From 8c4e989eb86eec83343aa3f9631946e1a30e9c19 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 27 Sep 2018 20:23:44 +0200 Subject: [PATCH 001/131] UnitsNet: 4.0.0-alpha1 --- .../UnitsNet.WindowsRuntimeComponent.nuspec | 2 +- UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs | 4 ++-- UnitsNet/UnitsNet.Common.props | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec index 403a2a45b0..51141ed5a7 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec @@ -2,7 +2,7 @@ UnitsNet.WindowsRuntimeComponent - 3.105.0 + 4.0.0-alpha1 Units.NET - Windows Runtime Component Andreas Gullberg Larsen Andreas Gullberg Larsen diff --git a/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs b/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs index 7267f0e1eb..4bfa15e002 100644 --- a/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs +++ b/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs @@ -38,6 +38,6 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("")] -[assembly: AssemblyVersion("3.105.0")] -[assembly: AssemblyFileVersion("3.105.0")] +[assembly: AssemblyVersion("4.0.0")] +[assembly: AssemblyFileVersion("4.0.0")] [assembly: InternalsVisibleTo("UnitsNet.WindowsRuntimeComponent.Tests")] diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index a6ba757600..db9043e866 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -2,7 +2,7 @@ UnitsNet - 3.105.0 + 4.0.0-alpha1 Andreas Gullberg Larsen Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. From 4baa18efe41cb7f6b0f4f0c2033db9364e2b1fc2 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 27 Sep 2018 20:23:55 +0200 Subject: [PATCH 002/131] JsonNet: 4.0.0-alpha1 --- .../UnitsNet.Serialization.JsonNet.Common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props index 0f1fd1b70d..5cc1cb1d6f 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props @@ -2,7 +2,7 @@ UnitsNet.Serialization.JsonNet - 1.3.0 + 4.0.0-alpha1 Andreas Gullberg Larsen Units.NET Serialization with Json.NET A helper library for serializing and deserializing types in Units.NET using Json.NET. From 3cb3efd57c5ed7cfdcaa361cdbdeb01f3e116e6a Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 27 Sep 2018 16:44:21 -0400 Subject: [PATCH 003/131] Removing obsolete quantity units --- .../Quantities/Duration.Common.g.cs | 46 - .../GeneratedCode/Quantities/Flow.Common.g.cs | 1026 ----------------- .../Quantities/Pressure.Common.g.cs | 23 - .../Quantities/TemperatureDelta.Common.g.cs | 184 --- .../Quantities/Volume.Common.g.cs | 46 - Common/UnitDefinitions/Duration.json | 34 - Common/UnitDefinitions/Flow.json | 263 ----- Common/UnitDefinitions/Pressure.json | 17 - Common/UnitDefinitions/TemperatureDelta.json | 104 -- Common/UnitDefinitions/Volume.json | 42 - UnitsNet.Tests/CustomCode/DurationTests.cs | 4 - UnitsNet.Tests/CustomCode/FlowTests.cs | 72 -- UnitsNet.Tests/CustomCode/LapseRateTests.cs | 8 +- UnitsNet.Tests/CustomCode/PressureTests.cs | 2 - .../CustomCode/TemperatureDeltaTests.cs | 9 - UnitsNet.Tests/CustomCode/VolumeTests.cs | 8 - .../GeneratedCode/DurationTestsBase.g.cs | 20 - .../GeneratedCode/FlowTestsBase.g.cs | 427 ------- .../GeneratedCode/PressureTestsBase.g.cs | 10 - .../TemperatureDeltaTestsBase.g.cs | 80 -- .../GeneratedCode/VolumeTestsBase.g.cs | 20 - UnitsNet.Tests/UnitSystemTests.cs | 18 +- .../Flow.WindowsRuntimeComponent.g.cs | 239 ---- .../CustomCode/Quantities/LapseRate.extra.cs | 4 +- .../Quantities/Temperature.extra.cs | 8 +- .../Quantities/TemperatureDelta.extra.cs | 2 +- .../Number/NumberToDurationExtensions.g.cs | 24 - .../Number/NumberToFlowExtensions.g.cs | 331 ------ .../Number/NumberToPressureExtensions.g.cs | 12 - .../NumberToTemperatureDeltaExtensions.g.cs | 96 -- .../Number/NumberToVolumeExtensions.g.cs | 24 - .../Quantities/Duration.NetFramework.g.cs | 18 - .../Quantities/Flow.NetFramework.g.cs | 528 --------- .../Quantities/Pressure.NetFramework.g.cs | 9 - .../TemperatureDelta.NetFramework.g.cs | 72 -- .../Quantities/Volume.NetFramework.g.cs | 18 - UnitsNet/GeneratedCode/QuantityType.g.cs | 1 - .../GeneratedCode/UnitSystem.Default.g.cs | 200 ---- .../GeneratedCode/Units/DurationUnit.g.cs | 4 - UnitsNet/GeneratedCode/Units/FlowUnit.g.cs | 93 -- .../GeneratedCode/Units/PressureUnit.g.cs | 2 - .../Units/TemperatureDeltaUnit.g.cs | 16 - UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs | 4 - 43 files changed, 19 insertions(+), 4149 deletions(-) delete mode 100644 Common/GeneratedCode/Quantities/Flow.Common.g.cs delete mode 100644 Common/UnitDefinitions/Flow.json delete mode 100644 UnitsNet.Tests/CustomCode/FlowTests.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Units/FlowUnit.g.cs diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 58ea15708b..a0593d34e1 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -186,12 +186,6 @@ public static BaseDimensions BaseDimensions /// public double Minutes => As(DurationUnit.Minute); - /// - /// Get Duration in Months. - /// - [System.Obsolete("Use Month30 instead, which makes it clear that this is an approximate unit based on 30 days per month. The duration of a month varies, but the Gregorian solar calendar has 365.2425/12 = 30.44 days on average.")] - public double Months => As(DurationUnit.Month); - /// /// Get Duration in Months30. /// @@ -212,12 +206,6 @@ public static BaseDimensions BaseDimensions /// public double Weeks => As(DurationUnit.Week); - /// - /// Get Duration in Years. - /// - [System.Obsolete("Use Year365 instead, which makes it clear that this is an approximate unit based on 365 days per year. The duration of a year varies due to corrections such as leap years, since a Gregorian solar calendar has 365.2425 days.")] - public double Years => As(DurationUnit.Year); - /// /// Get Duration in Years365. /// @@ -302,21 +290,6 @@ public static Duration FromMinutes(QuantityValue minutes) return new Duration(value, DurationUnit.Minute); } - /// - /// Get Duration from Months. - /// - [System.Obsolete("Use Month30 instead, which makes it clear that this is an approximate unit based on 30 days per month. The duration of a month varies, but the Gregorian solar calendar has 365.2425/12 = 30.44 days on average.")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromMonths(double months) -#else - public static Duration FromMonths(QuantityValue months) -#endif - { - double value = (double) months; - return new Duration(value, DurationUnit.Month); - } - /// /// Get Duration from Months30. /// @@ -373,21 +346,6 @@ public static Duration FromWeeks(QuantityValue weeks) return new Duration(value, DurationUnit.Week); } - /// - /// Get Duration from Years. - /// - [System.Obsolete("Use Year365 instead, which makes it clear that this is an approximate unit based on 365 days per year. The duration of a year varies due to corrections such as leap years, since a Gregorian solar calendar has 365.2425 days.")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromYears(double years) -#else - public static Duration FromYears(QuantityValue years) -#endif - { - double value = (double) years; - return new Duration(value, DurationUnit.Year); - } - /// /// Get Duration from Years365. /// @@ -579,12 +537,10 @@ private double AsBaseUnit() case DurationUnit.Microsecond: return (_value) * 1e-6d; case DurationUnit.Millisecond: return (_value) * 1e-3d; case DurationUnit.Minute: return _value*60; - case DurationUnit.Month: return _value*30*24*3600; case DurationUnit.Month30: return _value*30*24*3600; case DurationUnit.Nanosecond: return (_value) * 1e-9d; case DurationUnit.Second: return _value; case DurationUnit.Week: return _value*7*24*3600; - case DurationUnit.Year: return _value*365*24*3600; case DurationUnit.Year365: return _value*365*24*3600; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); @@ -605,12 +561,10 @@ private double AsBaseNumericType(DurationUnit unit) case DurationUnit.Microsecond: return (baseUnitValue) / 1e-6d; case DurationUnit.Millisecond: return (baseUnitValue) / 1e-3d; case DurationUnit.Minute: return baseUnitValue/60; - case DurationUnit.Month: return baseUnitValue/(30*24*3600); case DurationUnit.Month30: return baseUnitValue/(30*24*3600); case DurationUnit.Nanosecond: return (baseUnitValue) / 1e-9d; case DurationUnit.Second: return baseUnitValue; case DurationUnit.Week: return baseUnitValue/(7*24*3600); - case DurationUnit.Year: return baseUnitValue/(365*24*3600); case DurationUnit.Year365: return baseUnitValue/(365*24*3600); default: throw new NotImplementedException($"Can not convert {Unit} to {unit}."); diff --git a/Common/GeneratedCode/Quantities/Flow.Common.g.cs b/Common/GeneratedCode/Quantities/Flow.Common.g.cs deleted file mode 100644 index 92500edca9..0000000000 --- a/Common/GeneratedCode/Quantities/Flow.Common.g.cs +++ /dev/null @@ -1,1026 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. - /// - // ReSharper disable once PartialTypeWithSinglePart - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Flow : IQuantity -#else - public partial struct Flow : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly FlowUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public FlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Flow() - { - BaseDimensions = new BaseDimensions(3, 0, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given value in the base unit CubicMeterPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Flow(double cubicmeterspersecond) - { - _value = Convert.ToDouble(cubicmeterspersecond); - _unit = BaseUnit; - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// Numeric value. - /// Unit representation. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. -#if WINDOWS_UWP - private -#else - public -#endif - Flow(double numericValue, FlowUnit unit) - { - _value = numericValue; - _unit = unit; - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerSecond. - /// - /// Value assuming base unit CubicMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Flow(long cubicmeterspersecond) : this(Convert.ToDouble(cubicmeterspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerSecond. - /// - /// Value assuming base unit CubicMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Flow(decimal cubicmeterspersecond) : this(Convert.ToDouble(cubicmeterspersecond), BaseUnit) { } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Flow; - - /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. - /// - public static FlowUnit BaseUnit => FlowUnit.CubicMeterPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Flow quantity. - /// - public static FlowUnit[] Units { get; } = Enum.GetValues(typeof(FlowUnit)).Cast().Except(new FlowUnit[]{ FlowUnit.Undefined }).ToArray(); - - /// - /// Get Flow in CentilitersPerMinute. - /// - public double CentilitersPerMinute => As(FlowUnit.CentilitersPerMinute); - - /// - /// Get Flow in CubicDecimetersPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicDecimetersPerMinute => As(FlowUnit.CubicDecimeterPerMinute); - - /// - /// Get Flow in CubicFeetPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicFeetPerHour => As(FlowUnit.CubicFootPerHour); - - /// - /// Get Flow in CubicFeetPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicFeetPerMinute => As(FlowUnit.CubicFootPerMinute); - - /// - /// Get Flow in CubicFeetPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicFeetPerSecond => As(FlowUnit.CubicFootPerSecond); - - /// - /// Get Flow in CubicMetersPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicMetersPerHour => As(FlowUnit.CubicMeterPerHour); - - /// - /// Get Flow in CubicMetersPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicMetersPerMinute => As(FlowUnit.CubicMeterPerMinute); - - /// - /// Get Flow in CubicMetersPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicMetersPerSecond => As(FlowUnit.CubicMeterPerSecond); - - /// - /// Get Flow in CubicYardsPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicYardsPerHour => As(FlowUnit.CubicYardPerHour); - - /// - /// Get Flow in CubicYardsPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicYardsPerMinute => As(FlowUnit.CubicYardPerMinute); - - /// - /// Get Flow in CubicYardsPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double CubicYardsPerSecond => As(FlowUnit.CubicYardPerSecond); - - /// - /// Get Flow in DecilitersPerMinute. - /// - public double DecilitersPerMinute => As(FlowUnit.DecilitersPerMinute); - - /// - /// Get Flow in KilolitersPerMinute. - /// - public double KilolitersPerMinute => As(FlowUnit.KilolitersPerMinute); - - /// - /// Get Flow in LitersPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double LitersPerHour => As(FlowUnit.LitersPerHour); - - /// - /// Get Flow in LitersPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double LitersPerMinute => As(FlowUnit.LitersPerMinute); - - /// - /// Get Flow in LitersPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double LitersPerSecond => As(FlowUnit.LitersPerSecond); - - /// - /// Get Flow in MicrolitersPerMinute. - /// - public double MicrolitersPerMinute => As(FlowUnit.MicrolitersPerMinute); - - /// - /// Get Flow in MillilitersPerMinute. - /// - public double MillilitersPerMinute => As(FlowUnit.MillilitersPerMinute); - - /// - /// Get Flow in MillionUsGallonsPerDay. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double MillionUsGallonsPerDay => As(FlowUnit.MillionUsGallonsPerDay); - - /// - /// Get Flow in NanolitersPerMinute. - /// - public double NanolitersPerMinute => As(FlowUnit.NanolitersPerMinute); - - /// - /// Get Flow in OilBarrelsPerDay. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double OilBarrelsPerDay => As(FlowUnit.OilBarrelsPerDay); - - /// - /// Get Flow in UsGallonsPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double UsGallonsPerHour => As(FlowUnit.UsGallonsPerHour); - - /// - /// Get Flow in UsGallonsPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double UsGallonsPerMinute => As(FlowUnit.UsGallonsPerMinute); - - /// - /// Get Flow in UsGallonsPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public double UsGallonsPerSecond => As(FlowUnit.UsGallonsPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. - /// - public static Flow Zero => new Flow(0, BaseUnit); - - /// - /// Get Flow from CentilitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCentilitersPerMinute(double centilitersperminute) -#else - public static Flow FromCentilitersPerMinute(QuantityValue centilitersperminute) -#endif - { - double value = (double) centilitersperminute; - return new Flow(value, FlowUnit.CentilitersPerMinute); - } - - /// - /// Get Flow from CubicDecimetersPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) -#else - public static Flow FromCubicDecimetersPerMinute(QuantityValue cubicdecimetersperminute) -#endif - { - double value = (double) cubicdecimetersperminute; - return new Flow(value, FlowUnit.CubicDecimeterPerMinute); - } - - /// - /// Get Flow from CubicFeetPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicFeetPerHour(double cubicfeetperhour) -#else - public static Flow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) -#endif - { - double value = (double) cubicfeetperhour; - return new Flow(value, FlowUnit.CubicFootPerHour); - } - - /// - /// Get Flow from CubicFeetPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicFeetPerMinute(double cubicfeetperminute) -#else - public static Flow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute) -#endif - { - double value = (double) cubicfeetperminute; - return new Flow(value, FlowUnit.CubicFootPerMinute); - } - - /// - /// Get Flow from CubicFeetPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicFeetPerSecond(double cubicfeetpersecond) -#else - public static Flow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond) -#endif - { - double value = (double) cubicfeetpersecond; - return new Flow(value, FlowUnit.CubicFootPerSecond); - } - - /// - /// Get Flow from CubicMetersPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicMetersPerHour(double cubicmetersperhour) -#else - public static Flow FromCubicMetersPerHour(QuantityValue cubicmetersperhour) -#endif - { - double value = (double) cubicmetersperhour; - return new Flow(value, FlowUnit.CubicMeterPerHour); - } - - /// - /// Get Flow from CubicMetersPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicMetersPerMinute(double cubicmetersperminute) -#else - public static Flow FromCubicMetersPerMinute(QuantityValue cubicmetersperminute) -#endif - { - double value = (double) cubicmetersperminute; - return new Flow(value, FlowUnit.CubicMeterPerMinute); - } - - /// - /// Get Flow from CubicMetersPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicMetersPerSecond(double cubicmeterspersecond) -#else - public static Flow FromCubicMetersPerSecond(QuantityValue cubicmeterspersecond) -#endif - { - double value = (double) cubicmeterspersecond; - return new Flow(value, FlowUnit.CubicMeterPerSecond); - } - - /// - /// Get Flow from CubicYardsPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicYardsPerHour(double cubicyardsperhour) -#else - public static Flow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) -#endif - { - double value = (double) cubicyardsperhour; - return new Flow(value, FlowUnit.CubicYardPerHour); - } - - /// - /// Get Flow from CubicYardsPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicYardsPerMinute(double cubicyardsperminute) -#else - public static Flow FromCubicYardsPerMinute(QuantityValue cubicyardsperminute) -#endif - { - double value = (double) cubicyardsperminute; - return new Flow(value, FlowUnit.CubicYardPerMinute); - } - - /// - /// Get Flow from CubicYardsPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromCubicYardsPerSecond(double cubicyardspersecond) -#else - public static Flow FromCubicYardsPerSecond(QuantityValue cubicyardspersecond) -#endif - { - double value = (double) cubicyardspersecond; - return new Flow(value, FlowUnit.CubicYardPerSecond); - } - - /// - /// Get Flow from DecilitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromDecilitersPerMinute(double decilitersperminute) -#else - public static Flow FromDecilitersPerMinute(QuantityValue decilitersperminute) -#endif - { - double value = (double) decilitersperminute; - return new Flow(value, FlowUnit.DecilitersPerMinute); - } - - /// - /// Get Flow from KilolitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromKilolitersPerMinute(double kilolitersperminute) -#else - public static Flow FromKilolitersPerMinute(QuantityValue kilolitersperminute) -#endif - { - double value = (double) kilolitersperminute; - return new Flow(value, FlowUnit.KilolitersPerMinute); - } - - /// - /// Get Flow from LitersPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromLitersPerHour(double litersperhour) -#else - public static Flow FromLitersPerHour(QuantityValue litersperhour) -#endif - { - double value = (double) litersperhour; - return new Flow(value, FlowUnit.LitersPerHour); - } - - /// - /// Get Flow from LitersPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromLitersPerMinute(double litersperminute) -#else - public static Flow FromLitersPerMinute(QuantityValue litersperminute) -#endif - { - double value = (double) litersperminute; - return new Flow(value, FlowUnit.LitersPerMinute); - } - - /// - /// Get Flow from LitersPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromLitersPerSecond(double literspersecond) -#else - public static Flow FromLitersPerSecond(QuantityValue literspersecond) -#endif - { - double value = (double) literspersecond; - return new Flow(value, FlowUnit.LitersPerSecond); - } - - /// - /// Get Flow from MicrolitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromMicrolitersPerMinute(double microlitersperminute) -#else - public static Flow FromMicrolitersPerMinute(QuantityValue microlitersperminute) -#endif - { - double value = (double) microlitersperminute; - return new Flow(value, FlowUnit.MicrolitersPerMinute); - } - - /// - /// Get Flow from MillilitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromMillilitersPerMinute(double millilitersperminute) -#else - public static Flow FromMillilitersPerMinute(QuantityValue millilitersperminute) -#endif - { - double value = (double) millilitersperminute; - return new Flow(value, FlowUnit.MillilitersPerMinute); - } - - /// - /// Get Flow from MillionUsGallonsPerDay. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromMillionUsGallonsPerDay(double millionusgallonsperday) -#else - public static Flow FromMillionUsGallonsPerDay(QuantityValue millionusgallonsperday) -#endif - { - double value = (double) millionusgallonsperday; - return new Flow(value, FlowUnit.MillionUsGallonsPerDay); - } - - /// - /// Get Flow from NanolitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromNanolitersPerMinute(double nanolitersperminute) -#else - public static Flow FromNanolitersPerMinute(QuantityValue nanolitersperminute) -#endif - { - double value = (double) nanolitersperminute; - return new Flow(value, FlowUnit.NanolitersPerMinute); - } - - /// - /// Get Flow from OilBarrelsPerDay. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromOilBarrelsPerDay(double oilbarrelsperday) -#else - public static Flow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) -#endif - { - double value = (double) oilbarrelsperday; - return new Flow(value, FlowUnit.OilBarrelsPerDay); - } - - /// - /// Get Flow from UsGallonsPerHour. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromUsGallonsPerHour(double usgallonsperhour) -#else - public static Flow FromUsGallonsPerHour(QuantityValue usgallonsperhour) -#endif - { - double value = (double) usgallonsperhour; - return new Flow(value, FlowUnit.UsGallonsPerHour); - } - - /// - /// Get Flow from UsGallonsPerMinute. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromUsGallonsPerMinute(double usgallonsperminute) -#else - public static Flow FromUsGallonsPerMinute(QuantityValue usgallonsperminute) -#endif - { - double value = (double) usgallonsperminute; - return new Flow(value, FlowUnit.UsGallonsPerMinute); - } - - /// - /// Get Flow from UsGallonsPerSecond. - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Flow FromUsGallonsPerSecond(double usgallonspersecond) -#else - public static Flow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) -#endif - { - double value = (double) usgallonspersecond; - return new Flow(value, FlowUnit.UsGallonsPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Flow unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Flow From(double value, FlowUnit fromUnit) -#else - public static Flow From(QuantityValue value, FlowUnit fromUnit) -#endif - { - return new Flow((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(FlowUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Flow)) throw new ArgumentException("Expected type Flow.", nameof(obj)); - - return CompareTo((Flow)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Flow other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Flow)) - return false; - - var objQuantity = (Flow)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Flow within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Flow other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Compare equality to another Flow by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Flow, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Flow other, Flow maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Flow. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(FlowUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Flow to another Flow with the unit representation . - /// - /// A Flow with the specified unit. - public Flow ToUnit(FlowUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Flow(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case FlowUnit.CentilitersPerMinute: return (_value/60000.00000) * 1e-2d; - case FlowUnit.CubicDecimeterPerMinute: return _value/60000.00000; - case FlowUnit.CubicFootPerHour: return _value*7.8657907199999087346816086183876e-6; - case FlowUnit.CubicFootPerMinute: return _value/2118.88000326; - case FlowUnit.CubicFootPerSecond: return _value/35.314666721; - case FlowUnit.CubicMeterPerHour: return _value/3600; - case FlowUnit.CubicMeterPerMinute: return _value/60; - case FlowUnit.CubicMeterPerSecond: return _value; - case FlowUnit.CubicYardPerHour: return _value*2.1237634944E-4; - case FlowUnit.CubicYardPerMinute: return _value*0.0127425809664; - case FlowUnit.CubicYardPerSecond: return _value*0.764554857984; - case FlowUnit.DecilitersPerMinute: return (_value/60000.00000) * 1e-1d; - case FlowUnit.KilolitersPerMinute: return (_value/60000.00000) * 1e3d; - case FlowUnit.LitersPerHour: return _value/3600000.000; - case FlowUnit.LitersPerMinute: return _value/60000.00000; - case FlowUnit.LitersPerSecond: return _value/1000; - case FlowUnit.MicrolitersPerMinute: return (_value/60000.00000) * 1e-6d; - case FlowUnit.MillilitersPerMinute: return (_value/60000.00000) * 1e-3d; - case FlowUnit.MillionUsGallonsPerDay: return _value/22.824465227; - case FlowUnit.NanolitersPerMinute: return (_value/60000.00000) * 1e-9d; - case FlowUnit.OilBarrelsPerDay: return _value*1.8401307283333333333333333333333e-6; - case FlowUnit.UsGallonsPerHour: return _value/951019.38848933424; - case FlowUnit.UsGallonsPerMinute: return _value/15850.323141489; - case FlowUnit.UsGallonsPerSecond: return _value/264.1720523581484; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(FlowUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case FlowUnit.CentilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-2d; - case FlowUnit.CubicDecimeterPerMinute: return baseUnitValue*60000.00000; - case FlowUnit.CubicFootPerHour: return baseUnitValue/7.8657907199999087346816086183876e-6; - case FlowUnit.CubicFootPerMinute: return baseUnitValue*2118.88000326; - case FlowUnit.CubicFootPerSecond: return baseUnitValue*35.314666721; - case FlowUnit.CubicMeterPerHour: return baseUnitValue*3600; - case FlowUnit.CubicMeterPerMinute: return baseUnitValue*60; - case FlowUnit.CubicMeterPerSecond: return baseUnitValue; - case FlowUnit.CubicYardPerHour: return baseUnitValue/2.1237634944E-4; - case FlowUnit.CubicYardPerMinute: return baseUnitValue/0.0127425809664; - case FlowUnit.CubicYardPerSecond: return baseUnitValue/0.764554857984; - case FlowUnit.DecilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-1d; - case FlowUnit.KilolitersPerMinute: return (baseUnitValue*60000.00000) / 1e3d; - case FlowUnit.LitersPerHour: return baseUnitValue*3600000.000; - case FlowUnit.LitersPerMinute: return baseUnitValue*60000.00000; - case FlowUnit.LitersPerSecond: return baseUnitValue*1000; - case FlowUnit.MicrolitersPerMinute: return (baseUnitValue*60000.00000) / 1e-6d; - case FlowUnit.MillilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-3d; - case FlowUnit.MillionUsGallonsPerDay: return baseUnitValue*22.824465227; - case FlowUnit.NanolitersPerMinute: return (baseUnitValue*60000.00000) / 1e-9d; - case FlowUnit.OilBarrelsPerDay: return baseUnitValue/1.8401307283333333333333333333333e-6; - case FlowUnit.UsGallonsPerHour: return baseUnitValue*951019.38848933424; - case FlowUnit.UsGallonsPerMinute: return baseUnitValue*15850.323141489; - case FlowUnit.UsGallonsPerSecond: return baseUnitValue*264.1720523581484; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Flow Parse(string str) - { - return Parse(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Flow result) - { - return TryParse(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static FlowUnit ParseUnit(string str) - { - return ParseUnit(str, (IFormatProvider)null); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static FlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - - #endregion - - /// - /// Set the default unit used by ToString(). Default is CubicMeterPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static FlowUnit ToStringDefaultUnit { get; set; } = FlowUnit.CubicMeterPerSecond; - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(FlowUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Flow - /// - public static Flow MaxValue => new Flow(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Flow - /// - public static Flow MinValue => new Flow(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Flow.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Flow.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 26a39fe932..6eac7f04c4 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -321,12 +321,6 @@ public static BaseDimensions BaseDimensions /// public double PoundsForcePerSquareInch => As(PressureUnit.PoundForcePerSquareInch); - /// - /// Get Pressure in Psi. - /// - [System.Obsolete("Deprecated due to github issue #215, please use PoundForcePerSquareInch instead")] - public double Psi => As(PressureUnit.Psi); - /// /// Get Pressure in TechnicalAtmospheres. /// @@ -809,21 +803,6 @@ public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforceper return new Pressure(value, PressureUnit.PoundForcePerSquareInch); } - /// - /// Get Pressure from Psi. - /// - [System.Obsolete("Deprecated due to github issue #215, please use PoundForcePerSquareInch instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromPsi(double psi) -#else - public static Pressure FromPsi(QuantityValue psi) -#endif - { - double value = (double) psi; - return new Pressure(value, PressureUnit.Psi); - } - /// /// Get Pressure from TechnicalAtmospheres. /// @@ -1098,7 +1077,6 @@ private double AsBaseUnit() case PressureUnit.Pascal: return _value; case PressureUnit.PoundForcePerSquareFoot: return _value*4.788025898033584e1; case PressureUnit.PoundForcePerSquareInch: return _value*6.894757293168361e3; - case PressureUnit.Psi: return _value*6.894757293168361e3; case PressureUnit.TechnicalAtmosphere: return _value*9.80680592331*1e4; case PressureUnit.TonneForcePerSquareCentimeter: return _value*9.80665e7; case PressureUnit.TonneForcePerSquareMeter: return _value*9.80665e3; @@ -1150,7 +1128,6 @@ private double AsBaseNumericType(PressureUnit unit) case PressureUnit.Pascal: return baseUnitValue; case PressureUnit.PoundForcePerSquareFoot: return baseUnitValue/4.788025898033584e1; case PressureUnit.PoundForcePerSquareInch: return baseUnitValue/6.894757293168361e3; - case PressureUnit.Psi: return baseUnitValue/6.894757293168361e3; case PressureUnit.TechnicalAtmosphere: return baseUnitValue/(9.80680592331*1e4); case PressureUnit.TonneForcePerSquareCentimeter: return baseUnitValue/9.80665e7; case PressureUnit.TonneForcePerSquareMeter: return baseUnitValue/9.80665e3; diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index f450738404..fd837da213 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -165,89 +165,41 @@ public static BaseDimensions BaseDimensions /// public double DegreesCelsius => As(TemperatureDeltaUnit.DegreeCelsius); - /// - /// Get TemperatureDelta in DegreesCelsiusDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeCelsius instead")] - public double DegreesCelsiusDelta => As(TemperatureDeltaUnit.DegreeCelsiusDelta); - /// /// Get TemperatureDelta in DegreesDelisle. /// public double DegreesDelisle => As(TemperatureDeltaUnit.DegreeDelisle); - /// - /// Get TemperatureDelta in DegreesDelisleDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeDelisle instead")] - public double DegreesDelisleDelta => As(TemperatureDeltaUnit.DegreeDelisleDelta); - /// /// Get TemperatureDelta in DegreesFahrenheit. /// public double DegreesFahrenheit => As(TemperatureDeltaUnit.DegreeFahrenheit); - /// - /// Get TemperatureDelta in DegreesFahrenheitDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeFahrenheit instead")] - public double DegreesFahrenheitDelta => As(TemperatureDeltaUnit.DegreeFahrenheitDelta); - /// /// Get TemperatureDelta in DegreesNewton. /// public double DegreesNewton => As(TemperatureDeltaUnit.DegreeNewton); - /// - /// Get TemperatureDelta in DegreesNewtonDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeNewton instead")] - public double DegreesNewtonDelta => As(TemperatureDeltaUnit.DegreeNewtonDelta); - /// /// Get TemperatureDelta in DegreesRankine. /// public double DegreesRankine => As(TemperatureDeltaUnit.DegreeRankine); - /// - /// Get TemperatureDelta in DegreesRankineDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRankine instead")] - public double DegreesRankineDelta => As(TemperatureDeltaUnit.DegreeRankineDelta); - /// /// Get TemperatureDelta in DegreesReaumur. /// public double DegreesReaumur => As(TemperatureDeltaUnit.DegreeReaumur); - /// - /// Get TemperatureDelta in DegreesReaumurDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeReaumur instead")] - public double DegreesReaumurDelta => As(TemperatureDeltaUnit.DegreeReaumurDelta); - /// /// Get TemperatureDelta in DegreesRoemer. /// public double DegreesRoemer => As(TemperatureDeltaUnit.DegreeRoemer); - /// - /// Get TemperatureDelta in DegreesRoemerDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRoemer instead")] - public double DegreesRoemerDelta => As(TemperatureDeltaUnit.DegreeRoemerDelta); - /// /// Get TemperatureDelta in Kelvins. /// public double Kelvins => As(TemperatureDeltaUnit.Kelvin); - /// - /// Get TemperatureDelta in KelvinsDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use Kelvin instead")] - public double KelvinsDelta => As(TemperatureDeltaUnit.KelvinDelta); - #endregion #region Static @@ -271,21 +223,6 @@ public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsius); } - /// - /// Get TemperatureDelta from DegreesCelsiusDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeCelsius instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesCelsiusDelta(double degreescelsiusdelta) -#else - public static TemperatureDelta FromDegreesCelsiusDelta(QuantityValue degreescelsiusdelta) -#endif - { - double value = (double) degreescelsiusdelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsiusDelta); - } - /// /// Get TemperatureDelta from DegreesDelisle. /// @@ -300,21 +237,6 @@ public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisle); } - /// - /// Get TemperatureDelta from DegreesDelisleDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeDelisle instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesDelisleDelta(double degreesdelisledelta) -#else - public static TemperatureDelta FromDegreesDelisleDelta(QuantityValue degreesdelisledelta) -#endif - { - double value = (double) degreesdelisledelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisleDelta); - } - /// /// Get TemperatureDelta from DegreesFahrenheit. /// @@ -329,21 +251,6 @@ public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahren return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheit); } - /// - /// Get TemperatureDelta from DegreesFahrenheitDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeFahrenheit instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesFahrenheitDelta(double degreesfahrenheitdelta) -#else - public static TemperatureDelta FromDegreesFahrenheitDelta(QuantityValue degreesfahrenheitdelta) -#endif - { - double value = (double) degreesfahrenheitdelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheitDelta); - } - /// /// Get TemperatureDelta from DegreesNewton. /// @@ -358,21 +265,6 @@ public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewton); } - /// - /// Get TemperatureDelta from DegreesNewtonDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeNewton instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesNewtonDelta(double degreesnewtondelta) -#else - public static TemperatureDelta FromDegreesNewtonDelta(QuantityValue degreesnewtondelta) -#endif - { - double value = (double) degreesnewtondelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewtonDelta); - } - /// /// Get TemperatureDelta from DegreesRankine. /// @@ -387,21 +279,6 @@ public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankine); } - /// - /// Get TemperatureDelta from DegreesRankineDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRankine instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesRankineDelta(double degreesrankinedelta) -#else - public static TemperatureDelta FromDegreesRankineDelta(QuantityValue degreesrankinedelta) -#endif - { - double value = (double) degreesrankinedelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankineDelta); - } - /// /// Get TemperatureDelta from DegreesReaumur. /// @@ -416,21 +293,6 @@ public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumur); } - /// - /// Get TemperatureDelta from DegreesReaumurDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeReaumur instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesReaumurDelta(double degreesreaumurdelta) -#else - public static TemperatureDelta FromDegreesReaumurDelta(QuantityValue degreesreaumurdelta) -#endif - { - double value = (double) degreesreaumurdelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumurDelta); - } - /// /// Get TemperatureDelta from DegreesRoemer. /// @@ -445,21 +307,6 @@ public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemer); } - /// - /// Get TemperatureDelta from DegreesRoemerDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRoemer instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesRoemerDelta(double degreesroemerdelta) -#else - public static TemperatureDelta FromDegreesRoemerDelta(QuantityValue degreesroemerdelta) -#endif - { - double value = (double) degreesroemerdelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemerDelta); - } - /// /// Get TemperatureDelta from Kelvins. /// @@ -474,21 +321,6 @@ public static TemperatureDelta FromKelvins(QuantityValue kelvins) return new TemperatureDelta(value, TemperatureDeltaUnit.Kelvin); } - /// - /// Get TemperatureDelta from KelvinsDelta. - /// - [System.Obsolete("Deprecated due to github issue #180, please use Kelvin instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromKelvinsDelta(double kelvinsdelta) -#else - public static TemperatureDelta FromKelvinsDelta(QuantityValue kelvinsdelta) -#endif - { - double value = (double) kelvinsdelta; - return new TemperatureDelta(value, TemperatureDeltaUnit.KelvinDelta); - } - /// /// Dynamically convert from value and unit enum to . @@ -662,21 +494,13 @@ private double AsBaseUnit() switch(Unit) { case TemperatureDeltaUnit.DegreeCelsius: return _value; - case TemperatureDeltaUnit.DegreeCelsiusDelta: return _value; case TemperatureDeltaUnit.DegreeDelisle: return _value*-2/3; - case TemperatureDeltaUnit.DegreeDelisleDelta: return _value*-2/3; case TemperatureDeltaUnit.DegreeFahrenheit: return _value*5/9; - case TemperatureDeltaUnit.DegreeFahrenheitDelta: return _value*5/9; case TemperatureDeltaUnit.DegreeNewton: return _value*100/33; - case TemperatureDeltaUnit.DegreeNewtonDelta: return _value*100/33; case TemperatureDeltaUnit.DegreeRankine: return _value*5/9; - case TemperatureDeltaUnit.DegreeRankineDelta: return _value*5/9; case TemperatureDeltaUnit.DegreeReaumur: return _value*5/4; - case TemperatureDeltaUnit.DegreeReaumurDelta: return _value*5/4; case TemperatureDeltaUnit.DegreeRoemer: return _value*40/21; - case TemperatureDeltaUnit.DegreeRoemerDelta: return _value*40/21; case TemperatureDeltaUnit.Kelvin: return _value; - case TemperatureDeltaUnit.KelvinDelta: return _value; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -692,21 +516,13 @@ private double AsBaseNumericType(TemperatureDeltaUnit unit) switch(unit) { case TemperatureDeltaUnit.DegreeCelsius: return baseUnitValue; - case TemperatureDeltaUnit.DegreeCelsiusDelta: return baseUnitValue; case TemperatureDeltaUnit.DegreeDelisle: return baseUnitValue*-3/2; - case TemperatureDeltaUnit.DegreeDelisleDelta: return baseUnitValue*-3/2; case TemperatureDeltaUnit.DegreeFahrenheit: return baseUnitValue*9/5; - case TemperatureDeltaUnit.DegreeFahrenheitDelta: return baseUnitValue*9/5; case TemperatureDeltaUnit.DegreeNewton: return baseUnitValue*33/100; - case TemperatureDeltaUnit.DegreeNewtonDelta: return baseUnitValue*33/100; case TemperatureDeltaUnit.DegreeRankine: return baseUnitValue*9/5; - case TemperatureDeltaUnit.DegreeRankineDelta: return baseUnitValue*9/5; case TemperatureDeltaUnit.DegreeReaumur: return baseUnitValue*4/5; - case TemperatureDeltaUnit.DegreeReaumurDelta: return baseUnitValue*4/5; case TemperatureDeltaUnit.DegreeRoemer: return baseUnitValue*21/40; - case TemperatureDeltaUnit.DegreeRoemerDelta: return baseUnitValue*21/40; case TemperatureDeltaUnit.Kelvin: return baseUnitValue; - case TemperatureDeltaUnit.KelvinDelta: return baseUnitValue; default: throw new NotImplementedException($"Can not convert {Unit} to {unit}."); } diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 7af8d0bd50..0d028f51ab 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -321,18 +321,6 @@ public static BaseDimensions BaseDimensions /// public double OilBarrels => As(VolumeUnit.OilBarrel); - /// - /// Get Volume in Tablespoons. - /// - [System.Obsolete("Deprecated due to github issue #134, please use UsTablespoon instead")] - public double Tablespoons => As(VolumeUnit.Tablespoon); - - /// - /// Get Volume in Teaspoons. - /// - [System.Obsolete("Deprecated due to github issue #134, please use UsTeaspoon instead")] - public double Teaspoons => As(VolumeUnit.Teaspoon); - /// /// Get Volume in UkTablespoons. /// @@ -840,36 +828,6 @@ public static Volume FromOilBarrels(QuantityValue oilbarrels) return new Volume(value, VolumeUnit.OilBarrel); } - /// - /// Get Volume from Tablespoons. - /// - [System.Obsolete("Deprecated due to github issue #134, please use UsTablespoon instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromTablespoons(double tablespoons) -#else - public static Volume FromTablespoons(QuantityValue tablespoons) -#endif - { - double value = (double) tablespoons; - return new Volume(value, VolumeUnit.Tablespoon); - } - - /// - /// Get Volume from Teaspoons. - /// - [System.Obsolete("Deprecated due to github issue #134, please use UsTeaspoon instead")] -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromTeaspoons(double teaspoons) -#else - public static Volume FromTeaspoons(QuantityValue teaspoons) -#endif - { - double value = (double) teaspoons; - return new Volume(value, VolumeUnit.Teaspoon); - } - /// /// Get Volume from UkTablespoons. /// @@ -1214,8 +1172,6 @@ private double AsBaseUnit() case VolumeUnit.Microliter: return (_value/1e3) * 1e-6d; case VolumeUnit.Milliliter: return (_value/1e3) * 1e-3d; case VolumeUnit.OilBarrel: return _value*0.158987294928; - case VolumeUnit.Tablespoon: return _value*1.478676478125e-5; - case VolumeUnit.Teaspoon: return _value*4.92892159375e-6; case VolumeUnit.UkTablespoon: return _value*1.5e-5; case VolumeUnit.UsBeerBarrel: return _value*0.1173477658; case VolumeUnit.UsCustomaryCup: return _value*0.0002365882365; @@ -1272,8 +1228,6 @@ private double AsBaseNumericType(VolumeUnit unit) case VolumeUnit.Microliter: return (baseUnitValue*1e3) / 1e-6d; case VolumeUnit.Milliliter: return (baseUnitValue*1e3) / 1e-3d; case VolumeUnit.OilBarrel: return baseUnitValue/0.158987294928; - case VolumeUnit.Tablespoon: return baseUnitValue/1.478676478125e-5; - case VolumeUnit.Teaspoon: return baseUnitValue/4.92892159375e-6; case VolumeUnit.UkTablespoon: return baseUnitValue/1.5e-5; case VolumeUnit.UsBeerBarrel: return baseUnitValue/0.1173477658; case VolumeUnit.UsCustomaryCup: return baseUnitValue/0.0002365882365; diff --git a/Common/UnitDefinitions/Duration.json b/Common/UnitDefinitions/Duration.json index ad19f0f063..7343405e0e 100644 --- a/Common/UnitDefinitions/Duration.json +++ b/Common/UnitDefinitions/Duration.json @@ -6,23 +6,6 @@ "T": 1 }, "Units": [ - { - "ObsoleteText": "Use Year365 instead, which makes it clear that this is an approximate unit based on 365 days per year. The duration of a year varies due to corrections such as leap years, since a Gregorian solar calendar has 365.2425 days.", - "SingularName": "Year", - "PluralName": "Years", - "FromUnitToBaseFunc": "x*365*24*3600", - "FromBaseToUnitFunc": "x/(365*24*3600)", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "yr", "year", "years" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "год" ] - } - ] - }, { "SingularName": "Year365", "PluralName": "Years365", @@ -39,23 +22,6 @@ } ] }, - { - "ObsoleteText": "Use Month30 instead, which makes it clear that this is an approximate unit based on 30 days per month. The duration of a month varies, but the Gregorian solar calendar has 365.2425/12 = 30.44 days on average.", - "SingularName": "Month", - "PluralName": "Months", - "FromUnitToBaseFunc": "x*30*24*3600", - "FromBaseToUnitFunc": "x/(30*24*3600)", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "mo", "month", "months" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "месяц" ] - } - ] - }, { "SingularName": "Month30", "PluralName": "Months30", diff --git a/Common/UnitDefinitions/Flow.json b/Common/UnitDefinitions/Flow.json deleted file mode 100644 index 2b4918d122..0000000000 --- a/Common/UnitDefinitions/Flow.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "Name": "Flow", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "BaseUnit": "CubicMeterPerSecond", - "XmlDoc": "In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q.", - "BaseDimensions": { - "L": 3, - "T": -1 - }, - "Units": [ - { - "SingularName": "CubicMeterPerSecond", - "PluralName": "CubicMetersPerSecond", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x", - "FromBaseToUnitFunc": "x", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "m³/s" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "м³/с" ] - } - ] - }, - { - "SingularName": "CubicMeterPerMinute", - "PluralName": "CubicMetersPerMinute", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/60", - "FromBaseToUnitFunc": "x*60", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "m³/min" ] - } - ] - }, - { - "SingularName": "CubicMeterPerHour", - "PluralName": "CubicMetersPerHour", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/3600", - "FromBaseToUnitFunc": "x*3600", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "m³/h" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "м³/ч" ] - } - ] - }, - { - "SingularName": "CubicFootPerSecond", - "PluralName": "CubicFeetPerSecond", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/35.314666721", - "FromBaseToUnitFunc": "x*35.314666721", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "ft³/s" ] - } - ] - }, - { - "SingularName": "CubicFootPerMinute", - "PluralName": "CubicFeetPerMinute", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/2118.88000326", - "FromBaseToUnitFunc": "x*2118.88000326", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "ft³/min" ] - } - ] - }, - { - "SingularName": "CubicFootPerHour", - "PluralName": "CubicFeetPerHour", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x*7.8657907199999087346816086183876e-6", - "FromBaseToUnitFunc": "x/7.8657907199999087346816086183876e-6", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "ft³/h", "cf/hr" ] - } - ] - }, - { - "SingularName": "CubicYardPerSecond", - "PluralName": "CubicYardsPerSecond", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x*0.764554857984", - "FromBaseToUnitFunc": "x/0.764554857984", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "yd³/s" ] - } - ] - }, - { - "SingularName": "CubicYardPerMinute", - "PluralName": "CubicYardsPerMinute", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x*0.0127425809664", - "FromBaseToUnitFunc": "x/0.0127425809664", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "yd³/min" ] - } - ] - }, - { - "SingularName": "CubicYardPerHour", - "PluralName": "CubicYardsPerHour", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x*2.1237634944E-4", - "FromBaseToUnitFunc": "x/2.1237634944E-4", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "yd³/h" ] - } - ] - }, - { - "SingularName": "MillionUsGallonsPerDay", - "PluralName": "MillionUsGallonsPerDay", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/22.824465227", - "FromBaseToUnitFunc": "x*22.824465227", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "MGD" ] - } - ] - }, - { - "SingularName": "LitersPerSecond", - "PluralName": "LitersPerSecond", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/1000", - "FromBaseToUnitFunc": "x*1000", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "LPS" ] - } - ] - }, - { - "SingularName": "LitersPerMinute", - "PluralName": "LitersPerMinute", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/60000.00000", - "FromBaseToUnitFunc": "x*60000.00000", - "Prefixes": [ "Nano", "Micro", "Milli", "Centi", "Deci", "Kilo" ], - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "LPM" ] - } - ] - }, - { - "SingularName": "LitersPerHour", - "PluralName": "LitersPerHour", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/3600000.000", - "FromBaseToUnitFunc": "x*3600000.000", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "LPH" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "л/ч" ] - } - ] - }, - { - "SingularName": "UsGallonsPerSecond", - "PluralName": "UsGallonsPerSecond", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/264.1720523581484", - "FromBaseToUnitFunc": "x*264.1720523581484", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "gal (U.S.)/s" ] - } - ] - }, - { - "SingularName": "UsGallonsPerMinute", - "PluralName": "UsGallonsPerMinute", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/15850.323141489", - "FromBaseToUnitFunc": "x*15850.323141489", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "gal (U.S.)/min", "GPM" ] - } - ] - }, - { - "SingularName": "UsGallonsPerHour", - "PluralName": "UsGallonsPerHour", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/951019.38848933424", - "FromBaseToUnitFunc": "x*951019.38848933424", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "gal (U.S.)/h" ] - } - ] - }, - { - "SingularName": "CubicDecimeterPerMinute", - "PluralName": "CubicDecimetersPerMinute", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x/60000.00000", - "FromBaseToUnitFunc": "x*60000.00000", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "dm³/min" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "дм³/мин" ] - } - ] - }, - { - "SingularName": "OilBarrelsPerDay", - "PluralName": "OilBarrelsPerDay", - "ObsoleteText": "Deprecated due to github issue #363, please use VolumeFlow instead", - "FromUnitToBaseFunc": "x*1.8401307283333333333333333333333e-6", - "FromBaseToUnitFunc": "x/1.8401307283333333333333333333333e-6", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "bbl/d", "BOPD" ] - } - ] - } - ] -} diff --git a/Common/UnitDefinitions/Pressure.json b/Common/UnitDefinitions/Pressure.json index 7651a70e07..753a76b58a 100644 --- a/Common/UnitDefinitions/Pressure.json +++ b/Common/UnitDefinitions/Pressure.json @@ -161,23 +161,6 @@ } ] }, - { - "SingularName": "Psi", - "PluralName": "Psi", - "ObsoleteText": "Deprecated due to github issue #215, please use PoundForcePerSquareInch instead", - "FromUnitToBaseFunc": "x*6.894757293168361e3", - "FromBaseToUnitFunc": "x/6.894757293168361e3", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "psi" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "psi" ] - } - ] - }, { "SingularName": "TechnicalAtmosphere", "PluralName": "TechnicalAtmospheres", diff --git a/Common/UnitDefinitions/TemperatureDelta.json b/Common/UnitDefinitions/TemperatureDelta.json index 771f916667..34b37da1ea 100644 --- a/Common/UnitDefinitions/TemperatureDelta.json +++ b/Common/UnitDefinitions/TemperatureDelta.json @@ -98,110 +98,6 @@ "Abbreviations": [ "∆°Rø" ] } ] - }, - { - "SingularName": "KelvinDelta", - "PluralName": "KelvinsDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use Kelvin instead", - "FromUnitToBaseFunc": "x", - "FromBaseToUnitFunc": "x", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆K" ] - } - ] - }, - { - "SingularName": "DegreeCelsiusDelta", - "PluralName": "DegreesCelsiusDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use DegreeCelsius instead", - "FromUnitToBaseFunc": "x", - "FromBaseToUnitFunc": "x", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆°C" ] - } - ] - }, - { - "SingularName": "DegreeDelisleDelta", - "PluralName": "DegreesDelisleDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use DegreeDelisle instead", - "FromUnitToBaseFunc": "x*-2/3", - "FromBaseToUnitFunc": "x*-3/2", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆°De" ] - } - ] - }, - { - "SingularName": "DegreeFahrenheitDelta", - "PluralName": "DegreesFahrenheitDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use DegreeFahrenheit instead", - "FromUnitToBaseFunc": "x*5/9", - "FromBaseToUnitFunc": "x*9/5", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆°F" ] - } - ] - }, - { - "SingularName": "DegreeNewtonDelta", - "PluralName": "DegreesNewtonDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use DegreeNewton instead", - "FromUnitToBaseFunc": "x*100/33", - "FromBaseToUnitFunc": "x*33/100", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆°N" ] - } - ] - }, - { - "SingularName": "DegreeRankineDelta", - "PluralName": "DegreesRankineDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use DegreeRankine instead", - "FromUnitToBaseFunc": "x*5/9", - "FromBaseToUnitFunc": "x*9/5", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆°R" ] - } - ] - }, - { - "SingularName": "DegreeReaumurDelta", - "PluralName": "DegreesReaumurDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use DegreeReaumur instead", - "FromUnitToBaseFunc": "x*5/4", - "FromBaseToUnitFunc": "x*4/5", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆°Ré" ] - } - ] - }, - { - "SingularName": "DegreeRoemerDelta", - "PluralName": "DegreesRoemerDelta", - "ObsoleteText": "Deprecated due to github issue #180, please use DegreeRoemer instead", - "FromUnitToBaseFunc": "x*40/21", - "FromBaseToUnitFunc": "x*21/40", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "∆°Rø" ] - } - ] } ] } \ No newline at end of file diff --git a/Common/UnitDefinitions/Volume.json b/Common/UnitDefinitions/Volume.json index 013540c76b..1b2c417995 100644 --- a/Common/UnitDefinitions/Volume.json +++ b/Common/UnitDefinitions/Volume.json @@ -252,48 +252,6 @@ } ] }, - { - "SingularName": "Tablespoon", - "PluralName": "Tablespoons", - "ObsoleteText": "Deprecated due to github issue #134, please use UsTablespoon instead", - "FromUnitToBaseFunc": "x*1.478676478125e-5", - "FromBaseToUnitFunc": "x/1.478676478125e-5", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "Tbsp", "Tbs", "T", "tb", "tbs", "tbsp", "tblsp", "tblspn", "Tbsp.", "Tbs.", "T.", "tb.", "tbs.", "tbsp.", "tblsp.", "tblspn.", "tablespoon", "Tablespoon" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "столовая ложка" ] - }, - { - "Culture": "nb-NO", - "Abbreviations": [ "ss", "ss.", "SS", "SS." ] - } - ] - }, - { - "SingularName": "Teaspoon", - "PluralName": "Teaspoons", - "ObsoleteText": "Deprecated due to github issue #134, please use UsTeaspoon instead", - "FromUnitToBaseFunc": "x*4.92892159375e-6", - "FromBaseToUnitFunc": "x/4.92892159375e-6", - "Localization": [ - { - "Culture": "en-US", - "Abbreviations": [ "tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon" ] - }, - { - "Culture": "ru-RU", - "Abbreviations": [ "чайная ложка" ] - }, - { - "Culture": "nb-NO", - "Abbreviations": [ "ts", "ts." ] - } - ] - }, { "SingularName": "UsTablespoon", "PluralName": "UsTablespoons", diff --git a/UnitsNet.Tests/CustomCode/DurationTests.cs b/UnitsNet.Tests/CustomCode/DurationTests.cs index 4ad5c3338e..f99439a482 100644 --- a/UnitsNet.Tests/CustomCode/DurationTests.cs +++ b/UnitsNet.Tests/CustomCode/DurationTests.cs @@ -36,8 +36,6 @@ public class DurationTests : DurationTestsBase protected override double MinutesInOneSecond => 0.0166667; - protected override double MonthsInOneSecond => 3.858024691358024e-7; - protected override double Months30InOneSecond => 3.858024691358024e-7; protected override double NanosecondsInOneSecond => 1e+9; @@ -46,8 +44,6 @@ public class DurationTests : DurationTestsBase protected override double WeeksInOneSecond => 1.653439153439153e-6; - protected override double YearsInOneSecond => 3.170979198376458e-8; - protected override double Years365InOneSecond => 3.170979198376458e-8; [Fact] diff --git a/UnitsNet.Tests/CustomCode/FlowTests.cs b/UnitsNet.Tests/CustomCode/FlowTests.cs deleted file mode 100644 index 9742af1064..0000000000 --- a/UnitsNet.Tests/CustomCode/FlowTests.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -namespace UnitsNet.Tests.CustomCode -{ - public class FlowTests : FlowTestsBase - { - protected override double CubicMetersPerHourInOneCubicMeterPerSecond => 3600.0; - - protected override double CubicDecimetersPerMinuteInOneCubicMeterPerSecond => 60000.00000; - - protected override double CubicFeetPerHourInOneCubicMeterPerSecond => 1.271328001973604e+5; - - protected override double CubicFeetPerSecondInOneCubicMeterPerSecond => 35.314666721489; - - protected override double MillionUsGallonsPerDayInOneCubicMeterPerSecond => 22.824465227; - - protected override double CubicMetersPerSecondInOneCubicMeterPerSecond => 1; - - protected override double UsGallonsPerMinuteInOneCubicMeterPerSecond => 15850.323141489; - protected override double LitersPerHourInOneCubicMeterPerSecond => 3600000; - - protected override double LitersPerMinuteInOneCubicMeterPerSecond => 60000.00000; - - protected override double NanolitersPerMinuteInOneCubicMeterPerSecond => 60000000000000.00000; - protected override double LitersPerSecondInOneCubicMeterPerSecond => 1000; - - protected override double MicrolitersPerMinuteInOneCubicMeterPerSecond => 60000000000.00000; - - protected override double MillilitersPerMinuteInOneCubicMeterPerSecond => 60000000.00000; - - protected override double CentilitersPerMinuteInOneCubicMeterPerSecond => 6000000.00000; - - protected override double DecilitersPerMinuteInOneCubicMeterPerSecond => 600000.00000; - - protected override double KilolitersPerMinuteInOneCubicMeterPerSecond => 60.00000; - - protected override double OilBarrelsPerDayInOneCubicMeterPerSecond => 543439.65056533388306722269588172; - - protected override double CubicFeetPerMinuteInOneCubicMeterPerSecond => 2.11888E3; - - protected override double CubicMetersPerMinuteInOneCubicMeterPerSecond => 6.0E1; - - protected override double CubicYardsPerHourInOneCubicMeterPerSecond => 4.708622232E3; - - protected override double CubicYardsPerMinuteInOneCubicMeterPerSecond => 7.84770372E1; - - protected override double CubicYardsPerSecondInOneCubicMeterPerSecond => 1.30795062; - - protected override double UsGallonsPerHourInOneCubicMeterPerSecond => 9.510193884893328E5; - - protected override double UsGallonsPerSecondInOneCubicMeterPerSecond => 2.64172052358148E2; - } -} \ No newline at end of file diff --git a/UnitsNet.Tests/CustomCode/LapseRateTests.cs b/UnitsNet.Tests/CustomCode/LapseRateTests.cs index 4ae15baa1e..e78920162e 100644 --- a/UnitsNet.Tests/CustomCode/LapseRateTests.cs +++ b/UnitsNet.Tests/CustomCode/LapseRateTests.cs @@ -52,14 +52,14 @@ public class LapseRateTests : LapseRateTestsBase [Fact] public void TemperatureDeltaDividedByLapseRateEqualsLength() { - Length length = TemperatureDelta.FromDegreesCelsiusDelta(50) / LapseRate.FromDegreesCelciusPerKilometer(5); + Length length = TemperatureDelta.FromDegreesCelsius(50) / LapseRate.FromDegreesCelciusPerKilometer(5); Assert.Equal(length, Length.FromKilometers(10)); } [Fact] public void TemperatureDeltaDividedByLengthEqualsLapseRate() { - LapseRate lapseRate = TemperatureDelta.FromDegreesCelsiusDelta(50) / Length.FromKilometers(10); + LapseRate lapseRate = TemperatureDelta.FromDegreesCelsius(50) / Length.FromKilometers(10); Assert.Equal(lapseRate, LapseRate.FromDegreesCelciusPerKilometer(5)); } @@ -67,14 +67,14 @@ public void TemperatureDeltaDividedByLengthEqualsLapseRate() public void LengthMultipliedByLapseRateEqualsTemperatureDelta() { TemperatureDelta temperatureDelta = Length.FromKilometers(10) * LapseRate.FromDegreesCelciusPerKilometer(5); - Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsiusDelta(50)); + Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); } [Fact] public void LapseRateMultipliedByLengthEqualsTemperatureDelta() { TemperatureDelta temperatureDelta = LapseRate.FromDegreesCelciusPerKilometer(5) * Length.FromKilometers(10); - Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsiusDelta(50)); + Assert.Equal(temperatureDelta, TemperatureDelta.FromDegreesCelsius(50)); } } } diff --git a/UnitsNet.Tests/CustomCode/PressureTests.cs b/UnitsNet.Tests/CustomCode/PressureTests.cs index bf6b3d4bd2..da37b8d7dc 100644 --- a/UnitsNet.Tests/CustomCode/PressureTests.cs +++ b/UnitsNet.Tests/CustomCode/PressureTests.cs @@ -66,8 +66,6 @@ public class PressureTests : PressureTestsBase protected override double PoundsForcePerSquareInchInOnePascal => 1.450377377302092e-4; - protected override double PsiInOnePascal => 1.450377377302092e-4; - protected override double TechnicalAtmospheresInOnePascal => 1.0197*1E-5; protected override double TonnesForcePerSquareCentimeterInOnePascal => 1.019716212977928e-8; diff --git a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs index d1254bc451..ae78d91649 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs @@ -45,15 +45,6 @@ namespace UnitsNet.Tests.CustomCode { public class TemperatureDeltaTests : TemperatureDeltaTestsBase { - protected override double DegreesCelsiusDeltaInOneKelvin => 1; - protected override double DegreesDelisleDeltaInOneKelvin => -1.5d; - protected override double DegreesFahrenheitDeltaInOneKelvin => 1.8; - protected override double DegreesNewtonDeltaInOneKelvin => 0.33d; - protected override double DegreesRankineDeltaInOneKelvin => 1.8; - protected override double DegreesReaumurDeltaInOneKelvin => 0.8; - protected override double DegreesRoemerDeltaInOneKelvin => 21/40d; - protected override double KelvinsDeltaInOneKelvin => 1; - protected override double DegreesCelsiusInOneKelvin => 1; protected override double DegreesDelisleInOneKelvin => -1.5d; protected override double DegreesFahrenheitInOneKelvin => 1.8; diff --git a/UnitsNet.Tests/CustomCode/VolumeTests.cs b/UnitsNet.Tests/CustomCode/VolumeTests.cs index 649c0e2ca1..3ab757796a 100644 --- a/UnitsNet.Tests/CustomCode/VolumeTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeTests.cs @@ -75,25 +75,17 @@ public class VolumeTests : VolumeTestsBase protected override double AuTablespoonsInOneCubicMeter => 50000; protected override double UsTablespoonsInOneCubicMeter => 67628.0454; - - protected override double TablespoonsInOneCubicMeter => 67628.0454; - - protected override double TablespoonsTolerance => 1E-4; protected override double MetricTeaspoonsInOneCubicMeter => 200000; protected override double UsTeaspoonsInOneCubicMeter => 202884.13621105801; - protected override double TeaspoonsInOneCubicMeter => 202884.13621105801; - protected override double ImperialBeerBarrelsInOneCubicMeter => 6.1102568972; protected override double UkTablespoonsInOneCubicMeter => 66666.6666667; protected override double UsBeerBarrelsInOneCubicMeter => 8.5216790723083; - protected override double TeaspoonsTolerance => 1E-3; - protected override double UsGallonsInOneCubicMeter => 264.17217; protected override double UsOuncesInOneCubicMeter => 33814.02270; diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index 0c107c622b..8708558bee 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -58,12 +58,10 @@ public abstract partial class DurationTestsBase protected abstract double MicrosecondsInOneSecond { get; } protected abstract double MillisecondsInOneSecond { get; } protected abstract double MinutesInOneSecond { get; } - protected abstract double MonthsInOneSecond { get; } protected abstract double Months30InOneSecond { get; } protected abstract double NanosecondsInOneSecond { get; } protected abstract double SecondsInOneSecond { get; } protected abstract double WeeksInOneSecond { get; } - protected abstract double YearsInOneSecond { get; } protected abstract double Years365InOneSecond { get; } // ReSharper disable VirtualMemberNeverOverriden.Global @@ -72,12 +70,10 @@ public abstract partial class DurationTestsBase protected virtual double MicrosecondsTolerance { get { return 1e-5; } } protected virtual double MillisecondsTolerance { get { return 1e-5; } } protected virtual double MinutesTolerance { get { return 1e-5; } } - protected virtual double MonthsTolerance { get { return 1e-5; } } protected virtual double Months30Tolerance { get { return 1e-5; } } protected virtual double NanosecondsTolerance { get { return 1e-5; } } protected virtual double SecondsTolerance { get { return 1e-5; } } protected virtual double WeeksTolerance { get { return 1e-5; } } - protected virtual double YearsTolerance { get { return 1e-5; } } protected virtual double Years365Tolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global @@ -90,12 +86,10 @@ public void SecondToDurationUnits() AssertEx.EqualTolerance(MicrosecondsInOneSecond, second.Microseconds, MicrosecondsTolerance); AssertEx.EqualTolerance(MillisecondsInOneSecond, second.Milliseconds, MillisecondsTolerance); AssertEx.EqualTolerance(MinutesInOneSecond, second.Minutes, MinutesTolerance); - AssertEx.EqualTolerance(MonthsInOneSecond, second.Months, MonthsTolerance); AssertEx.EqualTolerance(Months30InOneSecond, second.Months30, Months30Tolerance); AssertEx.EqualTolerance(NanosecondsInOneSecond, second.Nanoseconds, NanosecondsTolerance); AssertEx.EqualTolerance(SecondsInOneSecond, second.Seconds, SecondsTolerance); AssertEx.EqualTolerance(WeeksInOneSecond, second.Weeks, WeeksTolerance); - AssertEx.EqualTolerance(YearsInOneSecond, second.Years, YearsTolerance); AssertEx.EqualTolerance(Years365InOneSecond, second.Years365, Years365Tolerance); } @@ -107,12 +101,10 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Microsecond).Microseconds, MicrosecondsTolerance); AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Millisecond).Milliseconds, MillisecondsTolerance); AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Minute).Minutes, MinutesTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Month).Months, MonthsTolerance); AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Month30).Months30, Months30Tolerance); AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Nanosecond).Nanoseconds, NanosecondsTolerance); AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Second).Seconds, SecondsTolerance); AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Week).Weeks, WeeksTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Year).Years, YearsTolerance); AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Year365).Years365, Years365Tolerance); } @@ -125,12 +117,10 @@ public void As() AssertEx.EqualTolerance(MicrosecondsInOneSecond, second.As(DurationUnit.Microsecond), MicrosecondsTolerance); AssertEx.EqualTolerance(MillisecondsInOneSecond, second.As(DurationUnit.Millisecond), MillisecondsTolerance); AssertEx.EqualTolerance(MinutesInOneSecond, second.As(DurationUnit.Minute), MinutesTolerance); - AssertEx.EqualTolerance(MonthsInOneSecond, second.As(DurationUnit.Month), MonthsTolerance); AssertEx.EqualTolerance(Months30InOneSecond, second.As(DurationUnit.Month30), Months30Tolerance); AssertEx.EqualTolerance(NanosecondsInOneSecond, second.As(DurationUnit.Nanosecond), NanosecondsTolerance); AssertEx.EqualTolerance(SecondsInOneSecond, second.As(DurationUnit.Second), SecondsTolerance); AssertEx.EqualTolerance(WeeksInOneSecond, second.As(DurationUnit.Week), WeeksTolerance); - AssertEx.EqualTolerance(YearsInOneSecond, second.As(DurationUnit.Year), YearsTolerance); AssertEx.EqualTolerance(Years365InOneSecond, second.As(DurationUnit.Year365), Years365Tolerance); } @@ -159,10 +149,6 @@ public void ToUnit() AssertEx.EqualTolerance(MinutesInOneSecond, (double)minuteQuantity.Value, MinutesTolerance); Assert.Equal(DurationUnit.Minute, minuteQuantity.Unit); - var monthQuantity = second.ToUnit(DurationUnit.Month); - AssertEx.EqualTolerance(MonthsInOneSecond, (double)monthQuantity.Value, MonthsTolerance); - Assert.Equal(DurationUnit.Month, monthQuantity.Unit); - var month30Quantity = second.ToUnit(DurationUnit.Month30); AssertEx.EqualTolerance(Months30InOneSecond, (double)month30Quantity.Value, Months30Tolerance); Assert.Equal(DurationUnit.Month30, month30Quantity.Unit); @@ -179,10 +165,6 @@ public void ToUnit() AssertEx.EqualTolerance(WeeksInOneSecond, (double)weekQuantity.Value, WeeksTolerance); Assert.Equal(DurationUnit.Week, weekQuantity.Unit); - var yearQuantity = second.ToUnit(DurationUnit.Year); - AssertEx.EqualTolerance(YearsInOneSecond, (double)yearQuantity.Value, YearsTolerance); - Assert.Equal(DurationUnit.Year, yearQuantity.Unit); - var year365Quantity = second.ToUnit(DurationUnit.Year365); AssertEx.EqualTolerance(Years365InOneSecond, (double)year365Quantity.Value, Years365Tolerance); Assert.Equal(DurationUnit.Year365, year365Quantity.Unit); @@ -197,12 +179,10 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Duration.FromMicroseconds(second.Microseconds).Seconds, MicrosecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromMilliseconds(second.Milliseconds).Seconds, MillisecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromMinutes(second.Minutes).Seconds, MinutesTolerance); - AssertEx.EqualTolerance(1, Duration.FromMonths(second.Months).Seconds, MonthsTolerance); AssertEx.EqualTolerance(1, Duration.FromMonths30(second.Months30).Seconds, Months30Tolerance); AssertEx.EqualTolerance(1, Duration.FromNanoseconds(second.Nanoseconds).Seconds, NanosecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromSeconds(second.Seconds).Seconds, SecondsTolerance); AssertEx.EqualTolerance(1, Duration.FromWeeks(second.Weeks).Seconds, WeeksTolerance); - AssertEx.EqualTolerance(1, Duration.FromYears(second.Years).Seconds, YearsTolerance); AssertEx.EqualTolerance(1, Duration.FromYears365(second.Years365).Seconds, Years365Tolerance); } diff --git a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs deleted file mode 100644 index 3b2b44ce5e..0000000000 --- a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs +++ /dev/null @@ -1,427 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Flow. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class FlowTestsBase - { - protected abstract double CentilitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicDecimetersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicFeetPerHourInOneCubicMeterPerSecond { get; } - protected abstract double CubicFeetPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; } - protected abstract double CubicMetersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double CubicYardsPerHourInOneCubicMeterPerSecond { get; } - protected abstract double CubicYardsPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicYardsPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double DecilitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double KilolitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double LitersPerHourInOneCubicMeterPerSecond { get; } - protected abstract double LitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double LitersPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double MicrolitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double MillilitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double MillionUsGallonsPerDayInOneCubicMeterPerSecond { get; } - protected abstract double NanolitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double OilBarrelsPerDayInOneCubicMeterPerSecond { get; } - protected abstract double UsGallonsPerHourInOneCubicMeterPerSecond { get; } - protected abstract double UsGallonsPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double UsGallonsPerSecondInOneCubicMeterPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentilitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicDecimetersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicFeetPerHourTolerance { get { return 1e-5; } } - protected virtual double CubicFeetPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } } - protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } } - protected virtual double CubicMetersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double CubicYardsPerHourTolerance { get { return 1e-5; } } - protected virtual double CubicYardsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicYardsPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecilitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double KilolitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double LitersPerHourTolerance { get { return 1e-5; } } - protected virtual double LitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double LitersPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicrolitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double MillilitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double MillionUsGallonsPerDayTolerance { get { return 1e-5; } } - protected virtual double NanolitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double OilBarrelsPerDayTolerance { get { return 1e-5; } } - protected virtual double UsGallonsPerHourTolerance { get { return 1e-5; } } - protected virtual double UsGallonsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double UsGallonsPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void CubicMeterPerSecondToFlowUnits() - { - Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CentilitersPerMinute, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerHour, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerMinute, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerMinute, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerHour, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerMinute, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.DecilitersPerMinute, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.KilolitersPerMinute, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerHour, LitersPerHourTolerance); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerMinute, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.MicrolitersPerMinute, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.MillilitersPerMinute, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.NanolitersPerMinute, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.OilBarrelsPerDay, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerHour, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerMinute, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerSecond, UsGallonsPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CentilitersPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerHour).CubicFeetPerHour, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerMinute).CubicFeetPerMinute, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerMinute).CubicMetersPerMinute, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicYardPerHour).CubicYardsPerHour, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicYardPerMinute).CubicYardsPerMinute, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.CubicYardPerSecond).CubicYardsPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.DecilitersPerMinute).DecilitersPerMinute, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.KilolitersPerMinute).KilolitersPerMinute, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.LitersPerHour).LitersPerHour, LitersPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.LitersPerMinute).LitersPerMinute, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.LitersPerSecond).LitersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.MicrolitersPerMinute).MicrolitersPerMinute, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.MillilitersPerMinute).MillilitersPerMinute, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.MillionUsGallonsPerDay).MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.NanolitersPerMinute).NanolitersPerMinute, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.OilBarrelsPerDay).OilBarrelsPerDay, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.UsGallonsPerHour).UsGallonsPerHour, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.UsGallonsPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.From(1, FlowUnit.UsGallonsPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); - } - - [Fact] - public void As() - { - var cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CentilitersPerMinute), CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerHour), CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerMinute), CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerMinute), CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicYardPerHour), CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicYardPerMinute), CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.CubicYardPerSecond), CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.DecilitersPerMinute), DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.KilolitersPerMinute), KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.LitersPerHour), LitersPerHourTolerance); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.LitersPerMinute), LitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.LitersPerSecond), LitersPerSecondTolerance); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.MicrolitersPerMinute), MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.MillilitersPerMinute), MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.MillionUsGallonsPerDay), MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.NanolitersPerMinute), NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.OilBarrelsPerDay), OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.UsGallonsPerHour), UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.UsGallonsPerMinute), UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(FlowUnit.UsGallonsPerSecond), UsGallonsPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - - var centilitersperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CentilitersPerMinute); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, (double)centilitersperminuteQuantity.Value, CentilitersPerMinuteTolerance); - Assert.Equal(FlowUnit.CentilitersPerMinute, centilitersperminuteQuantity.Unit); - - var cubicdecimeterperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicDecimeterPerMinute); - AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, (double)cubicdecimeterperminuteQuantity.Value, CubicDecimetersPerMinuteTolerance); - Assert.Equal(FlowUnit.CubicDecimeterPerMinute, cubicdecimeterperminuteQuantity.Unit); - - var cubicfootperhourQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicFootPerHour); - AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, (double)cubicfootperhourQuantity.Value, CubicFeetPerHourTolerance); - Assert.Equal(FlowUnit.CubicFootPerHour, cubicfootperhourQuantity.Unit); - - var cubicfootperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicFootPerMinute); - AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, (double)cubicfootperminuteQuantity.Value, CubicFeetPerMinuteTolerance); - Assert.Equal(FlowUnit.CubicFootPerMinute, cubicfootperminuteQuantity.Unit); - - var cubicfootpersecondQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicFootPerSecond); - AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, (double)cubicfootpersecondQuantity.Value, CubicFeetPerSecondTolerance); - Assert.Equal(FlowUnit.CubicFootPerSecond, cubicfootpersecondQuantity.Unit); - - var cubicmeterperhourQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicMeterPerHour); - AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, (double)cubicmeterperhourQuantity.Value, CubicMetersPerHourTolerance); - Assert.Equal(FlowUnit.CubicMeterPerHour, cubicmeterperhourQuantity.Unit); - - var cubicmeterperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicMeterPerMinute); - AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, (double)cubicmeterperminuteQuantity.Value, CubicMetersPerMinuteTolerance); - Assert.Equal(FlowUnit.CubicMeterPerMinute, cubicmeterperminuteQuantity.Unit); - - var cubicmeterpersecondQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicMeterPerSecond); - AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, (double)cubicmeterpersecondQuantity.Value, CubicMetersPerSecondTolerance); - Assert.Equal(FlowUnit.CubicMeterPerSecond, cubicmeterpersecondQuantity.Unit); - - var cubicyardperhourQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicYardPerHour); - AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, (double)cubicyardperhourQuantity.Value, CubicYardsPerHourTolerance); - Assert.Equal(FlowUnit.CubicYardPerHour, cubicyardperhourQuantity.Unit); - - var cubicyardperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicYardPerMinute); - AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, (double)cubicyardperminuteQuantity.Value, CubicYardsPerMinuteTolerance); - Assert.Equal(FlowUnit.CubicYardPerMinute, cubicyardperminuteQuantity.Unit); - - var cubicyardpersecondQuantity = cubicmeterpersecond.ToUnit(FlowUnit.CubicYardPerSecond); - AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, (double)cubicyardpersecondQuantity.Value, CubicYardsPerSecondTolerance); - Assert.Equal(FlowUnit.CubicYardPerSecond, cubicyardpersecondQuantity.Unit); - - var decilitersperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.DecilitersPerMinute); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, (double)decilitersperminuteQuantity.Value, DecilitersPerMinuteTolerance); - Assert.Equal(FlowUnit.DecilitersPerMinute, decilitersperminuteQuantity.Unit); - - var kilolitersperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.KilolitersPerMinute); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, (double)kilolitersperminuteQuantity.Value, KilolitersPerMinuteTolerance); - Assert.Equal(FlowUnit.KilolitersPerMinute, kilolitersperminuteQuantity.Unit); - - var litersperhourQuantity = cubicmeterpersecond.ToUnit(FlowUnit.LitersPerHour); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, (double)litersperhourQuantity.Value, LitersPerHourTolerance); - Assert.Equal(FlowUnit.LitersPerHour, litersperhourQuantity.Unit); - - var litersperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.LitersPerMinute); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, (double)litersperminuteQuantity.Value, LitersPerMinuteTolerance); - Assert.Equal(FlowUnit.LitersPerMinute, litersperminuteQuantity.Unit); - - var literspersecondQuantity = cubicmeterpersecond.ToUnit(FlowUnit.LitersPerSecond); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, (double)literspersecondQuantity.Value, LitersPerSecondTolerance); - Assert.Equal(FlowUnit.LitersPerSecond, literspersecondQuantity.Unit); - - var microlitersperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.MicrolitersPerMinute); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, (double)microlitersperminuteQuantity.Value, MicrolitersPerMinuteTolerance); - Assert.Equal(FlowUnit.MicrolitersPerMinute, microlitersperminuteQuantity.Unit); - - var millilitersperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.MillilitersPerMinute); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, (double)millilitersperminuteQuantity.Value, MillilitersPerMinuteTolerance); - Assert.Equal(FlowUnit.MillilitersPerMinute, millilitersperminuteQuantity.Unit); - - var millionusgallonsperdayQuantity = cubicmeterpersecond.ToUnit(FlowUnit.MillionUsGallonsPerDay); - AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, (double)millionusgallonsperdayQuantity.Value, MillionUsGallonsPerDayTolerance); - Assert.Equal(FlowUnit.MillionUsGallonsPerDay, millionusgallonsperdayQuantity.Unit); - - var nanolitersperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.NanolitersPerMinute); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, (double)nanolitersperminuteQuantity.Value, NanolitersPerMinuteTolerance); - Assert.Equal(FlowUnit.NanolitersPerMinute, nanolitersperminuteQuantity.Unit); - - var oilbarrelsperdayQuantity = cubicmeterpersecond.ToUnit(FlowUnit.OilBarrelsPerDay); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, (double)oilbarrelsperdayQuantity.Value, OilBarrelsPerDayTolerance); - Assert.Equal(FlowUnit.OilBarrelsPerDay, oilbarrelsperdayQuantity.Unit); - - var usgallonsperhourQuantity = cubicmeterpersecond.ToUnit(FlowUnit.UsGallonsPerHour); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, (double)usgallonsperhourQuantity.Value, UsGallonsPerHourTolerance); - Assert.Equal(FlowUnit.UsGallonsPerHour, usgallonsperhourQuantity.Unit); - - var usgallonsperminuteQuantity = cubicmeterpersecond.ToUnit(FlowUnit.UsGallonsPerMinute); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, (double)usgallonsperminuteQuantity.Value, UsGallonsPerMinuteTolerance); - Assert.Equal(FlowUnit.UsGallonsPerMinute, usgallonsperminuteQuantity.Unit); - - var usgallonspersecondQuantity = cubicmeterpersecond.ToUnit(FlowUnit.UsGallonsPerSecond); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, (double)usgallonspersecondQuantity.Value, UsGallonsPerSecondTolerance); - Assert.Equal(FlowUnit.UsGallonsPerSecond, usgallonspersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(1, Flow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerHour(cubicmeterpersecond.CubicFeetPerHour).CubicMetersPerSecond, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerMinute(cubicmeterpersecond.CubicFeetPerMinute).CubicMetersPerSecond, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerMinute(cubicmeterpersecond.CubicMetersPerMinute).CubicMetersPerSecond, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicYardsPerHour(cubicmeterpersecond.CubicYardsPerHour).CubicMetersPerSecond, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicYardsPerMinute(cubicmeterpersecond.CubicYardsPerMinute).CubicMetersPerSecond, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromCubicYardsPerSecond(cubicmeterpersecond.CubicYardsPerSecond).CubicMetersPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.FromDecilitersPerMinute(cubicmeterpersecond.DecilitersPerMinute).CubicMetersPerSecond, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromKilolitersPerMinute(cubicmeterpersecond.KilolitersPerMinute).CubicMetersPerSecond, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromLitersPerHour(cubicmeterpersecond.LitersPerHour).CubicMetersPerSecond, LitersPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.FromLitersPerMinute(cubicmeterpersecond.LitersPerMinute).CubicMetersPerSecond, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromLitersPerSecond(cubicmeterpersecond.LitersPerSecond).CubicMetersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(1, Flow.FromMicrolitersPerMinute(cubicmeterpersecond.MicrolitersPerMinute).CubicMetersPerSecond, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromMillilitersPerMinute(cubicmeterpersecond.MillilitersPerMinute).CubicMetersPerSecond, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromMillionUsGallonsPerDay(cubicmeterpersecond.MillionUsGallonsPerDay).CubicMetersPerSecond, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, Flow.FromNanolitersPerMinute(cubicmeterpersecond.NanolitersPerMinute).CubicMetersPerSecond, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromOilBarrelsPerDay(cubicmeterpersecond.OilBarrelsPerDay).CubicMetersPerSecond, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(1, Flow.FromUsGallonsPerHour(cubicmeterpersecond.UsGallonsPerHour).CubicMetersPerSecond, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, Flow.FromUsGallonsPerMinute(cubicmeterpersecond.UsGallonsPerMinute).CubicMetersPerSecond, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Flow.FromUsGallonsPerSecond(cubicmeterpersecond.UsGallonsPerSecond).CubicMetersPerSecond, UsGallonsPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Flow v = Flow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(-1, -v.CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (Flow.FromCubicMetersPerSecond(3)-v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (Flow.FromCubicMetersPerSecond(10)/5).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, Flow.FromCubicMetersPerSecond(10)/Flow.FromCubicMetersPerSecond(5), CubicMetersPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Flow oneCubicMeterPerSecond = Flow.FromCubicMetersPerSecond(1); - Flow twoCubicMetersPerSecond = Flow.FromCubicMetersPerSecond(2); - - Assert.True(oneCubicMeterPerSecond < twoCubicMetersPerSecond); - Assert.True(oneCubicMeterPerSecond <= twoCubicMetersPerSecond); - Assert.True(twoCubicMetersPerSecond > oneCubicMeterPerSecond); - Assert.True(twoCubicMetersPerSecond >= oneCubicMeterPerSecond); - - Assert.False(oneCubicMeterPerSecond > twoCubicMetersPerSecond); - Assert.False(oneCubicMeterPerSecond >= twoCubicMetersPerSecond); - Assert.False(twoCubicMetersPerSecond < oneCubicMeterPerSecond); - Assert.False(twoCubicMetersPerSecond <= oneCubicMeterPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - Assert.Equal(0, cubicmeterpersecond.CompareTo(cubicmeterpersecond)); - Assert.True(cubicmeterpersecond.CompareTo(Flow.Zero) > 0); - Assert.True(Flow.Zero.CompareTo(cubicmeterpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - Assert.Throws(() => cubicmeterpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - Assert.Throws(() => cubicmeterpersecond.CompareTo(null)); - } - - - [Fact] - public void EqualityOperators() - { - Flow a = Flow.FromCubicMetersPerSecond(1); - Flow b = Flow.FromCubicMetersPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - - [Fact] - public void EqualsIsImplemented() - { - Flow v = Flow.FromCubicMetersPerSecond(1); - Assert.True(v.Equals(Flow.FromCubicMetersPerSecond(1), Flow.FromCubicMetersPerSecond(CubicMetersPerSecondTolerance))); - Assert.False(v.Equals(Flow.Zero, Flow.FromCubicMetersPerSecond(CubicMetersPerSecondTolerance))); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - Assert.False(cubicmeterpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Flow cubicmeterpersecond = Flow.FromCubicMetersPerSecond(1); - Assert.False(cubicmeterpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(FlowUnit.Undefined, Flow.Units); - } - - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index fad6f6b86e..98dca17dd2 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -85,7 +85,6 @@ public abstract partial class PressureTestsBase protected abstract double PascalsInOnePascal { get; } protected abstract double PoundsForcePerSquareFootInOnePascal { get; } protected abstract double PoundsForcePerSquareInchInOnePascal { get; } - protected abstract double PsiInOnePascal { get; } protected abstract double TechnicalAtmospheresInOnePascal { get; } protected abstract double TonnesForcePerSquareCentimeterInOnePascal { get; } protected abstract double TonnesForcePerSquareMeterInOnePascal { get; } @@ -125,7 +124,6 @@ public abstract partial class PressureTestsBase protected virtual double PascalsTolerance { get { return 1e-5; } } protected virtual double PoundsForcePerSquareFootTolerance { get { return 1e-5; } } protected virtual double PoundsForcePerSquareInchTolerance { get { return 1e-5; } } - protected virtual double PsiTolerance { get { return 1e-5; } } protected virtual double TechnicalAtmospheresTolerance { get { return 1e-5; } } protected virtual double TonnesForcePerSquareCentimeterTolerance { get { return 1e-5; } } protected virtual double TonnesForcePerSquareMeterTolerance { get { return 1e-5; } } @@ -169,7 +167,6 @@ public void PascalToPressureUnits() AssertEx.EqualTolerance(PascalsInOnePascal, pascal.Pascals, PascalsTolerance); AssertEx.EqualTolerance(PoundsForcePerSquareFootInOnePascal, pascal.PoundsForcePerSquareFoot, PoundsForcePerSquareFootTolerance); AssertEx.EqualTolerance(PoundsForcePerSquareInchInOnePascal, pascal.PoundsForcePerSquareInch, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(PsiInOnePascal, pascal.Psi, PsiTolerance); AssertEx.EqualTolerance(TechnicalAtmospheresInOnePascal, pascal.TechnicalAtmospheres, TechnicalAtmospheresTolerance); AssertEx.EqualTolerance(TonnesForcePerSquareCentimeterInOnePascal, pascal.TonnesForcePerSquareCentimeter, TonnesForcePerSquareCentimeterTolerance); AssertEx.EqualTolerance(TonnesForcePerSquareMeterInOnePascal, pascal.TonnesForcePerSquareMeter, TonnesForcePerSquareMeterTolerance); @@ -212,7 +209,6 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Pascal).Pascals, PascalsTolerance); AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareFoot).PoundsForcePerSquareFoot, PoundsForcePerSquareFootTolerance); AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareInch).PoundsForcePerSquareInch, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Psi).Psi, PsiTolerance); AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TechnicalAtmosphere).TechnicalAtmospheres, TechnicalAtmospheresTolerance); AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareCentimeter).TonnesForcePerSquareCentimeter, TonnesForcePerSquareCentimeterTolerance); AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareMeter).TonnesForcePerSquareMeter, TonnesForcePerSquareMeterTolerance); @@ -256,7 +252,6 @@ public void As() AssertEx.EqualTolerance(PascalsInOnePascal, pascal.As(PressureUnit.Pascal), PascalsTolerance); AssertEx.EqualTolerance(PoundsForcePerSquareFootInOnePascal, pascal.As(PressureUnit.PoundForcePerSquareFoot), PoundsForcePerSquareFootTolerance); AssertEx.EqualTolerance(PoundsForcePerSquareInchInOnePascal, pascal.As(PressureUnit.PoundForcePerSquareInch), PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(PsiInOnePascal, pascal.As(PressureUnit.Psi), PsiTolerance); AssertEx.EqualTolerance(TechnicalAtmospheresInOnePascal, pascal.As(PressureUnit.TechnicalAtmosphere), TechnicalAtmospheresTolerance); AssertEx.EqualTolerance(TonnesForcePerSquareCentimeterInOnePascal, pascal.As(PressureUnit.TonneForcePerSquareCentimeter), TonnesForcePerSquareCentimeterTolerance); AssertEx.EqualTolerance(TonnesForcePerSquareMeterInOnePascal, pascal.As(PressureUnit.TonneForcePerSquareMeter), TonnesForcePerSquareMeterTolerance); @@ -397,10 +392,6 @@ public void ToUnit() AssertEx.EqualTolerance(PoundsForcePerSquareInchInOnePascal, (double)poundforcepersquareinchQuantity.Value, PoundsForcePerSquareInchTolerance); Assert.Equal(PressureUnit.PoundForcePerSquareInch, poundforcepersquareinchQuantity.Unit); - var psiQuantity = pascal.ToUnit(PressureUnit.Psi); - AssertEx.EqualTolerance(PsiInOnePascal, (double)psiQuantity.Value, PsiTolerance); - Assert.Equal(PressureUnit.Psi, psiQuantity.Unit); - var technicalatmosphereQuantity = pascal.ToUnit(PressureUnit.TechnicalAtmosphere); AssertEx.EqualTolerance(TechnicalAtmospheresInOnePascal, (double)technicalatmosphereQuantity.Value, TechnicalAtmospheresTolerance); Assert.Equal(PressureUnit.TechnicalAtmosphere, technicalatmosphereQuantity.Unit); @@ -458,7 +449,6 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Pressure.FromPascals(pascal.Pascals).Pascals, PascalsTolerance); AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareFoot(pascal.PoundsForcePerSquareFoot).Pascals, PoundsForcePerSquareFootTolerance); AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareInch(pascal.PoundsForcePerSquareInch).Pascals, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPsi(pascal.Psi).Pascals, PsiTolerance); AssertEx.EqualTolerance(1, Pressure.FromTechnicalAtmospheres(pascal.TechnicalAtmospheres).Pascals, TechnicalAtmospheresTolerance); AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareCentimeter(pascal.TonnesForcePerSquareCentimeter).Pascals, TonnesForcePerSquareCentimeterTolerance); AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareMeter(pascal.TonnesForcePerSquareMeter).Pascals, TonnesForcePerSquareMeterTolerance); diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index 3fd5e0a093..f7b56263c6 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -54,39 +54,23 @@ namespace UnitsNet.Tests public abstract partial class TemperatureDeltaTestsBase { protected abstract double DegreesCelsiusInOneKelvin { get; } - protected abstract double DegreesCelsiusDeltaInOneKelvin { get; } protected abstract double DegreesDelisleInOneKelvin { get; } - protected abstract double DegreesDelisleDeltaInOneKelvin { get; } protected abstract double DegreesFahrenheitInOneKelvin { get; } - protected abstract double DegreesFahrenheitDeltaInOneKelvin { get; } protected abstract double DegreesNewtonInOneKelvin { get; } - protected abstract double DegreesNewtonDeltaInOneKelvin { get; } protected abstract double DegreesRankineInOneKelvin { get; } - protected abstract double DegreesRankineDeltaInOneKelvin { get; } protected abstract double DegreesReaumurInOneKelvin { get; } - protected abstract double DegreesReaumurDeltaInOneKelvin { get; } protected abstract double DegreesRoemerInOneKelvin { get; } - protected abstract double DegreesRoemerDeltaInOneKelvin { get; } protected abstract double KelvinsInOneKelvin { get; } - protected abstract double KelvinsDeltaInOneKelvin { get; } // ReSharper disable VirtualMemberNeverOverriden.Global protected virtual double DegreesCelsiusTolerance { get { return 1e-5; } } - protected virtual double DegreesCelsiusDeltaTolerance { get { return 1e-5; } } protected virtual double DegreesDelisleTolerance { get { return 1e-5; } } - protected virtual double DegreesDelisleDeltaTolerance { get { return 1e-5; } } protected virtual double DegreesFahrenheitTolerance { get { return 1e-5; } } - protected virtual double DegreesFahrenheitDeltaTolerance { get { return 1e-5; } } protected virtual double DegreesNewtonTolerance { get { return 1e-5; } } - protected virtual double DegreesNewtonDeltaTolerance { get { return 1e-5; } } protected virtual double DegreesRankineTolerance { get { return 1e-5; } } - protected virtual double DegreesRankineDeltaTolerance { get { return 1e-5; } } protected virtual double DegreesReaumurTolerance { get { return 1e-5; } } - protected virtual double DegreesReaumurDeltaTolerance { get { return 1e-5; } } protected virtual double DegreesRoemerTolerance { get { return 1e-5; } } - protected virtual double DegreesRoemerDeltaTolerance { get { return 1e-5; } } protected virtual double KelvinsTolerance { get { return 1e-5; } } - protected virtual double KelvinsDeltaTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] @@ -94,42 +78,26 @@ public void KelvinToTemperatureDeltaUnits() { TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(DegreesCelsiusDeltaInOneKelvin, kelvin.DegreesCelsiusDelta, DegreesCelsiusDeltaTolerance); AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(DegreesDelisleDeltaInOneKelvin, kelvin.DegreesDelisleDelta, DegreesDelisleDeltaTolerance); AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(DegreesFahrenheitDeltaInOneKelvin, kelvin.DegreesFahrenheitDelta, DegreesFahrenheitDeltaTolerance); AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, kelvin.DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(DegreesNewtonDeltaInOneKelvin, kelvin.DegreesNewtonDelta, DegreesNewtonDeltaTolerance); AssertEx.EqualTolerance(DegreesRankineInOneKelvin, kelvin.DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(DegreesRankineDeltaInOneKelvin, kelvin.DegreesRankineDelta, DegreesRankineDeltaTolerance); AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, kelvin.DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(DegreesReaumurDeltaInOneKelvin, kelvin.DegreesReaumurDelta, DegreesReaumurDeltaTolerance); AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, kelvin.DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(DegreesRoemerDeltaInOneKelvin, kelvin.DegreesRoemerDelta, DegreesRoemerDeltaTolerance); AssertEx.EqualTolerance(KelvinsInOneKelvin, kelvin.Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(KelvinsDeltaInOneKelvin, kelvin.KelvinsDelta, KelvinsDeltaTolerance); } [Fact] public void FromValueAndUnit() { AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsiusDelta).DegreesCelsiusDelta, DegreesCelsiusDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisleDelta).DegreesDelisleDelta, DegreesDelisleDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheitDelta).DegreesFahrenheitDelta, DegreesFahrenheitDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewtonDelta).DegreesNewtonDelta, DegreesNewtonDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankineDelta).DegreesRankineDelta, DegreesRankineDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumurDelta).DegreesReaumurDelta, DegreesReaumurDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemerDelta).DegreesRoemerDelta, DegreesRoemerDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.KelvinDelta).KelvinsDelta, KelvinsDeltaTolerance); } [Fact] @@ -137,21 +105,13 @@ public void As() { var kelvin = TemperatureDelta.FromKelvins(1); AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeCelsius), DegreesCelsiusTolerance); - AssertEx.EqualTolerance(DegreesCelsiusDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeCelsiusDelta), DegreesCelsiusDeltaTolerance); AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeDelisle), DegreesDelisleTolerance); - AssertEx.EqualTolerance(DegreesDelisleDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeDelisleDelta), DegreesDelisleDeltaTolerance); AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeFahrenheit), DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(DegreesFahrenheitDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeFahrenheitDelta), DegreesFahrenheitDeltaTolerance); AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeNewton), DegreesNewtonTolerance); - AssertEx.EqualTolerance(DegreesNewtonDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeNewtonDelta), DegreesNewtonDeltaTolerance); AssertEx.EqualTolerance(DegreesRankineInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeRankine), DegreesRankineTolerance); - AssertEx.EqualTolerance(DegreesRankineDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeRankineDelta), DegreesRankineDeltaTolerance); AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeReaumur), DegreesReaumurTolerance); - AssertEx.EqualTolerance(DegreesReaumurDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeReaumurDelta), DegreesReaumurDeltaTolerance); AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeRoemer), DegreesRoemerTolerance); - AssertEx.EqualTolerance(DegreesRoemerDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeRoemerDelta), DegreesRoemerDeltaTolerance); AssertEx.EqualTolerance(KelvinsInOneKelvin, kelvin.As(TemperatureDeltaUnit.Kelvin), KelvinsTolerance); - AssertEx.EqualTolerance(KelvinsDeltaInOneKelvin, kelvin.As(TemperatureDeltaUnit.KelvinDelta), KelvinsDeltaTolerance); } [Fact] @@ -163,65 +123,33 @@ public void ToUnit() AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, (double)degreecelsiusQuantity.Value, DegreesCelsiusTolerance); Assert.Equal(TemperatureDeltaUnit.DegreeCelsius, degreecelsiusQuantity.Unit); - var degreecelsiusdeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeCelsiusDelta); - AssertEx.EqualTolerance(DegreesCelsiusDeltaInOneKelvin, (double)degreecelsiusdeltaQuantity.Value, DegreesCelsiusDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeCelsiusDelta, degreecelsiusdeltaQuantity.Unit); - var degreedelisleQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeDelisle); AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, (double)degreedelisleQuantity.Value, DegreesDelisleTolerance); Assert.Equal(TemperatureDeltaUnit.DegreeDelisle, degreedelisleQuantity.Unit); - var degreedelisledeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeDelisleDelta); - AssertEx.EqualTolerance(DegreesDelisleDeltaInOneKelvin, (double)degreedelisledeltaQuantity.Value, DegreesDelisleDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeDelisleDelta, degreedelisledeltaQuantity.Unit); - var degreefahrenheitQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeFahrenheit); AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, (double)degreefahrenheitQuantity.Value, DegreesFahrenheitTolerance); Assert.Equal(TemperatureDeltaUnit.DegreeFahrenheit, degreefahrenheitQuantity.Unit); - var degreefahrenheitdeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeFahrenheitDelta); - AssertEx.EqualTolerance(DegreesFahrenheitDeltaInOneKelvin, (double)degreefahrenheitdeltaQuantity.Value, DegreesFahrenheitDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeFahrenheitDelta, degreefahrenheitdeltaQuantity.Unit); - var degreenewtonQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeNewton); AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, (double)degreenewtonQuantity.Value, DegreesNewtonTolerance); Assert.Equal(TemperatureDeltaUnit.DegreeNewton, degreenewtonQuantity.Unit); - var degreenewtondeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeNewtonDelta); - AssertEx.EqualTolerance(DegreesNewtonDeltaInOneKelvin, (double)degreenewtondeltaQuantity.Value, DegreesNewtonDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeNewtonDelta, degreenewtondeltaQuantity.Unit); - var degreerankineQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeRankine); AssertEx.EqualTolerance(DegreesRankineInOneKelvin, (double)degreerankineQuantity.Value, DegreesRankineTolerance); Assert.Equal(TemperatureDeltaUnit.DegreeRankine, degreerankineQuantity.Unit); - var degreerankinedeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeRankineDelta); - AssertEx.EqualTolerance(DegreesRankineDeltaInOneKelvin, (double)degreerankinedeltaQuantity.Value, DegreesRankineDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeRankineDelta, degreerankinedeltaQuantity.Unit); - var degreereaumurQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeReaumur); AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, (double)degreereaumurQuantity.Value, DegreesReaumurTolerance); Assert.Equal(TemperatureDeltaUnit.DegreeReaumur, degreereaumurQuantity.Unit); - var degreereaumurdeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeReaumurDelta); - AssertEx.EqualTolerance(DegreesReaumurDeltaInOneKelvin, (double)degreereaumurdeltaQuantity.Value, DegreesReaumurDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeReaumurDelta, degreereaumurdeltaQuantity.Unit); - var degreeroemerQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeRoemer); AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, (double)degreeroemerQuantity.Value, DegreesRoemerTolerance); Assert.Equal(TemperatureDeltaUnit.DegreeRoemer, degreeroemerQuantity.Unit); - var degreeroemerdeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeRoemerDelta); - AssertEx.EqualTolerance(DegreesRoemerDeltaInOneKelvin, (double)degreeroemerdeltaQuantity.Value, DegreesRoemerDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeRoemerDelta, degreeroemerdeltaQuantity.Unit); - var kelvinQuantity = kelvin.ToUnit(TemperatureDeltaUnit.Kelvin); AssertEx.EqualTolerance(KelvinsInOneKelvin, (double)kelvinQuantity.Value, KelvinsTolerance); Assert.Equal(TemperatureDeltaUnit.Kelvin, kelvinQuantity.Unit); - - var kelvindeltaQuantity = kelvin.ToUnit(TemperatureDeltaUnit.KelvinDelta); - AssertEx.EqualTolerance(KelvinsDeltaInOneKelvin, (double)kelvindeltaQuantity.Value, KelvinsDeltaTolerance); - Assert.Equal(TemperatureDeltaUnit.KelvinDelta, kelvindeltaQuantity.Unit); } [Fact] @@ -229,21 +157,13 @@ public void ConversionRoundTrip() { TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesCelsius(kelvin.DegreesCelsius).Kelvins, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesCelsiusDelta(kelvin.DegreesCelsiusDelta).Kelvins, DegreesCelsiusDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesDelisle(kelvin.DegreesDelisle).Kelvins, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesDelisleDelta(kelvin.DegreesDelisleDelta).Kelvins, DegreesDelisleDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesFahrenheit(kelvin.DegreesFahrenheit).Kelvins, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesFahrenheitDelta(kelvin.DegreesFahrenheitDelta).Kelvins, DegreesFahrenheitDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesNewton(kelvin.DegreesNewton).Kelvins, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesNewtonDelta(kelvin.DegreesNewtonDelta).Kelvins, DegreesNewtonDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRankine(kelvin.DegreesRankine).Kelvins, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRankineDelta(kelvin.DegreesRankineDelta).Kelvins, DegreesRankineDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesReaumur(kelvin.DegreesReaumur).Kelvins, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesReaumurDelta(kelvin.DegreesReaumurDelta).Kelvins, DegreesReaumurDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRoemer(kelvin.DegreesRoemer).Kelvins, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRoemerDelta(kelvin.DegreesRoemerDelta).Kelvins, DegreesRoemerDeltaTolerance); AssertEx.EqualTolerance(1, TemperatureDelta.FromKelvins(kelvin.Kelvins).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromKelvinsDelta(kelvin.KelvinsDelta).Kelvins, KelvinsDeltaTolerance); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index feecaf0831..6d81c3d63e 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -85,8 +85,6 @@ public abstract partial class VolumeTestsBase protected abstract double MicrolitersInOneCubicMeter { get; } protected abstract double MillilitersInOneCubicMeter { get; } protected abstract double OilBarrelsInOneCubicMeter { get; } - protected abstract double TablespoonsInOneCubicMeter { get; } - protected abstract double TeaspoonsInOneCubicMeter { get; } protected abstract double UkTablespoonsInOneCubicMeter { get; } protected abstract double UsBeerBarrelsInOneCubicMeter { get; } protected abstract double UsCustomaryCupsInOneCubicMeter { get; } @@ -131,8 +129,6 @@ public abstract partial class VolumeTestsBase protected virtual double MicrolitersTolerance { get { return 1e-5; } } protected virtual double MillilitersTolerance { get { return 1e-5; } } protected virtual double OilBarrelsTolerance { get { return 1e-5; } } - protected virtual double TablespoonsTolerance { get { return 1e-5; } } - protected virtual double TeaspoonsTolerance { get { return 1e-5; } } protected virtual double UkTablespoonsTolerance { get { return 1e-5; } } protected virtual double UsBeerBarrelsTolerance { get { return 1e-5; } } protected virtual double UsCustomaryCupsTolerance { get { return 1e-5; } } @@ -181,8 +177,6 @@ public void CubicMeterToVolumeUnits() AssertEx.EqualTolerance(MicrolitersInOneCubicMeter, cubicmeter.Microliters, MicrolitersTolerance); AssertEx.EqualTolerance(MillilitersInOneCubicMeter, cubicmeter.Milliliters, MillilitersTolerance); AssertEx.EqualTolerance(OilBarrelsInOneCubicMeter, cubicmeter.OilBarrels, OilBarrelsTolerance); - AssertEx.EqualTolerance(TablespoonsInOneCubicMeter, cubicmeter.Tablespoons, TablespoonsTolerance); - AssertEx.EqualTolerance(TeaspoonsInOneCubicMeter, cubicmeter.Teaspoons, TeaspoonsTolerance); AssertEx.EqualTolerance(UkTablespoonsInOneCubicMeter, cubicmeter.UkTablespoons, UkTablespoonsTolerance); AssertEx.EqualTolerance(UsBeerBarrelsInOneCubicMeter, cubicmeter.UsBeerBarrels, UsBeerBarrelsTolerance); AssertEx.EqualTolerance(UsCustomaryCupsInOneCubicMeter, cubicmeter.UsCustomaryCups, UsCustomaryCupsTolerance); @@ -230,8 +224,6 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Microliter).Microliters, MicrolitersTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Milliliter).Milliliters, MillilitersTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.OilBarrel).OilBarrels, OilBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Tablespoon).Tablespoons, TablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Teaspoon).Teaspoons, TeaspoonsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UkTablespoon).UkTablespoons, UkTablespoonsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsBeerBarrel).UsBeerBarrels, UsBeerBarrelsTolerance); AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsCustomaryCup).UsCustomaryCups, UsCustomaryCupsTolerance); @@ -280,8 +272,6 @@ public void As() AssertEx.EqualTolerance(MicrolitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Microliter), MicrolitersTolerance); AssertEx.EqualTolerance(MillilitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Milliliter), MillilitersTolerance); AssertEx.EqualTolerance(OilBarrelsInOneCubicMeter, cubicmeter.As(VolumeUnit.OilBarrel), OilBarrelsTolerance); - AssertEx.EqualTolerance(TablespoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.Tablespoon), TablespoonsTolerance); - AssertEx.EqualTolerance(TeaspoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.Teaspoon), TeaspoonsTolerance); AssertEx.EqualTolerance(UkTablespoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.UkTablespoon), UkTablespoonsTolerance); AssertEx.EqualTolerance(UsBeerBarrelsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsBeerBarrel), UsBeerBarrelsTolerance); AssertEx.EqualTolerance(UsCustomaryCupsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsCustomaryCup), UsCustomaryCupsTolerance); @@ -427,14 +417,6 @@ public void ToUnit() AssertEx.EqualTolerance(OilBarrelsInOneCubicMeter, (double)oilbarrelQuantity.Value, OilBarrelsTolerance); Assert.Equal(VolumeUnit.OilBarrel, oilbarrelQuantity.Unit); - var tablespoonQuantity = cubicmeter.ToUnit(VolumeUnit.Tablespoon); - AssertEx.EqualTolerance(TablespoonsInOneCubicMeter, (double)tablespoonQuantity.Value, TablespoonsTolerance); - Assert.Equal(VolumeUnit.Tablespoon, tablespoonQuantity.Unit); - - var teaspoonQuantity = cubicmeter.ToUnit(VolumeUnit.Teaspoon); - AssertEx.EqualTolerance(TeaspoonsInOneCubicMeter, (double)teaspoonQuantity.Value, TeaspoonsTolerance); - Assert.Equal(VolumeUnit.Teaspoon, teaspoonQuantity.Unit); - var uktablespoonQuantity = cubicmeter.ToUnit(VolumeUnit.UkTablespoon); AssertEx.EqualTolerance(UkTablespoonsInOneCubicMeter, (double)uktablespoonQuantity.Value, UkTablespoonsTolerance); Assert.Equal(VolumeUnit.UkTablespoon, uktablespoonQuantity.Unit); @@ -512,8 +494,6 @@ public void ConversionRoundTrip() AssertEx.EqualTolerance(1, Volume.FromMicroliters(cubicmeter.Microliters).CubicMeters, MicrolitersTolerance); AssertEx.EqualTolerance(1, Volume.FromMilliliters(cubicmeter.Milliliters).CubicMeters, MillilitersTolerance); AssertEx.EqualTolerance(1, Volume.FromOilBarrels(cubicmeter.OilBarrels).CubicMeters, OilBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.FromTablespoons(cubicmeter.Tablespoons).CubicMeters, TablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromTeaspoons(cubicmeter.Teaspoons).CubicMeters, TeaspoonsTolerance); AssertEx.EqualTolerance(1, Volume.FromUkTablespoons(cubicmeter.UkTablespoons).CubicMeters, UkTablespoonsTolerance); AssertEx.EqualTolerance(1, Volume.FromUsBeerBarrels(cubicmeter.UsBeerBarrels).CubicMeters, UsBeerBarrelsTolerance); AssertEx.EqualTolerance(1, Volume.FromUsCustomaryCups(cubicmeter.UsCustomaryCups).CubicMeters, UsCustomaryCupsTolerance); diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index 1bdb3f34c2..e65f0df700 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -259,7 +259,6 @@ public void ShouldUseCorrectMicroSign() Assert.Equal(DurationUnit.Microsecond, Duration.ParseUnit("\u00b5s")); Assert.Equal(ElectricCurrentUnit.Microampere, ElectricCurrent.ParseUnit("\u00b5A")); Assert.Equal(ElectricPotentialUnit.Microvolt, ElectricPotential.ParseUnit("\u00b5V")); - Assert.Equal(FlowUnit.MicrolitersPerMinute, Flow.ParseUnit("\u00b5LPM")); Assert.Equal(ForceChangeRateUnit.MicronewtonPerSecond, ForceChangeRate.ParseUnit("\u00b5N/s")); Assert.Equal(ForcePerLengthUnit.MicronewtonPerMeter, ForcePerLength.ParseUnit("\u00b5N/m")); Assert.Equal(KinematicViscosityUnit.Microstokes, KinematicViscosity.ParseUnit("\u00b5St")); @@ -276,6 +275,7 @@ public void ShouldUseCorrectMicroSign() Assert.Equal(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, TemperatureChangeRate.ParseUnit("\u00b5°C/s")); Assert.Equal(VolumeUnit.Microliter, Volume.ParseUnit("\u00b5l")); Assert.Equal(VolumeUnit.CubicMicrometer, Volume.ParseUnit("\u00b5m³")); + Assert.Equal(VolumeFlowUnit.MicrolitersPerMinute, VolumeFlow.ParseUnit("\u00b5LPM")); // "\u03bc" = Lower case greek letter 'Mu' Assert.Throws(() => Acceleration.ParseUnit("\u03bcm/s²")); @@ -286,7 +286,6 @@ public void ShouldUseCorrectMicroSign() Assert.Throws(() => Duration.ParseUnit("\u03bcs")); Assert.Throws(() => ElectricCurrent.ParseUnit("\u03bcA")); Assert.Throws(() => ElectricPotential.ParseUnit("\u03bcV")); - Assert.Throws(() => Flow.ParseUnit("\u03bcLPM")); Assert.Throws(() => ForceChangeRate.ParseUnit("\u03bcN/s")); Assert.Throws(() => ForcePerLength.ParseUnit("\u03bcN/m")); Assert.Throws(() => KinematicViscosity.ParseUnit("\u03bcSt")); @@ -303,6 +302,7 @@ public void ShouldUseCorrectMicroSign() Assert.Throws(() => TemperatureChangeRate.ParseUnit("\u03bc°C/s")); Assert.Throws(() => Volume.ParseUnit("\u03bcl")); Assert.Throws(() => Volume.ParseUnit("\u03bcm³")); + Assert.Throws( () => VolumeFlow.ParseUnit( "\u03bcLPM" ) ); } [Theory] @@ -315,9 +315,7 @@ public void AllUnitAbbreviationsImplemented(string cultureName) .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, - EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) + .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) @@ -350,7 +348,6 @@ public void AllUnitsImplementToStringForInvariantCulture() Assert.Equal("1 °", Angle.FromDegrees(1).ToString()); Assert.Equal("1 m²", Area.FromSquareMeters(1).ToString()); Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToString()); - Assert.Equal("1 m³/s", Flow.FromCubicMetersPerSecond(1).ToString()); Assert.Equal("1 N", Force.FromNewtons(1).ToString()); Assert.Equal("1 m", Length.FromMeters(1).ToString()); Assert.Equal("1 kg", Mass.FromKilograms(1).ToString()); @@ -359,6 +356,7 @@ public void AllUnitsImplementToStringForInvariantCulture() Assert.Equal("1 K", Temperature.FromKelvins(1).ToString()); Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToString()); Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToString()); + Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToString()); Assert.Equal("2 ft 3 in", Length.FromFeetInches(2, 3).FeetInches.ToString()); Assert.Equal("3 st 7 lb", Mass.FromStonePounds(3, 7).StonePounds.ToString()); @@ -464,14 +462,14 @@ public void Parse_AmbiguousUnitsThrowsException() UnitSystem unitSystem = UnitSystem.Default; // Act 1 - var exception1 = Assert.Throws(() => unitSystem.Parse("tsp")); + var exception1 = Assert.Throws(() => unitSystem.Parse("pt")); // Act 2 - var exception2 = Assert.Throws(() => Volume.Parse("1 tsp")); + var exception2 = Assert.Throws(() => Length.Parse("1 pt")); // Assert - Assert.Equal("Cannot parse \"tsp\" since it could be either of these: MetricTeaspoon, Teaspoon", exception1.Message); - Assert.Equal("Cannot parse \"tsp\" since it could be either of these: MetricTeaspoon, Teaspoon", exception2.Message); + Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception1.Message); + Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception2.Message); } [Fact] diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 2d92d5144b..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,239 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Flow - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit CubicMeterPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Flow() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(FlowUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Flow Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - FlowUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMetersPerSecond(x.CubicMetersPerSecond + y.CubicMetersPerSecond)); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Flow result) - { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Flow); - return false; - } - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static FlowUnit ParseUnit(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == FlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized FlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. - /// String representation. - public string ToString(FlowUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(FlowUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(FlowUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs b/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs index 4395200509..ba34a2e828 100644 --- a/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs +++ b/UnitsNet/CustomCode/Quantities/LapseRate.extra.cs @@ -35,14 +35,14 @@ public partial struct LapseRate #if !WINDOWS_UWP public static Length operator /(TemperatureDelta left, LapseRate right) { - return Length.FromKilometers(left.KelvinsDelta / right.DegreesCelciusPerKilometer); + return Length.FromKilometers(left.Kelvins / right.DegreesCelciusPerKilometer); } public static TemperatureDelta operator *(Length left, LapseRate right) => right * left; public static TemperatureDelta operator *(LapseRate left, Length right) { - return TemperatureDelta.FromDegreesCelsiusDelta(left.DegreesCelciusPerKilometer * right.Kilometers); + return TemperatureDelta.FromDegreesCelsius(left.DegreesCelciusPerKilometer * right.Kilometers); } #endif } diff --git a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs index 6f422283ce..ec0234a55c 100644 --- a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs @@ -42,7 +42,7 @@ public partial struct Temperature /// The new temperature. public static Temperature operator +(Temperature left, TemperatureDelta right) { - return new Temperature(left.Kelvins + right.KelvinsDelta); + return new Temperature(left.Kelvins + right.Kelvins); } /// @@ -52,7 +52,7 @@ public partial struct Temperature /// The new temperature. public static Temperature operator +(TemperatureDelta left, Temperature right) { - return new Temperature(left.KelvinsDelta + right.Kelvins); + return new Temperature(left.Kelvins + right.Kelvins); } /// @@ -62,7 +62,7 @@ public partial struct Temperature /// The new temperature. public static Temperature operator -(Temperature left, TemperatureDelta right) { - return new Temperature(left.Kelvins - right.KelvinsDelta); + return new Temperature(left.Kelvins - right.Kelvins); } /// @@ -111,4 +111,4 @@ public Temperature Divide(double divisor, TemperatureUnit unit) return From(resultInUnit, unit); } } -} \ No newline at end of file +} diff --git a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs b/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs index 88d598e747..4ec7201483 100644 --- a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs +++ b/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs @@ -35,7 +35,7 @@ public partial struct TemperatureDelta #if !WINDOWS_UWP public static LapseRate operator /(TemperatureDelta left, Length right) { - return LapseRate.FromDegreesCelciusPerKilometer(left.DegreesCelsiusDelta / right.Kilometers); + return LapseRate.FromDegreesCelciusPerKilometer(left.DegreesCelsius / right.Kilometers); } public static SpecificEnergy operator *(SpecificEntropy specificEntropy, TemperatureDelta temperatureDelta) diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs index 48e1ccab1a..dafbb1e1a8 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs @@ -99,18 +99,6 @@ public static class NumberToDurationExtensions #endregion - #region Month - - /// - [System.Obsolete("Use Month30 instead, which makes it clear that this is an approximate unit based on 30 days per month. The duration of a month varies, but the Gregorian solar calendar has 365.2425/12 = 30.44 days on average.")] - public static Duration Months(this T value) => Duration.FromMonths(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Months(this T? value) where T : struct => Duration.FromMonths(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region Month30 /// @@ -155,18 +143,6 @@ public static class NumberToDurationExtensions #endregion - #region Year - - /// - [System.Obsolete("Use Year365 instead, which makes it clear that this is an approximate unit based on 365 days per year. The duration of a year varies due to corrections such as leap years, since a Gregorian solar calendar has 365.2425 days.")] - public static Duration Years(this T value) => Duration.FromYears(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Years(this T? value) where T : struct => Duration.FromYears(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region Year365 /// diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs deleted file mode 100644 index 6fdb1b2fa7..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs +++ /dev/null @@ -1,331 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToFlow -{ - public static class NumberToFlowExtensions - { - #region CentilitersPerMinute - - /// - public static Flow CentilitersPerMinute(this T value) => Flow.FromCentilitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CentilitersPerMinute(this T? value) where T : struct => Flow.FromCentilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicDecimeterPerMinute - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicDecimetersPerMinute(this T value) => Flow.FromCubicDecimetersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicDecimetersPerMinute(this T? value) where T : struct => Flow.FromCubicDecimetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerHour - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicFeetPerHour(this T value) => Flow.FromCubicFeetPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicFeetPerHour(this T? value) where T : struct => Flow.FromCubicFeetPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerMinute - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicFeetPerMinute(this T value) => Flow.FromCubicFeetPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicFeetPerMinute(this T? value) where T : struct => Flow.FromCubicFeetPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerSecond - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicFeetPerSecond(this T value) => Flow.FromCubicFeetPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicFeetPerSecond(this T? value) where T : struct => Flow.FromCubicFeetPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerHour - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicMetersPerHour(this T value) => Flow.FromCubicMetersPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicMetersPerHour(this T? value) where T : struct => Flow.FromCubicMetersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerMinute - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicMetersPerMinute(this T value) => Flow.FromCubicMetersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicMetersPerMinute(this T? value) where T : struct => Flow.FromCubicMetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerSecond - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicMetersPerSecond(this T value) => Flow.FromCubicMetersPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicMetersPerSecond(this T? value) where T : struct => Flow.FromCubicMetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerHour - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicYardsPerHour(this T value) => Flow.FromCubicYardsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicYardsPerHour(this T? value) where T : struct => Flow.FromCubicYardsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerMinute - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicYardsPerMinute(this T value) => Flow.FromCubicYardsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicYardsPerMinute(this T? value) where T : struct => Flow.FromCubicYardsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerSecond - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow CubicYardsPerSecond(this T value) => Flow.FromCubicYardsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicYardsPerSecond(this T? value) where T : struct => Flow.FromCubicYardsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecilitersPerMinute - - /// - public static Flow DecilitersPerMinute(this T value) => Flow.FromDecilitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? DecilitersPerMinute(this T? value) where T : struct => Flow.FromDecilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilolitersPerMinute - - /// - public static Flow KilolitersPerMinute(this T value) => Flow.FromKilolitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? KilolitersPerMinute(this T? value) where T : struct => Flow.FromKilolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerHour - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow LitersPerHour(this T value) => Flow.FromLitersPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? LitersPerHour(this T? value) where T : struct => Flow.FromLitersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerMinute - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow LitersPerMinute(this T value) => Flow.FromLitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? LitersPerMinute(this T? value) where T : struct => Flow.FromLitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerSecond - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow LitersPerSecond(this T value) => Flow.FromLitersPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? LitersPerSecond(this T? value) where T : struct => Flow.FromLitersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrolitersPerMinute - - /// - public static Flow MicrolitersPerMinute(this T value) => Flow.FromMicrolitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? MicrolitersPerMinute(this T? value) where T : struct => Flow.FromMicrolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillilitersPerMinute - - /// - public static Flow MillilitersPerMinute(this T value) => Flow.FromMillilitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? MillilitersPerMinute(this T? value) where T : struct => Flow.FromMillilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillionUsGallonsPerDay - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow MillionUsGallonsPerDay(this T value) => Flow.FromMillionUsGallonsPerDay(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? MillionUsGallonsPerDay(this T? value) where T : struct => Flow.FromMillionUsGallonsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanolitersPerMinute - - /// - public static Flow NanolitersPerMinute(this T value) => Flow.FromNanolitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? NanolitersPerMinute(this T? value) where T : struct => Flow.FromNanolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerDay - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow OilBarrelsPerDay(this T value) => Flow.FromOilBarrelsPerDay(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? OilBarrelsPerDay(this T? value) where T : struct => Flow.FromOilBarrelsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerHour - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow UsGallonsPerHour(this T value) => Flow.FromUsGallonsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? UsGallonsPerHour(this T? value) where T : struct => Flow.FromUsGallonsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerMinute - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow UsGallonsPerMinute(this T value) => Flow.FromUsGallonsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? UsGallonsPerMinute(this T? value) where T : struct => Flow.FromUsGallonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerSecond - - /// - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - public static Flow UsGallonsPerSecond(this T value) => Flow.FromUsGallonsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? UsGallonsPerSecond(this T? value) where T : struct => Flow.FromUsGallonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs index 3a81e40518..31775e6ab4 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs @@ -396,18 +396,6 @@ public static class NumberToPressureExtensions #endregion - #region Psi - - /// - [System.Obsolete("Deprecated due to github issue #215, please use PoundForcePerSquareInch instead")] - public static Pressure Psi(this T value) => Pressure.FromPsi(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Psi(this T? value) where T : struct => Pressure.FromPsi(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region TechnicalAtmosphere /// diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs index 1b2559ee15..1e0f241ffd 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs @@ -55,18 +55,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region DegreeCelsiusDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeCelsius instead")] - public static TemperatureDelta DegreesCelsiusDelta(this T value) => TemperatureDelta.FromDegreesCelsiusDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesCelsiusDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesCelsiusDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region DegreeDelisle /// @@ -78,18 +66,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region DegreeDelisleDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeDelisle instead")] - public static TemperatureDelta DegreesDelisleDelta(this T value) => TemperatureDelta.FromDegreesDelisleDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesDelisleDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesDelisleDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region DegreeFahrenheit /// @@ -101,18 +77,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region DegreeFahrenheitDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeFahrenheit instead")] - public static TemperatureDelta DegreesFahrenheitDelta(this T value) => TemperatureDelta.FromDegreesFahrenheitDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesFahrenheitDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesFahrenheitDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region DegreeNewton /// @@ -124,18 +88,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region DegreeNewtonDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeNewton instead")] - public static TemperatureDelta DegreesNewtonDelta(this T value) => TemperatureDelta.FromDegreesNewtonDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesNewtonDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesNewtonDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region DegreeRankine /// @@ -147,18 +99,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region DegreeRankineDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRankine instead")] - public static TemperatureDelta DegreesRankineDelta(this T value) => TemperatureDelta.FromDegreesRankineDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesRankineDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesRankineDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region DegreeReaumur /// @@ -170,18 +110,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region DegreeReaumurDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeReaumur instead")] - public static TemperatureDelta DegreesReaumurDelta(this T value) => TemperatureDelta.FromDegreesReaumurDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesReaumurDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesReaumurDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region DegreeRoemer /// @@ -193,18 +121,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region DegreeRoemerDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRoemer instead")] - public static TemperatureDelta DegreesRoemerDelta(this T value) => TemperatureDelta.FromDegreesRoemerDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesRoemerDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesRoemerDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region Kelvin /// @@ -216,18 +132,6 @@ public static class NumberToTemperatureDeltaExtensions #endregion - #region KelvinDelta - - /// - [System.Obsolete("Deprecated due to github issue #180, please use Kelvin instead")] - public static TemperatureDelta KelvinsDelta(this T value) => TemperatureDelta.FromKelvinsDelta(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? KelvinsDelta(this T? value) where T : struct => TemperatureDelta.FromKelvinsDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs index 26c05e3625..7f51e84537 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs @@ -396,30 +396,6 @@ public static class NumberToVolumeExtensions #endregion - #region Tablespoon - - /// - [System.Obsolete("Deprecated due to github issue #134, please use UsTablespoon instead")] - public static Volume Tablespoons(this T value) => Volume.FromTablespoons(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Tablespoons(this T? value) where T : struct => Volume.FromTablespoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Teaspoon - - /// - [System.Obsolete("Deprecated due to github issue #134, please use UsTeaspoon instead")] - public static Volume Teaspoons(this T value) => Volume.FromTeaspoons(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Teaspoons(this T? value) where T : struct => Volume.FromTeaspoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - #region UkTablespoon /// diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 351f373794..5a6de28e1c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -107,15 +107,6 @@ public partial struct Duration : IComparable, IComparable return minutes.HasValue ? FromMinutes(minutes.Value) : default(Duration?); } - /// - /// Get nullable Duration from nullable Months. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromMonths(QuantityValue? months) - { - return months.HasValue ? FromMonths(months.Value) : default(Duration?); - } - /// /// Get nullable Duration from nullable Months30. /// @@ -152,15 +143,6 @@ public partial struct Duration : IComparable, IComparable return weeks.HasValue ? FromWeeks(weeks.Value) : default(Duration?); } - /// - /// Get nullable Duration from nullable Years. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromYears(QuantityValue? years) - { - return years.HasValue ? FromYears(years.Value) : default(Duration?); - } - /// /// Get nullable Duration from nullable Years365. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs deleted file mode 100644 index 1530fa6888..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs +++ /dev/null @@ -1,528 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. - /// - // ReSharper disable once PartialTypeWithSinglePart - - 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. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCentilitersPerMinute(QuantityValue? centilitersperminute) - { - return centilitersperminute.HasValue ? FromCentilitersPerMinute(centilitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicDecimetersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicDecimetersPerMinute(QuantityValue? cubicdecimetersperminute) - { - return cubicdecimetersperminute.HasValue ? FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicFeetPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicFeetPerHour(QuantityValue? cubicfeetperhour) - { - return cubicfeetperhour.HasValue ? FromCubicFeetPerHour(cubicfeetperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicFeetPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicFeetPerMinute(QuantityValue? cubicfeetperminute) - { - return cubicfeetperminute.HasValue ? FromCubicFeetPerMinute(cubicfeetperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicFeetPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicFeetPerSecond(QuantityValue? cubicfeetpersecond) - { - return cubicfeetpersecond.HasValue ? FromCubicFeetPerSecond(cubicfeetpersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicMetersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicMetersPerHour(QuantityValue? cubicmetersperhour) - { - return cubicmetersperhour.HasValue ? FromCubicMetersPerHour(cubicmetersperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicMetersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicMetersPerMinute(QuantityValue? cubicmetersperminute) - { - return cubicmetersperminute.HasValue ? FromCubicMetersPerMinute(cubicmetersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicMetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicMetersPerSecond(QuantityValue? cubicmeterspersecond) - { - return cubicmeterspersecond.HasValue ? FromCubicMetersPerSecond(cubicmeterspersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicYardsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicYardsPerHour(QuantityValue? cubicyardsperhour) - { - return cubicyardsperhour.HasValue ? FromCubicYardsPerHour(cubicyardsperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicYardsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicYardsPerMinute(QuantityValue? cubicyardsperminute) - { - return cubicyardsperminute.HasValue ? FromCubicYardsPerMinute(cubicyardsperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicYardsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicYardsPerSecond(QuantityValue? cubicyardspersecond) - { - return cubicyardspersecond.HasValue ? FromCubicYardsPerSecond(cubicyardspersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable DecilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromDecilitersPerMinute(QuantityValue? decilitersperminute) - { - return decilitersperminute.HasValue ? FromDecilitersPerMinute(decilitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable KilolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromKilolitersPerMinute(QuantityValue? kilolitersperminute) - { - return kilolitersperminute.HasValue ? FromKilolitersPerMinute(kilolitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable LitersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromLitersPerHour(QuantityValue? litersperhour) - { - return litersperhour.HasValue ? FromLitersPerHour(litersperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable LitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromLitersPerMinute(QuantityValue? litersperminute) - { - return litersperminute.HasValue ? FromLitersPerMinute(litersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable LitersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromLitersPerSecond(QuantityValue? literspersecond) - { - return literspersecond.HasValue ? FromLitersPerSecond(literspersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable MicrolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromMicrolitersPerMinute(QuantityValue? microlitersperminute) - { - return microlitersperminute.HasValue ? FromMicrolitersPerMinute(microlitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable MillilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromMillilitersPerMinute(QuantityValue? millilitersperminute) - { - return millilitersperminute.HasValue ? FromMillilitersPerMinute(millilitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable MillionUsGallonsPerDay. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromMillionUsGallonsPerDay(QuantityValue? millionusgallonsperday) - { - return millionusgallonsperday.HasValue ? FromMillionUsGallonsPerDay(millionusgallonsperday.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable NanolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromNanolitersPerMinute(QuantityValue? nanolitersperminute) - { - return nanolitersperminute.HasValue ? FromNanolitersPerMinute(nanolitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable OilBarrelsPerDay. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromOilBarrelsPerDay(QuantityValue? oilbarrelsperday) - { - return oilbarrelsperday.HasValue ? FromOilBarrelsPerDay(oilbarrelsperday.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable UsGallonsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromUsGallonsPerHour(QuantityValue? usgallonsperhour) - { - return usgallonsperhour.HasValue ? FromUsGallonsPerHour(usgallonsperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable UsGallonsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromUsGallonsPerMinute(QuantityValue? usgallonsperminute) - { - return usgallonsperminute.HasValue ? FromUsGallonsPerMinute(usgallonsperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable UsGallonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? From(QuantityValue? value, FlowUnit fromUnit) - { - return value.HasValue ? new Flow((double)value.Value, fromUnit) : default(Flow?); - } - - #endregion - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(FlowUnit unit, [CanBeNull] IFormatProvider provider) - { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Flow Parse(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - FlowUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMetersPerSecond(x.CubicMetersPerSecond + y.CubicMetersPerSecond)); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Flow result) - { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Flow); - return false; - } - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static FlowUnit ParseUnit(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == FlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized FlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . - /// String representation. - public string ToString(FlowUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(FlowUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to . - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(FlowUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? UnitSystem.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 251ae0bce2..0a73b6efb5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -350,15 +350,6 @@ public partial struct Pressure : IComparable, IComparable return poundsforcepersquareinch.HasValue ? FromPoundsForcePerSquareInch(poundsforcepersquareinch.Value) : default(Pressure?); } - /// - /// Get nullable Pressure from nullable Psi. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromPsi(QuantityValue? psi) - { - return psi.HasValue ? FromPsi(psi.Value) : default(Pressure?); - } - /// /// Get nullable Pressure from nullable TechnicalAtmospheres. /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 1a85aa86c7..b0d857da0d 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -71,15 +71,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable DegreesCelsiusDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesCelsiusDelta(QuantityValue? degreescelsiusdelta) - { - return degreescelsiusdelta.HasValue ? FromDegreesCelsiusDelta(degreescelsiusdelta.Value) : default(TemperatureDelta?); - } - /// /// Get nullable TemperatureDelta from nullable DegreesDelisle. /// @@ -89,15 +80,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable DegreesDelisleDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesDelisleDelta(QuantityValue? degreesdelisledelta) - { - return degreesdelisledelta.HasValue ? FromDegreesDelisleDelta(degreesdelisledelta.Value) : default(TemperatureDelta?); - } - /// /// Get nullable TemperatureDelta from nullable DegreesFahrenheit. /// @@ -107,15 +89,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable DegreesFahrenheitDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesFahrenheitDelta(QuantityValue? degreesfahrenheitdelta) - { - return degreesfahrenheitdelta.HasValue ? FromDegreesFahrenheitDelta(degreesfahrenheitdelta.Value) : default(TemperatureDelta?); - } - /// /// Get nullable TemperatureDelta from nullable DegreesNewton. /// @@ -125,15 +98,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable DegreesNewtonDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesNewtonDelta(QuantityValue? degreesnewtondelta) - { - return degreesnewtondelta.HasValue ? FromDegreesNewtonDelta(degreesnewtondelta.Value) : default(TemperatureDelta?); - } - /// /// Get nullable TemperatureDelta from nullable DegreesRankine. /// @@ -143,15 +107,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable DegreesRankineDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesRankineDelta(QuantityValue? degreesrankinedelta) - { - return degreesrankinedelta.HasValue ? FromDegreesRankineDelta(degreesrankinedelta.Value) : default(TemperatureDelta?); - } - /// /// Get nullable TemperatureDelta from nullable DegreesReaumur. /// @@ -161,15 +116,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable DegreesReaumurDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesReaumurDelta(QuantityValue? degreesreaumurdelta) - { - return degreesreaumurdelta.HasValue ? FromDegreesReaumurDelta(degreesreaumurdelta.Value) : default(TemperatureDelta?); - } - /// /// Get nullable TemperatureDelta from nullable DegreesRoemer. /// @@ -179,15 +125,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable DegreesRoemerDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesRoemerDelta(QuantityValue? degreesroemerdelta) - { - return degreesroemerdelta.HasValue ? FromDegreesRoemerDelta(degreesroemerdelta.Value) : default(TemperatureDelta?); - } - /// /// Get nullable TemperatureDelta from nullable Kelvins. /// @@ -197,15 +134,6 @@ public partial struct TemperatureDelta : IComparable, IComparable - /// Get nullable TemperatureDelta from nullable KelvinsDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromKelvinsDelta(QuantityValue? kelvinsdelta) - { - return kelvinsdelta.HasValue ? FromKelvinsDelta(kelvinsdelta.Value) : default(TemperatureDelta?); - } - /// /// Dynamically convert from value and unit enum to . /// diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 17ec35b34f..777dd16aea 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -350,24 +350,6 @@ public partial struct Volume : IComparable, IComparable return oilbarrels.HasValue ? FromOilBarrels(oilbarrels.Value) : default(Volume?); } - /// - /// Get nullable Volume from nullable Tablespoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromTablespoons(QuantityValue? tablespoons) - { - return tablespoons.HasValue ? FromTablespoons(tablespoons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Teaspoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromTeaspoons(QuantityValue? teaspoons) - { - return teaspoons.HasValue ? FromTeaspoons(teaspoons.Value) : default(Volume?); - } - /// /// Get nullable Volume from nullable UkTablespoons. /// diff --git a/UnitsNet/GeneratedCode/QuantityType.g.cs b/UnitsNet/GeneratedCode/QuantityType.g.cs index cb098ee0bf..932cce055f 100644 --- a/UnitsNet/GeneratedCode/QuantityType.g.cs +++ b/UnitsNet/GeneratedCode/QuantityType.g.cs @@ -81,7 +81,6 @@ public enum QuantityType ElectricResistivity, Energy, Entropy, - Flow, Force, ForceChangeRate, ForcePerLength, diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index b1bb2a1d23..e8d6492a90 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -861,12 +861,6 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "m", "min", "minute", "minutes"), new AbbreviationsForCulture("ru-RU", "мин"), }), - new CulturesForEnumValue((int) DurationUnit.Month, - new[] - { - new AbbreviationsForCulture("en-US", "mo", "month", "months"), - new AbbreviationsForCulture("ru-RU", "месяц"), - }), new CulturesForEnumValue((int) DurationUnit.Month30, new[] { @@ -891,12 +885,6 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "wk", "week", "weeks"), new AbbreviationsForCulture("ru-RU", "мин"), }), - new CulturesForEnumValue((int) DurationUnit.Year, - new[] - { - new AbbreviationsForCulture("en-US", "yr", "year", "years"), - new AbbreviationsForCulture("ru-RU", "год"), - }), new CulturesForEnumValue((int) DurationUnit.Year365, new[] { @@ -1391,134 +1379,6 @@ private static readonly ReadOnlyCollection DefaultLocalization new AbbreviationsForCulture("en-US", "MJ/K"), }), }), - new UnitLocalization(typeof (FlowUnit), - new[] - { - new CulturesForEnumValue((int) FlowUnit.CentilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicDecimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dm³/min"), - new AbbreviationsForCulture("ru-RU", "дм³/мин"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicFootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/h", "cf/hr"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicFootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/min"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicFootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/s"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicMeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "m³/h"), - new AbbreviationsForCulture("ru-RU", "м³/ч"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicMeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "m³/min"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicMeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m³/s"), - new AbbreviationsForCulture("ru-RU", "м³/с"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicYardPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/h"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicYardPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/min"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicYardPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/s"), - }), - new CulturesForEnumValue((int) FlowUnit.DecilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.KilolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.LitersPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "LPH"), - new AbbreviationsForCulture("ru-RU", "л/ч"), - }), - new CulturesForEnumValue((int) FlowUnit.LitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "LPM"), - }), - new CulturesForEnumValue((int) FlowUnit.LitersPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "LPS"), - }), - new CulturesForEnumValue((int) FlowUnit.MicrolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "µLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.MillilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "mLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.MillionUsGallonsPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "MGD"), - }), - new CulturesForEnumValue((int) FlowUnit.NanolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "nLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.OilBarrelsPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/d", "BOPD"), - }), - new CulturesForEnumValue((int) FlowUnit.UsGallonsPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/h"), - }), - new CulturesForEnumValue((int) FlowUnit.UsGallonsPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/min", "GPM"), - }), - new CulturesForEnumValue((int) FlowUnit.UsGallonsPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/s"), - }), - }), new UnitLocalization(typeof (ForceUnit), new[] { @@ -3351,12 +3211,6 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "psi", "lb/in²"), }), - new CulturesForEnumValue((int) PressureUnit.Psi, - new[] - { - new AbbreviationsForCulture("en-US", "psi"), - new AbbreviationsForCulture("ru-RU", "psi"), - }), new CulturesForEnumValue((int) PressureUnit.TechnicalAtmosphere, new[] { @@ -4098,81 +3952,41 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "∆°C"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeCelsiusDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°C"), - }), new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeDelisle, new[] { new AbbreviationsForCulture("en-US", "∆°De"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeDelisleDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°De"), - }), new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeFahrenheit, new[] { new AbbreviationsForCulture("en-US", "∆°F"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeFahrenheitDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°F"), - }), new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeNewton, new[] { new AbbreviationsForCulture("en-US", "∆°N"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeNewtonDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°N"), - }), new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRankine, new[] { new AbbreviationsForCulture("en-US", "∆°R"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRankineDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°R"), - }), new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeReaumur, new[] { new AbbreviationsForCulture("en-US", "∆°Ré"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeReaumurDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Ré"), - }), new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRoemer, new[] { new AbbreviationsForCulture("en-US", "∆°Rø"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRoemerDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Rø"), - }), new CulturesForEnumValue((int) TemperatureDeltaUnit.Kelvin, new[] { new AbbreviationsForCulture("en-US", "∆K"), }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.KelvinDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆K"), - }), }), new UnitLocalization(typeof (ThermalConductivityUnit), new[] @@ -4532,20 +4346,6 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "bbl"), }), - new CulturesForEnumValue((int) VolumeUnit.Tablespoon, - new[] - { - new AbbreviationsForCulture("en-US", "Tbsp", "Tbs", "T", "tb", "tbs", "tbsp", "tblsp", "tblspn", "Tbsp.", "Tbs.", "T.", "tb.", "tbs.", "tbsp.", "tblsp.", "tblspn.", "tablespoon", "Tablespoon"), - new AbbreviationsForCulture("ru-RU", "столовая ложка"), - new AbbreviationsForCulture("nb-NO", "ss", "ss.", "SS", "SS."), - }), - new CulturesForEnumValue((int) VolumeUnit.Teaspoon, - new[] - { - new AbbreviationsForCulture("en-US", "tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"), - new AbbreviationsForCulture("ru-RU", "чайная ложка"), - new AbbreviationsForCulture("nb-NO", "ts", "ts."), - }), new CulturesForEnumValue((int) VolumeUnit.UkTablespoon, new[] { diff --git a/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs b/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs index 5ac31e5143..8131bbf267 100644 --- a/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs @@ -50,14 +50,10 @@ public enum DurationUnit Microsecond, Millisecond, Minute, - [System.Obsolete("Use Month30 instead, which makes it clear that this is an approximate unit based on 30 days per month. The duration of a month varies, but the Gregorian solar calendar has 365.2425/12 = 30.44 days on average.")] - Month, Month30, Nanosecond, Second, Week, - [System.Obsolete("Use Year365 instead, which makes it clear that this is an approximate unit based on 365 days per year. The duration of a year varies due to corrections such as leap years, since a Gregorian solar calendar has 365.2425 days.")] - Year, Year365, } diff --git a/UnitsNet/GeneratedCode/Units/FlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/FlowUnit.g.cs deleted file mode 100644 index 1cf0e5b07c..0000000000 --- a/UnitsNet/GeneratedCode/Units/FlowUnit.g.cs +++ /dev/null @@ -1,93 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Units -{ - // Disable missing XML comment warnings for the generated unit enums. - #pragma warning disable 1591 - - public enum FlowUnit - { - Undefined = 0, - CentilitersPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicDecimeterPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicFootPerHour, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicFootPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicFootPerSecond, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicMeterPerHour, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicMeterPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicMeterPerSecond, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicYardPerHour, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicYardPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - CubicYardPerSecond, - DecilitersPerMinute, - KilolitersPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - LitersPerHour, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - LitersPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - LitersPerSecond, - MicrolitersPerMinute, - MillilitersPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - MillionUsGallonsPerDay, - NanolitersPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - OilBarrelsPerDay, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - UsGallonsPerHour, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - UsGallonsPerMinute, - [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] - UsGallonsPerSecond, - } - - #pragma warning restore 1591 -} diff --git a/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs b/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs index dd3633fc11..4077f28533 100644 --- a/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs @@ -77,8 +77,6 @@ public enum PressureUnit Pascal, PoundForcePerSquareFoot, PoundForcePerSquareInch, - [System.Obsolete("Deprecated due to github issue #215, please use PoundForcePerSquareInch instead")] - Psi, TechnicalAtmosphere, TonneForcePerSquareCentimeter, TonneForcePerSquareMeter, diff --git a/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs b/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs index 20841be3dd..ef6299db7d 100644 --- a/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs @@ -46,29 +46,13 @@ public enum TemperatureDeltaUnit { Undefined = 0, DegreeCelsius, - [System.Obsolete("Deprecated due to github issue #180, please use DegreeCelsius instead")] - DegreeCelsiusDelta, DegreeDelisle, - [System.Obsolete("Deprecated due to github issue #180, please use DegreeDelisle instead")] - DegreeDelisleDelta, DegreeFahrenheit, - [System.Obsolete("Deprecated due to github issue #180, please use DegreeFahrenheit instead")] - DegreeFahrenheitDelta, DegreeNewton, - [System.Obsolete("Deprecated due to github issue #180, please use DegreeNewton instead")] - DegreeNewtonDelta, DegreeRankine, - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRankine instead")] - DegreeRankineDelta, DegreeReaumur, - [System.Obsolete("Deprecated due to github issue #180, please use DegreeReaumur instead")] - DegreeReaumurDelta, DegreeRoemer, - [System.Obsolete("Deprecated due to github issue #180, please use DegreeRoemer instead")] - DegreeRoemerDelta, Kelvin, - [System.Obsolete("Deprecated due to github issue #180, please use Kelvin instead")] - KelvinDelta, } #pragma warning restore 1591 diff --git a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs index 1dc0bbadc4..100a3162f3 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs @@ -77,10 +77,6 @@ public enum VolumeUnit Microliter, Milliliter, OilBarrel, - [System.Obsolete("Deprecated due to github issue #134, please use UsTablespoon instead")] - Tablespoon, - [System.Obsolete("Deprecated due to github issue #134, please use UsTeaspoon instead")] - Teaspoon, UkTablespoon, UsBeerBarrel, UsCustomaryCup, From 6752b26c9a381751c92ab64e7ae5ceeb2ec37252 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 27 Sep 2018 16:06:46 -0400 Subject: [PATCH 004/131] Removing equality methods/operators that do not accept a relative/absolute equality check. --- .../Quantities/Acceleration.Common.g.cs | 24 ------------------- .../Quantities/AmountOfSubstance.Common.g.cs | 24 ------------------- .../Quantities/AmplitudeRatio.Common.g.cs | 24 ------------------- .../Quantities/Angle.Common.g.cs | 24 ------------------- .../Quantities/ApparentEnergy.Common.g.cs | 24 ------------------- .../Quantities/ApparentPower.Common.g.cs | 24 ------------------- .../GeneratedCode/Quantities/Area.Common.g.cs | 24 ------------------- .../Quantities/AreaDensity.Common.g.cs | 24 ------------------- .../AreaMomentOfInertia.Common.g.cs | 24 ------------------- .../Quantities/BitRate.Common.g.cs | 23 ------------------ .../BrakeSpecificFuelConsumption.Common.g.cs | 24 ------------------- .../Quantities/Capacitance.Common.g.cs | 24 ------------------- .../Quantities/Density.Common.g.cs | 24 ------------------- .../Quantities/Duration.Common.g.cs | 24 ------------------- .../Quantities/DynamicViscosity.Common.g.cs | 24 ------------------- .../Quantities/ElectricAdmittance.Common.g.cs | 24 ------------------- .../Quantities/ElectricCharge.Common.g.cs | 24 ------------------- .../ElectricChargeDensity.Common.g.cs | 24 ------------------- .../ElectricConductance.Common.g.cs | 24 ------------------- .../ElectricConductivity.Common.g.cs | 24 ------------------- .../Quantities/ElectricCurrent.Common.g.cs | 24 ------------------- .../ElectricCurrentDensity.Common.g.cs | 24 ------------------- .../ElectricCurrentGradient.Common.g.cs | 24 ------------------- .../Quantities/ElectricField.Common.g.cs | 24 ------------------- .../Quantities/ElectricInductance.Common.g.cs | 24 ------------------- .../Quantities/ElectricPotential.Common.g.cs | 24 ------------------- .../ElectricPotentialAc.Common.g.cs | 24 ------------------- .../ElectricPotentialDc.Common.g.cs | 24 ------------------- .../Quantities/ElectricResistance.Common.g.cs | 24 ------------------- .../ElectricResistivity.Common.g.cs | 24 ------------------- .../Quantities/Energy.Common.g.cs | 24 ------------------- .../Quantities/Entropy.Common.g.cs | 24 ------------------- .../GeneratedCode/Quantities/Flow.Common.g.cs | 24 ------------------- .../Quantities/Force.Common.g.cs | 24 ------------------- .../Quantities/ForceChangeRate.Common.g.cs | 24 ------------------- .../Quantities/ForcePerLength.Common.g.cs | 24 ------------------- .../Quantities/Frequency.Common.g.cs | 24 ------------------- .../Quantities/HeatFlux.Common.g.cs | 24 ------------------- .../HeatTransferCoefficient.Common.g.cs | 24 ------------------- .../Quantities/Illuminance.Common.g.cs | 24 ------------------- .../Quantities/Information.Common.g.cs | 23 ------------------ .../Quantities/Irradiance.Common.g.cs | 24 ------------------- .../Quantities/Irradiation.Common.g.cs | 24 ------------------- .../Quantities/KinematicViscosity.Common.g.cs | 24 ------------------- .../Quantities/LapseRate.Common.g.cs | 24 ------------------- .../Quantities/Length.Common.g.cs | 24 ------------------- .../Quantities/Level.Common.g.cs | 24 ------------------- .../Quantities/LinearDensity.Common.g.cs | 24 ------------------- .../Quantities/LuminousFlux.Common.g.cs | 24 ------------------- .../Quantities/LuminousIntensity.Common.g.cs | 24 ------------------- .../Quantities/MagneticField.Common.g.cs | 24 ------------------- .../Quantities/MagneticFlux.Common.g.cs | 24 ------------------- .../Quantities/Magnetization.Common.g.cs | 24 ------------------- .../GeneratedCode/Quantities/Mass.Common.g.cs | 24 ------------------- .../Quantities/MassFlow.Common.g.cs | 24 ------------------- .../Quantities/MassFlux.Common.g.cs | 24 ------------------- .../MassMomentOfInertia.Common.g.cs | 24 ------------------- .../Quantities/MolarEnergy.Common.g.cs | 24 ------------------- .../Quantities/MolarEntropy.Common.g.cs | 24 ------------------- .../Quantities/MolarMass.Common.g.cs | 24 ------------------- .../Quantities/Molarity.Common.g.cs | 24 ------------------- .../Quantities/Permeability.Common.g.cs | 24 ------------------- .../Quantities/Permittivity.Common.g.cs | 24 ------------------- .../Quantities/Power.Common.g.cs | 23 ------------------ .../Quantities/PowerDensity.Common.g.cs | 24 ------------------- .../Quantities/PowerRatio.Common.g.cs | 24 ------------------- .../Quantities/Pressure.Common.g.cs | 24 ------------------- .../Quantities/PressureChangeRate.Common.g.cs | 24 ------------------- .../Quantities/Ratio.Common.g.cs | 24 ------------------- .../Quantities/ReactiveEnergy.Common.g.cs | 24 ------------------- .../Quantities/ReactivePower.Common.g.cs | 24 ------------------- .../RotationalAcceleration.Common.g.cs | 24 ------------------- .../Quantities/RotationalSpeed.Common.g.cs | 24 ------------------- .../RotationalStiffness.Common.g.cs | 24 ------------------- .../RotationalStiffnessPerLength.Common.g.cs | 24 ------------------- .../Quantities/SolidAngle.Common.g.cs | 24 ------------------- .../Quantities/SpecificEnergy.Common.g.cs | 24 ------------------- .../Quantities/SpecificEntropy.Common.g.cs | 24 ------------------- .../Quantities/SpecificVolume.Common.g.cs | 24 ------------------- .../Quantities/SpecificWeight.Common.g.cs | 24 ------------------- .../Quantities/Speed.Common.g.cs | 24 ------------------- .../Quantities/Temperature.Common.g.cs | 24 ------------------- .../TemperatureChangeRate.Common.g.cs | 24 ------------------- .../Quantities/TemperatureDelta.Common.g.cs | 24 ------------------- .../ThermalConductivity.Common.g.cs | 24 ------------------- .../Quantities/ThermalResistance.Common.g.cs | 24 ------------------- .../Quantities/Torque.Common.g.cs | 24 ------------------- .../Quantities/VitaminA.Common.g.cs | 24 ------------------- .../Quantities/Volume.Common.g.cs | 24 ------------------- .../Quantities/VolumeFlow.Common.g.cs | 24 ------------------- .../GeneratedCode/AccelerationTestsBase.g.cs | 20 ++-------------- .../AmountOfSubstanceTestsBase.g.cs | 20 ++-------------- .../AmplitudeRatioTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/AngleTestsBase.g.cs | 20 ++-------------- .../ApparentEnergyTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/ApparentPowerTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/AreaDensityTestsBase.g.cs | 20 ++-------------- .../AreaMomentOfInertiaTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/AreaTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/BitRateTestsBase.g.cs | 20 ++-------------- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/CapacitanceTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/DensityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/DurationTestsBase.g.cs | 20 ++-------------- .../DynamicViscosityTestsBase.g.cs | 20 ++-------------- .../ElectricAdmittanceTestsBase.g.cs | 20 ++-------------- .../ElectricChargeDensityTestsBase.g.cs | 20 ++-------------- .../ElectricChargeTestsBase.g.cs | 20 ++-------------- .../ElectricConductanceTestsBase.g.cs | 20 ++-------------- .../ElectricConductivityTestsBase.g.cs | 20 ++-------------- .../ElectricCurrentDensityTestsBase.g.cs | 20 ++-------------- .../ElectricCurrentGradientTestsBase.g.cs | 20 ++-------------- .../ElectricCurrentTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/ElectricFieldTestsBase.g.cs | 20 ++-------------- .../ElectricInductanceTestsBase.g.cs | 20 ++-------------- .../ElectricPotentialAcTestsBase.g.cs | 20 ++-------------- .../ElectricPotentialDcTestsBase.g.cs | 20 ++-------------- .../ElectricPotentialTestsBase.g.cs | 20 ++-------------- .../ElectricResistanceTestsBase.g.cs | 20 ++-------------- .../ElectricResistivityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/EnergyTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/EntropyTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/FlowTestsBase.g.cs | 20 ++-------------- .../ForceChangeRateTestsBase.g.cs | 20 ++-------------- .../ForcePerLengthTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/ForceTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/FrequencyTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/HeatFluxTestsBase.g.cs | 20 ++-------------- .../HeatTransferCoefficientTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/IlluminanceTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/InformationTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/IrradianceTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/IrradiationTestsBase.g.cs | 20 ++-------------- .../KinematicViscosityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/LapseRateTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/LengthTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/LevelTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/LinearDensityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/LuminousFluxTestsBase.g.cs | 20 ++-------------- .../LuminousIntensityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MagneticFieldTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MagneticFluxTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MagnetizationTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MassFlowTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MassFluxTestsBase.g.cs | 20 ++-------------- .../MassMomentOfInertiaTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MassTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MolarEnergyTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MolarEntropyTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MolarMassTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/MolarityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/PermeabilityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/PermittivityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/PowerDensityTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/PowerRatioTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/PowerTestsBase.g.cs | 20 ++-------------- .../PressureChangeRateTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/PressureTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/RatioTestsBase.g.cs | 20 ++-------------- .../ReactiveEnergyTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/ReactivePowerTestsBase.g.cs | 20 ++-------------- .../RotationalAccelerationTestsBase.g.cs | 20 ++-------------- .../RotationalSpeedTestsBase.g.cs | 20 ++-------------- ...RotationalStiffnessPerLengthTestsBase.g.cs | 20 ++-------------- .../RotationalStiffnessTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/SolidAngleTestsBase.g.cs | 20 ++-------------- .../SpecificEnergyTestsBase.g.cs | 20 ++-------------- .../SpecificEntropyTestsBase.g.cs | 20 ++-------------- .../SpecificVolumeTestsBase.g.cs | 20 ++-------------- .../SpecificWeightTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/SpeedTestsBase.g.cs | 20 ++-------------- .../TemperatureChangeRateTestsBase.g.cs | 20 ++-------------- .../TemperatureDeltaTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/TemperatureTestsBase.g.cs | 20 ++-------------- .../ThermalConductivityTestsBase.g.cs | 20 ++-------------- .../ThermalResistanceTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/TorqueTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/VitaminATestsBase.g.cs | 20 ++-------------- .../GeneratedCode/VolumeFlowTestsBase.g.cs | 20 ++-------------- .../GeneratedCode/VolumeTestsBase.g.cs | 20 ++-------------- UnitsNet.Tests/GeneratedQuantityCodeTests.cs | 13 +++++----- .../Quantities/Acceleration.NetFramework.g.cs | 14 ----------- .../AmountOfSubstance.NetFramework.g.cs | 14 ----------- .../AmplitudeRatio.NetFramework.g.cs | 14 ----------- .../Quantities/Angle.NetFramework.g.cs | 14 ----------- .../ApparentEnergy.NetFramework.g.cs | 14 ----------- .../ApparentPower.NetFramework.g.cs | 14 ----------- .../Quantities/Area.NetFramework.g.cs | 14 ----------- .../Quantities/AreaDensity.NetFramework.g.cs | 14 ----------- .../AreaMomentOfInertia.NetFramework.g.cs | 14 ----------- .../Quantities/BitRate.NetFramework.g.cs | 12 ---------- ...eSpecificFuelConsumption.NetFramework.g.cs | 14 ----------- .../Quantities/Capacitance.NetFramework.g.cs | 14 ----------- .../Quantities/Density.NetFramework.g.cs | 14 ----------- .../Quantities/Duration.NetFramework.g.cs | 14 ----------- .../DynamicViscosity.NetFramework.g.cs | 14 ----------- .../ElectricAdmittance.NetFramework.g.cs | 14 ----------- .../ElectricCharge.NetFramework.g.cs | 14 ----------- .../ElectricChargeDensity.NetFramework.g.cs | 14 ----------- .../ElectricConductance.NetFramework.g.cs | 14 ----------- .../ElectricConductivity.NetFramework.g.cs | 14 ----------- .../ElectricCurrent.NetFramework.g.cs | 14 ----------- .../ElectricCurrentDensity.NetFramework.g.cs | 14 ----------- .../ElectricCurrentGradient.NetFramework.g.cs | 14 ----------- .../ElectricField.NetFramework.g.cs | 14 ----------- .../ElectricInductance.NetFramework.g.cs | 14 ----------- .../ElectricPotential.NetFramework.g.cs | 14 ----------- .../ElectricPotentialAc.NetFramework.g.cs | 14 ----------- .../ElectricPotentialDc.NetFramework.g.cs | 14 ----------- .../ElectricResistance.NetFramework.g.cs | 14 ----------- .../ElectricResistivity.NetFramework.g.cs | 14 ----------- .../Quantities/Energy.NetFramework.g.cs | 14 ----------- .../Quantities/Entropy.NetFramework.g.cs | 14 ----------- .../Quantities/Flow.NetFramework.g.cs | 14 ----------- .../Quantities/Force.NetFramework.g.cs | 14 ----------- .../ForceChangeRate.NetFramework.g.cs | 14 ----------- .../ForcePerLength.NetFramework.g.cs | 14 ----------- .../Quantities/Frequency.NetFramework.g.cs | 14 ----------- .../Quantities/HeatFlux.NetFramework.g.cs | 14 ----------- .../HeatTransferCoefficient.NetFramework.g.cs | 14 ----------- .../Quantities/Illuminance.NetFramework.g.cs | 14 ----------- .../Quantities/Information.NetFramework.g.cs | 12 ---------- .../Quantities/Irradiance.NetFramework.g.cs | 14 ----------- .../Quantities/Irradiation.NetFramework.g.cs | 14 ----------- .../KinematicViscosity.NetFramework.g.cs | 14 ----------- .../Quantities/LapseRate.NetFramework.g.cs | 14 ----------- .../Quantities/Length.NetFramework.g.cs | 14 ----------- .../Quantities/Level.NetFramework.g.cs | 14 ----------- .../LinearDensity.NetFramework.g.cs | 14 ----------- .../Quantities/LuminousFlux.NetFramework.g.cs | 14 ----------- .../LuminousIntensity.NetFramework.g.cs | 14 ----------- .../MagneticField.NetFramework.g.cs | 14 ----------- .../Quantities/MagneticFlux.NetFramework.g.cs | 14 ----------- .../Magnetization.NetFramework.g.cs | 14 ----------- .../Quantities/Mass.NetFramework.g.cs | 14 ----------- .../Quantities/MassFlow.NetFramework.g.cs | 14 ----------- .../Quantities/MassFlux.NetFramework.g.cs | 14 ----------- .../MassMomentOfInertia.NetFramework.g.cs | 14 ----------- .../Quantities/MolarEnergy.NetFramework.g.cs | 14 ----------- .../Quantities/MolarEntropy.NetFramework.g.cs | 14 ----------- .../Quantities/MolarMass.NetFramework.g.cs | 14 ----------- .../Quantities/Molarity.NetFramework.g.cs | 14 ----------- .../Quantities/Permeability.NetFramework.g.cs | 14 ----------- .../Quantities/Permittivity.NetFramework.g.cs | 14 ----------- .../Quantities/Power.NetFramework.g.cs | 12 ---------- .../Quantities/PowerDensity.NetFramework.g.cs | 14 ----------- .../Quantities/PowerRatio.NetFramework.g.cs | 14 ----------- .../Quantities/Pressure.NetFramework.g.cs | 14 ----------- .../PressureChangeRate.NetFramework.g.cs | 14 ----------- .../Quantities/Ratio.NetFramework.g.cs | 14 ----------- .../ReactiveEnergy.NetFramework.g.cs | 14 ----------- .../ReactivePower.NetFramework.g.cs | 14 ----------- .../RotationalAcceleration.NetFramework.g.cs | 14 ----------- .../RotationalSpeed.NetFramework.g.cs | 14 ----------- .../RotationalStiffness.NetFramework.g.cs | 14 ----------- ...tionalStiffnessPerLength.NetFramework.g.cs | 14 ----------- .../Quantities/SolidAngle.NetFramework.g.cs | 14 ----------- .../SpecificEnergy.NetFramework.g.cs | 14 ----------- .../SpecificEntropy.NetFramework.g.cs | 14 ----------- .../SpecificVolume.NetFramework.g.cs | 14 ----------- .../SpecificWeight.NetFramework.g.cs | 14 ----------- .../Quantities/Speed.NetFramework.g.cs | 14 ----------- .../Quantities/Temperature.NetFramework.g.cs | 14 ----------- .../TemperatureChangeRate.NetFramework.g.cs | 14 ----------- .../TemperatureDelta.NetFramework.g.cs | 14 ----------- .../ThermalConductivity.NetFramework.g.cs | 14 ----------- .../ThermalResistance.NetFramework.g.cs | 14 ----------- .../Quantities/Torque.NetFramework.g.cs | 14 ----------- .../Quantities/VitaminA.NetFramework.g.cs | 14 ----------- .../Quantities/Volume.NetFramework.g.cs | 14 ----------- .../Quantities/VolumeFlow.NetFramework.g.cs | 14 ----------- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 23 ------------------ ...GenerateQuantitySourceCodeNetFramework.ps1 | 12 ---------- ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 20 ++-------------- 274 files changed, 189 insertions(+), 5090 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 32ed95e2f8..7618439a36 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -469,16 +469,6 @@ int CompareTo(Acceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Acceleration)) - return false; - - var objQuantity = (Acceleration)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Acceleration within the given absolute or relative tolerance. @@ -530,20 +520,6 @@ public bool Equals(Acceleration other, double tolerance, ComparisonType comparis return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Acceleration by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Acceleration, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Acceleration other, Acceleration maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index e09c313bdc..87801e0450 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -488,16 +488,6 @@ int CompareTo(AmountOfSubstance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is AmountOfSubstance)) - return false; - - var objQuantity = (AmountOfSubstance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance. @@ -549,20 +539,6 @@ public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType com return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another AmountOfSubstance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(AmountOfSubstance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(AmountOfSubstance other, AmountOfSubstance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 8bb678bbd7..b4f5bea15a 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -297,16 +297,6 @@ int CompareTo(AmplitudeRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is AmplitudeRatio)) - return false; - - var objQuantity = (AmplitudeRatio)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance. @@ -358,20 +348,6 @@ public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another AmplitudeRatio by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(AmplitudeRatio, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(AmplitudeRatio other, AmplitudeRatio maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 224eb7ae1d..87ac38f45f 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -487,16 +487,6 @@ int CompareTo(Angle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Angle)) - return false; - - var objQuantity = (Angle)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Angle within the given absolute or relative tolerance. @@ -548,20 +538,6 @@ public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Angle by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Angle, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Angle other, Angle maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index b360e90d45..1f010471ec 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(ApparentEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ApparentEnergy)) - return false; - - var objQuantity = (ApparentEnergy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ApparentEnergy within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(ApparentEnergy other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ApparentEnergy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ApparentEnergy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ApparentEnergy other, ApparentEnergy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 20c782523c..0c1bf0f2b6 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -298,16 +298,6 @@ int CompareTo(ApparentPower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ApparentPower)) - return false; - - var objQuantity = (ApparentPower)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ApparentPower within the given absolute or relative tolerance. @@ -359,20 +349,6 @@ public bool Equals(ApparentPower other, double tolerance, ComparisonType compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ApparentPower by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ApparentPower, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ApparentPower other, ApparentPower maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index cabdafbce9..083de4e91a 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -469,16 +469,6 @@ int CompareTo(Area other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Area)) - return false; - - var objQuantity = (Area)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Area within the given absolute or relative tolerance. @@ -530,20 +520,6 @@ public bool Equals(Area other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Area by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Area, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Area other, Area maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index d016ade809..d5948045e0 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(AreaDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is AreaDensity)) - return false; - - var objQuantity = (AreaDensity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another AreaDensity within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(AreaDensity other, double tolerance, ComparisonType compariso return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another AreaDensity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(AreaDensity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(AreaDensity other, AreaDensity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 1cee90c5dc..73aa0731ee 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -336,16 +336,6 @@ int CompareTo(AreaMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is AreaMomentOfInertia)) - return false; - - var objQuantity = (AreaMomentOfInertia)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance. @@ -397,20 +387,6 @@ public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another AreaMomentOfInertia by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(AreaMomentOfInertia, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(AreaMomentOfInertia other, AreaMomentOfInertia maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index 7f7fb55004..ade3ac0f39 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -715,15 +715,6 @@ int CompareTo(BitRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - public override bool Equals(object obj) - { - if(obj is null || !(obj is BitRate)) - return false; - - var objQuantity = (BitRate)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another BitRate within the given absolute or relative tolerance. @@ -775,20 +766,6 @@ public bool Equals(BitRate other, double tolerance, ComparisonType comparisonTyp return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another BitRate by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(BitRate, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(BitRate other, BitRate maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index c762e6824c..bb650a987e 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(BrakeSpecificFuelConsumption other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is BrakeSpecificFuelConsumption)) - return false; - - var objQuantity = (BrakeSpecificFuelConsumption)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another BrakeSpecificFuelConsumption within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, Compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another BrakeSpecificFuelConsumption by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(BrakeSpecificFuelConsumption, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(BrakeSpecificFuelConsumption other, BrakeSpecificFuelConsumption maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 97b3266b6b..830559f670 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(Capacitance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Capacitance)) - return false; - - var objQuantity = (Capacitance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Capacitance within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(Capacitance other, double tolerance, ComparisonType compariso return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Capacitance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Capacitance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Capacitance other, Capacitance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 23a093e167..dfe078ef1c 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -944,16 +944,6 @@ int CompareTo(Density other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Density)) - return false; - - var objQuantity = (Density)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Density within the given absolute or relative tolerance. @@ -1005,20 +995,6 @@ public bool Equals(Density other, double tolerance, ComparisonType comparisonTyp return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Density by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Density, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Density other, Density maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 58ea15708b..c881936bbe 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -454,16 +454,6 @@ int CompareTo(Duration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Duration)) - return false; - - var objQuantity = (Duration)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Duration within the given absolute or relative tolerance. @@ -515,20 +505,6 @@ public bool Equals(Duration other, double tolerance, ComparisonType comparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Duration by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Duration, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Duration other, Duration maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 5f1007380f..fa2645cabb 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -336,16 +336,6 @@ int CompareTo(DynamicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is DynamicViscosity)) - return false; - - var objQuantity = (DynamicViscosity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another DynamicViscosity within the given absolute or relative tolerance. @@ -397,20 +387,6 @@ public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comp return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another DynamicViscosity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(DynamicViscosity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(DynamicViscosity other, DynamicViscosity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index 4627181f9c..e2a8036f57 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -298,16 +298,6 @@ int CompareTo(ElectricAdmittance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricAdmittance)) - return false; - - var objQuantity = (ElectricAdmittance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricAdmittance within the given absolute or relative tolerance. @@ -359,20 +349,6 @@ public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType co return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricAdmittance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricAdmittance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricAdmittance other, ElectricAdmittance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index f011e1a311..9464bc59e4 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(ElectricCharge other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricCharge)) - return false; - - var objQuantity = (ElectricCharge)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricCharge within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(ElectricCharge other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricCharge by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricCharge, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricCharge other, ElectricCharge maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 7e73beedd0..faa814abe8 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(ElectricChargeDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricChargeDensity)) - return false; - - var objQuantity = (ElectricChargeDensity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricChargeDensity within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricChargeDensity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricChargeDensity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricChargeDensity other, ElectricChargeDensity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index f3099fd9d3..58a0c1ea8f 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(ElectricConductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricConductance)) - return false; - - var objQuantity = (ElectricConductance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricConductance within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(ElectricConductance other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricConductance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricConductance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricConductance other, ElectricConductance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 9487fe3df1..7240a0514e 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(ElectricConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricConductivity)) - return false; - - var objQuantity = (ElectricConductivity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricConductivity within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(ElectricConductivity other, double tolerance, ComparisonType return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricConductivity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricConductivity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricConductivity other, ElectricConductivity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 28fc1e4f78..3633dedb8b 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -374,16 +374,6 @@ int CompareTo(ElectricCurrent other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricCurrent)) - return false; - - var objQuantity = (ElectricCurrent)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricCurrent within the given absolute or relative tolerance. @@ -435,20 +425,6 @@ public bool Equals(ElectricCurrent other, double tolerance, ComparisonType compa return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricCurrent by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricCurrent, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricCurrent other, ElectricCurrent maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 71a8cdcc34..06abed8ae5 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(ElectricCurrentDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricCurrentDensity)) - return false; - - var objQuantity = (ElectricCurrentDensity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricCurrentDensity within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonTyp return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricCurrentDensity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricCurrentDensity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricCurrentDensity other, ElectricCurrentDensity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 3a777bb953..397a6d710e 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(ElectricCurrentGradient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricCurrentGradient)) - return false; - - var objQuantity = (ElectricCurrentGradient)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricCurrentGradient within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricCurrentGradient by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricCurrentGradient, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricCurrentGradient other, ElectricCurrentGradient maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 5f48bcba7a..a54ef6d65b 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(ElectricField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricField)) - return false; - - var objQuantity = (ElectricField)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricField within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(ElectricField other, double tolerance, ComparisonType compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricField by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricField, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricField other, ElectricField maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index dce93b68a0..9d39ac1ace 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(ElectricInductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricInductance)) - return false; - - var objQuantity = (ElectricInductance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricInductance within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(ElectricInductance other, double tolerance, ComparisonType co return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricInductance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricInductance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricInductance other, ElectricInductance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 8a90e4bc1f..9773cc9a38 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -317,16 +317,6 @@ int CompareTo(ElectricPotential other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricPotential)) - return false; - - var objQuantity = (ElectricPotential)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricPotential within the given absolute or relative tolerance. @@ -378,20 +368,6 @@ public bool Equals(ElectricPotential other, double tolerance, ComparisonType com return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricPotential by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricPotential, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricPotential other, ElectricPotential maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 452a3b6bab..1de05c17a4 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -316,16 +316,6 @@ int CompareTo(ElectricPotentialAc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricPotentialAc)) - return false; - - var objQuantity = (ElectricPotentialAc)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricPotentialAc within the given absolute or relative tolerance. @@ -377,20 +367,6 @@ public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricPotentialAc by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricPotentialAc, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricPotentialAc other, ElectricPotentialAc maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 7ad0595e08..bc0a23a4ee 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -316,16 +316,6 @@ int CompareTo(ElectricPotentialDc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricPotentialDc)) - return false; - - var objQuantity = (ElectricPotentialDc)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricPotentialDc within the given absolute or relative tolerance. @@ -377,20 +367,6 @@ public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricPotentialDc by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricPotentialDc, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricPotentialDc other, ElectricPotentialDc maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 6985c1d234..65f6bbe0a9 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -298,16 +298,6 @@ int CompareTo(ElectricResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricResistance)) - return false; - - var objQuantity = (ElectricResistance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricResistance within the given absolute or relative tolerance. @@ -359,20 +349,6 @@ public bool Equals(ElectricResistance other, double tolerance, ComparisonType co return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricResistance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricResistance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricResistance other, ElectricResistance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 6860758317..7bf7236425 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -298,16 +298,6 @@ int CompareTo(ElectricResistivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ElectricResistivity)) - return false; - - var objQuantity = (ElectricResistivity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ElectricResistivity within the given absolute or relative tolerance. @@ -359,20 +349,6 @@ public bool Equals(ElectricResistivity other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ElectricResistivity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ElectricResistivity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ElectricResistivity other, ElectricResistivity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 1d79af5c50..a06bafa83a 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -640,16 +640,6 @@ int CompareTo(Energy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Energy)) - return false; - - var objQuantity = (Energy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Energy within the given absolute or relative tolerance. @@ -701,20 +691,6 @@ public bool Equals(Energy other, double tolerance, ComparisonType comparisonType return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Energy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Energy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Energy other, Energy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index c5b077145d..2ef62b67d5 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -355,16 +355,6 @@ int CompareTo(Entropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Entropy)) - return false; - - var objQuantity = (Entropy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Entropy within the given absolute or relative tolerance. @@ -416,20 +406,6 @@ public bool Equals(Entropy other, double tolerance, ComparisonType comparisonTyp return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Entropy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Entropy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Entropy other, Entropy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Flow.Common.g.cs b/Common/GeneratedCode/Quantities/Flow.Common.g.cs index 92500edca9..c962748b8d 100644 --- a/Common/GeneratedCode/Quantities/Flow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Flow.Common.g.cs @@ -715,16 +715,6 @@ int CompareTo(Flow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Flow)) - return false; - - var objQuantity = (Flow)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Flow within the given absolute or relative tolerance. @@ -776,20 +766,6 @@ public bool Equals(Flow other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Flow by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Flow, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Flow other, Flow maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 827cc1a107..d630d992e2 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -412,16 +412,6 @@ int CompareTo(Force other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Force)) - return false; - - var objQuantity = (Force)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Force within the given absolute or relative tolerance. @@ -473,20 +463,6 @@ public bool Equals(Force other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Force by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Force, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Force other, Force maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index f3b7e04db9..a0abf55f95 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -431,16 +431,6 @@ int CompareTo(ForceChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ForceChangeRate)) - return false; - - var objQuantity = (ForceChangeRate)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ForceChangeRate within the given absolute or relative tolerance. @@ -492,20 +482,6 @@ public bool Equals(ForceChangeRate other, double tolerance, ComparisonType compa return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ForceChangeRate by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ForceChangeRate, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ForceChangeRate other, ForceChangeRate maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index c60955e3c1..fb37493acd 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -393,16 +393,6 @@ int CompareTo(ForcePerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ForcePerLength)) - return false; - - var objQuantity = (ForcePerLength)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ForcePerLength within the given absolute or relative tolerance. @@ -454,20 +444,6 @@ public bool Equals(ForcePerLength other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ForcePerLength by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ForcePerLength, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ForcePerLength other, ForcePerLength maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 3814aaabb5..2de1c40d60 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -374,16 +374,6 @@ int CompareTo(Frequency other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Frequency)) - return false; - - var objQuantity = (Frequency)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Frequency within the given absolute or relative tolerance. @@ -435,20 +425,6 @@ public bool Equals(Frequency other, double tolerance, ComparisonType comparisonT return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Frequency by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Frequency, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Frequency other, Frequency maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index af17a5b614..1e98dd0710 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -526,16 +526,6 @@ int CompareTo(HeatFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is HeatFlux)) - return false; - - var objQuantity = (HeatFlux)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another HeatFlux within the given absolute or relative tolerance. @@ -587,20 +577,6 @@ public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another HeatFlux by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(HeatFlux, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(HeatFlux other, HeatFlux maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 6c1e6e297b..f3e67e84d8 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -260,16 +260,6 @@ int CompareTo(HeatTransferCoefficient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is HeatTransferCoefficient)) - return false; - - var objQuantity = (HeatTransferCoefficient)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another HeatTransferCoefficient within the given absolute or relative tolerance. @@ -321,20 +311,6 @@ public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another HeatTransferCoefficient by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(HeatTransferCoefficient, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(HeatTransferCoefficient other, HeatTransferCoefficient maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index abd8790909..eb57f3542e 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -298,16 +298,6 @@ int CompareTo(Illuminance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Illuminance)) - return false; - - var objQuantity = (Illuminance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Illuminance within the given absolute or relative tolerance. @@ -359,20 +349,6 @@ public bool Equals(Illuminance other, double tolerance, ComparisonType compariso return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Illuminance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Illuminance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Illuminance other, Illuminance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 9183d31d8f..2a368a9696 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -715,15 +715,6 @@ int CompareTo(Information other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - public override bool Equals(object obj) - { - if(obj is null || !(obj is Information)) - return false; - - var objQuantity = (Information)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Information within the given absolute or relative tolerance. @@ -775,20 +766,6 @@ public bool Equals(Information other, double tolerance, ComparisonType compariso return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Information by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Information, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Information other, Information maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 7f1b4252ad..1e02e27a79 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -260,16 +260,6 @@ int CompareTo(Irradiance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Irradiance)) - return false; - - var objQuantity = (Irradiance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Irradiance within the given absolute or relative tolerance. @@ -321,20 +311,6 @@ public bool Equals(Irradiance other, double tolerance, ComparisonType comparison return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Irradiance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Irradiance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Irradiance other, Irradiance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 58db172b3f..c34d37be91 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(Irradiation other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Irradiation)) - return false; - - var objQuantity = (Irradiation)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Irradiation within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(Irradiation other, double tolerance, ComparisonType compariso return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Irradiation by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Irradiation, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Irradiation other, Irradiation maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index fe75567216..3b050b5dfb 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -374,16 +374,6 @@ int CompareTo(KinematicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is KinematicViscosity)) - return false; - - var objQuantity = (KinematicViscosity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another KinematicViscosity within the given absolute or relative tolerance. @@ -435,20 +425,6 @@ public bool Equals(KinematicViscosity other, double tolerance, ComparisonType co return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another KinematicViscosity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(KinematicViscosity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(KinematicViscosity other, KinematicViscosity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 2c37adad8f..8b0a68cfa8 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(LapseRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is LapseRate)) - return false; - - var objQuantity = (LapseRate)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another LapseRate within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonT return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another LapseRate by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(LapseRate, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(LapseRate other, LapseRate maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index 2e3d2a38d3..421b319095 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -640,16 +640,6 @@ int CompareTo(Length other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Length)) - return false; - - var objQuantity = (Length)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Length within the given absolute or relative tolerance. @@ -701,20 +691,6 @@ public bool Equals(Length other, double tolerance, ComparisonType comparisonType return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Length by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Length, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Length other, Length maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index ad48a43d85..f8aa2f67f1 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -259,16 +259,6 @@ int CompareTo(Level other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Level)) - return false; - - var objQuantity = (Level)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Level within the given absolute or relative tolerance. @@ -320,20 +310,6 @@ public bool Equals(Level other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Level by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Level, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Level other, Level maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 4193003fb0..b88033a953 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(LinearDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is LinearDensity)) - return false; - - var objQuantity = (LinearDensity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another LinearDensity within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(LinearDensity other, double tolerance, ComparisonType compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another LinearDensity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(LinearDensity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(LinearDensity other, LinearDensity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index a5b0e63900..69bec040a7 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(LuminousFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is LuminousFlux)) - return false; - - var objQuantity = (LuminousFlux)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another LuminousFlux within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparis return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another LuminousFlux by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(LuminousFlux, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(LuminousFlux other, LuminousFlux maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index b5fd94601d..36314d318a 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(LuminousIntensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is LuminousIntensity)) - return false; - - var objQuantity = (LuminousIntensity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another LuminousIntensity within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(LuminousIntensity other, double tolerance, ComparisonType com return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another LuminousIntensity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(LuminousIntensity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(LuminousIntensity other, LuminousIntensity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index b5f5d2dde5..7be8363c6c 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(MagneticField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MagneticField)) - return false; - - var objQuantity = (MagneticField)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MagneticField within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(MagneticField other, double tolerance, ComparisonType compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MagneticField by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MagneticField, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MagneticField other, MagneticField maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index b09af34da0..60da01ca35 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(MagneticFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MagneticFlux)) - return false; - - var objQuantity = (MagneticFlux)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MagneticFlux within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparis return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MagneticFlux by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MagneticFlux, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MagneticFlux other, MagneticFlux maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 0a04d5753e..f2b6b24a76 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(Magnetization other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Magnetization)) - return false; - - var objQuantity = (Magnetization)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Magnetization within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(Magnetization other, double tolerance, ComparisonType compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Magnetization by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Magnetization, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Magnetization other, Magnetization maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 0e9f53d699..7f57cf1f55 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -621,16 +621,6 @@ int CompareTo(Mass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Mass)) - return false; - - var objQuantity = (Mass)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Mass within the given absolute or relative tolerance. @@ -682,20 +672,6 @@ public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Mass by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Mass, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Mass other, Mass maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index c1f884aea2..cf8f9f038a 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -507,16 +507,6 @@ int CompareTo(MassFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MassFlow)) - return false; - - var objQuantity = (MassFlow)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MassFlow within the given absolute or relative tolerance. @@ -568,20 +558,6 @@ public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MassFlow by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MassFlow, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MassFlow other, MassFlow maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index 12b507c25c..66b14d1c22 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -260,16 +260,6 @@ int CompareTo(MassFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MassFlux)) - return false; - - var objQuantity = (MassFlux)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MassFlux within the given absolute or relative tolerance. @@ -321,20 +311,6 @@ public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MassFlux by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MassFlux, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MassFlux other, MassFlux maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 90e30652cb..ad89f69463 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -716,16 +716,6 @@ int CompareTo(MassMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MassMomentOfInertia)) - return false; - - var objQuantity = (MassMomentOfInertia)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MassMomentOfInertia within the given absolute or relative tolerance. @@ -777,20 +767,6 @@ public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MassMomentOfInertia by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MassMomentOfInertia, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MassMomentOfInertia other, MassMomentOfInertia maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index f4164e95c9..04824f0c43 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(MolarEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MolarEnergy)) - return false; - - var objQuantity = (MolarEnergy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MolarEnergy within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(MolarEnergy other, double tolerance, ComparisonType compariso return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MolarEnergy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MolarEnergy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MolarEnergy other, MolarEnergy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index abb87a58f9..df7f68bbef 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(MolarEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MolarEntropy)) - return false; - - var objQuantity = (MolarEntropy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MolarEntropy within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparis return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MolarEntropy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MolarEntropy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MolarEntropy other, MolarEntropy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 6cbe02d28d..6a75f0bb95 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -450,16 +450,6 @@ int CompareTo(MolarMass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is MolarMass)) - return false; - - var objQuantity = (MolarMass)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another MolarMass within the given absolute or relative tolerance. @@ -511,20 +501,6 @@ public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonT return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another MolarMass by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MolarMass, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MolarMass other, MolarMass maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index 19a4f20720..fd856010ee 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -374,16 +374,6 @@ int CompareTo(Molarity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Molarity)) - return false; - - var objQuantity = (Molarity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Molarity within the given absolute or relative tolerance. @@ -435,20 +425,6 @@ public bool Equals(Molarity other, double tolerance, ComparisonType comparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Molarity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Molarity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Molarity other, Molarity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 032dec27e5..2efe17735e 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(Permeability other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Permeability)) - return false; - - var objQuantity = (Permeability)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Permeability within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(Permeability other, double tolerance, ComparisonType comparis return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Permeability by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Permeability, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Permeability other, Permeability maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index a8a40f1c0a..30db6dcca2 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -241,16 +241,6 @@ int CompareTo(Permittivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Permittivity)) - return false; - - var objQuantity = (Permittivity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Permittivity within the given absolute or relative tolerance. @@ -302,20 +292,6 @@ public bool Equals(Permittivity other, double tolerance, ComparisonType comparis return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Permittivity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Permittivity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Permittivity other, Permittivity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index ed9cbba62d..48b81568f3 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -602,15 +602,6 @@ int CompareTo(Power other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - public override bool Equals(object obj) - { - if(obj is null || !(obj is Power)) - return false; - - var objQuantity = (Power)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Power within the given absolute or relative tolerance. @@ -662,20 +653,6 @@ public bool Equals(Power other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Power by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Power, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Power other, Power maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 1acfabad4e..dd901c6004 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -1058,16 +1058,6 @@ int CompareTo(PowerDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is PowerDensity)) - return false; - - var objQuantity = (PowerDensity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another PowerDensity within the given absolute or relative tolerance. @@ -1119,20 +1109,6 @@ public bool Equals(PowerDensity other, double tolerance, ComparisonType comparis return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another PowerDensity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(PowerDensity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(PowerDensity other, PowerDensity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index ab16e2fdc9..2937aa4cc9 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -259,16 +259,6 @@ int CompareTo(PowerRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is PowerRatio)) - return false; - - var objQuantity = (PowerRatio)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another PowerRatio within the given absolute or relative tolerance. @@ -320,20 +310,6 @@ public bool Equals(PowerRatio other, double tolerance, ComparisonType comparison return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another PowerRatio by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(PowerRatio, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(PowerRatio other, PowerRatio maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 26a39fe932..264db9c86c 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -946,16 +946,6 @@ int CompareTo(Pressure other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Pressure)) - return false; - - var objQuantity = (Pressure)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Pressure within the given absolute or relative tolerance. @@ -1007,20 +997,6 @@ public bool Equals(Pressure other, double tolerance, ComparisonType comparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Pressure by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Pressure, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Pressure other, Pressure maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 11c7fdc4a8..b95433a44e 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -298,16 +298,6 @@ int CompareTo(PressureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is PressureChangeRate)) - return false; - - var objQuantity = (PressureChangeRate)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another PressureChangeRate within the given absolute or relative tolerance. @@ -359,20 +349,6 @@ public bool Equals(PressureChangeRate other, double tolerance, ComparisonType co return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another PressureChangeRate by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(PressureChangeRate, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(PressureChangeRate other, PressureChangeRate maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index b3629babf9..255b7c181d 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -335,16 +335,6 @@ int CompareTo(Ratio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Ratio)) - return false; - - var objQuantity = (Ratio)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Ratio within the given absolute or relative tolerance. @@ -396,20 +386,6 @@ public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Ratio by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Ratio, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Ratio other, Ratio maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index fc1272c6f8..aa0db40964 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(ReactiveEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ReactiveEnergy)) - return false; - - var objQuantity = (ReactiveEnergy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ReactiveEnergy within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ReactiveEnergy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ReactiveEnergy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ReactiveEnergy other, ReactiveEnergy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index ba8679fd10..87de0e0958 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -298,16 +298,6 @@ int CompareTo(ReactivePower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ReactivePower)) - return false; - - var objQuantity = (ReactivePower)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ReactivePower within the given absolute or relative tolerance. @@ -359,20 +349,6 @@ public bool Equals(ReactivePower other, double tolerance, ComparisonType compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ReactivePower by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ReactivePower, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ReactivePower other, ReactivePower maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 992d9acab6..93924c8645 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(RotationalAcceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is RotationalAcceleration)) - return false; - - var objQuantity = (RotationalAcceleration)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another RotationalAcceleration within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(RotationalAcceleration other, double tolerance, ComparisonTyp return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another RotationalAcceleration by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(RotationalAcceleration, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(RotationalAcceleration other, RotationalAcceleration maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 430347c970..5643723cf3 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -469,16 +469,6 @@ int CompareTo(RotationalSpeed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is RotationalSpeed)) - return false; - - var objQuantity = (RotationalSpeed)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another RotationalSpeed within the given absolute or relative tolerance. @@ -530,20 +520,6 @@ public bool Equals(RotationalSpeed other, double tolerance, ComparisonType compa return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another RotationalSpeed by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(RotationalSpeed, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(RotationalSpeed other, RotationalSpeed maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 5ec21ca384..69eab9468a 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(RotationalStiffness other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is RotationalStiffness)) - return false; - - var objQuantity = (RotationalStiffness)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another RotationalStiffness within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(RotationalStiffness other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another RotationalStiffness by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(RotationalStiffness, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(RotationalStiffness other, RotationalStiffness maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index e994b6ed9b..737080f068 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -279,16 +279,6 @@ int CompareTo(RotationalStiffnessPerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is RotationalStiffnessPerLength)) - return false; - - var objQuantity = (RotationalStiffnessPerLength)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another RotationalStiffnessPerLength within the given absolute or relative tolerance. @@ -340,20 +330,6 @@ public bool Equals(RotationalStiffnessPerLength other, double tolerance, Compari return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another RotationalStiffnessPerLength by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(RotationalStiffnessPerLength, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(RotationalStiffnessPerLength other, RotationalStiffnessPerLength maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 2f258256e0..c99667ae4b 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -240,16 +240,6 @@ int CompareTo(SolidAngle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is SolidAngle)) - return false; - - var objQuantity = (SolidAngle)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another SolidAngle within the given absolute or relative tolerance. @@ -301,20 +291,6 @@ public bool Equals(SolidAngle other, double tolerance, ComparisonType comparison return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another SolidAngle by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(SolidAngle, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(SolidAngle other, SolidAngle maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index 944ba7474b..4000d3e74f 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -374,16 +374,6 @@ int CompareTo(SpecificEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is SpecificEnergy)) - return false; - - var objQuantity = (SpecificEnergy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another SpecificEnergy within the given absolute or relative tolerance. @@ -435,20 +425,6 @@ public bool Equals(SpecificEnergy other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another SpecificEnergy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(SpecificEnergy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(SpecificEnergy other, SpecificEnergy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index c31a618029..ab92be92c6 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -374,16 +374,6 @@ int CompareTo(SpecificEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is SpecificEntropy)) - return false; - - var objQuantity = (SpecificEntropy)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another SpecificEntropy within the given absolute or relative tolerance. @@ -435,20 +425,6 @@ public bool Equals(SpecificEntropy other, double tolerance, ComparisonType compa return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another SpecificEntropy by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(SpecificEntropy, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(SpecificEntropy other, SpecificEntropy maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 081afdbe8e..08d2504672 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -260,16 +260,6 @@ int CompareTo(SpecificVolume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is SpecificVolume)) - return false; - - var objQuantity = (SpecificVolume)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another SpecificVolume within the given absolute or relative tolerance. @@ -321,20 +311,6 @@ public bool Equals(SpecificVolume other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another SpecificVolume by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(SpecificVolume, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(SpecificVolume other, SpecificVolume maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index f3752b3ec5..ae08ee474a 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -545,16 +545,6 @@ int CompareTo(SpecificWeight other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is SpecificWeight)) - return false; - - var objQuantity = (SpecificWeight)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another SpecificWeight within the given absolute or relative tolerance. @@ -606,20 +596,6 @@ public bool Equals(SpecificWeight other, double tolerance, ComparisonType compar return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another SpecificWeight by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(SpecificWeight, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(SpecificWeight other, SpecificWeight maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 3bd6a717fd..d3504c1d30 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -830,16 +830,6 @@ int CompareTo(Speed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Speed)) - return false; - - var objQuantity = (Speed)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Speed within the given absolute or relative tolerance. @@ -891,20 +881,6 @@ public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Speed by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Speed, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Speed other, Speed maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 3e5e6b2891..f332113b81 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -374,16 +374,6 @@ int CompareTo(Temperature other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Temperature)) - return false; - - var objQuantity = (Temperature)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Temperature within the given absolute or relative tolerance. @@ -435,20 +425,6 @@ public bool Equals(Temperature other, double tolerance, ComparisonType compariso return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Temperature by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Temperature, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Temperature other, Temperature maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 842e3a13bd..795ed4d603 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -412,16 +412,6 @@ int CompareTo(TemperatureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is TemperatureChangeRate)) - return false; - - var objQuantity = (TemperatureChangeRate)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another TemperatureChangeRate within the given absolute or relative tolerance. @@ -473,20 +463,6 @@ public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another TemperatureChangeRate by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(TemperatureChangeRate, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(TemperatureChangeRate other, TemperatureChangeRate maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index f450738404..ba2df9fe97 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -541,16 +541,6 @@ int CompareTo(TemperatureDelta other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is TemperatureDelta)) - return false; - - var objQuantity = (TemperatureDelta)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another TemperatureDelta within the given absolute or relative tolerance. @@ -602,20 +592,6 @@ public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comp return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another TemperatureDelta by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(TemperatureDelta, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(TemperatureDelta other, TemperatureDelta maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index 799d338c54..da68e4cdd8 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -260,16 +260,6 @@ int CompareTo(ThermalConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ThermalConductivity)) - return false; - - var objQuantity = (ThermalConductivity)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ThermalConductivity within the given absolute or relative tolerance. @@ -321,20 +311,6 @@ public bool Equals(ThermalConductivity other, double tolerance, ComparisonType c return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ThermalConductivity by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ThermalConductivity, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ThermalConductivity other, ThermalConductivity maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 89f752dae9..a755023826 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -317,16 +317,6 @@ int CompareTo(ThermalResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is ThermalResistance)) - return false; - - var objQuantity = (ThermalResistance)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another ThermalResistance within the given absolute or relative tolerance. @@ -378,20 +368,6 @@ public bool Equals(ThermalResistance other, double tolerance, ComparisonType com return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another ThermalResistance by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(ThermalResistance, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(ThermalResistance other, ThermalResistance maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index b81e935d7c..88a6fd4cf9 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -621,16 +621,6 @@ int CompareTo(Torque other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Torque)) - return false; - - var objQuantity = (Torque)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Torque within the given absolute or relative tolerance. @@ -682,20 +672,6 @@ public bool Equals(Torque other, double tolerance, ComparisonType comparisonType return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Torque by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Torque, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Torque other, Torque maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 5764238125..331c692468 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -240,16 +240,6 @@ int CompareTo(VitaminA other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is VitaminA)) - return false; - - var objQuantity = (VitaminA)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another VitaminA within the given absolute or relative tolerance. @@ -301,20 +291,6 @@ public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonTy return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another VitaminA by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(VitaminA, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(VitaminA other, VitaminA maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 7af8d0bd50..2f2fc68a08 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -1062,16 +1062,6 @@ int CompareTo(Volume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is Volume)) - return false; - - var objQuantity = (Volume)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another Volume within the given absolute or relative tolerance. @@ -1123,20 +1113,6 @@ public bool Equals(Volume other, double tolerance, ComparisonType comparisonType return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another Volume by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(Volume, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(Volume other, Volume maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 706449f20d..47e5cd648e 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -716,16 +716,6 @@ int CompareTo(VolumeFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get 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) - { - if(obj is null || !(obj is VolumeFlow)) - return false; - - var objQuantity = (VolumeFlow)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. @@ -777,20 +767,6 @@ public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparison return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another VolumeFlow by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(VolumeFlow, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(VolumeFlow other, VolumeFlow maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index 6312872176..d5d8d54956 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -269,28 +269,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => meterpersecondsquared.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Acceleration a = Acceleration.FromMetersPerSecondSquared(1); - Acceleration b = Acceleration.FromMetersPerSecondSquared(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Acceleration v = Acceleration.FromMetersPerSecondSquared(1); - Assert.True(v.Equals(Acceleration.FromMetersPerSecondSquared(1), Acceleration.FromMetersPerSecondSquared(MetersPerSecondSquaredTolerance))); - Assert.False(v.Equals(Acceleration.Zero, Acceleration.FromMetersPerSecondSquared(MetersPerSecondSquaredTolerance))); + Assert.True(v.Equals(Acceleration.FromMetersPerSecondSquared(1), MetersPerSecondSquaredTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Acceleration.Zero, MetersPerSecondSquaredTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index ea9b263136..ad91ab381d 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -279,28 +279,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => mole.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - AmountOfSubstance a = AmountOfSubstance.FromMoles(1); - AmountOfSubstance b = AmountOfSubstance.FromMoles(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { AmountOfSubstance v = AmountOfSubstance.FromMoles(1); - Assert.True(v.Equals(AmountOfSubstance.FromMoles(1), AmountOfSubstance.FromMoles(MolesTolerance))); - Assert.False(v.Equals(AmountOfSubstance.Zero, AmountOfSubstance.FromMoles(MolesTolerance))); + Assert.True(v.Equals(AmountOfSubstance.FromMoles(1), MolesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AmountOfSubstance.Zero, MolesTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 5ef7153039..56400c05f3 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -184,28 +184,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => decibelvolt.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - AmplitudeRatio a = AmplitudeRatio.FromDecibelVolts(1); - AmplitudeRatio b = AmplitudeRatio.FromDecibelVolts(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { AmplitudeRatio v = AmplitudeRatio.FromDecibelVolts(1); - Assert.True(v.Equals(AmplitudeRatio.FromDecibelVolts(1), AmplitudeRatio.FromDecibelVolts(DecibelVoltsTolerance))); - Assert.False(v.Equals(AmplitudeRatio.Zero, AmplitudeRatio.FromDecibelVolts(DecibelVoltsTolerance))); + Assert.True(v.Equals(AmplitudeRatio.FromDecibelVolts(1), DecibelVoltsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AmplitudeRatio.Zero, DecibelVoltsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index 6589478a78..b024d92619 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -279,28 +279,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => degree.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Angle a = Angle.FromDegrees(1); - Angle b = Angle.FromDegrees(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Angle v = Angle.FromDegrees(1); - Assert.True(v.Equals(Angle.FromDegrees(1), Angle.FromDegrees(DegreesTolerance))); - Assert.False(v.Equals(Angle.Zero, Angle.FromDegrees(DegreesTolerance))); + Assert.True(v.Equals(Angle.FromDegrees(1), DegreesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Angle.Zero, DegreesTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index 7515f60b10..6fab19f62f 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => voltamperehour.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ApparentEnergy a = ApparentEnergy.FromVoltampereHours(1); - ApparentEnergy b = ApparentEnergy.FromVoltampereHours(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ApparentEnergy v = ApparentEnergy.FromVoltampereHours(1); - Assert.True(v.Equals(ApparentEnergy.FromVoltampereHours(1), ApparentEnergy.FromVoltampereHours(VoltampereHoursTolerance))); - Assert.False(v.Equals(ApparentEnergy.Zero, ApparentEnergy.FromVoltampereHours(VoltampereHoursTolerance))); + Assert.True(v.Equals(ApparentEnergy.FromVoltampereHours(1), VoltampereHoursTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ApparentEnergy.Zero, VoltampereHoursTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index 198401e9cd..91ad20b6c2 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -179,28 +179,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => voltampere.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ApparentPower a = ApparentPower.FromVoltamperes(1); - ApparentPower b = ApparentPower.FromVoltamperes(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ApparentPower v = ApparentPower.FromVoltamperes(1); - Assert.True(v.Equals(ApparentPower.FromVoltamperes(1), ApparentPower.FromVoltamperes(VoltamperesTolerance))); - Assert.False(v.Equals(ApparentPower.Zero, ApparentPower.FromVoltamperes(VoltamperesTolerance))); + Assert.True(v.Equals(ApparentPower.FromVoltamperes(1), VoltamperesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ApparentPower.Zero, VoltamperesTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index bb580bc641..0d2dea3d1a 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogrampersquaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - AreaDensity a = AreaDensity.FromKilogramsPerSquareMeter(1); - AreaDensity b = AreaDensity.FromKilogramsPerSquareMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { AreaDensity v = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.True(v.Equals(AreaDensity.FromKilogramsPerSquareMeter(1), AreaDensity.FromKilogramsPerSquareMeter(KilogramsPerSquareMeterTolerance))); - Assert.False(v.Equals(AreaDensity.Zero, AreaDensity.FromKilogramsPerSquareMeter(KilogramsPerSquareMeterTolerance))); + Assert.True(v.Equals(AreaDensity.FromKilogramsPerSquareMeter(1), KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AreaDensity.Zero, KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index 0811084f53..95e82fc60a 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -199,28 +199,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => metertothefourth.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - AreaMomentOfInertia a = AreaMomentOfInertia.FromMetersToTheFourth(1); - AreaMomentOfInertia b = AreaMomentOfInertia.FromMetersToTheFourth(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { AreaMomentOfInertia v = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.True(v.Equals(AreaMomentOfInertia.FromMetersToTheFourth(1), AreaMomentOfInertia.FromMetersToTheFourth(MetersToTheFourthTolerance))); - Assert.False(v.Equals(AreaMomentOfInertia.Zero, AreaMomentOfInertia.FromMetersToTheFourth(MetersToTheFourthTolerance))); + Assert.True(v.Equals(AreaMomentOfInertia.FromMetersToTheFourth(1), MetersToTheFourthTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(AreaMomentOfInertia.Zero, MetersToTheFourthTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index bc77c9e71f..fd609e9363 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -269,28 +269,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => squaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Area a = Area.FromSquareMeters(1); - Area b = Area.FromSquareMeters(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Area v = Area.FromSquareMeters(1); - Assert.True(v.Equals(Area.FromSquareMeters(1), Area.FromSquareMeters(SquareMetersTolerance))); - Assert.False(v.Equals(Area.Zero, Area.FromSquareMeters(SquareMetersTolerance))); + Assert.True(v.Equals(Area.FromSquareMeters(1), SquareMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Area.Zero, SquareMetersTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index 6d249382a5..4ffd779db9 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -399,28 +399,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => bitpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - BitRate a = BitRate.FromBitsPerSecond(1); - BitRate b = BitRate.FromBitsPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { BitRate v = BitRate.FromBitsPerSecond(1); - Assert.True(v.Equals(BitRate.FromBitsPerSecond(1), BitRate.FromBitsPerSecond(BitsPerSecondTolerance))); - Assert.False(v.Equals(BitRate.Zero, BitRate.FromBitsPerSecond(BitsPerSecondTolerance))); + Assert.True(v.Equals(BitRate.FromBitsPerSecond(1), BitsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(BitRate.Zero, BitsPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index 04aa19ffc5..f6970db1c4 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogramperjoule.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - BrakeSpecificFuelConsumption a = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - BrakeSpecificFuelConsumption b = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { BrakeSpecificFuelConsumption v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.True(v.Equals(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1), BrakeSpecificFuelConsumption.FromKilogramsPerJoule(KilogramsPerJouleTolerance))); - Assert.False(v.Equals(BrakeSpecificFuelConsumption.Zero, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(KilogramsPerJouleTolerance))); + Assert.True(v.Equals(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1), KilogramsPerJouleTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(BrakeSpecificFuelConsumption.Zero, KilogramsPerJouleTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index 36e8413b89..bf1403edc7 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => farad.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Capacitance a = Capacitance.FromFarads(1); - Capacitance b = Capacitance.FromFarads(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Capacitance v = Capacitance.FromFarads(1); - Assert.True(v.Equals(Capacitance.FromFarads(1), Capacitance.FromFarads(FaradsTolerance))); - Assert.False(v.Equals(Capacitance.Zero, Capacitance.FromFarads(FaradsTolerance))); + Assert.True(v.Equals(Capacitance.FromFarads(1), FaradsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Capacitance.Zero, FaradsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index 3a721ca51e..367edee704 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -519,28 +519,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogrampercubicmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Density a = Density.FromKilogramsPerCubicMeter(1); - Density b = Density.FromKilogramsPerCubicMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Density v = Density.FromKilogramsPerCubicMeter(1); - Assert.True(v.Equals(Density.FromKilogramsPerCubicMeter(1), Density.FromKilogramsPerCubicMeter(KilogramsPerCubicMeterTolerance))); - Assert.False(v.Equals(Density.Zero, Density.FromKilogramsPerCubicMeter(KilogramsPerCubicMeterTolerance))); + Assert.True(v.Equals(Density.FromKilogramsPerCubicMeter(1), KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Density.Zero, KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index 0c107c622b..46ffcb501f 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -259,28 +259,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => second.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Duration a = Duration.FromSeconds(1); - Duration b = Duration.FromSeconds(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Duration v = Duration.FromSeconds(1); - Assert.True(v.Equals(Duration.FromSeconds(1), Duration.FromSeconds(SecondsTolerance))); - Assert.False(v.Equals(Duration.Zero, Duration.FromSeconds(SecondsTolerance))); + Assert.True(v.Equals(Duration.FromSeconds(1), SecondsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Duration.Zero, SecondsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index fe80050f24..3d0034f8bd 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -199,28 +199,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newtonsecondpermetersquared.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - DynamicViscosity a = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - DynamicViscosity b = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { DynamicViscosity v = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.True(v.Equals(DynamicViscosity.FromNewtonSecondsPerMeterSquared(1), DynamicViscosity.FromNewtonSecondsPerMeterSquared(NewtonSecondsPerMeterSquaredTolerance))); - Assert.False(v.Equals(DynamicViscosity.Zero, DynamicViscosity.FromNewtonSecondsPerMeterSquared(NewtonSecondsPerMeterSquaredTolerance))); + Assert.True(v.Equals(DynamicViscosity.FromNewtonSecondsPerMeterSquared(1), NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(DynamicViscosity.Zero, NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index 58097b5e01..52ce56c277 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -179,28 +179,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => siemens.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricAdmittance a = ElectricAdmittance.FromSiemens(1); - ElectricAdmittance b = ElectricAdmittance.FromSiemens(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricAdmittance v = ElectricAdmittance.FromSiemens(1); - Assert.True(v.Equals(ElectricAdmittance.FromSiemens(1), ElectricAdmittance.FromSiemens(SiemensTolerance))); - Assert.False(v.Equals(ElectricAdmittance.Zero, ElectricAdmittance.FromSiemens(SiemensTolerance))); + Assert.True(v.Equals(ElectricAdmittance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricAdmittance.Zero, SiemensTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index 21589616fb..f8db7c5e41 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => coulombpercubicmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricChargeDensity a = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - ElectricChargeDensity b = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricChargeDensity v = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.True(v.Equals(ElectricChargeDensity.FromCoulombsPerCubicMeter(1), ElectricChargeDensity.FromCoulombsPerCubicMeter(CoulombsPerCubicMeterTolerance))); - Assert.False(v.Equals(ElectricChargeDensity.Zero, ElectricChargeDensity.FromCoulombsPerCubicMeter(CoulombsPerCubicMeterTolerance))); + Assert.True(v.Equals(ElectricChargeDensity.FromCoulombsPerCubicMeter(1), CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricChargeDensity.Zero, CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index e867eb01ab..dca2f01ccc 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => coulomb.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricCharge a = ElectricCharge.FromCoulombs(1); - ElectricCharge b = ElectricCharge.FromCoulombs(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricCharge v = ElectricCharge.FromCoulombs(1); - Assert.True(v.Equals(ElectricCharge.FromCoulombs(1), ElectricCharge.FromCoulombs(CoulombsTolerance))); - Assert.False(v.Equals(ElectricCharge.Zero, ElectricCharge.FromCoulombs(CoulombsTolerance))); + Assert.True(v.Equals(ElectricCharge.FromCoulombs(1), CoulombsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCharge.Zero, CoulombsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index e6e565c53f..dc0bf955c7 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => siemens.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricConductance a = ElectricConductance.FromSiemens(1); - ElectricConductance b = ElectricConductance.FromSiemens(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricConductance v = ElectricConductance.FromSiemens(1); - Assert.True(v.Equals(ElectricConductance.FromSiemens(1), ElectricConductance.FromSiemens(SiemensTolerance))); - Assert.False(v.Equals(ElectricConductance.Zero, ElectricConductance.FromSiemens(SiemensTolerance))); + Assert.True(v.Equals(ElectricConductance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricConductance.Zero, SiemensTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index afa9552ae4..e2b68f3af9 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => siemenspermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricConductivity a = ElectricConductivity.FromSiemensPerMeter(1); - ElectricConductivity b = ElectricConductivity.FromSiemensPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricConductivity v = ElectricConductivity.FromSiemensPerMeter(1); - Assert.True(v.Equals(ElectricConductivity.FromSiemensPerMeter(1), ElectricConductivity.FromSiemensPerMeter(SiemensPerMeterTolerance))); - Assert.False(v.Equals(ElectricConductivity.Zero, ElectricConductivity.FromSiemensPerMeter(SiemensPerMeterTolerance))); + Assert.True(v.Equals(ElectricConductivity.FromSiemensPerMeter(1), SiemensPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricConductivity.Zero, SiemensPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index 4f28d50282..ec9b3c9491 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => amperepersquaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricCurrentDensity a = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - ElectricCurrentDensity b = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricCurrentDensity v = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.True(v.Equals(ElectricCurrentDensity.FromAmperesPerSquareMeter(1), ElectricCurrentDensity.FromAmperesPerSquareMeter(AmperesPerSquareMeterTolerance))); - Assert.False(v.Equals(ElectricCurrentDensity.Zero, ElectricCurrentDensity.FromAmperesPerSquareMeter(AmperesPerSquareMeterTolerance))); + Assert.True(v.Equals(ElectricCurrentDensity.FromAmperesPerSquareMeter(1), AmperesPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCurrentDensity.Zero, AmperesPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 066f847fa9..87a2096ef1 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => amperepersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricCurrentGradient a = ElectricCurrentGradient.FromAmperesPerSecond(1); - ElectricCurrentGradient b = ElectricCurrentGradient.FromAmperesPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricCurrentGradient v = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.True(v.Equals(ElectricCurrentGradient.FromAmperesPerSecond(1), ElectricCurrentGradient.FromAmperesPerSecond(AmperesPerSecondTolerance))); - Assert.False(v.Equals(ElectricCurrentGradient.Zero, ElectricCurrentGradient.FromAmperesPerSecond(AmperesPerSecondTolerance))); + Assert.True(v.Equals(ElectricCurrentGradient.FromAmperesPerSecond(1), AmperesPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCurrentGradient.Zero, AmperesPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index 44e66c1490..fbdc010cd2 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -219,28 +219,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => ampere.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricCurrent a = ElectricCurrent.FromAmperes(1); - ElectricCurrent b = ElectricCurrent.FromAmperes(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricCurrent v = ElectricCurrent.FromAmperes(1); - Assert.True(v.Equals(ElectricCurrent.FromAmperes(1), ElectricCurrent.FromAmperes(AmperesTolerance))); - Assert.False(v.Equals(ElectricCurrent.Zero, ElectricCurrent.FromAmperes(AmperesTolerance))); + Assert.True(v.Equals(ElectricCurrent.FromAmperes(1), AmperesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricCurrent.Zero, AmperesTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index 559f971e51..ee0f64934c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => voltpermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricField a = ElectricField.FromVoltsPerMeter(1); - ElectricField b = ElectricField.FromVoltsPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricField v = ElectricField.FromVoltsPerMeter(1); - Assert.True(v.Equals(ElectricField.FromVoltsPerMeter(1), ElectricField.FromVoltsPerMeter(VoltsPerMeterTolerance))); - Assert.False(v.Equals(ElectricField.Zero, ElectricField.FromVoltsPerMeter(VoltsPerMeterTolerance))); + Assert.True(v.Equals(ElectricField.FromVoltsPerMeter(1), VoltsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricField.Zero, VoltsPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index ad2bfe300a..21cb45fb10 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => henry.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricInductance a = ElectricInductance.FromHenries(1); - ElectricInductance b = ElectricInductance.FromHenries(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricInductance v = ElectricInductance.FromHenries(1); - Assert.True(v.Equals(ElectricInductance.FromHenries(1), ElectricInductance.FromHenries(HenriesTolerance))); - Assert.False(v.Equals(ElectricInductance.Zero, ElectricInductance.FromHenries(HenriesTolerance))); + Assert.True(v.Equals(ElectricInductance.FromHenries(1), HenriesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricInductance.Zero, HenriesTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index 382dca9c20..4e00d0f1d4 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -189,28 +189,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => voltac.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricPotentialAc a = ElectricPotentialAc.FromVoltsAc(1); - ElectricPotentialAc b = ElectricPotentialAc.FromVoltsAc(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricPotentialAc v = ElectricPotentialAc.FromVoltsAc(1); - Assert.True(v.Equals(ElectricPotentialAc.FromVoltsAc(1), ElectricPotentialAc.FromVoltsAc(VoltsAcTolerance))); - Assert.False(v.Equals(ElectricPotentialAc.Zero, ElectricPotentialAc.FromVoltsAc(VoltsAcTolerance))); + Assert.True(v.Equals(ElectricPotentialAc.FromVoltsAc(1), VoltsAcTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricPotentialAc.Zero, VoltsAcTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index d87ca1945b..31ae99171d 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -189,28 +189,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => voltdc.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricPotentialDc a = ElectricPotentialDc.FromVoltsDc(1); - ElectricPotentialDc b = ElectricPotentialDc.FromVoltsDc(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricPotentialDc v = ElectricPotentialDc.FromVoltsDc(1); - Assert.True(v.Equals(ElectricPotentialDc.FromVoltsDc(1), ElectricPotentialDc.FromVoltsDc(VoltsDcTolerance))); - Assert.False(v.Equals(ElectricPotentialDc.Zero, ElectricPotentialDc.FromVoltsDc(VoltsDcTolerance))); + Assert.True(v.Equals(ElectricPotentialDc.FromVoltsDc(1), VoltsDcTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricPotentialDc.Zero, VoltsDcTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index b3f20c8c98..3418f8e556 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -189,28 +189,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => volt.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricPotential a = ElectricPotential.FromVolts(1); - ElectricPotential b = ElectricPotential.FromVolts(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricPotential v = ElectricPotential.FromVolts(1); - Assert.True(v.Equals(ElectricPotential.FromVolts(1), ElectricPotential.FromVolts(VoltsTolerance))); - Assert.False(v.Equals(ElectricPotential.Zero, ElectricPotential.FromVolts(VoltsTolerance))); + Assert.True(v.Equals(ElectricPotential.FromVolts(1), VoltsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricPotential.Zero, VoltsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index 503519f667..58d093de1f 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -179,28 +179,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => ohm.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricResistance a = ElectricResistance.FromOhms(1); - ElectricResistance b = ElectricResistance.FromOhms(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricResistance v = ElectricResistance.FromOhms(1); - Assert.True(v.Equals(ElectricResistance.FromOhms(1), ElectricResistance.FromOhms(OhmsTolerance))); - Assert.False(v.Equals(ElectricResistance.Zero, ElectricResistance.FromOhms(OhmsTolerance))); + Assert.True(v.Equals(ElectricResistance.FromOhms(1), OhmsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricResistance.Zero, OhmsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index af17382b28..e3f152c82d 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -179,28 +179,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => ohmmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ElectricResistivity a = ElectricResistivity.FromOhmMeters(1); - ElectricResistivity b = ElectricResistivity.FromOhmMeters(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ElectricResistivity v = ElectricResistivity.FromOhmMeters(1); - Assert.True(v.Equals(ElectricResistivity.FromOhmMeters(1), ElectricResistivity.FromOhmMeters(OhmMetersTolerance))); - Assert.False(v.Equals(ElectricResistivity.Zero, ElectricResistivity.FromOhmMeters(OhmMetersTolerance))); + Assert.True(v.Equals(ElectricResistivity.FromOhmMeters(1), OhmMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ElectricResistivity.Zero, OhmMetersTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 9b33409387..185cb209b8 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -359,28 +359,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => joule.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Energy a = Energy.FromJoules(1); - Energy b = Energy.FromJoules(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Energy v = Energy.FromJoules(1); - Assert.True(v.Equals(Energy.FromJoules(1), Energy.FromJoules(JoulesTolerance))); - Assert.False(v.Equals(Energy.Zero, Energy.FromJoules(JoulesTolerance))); + Assert.True(v.Equals(Energy.FromJoules(1), JoulesTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Energy.Zero, JoulesTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index 0e56dca59c..9be160a987 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -209,28 +209,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => jouleperkelvin.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Entropy a = Entropy.FromJoulesPerKelvin(1); - Entropy b = Entropy.FromJoulesPerKelvin(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Entropy v = Entropy.FromJoulesPerKelvin(1); - Assert.True(v.Equals(Entropy.FromJoulesPerKelvin(1), Entropy.FromJoulesPerKelvin(JoulesPerKelvinTolerance))); - Assert.False(v.Equals(Entropy.Zero, Entropy.FromJoulesPerKelvin(JoulesPerKelvinTolerance))); + Assert.True(v.Equals(Entropy.FromJoulesPerKelvin(1), JoulesPerKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Entropy.Zero, JoulesPerKelvinTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs index 3b2b44ce5e..aa810042a6 100644 --- a/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FlowTestsBase.g.cs @@ -379,28 +379,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => cubicmeterpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Flow a = Flow.FromCubicMetersPerSecond(1); - Flow b = Flow.FromCubicMetersPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Flow v = Flow.FromCubicMetersPerSecond(1); - Assert.True(v.Equals(Flow.FromCubicMetersPerSecond(1), Flow.FromCubicMetersPerSecond(CubicMetersPerSecondTolerance))); - Assert.False(v.Equals(Flow.Zero, Flow.FromCubicMetersPerSecond(CubicMetersPerSecondTolerance))); + Assert.True(v.Equals(Flow.FromCubicMetersPerSecond(1), CubicMetersPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Flow.Zero, CubicMetersPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index c7cc526d7e..71a10c50cd 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -249,28 +249,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newtonpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ForceChangeRate a = ForceChangeRate.FromNewtonsPerSecond(1); - ForceChangeRate b = ForceChangeRate.FromNewtonsPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ForceChangeRate v = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.True(v.Equals(ForceChangeRate.FromNewtonsPerSecond(1), ForceChangeRate.FromNewtonsPerSecond(NewtonsPerSecondTolerance))); - Assert.False(v.Equals(ForceChangeRate.Zero, ForceChangeRate.FromNewtonsPerSecond(NewtonsPerSecondTolerance))); + Assert.True(v.Equals(ForceChangeRate.FromNewtonsPerSecond(1), NewtonsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ForceChangeRate.Zero, NewtonsPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index df43843b85..475ba70f58 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -229,28 +229,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newtonpermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ForcePerLength a = ForcePerLength.FromNewtonsPerMeter(1); - ForcePerLength b = ForcePerLength.FromNewtonsPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ForcePerLength v = ForcePerLength.FromNewtonsPerMeter(1); - Assert.True(v.Equals(ForcePerLength.FromNewtonsPerMeter(1), ForcePerLength.FromNewtonsPerMeter(NewtonsPerMeterTolerance))); - Assert.False(v.Equals(ForcePerLength.Zero, ForcePerLength.FromNewtonsPerMeter(NewtonsPerMeterTolerance))); + Assert.True(v.Equals(ForcePerLength.FromNewtonsPerMeter(1), NewtonsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ForcePerLength.Zero, NewtonsPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 72f36a6078..675e78b0aa 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -239,28 +239,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newton.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Force a = Force.FromNewtons(1); - Force b = Force.FromNewtons(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Force v = Force.FromNewtons(1); - Assert.True(v.Equals(Force.FromNewtons(1), Force.FromNewtons(NewtonsTolerance))); - Assert.False(v.Equals(Force.Zero, Force.FromNewtons(NewtonsTolerance))); + Assert.True(v.Equals(Force.FromNewtons(1), NewtonsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Force.Zero, NewtonsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index 095f12058a..57829de236 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -219,28 +219,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => hertz.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Frequency a = Frequency.FromHertz(1); - Frequency b = Frequency.FromHertz(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Frequency v = Frequency.FromHertz(1); - Assert.True(v.Equals(Frequency.FromHertz(1), Frequency.FromHertz(HertzTolerance))); - Assert.False(v.Equals(Frequency.Zero, Frequency.FromHertz(HertzTolerance))); + Assert.True(v.Equals(Frequency.FromHertz(1), HertzTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Frequency.Zero, HertzTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index f704b9faff..745ab078d4 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -299,28 +299,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => wattpersquaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - HeatFlux a = HeatFlux.FromWattsPerSquareMeter(1); - HeatFlux b = HeatFlux.FromWattsPerSquareMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { HeatFlux v = HeatFlux.FromWattsPerSquareMeter(1); - Assert.True(v.Equals(HeatFlux.FromWattsPerSquareMeter(1), HeatFlux.FromWattsPerSquareMeter(WattsPerSquareMeterTolerance))); - Assert.False(v.Equals(HeatFlux.Zero, HeatFlux.FromWattsPerSquareMeter(WattsPerSquareMeterTolerance))); + Assert.True(v.Equals(HeatFlux.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(HeatFlux.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index 38c513a17a..fbb8dfae1a 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -159,28 +159,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => wattpersquaremeterkelvin.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - HeatTransferCoefficient a = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - HeatTransferCoefficient b = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { HeatTransferCoefficient v = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.True(v.Equals(HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1), HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(WattsPerSquareMeterKelvinTolerance))); - Assert.False(v.Equals(HeatTransferCoefficient.Zero, HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(WattsPerSquareMeterKelvinTolerance))); + Assert.True(v.Equals(HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1), WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(HeatTransferCoefficient.Zero, WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index 19d2830557..bb41e712c1 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -179,28 +179,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => lux.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Illuminance a = Illuminance.FromLux(1); - Illuminance b = Illuminance.FromLux(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Illuminance v = Illuminance.FromLux(1); - Assert.True(v.Equals(Illuminance.FromLux(1), Illuminance.FromLux(LuxTolerance))); - Assert.False(v.Equals(Illuminance.Zero, Illuminance.FromLux(LuxTolerance))); + Assert.True(v.Equals(Illuminance.FromLux(1), LuxTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Illuminance.Zero, LuxTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 635c68699f..9838aae21a 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -399,28 +399,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => bit.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Information a = Information.FromBits(1); - Information b = Information.FromBits(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Information v = Information.FromBits(1); - Assert.True(v.Equals(Information.FromBits(1), Information.FromBits(BitsTolerance))); - Assert.False(v.Equals(Information.Zero, Information.FromBits(BitsTolerance))); + Assert.True(v.Equals(Information.FromBits(1), BitsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Information.Zero, BitsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index 2fef8007e2..abafe1662d 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -159,28 +159,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => wattpersquaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Irradiance a = Irradiance.FromWattsPerSquareMeter(1); - Irradiance b = Irradiance.FromWattsPerSquareMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Irradiance v = Irradiance.FromWattsPerSquareMeter(1); - Assert.True(v.Equals(Irradiance.FromWattsPerSquareMeter(1), Irradiance.FromWattsPerSquareMeter(WattsPerSquareMeterTolerance))); - Assert.False(v.Equals(Irradiance.Zero, Irradiance.FromWattsPerSquareMeter(WattsPerSquareMeterTolerance))); + Assert.True(v.Equals(Irradiance.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Irradiance.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index f77c29779f..9beaf2316b 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => joulepersquaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Irradiation a = Irradiation.FromJoulesPerSquareMeter(1); - Irradiation b = Irradiation.FromJoulesPerSquareMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Irradiation v = Irradiation.FromJoulesPerSquareMeter(1); - Assert.True(v.Equals(Irradiation.FromJoulesPerSquareMeter(1), Irradiation.FromJoulesPerSquareMeter(JoulesPerSquareMeterTolerance))); - Assert.False(v.Equals(Irradiation.Zero, Irradiation.FromJoulesPerSquareMeter(JoulesPerSquareMeterTolerance))); + Assert.True(v.Equals(Irradiation.FromJoulesPerSquareMeter(1), JoulesPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Irradiation.Zero, JoulesPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 1182770b7b..8658aff7ea 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -219,28 +219,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => squaremeterpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - KinematicViscosity a = KinematicViscosity.FromSquareMetersPerSecond(1); - KinematicViscosity b = KinematicViscosity.FromSquareMetersPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { KinematicViscosity v = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.True(v.Equals(KinematicViscosity.FromSquareMetersPerSecond(1), KinematicViscosity.FromSquareMetersPerSecond(SquareMetersPerSecondTolerance))); - Assert.False(v.Equals(KinematicViscosity.Zero, KinematicViscosity.FromSquareMetersPerSecond(SquareMetersPerSecondTolerance))); + Assert.True(v.Equals(KinematicViscosity.FromSquareMetersPerSecond(1), SquareMetersPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(KinematicViscosity.Zero, SquareMetersPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 10c3f138ff..7d2fcf1f37 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => degreecelsiusperkilometer.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - LapseRate a = LapseRate.FromDegreesCelciusPerKilometer(1); - LapseRate b = LapseRate.FromDegreesCelciusPerKilometer(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { LapseRate v = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.True(v.Equals(LapseRate.FromDegreesCelciusPerKilometer(1), LapseRate.FromDegreesCelciusPerKilometer(DegreesCelciusPerKilometerTolerance))); - Assert.False(v.Equals(LapseRate.Zero, LapseRate.FromDegreesCelciusPerKilometer(DegreesCelciusPerKilometerTolerance))); + Assert.True(v.Equals(LapseRate.FromDegreesCelciusPerKilometer(1), DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LapseRate.Zero, DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index 6db53d0741..3b3e68c55a 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -359,28 +359,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => meter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Length a = Length.FromMeters(1); - Length b = Length.FromMeters(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Length v = Length.FromMeters(1); - Assert.True(v.Equals(Length.FromMeters(1), Length.FromMeters(MetersTolerance))); - Assert.False(v.Equals(Length.Zero, Length.FromMeters(MetersTolerance))); + Assert.True(v.Equals(Length.FromMeters(1), MetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Length.Zero, MetersTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 361a62038e..3bb2e29d6e 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -164,28 +164,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => decibel.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Level a = Level.FromDecibels(1); - Level b = Level.FromDecibels(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Level v = Level.FromDecibels(1); - Assert.True(v.Equals(Level.FromDecibels(1), Level.FromDecibels(DecibelsTolerance))); - Assert.False(v.Equals(Level.Zero, Level.FromDecibels(DecibelsTolerance))); + Assert.True(v.Equals(Level.FromDecibels(1), DecibelsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Level.Zero, DecibelsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index 1efda1e3cc..f539cd5237 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogrampermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - LinearDensity a = LinearDensity.FromKilogramsPerMeter(1); - LinearDensity b = LinearDensity.FromKilogramsPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { LinearDensity v = LinearDensity.FromKilogramsPerMeter(1); - Assert.True(v.Equals(LinearDensity.FromKilogramsPerMeter(1), LinearDensity.FromKilogramsPerMeter(KilogramsPerMeterTolerance))); - Assert.False(v.Equals(LinearDensity.Zero, LinearDensity.FromKilogramsPerMeter(KilogramsPerMeterTolerance))); + Assert.True(v.Equals(LinearDensity.FromKilogramsPerMeter(1), KilogramsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LinearDensity.Zero, KilogramsPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index acc5cbb383..1d8377c939 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => lumen.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - LuminousFlux a = LuminousFlux.FromLumens(1); - LuminousFlux b = LuminousFlux.FromLumens(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { LuminousFlux v = LuminousFlux.FromLumens(1); - Assert.True(v.Equals(LuminousFlux.FromLumens(1), LuminousFlux.FromLumens(LumensTolerance))); - Assert.False(v.Equals(LuminousFlux.Zero, LuminousFlux.FromLumens(LumensTolerance))); + Assert.True(v.Equals(LuminousFlux.FromLumens(1), LumensTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LuminousFlux.Zero, LumensTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index 51855d73cc..43a3f8571f 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => candela.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - LuminousIntensity a = LuminousIntensity.FromCandela(1); - LuminousIntensity b = LuminousIntensity.FromCandela(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { LuminousIntensity v = LuminousIntensity.FromCandela(1); - Assert.True(v.Equals(LuminousIntensity.FromCandela(1), LuminousIntensity.FromCandela(CandelaTolerance))); - Assert.False(v.Equals(LuminousIntensity.Zero, LuminousIntensity.FromCandela(CandelaTolerance))); + Assert.True(v.Equals(LuminousIntensity.FromCandela(1), CandelaTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(LuminousIntensity.Zero, CandelaTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index 2245cd6973..aa8c49db3f 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => tesla.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MagneticField a = MagneticField.FromTeslas(1); - MagneticField b = MagneticField.FromTeslas(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MagneticField v = MagneticField.FromTeslas(1); - Assert.True(v.Equals(MagneticField.FromTeslas(1), MagneticField.FromTeslas(TeslasTolerance))); - Assert.False(v.Equals(MagneticField.Zero, MagneticField.FromTeslas(TeslasTolerance))); + Assert.True(v.Equals(MagneticField.FromTeslas(1), TeslasTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MagneticField.Zero, TeslasTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index 9a67e75476..0324d949a3 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => weber.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MagneticFlux a = MagneticFlux.FromWebers(1); - MagneticFlux b = MagneticFlux.FromWebers(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MagneticFlux v = MagneticFlux.FromWebers(1); - Assert.True(v.Equals(MagneticFlux.FromWebers(1), MagneticFlux.FromWebers(WebersTolerance))); - Assert.False(v.Equals(MagneticFlux.Zero, MagneticFlux.FromWebers(WebersTolerance))); + Assert.True(v.Equals(MagneticFlux.FromWebers(1), WebersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MagneticFlux.Zero, WebersTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index 7e3f1aeae2..9d0205fa94 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => amperepermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Magnetization a = Magnetization.FromAmperesPerMeter(1); - Magnetization b = Magnetization.FromAmperesPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Magnetization v = Magnetization.FromAmperesPerMeter(1); - Assert.True(v.Equals(Magnetization.FromAmperesPerMeter(1), Magnetization.FromAmperesPerMeter(AmperesPerMeterTolerance))); - Assert.False(v.Equals(Magnetization.Zero, Magnetization.FromAmperesPerMeter(AmperesPerMeterTolerance))); + Assert.True(v.Equals(Magnetization.FromAmperesPerMeter(1), AmperesPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Magnetization.Zero, AmperesPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 8f6aa826ea..9fd4c1d834 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -289,28 +289,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => grampersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MassFlow a = MassFlow.FromGramsPerSecond(1); - MassFlow b = MassFlow.FromGramsPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MassFlow v = MassFlow.FromGramsPerSecond(1); - Assert.True(v.Equals(MassFlow.FromGramsPerSecond(1), MassFlow.FromGramsPerSecond(GramsPerSecondTolerance))); - Assert.False(v.Equals(MassFlow.Zero, MassFlow.FromGramsPerSecond(GramsPerSecondTolerance))); + Assert.True(v.Equals(MassFlow.FromGramsPerSecond(1), GramsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassFlow.Zero, GramsPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index d1a1e0acc2..d8edec8a0b 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -159,28 +159,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogrampersecondpersquaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MassFlux a = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - MassFlux b = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MassFlux v = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.True(v.Equals(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), MassFlux.FromKilogramsPerSecondPerSquareMeter(KilogramsPerSecondPerSquareMeterTolerance))); - Assert.False(v.Equals(MassFlux.Zero, MassFlux.FromKilogramsPerSecondPerSquareMeter(KilogramsPerSecondPerSquareMeterTolerance))); + Assert.True(v.Equals(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassFlux.Zero, KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index 33f518a927..ab3adee533 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -399,28 +399,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogramsquaremeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MassMomentOfInertia a = MassMomentOfInertia.FromKilogramSquareMeters(1); - MassMomentOfInertia b = MassMomentOfInertia.FromKilogramSquareMeters(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MassMomentOfInertia v = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.True(v.Equals(MassMomentOfInertia.FromKilogramSquareMeters(1), MassMomentOfInertia.FromKilogramSquareMeters(KilogramSquareMetersTolerance))); - Assert.False(v.Equals(MassMomentOfInertia.Zero, MassMomentOfInertia.FromKilogramSquareMeters(KilogramSquareMetersTolerance))); + Assert.True(v.Equals(MassMomentOfInertia.FromKilogramSquareMeters(1), KilogramSquareMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MassMomentOfInertia.Zero, KilogramSquareMetersTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index 1e15593177..13586290ae 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -349,28 +349,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogram.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Mass a = Mass.FromKilograms(1); - Mass b = Mass.FromKilograms(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Mass v = Mass.FromKilograms(1); - Assert.True(v.Equals(Mass.FromKilograms(1), Mass.FromKilograms(KilogramsTolerance))); - Assert.False(v.Equals(Mass.Zero, Mass.FromKilograms(KilogramsTolerance))); + Assert.True(v.Equals(Mass.FromKilograms(1), KilogramsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Mass.Zero, KilogramsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index 920f219a95..d513b87f1d 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => joulepermole.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MolarEnergy a = MolarEnergy.FromJoulesPerMole(1); - MolarEnergy b = MolarEnergy.FromJoulesPerMole(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MolarEnergy v = MolarEnergy.FromJoulesPerMole(1); - Assert.True(v.Equals(MolarEnergy.FromJoulesPerMole(1), MolarEnergy.FromJoulesPerMole(JoulesPerMoleTolerance))); - Assert.False(v.Equals(MolarEnergy.Zero, MolarEnergy.FromJoulesPerMole(JoulesPerMoleTolerance))); + Assert.True(v.Equals(MolarEnergy.FromJoulesPerMole(1), JoulesPerMoleTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MolarEnergy.Zero, JoulesPerMoleTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index 7892dcd4e6..fc31da2b01 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => joulepermolekelvin.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MolarEntropy a = MolarEntropy.FromJoulesPerMoleKelvin(1); - MolarEntropy b = MolarEntropy.FromJoulesPerMoleKelvin(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MolarEntropy v = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.True(v.Equals(MolarEntropy.FromJoulesPerMoleKelvin(1), MolarEntropy.FromJoulesPerMoleKelvin(JoulesPerMoleKelvinTolerance))); - Assert.False(v.Equals(MolarEntropy.Zero, MolarEntropy.FromJoulesPerMoleKelvin(JoulesPerMoleKelvinTolerance))); + Assert.True(v.Equals(MolarEntropy.FromJoulesPerMoleKelvin(1), JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MolarEntropy.Zero, JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index 83f82c605b..fd8a848e71 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -259,28 +259,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kilogrampermole.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - MolarMass a = MolarMass.FromKilogramsPerMole(1); - MolarMass b = MolarMass.FromKilogramsPerMole(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { MolarMass v = MolarMass.FromKilogramsPerMole(1); - Assert.True(v.Equals(MolarMass.FromKilogramsPerMole(1), MolarMass.FromKilogramsPerMole(KilogramsPerMoleTolerance))); - Assert.False(v.Equals(MolarMass.Zero, MolarMass.FromKilogramsPerMole(KilogramsPerMoleTolerance))); + Assert.True(v.Equals(MolarMass.FromKilogramsPerMole(1), KilogramsPerMoleTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(MolarMass.Zero, KilogramsPerMoleTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index d918cebc4f..2d0bdd0d89 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -219,28 +219,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => molespercubicmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Molarity a = Molarity.FromMolesPerCubicMeter(1); - Molarity b = Molarity.FromMolesPerCubicMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Molarity v = Molarity.FromMolesPerCubicMeter(1); - Assert.True(v.Equals(Molarity.FromMolesPerCubicMeter(1), Molarity.FromMolesPerCubicMeter(MolesPerCubicMeterTolerance))); - Assert.False(v.Equals(Molarity.Zero, Molarity.FromMolesPerCubicMeter(MolesPerCubicMeterTolerance))); + Assert.True(v.Equals(Molarity.FromMolesPerCubicMeter(1), MolesPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Molarity.Zero, MolesPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index 0826bfbfdd..f307316701 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => henrypermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Permeability a = Permeability.FromHenriesPerMeter(1); - Permeability b = Permeability.FromHenriesPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Permeability v = Permeability.FromHenriesPerMeter(1); - Assert.True(v.Equals(Permeability.FromHenriesPerMeter(1), Permeability.FromHenriesPerMeter(HenriesPerMeterTolerance))); - Assert.False(v.Equals(Permeability.Zero, Permeability.FromHenriesPerMeter(HenriesPerMeterTolerance))); + Assert.True(v.Equals(Permeability.FromHenriesPerMeter(1), HenriesPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Permeability.Zero, HenriesPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index f3137f003a..2ab368854a 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => faradpermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Permittivity a = Permittivity.FromFaradsPerMeter(1); - Permittivity b = Permittivity.FromFaradsPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Permittivity v = Permittivity.FromFaradsPerMeter(1); - Assert.True(v.Equals(Permittivity.FromFaradsPerMeter(1), Permittivity.FromFaradsPerMeter(FaradsPerMeterTolerance))); - Assert.False(v.Equals(Permittivity.Zero, Permittivity.FromFaradsPerMeter(FaradsPerMeterTolerance))); + Assert.True(v.Equals(Permittivity.FromFaradsPerMeter(1), FaradsPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Permittivity.Zero, FaradsPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 7ec8597875..8bc82409e1 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -579,28 +579,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => wattpercubicmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - PowerDensity a = PowerDensity.FromWattsPerCubicMeter(1); - PowerDensity b = PowerDensity.FromWattsPerCubicMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { PowerDensity v = PowerDensity.FromWattsPerCubicMeter(1); - Assert.True(v.Equals(PowerDensity.FromWattsPerCubicMeter(1), PowerDensity.FromWattsPerCubicMeter(WattsPerCubicMeterTolerance))); - Assert.False(v.Equals(PowerDensity.Zero, PowerDensity.FromWattsPerCubicMeter(WattsPerCubicMeterTolerance))); + Assert.True(v.Equals(PowerDensity.FromWattsPerCubicMeter(1), WattsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(PowerDensity.Zero, WattsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index 9ee129a240..998f067817 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -164,28 +164,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => decibelwatt.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - PowerRatio a = PowerRatio.FromDecibelWatts(1); - PowerRatio b = PowerRatio.FromDecibelWatts(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { PowerRatio v = PowerRatio.FromDecibelWatts(1); - Assert.True(v.Equals(PowerRatio.FromDecibelWatts(1), PowerRatio.FromDecibelWatts(DecibelWattsTolerance))); - Assert.False(v.Equals(PowerRatio.Zero, PowerRatio.FromDecibelWatts(DecibelWattsTolerance))); + Assert.True(v.Equals(PowerRatio.FromDecibelWatts(1), DecibelWattsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(PowerRatio.Zero, DecibelWattsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index 894accc13a..965e63128c 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -339,28 +339,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => watt.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Power a = Power.FromWatts(1); - Power b = Power.FromWatts(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Power v = Power.FromWatts(1); - Assert.True(v.Equals(Power.FromWatts(1), Power.FromWatts(WattsTolerance))); - Assert.False(v.Equals(Power.Zero, Power.FromWatts(WattsTolerance))); + Assert.True(v.Equals(Power.FromWatts(1), WattsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Power.Zero, WattsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index a682b11362..879d0f0cd0 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -179,28 +179,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => pascalpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - PressureChangeRate a = PressureChangeRate.FromPascalsPerSecond(1); - PressureChangeRate b = PressureChangeRate.FromPascalsPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { PressureChangeRate v = PressureChangeRate.FromPascalsPerSecond(1); - Assert.True(v.Equals(PressureChangeRate.FromPascalsPerSecond(1), PressureChangeRate.FromPascalsPerSecond(PascalsPerSecondTolerance))); - Assert.False(v.Equals(PressureChangeRate.Zero, PressureChangeRate.FromPascalsPerSecond(PascalsPerSecondTolerance))); + Assert.True(v.Equals(PressureChangeRate.FromPascalsPerSecond(1), PascalsPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(PressureChangeRate.Zero, PascalsPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index fad6f6b86e..900ee1ffe5 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -519,28 +519,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => pascal.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Pressure a = Pressure.FromPascals(1); - Pressure b = Pressure.FromPascals(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Pressure v = Pressure.FromPascals(1); - Assert.True(v.Equals(Pressure.FromPascals(1), Pressure.FromPascals(PascalsTolerance))); - Assert.False(v.Equals(Pressure.Zero, Pressure.FromPascals(PascalsTolerance))); + Assert.True(v.Equals(Pressure.FromPascals(1), PascalsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Pressure.Zero, PascalsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index 0b1e156e0d..2c2397753a 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -199,28 +199,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => decimalfraction.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Ratio a = Ratio.FromDecimalFractions(1); - Ratio b = Ratio.FromDecimalFractions(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Ratio v = Ratio.FromDecimalFractions(1); - Assert.True(v.Equals(Ratio.FromDecimalFractions(1), Ratio.FromDecimalFractions(DecimalFractionsTolerance))); - Assert.False(v.Equals(Ratio.Zero, Ratio.FromDecimalFractions(DecimalFractionsTolerance))); + Assert.True(v.Equals(Ratio.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Ratio.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index d0deaa44aa..78212a0e1f 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => voltamperereactivehour.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ReactiveEnergy a = ReactiveEnergy.FromVoltampereReactiveHours(1); - ReactiveEnergy b = ReactiveEnergy.FromVoltampereReactiveHours(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ReactiveEnergy v = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.True(v.Equals(ReactiveEnergy.FromVoltampereReactiveHours(1), ReactiveEnergy.FromVoltampereReactiveHours(VoltampereReactiveHoursTolerance))); - Assert.False(v.Equals(ReactiveEnergy.Zero, ReactiveEnergy.FromVoltampereReactiveHours(VoltampereReactiveHoursTolerance))); + Assert.True(v.Equals(ReactiveEnergy.FromVoltampereReactiveHours(1), VoltampereReactiveHoursTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ReactiveEnergy.Zero, VoltampereReactiveHoursTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index 627bdaa5d3..9b325f9183 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -179,28 +179,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => voltamperereactive.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ReactivePower a = ReactivePower.FromVoltamperesReactive(1); - ReactivePower b = ReactivePower.FromVoltamperesReactive(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ReactivePower v = ReactivePower.FromVoltamperesReactive(1); - Assert.True(v.Equals(ReactivePower.FromVoltamperesReactive(1), ReactivePower.FromVoltamperesReactive(VoltamperesReactiveTolerance))); - Assert.False(v.Equals(ReactivePower.Zero, ReactivePower.FromVoltamperesReactive(VoltamperesReactiveTolerance))); + Assert.True(v.Equals(ReactivePower.FromVoltamperesReactive(1), VoltamperesReactiveTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ReactivePower.Zero, VoltamperesReactiveTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index c22d688973..3e23884d1c 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => radianpersecondsquared.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - RotationalAcceleration a = RotationalAcceleration.FromRadiansPerSecondSquared(1); - RotationalAcceleration b = RotationalAcceleration.FromRadiansPerSecondSquared(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { RotationalAcceleration v = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.True(v.Equals(RotationalAcceleration.FromRadiansPerSecondSquared(1), RotationalAcceleration.FromRadiansPerSecondSquared(RadiansPerSecondSquaredTolerance))); - Assert.False(v.Equals(RotationalAcceleration.Zero, RotationalAcceleration.FromRadiansPerSecondSquared(RadiansPerSecondSquaredTolerance))); + Assert.True(v.Equals(RotationalAcceleration.FromRadiansPerSecondSquared(1), RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalAcceleration.Zero, RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index 3ad5a6df0d..c031eebfde 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -269,28 +269,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => radianpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - RotationalSpeed a = RotationalSpeed.FromRadiansPerSecond(1); - RotationalSpeed b = RotationalSpeed.FromRadiansPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { RotationalSpeed v = RotationalSpeed.FromRadiansPerSecond(1); - Assert.True(v.Equals(RotationalSpeed.FromRadiansPerSecond(1), RotationalSpeed.FromRadiansPerSecond(RadiansPerSecondTolerance))); - Assert.False(v.Equals(RotationalSpeed.Zero, RotationalSpeed.FromRadiansPerSecond(RadiansPerSecondTolerance))); + Assert.True(v.Equals(RotationalSpeed.FromRadiansPerSecond(1), RadiansPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalSpeed.Zero, RadiansPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 333b1b1c5d..2d0dab215e 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newtonmeterperradianpermeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - RotationalStiffnessPerLength a = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - RotationalStiffnessPerLength b = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { RotationalStiffnessPerLength v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.True(v.Equals(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1), RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(NewtonMetersPerRadianPerMeterTolerance))); - Assert.False(v.Equals(RotationalStiffnessPerLength.Zero, RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(NewtonMetersPerRadianPerMeterTolerance))); + Assert.True(v.Equals(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1), NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalStiffnessPerLength.Zero, NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index 0dba2bc6c5..cf8e152fa6 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -169,28 +169,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newtonmeterperradian.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - RotationalStiffness a = RotationalStiffness.FromNewtonMetersPerRadian(1); - RotationalStiffness b = RotationalStiffness.FromNewtonMetersPerRadian(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { RotationalStiffness v = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.True(v.Equals(RotationalStiffness.FromNewtonMetersPerRadian(1), RotationalStiffness.FromNewtonMetersPerRadian(NewtonMetersPerRadianTolerance))); - Assert.False(v.Equals(RotationalStiffness.Zero, RotationalStiffness.FromNewtonMetersPerRadian(NewtonMetersPerRadianTolerance))); + Assert.True(v.Equals(RotationalStiffness.FromNewtonMetersPerRadian(1), NewtonMetersPerRadianTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(RotationalStiffness.Zero, NewtonMetersPerRadianTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index 9a8ce58204..f673e26e4e 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => steradian.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - SolidAngle a = SolidAngle.FromSteradians(1); - SolidAngle b = SolidAngle.FromSteradians(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { SolidAngle v = SolidAngle.FromSteradians(1); - Assert.True(v.Equals(SolidAngle.FromSteradians(1), SolidAngle.FromSteradians(SteradiansTolerance))); - Assert.False(v.Equals(SolidAngle.Zero, SolidAngle.FromSteradians(SteradiansTolerance))); + Assert.True(v.Equals(SolidAngle.FromSteradians(1), SteradiansTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SolidAngle.Zero, SteradiansTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index 21f5e5a664..1072b5c4a3 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -219,28 +219,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => jouleperkilogram.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - SpecificEnergy a = SpecificEnergy.FromJoulesPerKilogram(1); - SpecificEnergy b = SpecificEnergy.FromJoulesPerKilogram(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { SpecificEnergy v = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.True(v.Equals(SpecificEnergy.FromJoulesPerKilogram(1), SpecificEnergy.FromJoulesPerKilogram(JoulesPerKilogramTolerance))); - Assert.False(v.Equals(SpecificEnergy.Zero, SpecificEnergy.FromJoulesPerKilogram(JoulesPerKilogramTolerance))); + Assert.True(v.Equals(SpecificEnergy.FromJoulesPerKilogram(1), JoulesPerKilogramTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificEnergy.Zero, JoulesPerKilogramTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 484e9ad12b..9c49f40558 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -219,28 +219,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => jouleperkilogramkelvin.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - SpecificEntropy a = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - SpecificEntropy b = SpecificEntropy.FromJoulesPerKilogramKelvin(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { SpecificEntropy v = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.True(v.Equals(SpecificEntropy.FromJoulesPerKilogramKelvin(1), SpecificEntropy.FromJoulesPerKilogramKelvin(JoulesPerKilogramKelvinTolerance))); - Assert.False(v.Equals(SpecificEntropy.Zero, SpecificEntropy.FromJoulesPerKilogramKelvin(JoulesPerKilogramKelvinTolerance))); + Assert.True(v.Equals(SpecificEntropy.FromJoulesPerKilogramKelvin(1), JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificEntropy.Zero, JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 8ad46ec812..8a91d36863 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -159,28 +159,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => cubicmeterperkilogram.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - SpecificVolume a = SpecificVolume.FromCubicMetersPerKilogram(1); - SpecificVolume b = SpecificVolume.FromCubicMetersPerKilogram(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { SpecificVolume v = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.True(v.Equals(SpecificVolume.FromCubicMetersPerKilogram(1), SpecificVolume.FromCubicMetersPerKilogram(CubicMetersPerKilogramTolerance))); - Assert.False(v.Equals(SpecificVolume.Zero, SpecificVolume.FromCubicMetersPerKilogram(CubicMetersPerKilogramTolerance))); + Assert.True(v.Equals(SpecificVolume.FromCubicMetersPerKilogram(1), CubicMetersPerKilogramTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificVolume.Zero, CubicMetersPerKilogramTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index 6ce9860bf4..6221a093a1 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -309,28 +309,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newtonpercubicmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - SpecificWeight a = SpecificWeight.FromNewtonsPerCubicMeter(1); - SpecificWeight b = SpecificWeight.FromNewtonsPerCubicMeter(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { SpecificWeight v = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.True(v.Equals(SpecificWeight.FromNewtonsPerCubicMeter(1), SpecificWeight.FromNewtonsPerCubicMeter(NewtonsPerCubicMeterTolerance))); - Assert.False(v.Equals(SpecificWeight.Zero, SpecificWeight.FromNewtonsPerCubicMeter(NewtonsPerCubicMeterTolerance))); + Assert.True(v.Equals(SpecificWeight.FromNewtonsPerCubicMeter(1), NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(SpecificWeight.Zero, NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index 44c1e91ab3..b26aec893d 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -459,28 +459,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => meterpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Speed a = Speed.FromMetersPerSecond(1); - Speed b = Speed.FromMetersPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Speed v = Speed.FromMetersPerSecond(1); - Assert.True(v.Equals(Speed.FromMetersPerSecond(1), Speed.FromMetersPerSecond(MetersPerSecondTolerance))); - Assert.False(v.Equals(Speed.Zero, Speed.FromMetersPerSecond(MetersPerSecondTolerance))); + Assert.True(v.Equals(Speed.FromMetersPerSecond(1), MetersPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Speed.Zero, MetersPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index a5d3503dc7..7d5d3aea7f 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -239,28 +239,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => degreecelsiuspersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - TemperatureChangeRate a = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - TemperatureChangeRate b = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { TemperatureChangeRate v = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.True(v.Equals(TemperatureChangeRate.FromDegreesCelsiusPerSecond(1), TemperatureChangeRate.FromDegreesCelsiusPerSecond(DegreesCelsiusPerSecondTolerance))); - Assert.False(v.Equals(TemperatureChangeRate.Zero, TemperatureChangeRate.FromDegreesCelsiusPerSecond(DegreesCelsiusPerSecondTolerance))); + Assert.True(v.Equals(TemperatureChangeRate.FromDegreesCelsiusPerSecond(1), DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(TemperatureChangeRate.Zero, DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index 3fd5e0a093..7e856964cf 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -299,28 +299,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kelvin.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - TemperatureDelta a = TemperatureDelta.FromKelvins(1); - TemperatureDelta b = TemperatureDelta.FromKelvins(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { TemperatureDelta v = TemperatureDelta.FromKelvins(1); - Assert.True(v.Equals(TemperatureDelta.FromKelvins(1), TemperatureDelta.FromKelvins(KelvinsTolerance))); - Assert.False(v.Equals(TemperatureDelta.Zero, TemperatureDelta.FromKelvins(KelvinsTolerance))); + Assert.True(v.Equals(TemperatureDelta.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(TemperatureDelta.Zero, KelvinsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index e855ea235c..43f99b4864 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -207,28 +207,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => kelvin.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Temperature a = Temperature.FromKelvins(1); - Temperature b = Temperature.FromKelvins(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Temperature v = Temperature.FromKelvins(1); - Assert.True(v.Equals(Temperature.FromKelvins(1), Temperature.FromKelvins(KelvinsTolerance))); - Assert.False(v.Equals(Temperature.Zero, Temperature.FromKelvins(KelvinsTolerance))); + Assert.True(v.Equals(Temperature.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Temperature.Zero, KelvinsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index 0f59b697b8..8c8c4384b2 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -159,28 +159,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => wattpermeterkelvin.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ThermalConductivity a = ThermalConductivity.FromWattsPerMeterKelvin(1); - ThermalConductivity b = ThermalConductivity.FromWattsPerMeterKelvin(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ThermalConductivity v = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.True(v.Equals(ThermalConductivity.FromWattsPerMeterKelvin(1), ThermalConductivity.FromWattsPerMeterKelvin(WattsPerMeterKelvinTolerance))); - Assert.False(v.Equals(ThermalConductivity.Zero, ThermalConductivity.FromWattsPerMeterKelvin(WattsPerMeterKelvinTolerance))); + Assert.True(v.Equals(ThermalConductivity.FromWattsPerMeterKelvin(1), WattsPerMeterKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ThermalConductivity.Zero, WattsPerMeterKelvinTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index b2f1989ed0..5a7b6d6e70 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -189,28 +189,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => squaremeterkelvinperkilowatt.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - ThermalResistance a = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - ThermalResistance b = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { ThermalResistance v = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.True(v.Equals(ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1), ThermalResistance.FromSquareMeterKelvinsPerKilowatt(SquareMeterKelvinsPerKilowattTolerance))); - Assert.False(v.Equals(ThermalResistance.Zero, ThermalResistance.FromSquareMeterKelvinsPerKilowatt(SquareMeterKelvinsPerKilowattTolerance))); + Assert.True(v.Equals(ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1), SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(ThermalResistance.Zero, SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index 908ec3f2f0..297647516e 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -349,28 +349,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => newtonmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Torque a = Torque.FromNewtonMeters(1); - Torque b = Torque.FromNewtonMeters(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Torque v = Torque.FromNewtonMeters(1); - Assert.True(v.Equals(Torque.FromNewtonMeters(1), Torque.FromNewtonMeters(NewtonMetersTolerance))); - Assert.False(v.Equals(Torque.Zero, Torque.FromNewtonMeters(NewtonMetersTolerance))); + Assert.True(v.Equals(Torque.FromNewtonMeters(1), NewtonMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Torque.Zero, NewtonMetersTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index 8d75f4a4cc..8d5d86f2e6 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -149,28 +149,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => internationalunit.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - VitaminA a = VitaminA.FromInternationalUnits(1); - VitaminA b = VitaminA.FromInternationalUnits(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { VitaminA v = VitaminA.FromInternationalUnits(1); - Assert.True(v.Equals(VitaminA.FromInternationalUnits(1), VitaminA.FromInternationalUnits(InternationalUnitsTolerance))); - Assert.False(v.Equals(VitaminA.Zero, VitaminA.FromInternationalUnits(InternationalUnitsTolerance))); + Assert.True(v.Equals(VitaminA.FromInternationalUnits(1), InternationalUnitsTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(VitaminA.Zero, InternationalUnitsTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index 30cdffaf77..e7f4484e3f 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -399,28 +399,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => cubicmeterpersecond.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - VolumeFlow a = VolumeFlow.FromCubicMetersPerSecond(1); - VolumeFlow b = VolumeFlow.FromCubicMetersPerSecond(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { VolumeFlow v = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.True(v.Equals(VolumeFlow.FromCubicMetersPerSecond(1), VolumeFlow.FromCubicMetersPerSecond(CubicMetersPerSecondTolerance))); - Assert.False(v.Equals(VolumeFlow.Zero, VolumeFlow.FromCubicMetersPerSecond(CubicMetersPerSecondTolerance))); + Assert.True(v.Equals(VolumeFlow.FromCubicMetersPerSecond(1), CubicMetersPerSecondTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(VolumeFlow.Zero, CubicMetersPerSecondTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index feecaf0831..561e1a70a0 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -579,28 +579,12 @@ public void CompareToThrowsOnNull() Assert.Throws(() => cubicmeter.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - Volume a = Volume.FromCubicMeters(1); - Volume b = Volume.FromCubicMeters(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { Volume v = Volume.FromCubicMeters(1); - Assert.True(v.Equals(Volume.FromCubicMeters(1), Volume.FromCubicMeters(CubicMetersTolerance))); - Assert.False(v.Equals(Volume.Zero, Volume.FromCubicMeters(CubicMetersTolerance))); + Assert.True(v.Equals(Volume.FromCubicMeters(1), CubicMetersTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(Volume.Zero, CubicMetersTolerance, ComparisonType.Relative)); } [Fact] diff --git a/UnitsNet.Tests/GeneratedQuantityCodeTests.cs b/UnitsNet.Tests/GeneratedQuantityCodeTests.cs index 501c0c5675..4f188897f4 100644 --- a/UnitsNet.Tests/GeneratedQuantityCodeTests.cs +++ b/UnitsNet.Tests/GeneratedQuantityCodeTests.cs @@ -18,14 +18,15 @@ public class QuantitiesWithDouble [Fact] public void LengthEquals_GivenMaxError_ReturnsTrueIfWithinError() { - Length smallError = Length.FromMeters(1e-5); - Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), Length.Zero), "Integer values have zero difference."); - Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), smallError), "Using a max difference value should not change that fact."); + var smallError = 1e-5; - Assert.False(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), Length.Zero), + Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), 0, ComparisonType.Relative), "Integer values have zero difference."); + Assert.True(Length.FromMeters(1).Equals(Length.FromMeters(1), smallError, ComparisonType.Relative), "Using a max difference value should not change that fact."); + + Assert.False(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), 0, ComparisonType.Relative), "Example of floating precision arithmetic that produces slightly different results."); - Assert.True(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), smallError), "But the difference is very small"); + Assert.True(Length.FromMeters(1 + 0.39).Equals(Length.FromMeters(1.39), smallError, ComparisonType.Relative), "But the difference is very small"); } } } -} \ No newline at end of file +} diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index afe7bad3d2..8ff4509d11 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -266,20 +266,6 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatP return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 61e24dca68..b3d268d9ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -275,20 +275,6 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFo return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index 23c643afd5..ca79c35eeb 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -193,20 +193,6 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index ca02498de4..26fa2a5282 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -275,20 +275,6 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 05dfc23e9d..b74eb3e4c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index aea8d678f7..86196917d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -185,20 +185,6 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormat return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 5235e24c0d..b20482542a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -266,20 +266,6 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 842a74b281..159a5b6241 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatPr return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 76f090fc9d..e0aea1f48c 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -203,20 +203,6 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 222a886e70..d1c325eb33 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -383,18 +383,6 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvid 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 9de58b5023..c92b6de956 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 1a0f3a3dd9..592a0dc187 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatPr return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index adc1b74e5f..d7cfe1e654 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -491,20 +491,6 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvid return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 351f373794..e70f240e05 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -257,20 +257,6 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvi return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index 40c15616e8..71ea9a2b70 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -203,20 +203,6 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFor return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index d1814b926c..cc4f9f96f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -185,20 +185,6 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IF return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index de311c02d2..79a455ea2b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index e5ac919058..8d9add2e54 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index c8e5ee97db..af78377c84 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index d74de9be33..6500618905 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 0f5858fe1b..4aceb2c5ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -221,20 +221,6 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IForm return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 4ac621d58f..becc8ec8a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 1bdea233a1..e3bc19a99c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 5f7b4d55cd..39452e92ff 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormat return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 8b8e0060e5..79980fef27 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IF return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index f9cebf55a4..9994c173c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -194,20 +194,6 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFo return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index f3df5f0762..cb3dd8ab0d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -194,20 +194,6 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index ea6f85c7ae..9292794555 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -194,20 +194,6 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index df944cce7a..a3ec5546fd 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -185,20 +185,6 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IF return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index e909be0ec1..32c54bfb66 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -185,20 +185,6 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 0aab5ee9a9..77a86e561b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -347,20 +347,6 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvide return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 1e174a2486..cf8dbb9521 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -212,20 +212,6 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvid return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs index 1530fa6888..3feb3a5a62 100644 --- a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs @@ -365,20 +365,6 @@ public static string GetAbbreviation(FlowUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index d741260a28..9ebb6099de 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -239,20 +239,6 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 1c5ec27ce0..1830a881da 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -248,20 +248,6 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IForm return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index a221b700b4..f725f96d81 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -230,20 +230,6 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 649b2a2c52..871f03d11f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -221,20 +221,6 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProv return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 3e1fdde1d7..f1c0910311 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -293,20 +293,6 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvi return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index cf0bf1e253..4acb91b185 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -167,20 +167,6 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 16e9931409..22a3ac2e3f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -185,20 +185,6 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatPr return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index bf562afe24..f7c313d6f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -383,18 +383,6 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 8a1ef1ab60..0c1c4e8f7e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -167,20 +167,6 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatPro return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 486da8cd88..1c5a322dac 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatPr return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index c9d49d1d19..7b0dd7d370 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -221,20 +221,6 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IF return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 1cd3e7621f..5064f495a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProv return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index f15c49f2f5..35b75bd61b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -347,20 +347,6 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvide return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 75bab150c4..17214b7202 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -175,20 +175,6 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index b2c1100816..a5ce6de6f1 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormat return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 778aabad6d..6f418ef2d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatP return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 56388d68d1..626e4293b5 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFo return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 636e0610cb..c2c14df516 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormat return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index f3f3eefdb3..a390959ed0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatP return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 9ee47929f2..a66a45d478 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormat return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index a2aff8b53e..0ffc4ce043 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -338,20 +338,6 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index e90181d29f..2e7158bdc1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -284,20 +284,6 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvi return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index ff966c6ddb..708514cb02 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -167,20 +167,6 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvi return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 009ea8b31d..c45d040c61 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -383,20 +383,6 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 0eedd254a6..c471ecff0f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatPr return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 854cf36bea..7c9a6617dc 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatP return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index a04598777e..791565bf01 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -257,20 +257,6 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProv return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index c431a9a647..f8ba36dc26 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -221,20 +221,6 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvi return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index d767808955..1e5c230ea6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatP return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 4891ceb3de..0a27fa02f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatP return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 9287d3cbb3..6d9af936d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -329,18 +329,6 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index c1612bea8f..bee5470e28 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -545,20 +545,6 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatP return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index fb8b9b3639..1a3cbfe419 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -175,20 +175,6 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatPro return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 251ae0bce2..246c0248d6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -491,20 +491,6 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvi return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index e9133a77a8..cd0a41f8a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -185,20 +185,6 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IF return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 993c2015d3..8862c5769f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -203,20 +203,6 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 390183475b..e8207d067e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index 086effb16a..160e450433 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -185,20 +185,6 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormat return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 16b0a47185..c1aac79709 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index baf25cc9cf..d80bcd0c84 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -266,20 +266,6 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IForm return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index db4b15e846..635fe64fdf 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index 0a41d0fef4..3185bd92f4 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -176,20 +176,6 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 802e37b63a..3c23ce20e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatPro return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 5d6fd503d4..88300d9590 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -221,20 +221,6 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index df6ff742b1..d20600f5ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -221,20 +221,6 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IForm return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 1e06b97f10..695f5eaa54 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -167,20 +167,6 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 417b4170e6..e863c6c3b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -302,20 +302,6 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IForma return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index daf8ab45d8..f6aede04a1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -437,20 +437,6 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 920828df1b..a368122031 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -182,20 +182,6 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatPr return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 87c254bb63..de51fe0be5 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -239,20 +239,6 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 1a85aa86c7..03c02671a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -293,20 +293,6 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFor return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 9d4eb1d11e..78c5f00e09 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -167,20 +167,6 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] I return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 8924ea7ab4..8cd0081ba2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -194,20 +194,6 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFo return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 3f03228011..ee7d3746d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -338,20 +338,6 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvide return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index b8ff7ad03b..eb5a2f0284 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -158,20 +158,6 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvi return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 17ec35b34f..d310e85923 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -545,20 +545,6 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvide return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index c4f7944647..13211f2989 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -383,20 +383,6 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatPro return left.Value > right.AsBaseNumericType(left.Unit); } - [Obsolete("It is not safe to compare equality due to 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); - } - #region Parsing /// diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index a95f59ca75..c57ca8574c 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -315,15 +315,6 @@ if ($obsoleteAttribute) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - $($obsoleteEqualityIfDouble)public override bool Equals(object obj) - { - if(obj is null || !(obj is $quantityName)) - return false; - - var objQuantity = ($quantityName)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - /// /// /// Compare equality to another $quantityName within the given absolute or relative tolerance. @@ -375,20 +366,6 @@ if ($obsoleteAttribute) return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } - /// - /// Compare equality to another $quantityName by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals($quantityName, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals($quantityName other, $quantityName maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - /// /// Returns the hash code for this instance. /// diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 6baf780cb9..25a72ef097 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -209,18 +209,6 @@ namespace UnitsNet 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); - } - #region Parsing /// diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index 37e87d401d..a1ae92fc08 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -198,28 +198,12 @@ namespace UnitsNet.Tests Assert.Throws(() => $baseUnitVariableName.CompareTo(null)); } - - [Fact] - public void EqualityOperators() - { - $quantityName a = $quantityName.From$baseUnitPluralName(1); - $quantityName b = $quantityName.From$baseUnitPluralName(2); - -// ReSharper disable EqualExpressionComparison - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -// ReSharper restore EqualExpressionComparison - } - [Fact] public void EqualsIsImplemented() { $quantityName v = $quantityName.From$baseUnitPluralName(1); - Assert.True(v.Equals($quantityName.From$baseUnitPluralName(1), $quantityName.From$baseUnitPluralName($($baseUnitPluralName)Tolerance))); - Assert.False(v.Equals($quantityName.Zero, $quantityName.From$baseUnitPluralName($($baseUnitPluralName)Tolerance))); + Assert.True(v.Equals($quantityName.From$baseUnitPluralName(1), $($baseUnitPluralName)Tolerance, ComparisonType.Relative)); + Assert.False(v.Equals($quantityName.Zero, $($baseUnitPluralName)Tolerance, ComparisonType.Relative)); } [Fact] From f59e55aa14351e7679f6611b7e34a1768f79baa9 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 24 Sep 2018 14:09:35 -0400 Subject: [PATCH 005/131] Removing nullable methods from quantity classes as well as extension methods --- UnitsNet.Tests/DecimalOverloadTests.cs | 68 --- UnitsNet.Tests/IntOverloadTests.cs | 68 --- UnitsNet.Tests/LongOverloadTests.cs | 68 --- UnitsNet.Tests/NullableConstructors.cs | 90 ---- .../NumberToAccelerationExtensions.g.cs | 104 ----- .../NumberToAmountOfSubstanceExtensions.g.cs | 112 ----- .../NumberToAmplitudeRatioExtensions.g.cs | 32 -- .../Number/NumberToAngleExtensions.g.cs | 112 ----- .../NumberToApparentEnergyExtensions.g.cs | 24 - .../NumberToApparentPowerExtensions.g.cs | 32 -- .../Number/NumberToAreaDensityExtensions.g.cs | 8 - .../Number/NumberToAreaExtensions.g.cs | 104 ----- ...NumberToAreaMomentOfInertiaExtensions.g.cs | 48 -- .../Number/NumberToBitRateExtensions.g.cs | 208 --------- ...rakeSpecificFuelConsumptionExtensions.g.cs | 24 - .../Number/NumberToCapacitanceExtensions.g.cs | 8 - .../Number/NumberToDensityExtensions.g.cs | 304 ------------- .../Number/NumberToDurationExtensions.g.cs | 96 ---- .../NumberToDynamicViscosityExtensions.g.cs | 48 -- .../NumberToElectricAdmittanceExtensions.g.cs | 32 -- ...mberToElectricChargeDensityExtensions.g.cs | 8 - .../NumberToElectricChargeExtensions.g.cs | 8 - ...NumberToElectricConductanceExtensions.g.cs | 24 - ...umberToElectricConductivityExtensions.g.cs | 8 - ...berToElectricCurrentDensityExtensions.g.cs | 8 - .../NumberToElectricCurrentExtensions.g.cs | 64 --- ...erToElectricCurrentGradientExtensions.g.cs | 8 - .../NumberToElectricFieldExtensions.g.cs | 8 - .../NumberToElectricInductanceExtensions.g.cs | 8 - ...NumberToElectricPotentialAcExtensions.g.cs | 40 -- ...NumberToElectricPotentialDcExtensions.g.cs | 40 -- .../NumberToElectricPotentialExtensions.g.cs | 40 -- .../NumberToElectricResistanceExtensions.g.cs | 32 -- ...NumberToElectricResistivityExtensions.g.cs | 32 -- .../Number/NumberToEnergyExtensions.g.cs | 176 -------- .../Number/NumberToEntropyExtensions.g.cs | 56 --- .../Number/NumberToFlowExtensions.g.cs | 192 -------- .../NumberToForceChangeRateExtensions.g.cs | 88 ---- .../Number/NumberToForceExtensions.g.cs | 80 ---- .../NumberToForcePerLengthExtensions.g.cs | 72 --- .../Number/NumberToFrequencyExtensions.g.cs | 56 --- .../Number/NumberToHeatFluxExtensions.g.cs | 128 ------ ...erToHeatTransferCoefficientExtensions.g.cs | 16 - .../Number/NumberToIlluminanceExtensions.g.cs | 32 -- .../Number/NumberToInformationExtensions.g.cs | 208 --------- .../Number/NumberToIrradianceExtensions.g.cs | 16 - .../Number/NumberToIrradiationExtensions.g.cs | 24 - .../NumberToKinematicViscosityExtensions.g.cs | 64 --- .../Number/NumberToLapseRateExtensions.g.cs | 8 - .../Number/NumberToLengthExtensions.g.cs | 176 -------- .../Number/NumberToLevelExtensions.g.cs | 16 - .../NumberToLinearDensityExtensions.g.cs | 24 - .../NumberToLuminousFluxExtensions.g.cs | 8 - .../NumberToLuminousIntensityExtensions.g.cs | 8 - .../NumberToMagneticFieldExtensions.g.cs | 8 - .../NumberToMagneticFluxExtensions.g.cs | 8 - .../NumberToMagnetizationExtensions.g.cs | 8 - .../Number/NumberToMassExtensions.g.cs | 168 ------- .../Number/NumberToMassFlowExtensions.g.cs | 120 ----- .../Number/NumberToMassFluxExtensions.g.cs | 16 - ...NumberToMassMomentOfInertiaExtensions.g.cs | 208 --------- .../Number/NumberToMolarEnergyExtensions.g.cs | 24 - .../NumberToMolarEntropyExtensions.g.cs | 24 - .../Number/NumberToMolarMassExtensions.g.cs | 96 ---- .../Number/NumberToMolarityExtensions.g.cs | 64 --- .../NumberToPermeabilityExtensions.g.cs | 8 - .../NumberToPermittivityExtensions.g.cs | 8 - .../NumberToPowerDensityExtensions.g.cs | 352 --------------- .../Number/NumberToPowerExtensions.g.cs | 160 ------- .../Number/NumberToPowerRatioExtensions.g.cs | 16 - .../NumberToPressureChangeRateExtensions.g.cs | 32 -- .../Number/NumberToPressureExtensions.g.cs | 304 ------------- .../Number/NumberToRatioExtensions.g.cs | 48 -- .../NumberToReactiveEnergyExtensions.g.cs | 24 - .../NumberToReactivePowerExtensions.g.cs | 32 -- ...berToRotationalAccelerationExtensions.g.cs | 24 - .../NumberToRotationalSpeedExtensions.g.cs | 104 ----- ...NumberToRotationalStiffnessExtensions.g.cs | 24 - ...otationalStiffnessPerLengthExtensions.g.cs | 24 - .../Number/NumberToSolidAngleExtensions.g.cs | 8 - .../NumberToSpecificEnergyExtensions.g.cs | 64 --- .../NumberToSpecificEntropyExtensions.g.cs | 64 --- .../NumberToSpecificVolumeExtensions.g.cs | 16 - .../NumberToSpecificWeightExtensions.g.cs | 136 ------ .../Number/NumberToSpeedExtensions.g.cs | 256 ----------- ...mberToTemperatureChangeRateExtensions.g.cs | 80 ---- .../NumberToTemperatureDeltaExtensions.g.cs | 128 ------ .../Number/NumberToTemperatureExtensions.g.cs | 64 --- ...NumberToThermalConductivityExtensions.g.cs | 16 - .../NumberToThermalResistanceExtensions.g.cs | 40 -- .../Number/NumberToTorqueExtensions.g.cs | 168 ------- .../Number/NumberToVitaminAExtensions.g.cs | 8 - .../Number/NumberToVolumeExtensions.g.cs | 352 --------------- .../Number/NumberToVolumeFlowExtensions.g.cs | 208 --------- .../Quantities/Acceleration.NetFramework.g.cs | 133 ------ .../AmountOfSubstance.NetFramework.g.cs | 142 ------ .../AmplitudeRatio.NetFramework.g.cs | 52 --- .../Quantities/Angle.NetFramework.g.cs | 142 ------ .../ApparentEnergy.NetFramework.g.cs | 43 -- .../ApparentPower.NetFramework.g.cs | 52 --- .../Quantities/Area.NetFramework.g.cs | 133 ------ .../Quantities/AreaDensity.NetFramework.g.cs | 25 -- .../AreaMomentOfInertia.NetFramework.g.cs | 70 --- .../Quantities/BitRate.NetFramework.g.cs | 250 ----------- ...eSpecificFuelConsumption.NetFramework.g.cs | 43 -- .../Quantities/Capacitance.NetFramework.g.cs | 25 -- .../Quantities/Density.NetFramework.g.cs | 358 --------------- .../Quantities/Duration.NetFramework.g.cs | 124 ------ .../DynamicViscosity.NetFramework.g.cs | 70 --- .../ElectricAdmittance.NetFramework.g.cs | 52 --- .../ElectricCharge.NetFramework.g.cs | 25 -- .../ElectricChargeDensity.NetFramework.g.cs | 25 -- .../ElectricConductance.NetFramework.g.cs | 43 -- .../ElectricConductivity.NetFramework.g.cs | 25 -- .../ElectricCurrent.NetFramework.g.cs | 88 ---- .../ElectricCurrentDensity.NetFramework.g.cs | 25 -- .../ElectricCurrentGradient.NetFramework.g.cs | 25 -- .../ElectricField.NetFramework.g.cs | 25 -- .../ElectricInductance.NetFramework.g.cs | 25 -- .../ElectricPotential.NetFramework.g.cs | 61 --- .../ElectricPotentialAc.NetFramework.g.cs | 61 --- .../ElectricPotentialDc.NetFramework.g.cs | 61 --- .../ElectricResistance.NetFramework.g.cs | 52 --- .../ElectricResistivity.NetFramework.g.cs | 52 --- .../Quantities/Energy.NetFramework.g.cs | 214 --------- .../Quantities/Entropy.NetFramework.g.cs | 79 ---- .../Quantities/Flow.NetFramework.g.cs | 232 ---------- .../Quantities/Force.NetFramework.g.cs | 106 ----- .../ForceChangeRate.NetFramework.g.cs | 115 ----- .../ForcePerLength.NetFramework.g.cs | 97 ----- .../Quantities/Frequency.NetFramework.g.cs | 88 ---- .../Quantities/HeatFlux.NetFramework.g.cs | 160 ------- .../HeatTransferCoefficient.NetFramework.g.cs | 34 -- .../Quantities/Illuminance.NetFramework.g.cs | 52 --- .../Quantities/Information.NetFramework.g.cs | 250 ----------- .../Quantities/Irradiance.NetFramework.g.cs | 34 -- .../Quantities/Irradiation.NetFramework.g.cs | 43 -- .../KinematicViscosity.NetFramework.g.cs | 88 ---- .../Quantities/LapseRate.NetFramework.g.cs | 25 -- .../Quantities/Length.NetFramework.g.cs | 214 --------- .../Quantities/Level.NetFramework.g.cs | 34 -- .../LinearDensity.NetFramework.g.cs | 43 -- .../Quantities/LuminousFlux.NetFramework.g.cs | 25 -- .../LuminousIntensity.NetFramework.g.cs | 25 -- .../MagneticField.NetFramework.g.cs | 25 -- .../Quantities/MagneticFlux.NetFramework.g.cs | 25 -- .../Magnetization.NetFramework.g.cs | 25 -- .../Quantities/Mass.NetFramework.g.cs | 205 --------- .../Quantities/MassFlow.NetFramework.g.cs | 151 ------- .../Quantities/MassFlux.NetFramework.g.cs | 34 -- .../MassMomentOfInertia.NetFramework.g.cs | 250 ----------- .../Quantities/MolarEnergy.NetFramework.g.cs | 43 -- .../Quantities/MolarEntropy.NetFramework.g.cs | 43 -- .../Quantities/MolarMass.NetFramework.g.cs | 124 ------ .../Quantities/Molarity.NetFramework.g.cs | 88 ---- .../Quantities/Permeability.NetFramework.g.cs | 25 -- .../Quantities/Permittivity.NetFramework.g.cs | 25 -- .../Quantities/Power.NetFramework.g.cs | 196 --------- .../Quantities/PowerDensity.NetFramework.g.cs | 412 ------------------ .../Quantities/PowerRatio.NetFramework.g.cs | 34 -- .../Quantities/Pressure.NetFramework.g.cs | 358 --------------- .../PressureChangeRate.NetFramework.g.cs | 52 --- .../Quantities/Ratio.NetFramework.g.cs | 70 --- .../ReactiveEnergy.NetFramework.g.cs | 43 -- .../ReactivePower.NetFramework.g.cs | 52 --- .../RotationalAcceleration.NetFramework.g.cs | 43 -- .../RotationalSpeed.NetFramework.g.cs | 133 ------ .../RotationalStiffness.NetFramework.g.cs | 43 -- ...tionalStiffnessPerLength.NetFramework.g.cs | 43 -- .../Quantities/SolidAngle.NetFramework.g.cs | 25 -- .../SpecificEnergy.NetFramework.g.cs | 88 ---- .../SpecificEntropy.NetFramework.g.cs | 88 ---- .../SpecificVolume.NetFramework.g.cs | 34 -- .../SpecificWeight.NetFramework.g.cs | 169 ------- .../Quantities/Speed.NetFramework.g.cs | 304 ------------- .../Quantities/Temperature.NetFramework.g.cs | 88 ---- .../TemperatureChangeRate.NetFramework.g.cs | 106 ----- .../TemperatureDelta.NetFramework.g.cs | 160 ------- .../ThermalConductivity.NetFramework.g.cs | 34 -- .../ThermalResistance.NetFramework.g.cs | 61 --- .../Quantities/Torque.NetFramework.g.cs | 205 --------- .../Quantities/VitaminA.NetFramework.g.cs | 25 -- .../Quantities/Volume.NetFramework.g.cs | 412 ------------------ .../Quantities/VolumeFlow.NetFramework.g.cs | 250 ----------- ...ude-GenerateNumberExtensionsSourceCode.ps1 | 8 - ...GenerateQuantitySourceCodeNetFramework.ps1 | 28 -- 186 files changed, 15770 deletions(-) delete mode 100644 UnitsNet.Tests/NullableConstructors.cs diff --git a/UnitsNet.Tests/DecimalOverloadTests.cs b/UnitsNet.Tests/DecimalOverloadTests.cs index f19e131a14..3b38d2e36e 100644 --- a/UnitsNet.Tests/DecimalOverloadTests.cs +++ b/UnitsNet.Tests/DecimalOverloadTests.cs @@ -35,23 +35,6 @@ public static void CreatingQuantityWithDoubleBackingFieldFromDecimalReturnsCorre Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableDecimalReturnsCorrectValue() - { - decimal? oneMeterPerSecondSquared = 1m; - Acceleration? acceleration = Acceleration.FromMetersPerSecondSquared(oneMeterPerSecondSquared); - Assert.NotNull(acceleration); - Assert.Equal(1.0, acceleration.Value.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableDecimalReturnsNullWhenGivenNull() - { - decimal? nullDecimal = null; - Acceleration? acceleration = Acceleration.FromMetersPerSecondSquared(nullDecimal); - Assert.Null(acceleration); - } - [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromDecimalWithExtensionMethodReturnsCorrectValue() { @@ -60,23 +43,6 @@ public static void CreatingQuantityWithDoubleBackingFieldFromDecimalWithExtensio Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableDecimalWithExtensionMethodReturnsCorrectValue() - { - decimal? oneMeterPerSecondSquared = 1m; - Acceleration? acceleration = oneMeterPerSecondSquared.MetersPerSecondSquared(); - Assert.NotNull(acceleration); - Assert.Equal(1.0, acceleration.Value.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableDecimalWithExtensionMethodReturnsNullWhenGivenNull() - { - decimal? nullDecimal = null; - Acceleration? acceleration = nullDecimal.MetersPerSecondSquared(); - Assert.Null(acceleration); - } - [Fact] public static void CreatingQuantityWithDecimalBackingFieldFromDecimalReturnsCorrectValue() { @@ -85,23 +51,6 @@ public static void CreatingQuantityWithDecimalBackingFieldFromDecimalReturnsCorr Assert.Equal(1.0, power.Watts); } - [Fact] - public static void CreatingQuantityWithDecimalBackingFieldFromNullableDecimalReturnsCorrectValue() - { - decimal? oneWatt = 1m; - Power? power = Power.FromWatts(oneWatt); - Assert.NotNull(power); - Assert.Equal(1.0, power.Value.Watts); - } - - [Fact] - public static void CreatingQuantityWithDecimalBackingFieldFromNullableDecimalReturnsNullWhenGivenNull() - { - decimal? nullDecimal = null; - Power? power = Power.FromWatts(nullDecimal); - Assert.Null(power); - } - [Fact] public static void CreatingQuantityWithDecimalBackingFieldFromDecimalWithExtensionMethodReturnsCorrectValue() { @@ -109,22 +58,5 @@ public static void CreatingQuantityWithDecimalBackingFieldFromDecimalWithExtensi Power power = oneWatt.Watts(); Assert.Equal(1.0, power.Watts); } - - [Fact] - public static void CreatingQuantityWithDecimalBackingFieldFromNullableDecimalWithExtensionMethodReturnsCorrectValue() - { - decimal? oneWatt = 1m; - Power? power = oneWatt.Watts(); - Assert.NotNull(power); - Assert.Equal(1.0, power.Value.Watts); - } - - [Fact] - public static void CreatingQuantityWithDecimalBackingFieldFromNullableDecimalWithExtensionMethodReturnsNullWhenGivenNull() - { - decimal? nullDecimal = null; - Power? power = nullDecimal.Watts(); - Assert.Null(power); - } } } diff --git a/UnitsNet.Tests/IntOverloadTests.cs b/UnitsNet.Tests/IntOverloadTests.cs index 3a762ecb54..1ffc8c75fa 100644 --- a/UnitsNet.Tests/IntOverloadTests.cs +++ b/UnitsNet.Tests/IntOverloadTests.cs @@ -35,23 +35,6 @@ public static void CreatingQuantityWithDoubleBackingFieldFromIntReturnsCorrectVa Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableIntReturnsCorrectValue() - { - int? oneMeterPerSecondSquared = 1; - Acceleration? acceleration = Acceleration.FromMetersPerSecondSquared(oneMeterPerSecondSquared); - Assert.NotNull(acceleration); - Assert.Equal(1.0, acceleration.Value.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableIntReturnsNullWhenGivenNull() - { - int? nullInt = null; - Acceleration? acceleration = Acceleration.FromMetersPerSecondSquared(nullInt); - Assert.Null(acceleration); - } - [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromIntWithExtensionMethodReturnsCorrectValue() { @@ -60,23 +43,6 @@ public static void CreatingQuantityWithDoubleBackingFieldFromIntWithExtensionMet Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableIntWithExtensionMethodReturnsCorrectValue() - { - int? oneMeterPerSecondSquared = 1; - Acceleration? acceleration = oneMeterPerSecondSquared.MetersPerSecondSquared(); - Assert.NotNull(acceleration); - Assert.Equal(1.0, acceleration.Value.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableIntWithExtensionMethodReturnsNullWhenGivenNull() - { - int? nullInt = null; - Acceleration? acceleration = nullInt.MetersPerSecondSquared(); - Assert.Null(acceleration); - } - [Fact] public static void CreatingQuantityWithIntBackingFieldFromIntReturnsCorrectValue() { @@ -85,23 +51,6 @@ public static void CreatingQuantityWithIntBackingFieldFromIntReturnsCorrectValue Assert.Equal(1.0, power.Watts); } - [Fact] - public static void CreatingQuantityWithIntBackingFieldFromNullableIntReturnsCorrectValue() - { - int? oneWatt = 1; - Power? power = Power.FromWatts(oneWatt); - Assert.NotNull(power); - Assert.Equal(1.0, power.Value.Watts); - } - - [Fact] - public static void CreatingQuantityWithIntBackingFieldFromNullableIntReturnsNullWhenGivenNull() - { - int? nullInt = null; - Power? power = Power.FromWatts(nullInt); - Assert.Null(power); - } - [Fact] public static void CreatingQuantityWithIntBackingFieldFromIntWithExtensionMethodReturnsCorrectValue() { @@ -109,22 +58,5 @@ public static void CreatingQuantityWithIntBackingFieldFromIntWithExtensionMethod Power power = oneWatt.Watts(); Assert.Equal(1.0, power.Watts); } - - [Fact] - public static void CreatingQuantityWithIntBackingFieldFromNullableIntWithExtensionMethodReturnsCorrectValue() - { - int? oneWatt = 1; - Power? power = oneWatt.Watts(); - Assert.NotNull(power); - Assert.Equal(1.0, power.Value.Watts); - } - - [Fact] - public static void CreatingQuantityWithIntBackingFieldFromNullableIntWithExtensionMethodReturnsNullWhenGivenNull() - { - int? nullInt = null; - Power? power = nullInt.Watts(); - Assert.Null(power); - } } } diff --git a/UnitsNet.Tests/LongOverloadTests.cs b/UnitsNet.Tests/LongOverloadTests.cs index d64ee9fa03..97851720bf 100644 --- a/UnitsNet.Tests/LongOverloadTests.cs +++ b/UnitsNet.Tests/LongOverloadTests.cs @@ -35,23 +35,6 @@ public static void CreatingQuantityWithDoubleBackingFieldFromLongReturnsCorrectV Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableLongReturnsCorrectValue() - { - long? oneMeterPerSecondSquared = 1; - Acceleration? acceleration = Acceleration.FromMetersPerSecondSquared(oneMeterPerSecondSquared); - Assert.NotNull(acceleration); - Assert.Equal(1.0, acceleration.Value.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableLongReturnsNullWhenGivenNull() - { - long? nullLong = null; - Acceleration? acceleration = Acceleration.FromMetersPerSecondSquared(nullLong); - Assert.Null(acceleration); - } - [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromLongWithExtensionMethodReturnsCorrectValue() { @@ -60,23 +43,6 @@ public static void CreatingQuantityWithDoubleBackingFieldFromLongWithExtensionMe Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableLongWithExtensionMethodReturnsCorrectValue() - { - long? oneMeterPerSecondSquared = 1; - Acceleration? acceleration = oneMeterPerSecondSquared.MetersPerSecondSquared(); - Assert.NotNull(acceleration); - Assert.Equal(1.0, acceleration.Value.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromNullableLongWithExtensionMethodReturnsNullWhenGivenNull() - { - long? nullLong = null; - Acceleration? acceleration = nullLong.MetersPerSecondSquared(); - Assert.Null(acceleration); - } - [Fact] public static void CreatingQuantityWithLongBackingFieldFromLongReturnsCorrectValue() { @@ -85,23 +51,6 @@ public static void CreatingQuantityWithLongBackingFieldFromLongReturnsCorrectVal Assert.Equal(1.0, power.Watts); } - [Fact] - public static void CreatingQuantityWithLongBackingFieldFromNullableLongReturnsCorrectValue() - { - long? oneWatt = 1; - Power? power = Power.FromWatts(oneWatt); - Assert.NotNull(power); - Assert.Equal(1.0, power.Value.Watts); - } - - [Fact] - public static void CreatingQuantityWithLongBackingFieldFromNullableLongReturnsNullWhenGivenNull() - { - long? nullLong = null; - Power? power = Power.FromWatts(nullLong); - Assert.Null(power); - } - [Fact] public static void CreatingQuantityWithLongBackingFieldFromLongWithExtensionMethodReturnsCorrectValue() { @@ -109,22 +58,5 @@ public static void CreatingQuantityWithLongBackingFieldFromLongWithExtensionMeth Power power = oneWatt.Watts(); Assert.Equal(1.0, power.Watts); } - - [Fact] - public static void CreatingQuantityWithLongBackingFieldFromNullableLongWithExtensionMethodReturnsCorrectValue() - { - long? oneWatt = 1; - Power? power = oneWatt.Watts(); - Assert.NotNull(power); - Assert.Equal(1.0, power.Value.Watts); - } - - [Fact] - public static void CreatingQuantityWithLongBackingFieldFromNullableLongWithExtensionMethodReturnsNullWhenGivenNull() - { - long? nullLong = null; - Power? power = nullLong.Watts(); - Assert.Null(power); - } } } diff --git a/UnitsNet.Tests/NullableConstructors.cs b/UnitsNet.Tests/NullableConstructors.cs deleted file mode 100644 index 1322b96956..0000000000 --- a/UnitsNet.Tests/NullableConstructors.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using Xunit; -using UnitsNet.Units; - -namespace UnitsNet.Tests -{ - public class NullableConstructors - { - [Fact] - public void StaticConstructorWithNullReturnsNullWhenBackingTypeIsDouble() - { - Length? meter = Length.FromMeters(null); - Assert.False(meter.HasValue); - } - - [Fact] - public void StaticConstructorWithNullAndEnumReturnsNullWhenBackingTypeIsDouble() - { - Length? meter = Length.From(null, LengthUnit.Meter); - Assert.False(meter.HasValue); - } - - [Fact] - public void StaticConstructorWithNullAndEnumArgumentReturnsValueWhenInputArgumentHasValueWhenBackingTypeIsDouble() - { - double? value = 1.0; - Length? meter = Length.From(value, LengthUnit.Meter); - Assert.True(meter.HasValue); - } - - [Fact] - public void StaticConstructorWithNullArgumentReturnsValueWhenInputArgumentHasValueWhenBackingTypeIsDouble() - { - double? value = 1.0; - Length? meter = Length.FromMeters(value); - Assert.True(meter.HasValue); - } - - [Fact] - public void StaticConstructorWithNullReturnsNullWhenBackingTypeIsDecimal() - { - Information? meter = Information.FromBytes(null); - Assert.False(meter.HasValue); - } - - [Fact] - public void StaticConstructorWithNullAndEnumReturnsNullWhenBackingTypeIsDecimal() - { - Information? meter = Information.From(null, InformationUnit.Byte); - Assert.False(meter.HasValue); - } - - [Fact] - public void StaticConstructorWithNullAndEnumArgumentReturnsValueWhenInputArgumentHasValueWhenBackingTypeIsDecimal() - { - double? value = 1.0; - Information? meter = Information.From(value, InformationUnit.Byte); - Assert.True(meter.HasValue); - } - - [Fact] - public void StaticConstructorWithNullArgumentReturnsValueWhenInputArgumentHasValueWhenBackingTypeIsDecimal() - { - double? value = 1.0; - Information? meter = Information.FromBytes(value); - Assert.True(meter.HasValue); - } - } -} \ No newline at end of file diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs index 9fc9b9cc5b..7cede6880d 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs @@ -44,149 +44,45 @@ namespace UnitsNet.Extensions.NumberToAcceleration { public static class NumberToAccelerationExtensions { - #region CentimeterPerSecondSquared - /// public static Acceleration CentimetersPerSecondSquared(this T value) => Acceleration.FromCentimetersPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? CentimetersPerSecondSquared(this T? value) where T : struct => Acceleration.FromCentimetersPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecimeterPerSecondSquared - /// public static Acceleration DecimetersPerSecondSquared(this T value) => Acceleration.FromDecimetersPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? DecimetersPerSecondSquared(this T? value) where T : struct => Acceleration.FromDecimetersPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region FootPerSecondSquared - /// public static Acceleration FeetPerSecondSquared(this T value) => Acceleration.FromFeetPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? FeetPerSecondSquared(this T? value) where T : struct => Acceleration.FromFeetPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region InchPerSecondSquared - /// public static Acceleration InchesPerSecondSquared(this T value) => Acceleration.FromInchesPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? InchesPerSecondSquared(this T? value) where T : struct => Acceleration.FromInchesPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilometerPerSecondSquared - /// public static Acceleration KilometersPerSecondSquared(this T value) => Acceleration.FromKilometersPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? KilometersPerSecondSquared(this T? value) where T : struct => Acceleration.FromKilometersPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KnotPerHour - /// public static Acceleration KnotsPerHour(this T value) => Acceleration.FromKnotsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? KnotsPerHour(this T? value) where T : struct => Acceleration.FromKnotsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KnotPerMinute - /// public static Acceleration KnotsPerMinute(this T value) => Acceleration.FromKnotsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? KnotsPerMinute(this T? value) where T : struct => Acceleration.FromKnotsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KnotPerSecond - /// public static Acceleration KnotsPerSecond(this T value) => Acceleration.FromKnotsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? KnotsPerSecond(this T? value) where T : struct => Acceleration.FromKnotsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeterPerSecondSquared - /// public static Acceleration MetersPerSecondSquared(this T value) => Acceleration.FromMetersPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? MetersPerSecondSquared(this T? value) where T : struct => Acceleration.FromMetersPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrometerPerSecondSquared - /// public static Acceleration MicrometersPerSecondSquared(this T value) => Acceleration.FromMicrometersPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? MicrometersPerSecondSquared(this T? value) where T : struct => Acceleration.FromMicrometersPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillimeterPerSecondSquared - /// public static Acceleration MillimetersPerSecondSquared(this T value) => Acceleration.FromMillimetersPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? MillimetersPerSecondSquared(this T? value) where T : struct => Acceleration.FromMillimetersPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanometerPerSecondSquared - /// public static Acceleration NanometersPerSecondSquared(this T value) => Acceleration.FromNanometersPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? NanometersPerSecondSquared(this T? value) where T : struct => Acceleration.FromNanometersPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region StandardGravity - /// public static Acceleration StandardGravity(this T value) => Acceleration.FromStandardGravity(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? StandardGravity(this T? value) where T : struct => Acceleration.FromStandardGravity(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs index f51cf4316b..8a00acba39 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs @@ -44,160 +44,48 @@ namespace UnitsNet.Extensions.NumberToAmountOfSubstance { public static class NumberToAmountOfSubstanceExtensions { - #region Centimole - /// public static AmountOfSubstance Centimoles(this T value) => AmountOfSubstance.FromCentimoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? Centimoles(this T? value) where T : struct => AmountOfSubstance.FromCentimoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CentipoundMole - /// public static AmountOfSubstance CentipoundMoles(this T value) => AmountOfSubstance.FromCentipoundMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? CentipoundMoles(this T? value) where T : struct => AmountOfSubstance.FromCentipoundMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decimole - /// public static AmountOfSubstance Decimoles(this T value) => AmountOfSubstance.FromDecimoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? Decimoles(this T? value) where T : struct => AmountOfSubstance.FromDecimoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecipoundMole - /// public static AmountOfSubstance DecipoundMoles(this T value) => AmountOfSubstance.FromDecipoundMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? DecipoundMoles(this T? value) where T : struct => AmountOfSubstance.FromDecipoundMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilomole - /// public static AmountOfSubstance Kilomoles(this T value) => AmountOfSubstance.FromKilomoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? Kilomoles(this T? value) where T : struct => AmountOfSubstance.FromKilomoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundMole - /// public static AmountOfSubstance KilopoundMoles(this T value) => AmountOfSubstance.FromKilopoundMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? KilopoundMoles(this T? value) where T : struct => AmountOfSubstance.FromKilopoundMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Micromole - /// public static AmountOfSubstance Micromoles(this T value) => AmountOfSubstance.FromMicromoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? Micromoles(this T? value) where T : struct => AmountOfSubstance.FromMicromoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicropoundMole - /// public static AmountOfSubstance MicropoundMoles(this T value) => AmountOfSubstance.FromMicropoundMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? MicropoundMoles(this T? value) where T : struct => AmountOfSubstance.FromMicropoundMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millimole - /// public static AmountOfSubstance Millimoles(this T value) => AmountOfSubstance.FromMillimoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? Millimoles(this T? value) where T : struct => AmountOfSubstance.FromMillimoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillipoundMole - /// public static AmountOfSubstance MillipoundMoles(this T value) => AmountOfSubstance.FromMillipoundMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? MillipoundMoles(this T? value) where T : struct => AmountOfSubstance.FromMillipoundMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Mole - /// public static AmountOfSubstance Moles(this T value) => AmountOfSubstance.FromMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? Moles(this T? value) where T : struct => AmountOfSubstance.FromMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanomole - /// public static AmountOfSubstance Nanomoles(this T value) => AmountOfSubstance.FromNanomoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? Nanomoles(this T? value) where T : struct => AmountOfSubstance.FromNanomoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanopoundMole - /// public static AmountOfSubstance NanopoundMoles(this T value) => AmountOfSubstance.FromNanopoundMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? NanopoundMoles(this T? value) where T : struct => AmountOfSubstance.FromNanopoundMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundMole - /// public static AmountOfSubstance PoundMoles(this T value) => AmountOfSubstance.FromPoundMoles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? PoundMoles(this T? value) where T : struct => AmountOfSubstance.FromPoundMoles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs index c65efd7352..7b6ccbc891 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToAmplitudeRatio { public static class NumberToAmplitudeRatioExtensions { - #region DecibelMicrovolt - /// public static AmplitudeRatio DecibelMicrovolts(this T value) => AmplitudeRatio.FromDecibelMicrovolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmplitudeRatio? DecibelMicrovolts(this T? value) where T : struct => AmplitudeRatio.FromDecibelMicrovolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecibelMillivolt - /// public static AmplitudeRatio DecibelMillivolts(this T value) => AmplitudeRatio.FromDecibelMillivolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmplitudeRatio? DecibelMillivolts(this T? value) where T : struct => AmplitudeRatio.FromDecibelMillivolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecibelUnloaded - /// public static AmplitudeRatio DecibelsUnloaded(this T value) => AmplitudeRatio.FromDecibelsUnloaded(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmplitudeRatio? DecibelsUnloaded(this T? value) where T : struct => AmplitudeRatio.FromDecibelsUnloaded(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecibelVolt - /// public static AmplitudeRatio DecibelVolts(this T value) => AmplitudeRatio.FromDecibelVolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmplitudeRatio? DecibelVolts(this T? value) where T : struct => AmplitudeRatio.FromDecibelVolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs index 7a6a5ef36a..0b34dcbc7f 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs @@ -44,160 +44,48 @@ namespace UnitsNet.Extensions.NumberToAngle { public static class NumberToAngleExtensions { - #region Arcminute - /// public static Angle Arcminutes(this T value) => Angle.FromArcminutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Arcminutes(this T? value) where T : struct => Angle.FromArcminutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Arcsecond - /// public static Angle Arcseconds(this T value) => Angle.FromArcseconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Arcseconds(this T? value) where T : struct => Angle.FromArcseconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Centiradian - /// public static Angle Centiradians(this T value) => Angle.FromCentiradians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Centiradians(this T? value) where T : struct => Angle.FromCentiradians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Deciradian - /// public static Angle Deciradians(this T value) => Angle.FromDeciradians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Deciradians(this T? value) where T : struct => Angle.FromDeciradians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Degree - /// public static Angle Degrees(this T value) => Angle.FromDegrees(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Degrees(this T? value) where T : struct => Angle.FromDegrees(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gradian - /// public static Angle Gradians(this T value) => Angle.FromGradians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Gradians(this T? value) where T : struct => Angle.FromGradians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microdegree - /// public static Angle Microdegrees(this T value) => Angle.FromMicrodegrees(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Microdegrees(this T? value) where T : struct => Angle.FromMicrodegrees(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microradian - /// public static Angle Microradians(this T value) => Angle.FromMicroradians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Microradians(this T? value) where T : struct => Angle.FromMicroradians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millidegree - /// public static Angle Millidegrees(this T value) => Angle.FromMillidegrees(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Millidegrees(this T? value) where T : struct => Angle.FromMillidegrees(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Milliradian - /// public static Angle Milliradians(this T value) => Angle.FromMilliradians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Milliradians(this T? value) where T : struct => Angle.FromMilliradians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanodegree - /// public static Angle Nanodegrees(this T value) => Angle.FromNanodegrees(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Nanodegrees(this T? value) where T : struct => Angle.FromNanodegrees(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanoradian - /// public static Angle Nanoradians(this T value) => Angle.FromNanoradians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Nanoradians(this T? value) where T : struct => Angle.FromNanoradians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Radian - /// public static Angle Radians(this T value) => Angle.FromRadians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Radians(this T? value) where T : struct => Angle.FromRadians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Revolution - /// public static Angle Revolutions(this T value) => Angle.FromRevolutions(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? Revolutions(this T? value) where T : struct => Angle.FromRevolutions(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs index b6ff726836..0c007ff083 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToApparentEnergy { public static class NumberToApparentEnergyExtensions { - #region KilovoltampereHour - /// public static ApparentEnergy KilovoltampereHours(this T value) => ApparentEnergy.FromKilovoltampereHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentEnergy? KilovoltampereHours(this T? value) where T : struct => ApparentEnergy.FromKilovoltampereHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegavoltampereHour - /// public static ApparentEnergy MegavoltampereHours(this T value) => ApparentEnergy.FromMegavoltampereHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentEnergy? MegavoltampereHours(this T? value) where T : struct => ApparentEnergy.FromMegavoltampereHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region VoltampereHour - /// public static ApparentEnergy VoltampereHours(this T value) => ApparentEnergy.FromVoltampereHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentEnergy? VoltampereHours(this T? value) where T : struct => ApparentEnergy.FromVoltampereHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs index ad97cdc78e..17f85155fd 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToApparentPower { public static class NumberToApparentPowerExtensions { - #region Gigavoltampere - /// public static ApparentPower Gigavoltamperes(this T value) => ApparentPower.FromGigavoltamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentPower? Gigavoltamperes(this T? value) where T : struct => ApparentPower.FromGigavoltamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilovoltampere - /// public static ApparentPower Kilovoltamperes(this T value) => ApparentPower.FromKilovoltamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentPower? Kilovoltamperes(this T? value) where T : struct => ApparentPower.FromKilovoltamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megavoltampere - /// public static ApparentPower Megavoltamperes(this T value) => ApparentPower.FromMegavoltamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentPower? Megavoltamperes(this T? value) where T : struct => ApparentPower.FromMegavoltamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Voltampere - /// public static ApparentPower Voltamperes(this T value) => ApparentPower.FromVoltamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentPower? Voltamperes(this T? value) where T : struct => ApparentPower.FromVoltamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs index c91ee1b15d..6a67802f24 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToAreaDensity { public static class NumberToAreaDensityExtensions { - #region KilogramPerSquareMeter - /// public static AreaDensity KilogramsPerSquareMeter(this T value) => AreaDensity.FromKilogramsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaDensity? KilogramsPerSquareMeter(this T? value) where T : struct => AreaDensity.FromKilogramsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs index f9efe3d5f6..aa22221e89 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs @@ -44,149 +44,45 @@ namespace UnitsNet.Extensions.NumberToArea { public static class NumberToAreaExtensions { - #region Acre - /// public static Area Acres(this T value) => Area.FromAcres(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? Acres(this T? value) where T : struct => Area.FromAcres(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Hectare - /// public static Area Hectares(this T value) => Area.FromHectares(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? Hectares(this T? value) where T : struct => Area.FromHectares(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareCentimeter - /// public static Area SquareCentimeters(this T value) => Area.FromSquareCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareCentimeters(this T? value) where T : struct => Area.FromSquareCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareDecimeter - /// public static Area SquareDecimeters(this T value) => Area.FromSquareDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareDecimeters(this T? value) where T : struct => Area.FromSquareDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareFoot - /// public static Area SquareFeet(this T value) => Area.FromSquareFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareFeet(this T? value) where T : struct => Area.FromSquareFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareInch - /// public static Area SquareInches(this T value) => Area.FromSquareInches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareInches(this T? value) where T : struct => Area.FromSquareInches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareKilometer - /// public static Area SquareKilometers(this T value) => Area.FromSquareKilometers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareKilometers(this T? value) where T : struct => Area.FromSquareKilometers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareMeter - /// public static Area SquareMeters(this T value) => Area.FromSquareMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareMeters(this T? value) where T : struct => Area.FromSquareMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareMicrometer - /// public static Area SquareMicrometers(this T value) => Area.FromSquareMicrometers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareMicrometers(this T? value) where T : struct => Area.FromSquareMicrometers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareMile - /// public static Area SquareMiles(this T value) => Area.FromSquareMiles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareMiles(this T? value) where T : struct => Area.FromSquareMiles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareMillimeter - /// public static Area SquareMillimeters(this T value) => Area.FromSquareMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareMillimeters(this T? value) where T : struct => Area.FromSquareMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareYard - /// public static Area SquareYards(this T value) => Area.FromSquareYards(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? SquareYards(this T? value) where T : struct => Area.FromSquareYards(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsSurveySquareFoot - /// public static Area UsSurveySquareFeet(this T value) => Area.FromUsSurveySquareFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? UsSurveySquareFeet(this T? value) where T : struct => Area.FromUsSurveySquareFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs index e9a5af6b3f..1917cf1a82 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs @@ -44,72 +44,24 @@ namespace UnitsNet.Extensions.NumberToAreaMomentOfInertia { public static class NumberToAreaMomentOfInertiaExtensions { - #region CentimeterToTheFourth - /// public static AreaMomentOfInertia CentimetersToTheFourth(this T value) => AreaMomentOfInertia.FromCentimetersToTheFourth(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaMomentOfInertia? CentimetersToTheFourth(this T? value) where T : struct => AreaMomentOfInertia.FromCentimetersToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecimeterToTheFourth - /// public static AreaMomentOfInertia DecimetersToTheFourth(this T value) => AreaMomentOfInertia.FromDecimetersToTheFourth(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaMomentOfInertia? DecimetersToTheFourth(this T? value) where T : struct => AreaMomentOfInertia.FromDecimetersToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region FootToTheFourth - /// public static AreaMomentOfInertia FeetToTheFourth(this T value) => AreaMomentOfInertia.FromFeetToTheFourth(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaMomentOfInertia? FeetToTheFourth(this T? value) where T : struct => AreaMomentOfInertia.FromFeetToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region InchToTheFourth - /// public static AreaMomentOfInertia InchesToTheFourth(this T value) => AreaMomentOfInertia.FromInchesToTheFourth(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaMomentOfInertia? InchesToTheFourth(this T? value) where T : struct => AreaMomentOfInertia.FromInchesToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeterToTheFourth - /// public static AreaMomentOfInertia MetersToTheFourth(this T value) => AreaMomentOfInertia.FromMetersToTheFourth(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaMomentOfInertia? MetersToTheFourth(this T? value) where T : struct => AreaMomentOfInertia.FromMetersToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillimeterToTheFourth - /// public static AreaMomentOfInertia MillimetersToTheFourth(this T value) => AreaMomentOfInertia.FromMillimetersToTheFourth(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaMomentOfInertia? MillimetersToTheFourth(this T? value) where T : struct => AreaMomentOfInertia.FromMillimetersToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs index 4efef3834b..83969b3527 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs @@ -44,292 +44,84 @@ namespace UnitsNet.Extensions.NumberToBitRate { public static class NumberToBitRateExtensions { - #region BitPerSecond - /// public static BitRate BitsPerSecond(this T value) => BitRate.FromBitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? BitsPerSecond(this T? value) where T : struct => BitRate.FromBitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region BytePerSecond - /// public static BitRate BytesPerSecond(this T value) => BitRate.FromBytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? BytesPerSecond(this T? value) where T : struct => BitRate.FromBytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ExabitPerSecond - /// public static BitRate ExabitsPerSecond(this T value) => BitRate.FromExabitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? ExabitsPerSecond(this T? value) where T : struct => BitRate.FromExabitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ExabytePerSecond - /// public static BitRate ExabytesPerSecond(this T value) => BitRate.FromExabytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? ExabytesPerSecond(this T? value) where T : struct => BitRate.FromExabytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ExbibitPerSecond - /// public static BitRate ExbibitsPerSecond(this T value) => BitRate.FromExbibitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? ExbibitsPerSecond(this T? value) where T : struct => BitRate.FromExbibitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ExbibytePerSecond - /// public static BitRate ExbibytesPerSecond(this T value) => BitRate.FromExbibytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? ExbibytesPerSecond(this T? value) where T : struct => BitRate.FromExbibytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GibibitPerSecond - /// public static BitRate GibibitsPerSecond(this T value) => BitRate.FromGibibitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? GibibitsPerSecond(this T? value) where T : struct => BitRate.FromGibibitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GibibytePerSecond - /// public static BitRate GibibytesPerSecond(this T value) => BitRate.FromGibibytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? GibibytesPerSecond(this T? value) where T : struct => BitRate.FromGibibytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigabitPerSecond - /// public static BitRate GigabitsPerSecond(this T value) => BitRate.FromGigabitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? GigabitsPerSecond(this T? value) where T : struct => BitRate.FromGigabitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigabytePerSecond - /// public static BitRate GigabytesPerSecond(this T value) => BitRate.FromGigabytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? GigabytesPerSecond(this T? value) where T : struct => BitRate.FromGigabytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KibibitPerSecond - /// public static BitRate KibibitsPerSecond(this T value) => BitRate.FromKibibitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? KibibitsPerSecond(this T? value) where T : struct => BitRate.FromKibibitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KibibytePerSecond - /// public static BitRate KibibytesPerSecond(this T value) => BitRate.FromKibibytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? KibibytesPerSecond(this T? value) where T : struct => BitRate.FromKibibytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilobitPerSecond - /// public static BitRate KilobitsPerSecond(this T value) => BitRate.FromKilobitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? KilobitsPerSecond(this T? value) where T : struct => BitRate.FromKilobitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilobytePerSecond - /// public static BitRate KilobytesPerSecond(this T value) => BitRate.FromKilobytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? KilobytesPerSecond(this T? value) where T : struct => BitRate.FromKilobytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MebibitPerSecond - /// public static BitRate MebibitsPerSecond(this T value) => BitRate.FromMebibitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? MebibitsPerSecond(this T? value) where T : struct => BitRate.FromMebibitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MebibytePerSecond - /// public static BitRate MebibytesPerSecond(this T value) => BitRate.FromMebibytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? MebibytesPerSecond(this T? value) where T : struct => BitRate.FromMebibytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegabitPerSecond - /// public static BitRate MegabitsPerSecond(this T value) => BitRate.FromMegabitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? MegabitsPerSecond(this T? value) where T : struct => BitRate.FromMegabitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegabytePerSecond - /// public static BitRate MegabytesPerSecond(this T value) => BitRate.FromMegabytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? MegabytesPerSecond(this T? value) where T : struct => BitRate.FromMegabytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PebibitPerSecond - /// public static BitRate PebibitsPerSecond(this T value) => BitRate.FromPebibitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? PebibitsPerSecond(this T? value) where T : struct => BitRate.FromPebibitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PebibytePerSecond - /// public static BitRate PebibytesPerSecond(this T value) => BitRate.FromPebibytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? PebibytesPerSecond(this T? value) where T : struct => BitRate.FromPebibytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PetabitPerSecond - /// public static BitRate PetabitsPerSecond(this T value) => BitRate.FromPetabitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? PetabitsPerSecond(this T? value) where T : struct => BitRate.FromPetabitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PetabytePerSecond - /// public static BitRate PetabytesPerSecond(this T value) => BitRate.FromPetabytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? PetabytesPerSecond(this T? value) where T : struct => BitRate.FromPetabytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TebibitPerSecond - /// public static BitRate TebibitsPerSecond(this T value) => BitRate.FromTebibitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? TebibitsPerSecond(this T? value) where T : struct => BitRate.FromTebibitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TebibytePerSecond - /// public static BitRate TebibytesPerSecond(this T value) => BitRate.FromTebibytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? TebibytesPerSecond(this T? value) where T : struct => BitRate.FromTebibytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TerabitPerSecond - /// public static BitRate TerabitsPerSecond(this T value) => BitRate.FromTerabitsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? TerabitsPerSecond(this T? value) where T : struct => BitRate.FromTerabitsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TerabytePerSecond - /// public static BitRate TerabytesPerSecond(this T value) => BitRate.FromTerabytesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? TerabytesPerSecond(this T? value) where T : struct => BitRate.FromTerabytesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs index 1342e04e53..209e93833b 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToBrakeSpecificFuelConsumption { public static class NumberToBrakeSpecificFuelConsumptionExtensions { - #region GramPerKiloWattHour - /// public static BrakeSpecificFuelConsumption GramsPerKiloWattHour(this T value) => BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BrakeSpecificFuelConsumption? GramsPerKiloWattHour(this T? value) where T : struct => BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerJoule - /// public static BrakeSpecificFuelConsumption KilogramsPerJoule(this T value) => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BrakeSpecificFuelConsumption? KilogramsPerJoule(this T? value) where T : struct => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerMechanicalHorsepowerHour - /// public static BrakeSpecificFuelConsumption PoundsPerMechanicalHorsepowerHour(this T value) => BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BrakeSpecificFuelConsumption? PoundsPerMechanicalHorsepowerHour(this T? value) where T : struct => BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs index 0ec974e4ae..7c4f20237f 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToCapacitance { public static class NumberToCapacitanceExtensions { - #region Farad - /// public static Capacitance Farads(this T value) => Capacitance.FromFarads(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Capacitance? Farads(this T? value) where T : struct => Capacitance.FromFarads(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs index ea7699b6a7..ebcbefd1ac 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs @@ -44,424 +44,120 @@ namespace UnitsNet.Extensions.NumberToDensity { public static class NumberToDensityExtensions { - #region CentigramPerDeciliter - /// public static Density CentigramsPerDeciLiter(this T value) => Density.FromCentigramsPerDeciLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? CentigramsPerDeciLiter(this T? value) where T : struct => Density.FromCentigramsPerDeciLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CentigramPerLiter - /// public static Density CentigramsPerLiter(this T value) => Density.FromCentigramsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? CentigramsPerLiter(this T? value) where T : struct => Density.FromCentigramsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CentigramPerMilliliter - /// public static Density CentigramsPerMilliliter(this T value) => Density.FromCentigramsPerMilliliter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? CentigramsPerMilliliter(this T? value) where T : struct => Density.FromCentigramsPerMilliliter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecigramPerDeciliter - /// public static Density DecigramsPerDeciLiter(this T value) => Density.FromDecigramsPerDeciLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? DecigramsPerDeciLiter(this T? value) where T : struct => Density.FromDecigramsPerDeciLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecigramPerLiter - /// public static Density DecigramsPerLiter(this T value) => Density.FromDecigramsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? DecigramsPerLiter(this T? value) where T : struct => Density.FromDecigramsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecigramPerMilliliter - /// public static Density DecigramsPerMilliliter(this T value) => Density.FromDecigramsPerMilliliter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? DecigramsPerMilliliter(this T? value) where T : struct => Density.FromDecigramsPerMilliliter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerCubicCentimeter - /// public static Density GramsPerCubicCentimeter(this T value) => Density.FromGramsPerCubicCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? GramsPerCubicCentimeter(this T? value) where T : struct => Density.FromGramsPerCubicCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerCubicMeter - /// public static Density GramsPerCubicMeter(this T value) => Density.FromGramsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? GramsPerCubicMeter(this T? value) where T : struct => Density.FromGramsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerCubicMillimeter - /// public static Density GramsPerCubicMillimeter(this T value) => Density.FromGramsPerCubicMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? GramsPerCubicMillimeter(this T? value) where T : struct => Density.FromGramsPerCubicMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerDeciliter - /// public static Density GramsPerDeciLiter(this T value) => Density.FromGramsPerDeciLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? GramsPerDeciLiter(this T? value) where T : struct => Density.FromGramsPerDeciLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerLiter - /// public static Density GramsPerLiter(this T value) => Density.FromGramsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? GramsPerLiter(this T? value) where T : struct => Density.FromGramsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerMilliliter - /// public static Density GramsPerMilliliter(this T value) => Density.FromGramsPerMilliliter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? GramsPerMilliliter(this T? value) where T : struct => Density.FromGramsPerMilliliter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerCubicCentimeter - /// public static Density KilogramsPerCubicCentimeter(this T value) => Density.FromKilogramsPerCubicCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? KilogramsPerCubicCentimeter(this T? value) where T : struct => Density.FromKilogramsPerCubicCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerCubicMeter - /// public static Density KilogramsPerCubicMeter(this T value) => Density.FromKilogramsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? KilogramsPerCubicMeter(this T? value) where T : struct => Density.FromKilogramsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerCubicMillimeter - /// public static Density KilogramsPerCubicMillimeter(this T value) => Density.FromKilogramsPerCubicMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? KilogramsPerCubicMillimeter(this T? value) where T : struct => Density.FromKilogramsPerCubicMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundPerCubicFoot - /// public static Density KilopoundsPerCubicFoot(this T value) => Density.FromKilopoundsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? KilopoundsPerCubicFoot(this T? value) where T : struct => Density.FromKilopoundsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundPerCubicInch - /// public static Density KilopoundsPerCubicInch(this T value) => Density.FromKilopoundsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? KilopoundsPerCubicInch(this T? value) where T : struct => Density.FromKilopoundsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrogramPerDeciliter - /// public static Density MicrogramsPerDeciLiter(this T value) => Density.FromMicrogramsPerDeciLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? MicrogramsPerDeciLiter(this T? value) where T : struct => Density.FromMicrogramsPerDeciLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrogramPerLiter - /// public static Density MicrogramsPerLiter(this T value) => Density.FromMicrogramsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? MicrogramsPerLiter(this T? value) where T : struct => Density.FromMicrogramsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrogramPerMilliliter - /// public static Density MicrogramsPerMilliliter(this T value) => Density.FromMicrogramsPerMilliliter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? MicrogramsPerMilliliter(this T? value) where T : struct => Density.FromMicrogramsPerMilliliter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramPerCubicMeter - /// public static Density MilligramsPerCubicMeter(this T value) => Density.FromMilligramsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? MilligramsPerCubicMeter(this T? value) where T : struct => Density.FromMilligramsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramPerDeciliter - /// public static Density MilligramsPerDeciLiter(this T value) => Density.FromMilligramsPerDeciLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? MilligramsPerDeciLiter(this T? value) where T : struct => Density.FromMilligramsPerDeciLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramPerLiter - /// public static Density MilligramsPerLiter(this T value) => Density.FromMilligramsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? MilligramsPerLiter(this T? value) where T : struct => Density.FromMilligramsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramPerMilliliter - /// public static Density MilligramsPerMilliliter(this T value) => Density.FromMilligramsPerMilliliter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? MilligramsPerMilliliter(this T? value) where T : struct => Density.FromMilligramsPerMilliliter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanogramPerDeciliter - /// public static Density NanogramsPerDeciLiter(this T value) => Density.FromNanogramsPerDeciLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? NanogramsPerDeciLiter(this T? value) where T : struct => Density.FromNanogramsPerDeciLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanogramPerLiter - /// public static Density NanogramsPerLiter(this T value) => Density.FromNanogramsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? NanogramsPerLiter(this T? value) where T : struct => Density.FromNanogramsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanogramPerMilliliter - /// public static Density NanogramsPerMilliliter(this T value) => Density.FromNanogramsPerMilliliter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? NanogramsPerMilliliter(this T? value) where T : struct => Density.FromNanogramsPerMilliliter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicogramPerDeciliter - /// public static Density PicogramsPerDeciLiter(this T value) => Density.FromPicogramsPerDeciLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? PicogramsPerDeciLiter(this T? value) where T : struct => Density.FromPicogramsPerDeciLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicogramPerLiter - /// public static Density PicogramsPerLiter(this T value) => Density.FromPicogramsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? PicogramsPerLiter(this T? value) where T : struct => Density.FromPicogramsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicogramPerMilliliter - /// public static Density PicogramsPerMilliliter(this T value) => Density.FromPicogramsPerMilliliter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? PicogramsPerMilliliter(this T? value) where T : struct => Density.FromPicogramsPerMilliliter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerCubicFoot - /// public static Density PoundsPerCubicFoot(this T value) => Density.FromPoundsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? PoundsPerCubicFoot(this T? value) where T : struct => Density.FromPoundsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerCubicInch - /// public static Density PoundsPerCubicInch(this T value) => Density.FromPoundsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? PoundsPerCubicInch(this T? value) where T : struct => Density.FromPoundsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerImperialGallon - /// public static Density PoundsPerImperialGallon(this T value) => Density.FromPoundsPerImperialGallon(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? PoundsPerImperialGallon(this T? value) where T : struct => Density.FromPoundsPerImperialGallon(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerUSGallon - /// public static Density PoundsPerUSGallon(this T value) => Density.FromPoundsPerUSGallon(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? PoundsPerUSGallon(this T? value) where T : struct => Density.FromPoundsPerUSGallon(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SlugPerCubicFoot - /// public static Density SlugsPerCubicFoot(this T value) => Density.FromSlugsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? SlugsPerCubicFoot(this T? value) where T : struct => Density.FromSlugsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonnePerCubicCentimeter - /// public static Density TonnesPerCubicCentimeter(this T value) => Density.FromTonnesPerCubicCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? TonnesPerCubicCentimeter(this T? value) where T : struct => Density.FromTonnesPerCubicCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonnePerCubicMeter - /// public static Density TonnesPerCubicMeter(this T value) => Density.FromTonnesPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? TonnesPerCubicMeter(this T? value) where T : struct => Density.FromTonnesPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonnePerCubicMillimeter - /// public static Density TonnesPerCubicMillimeter(this T value) => Density.FromTonnesPerCubicMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? TonnesPerCubicMillimeter(this T? value) where T : struct => Density.FromTonnesPerCubicMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs index 48e1ccab1a..fad167abb6 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs @@ -44,140 +44,44 @@ namespace UnitsNet.Extensions.NumberToDuration { public static class NumberToDurationExtensions { - #region Day - /// public static Duration Days(this T value) => Duration.FromDays(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Days(this T? value) where T : struct => Duration.FromDays(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Hour - /// public static Duration Hours(this T value) => Duration.FromHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Hours(this T? value) where T : struct => Duration.FromHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microsecond - /// public static Duration Microseconds(this T value) => Duration.FromMicroseconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Microseconds(this T? value) where T : struct => Duration.FromMicroseconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millisecond - /// public static Duration Milliseconds(this T value) => Duration.FromMilliseconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Milliseconds(this T? value) where T : struct => Duration.FromMilliseconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Minute - /// public static Duration Minutes(this T value) => Duration.FromMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Minutes(this T? value) where T : struct => Duration.FromMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Month - /// [System.Obsolete("Use Month30 instead, which makes it clear that this is an approximate unit based on 30 days per month. The duration of a month varies, but the Gregorian solar calendar has 365.2425/12 = 30.44 days on average.")] public static Duration Months(this T value) => Duration.FromMonths(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Months(this T? value) where T : struct => Duration.FromMonths(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Month30 - /// public static Duration Months30(this T value) => Duration.FromMonths30(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Months30(this T? value) where T : struct => Duration.FromMonths30(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanosecond - /// public static Duration Nanoseconds(this T value) => Duration.FromNanoseconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Nanoseconds(this T? value) where T : struct => Duration.FromNanoseconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Second - /// public static Duration Seconds(this T value) => Duration.FromSeconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Seconds(this T? value) where T : struct => Duration.FromSeconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Week - /// public static Duration Weeks(this T value) => Duration.FromWeeks(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Weeks(this T? value) where T : struct => Duration.FromWeeks(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Year - /// [System.Obsolete("Use Year365 instead, which makes it clear that this is an approximate unit based on 365 days per year. The duration of a year varies due to corrections such as leap years, since a Gregorian solar calendar has 365.2425 days.")] public static Duration Years(this T value) => Duration.FromYears(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Years(this T? value) where T : struct => Duration.FromYears(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Year365 - /// public static Duration Years365(this T value) => Duration.FromYears365(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? Years365(this T? value) where T : struct => Duration.FromYears365(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs index e8af61187f..362f462bf0 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs @@ -44,72 +44,24 @@ namespace UnitsNet.Extensions.NumberToDynamicViscosity { public static class NumberToDynamicViscosityExtensions { - #region Centipoise - /// public static DynamicViscosity Centipoise(this T value) => DynamicViscosity.FromCentipoise(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static DynamicViscosity? Centipoise(this T? value) where T : struct => DynamicViscosity.FromCentipoise(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicropascalSecond - /// public static DynamicViscosity MicropascalSeconds(this T value) => DynamicViscosity.FromMicropascalSeconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static DynamicViscosity? MicropascalSeconds(this T? value) where T : struct => DynamicViscosity.FromMicropascalSeconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillipascalSecond - /// public static DynamicViscosity MillipascalSeconds(this T value) => DynamicViscosity.FromMillipascalSeconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static DynamicViscosity? MillipascalSeconds(this T? value) where T : struct => DynamicViscosity.FromMillipascalSeconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonSecondPerMeterSquared - /// public static DynamicViscosity NewtonSecondsPerMeterSquared(this T value) => DynamicViscosity.FromNewtonSecondsPerMeterSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static DynamicViscosity? NewtonSecondsPerMeterSquared(this T? value) where T : struct => DynamicViscosity.FromNewtonSecondsPerMeterSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PascalSecond - /// public static DynamicViscosity PascalSeconds(this T value) => DynamicViscosity.FromPascalSeconds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static DynamicViscosity? PascalSeconds(this T? value) where T : struct => DynamicViscosity.FromPascalSeconds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Poise - /// public static DynamicViscosity Poise(this T value) => DynamicViscosity.FromPoise(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static DynamicViscosity? Poise(this T? value) where T : struct => DynamicViscosity.FromPoise(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs index 479d2dadec..9f4abe488a 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToElectricAdmittance { public static class NumberToElectricAdmittanceExtensions { - #region Microsiemens - /// public static ElectricAdmittance Microsiemens(this T value) => ElectricAdmittance.FromMicrosiemens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricAdmittance? Microsiemens(this T? value) where T : struct => ElectricAdmittance.FromMicrosiemens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millisiemens - /// public static ElectricAdmittance Millisiemens(this T value) => ElectricAdmittance.FromMillisiemens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricAdmittance? Millisiemens(this T? value) where T : struct => ElectricAdmittance.FromMillisiemens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanosiemens - /// public static ElectricAdmittance Nanosiemens(this T value) => ElectricAdmittance.FromNanosiemens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricAdmittance? Nanosiemens(this T? value) where T : struct => ElectricAdmittance.FromNanosiemens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Siemens - /// public static ElectricAdmittance Siemens(this T value) => ElectricAdmittance.FromSiemens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricAdmittance? Siemens(this T? value) where T : struct => ElectricAdmittance.FromSiemens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs index 8cce5635a8..4c1ac1c46b 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToElectricChargeDensity { public static class NumberToElectricChargeDensityExtensions { - #region CoulombPerCubicMeter - /// public static ElectricChargeDensity CoulombsPerCubicMeter(this T value) => ElectricChargeDensity.FromCoulombsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricChargeDensity? CoulombsPerCubicMeter(this T? value) where T : struct => ElectricChargeDensity.FromCoulombsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs index 4172b896c6..5573d06a98 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToElectricCharge { public static class NumberToElectricChargeExtensions { - #region Coulomb - /// public static ElectricCharge Coulombs(this T value) => ElectricCharge.FromCoulombs(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCharge? Coulombs(this T? value) where T : struct => ElectricCharge.FromCoulombs(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs index 009d984d58..843261ed40 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToElectricConductance { public static class NumberToElectricConductanceExtensions { - #region Microsiemens - /// public static ElectricConductance Microsiemens(this T value) => ElectricConductance.FromMicrosiemens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricConductance? Microsiemens(this T? value) where T : struct => ElectricConductance.FromMicrosiemens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millisiemens - /// public static ElectricConductance Millisiemens(this T value) => ElectricConductance.FromMillisiemens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricConductance? Millisiemens(this T? value) where T : struct => ElectricConductance.FromMillisiemens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Siemens - /// public static ElectricConductance Siemens(this T value) => ElectricConductance.FromSiemens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricConductance? Siemens(this T? value) where T : struct => ElectricConductance.FromSiemens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs index d3f606e246..311328fedb 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToElectricConductivity { public static class NumberToElectricConductivityExtensions { - #region SiemensPerMeter - /// public static ElectricConductivity SiemensPerMeter(this T value) => ElectricConductivity.FromSiemensPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricConductivity? SiemensPerMeter(this T? value) where T : struct => ElectricConductivity.FromSiemensPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs index efd6ced57a..7ced6e9098 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToElectricCurrentDensity { public static class NumberToElectricCurrentDensityExtensions { - #region AmperePerSquareMeter - /// public static ElectricCurrentDensity AmperesPerSquareMeter(this T value) => ElectricCurrentDensity.FromAmperesPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrentDensity? AmperesPerSquareMeter(this T? value) where T : struct => ElectricCurrentDensity.FromAmperesPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs index cc6432cea8..cebeaa5cd6 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs @@ -44,94 +44,30 @@ namespace UnitsNet.Extensions.NumberToElectricCurrent { public static class NumberToElectricCurrentExtensions { - #region Ampere - /// public static ElectricCurrent Amperes(this T value) => ElectricCurrent.FromAmperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Amperes(this T? value) where T : struct => ElectricCurrent.FromAmperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Centiampere - /// public static ElectricCurrent Centiamperes(this T value) => ElectricCurrent.FromCentiamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Centiamperes(this T? value) where T : struct => ElectricCurrent.FromCentiamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kiloampere - /// public static ElectricCurrent Kiloamperes(this T value) => ElectricCurrent.FromKiloamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Kiloamperes(this T? value) where T : struct => ElectricCurrent.FromKiloamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megaampere - /// public static ElectricCurrent Megaamperes(this T value) => ElectricCurrent.FromMegaamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Megaamperes(this T? value) where T : struct => ElectricCurrent.FromMegaamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microampere - /// public static ElectricCurrent Microamperes(this T value) => ElectricCurrent.FromMicroamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Microamperes(this T? value) where T : struct => ElectricCurrent.FromMicroamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Milliampere - /// public static ElectricCurrent Milliamperes(this T value) => ElectricCurrent.FromMilliamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Milliamperes(this T? value) where T : struct => ElectricCurrent.FromMilliamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanoampere - /// public static ElectricCurrent Nanoamperes(this T value) => ElectricCurrent.FromNanoamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Nanoamperes(this T? value) where T : struct => ElectricCurrent.FromNanoamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Picoampere - /// public static ElectricCurrent Picoamperes(this T value) => ElectricCurrent.FromPicoamperes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? Picoamperes(this T? value) where T : struct => ElectricCurrent.FromPicoamperes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs index f8ff56e216..19456d74dc 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToElectricCurrentGradient { public static class NumberToElectricCurrentGradientExtensions { - #region AmperePerSecond - /// public static ElectricCurrentGradient AmperesPerSecond(this T value) => ElectricCurrentGradient.FromAmperesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrentGradient? AmperesPerSecond(this T? value) where T : struct => ElectricCurrentGradient.FromAmperesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs index dd03e3351a..3b18fa3e9c 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToElectricField { public static class NumberToElectricFieldExtensions { - #region VoltPerMeter - /// public static ElectricField VoltsPerMeter(this T value) => ElectricField.FromVoltsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricField? VoltsPerMeter(this T? value) where T : struct => ElectricField.FromVoltsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs index f080d2a359..32210c78ae 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToElectricInductance { public static class NumberToElectricInductanceExtensions { - #region Henry - /// public static ElectricInductance Henries(this T value) => ElectricInductance.FromHenries(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricInductance? Henries(this T? value) where T : struct => ElectricInductance.FromHenries(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs index 2e0562ea00..7a9623efee 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs @@ -44,61 +44,21 @@ namespace UnitsNet.Extensions.NumberToElectricPotentialAc { public static class NumberToElectricPotentialAcExtensions { - #region KilovoltAc - /// public static ElectricPotentialAc KilovoltsAc(this T value) => ElectricPotentialAc.FromKilovoltsAc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialAc? KilovoltsAc(this T? value) where T : struct => ElectricPotentialAc.FromKilovoltsAc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegavoltAc - /// public static ElectricPotentialAc MegavoltsAc(this T value) => ElectricPotentialAc.FromMegavoltsAc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialAc? MegavoltsAc(this T? value) where T : struct => ElectricPotentialAc.FromMegavoltsAc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrovoltAc - /// public static ElectricPotentialAc MicrovoltsAc(this T value) => ElectricPotentialAc.FromMicrovoltsAc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialAc? MicrovoltsAc(this T? value) where T : struct => ElectricPotentialAc.FromMicrovoltsAc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillivoltAc - /// public static ElectricPotentialAc MillivoltsAc(this T value) => ElectricPotentialAc.FromMillivoltsAc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialAc? MillivoltsAc(this T? value) where T : struct => ElectricPotentialAc.FromMillivoltsAc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region VoltAc - /// public static ElectricPotentialAc VoltsAc(this T value) => ElectricPotentialAc.FromVoltsAc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialAc? VoltsAc(this T? value) where T : struct => ElectricPotentialAc.FromVoltsAc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs index fde616f3e2..0322b95071 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs @@ -44,61 +44,21 @@ namespace UnitsNet.Extensions.NumberToElectricPotentialDc { public static class NumberToElectricPotentialDcExtensions { - #region KilovoltDc - /// public static ElectricPotentialDc KilovoltsDc(this T value) => ElectricPotentialDc.FromKilovoltsDc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialDc? KilovoltsDc(this T? value) where T : struct => ElectricPotentialDc.FromKilovoltsDc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegavoltDc - /// public static ElectricPotentialDc MegavoltsDc(this T value) => ElectricPotentialDc.FromMegavoltsDc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialDc? MegavoltsDc(this T? value) where T : struct => ElectricPotentialDc.FromMegavoltsDc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrovoltDc - /// public static ElectricPotentialDc MicrovoltsDc(this T value) => ElectricPotentialDc.FromMicrovoltsDc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialDc? MicrovoltsDc(this T? value) where T : struct => ElectricPotentialDc.FromMicrovoltsDc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillivoltDc - /// public static ElectricPotentialDc MillivoltsDc(this T value) => ElectricPotentialDc.FromMillivoltsDc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialDc? MillivoltsDc(this T? value) where T : struct => ElectricPotentialDc.FromMillivoltsDc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region VoltDc - /// public static ElectricPotentialDc VoltsDc(this T value) => ElectricPotentialDc.FromVoltsDc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialDc? VoltsDc(this T? value) where T : struct => ElectricPotentialDc.FromVoltsDc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs index 4d65056731..ab4f96ce53 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs @@ -44,61 +44,21 @@ namespace UnitsNet.Extensions.NumberToElectricPotential { public static class NumberToElectricPotentialExtensions { - #region Kilovolt - /// public static ElectricPotential Kilovolts(this T value) => ElectricPotential.FromKilovolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotential? Kilovolts(this T? value) where T : struct => ElectricPotential.FromKilovolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megavolt - /// public static ElectricPotential Megavolts(this T value) => ElectricPotential.FromMegavolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotential? Megavolts(this T? value) where T : struct => ElectricPotential.FromMegavolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microvolt - /// public static ElectricPotential Microvolts(this T value) => ElectricPotential.FromMicrovolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotential? Microvolts(this T? value) where T : struct => ElectricPotential.FromMicrovolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millivolt - /// public static ElectricPotential Millivolts(this T value) => ElectricPotential.FromMillivolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotential? Millivolts(this T? value) where T : struct => ElectricPotential.FromMillivolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Volt - /// public static ElectricPotential Volts(this T value) => ElectricPotential.FromVolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotential? Volts(this T? value) where T : struct => ElectricPotential.FromVolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs index 2bdd86c11d..2ceb16ce7a 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToElectricResistance { public static class NumberToElectricResistanceExtensions { - #region Kiloohm - /// public static ElectricResistance Kiloohms(this T value) => ElectricResistance.FromKiloohms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistance? Kiloohms(this T? value) where T : struct => ElectricResistance.FromKiloohms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megaohm - /// public static ElectricResistance Megaohms(this T value) => ElectricResistance.FromMegaohms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistance? Megaohms(this T? value) where T : struct => ElectricResistance.FromMegaohms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Milliohm - /// public static ElectricResistance Milliohms(this T value) => ElectricResistance.FromMilliohms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistance? Milliohms(this T? value) where T : struct => ElectricResistance.FromMilliohms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Ohm - /// public static ElectricResistance Ohms(this T value) => ElectricResistance.FromOhms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistance? Ohms(this T? value) where T : struct => ElectricResistance.FromOhms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs index 1ef50dabd8..264db20bda 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToElectricResistivity { public static class NumberToElectricResistivityExtensions { - #region MicroohmMeter - /// public static ElectricResistivity MicroohmMeters(this T value) => ElectricResistivity.FromMicroohmMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistivity? MicroohmMeters(this T? value) where T : struct => ElectricResistivity.FromMicroohmMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilliohmMeter - /// public static ElectricResistivity MilliohmMeters(this T value) => ElectricResistivity.FromMilliohmMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistivity? MilliohmMeters(this T? value) where T : struct => ElectricResistivity.FromMilliohmMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanoohmMeter - /// public static ElectricResistivity NanoohmMeters(this T value) => ElectricResistivity.FromNanoohmMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistivity? NanoohmMeters(this T? value) where T : struct => ElectricResistivity.FromNanoohmMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OhmMeter - /// public static ElectricResistivity OhmMeters(this T value) => ElectricResistivity.FromOhmMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistivity? OhmMeters(this T? value) where T : struct => ElectricResistivity.FromOhmMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs index f1b22c4470..61618ec154 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs @@ -44,248 +44,72 @@ namespace UnitsNet.Extensions.NumberToEnergy { public static class NumberToEnergyExtensions { - #region BritishThermalUnit - /// public static Energy BritishThermalUnits(this T value) => Energy.FromBritishThermalUnits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? BritishThermalUnits(this T? value) where T : struct => Energy.FromBritishThermalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Calorie - /// public static Energy Calories(this T value) => Energy.FromCalories(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? Calories(this T? value) where T : struct => Energy.FromCalories(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecathermEc - /// public static Energy DecathermsEc(this T value) => Energy.FromDecathermsEc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? DecathermsEc(this T? value) where T : struct => Energy.FromDecathermsEc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecathermImperial - /// public static Energy DecathermsImperial(this T value) => Energy.FromDecathermsImperial(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? DecathermsImperial(this T? value) where T : struct => Energy.FromDecathermsImperial(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecathermUs - /// public static Energy DecathermsUs(this T value) => Energy.FromDecathermsUs(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? DecathermsUs(this T? value) where T : struct => Energy.FromDecathermsUs(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ElectronVolt - /// public static Energy ElectronVolts(this T value) => Energy.FromElectronVolts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? ElectronVolts(this T? value) where T : struct => Energy.FromElectronVolts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Erg - /// public static Energy Ergs(this T value) => Energy.FromErgs(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? Ergs(this T? value) where T : struct => Energy.FromErgs(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region FootPound - /// public static Energy FootPounds(this T value) => Energy.FromFootPounds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? FootPounds(this T? value) where T : struct => Energy.FromFootPounds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigabritishThermalUnit - /// public static Energy GigabritishThermalUnits(this T value) => Energy.FromGigabritishThermalUnits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? GigabritishThermalUnits(this T? value) where T : struct => Energy.FromGigabritishThermalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigawattHour - /// public static Energy GigawattHours(this T value) => Energy.FromGigawattHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? GigawattHours(this T? value) where T : struct => Energy.FromGigawattHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Joule - /// public static Energy Joules(this T value) => Energy.FromJoules(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? Joules(this T? value) where T : struct => Energy.FromJoules(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilobritishThermalUnit - /// public static Energy KilobritishThermalUnits(this T value) => Energy.FromKilobritishThermalUnits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? KilobritishThermalUnits(this T? value) where T : struct => Energy.FromKilobritishThermalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilocalorie - /// public static Energy Kilocalories(this T value) => Energy.FromKilocalories(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? Kilocalories(this T? value) where T : struct => Energy.FromKilocalories(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilojoule - /// public static Energy Kilojoules(this T value) => Energy.FromKilojoules(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? Kilojoules(this T? value) where T : struct => Energy.FromKilojoules(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattHour - /// public static Energy KilowattHours(this T value) => Energy.FromKilowattHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? KilowattHours(this T? value) where T : struct => Energy.FromKilowattHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegabritishThermalUnit - /// public static Energy MegabritishThermalUnits(this T value) => Energy.FromMegabritishThermalUnits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? MegabritishThermalUnits(this T? value) where T : struct => Energy.FromMegabritishThermalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megajoule - /// public static Energy Megajoules(this T value) => Energy.FromMegajoules(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? Megajoules(this T? value) where T : struct => Energy.FromMegajoules(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegawattHour - /// public static Energy MegawattHours(this T value) => Energy.FromMegawattHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? MegawattHours(this T? value) where T : struct => Energy.FromMegawattHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ThermEc - /// public static Energy ThermsEc(this T value) => Energy.FromThermsEc(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? ThermsEc(this T? value) where T : struct => Energy.FromThermsEc(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ThermImperial - /// public static Energy ThermsImperial(this T value) => Energy.FromThermsImperial(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? ThermsImperial(this T? value) where T : struct => Energy.FromThermsImperial(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ThermUs - /// public static Energy ThermsUs(this T value) => Energy.FromThermsUs(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? ThermsUs(this T? value) where T : struct => Energy.FromThermsUs(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattHour - /// public static Energy WattHours(this T value) => Energy.FromWattHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? WattHours(this T? value) where T : struct => Energy.FromWattHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs index 0c83b6987b..2ff8c28351 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs @@ -44,83 +44,27 @@ namespace UnitsNet.Extensions.NumberToEntropy { public static class NumberToEntropyExtensions { - #region CaloriePerKelvin - /// public static Entropy CaloriesPerKelvin(this T value) => Entropy.FromCaloriesPerKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? CaloriesPerKelvin(this T? value) where T : struct => Entropy.FromCaloriesPerKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region JoulePerDegreeCelsius - /// public static Entropy JoulesPerDegreeCelsius(this T value) => Entropy.FromJoulesPerDegreeCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? JoulesPerDegreeCelsius(this T? value) where T : struct => Entropy.FromJoulesPerDegreeCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region JoulePerKelvin - /// public static Entropy JoulesPerKelvin(this T value) => Entropy.FromJoulesPerKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? JoulesPerKelvin(this T? value) where T : struct => Entropy.FromJoulesPerKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilocaloriePerKelvin - /// public static Entropy KilocaloriesPerKelvin(this T value) => Entropy.FromKilocaloriesPerKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? KilocaloriesPerKelvin(this T? value) where T : struct => Entropy.FromKilocaloriesPerKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilojoulePerDegreeCelsius - /// public static Entropy KilojoulesPerDegreeCelsius(this T value) => Entropy.FromKilojoulesPerDegreeCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? KilojoulesPerDegreeCelsius(this T? value) where T : struct => Entropy.FromKilojoulesPerDegreeCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilojoulePerKelvin - /// public static Entropy KilojoulesPerKelvin(this T value) => Entropy.FromKilojoulesPerKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? KilojoulesPerKelvin(this T? value) where T : struct => Entropy.FromKilojoulesPerKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegajoulePerKelvin - /// public static Entropy MegajoulesPerKelvin(this T value) => Entropy.FromMegajoulesPerKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? MegajoulesPerKelvin(this T? value) where T : struct => Entropy.FromMegajoulesPerKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs index 6fdb1b2fa7..5f82218c6c 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFlowExtensions.g.cs @@ -44,288 +44,96 @@ namespace UnitsNet.Extensions.NumberToFlow { public static class NumberToFlowExtensions { - #region CentilitersPerMinute - /// public static Flow CentilitersPerMinute(this T value) => Flow.FromCentilitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CentilitersPerMinute(this T? value) where T : struct => Flow.FromCentilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicDecimeterPerMinute - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicDecimetersPerMinute(this T value) => Flow.FromCubicDecimetersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicDecimetersPerMinute(this T? value) where T : struct => Flow.FromCubicDecimetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerHour - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicFeetPerHour(this T value) => Flow.FromCubicFeetPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicFeetPerHour(this T? value) where T : struct => Flow.FromCubicFeetPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerMinute - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicFeetPerMinute(this T value) => Flow.FromCubicFeetPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicFeetPerMinute(this T? value) where T : struct => Flow.FromCubicFeetPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerSecond - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicFeetPerSecond(this T value) => Flow.FromCubicFeetPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicFeetPerSecond(this T? value) where T : struct => Flow.FromCubicFeetPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerHour - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicMetersPerHour(this T value) => Flow.FromCubicMetersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicMetersPerHour(this T? value) where T : struct => Flow.FromCubicMetersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerMinute - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicMetersPerMinute(this T value) => Flow.FromCubicMetersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicMetersPerMinute(this T? value) where T : struct => Flow.FromCubicMetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerSecond - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicMetersPerSecond(this T value) => Flow.FromCubicMetersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicMetersPerSecond(this T? value) where T : struct => Flow.FromCubicMetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerHour - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicYardsPerHour(this T value) => Flow.FromCubicYardsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicYardsPerHour(this T? value) where T : struct => Flow.FromCubicYardsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerMinute - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicYardsPerMinute(this T value) => Flow.FromCubicYardsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicYardsPerMinute(this T? value) where T : struct => Flow.FromCubicYardsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerSecond - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow CubicYardsPerSecond(this T value) => Flow.FromCubicYardsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? CubicYardsPerSecond(this T? value) where T : struct => Flow.FromCubicYardsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecilitersPerMinute - /// public static Flow DecilitersPerMinute(this T value) => Flow.FromDecilitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? DecilitersPerMinute(this T? value) where T : struct => Flow.FromDecilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilolitersPerMinute - /// public static Flow KilolitersPerMinute(this T value) => Flow.FromKilolitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? KilolitersPerMinute(this T? value) where T : struct => Flow.FromKilolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerHour - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow LitersPerHour(this T value) => Flow.FromLitersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? LitersPerHour(this T? value) where T : struct => Flow.FromLitersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerMinute - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow LitersPerMinute(this T value) => Flow.FromLitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? LitersPerMinute(this T? value) where T : struct => Flow.FromLitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerSecond - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow LitersPerSecond(this T value) => Flow.FromLitersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? LitersPerSecond(this T? value) where T : struct => Flow.FromLitersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrolitersPerMinute - /// public static Flow MicrolitersPerMinute(this T value) => Flow.FromMicrolitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? MicrolitersPerMinute(this T? value) where T : struct => Flow.FromMicrolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillilitersPerMinute - /// public static Flow MillilitersPerMinute(this T value) => Flow.FromMillilitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? MillilitersPerMinute(this T? value) where T : struct => Flow.FromMillilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillionUsGallonsPerDay - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow MillionUsGallonsPerDay(this T value) => Flow.FromMillionUsGallonsPerDay(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? MillionUsGallonsPerDay(this T? value) where T : struct => Flow.FromMillionUsGallonsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanolitersPerMinute - /// public static Flow NanolitersPerMinute(this T value) => Flow.FromNanolitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? NanolitersPerMinute(this T? value) where T : struct => Flow.FromNanolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerDay - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow OilBarrelsPerDay(this T value) => Flow.FromOilBarrelsPerDay(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? OilBarrelsPerDay(this T? value) where T : struct => Flow.FromOilBarrelsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerHour - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow UsGallonsPerHour(this T value) => Flow.FromUsGallonsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? UsGallonsPerHour(this T? value) where T : struct => Flow.FromUsGallonsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerMinute - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow UsGallonsPerMinute(this T value) => Flow.FromUsGallonsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? UsGallonsPerMinute(this T? value) where T : struct => Flow.FromUsGallonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerSecond - /// [System.Obsolete("Deprecated due to github issue #363, please use VolumeFlow instead")] public static Flow UsGallonsPerSecond(this T value) => Flow.FromUsGallonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? UsGallonsPerSecond(this T? value) where T : struct => Flow.FromUsGallonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs index 4e9fd9075b..b58d9e2a79 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs @@ -44,127 +44,39 @@ namespace UnitsNet.Extensions.NumberToForceChangeRate { public static class NumberToForceChangeRateExtensions { - #region CentinewtonPerSecond - /// public static ForceChangeRate CentinewtonsPerSecond(this T value) => ForceChangeRate.FromCentinewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? CentinewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromCentinewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecanewtonPerMinute - /// public static ForceChangeRate DecanewtonsPerMinute(this T value) => ForceChangeRate.FromDecanewtonsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? DecanewtonsPerMinute(this T? value) where T : struct => ForceChangeRate.FromDecanewtonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecanewtonPerSecond - /// public static ForceChangeRate DecanewtonsPerSecond(this T value) => ForceChangeRate.FromDecanewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? DecanewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromDecanewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecinewtonPerSecond - /// public static ForceChangeRate DecinewtonsPerSecond(this T value) => ForceChangeRate.FromDecinewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? DecinewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromDecinewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerMinute - /// public static ForceChangeRate KilonewtonsPerMinute(this T value) => ForceChangeRate.FromKilonewtonsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? KilonewtonsPerMinute(this T? value) where T : struct => ForceChangeRate.FromKilonewtonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerSecond - /// public static ForceChangeRate KilonewtonsPerSecond(this T value) => ForceChangeRate.FromKilonewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? KilonewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromKilonewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicronewtonPerSecond - /// public static ForceChangeRate MicronewtonsPerSecond(this T value) => ForceChangeRate.FromMicronewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? MicronewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromMicronewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillinewtonPerSecond - /// public static ForceChangeRate MillinewtonsPerSecond(this T value) => ForceChangeRate.FromMillinewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? MillinewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromMillinewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanonewtonPerSecond - /// public static ForceChangeRate NanonewtonsPerSecond(this T value) => ForceChangeRate.FromNanonewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? NanonewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromNanonewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerMinute - /// public static ForceChangeRate NewtonsPerMinute(this T value) => ForceChangeRate.FromNewtonsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? NewtonsPerMinute(this T? value) where T : struct => ForceChangeRate.FromNewtonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerSecond - /// public static ForceChangeRate NewtonsPerSecond(this T value) => ForceChangeRate.FromNewtonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? NewtonsPerSecond(this T? value) where T : struct => ForceChangeRate.FromNewtonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs index da7ac9dba4..4e78aba2c8 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs @@ -44,116 +44,36 @@ namespace UnitsNet.Extensions.NumberToForce { public static class NumberToForceExtensions { - #region Decanewton - /// public static Force Decanewtons(this T value) => Force.FromDecanewtons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? Decanewtons(this T? value) where T : struct => Force.FromDecanewtons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Dyn - /// public static Force Dyne(this T value) => Force.FromDyne(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? Dyne(this T? value) where T : struct => Force.FromDyne(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForce - /// public static Force KilogramsForce(this T value) => Force.FromKilogramsForce(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? KilogramsForce(this T? value) where T : struct => Force.FromKilogramsForce(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilonewton - /// public static Force Kilonewtons(this T value) => Force.FromKilonewtons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? Kilonewtons(this T? value) where T : struct => Force.FromKilonewtons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KiloPond - /// public static Force KiloPonds(this T value) => Force.FromKiloPonds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? KiloPonds(this T? value) where T : struct => Force.FromKiloPonds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Meganewton - /// public static Force Meganewtons(this T value) => Force.FromMeganewtons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? Meganewtons(this T? value) where T : struct => Force.FromMeganewtons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Newton - /// public static Force Newtons(this T value) => Force.FromNewtons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? Newtons(this T? value) where T : struct => Force.FromNewtons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Poundal - /// public static Force Poundals(this T value) => Force.FromPoundals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? Poundals(this T? value) where T : struct => Force.FromPoundals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundForce - /// public static Force PoundsForce(this T value) => Force.FromPoundsForce(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? PoundsForce(this T? value) where T : struct => Force.FromPoundsForce(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForce - /// public static Force TonnesForce(this T value) => Force.FromTonnesForce(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? TonnesForce(this T? value) where T : struct => Force.FromTonnesForce(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs index 6db097dcd1..7a5cd2d5a2 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs @@ -44,105 +44,33 @@ namespace UnitsNet.Extensions.NumberToForcePerLength { public static class NumberToForcePerLengthExtensions { - #region CentinewtonPerMeter - /// public static ForcePerLength CentinewtonsPerMeter(this T value) => ForcePerLength.FromCentinewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? CentinewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromCentinewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecinewtonPerMeter - /// public static ForcePerLength DecinewtonsPerMeter(this T value) => ForcePerLength.FromDecinewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? DecinewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromDecinewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForcePerMeter - /// public static ForcePerLength KilogramsForcePerMeter(this T value) => ForcePerLength.FromKilogramsForcePerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? KilogramsForcePerMeter(this T? value) where T : struct => ForcePerLength.FromKilogramsForcePerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerMeter - /// public static ForcePerLength KilonewtonsPerMeter(this T value) => ForcePerLength.FromKilonewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? KilonewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromKilonewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonPerMeter - /// public static ForcePerLength MeganewtonsPerMeter(this T value) => ForcePerLength.FromMeganewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? MeganewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromMeganewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicronewtonPerMeter - /// public static ForcePerLength MicronewtonsPerMeter(this T value) => ForcePerLength.FromMicronewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? MicronewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromMicronewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillinewtonPerMeter - /// public static ForcePerLength MillinewtonsPerMeter(this T value) => ForcePerLength.FromMillinewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? MillinewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromMillinewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanonewtonPerMeter - /// public static ForcePerLength NanonewtonsPerMeter(this T value) => ForcePerLength.FromNanonewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? NanonewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromNanonewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerMeter - /// public static ForcePerLength NewtonsPerMeter(this T value) => ForcePerLength.FromNewtonsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? NewtonsPerMeter(this T? value) where T : struct => ForcePerLength.FromNewtonsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs index d9628a6665..313563c5e1 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs @@ -44,83 +44,27 @@ namespace UnitsNet.Extensions.NumberToFrequency { public static class NumberToFrequencyExtensions { - #region CyclePerHour - /// public static Frequency CyclesPerHour(this T value) => Frequency.FromCyclesPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? CyclesPerHour(this T? value) where T : struct => Frequency.FromCyclesPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CyclePerMinute - /// public static Frequency CyclesPerMinute(this T value) => Frequency.FromCyclesPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? CyclesPerMinute(this T? value) where T : struct => Frequency.FromCyclesPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gigahertz - /// public static Frequency Gigahertz(this T value) => Frequency.FromGigahertz(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? Gigahertz(this T? value) where T : struct => Frequency.FromGigahertz(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Hertz - /// public static Frequency Hertz(this T value) => Frequency.FromHertz(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? Hertz(this T? value) where T : struct => Frequency.FromHertz(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilohertz - /// public static Frequency Kilohertz(this T value) => Frequency.FromKilohertz(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? Kilohertz(this T? value) where T : struct => Frequency.FromKilohertz(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megahertz - /// public static Frequency Megahertz(this T value) => Frequency.FromMegahertz(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? Megahertz(this T? value) where T : struct => Frequency.FromMegahertz(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Terahertz - /// public static Frequency Terahertz(this T value) => Frequency.FromTerahertz(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? Terahertz(this T? value) where T : struct => Frequency.FromTerahertz(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs index d351423200..737ca32544 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs @@ -44,182 +44,54 @@ namespace UnitsNet.Extensions.NumberToHeatFlux { public static class NumberToHeatFluxExtensions { - #region BtuPerHourSquareFoot - /// public static HeatFlux BtusPerHourSquareFoot(this T value) => HeatFlux.FromBtusPerHourSquareFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? BtusPerHourSquareFoot(this T? value) where T : struct => HeatFlux.FromBtusPerHourSquareFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region BtuPerMinuteSquareFoot - /// public static HeatFlux BtusPerMinuteSquareFoot(this T value) => HeatFlux.FromBtusPerMinuteSquareFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? BtusPerMinuteSquareFoot(this T? value) where T : struct => HeatFlux.FromBtusPerMinuteSquareFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region BtuPerSecondSquareFoot - /// public static HeatFlux BtusPerSecondSquareFoot(this T value) => HeatFlux.FromBtusPerSecondSquareFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? BtusPerSecondSquareFoot(this T? value) where T : struct => HeatFlux.FromBtusPerSecondSquareFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region BtuPerSecondSquareInch - /// public static HeatFlux BtusPerSecondSquareInch(this T value) => HeatFlux.FromBtusPerSecondSquareInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? BtusPerSecondSquareInch(this T? value) where T : struct => HeatFlux.FromBtusPerSecondSquareInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CaloriePerSecondSquareCentimeter - /// public static HeatFlux CaloriesPerSecondSquareCentimeter(this T value) => HeatFlux.FromCaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? CaloriesPerSecondSquareCentimeter(this T? value) where T : struct => HeatFlux.FromCaloriesPerSecondSquareCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CentiwattPerSquareMeter - /// public static HeatFlux CentiwattsPerSquareMeter(this T value) => HeatFlux.FromCentiwattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? CentiwattsPerSquareMeter(this T? value) where T : struct => HeatFlux.FromCentiwattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DeciwattPerSquareMeter - /// public static HeatFlux DeciwattsPerSquareMeter(this T value) => HeatFlux.FromDeciwattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? DeciwattsPerSquareMeter(this T? value) where T : struct => HeatFlux.FromDeciwattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilocaloriePerHourSquareMeter - /// public static HeatFlux KilocaloriesPerHourSquareMeter(this T value) => HeatFlux.FromKilocaloriesPerHourSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? KilocaloriesPerHourSquareMeter(this T? value) where T : struct => HeatFlux.FromKilocaloriesPerHourSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilocaloriePerSecondSquareCentimeter - /// public static HeatFlux KilocaloriesPerSecondSquareCentimeter(this T value) => HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? KilocaloriesPerSecondSquareCentimeter(this T? value) where T : struct => HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattPerSquareMeter - /// public static HeatFlux KilowattsPerSquareMeter(this T value) => HeatFlux.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? KilowattsPerSquareMeter(this T? value) where T : struct => HeatFlux.FromKilowattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrowattPerSquareMeter - /// public static HeatFlux MicrowattsPerSquareMeter(this T value) => HeatFlux.FromMicrowattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? MicrowattsPerSquareMeter(this T? value) where T : struct => HeatFlux.FromMicrowattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilliwattPerSquareMeter - /// public static HeatFlux MilliwattsPerSquareMeter(this T value) => HeatFlux.FromMilliwattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? MilliwattsPerSquareMeter(this T? value) where T : struct => HeatFlux.FromMilliwattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanowattPerSquareMeter - /// public static HeatFlux NanowattsPerSquareMeter(this T value) => HeatFlux.FromNanowattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? NanowattsPerSquareMeter(this T? value) where T : struct => HeatFlux.FromNanowattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerSquareFoot - /// public static HeatFlux WattsPerSquareFoot(this T value) => HeatFlux.FromWattsPerSquareFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? WattsPerSquareFoot(this T? value) where T : struct => HeatFlux.FromWattsPerSquareFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerSquareInch - /// public static HeatFlux WattsPerSquareInch(this T value) => HeatFlux.FromWattsPerSquareInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? WattsPerSquareInch(this T? value) where T : struct => HeatFlux.FromWattsPerSquareInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerSquareMeter - /// public static HeatFlux WattsPerSquareMeter(this T value) => HeatFlux.FromWattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? WattsPerSquareMeter(this T? value) where T : struct => HeatFlux.FromWattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs index 95b2497adf..e47213f176 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs @@ -44,28 +44,12 @@ namespace UnitsNet.Extensions.NumberToHeatTransferCoefficient { public static class NumberToHeatTransferCoefficientExtensions { - #region WattPerSquareMeterCelsius - /// public static HeatTransferCoefficient WattsPerSquareMeterCelsius(this T value) => HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatTransferCoefficient? WattsPerSquareMeterCelsius(this T? value) where T : struct => HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerSquareMeterKelvin - /// public static HeatTransferCoefficient WattsPerSquareMeterKelvin(this T value) => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatTransferCoefficient? WattsPerSquareMeterKelvin(this T? value) where T : struct => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs index f65660e24d..63a4c2d79c 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToIlluminance { public static class NumberToIlluminanceExtensions { - #region Kilolux - /// public static Illuminance Kilolux(this T value) => Illuminance.FromKilolux(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Illuminance? Kilolux(this T? value) where T : struct => Illuminance.FromKilolux(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Lux - /// public static Illuminance Lux(this T value) => Illuminance.FromLux(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Illuminance? Lux(this T? value) where T : struct => Illuminance.FromLux(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megalux - /// public static Illuminance Megalux(this T value) => Illuminance.FromMegalux(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Illuminance? Megalux(this T? value) where T : struct => Illuminance.FromMegalux(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millilux - /// public static Illuminance Millilux(this T value) => Illuminance.FromMillilux(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Illuminance? Millilux(this T? value) where T : struct => Illuminance.FromMillilux(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs index e3e9b1e43e..fc02154ffb 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs @@ -44,292 +44,84 @@ namespace UnitsNet.Extensions.NumberToInformation { public static class NumberToInformationExtensions { - #region Bit - /// public static Information Bits(this T value) => Information.FromBits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Bits(this T? value) where T : struct => Information.FromBits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Byte - /// public static Information Bytes(this T value) => Information.FromBytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Bytes(this T? value) where T : struct => Information.FromBytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Exabit - /// public static Information Exabits(this T value) => Information.FromExabits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Exabits(this T? value) where T : struct => Information.FromExabits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Exabyte - /// public static Information Exabytes(this T value) => Information.FromExabytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Exabytes(this T? value) where T : struct => Information.FromExabytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Exbibit - /// public static Information Exbibits(this T value) => Information.FromExbibits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Exbibits(this T? value) where T : struct => Information.FromExbibits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Exbibyte - /// public static Information Exbibytes(this T value) => Information.FromExbibytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Exbibytes(this T? value) where T : struct => Information.FromExbibytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gibibit - /// public static Information Gibibits(this T value) => Information.FromGibibits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Gibibits(this T? value) where T : struct => Information.FromGibibits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gibibyte - /// public static Information Gibibytes(this T value) => Information.FromGibibytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Gibibytes(this T? value) where T : struct => Information.FromGibibytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gigabit - /// public static Information Gigabits(this T value) => Information.FromGigabits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Gigabits(this T? value) where T : struct => Information.FromGigabits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gigabyte - /// public static Information Gigabytes(this T value) => Information.FromGigabytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Gigabytes(this T? value) where T : struct => Information.FromGigabytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kibibit - /// public static Information Kibibits(this T value) => Information.FromKibibits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Kibibits(this T? value) where T : struct => Information.FromKibibits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kibibyte - /// public static Information Kibibytes(this T value) => Information.FromKibibytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Kibibytes(this T? value) where T : struct => Information.FromKibibytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilobit - /// public static Information Kilobits(this T value) => Information.FromKilobits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Kilobits(this T? value) where T : struct => Information.FromKilobits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilobyte - /// public static Information Kilobytes(this T value) => Information.FromKilobytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Kilobytes(this T? value) where T : struct => Information.FromKilobytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Mebibit - /// public static Information Mebibits(this T value) => Information.FromMebibits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Mebibits(this T? value) where T : struct => Information.FromMebibits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Mebibyte - /// public static Information Mebibytes(this T value) => Information.FromMebibytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Mebibytes(this T? value) where T : struct => Information.FromMebibytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megabit - /// public static Information Megabits(this T value) => Information.FromMegabits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Megabits(this T? value) where T : struct => Information.FromMegabits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megabyte - /// public static Information Megabytes(this T value) => Information.FromMegabytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Megabytes(this T? value) where T : struct => Information.FromMegabytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Pebibit - /// public static Information Pebibits(this T value) => Information.FromPebibits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Pebibits(this T? value) where T : struct => Information.FromPebibits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Pebibyte - /// public static Information Pebibytes(this T value) => Information.FromPebibytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Pebibytes(this T? value) where T : struct => Information.FromPebibytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Petabit - /// public static Information Petabits(this T value) => Information.FromPetabits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Petabits(this T? value) where T : struct => Information.FromPetabits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Petabyte - /// public static Information Petabytes(this T value) => Information.FromPetabytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Petabytes(this T? value) where T : struct => Information.FromPetabytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Tebibit - /// public static Information Tebibits(this T value) => Information.FromTebibits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Tebibits(this T? value) where T : struct => Information.FromTebibits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Tebibyte - /// public static Information Tebibytes(this T value) => Information.FromTebibytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Tebibytes(this T? value) where T : struct => Information.FromTebibytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Terabit - /// public static Information Terabits(this T value) => Information.FromTerabits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Terabits(this T? value) where T : struct => Information.FromTerabits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Terabyte - /// public static Information Terabytes(this T value) => Information.FromTerabytes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? Terabytes(this T? value) where T : struct => Information.FromTerabytes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs index 6102ebb51b..8b202820d6 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs @@ -44,28 +44,12 @@ namespace UnitsNet.Extensions.NumberToIrradiance { public static class NumberToIrradianceExtensions { - #region KilowattPerSquareMeter - /// public static Irradiance KilowattsPerSquareMeter(this T value) => Irradiance.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Irradiance? KilowattsPerSquareMeter(this T? value) where T : struct => Irradiance.FromKilowattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerSquareMeter - /// public static Irradiance WattsPerSquareMeter(this T value) => Irradiance.FromWattsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Irradiance? WattsPerSquareMeter(this T? value) where T : struct => Irradiance.FromWattsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs index 790e51aea5..f1c63a55d8 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToIrradiation { public static class NumberToIrradiationExtensions { - #region JoulePerSquareMeter - /// public static Irradiation JoulesPerSquareMeter(this T value) => Irradiation.FromJoulesPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Irradiation? JoulesPerSquareMeter(this T? value) where T : struct => Irradiation.FromJoulesPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattHourPerSquareMeter - /// public static Irradiation KilowattHoursPerSquareMeter(this T value) => Irradiation.FromKilowattHoursPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Irradiation? KilowattHoursPerSquareMeter(this T? value) where T : struct => Irradiation.FromKilowattHoursPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattHourPerSquareMeter - /// public static Irradiation WattHoursPerSquareMeter(this T value) => Irradiation.FromWattHoursPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Irradiation? WattHoursPerSquareMeter(this T? value) where T : struct => Irradiation.FromWattHoursPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs index ba6654d1d2..103d3c781a 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs @@ -44,94 +44,30 @@ namespace UnitsNet.Extensions.NumberToKinematicViscosity { public static class NumberToKinematicViscosityExtensions { - #region Centistokes - /// public static KinematicViscosity Centistokes(this T value) => KinematicViscosity.FromCentistokes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? Centistokes(this T? value) where T : struct => KinematicViscosity.FromCentistokes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decistokes - /// public static KinematicViscosity Decistokes(this T value) => KinematicViscosity.FromDecistokes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? Decistokes(this T? value) where T : struct => KinematicViscosity.FromDecistokes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilostokes - /// public static KinematicViscosity Kilostokes(this T value) => KinematicViscosity.FromKilostokes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? Kilostokes(this T? value) where T : struct => KinematicViscosity.FromKilostokes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microstokes - /// public static KinematicViscosity Microstokes(this T value) => KinematicViscosity.FromMicrostokes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? Microstokes(this T? value) where T : struct => KinematicViscosity.FromMicrostokes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millistokes - /// public static KinematicViscosity Millistokes(this T value) => KinematicViscosity.FromMillistokes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? Millistokes(this T? value) where T : struct => KinematicViscosity.FromMillistokes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanostokes - /// public static KinematicViscosity Nanostokes(this T value) => KinematicViscosity.FromNanostokes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? Nanostokes(this T? value) where T : struct => KinematicViscosity.FromNanostokes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareMeterPerSecond - /// public static KinematicViscosity SquareMetersPerSecond(this T value) => KinematicViscosity.FromSquareMetersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? SquareMetersPerSecond(this T? value) where T : struct => KinematicViscosity.FromSquareMetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Stokes - /// public static KinematicViscosity Stokes(this T value) => KinematicViscosity.FromStokes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? Stokes(this T? value) where T : struct => KinematicViscosity.FromStokes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs index 591ef48585..256c0daa49 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToLapseRate { public static class NumberToLapseRateExtensions { - #region DegreeCelsiusPerKilometer - /// public static LapseRate DegreesCelciusPerKilometer(this T value) => LapseRate.FromDegreesCelciusPerKilometer(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LapseRate? DegreesCelciusPerKilometer(this T? value) where T : struct => LapseRate.FromDegreesCelciusPerKilometer(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs index 0b2b14e3a0..930b5bd8fb 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs @@ -44,248 +44,72 @@ namespace UnitsNet.Extensions.NumberToLength { public static class NumberToLengthExtensions { - #region Centimeter - /// public static Length Centimeters(this T value) => Length.FromCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Centimeters(this T? value) where T : struct => Length.FromCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decimeter - /// public static Length Decimeters(this T value) => Length.FromDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Decimeters(this T? value) where T : struct => Length.FromDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DtpPica - /// public static Length DtpPicas(this T value) => Length.FromDtpPicas(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? DtpPicas(this T? value) where T : struct => Length.FromDtpPicas(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DtpPoint - /// public static Length DtpPoints(this T value) => Length.FromDtpPoints(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? DtpPoints(this T? value) where T : struct => Length.FromDtpPoints(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Fathom - /// public static Length Fathoms(this T value) => Length.FromFathoms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Fathoms(this T? value) where T : struct => Length.FromFathoms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Foot - /// public static Length Feet(this T value) => Length.FromFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Feet(this T? value) where T : struct => Length.FromFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Inch - /// public static Length Inches(this T value) => Length.FromInches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Inches(this T? value) where T : struct => Length.FromInches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilometer - /// public static Length Kilometers(this T value) => Length.FromKilometers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Kilometers(this T? value) where T : struct => Length.FromKilometers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Meter - /// public static Length Meters(this T value) => Length.FromMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Meters(this T? value) where T : struct => Length.FromMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microinch - /// public static Length Microinches(this T value) => Length.FromMicroinches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Microinches(this T? value) where T : struct => Length.FromMicroinches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Micrometer - /// public static Length Micrometers(this T value) => Length.FromMicrometers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Micrometers(this T? value) where T : struct => Length.FromMicrometers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Mil - /// public static Length Mils(this T value) => Length.FromMils(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Mils(this T? value) where T : struct => Length.FromMils(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Mile - /// public static Length Miles(this T value) => Length.FromMiles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Miles(this T? value) where T : struct => Length.FromMiles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millimeter - /// public static Length Millimeters(this T value) => Length.FromMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Millimeters(this T? value) where T : struct => Length.FromMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanometer - /// public static Length Nanometers(this T value) => Length.FromNanometers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Nanometers(this T? value) where T : struct => Length.FromNanometers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NauticalMile - /// public static Length NauticalMiles(this T value) => Length.FromNauticalMiles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? NauticalMiles(this T? value) where T : struct => Length.FromNauticalMiles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PrinterPica - /// public static Length PrinterPicas(this T value) => Length.FromPrinterPicas(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? PrinterPicas(this T? value) where T : struct => Length.FromPrinterPicas(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PrinterPoint - /// public static Length PrinterPoints(this T value) => Length.FromPrinterPoints(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? PrinterPoints(this T? value) where T : struct => Length.FromPrinterPoints(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Shackle - /// public static Length Shackles(this T value) => Length.FromShackles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Shackles(this T? value) where T : struct => Length.FromShackles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Twip - /// public static Length Twips(this T value) => Length.FromTwips(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Twips(this T? value) where T : struct => Length.FromTwips(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsSurveyFoot - /// public static Length UsSurveyFeet(this T value) => Length.FromUsSurveyFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? UsSurveyFeet(this T? value) where T : struct => Length.FromUsSurveyFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Yard - /// public static Length Yards(this T value) => Length.FromYards(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? Yards(this T? value) where T : struct => Length.FromYards(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs index f0d7aed5c8..024d9d1b64 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs @@ -44,28 +44,12 @@ namespace UnitsNet.Extensions.NumberToLevel { public static class NumberToLevelExtensions { - #region Decibel - /// public static Level Decibels(this T value) => Level.FromDecibels(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Level? Decibels(this T? value) where T : struct => Level.FromDecibels(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Neper - /// public static Level Nepers(this T value) => Level.FromNepers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Level? Nepers(this T? value) where T : struct => Level.FromNepers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs index 9481175332..fcc43ec98f 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToLinearDensity { public static class NumberToLinearDensityExtensions { - #region GramPerMeter - /// public static LinearDensity GramsPerMeter(this T value) => LinearDensity.FromGramsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LinearDensity? GramsPerMeter(this T? value) where T : struct => LinearDensity.FromGramsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerMeter - /// public static LinearDensity KilogramsPerMeter(this T value) => LinearDensity.FromKilogramsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LinearDensity? KilogramsPerMeter(this T? value) where T : struct => LinearDensity.FromKilogramsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerFoot - /// public static LinearDensity PoundsPerFoot(this T value) => LinearDensity.FromPoundsPerFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LinearDensity? PoundsPerFoot(this T? value) where T : struct => LinearDensity.FromPoundsPerFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs index 3db0da00d8..87e844ed6b 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToLuminousFlux { public static class NumberToLuminousFluxExtensions { - #region Lumen - /// public static LuminousFlux Lumens(this T value) => LuminousFlux.FromLumens(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LuminousFlux? Lumens(this T? value) where T : struct => LuminousFlux.FromLumens(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs index 79c9c9cd1b..6459050eb6 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToLuminousIntensity { public static class NumberToLuminousIntensityExtensions { - #region Candela - /// public static LuminousIntensity Candela(this T value) => LuminousIntensity.FromCandela(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LuminousIntensity? Candela(this T? value) where T : struct => LuminousIntensity.FromCandela(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs index b3484f756b..c7657d43b0 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToMagneticField { public static class NumberToMagneticFieldExtensions { - #region Tesla - /// public static MagneticField Teslas(this T value) => MagneticField.FromTeslas(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MagneticField? Teslas(this T? value) where T : struct => MagneticField.FromTeslas(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs index 935ecb2375..fc48c0ef6f 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToMagneticFlux { public static class NumberToMagneticFluxExtensions { - #region Weber - /// public static MagneticFlux Webers(this T value) => MagneticFlux.FromWebers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MagneticFlux? Webers(this T? value) where T : struct => MagneticFlux.FromWebers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs index cce5daf093..f9c977ccad 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToMagnetization { public static class NumberToMagnetizationExtensions { - #region AmperePerMeter - /// public static Magnetization AmperesPerMeter(this T value) => Magnetization.FromAmperesPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Magnetization? AmperesPerMeter(this T? value) where T : struct => Magnetization.FromAmperesPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs index 1d75e9f3e0..8a20899ef2 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs @@ -44,237 +44,69 @@ namespace UnitsNet.Extensions.NumberToMass { public static class NumberToMassExtensions { - #region Centigram - /// public static Mass Centigrams(this T value) => Mass.FromCentigrams(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Centigrams(this T? value) where T : struct => Mass.FromCentigrams(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decagram - /// public static Mass Decagrams(this T value) => Mass.FromDecagrams(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Decagrams(this T? value) where T : struct => Mass.FromDecagrams(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decigram - /// public static Mass Decigrams(this T value) => Mass.FromDecigrams(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Decigrams(this T? value) where T : struct => Mass.FromDecigrams(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gram - /// public static Mass Grams(this T value) => Mass.FromGrams(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Grams(this T? value) where T : struct => Mass.FromGrams(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Hectogram - /// public static Mass Hectograms(this T value) => Mass.FromHectograms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Hectograms(this T? value) where T : struct => Mass.FromHectograms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilogram - /// public static Mass Kilograms(this T value) => Mass.FromKilograms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Kilograms(this T? value) where T : struct => Mass.FromKilograms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilopound - /// public static Mass Kilopounds(this T value) => Mass.FromKilopounds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Kilopounds(this T? value) where T : struct => Mass.FromKilopounds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilotonne - /// public static Mass Kilotonnes(this T value) => Mass.FromKilotonnes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Kilotonnes(this T? value) where T : struct => Mass.FromKilotonnes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LongHundredweight - /// public static Mass LongHundredweight(this T value) => Mass.FromLongHundredweight(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? LongHundredweight(this T? value) where T : struct => Mass.FromLongHundredweight(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LongTon - /// public static Mass LongTons(this T value) => Mass.FromLongTons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? LongTons(this T? value) where T : struct => Mass.FromLongTons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megapound - /// public static Mass Megapounds(this T value) => Mass.FromMegapounds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Megapounds(this T? value) where T : struct => Mass.FromMegapounds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megatonne - /// public static Mass Megatonnes(this T value) => Mass.FromMegatonnes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Megatonnes(this T? value) where T : struct => Mass.FromMegatonnes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microgram - /// public static Mass Micrograms(this T value) => Mass.FromMicrograms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Micrograms(this T? value) where T : struct => Mass.FromMicrograms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Milligram - /// public static Mass Milligrams(this T value) => Mass.FromMilligrams(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Milligrams(this T? value) where T : struct => Mass.FromMilligrams(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanogram - /// public static Mass Nanograms(this T value) => Mass.FromNanograms(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Nanograms(this T? value) where T : struct => Mass.FromNanograms(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Ounce - /// public static Mass Ounces(this T value) => Mass.FromOunces(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Ounces(this T? value) where T : struct => Mass.FromOunces(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Pound - /// public static Mass Pounds(this T value) => Mass.FromPounds(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Pounds(this T? value) where T : struct => Mass.FromPounds(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ShortHundredweight - /// public static Mass ShortHundredweight(this T value) => Mass.FromShortHundredweight(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? ShortHundredweight(this T? value) where T : struct => Mass.FromShortHundredweight(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ShortTon - /// public static Mass ShortTons(this T value) => Mass.FromShortTons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? ShortTons(this T? value) where T : struct => Mass.FromShortTons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Stone - /// public static Mass Stone(this T value) => Mass.FromStone(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Stone(this T? value) where T : struct => Mass.FromStone(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Tonne - /// public static Mass Tonnes(this T value) => Mass.FromTonnes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? Tonnes(this T? value) where T : struct => Mass.FromTonnes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs index 133b50a4eb..8db4e6c06b 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs @@ -44,171 +44,51 @@ namespace UnitsNet.Extensions.NumberToMassFlow { public static class NumberToMassFlowExtensions { - #region CentigramPerSecond - /// public static MassFlow CentigramsPerSecond(this T value) => MassFlow.FromCentigramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? CentigramsPerSecond(this T? value) where T : struct => MassFlow.FromCentigramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecagramPerSecond - /// public static MassFlow DecagramsPerSecond(this T value) => MassFlow.FromDecagramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? DecagramsPerSecond(this T? value) where T : struct => MassFlow.FromDecagramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecigramPerSecond - /// public static MassFlow DecigramsPerSecond(this T value) => MassFlow.FromDecigramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? DecigramsPerSecond(this T? value) where T : struct => MassFlow.FromDecigramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerSecond - /// public static MassFlow GramsPerSecond(this T value) => MassFlow.FromGramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? GramsPerSecond(this T? value) where T : struct => MassFlow.FromGramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region HectogramPerSecond - /// public static MassFlow HectogramsPerSecond(this T value) => MassFlow.FromHectogramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? HectogramsPerSecond(this T? value) where T : struct => MassFlow.FromHectogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerHour - /// public static MassFlow KilogramsPerHour(this T value) => MassFlow.FromKilogramsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? KilogramsPerHour(this T? value) where T : struct => MassFlow.FromKilogramsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerSecond - /// public static MassFlow KilogramsPerSecond(this T value) => MassFlow.FromKilogramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? KilogramsPerSecond(this T? value) where T : struct => MassFlow.FromKilogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegapoundPerHour - /// public static MassFlow MegapoundsPerHour(this T value) => MassFlow.FromMegapoundsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? MegapoundsPerHour(this T? value) where T : struct => MassFlow.FromMegapoundsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrogramPerSecond - /// public static MassFlow MicrogramsPerSecond(this T value) => MassFlow.FromMicrogramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? MicrogramsPerSecond(this T? value) where T : struct => MassFlow.FromMicrogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramPerSecond - /// public static MassFlow MilligramsPerSecond(this T value) => MassFlow.FromMilligramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? MilligramsPerSecond(this T? value) where T : struct => MassFlow.FromMilligramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanogramPerSecond - /// public static MassFlow NanogramsPerSecond(this T value) => MassFlow.FromNanogramsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? NanogramsPerSecond(this T? value) where T : struct => MassFlow.FromNanogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerHour - /// public static MassFlow PoundsPerHour(this T value) => MassFlow.FromPoundsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? PoundsPerHour(this T? value) where T : struct => MassFlow.FromPoundsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ShortTonPerHour - /// public static MassFlow ShortTonsPerHour(this T value) => MassFlow.FromShortTonsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? ShortTonsPerHour(this T? value) where T : struct => MassFlow.FromShortTonsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonnePerDay - /// public static MassFlow TonnesPerDay(this T value) => MassFlow.FromTonnesPerDay(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? TonnesPerDay(this T? value) where T : struct => MassFlow.FromTonnesPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonnePerHour - /// public static MassFlow TonnesPerHour(this T value) => MassFlow.FromTonnesPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? TonnesPerHour(this T? value) where T : struct => MassFlow.FromTonnesPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs index 08731e83a2..8a820b0508 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs @@ -44,28 +44,12 @@ namespace UnitsNet.Extensions.NumberToMassFlux { public static class NumberToMassFluxExtensions { - #region GramPerSecondPerSquareMeter - /// public static MassFlux GramsPerSecondPerSquareMeter(this T value) => MassFlux.FromGramsPerSecondPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlux? GramsPerSecondPerSquareMeter(this T? value) where T : struct => MassFlux.FromGramsPerSecondPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerSecondPerSquareMeter - /// public static MassFlux KilogramsPerSecondPerSquareMeter(this T value) => MassFlux.FromKilogramsPerSecondPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlux? KilogramsPerSecondPerSquareMeter(this T? value) where T : struct => MassFlux.FromKilogramsPerSecondPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs index 0762120e59..4f51429b4b 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs @@ -44,292 +44,84 @@ namespace UnitsNet.Extensions.NumberToMassMomentOfInertia { public static class NumberToMassMomentOfInertiaExtensions { - #region GramSquareCentimeter - /// public static MassMomentOfInertia GramSquareCentimeters(this T value) => MassMomentOfInertia.FromGramSquareCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? GramSquareCentimeters(this T? value) where T : struct => MassMomentOfInertia.FromGramSquareCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramSquareDecimeter - /// public static MassMomentOfInertia GramSquareDecimeters(this T value) => MassMomentOfInertia.FromGramSquareDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? GramSquareDecimeters(this T? value) where T : struct => MassMomentOfInertia.FromGramSquareDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramSquareMeter - /// public static MassMomentOfInertia GramSquareMeters(this T value) => MassMomentOfInertia.FromGramSquareMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? GramSquareMeters(this T? value) where T : struct => MassMomentOfInertia.FromGramSquareMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramSquareMillimeter - /// public static MassMomentOfInertia GramSquareMillimeters(this T value) => MassMomentOfInertia.FromGramSquareMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? GramSquareMillimeters(this T? value) where T : struct => MassMomentOfInertia.FromGramSquareMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramSquareCentimeter - /// public static MassMomentOfInertia KilogramSquareCentimeters(this T value) => MassMomentOfInertia.FromKilogramSquareCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilogramSquareCentimeters(this T? value) where T : struct => MassMomentOfInertia.FromKilogramSquareCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramSquareDecimeter - /// public static MassMomentOfInertia KilogramSquareDecimeters(this T value) => MassMomentOfInertia.FromKilogramSquareDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilogramSquareDecimeters(this T? value) where T : struct => MassMomentOfInertia.FromKilogramSquareDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramSquareMeter - /// public static MassMomentOfInertia KilogramSquareMeters(this T value) => MassMomentOfInertia.FromKilogramSquareMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilogramSquareMeters(this T? value) where T : struct => MassMomentOfInertia.FromKilogramSquareMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramSquareMillimeter - /// public static MassMomentOfInertia KilogramSquareMillimeters(this T value) => MassMomentOfInertia.FromKilogramSquareMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilogramSquareMillimeters(this T? value) where T : struct => MassMomentOfInertia.FromKilogramSquareMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilotonneSquareCentimeter - /// public static MassMomentOfInertia KilotonneSquareCentimeters(this T value) => MassMomentOfInertia.FromKilotonneSquareCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilotonneSquareCentimeters(this T? value) where T : struct => MassMomentOfInertia.FromKilotonneSquareCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilotonneSquareDecimeter - /// public static MassMomentOfInertia KilotonneSquareDecimeters(this T value) => MassMomentOfInertia.FromKilotonneSquareDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilotonneSquareDecimeters(this T? value) where T : struct => MassMomentOfInertia.FromKilotonneSquareDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilotonneSquareMeter - /// public static MassMomentOfInertia KilotonneSquareMeters(this T value) => MassMomentOfInertia.FromKilotonneSquareMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilotonneSquareMeters(this T? value) where T : struct => MassMomentOfInertia.FromKilotonneSquareMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilotonneSquareMilimeter - /// public static MassMomentOfInertia KilotonneSquareMilimeters(this T value) => MassMomentOfInertia.FromKilotonneSquareMilimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? KilotonneSquareMilimeters(this T? value) where T : struct => MassMomentOfInertia.FromKilotonneSquareMilimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegatonneSquareCentimeter - /// public static MassMomentOfInertia MegatonneSquareCentimeters(this T value) => MassMomentOfInertia.FromMegatonneSquareCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MegatonneSquareCentimeters(this T? value) where T : struct => MassMomentOfInertia.FromMegatonneSquareCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegatonneSquareDecimeter - /// public static MassMomentOfInertia MegatonneSquareDecimeters(this T value) => MassMomentOfInertia.FromMegatonneSquareDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MegatonneSquareDecimeters(this T? value) where T : struct => MassMomentOfInertia.FromMegatonneSquareDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegatonneSquareMeter - /// public static MassMomentOfInertia MegatonneSquareMeters(this T value) => MassMomentOfInertia.FromMegatonneSquareMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MegatonneSquareMeters(this T? value) where T : struct => MassMomentOfInertia.FromMegatonneSquareMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegatonneSquareMilimeter - /// public static MassMomentOfInertia MegatonneSquareMilimeters(this T value) => MassMomentOfInertia.FromMegatonneSquareMilimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MegatonneSquareMilimeters(this T? value) where T : struct => MassMomentOfInertia.FromMegatonneSquareMilimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramSquareCentimeter - /// public static MassMomentOfInertia MilligramSquareCentimeters(this T value) => MassMomentOfInertia.FromMilligramSquareCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MilligramSquareCentimeters(this T? value) where T : struct => MassMomentOfInertia.FromMilligramSquareCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramSquareDecimeter - /// public static MassMomentOfInertia MilligramSquareDecimeters(this T value) => MassMomentOfInertia.FromMilligramSquareDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MilligramSquareDecimeters(this T? value) where T : struct => MassMomentOfInertia.FromMilligramSquareDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramSquareMeter - /// public static MassMomentOfInertia MilligramSquareMeters(this T value) => MassMomentOfInertia.FromMilligramSquareMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MilligramSquareMeters(this T? value) where T : struct => MassMomentOfInertia.FromMilligramSquareMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramSquareMillimeter - /// public static MassMomentOfInertia MilligramSquareMillimeters(this T value) => MassMomentOfInertia.FromMilligramSquareMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? MilligramSquareMillimeters(this T? value) where T : struct => MassMomentOfInertia.FromMilligramSquareMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundSquareFoot - /// public static MassMomentOfInertia PoundSquareFeet(this T value) => MassMomentOfInertia.FromPoundSquareFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? PoundSquareFeet(this T? value) where T : struct => MassMomentOfInertia.FromPoundSquareFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundSquareInch - /// public static MassMomentOfInertia PoundSquareInches(this T value) => MassMomentOfInertia.FromPoundSquareInches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? PoundSquareInches(this T? value) where T : struct => MassMomentOfInertia.FromPoundSquareInches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneSquareCentimeter - /// public static MassMomentOfInertia TonneSquareCentimeters(this T value) => MassMomentOfInertia.FromTonneSquareCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? TonneSquareCentimeters(this T? value) where T : struct => MassMomentOfInertia.FromTonneSquareCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneSquareDecimeter - /// public static MassMomentOfInertia TonneSquareDecimeters(this T value) => MassMomentOfInertia.FromTonneSquareDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? TonneSquareDecimeters(this T? value) where T : struct => MassMomentOfInertia.FromTonneSquareDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneSquareMeter - /// public static MassMomentOfInertia TonneSquareMeters(this T value) => MassMomentOfInertia.FromTonneSquareMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? TonneSquareMeters(this T? value) where T : struct => MassMomentOfInertia.FromTonneSquareMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneSquareMilimeter - /// public static MassMomentOfInertia TonneSquareMilimeters(this T value) => MassMomentOfInertia.FromTonneSquareMilimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? TonneSquareMilimeters(this T? value) where T : struct => MassMomentOfInertia.FromTonneSquareMilimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs index bd21a01cfe..04710dbb24 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToMolarEnergy { public static class NumberToMolarEnergyExtensions { - #region JoulePerMole - /// public static MolarEnergy JoulesPerMole(this T value) => MolarEnergy.FromJoulesPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEnergy? JoulesPerMole(this T? value) where T : struct => MolarEnergy.FromJoulesPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilojoulePerMole - /// public static MolarEnergy KilojoulesPerMole(this T value) => MolarEnergy.FromKilojoulesPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEnergy? KilojoulesPerMole(this T? value) where T : struct => MolarEnergy.FromKilojoulesPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegajoulePerMole - /// public static MolarEnergy MegajoulesPerMole(this T value) => MolarEnergy.FromMegajoulesPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEnergy? MegajoulesPerMole(this T? value) where T : struct => MolarEnergy.FromMegajoulesPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs index 1585ae6298..ec727f851d 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToMolarEntropy { public static class NumberToMolarEntropyExtensions { - #region JoulePerMoleKelvin - /// public static MolarEntropy JoulesPerMoleKelvin(this T value) => MolarEntropy.FromJoulesPerMoleKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEntropy? JoulesPerMoleKelvin(this T? value) where T : struct => MolarEntropy.FromJoulesPerMoleKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilojoulePerMoleKelvin - /// public static MolarEntropy KilojoulesPerMoleKelvin(this T value) => MolarEntropy.FromKilojoulesPerMoleKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEntropy? KilojoulesPerMoleKelvin(this T? value) where T : struct => MolarEntropy.FromKilojoulesPerMoleKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegajoulePerMoleKelvin - /// public static MolarEntropy MegajoulesPerMoleKelvin(this T value) => MolarEntropy.FromMegajoulesPerMoleKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEntropy? MegajoulesPerMoleKelvin(this T? value) where T : struct => MolarEntropy.FromMegajoulesPerMoleKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs index bde7d51d10..71386056cb 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs @@ -44,138 +44,42 @@ namespace UnitsNet.Extensions.NumberToMolarMass { public static class NumberToMolarMassExtensions { - #region CentigramPerMole - /// public static MolarMass CentigramsPerMole(this T value) => MolarMass.FromCentigramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? CentigramsPerMole(this T? value) where T : struct => MolarMass.FromCentigramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecagramPerMole - /// public static MolarMass DecagramsPerMole(this T value) => MolarMass.FromDecagramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? DecagramsPerMole(this T? value) where T : struct => MolarMass.FromDecagramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecigramPerMole - /// public static MolarMass DecigramsPerMole(this T value) => MolarMass.FromDecigramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? DecigramsPerMole(this T? value) where T : struct => MolarMass.FromDecigramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerMole - /// public static MolarMass GramsPerMole(this T value) => MolarMass.FromGramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? GramsPerMole(this T? value) where T : struct => MolarMass.FromGramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region HectogramPerMole - /// public static MolarMass HectogramsPerMole(this T value) => MolarMass.FromHectogramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? HectogramsPerMole(this T? value) where T : struct => MolarMass.FromHectogramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerMole - /// public static MolarMass KilogramsPerMole(this T value) => MolarMass.FromKilogramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? KilogramsPerMole(this T? value) where T : struct => MolarMass.FromKilogramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundPerMole - /// public static MolarMass KilopoundsPerMole(this T value) => MolarMass.FromKilopoundsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? KilopoundsPerMole(this T? value) where T : struct => MolarMass.FromKilopoundsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegapoundPerMole - /// public static MolarMass MegapoundsPerMole(this T value) => MolarMass.FromMegapoundsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? MegapoundsPerMole(this T? value) where T : struct => MolarMass.FromMegapoundsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrogramPerMole - /// public static MolarMass MicrogramsPerMole(this T value) => MolarMass.FromMicrogramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? MicrogramsPerMole(this T? value) where T : struct => MolarMass.FromMicrogramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramPerMole - /// public static MolarMass MilligramsPerMole(this T value) => MolarMass.FromMilligramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? MilligramsPerMole(this T? value) where T : struct => MolarMass.FromMilligramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanogramPerMole - /// public static MolarMass NanogramsPerMole(this T value) => MolarMass.FromNanogramsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? NanogramsPerMole(this T? value) where T : struct => MolarMass.FromNanogramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerMole - /// public static MolarMass PoundsPerMole(this T value) => MolarMass.FromPoundsPerMole(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? PoundsPerMole(this T? value) where T : struct => MolarMass.FromPoundsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs index e8a9e7d2e1..1ac5579802 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs @@ -44,94 +44,30 @@ namespace UnitsNet.Extensions.NumberToMolarity { public static class NumberToMolarityExtensions { - #region CentimolesPerLiter - /// public static Molarity CentimolesPerLiter(this T value) => Molarity.FromCentimolesPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? CentimolesPerLiter(this T? value) where T : struct => Molarity.FromCentimolesPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecimolesPerLiter - /// public static Molarity DecimolesPerLiter(this T value) => Molarity.FromDecimolesPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? DecimolesPerLiter(this T? value) where T : struct => Molarity.FromDecimolesPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicromolesPerLiter - /// public static Molarity MicromolesPerLiter(this T value) => Molarity.FromMicromolesPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? MicromolesPerLiter(this T? value) where T : struct => Molarity.FromMicromolesPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillimolesPerLiter - /// public static Molarity MillimolesPerLiter(this T value) => Molarity.FromMillimolesPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? MillimolesPerLiter(this T? value) where T : struct => Molarity.FromMillimolesPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MolesPerCubicMeter - /// public static Molarity MolesPerCubicMeter(this T value) => Molarity.FromMolesPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? MolesPerCubicMeter(this T? value) where T : struct => Molarity.FromMolesPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MolesPerLiter - /// public static Molarity MolesPerLiter(this T value) => Molarity.FromMolesPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? MolesPerLiter(this T? value) where T : struct => Molarity.FromMolesPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanomolesPerLiter - /// public static Molarity NanomolesPerLiter(this T value) => Molarity.FromNanomolesPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? NanomolesPerLiter(this T? value) where T : struct => Molarity.FromNanomolesPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicomolesPerLiter - /// public static Molarity PicomolesPerLiter(this T value) => Molarity.FromPicomolesPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? PicomolesPerLiter(this T? value) where T : struct => Molarity.FromPicomolesPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs index e098fc24ea..823d428c34 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToPermeability { public static class NumberToPermeabilityExtensions { - #region HenryPerMeter - /// public static Permeability HenriesPerMeter(this T value) => Permeability.FromHenriesPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Permeability? HenriesPerMeter(this T? value) where T : struct => Permeability.FromHenriesPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs index 8744ae9a5f..647088a5c1 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToPermittivity { public static class NumberToPermittivityExtensions { - #region FaradPerMeter - /// public static Permittivity FaradsPerMeter(this T value) => Permittivity.FromFaradsPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Permittivity? FaradsPerMeter(this T? value) where T : struct => Permittivity.FromFaradsPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs index fdf6c889f3..e6ed64ac9f 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs @@ -44,490 +44,138 @@ namespace UnitsNet.Extensions.NumberToPowerDensity { public static class NumberToPowerDensityExtensions { - #region DecawattPerCubicFoot - /// public static PowerDensity DecawattsPerCubicFoot(this T value) => PowerDensity.FromDecawattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DecawattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromDecawattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecawattPerCubicInch - /// public static PowerDensity DecawattsPerCubicInch(this T value) => PowerDensity.FromDecawattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DecawattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromDecawattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecawattPerCubicMeter - /// public static PowerDensity DecawattsPerCubicMeter(this T value) => PowerDensity.FromDecawattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DecawattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromDecawattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecawattPerLiter - /// public static PowerDensity DecawattsPerLiter(this T value) => PowerDensity.FromDecawattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DecawattsPerLiter(this T? value) where T : struct => PowerDensity.FromDecawattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DeciwattPerCubicFoot - /// public static PowerDensity DeciwattsPerCubicFoot(this T value) => PowerDensity.FromDeciwattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DeciwattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromDeciwattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DeciwattPerCubicInch - /// public static PowerDensity DeciwattsPerCubicInch(this T value) => PowerDensity.FromDeciwattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DeciwattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromDeciwattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DeciwattPerCubicMeter - /// public static PowerDensity DeciwattsPerCubicMeter(this T value) => PowerDensity.FromDeciwattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DeciwattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromDeciwattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DeciwattPerLiter - /// public static PowerDensity DeciwattsPerLiter(this T value) => PowerDensity.FromDeciwattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? DeciwattsPerLiter(this T? value) where T : struct => PowerDensity.FromDeciwattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigawattPerCubicFoot - /// public static PowerDensity GigawattsPerCubicFoot(this T value) => PowerDensity.FromGigawattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? GigawattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromGigawattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigawattPerCubicInch - /// public static PowerDensity GigawattsPerCubicInch(this T value) => PowerDensity.FromGigawattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? GigawattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromGigawattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigawattPerCubicMeter - /// public static PowerDensity GigawattsPerCubicMeter(this T value) => PowerDensity.FromGigawattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? GigawattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromGigawattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GigawattPerLiter - /// public static PowerDensity GigawattsPerLiter(this T value) => PowerDensity.FromGigawattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? GigawattsPerLiter(this T? value) where T : struct => PowerDensity.FromGigawattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattPerCubicFoot - /// public static PowerDensity KilowattsPerCubicFoot(this T value) => PowerDensity.FromKilowattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? KilowattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromKilowattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattPerCubicInch - /// public static PowerDensity KilowattsPerCubicInch(this T value) => PowerDensity.FromKilowattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? KilowattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromKilowattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattPerCubicMeter - /// public static PowerDensity KilowattsPerCubicMeter(this T value) => PowerDensity.FromKilowattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? KilowattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromKilowattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattPerLiter - /// public static PowerDensity KilowattsPerLiter(this T value) => PowerDensity.FromKilowattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? KilowattsPerLiter(this T? value) where T : struct => PowerDensity.FromKilowattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegawattPerCubicFoot - /// public static PowerDensity MegawattsPerCubicFoot(this T value) => PowerDensity.FromMegawattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MegawattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromMegawattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegawattPerCubicInch - /// public static PowerDensity MegawattsPerCubicInch(this T value) => PowerDensity.FromMegawattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MegawattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromMegawattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegawattPerCubicMeter - /// public static PowerDensity MegawattsPerCubicMeter(this T value) => PowerDensity.FromMegawattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MegawattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromMegawattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegawattPerLiter - /// public static PowerDensity MegawattsPerLiter(this T value) => PowerDensity.FromMegawattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MegawattsPerLiter(this T? value) where T : struct => PowerDensity.FromMegawattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrowattPerCubicFoot - /// public static PowerDensity MicrowattsPerCubicFoot(this T value) => PowerDensity.FromMicrowattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MicrowattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromMicrowattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrowattPerCubicInch - /// public static PowerDensity MicrowattsPerCubicInch(this T value) => PowerDensity.FromMicrowattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MicrowattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromMicrowattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrowattPerCubicMeter - /// public static PowerDensity MicrowattsPerCubicMeter(this T value) => PowerDensity.FromMicrowattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MicrowattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromMicrowattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrowattPerLiter - /// public static PowerDensity MicrowattsPerLiter(this T value) => PowerDensity.FromMicrowattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MicrowattsPerLiter(this T? value) where T : struct => PowerDensity.FromMicrowattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilliwattPerCubicFoot - /// public static PowerDensity MilliwattsPerCubicFoot(this T value) => PowerDensity.FromMilliwattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MilliwattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromMilliwattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilliwattPerCubicInch - /// public static PowerDensity MilliwattsPerCubicInch(this T value) => PowerDensity.FromMilliwattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MilliwattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromMilliwattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilliwattPerCubicMeter - /// public static PowerDensity MilliwattsPerCubicMeter(this T value) => PowerDensity.FromMilliwattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MilliwattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromMilliwattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilliwattPerLiter - /// public static PowerDensity MilliwattsPerLiter(this T value) => PowerDensity.FromMilliwattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? MilliwattsPerLiter(this T? value) where T : struct => PowerDensity.FromMilliwattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanowattPerCubicFoot - /// public static PowerDensity NanowattsPerCubicFoot(this T value) => PowerDensity.FromNanowattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? NanowattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromNanowattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanowattPerCubicInch - /// public static PowerDensity NanowattsPerCubicInch(this T value) => PowerDensity.FromNanowattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? NanowattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromNanowattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanowattPerCubicMeter - /// public static PowerDensity NanowattsPerCubicMeter(this T value) => PowerDensity.FromNanowattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? NanowattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromNanowattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanowattPerLiter - /// public static PowerDensity NanowattsPerLiter(this T value) => PowerDensity.FromNanowattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? NanowattsPerLiter(this T? value) where T : struct => PowerDensity.FromNanowattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicowattPerCubicFoot - /// public static PowerDensity PicowattsPerCubicFoot(this T value) => PowerDensity.FromPicowattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? PicowattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromPicowattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicowattPerCubicInch - /// public static PowerDensity PicowattsPerCubicInch(this T value) => PowerDensity.FromPicowattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? PicowattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromPicowattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicowattPerCubicMeter - /// public static PowerDensity PicowattsPerCubicMeter(this T value) => PowerDensity.FromPicowattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? PicowattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromPicowattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PicowattPerLiter - /// public static PowerDensity PicowattsPerLiter(this T value) => PowerDensity.FromPicowattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? PicowattsPerLiter(this T? value) where T : struct => PowerDensity.FromPicowattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TerawattPerCubicFoot - /// public static PowerDensity TerawattsPerCubicFoot(this T value) => PowerDensity.FromTerawattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? TerawattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromTerawattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TerawattPerCubicInch - /// public static PowerDensity TerawattsPerCubicInch(this T value) => PowerDensity.FromTerawattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? TerawattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromTerawattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TerawattPerCubicMeter - /// public static PowerDensity TerawattsPerCubicMeter(this T value) => PowerDensity.FromTerawattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? TerawattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromTerawattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TerawattPerLiter - /// public static PowerDensity TerawattsPerLiter(this T value) => PowerDensity.FromTerawattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? TerawattsPerLiter(this T? value) where T : struct => PowerDensity.FromTerawattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerCubicFoot - /// public static PowerDensity WattsPerCubicFoot(this T value) => PowerDensity.FromWattsPerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? WattsPerCubicFoot(this T? value) where T : struct => PowerDensity.FromWattsPerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerCubicInch - /// public static PowerDensity WattsPerCubicInch(this T value) => PowerDensity.FromWattsPerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? WattsPerCubicInch(this T? value) where T : struct => PowerDensity.FromWattsPerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerCubicMeter - /// public static PowerDensity WattsPerCubicMeter(this T value) => PowerDensity.FromWattsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? WattsPerCubicMeter(this T? value) where T : struct => PowerDensity.FromWattsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerLiter - /// public static PowerDensity WattsPerLiter(this T value) => PowerDensity.FromWattsPerLiter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? WattsPerLiter(this T? value) where T : struct => PowerDensity.FromWattsPerLiter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs index 6b787f7371..9de02cb592 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs @@ -44,226 +44,66 @@ namespace UnitsNet.Extensions.NumberToPower { public static class NumberToPowerExtensions { - #region BoilerHorsepower - /// public static Power BoilerHorsepower(this T value) => Power.FromBoilerHorsepower(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? BoilerHorsepower(this T? value) where T : struct => Power.FromBoilerHorsepower(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region BritishThermalUnitPerHour - /// public static Power BritishThermalUnitsPerHour(this T value) => Power.FromBritishThermalUnitsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? BritishThermalUnitsPerHour(this T? value) where T : struct => Power.FromBritishThermalUnitsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decawatt - /// public static Power Decawatts(this T value) => Power.FromDecawatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Decawatts(this T? value) where T : struct => Power.FromDecawatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Deciwatt - /// public static Power Deciwatts(this T value) => Power.FromDeciwatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Deciwatts(this T? value) where T : struct => Power.FromDeciwatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ElectricalHorsepower - /// public static Power ElectricalHorsepower(this T value) => Power.FromElectricalHorsepower(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? ElectricalHorsepower(this T? value) where T : struct => Power.FromElectricalHorsepower(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Femtowatt - /// public static Power Femtowatts(this T value) => Power.FromFemtowatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Femtowatts(this T? value) where T : struct => Power.FromFemtowatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gigawatt - /// public static Power Gigawatts(this T value) => Power.FromGigawatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Gigawatts(this T? value) where T : struct => Power.FromGigawatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region HydraulicHorsepower - /// public static Power HydraulicHorsepower(this T value) => Power.FromHydraulicHorsepower(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? HydraulicHorsepower(this T? value) where T : struct => Power.FromHydraulicHorsepower(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilobritishThermalUnitPerHour - /// public static Power KilobritishThermalUnitsPerHour(this T value) => Power.FromKilobritishThermalUnitsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? KilobritishThermalUnitsPerHour(this T? value) where T : struct => Power.FromKilobritishThermalUnitsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilowatt - /// public static Power Kilowatts(this T value) => Power.FromKilowatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Kilowatts(this T? value) where T : struct => Power.FromKilowatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MechanicalHorsepower - /// public static Power MechanicalHorsepower(this T value) => Power.FromMechanicalHorsepower(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? MechanicalHorsepower(this T? value) where T : struct => Power.FromMechanicalHorsepower(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megawatt - /// public static Power Megawatts(this T value) => Power.FromMegawatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Megawatts(this T? value) where T : struct => Power.FromMegawatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MetricHorsepower - /// public static Power MetricHorsepower(this T value) => Power.FromMetricHorsepower(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? MetricHorsepower(this T? value) where T : struct => Power.FromMetricHorsepower(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microwatt - /// public static Power Microwatts(this T value) => Power.FromMicrowatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Microwatts(this T? value) where T : struct => Power.FromMicrowatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Milliwatt - /// public static Power Milliwatts(this T value) => Power.FromMilliwatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Milliwatts(this T? value) where T : struct => Power.FromMilliwatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Nanowatt - /// public static Power Nanowatts(this T value) => Power.FromNanowatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Nanowatts(this T? value) where T : struct => Power.FromNanowatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Petawatt - /// public static Power Petawatts(this T value) => Power.FromPetawatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Petawatts(this T? value) where T : struct => Power.FromPetawatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Picowatt - /// public static Power Picowatts(this T value) => Power.FromPicowatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Picowatts(this T? value) where T : struct => Power.FromPicowatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Terawatt - /// public static Power Terawatts(this T value) => Power.FromTerawatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Terawatts(this T? value) where T : struct => Power.FromTerawatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Watt - /// public static Power Watts(this T value) => Power.FromWatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? Watts(this T? value) where T : struct => Power.FromWatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs index df98da38e2..996e47fbd5 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs @@ -44,28 +44,12 @@ namespace UnitsNet.Extensions.NumberToPowerRatio { public static class NumberToPowerRatioExtensions { - #region DecibelMilliwatt - /// public static PowerRatio DecibelMilliwatts(this T value) => PowerRatio.FromDecibelMilliwatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerRatio? DecibelMilliwatts(this T? value) where T : struct => PowerRatio.FromDecibelMilliwatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecibelWatt - /// public static PowerRatio DecibelWatts(this T value) => PowerRatio.FromDecibelWatts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerRatio? DecibelWatts(this T? value) where T : struct => PowerRatio.FromDecibelWatts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs index afb087b144..380cdb9cce 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToPressureChangeRate { public static class NumberToPressureChangeRateExtensions { - #region AtmospherePerSecond - /// public static PressureChangeRate AtmospheresPerSecond(this T value) => PressureChangeRate.FromAtmospheresPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PressureChangeRate? AtmospheresPerSecond(this T? value) where T : struct => PressureChangeRate.FromAtmospheresPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopascalPerSecond - /// public static PressureChangeRate KilopascalsPerSecond(this T value) => PressureChangeRate.FromKilopascalsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PressureChangeRate? KilopascalsPerSecond(this T? value) where T : struct => PressureChangeRate.FromKilopascalsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegapascalPerSecond - /// public static PressureChangeRate MegapascalsPerSecond(this T value) => PressureChangeRate.FromMegapascalsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PressureChangeRate? MegapascalsPerSecond(this T? value) where T : struct => PressureChangeRate.FromMegapascalsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PascalPerSecond - /// public static PressureChangeRate PascalsPerSecond(this T value) => PressureChangeRate.FromPascalsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PressureChangeRate? PascalsPerSecond(this T? value) where T : struct => PressureChangeRate.FromPascalsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs index 3a81e40518..fce5c27b14 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs @@ -44,425 +44,121 @@ namespace UnitsNet.Extensions.NumberToPressure { public static class NumberToPressureExtensions { - #region Atmosphere - /// public static Pressure Atmospheres(this T value) => Pressure.FromAtmospheres(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Atmospheres(this T? value) where T : struct => Pressure.FromAtmospheres(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Bar - /// public static Pressure Bars(this T value) => Pressure.FromBars(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Bars(this T? value) where T : struct => Pressure.FromBars(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Centibar - /// public static Pressure Centibars(this T value) => Pressure.FromCentibars(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Centibars(this T? value) where T : struct => Pressure.FromCentibars(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decapascal - /// public static Pressure Decapascals(this T value) => Pressure.FromDecapascals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Decapascals(this T? value) where T : struct => Pressure.FromDecapascals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Decibar - /// public static Pressure Decibars(this T value) => Pressure.FromDecibars(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Decibars(this T? value) where T : struct => Pressure.FromDecibars(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region FootOfHead - /// public static Pressure FeetOfHead(this T value) => Pressure.FromFeetOfHead(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? FeetOfHead(this T? value) where T : struct => Pressure.FromFeetOfHead(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Gigapascal - /// public static Pressure Gigapascals(this T value) => Pressure.FromGigapascals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Gigapascals(this T? value) where T : struct => Pressure.FromGigapascals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Hectopascal - /// public static Pressure Hectopascals(this T value) => Pressure.FromHectopascals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Hectopascals(this T? value) where T : struct => Pressure.FromHectopascals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region InchOfMercury - /// public static Pressure InchesOfMercury(this T value) => Pressure.FromInchesOfMercury(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? InchesOfMercury(this T? value) where T : struct => Pressure.FromInchesOfMercury(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilobar - /// public static Pressure Kilobars(this T value) => Pressure.FromKilobars(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Kilobars(this T? value) where T : struct => Pressure.FromKilobars(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForcePerSquareCentimeter - /// public static Pressure KilogramsForcePerSquareCentimeter(this T value) => Pressure.FromKilogramsForcePerSquareCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilogramsForcePerSquareCentimeter(this T? value) where T : struct => Pressure.FromKilogramsForcePerSquareCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForcePerSquareMeter - /// public static Pressure KilogramsForcePerSquareMeter(this T value) => Pressure.FromKilogramsForcePerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilogramsForcePerSquareMeter(this T? value) where T : struct => Pressure.FromKilogramsForcePerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForcePerSquareMillimeter - /// public static Pressure KilogramsForcePerSquareMillimeter(this T value) => Pressure.FromKilogramsForcePerSquareMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilogramsForcePerSquareMillimeter(this T? value) where T : struct => Pressure.FromKilogramsForcePerSquareMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerSquareCentimeter - /// public static Pressure KilonewtonsPerSquareCentimeter(this T value) => Pressure.FromKilonewtonsPerSquareCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilonewtonsPerSquareCentimeter(this T? value) where T : struct => Pressure.FromKilonewtonsPerSquareCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerSquareMeter - /// public static Pressure KilonewtonsPerSquareMeter(this T value) => Pressure.FromKilonewtonsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilonewtonsPerSquareMeter(this T? value) where T : struct => Pressure.FromKilonewtonsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerSquareMillimeter - /// public static Pressure KilonewtonsPerSquareMillimeter(this T value) => Pressure.FromKilonewtonsPerSquareMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilonewtonsPerSquareMillimeter(this T? value) where T : struct => Pressure.FromKilonewtonsPerSquareMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kilopascal - /// public static Pressure Kilopascals(this T value) => Pressure.FromKilopascals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Kilopascals(this T? value) where T : struct => Pressure.FromKilopascals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundForcePerSquareFoot - /// public static Pressure KilopoundsForcePerSquareFoot(this T value) => Pressure.FromKilopoundsForcePerSquareFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilopoundsForcePerSquareFoot(this T? value) where T : struct => Pressure.FromKilopoundsForcePerSquareFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundForcePerSquareInch - /// public static Pressure KilopoundsForcePerSquareInch(this T value) => Pressure.FromKilopoundsForcePerSquareInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? KilopoundsForcePerSquareInch(this T? value) where T : struct => Pressure.FromKilopoundsForcePerSquareInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megabar - /// public static Pressure Megabars(this T value) => Pressure.FromMegabars(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Megabars(this T? value) where T : struct => Pressure.FromMegabars(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonPerSquareMeter - /// public static Pressure MeganewtonsPerSquareMeter(this T value) => Pressure.FromMeganewtonsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? MeganewtonsPerSquareMeter(this T? value) where T : struct => Pressure.FromMeganewtonsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Megapascal - /// public static Pressure Megapascals(this T value) => Pressure.FromMegapascals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Megapascals(this T? value) where T : struct => Pressure.FromMegapascals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeterOfHead - /// public static Pressure MetersOfHead(this T value) => Pressure.FromMetersOfHead(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? MetersOfHead(this T? value) where T : struct => Pressure.FromMetersOfHead(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Micropascal - /// public static Pressure Micropascals(this T value) => Pressure.FromMicropascals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Micropascals(this T? value) where T : struct => Pressure.FromMicropascals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Millibar - /// public static Pressure Millibars(this T value) => Pressure.FromMillibars(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Millibars(this T? value) where T : struct => Pressure.FromMillibars(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillimeterOfMercury - /// public static Pressure MillimetersOfMercury(this T value) => Pressure.FromMillimetersOfMercury(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? MillimetersOfMercury(this T? value) where T : struct => Pressure.FromMillimetersOfMercury(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerSquareCentimeter - /// public static Pressure NewtonsPerSquareCentimeter(this T value) => Pressure.FromNewtonsPerSquareCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? NewtonsPerSquareCentimeter(this T? value) where T : struct => Pressure.FromNewtonsPerSquareCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerSquareMeter - /// public static Pressure NewtonsPerSquareMeter(this T value) => Pressure.FromNewtonsPerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? NewtonsPerSquareMeter(this T? value) where T : struct => Pressure.FromNewtonsPerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerSquareMillimeter - /// public static Pressure NewtonsPerSquareMillimeter(this T value) => Pressure.FromNewtonsPerSquareMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? NewtonsPerSquareMillimeter(this T? value) where T : struct => Pressure.FromNewtonsPerSquareMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Pascal - /// public static Pressure Pascals(this T value) => Pressure.FromPascals(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Pascals(this T? value) where T : struct => Pressure.FromPascals(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundForcePerSquareFoot - /// public static Pressure PoundsForcePerSquareFoot(this T value) => Pressure.FromPoundsForcePerSquareFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? PoundsForcePerSquareFoot(this T? value) where T : struct => Pressure.FromPoundsForcePerSquareFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundForcePerSquareInch - /// public static Pressure PoundsForcePerSquareInch(this T value) => Pressure.FromPoundsForcePerSquareInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? PoundsForcePerSquareInch(this T? value) where T : struct => Pressure.FromPoundsForcePerSquareInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Psi - /// [System.Obsolete("Deprecated due to github issue #215, please use PoundForcePerSquareInch instead")] public static Pressure Psi(this T value) => Pressure.FromPsi(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Psi(this T? value) where T : struct => Pressure.FromPsi(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TechnicalAtmosphere - /// public static Pressure TechnicalAtmospheres(this T value) => Pressure.FromTechnicalAtmospheres(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? TechnicalAtmospheres(this T? value) where T : struct => Pressure.FromTechnicalAtmospheres(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForcePerSquareCentimeter - /// public static Pressure TonnesForcePerSquareCentimeter(this T value) => Pressure.FromTonnesForcePerSquareCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? TonnesForcePerSquareCentimeter(this T? value) where T : struct => Pressure.FromTonnesForcePerSquareCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForcePerSquareMeter - /// public static Pressure TonnesForcePerSquareMeter(this T value) => Pressure.FromTonnesForcePerSquareMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? TonnesForcePerSquareMeter(this T? value) where T : struct => Pressure.FromTonnesForcePerSquareMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForcePerSquareMillimeter - /// public static Pressure TonnesForcePerSquareMillimeter(this T value) => Pressure.FromTonnesForcePerSquareMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? TonnesForcePerSquareMillimeter(this T? value) where T : struct => Pressure.FromTonnesForcePerSquareMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Torr - /// public static Pressure Torrs(this T value) => Pressure.FromTorrs(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? Torrs(this T? value) where T : struct => Pressure.FromTorrs(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs index 470f763f82..5d33244679 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs @@ -44,72 +44,24 @@ namespace UnitsNet.Extensions.NumberToRatio { public static class NumberToRatioExtensions { - #region DecimalFraction - /// public static Ratio DecimalFractions(this T value) => Ratio.FromDecimalFractions(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Ratio? DecimalFractions(this T? value) where T : struct => Ratio.FromDecimalFractions(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PartPerBillion - /// public static Ratio PartsPerBillion(this T value) => Ratio.FromPartsPerBillion(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Ratio? PartsPerBillion(this T? value) where T : struct => Ratio.FromPartsPerBillion(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PartPerMillion - /// public static Ratio PartsPerMillion(this T value) => Ratio.FromPartsPerMillion(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Ratio? PartsPerMillion(this T? value) where T : struct => Ratio.FromPartsPerMillion(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PartPerThousand - /// public static Ratio PartsPerThousand(this T value) => Ratio.FromPartsPerThousand(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Ratio? PartsPerThousand(this T? value) where T : struct => Ratio.FromPartsPerThousand(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PartPerTrillion - /// public static Ratio PartsPerTrillion(this T value) => Ratio.FromPartsPerTrillion(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Ratio? PartsPerTrillion(this T? value) where T : struct => Ratio.FromPartsPerTrillion(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Percent - /// public static Ratio Percent(this T value) => Ratio.FromPercent(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Ratio? Percent(this T? value) where T : struct => Ratio.FromPercent(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs index 9a4594afc3..9154910452 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToReactiveEnergy { public static class NumberToReactiveEnergyExtensions { - #region KilovoltampereReactiveHour - /// public static ReactiveEnergy KilovoltampereReactiveHours(this T value) => ReactiveEnergy.FromKilovoltampereReactiveHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactiveEnergy? KilovoltampereReactiveHours(this T? value) where T : struct => ReactiveEnergy.FromKilovoltampereReactiveHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegavoltampereReactiveHour - /// public static ReactiveEnergy MegavoltampereReactiveHours(this T value) => ReactiveEnergy.FromMegavoltampereReactiveHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactiveEnergy? MegavoltampereReactiveHours(this T? value) where T : struct => ReactiveEnergy.FromMegavoltampereReactiveHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region VoltampereReactiveHour - /// public static ReactiveEnergy VoltampereReactiveHours(this T value) => ReactiveEnergy.FromVoltampereReactiveHours(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactiveEnergy? VoltampereReactiveHours(this T? value) where T : struct => ReactiveEnergy.FromVoltampereReactiveHours(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs index 89d6b7f589..efb9839777 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs @@ -44,50 +44,18 @@ namespace UnitsNet.Extensions.NumberToReactivePower { public static class NumberToReactivePowerExtensions { - #region GigavoltampereReactive - /// public static ReactivePower GigavoltamperesReactive(this T value) => ReactivePower.FromGigavoltamperesReactive(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactivePower? GigavoltamperesReactive(this T? value) where T : struct => ReactivePower.FromGigavoltamperesReactive(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilovoltampereReactive - /// public static ReactivePower KilovoltamperesReactive(this T value) => ReactivePower.FromKilovoltamperesReactive(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactivePower? KilovoltamperesReactive(this T? value) where T : struct => ReactivePower.FromKilovoltamperesReactive(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegavoltampereReactive - /// public static ReactivePower MegavoltamperesReactive(this T value) => ReactivePower.FromMegavoltamperesReactive(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactivePower? MegavoltamperesReactive(this T? value) where T : struct => ReactivePower.FromMegavoltamperesReactive(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region VoltampereReactive - /// public static ReactivePower VoltamperesReactive(this T value) => ReactivePower.FromVoltamperesReactive(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactivePower? VoltamperesReactive(this T? value) where T : struct => ReactivePower.FromVoltamperesReactive(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs index 68b257bddd..d8643581a7 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToRotationalAcceleration { public static class NumberToRotationalAccelerationExtensions { - #region DegreePerSecondSquared - /// public static RotationalAcceleration DegreesPerSecondSquared(this T value) => RotationalAcceleration.FromDegreesPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalAcceleration? DegreesPerSecondSquared(this T? value) where T : struct => RotationalAcceleration.FromDegreesPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region RadianPerSecondSquared - /// public static RotationalAcceleration RadiansPerSecondSquared(this T value) => RotationalAcceleration.FromRadiansPerSecondSquared(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalAcceleration? RadiansPerSecondSquared(this T? value) where T : struct => RotationalAcceleration.FromRadiansPerSecondSquared(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region RevolutionPerMinutePerSecond - /// public static RotationalAcceleration RevolutionsPerMinutePerSecond(this T value) => RotationalAcceleration.FromRevolutionsPerMinutePerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalAcceleration? RevolutionsPerMinutePerSecond(this T? value) where T : struct => RotationalAcceleration.FromRevolutionsPerMinutePerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs index f0512ae33d..005f9ab145 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs @@ -44,149 +44,45 @@ namespace UnitsNet.Extensions.NumberToRotationalSpeed { public static class NumberToRotationalSpeedExtensions { - #region CentiradianPerSecond - /// public static RotationalSpeed CentiradiansPerSecond(this T value) => RotationalSpeed.FromCentiradiansPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? CentiradiansPerSecond(this T? value) where T : struct => RotationalSpeed.FromCentiradiansPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DeciradianPerSecond - /// public static RotationalSpeed DeciradiansPerSecond(this T value) => RotationalSpeed.FromDeciradiansPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? DeciradiansPerSecond(this T? value) where T : struct => RotationalSpeed.FromDeciradiansPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreePerMinute - /// public static RotationalSpeed DegreesPerMinute(this T value) => RotationalSpeed.FromDegreesPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? DegreesPerMinute(this T? value) where T : struct => RotationalSpeed.FromDegreesPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreePerSecond - /// public static RotationalSpeed DegreesPerSecond(this T value) => RotationalSpeed.FromDegreesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? DegreesPerSecond(this T? value) where T : struct => RotationalSpeed.FromDegreesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrodegreePerSecond - /// public static RotationalSpeed MicrodegreesPerSecond(this T value) => RotationalSpeed.FromMicrodegreesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? MicrodegreesPerSecond(this T? value) where T : struct => RotationalSpeed.FromMicrodegreesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicroradianPerSecond - /// public static RotationalSpeed MicroradiansPerSecond(this T value) => RotationalSpeed.FromMicroradiansPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? MicroradiansPerSecond(this T? value) where T : struct => RotationalSpeed.FromMicroradiansPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillidegreePerSecond - /// public static RotationalSpeed MillidegreesPerSecond(this T value) => RotationalSpeed.FromMillidegreesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? MillidegreesPerSecond(this T? value) where T : struct => RotationalSpeed.FromMillidegreesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilliradianPerSecond - /// public static RotationalSpeed MilliradiansPerSecond(this T value) => RotationalSpeed.FromMilliradiansPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? MilliradiansPerSecond(this T? value) where T : struct => RotationalSpeed.FromMilliradiansPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanodegreePerSecond - /// public static RotationalSpeed NanodegreesPerSecond(this T value) => RotationalSpeed.FromNanodegreesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? NanodegreesPerSecond(this T? value) where T : struct => RotationalSpeed.FromNanodegreesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanoradianPerSecond - /// public static RotationalSpeed NanoradiansPerSecond(this T value) => RotationalSpeed.FromNanoradiansPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? NanoradiansPerSecond(this T? value) where T : struct => RotationalSpeed.FromNanoradiansPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region RadianPerSecond - /// public static RotationalSpeed RadiansPerSecond(this T value) => RotationalSpeed.FromRadiansPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? RadiansPerSecond(this T? value) where T : struct => RotationalSpeed.FromRadiansPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region RevolutionPerMinute - /// public static RotationalSpeed RevolutionsPerMinute(this T value) => RotationalSpeed.FromRevolutionsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? RevolutionsPerMinute(this T? value) where T : struct => RotationalSpeed.FromRevolutionsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region RevolutionPerSecond - /// public static RotationalSpeed RevolutionsPerSecond(this T value) => RotationalSpeed.FromRevolutionsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? RevolutionsPerSecond(this T? value) where T : struct => RotationalSpeed.FromRevolutionsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs index 25d863aac9..36e2e3d4ab 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToRotationalStiffness { public static class NumberToRotationalStiffnessExtensions { - #region KilonewtonMeterPerRadian - /// public static RotationalStiffness KilonewtonMetersPerRadian(this T value) => RotationalStiffness.FromKilonewtonMetersPerRadian(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffness? KilonewtonMetersPerRadian(this T? value) where T : struct => RotationalStiffness.FromKilonewtonMetersPerRadian(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonMeterPerRadian - /// public static RotationalStiffness MeganewtonMetersPerRadian(this T value) => RotationalStiffness.FromMeganewtonMetersPerRadian(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffness? MeganewtonMetersPerRadian(this T? value) where T : struct => RotationalStiffness.FromMeganewtonMetersPerRadian(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonMeterPerRadian - /// public static RotationalStiffness NewtonMetersPerRadian(this T value) => RotationalStiffness.FromNewtonMetersPerRadian(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffness? NewtonMetersPerRadian(this T? value) where T : struct => RotationalStiffness.FromNewtonMetersPerRadian(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs index d8891117ff..972c49dac1 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs @@ -44,39 +44,15 @@ namespace UnitsNet.Extensions.NumberToRotationalStiffnessPerLength { public static class NumberToRotationalStiffnessPerLengthExtensions { - #region KilonewtonMeterPerRadianPerMeter - /// public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this T value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffnessPerLength? KilonewtonMetersPerRadianPerMeter(this T? value) where T : struct => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonMeterPerRadianPerMeter - /// public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this T value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffnessPerLength? MeganewtonMetersPerRadianPerMeter(this T? value) where T : struct => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonMeterPerRadianPerMeter - /// public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this T value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffnessPerLength? NewtonMetersPerRadianPerMeter(this T? value) where T : struct => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs index b960b70ba1..ee15ab2fcf 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToSolidAngle { public static class NumberToSolidAngleExtensions { - #region Steradian - /// public static SolidAngle Steradians(this T value) => SolidAngle.FromSteradians(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SolidAngle? Steradians(this T? value) where T : struct => SolidAngle.FromSteradians(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs index 873ffd7db8..eedb73e55d 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs @@ -44,94 +44,30 @@ namespace UnitsNet.Extensions.NumberToSpecificEnergy { public static class NumberToSpecificEnergyExtensions { - #region CaloriePerGram - /// public static SpecificEnergy CaloriesPerGram(this T value) => SpecificEnergy.FromCaloriesPerGram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? CaloriesPerGram(this T? value) where T : struct => SpecificEnergy.FromCaloriesPerGram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region JoulePerKilogram - /// public static SpecificEnergy JoulesPerKilogram(this T value) => SpecificEnergy.FromJoulesPerKilogram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? JoulesPerKilogram(this T? value) where T : struct => SpecificEnergy.FromJoulesPerKilogram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilocaloriePerGram - /// public static SpecificEnergy KilocaloriesPerGram(this T value) => SpecificEnergy.FromKilocaloriesPerGram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? KilocaloriesPerGram(this T? value) where T : struct => SpecificEnergy.FromKilocaloriesPerGram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilojoulePerKilogram - /// public static SpecificEnergy KilojoulesPerKilogram(this T value) => SpecificEnergy.FromKilojoulesPerKilogram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? KilojoulesPerKilogram(this T? value) where T : struct => SpecificEnergy.FromKilojoulesPerKilogram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilowattHourPerKilogram - /// public static SpecificEnergy KilowattHoursPerKilogram(this T value) => SpecificEnergy.FromKilowattHoursPerKilogram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? KilowattHoursPerKilogram(this T? value) where T : struct => SpecificEnergy.FromKilowattHoursPerKilogram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegajoulePerKilogram - /// public static SpecificEnergy MegajoulesPerKilogram(this T value) => SpecificEnergy.FromMegajoulesPerKilogram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? MegajoulesPerKilogram(this T? value) where T : struct => SpecificEnergy.FromMegajoulesPerKilogram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegawattHourPerKilogram - /// public static SpecificEnergy MegawattHoursPerKilogram(this T value) => SpecificEnergy.FromMegawattHoursPerKilogram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? MegawattHoursPerKilogram(this T? value) where T : struct => SpecificEnergy.FromMegawattHoursPerKilogram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattHourPerKilogram - /// public static SpecificEnergy WattHoursPerKilogram(this T value) => SpecificEnergy.FromWattHoursPerKilogram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? WattHoursPerKilogram(this T? value) where T : struct => SpecificEnergy.FromWattHoursPerKilogram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs index e9915976d1..349c77f35b 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs @@ -44,94 +44,30 @@ namespace UnitsNet.Extensions.NumberToSpecificEntropy { public static class NumberToSpecificEntropyExtensions { - #region CaloriePerGramKelvin - /// public static SpecificEntropy CaloriesPerGramKelvin(this T value) => SpecificEntropy.FromCaloriesPerGramKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? CaloriesPerGramKelvin(this T? value) where T : struct => SpecificEntropy.FromCaloriesPerGramKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region JoulePerKilogramDegreeCelsius - /// public static SpecificEntropy JoulesPerKilogramDegreeCelsius(this T value) => SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? JoulesPerKilogramDegreeCelsius(this T? value) where T : struct => SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region JoulePerKilogramKelvin - /// public static SpecificEntropy JoulesPerKilogramKelvin(this T value) => SpecificEntropy.FromJoulesPerKilogramKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? JoulesPerKilogramKelvin(this T? value) where T : struct => SpecificEntropy.FromJoulesPerKilogramKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilocaloriePerGramKelvin - /// public static SpecificEntropy KilocaloriesPerGramKelvin(this T value) => SpecificEntropy.FromKilocaloriesPerGramKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? KilocaloriesPerGramKelvin(this T? value) where T : struct => SpecificEntropy.FromKilocaloriesPerGramKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilojoulePerKilogramDegreeCelsius - /// public static SpecificEntropy KilojoulesPerKilogramDegreeCelsius(this T value) => SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? KilojoulesPerKilogramDegreeCelsius(this T? value) where T : struct => SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilojoulePerKilogramKelvin - /// public static SpecificEntropy KilojoulesPerKilogramKelvin(this T value) => SpecificEntropy.FromKilojoulesPerKilogramKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? KilojoulesPerKilogramKelvin(this T? value) where T : struct => SpecificEntropy.FromKilojoulesPerKilogramKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegajoulePerKilogramDegreeCelsius - /// public static SpecificEntropy MegajoulesPerKilogramDegreeCelsius(this T value) => SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? MegajoulesPerKilogramDegreeCelsius(this T? value) where T : struct => SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegajoulePerKilogramKelvin - /// public static SpecificEntropy MegajoulesPerKilogramKelvin(this T value) => SpecificEntropy.FromMegajoulesPerKilogramKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? MegajoulesPerKilogramKelvin(this T? value) where T : struct => SpecificEntropy.FromMegajoulesPerKilogramKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs index 3ac4fad9d2..38ad063b86 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs @@ -44,28 +44,12 @@ namespace UnitsNet.Extensions.NumberToSpecificVolume { public static class NumberToSpecificVolumeExtensions { - #region CubicFootPerPound - /// public static SpecificVolume CubicFeetPerPound(this T value) => SpecificVolume.FromCubicFeetPerPound(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificVolume? CubicFeetPerPound(this T? value) where T : struct => SpecificVolume.FromCubicFeetPerPound(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerKilogram - /// public static SpecificVolume CubicMetersPerKilogram(this T value) => SpecificVolume.FromCubicMetersPerKilogram(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificVolume? CubicMetersPerKilogram(this T? value) where T : struct => SpecificVolume.FromCubicMetersPerKilogram(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs index 96baddecbc..53e1155bd6 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs @@ -44,193 +44,57 @@ namespace UnitsNet.Extensions.NumberToSpecificWeight { public static class NumberToSpecificWeightExtensions { - #region KilogramForcePerCubicCentimeter - /// public static SpecificWeight KilogramsForcePerCubicCentimeter(this T value) => SpecificWeight.FromKilogramsForcePerCubicCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilogramsForcePerCubicCentimeter(this T? value) where T : struct => SpecificWeight.FromKilogramsForcePerCubicCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForcePerCubicMeter - /// public static SpecificWeight KilogramsForcePerCubicMeter(this T value) => SpecificWeight.FromKilogramsForcePerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilogramsForcePerCubicMeter(this T? value) where T : struct => SpecificWeight.FromKilogramsForcePerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForcePerCubicMillimeter - /// public static SpecificWeight KilogramsForcePerCubicMillimeter(this T value) => SpecificWeight.FromKilogramsForcePerCubicMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilogramsForcePerCubicMillimeter(this T? value) where T : struct => SpecificWeight.FromKilogramsForcePerCubicMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerCubicCentimeter - /// public static SpecificWeight KilonewtonsPerCubicCentimeter(this T value) => SpecificWeight.FromKilonewtonsPerCubicCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilonewtonsPerCubicCentimeter(this T? value) where T : struct => SpecificWeight.FromKilonewtonsPerCubicCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerCubicMeter - /// public static SpecificWeight KilonewtonsPerCubicMeter(this T value) => SpecificWeight.FromKilonewtonsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilonewtonsPerCubicMeter(this T? value) where T : struct => SpecificWeight.FromKilonewtonsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonPerCubicMillimeter - /// public static SpecificWeight KilonewtonsPerCubicMillimeter(this T value) => SpecificWeight.FromKilonewtonsPerCubicMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilonewtonsPerCubicMillimeter(this T? value) where T : struct => SpecificWeight.FromKilonewtonsPerCubicMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundForcePerCubicFoot - /// public static SpecificWeight KilopoundsForcePerCubicFoot(this T value) => SpecificWeight.FromKilopoundsForcePerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilopoundsForcePerCubicFoot(this T? value) where T : struct => SpecificWeight.FromKilopoundsForcePerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundForcePerCubicInch - /// public static SpecificWeight KilopoundsForcePerCubicInch(this T value) => SpecificWeight.FromKilopoundsForcePerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? KilopoundsForcePerCubicInch(this T? value) where T : struct => SpecificWeight.FromKilopoundsForcePerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonPerCubicMeter - /// public static SpecificWeight MeganewtonsPerCubicMeter(this T value) => SpecificWeight.FromMeganewtonsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? MeganewtonsPerCubicMeter(this T? value) where T : struct => SpecificWeight.FromMeganewtonsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerCubicCentimeter - /// public static SpecificWeight NewtonsPerCubicCentimeter(this T value) => SpecificWeight.FromNewtonsPerCubicCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? NewtonsPerCubicCentimeter(this T? value) where T : struct => SpecificWeight.FromNewtonsPerCubicCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerCubicMeter - /// public static SpecificWeight NewtonsPerCubicMeter(this T value) => SpecificWeight.FromNewtonsPerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? NewtonsPerCubicMeter(this T? value) where T : struct => SpecificWeight.FromNewtonsPerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonPerCubicMillimeter - /// public static SpecificWeight NewtonsPerCubicMillimeter(this T value) => SpecificWeight.FromNewtonsPerCubicMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? NewtonsPerCubicMillimeter(this T? value) where T : struct => SpecificWeight.FromNewtonsPerCubicMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundForcePerCubicFoot - /// public static SpecificWeight PoundsForcePerCubicFoot(this T value) => SpecificWeight.FromPoundsForcePerCubicFoot(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? PoundsForcePerCubicFoot(this T? value) where T : struct => SpecificWeight.FromPoundsForcePerCubicFoot(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundForcePerCubicInch - /// public static SpecificWeight PoundsForcePerCubicInch(this T value) => SpecificWeight.FromPoundsForcePerCubicInch(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? PoundsForcePerCubicInch(this T? value) where T : struct => SpecificWeight.FromPoundsForcePerCubicInch(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForcePerCubicCentimeter - /// public static SpecificWeight TonnesForcePerCubicCentimeter(this T value) => SpecificWeight.FromTonnesForcePerCubicCentimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? TonnesForcePerCubicCentimeter(this T? value) where T : struct => SpecificWeight.FromTonnesForcePerCubicCentimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForcePerCubicMeter - /// public static SpecificWeight TonnesForcePerCubicMeter(this T value) => SpecificWeight.FromTonnesForcePerCubicMeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? TonnesForcePerCubicMeter(this T? value) where T : struct => SpecificWeight.FromTonnesForcePerCubicMeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForcePerCubicMillimeter - /// public static SpecificWeight TonnesForcePerCubicMillimeter(this T value) => SpecificWeight.FromTonnesForcePerCubicMillimeter(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? TonnesForcePerCubicMillimeter(this T? value) where T : struct => SpecificWeight.FromTonnesForcePerCubicMillimeter(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs index ee9db77b1f..d921f92ff2 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs @@ -44,358 +44,102 @@ namespace UnitsNet.Extensions.NumberToSpeed { public static class NumberToSpeedExtensions { - #region CentimeterPerHour - /// public static Speed CentimetersPerHour(this T value) => Speed.FromCentimetersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? CentimetersPerHour(this T? value) where T : struct => Speed.FromCentimetersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CentimeterPerMinute - /// public static Speed CentimetersPerMinutes(this T value) => Speed.FromCentimetersPerMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? CentimetersPerMinutes(this T? value) where T : struct => Speed.FromCentimetersPerMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CentimeterPerSecond - /// public static Speed CentimetersPerSecond(this T value) => Speed.FromCentimetersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? CentimetersPerSecond(this T? value) where T : struct => Speed.FromCentimetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecimeterPerMinute - /// public static Speed DecimetersPerMinutes(this T value) => Speed.FromDecimetersPerMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? DecimetersPerMinutes(this T? value) where T : struct => Speed.FromDecimetersPerMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecimeterPerSecond - /// public static Speed DecimetersPerSecond(this T value) => Speed.FromDecimetersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? DecimetersPerSecond(this T? value) where T : struct => Speed.FromDecimetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region FootPerHour - /// public static Speed FeetPerHour(this T value) => Speed.FromFeetPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? FeetPerHour(this T? value) where T : struct => Speed.FromFeetPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region FootPerMinute - /// public static Speed FeetPerMinute(this T value) => Speed.FromFeetPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? FeetPerMinute(this T? value) where T : struct => Speed.FromFeetPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region FootPerSecond - /// public static Speed FeetPerSecond(this T value) => Speed.FromFeetPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? FeetPerSecond(this T? value) where T : struct => Speed.FromFeetPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region InchPerHour - /// public static Speed InchesPerHour(this T value) => Speed.FromInchesPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? InchesPerHour(this T? value) where T : struct => Speed.FromInchesPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region InchPerMinute - /// public static Speed InchesPerMinute(this T value) => Speed.FromInchesPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? InchesPerMinute(this T? value) where T : struct => Speed.FromInchesPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region InchPerSecond - /// public static Speed InchesPerSecond(this T value) => Speed.FromInchesPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? InchesPerSecond(this T? value) where T : struct => Speed.FromInchesPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilometerPerHour - /// public static Speed KilometersPerHour(this T value) => Speed.FromKilometersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? KilometersPerHour(this T? value) where T : struct => Speed.FromKilometersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilometerPerMinute - /// public static Speed KilometersPerMinutes(this T value) => Speed.FromKilometersPerMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? KilometersPerMinutes(this T? value) where T : struct => Speed.FromKilometersPerMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilometerPerSecond - /// public static Speed KilometersPerSecond(this T value) => Speed.FromKilometersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? KilometersPerSecond(this T? value) where T : struct => Speed.FromKilometersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Knot - /// public static Speed Knots(this T value) => Speed.FromKnots(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? Knots(this T? value) where T : struct => Speed.FromKnots(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeterPerHour - /// public static Speed MetersPerHour(this T value) => Speed.FromMetersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MetersPerHour(this T? value) where T : struct => Speed.FromMetersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeterPerMinute - /// public static Speed MetersPerMinutes(this T value) => Speed.FromMetersPerMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MetersPerMinutes(this T? value) where T : struct => Speed.FromMetersPerMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeterPerSecond - /// public static Speed MetersPerSecond(this T value) => Speed.FromMetersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MetersPerSecond(this T? value) where T : struct => Speed.FromMetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrometerPerMinute - /// public static Speed MicrometersPerMinutes(this T value) => Speed.FromMicrometersPerMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MicrometersPerMinutes(this T? value) where T : struct => Speed.FromMicrometersPerMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrometerPerSecond - /// public static Speed MicrometersPerSecond(this T value) => Speed.FromMicrometersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MicrometersPerSecond(this T? value) where T : struct => Speed.FromMicrometersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilePerHour - /// public static Speed MilesPerHour(this T value) => Speed.FromMilesPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MilesPerHour(this T? value) where T : struct => Speed.FromMilesPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillimeterPerHour - /// public static Speed MillimetersPerHour(this T value) => Speed.FromMillimetersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MillimetersPerHour(this T? value) where T : struct => Speed.FromMillimetersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillimeterPerMinute - /// public static Speed MillimetersPerMinutes(this T value) => Speed.FromMillimetersPerMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MillimetersPerMinutes(this T? value) where T : struct => Speed.FromMillimetersPerMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillimeterPerSecond - /// public static Speed MillimetersPerSecond(this T value) => Speed.FromMillimetersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? MillimetersPerSecond(this T? value) where T : struct => Speed.FromMillimetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanometerPerMinute - /// public static Speed NanometersPerMinutes(this T value) => Speed.FromNanometersPerMinutes(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? NanometersPerMinutes(this T? value) where T : struct => Speed.FromNanometersPerMinutes(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanometerPerSecond - /// public static Speed NanometersPerSecond(this T value) => Speed.FromNanometersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? NanometersPerSecond(this T? value) where T : struct => Speed.FromNanometersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsSurveyFootPerHour - /// public static Speed UsSurveyFeetPerHour(this T value) => Speed.FromUsSurveyFeetPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? UsSurveyFeetPerHour(this T? value) where T : struct => Speed.FromUsSurveyFeetPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsSurveyFootPerMinute - /// public static Speed UsSurveyFeetPerMinute(this T value) => Speed.FromUsSurveyFeetPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? UsSurveyFeetPerMinute(this T? value) where T : struct => Speed.FromUsSurveyFeetPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsSurveyFootPerSecond - /// public static Speed UsSurveyFeetPerSecond(this T value) => Speed.FromUsSurveyFeetPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? UsSurveyFeetPerSecond(this T? value) where T : struct => Speed.FromUsSurveyFeetPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region YardPerHour - /// public static Speed YardsPerHour(this T value) => Speed.FromYardsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? YardsPerHour(this T? value) where T : struct => Speed.FromYardsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region YardPerMinute - /// public static Speed YardsPerMinute(this T value) => Speed.FromYardsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? YardsPerMinute(this T? value) where T : struct => Speed.FromYardsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region YardPerSecond - /// public static Speed YardsPerSecond(this T value) => Speed.FromYardsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? YardsPerSecond(this T? value) where T : struct => Speed.FromYardsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs index 3e6946be23..6754a82323 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs @@ -44,116 +44,36 @@ namespace UnitsNet.Extensions.NumberToTemperatureChangeRate { public static class NumberToTemperatureChangeRateExtensions { - #region CentidegreeCelsiusPerSecond - /// public static TemperatureChangeRate CentidegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? CentidegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecadegreeCelsiusPerSecond - /// public static TemperatureChangeRate DecadegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? DecadegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecidegreeCelsiusPerSecond - /// public static TemperatureChangeRate DecidegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? DecidegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeCelsiusPerMinute - /// public static TemperatureChangeRate DegreesCelsiusPerMinute(this T value) => TemperatureChangeRate.FromDegreesCelsiusPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? DegreesCelsiusPerMinute(this T? value) where T : struct => TemperatureChangeRate.FromDegreesCelsiusPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeCelsiusPerSecond - /// public static TemperatureChangeRate DegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromDegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? DegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromDegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region HectodegreeCelsiusPerSecond - /// public static TemperatureChangeRate HectodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? HectodegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilodegreeCelsiusPerSecond - /// public static TemperatureChangeRate KilodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? KilodegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrodegreeCelsiusPerSecond - /// public static TemperatureChangeRate MicrodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? MicrodegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillidegreeCelsiusPerSecond - /// public static TemperatureChangeRate MillidegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? MillidegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanodegreeCelsiusPerSecond - /// public static TemperatureChangeRate NanodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? NanodegreesCelsiusPerSecond(this T? value) where T : struct => TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs index 1b2559ee15..db4d0a0ca5 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs @@ -44,190 +44,62 @@ namespace UnitsNet.Extensions.NumberToTemperatureDelta { public static class NumberToTemperatureDeltaExtensions { - #region DegreeCelsius - /// public static TemperatureDelta DegreesCelsius(this T value) => TemperatureDelta.FromDegreesCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesCelsius(this T? value) where T : struct => TemperatureDelta.FromDegreesCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeCelsiusDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use DegreeCelsius instead")] public static TemperatureDelta DegreesCelsiusDelta(this T value) => TemperatureDelta.FromDegreesCelsiusDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesCelsiusDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesCelsiusDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeDelisle - /// public static TemperatureDelta DegreesDelisle(this T value) => TemperatureDelta.FromDegreesDelisle(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesDelisle(this T? value) where T : struct => TemperatureDelta.FromDegreesDelisle(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeDelisleDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use DegreeDelisle instead")] public static TemperatureDelta DegreesDelisleDelta(this T value) => TemperatureDelta.FromDegreesDelisleDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesDelisleDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesDelisleDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeFahrenheit - /// public static TemperatureDelta DegreesFahrenheit(this T value) => TemperatureDelta.FromDegreesFahrenheit(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesFahrenheit(this T? value) where T : struct => TemperatureDelta.FromDegreesFahrenheit(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeFahrenheitDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use DegreeFahrenheit instead")] public static TemperatureDelta DegreesFahrenheitDelta(this T value) => TemperatureDelta.FromDegreesFahrenheitDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesFahrenheitDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesFahrenheitDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeNewton - /// public static TemperatureDelta DegreesNewton(this T value) => TemperatureDelta.FromDegreesNewton(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesNewton(this T? value) where T : struct => TemperatureDelta.FromDegreesNewton(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeNewtonDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use DegreeNewton instead")] public static TemperatureDelta DegreesNewtonDelta(this T value) => TemperatureDelta.FromDegreesNewtonDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesNewtonDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesNewtonDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeRankine - /// public static TemperatureDelta DegreesRankine(this T value) => TemperatureDelta.FromDegreesRankine(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesRankine(this T? value) where T : struct => TemperatureDelta.FromDegreesRankine(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeRankineDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use DegreeRankine instead")] public static TemperatureDelta DegreesRankineDelta(this T value) => TemperatureDelta.FromDegreesRankineDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesRankineDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesRankineDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeReaumur - /// public static TemperatureDelta DegreesReaumur(this T value) => TemperatureDelta.FromDegreesReaumur(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesReaumur(this T? value) where T : struct => TemperatureDelta.FromDegreesReaumur(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeReaumurDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use DegreeReaumur instead")] public static TemperatureDelta DegreesReaumurDelta(this T value) => TemperatureDelta.FromDegreesReaumurDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesReaumurDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesReaumurDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeRoemer - /// public static TemperatureDelta DegreesRoemer(this T value) => TemperatureDelta.FromDegreesRoemer(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesRoemer(this T? value) where T : struct => TemperatureDelta.FromDegreesRoemer(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeRoemerDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use DegreeRoemer instead")] public static TemperatureDelta DegreesRoemerDelta(this T value) => TemperatureDelta.FromDegreesRoemerDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? DegreesRoemerDelta(this T? value) where T : struct => TemperatureDelta.FromDegreesRoemerDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kelvin - /// public static TemperatureDelta Kelvins(this T value) => TemperatureDelta.FromKelvins(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? Kelvins(this T? value) where T : struct => TemperatureDelta.FromKelvins(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KelvinDelta - /// [System.Obsolete("Deprecated due to github issue #180, please use Kelvin instead")] public static TemperatureDelta KelvinsDelta(this T value) => TemperatureDelta.FromKelvinsDelta(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? KelvinsDelta(this T? value) where T : struct => TemperatureDelta.FromKelvinsDelta(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs index 74b3d22047..b04a374531 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs @@ -44,94 +44,30 @@ namespace UnitsNet.Extensions.NumberToTemperature { public static class NumberToTemperatureExtensions { - #region DegreeCelsius - /// public static Temperature DegreesCelsius(this T value) => Temperature.FromDegreesCelsius(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? DegreesCelsius(this T? value) where T : struct => Temperature.FromDegreesCelsius(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeDelisle - /// public static Temperature DegreesDelisle(this T value) => Temperature.FromDegreesDelisle(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? DegreesDelisle(this T? value) where T : struct => Temperature.FromDegreesDelisle(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeFahrenheit - /// public static Temperature DegreesFahrenheit(this T value) => Temperature.FromDegreesFahrenheit(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? DegreesFahrenheit(this T? value) where T : struct => Temperature.FromDegreesFahrenheit(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeNewton - /// public static Temperature DegreesNewton(this T value) => Temperature.FromDegreesNewton(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? DegreesNewton(this T? value) where T : struct => Temperature.FromDegreesNewton(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeRankine - /// public static Temperature DegreesRankine(this T value) => Temperature.FromDegreesRankine(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? DegreesRankine(this T? value) where T : struct => Temperature.FromDegreesRankine(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeReaumur - /// public static Temperature DegreesReaumur(this T value) => Temperature.FromDegreesReaumur(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? DegreesReaumur(this T? value) where T : struct => Temperature.FromDegreesReaumur(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DegreeRoemer - /// public static Temperature DegreesRoemer(this T value) => Temperature.FromDegreesRoemer(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? DegreesRoemer(this T? value) where T : struct => Temperature.FromDegreesRoemer(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Kelvin - /// public static Temperature Kelvins(this T value) => Temperature.FromKelvins(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? Kelvins(this T? value) where T : struct => Temperature.FromKelvins(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs index dc9c3d7539..74d3658cb4 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs @@ -44,28 +44,12 @@ namespace UnitsNet.Extensions.NumberToThermalConductivity { public static class NumberToThermalConductivityExtensions { - #region BtuPerHourFootFahrenheit - /// public static ThermalConductivity BtusPerHourFootFahrenheit(this T value) => ThermalConductivity.FromBtusPerHourFootFahrenheit(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalConductivity? BtusPerHourFootFahrenheit(this T? value) where T : struct => ThermalConductivity.FromBtusPerHourFootFahrenheit(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region WattPerMeterKelvin - /// public static ThermalConductivity WattsPerMeterKelvin(this T value) => ThermalConductivity.FromWattsPerMeterKelvin(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalConductivity? WattsPerMeterKelvin(this T? value) where T : struct => ThermalConductivity.FromWattsPerMeterKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs index cd13575d0a..814e163654 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs @@ -44,61 +44,21 @@ namespace UnitsNet.Extensions.NumberToThermalResistance { public static class NumberToThermalResistanceExtensions { - #region HourSquareFeetDegreeFahrenheitPerBtu - /// public static ThermalResistance HourSquareFeetDegreesFahrenheitPerBtu(this T value) => ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalResistance? HourSquareFeetDegreesFahrenheitPerBtu(this T? value) where T : struct => ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareCentimeterHourDegreeCelsiusPerKilocalorie - /// public static ThermalResistance SquareCentimeterHourDegreesCelsiusPerKilocalorie(this T value) => ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalResistance? SquareCentimeterHourDegreesCelsiusPerKilocalorie(this T? value) where T : struct => ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareCentimeterKelvinPerWatt - /// public static ThermalResistance SquareCentimeterKelvinsPerWatt(this T value) => ThermalResistance.FromSquareCentimeterKelvinsPerWatt(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalResistance? SquareCentimeterKelvinsPerWatt(this T? value) where T : struct => ThermalResistance.FromSquareCentimeterKelvinsPerWatt(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareMeterDegreeCelsiusPerWatt - /// public static ThermalResistance SquareMeterDegreesCelsiusPerWatt(this T value) => ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalResistance? SquareMeterDegreesCelsiusPerWatt(this T? value) where T : struct => ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region SquareMeterKelvinPerKilowatt - /// public static ThermalResistance SquareMeterKelvinsPerKilowatt(this T value) => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalResistance? SquareMeterKelvinsPerKilowatt(this T? value) where T : struct => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs index 3e373c103a..9a1b0c92d8 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs @@ -44,237 +44,69 @@ namespace UnitsNet.Extensions.NumberToTorque { public static class NumberToTorqueExtensions { - #region KilogramForceCentimeter - /// public static Torque KilogramForceCentimeters(this T value) => Torque.FromKilogramForceCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilogramForceCentimeters(this T? value) where T : struct => Torque.FromKilogramForceCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForceMeter - /// public static Torque KilogramForceMeters(this T value) => Torque.FromKilogramForceMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilogramForceMeters(this T? value) where T : struct => Torque.FromKilogramForceMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramForceMillimeter - /// public static Torque KilogramForceMillimeters(this T value) => Torque.FromKilogramForceMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilogramForceMillimeters(this T? value) where T : struct => Torque.FromKilogramForceMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonCentimeter - /// public static Torque KilonewtonCentimeters(this T value) => Torque.FromKilonewtonCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilonewtonCentimeters(this T? value) where T : struct => Torque.FromKilonewtonCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonMeter - /// public static Torque KilonewtonMeters(this T value) => Torque.FromKilonewtonMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilonewtonMeters(this T? value) where T : struct => Torque.FromKilonewtonMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilonewtonMillimeter - /// public static Torque KilonewtonMillimeters(this T value) => Torque.FromKilonewtonMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilonewtonMillimeters(this T? value) where T : struct => Torque.FromKilonewtonMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundForceFoot - /// public static Torque KilopoundForceFeet(this T value) => Torque.FromKilopoundForceFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilopoundForceFeet(this T? value) where T : struct => Torque.FromKilopoundForceFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilopoundForceInch - /// public static Torque KilopoundForceInches(this T value) => Torque.FromKilopoundForceInches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? KilopoundForceInches(this T? value) where T : struct => Torque.FromKilopoundForceInches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonCentimeter - /// public static Torque MeganewtonCentimeters(this T value) => Torque.FromMeganewtonCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? MeganewtonCentimeters(this T? value) where T : struct => Torque.FromMeganewtonCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonMeter - /// public static Torque MeganewtonMeters(this T value) => Torque.FromMeganewtonMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? MeganewtonMeters(this T? value) where T : struct => Torque.FromMeganewtonMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MeganewtonMillimeter - /// public static Torque MeganewtonMillimeters(this T value) => Torque.FromMeganewtonMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? MeganewtonMillimeters(this T? value) where T : struct => Torque.FromMeganewtonMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegapoundForceFoot - /// public static Torque MegapoundForceFeet(this T value) => Torque.FromMegapoundForceFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? MegapoundForceFeet(this T? value) where T : struct => Torque.FromMegapoundForceFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegapoundForceInch - /// public static Torque MegapoundForceInches(this T value) => Torque.FromMegapoundForceInches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? MegapoundForceInches(this T? value) where T : struct => Torque.FromMegapoundForceInches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonCentimeter - /// public static Torque NewtonCentimeters(this T value) => Torque.FromNewtonCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? NewtonCentimeters(this T? value) where T : struct => Torque.FromNewtonCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonMeter - /// public static Torque NewtonMeters(this T value) => Torque.FromNewtonMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? NewtonMeters(this T? value) where T : struct => Torque.FromNewtonMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NewtonMillimeter - /// public static Torque NewtonMillimeters(this T value) => Torque.FromNewtonMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? NewtonMillimeters(this T? value) where T : struct => Torque.FromNewtonMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundForceFoot - /// public static Torque PoundForceFeet(this T value) => Torque.FromPoundForceFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? PoundForceFeet(this T? value) where T : struct => Torque.FromPoundForceFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundForceInch - /// public static Torque PoundForceInches(this T value) => Torque.FromPoundForceInches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? PoundForceInches(this T? value) where T : struct => Torque.FromPoundForceInches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForceCentimeter - /// public static Torque TonneForceCentimeters(this T value) => Torque.FromTonneForceCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? TonneForceCentimeters(this T? value) where T : struct => Torque.FromTonneForceCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForceMeter - /// public static Torque TonneForceMeters(this T value) => Torque.FromTonneForceMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? TonneForceMeters(this T? value) where T : struct => Torque.FromTonneForceMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonneForceMillimeter - /// public static Torque TonneForceMillimeters(this T value) => Torque.FromTonneForceMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? TonneForceMillimeters(this T? value) where T : struct => Torque.FromTonneForceMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs index 748f471f95..79890adcb2 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs @@ -44,17 +44,9 @@ namespace UnitsNet.Extensions.NumberToVitaminA { public static class NumberToVitaminAExtensions { - #region InternationalUnit - /// public static VitaminA InternationalUnits(this T value) => VitaminA.FromInternationalUnits(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VitaminA? InternationalUnits(this T? value) where T : struct => VitaminA.FromInternationalUnits(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs index 26c05e3625..150eef67e2 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs @@ -44,492 +44,140 @@ namespace UnitsNet.Extensions.NumberToVolume { public static class NumberToVolumeExtensions { - #region AuTablespoon - /// public static Volume AuTablespoons(this T value) => Volume.FromAuTablespoons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? AuTablespoons(this T? value) where T : struct => Volume.FromAuTablespoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Centiliter - /// public static Volume Centiliters(this T value) => Volume.FromCentiliters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Centiliters(this T? value) where T : struct => Volume.FromCentiliters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicCentimeter - /// public static Volume CubicCentimeters(this T value) => Volume.FromCubicCentimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicCentimeters(this T? value) where T : struct => Volume.FromCubicCentimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicDecimeter - /// public static Volume CubicDecimeters(this T value) => Volume.FromCubicDecimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicDecimeters(this T? value) where T : struct => Volume.FromCubicDecimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFoot - /// public static Volume CubicFeet(this T value) => Volume.FromCubicFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicFeet(this T? value) where T : struct => Volume.FromCubicFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicInch - /// public static Volume CubicInches(this T value) => Volume.FromCubicInches(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicInches(this T? value) where T : struct => Volume.FromCubicInches(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicKilometer - /// public static Volume CubicKilometers(this T value) => Volume.FromCubicKilometers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicKilometers(this T? value) where T : struct => Volume.FromCubicKilometers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeter - /// public static Volume CubicMeters(this T value) => Volume.FromCubicMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicMeters(this T? value) where T : struct => Volume.FromCubicMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMicrometer - /// public static Volume CubicMicrometers(this T value) => Volume.FromCubicMicrometers(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicMicrometers(this T? value) where T : struct => Volume.FromCubicMicrometers(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMile - /// public static Volume CubicMiles(this T value) => Volume.FromCubicMiles(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicMiles(this T? value) where T : struct => Volume.FromCubicMiles(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMillimeter - /// public static Volume CubicMillimeters(this T value) => Volume.FromCubicMillimeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicMillimeters(this T? value) where T : struct => Volume.FromCubicMillimeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYard - /// public static Volume CubicYards(this T value) => Volume.FromCubicYards(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? CubicYards(this T? value) where T : struct => Volume.FromCubicYards(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Deciliter - /// public static Volume Deciliters(this T value) => Volume.FromDeciliters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Deciliters(this T? value) where T : struct => Volume.FromDeciliters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region HectocubicFoot - /// public static Volume HectocubicFeet(this T value) => Volume.FromHectocubicFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? HectocubicFeet(this T? value) where T : struct => Volume.FromHectocubicFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region HectocubicMeter - /// public static Volume HectocubicMeters(this T value) => Volume.FromHectocubicMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? HectocubicMeters(this T? value) where T : struct => Volume.FromHectocubicMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Hectoliter - /// public static Volume Hectoliters(this T value) => Volume.FromHectoliters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Hectoliters(this T? value) where T : struct => Volume.FromHectoliters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ImperialBeerBarrel - /// public static Volume ImperialBeerBarrels(this T value) => Volume.FromImperialBeerBarrels(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? ImperialBeerBarrels(this T? value) where T : struct => Volume.FromImperialBeerBarrels(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ImperialGallon - /// public static Volume ImperialGallons(this T value) => Volume.FromImperialGallons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? ImperialGallons(this T? value) where T : struct => Volume.FromImperialGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ImperialOunce - /// public static Volume ImperialOunces(this T value) => Volume.FromImperialOunces(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? ImperialOunces(this T? value) where T : struct => Volume.FromImperialOunces(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilocubicFoot - /// public static Volume KilocubicFeet(this T value) => Volume.FromKilocubicFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? KilocubicFeet(this T? value) where T : struct => Volume.FromKilocubicFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilocubicMeter - /// public static Volume KilocubicMeters(this T value) => Volume.FromKilocubicMeters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? KilocubicMeters(this T? value) where T : struct => Volume.FromKilocubicMeters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KiloimperialGallon - /// public static Volume KiloimperialGallons(this T value) => Volume.FromKiloimperialGallons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? KiloimperialGallons(this T? value) where T : struct => Volume.FromKiloimperialGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilousGallon - /// public static Volume KilousGallons(this T value) => Volume.FromKilousGallons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? KilousGallons(this T? value) where T : struct => Volume.FromKilousGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Liter - /// public static Volume Liters(this T value) => Volume.FromLiters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Liters(this T? value) where T : struct => Volume.FromLiters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegacubicFoot - /// public static Volume MegacubicFeet(this T value) => Volume.FromMegacubicFeet(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? MegacubicFeet(this T? value) where T : struct => Volume.FromMegacubicFeet(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegaimperialGallon - /// public static Volume MegaimperialGallons(this T value) => Volume.FromMegaimperialGallons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? MegaimperialGallons(this T? value) where T : struct => Volume.FromMegaimperialGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegausGallon - /// public static Volume MegausGallons(this T value) => Volume.FromMegausGallons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? MegausGallons(this T? value) where T : struct => Volume.FromMegausGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MetricCup - /// public static Volume MetricCups(this T value) => Volume.FromMetricCups(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? MetricCups(this T? value) where T : struct => Volume.FromMetricCups(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MetricTeaspoon - /// public static Volume MetricTeaspoons(this T value) => Volume.FromMetricTeaspoons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? MetricTeaspoons(this T? value) where T : struct => Volume.FromMetricTeaspoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Microliter - /// public static Volume Microliters(this T value) => Volume.FromMicroliters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Microliters(this T? value) where T : struct => Volume.FromMicroliters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Milliliter - /// public static Volume Milliliters(this T value) => Volume.FromMilliliters(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Milliliters(this T? value) where T : struct => Volume.FromMilliliters(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrel - /// public static Volume OilBarrels(this T value) => Volume.FromOilBarrels(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? OilBarrels(this T? value) where T : struct => Volume.FromOilBarrels(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Tablespoon - /// [System.Obsolete("Deprecated due to github issue #134, please use UsTablespoon instead")] public static Volume Tablespoons(this T value) => Volume.FromTablespoons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Tablespoons(this T? value) where T : struct => Volume.FromTablespoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region Teaspoon - /// [System.Obsolete("Deprecated due to github issue #134, please use UsTeaspoon instead")] public static Volume Teaspoons(this T value) => Volume.FromTeaspoons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? Teaspoons(this T? value) where T : struct => Volume.FromTeaspoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UkTablespoon - /// public static Volume UkTablespoons(this T value) => Volume.FromUkTablespoons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UkTablespoons(this T? value) where T : struct => Volume.FromUkTablespoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsBeerBarrel - /// public static Volume UsBeerBarrels(this T value) => Volume.FromUsBeerBarrels(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsBeerBarrels(this T? value) where T : struct => Volume.FromUsBeerBarrels(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsCustomaryCup - /// public static Volume UsCustomaryCups(this T value) => Volume.FromUsCustomaryCups(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsCustomaryCups(this T? value) where T : struct => Volume.FromUsCustomaryCups(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallon - /// public static Volume UsGallons(this T value) => Volume.FromUsGallons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsGallons(this T? value) where T : struct => Volume.FromUsGallons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsLegalCup - /// public static Volume UsLegalCups(this T value) => Volume.FromUsLegalCups(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsLegalCups(this T? value) where T : struct => Volume.FromUsLegalCups(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsOunce - /// public static Volume UsOunces(this T value) => Volume.FromUsOunces(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsOunces(this T? value) where T : struct => Volume.FromUsOunces(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsPint - /// public static Volume UsPints(this T value) => Volume.FromUsPints(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsPints(this T? value) where T : struct => Volume.FromUsPints(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsQuart - /// public static Volume UsQuarts(this T value) => Volume.FromUsQuarts(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsQuarts(this T? value) where T : struct => Volume.FromUsQuarts(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsTablespoon - /// public static Volume UsTablespoons(this T value) => Volume.FromUsTablespoons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsTablespoons(this T? value) where T : struct => Volume.FromUsTablespoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsTeaspoon - /// public static Volume UsTeaspoons(this T value) => Volume.FromUsTeaspoons(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? UsTeaspoons(this T? value) where T : struct => Volume.FromUsTeaspoons(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs index 19375aa8a8..18e5684f05 100644 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs +++ b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs @@ -44,292 +44,84 @@ namespace UnitsNet.Extensions.NumberToVolumeFlow { public static class NumberToVolumeFlowExtensions { - #region CentilitersPerMinute - /// public static VolumeFlow CentilitersPerMinute(this T value) => VolumeFlow.FromCentilitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CentilitersPerMinute(this T? value) where T : struct => VolumeFlow.FromCentilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicDecimeterPerMinute - /// public static VolumeFlow CubicDecimetersPerMinute(this T value) => VolumeFlow.FromCubicDecimetersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicDecimetersPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicDecimetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerHour - /// public static VolumeFlow CubicFeetPerHour(this T value) => VolumeFlow.FromCubicFeetPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicFeetPerHour(this T? value) where T : struct => VolumeFlow.FromCubicFeetPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerMinute - /// public static VolumeFlow CubicFeetPerMinute(this T value) => VolumeFlow.FromCubicFeetPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicFeetPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicFeetPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerSecond - /// public static VolumeFlow CubicFeetPerSecond(this T value) => VolumeFlow.FromCubicFeetPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicFeetPerSecond(this T? value) where T : struct => VolumeFlow.FromCubicFeetPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerHour - /// public static VolumeFlow CubicMetersPerHour(this T value) => VolumeFlow.FromCubicMetersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicMetersPerHour(this T? value) where T : struct => VolumeFlow.FromCubicMetersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerMinute - /// public static VolumeFlow CubicMetersPerMinute(this T value) => VolumeFlow.FromCubicMetersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicMetersPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicMetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerSecond - /// public static VolumeFlow CubicMetersPerSecond(this T value) => VolumeFlow.FromCubicMetersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicMetersPerSecond(this T? value) where T : struct => VolumeFlow.FromCubicMetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerHour - /// public static VolumeFlow CubicYardsPerHour(this T value) => VolumeFlow.FromCubicYardsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicYardsPerHour(this T? value) where T : struct => VolumeFlow.FromCubicYardsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerMinute - /// public static VolumeFlow CubicYardsPerMinute(this T value) => VolumeFlow.FromCubicYardsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicYardsPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicYardsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerSecond - /// public static VolumeFlow CubicYardsPerSecond(this T value) => VolumeFlow.FromCubicYardsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicYardsPerSecond(this T? value) where T : struct => VolumeFlow.FromCubicYardsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecilitersPerMinute - /// public static VolumeFlow DecilitersPerMinute(this T value) => VolumeFlow.FromDecilitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? DecilitersPerMinute(this T? value) where T : struct => VolumeFlow.FromDecilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilolitersPerMinute - /// public static VolumeFlow KilolitersPerMinute(this T value) => VolumeFlow.FromKilolitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? KilolitersPerMinute(this T? value) where T : struct => VolumeFlow.FromKilolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerHour - /// public static VolumeFlow LitersPerHour(this T value) => VolumeFlow.FromLitersPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? LitersPerHour(this T? value) where T : struct => VolumeFlow.FromLitersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerMinute - /// public static VolumeFlow LitersPerMinute(this T value) => VolumeFlow.FromLitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? LitersPerMinute(this T? value) where T : struct => VolumeFlow.FromLitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerSecond - /// public static VolumeFlow LitersPerSecond(this T value) => VolumeFlow.FromLitersPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? LitersPerSecond(this T? value) where T : struct => VolumeFlow.FromLitersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrolitersPerMinute - /// public static VolumeFlow MicrolitersPerMinute(this T value) => VolumeFlow.FromMicrolitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? MicrolitersPerMinute(this T? value) where T : struct => VolumeFlow.FromMicrolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillilitersPerMinute - /// public static VolumeFlow MillilitersPerMinute(this T value) => VolumeFlow.FromMillilitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? MillilitersPerMinute(this T? value) where T : struct => VolumeFlow.FromMillilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillionUsGallonsPerDay - /// public static VolumeFlow MillionUsGallonsPerDay(this T value) => VolumeFlow.FromMillionUsGallonsPerDay(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? MillionUsGallonsPerDay(this T? value) where T : struct => VolumeFlow.FromMillionUsGallonsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanolitersPerMinute - /// public static VolumeFlow NanolitersPerMinute(this T value) => VolumeFlow.FromNanolitersPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? NanolitersPerMinute(this T? value) where T : struct => VolumeFlow.FromNanolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerDay - /// public static VolumeFlow OilBarrelsPerDay(this T value) => VolumeFlow.FromOilBarrelsPerDay(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? OilBarrelsPerDay(this T? value) where T : struct => VolumeFlow.FromOilBarrelsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerHour - /// public static VolumeFlow OilBarrelsPerHour(this T value) => VolumeFlow.FromOilBarrelsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? OilBarrelsPerHour(this T? value) where T : struct => VolumeFlow.FromOilBarrelsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerMinute - /// public static VolumeFlow OilBarrelsPerMinute(this T value) => VolumeFlow.FromOilBarrelsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? OilBarrelsPerMinute(this T? value) where T : struct => VolumeFlow.FromOilBarrelsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerHour - /// public static VolumeFlow UsGallonsPerHour(this T value) => VolumeFlow.FromUsGallonsPerHour(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? UsGallonsPerHour(this T? value) where T : struct => VolumeFlow.FromUsGallonsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerMinute - /// public static VolumeFlow UsGallonsPerMinute(this T value) => VolumeFlow.FromUsGallonsPerMinute(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? UsGallonsPerMinute(this T? value) where T : struct => VolumeFlow.FromUsGallonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerSecond - /// public static VolumeFlow UsGallonsPerSecond(this T value) => VolumeFlow.FromUsGallonsPerSecond(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? UsGallonsPerSecond(this T? value) where T : struct => VolumeFlow.FromUsGallonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - } } #endif diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index afe7bad3d2..5032179de9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -60,139 +60,6 @@ public partial struct Acceleration : IComparable, IComparable /// public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Acceleration from nullable CentimetersPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromCentimetersPerSecondSquared(QuantityValue? centimeterspersecondsquared) - { - return centimeterspersecondsquared.HasValue ? FromCentimetersPerSecondSquared(centimeterspersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable DecimetersPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromDecimetersPerSecondSquared(QuantityValue? decimeterspersecondsquared) - { - return decimeterspersecondsquared.HasValue ? FromDecimetersPerSecondSquared(decimeterspersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable FeetPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromFeetPerSecondSquared(QuantityValue? feetpersecondsquared) - { - return feetpersecondsquared.HasValue ? FromFeetPerSecondSquared(feetpersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable InchesPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromInchesPerSecondSquared(QuantityValue? inchespersecondsquared) - { - return inchespersecondsquared.HasValue ? FromInchesPerSecondSquared(inchespersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable KilometersPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromKilometersPerSecondSquared(QuantityValue? kilometerspersecondsquared) - { - return kilometerspersecondsquared.HasValue ? FromKilometersPerSecondSquared(kilometerspersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable KnotsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromKnotsPerHour(QuantityValue? knotsperhour) - { - return knotsperhour.HasValue ? FromKnotsPerHour(knotsperhour.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable KnotsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromKnotsPerMinute(QuantityValue? knotsperminute) - { - return knotsperminute.HasValue ? FromKnotsPerMinute(knotsperminute.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable KnotsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromKnotsPerSecond(QuantityValue? knotspersecond) - { - return knotspersecond.HasValue ? FromKnotsPerSecond(knotspersecond.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable MetersPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromMetersPerSecondSquared(QuantityValue? meterspersecondsquared) - { - return meterspersecondsquared.HasValue ? FromMetersPerSecondSquared(meterspersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable MicrometersPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromMicrometersPerSecondSquared(QuantityValue? micrometerspersecondsquared) - { - return micrometerspersecondsquared.HasValue ? FromMicrometersPerSecondSquared(micrometerspersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable MillimetersPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromMillimetersPerSecondSquared(QuantityValue? millimeterspersecondsquared) - { - return millimeterspersecondsquared.HasValue ? FromMillimetersPerSecondSquared(millimeterspersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable NanometersPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Acceleration? FromNanometersPerSecondSquared(QuantityValue? nanometerspersecondsquared) - { - return nanometerspersecondsquared.HasValue ? FromNanometersPerSecondSquared(nanometerspersecondsquared.Value) : default(Acceleration?); - } - - /// - /// Get nullable Acceleration from nullable StandardGravity. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Acceleration? From(QuantityValue? value, AccelerationUnit fromUnit) - { - return value.HasValue ? new Acceleration((double)value.Value, fromUnit) : default(Acceleration?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 61e24dca68..0c7bbb8672 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -60,148 +60,6 @@ public partial struct AmountOfSubstance : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable AmountOfSubstance from nullable Centimoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromCentimoles(QuantityValue? centimoles) - { - return centimoles.HasValue ? FromCentimoles(centimoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable CentipoundMoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromCentipoundMoles(QuantityValue? centipoundmoles) - { - return centipoundmoles.HasValue ? FromCentipoundMoles(centipoundmoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable Decimoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromDecimoles(QuantityValue? decimoles) - { - return decimoles.HasValue ? FromDecimoles(decimoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable DecipoundMoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromDecipoundMoles(QuantityValue? decipoundmoles) - { - return decipoundmoles.HasValue ? FromDecipoundMoles(decipoundmoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable Kilomoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromKilomoles(QuantityValue? kilomoles) - { - return kilomoles.HasValue ? FromKilomoles(kilomoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable KilopoundMoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromKilopoundMoles(QuantityValue? kilopoundmoles) - { - return kilopoundmoles.HasValue ? FromKilopoundMoles(kilopoundmoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable Micromoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromMicromoles(QuantityValue? micromoles) - { - return micromoles.HasValue ? FromMicromoles(micromoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable MicropoundMoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromMicropoundMoles(QuantityValue? micropoundmoles) - { - return micropoundmoles.HasValue ? FromMicropoundMoles(micropoundmoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable Millimoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromMillimoles(QuantityValue? millimoles) - { - return millimoles.HasValue ? FromMillimoles(millimoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable MillipoundMoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromMillipoundMoles(QuantityValue? millipoundmoles) - { - return millipoundmoles.HasValue ? FromMillipoundMoles(millipoundmoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable Moles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromMoles(QuantityValue? moles) - { - return moles.HasValue ? FromMoles(moles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable Nanomoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromNanomoles(QuantityValue? nanomoles) - { - return nanomoles.HasValue ? FromNanomoles(nanomoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable NanopoundMoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmountOfSubstance? FromNanopoundMoles(QuantityValue? nanopoundmoles) - { - return nanopoundmoles.HasValue ? FromNanopoundMoles(nanopoundmoles.Value) : default(AmountOfSubstance?); - } - - /// - /// Get nullable AmountOfSubstance from nullable PoundMoles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmountOfSubstance? From(QuantityValue? value, AmountOfSubstanceUnit fromUnit) - { - return value.HasValue ? new AmountOfSubstance((double)value.Value, fromUnit) : default(AmountOfSubstance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index 23c643afd5..b6b7872a4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct AmplitudeRatio : IComparable, IComparable /// public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable AmplitudeRatio from nullable DecibelMicrovolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmplitudeRatio? FromDecibelMicrovolts(QuantityValue? decibelmicrovolts) - { - return decibelmicrovolts.HasValue ? FromDecibelMicrovolts(decibelmicrovolts.Value) : default(AmplitudeRatio?); - } - - /// - /// Get nullable AmplitudeRatio from nullable DecibelMillivolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmplitudeRatio? FromDecibelMillivolts(QuantityValue? decibelmillivolts) - { - return decibelmillivolts.HasValue ? FromDecibelMillivolts(decibelmillivolts.Value) : default(AmplitudeRatio?); - } - - /// - /// Get nullable AmplitudeRatio from nullable DecibelsUnloaded. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AmplitudeRatio? FromDecibelsUnloaded(QuantityValue? decibelsunloaded) - { - return decibelsunloaded.HasValue ? FromDecibelsUnloaded(decibelsunloaded.Value) : default(AmplitudeRatio?); - } - - /// - /// Get nullable AmplitudeRatio from nullable DecibelVolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AmplitudeRatio? From(QuantityValue? value, AmplitudeRatioUnit fromUnit) - { - return value.HasValue ? new AmplitudeRatio((double)value.Value, fromUnit) : default(AmplitudeRatio?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index ca02498de4..0836147276 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -60,148 +60,6 @@ public partial struct Angle : IComparable, IComparable /// public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Angle from nullable Arcminutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromArcminutes(QuantityValue? arcminutes) - { - return arcminutes.HasValue ? FromArcminutes(arcminutes.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Arcseconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromArcseconds(QuantityValue? arcseconds) - { - return arcseconds.HasValue ? FromArcseconds(arcseconds.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Centiradians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromCentiradians(QuantityValue? centiradians) - { - return centiradians.HasValue ? FromCentiradians(centiradians.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Deciradians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromDeciradians(QuantityValue? deciradians) - { - return deciradians.HasValue ? FromDeciradians(deciradians.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Degrees. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromDegrees(QuantityValue? degrees) - { - return degrees.HasValue ? FromDegrees(degrees.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Gradians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromGradians(QuantityValue? gradians) - { - return gradians.HasValue ? FromGradians(gradians.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Microdegrees. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromMicrodegrees(QuantityValue? microdegrees) - { - return microdegrees.HasValue ? FromMicrodegrees(microdegrees.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Microradians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromMicroradians(QuantityValue? microradians) - { - return microradians.HasValue ? FromMicroradians(microradians.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Millidegrees. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromMillidegrees(QuantityValue? millidegrees) - { - return millidegrees.HasValue ? FromMillidegrees(millidegrees.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Milliradians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromMilliradians(QuantityValue? milliradians) - { - return milliradians.HasValue ? FromMilliradians(milliradians.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Nanodegrees. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromNanodegrees(QuantityValue? nanodegrees) - { - return nanodegrees.HasValue ? FromNanodegrees(nanodegrees.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Nanoradians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromNanoradians(QuantityValue? nanoradians) - { - return nanoradians.HasValue ? FromNanoradians(nanoradians.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Radians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Angle? FromRadians(QuantityValue? radians) - { - return radians.HasValue ? FromRadians(radians.Value) : default(Angle?); - } - - /// - /// Get nullable Angle from nullable Revolutions. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Angle? From(QuantityValue? value, AngleUnit fromUnit) - { - return value.HasValue ? new Angle((double)value.Value, fromUnit) : default(Angle?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 05dfc23e9d..d6b822b78e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct ApparentEnergy : IComparable, IComparable /// public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ApparentEnergy from nullable KilovoltampereHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ApparentEnergy? FromKilovoltampereHours(QuantityValue? kilovoltamperehours) - { - return kilovoltamperehours.HasValue ? FromKilovoltampereHours(kilovoltamperehours.Value) : default(ApparentEnergy?); - } - - /// - /// Get nullable ApparentEnergy from nullable MegavoltampereHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ApparentEnergy? FromMegavoltampereHours(QuantityValue? megavoltamperehours) - { - return megavoltamperehours.HasValue ? FromMegavoltampereHours(megavoltamperehours.Value) : default(ApparentEnergy?); - } - - /// - /// Get nullable ApparentEnergy from nullable VoltampereHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentEnergy? From(QuantityValue? value, ApparentEnergyUnit fromUnit) - { - return value.HasValue ? new ApparentEnergy((double)value.Value, fromUnit) : default(ApparentEnergy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index aea8d678f7..768eea8baa 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct ApparentPower : IComparable, IComparable /// public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ApparentPower from nullable Gigavoltamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ApparentPower? FromGigavoltamperes(QuantityValue? gigavoltamperes) - { - return gigavoltamperes.HasValue ? FromGigavoltamperes(gigavoltamperes.Value) : default(ApparentPower?); - } - - /// - /// Get nullable ApparentPower from nullable Kilovoltamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ApparentPower? FromKilovoltamperes(QuantityValue? kilovoltamperes) - { - return kilovoltamperes.HasValue ? FromKilovoltamperes(kilovoltamperes.Value) : default(ApparentPower?); - } - - /// - /// Get nullable ApparentPower from nullable Megavoltamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ApparentPower? FromMegavoltamperes(QuantityValue? megavoltamperes) - { - return megavoltamperes.HasValue ? FromMegavoltamperes(megavoltamperes.Value) : default(ApparentPower?); - } - - /// - /// Get nullable ApparentPower from nullable Voltamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ApparentPower? From(QuantityValue? value, ApparentPowerUnit fromUnit) - { - return value.HasValue ? new ApparentPower((double)value.Value, fromUnit) : default(ApparentPower?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 5235e24c0d..848e6678de 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -60,139 +60,6 @@ public partial struct Area : IComparable, IComparable /// public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Area from nullable Acres. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromAcres(QuantityValue? acres) - { - return acres.HasValue ? FromAcres(acres.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable Hectares. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromHectares(QuantityValue? hectares) - { - return hectares.HasValue ? FromHectares(hectares.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareCentimeters(QuantityValue? squarecentimeters) - { - return squarecentimeters.HasValue ? FromSquareCentimeters(squarecentimeters.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareDecimeters(QuantityValue? squaredecimeters) - { - return squaredecimeters.HasValue ? FromSquareDecimeters(squaredecimeters.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareFeet(QuantityValue? squarefeet) - { - return squarefeet.HasValue ? FromSquareFeet(squarefeet.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareInches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareInches(QuantityValue? squareinches) - { - return squareinches.HasValue ? FromSquareInches(squareinches.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareKilometers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareKilometers(QuantityValue? squarekilometers) - { - return squarekilometers.HasValue ? FromSquareKilometers(squarekilometers.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareMeters(QuantityValue? squaremeters) - { - return squaremeters.HasValue ? FromSquareMeters(squaremeters.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareMicrometers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareMicrometers(QuantityValue? squaremicrometers) - { - return squaremicrometers.HasValue ? FromSquareMicrometers(squaremicrometers.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareMiles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareMiles(QuantityValue? squaremiles) - { - return squaremiles.HasValue ? FromSquareMiles(squaremiles.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareMillimeters(QuantityValue? squaremillimeters) - { - return squaremillimeters.HasValue ? FromSquareMillimeters(squaremillimeters.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable SquareYards. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Area? FromSquareYards(QuantityValue? squareyards) - { - return squareyards.HasValue ? FromSquareYards(squareyards.Value) : default(Area?); - } - - /// - /// Get nullable Area from nullable UsSurveySquareFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Area? From(QuantityValue? value, AreaUnit fromUnit) - { - return value.HasValue ? new Area((double)value.Value, fromUnit) : default(Area?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 842a74b281..22183d61bd 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct AreaDensity : IComparable, IComparable /// public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable AreaDensity from nullable KilogramsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaDensity? From(QuantityValue? value, AreaDensityUnit fromUnit) - { - return value.HasValue ? new AreaDensity((double)value.Value, fromUnit) : default(AreaDensity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 76f090fc9d..9474a70716 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -60,76 +60,6 @@ public partial struct AreaMomentOfInertia : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable AreaMomentOfInertia from nullable CentimetersToTheFourth. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AreaMomentOfInertia? FromCentimetersToTheFourth(QuantityValue? centimeterstothefourth) - { - return centimeterstothefourth.HasValue ? FromCentimetersToTheFourth(centimeterstothefourth.Value) : default(AreaMomentOfInertia?); - } - - /// - /// Get nullable AreaMomentOfInertia from nullable DecimetersToTheFourth. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AreaMomentOfInertia? FromDecimetersToTheFourth(QuantityValue? decimeterstothefourth) - { - return decimeterstothefourth.HasValue ? FromDecimetersToTheFourth(decimeterstothefourth.Value) : default(AreaMomentOfInertia?); - } - - /// - /// Get nullable AreaMomentOfInertia from nullable FeetToTheFourth. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AreaMomentOfInertia? FromFeetToTheFourth(QuantityValue? feettothefourth) - { - return feettothefourth.HasValue ? FromFeetToTheFourth(feettothefourth.Value) : default(AreaMomentOfInertia?); - } - - /// - /// Get nullable AreaMomentOfInertia from nullable InchesToTheFourth. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AreaMomentOfInertia? FromInchesToTheFourth(QuantityValue? inchestothefourth) - { - return inchestothefourth.HasValue ? FromInchesToTheFourth(inchestothefourth.Value) : default(AreaMomentOfInertia?); - } - - /// - /// Get nullable AreaMomentOfInertia from nullable MetersToTheFourth. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static AreaMomentOfInertia? FromMetersToTheFourth(QuantityValue? meterstothefourth) - { - return meterstothefourth.HasValue ? FromMetersToTheFourth(meterstothefourth.Value) : default(AreaMomentOfInertia?); - } - - /// - /// Get nullable AreaMomentOfInertia from nullable MillimetersToTheFourth. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static AreaMomentOfInertia? From(QuantityValue? value, AreaMomentOfInertiaUnit fromUnit) - { - return value.HasValue ? new AreaMomentOfInertia((double)value.Value, fromUnit) : default(AreaMomentOfInertia?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 222a886e70..9d59eb703f 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -60,256 +60,6 @@ public partial struct BitRate : IComparable, IComparable /// public decimal Value => _value; - #region Nullable From Methods - - /// - /// Get nullable BitRate from nullable BitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromBitsPerSecond(QuantityValue? bitspersecond) - { - return bitspersecond.HasValue ? FromBitsPerSecond(bitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable BytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromBytesPerSecond(QuantityValue? bytespersecond) - { - return bytespersecond.HasValue ? FromBytesPerSecond(bytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable ExabitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromExabitsPerSecond(QuantityValue? exabitspersecond) - { - return exabitspersecond.HasValue ? FromExabitsPerSecond(exabitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable ExabytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromExabytesPerSecond(QuantityValue? exabytespersecond) - { - return exabytespersecond.HasValue ? FromExabytesPerSecond(exabytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable ExbibitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromExbibitsPerSecond(QuantityValue? exbibitspersecond) - { - return exbibitspersecond.HasValue ? FromExbibitsPerSecond(exbibitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable ExbibytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromExbibytesPerSecond(QuantityValue? exbibytespersecond) - { - return exbibytespersecond.HasValue ? FromExbibytesPerSecond(exbibytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable GibibitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromGibibitsPerSecond(QuantityValue? gibibitspersecond) - { - return gibibitspersecond.HasValue ? FromGibibitsPerSecond(gibibitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable GibibytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromGibibytesPerSecond(QuantityValue? gibibytespersecond) - { - return gibibytespersecond.HasValue ? FromGibibytesPerSecond(gibibytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable GigabitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromGigabitsPerSecond(QuantityValue? gigabitspersecond) - { - return gigabitspersecond.HasValue ? FromGigabitsPerSecond(gigabitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable GigabytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromGigabytesPerSecond(QuantityValue? gigabytespersecond) - { - return gigabytespersecond.HasValue ? FromGigabytesPerSecond(gigabytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable KibibitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromKibibitsPerSecond(QuantityValue? kibibitspersecond) - { - return kibibitspersecond.HasValue ? FromKibibitsPerSecond(kibibitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable KibibytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromKibibytesPerSecond(QuantityValue? kibibytespersecond) - { - return kibibytespersecond.HasValue ? FromKibibytesPerSecond(kibibytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable KilobitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromKilobitsPerSecond(QuantityValue? kilobitspersecond) - { - return kilobitspersecond.HasValue ? FromKilobitsPerSecond(kilobitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable KilobytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromKilobytesPerSecond(QuantityValue? kilobytespersecond) - { - return kilobytespersecond.HasValue ? FromKilobytesPerSecond(kilobytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable MebibitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromMebibitsPerSecond(QuantityValue? mebibitspersecond) - { - return mebibitspersecond.HasValue ? FromMebibitsPerSecond(mebibitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable MebibytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromMebibytesPerSecond(QuantityValue? mebibytespersecond) - { - return mebibytespersecond.HasValue ? FromMebibytesPerSecond(mebibytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable MegabitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromMegabitsPerSecond(QuantityValue? megabitspersecond) - { - return megabitspersecond.HasValue ? FromMegabitsPerSecond(megabitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable MegabytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromMegabytesPerSecond(QuantityValue? megabytespersecond) - { - return megabytespersecond.HasValue ? FromMegabytesPerSecond(megabytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable PebibitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromPebibitsPerSecond(QuantityValue? pebibitspersecond) - { - return pebibitspersecond.HasValue ? FromPebibitsPerSecond(pebibitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable PebibytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromPebibytesPerSecond(QuantityValue? pebibytespersecond) - { - return pebibytespersecond.HasValue ? FromPebibytesPerSecond(pebibytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable PetabitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromPetabitsPerSecond(QuantityValue? petabitspersecond) - { - return petabitspersecond.HasValue ? FromPetabitsPerSecond(petabitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable PetabytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromPetabytesPerSecond(QuantityValue? petabytespersecond) - { - return petabytespersecond.HasValue ? FromPetabytesPerSecond(petabytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable TebibitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromTebibitsPerSecond(QuantityValue? tebibitspersecond) - { - return tebibitspersecond.HasValue ? FromTebibitsPerSecond(tebibitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable TebibytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromTebibytesPerSecond(QuantityValue? tebibytespersecond) - { - return tebibytespersecond.HasValue ? FromTebibytesPerSecond(tebibytespersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable TerabitsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BitRate? FromTerabitsPerSecond(QuantityValue? terabitspersecond) - { - return terabitspersecond.HasValue ? FromTerabitsPerSecond(terabitspersecond.Value) : default(BitRate?); - } - - /// - /// Get nullable BitRate from nullable TerabytesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BitRate? From(QuantityValue? value, BitRateUnit fromUnit) - { - return value.HasValue ? new BitRate((decimal)value.Value, fromUnit) : default(BitRate?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 9de58b5023..9e625bd2c0 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct BrakeSpecificFuelConsumption : IComparable, IComparable
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable BrakeSpecificFuelConsumption from nullable GramsPerKiloWattHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BrakeSpecificFuelConsumption? FromGramsPerKiloWattHour(QuantityValue? gramsperkilowatthour) - { - return gramsperkilowatthour.HasValue ? FromGramsPerKiloWattHour(gramsperkilowatthour.Value) : default(BrakeSpecificFuelConsumption?); - } - - /// - /// Get nullable BrakeSpecificFuelConsumption from nullable KilogramsPerJoule. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static BrakeSpecificFuelConsumption? FromKilogramsPerJoule(QuantityValue? kilogramsperjoule) - { - return kilogramsperjoule.HasValue ? FromKilogramsPerJoule(kilogramsperjoule.Value) : default(BrakeSpecificFuelConsumption?); - } - - /// - /// Get nullable BrakeSpecificFuelConsumption from nullable PoundsPerMechanicalHorsepowerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static BrakeSpecificFuelConsumption? From(QuantityValue? value, BrakeSpecificFuelConsumptionUnit fromUnit) - { - return value.HasValue ? new BrakeSpecificFuelConsumption((double)value.Value, fromUnit) : default(BrakeSpecificFuelConsumption?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 1a0f3a3dd9..45f0edafa3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct Capacitance : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Capacitance from nullable Farads. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Capacitance? From(QuantityValue? value, CapacitanceUnit fromUnit) - { - return value.HasValue ? new Capacitance((double)value.Value, fromUnit) : default(Capacitance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index adc1b74e5f..62938a27d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -60,364 +60,6 @@ public partial struct Density : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Density from nullable CentigramsPerDeciLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromCentigramsPerDeciLiter(QuantityValue? centigramsperdeciliter) - { - return centigramsperdeciliter.HasValue ? FromCentigramsPerDeciLiter(centigramsperdeciliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable CentigramsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromCentigramsPerLiter(QuantityValue? centigramsperliter) - { - return centigramsperliter.HasValue ? FromCentigramsPerLiter(centigramsperliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable CentigramsPerMilliliter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromCentigramsPerMilliliter(QuantityValue? centigramspermilliliter) - { - return centigramspermilliliter.HasValue ? FromCentigramsPerMilliliter(centigramspermilliliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable DecigramsPerDeciLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromDecigramsPerDeciLiter(QuantityValue? decigramsperdeciliter) - { - return decigramsperdeciliter.HasValue ? FromDecigramsPerDeciLiter(decigramsperdeciliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable DecigramsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromDecigramsPerLiter(QuantityValue? decigramsperliter) - { - return decigramsperliter.HasValue ? FromDecigramsPerLiter(decigramsperliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable DecigramsPerMilliliter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromDecigramsPerMilliliter(QuantityValue? decigramspermilliliter) - { - return decigramspermilliliter.HasValue ? FromDecigramsPerMilliliter(decigramspermilliliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable GramsPerCubicCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromGramsPerCubicCentimeter(QuantityValue? gramspercubiccentimeter) - { - return gramspercubiccentimeter.HasValue ? FromGramsPerCubicCentimeter(gramspercubiccentimeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable GramsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromGramsPerCubicMeter(QuantityValue? gramspercubicmeter) - { - return gramspercubicmeter.HasValue ? FromGramsPerCubicMeter(gramspercubicmeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable GramsPerCubicMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromGramsPerCubicMillimeter(QuantityValue? gramspercubicmillimeter) - { - return gramspercubicmillimeter.HasValue ? FromGramsPerCubicMillimeter(gramspercubicmillimeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable GramsPerDeciLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromGramsPerDeciLiter(QuantityValue? gramsperdeciliter) - { - return gramsperdeciliter.HasValue ? FromGramsPerDeciLiter(gramsperdeciliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable GramsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromGramsPerLiter(QuantityValue? gramsperliter) - { - return gramsperliter.HasValue ? FromGramsPerLiter(gramsperliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable GramsPerMilliliter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromGramsPerMilliliter(QuantityValue? gramspermilliliter) - { - return gramspermilliliter.HasValue ? FromGramsPerMilliliter(gramspermilliliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable KilogramsPerCubicCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromKilogramsPerCubicCentimeter(QuantityValue? kilogramspercubiccentimeter) - { - return kilogramspercubiccentimeter.HasValue ? FromKilogramsPerCubicCentimeter(kilogramspercubiccentimeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable KilogramsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromKilogramsPerCubicMeter(QuantityValue? kilogramspercubicmeter) - { - return kilogramspercubicmeter.HasValue ? FromKilogramsPerCubicMeter(kilogramspercubicmeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable KilogramsPerCubicMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromKilogramsPerCubicMillimeter(QuantityValue? kilogramspercubicmillimeter) - { - return kilogramspercubicmillimeter.HasValue ? FromKilogramsPerCubicMillimeter(kilogramspercubicmillimeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable KilopoundsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromKilopoundsPerCubicFoot(QuantityValue? kilopoundspercubicfoot) - { - return kilopoundspercubicfoot.HasValue ? FromKilopoundsPerCubicFoot(kilopoundspercubicfoot.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable KilopoundsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromKilopoundsPerCubicInch(QuantityValue? kilopoundspercubicinch) - { - return kilopoundspercubicinch.HasValue ? FromKilopoundsPerCubicInch(kilopoundspercubicinch.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable MicrogramsPerDeciLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromMicrogramsPerDeciLiter(QuantityValue? microgramsperdeciliter) - { - return microgramsperdeciliter.HasValue ? FromMicrogramsPerDeciLiter(microgramsperdeciliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable MicrogramsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromMicrogramsPerLiter(QuantityValue? microgramsperliter) - { - return microgramsperliter.HasValue ? FromMicrogramsPerLiter(microgramsperliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable MicrogramsPerMilliliter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromMicrogramsPerMilliliter(QuantityValue? microgramspermilliliter) - { - return microgramspermilliliter.HasValue ? FromMicrogramsPerMilliliter(microgramspermilliliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable MilligramsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromMilligramsPerCubicMeter(QuantityValue? milligramspercubicmeter) - { - return milligramspercubicmeter.HasValue ? FromMilligramsPerCubicMeter(milligramspercubicmeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable MilligramsPerDeciLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromMilligramsPerDeciLiter(QuantityValue? milligramsperdeciliter) - { - return milligramsperdeciliter.HasValue ? FromMilligramsPerDeciLiter(milligramsperdeciliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable MilligramsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromMilligramsPerLiter(QuantityValue? milligramsperliter) - { - return milligramsperliter.HasValue ? FromMilligramsPerLiter(milligramsperliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable MilligramsPerMilliliter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromMilligramsPerMilliliter(QuantityValue? milligramspermilliliter) - { - return milligramspermilliliter.HasValue ? FromMilligramsPerMilliliter(milligramspermilliliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable NanogramsPerDeciLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromNanogramsPerDeciLiter(QuantityValue? nanogramsperdeciliter) - { - return nanogramsperdeciliter.HasValue ? FromNanogramsPerDeciLiter(nanogramsperdeciliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable NanogramsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromNanogramsPerLiter(QuantityValue? nanogramsperliter) - { - return nanogramsperliter.HasValue ? FromNanogramsPerLiter(nanogramsperliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable NanogramsPerMilliliter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromNanogramsPerMilliliter(QuantityValue? nanogramspermilliliter) - { - return nanogramspermilliliter.HasValue ? FromNanogramsPerMilliliter(nanogramspermilliliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable PicogramsPerDeciLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromPicogramsPerDeciLiter(QuantityValue? picogramsperdeciliter) - { - return picogramsperdeciliter.HasValue ? FromPicogramsPerDeciLiter(picogramsperdeciliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable PicogramsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromPicogramsPerLiter(QuantityValue? picogramsperliter) - { - return picogramsperliter.HasValue ? FromPicogramsPerLiter(picogramsperliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable PicogramsPerMilliliter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromPicogramsPerMilliliter(QuantityValue? picogramspermilliliter) - { - return picogramspermilliliter.HasValue ? FromPicogramsPerMilliliter(picogramspermilliliter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable PoundsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromPoundsPerCubicFoot(QuantityValue? poundspercubicfoot) - { - return poundspercubicfoot.HasValue ? FromPoundsPerCubicFoot(poundspercubicfoot.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable PoundsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromPoundsPerCubicInch(QuantityValue? poundspercubicinch) - { - return poundspercubicinch.HasValue ? FromPoundsPerCubicInch(poundspercubicinch.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable PoundsPerImperialGallon. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromPoundsPerImperialGallon(QuantityValue? poundsperimperialgallon) - { - return poundsperimperialgallon.HasValue ? FromPoundsPerImperialGallon(poundsperimperialgallon.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable PoundsPerUSGallon. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromPoundsPerUSGallon(QuantityValue? poundsperusgallon) - { - return poundsperusgallon.HasValue ? FromPoundsPerUSGallon(poundsperusgallon.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable SlugsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromSlugsPerCubicFoot(QuantityValue? slugspercubicfoot) - { - return slugspercubicfoot.HasValue ? FromSlugsPerCubicFoot(slugspercubicfoot.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable TonnesPerCubicCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromTonnesPerCubicCentimeter(QuantityValue? tonnespercubiccentimeter) - { - return tonnespercubiccentimeter.HasValue ? FromTonnesPerCubicCentimeter(tonnespercubiccentimeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable TonnesPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Density? FromTonnesPerCubicMeter(QuantityValue? tonnespercubicmeter) - { - return tonnespercubicmeter.HasValue ? FromTonnesPerCubicMeter(tonnespercubicmeter.Value) : default(Density?); - } - - /// - /// Get nullable Density from nullable TonnesPerCubicMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Density? From(QuantityValue? value, DensityUnit fromUnit) - { - return value.HasValue ? new Density((double)value.Value, fromUnit) : default(Density?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 351f373794..4c5090f276 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -60,130 +60,6 @@ public partial struct Duration : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Duration from nullable Days. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromDays(QuantityValue? days) - { - return days.HasValue ? FromDays(days.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Hours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromHours(QuantityValue? hours) - { - return hours.HasValue ? FromHours(hours.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Microseconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromMicroseconds(QuantityValue? microseconds) - { - return microseconds.HasValue ? FromMicroseconds(microseconds.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Milliseconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromMilliseconds(QuantityValue? milliseconds) - { - return milliseconds.HasValue ? FromMilliseconds(milliseconds.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Minutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromMinutes(QuantityValue? minutes) - { - return minutes.HasValue ? FromMinutes(minutes.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Months. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromMonths(QuantityValue? months) - { - return months.HasValue ? FromMonths(months.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Months30. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromMonths30(QuantityValue? months30) - { - return months30.HasValue ? FromMonths30(months30.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Nanoseconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromNanoseconds(QuantityValue? nanoseconds) - { - return nanoseconds.HasValue ? FromNanoseconds(nanoseconds.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Seconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromSeconds(QuantityValue? seconds) - { - return seconds.HasValue ? FromSeconds(seconds.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Weeks. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromWeeks(QuantityValue? weeks) - { - return weeks.HasValue ? FromWeeks(weeks.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Years. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Duration? FromYears(QuantityValue? years) - { - return years.HasValue ? FromYears(years.Value) : default(Duration?); - } - - /// - /// Get nullable Duration from nullable Years365. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Duration? From(QuantityValue? value, DurationUnit fromUnit) - { - return value.HasValue ? new Duration((double)value.Value, fromUnit) : default(Duration?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index 40c15616e8..626a349819 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -60,76 +60,6 @@ public partial struct DynamicViscosity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable DynamicViscosity from nullable Centipoise. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static DynamicViscosity? FromCentipoise(QuantityValue? centipoise) - { - return centipoise.HasValue ? FromCentipoise(centipoise.Value) : default(DynamicViscosity?); - } - - /// - /// Get nullable DynamicViscosity from nullable MicropascalSeconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static DynamicViscosity? FromMicropascalSeconds(QuantityValue? micropascalseconds) - { - return micropascalseconds.HasValue ? FromMicropascalSeconds(micropascalseconds.Value) : default(DynamicViscosity?); - } - - /// - /// Get nullable DynamicViscosity from nullable MillipascalSeconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static DynamicViscosity? FromMillipascalSeconds(QuantityValue? millipascalseconds) - { - return millipascalseconds.HasValue ? FromMillipascalSeconds(millipascalseconds.Value) : default(DynamicViscosity?); - } - - /// - /// Get nullable DynamicViscosity from nullable NewtonSecondsPerMeterSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static DynamicViscosity? FromNewtonSecondsPerMeterSquared(QuantityValue? newtonsecondspermetersquared) - { - return newtonsecondspermetersquared.HasValue ? FromNewtonSecondsPerMeterSquared(newtonsecondspermetersquared.Value) : default(DynamicViscosity?); - } - - /// - /// Get nullable DynamicViscosity from nullable PascalSeconds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static DynamicViscosity? FromPascalSeconds(QuantityValue? pascalseconds) - { - return pascalseconds.HasValue ? FromPascalSeconds(pascalseconds.Value) : default(DynamicViscosity?); - } - - /// - /// Get nullable DynamicViscosity from nullable Poise. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static DynamicViscosity? From(QuantityValue? value, DynamicViscosityUnit fromUnit) - { - return value.HasValue ? new DynamicViscosity((double)value.Value, fromUnit) : default(DynamicViscosity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index d1814b926c..9e9515bb29 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct ElectricAdmittance : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricAdmittance from nullable Microsiemens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricAdmittance? FromMicrosiemens(QuantityValue? microsiemens) - { - return microsiemens.HasValue ? FromMicrosiemens(microsiemens.Value) : default(ElectricAdmittance?); - } - - /// - /// Get nullable ElectricAdmittance from nullable Millisiemens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricAdmittance? FromMillisiemens(QuantityValue? millisiemens) - { - return millisiemens.HasValue ? FromMillisiemens(millisiemens.Value) : default(ElectricAdmittance?); - } - - /// - /// Get nullable ElectricAdmittance from nullable Nanosiemens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricAdmittance? FromNanosiemens(QuantityValue? nanosiemens) - { - return nanosiemens.HasValue ? FromNanosiemens(nanosiemens.Value) : default(ElectricAdmittance?); - } - - /// - /// Get nullable ElectricAdmittance from nullable Siemens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricAdmittance? From(QuantityValue? value, ElectricAdmittanceUnit fromUnit) - { - return value.HasValue ? new ElectricAdmittance((double)value.Value, fromUnit) : default(ElectricAdmittance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index de311c02d2..2246311187 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct ElectricCharge : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricCharge from nullable Coulombs. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCharge? From(QuantityValue? value, ElectricChargeUnit fromUnit) - { - return value.HasValue ? new ElectricCharge((double)value.Value, fromUnit) : default(ElectricCharge?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index e5ac919058..b24018a2c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct ElectricChargeDensity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricChargeDensity from nullable CoulombsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricChargeDensity? From(QuantityValue? value, ElectricChargeDensityUnit fromUnit) - { - return value.HasValue ? new ElectricChargeDensity((double)value.Value, fromUnit) : default(ElectricChargeDensity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index c8e5ee97db..0c90e51a46 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct ElectricConductance : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricConductance from nullable Microsiemens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricConductance? FromMicrosiemens(QuantityValue? microsiemens) - { - return microsiemens.HasValue ? FromMicrosiemens(microsiemens.Value) : default(ElectricConductance?); - } - - /// - /// Get nullable ElectricConductance from nullable Millisiemens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricConductance? FromMillisiemens(QuantityValue? millisiemens) - { - return millisiemens.HasValue ? FromMillisiemens(millisiemens.Value) : default(ElectricConductance?); - } - - /// - /// Get nullable ElectricConductance from nullable Siemens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricConductance? From(QuantityValue? value, ElectricConductanceUnit fromUnit) - { - return value.HasValue ? new ElectricConductance((double)value.Value, fromUnit) : default(ElectricConductance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index d74de9be33..861ada2fe5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct ElectricConductivity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricConductivity from nullable SiemensPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricConductivity? From(QuantityValue? value, ElectricConductivityUnit fromUnit) - { - return value.HasValue ? new ElectricConductivity((double)value.Value, fromUnit) : default(ElectricConductivity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 0f5858fe1b..911b3ff983 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -60,94 +60,6 @@ public partial struct ElectricCurrent : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricCurrent from nullable Amperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricCurrent? FromAmperes(QuantityValue? amperes) - { - return amperes.HasValue ? FromAmperes(amperes.Value) : default(ElectricCurrent?); - } - - /// - /// Get nullable ElectricCurrent from nullable Centiamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricCurrent? FromCentiamperes(QuantityValue? centiamperes) - { - return centiamperes.HasValue ? FromCentiamperes(centiamperes.Value) : default(ElectricCurrent?); - } - - /// - /// Get nullable ElectricCurrent from nullable Kiloamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricCurrent? FromKiloamperes(QuantityValue? kiloamperes) - { - return kiloamperes.HasValue ? FromKiloamperes(kiloamperes.Value) : default(ElectricCurrent?); - } - - /// - /// Get nullable ElectricCurrent from nullable Megaamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricCurrent? FromMegaamperes(QuantityValue? megaamperes) - { - return megaamperes.HasValue ? FromMegaamperes(megaamperes.Value) : default(ElectricCurrent?); - } - - /// - /// Get nullable ElectricCurrent from nullable Microamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricCurrent? FromMicroamperes(QuantityValue? microamperes) - { - return microamperes.HasValue ? FromMicroamperes(microamperes.Value) : default(ElectricCurrent?); - } - - /// - /// Get nullable ElectricCurrent from nullable Milliamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricCurrent? FromMilliamperes(QuantityValue? milliamperes) - { - return milliamperes.HasValue ? FromMilliamperes(milliamperes.Value) : default(ElectricCurrent?); - } - - /// - /// Get nullable ElectricCurrent from nullable Nanoamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricCurrent? FromNanoamperes(QuantityValue? nanoamperes) - { - return nanoamperes.HasValue ? FromNanoamperes(nanoamperes.Value) : default(ElectricCurrent?); - } - - /// - /// Get nullable ElectricCurrent from nullable Picoamperes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrent? From(QuantityValue? value, ElectricCurrentUnit fromUnit) - { - return value.HasValue ? new ElectricCurrent((double)value.Value, fromUnit) : default(ElectricCurrent?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 4ac621d58f..4e26f2b295 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct ElectricCurrentDensity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricCurrentDensity from nullable AmperesPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrentDensity? From(QuantityValue? value, ElectricCurrentDensityUnit fromUnit) - { - return value.HasValue ? new ElectricCurrentDensity((double)value.Value, fromUnit) : default(ElectricCurrentDensity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 1bdea233a1..90cc5d2e3a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct ElectricCurrentGradient : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricCurrentGradient from nullable AmperesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricCurrentGradient? From(QuantityValue? value, ElectricCurrentGradientUnit fromUnit) - { - return value.HasValue ? new ElectricCurrentGradient((double)value.Value, fromUnit) : default(ElectricCurrentGradient?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 5f7b4d55cd..fa4d78c78b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct ElectricField : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricField from nullable VoltsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricField? From(QuantityValue? value, ElectricFieldUnit fromUnit) - { - return value.HasValue ? new ElectricField((double)value.Value, fromUnit) : default(ElectricField?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 8b8e0060e5..885d7d6bd0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct ElectricInductance : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricInductance from nullable Henries. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricInductance? From(QuantityValue? value, ElectricInductanceUnit fromUnit) - { - return value.HasValue ? new ElectricInductance((double)value.Value, fromUnit) : default(ElectricInductance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index f9cebf55a4..0741dbc127 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -60,67 +60,6 @@ public partial struct ElectricPotential : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricPotential from nullable Kilovolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotential? FromKilovolts(QuantityValue? kilovolts) - { - return kilovolts.HasValue ? FromKilovolts(kilovolts.Value) : default(ElectricPotential?); - } - - /// - /// Get nullable ElectricPotential from nullable Megavolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotential? FromMegavolts(QuantityValue? megavolts) - { - return megavolts.HasValue ? FromMegavolts(megavolts.Value) : default(ElectricPotential?); - } - - /// - /// Get nullable ElectricPotential from nullable Microvolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotential? FromMicrovolts(QuantityValue? microvolts) - { - return microvolts.HasValue ? FromMicrovolts(microvolts.Value) : default(ElectricPotential?); - } - - /// - /// Get nullable ElectricPotential from nullable Millivolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotential? FromMillivolts(QuantityValue? millivolts) - { - return millivolts.HasValue ? FromMillivolts(millivolts.Value) : default(ElectricPotential?); - } - - /// - /// Get nullable ElectricPotential from nullable Volts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotential? From(QuantityValue? value, ElectricPotentialUnit fromUnit) - { - return value.HasValue ? new ElectricPotential((double)value.Value, fromUnit) : default(ElectricPotential?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index f3df5f0762..6174e002db 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -60,67 +60,6 @@ public partial struct ElectricPotentialAc : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricPotentialAc from nullable KilovoltsAc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialAc? FromKilovoltsAc(QuantityValue? kilovoltsac) - { - return kilovoltsac.HasValue ? FromKilovoltsAc(kilovoltsac.Value) : default(ElectricPotentialAc?); - } - - /// - /// Get nullable ElectricPotentialAc from nullable MegavoltsAc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialAc? FromMegavoltsAc(QuantityValue? megavoltsac) - { - return megavoltsac.HasValue ? FromMegavoltsAc(megavoltsac.Value) : default(ElectricPotentialAc?); - } - - /// - /// Get nullable ElectricPotentialAc from nullable MicrovoltsAc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialAc? FromMicrovoltsAc(QuantityValue? microvoltsac) - { - return microvoltsac.HasValue ? FromMicrovoltsAc(microvoltsac.Value) : default(ElectricPotentialAc?); - } - - /// - /// Get nullable ElectricPotentialAc from nullable MillivoltsAc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialAc? FromMillivoltsAc(QuantityValue? millivoltsac) - { - return millivoltsac.HasValue ? FromMillivoltsAc(millivoltsac.Value) : default(ElectricPotentialAc?); - } - - /// - /// Get nullable ElectricPotentialAc from nullable VoltsAc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialAc? From(QuantityValue? value, ElectricPotentialAcUnit fromUnit) - { - return value.HasValue ? new ElectricPotentialAc((double)value.Value, fromUnit) : default(ElectricPotentialAc?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index ea6f85c7ae..350e476513 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -60,67 +60,6 @@ public partial struct ElectricPotentialDc : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricPotentialDc from nullable KilovoltsDc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialDc? FromKilovoltsDc(QuantityValue? kilovoltsdc) - { - return kilovoltsdc.HasValue ? FromKilovoltsDc(kilovoltsdc.Value) : default(ElectricPotentialDc?); - } - - /// - /// Get nullable ElectricPotentialDc from nullable MegavoltsDc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialDc? FromMegavoltsDc(QuantityValue? megavoltsdc) - { - return megavoltsdc.HasValue ? FromMegavoltsDc(megavoltsdc.Value) : default(ElectricPotentialDc?); - } - - /// - /// Get nullable ElectricPotentialDc from nullable MicrovoltsDc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialDc? FromMicrovoltsDc(QuantityValue? microvoltsdc) - { - return microvoltsdc.HasValue ? FromMicrovoltsDc(microvoltsdc.Value) : default(ElectricPotentialDc?); - } - - /// - /// Get nullable ElectricPotentialDc from nullable MillivoltsDc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricPotentialDc? FromMillivoltsDc(QuantityValue? millivoltsdc) - { - return millivoltsdc.HasValue ? FromMillivoltsDc(millivoltsdc.Value) : default(ElectricPotentialDc?); - } - - /// - /// Get nullable ElectricPotentialDc from nullable VoltsDc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricPotentialDc? From(QuantityValue? value, ElectricPotentialDcUnit fromUnit) - { - return value.HasValue ? new ElectricPotentialDc((double)value.Value, fromUnit) : default(ElectricPotentialDc?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index df944cce7a..74eee349ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct ElectricResistance : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricResistance from nullable Kiloohms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricResistance? FromKiloohms(QuantityValue? kiloohms) - { - return kiloohms.HasValue ? FromKiloohms(kiloohms.Value) : default(ElectricResistance?); - } - - /// - /// Get nullable ElectricResistance from nullable Megaohms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricResistance? FromMegaohms(QuantityValue? megaohms) - { - return megaohms.HasValue ? FromMegaohms(megaohms.Value) : default(ElectricResistance?); - } - - /// - /// Get nullable ElectricResistance from nullable Milliohms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricResistance? FromMilliohms(QuantityValue? milliohms) - { - return milliohms.HasValue ? FromMilliohms(milliohms.Value) : default(ElectricResistance?); - } - - /// - /// Get nullable ElectricResistance from nullable Ohms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistance? From(QuantityValue? value, ElectricResistanceUnit fromUnit) - { - return value.HasValue ? new ElectricResistance((double)value.Value, fromUnit) : default(ElectricResistance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index e909be0ec1..31620023e2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct ElectricResistivity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ElectricResistivity from nullable MicroohmMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricResistivity? FromMicroohmMeters(QuantityValue? microohmmeters) - { - return microohmmeters.HasValue ? FromMicroohmMeters(microohmmeters.Value) : default(ElectricResistivity?); - } - - /// - /// Get nullable ElectricResistivity from nullable MilliohmMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricResistivity? FromMilliohmMeters(QuantityValue? milliohmmeters) - { - return milliohmmeters.HasValue ? FromMilliohmMeters(milliohmmeters.Value) : default(ElectricResistivity?); - } - - /// - /// Get nullable ElectricResistivity from nullable NanoohmMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ElectricResistivity? FromNanoohmMeters(QuantityValue? nanoohmmeters) - { - return nanoohmmeters.HasValue ? FromNanoohmMeters(nanoohmmeters.Value) : default(ElectricResistivity?); - } - - /// - /// Get nullable ElectricResistivity from nullable OhmMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ElectricResistivity? From(QuantityValue? value, ElectricResistivityUnit fromUnit) - { - return value.HasValue ? new ElectricResistivity((double)value.Value, fromUnit) : default(ElectricResistivity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 0aab5ee9a9..9d9a53ede1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -60,220 +60,6 @@ public partial struct Energy : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Energy from nullable BritishThermalUnits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromBritishThermalUnits(QuantityValue? britishthermalunits) - { - return britishthermalunits.HasValue ? FromBritishThermalUnits(britishthermalunits.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable Calories. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromCalories(QuantityValue? calories) - { - return calories.HasValue ? FromCalories(calories.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable DecathermsEc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromDecathermsEc(QuantityValue? decathermsec) - { - return decathermsec.HasValue ? FromDecathermsEc(decathermsec.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable DecathermsImperial. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromDecathermsImperial(QuantityValue? decathermsimperial) - { - return decathermsimperial.HasValue ? FromDecathermsImperial(decathermsimperial.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable DecathermsUs. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromDecathermsUs(QuantityValue? decathermsus) - { - return decathermsus.HasValue ? FromDecathermsUs(decathermsus.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable ElectronVolts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromElectronVolts(QuantityValue? electronvolts) - { - return electronvolts.HasValue ? FromElectronVolts(electronvolts.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable Ergs. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromErgs(QuantityValue? ergs) - { - return ergs.HasValue ? FromErgs(ergs.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable FootPounds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromFootPounds(QuantityValue? footpounds) - { - return footpounds.HasValue ? FromFootPounds(footpounds.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable GigabritishThermalUnits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromGigabritishThermalUnits(QuantityValue? gigabritishthermalunits) - { - return gigabritishthermalunits.HasValue ? FromGigabritishThermalUnits(gigabritishthermalunits.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable GigawattHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromGigawattHours(QuantityValue? gigawatthours) - { - return gigawatthours.HasValue ? FromGigawattHours(gigawatthours.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable Joules. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromJoules(QuantityValue? joules) - { - return joules.HasValue ? FromJoules(joules.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable KilobritishThermalUnits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromKilobritishThermalUnits(QuantityValue? kilobritishthermalunits) - { - return kilobritishthermalunits.HasValue ? FromKilobritishThermalUnits(kilobritishthermalunits.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable Kilocalories. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromKilocalories(QuantityValue? kilocalories) - { - return kilocalories.HasValue ? FromKilocalories(kilocalories.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable Kilojoules. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromKilojoules(QuantityValue? kilojoules) - { - return kilojoules.HasValue ? FromKilojoules(kilojoules.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable KilowattHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromKilowattHours(QuantityValue? kilowatthours) - { - return kilowatthours.HasValue ? FromKilowattHours(kilowatthours.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable MegabritishThermalUnits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromMegabritishThermalUnits(QuantityValue? megabritishthermalunits) - { - return megabritishthermalunits.HasValue ? FromMegabritishThermalUnits(megabritishthermalunits.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable Megajoules. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromMegajoules(QuantityValue? megajoules) - { - return megajoules.HasValue ? FromMegajoules(megajoules.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable MegawattHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromMegawattHours(QuantityValue? megawatthours) - { - return megawatthours.HasValue ? FromMegawattHours(megawatthours.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable ThermsEc. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromThermsEc(QuantityValue? thermsec) - { - return thermsec.HasValue ? FromThermsEc(thermsec.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable ThermsImperial. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromThermsImperial(QuantityValue? thermsimperial) - { - return thermsimperial.HasValue ? FromThermsImperial(thermsimperial.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable ThermsUs. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Energy? FromThermsUs(QuantityValue? thermsus) - { - return thermsus.HasValue ? FromThermsUs(thermsus.Value) : default(Energy?); - } - - /// - /// Get nullable Energy from nullable WattHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Energy? From(QuantityValue? value, EnergyUnit fromUnit) - { - return value.HasValue ? new Energy((double)value.Value, fromUnit) : default(Energy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 1e174a2486..7282579bf1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -60,85 +60,6 @@ public partial struct Entropy : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Entropy from nullable CaloriesPerKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Entropy? FromCaloriesPerKelvin(QuantityValue? caloriesperkelvin) - { - return caloriesperkelvin.HasValue ? FromCaloriesPerKelvin(caloriesperkelvin.Value) : default(Entropy?); - } - - /// - /// Get nullable Entropy from nullable JoulesPerDegreeCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Entropy? FromJoulesPerDegreeCelsius(QuantityValue? joulesperdegreecelsius) - { - return joulesperdegreecelsius.HasValue ? FromJoulesPerDegreeCelsius(joulesperdegreecelsius.Value) : default(Entropy?); - } - - /// - /// Get nullable Entropy from nullable JoulesPerKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Entropy? FromJoulesPerKelvin(QuantityValue? joulesperkelvin) - { - return joulesperkelvin.HasValue ? FromJoulesPerKelvin(joulesperkelvin.Value) : default(Entropy?); - } - - /// - /// Get nullable Entropy from nullable KilocaloriesPerKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Entropy? FromKilocaloriesPerKelvin(QuantityValue? kilocaloriesperkelvin) - { - return kilocaloriesperkelvin.HasValue ? FromKilocaloriesPerKelvin(kilocaloriesperkelvin.Value) : default(Entropy?); - } - - /// - /// Get nullable Entropy from nullable KilojoulesPerDegreeCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Entropy? FromKilojoulesPerDegreeCelsius(QuantityValue? kilojoulesperdegreecelsius) - { - return kilojoulesperdegreecelsius.HasValue ? FromKilojoulesPerDegreeCelsius(kilojoulesperdegreecelsius.Value) : default(Entropy?); - } - - /// - /// Get nullable Entropy from nullable KilojoulesPerKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Entropy? FromKilojoulesPerKelvin(QuantityValue? kilojoulesperkelvin) - { - return kilojoulesperkelvin.HasValue ? FromKilojoulesPerKelvin(kilojoulesperkelvin.Value) : default(Entropy?); - } - - /// - /// Get nullable Entropy from nullable MegajoulesPerKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Entropy? From(QuantityValue? value, EntropyUnit fromUnit) - { - return value.HasValue ? new Entropy((double)value.Value, fromUnit) : default(Entropy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs index 1530fa6888..8897b2b55b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs @@ -60,238 +60,6 @@ public partial struct Flow : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Flow from nullable CentilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCentilitersPerMinute(QuantityValue? centilitersperminute) - { - return centilitersperminute.HasValue ? FromCentilitersPerMinute(centilitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicDecimetersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicDecimetersPerMinute(QuantityValue? cubicdecimetersperminute) - { - return cubicdecimetersperminute.HasValue ? FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicFeetPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicFeetPerHour(QuantityValue? cubicfeetperhour) - { - return cubicfeetperhour.HasValue ? FromCubicFeetPerHour(cubicfeetperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicFeetPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicFeetPerMinute(QuantityValue? cubicfeetperminute) - { - return cubicfeetperminute.HasValue ? FromCubicFeetPerMinute(cubicfeetperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicFeetPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicFeetPerSecond(QuantityValue? cubicfeetpersecond) - { - return cubicfeetpersecond.HasValue ? FromCubicFeetPerSecond(cubicfeetpersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicMetersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicMetersPerHour(QuantityValue? cubicmetersperhour) - { - return cubicmetersperhour.HasValue ? FromCubicMetersPerHour(cubicmetersperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicMetersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicMetersPerMinute(QuantityValue? cubicmetersperminute) - { - return cubicmetersperminute.HasValue ? FromCubicMetersPerMinute(cubicmetersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicMetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicMetersPerSecond(QuantityValue? cubicmeterspersecond) - { - return cubicmeterspersecond.HasValue ? FromCubicMetersPerSecond(cubicmeterspersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicYardsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicYardsPerHour(QuantityValue? cubicyardsperhour) - { - return cubicyardsperhour.HasValue ? FromCubicYardsPerHour(cubicyardsperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicYardsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicYardsPerMinute(QuantityValue? cubicyardsperminute) - { - return cubicyardsperminute.HasValue ? FromCubicYardsPerMinute(cubicyardsperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable CubicYardsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromCubicYardsPerSecond(QuantityValue? cubicyardspersecond) - { - return cubicyardspersecond.HasValue ? FromCubicYardsPerSecond(cubicyardspersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable DecilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromDecilitersPerMinute(QuantityValue? decilitersperminute) - { - return decilitersperminute.HasValue ? FromDecilitersPerMinute(decilitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable KilolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromKilolitersPerMinute(QuantityValue? kilolitersperminute) - { - return kilolitersperminute.HasValue ? FromKilolitersPerMinute(kilolitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable LitersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromLitersPerHour(QuantityValue? litersperhour) - { - return litersperhour.HasValue ? FromLitersPerHour(litersperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable LitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromLitersPerMinute(QuantityValue? litersperminute) - { - return litersperminute.HasValue ? FromLitersPerMinute(litersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable LitersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromLitersPerSecond(QuantityValue? literspersecond) - { - return literspersecond.HasValue ? FromLitersPerSecond(literspersecond.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable MicrolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromMicrolitersPerMinute(QuantityValue? microlitersperminute) - { - return microlitersperminute.HasValue ? FromMicrolitersPerMinute(microlitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable MillilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromMillilitersPerMinute(QuantityValue? millilitersperminute) - { - return millilitersperminute.HasValue ? FromMillilitersPerMinute(millilitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable MillionUsGallonsPerDay. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromMillionUsGallonsPerDay(QuantityValue? millionusgallonsperday) - { - return millionusgallonsperday.HasValue ? FromMillionUsGallonsPerDay(millionusgallonsperday.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable NanolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromNanolitersPerMinute(QuantityValue? nanolitersperminute) - { - return nanolitersperminute.HasValue ? FromNanolitersPerMinute(nanolitersperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable OilBarrelsPerDay. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromOilBarrelsPerDay(QuantityValue? oilbarrelsperday) - { - return oilbarrelsperday.HasValue ? FromOilBarrelsPerDay(oilbarrelsperday.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable UsGallonsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromUsGallonsPerHour(QuantityValue? usgallonsperhour) - { - return usgallonsperhour.HasValue ? FromUsGallonsPerHour(usgallonsperhour.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable UsGallonsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Flow? FromUsGallonsPerMinute(QuantityValue? usgallonsperminute) - { - return usgallonsperminute.HasValue ? FromUsGallonsPerMinute(usgallonsperminute.Value) : default(Flow?); - } - - /// - /// Get nullable Flow from nullable UsGallonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Flow? From(QuantityValue? value, FlowUnit fromUnit) - { - return value.HasValue ? new Flow((double)value.Value, fromUnit) : default(Flow?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index d741260a28..65ab1b6f08 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -60,112 +60,6 @@ public partial struct Force : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Force from nullable Decanewtons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromDecanewtons(QuantityValue? decanewtons) - { - return decanewtons.HasValue ? FromDecanewtons(decanewtons.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable Dyne. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromDyne(QuantityValue? dyne) - { - return dyne.HasValue ? FromDyne(dyne.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable KilogramsForce. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromKilogramsForce(QuantityValue? kilogramsforce) - { - return kilogramsforce.HasValue ? FromKilogramsForce(kilogramsforce.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable Kilonewtons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromKilonewtons(QuantityValue? kilonewtons) - { - return kilonewtons.HasValue ? FromKilonewtons(kilonewtons.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable KiloPonds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromKiloPonds(QuantityValue? kiloponds) - { - return kiloponds.HasValue ? FromKiloPonds(kiloponds.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable Meganewtons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromMeganewtons(QuantityValue? meganewtons) - { - return meganewtons.HasValue ? FromMeganewtons(meganewtons.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable Newtons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromNewtons(QuantityValue? newtons) - { - return newtons.HasValue ? FromNewtons(newtons.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable Poundals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromPoundals(QuantityValue? poundals) - { - return poundals.HasValue ? FromPoundals(poundals.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable PoundsForce. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Force? FromPoundsForce(QuantityValue? poundsforce) - { - return poundsforce.HasValue ? FromPoundsForce(poundsforce.Value) : default(Force?); - } - - /// - /// Get nullable Force from nullable TonnesForce. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Force? From(QuantityValue? value, ForceUnit fromUnit) - { - return value.HasValue ? new Force((double)value.Value, fromUnit) : default(Force?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 1c5ec27ce0..e49d08d2f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -60,121 +60,6 @@ public partial struct ForceChangeRate : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ForceChangeRate from nullable CentinewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromCentinewtonsPerSecond(QuantityValue? centinewtonspersecond) - { - return centinewtonspersecond.HasValue ? FromCentinewtonsPerSecond(centinewtonspersecond.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable DecanewtonsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromDecanewtonsPerMinute(QuantityValue? decanewtonsperminute) - { - return decanewtonsperminute.HasValue ? FromDecanewtonsPerMinute(decanewtonsperminute.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable DecanewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromDecanewtonsPerSecond(QuantityValue? decanewtonspersecond) - { - return decanewtonspersecond.HasValue ? FromDecanewtonsPerSecond(decanewtonspersecond.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable DecinewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromDecinewtonsPerSecond(QuantityValue? decinewtonspersecond) - { - return decinewtonspersecond.HasValue ? FromDecinewtonsPerSecond(decinewtonspersecond.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable KilonewtonsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromKilonewtonsPerMinute(QuantityValue? kilonewtonsperminute) - { - return kilonewtonsperminute.HasValue ? FromKilonewtonsPerMinute(kilonewtonsperminute.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable KilonewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromKilonewtonsPerSecond(QuantityValue? kilonewtonspersecond) - { - return kilonewtonspersecond.HasValue ? FromKilonewtonsPerSecond(kilonewtonspersecond.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable MicronewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromMicronewtonsPerSecond(QuantityValue? micronewtonspersecond) - { - return micronewtonspersecond.HasValue ? FromMicronewtonsPerSecond(micronewtonspersecond.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable MillinewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromMillinewtonsPerSecond(QuantityValue? millinewtonspersecond) - { - return millinewtonspersecond.HasValue ? FromMillinewtonsPerSecond(millinewtonspersecond.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable NanonewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromNanonewtonsPerSecond(QuantityValue? nanonewtonspersecond) - { - return nanonewtonspersecond.HasValue ? FromNanonewtonsPerSecond(nanonewtonspersecond.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable NewtonsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForceChangeRate? FromNewtonsPerMinute(QuantityValue? newtonsperminute) - { - return newtonsperminute.HasValue ? FromNewtonsPerMinute(newtonsperminute.Value) : default(ForceChangeRate?); - } - - /// - /// Get nullable ForceChangeRate from nullable NewtonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForceChangeRate? From(QuantityValue? value, ForceChangeRateUnit fromUnit) - { - return value.HasValue ? new ForceChangeRate((double)value.Value, fromUnit) : default(ForceChangeRate?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index a221b700b4..f66b0a5074 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -60,103 +60,6 @@ public partial struct ForcePerLength : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ForcePerLength from nullable CentinewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromCentinewtonsPerMeter(QuantityValue? centinewtonspermeter) - { - return centinewtonspermeter.HasValue ? FromCentinewtonsPerMeter(centinewtonspermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable DecinewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromDecinewtonsPerMeter(QuantityValue? decinewtonspermeter) - { - return decinewtonspermeter.HasValue ? FromDecinewtonsPerMeter(decinewtonspermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable KilogramsForcePerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromKilogramsForcePerMeter(QuantityValue? kilogramsforcepermeter) - { - return kilogramsforcepermeter.HasValue ? FromKilogramsForcePerMeter(kilogramsforcepermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable KilonewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromKilonewtonsPerMeter(QuantityValue? kilonewtonspermeter) - { - return kilonewtonspermeter.HasValue ? FromKilonewtonsPerMeter(kilonewtonspermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable MeganewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromMeganewtonsPerMeter(QuantityValue? meganewtonspermeter) - { - return meganewtonspermeter.HasValue ? FromMeganewtonsPerMeter(meganewtonspermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable MicronewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromMicronewtonsPerMeter(QuantityValue? micronewtonspermeter) - { - return micronewtonspermeter.HasValue ? FromMicronewtonsPerMeter(micronewtonspermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable MillinewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromMillinewtonsPerMeter(QuantityValue? millinewtonspermeter) - { - return millinewtonspermeter.HasValue ? FromMillinewtonsPerMeter(millinewtonspermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable NanonewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ForcePerLength? FromNanonewtonsPerMeter(QuantityValue? nanonewtonspermeter) - { - return nanonewtonspermeter.HasValue ? FromNanonewtonsPerMeter(nanonewtonspermeter.Value) : default(ForcePerLength?); - } - - /// - /// Get nullable ForcePerLength from nullable NewtonsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ForcePerLength? From(QuantityValue? value, ForcePerLengthUnit fromUnit) - { - return value.HasValue ? new ForcePerLength((double)value.Value, fromUnit) : default(ForcePerLength?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 649b2a2c52..4ad34d9423 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -60,94 +60,6 @@ public partial struct Frequency : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Frequency from nullable CyclesPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Frequency? FromCyclesPerHour(QuantityValue? cyclesperhour) - { - return cyclesperhour.HasValue ? FromCyclesPerHour(cyclesperhour.Value) : default(Frequency?); - } - - /// - /// Get nullable Frequency from nullable CyclesPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Frequency? FromCyclesPerMinute(QuantityValue? cyclesperminute) - { - return cyclesperminute.HasValue ? FromCyclesPerMinute(cyclesperminute.Value) : default(Frequency?); - } - - /// - /// Get nullable Frequency from nullable Gigahertz. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Frequency? FromGigahertz(QuantityValue? gigahertz) - { - return gigahertz.HasValue ? FromGigahertz(gigahertz.Value) : default(Frequency?); - } - - /// - /// Get nullable Frequency from nullable Hertz. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Frequency? FromHertz(QuantityValue? hertz) - { - return hertz.HasValue ? FromHertz(hertz.Value) : default(Frequency?); - } - - /// - /// Get nullable Frequency from nullable Kilohertz. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Frequency? FromKilohertz(QuantityValue? kilohertz) - { - return kilohertz.HasValue ? FromKilohertz(kilohertz.Value) : default(Frequency?); - } - - /// - /// Get nullable Frequency from nullable Megahertz. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Frequency? FromMegahertz(QuantityValue? megahertz) - { - return megahertz.HasValue ? FromMegahertz(megahertz.Value) : default(Frequency?); - } - - /// - /// Get nullable Frequency from nullable RadiansPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Frequency? FromRadiansPerSecond(QuantityValue? radianspersecond) - { - return radianspersecond.HasValue ? FromRadiansPerSecond(radianspersecond.Value) : default(Frequency?); - } - - /// - /// Get nullable Frequency from nullable Terahertz. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Frequency? From(QuantityValue? value, FrequencyUnit fromUnit) - { - return value.HasValue ? new Frequency((double)value.Value, fromUnit) : default(Frequency?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 3e1fdde1d7..2a82f5a9fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -60,166 +60,6 @@ public partial struct HeatFlux : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable HeatFlux from nullable BtusPerHourSquareFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromBtusPerHourSquareFoot(QuantityValue? btusperhoursquarefoot) - { - return btusperhoursquarefoot.HasValue ? FromBtusPerHourSquareFoot(btusperhoursquarefoot.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable BtusPerMinuteSquareFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromBtusPerMinuteSquareFoot(QuantityValue? btusperminutesquarefoot) - { - return btusperminutesquarefoot.HasValue ? FromBtusPerMinuteSquareFoot(btusperminutesquarefoot.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable BtusPerSecondSquareFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromBtusPerSecondSquareFoot(QuantityValue? btuspersecondsquarefoot) - { - return btuspersecondsquarefoot.HasValue ? FromBtusPerSecondSquareFoot(btuspersecondsquarefoot.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable BtusPerSecondSquareInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromBtusPerSecondSquareInch(QuantityValue? btuspersecondsquareinch) - { - return btuspersecondsquareinch.HasValue ? FromBtusPerSecondSquareInch(btuspersecondsquareinch.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable CaloriesPerSecondSquareCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromCaloriesPerSecondSquareCentimeter(QuantityValue? caloriespersecondsquarecentimeter) - { - return caloriespersecondsquarecentimeter.HasValue ? FromCaloriesPerSecondSquareCentimeter(caloriespersecondsquarecentimeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable CentiwattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromCentiwattsPerSquareMeter(QuantityValue? centiwattspersquaremeter) - { - return centiwattspersquaremeter.HasValue ? FromCentiwattsPerSquareMeter(centiwattspersquaremeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable DeciwattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromDeciwattsPerSquareMeter(QuantityValue? deciwattspersquaremeter) - { - return deciwattspersquaremeter.HasValue ? FromDeciwattsPerSquareMeter(deciwattspersquaremeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable KilocaloriesPerHourSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromKilocaloriesPerHourSquareMeter(QuantityValue? kilocaloriesperhoursquaremeter) - { - return kilocaloriesperhoursquaremeter.HasValue ? FromKilocaloriesPerHourSquareMeter(kilocaloriesperhoursquaremeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable KilocaloriesPerSecondSquareCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromKilocaloriesPerSecondSquareCentimeter(QuantityValue? kilocaloriespersecondsquarecentimeter) - { - return kilocaloriespersecondsquarecentimeter.HasValue ? FromKilocaloriesPerSecondSquareCentimeter(kilocaloriespersecondsquarecentimeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable KilowattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromKilowattsPerSquareMeter(QuantityValue? kilowattspersquaremeter) - { - return kilowattspersquaremeter.HasValue ? FromKilowattsPerSquareMeter(kilowattspersquaremeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable MicrowattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromMicrowattsPerSquareMeter(QuantityValue? microwattspersquaremeter) - { - return microwattspersquaremeter.HasValue ? FromMicrowattsPerSquareMeter(microwattspersquaremeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable MilliwattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromMilliwattsPerSquareMeter(QuantityValue? milliwattspersquaremeter) - { - return milliwattspersquaremeter.HasValue ? FromMilliwattsPerSquareMeter(milliwattspersquaremeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable NanowattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromNanowattsPerSquareMeter(QuantityValue? nanowattspersquaremeter) - { - return nanowattspersquaremeter.HasValue ? FromNanowattsPerSquareMeter(nanowattspersquaremeter.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable WattsPerSquareFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromWattsPerSquareFoot(QuantityValue? wattspersquarefoot) - { - return wattspersquarefoot.HasValue ? FromWattsPerSquareFoot(wattspersquarefoot.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable WattsPerSquareInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromWattsPerSquareInch(QuantityValue? wattspersquareinch) - { - return wattspersquareinch.HasValue ? FromWattsPerSquareInch(wattspersquareinch.Value) : default(HeatFlux?); - } - - /// - /// Get nullable HeatFlux from nullable WattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatFlux? From(QuantityValue? value, HeatFluxUnit fromUnit) - { - return value.HasValue ? new HeatFlux((double)value.Value, fromUnit) : default(HeatFlux?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index cf0bf1e253..6cc6e0df4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -60,40 +60,6 @@ public partial struct HeatTransferCoefficient : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable HeatTransferCoefficient from nullable WattsPerSquareMeterCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatTransferCoefficient? FromWattsPerSquareMeterCelsius(QuantityValue? wattspersquaremetercelsius) - { - return wattspersquaremetercelsius.HasValue ? FromWattsPerSquareMeterCelsius(wattspersquaremetercelsius.Value) : default(HeatTransferCoefficient?); - } - - /// - /// Get nullable HeatTransferCoefficient from nullable WattsPerSquareMeterKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static HeatTransferCoefficient? From(QuantityValue? value, HeatTransferCoefficientUnit fromUnit) - { - return value.HasValue ? new HeatTransferCoefficient((double)value.Value, fromUnit) : default(HeatTransferCoefficient?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 16e9931409..e5b116ca55 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct Illuminance : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Illuminance from nullable Kilolux. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Illuminance? FromKilolux(QuantityValue? kilolux) - { - return kilolux.HasValue ? FromKilolux(kilolux.Value) : default(Illuminance?); - } - - /// - /// Get nullable Illuminance from nullable Lux. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Illuminance? FromLux(QuantityValue? lux) - { - return lux.HasValue ? FromLux(lux.Value) : default(Illuminance?); - } - - /// - /// Get nullable Illuminance from nullable Megalux. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Illuminance? FromMegalux(QuantityValue? megalux) - { - return megalux.HasValue ? FromMegalux(megalux.Value) : default(Illuminance?); - } - - /// - /// Get nullable Illuminance from nullable Millilux. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Illuminance? From(QuantityValue? value, IlluminanceUnit fromUnit) - { - return value.HasValue ? new Illuminance((double)value.Value, fromUnit) : default(Illuminance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index bf562afe24..6415a8dd75 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -60,256 +60,6 @@ public partial struct Information : IComparable, IComparable ///
public decimal Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Information from nullable Bits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromBits(QuantityValue? bits) - { - return bits.HasValue ? FromBits(bits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Bytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromBytes(QuantityValue? bytes) - { - return bytes.HasValue ? FromBytes(bytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Exabits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromExabits(QuantityValue? exabits) - { - return exabits.HasValue ? FromExabits(exabits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Exabytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromExabytes(QuantityValue? exabytes) - { - return exabytes.HasValue ? FromExabytes(exabytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Exbibits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromExbibits(QuantityValue? exbibits) - { - return exbibits.HasValue ? FromExbibits(exbibits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Exbibytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromExbibytes(QuantityValue? exbibytes) - { - return exbibytes.HasValue ? FromExbibytes(exbibytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Gibibits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromGibibits(QuantityValue? gibibits) - { - return gibibits.HasValue ? FromGibibits(gibibits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Gibibytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromGibibytes(QuantityValue? gibibytes) - { - return gibibytes.HasValue ? FromGibibytes(gibibytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Gigabits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromGigabits(QuantityValue? gigabits) - { - return gigabits.HasValue ? FromGigabits(gigabits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Gigabytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromGigabytes(QuantityValue? gigabytes) - { - return gigabytes.HasValue ? FromGigabytes(gigabytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Kibibits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromKibibits(QuantityValue? kibibits) - { - return kibibits.HasValue ? FromKibibits(kibibits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Kibibytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromKibibytes(QuantityValue? kibibytes) - { - return kibibytes.HasValue ? FromKibibytes(kibibytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Kilobits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromKilobits(QuantityValue? kilobits) - { - return kilobits.HasValue ? FromKilobits(kilobits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Kilobytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromKilobytes(QuantityValue? kilobytes) - { - return kilobytes.HasValue ? FromKilobytes(kilobytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Mebibits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromMebibits(QuantityValue? mebibits) - { - return mebibits.HasValue ? FromMebibits(mebibits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Mebibytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromMebibytes(QuantityValue? mebibytes) - { - return mebibytes.HasValue ? FromMebibytes(mebibytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Megabits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromMegabits(QuantityValue? megabits) - { - return megabits.HasValue ? FromMegabits(megabits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Megabytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromMegabytes(QuantityValue? megabytes) - { - return megabytes.HasValue ? FromMegabytes(megabytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Pebibits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromPebibits(QuantityValue? pebibits) - { - return pebibits.HasValue ? FromPebibits(pebibits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Pebibytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromPebibytes(QuantityValue? pebibytes) - { - return pebibytes.HasValue ? FromPebibytes(pebibytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Petabits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromPetabits(QuantityValue? petabits) - { - return petabits.HasValue ? FromPetabits(petabits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Petabytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromPetabytes(QuantityValue? petabytes) - { - return petabytes.HasValue ? FromPetabytes(petabytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Tebibits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromTebibits(QuantityValue? tebibits) - { - return tebibits.HasValue ? FromTebibits(tebibits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Tebibytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromTebibytes(QuantityValue? tebibytes) - { - return tebibytes.HasValue ? FromTebibytes(tebibytes.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Terabits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Information? FromTerabits(QuantityValue? terabits) - { - return terabits.HasValue ? FromTerabits(terabits.Value) : default(Information?); - } - - /// - /// Get nullable Information from nullable Terabytes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Information? From(QuantityValue? value, InformationUnit fromUnit) - { - return value.HasValue ? new Information((decimal)value.Value, fromUnit) : default(Information?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 8a1ef1ab60..839760f5d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -60,40 +60,6 @@ public partial struct Irradiance : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Irradiance from nullable KilowattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Irradiance? FromKilowattsPerSquareMeter(QuantityValue? kilowattspersquaremeter) - { - return kilowattspersquaremeter.HasValue ? FromKilowattsPerSquareMeter(kilowattspersquaremeter.Value) : default(Irradiance?); - } - - /// - /// Get nullable Irradiance from nullable WattsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Irradiance? From(QuantityValue? value, IrradianceUnit fromUnit) - { - return value.HasValue ? new Irradiance((double)value.Value, fromUnit) : default(Irradiance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 486da8cd88..3f816711ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct Irradiation : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Irradiation from nullable JoulesPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Irradiation? FromJoulesPerSquareMeter(QuantityValue? joulespersquaremeter) - { - return joulespersquaremeter.HasValue ? FromJoulesPerSquareMeter(joulespersquaremeter.Value) : default(Irradiation?); - } - - /// - /// Get nullable Irradiation from nullable KilowattHoursPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Irradiation? FromKilowattHoursPerSquareMeter(QuantityValue? kilowatthourspersquaremeter) - { - return kilowatthourspersquaremeter.HasValue ? FromKilowattHoursPerSquareMeter(kilowatthourspersquaremeter.Value) : default(Irradiation?); - } - - /// - /// Get nullable Irradiation from nullable WattHoursPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Irradiation? From(QuantityValue? value, IrradiationUnit fromUnit) - { - return value.HasValue ? new Irradiation((double)value.Value, fromUnit) : default(Irradiation?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index c9d49d1d19..0e8f501790 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -60,94 +60,6 @@ public partial struct KinematicViscosity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable KinematicViscosity from nullable Centistokes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static KinematicViscosity? FromCentistokes(QuantityValue? centistokes) - { - return centistokes.HasValue ? FromCentistokes(centistokes.Value) : default(KinematicViscosity?); - } - - /// - /// Get nullable KinematicViscosity from nullable Decistokes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static KinematicViscosity? FromDecistokes(QuantityValue? decistokes) - { - return decistokes.HasValue ? FromDecistokes(decistokes.Value) : default(KinematicViscosity?); - } - - /// - /// Get nullable KinematicViscosity from nullable Kilostokes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static KinematicViscosity? FromKilostokes(QuantityValue? kilostokes) - { - return kilostokes.HasValue ? FromKilostokes(kilostokes.Value) : default(KinematicViscosity?); - } - - /// - /// Get nullable KinematicViscosity from nullable Microstokes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static KinematicViscosity? FromMicrostokes(QuantityValue? microstokes) - { - return microstokes.HasValue ? FromMicrostokes(microstokes.Value) : default(KinematicViscosity?); - } - - /// - /// Get nullable KinematicViscosity from nullable Millistokes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static KinematicViscosity? FromMillistokes(QuantityValue? millistokes) - { - return millistokes.HasValue ? FromMillistokes(millistokes.Value) : default(KinematicViscosity?); - } - - /// - /// Get nullable KinematicViscosity from nullable Nanostokes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static KinematicViscosity? FromNanostokes(QuantityValue? nanostokes) - { - return nanostokes.HasValue ? FromNanostokes(nanostokes.Value) : default(KinematicViscosity?); - } - - /// - /// Get nullable KinematicViscosity from nullable SquareMetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static KinematicViscosity? FromSquareMetersPerSecond(QuantityValue? squaremeterspersecond) - { - return squaremeterspersecond.HasValue ? FromSquareMetersPerSecond(squaremeterspersecond.Value) : default(KinematicViscosity?); - } - - /// - /// Get nullable KinematicViscosity from nullable Stokes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static KinematicViscosity? From(QuantityValue? value, KinematicViscosityUnit fromUnit) - { - return value.HasValue ? new KinematicViscosity((double)value.Value, fromUnit) : default(KinematicViscosity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 1cd3e7621f..3ab8900aba 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct LapseRate : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable LapseRate from nullable DegreesCelciusPerKilometer. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LapseRate? From(QuantityValue? value, LapseRateUnit fromUnit) - { - return value.HasValue ? new LapseRate((double)value.Value, fromUnit) : default(LapseRate?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index f15c49f2f5..962de75fef 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -60,220 +60,6 @@ public partial struct Length : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Length from nullable Centimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromCentimeters(QuantityValue? centimeters) - { - return centimeters.HasValue ? FromCentimeters(centimeters.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Decimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromDecimeters(QuantityValue? decimeters) - { - return decimeters.HasValue ? FromDecimeters(decimeters.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable DtpPicas. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromDtpPicas(QuantityValue? dtppicas) - { - return dtppicas.HasValue ? FromDtpPicas(dtppicas.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable DtpPoints. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromDtpPoints(QuantityValue? dtppoints) - { - return dtppoints.HasValue ? FromDtpPoints(dtppoints.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Fathoms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromFathoms(QuantityValue? fathoms) - { - return fathoms.HasValue ? FromFathoms(fathoms.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Feet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromFeet(QuantityValue? feet) - { - return feet.HasValue ? FromFeet(feet.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Inches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromInches(QuantityValue? inches) - { - return inches.HasValue ? FromInches(inches.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Kilometers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromKilometers(QuantityValue? kilometers) - { - return kilometers.HasValue ? FromKilometers(kilometers.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Meters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromMeters(QuantityValue? meters) - { - return meters.HasValue ? FromMeters(meters.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Microinches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromMicroinches(QuantityValue? microinches) - { - return microinches.HasValue ? FromMicroinches(microinches.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Micrometers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromMicrometers(QuantityValue? micrometers) - { - return micrometers.HasValue ? FromMicrometers(micrometers.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Mils. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromMils(QuantityValue? mils) - { - return mils.HasValue ? FromMils(mils.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Miles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromMiles(QuantityValue? miles) - { - return miles.HasValue ? FromMiles(miles.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Millimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromMillimeters(QuantityValue? millimeters) - { - return millimeters.HasValue ? FromMillimeters(millimeters.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Nanometers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromNanometers(QuantityValue? nanometers) - { - return nanometers.HasValue ? FromNanometers(nanometers.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable NauticalMiles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromNauticalMiles(QuantityValue? nauticalmiles) - { - return nauticalmiles.HasValue ? FromNauticalMiles(nauticalmiles.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable PrinterPicas. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromPrinterPicas(QuantityValue? printerpicas) - { - return printerpicas.HasValue ? FromPrinterPicas(printerpicas.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable PrinterPoints. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromPrinterPoints(QuantityValue? printerpoints) - { - return printerpoints.HasValue ? FromPrinterPoints(printerpoints.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Shackles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromShackles(QuantityValue? shackles) - { - return shackles.HasValue ? FromShackles(shackles.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Twips. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromTwips(QuantityValue? twips) - { - return twips.HasValue ? FromTwips(twips.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable UsSurveyFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Length? FromUsSurveyFeet(QuantityValue? ussurveyfeet) - { - return ussurveyfeet.HasValue ? FromUsSurveyFeet(ussurveyfeet.Value) : default(Length?); - } - - /// - /// Get nullable Length from nullable Yards. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Length? From(QuantityValue? value, LengthUnit fromUnit) - { - return value.HasValue ? new Length((double)value.Value, fromUnit) : default(Length?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 75bab150c4..4531caf715 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -60,40 +60,6 @@ public partial struct Level : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Level from nullable Decibels. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Level? FromDecibels(QuantityValue? decibels) - { - return decibels.HasValue ? FromDecibels(decibels.Value) : default(Level?); - } - - /// - /// Get nullable Level from nullable Nepers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Level? From(QuantityValue? value, LevelUnit fromUnit) - { - return value.HasValue ? new Level((double)value.Value, fromUnit) : default(Level?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index b2c1100816..980f16d7ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct LinearDensity : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable LinearDensity from nullable GramsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static LinearDensity? FromGramsPerMeter(QuantityValue? gramspermeter) - { - return gramspermeter.HasValue ? FromGramsPerMeter(gramspermeter.Value) : default(LinearDensity?); - } - - /// - /// Get nullable LinearDensity from nullable KilogramsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static LinearDensity? FromKilogramsPerMeter(QuantityValue? kilogramspermeter) - { - return kilogramspermeter.HasValue ? FromKilogramsPerMeter(kilogramspermeter.Value) : default(LinearDensity?); - } - - /// - /// Get nullable LinearDensity from nullable PoundsPerFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LinearDensity? From(QuantityValue? value, LinearDensityUnit fromUnit) - { - return value.HasValue ? new LinearDensity((double)value.Value, fromUnit) : default(LinearDensity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 778aabad6d..74c7c24231 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct LuminousFlux : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable LuminousFlux from nullable Lumens. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LuminousFlux? From(QuantityValue? value, LuminousFluxUnit fromUnit) - { - return value.HasValue ? new LuminousFlux((double)value.Value, fromUnit) : default(LuminousFlux?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 56388d68d1..68bc476cd1 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct LuminousIntensity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable LuminousIntensity from nullable Candela. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static LuminousIntensity? From(QuantityValue? value, LuminousIntensityUnit fromUnit) - { - return value.HasValue ? new LuminousIntensity((double)value.Value, fromUnit) : default(LuminousIntensity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 636e0610cb..e13e5408f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct MagneticField : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MagneticField from nullable Teslas. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MagneticField? From(QuantityValue? value, MagneticFieldUnit fromUnit) - { - return value.HasValue ? new MagneticField((double)value.Value, fromUnit) : default(MagneticField?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index f3f3eefdb3..6283a54595 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct MagneticFlux : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MagneticFlux from nullable Webers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MagneticFlux? From(QuantityValue? value, MagneticFluxUnit fromUnit) - { - return value.HasValue ? new MagneticFlux((double)value.Value, fromUnit) : default(MagneticFlux?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 9ee47929f2..a631d15df4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct Magnetization : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Magnetization from nullable AmperesPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Magnetization? From(QuantityValue? value, MagnetizationUnit fromUnit) - { - return value.HasValue ? new Magnetization((double)value.Value, fromUnit) : default(Magnetization?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index a2aff8b53e..ce9566c873 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -60,211 +60,6 @@ public partial struct Mass : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Mass from nullable Centigrams. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromCentigrams(QuantityValue? centigrams) - { - return centigrams.HasValue ? FromCentigrams(centigrams.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Decagrams. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromDecagrams(QuantityValue? decagrams) - { - return decagrams.HasValue ? FromDecagrams(decagrams.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Decigrams. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromDecigrams(QuantityValue? decigrams) - { - return decigrams.HasValue ? FromDecigrams(decigrams.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Grams. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromGrams(QuantityValue? grams) - { - return grams.HasValue ? FromGrams(grams.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Hectograms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromHectograms(QuantityValue? hectograms) - { - return hectograms.HasValue ? FromHectograms(hectograms.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Kilograms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromKilograms(QuantityValue? kilograms) - { - return kilograms.HasValue ? FromKilograms(kilograms.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Kilopounds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromKilopounds(QuantityValue? kilopounds) - { - return kilopounds.HasValue ? FromKilopounds(kilopounds.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Kilotonnes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromKilotonnes(QuantityValue? kilotonnes) - { - return kilotonnes.HasValue ? FromKilotonnes(kilotonnes.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable LongHundredweight. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromLongHundredweight(QuantityValue? longhundredweight) - { - return longhundredweight.HasValue ? FromLongHundredweight(longhundredweight.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable LongTons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromLongTons(QuantityValue? longtons) - { - return longtons.HasValue ? FromLongTons(longtons.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Megapounds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromMegapounds(QuantityValue? megapounds) - { - return megapounds.HasValue ? FromMegapounds(megapounds.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Megatonnes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromMegatonnes(QuantityValue? megatonnes) - { - return megatonnes.HasValue ? FromMegatonnes(megatonnes.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Micrograms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromMicrograms(QuantityValue? micrograms) - { - return micrograms.HasValue ? FromMicrograms(micrograms.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Milligrams. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromMilligrams(QuantityValue? milligrams) - { - return milligrams.HasValue ? FromMilligrams(milligrams.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Nanograms. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromNanograms(QuantityValue? nanograms) - { - return nanograms.HasValue ? FromNanograms(nanograms.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Ounces. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromOunces(QuantityValue? ounces) - { - return ounces.HasValue ? FromOunces(ounces.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Pounds. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromPounds(QuantityValue? pounds) - { - return pounds.HasValue ? FromPounds(pounds.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable ShortHundredweight. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromShortHundredweight(QuantityValue? shorthundredweight) - { - return shorthundredweight.HasValue ? FromShortHundredweight(shorthundredweight.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable ShortTons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromShortTons(QuantityValue? shorttons) - { - return shorttons.HasValue ? FromShortTons(shorttons.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Stone. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Mass? FromStone(QuantityValue? stone) - { - return stone.HasValue ? FromStone(stone.Value) : default(Mass?); - } - - /// - /// Get nullable Mass from nullable Tonnes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Mass? From(QuantityValue? value, MassUnit fromUnit) - { - return value.HasValue ? new Mass((double)value.Value, fromUnit) : default(Mass?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index e90181d29f..2c22b03ceb 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -60,157 +60,6 @@ public partial struct MassFlow : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MassFlow from nullable CentigramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromCentigramsPerSecond(QuantityValue? centigramspersecond) - { - return centigramspersecond.HasValue ? FromCentigramsPerSecond(centigramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable DecagramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromDecagramsPerSecond(QuantityValue? decagramspersecond) - { - return decagramspersecond.HasValue ? FromDecagramsPerSecond(decagramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable DecigramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromDecigramsPerSecond(QuantityValue? decigramspersecond) - { - return decigramspersecond.HasValue ? FromDecigramsPerSecond(decigramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable GramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromGramsPerSecond(QuantityValue? gramspersecond) - { - return gramspersecond.HasValue ? FromGramsPerSecond(gramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable HectogramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromHectogramsPerSecond(QuantityValue? hectogramspersecond) - { - return hectogramspersecond.HasValue ? FromHectogramsPerSecond(hectogramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable KilogramsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromKilogramsPerHour(QuantityValue? kilogramsperhour) - { - return kilogramsperhour.HasValue ? FromKilogramsPerHour(kilogramsperhour.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable KilogramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromKilogramsPerSecond(QuantityValue? kilogramspersecond) - { - return kilogramspersecond.HasValue ? FromKilogramsPerSecond(kilogramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable MegapoundsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromMegapoundsPerHour(QuantityValue? megapoundsperhour) - { - return megapoundsperhour.HasValue ? FromMegapoundsPerHour(megapoundsperhour.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable MicrogramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromMicrogramsPerSecond(QuantityValue? microgramspersecond) - { - return microgramspersecond.HasValue ? FromMicrogramsPerSecond(microgramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable MilligramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromMilligramsPerSecond(QuantityValue? milligramspersecond) - { - return milligramspersecond.HasValue ? FromMilligramsPerSecond(milligramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable NanogramsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromNanogramsPerSecond(QuantityValue? nanogramspersecond) - { - return nanogramspersecond.HasValue ? FromNanogramsPerSecond(nanogramspersecond.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable PoundsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromPoundsPerHour(QuantityValue? poundsperhour) - { - return poundsperhour.HasValue ? FromPoundsPerHour(poundsperhour.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable ShortTonsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromShortTonsPerHour(QuantityValue? shorttonsperhour) - { - return shorttonsperhour.HasValue ? FromShortTonsPerHour(shorttonsperhour.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable TonnesPerDay. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlow? FromTonnesPerDay(QuantityValue? tonnesperday) - { - return tonnesperday.HasValue ? FromTonnesPerDay(tonnesperday.Value) : default(MassFlow?); - } - - /// - /// Get nullable MassFlow from nullable TonnesPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? From(QuantityValue? value, MassFlowUnit fromUnit) - { - return value.HasValue ? new MassFlow((double)value.Value, fromUnit) : default(MassFlow?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index ff966c6ddb..c33c22dbf5 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -60,40 +60,6 @@ public partial struct MassFlux : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MassFlux from nullable GramsPerSecondPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassFlux? FromGramsPerSecondPerSquareMeter(QuantityValue? gramspersecondpersquaremeter) - { - return gramspersecondpersquaremeter.HasValue ? FromGramsPerSecondPerSquareMeter(gramspersecondpersquaremeter.Value) : default(MassFlux?); - } - - /// - /// Get nullable MassFlux from nullable KilogramsPerSecondPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlux? From(QuantityValue? value, MassFluxUnit fromUnit) - { - return value.HasValue ? new MassFlux((double)value.Value, fromUnit) : default(MassFlux?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 009ea8b31d..98cfd17366 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -60,256 +60,6 @@ public partial struct MassMomentOfInertia : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromGramSquareCentimeters(QuantityValue? gramsquarecentimeters) - { - return gramsquarecentimeters.HasValue ? FromGramSquareCentimeters(gramsquarecentimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromGramSquareDecimeters(QuantityValue? gramsquaredecimeters) - { - return gramsquaredecimeters.HasValue ? FromGramSquareDecimeters(gramsquaredecimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromGramSquareMeters(QuantityValue? gramsquaremeters) - { - return gramsquaremeters.HasValue ? FromGramSquareMeters(gramsquaremeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromGramSquareMillimeters(QuantityValue? gramsquaremillimeters) - { - return gramsquaremillimeters.HasValue ? FromGramSquareMillimeters(gramsquaremillimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilogramSquareCentimeters(QuantityValue? kilogramsquarecentimeters) - { - return kilogramsquarecentimeters.HasValue ? FromKilogramSquareCentimeters(kilogramsquarecentimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilogramSquareDecimeters(QuantityValue? kilogramsquaredecimeters) - { - return kilogramsquaredecimeters.HasValue ? FromKilogramSquareDecimeters(kilogramsquaredecimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilogramSquareMeters(QuantityValue? kilogramsquaremeters) - { - return kilogramsquaremeters.HasValue ? FromKilogramSquareMeters(kilogramsquaremeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilogramSquareMillimeters(QuantityValue? kilogramsquaremillimeters) - { - return kilogramsquaremillimeters.HasValue ? FromKilogramSquareMillimeters(kilogramsquaremillimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilotonneSquareCentimeters(QuantityValue? kilotonnesquarecentimeters) - { - return kilotonnesquarecentimeters.HasValue ? FromKilotonneSquareCentimeters(kilotonnesquarecentimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilotonneSquareDecimeters(QuantityValue? kilotonnesquaredecimeters) - { - return kilotonnesquaredecimeters.HasValue ? FromKilotonneSquareDecimeters(kilotonnesquaredecimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilotonneSquareMeters(QuantityValue? kilotonnesquaremeters) - { - return kilotonnesquaremeters.HasValue ? FromKilotonneSquareMeters(kilotonnesquaremeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareMilimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromKilotonneSquareMilimeters(QuantityValue? kilotonnesquaremilimeters) - { - return kilotonnesquaremilimeters.HasValue ? FromKilotonneSquareMilimeters(kilotonnesquaremilimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMegatonneSquareCentimeters(QuantityValue? megatonnesquarecentimeters) - { - return megatonnesquarecentimeters.HasValue ? FromMegatonneSquareCentimeters(megatonnesquarecentimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMegatonneSquareDecimeters(QuantityValue? megatonnesquaredecimeters) - { - return megatonnesquaredecimeters.HasValue ? FromMegatonneSquareDecimeters(megatonnesquaredecimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMegatonneSquareMeters(QuantityValue? megatonnesquaremeters) - { - return megatonnesquaremeters.HasValue ? FromMegatonneSquareMeters(megatonnesquaremeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareMilimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMegatonneSquareMilimeters(QuantityValue? megatonnesquaremilimeters) - { - return megatonnesquaremilimeters.HasValue ? FromMegatonneSquareMilimeters(megatonnesquaremilimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMilligramSquareCentimeters(QuantityValue? milligramsquarecentimeters) - { - return milligramsquarecentimeters.HasValue ? FromMilligramSquareCentimeters(milligramsquarecentimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMilligramSquareDecimeters(QuantityValue? milligramsquaredecimeters) - { - return milligramsquaredecimeters.HasValue ? FromMilligramSquareDecimeters(milligramsquaredecimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMilligramSquareMeters(QuantityValue? milligramsquaremeters) - { - return milligramsquaremeters.HasValue ? FromMilligramSquareMeters(milligramsquaremeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromMilligramSquareMillimeters(QuantityValue? milligramsquaremillimeters) - { - return milligramsquaremillimeters.HasValue ? FromMilligramSquareMillimeters(milligramsquaremillimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable PoundSquareFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromPoundSquareFeet(QuantityValue? poundsquarefeet) - { - return poundsquarefeet.HasValue ? FromPoundSquareFeet(poundsquarefeet.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable PoundSquareInches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromPoundSquareInches(QuantityValue? poundsquareinches) - { - return poundsquareinches.HasValue ? FromPoundSquareInches(poundsquareinches.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromTonneSquareCentimeters(QuantityValue? tonnesquarecentimeters) - { - return tonnesquarecentimeters.HasValue ? FromTonneSquareCentimeters(tonnesquarecentimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromTonneSquareDecimeters(QuantityValue? tonnesquaredecimeters) - { - return tonnesquaredecimeters.HasValue ? FromTonneSquareDecimeters(tonnesquaredecimeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MassMomentOfInertia? FromTonneSquareMeters(QuantityValue? tonnesquaremeters) - { - return tonnesquaremeters.HasValue ? FromTonneSquareMeters(tonnesquaremeters.Value) : default(MassMomentOfInertia?); - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareMilimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassMomentOfInertia? From(QuantityValue? value, MassMomentOfInertiaUnit fromUnit) - { - return value.HasValue ? new MassMomentOfInertia((double)value.Value, fromUnit) : default(MassMomentOfInertia?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 0eedd254a6..dd4aaa2ba3 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct MolarEnergy : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MolarEnergy from nullable JoulesPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarEnergy? FromJoulesPerMole(QuantityValue? joulespermole) - { - return joulespermole.HasValue ? FromJoulesPerMole(joulespermole.Value) : default(MolarEnergy?); - } - - /// - /// Get nullable MolarEnergy from nullable KilojoulesPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarEnergy? FromKilojoulesPerMole(QuantityValue? kilojoulespermole) - { - return kilojoulespermole.HasValue ? FromKilojoulesPerMole(kilojoulespermole.Value) : default(MolarEnergy?); - } - - /// - /// Get nullable MolarEnergy from nullable MegajoulesPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEnergy? From(QuantityValue? value, MolarEnergyUnit fromUnit) - { - return value.HasValue ? new MolarEnergy((double)value.Value, fromUnit) : default(MolarEnergy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 854cf36bea..ff465f7ad6 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct MolarEntropy : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MolarEntropy from nullable JoulesPerMoleKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarEntropy? FromJoulesPerMoleKelvin(QuantityValue? joulespermolekelvin) - { - return joulespermolekelvin.HasValue ? FromJoulesPerMoleKelvin(joulespermolekelvin.Value) : default(MolarEntropy?); - } - - /// - /// Get nullable MolarEntropy from nullable KilojoulesPerMoleKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarEntropy? FromKilojoulesPerMoleKelvin(QuantityValue? kilojoulespermolekelvin) - { - return kilojoulespermolekelvin.HasValue ? FromKilojoulesPerMoleKelvin(kilojoulespermolekelvin.Value) : default(MolarEntropy?); - } - - /// - /// Get nullable MolarEntropy from nullable MegajoulesPerMoleKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarEntropy? From(QuantityValue? value, MolarEntropyUnit fromUnit) - { - return value.HasValue ? new MolarEntropy((double)value.Value, fromUnit) : default(MolarEntropy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index a04598777e..d1ad580e8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -60,130 +60,6 @@ public partial struct MolarMass : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable MolarMass from nullable CentigramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromCentigramsPerMole(QuantityValue? centigramspermole) - { - return centigramspermole.HasValue ? FromCentigramsPerMole(centigramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable DecagramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromDecagramsPerMole(QuantityValue? decagramspermole) - { - return decagramspermole.HasValue ? FromDecagramsPerMole(decagramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable DecigramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromDecigramsPerMole(QuantityValue? decigramspermole) - { - return decigramspermole.HasValue ? FromDecigramsPerMole(decigramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable GramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromGramsPerMole(QuantityValue? gramspermole) - { - return gramspermole.HasValue ? FromGramsPerMole(gramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable HectogramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromHectogramsPerMole(QuantityValue? hectogramspermole) - { - return hectogramspermole.HasValue ? FromHectogramsPerMole(hectogramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable KilogramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromKilogramsPerMole(QuantityValue? kilogramspermole) - { - return kilogramspermole.HasValue ? FromKilogramsPerMole(kilogramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable KilopoundsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromKilopoundsPerMole(QuantityValue? kilopoundspermole) - { - return kilopoundspermole.HasValue ? FromKilopoundsPerMole(kilopoundspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable MegapoundsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromMegapoundsPerMole(QuantityValue? megapoundspermole) - { - return megapoundspermole.HasValue ? FromMegapoundsPerMole(megapoundspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable MicrogramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromMicrogramsPerMole(QuantityValue? microgramspermole) - { - return microgramspermole.HasValue ? FromMicrogramsPerMole(microgramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable MilligramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromMilligramsPerMole(QuantityValue? milligramspermole) - { - return milligramspermole.HasValue ? FromMilligramsPerMole(milligramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable NanogramsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static MolarMass? FromNanogramsPerMole(QuantityValue? nanogramspermole) - { - return nanogramspermole.HasValue ? FromNanogramsPerMole(nanogramspermole.Value) : default(MolarMass?); - } - - /// - /// Get nullable MolarMass from nullable PoundsPerMole. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MolarMass? From(QuantityValue? value, MolarMassUnit fromUnit) - { - return value.HasValue ? new MolarMass((double)value.Value, fromUnit) : default(MolarMass?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index c431a9a647..27639b7b1d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -60,94 +60,6 @@ public partial struct Molarity : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Molarity from nullable CentimolesPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Molarity? FromCentimolesPerLiter(QuantityValue? centimolesperliter) - { - return centimolesperliter.HasValue ? FromCentimolesPerLiter(centimolesperliter.Value) : default(Molarity?); - } - - /// - /// Get nullable Molarity from nullable DecimolesPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Molarity? FromDecimolesPerLiter(QuantityValue? decimolesperliter) - { - return decimolesperliter.HasValue ? FromDecimolesPerLiter(decimolesperliter.Value) : default(Molarity?); - } - - /// - /// Get nullable Molarity from nullable MicromolesPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Molarity? FromMicromolesPerLiter(QuantityValue? micromolesperliter) - { - return micromolesperliter.HasValue ? FromMicromolesPerLiter(micromolesperliter.Value) : default(Molarity?); - } - - /// - /// Get nullable Molarity from nullable MillimolesPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Molarity? FromMillimolesPerLiter(QuantityValue? millimolesperliter) - { - return millimolesperliter.HasValue ? FromMillimolesPerLiter(millimolesperliter.Value) : default(Molarity?); - } - - /// - /// Get nullable Molarity from nullable MolesPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Molarity? FromMolesPerCubicMeter(QuantityValue? molespercubicmeter) - { - return molespercubicmeter.HasValue ? FromMolesPerCubicMeter(molespercubicmeter.Value) : default(Molarity?); - } - - /// - /// Get nullable Molarity from nullable MolesPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Molarity? FromMolesPerLiter(QuantityValue? molesperliter) - { - return molesperliter.HasValue ? FromMolesPerLiter(molesperliter.Value) : default(Molarity?); - } - - /// - /// Get nullable Molarity from nullable NanomolesPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Molarity? FromNanomolesPerLiter(QuantityValue? nanomolesperliter) - { - return nanomolesperliter.HasValue ? FromNanomolesPerLiter(nanomolesperliter.Value) : default(Molarity?); - } - - /// - /// Get nullable Molarity from nullable PicomolesPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Molarity? From(QuantityValue? value, MolarityUnit fromUnit) - { - return value.HasValue ? new Molarity((double)value.Value, fromUnit) : default(Molarity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index d767808955..649ddcf6c1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct Permeability : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Permeability from nullable HenriesPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Permeability? From(QuantityValue? value, PermeabilityUnit fromUnit) - { - return value.HasValue ? new Permeability((double)value.Value, fromUnit) : default(Permeability?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 4891ceb3de..5be12bc995 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct Permittivity : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Permittivity from nullable FaradsPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Permittivity? From(QuantityValue? value, PermittivityUnit fromUnit) - { - return value.HasValue ? new Permittivity((double)value.Value, fromUnit) : default(Permittivity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 9287d3cbb3..b755ff3660 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -60,202 +60,6 @@ public partial struct Power : IComparable, IComparable ///
public decimal Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Power from nullable BoilerHorsepower. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromBoilerHorsepower(QuantityValue? boilerhorsepower) - { - return boilerhorsepower.HasValue ? FromBoilerHorsepower(boilerhorsepower.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable BritishThermalUnitsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromBritishThermalUnitsPerHour(QuantityValue? britishthermalunitsperhour) - { - return britishthermalunitsperhour.HasValue ? FromBritishThermalUnitsPerHour(britishthermalunitsperhour.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Decawatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromDecawatts(QuantityValue? decawatts) - { - return decawatts.HasValue ? FromDecawatts(decawatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Deciwatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromDeciwatts(QuantityValue? deciwatts) - { - return deciwatts.HasValue ? FromDeciwatts(deciwatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable ElectricalHorsepower. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromElectricalHorsepower(QuantityValue? electricalhorsepower) - { - return electricalhorsepower.HasValue ? FromElectricalHorsepower(electricalhorsepower.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Femtowatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromFemtowatts(QuantityValue? femtowatts) - { - return femtowatts.HasValue ? FromFemtowatts(femtowatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Gigawatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromGigawatts(QuantityValue? gigawatts) - { - return gigawatts.HasValue ? FromGigawatts(gigawatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable HydraulicHorsepower. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromHydraulicHorsepower(QuantityValue? hydraulichorsepower) - { - return hydraulichorsepower.HasValue ? FromHydraulicHorsepower(hydraulichorsepower.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable KilobritishThermalUnitsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromKilobritishThermalUnitsPerHour(QuantityValue? kilobritishthermalunitsperhour) - { - return kilobritishthermalunitsperhour.HasValue ? FromKilobritishThermalUnitsPerHour(kilobritishthermalunitsperhour.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Kilowatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromKilowatts(QuantityValue? kilowatts) - { - return kilowatts.HasValue ? FromKilowatts(kilowatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable MechanicalHorsepower. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromMechanicalHorsepower(QuantityValue? mechanicalhorsepower) - { - return mechanicalhorsepower.HasValue ? FromMechanicalHorsepower(mechanicalhorsepower.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Megawatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromMegawatts(QuantityValue? megawatts) - { - return megawatts.HasValue ? FromMegawatts(megawatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable MetricHorsepower. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromMetricHorsepower(QuantityValue? metrichorsepower) - { - return metrichorsepower.HasValue ? FromMetricHorsepower(metrichorsepower.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Microwatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromMicrowatts(QuantityValue? microwatts) - { - return microwatts.HasValue ? FromMicrowatts(microwatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Milliwatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromMilliwatts(QuantityValue? milliwatts) - { - return milliwatts.HasValue ? FromMilliwatts(milliwatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Nanowatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromNanowatts(QuantityValue? nanowatts) - { - return nanowatts.HasValue ? FromNanowatts(nanowatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Petawatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromPetawatts(QuantityValue? petawatts) - { - return petawatts.HasValue ? FromPetawatts(petawatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Picowatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromPicowatts(QuantityValue? picowatts) - { - return picowatts.HasValue ? FromPicowatts(picowatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Terawatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Power? FromTerawatts(QuantityValue? terawatts) - { - return terawatts.HasValue ? FromTerawatts(terawatts.Value) : default(Power?); - } - - /// - /// Get nullable Power from nullable Watts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Power? From(QuantityValue? value, PowerUnit fromUnit) - { - return value.HasValue ? new Power((decimal)value.Value, fromUnit) : default(Power?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index c1612bea8f..183c4b30d8 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -60,418 +60,6 @@ public partial struct PowerDensity : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable PowerDensity from nullable DecawattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDecawattsPerCubicFoot(QuantityValue? decawattspercubicfoot) - { - return decawattspercubicfoot.HasValue ? FromDecawattsPerCubicFoot(decawattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable DecawattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDecawattsPerCubicInch(QuantityValue? decawattspercubicinch) - { - return decawattspercubicinch.HasValue ? FromDecawattsPerCubicInch(decawattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable DecawattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDecawattsPerCubicMeter(QuantityValue? decawattspercubicmeter) - { - return decawattspercubicmeter.HasValue ? FromDecawattsPerCubicMeter(decawattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable DecawattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDecawattsPerLiter(QuantityValue? decawattsperliter) - { - return decawattsperliter.HasValue ? FromDecawattsPerLiter(decawattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDeciwattsPerCubicFoot(QuantityValue? deciwattspercubicfoot) - { - return deciwattspercubicfoot.HasValue ? FromDeciwattsPerCubicFoot(deciwattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDeciwattsPerCubicInch(QuantityValue? deciwattspercubicinch) - { - return deciwattspercubicinch.HasValue ? FromDeciwattsPerCubicInch(deciwattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDeciwattsPerCubicMeter(QuantityValue? deciwattspercubicmeter) - { - return deciwattspercubicmeter.HasValue ? FromDeciwattsPerCubicMeter(deciwattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromDeciwattsPerLiter(QuantityValue? deciwattsperliter) - { - return deciwattsperliter.HasValue ? FromDeciwattsPerLiter(deciwattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromGigawattsPerCubicFoot(QuantityValue? gigawattspercubicfoot) - { - return gigawattspercubicfoot.HasValue ? FromGigawattsPerCubicFoot(gigawattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromGigawattsPerCubicInch(QuantityValue? gigawattspercubicinch) - { - return gigawattspercubicinch.HasValue ? FromGigawattsPerCubicInch(gigawattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromGigawattsPerCubicMeter(QuantityValue? gigawattspercubicmeter) - { - return gigawattspercubicmeter.HasValue ? FromGigawattsPerCubicMeter(gigawattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromGigawattsPerLiter(QuantityValue? gigawattsperliter) - { - return gigawattsperliter.HasValue ? FromGigawattsPerLiter(gigawattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromKilowattsPerCubicFoot(QuantityValue? kilowattspercubicfoot) - { - return kilowattspercubicfoot.HasValue ? FromKilowattsPerCubicFoot(kilowattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromKilowattsPerCubicInch(QuantityValue? kilowattspercubicinch) - { - return kilowattspercubicinch.HasValue ? FromKilowattsPerCubicInch(kilowattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromKilowattsPerCubicMeter(QuantityValue? kilowattspercubicmeter) - { - return kilowattspercubicmeter.HasValue ? FromKilowattsPerCubicMeter(kilowattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromKilowattsPerLiter(QuantityValue? kilowattsperliter) - { - return kilowattsperliter.HasValue ? FromKilowattsPerLiter(kilowattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMegawattsPerCubicFoot(QuantityValue? megawattspercubicfoot) - { - return megawattspercubicfoot.HasValue ? FromMegawattsPerCubicFoot(megawattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMegawattsPerCubicInch(QuantityValue? megawattspercubicinch) - { - return megawattspercubicinch.HasValue ? FromMegawattsPerCubicInch(megawattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMegawattsPerCubicMeter(QuantityValue? megawattspercubicmeter) - { - return megawattspercubicmeter.HasValue ? FromMegawattsPerCubicMeter(megawattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMegawattsPerLiter(QuantityValue? megawattsperliter) - { - return megawattsperliter.HasValue ? FromMegawattsPerLiter(megawattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMicrowattsPerCubicFoot(QuantityValue? microwattspercubicfoot) - { - return microwattspercubicfoot.HasValue ? FromMicrowattsPerCubicFoot(microwattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMicrowattsPerCubicInch(QuantityValue? microwattspercubicinch) - { - return microwattspercubicinch.HasValue ? FromMicrowattsPerCubicInch(microwattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMicrowattsPerCubicMeter(QuantityValue? microwattspercubicmeter) - { - return microwattspercubicmeter.HasValue ? FromMicrowattsPerCubicMeter(microwattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMicrowattsPerLiter(QuantityValue? microwattsperliter) - { - return microwattsperliter.HasValue ? FromMicrowattsPerLiter(microwattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMilliwattsPerCubicFoot(QuantityValue? milliwattspercubicfoot) - { - return milliwattspercubicfoot.HasValue ? FromMilliwattsPerCubicFoot(milliwattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMilliwattsPerCubicInch(QuantityValue? milliwattspercubicinch) - { - return milliwattspercubicinch.HasValue ? FromMilliwattsPerCubicInch(milliwattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMilliwattsPerCubicMeter(QuantityValue? milliwattspercubicmeter) - { - return milliwattspercubicmeter.HasValue ? FromMilliwattsPerCubicMeter(milliwattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromMilliwattsPerLiter(QuantityValue? milliwattsperliter) - { - return milliwattsperliter.HasValue ? FromMilliwattsPerLiter(milliwattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromNanowattsPerCubicFoot(QuantityValue? nanowattspercubicfoot) - { - return nanowattspercubicfoot.HasValue ? FromNanowattsPerCubicFoot(nanowattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromNanowattsPerCubicInch(QuantityValue? nanowattspercubicinch) - { - return nanowattspercubicinch.HasValue ? FromNanowattsPerCubicInch(nanowattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromNanowattsPerCubicMeter(QuantityValue? nanowattspercubicmeter) - { - return nanowattspercubicmeter.HasValue ? FromNanowattsPerCubicMeter(nanowattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromNanowattsPerLiter(QuantityValue? nanowattsperliter) - { - return nanowattsperliter.HasValue ? FromNanowattsPerLiter(nanowattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromPicowattsPerCubicFoot(QuantityValue? picowattspercubicfoot) - { - return picowattspercubicfoot.HasValue ? FromPicowattsPerCubicFoot(picowattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromPicowattsPerCubicInch(QuantityValue? picowattspercubicinch) - { - return picowattspercubicinch.HasValue ? FromPicowattsPerCubicInch(picowattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromPicowattsPerCubicMeter(QuantityValue? picowattspercubicmeter) - { - return picowattspercubicmeter.HasValue ? FromPicowattsPerCubicMeter(picowattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromPicowattsPerLiter(QuantityValue? picowattsperliter) - { - return picowattsperliter.HasValue ? FromPicowattsPerLiter(picowattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromTerawattsPerCubicFoot(QuantityValue? terawattspercubicfoot) - { - return terawattspercubicfoot.HasValue ? FromTerawattsPerCubicFoot(terawattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromTerawattsPerCubicInch(QuantityValue? terawattspercubicinch) - { - return terawattspercubicinch.HasValue ? FromTerawattsPerCubicInch(terawattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromTerawattsPerCubicMeter(QuantityValue? terawattspercubicmeter) - { - return terawattspercubicmeter.HasValue ? FromTerawattsPerCubicMeter(terawattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromTerawattsPerLiter(QuantityValue? terawattsperliter) - { - return terawattsperliter.HasValue ? FromTerawattsPerLiter(terawattsperliter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable WattsPerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromWattsPerCubicFoot(QuantityValue? wattspercubicfoot) - { - return wattspercubicfoot.HasValue ? FromWattsPerCubicFoot(wattspercubicfoot.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable WattsPerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromWattsPerCubicInch(QuantityValue? wattspercubicinch) - { - return wattspercubicinch.HasValue ? FromWattsPerCubicInch(wattspercubicinch.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable WattsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerDensity? FromWattsPerCubicMeter(QuantityValue? wattspercubicmeter) - { - return wattspercubicmeter.HasValue ? FromWattsPerCubicMeter(wattspercubicmeter.Value) : default(PowerDensity?); - } - - /// - /// Get nullable PowerDensity from nullable WattsPerLiter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerDensity? From(QuantityValue? value, PowerDensityUnit fromUnit) - { - return value.HasValue ? new PowerDensity((double)value.Value, fromUnit) : default(PowerDensity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index fb8b9b3639..7ed507dbe4 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -60,40 +60,6 @@ public partial struct PowerRatio : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable PowerRatio from nullable DecibelMilliwatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PowerRatio? FromDecibelMilliwatts(QuantityValue? decibelmilliwatts) - { - return decibelmilliwatts.HasValue ? FromDecibelMilliwatts(decibelmilliwatts.Value) : default(PowerRatio?); - } - - /// - /// Get nullable PowerRatio from nullable DecibelWatts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PowerRatio? From(QuantityValue? value, PowerRatioUnit fromUnit) - { - return value.HasValue ? new PowerRatio((double)value.Value, fromUnit) : default(PowerRatio?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 251ae0bce2..61c85b42bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -60,364 +60,6 @@ public partial struct Pressure : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Pressure from nullable Atmospheres. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromAtmospheres(QuantityValue? atmospheres) - { - return atmospheres.HasValue ? FromAtmospheres(atmospheres.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Bars. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromBars(QuantityValue? bars) - { - return bars.HasValue ? FromBars(bars.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Centibars. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromCentibars(QuantityValue? centibars) - { - return centibars.HasValue ? FromCentibars(centibars.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Decapascals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromDecapascals(QuantityValue? decapascals) - { - return decapascals.HasValue ? FromDecapascals(decapascals.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Decibars. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromDecibars(QuantityValue? decibars) - { - return decibars.HasValue ? FromDecibars(decibars.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable FeetOfHead. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromFeetOfHead(QuantityValue? feetofhead) - { - return feetofhead.HasValue ? FromFeetOfHead(feetofhead.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Gigapascals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromGigapascals(QuantityValue? gigapascals) - { - return gigapascals.HasValue ? FromGigapascals(gigapascals.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Hectopascals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromHectopascals(QuantityValue? hectopascals) - { - return hectopascals.HasValue ? FromHectopascals(hectopascals.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable InchesOfMercury. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromInchesOfMercury(QuantityValue? inchesofmercury) - { - return inchesofmercury.HasValue ? FromInchesOfMercury(inchesofmercury.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Kilobars. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilobars(QuantityValue? kilobars) - { - return kilobars.HasValue ? FromKilobars(kilobars.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilogramsForcePerSquareCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilogramsForcePerSquareCentimeter(QuantityValue? kilogramsforcepersquarecentimeter) - { - return kilogramsforcepersquarecentimeter.HasValue ? FromKilogramsForcePerSquareCentimeter(kilogramsforcepersquarecentimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilogramsForcePerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilogramsForcePerSquareMeter(QuantityValue? kilogramsforcepersquaremeter) - { - return kilogramsforcepersquaremeter.HasValue ? FromKilogramsForcePerSquareMeter(kilogramsforcepersquaremeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilogramsForcePerSquareMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilogramsForcePerSquareMillimeter(QuantityValue? kilogramsforcepersquaremillimeter) - { - return kilogramsforcepersquaremillimeter.HasValue ? FromKilogramsForcePerSquareMillimeter(kilogramsforcepersquaremillimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilonewtonsPerSquareCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilonewtonsPerSquareCentimeter(QuantityValue? kilonewtonspersquarecentimeter) - { - return kilonewtonspersquarecentimeter.HasValue ? FromKilonewtonsPerSquareCentimeter(kilonewtonspersquarecentimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilonewtonsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilonewtonsPerSquareMeter(QuantityValue? kilonewtonspersquaremeter) - { - return kilonewtonspersquaremeter.HasValue ? FromKilonewtonsPerSquareMeter(kilonewtonspersquaremeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilonewtonsPerSquareMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilonewtonsPerSquareMillimeter(QuantityValue? kilonewtonspersquaremillimeter) - { - return kilonewtonspersquaremillimeter.HasValue ? FromKilonewtonsPerSquareMillimeter(kilonewtonspersquaremillimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Kilopascals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilopascals(QuantityValue? kilopascals) - { - return kilopascals.HasValue ? FromKilopascals(kilopascals.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilopoundsForcePerSquareFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilopoundsForcePerSquareFoot(QuantityValue? kilopoundsforcepersquarefoot) - { - return kilopoundsforcepersquarefoot.HasValue ? FromKilopoundsForcePerSquareFoot(kilopoundsforcepersquarefoot.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable KilopoundsForcePerSquareInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromKilopoundsForcePerSquareInch(QuantityValue? kilopoundsforcepersquareinch) - { - return kilopoundsforcepersquareinch.HasValue ? FromKilopoundsForcePerSquareInch(kilopoundsforcepersquareinch.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Megabars. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromMegabars(QuantityValue? megabars) - { - return megabars.HasValue ? FromMegabars(megabars.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable MeganewtonsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromMeganewtonsPerSquareMeter(QuantityValue? meganewtonspersquaremeter) - { - return meganewtonspersquaremeter.HasValue ? FromMeganewtonsPerSquareMeter(meganewtonspersquaremeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Megapascals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromMegapascals(QuantityValue? megapascals) - { - return megapascals.HasValue ? FromMegapascals(megapascals.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable MetersOfHead. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromMetersOfHead(QuantityValue? metersofhead) - { - return metersofhead.HasValue ? FromMetersOfHead(metersofhead.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Micropascals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromMicropascals(QuantityValue? micropascals) - { - return micropascals.HasValue ? FromMicropascals(micropascals.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Millibars. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromMillibars(QuantityValue? millibars) - { - return millibars.HasValue ? FromMillibars(millibars.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable MillimetersOfMercury. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromMillimetersOfMercury(QuantityValue? millimetersofmercury) - { - return millimetersofmercury.HasValue ? FromMillimetersOfMercury(millimetersofmercury.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable NewtonsPerSquareCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromNewtonsPerSquareCentimeter(QuantityValue? newtonspersquarecentimeter) - { - return newtonspersquarecentimeter.HasValue ? FromNewtonsPerSquareCentimeter(newtonspersquarecentimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable NewtonsPerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromNewtonsPerSquareMeter(QuantityValue? newtonspersquaremeter) - { - return newtonspersquaremeter.HasValue ? FromNewtonsPerSquareMeter(newtonspersquaremeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable NewtonsPerSquareMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromNewtonsPerSquareMillimeter(QuantityValue? newtonspersquaremillimeter) - { - return newtonspersquaremillimeter.HasValue ? FromNewtonsPerSquareMillimeter(newtonspersquaremillimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Pascals. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromPascals(QuantityValue? pascals) - { - return pascals.HasValue ? FromPascals(pascals.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable PoundsForcePerSquareFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromPoundsForcePerSquareFoot(QuantityValue? poundsforcepersquarefoot) - { - return poundsforcepersquarefoot.HasValue ? FromPoundsForcePerSquareFoot(poundsforcepersquarefoot.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable PoundsForcePerSquareInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromPoundsForcePerSquareInch(QuantityValue? poundsforcepersquareinch) - { - return poundsforcepersquareinch.HasValue ? FromPoundsForcePerSquareInch(poundsforcepersquareinch.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Psi. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromPsi(QuantityValue? psi) - { - return psi.HasValue ? FromPsi(psi.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable TechnicalAtmospheres. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromTechnicalAtmospheres(QuantityValue? technicalatmospheres) - { - return technicalatmospheres.HasValue ? FromTechnicalAtmospheres(technicalatmospheres.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable TonnesForcePerSquareCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromTonnesForcePerSquareCentimeter(QuantityValue? tonnesforcepersquarecentimeter) - { - return tonnesforcepersquarecentimeter.HasValue ? FromTonnesForcePerSquareCentimeter(tonnesforcepersquarecentimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable TonnesForcePerSquareMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromTonnesForcePerSquareMeter(QuantityValue? tonnesforcepersquaremeter) - { - return tonnesforcepersquaremeter.HasValue ? FromTonnesForcePerSquareMeter(tonnesforcepersquaremeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable TonnesForcePerSquareMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Pressure? FromTonnesForcePerSquareMillimeter(QuantityValue? tonnesforcepersquaremillimeter) - { - return tonnesforcepersquaremillimeter.HasValue ? FromTonnesForcePerSquareMillimeter(tonnesforcepersquaremillimeter.Value) : default(Pressure?); - } - - /// - /// Get nullable Pressure from nullable Torrs. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Pressure? From(QuantityValue? value, PressureUnit fromUnit) - { - return value.HasValue ? new Pressure((double)value.Value, fromUnit) : default(Pressure?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index e9133a77a8..cadf4edc38 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct PressureChangeRate : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable PressureChangeRate from nullable AtmospheresPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PressureChangeRate? FromAtmospheresPerSecond(QuantityValue? atmospherespersecond) - { - return atmospherespersecond.HasValue ? FromAtmospheresPerSecond(atmospherespersecond.Value) : default(PressureChangeRate?); - } - - /// - /// Get nullable PressureChangeRate from nullable KilopascalsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PressureChangeRate? FromKilopascalsPerSecond(QuantityValue? kilopascalspersecond) - { - return kilopascalspersecond.HasValue ? FromKilopascalsPerSecond(kilopascalspersecond.Value) : default(PressureChangeRate?); - } - - /// - /// Get nullable PressureChangeRate from nullable MegapascalsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static PressureChangeRate? FromMegapascalsPerSecond(QuantityValue? megapascalspersecond) - { - return megapascalspersecond.HasValue ? FromMegapascalsPerSecond(megapascalspersecond.Value) : default(PressureChangeRate?); - } - - /// - /// Get nullable PressureChangeRate from nullable PascalsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static PressureChangeRate? From(QuantityValue? value, PressureChangeRateUnit fromUnit) - { - return value.HasValue ? new PressureChangeRate((double)value.Value, fromUnit) : default(PressureChangeRate?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 993c2015d3..e0a699a55c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -60,76 +60,6 @@ public partial struct Ratio : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Ratio from nullable DecimalFractions. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Ratio? FromDecimalFractions(QuantityValue? decimalfractions) - { - return decimalfractions.HasValue ? FromDecimalFractions(decimalfractions.Value) : default(Ratio?); - } - - /// - /// Get nullable Ratio from nullable PartsPerBillion. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Ratio? FromPartsPerBillion(QuantityValue? partsperbillion) - { - return partsperbillion.HasValue ? FromPartsPerBillion(partsperbillion.Value) : default(Ratio?); - } - - /// - /// Get nullable Ratio from nullable PartsPerMillion. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Ratio? FromPartsPerMillion(QuantityValue? partspermillion) - { - return partspermillion.HasValue ? FromPartsPerMillion(partspermillion.Value) : default(Ratio?); - } - - /// - /// Get nullable Ratio from nullable PartsPerThousand. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Ratio? FromPartsPerThousand(QuantityValue? partsperthousand) - { - return partsperthousand.HasValue ? FromPartsPerThousand(partsperthousand.Value) : default(Ratio?); - } - - /// - /// Get nullable Ratio from nullable PartsPerTrillion. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Ratio? FromPartsPerTrillion(QuantityValue? partspertrillion) - { - return partspertrillion.HasValue ? FromPartsPerTrillion(partspertrillion.Value) : default(Ratio?); - } - - /// - /// Get nullable Ratio from nullable Percent. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Ratio? From(QuantityValue? value, RatioUnit fromUnit) - { - return value.HasValue ? new Ratio((double)value.Value, fromUnit) : default(Ratio?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 390183475b..b21efbd3f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct ReactiveEnergy : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ReactiveEnergy from nullable KilovoltampereReactiveHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ReactiveEnergy? FromKilovoltampereReactiveHours(QuantityValue? kilovoltamperereactivehours) - { - return kilovoltamperereactivehours.HasValue ? FromKilovoltampereReactiveHours(kilovoltamperereactivehours.Value) : default(ReactiveEnergy?); - } - - /// - /// Get nullable ReactiveEnergy from nullable MegavoltampereReactiveHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ReactiveEnergy? FromMegavoltampereReactiveHours(QuantityValue? megavoltamperereactivehours) - { - return megavoltamperereactivehours.HasValue ? FromMegavoltampereReactiveHours(megavoltamperereactivehours.Value) : default(ReactiveEnergy?); - } - - /// - /// Get nullable ReactiveEnergy from nullable VoltampereReactiveHours. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactiveEnergy? From(QuantityValue? value, ReactiveEnergyUnit fromUnit) - { - return value.HasValue ? new ReactiveEnergy((double)value.Value, fromUnit) : default(ReactiveEnergy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index 086effb16a..dd28e8171e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -60,58 +60,6 @@ public partial struct ReactivePower : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ReactivePower from nullable GigavoltamperesReactive. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ReactivePower? FromGigavoltamperesReactive(QuantityValue? gigavoltamperesreactive) - { - return gigavoltamperesreactive.HasValue ? FromGigavoltamperesReactive(gigavoltamperesreactive.Value) : default(ReactivePower?); - } - - /// - /// Get nullable ReactivePower from nullable KilovoltamperesReactive. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ReactivePower? FromKilovoltamperesReactive(QuantityValue? kilovoltamperesreactive) - { - return kilovoltamperesreactive.HasValue ? FromKilovoltamperesReactive(kilovoltamperesreactive.Value) : default(ReactivePower?); - } - - /// - /// Get nullable ReactivePower from nullable MegavoltamperesReactive. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ReactivePower? FromMegavoltamperesReactive(QuantityValue? megavoltamperesreactive) - { - return megavoltamperesreactive.HasValue ? FromMegavoltamperesReactive(megavoltamperesreactive.Value) : default(ReactivePower?); - } - - /// - /// Get nullable ReactivePower from nullable VoltamperesReactive. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ReactivePower? From(QuantityValue? value, ReactivePowerUnit fromUnit) - { - return value.HasValue ? new ReactivePower((double)value.Value, fromUnit) : default(ReactivePower?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 16b0a47185..f080c98165 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct RotationalAcceleration : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable RotationalAcceleration from nullable DegreesPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalAcceleration? FromDegreesPerSecondSquared(QuantityValue? degreespersecondsquared) - { - return degreespersecondsquared.HasValue ? FromDegreesPerSecondSquared(degreespersecondsquared.Value) : default(RotationalAcceleration?); - } - - /// - /// Get nullable RotationalAcceleration from nullable RadiansPerSecondSquared. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalAcceleration? FromRadiansPerSecondSquared(QuantityValue? radianspersecondsquared) - { - return radianspersecondsquared.HasValue ? FromRadiansPerSecondSquared(radianspersecondsquared.Value) : default(RotationalAcceleration?); - } - - /// - /// Get nullable RotationalAcceleration from nullable RevolutionsPerMinutePerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalAcceleration? From(QuantityValue? value, RotationalAccelerationUnit fromUnit) - { - return value.HasValue ? new RotationalAcceleration((double)value.Value, fromUnit) : default(RotationalAcceleration?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index baf25cc9cf..f2e653a169 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -60,139 +60,6 @@ public partial struct RotationalSpeed : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable RotationalSpeed from nullable CentiradiansPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromCentiradiansPerSecond(QuantityValue? centiradianspersecond) - { - return centiradianspersecond.HasValue ? FromCentiradiansPerSecond(centiradianspersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable DeciradiansPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromDeciradiansPerSecond(QuantityValue? deciradianspersecond) - { - return deciradianspersecond.HasValue ? FromDeciradiansPerSecond(deciradianspersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable DegreesPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromDegreesPerMinute(QuantityValue? degreesperminute) - { - return degreesperminute.HasValue ? FromDegreesPerMinute(degreesperminute.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable DegreesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromDegreesPerSecond(QuantityValue? degreespersecond) - { - return degreespersecond.HasValue ? FromDegreesPerSecond(degreespersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable MicrodegreesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromMicrodegreesPerSecond(QuantityValue? microdegreespersecond) - { - return microdegreespersecond.HasValue ? FromMicrodegreesPerSecond(microdegreespersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable MicroradiansPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromMicroradiansPerSecond(QuantityValue? microradianspersecond) - { - return microradianspersecond.HasValue ? FromMicroradiansPerSecond(microradianspersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable MillidegreesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromMillidegreesPerSecond(QuantityValue? millidegreespersecond) - { - return millidegreespersecond.HasValue ? FromMillidegreesPerSecond(millidegreespersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable MilliradiansPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromMilliradiansPerSecond(QuantityValue? milliradianspersecond) - { - return milliradianspersecond.HasValue ? FromMilliradiansPerSecond(milliradianspersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable NanodegreesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromNanodegreesPerSecond(QuantityValue? nanodegreespersecond) - { - return nanodegreespersecond.HasValue ? FromNanodegreesPerSecond(nanodegreespersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable NanoradiansPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromNanoradiansPerSecond(QuantityValue? nanoradianspersecond) - { - return nanoradianspersecond.HasValue ? FromNanoradiansPerSecond(nanoradianspersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable RadiansPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromRadiansPerSecond(QuantityValue? radianspersecond) - { - return radianspersecond.HasValue ? FromRadiansPerSecond(radianspersecond.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable RevolutionsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalSpeed? FromRevolutionsPerMinute(QuantityValue? revolutionsperminute) - { - return revolutionsperminute.HasValue ? FromRevolutionsPerMinute(revolutionsperminute.Value) : default(RotationalSpeed?); - } - - /// - /// Get nullable RotationalSpeed from nullable RevolutionsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalSpeed? From(QuantityValue? value, RotationalSpeedUnit fromUnit) - { - return value.HasValue ? new RotationalSpeed((double)value.Value, fromUnit) : default(RotationalSpeed?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index db4b15e846..a72a9e4b34 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct RotationalStiffness : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable RotationalStiffness from nullable KilonewtonMetersPerRadian. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalStiffness? FromKilonewtonMetersPerRadian(QuantityValue? kilonewtonmetersperradian) - { - return kilonewtonmetersperradian.HasValue ? FromKilonewtonMetersPerRadian(kilonewtonmetersperradian.Value) : default(RotationalStiffness?); - } - - /// - /// Get nullable RotationalStiffness from nullable MeganewtonMetersPerRadian. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalStiffness? FromMeganewtonMetersPerRadian(QuantityValue? meganewtonmetersperradian) - { - return meganewtonmetersperradian.HasValue ? FromMeganewtonMetersPerRadian(meganewtonmetersperradian.Value) : default(RotationalStiffness?); - } - - /// - /// Get nullable RotationalStiffness from nullable NewtonMetersPerRadian. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffness? From(QuantityValue? value, RotationalStiffnessUnit fromUnit) - { - return value.HasValue ? new RotationalStiffness((double)value.Value, fromUnit) : default(RotationalStiffness?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index 0a41d0fef4..1cea909409 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -60,49 +60,6 @@ public partial struct RotationalStiffnessPerLength : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable RotationalStiffnessPerLength from nullable KilonewtonMetersPerRadianPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalStiffnessPerLength? FromKilonewtonMetersPerRadianPerMeter(QuantityValue? kilonewtonmetersperradianpermeter) - { - return kilonewtonmetersperradianpermeter.HasValue ? FromKilonewtonMetersPerRadianPerMeter(kilonewtonmetersperradianpermeter.Value) : default(RotationalStiffnessPerLength?); - } - - /// - /// Get nullable RotationalStiffnessPerLength from nullable MeganewtonMetersPerRadianPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static RotationalStiffnessPerLength? FromMeganewtonMetersPerRadianPerMeter(QuantityValue? meganewtonmetersperradianpermeter) - { - return meganewtonmetersperradianpermeter.HasValue ? FromMeganewtonMetersPerRadianPerMeter(meganewtonmetersperradianpermeter.Value) : default(RotationalStiffnessPerLength?); - } - - /// - /// Get nullable RotationalStiffnessPerLength from nullable NewtonMetersPerRadianPerMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static RotationalStiffnessPerLength? From(QuantityValue? value, RotationalStiffnessPerLengthUnit fromUnit) - { - return value.HasValue ? new RotationalStiffnessPerLength((double)value.Value, fromUnit) : default(RotationalStiffnessPerLength?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 802e37b63a..753cc4908d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct SolidAngle : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable SolidAngle from nullable Steradians. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SolidAngle? From(QuantityValue? value, SolidAngleUnit fromUnit) - { - return value.HasValue ? new SolidAngle((double)value.Value, fromUnit) : default(SolidAngle?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 5d6fd503d4..d14c8373a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -60,94 +60,6 @@ public partial struct SpecificEnergy : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable SpecificEnergy from nullable CaloriesPerGram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEnergy? FromCaloriesPerGram(QuantityValue? caloriespergram) - { - return caloriespergram.HasValue ? FromCaloriesPerGram(caloriespergram.Value) : default(SpecificEnergy?); - } - - /// - /// Get nullable SpecificEnergy from nullable JoulesPerKilogram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEnergy? FromJoulesPerKilogram(QuantityValue? joulesperkilogram) - { - return joulesperkilogram.HasValue ? FromJoulesPerKilogram(joulesperkilogram.Value) : default(SpecificEnergy?); - } - - /// - /// Get nullable SpecificEnergy from nullable KilocaloriesPerGram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEnergy? FromKilocaloriesPerGram(QuantityValue? kilocaloriespergram) - { - return kilocaloriespergram.HasValue ? FromKilocaloriesPerGram(kilocaloriespergram.Value) : default(SpecificEnergy?); - } - - /// - /// Get nullable SpecificEnergy from nullable KilojoulesPerKilogram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEnergy? FromKilojoulesPerKilogram(QuantityValue? kilojoulesperkilogram) - { - return kilojoulesperkilogram.HasValue ? FromKilojoulesPerKilogram(kilojoulesperkilogram.Value) : default(SpecificEnergy?); - } - - /// - /// Get nullable SpecificEnergy from nullable KilowattHoursPerKilogram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEnergy? FromKilowattHoursPerKilogram(QuantityValue? kilowatthoursperkilogram) - { - return kilowatthoursperkilogram.HasValue ? FromKilowattHoursPerKilogram(kilowatthoursperkilogram.Value) : default(SpecificEnergy?); - } - - /// - /// Get nullable SpecificEnergy from nullable MegajoulesPerKilogram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEnergy? FromMegajoulesPerKilogram(QuantityValue? megajoulesperkilogram) - { - return megajoulesperkilogram.HasValue ? FromMegajoulesPerKilogram(megajoulesperkilogram.Value) : default(SpecificEnergy?); - } - - /// - /// Get nullable SpecificEnergy from nullable MegawattHoursPerKilogram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEnergy? FromMegawattHoursPerKilogram(QuantityValue? megawatthoursperkilogram) - { - return megawatthoursperkilogram.HasValue ? FromMegawattHoursPerKilogram(megawatthoursperkilogram.Value) : default(SpecificEnergy?); - } - - /// - /// Get nullable SpecificEnergy from nullable WattHoursPerKilogram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEnergy? From(QuantityValue? value, SpecificEnergyUnit fromUnit) - { - return value.HasValue ? new SpecificEnergy((double)value.Value, fromUnit) : default(SpecificEnergy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index df6ff742b1..01cab081c9 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -60,94 +60,6 @@ public partial struct SpecificEntropy : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable SpecificEntropy from nullable CaloriesPerGramKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEntropy? FromCaloriesPerGramKelvin(QuantityValue? caloriespergramkelvin) - { - return caloriespergramkelvin.HasValue ? FromCaloriesPerGramKelvin(caloriespergramkelvin.Value) : default(SpecificEntropy?); - } - - /// - /// Get nullable SpecificEntropy from nullable JoulesPerKilogramDegreeCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEntropy? FromJoulesPerKilogramDegreeCelsius(QuantityValue? joulesperkilogramdegreecelsius) - { - return joulesperkilogramdegreecelsius.HasValue ? FromJoulesPerKilogramDegreeCelsius(joulesperkilogramdegreecelsius.Value) : default(SpecificEntropy?); - } - - /// - /// Get nullable SpecificEntropy from nullable JoulesPerKilogramKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEntropy? FromJoulesPerKilogramKelvin(QuantityValue? joulesperkilogramkelvin) - { - return joulesperkilogramkelvin.HasValue ? FromJoulesPerKilogramKelvin(joulesperkilogramkelvin.Value) : default(SpecificEntropy?); - } - - /// - /// Get nullable SpecificEntropy from nullable KilocaloriesPerGramKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEntropy? FromKilocaloriesPerGramKelvin(QuantityValue? kilocaloriespergramkelvin) - { - return kilocaloriespergramkelvin.HasValue ? FromKilocaloriesPerGramKelvin(kilocaloriespergramkelvin.Value) : default(SpecificEntropy?); - } - - /// - /// Get nullable SpecificEntropy from nullable KilojoulesPerKilogramDegreeCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEntropy? FromKilojoulesPerKilogramDegreeCelsius(QuantityValue? kilojoulesperkilogramdegreecelsius) - { - return kilojoulesperkilogramdegreecelsius.HasValue ? FromKilojoulesPerKilogramDegreeCelsius(kilojoulesperkilogramdegreecelsius.Value) : default(SpecificEntropy?); - } - - /// - /// Get nullable SpecificEntropy from nullable KilojoulesPerKilogramKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEntropy? FromKilojoulesPerKilogramKelvin(QuantityValue? kilojoulesperkilogramkelvin) - { - return kilojoulesperkilogramkelvin.HasValue ? FromKilojoulesPerKilogramKelvin(kilojoulesperkilogramkelvin.Value) : default(SpecificEntropy?); - } - - /// - /// Get nullable SpecificEntropy from nullable MegajoulesPerKilogramDegreeCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificEntropy? FromMegajoulesPerKilogramDegreeCelsius(QuantityValue? megajoulesperkilogramdegreecelsius) - { - return megajoulesperkilogramdegreecelsius.HasValue ? FromMegajoulesPerKilogramDegreeCelsius(megajoulesperkilogramdegreecelsius.Value) : default(SpecificEntropy?); - } - - /// - /// Get nullable SpecificEntropy from nullable MegajoulesPerKilogramKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificEntropy? From(QuantityValue? value, SpecificEntropyUnit fromUnit) - { - return value.HasValue ? new SpecificEntropy((double)value.Value, fromUnit) : default(SpecificEntropy?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 1e06b97f10..09239402e0 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -60,40 +60,6 @@ public partial struct SpecificVolume : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable SpecificVolume from nullable CubicFeetPerPound. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificVolume? FromCubicFeetPerPound(QuantityValue? cubicfeetperpound) - { - return cubicfeetperpound.HasValue ? FromCubicFeetPerPound(cubicfeetperpound.Value) : default(SpecificVolume?); - } - - /// - /// Get nullable SpecificVolume from nullable CubicMetersPerKilogram. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificVolume? From(QuantityValue? value, SpecificVolumeUnit fromUnit) - { - return value.HasValue ? new SpecificVolume((double)value.Value, fromUnit) : default(SpecificVolume?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 417b4170e6..663448a8c5 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -60,175 +60,6 @@ public partial struct SpecificWeight : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilogramsForcePerCubicCentimeter(QuantityValue? kilogramsforcepercubiccentimeter) - { - return kilogramsforcepercubiccentimeter.HasValue ? FromKilogramsForcePerCubicCentimeter(kilogramsforcepercubiccentimeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilogramsForcePerCubicMeter(QuantityValue? kilogramsforcepercubicmeter) - { - return kilogramsforcepercubicmeter.HasValue ? FromKilogramsForcePerCubicMeter(kilogramsforcepercubicmeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilogramsForcePerCubicMillimeter(QuantityValue? kilogramsforcepercubicmillimeter) - { - return kilogramsforcepercubicmillimeter.HasValue ? FromKilogramsForcePerCubicMillimeter(kilogramsforcepercubicmillimeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilonewtonsPerCubicCentimeter(QuantityValue? kilonewtonspercubiccentimeter) - { - return kilonewtonspercubiccentimeter.HasValue ? FromKilonewtonsPerCubicCentimeter(kilonewtonspercubiccentimeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilonewtonsPerCubicMeter(QuantityValue? kilonewtonspercubicmeter) - { - return kilonewtonspercubicmeter.HasValue ? FromKilonewtonsPerCubicMeter(kilonewtonspercubicmeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilonewtonsPerCubicMillimeter(QuantityValue? kilonewtonspercubicmillimeter) - { - return kilonewtonspercubicmillimeter.HasValue ? FromKilonewtonsPerCubicMillimeter(kilonewtonspercubicmillimeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable KilopoundsForcePerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilopoundsForcePerCubicFoot(QuantityValue? kilopoundsforcepercubicfoot) - { - return kilopoundsforcepercubicfoot.HasValue ? FromKilopoundsForcePerCubicFoot(kilopoundsforcepercubicfoot.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable KilopoundsForcePerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromKilopoundsForcePerCubicInch(QuantityValue? kilopoundsforcepercubicinch) - { - return kilopoundsforcepercubicinch.HasValue ? FromKilopoundsForcePerCubicInch(kilopoundsforcepercubicinch.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable MeganewtonsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromMeganewtonsPerCubicMeter(QuantityValue? meganewtonspercubicmeter) - { - return meganewtonspercubicmeter.HasValue ? FromMeganewtonsPerCubicMeter(meganewtonspercubicmeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable NewtonsPerCubicCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromNewtonsPerCubicCentimeter(QuantityValue? newtonspercubiccentimeter) - { - return newtonspercubiccentimeter.HasValue ? FromNewtonsPerCubicCentimeter(newtonspercubiccentimeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable NewtonsPerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromNewtonsPerCubicMeter(QuantityValue? newtonspercubicmeter) - { - return newtonspercubicmeter.HasValue ? FromNewtonsPerCubicMeter(newtonspercubicmeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable NewtonsPerCubicMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromNewtonsPerCubicMillimeter(QuantityValue? newtonspercubicmillimeter) - { - return newtonspercubicmillimeter.HasValue ? FromNewtonsPerCubicMillimeter(newtonspercubicmillimeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable PoundsForcePerCubicFoot. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromPoundsForcePerCubicFoot(QuantityValue? poundsforcepercubicfoot) - { - return poundsforcepercubicfoot.HasValue ? FromPoundsForcePerCubicFoot(poundsforcepercubicfoot.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable PoundsForcePerCubicInch. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromPoundsForcePerCubicInch(QuantityValue? poundsforcepercubicinch) - { - return poundsforcepercubicinch.HasValue ? FromPoundsForcePerCubicInch(poundsforcepercubicinch.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable TonnesForcePerCubicCentimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromTonnesForcePerCubicCentimeter(QuantityValue? tonnesforcepercubiccentimeter) - { - return tonnesforcepercubiccentimeter.HasValue ? FromTonnesForcePerCubicCentimeter(tonnesforcepercubiccentimeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable TonnesForcePerCubicMeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static SpecificWeight? FromTonnesForcePerCubicMeter(QuantityValue? tonnesforcepercubicmeter) - { - return tonnesforcepercubicmeter.HasValue ? FromTonnesForcePerCubicMeter(tonnesforcepercubicmeter.Value) : default(SpecificWeight?); - } - - /// - /// Get nullable SpecificWeight from nullable TonnesForcePerCubicMillimeter. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static SpecificWeight? From(QuantityValue? value, SpecificWeightUnit fromUnit) - { - return value.HasValue ? new SpecificWeight((double)value.Value, fromUnit) : default(SpecificWeight?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index daf8ab45d8..67c8cadfb3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -60,310 +60,6 @@ public partial struct Speed : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Speed from nullable CentimetersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromCentimetersPerHour(QuantityValue? centimetersperhour) - { - return centimetersperhour.HasValue ? FromCentimetersPerHour(centimetersperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable CentimetersPerMinutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromCentimetersPerMinutes(QuantityValue? centimetersperminutes) - { - return centimetersperminutes.HasValue ? FromCentimetersPerMinutes(centimetersperminutes.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable CentimetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromCentimetersPerSecond(QuantityValue? centimeterspersecond) - { - return centimeterspersecond.HasValue ? FromCentimetersPerSecond(centimeterspersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable DecimetersPerMinutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromDecimetersPerMinutes(QuantityValue? decimetersperminutes) - { - return decimetersperminutes.HasValue ? FromDecimetersPerMinutes(decimetersperminutes.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable DecimetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromDecimetersPerSecond(QuantityValue? decimeterspersecond) - { - return decimeterspersecond.HasValue ? FromDecimetersPerSecond(decimeterspersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable FeetPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromFeetPerHour(QuantityValue? feetperhour) - { - return feetperhour.HasValue ? FromFeetPerHour(feetperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable FeetPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromFeetPerMinute(QuantityValue? feetperminute) - { - return feetperminute.HasValue ? FromFeetPerMinute(feetperminute.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable FeetPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromFeetPerSecond(QuantityValue? feetpersecond) - { - return feetpersecond.HasValue ? FromFeetPerSecond(feetpersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable InchesPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromInchesPerHour(QuantityValue? inchesperhour) - { - return inchesperhour.HasValue ? FromInchesPerHour(inchesperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable InchesPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromInchesPerMinute(QuantityValue? inchesperminute) - { - return inchesperminute.HasValue ? FromInchesPerMinute(inchesperminute.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable InchesPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromInchesPerSecond(QuantityValue? inchespersecond) - { - return inchespersecond.HasValue ? FromInchesPerSecond(inchespersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable KilometersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromKilometersPerHour(QuantityValue? kilometersperhour) - { - return kilometersperhour.HasValue ? FromKilometersPerHour(kilometersperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable KilometersPerMinutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromKilometersPerMinutes(QuantityValue? kilometersperminutes) - { - return kilometersperminutes.HasValue ? FromKilometersPerMinutes(kilometersperminutes.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable KilometersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromKilometersPerSecond(QuantityValue? kilometerspersecond) - { - return kilometerspersecond.HasValue ? FromKilometersPerSecond(kilometerspersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable Knots. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromKnots(QuantityValue? knots) - { - return knots.HasValue ? FromKnots(knots.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MetersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMetersPerHour(QuantityValue? metersperhour) - { - return metersperhour.HasValue ? FromMetersPerHour(metersperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MetersPerMinutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMetersPerMinutes(QuantityValue? metersperminutes) - { - return metersperminutes.HasValue ? FromMetersPerMinutes(metersperminutes.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMetersPerSecond(QuantityValue? meterspersecond) - { - return meterspersecond.HasValue ? FromMetersPerSecond(meterspersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MicrometersPerMinutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMicrometersPerMinutes(QuantityValue? micrometersperminutes) - { - return micrometersperminutes.HasValue ? FromMicrometersPerMinutes(micrometersperminutes.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MicrometersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMicrometersPerSecond(QuantityValue? micrometerspersecond) - { - return micrometerspersecond.HasValue ? FromMicrometersPerSecond(micrometerspersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MilesPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMilesPerHour(QuantityValue? milesperhour) - { - return milesperhour.HasValue ? FromMilesPerHour(milesperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MillimetersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMillimetersPerHour(QuantityValue? millimetersperhour) - { - return millimetersperhour.HasValue ? FromMillimetersPerHour(millimetersperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MillimetersPerMinutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMillimetersPerMinutes(QuantityValue? millimetersperminutes) - { - return millimetersperminutes.HasValue ? FromMillimetersPerMinutes(millimetersperminutes.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable MillimetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromMillimetersPerSecond(QuantityValue? millimeterspersecond) - { - return millimeterspersecond.HasValue ? FromMillimetersPerSecond(millimeterspersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable NanometersPerMinutes. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromNanometersPerMinutes(QuantityValue? nanometersperminutes) - { - return nanometersperminutes.HasValue ? FromNanometersPerMinutes(nanometersperminutes.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable NanometersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromNanometersPerSecond(QuantityValue? nanometerspersecond) - { - return nanometerspersecond.HasValue ? FromNanometersPerSecond(nanometerspersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable UsSurveyFeetPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromUsSurveyFeetPerHour(QuantityValue? ussurveyfeetperhour) - { - return ussurveyfeetperhour.HasValue ? FromUsSurveyFeetPerHour(ussurveyfeetperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable UsSurveyFeetPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromUsSurveyFeetPerMinute(QuantityValue? ussurveyfeetperminute) - { - return ussurveyfeetperminute.HasValue ? FromUsSurveyFeetPerMinute(ussurveyfeetperminute.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable UsSurveyFeetPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromUsSurveyFeetPerSecond(QuantityValue? ussurveyfeetpersecond) - { - return ussurveyfeetpersecond.HasValue ? FromUsSurveyFeetPerSecond(ussurveyfeetpersecond.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable YardsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromYardsPerHour(QuantityValue? yardsperhour) - { - return yardsperhour.HasValue ? FromYardsPerHour(yardsperhour.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable YardsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Speed? FromYardsPerMinute(QuantityValue? yardsperminute) - { - return yardsperminute.HasValue ? FromYardsPerMinute(yardsperminute.Value) : default(Speed?); - } - - /// - /// Get nullable Speed from nullable YardsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Speed? From(QuantityValue? value, SpeedUnit fromUnit) - { - return value.HasValue ? new Speed((double)value.Value, fromUnit) : default(Speed?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 920828df1b..7ab3a5d8e2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -60,94 +60,6 @@ public partial struct Temperature : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Temperature from nullable DegreesCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Temperature? FromDegreesCelsius(QuantityValue? degreescelsius) - { - return degreescelsius.HasValue ? FromDegreesCelsius(degreescelsius.Value) : default(Temperature?); - } - - /// - /// Get nullable Temperature from nullable DegreesDelisle. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Temperature? FromDegreesDelisle(QuantityValue? degreesdelisle) - { - return degreesdelisle.HasValue ? FromDegreesDelisle(degreesdelisle.Value) : default(Temperature?); - } - - /// - /// Get nullable Temperature from nullable DegreesFahrenheit. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Temperature? FromDegreesFahrenheit(QuantityValue? degreesfahrenheit) - { - return degreesfahrenheit.HasValue ? FromDegreesFahrenheit(degreesfahrenheit.Value) : default(Temperature?); - } - - /// - /// Get nullable Temperature from nullable DegreesNewton. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Temperature? FromDegreesNewton(QuantityValue? degreesnewton) - { - return degreesnewton.HasValue ? FromDegreesNewton(degreesnewton.Value) : default(Temperature?); - } - - /// - /// Get nullable Temperature from nullable DegreesRankine. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Temperature? FromDegreesRankine(QuantityValue? degreesrankine) - { - return degreesrankine.HasValue ? FromDegreesRankine(degreesrankine.Value) : default(Temperature?); - } - - /// - /// Get nullable Temperature from nullable DegreesReaumur. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Temperature? FromDegreesReaumur(QuantityValue? degreesreaumur) - { - return degreesreaumur.HasValue ? FromDegreesReaumur(degreesreaumur.Value) : default(Temperature?); - } - - /// - /// Get nullable Temperature from nullable DegreesRoemer. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Temperature? FromDegreesRoemer(QuantityValue? degreesroemer) - { - return degreesroemer.HasValue ? FromDegreesRoemer(degreesroemer.Value) : default(Temperature?); - } - - /// - /// Get nullable Temperature from nullable Kelvins. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Temperature? From(QuantityValue? value, TemperatureUnit fromUnit) - { - return value.HasValue ? new Temperature((double)value.Value, fromUnit) : default(Temperature?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 87c254bb63..062ab65d8c 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -60,112 +60,6 @@ public partial struct TemperatureChangeRate : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable TemperatureChangeRate from nullable CentidegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromCentidegreesCelsiusPerSecond(QuantityValue? centidegreescelsiuspersecond) - { - return centidegreescelsiuspersecond.HasValue ? FromCentidegreesCelsiusPerSecond(centidegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable DecadegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromDecadegreesCelsiusPerSecond(QuantityValue? decadegreescelsiuspersecond) - { - return decadegreescelsiuspersecond.HasValue ? FromDecadegreesCelsiusPerSecond(decadegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable DecidegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromDecidegreesCelsiusPerSecond(QuantityValue? decidegreescelsiuspersecond) - { - return decidegreescelsiuspersecond.HasValue ? FromDecidegreesCelsiusPerSecond(decidegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable DegreesCelsiusPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromDegreesCelsiusPerMinute(QuantityValue? degreescelsiusperminute) - { - return degreescelsiusperminute.HasValue ? FromDegreesCelsiusPerMinute(degreescelsiusperminute.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable DegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromDegreesCelsiusPerSecond(QuantityValue? degreescelsiuspersecond) - { - return degreescelsiuspersecond.HasValue ? FromDegreesCelsiusPerSecond(degreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable HectodegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromHectodegreesCelsiusPerSecond(QuantityValue? hectodegreescelsiuspersecond) - { - return hectodegreescelsiuspersecond.HasValue ? FromHectodegreesCelsiusPerSecond(hectodegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable KilodegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromKilodegreesCelsiusPerSecond(QuantityValue? kilodegreescelsiuspersecond) - { - return kilodegreescelsiuspersecond.HasValue ? FromKilodegreesCelsiusPerSecond(kilodegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable MicrodegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromMicrodegreesCelsiusPerSecond(QuantityValue? microdegreescelsiuspersecond) - { - return microdegreescelsiuspersecond.HasValue ? FromMicrodegreesCelsiusPerSecond(microdegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable MillidegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureChangeRate? FromMillidegreesCelsiusPerSecond(QuantityValue? millidegreescelsiuspersecond) - { - return millidegreescelsiuspersecond.HasValue ? FromMillidegreesCelsiusPerSecond(millidegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); - } - - /// - /// Get nullable TemperatureChangeRate from nullable NanodegreesCelsiusPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureChangeRate? From(QuantityValue? value, TemperatureChangeRateUnit fromUnit) - { - return value.HasValue ? new TemperatureChangeRate((double)value.Value, fromUnit) : default(TemperatureChangeRate?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 1a85aa86c7..0f8d0ae327 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -60,166 +60,6 @@ public partial struct TemperatureDelta : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable TemperatureDelta from nullable DegreesCelsius. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesCelsius(QuantityValue? degreescelsius) - { - return degreescelsius.HasValue ? FromDegreesCelsius(degreescelsius.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesCelsiusDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesCelsiusDelta(QuantityValue? degreescelsiusdelta) - { - return degreescelsiusdelta.HasValue ? FromDegreesCelsiusDelta(degreescelsiusdelta.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesDelisle. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesDelisle(QuantityValue? degreesdelisle) - { - return degreesdelisle.HasValue ? FromDegreesDelisle(degreesdelisle.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesDelisleDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesDelisleDelta(QuantityValue? degreesdelisledelta) - { - return degreesdelisledelta.HasValue ? FromDegreesDelisleDelta(degreesdelisledelta.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesFahrenheit. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesFahrenheit(QuantityValue? degreesfahrenheit) - { - return degreesfahrenheit.HasValue ? FromDegreesFahrenheit(degreesfahrenheit.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesFahrenheitDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesFahrenheitDelta(QuantityValue? degreesfahrenheitdelta) - { - return degreesfahrenheitdelta.HasValue ? FromDegreesFahrenheitDelta(degreesfahrenheitdelta.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesNewton. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesNewton(QuantityValue? degreesnewton) - { - return degreesnewton.HasValue ? FromDegreesNewton(degreesnewton.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesNewtonDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesNewtonDelta(QuantityValue? degreesnewtondelta) - { - return degreesnewtondelta.HasValue ? FromDegreesNewtonDelta(degreesnewtondelta.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRankine. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesRankine(QuantityValue? degreesrankine) - { - return degreesrankine.HasValue ? FromDegreesRankine(degreesrankine.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRankineDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesRankineDelta(QuantityValue? degreesrankinedelta) - { - return degreesrankinedelta.HasValue ? FromDegreesRankineDelta(degreesrankinedelta.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesReaumur. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesReaumur(QuantityValue? degreesreaumur) - { - return degreesreaumur.HasValue ? FromDegreesReaumur(degreesreaumur.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesReaumurDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesReaumurDelta(QuantityValue? degreesreaumurdelta) - { - return degreesreaumurdelta.HasValue ? FromDegreesReaumurDelta(degreesreaumurdelta.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRoemer. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesRoemer(QuantityValue? degreesroemer) - { - return degreesroemer.HasValue ? FromDegreesRoemer(degreesroemer.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRoemerDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromDegreesRoemerDelta(QuantityValue? degreesroemerdelta) - { - return degreesroemerdelta.HasValue ? FromDegreesRoemerDelta(degreesroemerdelta.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable Kelvins. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static TemperatureDelta? FromKelvins(QuantityValue? kelvins) - { - return kelvins.HasValue ? FromKelvins(kelvins.Value) : default(TemperatureDelta?); - } - - /// - /// Get nullable TemperatureDelta from nullable KelvinsDelta. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static TemperatureDelta? From(QuantityValue? value, TemperatureDeltaUnit fromUnit) - { - return value.HasValue ? new TemperatureDelta((double)value.Value, fromUnit) : default(TemperatureDelta?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 9d4eb1d11e..81ffdd2ffa 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -60,40 +60,6 @@ public partial struct ThermalConductivity : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ThermalConductivity from nullable BtusPerHourFootFahrenheit. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ThermalConductivity? FromBtusPerHourFootFahrenheit(QuantityValue? btusperhourfootfahrenheit) - { - return btusperhourfootfahrenheit.HasValue ? FromBtusPerHourFootFahrenheit(btusperhourfootfahrenheit.Value) : default(ThermalConductivity?); - } - - /// - /// Get nullable ThermalConductivity from nullable WattsPerMeterKelvin. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalConductivity? From(QuantityValue? value, ThermalConductivityUnit fromUnit) - { - return value.HasValue ? new ThermalConductivity((double)value.Value, fromUnit) : default(ThermalConductivity?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 8924ea7ab4..3b45d7d689 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -60,67 +60,6 @@ public partial struct ThermalResistance : IComparable, IComparable public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable ThermalResistance from nullable HourSquareFeetDegreesFahrenheitPerBtu. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ThermalResistance? FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue? hoursquarefeetdegreesfahrenheitperbtu) - { - return hoursquarefeetdegreesfahrenheitperbtu.HasValue ? FromHourSquareFeetDegreesFahrenheitPerBtu(hoursquarefeetdegreesfahrenheitperbtu.Value) : default(ThermalResistance?); - } - - /// - /// Get nullable ThermalResistance from nullable SquareCentimeterHourDegreesCelsiusPerKilocalorie. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ThermalResistance? FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue? squarecentimeterhourdegreescelsiusperkilocalorie) - { - return squarecentimeterhourdegreescelsiusperkilocalorie.HasValue ? FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(squarecentimeterhourdegreescelsiusperkilocalorie.Value) : default(ThermalResistance?); - } - - /// - /// Get nullable ThermalResistance from nullable SquareCentimeterKelvinsPerWatt. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ThermalResistance? FromSquareCentimeterKelvinsPerWatt(QuantityValue? squarecentimeterkelvinsperwatt) - { - return squarecentimeterkelvinsperwatt.HasValue ? FromSquareCentimeterKelvinsPerWatt(squarecentimeterkelvinsperwatt.Value) : default(ThermalResistance?); - } - - /// - /// Get nullable ThermalResistance from nullable SquareMeterDegreesCelsiusPerWatt. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static ThermalResistance? FromSquareMeterDegreesCelsiusPerWatt(QuantityValue? squaremeterdegreescelsiusperwatt) - { - return squaremeterdegreescelsiusperwatt.HasValue ? FromSquareMeterDegreesCelsiusPerWatt(squaremeterdegreescelsiusperwatt.Value) : default(ThermalResistance?); - } - - /// - /// Get nullable ThermalResistance from nullable SquareMeterKelvinsPerKilowatt. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static ThermalResistance? From(QuantityValue? value, ThermalResistanceUnit fromUnit) - { - return value.HasValue ? new ThermalResistance((double)value.Value, fromUnit) : default(ThermalResistance?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 3f03228011..50170a5ffa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -60,211 +60,6 @@ public partial struct Torque : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Torque from nullable KilogramForceCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilogramForceCentimeters(QuantityValue? kilogramforcecentimeters) - { - return kilogramforcecentimeters.HasValue ? FromKilogramForceCentimeters(kilogramforcecentimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable KilogramForceMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilogramForceMeters(QuantityValue? kilogramforcemeters) - { - return kilogramforcemeters.HasValue ? FromKilogramForceMeters(kilogramforcemeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable KilogramForceMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilogramForceMillimeters(QuantityValue? kilogramforcemillimeters) - { - return kilogramforcemillimeters.HasValue ? FromKilogramForceMillimeters(kilogramforcemillimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable KilonewtonCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilonewtonCentimeters(QuantityValue? kilonewtoncentimeters) - { - return kilonewtoncentimeters.HasValue ? FromKilonewtonCentimeters(kilonewtoncentimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable KilonewtonMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilonewtonMeters(QuantityValue? kilonewtonmeters) - { - return kilonewtonmeters.HasValue ? FromKilonewtonMeters(kilonewtonmeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable KilonewtonMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilonewtonMillimeters(QuantityValue? kilonewtonmillimeters) - { - return kilonewtonmillimeters.HasValue ? FromKilonewtonMillimeters(kilonewtonmillimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable KilopoundForceFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilopoundForceFeet(QuantityValue? kilopoundforcefeet) - { - return kilopoundforcefeet.HasValue ? FromKilopoundForceFeet(kilopoundforcefeet.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable KilopoundForceInches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromKilopoundForceInches(QuantityValue? kilopoundforceinches) - { - return kilopoundforceinches.HasValue ? FromKilopoundForceInches(kilopoundforceinches.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable MeganewtonCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromMeganewtonCentimeters(QuantityValue? meganewtoncentimeters) - { - return meganewtoncentimeters.HasValue ? FromMeganewtonCentimeters(meganewtoncentimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable MeganewtonMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromMeganewtonMeters(QuantityValue? meganewtonmeters) - { - return meganewtonmeters.HasValue ? FromMeganewtonMeters(meganewtonmeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable MeganewtonMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromMeganewtonMillimeters(QuantityValue? meganewtonmillimeters) - { - return meganewtonmillimeters.HasValue ? FromMeganewtonMillimeters(meganewtonmillimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable MegapoundForceFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromMegapoundForceFeet(QuantityValue? megapoundforcefeet) - { - return megapoundforcefeet.HasValue ? FromMegapoundForceFeet(megapoundforcefeet.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable MegapoundForceInches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromMegapoundForceInches(QuantityValue? megapoundforceinches) - { - return megapoundforceinches.HasValue ? FromMegapoundForceInches(megapoundforceinches.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable NewtonCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromNewtonCentimeters(QuantityValue? newtoncentimeters) - { - return newtoncentimeters.HasValue ? FromNewtonCentimeters(newtoncentimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable NewtonMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromNewtonMeters(QuantityValue? newtonmeters) - { - return newtonmeters.HasValue ? FromNewtonMeters(newtonmeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable NewtonMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromNewtonMillimeters(QuantityValue? newtonmillimeters) - { - return newtonmillimeters.HasValue ? FromNewtonMillimeters(newtonmillimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable PoundForceFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromPoundForceFeet(QuantityValue? poundforcefeet) - { - return poundforcefeet.HasValue ? FromPoundForceFeet(poundforcefeet.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable PoundForceInches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromPoundForceInches(QuantityValue? poundforceinches) - { - return poundforceinches.HasValue ? FromPoundForceInches(poundforceinches.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable TonneForceCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromTonneForceCentimeters(QuantityValue? tonneforcecentimeters) - { - return tonneforcecentimeters.HasValue ? FromTonneForceCentimeters(tonneforcecentimeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable TonneForceMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Torque? FromTonneForceMeters(QuantityValue? tonneforcemeters) - { - return tonneforcemeters.HasValue ? FromTonneForceMeters(tonneforcemeters.Value) : default(Torque?); - } - - /// - /// Get nullable Torque from nullable TonneForceMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Torque? From(QuantityValue? value, TorqueUnit fromUnit) - { - return value.HasValue ? new Torque((double)value.Value, fromUnit) : default(Torque?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index b8ff7ad03b..6c99c82e48 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -60,31 +60,6 @@ public partial struct VitaminA : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable VitaminA from nullable InternationalUnits. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VitaminA? From(QuantityValue? value, VitaminAUnit fromUnit) - { - return value.HasValue ? new VitaminA((double)value.Value, fromUnit) : default(VitaminA?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 17ec35b34f..edf3e0e025 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -60,418 +60,6 @@ public partial struct Volume : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable Volume from nullable AuTablespoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromAuTablespoons(QuantityValue? autablespoons) - { - return autablespoons.HasValue ? FromAuTablespoons(autablespoons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Centiliters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCentiliters(QuantityValue? centiliters) - { - return centiliters.HasValue ? FromCentiliters(centiliters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicCentimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicCentimeters(QuantityValue? cubiccentimeters) - { - return cubiccentimeters.HasValue ? FromCubicCentimeters(cubiccentimeters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicDecimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicDecimeters(QuantityValue? cubicdecimeters) - { - return cubicdecimeters.HasValue ? FromCubicDecimeters(cubicdecimeters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicFeet(QuantityValue? cubicfeet) - { - return cubicfeet.HasValue ? FromCubicFeet(cubicfeet.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicInches. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicInches(QuantityValue? cubicinches) - { - return cubicinches.HasValue ? FromCubicInches(cubicinches.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicKilometers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicKilometers(QuantityValue? cubickilometers) - { - return cubickilometers.HasValue ? FromCubicKilometers(cubickilometers.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicMeters(QuantityValue? cubicmeters) - { - return cubicmeters.HasValue ? FromCubicMeters(cubicmeters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicMicrometers. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicMicrometers(QuantityValue? cubicmicrometers) - { - return cubicmicrometers.HasValue ? FromCubicMicrometers(cubicmicrometers.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicMiles. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicMiles(QuantityValue? cubicmiles) - { - return cubicmiles.HasValue ? FromCubicMiles(cubicmiles.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicMillimeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicMillimeters(QuantityValue? cubicmillimeters) - { - return cubicmillimeters.HasValue ? FromCubicMillimeters(cubicmillimeters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable CubicYards. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromCubicYards(QuantityValue? cubicyards) - { - return cubicyards.HasValue ? FromCubicYards(cubicyards.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Deciliters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromDeciliters(QuantityValue? deciliters) - { - return deciliters.HasValue ? FromDeciliters(deciliters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable HectocubicFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromHectocubicFeet(QuantityValue? hectocubicfeet) - { - return hectocubicfeet.HasValue ? FromHectocubicFeet(hectocubicfeet.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable HectocubicMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromHectocubicMeters(QuantityValue? hectocubicmeters) - { - return hectocubicmeters.HasValue ? FromHectocubicMeters(hectocubicmeters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Hectoliters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromHectoliters(QuantityValue? hectoliters) - { - return hectoliters.HasValue ? FromHectoliters(hectoliters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable ImperialBeerBarrels. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromImperialBeerBarrels(QuantityValue? imperialbeerbarrels) - { - return imperialbeerbarrels.HasValue ? FromImperialBeerBarrels(imperialbeerbarrels.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable ImperialGallons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromImperialGallons(QuantityValue? imperialgallons) - { - return imperialgallons.HasValue ? FromImperialGallons(imperialgallons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable ImperialOunces. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromImperialOunces(QuantityValue? imperialounces) - { - return imperialounces.HasValue ? FromImperialOunces(imperialounces.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable KilocubicFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromKilocubicFeet(QuantityValue? kilocubicfeet) - { - return kilocubicfeet.HasValue ? FromKilocubicFeet(kilocubicfeet.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable KilocubicMeters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromKilocubicMeters(QuantityValue? kilocubicmeters) - { - return kilocubicmeters.HasValue ? FromKilocubicMeters(kilocubicmeters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable KiloimperialGallons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromKiloimperialGallons(QuantityValue? kiloimperialgallons) - { - return kiloimperialgallons.HasValue ? FromKiloimperialGallons(kiloimperialgallons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable KilousGallons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromKilousGallons(QuantityValue? kilousgallons) - { - return kilousgallons.HasValue ? FromKilousGallons(kilousgallons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Liters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromLiters(QuantityValue? liters) - { - return liters.HasValue ? FromLiters(liters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable MegacubicFeet. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromMegacubicFeet(QuantityValue? megacubicfeet) - { - return megacubicfeet.HasValue ? FromMegacubicFeet(megacubicfeet.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable MegaimperialGallons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromMegaimperialGallons(QuantityValue? megaimperialgallons) - { - return megaimperialgallons.HasValue ? FromMegaimperialGallons(megaimperialgallons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable MegausGallons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromMegausGallons(QuantityValue? megausgallons) - { - return megausgallons.HasValue ? FromMegausGallons(megausgallons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable MetricCups. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromMetricCups(QuantityValue? metriccups) - { - return metriccups.HasValue ? FromMetricCups(metriccups.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable MetricTeaspoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromMetricTeaspoons(QuantityValue? metricteaspoons) - { - return metricteaspoons.HasValue ? FromMetricTeaspoons(metricteaspoons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Microliters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromMicroliters(QuantityValue? microliters) - { - return microliters.HasValue ? FromMicroliters(microliters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Milliliters. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromMilliliters(QuantityValue? milliliters) - { - return milliliters.HasValue ? FromMilliliters(milliliters.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable OilBarrels. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromOilBarrels(QuantityValue? oilbarrels) - { - return oilbarrels.HasValue ? FromOilBarrels(oilbarrels.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Tablespoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromTablespoons(QuantityValue? tablespoons) - { - return tablespoons.HasValue ? FromTablespoons(tablespoons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable Teaspoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromTeaspoons(QuantityValue? teaspoons) - { - return teaspoons.HasValue ? FromTeaspoons(teaspoons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UkTablespoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUkTablespoons(QuantityValue? uktablespoons) - { - return uktablespoons.HasValue ? FromUkTablespoons(uktablespoons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsBeerBarrels. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsBeerBarrels(QuantityValue? usbeerbarrels) - { - return usbeerbarrels.HasValue ? FromUsBeerBarrels(usbeerbarrels.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsCustomaryCups. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsCustomaryCups(QuantityValue? uscustomarycups) - { - return uscustomarycups.HasValue ? FromUsCustomaryCups(uscustomarycups.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsGallons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsGallons(QuantityValue? usgallons) - { - return usgallons.HasValue ? FromUsGallons(usgallons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsLegalCups. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsLegalCups(QuantityValue? uslegalcups) - { - return uslegalcups.HasValue ? FromUsLegalCups(uslegalcups.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsOunces. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsOunces(QuantityValue? usounces) - { - return usounces.HasValue ? FromUsOunces(usounces.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsPints. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsPints(QuantityValue? uspints) - { - return uspints.HasValue ? FromUsPints(uspints.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsQuarts. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsQuarts(QuantityValue? usquarts) - { - return usquarts.HasValue ? FromUsQuarts(usquarts.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsTablespoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static Volume? FromUsTablespoons(QuantityValue? ustablespoons) - { - return ustablespoons.HasValue ? FromUsTablespoons(ustablespoons.Value) : default(Volume?); - } - - /// - /// Get nullable Volume from nullable UsTeaspoons. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static Volume? From(QuantityValue? value, VolumeUnit fromUnit) - { - return value.HasValue ? new Volume((double)value.Value, fromUnit) : default(Volume?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index c4f7944647..e3c5183310 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -60,256 +60,6 @@ public partial struct VolumeFlow : IComparable, IComparable ///
public double Value => _value; - #region Nullable From Methods - - /// - /// Get nullable VolumeFlow from nullable CentilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCentilitersPerMinute(QuantityValue? centilitersperminute) - { - return centilitersperminute.HasValue ? FromCentilitersPerMinute(centilitersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicDecimetersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicDecimetersPerMinute(QuantityValue? cubicdecimetersperminute) - { - return cubicdecimetersperminute.HasValue ? FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicFeetPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicFeetPerHour(QuantityValue? cubicfeetperhour) - { - return cubicfeetperhour.HasValue ? FromCubicFeetPerHour(cubicfeetperhour.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicFeetPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicFeetPerMinute(QuantityValue? cubicfeetperminute) - { - return cubicfeetperminute.HasValue ? FromCubicFeetPerMinute(cubicfeetperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicFeetPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicFeetPerSecond(QuantityValue? cubicfeetpersecond) - { - return cubicfeetpersecond.HasValue ? FromCubicFeetPerSecond(cubicfeetpersecond.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicMetersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicMetersPerHour(QuantityValue? cubicmetersperhour) - { - return cubicmetersperhour.HasValue ? FromCubicMetersPerHour(cubicmetersperhour.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicMetersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicMetersPerMinute(QuantityValue? cubicmetersperminute) - { - return cubicmetersperminute.HasValue ? FromCubicMetersPerMinute(cubicmetersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicMetersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicMetersPerSecond(QuantityValue? cubicmeterspersecond) - { - return cubicmeterspersecond.HasValue ? FromCubicMetersPerSecond(cubicmeterspersecond.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicYardsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicYardsPerHour(QuantityValue? cubicyardsperhour) - { - return cubicyardsperhour.HasValue ? FromCubicYardsPerHour(cubicyardsperhour.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicYardsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicYardsPerMinute(QuantityValue? cubicyardsperminute) - { - return cubicyardsperminute.HasValue ? FromCubicYardsPerMinute(cubicyardsperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable CubicYardsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromCubicYardsPerSecond(QuantityValue? cubicyardspersecond) - { - return cubicyardspersecond.HasValue ? FromCubicYardsPerSecond(cubicyardspersecond.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable DecilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromDecilitersPerMinute(QuantityValue? decilitersperminute) - { - return decilitersperminute.HasValue ? FromDecilitersPerMinute(decilitersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable KilolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromKilolitersPerMinute(QuantityValue? kilolitersperminute) - { - return kilolitersperminute.HasValue ? FromKilolitersPerMinute(kilolitersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable LitersPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromLitersPerHour(QuantityValue? litersperhour) - { - return litersperhour.HasValue ? FromLitersPerHour(litersperhour.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable LitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromLitersPerMinute(QuantityValue? litersperminute) - { - return litersperminute.HasValue ? FromLitersPerMinute(litersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable LitersPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromLitersPerSecond(QuantityValue? literspersecond) - { - return literspersecond.HasValue ? FromLitersPerSecond(literspersecond.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable MicrolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromMicrolitersPerMinute(QuantityValue? microlitersperminute) - { - return microlitersperminute.HasValue ? FromMicrolitersPerMinute(microlitersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable MillilitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromMillilitersPerMinute(QuantityValue? millilitersperminute) - { - return millilitersperminute.HasValue ? FromMillilitersPerMinute(millilitersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable MillionUsGallonsPerDay. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromMillionUsGallonsPerDay(QuantityValue? millionusgallonsperday) - { - return millionusgallonsperday.HasValue ? FromMillionUsGallonsPerDay(millionusgallonsperday.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable NanolitersPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromNanolitersPerMinute(QuantityValue? nanolitersperminute) - { - return nanolitersperminute.HasValue ? FromNanolitersPerMinute(nanolitersperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable OilBarrelsPerDay. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromOilBarrelsPerDay(QuantityValue? oilbarrelsperday) - { - return oilbarrelsperday.HasValue ? FromOilBarrelsPerDay(oilbarrelsperday.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable OilBarrelsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromOilBarrelsPerHour(QuantityValue? oilbarrelsperhour) - { - return oilbarrelsperhour.HasValue ? FromOilBarrelsPerHour(oilbarrelsperhour.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable OilBarrelsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromOilBarrelsPerMinute(QuantityValue? oilbarrelsperminute) - { - return oilbarrelsperminute.HasValue ? FromOilBarrelsPerMinute(oilbarrelsperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable UsGallonsPerHour. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromUsGallonsPerHour(QuantityValue? usgallonsperhour) - { - return usgallonsperhour.HasValue ? FromUsGallonsPerHour(usgallonsperhour.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable UsGallonsPerMinute. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static VolumeFlow? FromUsGallonsPerMinute(QuantityValue? usgallonsperminute) - { - return usgallonsperminute.HasValue ? FromUsGallonsPerMinute(usgallonsperminute.Value) : default(VolumeFlow?); - } - - /// - /// Get nullable VolumeFlow from nullable UsGallonsPerSecond. - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? From(QuantityValue? value, VolumeFlowUnit fromUnit) - { - return value.HasValue ? new VolumeFlow((double)value.Value, fromUnit) : default(VolumeFlow?); - } - - #endregion - /// /// Get unit abbreviation string. /// diff --git a/UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 index 2c931d79f1..b571c0ee0c 100644 --- a/UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 @@ -60,17 +60,9 @@ namespace UnitsNet.Extensions.NumberTo$quantityName # We add "OmitExtensionMethod": true on all but one of the conflicting units in JSON. if ($unit.OmitExtensionMethod) { continue } @" - #region $($unit.SingularName) - /// $($obsoleteAttribute) public static $quantityName $($unit.PluralName)(this T value) => $quantityName.From$($unit.PluralName)(Convert.ToDouble(value)); - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static $($quantityName)? $($unit.PluralName)(this T? value) where T : struct => $quantityName.From$($unit.PluralName)(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - "@; }@" } } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 6baf780cb9..a3b5d20a85 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -101,34 +101,6 @@ namespace UnitsNet ///
public $baseType Value => _value; - #region Nullable From Methods - -"@; foreach ($unit in $units) { - $valueParamName = $unit.PluralName.ToLowerInvariant();@" - /// - /// Get nullable $quantityName from nullable $($unit.PluralName). - /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - 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. - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static $($quantityName)? From($($quantityValueType)? value, $unitEnumName fromUnit) - { - return value.HasValue ? new $quantityName(($baseType)value.Value, fromUnit) : default($($quantityName)?); - } - - #endregion - /// /// Get unit abbreviation string. /// From 71c0b1f4c172e3c03ca71170e53d589511e1193c Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 28 Sep 2018 10:23:20 -0400 Subject: [PATCH 006/131] ParseUnit(string, string) needs to be split in code generators. The .NET Framwork version is obsolete and will be removed in the future, but the WRC version is not and would be a breaking change to remove. --- .../Quantities/Acceleration.Common.g.cs | 16 ---------------- .../Quantities/AmountOfSubstance.Common.g.cs | 16 ---------------- .../Quantities/AmplitudeRatio.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Angle.Common.g.cs | 16 ---------------- .../Quantities/ApparentEnergy.Common.g.cs | 16 ---------------- .../Quantities/ApparentPower.Common.g.cs | 16 ---------------- Common/GeneratedCode/Quantities/Area.Common.g.cs | 16 ---------------- .../Quantities/AreaDensity.Common.g.cs | 16 ---------------- .../Quantities/AreaMomentOfInertia.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/BitRate.Common.g.cs | 16 ---------------- .../BrakeSpecificFuelConsumption.Common.g.cs | 16 ---------------- .../Quantities/Capacitance.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Density.Common.g.cs | 16 ---------------- .../Quantities/Duration.Common.g.cs | 16 ---------------- .../Quantities/DynamicViscosity.Common.g.cs | 16 ---------------- .../Quantities/ElectricAdmittance.Common.g.cs | 16 ---------------- .../Quantities/ElectricCharge.Common.g.cs | 16 ---------------- .../Quantities/ElectricChargeDensity.Common.g.cs | 16 ---------------- .../Quantities/ElectricConductance.Common.g.cs | 16 ---------------- .../Quantities/ElectricConductivity.Common.g.cs | 16 ---------------- .../Quantities/ElectricCurrent.Common.g.cs | 16 ---------------- .../ElectricCurrentDensity.Common.g.cs | 16 ---------------- .../ElectricCurrentGradient.Common.g.cs | 16 ---------------- .../Quantities/ElectricField.Common.g.cs | 16 ---------------- .../Quantities/ElectricInductance.Common.g.cs | 16 ---------------- .../Quantities/ElectricPotential.Common.g.cs | 16 ---------------- .../Quantities/ElectricPotentialAc.Common.g.cs | 16 ---------------- .../Quantities/ElectricPotentialDc.Common.g.cs | 16 ---------------- .../Quantities/ElectricResistance.Common.g.cs | 16 ---------------- .../Quantities/ElectricResistivity.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Energy.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Entropy.Common.g.cs | 16 ---------------- Common/GeneratedCode/Quantities/Flow.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Force.Common.g.cs | 16 ---------------- .../Quantities/ForceChangeRate.Common.g.cs | 16 ---------------- .../Quantities/ForcePerLength.Common.g.cs | 16 ---------------- .../Quantities/Frequency.Common.g.cs | 16 ---------------- .../Quantities/HeatFlux.Common.g.cs | 16 ---------------- .../HeatTransferCoefficient.Common.g.cs | 16 ---------------- .../Quantities/Illuminance.Common.g.cs | 16 ---------------- .../Quantities/Information.Common.g.cs | 16 ---------------- .../Quantities/Irradiance.Common.g.cs | 16 ---------------- .../Quantities/Irradiation.Common.g.cs | 16 ---------------- .../Quantities/KinematicViscosity.Common.g.cs | 16 ---------------- .../Quantities/LapseRate.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Length.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Level.Common.g.cs | 16 ---------------- .../Quantities/LinearDensity.Common.g.cs | 16 ---------------- .../Quantities/LuminousFlux.Common.g.cs | 16 ---------------- .../Quantities/LuminousIntensity.Common.g.cs | 16 ---------------- .../Quantities/MagneticField.Common.g.cs | 16 ---------------- .../Quantities/MagneticFlux.Common.g.cs | 16 ---------------- .../Quantities/Magnetization.Common.g.cs | 16 ---------------- Common/GeneratedCode/Quantities/Mass.Common.g.cs | 16 ---------------- .../Quantities/MassFlow.Common.g.cs | 16 ---------------- .../Quantities/MassFlux.Common.g.cs | 16 ---------------- .../Quantities/MassMomentOfInertia.Common.g.cs | 16 ---------------- .../Quantities/MolarEnergy.Common.g.cs | 16 ---------------- .../Quantities/MolarEntropy.Common.g.cs | 16 ---------------- .../Quantities/MolarMass.Common.g.cs | 16 ---------------- .../Quantities/Molarity.Common.g.cs | 16 ---------------- .../Quantities/Permeability.Common.g.cs | 16 ---------------- .../Quantities/Permittivity.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Power.Common.g.cs | 16 ---------------- .../Quantities/PowerDensity.Common.g.cs | 16 ---------------- .../Quantities/PowerRatio.Common.g.cs | 16 ---------------- .../Quantities/Pressure.Common.g.cs | 16 ---------------- .../Quantities/PressureChangeRate.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Ratio.Common.g.cs | 16 ---------------- .../Quantities/ReactiveEnergy.Common.g.cs | 16 ---------------- .../Quantities/ReactivePower.Common.g.cs | 16 ---------------- .../RotationalAcceleration.Common.g.cs | 16 ---------------- .../Quantities/RotationalSpeed.Common.g.cs | 16 ---------------- .../Quantities/RotationalStiffness.Common.g.cs | 16 ---------------- .../RotationalStiffnessPerLength.Common.g.cs | 16 ---------------- .../Quantities/SolidAngle.Common.g.cs | 16 ---------------- .../Quantities/SpecificEnergy.Common.g.cs | 16 ---------------- .../Quantities/SpecificEntropy.Common.g.cs | 16 ---------------- .../Quantities/SpecificVolume.Common.g.cs | 16 ---------------- .../Quantities/SpecificWeight.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Speed.Common.g.cs | 16 ---------------- .../Quantities/Temperature.Common.g.cs | 16 ---------------- .../Quantities/TemperatureChangeRate.Common.g.cs | 16 ---------------- .../Quantities/TemperatureDelta.Common.g.cs | 16 ---------------- .../Quantities/ThermalConductivity.Common.g.cs | 16 ---------------- .../Quantities/ThermalResistance.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Torque.Common.g.cs | 16 ---------------- .../Quantities/VitaminA.Common.g.cs | 16 ---------------- .../GeneratedCode/Quantities/Volume.Common.g.cs | 16 ---------------- .../Quantities/VolumeFlow.Common.g.cs | 16 ---------------- .../Acceleration.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...mountOfSubstance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../AmplitudeRatio.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Angle.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ApparentEnergy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ApparentPower.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Quantities/Area.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../AreaDensity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...aMomentOfInertia.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../BitRate.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...cFuelConsumption.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Capacitance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Density.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Duration.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...DynamicViscosity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ectricAdmittance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ElectricCharge.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ricChargeDensity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ctricConductance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...tricConductivity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ElectricCurrent.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...icCurrentDensity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...cCurrentGradient.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ElectricField.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ectricInductance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...lectricPotential.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ctricPotentialAc.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ctricPotentialDc.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ectricResistance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ctricResistivity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Energy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Entropy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Quantities/Flow.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Force.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ForceChangeRate.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ForcePerLength.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Frequency.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../HeatFlux.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...nsferCoefficient.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Illuminance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Information.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Irradiance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Irradiation.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...nematicViscosity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../LapseRate.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Length.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Level.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../LinearDensity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../LuminousFlux.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...uminousIntensity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../MagneticField.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../MagneticFlux.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Magnetization.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Quantities/Mass.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../MassFlow.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../MassFlux.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...sMomentOfInertia.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../MolarEnergy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../MolarEntropy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../MolarMass.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Molarity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Permeability.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Permittivity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Power.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../PowerDensity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../PowerRatio.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Pressure.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...essureChangeRate.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Ratio.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ReactiveEnergy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../ReactivePower.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...onalAcceleration.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../RotationalSpeed.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ationalStiffness.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...iffnessPerLength.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../SolidAngle.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../SpecificEnergy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../SpecificEntropy.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../SpecificVolume.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../SpecificWeight.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Speed.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Temperature.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...ratureChangeRate.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...TemperatureDelta.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...rmalConductivity.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ ...hermalResistance.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Torque.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../VitaminA.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Volume.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../VolumeFlow.WindowsRuntimeComponent.g.cs | 15 +++++++++++++++ .../Quantities/Acceleration.NetFramework.g.cs | 16 ++++++++++++++++ .../AmountOfSubstance.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/AmplitudeRatio.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Angle.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ApparentEnergy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ApparentPower.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Area.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/AreaDensity.NetFramework.g.cs | 16 ++++++++++++++++ .../AreaMomentOfInertia.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/BitRate.NetFramework.g.cs | 16 ++++++++++++++++ ...rakeSpecificFuelConsumption.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Capacitance.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Density.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Duration.NetFramework.g.cs | 16 ++++++++++++++++ .../DynamicViscosity.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricAdmittance.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ElectricCharge.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricChargeDensity.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricConductance.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricConductivity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ElectricCurrent.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricCurrentDensity.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricCurrentGradient.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ElectricField.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricInductance.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricPotential.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricPotentialAc.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricPotentialDc.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricResistance.NetFramework.g.cs | 16 ++++++++++++++++ .../ElectricResistivity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Energy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Entropy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Flow.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Force.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ForceChangeRate.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ForcePerLength.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Frequency.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/HeatFlux.NetFramework.g.cs | 16 ++++++++++++++++ .../HeatTransferCoefficient.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Illuminance.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Information.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Irradiance.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Irradiation.NetFramework.g.cs | 16 ++++++++++++++++ .../KinematicViscosity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/LapseRate.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Length.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Level.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/LinearDensity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/LuminousFlux.NetFramework.g.cs | 16 ++++++++++++++++ .../LuminousIntensity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/MagneticField.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/MagneticFlux.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Magnetization.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Mass.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/MassFlow.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/MassFlux.NetFramework.g.cs | 16 ++++++++++++++++ .../MassMomentOfInertia.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/MolarEnergy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/MolarEntropy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/MolarMass.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Molarity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Permeability.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Permittivity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Power.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/PowerDensity.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/PowerRatio.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Pressure.NetFramework.g.cs | 16 ++++++++++++++++ .../PressureChangeRate.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Ratio.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ReactiveEnergy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/ReactivePower.NetFramework.g.cs | 16 ++++++++++++++++ .../RotationalAcceleration.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/RotationalSpeed.NetFramework.g.cs | 16 ++++++++++++++++ .../RotationalStiffness.NetFramework.g.cs | 16 ++++++++++++++++ ...otationalStiffnessPerLength.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/SolidAngle.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/SpecificEnergy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/SpecificEntropy.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/SpecificVolume.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/SpecificWeight.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Speed.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Temperature.NetFramework.g.cs | 16 ++++++++++++++++ .../TemperatureChangeRate.NetFramework.g.cs | 16 ++++++++++++++++ .../TemperatureDelta.NetFramework.g.cs | 16 ++++++++++++++++ .../ThermalConductivity.NetFramework.g.cs | 16 ++++++++++++++++ .../ThermalResistance.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Torque.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/VitaminA.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/Volume.NetFramework.g.cs | 16 ++++++++++++++++ .../Quantities/VolumeFlow.NetFramework.g.cs | 16 ++++++++++++++++ .../Include-GenerateQuantitySourceCodeCommon.ps1 | 16 ---------------- ...de-GenerateQuantitySourceCodeNetFramework.ps1 | 16 ++++++++++++++++ ...QuantitySourceCodeWindowsRuntimeComponent.ps1 | 15 +++++++++++++++ 273 files changed, 2821 insertions(+), 1456 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 32ed95e2f8..20cdb98eb1 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -692,22 +692,6 @@ public static AccelerationUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index e09c313bdc..4a37a5e1db 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -713,22 +713,6 @@ public static AmountOfSubstanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 8bb678bbd7..8f76f2ceda 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -502,22 +502,6 @@ public static AmplitudeRatioUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 224eb7ae1d..6fc2f691d6 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -712,22 +712,6 @@ public static AngleUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index b360e90d45..c63c38b73c 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -482,22 +482,6 @@ public static ApparentEnergyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 20c782523c..f9983c34cc 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -503,22 +503,6 @@ public static ApparentPowerUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index cabdafbce9..7cda67fda6 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -692,22 +692,6 @@ public static AreaUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index d016ade809..5c826bd6d9 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -440,22 +440,6 @@ public static AreaDensityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 1cee90c5dc..d374af505b 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -545,22 +545,6 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index 7f7fb55004..4f23de2ee9 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -963,22 +963,6 @@ public static BitRateUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index c762e6824c..775e0bb39d 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -482,22 +482,6 @@ public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 97b3266b6b..51f4d7b426 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -440,22 +440,6 @@ public static CapacitanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 23a093e167..6b166783bf 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -1217,22 +1217,6 @@ public static DensityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 58ea15708b..c8a999f8c4 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -675,22 +675,6 @@ public static DurationUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 5f1007380f..e9c8c5f187 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -545,22 +545,6 @@ public static DynamicViscosityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index 4627181f9c..b2f51a20a4 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -503,22 +503,6 @@ public static ElectricAdmittanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index f011e1a311..7ee46b9a56 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -440,22 +440,6 @@ public static ElectricChargeUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 7e73beedd0..2077ea5219 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -440,22 +440,6 @@ public static ElectricChargeDensityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index f3099fd9d3..8065fca67c 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -482,22 +482,6 @@ public static ElectricConductanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 9487fe3df1..7dd8478447 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -440,22 +440,6 @@ public static ElectricConductivityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 28fc1e4f78..c0f97fdbf2 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -587,22 +587,6 @@ public static ElectricCurrentUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 71a8cdcc34..e2e803a3da 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -440,22 +440,6 @@ public static ElectricCurrentDensityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 3a777bb953..be91a65f38 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -440,22 +440,6 @@ public static ElectricCurrentGradientUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 5f48bcba7a..39eb12dd61 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -440,22 +440,6 @@ public static ElectricFieldUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index dce93b68a0..2a41581253 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -440,22 +440,6 @@ public static ElectricInductanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 8a90e4bc1f..451df6f235 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -524,22 +524,6 @@ public static ElectricPotentialUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 452a3b6bab..d1e7d7ecec 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -523,22 +523,6 @@ public static ElectricPotentialAcUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 7ad0595e08..cf468b8609 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -523,22 +523,6 @@ public static ElectricPotentialDcUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 6985c1d234..ba6709d508 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -503,22 +503,6 @@ public static ElectricResistanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 6860758317..caceb042e2 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -503,22 +503,6 @@ public static ElectricResistivityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 1d79af5c50..d28b309327 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -881,22 +881,6 @@ public static EnergyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index c5b077145d..1a8e7f5189 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -566,22 +566,6 @@ public static EntropyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Flow.Common.g.cs b/Common/GeneratedCode/Quantities/Flow.Common.g.cs index 92500edca9..52770f9207 100644 --- a/Common/GeneratedCode/Quantities/Flow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Flow.Common.g.cs @@ -960,22 +960,6 @@ public static FlowUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static FlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 827cc1a107..0f3f1abca3 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -629,22 +629,6 @@ public static ForceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index f3b7e04db9..6bc35ab155 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -650,22 +650,6 @@ public static ForceChangeRateUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index c60955e3c1..7abcf9092d 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -608,22 +608,6 @@ public static ForcePerLengthUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 3814aaabb5..ea915a7d87 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -587,22 +587,6 @@ public static FrequencyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index af17a5b614..c5a1aa0b19 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -755,22 +755,6 @@ public static HeatFluxUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 6c1e6e297b..7d88dfbfbe 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -461,22 +461,6 @@ public static HeatTransferCoefficientUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index abd8790909..40dfb97600 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -503,22 +503,6 @@ public static IlluminanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 9183d31d8f..d1c7c36a27 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -963,22 +963,6 @@ public static InformationUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 7f1b4252ad..1c7ea1efcb 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -461,22 +461,6 @@ public static IrradianceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 58db172b3f..3b1b356b93 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -482,22 +482,6 @@ public static IrradiationUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index fe75567216..2cdb78317d 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -587,22 +587,6 @@ public static KinematicViscosityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 2c37adad8f..8608f18fee 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -440,22 +440,6 @@ public static LapseRateUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index 2e3d2a38d3..64a2dce872 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -881,22 +881,6 @@ public static LengthUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index ad48a43d85..9cc06211bc 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -460,22 +460,6 @@ public static LevelUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 4193003fb0..d0264b8d31 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -482,22 +482,6 @@ public static LinearDensityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index a5b0e63900..00de3fcba2 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -440,22 +440,6 @@ public static LuminousFluxUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index b5fd94601d..bd8d4ae623 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -440,22 +440,6 @@ public static LuminousIntensityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index b5f5d2dde5..e3096d06f2 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -440,22 +440,6 @@ public static MagneticFieldUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index b09af34da0..dc783e24e2 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -440,22 +440,6 @@ public static MagneticFluxUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 0a04d5753e..7d3ddbed73 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -440,22 +440,6 @@ public static MagnetizationUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 0e9f53d699..30c7e1fe1d 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -860,22 +860,6 @@ public static MassUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index c1f884aea2..5e53f133aa 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -734,22 +734,6 @@ public static MassFlowUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index 12b507c25c..5056e19a6a 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -461,22 +461,6 @@ public static MassFluxUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 90e30652cb..3ed0389d76 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -965,22 +965,6 @@ public static MassMomentOfInertiaUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index f4164e95c9..7e16c5551f 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -482,22 +482,6 @@ public static MolarEnergyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index abb87a58f9..f8af941059 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -482,22 +482,6 @@ public static MolarEntropyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 6cbe02d28d..3c4d10424a 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -671,22 +671,6 @@ public static MolarMassUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index 19a4f20720..a5a589a4c4 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -587,22 +587,6 @@ public static MolarityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 032dec27e5..5e2f56764a 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -440,22 +440,6 @@ public static PermeabilityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index a8a40f1c0a..3e1ff4bcb9 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -440,22 +440,6 @@ public static PermittivityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index ed9cbba62d..24421b01df 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -838,22 +838,6 @@ public static PowerUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 1acfabad4e..13ff7f06cf 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -1343,22 +1343,6 @@ public static PowerDensityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index ab16e2fdc9..7410b89210 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -460,22 +460,6 @@ public static PowerRatioUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 26a39fe932..3959f4452a 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -1219,22 +1219,6 @@ public static PressureUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 11c7fdc4a8..e512852ff3 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -503,22 +503,6 @@ public static PressureChangeRateUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index b3629babf9..d25b618e70 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -544,22 +544,6 @@ public static RatioUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index fc1272c6f8..d84b66a21e 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -482,22 +482,6 @@ public static ReactiveEnergyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index ba8679fd10..2ceda5b598 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -503,22 +503,6 @@ public static ReactivePowerUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 992d9acab6..ecc79c8309 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -482,22 +482,6 @@ public static RotationalAccelerationUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 430347c970..36103e8ff5 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -692,22 +692,6 @@ public static RotationalSpeedUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 5ec21ca384..f876c05722 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -482,22 +482,6 @@ public static RotationalStiffnessUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index e994b6ed9b..a2bba468f9 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -482,22 +482,6 @@ public static RotationalStiffnessPerLengthUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 2f258256e0..c740b0e871 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -439,22 +439,6 @@ public static SolidAngleUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index 944ba7474b..793837c4b0 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -587,22 +587,6 @@ public static SpecificEnergyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index c31a618029..82c05e4ae7 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -587,22 +587,6 @@ public static SpecificEntropyUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 081afdbe8e..7eca216f6c 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -461,22 +461,6 @@ public static SpecificVolumeUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index f3752b3ec5..5cbdc51bed 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -776,22 +776,6 @@ public static SpecificWeightUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 3bd6a717fd..965f41f5e6 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -1091,22 +1091,6 @@ public static SpeedUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 3e5e6b2891..359d34c6e3 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -587,22 +587,6 @@ public static TemperatureUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 842e3a13bd..4ff17cca4f 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -629,22 +629,6 @@ public static TemperatureChangeRateUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index f450738404..e8550789c0 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -770,22 +770,6 @@ public static TemperatureDeltaUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index 799d338c54..1c2ef610f4 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -461,22 +461,6 @@ public static ThermalConductivityUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 89f752dae9..4334da12cc 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -524,22 +524,6 @@ public static ThermalResistanceUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index b81e935d7c..c5d451a342 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -860,22 +860,6 @@ public static TorqueUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 5764238125..f982df818c 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -439,22 +439,6 @@ public static VitaminAUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 7af8d0bd50..ef358c635e 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -1347,22 +1347,6 @@ public static VolumeUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 706449f20d..db1e565585 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -965,22 +965,6 @@ public static VolumeFlowUnit ParseUnit(string str) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 5d08aac859..1832f89807 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index 2361083dd8..47a945e754 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index bc57d2464d..71328ad967 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 68bec05e7e..9300463407 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index ec5e16f647..44e60f0419 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 28ea2ee4dc..3ccc80c7a9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 29e68d974c..1a618f6b96 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index ab2ce3d21e..14910ca0b6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index becf1d39eb..eef219081f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 7680252856..3a5e50f278 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index dd2f5671b6..cb392121fb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index e29d794d68..673e10abbd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index 9305713b78..b36da8240a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 81527a00b6..6629015d75 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index 8c7439b184..c618b94c4a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index 7a43dad8fb..9eef04267e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 5a4a50c28f..a967b0fd5f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index d0a2ccf03a..b964325a3e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 37dc806e61..ec4734b3f5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index a4493a40ad..659eb4a048 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 77d48cf84c..74dc0b4cfb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index dd2162aa81..c0893a10d3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 8316cc4428..8f7055a8ff 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index 64eaa06a42..0d3882d3fb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index c256289e43..306892156d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index feee8b2789..d2e374ae8d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 4b1a9104d0..8db3b6ef8f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index ae544de53a..9446dfaee1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index 35342d73f2..fcc1d95375 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index 1a002b4a61..e8259ace93 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index 99379b168b..8ecbcbd9b8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index b9e1491f79..9388a4a857 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs index 2d92d5144b..401f367c0c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Flow.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static FlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index 454a6db9c7..cfcd6b7e06 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index c543bac9af..f7eae0b524 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index e1913404ac..08af39e126 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index eae164cd38..faa4ffba54 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 7a3cb5b4fd..e48abae075 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index bfb15a2a34..68cce5ecda 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index ae312daaa8..6e9cdd4b6c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index 717cbb4530..a976942c87 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index c39a6e3a8f..2fa88e6256 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 39b7d748a3..0d20227817 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index f693a52e9e..2419cc1607 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index bf78438269..baa0846609 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 671b6e65bb..0153958518 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index fb8e3661b1..da2464eb8b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index e090a3a9e5..581e09735a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 2f4cb310a3..1d4f6a0277 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index ff7fc8377b..a2f7408e30 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index e761bc831c..ccf856bbf4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 3a06c5b88a..99daf87c26 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index cfd24f0578..cadd0acb99 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index e85cb7ef8d..8be9a9df40 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index c882126d69..a83681536d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 1a69884f8c..011f10d707 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index a8f9ecd0be..a3002b38e7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index 1990b60711..2ce16e7f46 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index d61f89e52d..9884724641 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index 0bcf00daf3..cb4669e427 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index c4c6fc5ebf..55ab72cfa5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index fc7d49629a..4da2995f20 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index a0afc22b73..affe190eb0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index 65e4724842..a59fa54f37 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 6f9c251cf0..b914aef018 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index 1c6eb6633b..568003e2d4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index c6e14c2a54..47af2646de 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index 670ec392f9..0dde9096ad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index d79f892acd..b20e662734 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 191516708c..5264152de7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 2e9d2249d7..52599537a8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index efccc0076c..8b3430abee 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index bc98d55f61..48fdd0b7bb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index 376eb49462..4bf0f028cc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index f201506efe..8f07a81fee 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index 417969a2c4..f29c944af5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index c88afe1a0c..1fb196ef50 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 1bc99dc598..3bb722e5d0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index abb560c8de..60ed38e097 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index 000ccb5370..142cd79d25 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 9a1c0107fc..761ba4fbe3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index c7aecb3a8c..be55387c1f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index 8e8d4ddb77..53014f02b2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 3e59ff0e09..a2ebc7ac84 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index e618c35a33..319d539066 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index 391d18f5df..4025d018a6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index ebfad445d0..e157f03a47 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 0430572518..9c5a83161d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 3180839ae3..84d4e028ab 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index edd4337843..52ec8f1b72 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -154,6 +154,21 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index afe7bad3d2..3ae4ff7b8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -345,6 +345,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 61e24dca68..9ba0a7cd78 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -354,6 +354,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index 23c643afd5..e5fd059584 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -272,6 +272,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index ca02498de4..5d2c7cae14 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -354,6 +354,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 05dfc23e9d..1b3e7a86f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index aea8d678f7..c495aa558c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -264,6 +264,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 5235e24c0d..0c0c0fc4c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -345,6 +345,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 842a74b281..5a6cd239c9 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 76f090fc9d..b614b4fc09 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -282,6 +282,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 222a886e70..d6e6e0745f 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -460,6 +460,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 9de58b5023..088fdf37b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 1a0f3a3dd9..1dc30e6ec2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index adc1b74e5f..eb92e62f56 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -570,6 +570,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 351f373794..4484c60708 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -336,6 +336,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index 40c15616e8..cc0d989fef 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -282,6 +282,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index d1814b926c..acc6d15dc1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -264,6 +264,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index de311c02d2..b21e0e49dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index e5ac919058..6e7a719cd1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index c8e5ee97db..b322840f4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index d74de9be33..6072fe8a8c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 0f5858fe1b..65c8b3ff0a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -300,6 +300,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 4ac621d58f..a8cd7bb599 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 1bdea233a1..4a1ca2a0fa 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 5f7b4d55cd..318599f382 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 8b8e0060e5..6bdc9e379c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index f9cebf55a4..cd10ced2c1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -273,6 +273,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index f3df5f0762..8955c03853 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -273,6 +273,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index ea6f85c7ae..0beb09ac45 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -273,6 +273,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index df944cce7a..36a0a415e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -264,6 +264,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index e909be0ec1..bbdfa81ace 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -264,6 +264,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 0aab5ee9a9..c956445b91 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -426,6 +426,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 1e174a2486..2a6b48229b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -291,6 +291,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs index 1530fa6888..a5fcd34873 100644 --- a/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Flow.NetFramework.g.cs @@ -444,6 +444,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static FlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index d741260a28..0c4f5a070b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -318,6 +318,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 1c5ec27ce0..28a61eb0c9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -327,6 +327,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index a221b700b4..e1269c8f0c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -309,6 +309,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 649b2a2c52..6d32133aaa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -300,6 +300,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 3e1fdde1d7..c993022e29 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -372,6 +372,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index cf0bf1e253..e4c66ccaa1 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -246,6 +246,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 16e9931409..1ae922c34e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -264,6 +264,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index bf562afe24..47ef375171 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -460,6 +460,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 8a1ef1ab60..28c8008fba 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -246,6 +246,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 486da8cd88..dc83c05c73 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index c9d49d1d19..9b08a58736 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -300,6 +300,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 1cd3e7621f..6106ecd247 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index f15c49f2f5..86b0d9cc9a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -426,6 +426,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 75bab150c4..3c8671d281 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -254,6 +254,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index b2c1100816..bbb23fa77b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 778aabad6d..9925f5cb7f 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 56388d68d1..6ddc553acd 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 636e0610cb..cccadd78f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index f3f3eefdb3..29a119cc4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 9ee47929f2..40ad15e434 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index a2aff8b53e..d46b197b76 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -417,6 +417,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index e90181d29f..f9dc0335a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -363,6 +363,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index ff966c6ddb..fc76f4d5a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -246,6 +246,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 009ea8b31d..50054640fd 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -462,6 +462,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 0eedd254a6..158fbb10b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 854cf36bea..397507a37c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index a04598777e..44c9b2a116 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -336,6 +336,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index c431a9a647..a3ea27a190 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -300,6 +300,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index d767808955..4a922c0989 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 4891ceb3de..3c60c545a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 9287d3cbb3..1f5c656fcc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -406,6 +406,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index c1612bea8f..7be4fd0d64 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -624,6 +624,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index fb8b9b3639..6c65c161da 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -254,6 +254,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 251ae0bce2..188b9fcdda 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -570,6 +570,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index e9133a77a8..e5f397c6dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -264,6 +264,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 993c2015d3..9768505b44 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -282,6 +282,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 390183475b..73621e977c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index 086effb16a..1f0a7ca201 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -264,6 +264,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 16b0a47185..84a620414e 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index baf25cc9cf..88dfe37282 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -345,6 +345,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index db4b15e846..d7e23068d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index 0a41d0fef4..8baa6fc521 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -255,6 +255,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 802e37b63a..e70634f9f4 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 5d6fd503d4..f04a617565 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -300,6 +300,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index df6ff742b1..9361d47e87 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -300,6 +300,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 1e06b97f10..cf2106da7f 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -246,6 +246,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 417b4170e6..4a44f54a09 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -381,6 +381,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index daf8ab45d8..db74fac14c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -516,6 +516,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 920828df1b..49e1c4a9ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -261,6 +261,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 87c254bb63..e1aca81b57 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -318,6 +318,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 1a85aa86c7..b3f1c83697 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -372,6 +372,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 9d4eb1d11e..9f586dc94e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -246,6 +246,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 8924ea7ab4..48cb14961f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -273,6 +273,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 3f03228011..d11466f16d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -417,6 +417,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index b8ff7ad03b..b7e4953430 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -237,6 +237,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 17ec35b34f..dbe1afd7ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -624,6 +624,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index c4f7944647..77c28a8562 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -462,6 +462,22 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index a95f59ca75..765955f3fd 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -519,22 +519,6 @@ if ($obsoleteAttribute) return ParseUnit(str, (IFormatProvider)null); } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from other .NET targets.")] - public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - #endregion /// diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 6baf780cb9..00797b9055 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -286,6 +286,22 @@ namespace UnitsNet } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] + public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index 0173984142..022f406f83 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -195,6 +195,21 @@ namespace UnitsNet } } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) + { + return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + } + /// /// Parse a unit string. /// From c32c9d22e95cf60e861f33909b57d21c88da8ded Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 28 Sep 2018 11:33:24 -0400 Subject: [PATCH 007/131] Removing obsolete methods --- .../Quantities/Acceleration.Common.g.cs | 47 +------------------ .../Quantities/AmountOfSubstance.Common.g.cs | 47 +------------------ .../Quantities/AmplitudeRatio.Common.g.cs | 47 +------------------ .../Quantities/Angle.Common.g.cs | 47 +------------------ .../Quantities/ApparentEnergy.Common.g.cs | 47 +------------------ .../Quantities/ApparentPower.Common.g.cs | 47 +------------------ .../GeneratedCode/Quantities/Area.Common.g.cs | 47 +------------------ .../Quantities/AreaDensity.Common.g.cs | 47 +------------------ .../AreaMomentOfInertia.Common.g.cs | 47 +------------------ .../Quantities/BitRate.Common.g.cs | 47 +------------------ .../BrakeSpecificFuelConsumption.Common.g.cs | 47 +------------------ .../Quantities/Capacitance.Common.g.cs | 47 +------------------ .../Quantities/Density.Common.g.cs | 47 +------------------ .../Quantities/Duration.Common.g.cs | 47 +------------------ .../Quantities/DynamicViscosity.Common.g.cs | 47 +------------------ .../Quantities/ElectricAdmittance.Common.g.cs | 47 +------------------ .../Quantities/ElectricCharge.Common.g.cs | 47 +------------------ .../ElectricChargeDensity.Common.g.cs | 47 +------------------ .../ElectricConductance.Common.g.cs | 47 +------------------ .../ElectricConductivity.Common.g.cs | 47 +------------------ .../Quantities/ElectricCurrent.Common.g.cs | 47 +------------------ .../ElectricCurrentDensity.Common.g.cs | 47 +------------------ .../ElectricCurrentGradient.Common.g.cs | 47 +------------------ .../Quantities/ElectricField.Common.g.cs | 47 +------------------ .../Quantities/ElectricInductance.Common.g.cs | 47 +------------------ .../Quantities/ElectricPotential.Common.g.cs | 47 +------------------ .../ElectricPotentialAc.Common.g.cs | 47 +------------------ .../ElectricPotentialDc.Common.g.cs | 47 +------------------ .../Quantities/ElectricResistance.Common.g.cs | 47 +------------------ .../ElectricResistivity.Common.g.cs | 47 +------------------ .../Quantities/Energy.Common.g.cs | 47 +------------------ .../Quantities/Entropy.Common.g.cs | 47 +------------------ .../Quantities/Force.Common.g.cs | 47 +------------------ .../Quantities/ForceChangeRate.Common.g.cs | 47 +------------------ .../Quantities/ForcePerLength.Common.g.cs | 47 +------------------ .../Quantities/Frequency.Common.g.cs | 47 +------------------ .../Quantities/HeatFlux.Common.g.cs | 47 +------------------ .../HeatTransferCoefficient.Common.g.cs | 47 +------------------ .../Quantities/Illuminance.Common.g.cs | 47 +------------------ .../Quantities/Information.Common.g.cs | 47 +------------------ .../Quantities/Irradiance.Common.g.cs | 47 +------------------ .../Quantities/Irradiation.Common.g.cs | 47 +------------------ .../Quantities/KinematicViscosity.Common.g.cs | 47 +------------------ .../Quantities/LapseRate.Common.g.cs | 47 +------------------ .../Quantities/Length.Common.g.cs | 47 +------------------ .../Quantities/Level.Common.g.cs | 47 +------------------ .../Quantities/LinearDensity.Common.g.cs | 47 +------------------ .../Quantities/LuminousFlux.Common.g.cs | 47 +------------------ .../Quantities/LuminousIntensity.Common.g.cs | 47 +------------------ .../Quantities/MagneticField.Common.g.cs | 47 +------------------ .../Quantities/MagneticFlux.Common.g.cs | 47 +------------------ .../Quantities/Magnetization.Common.g.cs | 47 +------------------ .../GeneratedCode/Quantities/Mass.Common.g.cs | 47 +------------------ .../Quantities/MassFlow.Common.g.cs | 47 +------------------ .../Quantities/MassFlux.Common.g.cs | 47 +------------------ .../MassMomentOfInertia.Common.g.cs | 47 +------------------ .../Quantities/MolarEnergy.Common.g.cs | 47 +------------------ .../Quantities/MolarEntropy.Common.g.cs | 47 +------------------ .../Quantities/MolarMass.Common.g.cs | 47 +------------------ .../Quantities/Molarity.Common.g.cs | 47 +------------------ .../Quantities/Permeability.Common.g.cs | 47 +------------------ .../Quantities/Permittivity.Common.g.cs | 47 +------------------ .../Quantities/Power.Common.g.cs | 47 +------------------ .../Quantities/PowerDensity.Common.g.cs | 47 +------------------ .../Quantities/PowerRatio.Common.g.cs | 47 +------------------ .../Quantities/Pressure.Common.g.cs | 47 +------------------ .../Quantities/PressureChangeRate.Common.g.cs | 47 +------------------ .../Quantities/Ratio.Common.g.cs | 47 +------------------ .../Quantities/ReactiveEnergy.Common.g.cs | 47 +------------------ .../Quantities/ReactivePower.Common.g.cs | 47 +------------------ .../RotationalAcceleration.Common.g.cs | 47 +------------------ .../Quantities/RotationalSpeed.Common.g.cs | 47 +------------------ .../RotationalStiffness.Common.g.cs | 47 +------------------ .../RotationalStiffnessPerLength.Common.g.cs | 47 +------------------ .../Quantities/SolidAngle.Common.g.cs | 47 +------------------ .../Quantities/SpecificEnergy.Common.g.cs | 47 +------------------ .../Quantities/SpecificEntropy.Common.g.cs | 47 +------------------ .../Quantities/SpecificVolume.Common.g.cs | 47 +------------------ .../Quantities/SpecificWeight.Common.g.cs | 47 +------------------ .../Quantities/Speed.Common.g.cs | 47 +------------------ .../Quantities/Temperature.Common.g.cs | 47 +------------------ .../TemperatureChangeRate.Common.g.cs | 47 +------------------ .../Quantities/TemperatureDelta.Common.g.cs | 47 +------------------ .../ThermalConductivity.Common.g.cs | 47 +------------------ .../Quantities/ThermalResistance.Common.g.cs | 47 +------------------ .../Quantities/Torque.Common.g.cs | 47 +------------------ .../Quantities/VitaminA.Common.g.cs | 47 +------------------ .../Quantities/Volume.Common.g.cs | 47 +------------------ .../Quantities/VolumeFlow.Common.g.cs | 47 +------------------ UnitsNet.Tests/CustomCode/LengthTests.cs | 14 ++---- UnitsNet.Tests/CustomCode/ParseTests.cs | 6 +-- UnitsNet.Tests/QuantityTests.Ctor.cs | 30 +++++------- UnitsNet.Tests/QuantityTests.ToString.cs | 15 +++--- .../CustomCode/Quantities/Density.extra.cs | 4 +- UnitsNet/CustomCode/Quantities/Force.extra.cs | 10 ++-- UnitsNet/CustomCode/Quantities/Mass.extra.cs | 2 +- .../Quantities/Temperature.extra.cs | 8 ++-- UnitsNet/CustomCode/UnitSystem.cs | 13 ----- .../Quantities/Acceleration.NetFramework.g.cs | 16 ------- .../AmountOfSubstance.NetFramework.g.cs | 16 ------- .../AmplitudeRatio.NetFramework.g.cs | 16 ------- .../Quantities/Angle.NetFramework.g.cs | 16 ------- .../ApparentEnergy.NetFramework.g.cs | 16 ------- .../ApparentPower.NetFramework.g.cs | 16 ------- .../Quantities/Area.NetFramework.g.cs | 16 ------- .../Quantities/AreaDensity.NetFramework.g.cs | 16 ------- .../AreaMomentOfInertia.NetFramework.g.cs | 16 ------- .../Quantities/BitRate.NetFramework.g.cs | 16 ------- ...eSpecificFuelConsumption.NetFramework.g.cs | 16 ------- .../Quantities/Capacitance.NetFramework.g.cs | 16 ------- .../Quantities/Density.NetFramework.g.cs | 16 ------- .../Quantities/Duration.NetFramework.g.cs | 16 ------- .../DynamicViscosity.NetFramework.g.cs | 16 ------- .../ElectricAdmittance.NetFramework.g.cs | 16 ------- .../ElectricCharge.NetFramework.g.cs | 16 ------- .../ElectricChargeDensity.NetFramework.g.cs | 16 ------- .../ElectricConductance.NetFramework.g.cs | 16 ------- .../ElectricConductivity.NetFramework.g.cs | 16 ------- .../ElectricCurrent.NetFramework.g.cs | 16 ------- .../ElectricCurrentDensity.NetFramework.g.cs | 16 ------- .../ElectricCurrentGradient.NetFramework.g.cs | 16 ------- .../ElectricField.NetFramework.g.cs | 16 ------- .../ElectricInductance.NetFramework.g.cs | 16 ------- .../ElectricPotential.NetFramework.g.cs | 16 ------- .../ElectricPotentialAc.NetFramework.g.cs | 16 ------- .../ElectricPotentialDc.NetFramework.g.cs | 16 ------- .../ElectricResistance.NetFramework.g.cs | 16 ------- .../ElectricResistivity.NetFramework.g.cs | 16 ------- .../Quantities/Energy.NetFramework.g.cs | 16 ------- .../Quantities/Entropy.NetFramework.g.cs | 16 ------- .../Quantities/Force.NetFramework.g.cs | 16 ------- .../ForceChangeRate.NetFramework.g.cs | 16 ------- .../ForcePerLength.NetFramework.g.cs | 16 ------- .../Quantities/Frequency.NetFramework.g.cs | 16 ------- .../Quantities/HeatFlux.NetFramework.g.cs | 16 ------- .../HeatTransferCoefficient.NetFramework.g.cs | 16 ------- .../Quantities/Illuminance.NetFramework.g.cs | 16 ------- .../Quantities/Information.NetFramework.g.cs | 16 ------- .../Quantities/Irradiance.NetFramework.g.cs | 16 ------- .../Quantities/Irradiation.NetFramework.g.cs | 16 ------- .../KinematicViscosity.NetFramework.g.cs | 16 ------- .../Quantities/LapseRate.NetFramework.g.cs | 16 ------- .../Quantities/Length.NetFramework.g.cs | 16 ------- .../Quantities/Level.NetFramework.g.cs | 16 ------- .../LinearDensity.NetFramework.g.cs | 16 ------- .../Quantities/LuminousFlux.NetFramework.g.cs | 16 ------- .../LuminousIntensity.NetFramework.g.cs | 16 ------- .../MagneticField.NetFramework.g.cs | 16 ------- .../Quantities/MagneticFlux.NetFramework.g.cs | 16 ------- .../Magnetization.NetFramework.g.cs | 16 ------- .../Quantities/Mass.NetFramework.g.cs | 16 ------- .../Quantities/MassFlow.NetFramework.g.cs | 16 ------- .../Quantities/MassFlux.NetFramework.g.cs | 16 ------- .../MassMomentOfInertia.NetFramework.g.cs | 16 ------- .../Quantities/MolarEnergy.NetFramework.g.cs | 16 ------- .../Quantities/MolarEntropy.NetFramework.g.cs | 16 ------- .../Quantities/MolarMass.NetFramework.g.cs | 16 ------- .../Quantities/Molarity.NetFramework.g.cs | 16 ------- .../Quantities/Permeability.NetFramework.g.cs | 16 ------- .../Quantities/Permittivity.NetFramework.g.cs | 16 ------- .../Quantities/Power.NetFramework.g.cs | 16 ------- .../Quantities/PowerDensity.NetFramework.g.cs | 16 ------- .../Quantities/PowerRatio.NetFramework.g.cs | 16 ------- .../Quantities/Pressure.NetFramework.g.cs | 16 ------- .../PressureChangeRate.NetFramework.g.cs | 16 ------- .../Quantities/Ratio.NetFramework.g.cs | 16 ------- .../ReactiveEnergy.NetFramework.g.cs | 16 ------- .../ReactivePower.NetFramework.g.cs | 16 ------- .../RotationalAcceleration.NetFramework.g.cs | 16 ------- .../RotationalSpeed.NetFramework.g.cs | 16 ------- .../RotationalStiffness.NetFramework.g.cs | 16 ------- ...tionalStiffnessPerLength.NetFramework.g.cs | 16 ------- .../Quantities/SolidAngle.NetFramework.g.cs | 16 ------- .../SpecificEnergy.NetFramework.g.cs | 16 ------- .../SpecificEntropy.NetFramework.g.cs | 16 ------- .../SpecificVolume.NetFramework.g.cs | 16 ------- .../SpecificWeight.NetFramework.g.cs | 16 ------- .../Quantities/Speed.NetFramework.g.cs | 16 ------- .../Quantities/Temperature.NetFramework.g.cs | 16 ------- .../TemperatureChangeRate.NetFramework.g.cs | 16 ------- .../TemperatureDelta.NetFramework.g.cs | 16 ------- .../ThermalConductivity.NetFramework.g.cs | 16 ------- .../ThermalResistance.NetFramework.g.cs | 16 ------- .../Quantities/Torque.NetFramework.g.cs | 16 ------- .../Quantities/VitaminA.NetFramework.g.cs | 16 ------- .../Quantities/Volume.NetFramework.g.cs | 16 ------- .../Quantities/VolumeFlow.NetFramework.g.cs | 16 ------- UnitsNet/Length2d.cs | 4 +- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 47 +------------------ ...GenerateQuantitySourceCodeNetFramework.ps1 | 16 ------- 190 files changed, 220 insertions(+), 5556 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 9a15ce08d6..c78845e10f 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -82,21 +82,11 @@ static Acceleration() BaseDimensions = new BaseDimensions(1, 0, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit MeterPerSecondSquared. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Acceleration(double meterspersecondsquared) - { - _value = Convert.ToDouble(meterspersecondsquared); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Acceleration(double meterspersecondsquared) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit MeterPerSecondSquared. - /// - /// Value assuming base unit MeterPerSecondSquared. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Acceleration(long meterspersecondsquared) : this(Convert.ToDouble(meterspersecondsquared), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit MeterPerSecondSquared. - /// - /// Value assuming base unit MeterPerSecondSquared. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Acceleration(decimal meterspersecondsquared) : this(Convert.ToDouble(meterspersecondsquared), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Acceleration(double meterspersecondsquared) public static QuantityType QuantityType => QuantityType.Acceleration; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Acceleration, which is MeterPerSecondSquared. All conversions go via this value. /// public static AccelerationUnit BaseUnit => AccelerationUnit.MeterPerSecondSquared; @@ -670,12 +633,6 @@ public static AccelerationUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is MeterPerSecondSquared - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static AccelerationUnit ToStringDefaultUnit { get; set; } = AccelerationUnit.MeterPerSecondSquared; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 71847ea832..2ae69c2105 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -82,21 +82,11 @@ static AmountOfSubstance() BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 1, 0); } - /// - /// Creates the quantity with the given value in the base unit Mole. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public AmountOfSubstance(double moles) - { - _value = Convert.ToDouble(moles); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public AmountOfSubstance(double moles) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Mole. - /// - /// Value assuming base unit Mole. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AmountOfSubstance(long moles) : this(Convert.ToDouble(moles), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Mole. - /// - /// Value assuming base unit Mole. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AmountOfSubstance(decimal moles) : this(Convert.ToDouble(moles), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public AmountOfSubstance(double moles) public static QuantityType QuantityType => QuantityType.AmountOfSubstance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of AmountOfSubstance, which is Mole. All conversions go via this value. /// public static AmountOfSubstanceUnit BaseUnit => AmountOfSubstanceUnit.Mole; @@ -691,12 +654,6 @@ public static AmountOfSubstanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Mole - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static AmountOfSubstanceUnit ToStringDefaultUnit { get; set; } = AmountOfSubstanceUnit.Mole; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index e0934fd483..21908ddbc5 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -81,21 +81,11 @@ static AmplitudeRatio() { } - /// - /// Creates the quantity with the given value in the base unit DecibelVolt. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public AmplitudeRatio(double decibelvolts) - { - _value = Convert.ToDouble(decibelvolts); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public AmplitudeRatio(double decibelvolts) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit DecibelVolt. - /// - /// Value assuming base unit DecibelVolt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AmplitudeRatio(long decibelvolts) : this(Convert.ToDouble(decibelvolts), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit DecibelVolt. - /// - /// Value assuming base unit DecibelVolt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AmplitudeRatio(decimal decibelvolts) : this(Convert.ToDouble(decibelvolts), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public AmplitudeRatio(double decibelvolts) public static QuantityType QuantityType => QuantityType.AmplitudeRatio; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of AmplitudeRatio, which is DecibelVolt. All conversions go via this value. /// public static AmplitudeRatioUnit BaseUnit => AmplitudeRatioUnit.DecibelVolt; @@ -480,12 +443,6 @@ public static AmplitudeRatioUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is DecibelVolt - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static AmplitudeRatioUnit ToStringDefaultUnit { get; set; } = AmplitudeRatioUnit.DecibelVolt; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 9dbfc907d3..31f12e70d5 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -81,21 +81,11 @@ static Angle() { } - /// - /// Creates the quantity with the given value in the base unit Degree. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Angle(double degrees) - { - _value = Convert.ToDouble(degrees); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public Angle(double degrees) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Degree. - /// - /// Value assuming base unit Degree. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Angle(long degrees) : this(Convert.ToDouble(degrees), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Degree. - /// - /// Value assuming base unit Degree. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Angle(decimal degrees) : this(Convert.ToDouble(degrees), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public Angle(double degrees) public static QuantityType QuantityType => QuantityType.Angle; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Angle, which is Degree. All conversions go via this value. /// public static AngleUnit BaseUnit => AngleUnit.Degree; @@ -690,12 +653,6 @@ public static AngleUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Degree - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static AngleUnit ToStringDefaultUnit { get; set; } = AngleUnit.Degree; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 02a2b3b251..d3b738c28f 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -82,21 +82,11 @@ static ApparentEnergy() BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit VoltampereHour. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ApparentEnergy(double voltamperehours) - { - _value = Convert.ToDouble(voltamperehours); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ApparentEnergy(double voltamperehours) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit VoltampereHour. - /// - /// Value assuming base unit VoltampereHour. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ApparentEnergy(long voltamperehours) : this(Convert.ToDouble(voltamperehours), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit VoltampereHour. - /// - /// Value assuming base unit VoltampereHour. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ApparentEnergy(decimal voltamperehours) : this(Convert.ToDouble(voltamperehours), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ApparentEnergy(double voltamperehours) public static QuantityType QuantityType => QuantityType.ApparentEnergy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ApparentEnergy, which is VoltampereHour. All conversions go via this value. /// public static ApparentEnergyUnit BaseUnit => ApparentEnergyUnit.VoltampereHour; @@ -460,12 +423,6 @@ public static ApparentEnergyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is VoltampereHour - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ApparentEnergyUnit ToStringDefaultUnit { get; set; } = ApparentEnergyUnit.VoltampereHour; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index cebc7b60d3..0c92300625 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -82,21 +82,11 @@ static ApparentPower() BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Voltampere. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ApparentPower(double voltamperes) - { - _value = Convert.ToDouble(voltamperes); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ApparentPower(double voltamperes) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Voltampere. - /// - /// Value assuming base unit Voltampere. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ApparentPower(long voltamperes) : this(Convert.ToDouble(voltamperes), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Voltampere. - /// - /// Value assuming base unit Voltampere. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ApparentPower(decimal voltamperes) : this(Convert.ToDouble(voltamperes), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ApparentPower(double voltamperes) public static QuantityType QuantityType => QuantityType.ApparentPower; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ApparentPower, which is Voltampere. All conversions go via this value. /// public static ApparentPowerUnit BaseUnit => ApparentPowerUnit.Voltampere; @@ -481,12 +444,6 @@ public static ApparentPowerUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Voltampere - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ApparentPowerUnit ToStringDefaultUnit { get; set; } = ApparentPowerUnit.Voltampere; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index c7477b8453..55d5d0612c 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -82,21 +82,11 @@ static Area() BaseDimensions = new BaseDimensions(2, 0, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit SquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Area(double squaremeters) - { - _value = Convert.ToDouble(squaremeters); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Area(double squaremeters) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit SquareMeter. - /// - /// Value assuming base unit SquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Area(long squaremeters) : this(Convert.ToDouble(squaremeters), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit SquareMeter. - /// - /// Value assuming base unit SquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Area(decimal squaremeters) : this(Convert.ToDouble(squaremeters), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Area(double squaremeters) public static QuantityType QuantityType => QuantityType.Area; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Area, which is SquareMeter. All conversions go via this value. /// public static AreaUnit BaseUnit => AreaUnit.SquareMeter; @@ -670,12 +633,6 @@ public static AreaUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is SquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static AreaUnit ToStringDefaultUnit { get; set; } = AreaUnit.SquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 96776b2677..cb1cfba4d1 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -82,21 +82,11 @@ static AreaDensity() BaseDimensions = new BaseDimensions(-2, 1, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit KilogramPerSquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public AreaDensity(double kilogramspersquaremeter) - { - _value = Convert.ToDouble(kilogramspersquaremeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public AreaDensity(double kilogramspersquaremeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerSquareMeter. - /// - /// Value assuming base unit KilogramPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AreaDensity(long kilogramspersquaremeter) : this(Convert.ToDouble(kilogramspersquaremeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerSquareMeter. - /// - /// Value assuming base unit KilogramPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AreaDensity(decimal kilogramspersquaremeter) : this(Convert.ToDouble(kilogramspersquaremeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public AreaDensity(double kilogramspersquaremeter) public static QuantityType QuantityType => QuantityType.AreaDensity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of AreaDensity, which is KilogramPerSquareMeter. All conversions go via this value. /// public static AreaDensityUnit BaseUnit => AreaDensityUnit.KilogramPerSquareMeter; @@ -418,12 +381,6 @@ public static AreaDensityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is KilogramPerSquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static AreaDensityUnit ToStringDefaultUnit { get; set; } = AreaDensityUnit.KilogramPerSquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 0d781c8805..0c8c11b930 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -82,21 +82,11 @@ static AreaMomentOfInertia() BaseDimensions = new BaseDimensions(4, 0, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit MeterToTheFourth. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public AreaMomentOfInertia(double meterstothefourth) - { - _value = Convert.ToDouble(meterstothefourth); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public AreaMomentOfInertia(double meterstothefourth) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit MeterToTheFourth. - /// - /// Value assuming base unit MeterToTheFourth. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AreaMomentOfInertia(long meterstothefourth) : this(Convert.ToDouble(meterstothefourth), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit MeterToTheFourth. - /// - /// Value assuming base unit MeterToTheFourth. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - AreaMomentOfInertia(decimal meterstothefourth) : this(Convert.ToDouble(meterstothefourth), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public AreaMomentOfInertia(double meterstothefourth) public static QuantityType QuantityType => QuantityType.AreaMomentOfInertia; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of AreaMomentOfInertia, which is MeterToTheFourth. All conversions go via this value. /// public static AreaMomentOfInertiaUnit BaseUnit => AreaMomentOfInertiaUnit.MeterToTheFourth; @@ -523,12 +486,6 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is MeterToTheFourth - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static AreaMomentOfInertiaUnit ToStringDefaultUnit { get; set; } = AreaMomentOfInertiaUnit.MeterToTheFourth; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index a1e62e838d..c80cb9103d 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -81,21 +81,11 @@ static BitRate() { } - /// - /// Creates the quantity with the given value in the base unit BitPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public BitRate(double bitspersecond) - { - _value = Convert.ToDecimal(bitspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public BitRate(double bitspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit BitPerSecond. - /// - /// Value assuming base unit BitPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - BitRate(long bitspersecond) : this(Convert.ToDecimal(bitspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit BitPerSecond. - /// - /// Value assuming base unit BitPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - BitRate(decimal bitspersecond) : this(Convert.ToDecimal(bitspersecond), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public BitRate(double bitspersecond) public static QuantityType QuantityType => QuantityType.BitRate; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of BitRate, which is BitPerSecond. All conversions go via this value. /// public static BitRateUnit BaseUnit => BitRateUnit.BitPerSecond; @@ -942,12 +905,6 @@ public static BitRateUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is BitPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static BitRateUnit ToStringDefaultUnit { get; set; } = BitRateUnit.BitPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index 0711a609f9..8451783471 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -82,21 +82,11 @@ static BrakeSpecificFuelConsumption() BaseDimensions = new BaseDimensions(-2, 0, 2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit KilogramPerJoule. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public BrakeSpecificFuelConsumption(double kilogramsperjoule) - { - _value = Convert.ToDouble(kilogramsperjoule); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public BrakeSpecificFuelConsumption(double kilogramsperjoule) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerJoule. - /// - /// Value assuming base unit KilogramPerJoule. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - BrakeSpecificFuelConsumption(long kilogramsperjoule) : this(Convert.ToDouble(kilogramsperjoule), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerJoule. - /// - /// Value assuming base unit KilogramPerJoule. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - BrakeSpecificFuelConsumption(decimal kilogramsperjoule) : this(Convert.ToDouble(kilogramsperjoule), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public BrakeSpecificFuelConsumption(double kilogramsperjoule) public static QuantityType QuantityType => QuantityType.BrakeSpecificFuelConsumption; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of BrakeSpecificFuelConsumption, which is KilogramPerJoule. All conversions go via this value. /// public static BrakeSpecificFuelConsumptionUnit BaseUnit => BrakeSpecificFuelConsumptionUnit.KilogramPerJoule; @@ -460,12 +423,6 @@ public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is KilogramPerJoule - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static BrakeSpecificFuelConsumptionUnit ToStringDefaultUnit { get; set; } = BrakeSpecificFuelConsumptionUnit.KilogramPerJoule; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 9241cd01c7..207d620ce3 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -82,21 +82,11 @@ static Capacitance() BaseDimensions = new BaseDimensions(-2, -1, 4, 2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Farad. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Capacitance(double farads) - { - _value = Convert.ToDouble(farads); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Capacitance(double farads) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Farad. - /// - /// Value assuming base unit Farad. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Capacitance(long farads) : this(Convert.ToDouble(farads), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Farad. - /// - /// Value assuming base unit Farad. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Capacitance(decimal farads) : this(Convert.ToDouble(farads), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Capacitance(double farads) public static QuantityType QuantityType => QuantityType.Capacitance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Capacitance, which is Farad. All conversions go via this value. /// public static CapacitanceUnit BaseUnit => CapacitanceUnit.Farad; @@ -418,12 +381,6 @@ public static CapacitanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Farad - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static CapacitanceUnit ToStringDefaultUnit { get; set; } = CapacitanceUnit.Farad; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index b02b22384e..424502289b 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -82,21 +82,11 @@ static Density() BaseDimensions = new BaseDimensions(-3, 1, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit KilogramPerCubicMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Density(double kilogramspercubicmeter) - { - _value = Convert.ToDouble(kilogramspercubicmeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Density(double kilogramspercubicmeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerCubicMeter. - /// - /// Value assuming base unit KilogramPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Density(long kilogramspercubicmeter) : this(Convert.ToDouble(kilogramspercubicmeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerCubicMeter. - /// - /// Value assuming base unit KilogramPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Density(decimal kilogramspercubicmeter) : this(Convert.ToDouble(kilogramspercubicmeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Density(double kilogramspercubicmeter) public static QuantityType QuantityType => QuantityType.Density; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Density, which is KilogramPerCubicMeter. All conversions go via this value. /// public static DensityUnit BaseUnit => DensityUnit.KilogramPerCubicMeter; @@ -1195,12 +1158,6 @@ public static DensityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is KilogramPerCubicMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static DensityUnit ToStringDefaultUnit { get; set; } = DensityUnit.KilogramPerCubicMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index f887bdaa9d..fb65aefdf7 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -82,21 +82,11 @@ static Duration() BaseDimensions = new BaseDimensions(0, 0, 1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Second. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Duration(double seconds) - { - _value = Convert.ToDouble(seconds); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Duration(double seconds) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Second. - /// - /// Value assuming base unit Second. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Duration(long seconds) : this(Convert.ToDouble(seconds), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Second. - /// - /// Value assuming base unit Second. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Duration(decimal seconds) : this(Convert.ToDouble(seconds), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Duration(double seconds) public static QuantityType QuantityType => QuantityType.Duration; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Duration, which is Second. All conversions go via this value. /// public static DurationUnit BaseUnit => DurationUnit.Second; @@ -607,12 +570,6 @@ public static DurationUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Second - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static DurationUnit ToStringDefaultUnit { get; set; } = DurationUnit.Second; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index a7ec561031..019b542850 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -82,21 +82,11 @@ static DynamicViscosity() BaseDimensions = new BaseDimensions(-1, 1, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit NewtonSecondPerMeterSquared. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public DynamicViscosity(double newtonsecondspermetersquared) - { - _value = Convert.ToDouble(newtonsecondspermetersquared); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public DynamicViscosity(double newtonsecondspermetersquared) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit NewtonSecondPerMeterSquared. - /// - /// Value assuming base unit NewtonSecondPerMeterSquared. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - DynamicViscosity(long newtonsecondspermetersquared) : this(Convert.ToDouble(newtonsecondspermetersquared), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit NewtonSecondPerMeterSquared. - /// - /// Value assuming base unit NewtonSecondPerMeterSquared. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - DynamicViscosity(decimal newtonsecondspermetersquared) : this(Convert.ToDouble(newtonsecondspermetersquared), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public DynamicViscosity(double newtonsecondspermetersquared) public static QuantityType QuantityType => QuantityType.DynamicViscosity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of DynamicViscosity, which is NewtonSecondPerMeterSquared. All conversions go via this value. /// public static DynamicViscosityUnit BaseUnit => DynamicViscosityUnit.NewtonSecondPerMeterSquared; @@ -523,12 +486,6 @@ public static DynamicViscosityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is NewtonSecondPerMeterSquared - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static DynamicViscosityUnit ToStringDefaultUnit { get; set; } = DynamicViscosityUnit.NewtonSecondPerMeterSquared; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index f6312cd305..d80d3e16b4 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -82,21 +82,11 @@ static ElectricAdmittance() BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Siemens. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricAdmittance(double siemens) - { - _value = Convert.ToDouble(siemens); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricAdmittance(double siemens) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Siemens. - /// - /// Value assuming base unit Siemens. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricAdmittance(long siemens) : this(Convert.ToDouble(siemens), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Siemens. - /// - /// Value assuming base unit Siemens. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricAdmittance(decimal siemens) : this(Convert.ToDouble(siemens), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricAdmittance(double siemens) public static QuantityType QuantityType => QuantityType.ElectricAdmittance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricAdmittance, which is Siemens. All conversions go via this value. /// public static ElectricAdmittanceUnit BaseUnit => ElectricAdmittanceUnit.Siemens; @@ -481,12 +444,6 @@ public static ElectricAdmittanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Siemens - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricAdmittanceUnit ToStringDefaultUnit { get; set; } = ElectricAdmittanceUnit.Siemens; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 054f008ba4..1c871dbf10 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -82,21 +82,11 @@ static ElectricCharge() BaseDimensions = new BaseDimensions(0, 0, 1, 1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Coulomb. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricCharge(double coulombs) - { - _value = Convert.ToDouble(coulombs); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricCharge(double coulombs) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Coulomb. - /// - /// Value assuming base unit Coulomb. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCharge(long coulombs) : this(Convert.ToDouble(coulombs), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Coulomb. - /// - /// Value assuming base unit Coulomb. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCharge(decimal coulombs) : this(Convert.ToDouble(coulombs), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricCharge(double coulombs) public static QuantityType QuantityType => QuantityType.ElectricCharge; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricCharge, which is Coulomb. All conversions go via this value. /// public static ElectricChargeUnit BaseUnit => ElectricChargeUnit.Coulomb; @@ -418,12 +381,6 @@ public static ElectricChargeUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Coulomb - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricChargeUnit ToStringDefaultUnit { get; set; } = ElectricChargeUnit.Coulomb; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 595cc898cf..0c96f85a45 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -82,21 +82,11 @@ static ElectricChargeDensity() BaseDimensions = new BaseDimensions(-3, 0, 1, 1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit CoulombPerCubicMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricChargeDensity(double coulombspercubicmeter) - { - _value = Convert.ToDouble(coulombspercubicmeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricChargeDensity(double coulombspercubicmeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit CoulombPerCubicMeter. - /// - /// Value assuming base unit CoulombPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricChargeDensity(long coulombspercubicmeter) : this(Convert.ToDouble(coulombspercubicmeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit CoulombPerCubicMeter. - /// - /// Value assuming base unit CoulombPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricChargeDensity(decimal coulombspercubicmeter) : this(Convert.ToDouble(coulombspercubicmeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricChargeDensity(double coulombspercubicmeter) public static QuantityType QuantityType => QuantityType.ElectricChargeDensity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricChargeDensity, which is CoulombPerCubicMeter. All conversions go via this value. /// public static ElectricChargeDensityUnit BaseUnit => ElectricChargeDensityUnit.CoulombPerCubicMeter; @@ -418,12 +381,6 @@ public static ElectricChargeDensityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is CoulombPerCubicMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricChargeDensityUnit ToStringDefaultUnit { get; set; } = ElectricChargeDensityUnit.CoulombPerCubicMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index cf45800e51..faf9943273 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -82,21 +82,11 @@ static ElectricConductance() BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Siemens. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricConductance(double siemens) - { - _value = Convert.ToDouble(siemens); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricConductance(double siemens) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Siemens. - /// - /// Value assuming base unit Siemens. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricConductance(long siemens) : this(Convert.ToDouble(siemens), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Siemens. - /// - /// Value assuming base unit Siemens. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricConductance(decimal siemens) : this(Convert.ToDouble(siemens), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricConductance(double siemens) public static QuantityType QuantityType => QuantityType.ElectricConductance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricConductance, which is Siemens. All conversions go via this value. /// public static ElectricConductanceUnit BaseUnit => ElectricConductanceUnit.Siemens; @@ -460,12 +423,6 @@ public static ElectricConductanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Siemens - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricConductanceUnit ToStringDefaultUnit { get; set; } = ElectricConductanceUnit.Siemens; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 20940ba28c..b7eecdd660 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -82,21 +82,11 @@ static ElectricConductivity() BaseDimensions = new BaseDimensions(-3, -1, 3, 2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit SiemensPerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricConductivity(double siemenspermeter) - { - _value = Convert.ToDouble(siemenspermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricConductivity(double siemenspermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit SiemensPerMeter. - /// - /// Value assuming base unit SiemensPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricConductivity(long siemenspermeter) : this(Convert.ToDouble(siemenspermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit SiemensPerMeter. - /// - /// Value assuming base unit SiemensPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricConductivity(decimal siemenspermeter) : this(Convert.ToDouble(siemenspermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricConductivity(double siemenspermeter) public static QuantityType QuantityType => QuantityType.ElectricConductivity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricConductivity, which is SiemensPerMeter. All conversions go via this value. /// public static ElectricConductivityUnit BaseUnit => ElectricConductivityUnit.SiemensPerMeter; @@ -418,12 +381,6 @@ public static ElectricConductivityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is SiemensPerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricConductivityUnit ToStringDefaultUnit { get; set; } = ElectricConductivityUnit.SiemensPerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 0a673f8658..c89040b50b 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -82,21 +82,11 @@ static ElectricCurrent() BaseDimensions = new BaseDimensions(0, 0, 0, 1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Ampere. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricCurrent(double amperes) - { - _value = Convert.ToDouble(amperes); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricCurrent(double amperes) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Ampere. - /// - /// Value assuming base unit Ampere. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCurrent(long amperes) : this(Convert.ToDouble(amperes), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Ampere. - /// - /// Value assuming base unit Ampere. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCurrent(decimal amperes) : this(Convert.ToDouble(amperes), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricCurrent(double amperes) public static QuantityType QuantityType => QuantityType.ElectricCurrent; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricCurrent, which is Ampere. All conversions go via this value. /// public static ElectricCurrentUnit BaseUnit => ElectricCurrentUnit.Ampere; @@ -565,12 +528,6 @@ public static ElectricCurrentUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Ampere - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricCurrentUnit ToStringDefaultUnit { get; set; } = ElectricCurrentUnit.Ampere; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 6123796558..07dc957242 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -82,21 +82,11 @@ static ElectricCurrentDensity() BaseDimensions = new BaseDimensions(-2, 0, 0, 1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit AmperePerSquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricCurrentDensity(double amperespersquaremeter) - { - _value = Convert.ToDouble(amperespersquaremeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricCurrentDensity(double amperespersquaremeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit AmperePerSquareMeter. - /// - /// Value assuming base unit AmperePerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCurrentDensity(long amperespersquaremeter) : this(Convert.ToDouble(amperespersquaremeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit AmperePerSquareMeter. - /// - /// Value assuming base unit AmperePerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCurrentDensity(decimal amperespersquaremeter) : this(Convert.ToDouble(amperespersquaremeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricCurrentDensity(double amperespersquaremeter) public static QuantityType QuantityType => QuantityType.ElectricCurrentDensity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricCurrentDensity, which is AmperePerSquareMeter. All conversions go via this value. /// public static ElectricCurrentDensityUnit BaseUnit => ElectricCurrentDensityUnit.AmperePerSquareMeter; @@ -418,12 +381,6 @@ public static ElectricCurrentDensityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is AmperePerSquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricCurrentDensityUnit ToStringDefaultUnit { get; set; } = ElectricCurrentDensityUnit.AmperePerSquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 97716db3dd..98ba0877fa 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -82,21 +82,11 @@ static ElectricCurrentGradient() BaseDimensions = new BaseDimensions(0, 0, -1, 1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit AmperePerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricCurrentGradient(double amperespersecond) - { - _value = Convert.ToDouble(amperespersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricCurrentGradient(double amperespersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit AmperePerSecond. - /// - /// Value assuming base unit AmperePerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCurrentGradient(long amperespersecond) : this(Convert.ToDouble(amperespersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit AmperePerSecond. - /// - /// Value assuming base unit AmperePerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricCurrentGradient(decimal amperespersecond) : this(Convert.ToDouble(amperespersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricCurrentGradient(double amperespersecond) public static QuantityType QuantityType => QuantityType.ElectricCurrentGradient; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricCurrentGradient, which is AmperePerSecond. All conversions go via this value. /// public static ElectricCurrentGradientUnit BaseUnit => ElectricCurrentGradientUnit.AmperePerSecond; @@ -418,12 +381,6 @@ public static ElectricCurrentGradientUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is AmperePerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricCurrentGradientUnit ToStringDefaultUnit { get; set; } = ElectricCurrentGradientUnit.AmperePerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index ba656adcfd..c7f4415c0d 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -82,21 +82,11 @@ static ElectricField() BaseDimensions = new BaseDimensions(1, 1, -3, -1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit VoltPerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricField(double voltspermeter) - { - _value = Convert.ToDouble(voltspermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricField(double voltspermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit VoltPerMeter. - /// - /// Value assuming base unit VoltPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricField(long voltspermeter) : this(Convert.ToDouble(voltspermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit VoltPerMeter. - /// - /// Value assuming base unit VoltPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricField(decimal voltspermeter) : this(Convert.ToDouble(voltspermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricField(double voltspermeter) public static QuantityType QuantityType => QuantityType.ElectricField; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricField, which is VoltPerMeter. All conversions go via this value. /// public static ElectricFieldUnit BaseUnit => ElectricFieldUnit.VoltPerMeter; @@ -418,12 +381,6 @@ public static ElectricFieldUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is VoltPerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricFieldUnit ToStringDefaultUnit { get; set; } = ElectricFieldUnit.VoltPerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 0b93e27c20..5e99aca8fc 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -82,21 +82,11 @@ static ElectricInductance() BaseDimensions = new BaseDimensions(2, 1, -2, -2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Henry. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricInductance(double henries) - { - _value = Convert.ToDouble(henries); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricInductance(double henries) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Henry. - /// - /// Value assuming base unit Henry. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricInductance(long henries) : this(Convert.ToDouble(henries), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Henry. - /// - /// Value assuming base unit Henry. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricInductance(decimal henries) : this(Convert.ToDouble(henries), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricInductance(double henries) public static QuantityType QuantityType => QuantityType.ElectricInductance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricInductance, which is Henry. All conversions go via this value. /// public static ElectricInductanceUnit BaseUnit => ElectricInductanceUnit.Henry; @@ -418,12 +381,6 @@ public static ElectricInductanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Henry - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricInductanceUnit ToStringDefaultUnit { get; set; } = ElectricInductanceUnit.Henry; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index d3a460a984..1335fe4f02 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -82,21 +82,11 @@ static ElectricPotential() BaseDimensions = new BaseDimensions(2, 1, -3, -1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Volt. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricPotential(double volts) - { - _value = Convert.ToDouble(volts); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricPotential(double volts) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Volt. - /// - /// Value assuming base unit Volt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricPotential(long volts) : this(Convert.ToDouble(volts), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Volt. - /// - /// Value assuming base unit Volt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricPotential(decimal volts) : this(Convert.ToDouble(volts), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricPotential(double volts) public static QuantityType QuantityType => QuantityType.ElectricPotential; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricPotential, which is Volt. All conversions go via this value. /// public static ElectricPotentialUnit BaseUnit => ElectricPotentialUnit.Volt; @@ -502,12 +465,6 @@ public static ElectricPotentialUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Volt - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricPotentialUnit ToStringDefaultUnit { get; set; } = ElectricPotentialUnit.Volt; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 7b69083ed3..ede77df0b7 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -81,21 +81,11 @@ static ElectricPotentialAc() { } - /// - /// Creates the quantity with the given value in the base unit VoltAc. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricPotentialAc(double voltsac) - { - _value = Convert.ToDouble(voltsac); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public ElectricPotentialAc(double voltsac) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit VoltAc. - /// - /// Value assuming base unit VoltAc. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricPotentialAc(long voltsac) : this(Convert.ToDouble(voltsac), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit VoltAc. - /// - /// Value assuming base unit VoltAc. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricPotentialAc(decimal voltsac) : this(Convert.ToDouble(voltsac), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public ElectricPotentialAc(double voltsac) public static QuantityType QuantityType => QuantityType.ElectricPotentialAc; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricPotentialAc, which is VoltAc. All conversions go via this value. /// public static ElectricPotentialAcUnit BaseUnit => ElectricPotentialAcUnit.VoltAc; @@ -501,12 +464,6 @@ public static ElectricPotentialAcUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is VoltAc - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricPotentialAcUnit ToStringDefaultUnit { get; set; } = ElectricPotentialAcUnit.VoltAc; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 0dca9b37e9..646534343f 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -81,21 +81,11 @@ static ElectricPotentialDc() { } - /// - /// Creates the quantity with the given value in the base unit VoltDc. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricPotentialDc(double voltsdc) - { - _value = Convert.ToDouble(voltsdc); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public ElectricPotentialDc(double voltsdc) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit VoltDc. - /// - /// Value assuming base unit VoltDc. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricPotentialDc(long voltsdc) : this(Convert.ToDouble(voltsdc), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit VoltDc. - /// - /// Value assuming base unit VoltDc. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricPotentialDc(decimal voltsdc) : this(Convert.ToDouble(voltsdc), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public ElectricPotentialDc(double voltsdc) public static QuantityType QuantityType => QuantityType.ElectricPotentialDc; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricPotentialDc, which is VoltDc. All conversions go via this value. /// public static ElectricPotentialDcUnit BaseUnit => ElectricPotentialDcUnit.VoltDc; @@ -501,12 +464,6 @@ public static ElectricPotentialDcUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is VoltDc - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricPotentialDcUnit ToStringDefaultUnit { get; set; } = ElectricPotentialDcUnit.VoltDc; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 50da50619a..edfbe3cf3c 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -82,21 +82,11 @@ static ElectricResistance() BaseDimensions = new BaseDimensions(2, 1, -3, -2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Ohm. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricResistance(double ohms) - { - _value = Convert.ToDouble(ohms); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricResistance(double ohms) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Ohm. - /// - /// Value assuming base unit Ohm. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricResistance(long ohms) : this(Convert.ToDouble(ohms), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Ohm. - /// - /// Value assuming base unit Ohm. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricResistance(decimal ohms) : this(Convert.ToDouble(ohms), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricResistance(double ohms) public static QuantityType QuantityType => QuantityType.ElectricResistance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricResistance, which is Ohm. All conversions go via this value. /// public static ElectricResistanceUnit BaseUnit => ElectricResistanceUnit.Ohm; @@ -481,12 +444,6 @@ public static ElectricResistanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Ohm - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricResistanceUnit ToStringDefaultUnit { get; set; } = ElectricResistanceUnit.Ohm; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index f6470b764a..1bf2b97e84 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -82,21 +82,11 @@ static ElectricResistivity() BaseDimensions = new BaseDimensions(3, 1, -3, -2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit OhmMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ElectricResistivity(double ohmmeters) - { - _value = Convert.ToDouble(ohmmeters); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ElectricResistivity(double ohmmeters) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit OhmMeter. - /// - /// Value assuming base unit OhmMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricResistivity(long ohmmeters) : this(Convert.ToDouble(ohmmeters), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit OhmMeter. - /// - /// Value assuming base unit OhmMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ElectricResistivity(decimal ohmmeters) : this(Convert.ToDouble(ohmmeters), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ElectricResistivity(double ohmmeters) public static QuantityType QuantityType => QuantityType.ElectricResistivity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ElectricResistivity, which is OhmMeter. All conversions go via this value. /// public static ElectricResistivityUnit BaseUnit => ElectricResistivityUnit.OhmMeter; @@ -481,12 +444,6 @@ public static ElectricResistivityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is OhmMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ElectricResistivityUnit ToStringDefaultUnit { get; set; } = ElectricResistivityUnit.OhmMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 63c600f9ca..300d8ebd52 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -82,21 +82,11 @@ static Energy() BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Joule. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Energy(double joules) - { - _value = Convert.ToDouble(joules); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Energy(double joules) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Joule. - /// - /// Value assuming base unit Joule. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Energy(long joules) : this(Convert.ToDouble(joules), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Joule. - /// - /// Value assuming base unit Joule. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Energy(decimal joules) : this(Convert.ToDouble(joules), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Energy(double joules) public static QuantityType QuantityType => QuantityType.Energy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Energy, which is Joule. All conversions go via this value. /// public static EnergyUnit BaseUnit => EnergyUnit.Joule; @@ -859,12 +822,6 @@ public static EnergyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Joule - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static EnergyUnit ToStringDefaultUnit { get; set; } = EnergyUnit.Joule; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index 3d589bae37..58134e394d 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -82,21 +82,11 @@ static Entropy() BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit JoulePerKelvin. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Entropy(double joulesperkelvin) - { - _value = Convert.ToDouble(joulesperkelvin); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Entropy(double joulesperkelvin) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit JoulePerKelvin. - /// - /// Value assuming base unit JoulePerKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Entropy(long joulesperkelvin) : this(Convert.ToDouble(joulesperkelvin), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit JoulePerKelvin. - /// - /// Value assuming base unit JoulePerKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Entropy(decimal joulesperkelvin) : this(Convert.ToDouble(joulesperkelvin), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Entropy(double joulesperkelvin) public static QuantityType QuantityType => QuantityType.Entropy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Entropy, which is JoulePerKelvin. All conversions go via this value. /// public static EntropyUnit BaseUnit => EntropyUnit.JoulePerKelvin; @@ -544,12 +507,6 @@ public static EntropyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is JoulePerKelvin - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static EntropyUnit ToStringDefaultUnit { get; set; } = EntropyUnit.JoulePerKelvin; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 1f3c6a045c..423da91f80 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -82,21 +82,11 @@ static Force() BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Newton. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Force(double newtons) - { - _value = Convert.ToDouble(newtons); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Force(double newtons) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Newton. - /// - /// Value assuming base unit Newton. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Force(long newtons) : this(Convert.ToDouble(newtons), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Newton. - /// - /// Value assuming base unit Newton. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Force(decimal newtons) : this(Convert.ToDouble(newtons), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Force(double newtons) public static QuantityType QuantityType => QuantityType.Force; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Force, which is Newton. All conversions go via this value. /// public static ForceUnit BaseUnit => ForceUnit.Newton; @@ -607,12 +570,6 @@ public static ForceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Newton - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ForceUnit ToStringDefaultUnit { get; set; } = ForceUnit.Newton; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 0438140ec6..8d40ac8eed 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -82,21 +82,11 @@ static ForceChangeRate() BaseDimensions = new BaseDimensions(1, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit NewtonPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ForceChangeRate(double newtonspersecond) - { - _value = Convert.ToDouble(newtonspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ForceChangeRate(double newtonspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit NewtonPerSecond. - /// - /// Value assuming base unit NewtonPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ForceChangeRate(long newtonspersecond) : this(Convert.ToDouble(newtonspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit NewtonPerSecond. - /// - /// Value assuming base unit NewtonPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ForceChangeRate(decimal newtonspersecond) : this(Convert.ToDouble(newtonspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ForceChangeRate(double newtonspersecond) public static QuantityType QuantityType => QuantityType.ForceChangeRate; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ForceChangeRate, which is NewtonPerSecond. All conversions go via this value. /// public static ForceChangeRateUnit BaseUnit => ForceChangeRateUnit.NewtonPerSecond; @@ -628,12 +591,6 @@ public static ForceChangeRateUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is NewtonPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ForceChangeRateUnit ToStringDefaultUnit { get; set; } = ForceChangeRateUnit.NewtonPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index ba7d43f39c..b125ddab77 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -82,21 +82,11 @@ static ForcePerLength() BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit NewtonPerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ForcePerLength(double newtonspermeter) - { - _value = Convert.ToDouble(newtonspermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ForcePerLength(double newtonspermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit NewtonPerMeter. - /// - /// Value assuming base unit NewtonPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ForcePerLength(long newtonspermeter) : this(Convert.ToDouble(newtonspermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit NewtonPerMeter. - /// - /// Value assuming base unit NewtonPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ForcePerLength(decimal newtonspermeter) : this(Convert.ToDouble(newtonspermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ForcePerLength(double newtonspermeter) public static QuantityType QuantityType => QuantityType.ForcePerLength; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ForcePerLength, which is NewtonPerMeter. All conversions go via this value. /// public static ForcePerLengthUnit BaseUnit => ForcePerLengthUnit.NewtonPerMeter; @@ -586,12 +549,6 @@ public static ForcePerLengthUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is NewtonPerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ForcePerLengthUnit ToStringDefaultUnit { get; set; } = ForcePerLengthUnit.NewtonPerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 8de729e386..ad20b1e708 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -82,21 +82,11 @@ static Frequency() BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Hertz. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Frequency(double hertz) - { - _value = Convert.ToDouble(hertz); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Frequency(double hertz) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Hertz. - /// - /// Value assuming base unit Hertz. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Frequency(long hertz) : this(Convert.ToDouble(hertz), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Hertz. - /// - /// Value assuming base unit Hertz. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Frequency(decimal hertz) : this(Convert.ToDouble(hertz), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Frequency(double hertz) public static QuantityType QuantityType => QuantityType.Frequency; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Frequency, which is Hertz. All conversions go via this value. /// public static FrequencyUnit BaseUnit => FrequencyUnit.Hertz; @@ -565,12 +528,6 @@ public static FrequencyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Hertz - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static FrequencyUnit ToStringDefaultUnit { get; set; } = FrequencyUnit.Hertz; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 91133819fd..3924581ad1 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -82,21 +82,11 @@ static HeatFlux() BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit WattPerSquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public HeatFlux(double wattspersquaremeter) - { - _value = Convert.ToDouble(wattspersquaremeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public HeatFlux(double wattspersquaremeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit WattPerSquareMeter. - /// - /// Value assuming base unit WattPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - HeatFlux(long wattspersquaremeter) : this(Convert.ToDouble(wattspersquaremeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit WattPerSquareMeter. - /// - /// Value assuming base unit WattPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - HeatFlux(decimal wattspersquaremeter) : this(Convert.ToDouble(wattspersquaremeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public HeatFlux(double wattspersquaremeter) public static QuantityType QuantityType => QuantityType.HeatFlux; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of HeatFlux, which is WattPerSquareMeter. All conversions go via this value. /// public static HeatFluxUnit BaseUnit => HeatFluxUnit.WattPerSquareMeter; @@ -733,12 +696,6 @@ public static HeatFluxUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is WattPerSquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static HeatFluxUnit ToStringDefaultUnit { get; set; } = HeatFluxUnit.WattPerSquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 297455ad5b..0af5b86e65 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -82,21 +82,11 @@ static HeatTransferCoefficient() BaseDimensions = new BaseDimensions(0, 1, -3, 0, -1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit WattPerSquareMeterKelvin. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public HeatTransferCoefficient(double wattspersquaremeterkelvin) - { - _value = Convert.ToDouble(wattspersquaremeterkelvin); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public HeatTransferCoefficient(double wattspersquaremeterkelvin) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit WattPerSquareMeterKelvin. - /// - /// Value assuming base unit WattPerSquareMeterKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - HeatTransferCoefficient(long wattspersquaremeterkelvin) : this(Convert.ToDouble(wattspersquaremeterkelvin), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit WattPerSquareMeterKelvin. - /// - /// Value assuming base unit WattPerSquareMeterKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - HeatTransferCoefficient(decimal wattspersquaremeterkelvin) : this(Convert.ToDouble(wattspersquaremeterkelvin), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public HeatTransferCoefficient(double wattspersquaremeterkelvin) public static QuantityType QuantityType => QuantityType.HeatTransferCoefficient; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of HeatTransferCoefficient, which is WattPerSquareMeterKelvin. All conversions go via this value. /// public static HeatTransferCoefficientUnit BaseUnit => HeatTransferCoefficientUnit.WattPerSquareMeterKelvin; @@ -439,12 +402,6 @@ public static HeatTransferCoefficientUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is WattPerSquareMeterKelvin - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static HeatTransferCoefficientUnit ToStringDefaultUnit { get; set; } = HeatTransferCoefficientUnit.WattPerSquareMeterKelvin; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index 2fb9720e81..fa620ee0f1 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -82,21 +82,11 @@ static Illuminance() BaseDimensions = new BaseDimensions(-2, 0, 0, 0, 0, 0, 1); } - /// - /// Creates the quantity with the given value in the base unit Lux. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Illuminance(double lux) - { - _value = Convert.ToDouble(lux); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Illuminance(double lux) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Lux. - /// - /// Value assuming base unit Lux. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Illuminance(long lux) : this(Convert.ToDouble(lux), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Lux. - /// - /// Value assuming base unit Lux. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Illuminance(decimal lux) : this(Convert.ToDouble(lux), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Illuminance(double lux) public static QuantityType QuantityType => QuantityType.Illuminance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Illuminance, which is Lux. All conversions go via this value. /// public static IlluminanceUnit BaseUnit => IlluminanceUnit.Lux; @@ -481,12 +444,6 @@ public static IlluminanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Lux - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static IlluminanceUnit ToStringDefaultUnit { get; set; } = IlluminanceUnit.Lux; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 58bc851328..f970685a84 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -81,21 +81,11 @@ static Information() { } - /// - /// Creates the quantity with the given value in the base unit Bit. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Information(double bits) - { - _value = Convert.ToDecimal(bits); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public Information(double bits) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Bit. - /// - /// Value assuming base unit Bit. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Information(long bits) : this(Convert.ToDecimal(bits), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Bit. - /// - /// Value assuming base unit Bit. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Information(decimal bits) : this(Convert.ToDecimal(bits), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public Information(double bits) public static QuantityType QuantityType => QuantityType.Information; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Information, which is Bit. All conversions go via this value. /// public static InformationUnit BaseUnit => InformationUnit.Bit; @@ -942,12 +905,6 @@ public static InformationUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Bit - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static InformationUnit ToStringDefaultUnit { get; set; } = InformationUnit.Bit; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index ef601d24e9..e88be7e7e5 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -82,21 +82,11 @@ static Irradiance() BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit WattPerSquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Irradiance(double wattspersquaremeter) - { - _value = Convert.ToDouble(wattspersquaremeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Irradiance(double wattspersquaremeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit WattPerSquareMeter. - /// - /// Value assuming base unit WattPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Irradiance(long wattspersquaremeter) : this(Convert.ToDouble(wattspersquaremeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit WattPerSquareMeter. - /// - /// Value assuming base unit WattPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Irradiance(decimal wattspersquaremeter) : this(Convert.ToDouble(wattspersquaremeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Irradiance(double wattspersquaremeter) public static QuantityType QuantityType => QuantityType.Irradiance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Irradiance, which is WattPerSquareMeter. All conversions go via this value. /// public static IrradianceUnit BaseUnit => IrradianceUnit.WattPerSquareMeter; @@ -439,12 +402,6 @@ public static IrradianceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is WattPerSquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static IrradianceUnit ToStringDefaultUnit { get; set; } = IrradianceUnit.WattPerSquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 954735b197..185c9dc106 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -82,21 +82,11 @@ static Irradiation() BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit JoulePerSquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Irradiation(double joulespersquaremeter) - { - _value = Convert.ToDouble(joulespersquaremeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Irradiation(double joulespersquaremeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit JoulePerSquareMeter. - /// - /// Value assuming base unit JoulePerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Irradiation(long joulespersquaremeter) : this(Convert.ToDouble(joulespersquaremeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit JoulePerSquareMeter. - /// - /// Value assuming base unit JoulePerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Irradiation(decimal joulespersquaremeter) : this(Convert.ToDouble(joulespersquaremeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Irradiation(double joulespersquaremeter) public static QuantityType QuantityType => QuantityType.Irradiation; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Irradiation, which is JoulePerSquareMeter. All conversions go via this value. /// public static IrradiationUnit BaseUnit => IrradiationUnit.JoulePerSquareMeter; @@ -460,12 +423,6 @@ public static IrradiationUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is JoulePerSquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static IrradiationUnit ToStringDefaultUnit { get; set; } = IrradiationUnit.JoulePerSquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index f85da89005..31ab830023 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -82,21 +82,11 @@ static KinematicViscosity() BaseDimensions = new BaseDimensions(2, 0, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit SquareMeterPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public KinematicViscosity(double squaremeterspersecond) - { - _value = Convert.ToDouble(squaremeterspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public KinematicViscosity(double squaremeterspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit SquareMeterPerSecond. - /// - /// Value assuming base unit SquareMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - KinematicViscosity(long squaremeterspersecond) : this(Convert.ToDouble(squaremeterspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit SquareMeterPerSecond. - /// - /// Value assuming base unit SquareMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - KinematicViscosity(decimal squaremeterspersecond) : this(Convert.ToDouble(squaremeterspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public KinematicViscosity(double squaremeterspersecond) public static QuantityType QuantityType => QuantityType.KinematicViscosity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of KinematicViscosity, which is SquareMeterPerSecond. All conversions go via this value. /// public static KinematicViscosityUnit BaseUnit => KinematicViscosityUnit.SquareMeterPerSecond; @@ -565,12 +528,6 @@ public static KinematicViscosityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is SquareMeterPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static KinematicViscosityUnit ToStringDefaultUnit { get; set; } = KinematicViscosityUnit.SquareMeterPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 314a93e445..f151d87f4b 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -82,21 +82,11 @@ static LapseRate() BaseDimensions = new BaseDimensions(-1, 0, 0, 0, 1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit DegreeCelsiusPerKilometer. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public LapseRate(double degreescelciusperkilometer) - { - _value = Convert.ToDouble(degreescelciusperkilometer); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public LapseRate(double degreescelciusperkilometer) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit DegreeCelsiusPerKilometer. - /// - /// Value assuming base unit DegreeCelsiusPerKilometer. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LapseRate(long degreescelciusperkilometer) : this(Convert.ToDouble(degreescelciusperkilometer), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit DegreeCelsiusPerKilometer. - /// - /// Value assuming base unit DegreeCelsiusPerKilometer. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LapseRate(decimal degreescelciusperkilometer) : this(Convert.ToDouble(degreescelciusperkilometer), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public LapseRate(double degreescelciusperkilometer) public static QuantityType QuantityType => QuantityType.LapseRate; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of LapseRate, which is DegreeCelsiusPerKilometer. All conversions go via this value. /// public static LapseRateUnit BaseUnit => LapseRateUnit.DegreeCelsiusPerKilometer; @@ -418,12 +381,6 @@ public static LapseRateUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is DegreeCelsiusPerKilometer - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static LapseRateUnit ToStringDefaultUnit { get; set; } = LapseRateUnit.DegreeCelsiusPerKilometer; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index d531a7dba5..df3c766803 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -82,21 +82,11 @@ static Length() BaseDimensions = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Meter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Length(double meters) - { - _value = Convert.ToDouble(meters); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Length(double meters) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Meter. - /// - /// Value assuming base unit Meter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Length(long meters) : this(Convert.ToDouble(meters), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Meter. - /// - /// Value assuming base unit Meter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Length(decimal meters) : this(Convert.ToDouble(meters), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Length(double meters) public static QuantityType QuantityType => QuantityType.Length; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Length, which is Meter. All conversions go via this value. /// public static LengthUnit BaseUnit => LengthUnit.Meter; @@ -859,12 +822,6 @@ public static LengthUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Meter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static LengthUnit ToStringDefaultUnit { get; set; } = LengthUnit.Meter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index eb5acf981e..135559cb2b 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -81,21 +81,11 @@ static Level() { } - /// - /// Creates the quantity with the given value in the base unit Decibel. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Level(double decibels) - { - _value = Convert.ToDouble(decibels); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public Level(double decibels) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Decibel. - /// - /// Value assuming base unit Decibel. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Level(long decibels) : this(Convert.ToDouble(decibels), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Decibel. - /// - /// Value assuming base unit Decibel. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Level(decimal decibels) : this(Convert.ToDouble(decibels), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public Level(double decibels) public static QuantityType QuantityType => QuantityType.Level; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Level, which is Decibel. All conversions go via this value. /// public static LevelUnit BaseUnit => LevelUnit.Decibel; @@ -438,12 +401,6 @@ public static LevelUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Decibel - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static LevelUnit ToStringDefaultUnit { get; set; } = LevelUnit.Decibel; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 03e4fe5bf0..ed61cef9dc 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -82,21 +82,11 @@ static LinearDensity() BaseDimensions = new BaseDimensions(-1, 1, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit KilogramPerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public LinearDensity(double kilogramspermeter) - { - _value = Convert.ToDouble(kilogramspermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public LinearDensity(double kilogramspermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerMeter. - /// - /// Value assuming base unit KilogramPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LinearDensity(long kilogramspermeter) : this(Convert.ToDouble(kilogramspermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerMeter. - /// - /// Value assuming base unit KilogramPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LinearDensity(decimal kilogramspermeter) : this(Convert.ToDouble(kilogramspermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public LinearDensity(double kilogramspermeter) public static QuantityType QuantityType => QuantityType.LinearDensity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of LinearDensity, which is KilogramPerMeter. All conversions go via this value. /// public static LinearDensityUnit BaseUnit => LinearDensityUnit.KilogramPerMeter; @@ -460,12 +423,6 @@ public static LinearDensityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is KilogramPerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static LinearDensityUnit ToStringDefaultUnit { get; set; } = LinearDensityUnit.KilogramPerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index cca9c30f7e..bbe14681e8 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -82,21 +82,11 @@ static LuminousFlux() BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); } - /// - /// Creates the quantity with the given value in the base unit Lumen. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public LuminousFlux(double lumens) - { - _value = Convert.ToDouble(lumens); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public LuminousFlux(double lumens) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Lumen. - /// - /// Value assuming base unit Lumen. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LuminousFlux(long lumens) : this(Convert.ToDouble(lumens), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Lumen. - /// - /// Value assuming base unit Lumen. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LuminousFlux(decimal lumens) : this(Convert.ToDouble(lumens), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public LuminousFlux(double lumens) public static QuantityType QuantityType => QuantityType.LuminousFlux; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of LuminousFlux, which is Lumen. All conversions go via this value. /// public static LuminousFluxUnit BaseUnit => LuminousFluxUnit.Lumen; @@ -418,12 +381,6 @@ public static LuminousFluxUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Lumen - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static LuminousFluxUnit ToStringDefaultUnit { get; set; } = LuminousFluxUnit.Lumen; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 8a4ca9046e..105d0ab1b6 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -82,21 +82,11 @@ static LuminousIntensity() BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); } - /// - /// Creates the quantity with the given value in the base unit Candela. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public LuminousIntensity(double candela) - { - _value = Convert.ToDouble(candela); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public LuminousIntensity(double candela) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Candela. - /// - /// Value assuming base unit Candela. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LuminousIntensity(long candela) : this(Convert.ToDouble(candela), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Candela. - /// - /// Value assuming base unit Candela. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - LuminousIntensity(decimal candela) : this(Convert.ToDouble(candela), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public LuminousIntensity(double candela) public static QuantityType QuantityType => QuantityType.LuminousIntensity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of LuminousIntensity, which is Candela. All conversions go via this value. /// public static LuminousIntensityUnit BaseUnit => LuminousIntensityUnit.Candela; @@ -418,12 +381,6 @@ public static LuminousIntensityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Candela - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static LuminousIntensityUnit ToStringDefaultUnit { get; set; } = LuminousIntensityUnit.Candela; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 5fdc10ef5a..777010fce3 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -82,21 +82,11 @@ static MagneticField() BaseDimensions = new BaseDimensions(0, 1, -2, -1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Tesla. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MagneticField(double teslas) - { - _value = Convert.ToDouble(teslas); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MagneticField(double teslas) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Tesla. - /// - /// Value assuming base unit Tesla. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MagneticField(long teslas) : this(Convert.ToDouble(teslas), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Tesla. - /// - /// Value assuming base unit Tesla. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MagneticField(decimal teslas) : this(Convert.ToDouble(teslas), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MagneticField(double teslas) public static QuantityType QuantityType => QuantityType.MagneticField; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MagneticField, which is Tesla. All conversions go via this value. /// public static MagneticFieldUnit BaseUnit => MagneticFieldUnit.Tesla; @@ -418,12 +381,6 @@ public static MagneticFieldUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Tesla - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MagneticFieldUnit ToStringDefaultUnit { get; set; } = MagneticFieldUnit.Tesla; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index ebc195b7cc..eab4ccba84 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -82,21 +82,11 @@ static MagneticFlux() BaseDimensions = new BaseDimensions(2, 1, -2, -1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Weber. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MagneticFlux(double webers) - { - _value = Convert.ToDouble(webers); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MagneticFlux(double webers) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Weber. - /// - /// Value assuming base unit Weber. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MagneticFlux(long webers) : this(Convert.ToDouble(webers), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Weber. - /// - /// Value assuming base unit Weber. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MagneticFlux(decimal webers) : this(Convert.ToDouble(webers), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MagneticFlux(double webers) public static QuantityType QuantityType => QuantityType.MagneticFlux; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MagneticFlux, which is Weber. All conversions go via this value. /// public static MagneticFluxUnit BaseUnit => MagneticFluxUnit.Weber; @@ -418,12 +381,6 @@ public static MagneticFluxUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Weber - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MagneticFluxUnit ToStringDefaultUnit { get; set; } = MagneticFluxUnit.Weber; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 3c62db754d..3fe35ea7f5 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -82,21 +82,11 @@ static Magnetization() BaseDimensions = new BaseDimensions(-1, 0, 0, 1, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit AmperePerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Magnetization(double amperespermeter) - { - _value = Convert.ToDouble(amperespermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Magnetization(double amperespermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit AmperePerMeter. - /// - /// Value assuming base unit AmperePerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Magnetization(long amperespermeter) : this(Convert.ToDouble(amperespermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit AmperePerMeter. - /// - /// Value assuming base unit AmperePerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Magnetization(decimal amperespermeter) : this(Convert.ToDouble(amperespermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Magnetization(double amperespermeter) public static QuantityType QuantityType => QuantityType.Magnetization; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Magnetization, which is AmperePerMeter. All conversions go via this value. /// public static MagnetizationUnit BaseUnit => MagnetizationUnit.AmperePerMeter; @@ -418,12 +381,6 @@ public static MagnetizationUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is AmperePerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MagnetizationUnit ToStringDefaultUnit { get; set; } = MagnetizationUnit.AmperePerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 06699b1b76..9aeaac81ef 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -82,21 +82,11 @@ static Mass() BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Kilogram. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Mass(double kilograms) - { - _value = Convert.ToDouble(kilograms); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Mass(double kilograms) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Kilogram. - /// - /// Value assuming base unit Kilogram. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Mass(long kilograms) : this(Convert.ToDouble(kilograms), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Kilogram. - /// - /// Value assuming base unit Kilogram. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Mass(decimal kilograms) : this(Convert.ToDouble(kilograms), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Mass(double kilograms) public static QuantityType QuantityType => QuantityType.Mass; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Mass, which is Kilogram. All conversions go via this value. /// public static MassUnit BaseUnit => MassUnit.Kilogram; @@ -838,12 +801,6 @@ public static MassUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Kilogram - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MassUnit ToStringDefaultUnit { get; set; } = MassUnit.Kilogram; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index b6a3b0578a..4920b42077 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -82,21 +82,11 @@ static MassFlow() BaseDimensions = new BaseDimensions(0, 1, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit GramPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MassFlow(double gramspersecond) - { - _value = Convert.ToDouble(gramspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MassFlow(double gramspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit GramPerSecond. - /// - /// Value assuming base unit GramPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassFlow(long gramspersecond) : this(Convert.ToDouble(gramspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit GramPerSecond. - /// - /// Value assuming base unit GramPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassFlow(decimal gramspersecond) : this(Convert.ToDouble(gramspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MassFlow(double gramspersecond) public static QuantityType QuantityType => QuantityType.MassFlow; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MassFlow, which is GramPerSecond. All conversions go via this value. /// public static MassFlowUnit BaseUnit => MassFlowUnit.GramPerSecond; @@ -712,12 +675,6 @@ public static MassFlowUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is GramPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MassFlowUnit ToStringDefaultUnit { get; set; } = MassFlowUnit.GramPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index 5f9eccc4b9..b7eaf6eeff 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -82,21 +82,11 @@ static MassFlux() BaseDimensions = new BaseDimensions(-2, 1, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit KilogramPerSecondPerSquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MassFlux(double kilogramspersecondpersquaremeter) - { - _value = Convert.ToDouble(kilogramspersecondpersquaremeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MassFlux(double kilogramspersecondpersquaremeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerSecondPerSquareMeter. - /// - /// Value assuming base unit KilogramPerSecondPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassFlux(long kilogramspersecondpersquaremeter) : this(Convert.ToDouble(kilogramspersecondpersquaremeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerSecondPerSquareMeter. - /// - /// Value assuming base unit KilogramPerSecondPerSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassFlux(decimal kilogramspersecondpersquaremeter) : this(Convert.ToDouble(kilogramspersecondpersquaremeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MassFlux(double kilogramspersecondpersquaremeter) public static QuantityType QuantityType => QuantityType.MassFlux; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MassFlux, which is KilogramPerSecondPerSquareMeter. All conversions go via this value. /// public static MassFluxUnit BaseUnit => MassFluxUnit.KilogramPerSecondPerSquareMeter; @@ -439,12 +402,6 @@ public static MassFluxUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is KilogramPerSecondPerSquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MassFluxUnit ToStringDefaultUnit { get; set; } = MassFluxUnit.KilogramPerSecondPerSquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index c5605de962..6dd62ed4b8 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -82,21 +82,11 @@ static MassMomentOfInertia() BaseDimensions = new BaseDimensions(2, 1, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit KilogramSquareMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MassMomentOfInertia(double kilogramsquaremeters) - { - _value = Convert.ToDouble(kilogramsquaremeters); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MassMomentOfInertia(double kilogramsquaremeters) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit KilogramSquareMeter. - /// - /// Value assuming base unit KilogramSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassMomentOfInertia(long kilogramsquaremeters) : this(Convert.ToDouble(kilogramsquaremeters), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit KilogramSquareMeter. - /// - /// Value assuming base unit KilogramSquareMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassMomentOfInertia(decimal kilogramsquaremeters) : this(Convert.ToDouble(kilogramsquaremeters), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MassMomentOfInertia(double kilogramsquaremeters) public static QuantityType QuantityType => QuantityType.MassMomentOfInertia; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MassMomentOfInertia, which is KilogramSquareMeter. All conversions go via this value. /// public static MassMomentOfInertiaUnit BaseUnit => MassMomentOfInertiaUnit.KilogramSquareMeter; @@ -943,12 +906,6 @@ public static MassMomentOfInertiaUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is KilogramSquareMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MassMomentOfInertiaUnit ToStringDefaultUnit { get; set; } = MassMomentOfInertiaUnit.KilogramSquareMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index e489ed704f..7d9bdf58b3 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -82,21 +82,11 @@ static MolarEnergy() BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, -1, 0); } - /// - /// Creates the quantity with the given value in the base unit JoulePerMole. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MolarEnergy(double joulespermole) - { - _value = Convert.ToDouble(joulespermole); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MolarEnergy(double joulespermole) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit JoulePerMole. - /// - /// Value assuming base unit JoulePerMole. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MolarEnergy(long joulespermole) : this(Convert.ToDouble(joulespermole), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit JoulePerMole. - /// - /// Value assuming base unit JoulePerMole. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MolarEnergy(decimal joulespermole) : this(Convert.ToDouble(joulespermole), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MolarEnergy(double joulespermole) public static QuantityType QuantityType => QuantityType.MolarEnergy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MolarEnergy, which is JoulePerMole. All conversions go via this value. /// public static MolarEnergyUnit BaseUnit => MolarEnergyUnit.JoulePerMole; @@ -460,12 +423,6 @@ public static MolarEnergyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is JoulePerMole - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MolarEnergyUnit ToStringDefaultUnit { get; set; } = MolarEnergyUnit.JoulePerMole; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index 4398823241..a198221bc0 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -82,21 +82,11 @@ static MolarEntropy() BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, -1, 0); } - /// - /// Creates the quantity with the given value in the base unit JoulePerMoleKelvin. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MolarEntropy(double joulespermolekelvin) - { - _value = Convert.ToDouble(joulespermolekelvin); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MolarEntropy(double joulespermolekelvin) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit JoulePerMoleKelvin. - /// - /// Value assuming base unit JoulePerMoleKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MolarEntropy(long joulespermolekelvin) : this(Convert.ToDouble(joulespermolekelvin), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit JoulePerMoleKelvin. - /// - /// Value assuming base unit JoulePerMoleKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MolarEntropy(decimal joulespermolekelvin) : this(Convert.ToDouble(joulespermolekelvin), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MolarEntropy(double joulespermolekelvin) public static QuantityType QuantityType => QuantityType.MolarEntropy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MolarEntropy, which is JoulePerMoleKelvin. All conversions go via this value. /// public static MolarEntropyUnit BaseUnit => MolarEntropyUnit.JoulePerMoleKelvin; @@ -460,12 +423,6 @@ public static MolarEntropyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is JoulePerMoleKelvin - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MolarEntropyUnit ToStringDefaultUnit { get; set; } = MolarEntropyUnit.JoulePerMoleKelvin; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 46a44da8de..caaf577f31 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -82,21 +82,11 @@ static MolarMass() BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, -1, 0); } - /// - /// Creates the quantity with the given value in the base unit KilogramPerMole. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MolarMass(double kilogramspermole) - { - _value = Convert.ToDouble(kilogramspermole); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public MolarMass(double kilogramspermole) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerMole. - /// - /// Value assuming base unit KilogramPerMole. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MolarMass(long kilogramspermole) : this(Convert.ToDouble(kilogramspermole), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit KilogramPerMole. - /// - /// Value assuming base unit KilogramPerMole. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MolarMass(decimal kilogramspermole) : this(Convert.ToDouble(kilogramspermole), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public MolarMass(double kilogramspermole) public static QuantityType QuantityType => QuantityType.MolarMass; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of MolarMass, which is KilogramPerMole. All conversions go via this value. /// public static MolarMassUnit BaseUnit => MolarMassUnit.KilogramPerMole; @@ -649,12 +612,6 @@ public static MolarMassUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is KilogramPerMole - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MolarMassUnit ToStringDefaultUnit { get; set; } = MolarMassUnit.KilogramPerMole; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index eba201c6d1..5a11b934cf 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -82,21 +82,11 @@ static Molarity() BaseDimensions = new BaseDimensions(-3, 0, 0, 0, 0, 1, 0); } - /// - /// Creates the quantity with the given value in the base unit MolesPerCubicMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Molarity(double molespercubicmeter) - { - _value = Convert.ToDouble(molespercubicmeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Molarity(double molespercubicmeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit MolesPerCubicMeter. - /// - /// Value assuming base unit MolesPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Molarity(long molespercubicmeter) : this(Convert.ToDouble(molespercubicmeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit MolesPerCubicMeter. - /// - /// Value assuming base unit MolesPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Molarity(decimal molespercubicmeter) : this(Convert.ToDouble(molespercubicmeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Molarity(double molespercubicmeter) public static QuantityType QuantityType => QuantityType.Molarity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Molarity, which is MolesPerCubicMeter. All conversions go via this value. /// public static MolarityUnit BaseUnit => MolarityUnit.MolesPerCubicMeter; @@ -565,12 +528,6 @@ public static MolarityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is MolesPerCubicMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MolarityUnit ToStringDefaultUnit { get; set; } = MolarityUnit.MolesPerCubicMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index aa289fc355..605d01f70f 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -82,21 +82,11 @@ static Permeability() BaseDimensions = new BaseDimensions(1, 1, -2, -2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit HenryPerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Permeability(double henriespermeter) - { - _value = Convert.ToDouble(henriespermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Permeability(double henriespermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit HenryPerMeter. - /// - /// Value assuming base unit HenryPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Permeability(long henriespermeter) : this(Convert.ToDouble(henriespermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit HenryPerMeter. - /// - /// Value assuming base unit HenryPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Permeability(decimal henriespermeter) : this(Convert.ToDouble(henriespermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Permeability(double henriespermeter) public static QuantityType QuantityType => QuantityType.Permeability; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Permeability, which is HenryPerMeter. All conversions go via this value. /// public static PermeabilityUnit BaseUnit => PermeabilityUnit.HenryPerMeter; @@ -418,12 +381,6 @@ public static PermeabilityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is HenryPerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static PermeabilityUnit ToStringDefaultUnit { get; set; } = PermeabilityUnit.HenryPerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 6cf39ac74a..5e478eebca 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -82,21 +82,11 @@ static Permittivity() BaseDimensions = new BaseDimensions(-3, -1, 4, 2, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit FaradPerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Permittivity(double faradspermeter) - { - _value = Convert.ToDouble(faradspermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Permittivity(double faradspermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit FaradPerMeter. - /// - /// Value assuming base unit FaradPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Permittivity(long faradspermeter) : this(Convert.ToDouble(faradspermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit FaradPerMeter. - /// - /// Value assuming base unit FaradPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Permittivity(decimal faradspermeter) : this(Convert.ToDouble(faradspermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Permittivity(double faradspermeter) public static QuantityType QuantityType => QuantityType.Permittivity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Permittivity, which is FaradPerMeter. All conversions go via this value. /// public static PermittivityUnit BaseUnit => PermittivityUnit.FaradPerMeter; @@ -418,12 +381,6 @@ public static PermittivityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is FaradPerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static PermittivityUnit ToStringDefaultUnit { get; set; } = PermittivityUnit.FaradPerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index 01ddb1832b..ba59d32489 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -82,21 +82,11 @@ static Power() BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Watt. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Power(double watts) - { - _value = Convert.ToDecimal(watts); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Power(double watts) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Watt. - /// - /// Value assuming base unit Watt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Power(long watts) : this(Convert.ToDecimal(watts), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Watt. - /// - /// Value assuming base unit Watt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Power(decimal watts) : this(Convert.ToDecimal(watts), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Power(double watts) public static QuantityType QuantityType => QuantityType.Power; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Power, which is Watt. All conversions go via this value. /// public static PowerUnit BaseUnit => PowerUnit.Watt; @@ -817,12 +780,6 @@ public static PowerUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Watt - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static PowerUnit ToStringDefaultUnit { get; set; } = PowerUnit.Watt; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index c6e521f6f0..8d8ab2583b 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -82,21 +82,11 @@ static PowerDensity() BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit WattPerCubicMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public PowerDensity(double wattspercubicmeter) - { - _value = Convert.ToDouble(wattspercubicmeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public PowerDensity(double wattspercubicmeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit WattPerCubicMeter. - /// - /// Value assuming base unit WattPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - PowerDensity(long wattspercubicmeter) : this(Convert.ToDouble(wattspercubicmeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit WattPerCubicMeter. - /// - /// Value assuming base unit WattPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - PowerDensity(decimal wattspercubicmeter) : this(Convert.ToDouble(wattspercubicmeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public PowerDensity(double wattspercubicmeter) public static QuantityType QuantityType => QuantityType.PowerDensity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of PowerDensity, which is WattPerCubicMeter. All conversions go via this value. /// public static PowerDensityUnit BaseUnit => PowerDensityUnit.WattPerCubicMeter; @@ -1321,12 +1284,6 @@ public static PowerDensityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is WattPerCubicMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static PowerDensityUnit ToStringDefaultUnit { get; set; } = PowerDensityUnit.WattPerCubicMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 4522c28c71..76a694a796 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -81,21 +81,11 @@ static PowerRatio() { } - /// - /// Creates the quantity with the given value in the base unit DecibelWatt. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public PowerRatio(double decibelwatts) - { - _value = Convert.ToDouble(decibelwatts); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public PowerRatio(double decibelwatts) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit DecibelWatt. - /// - /// Value assuming base unit DecibelWatt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - PowerRatio(long decibelwatts) : this(Convert.ToDouble(decibelwatts), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit DecibelWatt. - /// - /// Value assuming base unit DecibelWatt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - PowerRatio(decimal decibelwatts) : this(Convert.ToDouble(decibelwatts), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public PowerRatio(double decibelwatts) public static QuantityType QuantityType => QuantityType.PowerRatio; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of PowerRatio, which is DecibelWatt. All conversions go via this value. /// public static PowerRatioUnit BaseUnit => PowerRatioUnit.DecibelWatt; @@ -438,12 +401,6 @@ public static PowerRatioUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is DecibelWatt - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static PowerRatioUnit ToStringDefaultUnit { get; set; } = PowerRatioUnit.DecibelWatt; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index b8abaad74e..ec02f2f093 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -82,21 +82,11 @@ static Pressure() BaseDimensions = new BaseDimensions(-1, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Pascal. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Pressure(double pascals) - { - _value = Convert.ToDouble(pascals); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Pressure(double pascals) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Pascal. - /// - /// Value assuming base unit Pascal. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Pressure(long pascals) : this(Convert.ToDouble(pascals), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Pascal. - /// - /// Value assuming base unit Pascal. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Pressure(decimal pascals) : this(Convert.ToDouble(pascals), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Pressure(double pascals) public static QuantityType QuantityType => QuantityType.Pressure; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Pressure, which is Pascal. All conversions go via this value. /// public static PressureUnit BaseUnit => PressureUnit.Pascal; @@ -1174,12 +1137,6 @@ public static PressureUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Pascal - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static PressureUnit ToStringDefaultUnit { get; set; } = PressureUnit.Pascal; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 80b59387ae..5eb9d4e36f 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -82,21 +82,11 @@ static PressureChangeRate() BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit PascalPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public PressureChangeRate(double pascalspersecond) - { - _value = Convert.ToDouble(pascalspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public PressureChangeRate(double pascalspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit PascalPerSecond. - /// - /// Value assuming base unit PascalPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - PressureChangeRate(long pascalspersecond) : this(Convert.ToDouble(pascalspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit PascalPerSecond. - /// - /// Value assuming base unit PascalPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - PressureChangeRate(decimal pascalspersecond) : this(Convert.ToDouble(pascalspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public PressureChangeRate(double pascalspersecond) public static QuantityType QuantityType => QuantityType.PressureChangeRate; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of PressureChangeRate, which is PascalPerSecond. All conversions go via this value. /// public static PressureChangeRateUnit BaseUnit => PressureChangeRateUnit.PascalPerSecond; @@ -481,12 +444,6 @@ public static PressureChangeRateUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is PascalPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static PressureChangeRateUnit ToStringDefaultUnit { get; set; } = PressureChangeRateUnit.PascalPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 009264ca78..9a9ed80adf 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -81,21 +81,11 @@ static Ratio() { } - /// - /// Creates the quantity with the given value in the base unit DecimalFraction. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Ratio(double decimalfractions) - { - _value = Convert.ToDouble(decimalfractions); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public Ratio(double decimalfractions) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit DecimalFraction. - /// - /// Value assuming base unit DecimalFraction. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Ratio(long decimalfractions) : this(Convert.ToDouble(decimalfractions), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit DecimalFraction. - /// - /// Value assuming base unit DecimalFraction. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Ratio(decimal decimalfractions) : this(Convert.ToDouble(decimalfractions), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public Ratio(double decimalfractions) public static QuantityType QuantityType => QuantityType.Ratio; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Ratio, which is DecimalFraction. All conversions go via this value. /// public static RatioUnit BaseUnit => RatioUnit.DecimalFraction; @@ -522,12 +485,6 @@ public static RatioUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is DecimalFraction - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static RatioUnit ToStringDefaultUnit { get; set; } = RatioUnit.DecimalFraction; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index 7bb5753464..f0c04d4347 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -82,21 +82,11 @@ static ReactiveEnergy() BaseDimensions = new BaseDimensions(2, 1, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit VoltampereReactiveHour. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ReactiveEnergy(double voltamperereactivehours) - { - _value = Convert.ToDouble(voltamperereactivehours); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ReactiveEnergy(double voltamperereactivehours) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit VoltampereReactiveHour. - /// - /// Value assuming base unit VoltampereReactiveHour. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ReactiveEnergy(long voltamperereactivehours) : this(Convert.ToDouble(voltamperereactivehours), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit VoltampereReactiveHour. - /// - /// Value assuming base unit VoltampereReactiveHour. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ReactiveEnergy(decimal voltamperereactivehours) : this(Convert.ToDouble(voltamperereactivehours), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ReactiveEnergy(double voltamperereactivehours) public static QuantityType QuantityType => QuantityType.ReactiveEnergy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ReactiveEnergy, which is VoltampereReactiveHour. All conversions go via this value. /// public static ReactiveEnergyUnit BaseUnit => ReactiveEnergyUnit.VoltampereReactiveHour; @@ -460,12 +423,6 @@ public static ReactiveEnergyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is VoltampereReactiveHour - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ReactiveEnergyUnit ToStringDefaultUnit { get; set; } = ReactiveEnergyUnit.VoltampereReactiveHour; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index b2e709fc04..58efa1c60c 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -82,21 +82,11 @@ static ReactivePower() BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit VoltampereReactive. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ReactivePower(double voltamperesreactive) - { - _value = Convert.ToDouble(voltamperesreactive); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ReactivePower(double voltamperesreactive) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit VoltampereReactive. - /// - /// Value assuming base unit VoltampereReactive. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ReactivePower(long voltamperesreactive) : this(Convert.ToDouble(voltamperesreactive), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit VoltampereReactive. - /// - /// Value assuming base unit VoltampereReactive. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ReactivePower(decimal voltamperesreactive) : this(Convert.ToDouble(voltamperesreactive), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ReactivePower(double voltamperesreactive) public static QuantityType QuantityType => QuantityType.ReactivePower; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ReactivePower, which is VoltampereReactive. All conversions go via this value. /// public static ReactivePowerUnit BaseUnit => ReactivePowerUnit.VoltampereReactive; @@ -481,12 +444,6 @@ public static ReactivePowerUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is VoltampereReactive - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ReactivePowerUnit ToStringDefaultUnit { get; set; } = ReactivePowerUnit.VoltampereReactive; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 31c452b7be..62db2b62c3 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -82,21 +82,11 @@ static RotationalAcceleration() BaseDimensions = new BaseDimensions(0, 0, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit RadianPerSecondSquared. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public RotationalAcceleration(double radianspersecondsquared) - { - _value = Convert.ToDouble(radianspersecondsquared); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public RotationalAcceleration(double radianspersecondsquared) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit RadianPerSecondSquared. - /// - /// Value assuming base unit RadianPerSecondSquared. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalAcceleration(long radianspersecondsquared) : this(Convert.ToDouble(radianspersecondsquared), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit RadianPerSecondSquared. - /// - /// Value assuming base unit RadianPerSecondSquared. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalAcceleration(decimal radianspersecondsquared) : this(Convert.ToDouble(radianspersecondsquared), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public RotationalAcceleration(double radianspersecondsquared) public static QuantityType QuantityType => QuantityType.RotationalAcceleration; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of RotationalAcceleration, which is RadianPerSecondSquared. All conversions go via this value. /// public static RotationalAccelerationUnit BaseUnit => RotationalAccelerationUnit.RadianPerSecondSquared; @@ -460,12 +423,6 @@ public static RotationalAccelerationUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is RadianPerSecondSquared - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static RotationalAccelerationUnit ToStringDefaultUnit { get; set; } = RotationalAccelerationUnit.RadianPerSecondSquared; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 74139b6f12..62a31f62bf 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -82,21 +82,11 @@ static RotationalSpeed() BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit RadianPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public RotationalSpeed(double radianspersecond) - { - _value = Convert.ToDouble(radianspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public RotationalSpeed(double radianspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit RadianPerSecond. - /// - /// Value assuming base unit RadianPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalSpeed(long radianspersecond) : this(Convert.ToDouble(radianspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit RadianPerSecond. - /// - /// Value assuming base unit RadianPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalSpeed(decimal radianspersecond) : this(Convert.ToDouble(radianspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public RotationalSpeed(double radianspersecond) public static QuantityType QuantityType => QuantityType.RotationalSpeed; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of RotationalSpeed, which is RadianPerSecond. All conversions go via this value. /// public static RotationalSpeedUnit BaseUnit => RotationalSpeedUnit.RadianPerSecond; @@ -670,12 +633,6 @@ public static RotationalSpeedUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is RadianPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static RotationalSpeedUnit ToStringDefaultUnit { get; set; } = RotationalSpeedUnit.RadianPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index d79562ee83..6b9bff2b71 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -82,21 +82,11 @@ static RotationalStiffness() BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit NewtonMeterPerRadian. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public RotationalStiffness(double newtonmetersperradian) - { - _value = Convert.ToDouble(newtonmetersperradian); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public RotationalStiffness(double newtonmetersperradian) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit NewtonMeterPerRadian. - /// - /// Value assuming base unit NewtonMeterPerRadian. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalStiffness(long newtonmetersperradian) : this(Convert.ToDouble(newtonmetersperradian), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit NewtonMeterPerRadian. - /// - /// Value assuming base unit NewtonMeterPerRadian. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalStiffness(decimal newtonmetersperradian) : this(Convert.ToDouble(newtonmetersperradian), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public RotationalStiffness(double newtonmetersperradian) public static QuantityType QuantityType => QuantityType.RotationalStiffness; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of RotationalStiffness, which is NewtonMeterPerRadian. All conversions go via this value. /// public static RotationalStiffnessUnit BaseUnit => RotationalStiffnessUnit.NewtonMeterPerRadian; @@ -460,12 +423,6 @@ public static RotationalStiffnessUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is NewtonMeterPerRadian - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static RotationalStiffnessUnit ToStringDefaultUnit { get; set; } = RotationalStiffnessUnit.NewtonMeterPerRadian; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 8eace32d2a..67cbb7fb44 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -82,21 +82,11 @@ static RotationalStiffnessPerLength() BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit NewtonMeterPerRadianPerMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public RotationalStiffnessPerLength(double newtonmetersperradianpermeter) - { - _value = Convert.ToDouble(newtonmetersperradianpermeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public RotationalStiffnessPerLength(double newtonmetersperradianpermeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit NewtonMeterPerRadianPerMeter. - /// - /// Value assuming base unit NewtonMeterPerRadianPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalStiffnessPerLength(long newtonmetersperradianpermeter) : this(Convert.ToDouble(newtonmetersperradianpermeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit NewtonMeterPerRadianPerMeter. - /// - /// Value assuming base unit NewtonMeterPerRadianPerMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - RotationalStiffnessPerLength(decimal newtonmetersperradianpermeter) : this(Convert.ToDouble(newtonmetersperradianpermeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public RotationalStiffnessPerLength(double newtonmetersperradianpermeter) public static QuantityType QuantityType => QuantityType.RotationalStiffnessPerLength; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of RotationalStiffnessPerLength, which is NewtonMeterPerRadianPerMeter. All conversions go via this value. /// public static RotationalStiffnessPerLengthUnit BaseUnit => RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter; @@ -460,12 +423,6 @@ public static RotationalStiffnessPerLengthUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is NewtonMeterPerRadianPerMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static RotationalStiffnessPerLengthUnit ToStringDefaultUnit { get; set; } = RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index d6395d037d..ecdbbb4195 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -81,21 +81,11 @@ static SolidAngle() { } - /// - /// Creates the quantity with the given value in the base unit Steradian. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public SolidAngle(double steradians) - { - _value = Convert.ToDouble(steradians); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public SolidAngle(double steradians) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Steradian. - /// - /// Value assuming base unit Steradian. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SolidAngle(long steradians) : this(Convert.ToDouble(steradians), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Steradian. - /// - /// Value assuming base unit Steradian. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SolidAngle(decimal steradians) : this(Convert.ToDouble(steradians), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public SolidAngle(double steradians) public static QuantityType QuantityType => QuantityType.SolidAngle; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of SolidAngle, which is Steradian. All conversions go via this value. /// public static SolidAngleUnit BaseUnit => SolidAngleUnit.Steradian; @@ -417,12 +380,6 @@ public static SolidAngleUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Steradian - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static SolidAngleUnit ToStringDefaultUnit { get; set; } = SolidAngleUnit.Steradian; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index b7898c0eb2..6ec937c74f 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -82,21 +82,11 @@ static SpecificEnergy() BaseDimensions = new BaseDimensions(2, 0, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit JoulePerKilogram. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public SpecificEnergy(double joulesperkilogram) - { - _value = Convert.ToDouble(joulesperkilogram); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public SpecificEnergy(double joulesperkilogram) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit JoulePerKilogram. - /// - /// Value assuming base unit JoulePerKilogram. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificEnergy(long joulesperkilogram) : this(Convert.ToDouble(joulesperkilogram), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit JoulePerKilogram. - /// - /// Value assuming base unit JoulePerKilogram. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificEnergy(decimal joulesperkilogram) : this(Convert.ToDouble(joulesperkilogram), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public SpecificEnergy(double joulesperkilogram) public static QuantityType QuantityType => QuantityType.SpecificEnergy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of SpecificEnergy, which is JoulePerKilogram. All conversions go via this value. /// public static SpecificEnergyUnit BaseUnit => SpecificEnergyUnit.JoulePerKilogram; @@ -565,12 +528,6 @@ public static SpecificEnergyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is JoulePerKilogram - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static SpecificEnergyUnit ToStringDefaultUnit { get; set; } = SpecificEnergyUnit.JoulePerKilogram; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 0794eb0c20..3842b05971 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -82,21 +82,11 @@ static SpecificEntropy() BaseDimensions = new BaseDimensions(2, 0, -2, 0, -1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit JoulePerKilogramKelvin. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public SpecificEntropy(double joulesperkilogramkelvin) - { - _value = Convert.ToDouble(joulesperkilogramkelvin); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public SpecificEntropy(double joulesperkilogramkelvin) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit JoulePerKilogramKelvin. - /// - /// Value assuming base unit JoulePerKilogramKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificEntropy(long joulesperkilogramkelvin) : this(Convert.ToDouble(joulesperkilogramkelvin), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit JoulePerKilogramKelvin. - /// - /// Value assuming base unit JoulePerKilogramKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificEntropy(decimal joulesperkilogramkelvin) : this(Convert.ToDouble(joulesperkilogramkelvin), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public SpecificEntropy(double joulesperkilogramkelvin) public static QuantityType QuantityType => QuantityType.SpecificEntropy; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of SpecificEntropy, which is JoulePerKilogramKelvin. All conversions go via this value. /// public static SpecificEntropyUnit BaseUnit => SpecificEntropyUnit.JoulePerKilogramKelvin; @@ -565,12 +528,6 @@ public static SpecificEntropyUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is JoulePerKilogramKelvin - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static SpecificEntropyUnit ToStringDefaultUnit { get; set; } = SpecificEntropyUnit.JoulePerKilogramKelvin; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index df6f9659e7..2f1280f0aa 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -82,21 +82,11 @@ static SpecificVolume() BaseDimensions = new BaseDimensions(3, -1, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit CubicMeterPerKilogram. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public SpecificVolume(double cubicmetersperkilogram) - { - _value = Convert.ToDouble(cubicmetersperkilogram); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public SpecificVolume(double cubicmetersperkilogram) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerKilogram. - /// - /// Value assuming base unit CubicMeterPerKilogram. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificVolume(long cubicmetersperkilogram) : this(Convert.ToDouble(cubicmetersperkilogram), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerKilogram. - /// - /// Value assuming base unit CubicMeterPerKilogram. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificVolume(decimal cubicmetersperkilogram) : this(Convert.ToDouble(cubicmetersperkilogram), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public SpecificVolume(double cubicmetersperkilogram) public static QuantityType QuantityType => QuantityType.SpecificVolume; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of SpecificVolume, which is CubicMeterPerKilogram. All conversions go via this value. /// public static SpecificVolumeUnit BaseUnit => SpecificVolumeUnit.CubicMeterPerKilogram; @@ -439,12 +402,6 @@ public static SpecificVolumeUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is CubicMeterPerKilogram - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static SpecificVolumeUnit ToStringDefaultUnit { get; set; } = SpecificVolumeUnit.CubicMeterPerKilogram; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index d693509480..339c20529d 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -82,21 +82,11 @@ static SpecificWeight() BaseDimensions = new BaseDimensions(-2, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit NewtonPerCubicMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public SpecificWeight(double newtonspercubicmeter) - { - _value = Convert.ToDouble(newtonspercubicmeter); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public SpecificWeight(double newtonspercubicmeter) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit NewtonPerCubicMeter. - /// - /// Value assuming base unit NewtonPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificWeight(long newtonspercubicmeter) : this(Convert.ToDouble(newtonspercubicmeter), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit NewtonPerCubicMeter. - /// - /// Value assuming base unit NewtonPerCubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - SpecificWeight(decimal newtonspercubicmeter) : this(Convert.ToDouble(newtonspercubicmeter), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public SpecificWeight(double newtonspercubicmeter) public static QuantityType QuantityType => QuantityType.SpecificWeight; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of SpecificWeight, which is NewtonPerCubicMeter. All conversions go via this value. /// public static SpecificWeightUnit BaseUnit => SpecificWeightUnit.NewtonPerCubicMeter; @@ -754,12 +717,6 @@ public static SpecificWeightUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is NewtonPerCubicMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static SpecificWeightUnit ToStringDefaultUnit { get; set; } = SpecificWeightUnit.NewtonPerCubicMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index a2fea1e2f5..1910b3ae57 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -82,21 +82,11 @@ static Speed() BaseDimensions = new BaseDimensions(1, 0, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit MeterPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Speed(double meterspersecond) - { - _value = Convert.ToDouble(meterspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Speed(double meterspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit MeterPerSecond. - /// - /// Value assuming base unit MeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Speed(long meterspersecond) : this(Convert.ToDouble(meterspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit MeterPerSecond. - /// - /// Value assuming base unit MeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Speed(decimal meterspersecond) : this(Convert.ToDouble(meterspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Speed(double meterspersecond) public static QuantityType QuantityType => QuantityType.Speed; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Speed, which is MeterPerSecond. All conversions go via this value. /// public static SpeedUnit BaseUnit => SpeedUnit.MeterPerSecond; @@ -1069,12 +1032,6 @@ public static SpeedUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is MeterPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static SpeedUnit ToStringDefaultUnit { get; set; } = SpeedUnit.MeterPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index c37f61723d..2ee2dd11d2 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -82,21 +82,11 @@ static Temperature() BaseDimensions = new BaseDimensions(0, 0, 0, 0, 1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit Kelvin. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Temperature(double kelvins) - { - _value = Convert.ToDouble(kelvins); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Temperature(double kelvins) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Kelvin. - /// - /// Value assuming base unit Kelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Temperature(long kelvins) : this(Convert.ToDouble(kelvins), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Kelvin. - /// - /// Value assuming base unit Kelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Temperature(decimal kelvins) : this(Convert.ToDouble(kelvins), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Temperature(double kelvins) public static QuantityType QuantityType => QuantityType.Temperature; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Temperature, which is Kelvin. All conversions go via this value. /// public static TemperatureUnit BaseUnit => TemperatureUnit.Kelvin; @@ -565,12 +528,6 @@ public static TemperatureUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Kelvin - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static TemperatureUnit ToStringDefaultUnit { get; set; } = TemperatureUnit.Kelvin; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 0e31c995ab..3fafb7743b 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -82,21 +82,11 @@ static TemperatureChangeRate() BaseDimensions = new BaseDimensions(0, 0, -1, 0, 1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit DegreeCelsiusPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public TemperatureChangeRate(double degreescelsiuspersecond) - { - _value = Convert.ToDouble(degreescelsiuspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public TemperatureChangeRate(double degreescelsiuspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit DegreeCelsiusPerSecond. - /// - /// Value assuming base unit DegreeCelsiusPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - TemperatureChangeRate(long degreescelsiuspersecond) : this(Convert.ToDouble(degreescelsiuspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit DegreeCelsiusPerSecond. - /// - /// Value assuming base unit DegreeCelsiusPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - TemperatureChangeRate(decimal degreescelsiuspersecond) : this(Convert.ToDouble(degreescelsiuspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public TemperatureChangeRate(double degreescelsiuspersecond) public static QuantityType QuantityType => QuantityType.TemperatureChangeRate; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of TemperatureChangeRate, which is DegreeCelsiusPerSecond. All conversions go via this value. /// public static TemperatureChangeRateUnit BaseUnit => TemperatureChangeRateUnit.DegreeCelsiusPerSecond; @@ -607,12 +570,6 @@ public static TemperatureChangeRateUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is DegreeCelsiusPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static TemperatureChangeRateUnit ToStringDefaultUnit { get; set; } = TemperatureChangeRateUnit.DegreeCelsiusPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 56b1174cea..8728ee1613 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -81,21 +81,11 @@ static TemperatureDelta() { } - /// - /// Creates the quantity with the given value in the base unit Kelvin. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public TemperatureDelta(double kelvins) - { - _value = Convert.ToDouble(kelvins); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public TemperatureDelta(double kelvins) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit Kelvin. - /// - /// Value assuming base unit Kelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - TemperatureDelta(long kelvins) : this(Convert.ToDouble(kelvins), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit Kelvin. - /// - /// Value assuming base unit Kelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - TemperatureDelta(decimal kelvins) : this(Convert.ToDouble(kelvins), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public TemperatureDelta(double kelvins) public static QuantityType QuantityType => QuantityType.TemperatureDelta; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of TemperatureDelta, which is Kelvin. All conversions go via this value. /// public static TemperatureDeltaUnit BaseUnit => TemperatureDeltaUnit.Kelvin; @@ -564,12 +527,6 @@ public static TemperatureDeltaUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is Kelvin - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static TemperatureDeltaUnit ToStringDefaultUnit { get; set; } = TemperatureDeltaUnit.Kelvin; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index a4e61e57a4..e433887e49 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -82,21 +82,11 @@ static ThermalConductivity() BaseDimensions = new BaseDimensions(1, 1, -3, 0, -1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit WattPerMeterKelvin. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ThermalConductivity(double wattspermeterkelvin) - { - _value = Convert.ToDouble(wattspermeterkelvin); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ThermalConductivity(double wattspermeterkelvin) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit WattPerMeterKelvin. - /// - /// Value assuming base unit WattPerMeterKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ThermalConductivity(long wattspermeterkelvin) : this(Convert.ToDouble(wattspermeterkelvin), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit WattPerMeterKelvin. - /// - /// Value assuming base unit WattPerMeterKelvin. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ThermalConductivity(decimal wattspermeterkelvin) : this(Convert.ToDouble(wattspermeterkelvin), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ThermalConductivity(double wattspermeterkelvin) public static QuantityType QuantityType => QuantityType.ThermalConductivity; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ThermalConductivity, which is WattPerMeterKelvin. All conversions go via this value. /// public static ThermalConductivityUnit BaseUnit => ThermalConductivityUnit.WattPerMeterKelvin; @@ -439,12 +402,6 @@ public static ThermalConductivityUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is WattPerMeterKelvin - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ThermalConductivityUnit ToStringDefaultUnit { get; set; } = ThermalConductivityUnit.WattPerMeterKelvin; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 85126307c8..9652cb4f1d 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -82,21 +82,11 @@ static ThermalResistance() BaseDimensions = new BaseDimensions(0, -1, 3, 0, 1, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit SquareMeterKelvinPerKilowatt. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public ThermalResistance(double squaremeterkelvinsperkilowatt) - { - _value = Convert.ToDouble(squaremeterkelvinsperkilowatt); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public ThermalResistance(double squaremeterkelvinsperkilowatt) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit SquareMeterKelvinPerKilowatt. - /// - /// Value assuming base unit SquareMeterKelvinPerKilowatt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ThermalResistance(long squaremeterkelvinsperkilowatt) : this(Convert.ToDouble(squaremeterkelvinsperkilowatt), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit SquareMeterKelvinPerKilowatt. - /// - /// Value assuming base unit SquareMeterKelvinPerKilowatt. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - ThermalResistance(decimal squaremeterkelvinsperkilowatt) : this(Convert.ToDouble(squaremeterkelvinsperkilowatt), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public ThermalResistance(double squaremeterkelvinsperkilowatt) public static QuantityType QuantityType => QuantityType.ThermalResistance; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of ThermalResistance, which is SquareMeterKelvinPerKilowatt. All conversions go via this value. /// public static ThermalResistanceUnit BaseUnit => ThermalResistanceUnit.SquareMeterKelvinPerKilowatt; @@ -502,12 +465,6 @@ public static ThermalResistanceUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is SquareMeterKelvinPerKilowatt - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static ThermalResistanceUnit ToStringDefaultUnit { get; set; } = ThermalResistanceUnit.SquareMeterKelvinPerKilowatt; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index f0d000fc2a..d0187fa896 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -82,21 +82,11 @@ static Torque() BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit NewtonMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Torque(double newtonmeters) - { - _value = Convert.ToDouble(newtonmeters); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Torque(double newtonmeters) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit NewtonMeter. - /// - /// Value assuming base unit NewtonMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Torque(long newtonmeters) : this(Convert.ToDouble(newtonmeters), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit NewtonMeter. - /// - /// Value assuming base unit NewtonMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Torque(decimal newtonmeters) : this(Convert.ToDouble(newtonmeters), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Torque(double newtonmeters) public static QuantityType QuantityType => QuantityType.Torque; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Torque, which is NewtonMeter. All conversions go via this value. /// public static TorqueUnit BaseUnit => TorqueUnit.NewtonMeter; @@ -838,12 +801,6 @@ public static TorqueUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is NewtonMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static TorqueUnit ToStringDefaultUnit { get; set; } = TorqueUnit.NewtonMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 1c1419845f..43a11b2394 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -81,21 +81,11 @@ static VitaminA() { } - /// - /// Creates the quantity with the given value in the base unit InternationalUnit. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public VitaminA(double internationalunits) - { - _value = Convert.ToDouble(internationalunits); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -108,33 +98,6 @@ public VitaminA(double internationalunits) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit InternationalUnit. - /// - /// Value assuming base unit InternationalUnit. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - VitaminA(long internationalunits) : this(Convert.ToDouble(internationalunits), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit InternationalUnit. - /// - /// Value assuming base unit InternationalUnit. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - VitaminA(decimal internationalunits) : this(Convert.ToDouble(internationalunits), BaseUnit) { } - #region Properties /// @@ -143,7 +106,7 @@ public VitaminA(double internationalunits) public static QuantityType QuantityType => QuantityType.VitaminA; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of VitaminA, which is InternationalUnit. All conversions go via this value. /// public static VitaminAUnit BaseUnit => VitaminAUnit.InternationalUnit; @@ -417,12 +380,6 @@ public static VitaminAUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is InternationalUnit - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static VitaminAUnit ToStringDefaultUnit { get; set; } = VitaminAUnit.InternationalUnit; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 05794e5cee..f4b37e14a4 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -82,21 +82,11 @@ static Volume() BaseDimensions = new BaseDimensions(3, 0, 0, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit CubicMeter. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public Volume(double cubicmeters) - { - _value = Convert.ToDouble(cubicmeters); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public Volume(double cubicmeters) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit CubicMeter. - /// - /// Value assuming base unit CubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Volume(long cubicmeters) : this(Convert.ToDouble(cubicmeters), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit CubicMeter. - /// - /// Value assuming base unit CubicMeter. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - Volume(decimal cubicmeters) : this(Convert.ToDouble(cubicmeters), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public Volume(double cubicmeters) public static QuantityType QuantityType => QuantityType.Volume; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of Volume, which is CubicMeter. All conversions go via this value. /// public static VolumeUnit BaseUnit => VolumeUnit.CubicMeter; @@ -1279,12 +1242,6 @@ public static VolumeUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is CubicMeter - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static VolumeUnit ToStringDefaultUnit { get; set; } = VolumeUnit.CubicMeter; - /// /// Get default string representation of value and unit. /// diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index feab95716d..80fa85e868 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -82,21 +82,11 @@ static VolumeFlow() BaseDimensions = new BaseDimensions(3, 0, -1, 0, 0, 0, 0); } - /// - /// Creates the quantity with the given value in the base unit CubicMeterPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public VolumeFlow(double cubicmeterspersecond) - { - _value = Convert.ToDouble(cubicmeterspersecond); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -109,33 +99,6 @@ public VolumeFlow(double cubicmeterspersecond) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerSecond. - /// - /// Value assuming base unit CubicMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - VolumeFlow(long cubicmeterspersecond) : this(Convert.ToDouble(cubicmeterspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerSecond. - /// - /// Value assuming base unit CubicMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - VolumeFlow(decimal cubicmeterspersecond) : this(Convert.ToDouble(cubicmeterspersecond), BaseUnit) { } - #region Properties /// @@ -144,7 +107,7 @@ public VolumeFlow(double cubicmeterspersecond) public static QuantityType QuantityType => QuantityType.VolumeFlow; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of VolumeFlow, which is CubicMeterPerSecond. All conversions go via this value. /// public static VolumeFlowUnit BaseUnit => VolumeFlowUnit.CubicMeterPerSecond; @@ -943,12 +906,6 @@ public static VolumeFlowUnit ParseUnit(string str) #endregion - /// - /// Set the default unit used by ToString(). Default is CubicMeterPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static VolumeFlowUnit ToStringDefaultUnit { get; set; } = VolumeFlowUnit.CubicMeterPerSecond; - /// /// Get default string representation of value and unit. /// diff --git a/UnitsNet.Tests/CustomCode/LengthTests.cs b/UnitsNet.Tests/CustomCode/LengthTests.cs index 875ba7dff8..6b24ef9e04 100644 --- a/UnitsNet.Tests/CustomCode/LengthTests.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.cs @@ -130,22 +130,16 @@ public void LengthTimesSpecificWeightEqualsPressure() [Fact] public void ToStringReturnsCorrectNumberAndUnitWithDefaultUnitWhichIsMeter() { - LengthUnit oldUnit = Length.ToStringDefaultUnit; - Length.ToStringDefaultUnit = LengthUnit.Meter; - Length meter = Length.FromMeters(5); + var meter = Length.FromMeters(5); string meterString = meter.ToString(); - Length.ToStringDefaultUnit = oldUnit; Assert.Equal("5 m", meterString); } [Fact] public void ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit() { - LengthUnit oldUnit = Length.ToStringDefaultUnit; - Length.ToStringDefaultUnit = LengthUnit.Centimeter; - Length value = Length.From(2, LengthUnit.Centimeter); + var value = Length.From(2, LengthUnit.Centimeter); string valueString = value.ToString(); - Length.ToStringDefaultUnit = oldUnit; Assert.Equal("2 cm", valueString); } @@ -159,8 +153,6 @@ public void MaxValueIsCorrectForUnitWithBaseTypeDouble() public void MinValueIsCorrectForUnitWithBaseTypeDouble() { Assert.Equal(double.MinValue, Length.MinValue.Meters); - } - - + } } } diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 3fb03de1a0..f19995b13e 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -188,7 +188,7 @@ public void TryParseLengthUnitAbbreviationSpecialCharacters(string s) { string abbrev = $"m{s}s"; - UnitSystem unitSystem = UnitSystem.GetCached(); + var unitSystem = UnitSystem.Default; unitSystem.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act @@ -217,7 +217,7 @@ public void TryParseLengthSpecialCharacters(string s) { string abbrev = $"m{s}s"; - UnitSystem unitSystem = UnitSystem.GetCached(); + var unitSystem = UnitSystem.Default; unitSystem.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act @@ -235,4 +235,4 @@ private static string AssertExceptionAndGetFullTypeName(Action code) } } -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/QuantityTests.Ctor.cs b/UnitsNet.Tests/QuantityTests.Ctor.cs index ff13b7293d..29892d21e4 100644 --- a/UnitsNet.Tests/QuantityTests.Ctor.cs +++ b/UnitsNet.Tests/QuantityTests.Ctor.cs @@ -66,28 +66,22 @@ public void CtorWithOnlyValueOfRepresentativeTypes_SetsValueToGivenValueAndUnitT { #pragma warning disable 618 // double types - Assert.Equal(5, new Mass(5L).Value); - Assert.Equal(5, new Mass(5d).Value); - Assert.Equal(5, new Mass(5m).Value); - Assert.Equal(MassUnit.Kilogram, new Mass(5L).Unit); - Assert.Equal(MassUnit.Kilogram, new Mass(5d).Unit); - Assert.Equal(MassUnit.Kilogram, new Mass(5m).Unit); + Assert.Equal(5, new Mass(5L, MassUnit.Kilogram).Value); + Assert.Equal(5, new Mass(5d, MassUnit.Kilogram).Value); + Assert.Equal(MassUnit.Kilogram, new Mass(5L, MassUnit.Kilogram).Unit); + Assert.Equal(MassUnit.Kilogram, new Mass(5d, MassUnit.Kilogram).Unit); // decimal types - Assert.Equal(5, new Information(5L).Value); - Assert.Equal(5, new Information(5d).Value); - Assert.Equal(5, new Information(5m).Value); - Assert.Equal(InformationUnit.Bit, new Information(5L).Unit); - Assert.Equal(InformationUnit.Bit, new Information(5d).Unit); - Assert.Equal(InformationUnit.Bit, new Information(5m).Unit); + Assert.Equal(5, new Information(5L, InformationUnit.Bit).Value); + Assert.Equal(5, new Information(5m, InformationUnit.Bit).Value); + Assert.Equal(InformationUnit.Bit, new Information(5L, InformationUnit.Bit).Unit); + Assert.Equal(InformationUnit.Bit, new Information(5m, InformationUnit.Bit).Unit); // logarithmic types - Assert.Equal(5, new Level(5L).Value); - Assert.Equal(5, new Level(5d).Value); - Assert.Equal(5, new Level(5m).Value); - Assert.Equal(LevelUnit.Decibel, new Level(5L).Unit); - Assert.Equal(LevelUnit.Decibel, new Level(5d).Unit); - Assert.Equal(LevelUnit.Decibel, new Level(5m).Unit); + Assert.Equal(5, new Level(5L, LevelUnit.Decibel).Value); + Assert.Equal(5, new Level(5d, LevelUnit.Decibel).Value); + Assert.Equal(LevelUnit.Decibel, new Level(5L, LevelUnit.Decibel).Unit); + Assert.Equal(LevelUnit.Decibel, new Level(5d, LevelUnit.Decibel).Unit); #pragma warning restore 618 } diff --git a/UnitsNet.Tests/QuantityTests.ToString.cs b/UnitsNet.Tests/QuantityTests.ToString.cs index bab0e87a31..d0cad78e31 100644 --- a/UnitsNet.Tests/QuantityTests.ToString.cs +++ b/UnitsNet.Tests/QuantityTests.ToString.cs @@ -48,19 +48,16 @@ public void CreatedByCtorWithValue_ReturnsValueInBaseUnit() { #pragma warning disable 618 // double types - Assert.Equal("5 kg", new Mass(5L).ToString()); - Assert.Equal("5 kg", new Mass(5d).ToString()); - Assert.Equal("5 kg", new Mass(5m).ToString()); + Assert.Equal("5 kg", new Mass(5L, MassUnit.Kilogram).ToString()); + Assert.Equal("5 kg", new Mass(5d, MassUnit.Kilogram).ToString()); // decimal types - Assert.Equal("5 b", new Information(5L).ToString()); - Assert.Equal("5 b", new Information(5d).ToString()); - Assert.Equal("5 b", new Information(5m).ToString()); + Assert.Equal("5 b", new Information(5L, InformationUnit.Bit).ToString()); + Assert.Equal("5 b", new Information(5m, InformationUnit.Bit).ToString()); // logarithmic types - Assert.Equal("5 dB", new Level(5L).ToString()); - Assert.Equal("5 dB", new Level(5d).ToString()); - Assert.Equal("5 dB", new Level(5m).ToString()); + Assert.Equal("5 dB", new Level(5L, LevelUnit.Decibel).ToString()); + Assert.Equal("5 dB", new Level(5d, LevelUnit.Decibel).ToString()); #pragma warning restore 618 } diff --git a/UnitsNet/CustomCode/Quantities/Density.extra.cs b/UnitsNet/CustomCode/Quantities/Density.extra.cs index d3ce59f41d..f49aa66054 100644 --- a/UnitsNet/CustomCode/Quantities/Density.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Density.extra.cs @@ -19,6 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using UnitsNet.Units; + // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -38,7 +40,7 @@ public partial struct Density /// public static Density FromMolarity(Molarity molarity, Mass molecularWeight) { - return new Density(molarity.MolesPerCubicMeter * molecularWeight.Kilograms); + return new Density(molarity.MolesPerCubicMeter * molecularWeight.Kilograms, DensityUnit.KilogramPerCubicMeter); } public static Molarity ToMolarity(Density density, Mass molecularWeight) diff --git a/UnitsNet/CustomCode/Quantities/Force.extra.cs b/UnitsNet/CustomCode/Quantities/Force.extra.cs index 86b3ed0711..925f36002d 100644 --- a/UnitsNet/CustomCode/Quantities/Force.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Force.extra.cs @@ -19,6 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using UnitsNet.Units; + // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -70,24 +72,24 @@ public static Force FromPressureByArea(Pressure p, Length2d area) { double metersSquared = area.Meters.X * area.Meters.Y; double newtons = p.Pascals * metersSquared; - return new Force(newtons); + return new Force(newtons, ForceUnit.Newton); } public static Force FromMassByAcceleration(Mass mass, double metersPerSecondSquared) { - return new Force(mass.Kilograms * metersPerSecondSquared); + return new Force(mass.Kilograms * metersPerSecondSquared, ForceUnit.Newton); } #endif public static Force FromPressureByArea(Pressure p, Area area) { double newtons = p.Pascals * area.SquareMeters; - return new Force(newtons); + return new Force(newtons, ForceUnit.Newton); } public static Force FromMassByAcceleration(Mass mass, Acceleration acceleration) { - return new Force(mass.Kilograms * acceleration.MetersPerSecondSquared); + return new Force(mass.Kilograms * acceleration.MetersPerSecondSquared, ForceUnit.Newton); } } } diff --git a/UnitsNet/CustomCode/Quantities/Mass.extra.cs b/UnitsNet/CustomCode/Quantities/Mass.extra.cs index c6e95535ba..d3bcb95044 100644 --- a/UnitsNet/CustomCode/Quantities/Mass.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Mass.extra.cs @@ -43,7 +43,7 @@ public partial struct Mass { public static Mass FromGravitationalForce(Force f) { - return new Mass(f.KilogramsForce); + return new Mass(f.KilogramsForce, MassUnit.Kilogram); } /// diff --git a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs index ec0234a55c..fed00fd718 100644 --- a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs @@ -42,7 +42,7 @@ public partial struct Temperature /// The new temperature. public static Temperature operator +(Temperature left, TemperatureDelta right) { - return new Temperature(left.Kelvins + right.Kelvins); + return new Temperature(left.Kelvins + right.Kelvins, TemperatureUnit.Kelvin); } /// @@ -52,7 +52,7 @@ public partial struct Temperature /// The new temperature. public static Temperature operator +(TemperatureDelta left, Temperature right) { - return new Temperature(left.Kelvins + right.Kelvins); + return new Temperature(left.Kelvins + right.Kelvins, TemperatureUnit.Kelvin); } /// @@ -62,7 +62,7 @@ public partial struct Temperature /// The new temperature. public static Temperature operator -(Temperature left, TemperatureDelta right) { - return new Temperature(left.Kelvins - right.Kelvins); + return new Temperature(left.Kelvins - right.Kelvins, TemperatureUnit.Kelvin); } /// @@ -72,7 +72,7 @@ public partial struct Temperature /// The delta temperature (difference). public static TemperatureDelta operator -(Temperature left, Temperature right) { - return new TemperatureDelta(left.Kelvins - right.Kelvins); + return new TemperatureDelta(left.Kelvins - right.Kelvins, TemperatureDeltaUnit.Kelvin); } #endif diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs index ce253110bc..96480fe653 100644 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ b/UnitsNet/CustomCode/UnitSystem.cs @@ -170,19 +170,6 @@ public static void ClearCache() /// public static UnitSystem Default { get; } - /// - /// Get or create a unit system for parsing and presenting numbers, units and abbreviations. - /// Creating can be a little expensive, so it will use a static cache. - /// To always create, use the constructor. - /// - /// - [PublicAPI] - [Obsolete("Use Default property instead. This will be removed in the future.")] - public static UnitSystem GetCached() - { - return GetCached((CultureInfo) null); - } - /// /// Get or create a unit system for parsing and presenting numbers, units and abbreviations. /// Creating can be a little expensive, so it will use a static cache. diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 0e89ea1a12..abc8b531d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 86d4278cd0..54dae240ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index e0fa81cd5d..3890d65c81 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -206,22 +206,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 51753db5d2..8ee77fbb07 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 41bfe2d46f..7126014656 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 992613a95a..e7f3876a00 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index a4bfa9e295..4a78728771 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 6b09e42eac..68ea82e0ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index d036010068..b6deeba9b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index cff763ba49..547a014d6b 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 37117d872c..e8b48451a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index aadea1f0ba..5f78a6bec7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index c6f7ba50ad..c660c1fc01 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index a79dbc61c0..208ff3b97b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index d9ce2d1c0f..f3fa49c89b 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index e3b6f3a675..cb31364683 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index 3b730d7636..18efe4a0e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 8acc8b5ae7..fcc03c55ad 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 070ece5b15..238030bc1d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 6ce3b2e513..d47b82afee 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 8871210be8..6cf9b5f786 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 3539d817cb..3956dc8a2f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index a6c8c1147b..90a87f9049 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index ebe7da9c35..9940a9a992 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index fd65f779ff..66dfef16a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index 5274b4408b..5b8a4309e4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index 1cc663ba20..53d6878b7e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 27cca700b0..da8f5b3231 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index 3e8a9c21ab..4bff291ea6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index d99910acb6..6ae294b97f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index df820fd0f7..4468aad936 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index fed433b0eb..bc266dc27e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index fea2fa4acf..b5bbff6bcc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index c61e9c3e84..5e0d1e5d3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 7ab074def9..0534685498 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 7bb6f55ee9..9a999adabd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 84ecd3f8ba..e0c935debc 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 8108210b8e..516718c8e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index bd3a431902..3e1f7708ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 7a9bd15f06..2265ac0dbf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index dfdc82a528..5ac0ef7f64 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 14e0412c7e..1a0600987e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index df4c9fa5ea..ef81f91a07 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index bfb092ff67..2a9f9695bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 555d9d433c..632c724111 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index cbefbe65ed..20bbc116f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -206,22 +206,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index fcb1d06321..67e7de580b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index d14b4ee9e4..dd2ffe5259 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index c26523eddc..f332edb8c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 067cea1f87..21e4d7a9dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 4422776439..be07962f89 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 3ca49af665..20a2249692 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 86076f6624..cccaf87614 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index bf68b78921..d92936439f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index db65fd8e30..6855724183 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index aefa2e81c8..4fc2841028 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 80d8afb19f..dd077c86a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 41d856b93b..4987e0c2a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 52f9603a76..4c3e986d9d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 2d95d42b4a..b096e85cf6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 81e66bc7d2..ecfb4bf5e7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 07356c0d81..d930b75949 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index c2829747c5..721c0ef565 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 215fba3ef2..34b054f58f 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 53e5e4ec00..ef8cf7fc52 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -206,22 +206,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 1591939f2f..40355b473d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 4f19dd87ed..b7dc931e94 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 8598f87910..07a1bb1ad7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index db75cedd3d..3314c26a6d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index a65bfc0bdc..d5c83bcffb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index e61be585d8..53e9edc9f6 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 8bb5adb58f..82d86893a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index cb5e6ae90a..5beaf16d7c 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index f25f52cf57..dd8a972bca 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index f5b2911984..39f9dc61f1 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 1b8bfa30e4..67664903ea 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 9bb56976fc..7e46ea987f 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 515e44ad2e..d349ad6dd4 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 8c5f837d8c..5861072703 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 1e0b626c3b..e78bec0850 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index c723d62da2..88b6e2fdd2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -159,22 +159,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index ffbe4cf16a..097b196638 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index e5bdee0b8d..d0ba85a536 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 79852a7b14..d92ac63a00 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 5852961f37..cbd790f6d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 997983261d..ac4440d46c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 940e7bf0b6..f0d88a1f5b 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 81e0f4c884..d1b6fe24ea 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 144be8f24b..72394a97d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -198,22 +198,6 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// diff --git a/UnitsNet/Length2d.cs b/UnitsNet/Length2d.cs index e3e19d7c04..0eed30364d 100644 --- a/UnitsNet/Length2d.cs +++ b/UnitsNet/Length2d.cs @@ -197,7 +197,7 @@ public static Length2d FromMillimeters(double xMillimeters, double yMillimeters) public override string ToString() { return - $"({X.Meters:0.##}, {Y.Meters:0.##}) {UnitSystem.GetCached().GetDefaultAbbreviation(LengthUnit.Meter)}"; + $"({X.Meters:0.##}, {Y.Meters:0.##}) {UnitSystem.Default.GetDefaultAbbreviation(LengthUnit.Meter)}"; } public Length DistanceTo(Length2d other) @@ -257,4 +257,4 @@ public int GetHashCode(Length2d obj) #endregion } #endif -} \ No newline at end of file +} diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 7f15f8d5e7..020ede7da5 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -137,21 +137,11 @@ if ($obsoleteAttribute) @" } - /// - /// Creates the quantity with the given value in the base unit $baseUnitSingularName. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public $quantityName(double $baseUnitPluralNameLower) - { - _value = $convertToBaseType($baseUnitPluralNameLower); - _unit = BaseUnit; - } - /// /// Creates the quantity with the given numeric value and unit. /// /// Numeric value. - /// Unit representation. + /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP private @@ -164,33 +154,6 @@ if ($obsoleteAttribute) _unit = unit; } - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit $baseUnitSingularName. - /// - /// Value assuming base unit $baseUnitSingularName. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - $quantityName(long $baseUnitPluralNameLower) : this($convertToBaseType($baseUnitPluralNameLower), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit $baseUnitSingularName. - /// - /// Value assuming base unit $baseUnitSingularName. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - $quantityName(decimal $baseUnitPluralNameLower) : this($convertToBaseType($baseUnitPluralNameLower), BaseUnit) { } - #region Properties /// @@ -199,7 +162,7 @@ if ($obsoleteAttribute) public static QuantityType QuantityType => QuantityType.$quantityName; /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. + /// The base unit of $quantityName, which is $baseUnitSingularName. All conversions go via this value. /// public static $unitEnumName BaseUnit => $unitEnumName.$baseUnitSingularName; @@ -498,12 +461,6 @@ if ($obsoleteAttribute) #endregion - /// - /// Set the default unit used by ToString(). Default is $baseUnitSingularName - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static $unitEnumName ToStringDefaultUnit { get; set; } = $unitEnumName.$baseUnitSingularName; - /// /// Get default string representation of value and unit. /// diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 128543bb3f..b5caab6a7f 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -246,22 +246,6 @@ namespace UnitsNet } } - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) - { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); - } - /// /// Parse a unit string. /// From c64a697db4f0f228a5a9e0571eb1457f1a370a39 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 28 Sep 2018 12:05:42 -0400 Subject: [PATCH 008/131] Changing target frameworks to .NET standard 2.0 and .NET 4.0 (#488) * Changing target frameworks to .NET standard 2.0 and .NET 4.0 * Updating build script --- Build/build-functions.psm1 | 2 +- .../UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj | 2 +- .../UnitsNet.Serialization.JsonNet.Tests.csproj | 2 +- .../UnitsNet.Serialization.JsonNet.Common.props | 4 +--- UnitsNet.Tests/UnitsNet.Tests.csproj | 2 +- UnitsNet/UnitsNet.Common.props | 4 +--- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Build/build-functions.psm1 b/Build/build-functions.psm1 index 25183af774..4dbafc9785 100644 --- a/Build/build-functions.psm1 +++ b/Build/build-functions.psm1 @@ -68,7 +68,7 @@ function Start-Tests { # https://github.com/xunit/xunit/issues/1216 push-location $projectDir # -nobuild <-- this gives an error, but might want to use this to avoid extra builds - dotnet xunit -configuration Release -framework netcoreapp1.1 -xml $reportFile -nobuild + dotnet xunit -configuration Release -framework netcoreapp2.0 -xml $reportFile -nobuild if ($lastexitcode -ne 0) { exit 1 } pop-location } diff --git a/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj b/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj index 8eef57f2ab..bac5624720 100644 --- a/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj +++ b/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj @@ -1,7 +1,7 @@ - netcoreapp1.1 + netcoreapp2.0 UnitsNet.Serialization.JsonNet.CompatibilityTests diff --git a/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj b/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj index 95c2d6467d..e019de3970 100644 --- a/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj +++ b/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 UnitsNet.Serialization.JsonNet.Tests diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props index 5cc1cb1d6f..23366732b6 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props @@ -20,10 +20,8 @@ - netstandard1.0;net35;net40 + netstandard2.0;net40 UnitsNet.Serialization.JsonNet - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client CS1701;CS1702;CS1705;CS0618 diff --git a/UnitsNet.Tests/UnitsNet.Tests.csproj b/UnitsNet.Tests/UnitsNet.Tests.csproj index 132a701a43..42ac56c225 100644 --- a/UnitsNet.Tests/UnitsNet.Tests.csproj +++ b/UnitsNet.Tests/UnitsNet.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 UnitsNet.Tests CS1701;CS1702;CS1705;CS0618 diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index db9043e866..daf4122a7e 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -20,10 +20,8 @@ - netstandard1.0;net35;net40 + netstandard2.0;net40 UnitsNet - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client CS1701;CS1702;CS1705;CS0618;CS0809 From f42b4914a0083ffaebb5e3a6c0a78344b2962440 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:12:35 +0200 Subject: [PATCH 009/131] appveyor: Remove environment.api_key This is no longer used, was used when manually deploying nugets with scripts. --- appveyor.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9c0b403bd4..c0113b0db0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,9 +43,6 @@ test: off artifacts: - path: Artifacts\UnitsNet.zip - path: 'Artifacts\NuGet\*.nupkg' # find all NuGet packages recursively -environment: - api_key: - secure: NlJ+D6kXfgU6RgRuf9okylLDENp8DA3tTRSC6UHBNbRS9ZAvRrC3Z0++Mr5VtGvz deploy: - provider: NuGet api_key: @@ -53,4 +50,3 @@ deploy: skip_symbols: false on: branch: master - From 4d4800033a764dec0e357d38add842a22b745fed Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:13:12 +0200 Subject: [PATCH 010/131] appveyor: Publish nuget on v4 branch --- appveyor.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index c0113b0db0..19835181b9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,3 +50,9 @@ deploy: skip_symbols: false on: branch: master +- provider: NuGet + api_key: + secure: NlJ+D6kXfgU6RgRuf9okylLDENp8DA3tTRSC6UHBNbRS9ZAvRrC3Z0++Mr5VtGvz + skip_symbols: false + on: + branch: v4 From 4b6acb4d904dd6fa0f9d5fb66454aa48d2b4713d Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:19:59 +0200 Subject: [PATCH 011/131] UnitsNet: 4.0.0-alpha2 --- .../UnitsNet.WindowsRuntimeComponent.nuspec | 2 +- UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs | 4 ++-- UnitsNet/UnitsNet.Common.props | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec index 51141ed5a7..b5320f1eb6 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec @@ -2,7 +2,7 @@ UnitsNet.WindowsRuntimeComponent - 4.0.0-alpha1 + 4.0.0-alpha2 Units.NET - Windows Runtime Component Andreas Gullberg Larsen Andreas Gullberg Larsen diff --git a/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs b/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs index 4bfa15e002..e7d2f1a458 100644 --- a/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs +++ b/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs @@ -38,6 +38,6 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("")] -[assembly: AssemblyVersion("4.0.0")] -[assembly: AssemblyFileVersion("4.0.0")] +[assembly: AssemblyVersion("4.0.0-alpha2")] +[assembly: AssemblyFileVersion("4.0.0-alpha2")] [assembly: InternalsVisibleTo("UnitsNet.WindowsRuntimeComponent.Tests")] diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index daf4122a7e..d20ff29414 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -2,7 +2,7 @@ UnitsNet - 4.0.0-alpha1 + 4.0.0-alpha2 Andreas Gullberg Larsen Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. From 77cb3612060d052ea2c2f2e4d9de0cd70ea2b0bb Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:20:07 +0200 Subject: [PATCH 012/131] JsonNet: 4.0.0-alpha2 --- .../UnitsNet.Serialization.JsonNet.Common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props index 23366732b6..83cc771cca 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props @@ -2,7 +2,7 @@ UnitsNet.Serialization.JsonNet - 4.0.0-alpha1 + 4.0.0-alpha2 Andreas Gullberg Larsen Units.NET Serialization with Json.NET A helper library for serializing and deserializing types in Units.NET using Json.NET. From a1ba3b925eee9aa101ee2ad3ef7d8d31bde0a199 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:20:58 +0200 Subject: [PATCH 013/131] Fix script to bump suffix version It incorrectly bumped from -alpha1 to -alpha12. --- Build/set-version.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build/set-version.psm1 b/Build/set-version.psm1 index 523aa60c8f..9d4fd96bbc 100644 --- a/Build/set-version.psm1 +++ b/Build/set-version.psm1 @@ -107,7 +107,7 @@ function BumpSuffix([string] $oldSuffix) { # Example: # -alpha => -alpha2 # -alpha1 => -alpha2 - $match = [regex]::Match($oldSuffix, '^-(\w+)(\d+)?$'); + $match = [regex]::Match($oldSuffix, '^-([a-zA-Z]+)(\d+)?$'); $oldSuffix = $match.Groups[1].Value $numberGroup = $match.Groups[2] @@ -150,4 +150,4 @@ function Resolve-Error ($ErrorRecord=$Error[0]) } } -export-modulemember -function Get-NewProjectVersion, Set-ProjectVersion, Set-AssemblyInfoVersion, Invoke-CommitAndTagVersion, Set-NuspecVersion \ No newline at end of file +export-modulemember -function Get-NewProjectVersion, Set-ProjectVersion, Set-AssemblyInfoVersion, Invoke-CommitAndTagVersion, Set-NuspecVersion From 1db7ac7c045c8696263dd1c3a37ce08c681b18b8 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:39:31 +0200 Subject: [PATCH 014/131] Do not use suffix in assembly version 4.0.0-alpha1 not a valid assembly version or file version. --- Build/set-version.psm1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Build/set-version.psm1 b/Build/set-version.psm1 index 9d4fd96bbc..fabb3b3efe 100644 --- a/Build/set-version.psm1 +++ b/Build/set-version.psm1 @@ -48,6 +48,8 @@ function Set-ProjectVersion([string] $file, [string] $version) { } function Set-AssemblyInfoVersion([string] $file, [string] $version) { + # Strip out any suffix: "4.0.0-alpha1" => "4.0.0" + $version = $version.Split('-')[0] Write-Host "$file -> $version" (Get-Content $file) -replace 'Assembly(File)?Version\(".*?"\)', "Assembly`$1Version(`"$version`")" | Set-Content $file } From 5a5d66357b76ab8295298e7ad6ad3a30da9a2871 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:51:07 +0200 Subject: [PATCH 015/131] UnitsNet: 4.0.0-alpha3 --- .../UnitsNet.WindowsRuntimeComponent.nuspec | 2 +- UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs | 4 ++-- UnitsNet/UnitsNet.Common.props | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec index b5320f1eb6..a2363d3b6b 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec @@ -2,7 +2,7 @@ UnitsNet.WindowsRuntimeComponent - 4.0.0-alpha2 + 4.0.0-alpha3 Units.NET - Windows Runtime Component Andreas Gullberg Larsen Andreas Gullberg Larsen diff --git a/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs b/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs index e7d2f1a458..4bfa15e002 100644 --- a/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs +++ b/UnitsNet/Properties/AssemblyInfo.WindowsRuntimeComponent.cs @@ -38,6 +38,6 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("")] -[assembly: AssemblyVersion("4.0.0-alpha2")] -[assembly: AssemblyFileVersion("4.0.0-alpha2")] +[assembly: AssemblyVersion("4.0.0")] +[assembly: AssemblyFileVersion("4.0.0")] [assembly: InternalsVisibleTo("UnitsNet.WindowsRuntimeComponent.Tests")] diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index d20ff29414..368da42cdc 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -2,7 +2,7 @@ UnitsNet - 4.0.0-alpha2 + 4.0.0-alpha3 Andreas Gullberg Larsen Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. From 74554718e0fe05af219e6a3e227cc4479f9a7148 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 18:51:13 +0200 Subject: [PATCH 016/131] JsonNet: 4.0.0-alpha3 --- .../UnitsNet.Serialization.JsonNet.Common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props index 83cc771cca..3869e8bb9b 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props @@ -2,7 +2,7 @@ UnitsNet.Serialization.JsonNet - 4.0.0-alpha2 + 4.0.0-alpha3 Andreas Gullberg Larsen Units.NET Serialization with Json.NET A helper library for serializing and deserializing types in Units.NET using Json.NET. From ab5e33f72ac391edd8fa5b9ca642e98b94ae311b Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 21:29:42 +0200 Subject: [PATCH 017/131] Log msbuild live to AppVeyor and to log file --- Build/build-functions.psm1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Build/build-functions.psm1 b/Build/build-functions.psm1 index 4dbafc9785..26e864b502 100644 --- a/Build/build-functions.psm1 +++ b/Build/build-functions.psm1 @@ -28,7 +28,13 @@ function Update-GeneratedCode { function Start-Build([boolean] $skipUWP = $false) { write-host -foreground blue "Start-Build...`n---" - dotnet build --configuration Release "$root\UnitsNet.sln" + + $msbuildFileLogger = "/l:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.msbuild.log" + + $appVeyorMsbuildLogger = "C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll" + $appVeyorLogger = if (Test-Path "$appVeyorMsbuildLogger") { "/l:$appVeyorMsbuildLogger" } else { "" } + + dotnet build --configuration Release "$root\UnitsNet.sln" $msbuildFileLogger $appVeyorLogger if ($lastexitcode -ne 0) { exit 1 } if ($skipUWP -eq $true) @@ -37,11 +43,12 @@ function Start-Build([boolean] $skipUWP = $false) { } else { + $msbuildFileLogger = "/l:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.WindowsRuntimeComponent.msbuild.log" # dontnet CLI does not support WindowsRuntimeComponent project type yet # msbuild does not auto-restore nugets for this project type write-host -foreground yellow "WindowsRuntimeComponent project not yet supported by dotnet CLI, using MSBuild15 instead" & "$msbuild" "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release /t:restore - & "$msbuild" "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release + & "$msbuild" "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release $msbuildFileLogger $appVeyorLogger if ($lastexitcode -ne 0) { exit 1 } } @@ -56,7 +63,7 @@ function Start-Tests { ) # Parent dir must exist before xunit tries to write files to it - new-item -type directory $testReportDir 1> $null + new-item -type directory -force $testReportDir 1> $null write-host -foreground blue "Run tests...`n---" foreach ($projectPath in $projectPaths) { From ebeaa6cd60c706fd16c90de292dd8391a43493a9 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 21:51:21 +0200 Subject: [PATCH 018/131] Fix some warnings about missing xmldoc Too many to fix right now. --- UnitsNet/AmbiguousUnitParseException.cs | 17 +++- UnitsNet/BaseDimensions.cs | 46 +++++++++- UnitsNet/Comparison.cs | 88 +++++++++++-------- UnitsNet/ComparisonType.cs | 13 ++- .../Extensions/MolarityExtensions.cs | 14 ++- .../Quantities/Acceleration.extra.cs | 9 +- 6 files changed, 133 insertions(+), 54 deletions(-) diff --git a/UnitsNet/AmbiguousUnitParseException.cs b/UnitsNet/AmbiguousUnitParseException.cs index 22e6b00489..c59a5a5e12 100644 --- a/UnitsNet/AmbiguousUnitParseException.cs +++ b/UnitsNet/AmbiguousUnitParseException.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,9 +20,16 @@ // THE SOFTWARE. using System; +using UnitsNet.Units; namespace UnitsNet { + /// + /// Unable to parse because more than one unit of the given quantity type had this exact unit abbreviation. + /// Example: Length.Parse("1 pt") will throw , because both + /// and + /// have "pt" as their abbreviation. + /// #if WINDOWS_UWP internal #else @@ -30,14 +37,16 @@ namespace UnitsNet #endif class AmbiguousUnitParseException : UnitsNetException { + /// public AmbiguousUnitParseException(string message) : base(message) { HResult = 2; } + /// public AmbiguousUnitParseException(string message, Exception innerException) : base(message, innerException) { HResult = 2; } } -} \ No newline at end of file +} diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 8fd78eb208..79162dbff1 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -29,6 +29,7 @@ namespace UnitsNet /// public sealed class BaseDimensions { + /// public BaseDimensions(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) { Length = length; @@ -40,6 +41,7 @@ public BaseDimensions(int length, int mass, int time, int current, int temperatu LuminousIntensity = luminousIntensity; } + /// public override bool Equals(object obj) { if(obj is null || !(obj is BaseDimensions)) @@ -56,6 +58,7 @@ public override bool Equals(object obj) LuminousIntensity == baseDimensionsObj.LuminousIntensity; } + /// public override int GetHashCode() { int hash = 17; @@ -69,6 +72,11 @@ public override int GetHashCode() return hash; } + /// + /// Get resulting dimensions after multiplying two dimensions, by performing addition of each dimension. + /// + /// Other dimensions. + /// Resulting dimensions. public BaseDimensions Multiply(BaseDimensions right) { return new BaseDimensions( @@ -81,6 +89,11 @@ public BaseDimensions Multiply(BaseDimensions right) LuminousIntensity + right.LuminousIntensity); } + /// + /// Get resulting dimensions after dividing two dimensions, by performing subtraction of each dimension. + /// + /// Other dimensions. + /// Resulting dimensions. public BaseDimensions Divide(BaseDimensions right) { return new BaseDimensions( @@ -94,27 +107,52 @@ public BaseDimensions Divide(BaseDimensions right) } #if !WINDOWS_UWP + /// + /// Check if two dimensions are equal. + /// + /// Left. + /// Right. + /// True if equal. public static bool operator ==(BaseDimensions left, BaseDimensions right) { return left.Equals(right); } - + + /// + /// Check if two dimensions are unequal. + /// + /// Left. + /// Right. + /// True if not equal. public static bool operator !=(BaseDimensions left, BaseDimensions right) { return !( left == right ); } + /// + /// Multiply two dimensions. + /// + /// Left. + /// Right. + /// Resulting dimensions. public static BaseDimensions operator *(BaseDimensions left, BaseDimensions right) { return left.Multiply(right); } + /// + /// Divide two dimensions. + /// + /// Left. + /// Right. + /// Resulting dimensions. public static BaseDimensions operator /(BaseDimensions left, BaseDimensions right) { return left.Divide(right); } #endif + /// public override string ToString() { var sb = new StringBuilder(); diff --git a/UnitsNet/Comparison.cs b/UnitsNet/Comparison.cs index ad3b781afb..acf4add944 100644 --- a/UnitsNet/Comparison.cs +++ b/UnitsNet/Comparison.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -23,45 +23,56 @@ namespace UnitsNet { + /// + /// Helper methods to perform relative and absolute comparison. + /// public static class Comparison { /// /// - /// Checks if two values are equal with a given relative or absolute tolerance. + /// Checks if two values are equal with a given relative or absolute tolerance. /// /// - /// Relative tolerance is defined as the maximum allowable absolute difference between and - /// as a percentage of . A relative tolerance of 0.01 means the - /// absolute difference of and must be within +/- 1%. - /// - /// In this example, the two values will be equal if the value of b is within +/- 1% of a. - /// + /// Relative tolerance is defined as the maximum allowable absolute difference between + /// and + /// as a percentage of . A relative tolerance of + /// 0.01 means the + /// absolute difference of and must be within +/- + /// 1%. + /// + /// In this example, the two values will be equal if the value of b is within +/- 1% of a. + /// /// Equals(a, b, 0.01, ComparisonType.Relative); /// - /// + /// /// /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between and - /// as a fixed number. - /// - /// In this example, the two values will be equal if abs( - ) <= 0.01 - /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between + /// and + /// as a fixed number. + /// + /// In this example, the two values will be equal if abs( - + /// ) <= 0.01 + /// /// Equals(a, b, 0.01, ComparisonType.Absolute); /// - /// + /// /// /// - /// The reference value. If using relative tolerance, it is the value which the relative tolerance will be calculated against. + /// + /// The reference value. If using relative tolerance, it is the value which the relative + /// tolerance will be calculated against. + /// /// The value to compare to. /// The absolute or relative tolerance value. Must be greater than or equal to 0. /// Whether the tolerance is absolute or relative. /// public static bool Equals(double referenceValue, double otherValue, double tolerance, ComparisonType comparisonType) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0"); - switch(comparisonType) + switch (comparisonType) { case ComparisonType.Relative: return EqualsRelative(referenceValue, otherValue, tolerance); @@ -75,15 +86,18 @@ public static bool Equals(double referenceValue, double otherValue, double toler /// /// Checks if two values are equal with a given relative tolerance. /// - /// Relative tolerance is defined as the maximum allowable absolute difference between and - /// as a percentage of . A relative tolerance of 0.01 means the - /// absolute difference of and must be within +/- 1%. - /// - /// In this example, the two values will be equal if the value of b is within +/- 1% of a. - /// + /// Relative tolerance is defined as the maximum allowable absolute difference between + /// and + /// as a percentage of . A relative tolerance of + /// 0.01 means the + /// absolute difference of and must be within +/- + /// 1%. + /// + /// In this example, the two values will be equal if the value of b is within +/- 1% of a. + /// /// EqualsRelative(a, b, 0.01); /// - /// + /// /// /// /// The reference value which the tolerance will be calculated against. @@ -92,24 +106,26 @@ public static bool Equals(double referenceValue, double otherValue, double toler /// True if the two values are equal within the given relative tolerance, otherwise false. public static bool EqualsRelative(double referenceValue, double otherValue, double tolerance) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0"); - double maxVariation = Math.Abs(referenceValue * tolerance); + var maxVariation = Math.Abs(referenceValue * tolerance); return Math.Abs(referenceValue - otherValue) <= maxVariation; } /// /// Checks if two values are equal with a given absolute tolerance. /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between and - /// as a fixed number. - /// - /// In this example, the two values will be equal if abs( - ) <= 0.01 - /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between + /// and + /// as a fixed number. + /// + /// In this example, the two values will be equal if abs( - + /// ) <= 0.01 + /// /// Equals(a, b, 0.01, ComparisonType.Absolute); /// - /// + /// /// /// /// The first value. @@ -118,7 +134,7 @@ public static bool EqualsRelative(double referenceValue, double otherValue, doub /// True if the two values are equal within the given absolute tolerance, otherwise false. public static bool EqualsAbsolute(double value1, double value2, double tolerance) { - if(tolerance < 0) + if (tolerance < 0) throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0"); return Math.Abs(value1 - value2) <= tolerance; diff --git a/UnitsNet/ComparisonType.cs b/UnitsNet/ComparisonType.cs index 5d9a35ec1e..978de56398 100644 --- a/UnitsNet/ComparisonType.cs +++ b/UnitsNet/ComparisonType.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -26,7 +26,14 @@ namespace UnitsNet /// public enum ComparisonType { + /// + /// Error margin in relative size to a reference value. + /// Relative, + + /// + /// Error margin as absolute size. + /// Absolute } } diff --git a/UnitsNet/CustomCode/Extensions/MolarityExtensions.cs b/UnitsNet/CustomCode/Extensions/MolarityExtensions.cs index a33b9d1888..98cecee7f0 100644 --- a/UnitsNet/CustomCode/Extensions/MolarityExtensions.cs +++ b/UnitsNet/CustomCode/Extensions/MolarityExtensions.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,11 +21,17 @@ namespace UnitsNet.CustomCode.Extensions { + /// + /// Extensions for . + /// public static class MolarityExtensions { + /// + /// Get from . + /// public static Density ToDensity(this Molarity molarity, Mass molecularWeight) { return Molarity.ToDensity(molarity, molecularWeight); } } -} \ No newline at end of file +} diff --git a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs index 1470046b6a..612340536c 100644 --- a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -32,6 +32,9 @@ public partial struct Acceleration { // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP + /// + /// Multiply and to get . + /// public static SpecificWeight operator *(Acceleration acceleration, Density density) { return new SpecificWeight(acceleration.MetersPerSecondSquared * density.KilogramsPerCubicMeter, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); From 5e8ac05903ad041a2560f4d45d0a3e7e88428451 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 22:03:10 +0200 Subject: [PATCH 019/131] Ignore thousands of warnings about no xml doc We should address this, but right now this is just a big distraction and spam. Added issue to look at this later: https://github.com/angularsen/UnitsNet/issues/495 --- .../UnitsNet.WindowsRuntimeComponent.csproj | 2 +- UnitsNet/UnitsNet.Common.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj index 2b47b9e076..645817f4cf 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj @@ -18,7 +18,7 @@ {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} false ..\Artifacts\UnitsNet.WindowsRuntimeComponent - CS1701;CS1702;CS1705;CS0618;CS0809;2008 + CS1701;CS1702;CS1705;CS0618;CS0809;CS1591 AnyCPU diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index 368da42cdc..6d02af829d 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -22,7 +22,7 @@ netstandard2.0;net40 UnitsNet - CS1701;CS1702;CS1705;CS0618;CS0809 + CS1701;CS1702;CS1705;CS0618;CS0809;CS1591 From 407e72b4cc921fb7fe73075a2bf3decbc8e9bb7a Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 28 Sep 2018 16:42:44 -0400 Subject: [PATCH 020/131] Fix SingularName for some units in VolumeFlow (#494) * Fix SingularName for some units in VolumeFlow * On second thought, MillionUsGallonsPerDay is appropiate since millions already defines a plurality --- .../Quantities/VolumeFlow.Common.g.cs | 120 +++++++------- Common/UnitDefinitions/VolumeFlow.json | 20 +-- .../GeneratedCode/VolumeFlowTestsBase.g.cs | 150 +++++++++--------- UnitsNet.Tests/UnitSystemTests.cs | 2 +- .../GeneratedCode/UnitSystem.Default.g.cs | 30 ++-- .../GeneratedCode/Units/VolumeFlowUnit.g.cs | 30 ++-- 6 files changed, 176 insertions(+), 176 deletions(-) diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 80fa85e868..6d1309ae28 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -127,7 +127,7 @@ public static BaseDimensions BaseDimensions /// /// Get VolumeFlow in CentilitersPerMinute. /// - public double CentilitersPerMinute => As(VolumeFlowUnit.CentilitersPerMinute); + public double CentilitersPerMinute => As(VolumeFlowUnit.CentiliterPerMinute); /// /// Get VolumeFlow in CubicDecimetersPerMinute. @@ -182,37 +182,37 @@ public static BaseDimensions BaseDimensions /// /// Get VolumeFlow in DecilitersPerMinute. /// - public double DecilitersPerMinute => As(VolumeFlowUnit.DecilitersPerMinute); + public double DecilitersPerMinute => As(VolumeFlowUnit.DeciliterPerMinute); /// /// Get VolumeFlow in KilolitersPerMinute. /// - public double KilolitersPerMinute => As(VolumeFlowUnit.KilolitersPerMinute); + public double KilolitersPerMinute => As(VolumeFlowUnit.KiloliterPerMinute); /// /// Get VolumeFlow in LitersPerHour. /// - public double LitersPerHour => As(VolumeFlowUnit.LitersPerHour); + public double LitersPerHour => As(VolumeFlowUnit.LiterPerHour); /// /// Get VolumeFlow in LitersPerMinute. /// - public double LitersPerMinute => As(VolumeFlowUnit.LitersPerMinute); + public double LitersPerMinute => As(VolumeFlowUnit.LiterPerMinute); /// /// Get VolumeFlow in LitersPerSecond. /// - public double LitersPerSecond => As(VolumeFlowUnit.LitersPerSecond); + public double LitersPerSecond => As(VolumeFlowUnit.LiterPerSecond); /// /// Get VolumeFlow in MicrolitersPerMinute. /// - public double MicrolitersPerMinute => As(VolumeFlowUnit.MicrolitersPerMinute); + public double MicrolitersPerMinute => As(VolumeFlowUnit.MicroliterPerMinute); /// /// Get VolumeFlow in MillilitersPerMinute. /// - public double MillilitersPerMinute => As(VolumeFlowUnit.MillilitersPerMinute); + public double MillilitersPerMinute => As(VolumeFlowUnit.MilliliterPerMinute); /// /// Get VolumeFlow in MillionUsGallonsPerDay. @@ -222,37 +222,37 @@ public static BaseDimensions BaseDimensions /// /// Get VolumeFlow in NanolitersPerMinute. /// - public double NanolitersPerMinute => As(VolumeFlowUnit.NanolitersPerMinute); + public double NanolitersPerMinute => As(VolumeFlowUnit.NanoliterPerMinute); /// /// Get VolumeFlow in OilBarrelsPerDay. /// - public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelsPerDay); + public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelPerDay); /// /// Get VolumeFlow in OilBarrelsPerHour. /// - public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelsPerHour); + public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelPerHour); /// /// Get VolumeFlow in OilBarrelsPerMinute. /// - public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelsPerMinute); + public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelPerMinute); /// /// Get VolumeFlow in UsGallonsPerHour. /// - public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonsPerHour); + public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonPerHour); /// /// Get VolumeFlow in UsGallonsPerMinute. /// - public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonsPerMinute); + public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonPerMinute); /// /// Get VolumeFlow in UsGallonsPerSecond. /// - public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonsPerSecond); + public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonPerSecond); #endregion @@ -274,7 +274,7 @@ public static VolumeFlow FromCentilitersPerMinute(QuantityValue centiliterspermi #endif { double value = (double) centilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CentilitersPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerMinute); } /// @@ -428,7 +428,7 @@ public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminu #endif { double value = (double) decilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.DecilitersPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerMinute); } /// @@ -442,7 +442,7 @@ public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminu #endif { double value = (double) kilolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.KilolitersPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerMinute); } /// @@ -456,7 +456,7 @@ public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) #endif { double value = (double) litersperhour; - return new VolumeFlow(value, VolumeFlowUnit.LitersPerHour); + return new VolumeFlow(value, VolumeFlowUnit.LiterPerHour); } /// @@ -470,7 +470,7 @@ public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) #endif { double value = (double) litersperminute; - return new VolumeFlow(value, VolumeFlowUnit.LitersPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.LiterPerMinute); } /// @@ -484,7 +484,7 @@ public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) #endif { double value = (double) literspersecond; - return new VolumeFlow(value, VolumeFlowUnit.LitersPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.LiterPerSecond); } /// @@ -498,7 +498,7 @@ public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microliterspermi #endif { double value = (double) microlitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MicrolitersPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerMinute); } /// @@ -512,7 +512,7 @@ public static VolumeFlow FromMillilitersPerMinute(QuantityValue milliliterspermi #endif { double value = (double) millilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MillilitersPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerMinute); } /// @@ -540,7 +540,7 @@ public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminu #endif { double value = (double) nanolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.NanolitersPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerMinute); } /// @@ -554,7 +554,7 @@ public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) #endif { double value = (double) oilbarrelsperday; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelsPerDay); + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerDay); } /// @@ -568,7 +568,7 @@ public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) #endif { double value = (double) oilbarrelsperhour; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelsPerHour); + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerHour); } /// @@ -582,7 +582,7 @@ public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminu #endif { double value = (double) oilbarrelsperminute; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelsPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerMinute); } /// @@ -596,7 +596,7 @@ public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) #endif { double value = (double) usgallonsperhour; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonsPerHour); + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerHour); } /// @@ -610,7 +610,7 @@ public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute #endif { double value = (double) usgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonsPerMinute); + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerMinute); } /// @@ -624,7 +624,7 @@ public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond #endif { double value = (double) usgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonsPerSecond); + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerSecond); } @@ -775,7 +775,7 @@ private double AsBaseUnit() { switch(Unit) { - case VolumeFlowUnit.CentilitersPerMinute: return (_value/60000.00000) * 1e-2d; + case VolumeFlowUnit.CentiliterPerMinute: return (_value/60000.00000) * 1e-2d; case VolumeFlowUnit.CubicDecimeterPerMinute: return _value/60000.00000; case VolumeFlowUnit.CubicFootPerHour: return _value*7.8657907199999087346816086183876e-6; case VolumeFlowUnit.CubicFootPerMinute: return _value/2118.88000326; @@ -786,21 +786,21 @@ private double AsBaseUnit() case VolumeFlowUnit.CubicYardPerHour: return _value*2.1237634944E-4; case VolumeFlowUnit.CubicYardPerMinute: return _value*0.0127425809664; case VolumeFlowUnit.CubicYardPerSecond: return _value*0.764554857984; - case VolumeFlowUnit.DecilitersPerMinute: return (_value/60000.00000) * 1e-1d; - case VolumeFlowUnit.KilolitersPerMinute: return (_value/60000.00000) * 1e3d; - case VolumeFlowUnit.LitersPerHour: return _value/3600000.000; - case VolumeFlowUnit.LitersPerMinute: return _value/60000.00000; - case VolumeFlowUnit.LitersPerSecond: return _value/1000; - case VolumeFlowUnit.MicrolitersPerMinute: return (_value/60000.00000) * 1e-6d; - case VolumeFlowUnit.MillilitersPerMinute: return (_value/60000.00000) * 1e-3d; + case VolumeFlowUnit.DeciliterPerMinute: return (_value/60000.00000) * 1e-1d; + case VolumeFlowUnit.KiloliterPerMinute: return (_value/60000.00000) * 1e3d; + case VolumeFlowUnit.LiterPerHour: return _value/3600000.000; + case VolumeFlowUnit.LiterPerMinute: return _value/60000.00000; + case VolumeFlowUnit.LiterPerSecond: return _value/1000; + case VolumeFlowUnit.MicroliterPerMinute: return (_value/60000.00000) * 1e-6d; + case VolumeFlowUnit.MilliliterPerMinute: return (_value/60000.00000) * 1e-3d; case VolumeFlowUnit.MillionUsGallonsPerDay: return _value/22.824465227; - case VolumeFlowUnit.NanolitersPerMinute: return (_value/60000.00000) * 1e-9d; - case VolumeFlowUnit.OilBarrelsPerDay: return _value*1.8401307283333333333333333333333e-6; - case VolumeFlowUnit.OilBarrelsPerHour: return _value*4.41631375e-5; - case VolumeFlowUnit.OilBarrelsPerMinute: return _value*2.64978825e-3; - case VolumeFlowUnit.UsGallonsPerHour: return _value/951019.38848933424; - case VolumeFlowUnit.UsGallonsPerMinute: return _value/15850.323141489; - case VolumeFlowUnit.UsGallonsPerSecond: return _value/264.1720523581484; + case VolumeFlowUnit.NanoliterPerMinute: return (_value/60000.00000) * 1e-9d; + case VolumeFlowUnit.OilBarrelPerDay: return _value*1.8401307283333333333333333333333e-6; + case VolumeFlowUnit.OilBarrelPerHour: return _value*4.41631375e-5; + case VolumeFlowUnit.OilBarrelPerMinute: return _value*2.64978825e-3; + case VolumeFlowUnit.UsGallonPerHour: return _value/951019.38848933424; + case VolumeFlowUnit.UsGallonPerMinute: return _value/15850.323141489; + case VolumeFlowUnit.UsGallonPerSecond: return _value/264.1720523581484; default: throw new NotImplementedException($"Can not convert {Unit} to base units."); } @@ -815,7 +815,7 @@ private double AsBaseNumericType(VolumeFlowUnit unit) switch(unit) { - case VolumeFlowUnit.CentilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-2d; + case VolumeFlowUnit.CentiliterPerMinute: return (baseUnitValue*60000.00000) / 1e-2d; case VolumeFlowUnit.CubicDecimeterPerMinute: return baseUnitValue*60000.00000; case VolumeFlowUnit.CubicFootPerHour: return baseUnitValue/7.8657907199999087346816086183876e-6; case VolumeFlowUnit.CubicFootPerMinute: return baseUnitValue*2118.88000326; @@ -826,21 +826,21 @@ private double AsBaseNumericType(VolumeFlowUnit unit) case VolumeFlowUnit.CubicYardPerHour: return baseUnitValue/2.1237634944E-4; case VolumeFlowUnit.CubicYardPerMinute: return baseUnitValue/0.0127425809664; case VolumeFlowUnit.CubicYardPerSecond: return baseUnitValue/0.764554857984; - case VolumeFlowUnit.DecilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-1d; - case VolumeFlowUnit.KilolitersPerMinute: return (baseUnitValue*60000.00000) / 1e3d; - case VolumeFlowUnit.LitersPerHour: return baseUnitValue*3600000.000; - case VolumeFlowUnit.LitersPerMinute: return baseUnitValue*60000.00000; - case VolumeFlowUnit.LitersPerSecond: return baseUnitValue*1000; - case VolumeFlowUnit.MicrolitersPerMinute: return (baseUnitValue*60000.00000) / 1e-6d; - case VolumeFlowUnit.MillilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-3d; + case VolumeFlowUnit.DeciliterPerMinute: return (baseUnitValue*60000.00000) / 1e-1d; + case VolumeFlowUnit.KiloliterPerMinute: return (baseUnitValue*60000.00000) / 1e3d; + case VolumeFlowUnit.LiterPerHour: return baseUnitValue*3600000.000; + case VolumeFlowUnit.LiterPerMinute: return baseUnitValue*60000.00000; + case VolumeFlowUnit.LiterPerSecond: return baseUnitValue*1000; + case VolumeFlowUnit.MicroliterPerMinute: return (baseUnitValue*60000.00000) / 1e-6d; + case VolumeFlowUnit.MilliliterPerMinute: return (baseUnitValue*60000.00000) / 1e-3d; case VolumeFlowUnit.MillionUsGallonsPerDay: return baseUnitValue*22.824465227; - case VolumeFlowUnit.NanolitersPerMinute: return (baseUnitValue*60000.00000) / 1e-9d; - case VolumeFlowUnit.OilBarrelsPerDay: return baseUnitValue/1.8401307283333333333333333333333e-6; - case VolumeFlowUnit.OilBarrelsPerHour: return baseUnitValue/4.41631375e-5; - case VolumeFlowUnit.OilBarrelsPerMinute: return baseUnitValue/2.64978825e-3; - case VolumeFlowUnit.UsGallonsPerHour: return baseUnitValue*951019.38848933424; - case VolumeFlowUnit.UsGallonsPerMinute: return baseUnitValue*15850.323141489; - case VolumeFlowUnit.UsGallonsPerSecond: return baseUnitValue*264.1720523581484; + case VolumeFlowUnit.NanoliterPerMinute: return (baseUnitValue*60000.00000) / 1e-9d; + case VolumeFlowUnit.OilBarrelPerDay: return baseUnitValue/1.8401307283333333333333333333333e-6; + case VolumeFlowUnit.OilBarrelPerHour: return baseUnitValue/4.41631375e-5; + case VolumeFlowUnit.OilBarrelPerMinute: return baseUnitValue/2.64978825e-3; + case VolumeFlowUnit.UsGallonPerHour: return baseUnitValue*951019.38848933424; + case VolumeFlowUnit.UsGallonPerMinute: return baseUnitValue*15850.323141489; + case VolumeFlowUnit.UsGallonPerSecond: return baseUnitValue*264.1720523581484; default: throw new NotImplementedException($"Can not convert {Unit} to {unit}."); } diff --git a/Common/UnitDefinitions/VolumeFlow.json b/Common/UnitDefinitions/VolumeFlow.json index 37f22c1273..49f73e108e 100644 --- a/Common/UnitDefinitions/VolumeFlow.json +++ b/Common/UnitDefinitions/VolumeFlow.json @@ -1,4 +1,4 @@ -{ +{ "Name": "VolumeFlow", "BaseUnit": "CubicMeterPerSecond", "XmlDoc": "In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q.", @@ -136,7 +136,7 @@ ] }, { - "SingularName": "LitersPerSecond", + "SingularName": "LiterPerSecond", "PluralName": "LitersPerSecond", "FromUnitToBaseFunc": "x/1000", "FromBaseToUnitFunc": "x*1000", @@ -148,7 +148,7 @@ ] }, { - "SingularName": "LitersPerMinute", + "SingularName": "LiterPerMinute", "PluralName": "LitersPerMinute", "FromUnitToBaseFunc": "x/60000.00000", "FromBaseToUnitFunc": "x*60000.00000", @@ -161,7 +161,7 @@ ] }, { - "SingularName": "LitersPerHour", + "SingularName": "LiterPerHour", "PluralName": "LitersPerHour", "FromUnitToBaseFunc": "x/3600000.000", "FromBaseToUnitFunc": "x*3600000.000", @@ -177,7 +177,7 @@ ] }, { - "SingularName": "UsGallonsPerSecond", + "SingularName": "UsGallonPerSecond", "PluralName": "UsGallonsPerSecond", "FromUnitToBaseFunc": "x/264.1720523581484", "FromBaseToUnitFunc": "x*264.1720523581484", @@ -189,7 +189,7 @@ ] }, { - "SingularName": "UsGallonsPerMinute", + "SingularName": "UsGallonPerMinute", "PluralName": "UsGallonsPerMinute", "FromUnitToBaseFunc": "x/15850.323141489", "FromBaseToUnitFunc": "x*15850.323141489", @@ -201,7 +201,7 @@ ] }, { - "SingularName": "UsGallonsPerHour", + "SingularName": "UsGallonPerHour", "PluralName": "UsGallonsPerHour", "FromUnitToBaseFunc": "x/951019.38848933424", "FromBaseToUnitFunc": "x*951019.38848933424", @@ -229,7 +229,7 @@ ] }, { - "SingularName": "OilBarrelsPerDay", + "SingularName": "OilBarrelPerDay", "PluralName": "OilBarrelsPerDay", "FromUnitToBaseFunc": "x*1.8401307283333333333333333333333e-6", "FromBaseToUnitFunc": "x/1.8401307283333333333333333333333e-6", @@ -241,7 +241,7 @@ ] }, { - "SingularName": "OilBarrelsPerMinute", + "SingularName": "OilBarrelPerMinute", "PluralName": "OilBarrelsPerMinute", "FromUnitToBaseFunc": "x*2.64978825e-3", "FromBaseToUnitFunc": "x/2.64978825e-3", @@ -253,7 +253,7 @@ ] }, { - "SingularName": "OilBarrelsPerHour", + "SingularName": "OilBarrelPerHour", "PluralName": "OilBarrelsPerHour", "FromUnitToBaseFunc": "x*4.41631375e-5", "FromBaseToUnitFunc": "x/4.41631375e-5", diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index e7f4484e3f..2e70cb5e58 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -144,7 +144,7 @@ public void CubicMeterPerSecondToVolumeFlowUnits() [Fact] public void FromValueAndUnit() { - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CentilitersPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CentiliterPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerHour).CubicFeetPerHour, CubicFeetPerHourTolerance); AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerMinute).CubicFeetPerMinute, CubicFeetPerMinuteTolerance); @@ -155,28 +155,28 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerHour).CubicYardsPerHour, CubicYardsPerHourTolerance); AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerMinute).CubicYardsPerMinute, CubicYardsPerMinuteTolerance); AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerSecond).CubicYardsPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.DecilitersPerMinute).DecilitersPerMinute, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KilolitersPerMinute).KilolitersPerMinute, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LitersPerHour).LitersPerHour, LitersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LitersPerMinute).LitersPerMinute, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LitersPerSecond).LitersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MicrolitersPerMinute).MicrolitersPerMinute, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MillilitersPerMinute).MillilitersPerMinute, MillilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.DeciliterPerMinute).DecilitersPerMinute, DecilitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KiloliterPerMinute).KilolitersPerMinute, KilolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerHour).LitersPerHour, LitersPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerMinute).LitersPerMinute, LitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerSecond).LitersPerSecond, LitersPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerMinute).MicrolitersPerMinute, MicrolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerMinute).MillilitersPerMinute, MillilitersPerMinuteTolerance); AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MillionUsGallonsPerDay).MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.NanolitersPerMinute).NanolitersPerMinute, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelsPerDay).OilBarrelsPerDay, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelsPerHour).OilBarrelsPerHour, OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelsPerMinute).OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonsPerHour).UsGallonsPerHour, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonsPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonsPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerMinute).NanolitersPerMinute, NanolitersPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerDay).OilBarrelsPerDay, OilBarrelsPerDayTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerHour).OilBarrelsPerHour, OilBarrelsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerMinute).OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerHour).UsGallonsPerHour, UsGallonsPerHourTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); } [Fact] public void As() { var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CentilitersPerMinute), CentilitersPerMinuteTolerance); + AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CentiliterPerMinute), CentilitersPerMinuteTolerance); AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance); AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicFootPerHour), CubicFeetPerHourTolerance); AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicFootPerMinute), CubicFeetPerMinuteTolerance); @@ -187,21 +187,21 @@ public void As() AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicYardPerHour), CubicYardsPerHourTolerance); AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicYardPerMinute), CubicYardsPerMinuteTolerance); AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicYardPerSecond), CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.DecilitersPerMinute), DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.KilolitersPerMinute), KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LitersPerHour), LitersPerHourTolerance); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LitersPerMinute), LitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LitersPerSecond), LitersPerSecondTolerance); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MicrolitersPerMinute), MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MillilitersPerMinute), MillilitersPerMinuteTolerance); + AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.DeciliterPerMinute), DecilitersPerMinuteTolerance); + AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.KiloliterPerMinute), KilolitersPerMinuteTolerance); + AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LiterPerHour), LitersPerHourTolerance); + AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LiterPerMinute), LitersPerMinuteTolerance); + AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LiterPerSecond), LitersPerSecondTolerance); + AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MicroliterPerMinute), MicrolitersPerMinuteTolerance); + AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MilliliterPerMinute), MillilitersPerMinuteTolerance); AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MillionUsGallonsPerDay), MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.NanolitersPerMinute), NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelsPerDay), OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(OilBarrelsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelsPerHour), OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(OilBarrelsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelsPerMinute), OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonsPerHour), UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonsPerMinute), UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonsPerSecond), UsGallonsPerSecondTolerance); + AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.NanoliterPerMinute), NanolitersPerMinuteTolerance); + AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelPerDay), OilBarrelsPerDayTolerance); + AssertEx.EqualTolerance(OilBarrelsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelPerHour), OilBarrelsPerHourTolerance); + AssertEx.EqualTolerance(OilBarrelsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelPerMinute), OilBarrelsPerMinuteTolerance); + AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonPerHour), UsGallonsPerHourTolerance); + AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonPerMinute), UsGallonsPerMinuteTolerance); + AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonPerSecond), UsGallonsPerSecondTolerance); } [Fact] @@ -209,9 +209,9 @@ public void ToUnit() { var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - var centilitersperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CentilitersPerMinute); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, (double)centilitersperminuteQuantity.Value, CentilitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.CentilitersPerMinute, centilitersperminuteQuantity.Unit); + var centiliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CentiliterPerMinute); + AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, (double)centiliterperminuteQuantity.Value, CentilitersPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.CentiliterPerMinute, centiliterperminuteQuantity.Unit); var cubicdecimeterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicDecimeterPerMinute); AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, (double)cubicdecimeterperminuteQuantity.Value, CubicDecimetersPerMinuteTolerance); @@ -253,65 +253,65 @@ public void ToUnit() AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, (double)cubicyardpersecondQuantity.Value, CubicYardsPerSecondTolerance); Assert.Equal(VolumeFlowUnit.CubicYardPerSecond, cubicyardpersecondQuantity.Unit); - var decilitersperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.DecilitersPerMinute); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, (double)decilitersperminuteQuantity.Value, DecilitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.DecilitersPerMinute, decilitersperminuteQuantity.Unit); + var deciliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.DeciliterPerMinute); + AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, (double)deciliterperminuteQuantity.Value, DecilitersPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.DeciliterPerMinute, deciliterperminuteQuantity.Unit); - var kilolitersperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.KilolitersPerMinute); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, (double)kilolitersperminuteQuantity.Value, KilolitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.KilolitersPerMinute, kilolitersperminuteQuantity.Unit); + var kiloliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.KiloliterPerMinute); + AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, (double)kiloliterperminuteQuantity.Value, KilolitersPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.KiloliterPerMinute, kiloliterperminuteQuantity.Unit); - var litersperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LitersPerHour); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, (double)litersperhourQuantity.Value, LitersPerHourTolerance); - Assert.Equal(VolumeFlowUnit.LitersPerHour, litersperhourQuantity.Unit); + var literperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LiterPerHour); + AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, (double)literperhourQuantity.Value, LitersPerHourTolerance); + Assert.Equal(VolumeFlowUnit.LiterPerHour, literperhourQuantity.Unit); - var litersperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LitersPerMinute); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, (double)litersperminuteQuantity.Value, LitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.LitersPerMinute, litersperminuteQuantity.Unit); + var literperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LiterPerMinute); + AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, (double)literperminuteQuantity.Value, LitersPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.LiterPerMinute, literperminuteQuantity.Unit); - var literspersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LitersPerSecond); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, (double)literspersecondQuantity.Value, LitersPerSecondTolerance); - Assert.Equal(VolumeFlowUnit.LitersPerSecond, literspersecondQuantity.Unit); + var literpersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LiterPerSecond); + AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, (double)literpersecondQuantity.Value, LitersPerSecondTolerance); + Assert.Equal(VolumeFlowUnit.LiterPerSecond, literpersecondQuantity.Unit); - var microlitersperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MicrolitersPerMinute); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, (double)microlitersperminuteQuantity.Value, MicrolitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.MicrolitersPerMinute, microlitersperminuteQuantity.Unit); + var microliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MicroliterPerMinute); + AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, (double)microliterperminuteQuantity.Value, MicrolitersPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, microliterperminuteQuantity.Unit); - var millilitersperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MillilitersPerMinute); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, (double)millilitersperminuteQuantity.Value, MillilitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.MillilitersPerMinute, millilitersperminuteQuantity.Unit); + var milliliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MilliliterPerMinute); + AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, (double)milliliterperminuteQuantity.Value, MillilitersPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.MilliliterPerMinute, milliliterperminuteQuantity.Unit); var millionusgallonsperdayQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MillionUsGallonsPerDay); AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, (double)millionusgallonsperdayQuantity.Value, MillionUsGallonsPerDayTolerance); Assert.Equal(VolumeFlowUnit.MillionUsGallonsPerDay, millionusgallonsperdayQuantity.Unit); - var nanolitersperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.NanolitersPerMinute); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, (double)nanolitersperminuteQuantity.Value, NanolitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.NanolitersPerMinute, nanolitersperminuteQuantity.Unit); + var nanoliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.NanoliterPerMinute); + AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, (double)nanoliterperminuteQuantity.Value, NanolitersPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.NanoliterPerMinute, nanoliterperminuteQuantity.Unit); - var oilbarrelsperdayQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelsPerDay); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, (double)oilbarrelsperdayQuantity.Value, OilBarrelsPerDayTolerance); - Assert.Equal(VolumeFlowUnit.OilBarrelsPerDay, oilbarrelsperdayQuantity.Unit); + var oilbarrelperdayQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelPerDay); + AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, (double)oilbarrelperdayQuantity.Value, OilBarrelsPerDayTolerance); + Assert.Equal(VolumeFlowUnit.OilBarrelPerDay, oilbarrelperdayQuantity.Unit); - var oilbarrelsperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelsPerHour); - AssertEx.EqualTolerance(OilBarrelsPerHourInOneCubicMeterPerSecond, (double)oilbarrelsperhourQuantity.Value, OilBarrelsPerHourTolerance); - Assert.Equal(VolumeFlowUnit.OilBarrelsPerHour, oilbarrelsperhourQuantity.Unit); + var oilbarrelperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelPerHour); + AssertEx.EqualTolerance(OilBarrelsPerHourInOneCubicMeterPerSecond, (double)oilbarrelperhourQuantity.Value, OilBarrelsPerHourTolerance); + Assert.Equal(VolumeFlowUnit.OilBarrelPerHour, oilbarrelperhourQuantity.Unit); - var oilbarrelsperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelsPerMinute); - AssertEx.EqualTolerance(OilBarrelsPerMinuteInOneCubicMeterPerSecond, (double)oilbarrelsperminuteQuantity.Value, OilBarrelsPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.OilBarrelsPerMinute, oilbarrelsperminuteQuantity.Unit); + var oilbarrelperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelPerMinute); + AssertEx.EqualTolerance(OilBarrelsPerMinuteInOneCubicMeterPerSecond, (double)oilbarrelperminuteQuantity.Value, OilBarrelsPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.OilBarrelPerMinute, oilbarrelperminuteQuantity.Unit); - var usgallonsperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonsPerHour); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, (double)usgallonsperhourQuantity.Value, UsGallonsPerHourTolerance); - Assert.Equal(VolumeFlowUnit.UsGallonsPerHour, usgallonsperhourQuantity.Unit); + var usgallonperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonPerHour); + AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, (double)usgallonperhourQuantity.Value, UsGallonsPerHourTolerance); + Assert.Equal(VolumeFlowUnit.UsGallonPerHour, usgallonperhourQuantity.Unit); - var usgallonsperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonsPerMinute); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, (double)usgallonsperminuteQuantity.Value, UsGallonsPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.UsGallonsPerMinute, usgallonsperminuteQuantity.Unit); + var usgallonperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonPerMinute); + AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, (double)usgallonperminuteQuantity.Value, UsGallonsPerMinuteTolerance); + Assert.Equal(VolumeFlowUnit.UsGallonPerMinute, usgallonperminuteQuantity.Unit); - var usgallonspersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonsPerSecond); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, (double)usgallonspersecondQuantity.Value, UsGallonsPerSecondTolerance); - Assert.Equal(VolumeFlowUnit.UsGallonsPerSecond, usgallonspersecondQuantity.Unit); + var usgallonpersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonPerSecond); + AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, (double)usgallonpersecondQuantity.Value, UsGallonsPerSecondTolerance); + Assert.Equal(VolumeFlowUnit.UsGallonPerSecond, usgallonpersecondQuantity.Unit); } [Fact] diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index e65f0df700..3a040d7343 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -275,7 +275,7 @@ public void ShouldUseCorrectMicroSign() Assert.Equal(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, TemperatureChangeRate.ParseUnit("\u00b5°C/s")); Assert.Equal(VolumeUnit.Microliter, Volume.ParseUnit("\u00b5l")); Assert.Equal(VolumeUnit.CubicMicrometer, Volume.ParseUnit("\u00b5m³")); - Assert.Equal(VolumeFlowUnit.MicrolitersPerMinute, VolumeFlow.ParseUnit("\u00b5LPM")); + Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, VolumeFlow.ParseUnit("\u00b5LPM")); // "\u03bc" = Lower case greek letter 'Mu' Assert.Throws(() => Acceleration.ParseUnit("\u03bcm/s²")); diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index e8d6492a90..ce797d70f4 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -4408,7 +4408,7 @@ private static readonly ReadOnlyCollection DefaultLocalization new UnitLocalization(typeof (VolumeFlowUnit), new[] { - new CulturesForEnumValue((int) VolumeFlowUnit.CentilitersPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.CentiliterPerMinute, new[] { new AbbreviationsForCulture("en-US", "cLPM"), @@ -4466,38 +4466,38 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "yd³/s"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.DecilitersPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.DeciliterPerMinute, new[] { new AbbreviationsForCulture("en-US", "dLPM"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.KilolitersPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.KiloliterPerMinute, new[] { new AbbreviationsForCulture("en-US", "kLPM"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.LitersPerHour, + new CulturesForEnumValue((int) VolumeFlowUnit.LiterPerHour, new[] { new AbbreviationsForCulture("en-US", "LPH"), new AbbreviationsForCulture("ru-RU", "л/ч"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.LitersPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.LiterPerMinute, new[] { new AbbreviationsForCulture("en-US", "LPM"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.LitersPerSecond, + new CulturesForEnumValue((int) VolumeFlowUnit.LiterPerSecond, new[] { new AbbreviationsForCulture("en-US", "LPS"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.MicrolitersPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.MicroliterPerMinute, new[] { new AbbreviationsForCulture("en-US", "µLPM"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.MillilitersPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.MilliliterPerMinute, new[] { new AbbreviationsForCulture("en-US", "mLPM"), @@ -4507,37 +4507,37 @@ private static readonly ReadOnlyCollection DefaultLocalization { new AbbreviationsForCulture("en-US", "MGD"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.NanolitersPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.NanoliterPerMinute, new[] { new AbbreviationsForCulture("en-US", "nLPM"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelsPerDay, + new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelPerDay, new[] { new AbbreviationsForCulture("en-US", "bbl/d", "BOPD"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelsPerHour, + new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelPerHour, new[] { new AbbreviationsForCulture("en-US", "bbl/hr", "bph"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelsPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelPerMinute, new[] { new AbbreviationsForCulture("en-US", "bbl/min", "bpm"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonsPerHour, + new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonPerHour, new[] { new AbbreviationsForCulture("en-US", "gal (U.S.)/h"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonsPerMinute, + new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonPerMinute, new[] { new AbbreviationsForCulture("en-US", "gal (U.S.)/min", "GPM"), }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonsPerSecond, + new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonPerSecond, new[] { new AbbreviationsForCulture("en-US", "gal (U.S.)/s"), diff --git a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs index b21fed06c2..bc04eaddfe 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs @@ -45,7 +45,7 @@ namespace UnitsNet.Units public enum VolumeFlowUnit { Undefined = 0, - CentilitersPerMinute, + CentiliterPerMinute, CubicDecimeterPerMinute, CubicFootPerHour, CubicFootPerMinute, @@ -56,21 +56,21 @@ public enum VolumeFlowUnit CubicYardPerHour, CubicYardPerMinute, CubicYardPerSecond, - DecilitersPerMinute, - KilolitersPerMinute, - LitersPerHour, - LitersPerMinute, - LitersPerSecond, - MicrolitersPerMinute, - MillilitersPerMinute, + DeciliterPerMinute, + KiloliterPerMinute, + LiterPerHour, + LiterPerMinute, + LiterPerSecond, + MicroliterPerMinute, + MilliliterPerMinute, MillionUsGallonsPerDay, - NanolitersPerMinute, - OilBarrelsPerDay, - OilBarrelsPerHour, - OilBarrelsPerMinute, - UsGallonsPerHour, - UsGallonsPerMinute, - UsGallonsPerSecond, + NanoliterPerMinute, + OilBarrelPerDay, + OilBarrelPerHour, + OilBarrelPerMinute, + UsGallonPerHour, + UsGallonPerMinute, + UsGallonPerSecond, } #pragma warning restore 1591 From 93c79dd109c94a8147e1396a35bde907601bfefb Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 23:05:38 +0200 Subject: [PATCH 021/131] Attempt to fix AppVeyor logger for WRC --- Build/build-functions.psm1 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Build/build-functions.psm1 b/Build/build-functions.psm1 index 26e864b502..6f58691d85 100644 --- a/Build/build-functions.psm1 +++ b/Build/build-functions.psm1 @@ -29,12 +29,13 @@ function Update-GeneratedCode { function Start-Build([boolean] $skipUWP = $false) { write-host -foreground blue "Start-Build...`n---" - $msbuildFileLogger = "/l:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.msbuild.log" + $fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.msbuild.log" - $appVeyorMsbuildLogger = "C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll" - $appVeyorLogger = if (Test-Path "$appVeyorMsbuildLogger") { "/l:$appVeyorMsbuildLogger" } else { "" } + $appVeyorLoggerDll = "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + $appVeyorLoggerNetCoreDll = "C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll" + $appVeyorLoggerArg = if (Test-Path "$appVeyorLoggerNetCoreDll") { "/logger:$appVeyorLoggerNetCoreDll" } else { "" } - dotnet build --configuration Release "$root\UnitsNet.sln" $msbuildFileLogger $appVeyorLogger + dotnet build --configuration Release "$root\UnitsNet.sln" $fileLoggerArg $appVeyorLoggerArg if ($lastexitcode -ne 0) { exit 1 } if ($skipUWP -eq $true) @@ -43,12 +44,14 @@ function Start-Build([boolean] $skipUWP = $false) { } else { - $msbuildFileLogger = "/l:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.WindowsRuntimeComponent.msbuild.log" + $fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.WindowsRuntimeComponent.msbuild.log" + $appVeyorLoggerArg = if (Test-Path "$appVeyorLoggerDll") { "/logger:$appVeyorLoggerDll" } else { "" } + # dontnet CLI does not support WindowsRuntimeComponent project type yet # msbuild does not auto-restore nugets for this project type write-host -foreground yellow "WindowsRuntimeComponent project not yet supported by dotnet CLI, using MSBuild15 instead" & "$msbuild" "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release /t:restore - & "$msbuild" "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release $msbuildFileLogger $appVeyorLogger + & "$msbuild" "$root\UnitsNet.WindowsRuntimeComponent.sln" /verbosity:minimal /p:Configuration=Release $fileLoggerArg $appVeyorLoggerArg if ($lastexitcode -ne 0) { exit 1 } } From d2d3794cf15d4d95af6ce609300e1cc30d3a8d43 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 23:36:35 +0200 Subject: [PATCH 022/131] Remove == and != operators of Duration Fixes warning about operators when Equals() is not overridden. --- UnitsNet.Tests/CustomCode/DurationTests.cs | 38 ++----------------- .../CustomCode/Quantities/Duration.extra.cs | 20 ---------- 2 files changed, 3 insertions(+), 55 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/DurationTests.cs b/UnitsNet.Tests/CustomCode/DurationTests.cs index f99439a482..75249bc3ab 100644 --- a/UnitsNet.Tests/CustomCode/DurationTests.cs +++ b/UnitsNet.Tests/CustomCode/DurationTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -176,38 +176,6 @@ public static void DurationGreaterThanOrEqualTimeSpanShouldReturnCorrectly() Assert.True(duration >= timeSpan, "duration should be greater than timeSpan"); } - [Fact] - public static void DurationEqualToTimeSpanShouldReturnCorrectly() - { - TimeSpan timeSpan = TimeSpan.FromHours(11); - Duration duration = Duration.FromHours(11); - Assert.True(duration == timeSpan, "duration should be equal to timeSpan"); - } - - [Fact] - public static void TimeSpanEqualToDurationShouldReturnCorrectly() - { - TimeSpan timeSpan = TimeSpan.FromHours(11); - Duration duration = Duration.FromHours(11); - Assert.True(timeSpan == duration, "timeSpan should be equal to duration"); - } - - [Fact] - public static void DurationNotEqualToTimeSpanShouldReturnCorrectly() - { - TimeSpan timeSpan = TimeSpan.FromHours(12); - Duration duration = Duration.FromHours(11); - Assert.True(duration != timeSpan, "duration should not be equal to timeSpan"); - } - - [Fact] - public static void TimeSpanNotEqualToDurationShouldReturnCorrectly() - { - TimeSpan timeSpan = TimeSpan.FromHours(12); - Duration duration = Duration.FromHours(11); - Assert.True(timeSpan != duration, "timeSpan should not be equal to duration"); - } - [Fact] public void DurationTimesVolumeFlowEqualsVolume() { diff --git a/UnitsNet/CustomCode/Quantities/Duration.extra.cs b/UnitsNet/CustomCode/Quantities/Duration.extra.cs index 9a6e8d21d5..dd0c691cdf 100644 --- a/UnitsNet/CustomCode/Quantities/Duration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Duration.extra.cs @@ -75,16 +75,6 @@ public static explicit operator Duration(TimeSpan duration) return duration.Seconds >= timeSpan.TotalSeconds; } - public static bool operator ==(Duration duration, TimeSpan timeSpan) - { - return duration.Seconds == timeSpan.TotalSeconds; - } - - public static bool operator !=(Duration duration, TimeSpan timeSpan) - { - return duration.Seconds != timeSpan.TotalSeconds; - } - public static bool operator <(TimeSpan timeSpan, Duration duration) { return timeSpan.TotalSeconds < duration.Seconds; @@ -105,16 +95,6 @@ public static explicit operator Duration(TimeSpan duration) return timeSpan.TotalSeconds >= duration.Seconds; } - public static bool operator ==(TimeSpan timeSpan, Duration duration) - { - return timeSpan.TotalSeconds == duration.Seconds; - } - - public static bool operator !=(TimeSpan timeSpan, Duration duration) - { - return timeSpan.TotalSeconds != duration.Seconds; - } - public static Volume operator *(Duration duration, VolumeFlow volumeFlow) { return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); From 622bb336f606ad27fa4fd61dea6dcb6e3bfd8614 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 23:37:38 +0200 Subject: [PATCH 023/131] Fix minor warnings and code issues Remove unused usings Remove reduntant code Fix formatting --- .../UnitsNetJsonConverterTests.cs | 16 ++++++---------- UnitsNet.Tests/AssertEx.cs | 4 ++-- UnitsNet.Tests/BaseDimensionsTests.cs | 3 +-- .../BrakeSpecificFuelConsumptionTests.cs | 7 +++---- UnitsNet.Tests/CustomCode/DensityTests.cs | 7 +++---- .../CustomCode/DynamicViscosityTests.cs | 7 +++---- .../CustomCode/ElectricCurrentTests.cs | 8 +++----- .../CustomCode/ForceChangeRateTests.cs | 10 ++++------ UnitsNet.Tests/CustomCode/LengthTests.cs | 11 +++++------ UnitsNet.Tests/CustomCode/PressureTests.cs | 7 +++---- UnitsNet/BaseDimensions.cs | 4 ++-- .../CustomCode/Quantities/Acceleration.extra.cs | 1 + UnitsNet/CustomCode/Quantities/Density.extra.cs | 2 +- UnitsNet/CustomCode/Quantities/Level.extra.cs | 4 ++-- .../Quantities/SpecificWeight.extra.cs | 7 ++++--- UnitsNet/Length2d.cs | 1 + UnitsNet/QuantityValue.cs | 2 -- 17 files changed, 44 insertions(+), 57 deletions(-) diff --git a/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs b/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs index b6c77c84af..4514d5be1d 100644 --- a/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs +++ b/UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -121,12 +121,8 @@ public void NonNullNullableValueNestedInObject_ExpectJsonUnaffected() [Fact] public void NullValue_ExpectJsonContainsNullString() { - Mass? nullMass = null; - var expectedJson = "null"; - - string json = SerializeObject(nullMass); - - Assert.Equal(expectedJson, json); + string json = SerializeObject(null); + Assert.Equal("null", json); } [Fact] @@ -242,7 +238,7 @@ public void UnitInIComparable_ExpectUnitCorrectlyDeserialized() string json = JsonConvert.SerializeObject(testObjWithIComparable, jsonSerializerSettings); var deserializedTestObject = JsonConvert.DeserializeObject(json,jsonSerializerSettings); - + Assert.Equal(typeof(Power), deserializedTestObject.Value.GetType()); Assert.Equal(Power.FromWatts(10), (Power)deserializedTestObject.Value); } diff --git a/UnitsNet.Tests/AssertEx.cs b/UnitsNet.Tests/AssertEx.cs index 7e553f92bc..cf90732786 100644 --- a/UnitsNet.Tests/AssertEx.cs +++ b/UnitsNet.Tests/AssertEx.cs @@ -12,7 +12,7 @@ public static void EqualTolerance(double expected, double actual, double toleran { if(comparisonType == ComparisonType.Relative) { - bool areEqual = UnitsNet.Comparison.EqualsRelative(expected, actual, tolerance); + bool areEqual = Comparison.EqualsRelative(expected, actual, tolerance); double difference = Math.Abs(expected - actual); double relativeDifference = difference / expected; @@ -21,7 +21,7 @@ public static void EqualTolerance(double expected, double actual, double toleran } else if( comparisonType == ComparisonType.Absolute ) { - bool areEqual = UnitsNet.Comparison.EqualsAbsolute(expected, actual, tolerance); + bool areEqual = Comparison.EqualsAbsolute(expected, actual, tolerance); Assert.True( areEqual, $"Values are not equal within absolute tolerance: {tolerance}\nExpected: {expected}\nActual: {actual}\nDiff: {actual - expected:e}" ); } } diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 3d35b0c00d..0f6f00e675 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -1,5 +1,4 @@ -using System; -using Xunit; +using Xunit; namespace UnitsNet.Tests { diff --git a/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs b/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs index fbe02ac43f..e141a6ac58 100644 --- a/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs +++ b/UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,7 +21,6 @@ using Xunit; -using System; namespace UnitsNet.Tests.CustomCode { diff --git a/UnitsNet.Tests/CustomCode/DensityTests.cs b/UnitsNet.Tests/CustomCode/DensityTests.cs index 6901649b4a..428ef7f325 100644 --- a/UnitsNet.Tests/CustomCode/DensityTests.cs +++ b/UnitsNet.Tests/CustomCode/DensityTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,7 +19,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; using Xunit; using UnitsNet.CustomCode.Extensions; diff --git a/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs b/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs index f4042366cd..553665afe4 100644 --- a/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs +++ b/UnitsNet.Tests/CustomCode/DynamicViscosityTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,7 +20,6 @@ // THE SOFTWARE. -using System; using Xunit; namespace UnitsNet.Tests.CustomCode diff --git a/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs b/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs index c79bf46a8a..92cc98f875 100644 --- a/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricCurrentTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; - namespace UnitsNet.Tests.CustomCode { public class ElectricCurrentTests : ElectricCurrentTestsBase diff --git a/UnitsNet.Tests/CustomCode/ForceChangeRateTests.cs b/UnitsNet.Tests/CustomCode/ForceChangeRateTests.cs index f745d802aa..8edf0b4aa0 100644 --- a/UnitsNet.Tests/CustomCode/ForceChangeRateTests.cs +++ b/UnitsNet.Tests/CustomCode/ForceChangeRateTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; - namespace UnitsNet.Tests.CustomCode { public class ForceChangeRateTests : ForceChangeRateTestsBase @@ -37,4 +35,4 @@ public class ForceChangeRateTests : ForceChangeRateTestsBase protected override double MicronewtonsPerSecondInOneNewtonPerSecond => 1E6; protected override double NanonewtonsPerSecondInOneNewtonPerSecond => 1E9; } -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/CustomCode/LengthTests.cs b/UnitsNet.Tests/CustomCode/LengthTests.cs index 6b24ef9e04..f427b12387 100644 --- a/UnitsNet.Tests/CustomCode/LengthTests.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,7 +19,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; using Xunit; using UnitsNet.Units; @@ -61,7 +60,7 @@ public class LengthTests : LengthTestsBase protected override double NanometersInOneMeter => 1E9; protected override double YardsInOneMeter => 1.09361; - + protected override double FathomsInOneMeter => 0.546806649; protected override double PrinterPicasInOneMeter => 237.10630158; @@ -153,6 +152,6 @@ public void MaxValueIsCorrectForUnitWithBaseTypeDouble() public void MinValueIsCorrectForUnitWithBaseTypeDouble() { Assert.Equal(double.MinValue, Length.MinValue.Meters); - } + } } } diff --git a/UnitsNet.Tests/CustomCode/PressureTests.cs b/UnitsNet.Tests/CustomCode/PressureTests.cs index da37b8d7dc..1aaadbdb5c 100644 --- a/UnitsNet.Tests/CustomCode/PressureTests.cs +++ b/UnitsNet.Tests/CustomCode/PressureTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,7 +19,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; using Xunit; namespace UnitsNet.Tests.CustomCode diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 79162dbff1..7eb558b83d 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -115,7 +115,7 @@ public BaseDimensions Divide(BaseDimensions right) /// True if equal. public static bool operator ==(BaseDimensions left, BaseDimensions right) { - return left.Equals(right); + return left?.Equals(right) == true; } /// @@ -126,7 +126,7 @@ public BaseDimensions Divide(BaseDimensions right) /// True if not equal. public static bool operator !=(BaseDimensions left, BaseDimensions right) { - return !( left == right ); + return !(left == right); } /// diff --git a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs index 612340536c..1e89b9b6ea 100644 --- a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs @@ -19,6 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// ReSharper disable once CheckNamespace namespace UnitsNet { // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components diff --git a/UnitsNet/CustomCode/Quantities/Density.extra.cs b/UnitsNet/CustomCode/Quantities/Density.extra.cs index f49aa66054..d82336f64c 100644 --- a/UnitsNet/CustomCode/Quantities/Density.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Density.extra.cs @@ -72,7 +72,7 @@ public static Molarity ToMolarity(Density density, Mass molecularWeight) public static SpecificWeight operator *(Density density, Acceleration acceleration) { - return new SpecificWeight(density.KilogramsPerCubicMeter * acceleration.MetersPerSecondSquared, UnitsNet.Units.SpecificWeightUnit.NewtonPerCubicMeter); + return new SpecificWeight(density.KilogramsPerCubicMeter * acceleration.MetersPerSecondSquared, SpecificWeightUnit.NewtonPerCubicMeter); } #endif } diff --git a/UnitsNet/CustomCode/Quantities/Level.extra.cs b/UnitsNet/CustomCode/Quantities/Level.extra.cs index 5162e49992..9e25ee2dd0 100644 --- a/UnitsNet/CustomCode/Quantities/Level.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Level.extra.cs @@ -44,9 +44,9 @@ public Level(double quantity, double reference) string errorMessage = $"The base-10 logarithm of a number ≤ 0 is undefined ({quantity}/{reference})."; - if ((quantity == 0) || ((quantity < 0) && (reference > 0))) + if (quantity == 0 || quantity < 0 && reference > 0) throw new ArgumentOutOfRangeException(nameof(quantity), errorMessage); - if ((reference == 0) || ((quantity > 0) && (reference < 0))) + if (reference == 0 || quantity > 0 && reference < 0) throw new ArgumentOutOfRangeException(nameof(reference), errorMessage); _value = 10*Math.Log10(quantity/reference); diff --git a/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs b/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs index 50207c0bf6..b9403d2107 100644 --- a/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs +++ b/UnitsNet/CustomCode/Quantities/SpecificWeight.extra.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,6 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// ReSharper disable once CheckNamespace namespace UnitsNet { // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components diff --git a/UnitsNet/Length2d.cs b/UnitsNet/Length2d.cs index 0eed30364d..dd43225dca 100644 --- a/UnitsNet/Length2d.cs +++ b/UnitsNet/Length2d.cs @@ -40,6 +40,7 @@ public struct Length2d public Vector2 Meters; } #else + // ReSharper disable once InconsistentNaming public struct Length2d : IEquatable { /// diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index 2998dc148c..d05598705c 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -22,8 +22,6 @@ // Operator overloads not supported in Windows Runtime Components, we use 'double' type instead #if !WINDOWS_UWP -using System; - namespace UnitsNet { /// From 108ae7c51f1806fb277d11e8e49c1fa549509837 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 23:37:49 +0200 Subject: [PATCH 024/131] Fix unused param in Length2dTests --- UnitsNet.Tests/CustomCode/Length2dTests.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/Length2dTests.cs b/UnitsNet.Tests/CustomCode/Length2dTests.cs index 06f0b3ff5b..39cda56ef1 100644 --- a/UnitsNet.Tests/CustomCode/Length2dTests.cs +++ b/UnitsNet.Tests/CustomCode/Length2dTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -28,13 +28,12 @@ public class Length2dTests { private const double Delta = 1E-5; - private void AssertAreEqual(Vector2 expected, Vector2 actual, double delta) + private static void AssertAreEqual(Vector2 expected, Vector2 actual, double delta) { - AssertEx.EqualTolerance(expected.X, actual.X, Delta); - AssertEx.EqualTolerance(expected.Y, actual.Y, Delta); + AssertEx.EqualTolerance(expected.X, actual.X, delta); + AssertEx.EqualTolerance(expected.Y, actual.Y, delta); } - [Fact] public void ArithmeticOperators() { @@ -144,4 +143,4 @@ public void VectorLength() Assert.Equal(5, v.Length.Meters); } } -} \ No newline at end of file +} From b5cf639ba265cf01d5b963eab647ab02ac0329c3 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 22:35:48 +0200 Subject: [PATCH 025/131] Remove static methods of UnitSystem Where an instance method also exists. Add some xmldoc while at it too. --- UnitsNet/CustomCode/UnitSystem.cs | 109 +++++++++++++++++++++--------- 1 file changed, 77 insertions(+), 32 deletions(-) diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs index 96480fe653..9f21656176 100644 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ b/UnitsNet/CustomCode/UnitSystem.cs @@ -31,6 +31,14 @@ // ReSharper disable once CheckNamespace namespace UnitsNet { + /// + /// Main facade for working with units dynamically and configuring default behavior for quantities' ToString(): + /// - Instance per culture via , for caching number formatting and unit abbreviation localization + /// - Use for local system's current culture + /// - Override to affect number formatting and localization of all quantities' ToString() when culture is not specified + /// - unit abbreviations with dynamic types + /// - Dynamically add abbreviations to unit enums with + /// [PublicAPI] public sealed partial class UnitSystem { @@ -38,11 +46,11 @@ public sealed partial class UnitSystem /// /// Fallback culture used by and - /// + /// /// if no abbreviations are found with current . /// /// - /// User wants to call or with Russian + /// User wants to call or with Russian /// culture, but no translation is defined, so we return the US English definition as a last resort. If it's not /// defined there either, an exception is thrown. /// @@ -147,8 +155,16 @@ public UnitSystem() : this(DefaultCulture) #endif static IFormatProvider DefaultCulture { get; set; } = CultureInfo.CurrentUICulture; + /// + /// Whether this instance is for the . + /// TODO Make this private. + /// public bool IsFallbackCulture => Culture.Equals(FallbackCulture); + /// + /// Clear the cached singleton instances. + /// Calling or afterwards will create a new instance. + /// [PublicAPI] public static void ClearCache() { @@ -185,6 +201,11 @@ public static UnitSystem GetCached([CanBeNull] string cultureName) } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + /// + /// Gets or creates the singleton instance configured with localized unit abbreviations and number formatting for the given culture. + /// + /// The culture. + /// The instance. #if WINDOWS_UWP internal #else @@ -205,19 +226,13 @@ static UnitSystem GetCached([CanBeNull] IFormatProvider cultureInfo) } } - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - static TUnitType Parse(string unitAbbreviation, IFormatProvider culture) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable - { - return GetCached(culture).Parse(unitAbbreviation); - } - + /// + /// Parses a unit abbreviation for a given unit enumeration type. + /// Example: Parse<LengthUnit>("km") => LengthUnit.Kilometer + /// + /// + /// + /// [PublicAPI] // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods #if WINDOWS_UWP @@ -246,12 +261,10 @@ TUnitType Parse(string unitAbbreviation) [PublicAPI] public object Parse(string unitAbbreviation, Type unitType) { - AbbreviationMap abbrevToUnitValue; - if (!_unitTypeToAbbrevToUnitValue.TryGetValue(unitType, out abbrevToUnitValue)) + if (!_unitTypeToAbbrevToUnitValue.TryGetValue(unitType, out var abbrevToUnitValue)) throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{Culture}]."); - List unitIntValues; - List unitValues = abbrevToUnitValue.TryGetValue(unitAbbreviation, out unitIntValues) + List unitValues = abbrevToUnitValue.TryGetValue(unitAbbreviation, out var unitIntValues) ? unitIntValues.Distinct().Cast().ToList() : new List(); @@ -268,19 +281,13 @@ public object Parse(string unitAbbreviation, Type unitType) } } - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - static string GetDefaultAbbreviation(TUnitType unit, CultureInfo culture) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable - { - return GetCached(culture).GetDefaultAbbreviation(unit); - } - + /// + /// Gets the default abbreviation for a given unit. If a unit has more than one abbreviation defined, then it returns the first one. + /// Example: GetDefaultAbbreviation<LengthUnit>(LengthUnit.Kilometer) => "km" + /// + /// The unit enum value. + /// The type of unit enum. + /// The default unit abbreviation string. [PublicAPI] // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods #if WINDOWS_UWP @@ -294,12 +301,28 @@ string GetDefaultAbbreviation(TUnitType unit) return GetAllAbbreviations(unit).First(); } + /// + /// Gets the default abbreviation for a given unit type and its numeric enum value. + /// If a unit has more than one abbreviation defined, then it returns the first one. + /// Example: GetDefaultAbbreviation<LengthUnit>(typeof(LengthUnit), 1) => "cm" + /// + /// The unit enum type. + /// The unit enum value. + /// The default unit abbreviation string. [PublicAPI] public string GetDefaultAbbreviation(Type unitType, int unitValue) { return GetAllAbbreviations(unitType, unitValue).First(); } + /// + /// Adds one or more unit abbreviation for the given unit enum value. + /// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums + /// in order to or on them later. + /// + /// The unit enum value. + /// Unit abbreviations to add. + /// The type of unit enum. [PublicAPI] // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods #if WINDOWS_UWP @@ -318,6 +341,14 @@ void MapUnitToAbbreviation(TUnitType unit, params string[] abbreviati MapUnitToAbbreviation(unitType, unitValue, abbreviations); } + /// + /// Adds one or more unit abbreviation for the given unit enum value. + /// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums + /// in order to or on them later. + /// + /// The unit enum type. + /// The unit enum value. + /// Unit abbreviations to add. [PublicAPI] // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods #if WINDOWS_UWP @@ -364,6 +395,13 @@ void MapUnitToAbbreviation(Type unitType, int unitValue, [NotNull] params string } } + /// + /// Try to parse a unit abbreviation. + /// + /// The string value. + /// The unit enum value as out result. + /// Type of unit enum. + /// True if successful. [PublicAPI] // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods #if WINDOWS_UWP @@ -386,6 +424,13 @@ bool TryParse(string unitAbbreviation, out TUnitType unit) } } + /// + /// Try to parse a unit abbreviation. + /// + /// The string value. + /// Type of unit enum. + /// The unit enum value as out result. + /// True if successful. [PublicAPI] public bool TryParse(string unitAbbreviation, Type unitType, out object unit) { From 5202adcc05d968bfa6f7ab9f4edb42bd9f24bef2 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 28 Sep 2018 22:37:28 +0200 Subject: [PATCH 026/131] Make IsFallbackCulture private I can't see how this is used externally? --- UnitsNet/CustomCode/UnitSystem.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs index 9f21656176..e4dbfaf4ce 100644 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ b/UnitsNet/CustomCode/UnitSystem.cs @@ -157,9 +157,8 @@ public UnitSystem() : this(DefaultCulture) /// /// Whether this instance is for the . - /// TODO Make this private. /// - public bool IsFallbackCulture => Culture.Equals(FallbackCulture); + private bool IsFallbackCulture => Culture.Equals(FallbackCulture); /// /// Clear the cached singleton instances. From e1c3adfd2f8a6408500d31fb4ef4201d3784c6e0 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 00:18:34 +0200 Subject: [PATCH 027/131] Try to fix deploy in v4 branch --- appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 19835181b9..875f9de99b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,6 +12,10 @@ only_commits: - '**/*.ps1' - '**/*.psm1' - '**/*.bat' + +nuget: + disable_publish_on_pr: false # enable publishing of .nupkg artifacts + build_script: - ps: | ##################################### From 4f48637ab865943c47a428f50b552c4b813ccbd3 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 00:22:55 +0200 Subject: [PATCH 028/131] Add caching and other seemingly useful options Based on https://www.appveyor.com/docs/appveyor-yml/ --- appveyor.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 875f9de99b..a58af506e5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,20 +1,18 @@ version: '{build}' image: Visual Studio 2017 -only_commits: +skip_commits: files: - - appveyor.yml - - '**/*.sln' - - '**/*.csproj' - - '**/*.props' - - '**/*.nuspec' - - '**/*.cs' - - '**/*.json' - - '**/*.ps1' - - '**/*.psm1' - - '**/*.bat' - -nuget: - disable_publish_on_pr: false # enable publishing of .nupkg artifacts + - docs/* + - '**/*.md' + +# fetch repository as zip archive, not doing any git operations on it +shallow_clone: true + +# build cache to preserve files/folders between builds +cache: + - packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified + - '%LocalAppData%\NuGet\Cache' # NuGet < v3 + - '%LocalAppData%\NuGet\v3-cache' # NuGet v3 build_script: - ps: | @@ -41,12 +39,15 @@ build_script: Write-Host "Build failed with exit code $BuildExitCode." exit $BuildExitCode } + # Do not build feature branch with open Pull Requests skip_branch_with_pr: true test: off + artifacts: - path: Artifacts\UnitsNet.zip - path: 'Artifacts\NuGet\*.nupkg' # find all NuGet packages recursively + deploy: - provider: NuGet api_key: @@ -54,6 +55,7 @@ deploy: skip_symbols: false on: branch: master + - provider: NuGet api_key: secure: NlJ+D6kXfgU6RgRuf9okylLDENp8DA3tTRSC6UHBNbRS9ZAvRrC3Z0++Mr5VtGvz From 7f1107ca8df7368925b790c1306f771d3057ce38 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 00:24:05 +0200 Subject: [PATCH 029/131] Change deploy to branch release/v4 v4 has an open pull request and so it is skipped (to avoid duplicate builds for PRs), but now that we want to deploy we simply create a new branch release/v4 and merge into it whenever we want to deploy v4 branch. --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a58af506e5..7288bf1497 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ version: '{build}' image: Visual Studio 2017 skip_commits: - files: + files: - docs/* - '**/*.md' @@ -61,4 +61,4 @@ deploy: secure: NlJ+D6kXfgU6RgRuf9okylLDENp8DA3tTRSC6UHBNbRS9ZAvRrC3Z0++Mr5VtGvz skip_symbols: false on: - branch: v4 + branch: release/v4 From ed9561ad99c4cf406cee686b1e8cd752d3119d07 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 00:42:07 +0200 Subject: [PATCH 030/131] Remove all number extension methods Instead of waiting for us to get around to create a new nuget for this, let's remove it now that we have a breaking change release and rather add a new nuget if enough people actually ask for it. Then we can have them do the work. *evil laugh* But seriously, I suspect this is very little used and it adds significantly to binary size. Most people are well off creating a handful of extension methods themselves, or even copying source code from the repo history. --- UnitsNet/Scripts/GenerateUnits.ps1 | 2 - ...ude-GenerateNumberExtensionsSourceCode.ps1 | 71 ------------------- 2 files changed, 73 deletions(-) delete mode 100644 UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 diff --git a/UnitsNet/Scripts/GenerateUnits.ps1 b/UnitsNet/Scripts/GenerateUnits.ps1 index f51a88ad15..3954e765bf 100644 --- a/UnitsNet/Scripts/GenerateUnits.ps1 +++ b/UnitsNet/Scripts/GenerateUnits.ps1 @@ -259,7 +259,6 @@ function Add-InheritedUnits($quantity, $quantities) { # Load external generator functions with same name as file . "$PSScriptRoot/Include-GenerateTemplates.ps1" . "$PSScriptRoot/Include-GenerateLogarithmicCode.ps1" -. "$PSScriptRoot/Include-GenerateNumberExtensionsSourceCode.ps1" . "$PSScriptRoot/Include-GenerateUnitSystemDefaultSourceCode.ps1" . "$PSScriptRoot/Include-GenerateQuantityTypeSourceCode.ps1" . "$PSScriptRoot/Include-GenerateQuantitySourceCodeCommon.ps1" @@ -295,7 +294,6 @@ foreach ($quantity in $quantities) { GenerateQuantity $quantity $quantityDir GenerateUnitType $quantity $unitEnumDir - GenerateNumberExtensions $quantity $numberExtensionsDir GenerateUnitTestBaseClass $quantity $testsDir GenerateUnitTestClassIfNotExists $quantity $testsCustomCodeDir diff --git a/UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 deleted file mode 100644 index b571c0ee0c..0000000000 --- a/UnitsNet/Scripts/Include-GenerateNumberExtensionsSourceCode.ps1 +++ /dev/null @@ -1,71 +0,0 @@ -function GenerateNumberExtensionsSourceCode($quantity) -{ - $quantityName = $quantity.Name; - $units = $quantity.Units; -@" -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberTo$quantityName -{ - public static class NumberTo$($quantityName)Extensions - { -"@; foreach ($unit in $units) { - $obsoleteAttribute = GetObsoleteAttribute($unit); - if ($obsoleteAttribute) - { - $obsoleteAttribute = "`r`n " + $obsoleteAttribute; # apply padding to conformance with code format in this page - } - - # A few units share the exact same name across quantities, which give extension method name conflicts. - # We add "OmitExtensionMethod": true on all but one of the conflicting units in JSON. - if ($unit.OmitExtensionMethod) { continue } -@" - /// $($obsoleteAttribute) - public static $quantityName $($unit.PluralName)(this T value) => $quantityName.From$($unit.PluralName)(Convert.ToDouble(value)); - -"@; }@" - } -} -#endif -"@; -} From e9060d626581071cbc551b0c5a6501622e592b32 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 00:45:39 +0200 Subject: [PATCH 031/131] Remove generated code for number extensions --- .../NumberToTimeSpanExtensions.cs | 110 ----------- .../NumberToAccelerationExtensions.g.cs | 88 --------- .../NumberToAmountOfSubstanceExtensions.g.cs | 91 --------- .../NumberToAmplitudeRatioExtensions.g.cs | 61 ------ .../Number/NumberToAngleExtensions.g.cs | 91 --------- .../NumberToApparentEnergyExtensions.g.cs | 58 ------ .../NumberToApparentPowerExtensions.g.cs | 61 ------ .../Number/NumberToAreaDensityExtensions.g.cs | 52 ----- .../Number/NumberToAreaExtensions.g.cs | 88 --------- ...NumberToAreaMomentOfInertiaExtensions.g.cs | 67 ------- .../Number/NumberToBitRateExtensions.g.cs | 127 ------------ ...rakeSpecificFuelConsumptionExtensions.g.cs | 58 ------ .../Number/NumberToCapacitanceExtensions.g.cs | 52 ----- .../Number/NumberToDensityExtensions.g.cs | 163 ---------------- .../Number/NumberToDurationExtensions.g.cs | 79 -------- .../NumberToDynamicViscosityExtensions.g.cs | 67 ------- .../NumberToElectricAdmittanceExtensions.g.cs | 61 ------ ...mberToElectricChargeDensityExtensions.g.cs | 52 ----- .../NumberToElectricChargeExtensions.g.cs | 52 ----- ...NumberToElectricConductanceExtensions.g.cs | 58 ------ ...umberToElectricConductivityExtensions.g.cs | 52 ----- ...berToElectricCurrentDensityExtensions.g.cs | 52 ----- .../NumberToElectricCurrentExtensions.g.cs | 73 ------- ...erToElectricCurrentGradientExtensions.g.cs | 52 ----- .../NumberToElectricFieldExtensions.g.cs | 52 ----- .../NumberToElectricInductanceExtensions.g.cs | 52 ----- ...NumberToElectricPotentialAcExtensions.g.cs | 64 ------- ...NumberToElectricPotentialDcExtensions.g.cs | 64 ------- .../NumberToElectricPotentialExtensions.g.cs | 64 ------- .../NumberToElectricResistanceExtensions.g.cs | 61 ------ ...NumberToElectricResistivityExtensions.g.cs | 61 ------ .../Number/NumberToEnergyExtensions.g.cs | 115 ----------- .../Number/NumberToEntropyExtensions.g.cs | 70 ------- .../NumberToForceChangeRateExtensions.g.cs | 82 -------- .../Number/NumberToForceExtensions.g.cs | 79 -------- .../NumberToForcePerLengthExtensions.g.cs | 76 -------- .../Number/NumberToFrequencyExtensions.g.cs | 70 ------- .../Number/NumberToHeatFluxExtensions.g.cs | 97 ---------- ...erToHeatTransferCoefficientExtensions.g.cs | 55 ------ .../Number/NumberToIlluminanceExtensions.g.cs | 61 ------ .../Number/NumberToInformationExtensions.g.cs | 127 ------------ .../Number/NumberToIrradianceExtensions.g.cs | 55 ------ .../Number/NumberToIrradiationExtensions.g.cs | 58 ------ .../NumberToKinematicViscosityExtensions.g.cs | 73 ------- .../Number/NumberToLapseRateExtensions.g.cs | 52 ----- .../Number/NumberToLengthExtensions.g.cs | 115 ----------- .../Number/NumberToLevelExtensions.g.cs | 55 ------ .../NumberToLinearDensityExtensions.g.cs | 58 ------ .../NumberToLuminousFluxExtensions.g.cs | 52 ----- .../NumberToLuminousIntensityExtensions.g.cs | 52 ----- .../NumberToMagneticFieldExtensions.g.cs | 52 ----- .../NumberToMagneticFluxExtensions.g.cs | 52 ----- .../NumberToMagnetizationExtensions.g.cs | 52 ----- .../Number/NumberToMassExtensions.g.cs | 112 ----------- .../Number/NumberToMassFlowExtensions.g.cs | 94 --------- .../Number/NumberToMassFluxExtensions.g.cs | 55 ------ ...NumberToMassMomentOfInertiaExtensions.g.cs | 127 ------------ .../Number/NumberToMolarEnergyExtensions.g.cs | 58 ------ .../NumberToMolarEntropyExtensions.g.cs | 58 ------ .../Number/NumberToMolarMassExtensions.g.cs | 85 -------- .../Number/NumberToMolarityExtensions.g.cs | 73 ------- .../NumberToPermeabilityExtensions.g.cs | 52 ----- .../NumberToPermittivityExtensions.g.cs | 52 ----- .../NumberToPowerDensityExtensions.g.cs | 181 ------------------ .../Number/NumberToPowerExtensions.g.cs | 109 ----------- .../Number/NumberToPowerRatioExtensions.g.cs | 55 ------ .../NumberToPressureChangeRateExtensions.g.cs | 61 ------ .../Number/NumberToPressureExtensions.g.cs | 160 ---------------- .../Number/NumberToRatioExtensions.g.cs | 67 ------- .../NumberToReactiveEnergyExtensions.g.cs | 58 ------ .../NumberToReactivePowerExtensions.g.cs | 61 ------ ...berToRotationalAccelerationExtensions.g.cs | 58 ------ .../NumberToRotationalSpeedExtensions.g.cs | 88 --------- ...NumberToRotationalStiffnessExtensions.g.cs | 58 ------ ...otationalStiffnessPerLengthExtensions.g.cs | 58 ------ .../Number/NumberToSolidAngleExtensions.g.cs | 52 ----- .../NumberToSpecificEnergyExtensions.g.cs | 73 ------- .../NumberToSpecificEntropyExtensions.g.cs | 73 ------- .../NumberToSpecificVolumeExtensions.g.cs | 55 ------ .../NumberToSpecificWeightExtensions.g.cs | 100 ---------- .../Number/NumberToSpeedExtensions.g.cs | 145 -------------- ...mberToTemperatureChangeRateExtensions.g.cs | 79 -------- .../NumberToTemperatureDeltaExtensions.g.cs | 73 ------- .../Number/NumberToTemperatureExtensions.g.cs | 73 ------- ...NumberToThermalConductivityExtensions.g.cs | 55 ------ .../NumberToThermalResistanceExtensions.g.cs | 64 ------- .../Number/NumberToTorqueExtensions.g.cs | 112 ----------- .../Number/NumberToVitaminAExtensions.g.cs | 52 ----- .../Number/NumberToVolumeExtensions.g.cs | 175 ----------------- .../Number/NumberToVolumeFlowExtensions.g.cs | 127 ------------ 90 files changed, 6829 deletions(-) delete mode 100644 UnitsNet/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensions.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs diff --git a/UnitsNet/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensions.cs b/UnitsNet/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensions.cs deleted file mode 100644 index 105ab5df8a..0000000000 --- a/UnitsNet/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensions.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#if !WINDOWS_UWP -// Extension methods/overloads not supported in Universal Windows Platform (WinRT Components) -using System; - -namespace UnitsNet.Extensions.NumberToTimeSpan -{ - public static class NumberToTimeSpanExtensions - { - // ReSharper disable InconsistentNaming - /// Shorthand for . - public static TimeSpan d(this int days) => TimeSpan.FromDays(days); - - /// Shorthand for . - public static TimeSpan d(this long days) => TimeSpan.FromDays(days); - - /// Shorthand for . - public static TimeSpan d(this float days) => TimeSpan.FromDays(days); - - /// Shorthand for . - public static TimeSpan d(this double days) => TimeSpan.FromDays(days); - - /// Shorthand for . - public static TimeSpan d(this decimal days) => TimeSpan.FromDays(Convert.ToDouble(days)); - - /// Shorthand for . - public static TimeSpan h(this int hours) => TimeSpan.FromHours(hours); - - /// Shorthand for . - public static TimeSpan h(this long hours) => TimeSpan.FromHours(hours); - - /// Shorthand for . - public static TimeSpan h(this float hours) => TimeSpan.FromHours(hours); - - /// Shorthand for . - public static TimeSpan h(this double hours) => TimeSpan.FromHours(hours); - - /// Shorthand for . - public static TimeSpan h(this decimal hours) => TimeSpan.FromHours(Convert.ToDouble(hours)); - - /// Shorthand for . - public static TimeSpan m(this int minutes) => TimeSpan.FromMinutes(minutes); - - /// Shorthand for . - public static TimeSpan m(this long minutes) => TimeSpan.FromMinutes(minutes); - - /// Shorthand for . - public static TimeSpan m(this float minutes) => TimeSpan.FromMinutes(minutes); - - /// Shorthand for . - public static TimeSpan m(this double minutes) => TimeSpan.FromMinutes(minutes); - - /// Shorthand for . - public static TimeSpan m(this decimal minutes) => TimeSpan.FromMinutes(Convert.ToDouble(minutes)); - - /// Shorthand for . - public static TimeSpan s(this int seconds) => TimeSpan.FromSeconds(seconds); - - /// Shorthand for . - public static TimeSpan s(this long seconds) => TimeSpan.FromSeconds(seconds); - - /// Shorthand for . - public static TimeSpan s(this float seconds) => TimeSpan.FromSeconds(seconds); - - /// Shorthand for . - public static TimeSpan s(this double seconds) => TimeSpan.FromSeconds(seconds); - - /// Shorthand for . - public static TimeSpan s(this decimal seconds) => TimeSpan.FromSeconds(Convert.ToDouble(seconds)); - - /// Shorthand for . - public static TimeSpan ms(this int milliseconds) => TimeSpan.FromMilliseconds(milliseconds); - - /// Shorthand for . - public static TimeSpan ms(this long milliseconds) => TimeSpan.FromMilliseconds(milliseconds); - - /// Shorthand for . - public static TimeSpan ms(this float milliseconds) => TimeSpan.FromMilliseconds(milliseconds); - - /// Shorthand for . - public static TimeSpan ms(this double milliseconds) => TimeSpan.FromMilliseconds(milliseconds); - - /// Shorthand for . - public static TimeSpan ms(this decimal milliseconds) => TimeSpan.FromMilliseconds(Convert.ToDouble(milliseconds)); - - // ReSharper restore InconsistentNaming - } -} - -#endif \ No newline at end of file diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs deleted file mode 100644 index 7cede6880d..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAccelerationExtensions.g.cs +++ /dev/null @@ -1,88 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToAcceleration -{ - public static class NumberToAccelerationExtensions - { - /// - public static Acceleration CentimetersPerSecondSquared(this T value) => Acceleration.FromCentimetersPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration DecimetersPerSecondSquared(this T value) => Acceleration.FromDecimetersPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration FeetPerSecondSquared(this T value) => Acceleration.FromFeetPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration InchesPerSecondSquared(this T value) => Acceleration.FromInchesPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration KilometersPerSecondSquared(this T value) => Acceleration.FromKilometersPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration KnotsPerHour(this T value) => Acceleration.FromKnotsPerHour(Convert.ToDouble(value)); - - /// - public static Acceleration KnotsPerMinute(this T value) => Acceleration.FromKnotsPerMinute(Convert.ToDouble(value)); - - /// - public static Acceleration KnotsPerSecond(this T value) => Acceleration.FromKnotsPerSecond(Convert.ToDouble(value)); - - /// - public static Acceleration MetersPerSecondSquared(this T value) => Acceleration.FromMetersPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration MicrometersPerSecondSquared(this T value) => Acceleration.FromMicrometersPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration MillimetersPerSecondSquared(this T value) => Acceleration.FromMillimetersPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration NanometersPerSecondSquared(this T value) => Acceleration.FromNanometersPerSecondSquared(Convert.ToDouble(value)); - - /// - public static Acceleration StandardGravity(this T value) => Acceleration.FromStandardGravity(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs deleted file mode 100644 index 8a00acba39..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmountOfSubstanceExtensions.g.cs +++ /dev/null @@ -1,91 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToAmountOfSubstance -{ - public static class NumberToAmountOfSubstanceExtensions - { - /// - public static AmountOfSubstance Centimoles(this T value) => AmountOfSubstance.FromCentimoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance CentipoundMoles(this T value) => AmountOfSubstance.FromCentipoundMoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance Decimoles(this T value) => AmountOfSubstance.FromDecimoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance DecipoundMoles(this T value) => AmountOfSubstance.FromDecipoundMoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance Kilomoles(this T value) => AmountOfSubstance.FromKilomoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance KilopoundMoles(this T value) => AmountOfSubstance.FromKilopoundMoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance Micromoles(this T value) => AmountOfSubstance.FromMicromoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance MicropoundMoles(this T value) => AmountOfSubstance.FromMicropoundMoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance Millimoles(this T value) => AmountOfSubstance.FromMillimoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance MillipoundMoles(this T value) => AmountOfSubstance.FromMillipoundMoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance Moles(this T value) => AmountOfSubstance.FromMoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance Nanomoles(this T value) => AmountOfSubstance.FromNanomoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance NanopoundMoles(this T value) => AmountOfSubstance.FromNanopoundMoles(Convert.ToDouble(value)); - - /// - public static AmountOfSubstance PoundMoles(this T value) => AmountOfSubstance.FromPoundMoles(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs deleted file mode 100644 index 7b6ccbc891..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAmplitudeRatioExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToAmplitudeRatio -{ - public static class NumberToAmplitudeRatioExtensions - { - /// - public static AmplitudeRatio DecibelMicrovolts(this T value) => AmplitudeRatio.FromDecibelMicrovolts(Convert.ToDouble(value)); - - /// - public static AmplitudeRatio DecibelMillivolts(this T value) => AmplitudeRatio.FromDecibelMillivolts(Convert.ToDouble(value)); - - /// - public static AmplitudeRatio DecibelsUnloaded(this T value) => AmplitudeRatio.FromDecibelsUnloaded(Convert.ToDouble(value)); - - /// - public static AmplitudeRatio DecibelVolts(this T value) => AmplitudeRatio.FromDecibelVolts(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs deleted file mode 100644 index 0b34dcbc7f..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAngleExtensions.g.cs +++ /dev/null @@ -1,91 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToAngle -{ - public static class NumberToAngleExtensions - { - /// - public static Angle Arcminutes(this T value) => Angle.FromArcminutes(Convert.ToDouble(value)); - - /// - public static Angle Arcseconds(this T value) => Angle.FromArcseconds(Convert.ToDouble(value)); - - /// - public static Angle Centiradians(this T value) => Angle.FromCentiradians(Convert.ToDouble(value)); - - /// - public static Angle Deciradians(this T value) => Angle.FromDeciradians(Convert.ToDouble(value)); - - /// - public static Angle Degrees(this T value) => Angle.FromDegrees(Convert.ToDouble(value)); - - /// - public static Angle Gradians(this T value) => Angle.FromGradians(Convert.ToDouble(value)); - - /// - public static Angle Microdegrees(this T value) => Angle.FromMicrodegrees(Convert.ToDouble(value)); - - /// - public static Angle Microradians(this T value) => Angle.FromMicroradians(Convert.ToDouble(value)); - - /// - public static Angle Millidegrees(this T value) => Angle.FromMillidegrees(Convert.ToDouble(value)); - - /// - public static Angle Milliradians(this T value) => Angle.FromMilliradians(Convert.ToDouble(value)); - - /// - public static Angle Nanodegrees(this T value) => Angle.FromNanodegrees(Convert.ToDouble(value)); - - /// - public static Angle Nanoradians(this T value) => Angle.FromNanoradians(Convert.ToDouble(value)); - - /// - public static Angle Radians(this T value) => Angle.FromRadians(Convert.ToDouble(value)); - - /// - public static Angle Revolutions(this T value) => Angle.FromRevolutions(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs deleted file mode 100644 index 0c007ff083..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentEnergyExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToApparentEnergy -{ - public static class NumberToApparentEnergyExtensions - { - /// - public static ApparentEnergy KilovoltampereHours(this T value) => ApparentEnergy.FromKilovoltampereHours(Convert.ToDouble(value)); - - /// - public static ApparentEnergy MegavoltampereHours(this T value) => ApparentEnergy.FromMegavoltampereHours(Convert.ToDouble(value)); - - /// - public static ApparentEnergy VoltampereHours(this T value) => ApparentEnergy.FromVoltampereHours(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs deleted file mode 100644 index 17f85155fd..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToApparentPowerExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToApparentPower -{ - public static class NumberToApparentPowerExtensions - { - /// - public static ApparentPower Gigavoltamperes(this T value) => ApparentPower.FromGigavoltamperes(Convert.ToDouble(value)); - - /// - public static ApparentPower Kilovoltamperes(this T value) => ApparentPower.FromKilovoltamperes(Convert.ToDouble(value)); - - /// - public static ApparentPower Megavoltamperes(this T value) => ApparentPower.FromMegavoltamperes(Convert.ToDouble(value)); - - /// - public static ApparentPower Voltamperes(this T value) => ApparentPower.FromVoltamperes(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs deleted file mode 100644 index 6a67802f24..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaDensityExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToAreaDensity -{ - public static class NumberToAreaDensityExtensions - { - /// - public static AreaDensity KilogramsPerSquareMeter(this T value) => AreaDensity.FromKilogramsPerSquareMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs deleted file mode 100644 index aa22221e89..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaExtensions.g.cs +++ /dev/null @@ -1,88 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToArea -{ - public static class NumberToAreaExtensions - { - /// - public static Area Acres(this T value) => Area.FromAcres(Convert.ToDouble(value)); - - /// - public static Area Hectares(this T value) => Area.FromHectares(Convert.ToDouble(value)); - - /// - public static Area SquareCentimeters(this T value) => Area.FromSquareCentimeters(Convert.ToDouble(value)); - - /// - public static Area SquareDecimeters(this T value) => Area.FromSquareDecimeters(Convert.ToDouble(value)); - - /// - public static Area SquareFeet(this T value) => Area.FromSquareFeet(Convert.ToDouble(value)); - - /// - public static Area SquareInches(this T value) => Area.FromSquareInches(Convert.ToDouble(value)); - - /// - public static Area SquareKilometers(this T value) => Area.FromSquareKilometers(Convert.ToDouble(value)); - - /// - public static Area SquareMeters(this T value) => Area.FromSquareMeters(Convert.ToDouble(value)); - - /// - public static Area SquareMicrometers(this T value) => Area.FromSquareMicrometers(Convert.ToDouble(value)); - - /// - public static Area SquareMiles(this T value) => Area.FromSquareMiles(Convert.ToDouble(value)); - - /// - public static Area SquareMillimeters(this T value) => Area.FromSquareMillimeters(Convert.ToDouble(value)); - - /// - public static Area SquareYards(this T value) => Area.FromSquareYards(Convert.ToDouble(value)); - - /// - public static Area UsSurveySquareFeet(this T value) => Area.FromUsSurveySquareFeet(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs deleted file mode 100644 index 1917cf1a82..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToAreaMomentOfInertiaExtensions.g.cs +++ /dev/null @@ -1,67 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToAreaMomentOfInertia -{ - public static class NumberToAreaMomentOfInertiaExtensions - { - /// - public static AreaMomentOfInertia CentimetersToTheFourth(this T value) => AreaMomentOfInertia.FromCentimetersToTheFourth(Convert.ToDouble(value)); - - /// - public static AreaMomentOfInertia DecimetersToTheFourth(this T value) => AreaMomentOfInertia.FromDecimetersToTheFourth(Convert.ToDouble(value)); - - /// - public static AreaMomentOfInertia FeetToTheFourth(this T value) => AreaMomentOfInertia.FromFeetToTheFourth(Convert.ToDouble(value)); - - /// - public static AreaMomentOfInertia InchesToTheFourth(this T value) => AreaMomentOfInertia.FromInchesToTheFourth(Convert.ToDouble(value)); - - /// - public static AreaMomentOfInertia MetersToTheFourth(this T value) => AreaMomentOfInertia.FromMetersToTheFourth(Convert.ToDouble(value)); - - /// - public static AreaMomentOfInertia MillimetersToTheFourth(this T value) => AreaMomentOfInertia.FromMillimetersToTheFourth(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs deleted file mode 100644 index 83969b3527..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBitRateExtensions.g.cs +++ /dev/null @@ -1,127 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToBitRate -{ - public static class NumberToBitRateExtensions - { - /// - public static BitRate BitsPerSecond(this T value) => BitRate.FromBitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate BytesPerSecond(this T value) => BitRate.FromBytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate ExabitsPerSecond(this T value) => BitRate.FromExabitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate ExabytesPerSecond(this T value) => BitRate.FromExabytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate ExbibitsPerSecond(this T value) => BitRate.FromExbibitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate ExbibytesPerSecond(this T value) => BitRate.FromExbibytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate GibibitsPerSecond(this T value) => BitRate.FromGibibitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate GibibytesPerSecond(this T value) => BitRate.FromGibibytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate GigabitsPerSecond(this T value) => BitRate.FromGigabitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate GigabytesPerSecond(this T value) => BitRate.FromGigabytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate KibibitsPerSecond(this T value) => BitRate.FromKibibitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate KibibytesPerSecond(this T value) => BitRate.FromKibibytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate KilobitsPerSecond(this T value) => BitRate.FromKilobitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate KilobytesPerSecond(this T value) => BitRate.FromKilobytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate MebibitsPerSecond(this T value) => BitRate.FromMebibitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate MebibytesPerSecond(this T value) => BitRate.FromMebibytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate MegabitsPerSecond(this T value) => BitRate.FromMegabitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate MegabytesPerSecond(this T value) => BitRate.FromMegabytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate PebibitsPerSecond(this T value) => BitRate.FromPebibitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate PebibytesPerSecond(this T value) => BitRate.FromPebibytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate PetabitsPerSecond(this T value) => BitRate.FromPetabitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate PetabytesPerSecond(this T value) => BitRate.FromPetabytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate TebibitsPerSecond(this T value) => BitRate.FromTebibitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate TebibytesPerSecond(this T value) => BitRate.FromTebibytesPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate TerabitsPerSecond(this T value) => BitRate.FromTerabitsPerSecond(Convert.ToDouble(value)); - - /// - public static BitRate TerabytesPerSecond(this T value) => BitRate.FromTerabytesPerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs deleted file mode 100644 index 209e93833b..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToBrakeSpecificFuelConsumptionExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToBrakeSpecificFuelConsumption -{ - public static class NumberToBrakeSpecificFuelConsumptionExtensions - { - /// - public static BrakeSpecificFuelConsumption GramsPerKiloWattHour(this T value) => BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(Convert.ToDouble(value)); - - /// - public static BrakeSpecificFuelConsumption KilogramsPerJoule(this T value) => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(Convert.ToDouble(value)); - - /// - public static BrakeSpecificFuelConsumption PoundsPerMechanicalHorsepowerHour(this T value) => BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs deleted file mode 100644 index 7c4f20237f..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToCapacitanceExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToCapacitance -{ - public static class NumberToCapacitanceExtensions - { - /// - public static Capacitance Farads(this T value) => Capacitance.FromFarads(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs deleted file mode 100644 index ebcbefd1ac..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDensityExtensions.g.cs +++ /dev/null @@ -1,163 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToDensity -{ - public static class NumberToDensityExtensions - { - /// - public static Density CentigramsPerDeciLiter(this T value) => Density.FromCentigramsPerDeciLiter(Convert.ToDouble(value)); - - /// - public static Density CentigramsPerLiter(this T value) => Density.FromCentigramsPerLiter(Convert.ToDouble(value)); - - /// - public static Density CentigramsPerMilliliter(this T value) => Density.FromCentigramsPerMilliliter(Convert.ToDouble(value)); - - /// - public static Density DecigramsPerDeciLiter(this T value) => Density.FromDecigramsPerDeciLiter(Convert.ToDouble(value)); - - /// - public static Density DecigramsPerLiter(this T value) => Density.FromDecigramsPerLiter(Convert.ToDouble(value)); - - /// - public static Density DecigramsPerMilliliter(this T value) => Density.FromDecigramsPerMilliliter(Convert.ToDouble(value)); - - /// - public static Density GramsPerCubicCentimeter(this T value) => Density.FromGramsPerCubicCentimeter(Convert.ToDouble(value)); - - /// - public static Density GramsPerCubicMeter(this T value) => Density.FromGramsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static Density GramsPerCubicMillimeter(this T value) => Density.FromGramsPerCubicMillimeter(Convert.ToDouble(value)); - - /// - public static Density GramsPerDeciLiter(this T value) => Density.FromGramsPerDeciLiter(Convert.ToDouble(value)); - - /// - public static Density GramsPerLiter(this T value) => Density.FromGramsPerLiter(Convert.ToDouble(value)); - - /// - public static Density GramsPerMilliliter(this T value) => Density.FromGramsPerMilliliter(Convert.ToDouble(value)); - - /// - public static Density KilogramsPerCubicCentimeter(this T value) => Density.FromKilogramsPerCubicCentimeter(Convert.ToDouble(value)); - - /// - public static Density KilogramsPerCubicMeter(this T value) => Density.FromKilogramsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static Density KilogramsPerCubicMillimeter(this T value) => Density.FromKilogramsPerCubicMillimeter(Convert.ToDouble(value)); - - /// - public static Density KilopoundsPerCubicFoot(this T value) => Density.FromKilopoundsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static Density KilopoundsPerCubicInch(this T value) => Density.FromKilopoundsPerCubicInch(Convert.ToDouble(value)); - - /// - public static Density MicrogramsPerDeciLiter(this T value) => Density.FromMicrogramsPerDeciLiter(Convert.ToDouble(value)); - - /// - public static Density MicrogramsPerLiter(this T value) => Density.FromMicrogramsPerLiter(Convert.ToDouble(value)); - - /// - public static Density MicrogramsPerMilliliter(this T value) => Density.FromMicrogramsPerMilliliter(Convert.ToDouble(value)); - - /// - public static Density MilligramsPerCubicMeter(this T value) => Density.FromMilligramsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static Density MilligramsPerDeciLiter(this T value) => Density.FromMilligramsPerDeciLiter(Convert.ToDouble(value)); - - /// - public static Density MilligramsPerLiter(this T value) => Density.FromMilligramsPerLiter(Convert.ToDouble(value)); - - /// - public static Density MilligramsPerMilliliter(this T value) => Density.FromMilligramsPerMilliliter(Convert.ToDouble(value)); - - /// - public static Density NanogramsPerDeciLiter(this T value) => Density.FromNanogramsPerDeciLiter(Convert.ToDouble(value)); - - /// - public static Density NanogramsPerLiter(this T value) => Density.FromNanogramsPerLiter(Convert.ToDouble(value)); - - /// - public static Density NanogramsPerMilliliter(this T value) => Density.FromNanogramsPerMilliliter(Convert.ToDouble(value)); - - /// - public static Density PicogramsPerDeciLiter(this T value) => Density.FromPicogramsPerDeciLiter(Convert.ToDouble(value)); - - /// - public static Density PicogramsPerLiter(this T value) => Density.FromPicogramsPerLiter(Convert.ToDouble(value)); - - /// - public static Density PicogramsPerMilliliter(this T value) => Density.FromPicogramsPerMilliliter(Convert.ToDouble(value)); - - /// - public static Density PoundsPerCubicFoot(this T value) => Density.FromPoundsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static Density PoundsPerCubicInch(this T value) => Density.FromPoundsPerCubicInch(Convert.ToDouble(value)); - - /// - public static Density PoundsPerImperialGallon(this T value) => Density.FromPoundsPerImperialGallon(Convert.ToDouble(value)); - - /// - public static Density PoundsPerUSGallon(this T value) => Density.FromPoundsPerUSGallon(Convert.ToDouble(value)); - - /// - public static Density SlugsPerCubicFoot(this T value) => Density.FromSlugsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static Density TonnesPerCubicCentimeter(this T value) => Density.FromTonnesPerCubicCentimeter(Convert.ToDouble(value)); - - /// - public static Density TonnesPerCubicMeter(this T value) => Density.FromTonnesPerCubicMeter(Convert.ToDouble(value)); - - /// - public static Density TonnesPerCubicMillimeter(this T value) => Density.FromTonnesPerCubicMillimeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs deleted file mode 100644 index 9691f727c8..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDurationExtensions.g.cs +++ /dev/null @@ -1,79 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToDuration -{ - public static class NumberToDurationExtensions - { - /// - public static Duration Days(this T value) => Duration.FromDays(Convert.ToDouble(value)); - - /// - public static Duration Hours(this T value) => Duration.FromHours(Convert.ToDouble(value)); - - /// - public static Duration Microseconds(this T value) => Duration.FromMicroseconds(Convert.ToDouble(value)); - - /// - public static Duration Milliseconds(this T value) => Duration.FromMilliseconds(Convert.ToDouble(value)); - - /// - public static Duration Minutes(this T value) => Duration.FromMinutes(Convert.ToDouble(value)); - - /// - public static Duration Months30(this T value) => Duration.FromMonths30(Convert.ToDouble(value)); - - /// - public static Duration Nanoseconds(this T value) => Duration.FromNanoseconds(Convert.ToDouble(value)); - - /// - public static Duration Seconds(this T value) => Duration.FromSeconds(Convert.ToDouble(value)); - - /// - public static Duration Weeks(this T value) => Duration.FromWeeks(Convert.ToDouble(value)); - - /// - public static Duration Years365(this T value) => Duration.FromYears365(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs deleted file mode 100644 index 362f462bf0..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToDynamicViscosityExtensions.g.cs +++ /dev/null @@ -1,67 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToDynamicViscosity -{ - public static class NumberToDynamicViscosityExtensions - { - /// - public static DynamicViscosity Centipoise(this T value) => DynamicViscosity.FromCentipoise(Convert.ToDouble(value)); - - /// - public static DynamicViscosity MicropascalSeconds(this T value) => DynamicViscosity.FromMicropascalSeconds(Convert.ToDouble(value)); - - /// - public static DynamicViscosity MillipascalSeconds(this T value) => DynamicViscosity.FromMillipascalSeconds(Convert.ToDouble(value)); - - /// - public static DynamicViscosity NewtonSecondsPerMeterSquared(this T value) => DynamicViscosity.FromNewtonSecondsPerMeterSquared(Convert.ToDouble(value)); - - /// - public static DynamicViscosity PascalSeconds(this T value) => DynamicViscosity.FromPascalSeconds(Convert.ToDouble(value)); - - /// - public static DynamicViscosity Poise(this T value) => DynamicViscosity.FromPoise(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs deleted file mode 100644 index 9f4abe488a..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricAdmittanceExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricAdmittance -{ - public static class NumberToElectricAdmittanceExtensions - { - /// - public static ElectricAdmittance Microsiemens(this T value) => ElectricAdmittance.FromMicrosiemens(Convert.ToDouble(value)); - - /// - public static ElectricAdmittance Millisiemens(this T value) => ElectricAdmittance.FromMillisiemens(Convert.ToDouble(value)); - - /// - public static ElectricAdmittance Nanosiemens(this T value) => ElectricAdmittance.FromNanosiemens(Convert.ToDouble(value)); - - /// - public static ElectricAdmittance Siemens(this T value) => ElectricAdmittance.FromSiemens(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs deleted file mode 100644 index 4c1ac1c46b..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeDensityExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricChargeDensity -{ - public static class NumberToElectricChargeDensityExtensions - { - /// - public static ElectricChargeDensity CoulombsPerCubicMeter(this T value) => ElectricChargeDensity.FromCoulombsPerCubicMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs deleted file mode 100644 index 5573d06a98..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricChargeExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricCharge -{ - public static class NumberToElectricChargeExtensions - { - /// - public static ElectricCharge Coulombs(this T value) => ElectricCharge.FromCoulombs(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs deleted file mode 100644 index 843261ed40..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductanceExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricConductance -{ - public static class NumberToElectricConductanceExtensions - { - /// - public static ElectricConductance Microsiemens(this T value) => ElectricConductance.FromMicrosiemens(Convert.ToDouble(value)); - - /// - public static ElectricConductance Millisiemens(this T value) => ElectricConductance.FromMillisiemens(Convert.ToDouble(value)); - - /// - public static ElectricConductance Siemens(this T value) => ElectricConductance.FromSiemens(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs deleted file mode 100644 index 311328fedb..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricConductivityExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricConductivity -{ - public static class NumberToElectricConductivityExtensions - { - /// - public static ElectricConductivity SiemensPerMeter(this T value) => ElectricConductivity.FromSiemensPerMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs deleted file mode 100644 index 7ced6e9098..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentDensityExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricCurrentDensity -{ - public static class NumberToElectricCurrentDensityExtensions - { - /// - public static ElectricCurrentDensity AmperesPerSquareMeter(this T value) => ElectricCurrentDensity.FromAmperesPerSquareMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs deleted file mode 100644 index cebeaa5cd6..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentExtensions.g.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricCurrent -{ - public static class NumberToElectricCurrentExtensions - { - /// - public static ElectricCurrent Amperes(this T value) => ElectricCurrent.FromAmperes(Convert.ToDouble(value)); - - /// - public static ElectricCurrent Centiamperes(this T value) => ElectricCurrent.FromCentiamperes(Convert.ToDouble(value)); - - /// - public static ElectricCurrent Kiloamperes(this T value) => ElectricCurrent.FromKiloamperes(Convert.ToDouble(value)); - - /// - public static ElectricCurrent Megaamperes(this T value) => ElectricCurrent.FromMegaamperes(Convert.ToDouble(value)); - - /// - public static ElectricCurrent Microamperes(this T value) => ElectricCurrent.FromMicroamperes(Convert.ToDouble(value)); - - /// - public static ElectricCurrent Milliamperes(this T value) => ElectricCurrent.FromMilliamperes(Convert.ToDouble(value)); - - /// - public static ElectricCurrent Nanoamperes(this T value) => ElectricCurrent.FromNanoamperes(Convert.ToDouble(value)); - - /// - public static ElectricCurrent Picoamperes(this T value) => ElectricCurrent.FromPicoamperes(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs deleted file mode 100644 index 19456d74dc..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricCurrentGradientExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricCurrentGradient -{ - public static class NumberToElectricCurrentGradientExtensions - { - /// - public static ElectricCurrentGradient AmperesPerSecond(this T value) => ElectricCurrentGradient.FromAmperesPerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs deleted file mode 100644 index 3b18fa3e9c..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricFieldExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricField -{ - public static class NumberToElectricFieldExtensions - { - /// - public static ElectricField VoltsPerMeter(this T value) => ElectricField.FromVoltsPerMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs deleted file mode 100644 index 32210c78ae..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricInductanceExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricInductance -{ - public static class NumberToElectricInductanceExtensions - { - /// - public static ElectricInductance Henries(this T value) => ElectricInductance.FromHenries(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs deleted file mode 100644 index 7a9623efee..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialAcExtensions.g.cs +++ /dev/null @@ -1,64 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricPotentialAc -{ - public static class NumberToElectricPotentialAcExtensions - { - /// - public static ElectricPotentialAc KilovoltsAc(this T value) => ElectricPotentialAc.FromKilovoltsAc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialAc MegavoltsAc(this T value) => ElectricPotentialAc.FromMegavoltsAc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialAc MicrovoltsAc(this T value) => ElectricPotentialAc.FromMicrovoltsAc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialAc MillivoltsAc(this T value) => ElectricPotentialAc.FromMillivoltsAc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialAc VoltsAc(this T value) => ElectricPotentialAc.FromVoltsAc(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs deleted file mode 100644 index 0322b95071..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialDcExtensions.g.cs +++ /dev/null @@ -1,64 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricPotentialDc -{ - public static class NumberToElectricPotentialDcExtensions - { - /// - public static ElectricPotentialDc KilovoltsDc(this T value) => ElectricPotentialDc.FromKilovoltsDc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialDc MegavoltsDc(this T value) => ElectricPotentialDc.FromMegavoltsDc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialDc MicrovoltsDc(this T value) => ElectricPotentialDc.FromMicrovoltsDc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialDc MillivoltsDc(this T value) => ElectricPotentialDc.FromMillivoltsDc(Convert.ToDouble(value)); - - /// - public static ElectricPotentialDc VoltsDc(this T value) => ElectricPotentialDc.FromVoltsDc(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs deleted file mode 100644 index ab4f96ce53..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricPotentialExtensions.g.cs +++ /dev/null @@ -1,64 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricPotential -{ - public static class NumberToElectricPotentialExtensions - { - /// - public static ElectricPotential Kilovolts(this T value) => ElectricPotential.FromKilovolts(Convert.ToDouble(value)); - - /// - public static ElectricPotential Megavolts(this T value) => ElectricPotential.FromMegavolts(Convert.ToDouble(value)); - - /// - public static ElectricPotential Microvolts(this T value) => ElectricPotential.FromMicrovolts(Convert.ToDouble(value)); - - /// - public static ElectricPotential Millivolts(this T value) => ElectricPotential.FromMillivolts(Convert.ToDouble(value)); - - /// - public static ElectricPotential Volts(this T value) => ElectricPotential.FromVolts(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs deleted file mode 100644 index 2ceb16ce7a..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistanceExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricResistance -{ - public static class NumberToElectricResistanceExtensions - { - /// - public static ElectricResistance Kiloohms(this T value) => ElectricResistance.FromKiloohms(Convert.ToDouble(value)); - - /// - public static ElectricResistance Megaohms(this T value) => ElectricResistance.FromMegaohms(Convert.ToDouble(value)); - - /// - public static ElectricResistance Milliohms(this T value) => ElectricResistance.FromMilliohms(Convert.ToDouble(value)); - - /// - public static ElectricResistance Ohms(this T value) => ElectricResistance.FromOhms(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs deleted file mode 100644 index 264db20bda..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToElectricResistivityExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToElectricResistivity -{ - public static class NumberToElectricResistivityExtensions - { - /// - public static ElectricResistivity MicroohmMeters(this T value) => ElectricResistivity.FromMicroohmMeters(Convert.ToDouble(value)); - - /// - public static ElectricResistivity MilliohmMeters(this T value) => ElectricResistivity.FromMilliohmMeters(Convert.ToDouble(value)); - - /// - public static ElectricResistivity NanoohmMeters(this T value) => ElectricResistivity.FromNanoohmMeters(Convert.ToDouble(value)); - - /// - public static ElectricResistivity OhmMeters(this T value) => ElectricResistivity.FromOhmMeters(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs deleted file mode 100644 index 61618ec154..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEnergyExtensions.g.cs +++ /dev/null @@ -1,115 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToEnergy -{ - public static class NumberToEnergyExtensions - { - /// - public static Energy BritishThermalUnits(this T value) => Energy.FromBritishThermalUnits(Convert.ToDouble(value)); - - /// - public static Energy Calories(this T value) => Energy.FromCalories(Convert.ToDouble(value)); - - /// - public static Energy DecathermsEc(this T value) => Energy.FromDecathermsEc(Convert.ToDouble(value)); - - /// - public static Energy DecathermsImperial(this T value) => Energy.FromDecathermsImperial(Convert.ToDouble(value)); - - /// - public static Energy DecathermsUs(this T value) => Energy.FromDecathermsUs(Convert.ToDouble(value)); - - /// - public static Energy ElectronVolts(this T value) => Energy.FromElectronVolts(Convert.ToDouble(value)); - - /// - public static Energy Ergs(this T value) => Energy.FromErgs(Convert.ToDouble(value)); - - /// - public static Energy FootPounds(this T value) => Energy.FromFootPounds(Convert.ToDouble(value)); - - /// - public static Energy GigabritishThermalUnits(this T value) => Energy.FromGigabritishThermalUnits(Convert.ToDouble(value)); - - /// - public static Energy GigawattHours(this T value) => Energy.FromGigawattHours(Convert.ToDouble(value)); - - /// - public static Energy Joules(this T value) => Energy.FromJoules(Convert.ToDouble(value)); - - /// - public static Energy KilobritishThermalUnits(this T value) => Energy.FromKilobritishThermalUnits(Convert.ToDouble(value)); - - /// - public static Energy Kilocalories(this T value) => Energy.FromKilocalories(Convert.ToDouble(value)); - - /// - public static Energy Kilojoules(this T value) => Energy.FromKilojoules(Convert.ToDouble(value)); - - /// - public static Energy KilowattHours(this T value) => Energy.FromKilowattHours(Convert.ToDouble(value)); - - /// - public static Energy MegabritishThermalUnits(this T value) => Energy.FromMegabritishThermalUnits(Convert.ToDouble(value)); - - /// - public static Energy Megajoules(this T value) => Energy.FromMegajoules(Convert.ToDouble(value)); - - /// - public static Energy MegawattHours(this T value) => Energy.FromMegawattHours(Convert.ToDouble(value)); - - /// - public static Energy ThermsEc(this T value) => Energy.FromThermsEc(Convert.ToDouble(value)); - - /// - public static Energy ThermsImperial(this T value) => Energy.FromThermsImperial(Convert.ToDouble(value)); - - /// - public static Energy ThermsUs(this T value) => Energy.FromThermsUs(Convert.ToDouble(value)); - - /// - public static Energy WattHours(this T value) => Energy.FromWattHours(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs deleted file mode 100644 index 2ff8c28351..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToEntropyExtensions.g.cs +++ /dev/null @@ -1,70 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToEntropy -{ - public static class NumberToEntropyExtensions - { - /// - public static Entropy CaloriesPerKelvin(this T value) => Entropy.FromCaloriesPerKelvin(Convert.ToDouble(value)); - - /// - public static Entropy JoulesPerDegreeCelsius(this T value) => Entropy.FromJoulesPerDegreeCelsius(Convert.ToDouble(value)); - - /// - public static Entropy JoulesPerKelvin(this T value) => Entropy.FromJoulesPerKelvin(Convert.ToDouble(value)); - - /// - public static Entropy KilocaloriesPerKelvin(this T value) => Entropy.FromKilocaloriesPerKelvin(Convert.ToDouble(value)); - - /// - public static Entropy KilojoulesPerDegreeCelsius(this T value) => Entropy.FromKilojoulesPerDegreeCelsius(Convert.ToDouble(value)); - - /// - public static Entropy KilojoulesPerKelvin(this T value) => Entropy.FromKilojoulesPerKelvin(Convert.ToDouble(value)); - - /// - public static Entropy MegajoulesPerKelvin(this T value) => Entropy.FromMegajoulesPerKelvin(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs deleted file mode 100644 index b58d9e2a79..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceChangeRateExtensions.g.cs +++ /dev/null @@ -1,82 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToForceChangeRate -{ - public static class NumberToForceChangeRateExtensions - { - /// - public static ForceChangeRate CentinewtonsPerSecond(this T value) => ForceChangeRate.FromCentinewtonsPerSecond(Convert.ToDouble(value)); - - /// - public static ForceChangeRate DecanewtonsPerMinute(this T value) => ForceChangeRate.FromDecanewtonsPerMinute(Convert.ToDouble(value)); - - /// - public static ForceChangeRate DecanewtonsPerSecond(this T value) => ForceChangeRate.FromDecanewtonsPerSecond(Convert.ToDouble(value)); - - /// - public static ForceChangeRate DecinewtonsPerSecond(this T value) => ForceChangeRate.FromDecinewtonsPerSecond(Convert.ToDouble(value)); - - /// - public static ForceChangeRate KilonewtonsPerMinute(this T value) => ForceChangeRate.FromKilonewtonsPerMinute(Convert.ToDouble(value)); - - /// - public static ForceChangeRate KilonewtonsPerSecond(this T value) => ForceChangeRate.FromKilonewtonsPerSecond(Convert.ToDouble(value)); - - /// - public static ForceChangeRate MicronewtonsPerSecond(this T value) => ForceChangeRate.FromMicronewtonsPerSecond(Convert.ToDouble(value)); - - /// - public static ForceChangeRate MillinewtonsPerSecond(this T value) => ForceChangeRate.FromMillinewtonsPerSecond(Convert.ToDouble(value)); - - /// - public static ForceChangeRate NanonewtonsPerSecond(this T value) => ForceChangeRate.FromNanonewtonsPerSecond(Convert.ToDouble(value)); - - /// - public static ForceChangeRate NewtonsPerMinute(this T value) => ForceChangeRate.FromNewtonsPerMinute(Convert.ToDouble(value)); - - /// - public static ForceChangeRate NewtonsPerSecond(this T value) => ForceChangeRate.FromNewtonsPerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs deleted file mode 100644 index 4e78aba2c8..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForceExtensions.g.cs +++ /dev/null @@ -1,79 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToForce -{ - public static class NumberToForceExtensions - { - /// - public static Force Decanewtons(this T value) => Force.FromDecanewtons(Convert.ToDouble(value)); - - /// - public static Force Dyne(this T value) => Force.FromDyne(Convert.ToDouble(value)); - - /// - public static Force KilogramsForce(this T value) => Force.FromKilogramsForce(Convert.ToDouble(value)); - - /// - public static Force Kilonewtons(this T value) => Force.FromKilonewtons(Convert.ToDouble(value)); - - /// - public static Force KiloPonds(this T value) => Force.FromKiloPonds(Convert.ToDouble(value)); - - /// - public static Force Meganewtons(this T value) => Force.FromMeganewtons(Convert.ToDouble(value)); - - /// - public static Force Newtons(this T value) => Force.FromNewtons(Convert.ToDouble(value)); - - /// - public static Force Poundals(this T value) => Force.FromPoundals(Convert.ToDouble(value)); - - /// - public static Force PoundsForce(this T value) => Force.FromPoundsForce(Convert.ToDouble(value)); - - /// - public static Force TonnesForce(this T value) => Force.FromTonnesForce(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs deleted file mode 100644 index 7a5cd2d5a2..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToForcePerLengthExtensions.g.cs +++ /dev/null @@ -1,76 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToForcePerLength -{ - public static class NumberToForcePerLengthExtensions - { - /// - public static ForcePerLength CentinewtonsPerMeter(this T value) => ForcePerLength.FromCentinewtonsPerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength DecinewtonsPerMeter(this T value) => ForcePerLength.FromDecinewtonsPerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength KilogramsForcePerMeter(this T value) => ForcePerLength.FromKilogramsForcePerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength KilonewtonsPerMeter(this T value) => ForcePerLength.FromKilonewtonsPerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength MeganewtonsPerMeter(this T value) => ForcePerLength.FromMeganewtonsPerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength MicronewtonsPerMeter(this T value) => ForcePerLength.FromMicronewtonsPerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength MillinewtonsPerMeter(this T value) => ForcePerLength.FromMillinewtonsPerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength NanonewtonsPerMeter(this T value) => ForcePerLength.FromNanonewtonsPerMeter(Convert.ToDouble(value)); - - /// - public static ForcePerLength NewtonsPerMeter(this T value) => ForcePerLength.FromNewtonsPerMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs deleted file mode 100644 index 313563c5e1..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToFrequencyExtensions.g.cs +++ /dev/null @@ -1,70 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToFrequency -{ - public static class NumberToFrequencyExtensions - { - /// - public static Frequency CyclesPerHour(this T value) => Frequency.FromCyclesPerHour(Convert.ToDouble(value)); - - /// - public static Frequency CyclesPerMinute(this T value) => Frequency.FromCyclesPerMinute(Convert.ToDouble(value)); - - /// - public static Frequency Gigahertz(this T value) => Frequency.FromGigahertz(Convert.ToDouble(value)); - - /// - public static Frequency Hertz(this T value) => Frequency.FromHertz(Convert.ToDouble(value)); - - /// - public static Frequency Kilohertz(this T value) => Frequency.FromKilohertz(Convert.ToDouble(value)); - - /// - public static Frequency Megahertz(this T value) => Frequency.FromMegahertz(Convert.ToDouble(value)); - - /// - public static Frequency Terahertz(this T value) => Frequency.FromTerahertz(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs deleted file mode 100644 index 737ca32544..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs +++ /dev/null @@ -1,97 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToHeatFlux -{ - public static class NumberToHeatFluxExtensions - { - /// - public static HeatFlux BtusPerHourSquareFoot(this T value) => HeatFlux.FromBtusPerHourSquareFoot(Convert.ToDouble(value)); - - /// - public static HeatFlux BtusPerMinuteSquareFoot(this T value) => HeatFlux.FromBtusPerMinuteSquareFoot(Convert.ToDouble(value)); - - /// - public static HeatFlux BtusPerSecondSquareFoot(this T value) => HeatFlux.FromBtusPerSecondSquareFoot(Convert.ToDouble(value)); - - /// - public static HeatFlux BtusPerSecondSquareInch(this T value) => HeatFlux.FromBtusPerSecondSquareInch(Convert.ToDouble(value)); - - /// - public static HeatFlux CaloriesPerSecondSquareCentimeter(this T value) => HeatFlux.FromCaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); - - /// - public static HeatFlux CentiwattsPerSquareMeter(this T value) => HeatFlux.FromCentiwattsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static HeatFlux DeciwattsPerSquareMeter(this T value) => HeatFlux.FromDeciwattsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static HeatFlux KilocaloriesPerHourSquareMeter(this T value) => HeatFlux.FromKilocaloriesPerHourSquareMeter(Convert.ToDouble(value)); - - /// - public static HeatFlux KilocaloriesPerSecondSquareCentimeter(this T value) => HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(Convert.ToDouble(value)); - - /// - public static HeatFlux KilowattsPerSquareMeter(this T value) => HeatFlux.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static HeatFlux MicrowattsPerSquareMeter(this T value) => HeatFlux.FromMicrowattsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static HeatFlux MilliwattsPerSquareMeter(this T value) => HeatFlux.FromMilliwattsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static HeatFlux NanowattsPerSquareMeter(this T value) => HeatFlux.FromNanowattsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static HeatFlux WattsPerSquareFoot(this T value) => HeatFlux.FromWattsPerSquareFoot(Convert.ToDouble(value)); - - /// - public static HeatFlux WattsPerSquareInch(this T value) => HeatFlux.FromWattsPerSquareInch(Convert.ToDouble(value)); - - /// - public static HeatFlux WattsPerSquareMeter(this T value) => HeatFlux.FromWattsPerSquareMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs deleted file mode 100644 index e47213f176..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatTransferCoefficientExtensions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToHeatTransferCoefficient -{ - public static class NumberToHeatTransferCoefficientExtensions - { - /// - public static HeatTransferCoefficient WattsPerSquareMeterCelsius(this T value) => HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(Convert.ToDouble(value)); - - /// - public static HeatTransferCoefficient WattsPerSquareMeterKelvin(this T value) => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs deleted file mode 100644 index 63a4c2d79c..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIlluminanceExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToIlluminance -{ - public static class NumberToIlluminanceExtensions - { - /// - public static Illuminance Kilolux(this T value) => Illuminance.FromKilolux(Convert.ToDouble(value)); - - /// - public static Illuminance Lux(this T value) => Illuminance.FromLux(Convert.ToDouble(value)); - - /// - public static Illuminance Megalux(this T value) => Illuminance.FromMegalux(Convert.ToDouble(value)); - - /// - public static Illuminance Millilux(this T value) => Illuminance.FromMillilux(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs deleted file mode 100644 index fc02154ffb..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToInformationExtensions.g.cs +++ /dev/null @@ -1,127 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToInformation -{ - public static class NumberToInformationExtensions - { - /// - public static Information Bits(this T value) => Information.FromBits(Convert.ToDouble(value)); - - /// - public static Information Bytes(this T value) => Information.FromBytes(Convert.ToDouble(value)); - - /// - public static Information Exabits(this T value) => Information.FromExabits(Convert.ToDouble(value)); - - /// - public static Information Exabytes(this T value) => Information.FromExabytes(Convert.ToDouble(value)); - - /// - public static Information Exbibits(this T value) => Information.FromExbibits(Convert.ToDouble(value)); - - /// - public static Information Exbibytes(this T value) => Information.FromExbibytes(Convert.ToDouble(value)); - - /// - public static Information Gibibits(this T value) => Information.FromGibibits(Convert.ToDouble(value)); - - /// - public static Information Gibibytes(this T value) => Information.FromGibibytes(Convert.ToDouble(value)); - - /// - public static Information Gigabits(this T value) => Information.FromGigabits(Convert.ToDouble(value)); - - /// - public static Information Gigabytes(this T value) => Information.FromGigabytes(Convert.ToDouble(value)); - - /// - public static Information Kibibits(this T value) => Information.FromKibibits(Convert.ToDouble(value)); - - /// - public static Information Kibibytes(this T value) => Information.FromKibibytes(Convert.ToDouble(value)); - - /// - public static Information Kilobits(this T value) => Information.FromKilobits(Convert.ToDouble(value)); - - /// - public static Information Kilobytes(this T value) => Information.FromKilobytes(Convert.ToDouble(value)); - - /// - public static Information Mebibits(this T value) => Information.FromMebibits(Convert.ToDouble(value)); - - /// - public static Information Mebibytes(this T value) => Information.FromMebibytes(Convert.ToDouble(value)); - - /// - public static Information Megabits(this T value) => Information.FromMegabits(Convert.ToDouble(value)); - - /// - public static Information Megabytes(this T value) => Information.FromMegabytes(Convert.ToDouble(value)); - - /// - public static Information Pebibits(this T value) => Information.FromPebibits(Convert.ToDouble(value)); - - /// - public static Information Pebibytes(this T value) => Information.FromPebibytes(Convert.ToDouble(value)); - - /// - public static Information Petabits(this T value) => Information.FromPetabits(Convert.ToDouble(value)); - - /// - public static Information Petabytes(this T value) => Information.FromPetabytes(Convert.ToDouble(value)); - - /// - public static Information Tebibits(this T value) => Information.FromTebibits(Convert.ToDouble(value)); - - /// - public static Information Tebibytes(this T value) => Information.FromTebibytes(Convert.ToDouble(value)); - - /// - public static Information Terabits(this T value) => Information.FromTerabits(Convert.ToDouble(value)); - - /// - public static Information Terabytes(this T value) => Information.FromTerabytes(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs deleted file mode 100644 index 8b202820d6..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradianceExtensions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToIrradiance -{ - public static class NumberToIrradianceExtensions - { - /// - public static Irradiance KilowattsPerSquareMeter(this T value) => Irradiance.FromKilowattsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static Irradiance WattsPerSquareMeter(this T value) => Irradiance.FromWattsPerSquareMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs deleted file mode 100644 index f1c63a55d8..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToIrradiationExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToIrradiation -{ - public static class NumberToIrradiationExtensions - { - /// - public static Irradiation JoulesPerSquareMeter(this T value) => Irradiation.FromJoulesPerSquareMeter(Convert.ToDouble(value)); - - /// - public static Irradiation KilowattHoursPerSquareMeter(this T value) => Irradiation.FromKilowattHoursPerSquareMeter(Convert.ToDouble(value)); - - /// - public static Irradiation WattHoursPerSquareMeter(this T value) => Irradiation.FromWattHoursPerSquareMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs deleted file mode 100644 index 103d3c781a..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToKinematicViscosityExtensions.g.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToKinematicViscosity -{ - public static class NumberToKinematicViscosityExtensions - { - /// - public static KinematicViscosity Centistokes(this T value) => KinematicViscosity.FromCentistokes(Convert.ToDouble(value)); - - /// - public static KinematicViscosity Decistokes(this T value) => KinematicViscosity.FromDecistokes(Convert.ToDouble(value)); - - /// - public static KinematicViscosity Kilostokes(this T value) => KinematicViscosity.FromKilostokes(Convert.ToDouble(value)); - - /// - public static KinematicViscosity Microstokes(this T value) => KinematicViscosity.FromMicrostokes(Convert.ToDouble(value)); - - /// - public static KinematicViscosity Millistokes(this T value) => KinematicViscosity.FromMillistokes(Convert.ToDouble(value)); - - /// - public static KinematicViscosity Nanostokes(this T value) => KinematicViscosity.FromNanostokes(Convert.ToDouble(value)); - - /// - public static KinematicViscosity SquareMetersPerSecond(this T value) => KinematicViscosity.FromSquareMetersPerSecond(Convert.ToDouble(value)); - - /// - public static KinematicViscosity Stokes(this T value) => KinematicViscosity.FromStokes(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs deleted file mode 100644 index 256c0daa49..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLapseRateExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToLapseRate -{ - public static class NumberToLapseRateExtensions - { - /// - public static LapseRate DegreesCelciusPerKilometer(this T value) => LapseRate.FromDegreesCelciusPerKilometer(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs deleted file mode 100644 index 930b5bd8fb..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLengthExtensions.g.cs +++ /dev/null @@ -1,115 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToLength -{ - public static class NumberToLengthExtensions - { - /// - public static Length Centimeters(this T value) => Length.FromCentimeters(Convert.ToDouble(value)); - - /// - public static Length Decimeters(this T value) => Length.FromDecimeters(Convert.ToDouble(value)); - - /// - public static Length DtpPicas(this T value) => Length.FromDtpPicas(Convert.ToDouble(value)); - - /// - public static Length DtpPoints(this T value) => Length.FromDtpPoints(Convert.ToDouble(value)); - - /// - public static Length Fathoms(this T value) => Length.FromFathoms(Convert.ToDouble(value)); - - /// - public static Length Feet(this T value) => Length.FromFeet(Convert.ToDouble(value)); - - /// - public static Length Inches(this T value) => Length.FromInches(Convert.ToDouble(value)); - - /// - public static Length Kilometers(this T value) => Length.FromKilometers(Convert.ToDouble(value)); - - /// - public static Length Meters(this T value) => Length.FromMeters(Convert.ToDouble(value)); - - /// - public static Length Microinches(this T value) => Length.FromMicroinches(Convert.ToDouble(value)); - - /// - public static Length Micrometers(this T value) => Length.FromMicrometers(Convert.ToDouble(value)); - - /// - public static Length Mils(this T value) => Length.FromMils(Convert.ToDouble(value)); - - /// - public static Length Miles(this T value) => Length.FromMiles(Convert.ToDouble(value)); - - /// - public static Length Millimeters(this T value) => Length.FromMillimeters(Convert.ToDouble(value)); - - /// - public static Length Nanometers(this T value) => Length.FromNanometers(Convert.ToDouble(value)); - - /// - public static Length NauticalMiles(this T value) => Length.FromNauticalMiles(Convert.ToDouble(value)); - - /// - public static Length PrinterPicas(this T value) => Length.FromPrinterPicas(Convert.ToDouble(value)); - - /// - public static Length PrinterPoints(this T value) => Length.FromPrinterPoints(Convert.ToDouble(value)); - - /// - public static Length Shackles(this T value) => Length.FromShackles(Convert.ToDouble(value)); - - /// - public static Length Twips(this T value) => Length.FromTwips(Convert.ToDouble(value)); - - /// - public static Length UsSurveyFeet(this T value) => Length.FromUsSurveyFeet(Convert.ToDouble(value)); - - /// - public static Length Yards(this T value) => Length.FromYards(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs deleted file mode 100644 index 024d9d1b64..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLevelExtensions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToLevel -{ - public static class NumberToLevelExtensions - { - /// - public static Level Decibels(this T value) => Level.FromDecibels(Convert.ToDouble(value)); - - /// - public static Level Nepers(this T value) => Level.FromNepers(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs deleted file mode 100644 index fcc43ec98f..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLinearDensityExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToLinearDensity -{ - public static class NumberToLinearDensityExtensions - { - /// - public static LinearDensity GramsPerMeter(this T value) => LinearDensity.FromGramsPerMeter(Convert.ToDouble(value)); - - /// - public static LinearDensity KilogramsPerMeter(this T value) => LinearDensity.FromKilogramsPerMeter(Convert.ToDouble(value)); - - /// - public static LinearDensity PoundsPerFoot(this T value) => LinearDensity.FromPoundsPerFoot(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs deleted file mode 100644 index 87e844ed6b..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousFluxExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToLuminousFlux -{ - public static class NumberToLuminousFluxExtensions - { - /// - public static LuminousFlux Lumens(this T value) => LuminousFlux.FromLumens(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs deleted file mode 100644 index 6459050eb6..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToLuminousIntensityExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToLuminousIntensity -{ - public static class NumberToLuminousIntensityExtensions - { - /// - public static LuminousIntensity Candela(this T value) => LuminousIntensity.FromCandela(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs deleted file mode 100644 index c7657d43b0..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFieldExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMagneticField -{ - public static class NumberToMagneticFieldExtensions - { - /// - public static MagneticField Teslas(this T value) => MagneticField.FromTeslas(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs deleted file mode 100644 index fc48c0ef6f..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagneticFluxExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMagneticFlux -{ - public static class NumberToMagneticFluxExtensions - { - /// - public static MagneticFlux Webers(this T value) => MagneticFlux.FromWebers(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs deleted file mode 100644 index f9c977ccad..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMagnetizationExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMagnetization -{ - public static class NumberToMagnetizationExtensions - { - /// - public static Magnetization AmperesPerMeter(this T value) => Magnetization.FromAmperesPerMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs deleted file mode 100644 index 8a20899ef2..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassExtensions.g.cs +++ /dev/null @@ -1,112 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMass -{ - public static class NumberToMassExtensions - { - /// - public static Mass Centigrams(this T value) => Mass.FromCentigrams(Convert.ToDouble(value)); - - /// - public static Mass Decagrams(this T value) => Mass.FromDecagrams(Convert.ToDouble(value)); - - /// - public static Mass Decigrams(this T value) => Mass.FromDecigrams(Convert.ToDouble(value)); - - /// - public static Mass Grams(this T value) => Mass.FromGrams(Convert.ToDouble(value)); - - /// - public static Mass Hectograms(this T value) => Mass.FromHectograms(Convert.ToDouble(value)); - - /// - public static Mass Kilograms(this T value) => Mass.FromKilograms(Convert.ToDouble(value)); - - /// - public static Mass Kilopounds(this T value) => Mass.FromKilopounds(Convert.ToDouble(value)); - - /// - public static Mass Kilotonnes(this T value) => Mass.FromKilotonnes(Convert.ToDouble(value)); - - /// - public static Mass LongHundredweight(this T value) => Mass.FromLongHundredweight(Convert.ToDouble(value)); - - /// - public static Mass LongTons(this T value) => Mass.FromLongTons(Convert.ToDouble(value)); - - /// - public static Mass Megapounds(this T value) => Mass.FromMegapounds(Convert.ToDouble(value)); - - /// - public static Mass Megatonnes(this T value) => Mass.FromMegatonnes(Convert.ToDouble(value)); - - /// - public static Mass Micrograms(this T value) => Mass.FromMicrograms(Convert.ToDouble(value)); - - /// - public static Mass Milligrams(this T value) => Mass.FromMilligrams(Convert.ToDouble(value)); - - /// - public static Mass Nanograms(this T value) => Mass.FromNanograms(Convert.ToDouble(value)); - - /// - public static Mass Ounces(this T value) => Mass.FromOunces(Convert.ToDouble(value)); - - /// - public static Mass Pounds(this T value) => Mass.FromPounds(Convert.ToDouble(value)); - - /// - public static Mass ShortHundredweight(this T value) => Mass.FromShortHundredweight(Convert.ToDouble(value)); - - /// - public static Mass ShortTons(this T value) => Mass.FromShortTons(Convert.ToDouble(value)); - - /// - public static Mass Stone(this T value) => Mass.FromStone(Convert.ToDouble(value)); - - /// - public static Mass Tonnes(this T value) => Mass.FromTonnes(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs deleted file mode 100644 index 8db4e6c06b..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs +++ /dev/null @@ -1,94 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMassFlow -{ - public static class NumberToMassFlowExtensions - { - /// - public static MassFlow CentigramsPerSecond(this T value) => MassFlow.FromCentigramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow DecagramsPerSecond(this T value) => MassFlow.FromDecagramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow DecigramsPerSecond(this T value) => MassFlow.FromDecigramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow GramsPerSecond(this T value) => MassFlow.FromGramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow HectogramsPerSecond(this T value) => MassFlow.FromHectogramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow KilogramsPerHour(this T value) => MassFlow.FromKilogramsPerHour(Convert.ToDouble(value)); - - /// - public static MassFlow KilogramsPerSecond(this T value) => MassFlow.FromKilogramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow MegapoundsPerHour(this T value) => MassFlow.FromMegapoundsPerHour(Convert.ToDouble(value)); - - /// - public static MassFlow MicrogramsPerSecond(this T value) => MassFlow.FromMicrogramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow MilligramsPerSecond(this T value) => MassFlow.FromMilligramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow NanogramsPerSecond(this T value) => MassFlow.FromNanogramsPerSecond(Convert.ToDouble(value)); - - /// - public static MassFlow PoundsPerHour(this T value) => MassFlow.FromPoundsPerHour(Convert.ToDouble(value)); - - /// - public static MassFlow ShortTonsPerHour(this T value) => MassFlow.FromShortTonsPerHour(Convert.ToDouble(value)); - - /// - public static MassFlow TonnesPerDay(this T value) => MassFlow.FromTonnesPerDay(Convert.ToDouble(value)); - - /// - public static MassFlow TonnesPerHour(this T value) => MassFlow.FromTonnesPerHour(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs deleted file mode 100644 index 8a820b0508..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFluxExtensions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMassFlux -{ - public static class NumberToMassFluxExtensions - { - /// - public static MassFlux GramsPerSecondPerSquareMeter(this T value) => MassFlux.FromGramsPerSecondPerSquareMeter(Convert.ToDouble(value)); - - /// - public static MassFlux KilogramsPerSecondPerSquareMeter(this T value) => MassFlux.FromKilogramsPerSecondPerSquareMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs deleted file mode 100644 index 4f51429b4b..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassMomentOfInertiaExtensions.g.cs +++ /dev/null @@ -1,127 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMassMomentOfInertia -{ - public static class NumberToMassMomentOfInertiaExtensions - { - /// - public static MassMomentOfInertia GramSquareCentimeters(this T value) => MassMomentOfInertia.FromGramSquareCentimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia GramSquareDecimeters(this T value) => MassMomentOfInertia.FromGramSquareDecimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia GramSquareMeters(this T value) => MassMomentOfInertia.FromGramSquareMeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia GramSquareMillimeters(this T value) => MassMomentOfInertia.FromGramSquareMillimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilogramSquareCentimeters(this T value) => MassMomentOfInertia.FromKilogramSquareCentimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilogramSquareDecimeters(this T value) => MassMomentOfInertia.FromKilogramSquareDecimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilogramSquareMeters(this T value) => MassMomentOfInertia.FromKilogramSquareMeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilogramSquareMillimeters(this T value) => MassMomentOfInertia.FromKilogramSquareMillimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilotonneSquareCentimeters(this T value) => MassMomentOfInertia.FromKilotonneSquareCentimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilotonneSquareDecimeters(this T value) => MassMomentOfInertia.FromKilotonneSquareDecimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilotonneSquareMeters(this T value) => MassMomentOfInertia.FromKilotonneSquareMeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia KilotonneSquareMilimeters(this T value) => MassMomentOfInertia.FromKilotonneSquareMilimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MegatonneSquareCentimeters(this T value) => MassMomentOfInertia.FromMegatonneSquareCentimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MegatonneSquareDecimeters(this T value) => MassMomentOfInertia.FromMegatonneSquareDecimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MegatonneSquareMeters(this T value) => MassMomentOfInertia.FromMegatonneSquareMeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MegatonneSquareMilimeters(this T value) => MassMomentOfInertia.FromMegatonneSquareMilimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MilligramSquareCentimeters(this T value) => MassMomentOfInertia.FromMilligramSquareCentimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MilligramSquareDecimeters(this T value) => MassMomentOfInertia.FromMilligramSquareDecimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MilligramSquareMeters(this T value) => MassMomentOfInertia.FromMilligramSquareMeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia MilligramSquareMillimeters(this T value) => MassMomentOfInertia.FromMilligramSquareMillimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia PoundSquareFeet(this T value) => MassMomentOfInertia.FromPoundSquareFeet(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia PoundSquareInches(this T value) => MassMomentOfInertia.FromPoundSquareInches(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia TonneSquareCentimeters(this T value) => MassMomentOfInertia.FromTonneSquareCentimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia TonneSquareDecimeters(this T value) => MassMomentOfInertia.FromTonneSquareDecimeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia TonneSquareMeters(this T value) => MassMomentOfInertia.FromTonneSquareMeters(Convert.ToDouble(value)); - - /// - public static MassMomentOfInertia TonneSquareMilimeters(this T value) => MassMomentOfInertia.FromTonneSquareMilimeters(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs deleted file mode 100644 index 04710dbb24..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEnergyExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMolarEnergy -{ - public static class NumberToMolarEnergyExtensions - { - /// - public static MolarEnergy JoulesPerMole(this T value) => MolarEnergy.FromJoulesPerMole(Convert.ToDouble(value)); - - /// - public static MolarEnergy KilojoulesPerMole(this T value) => MolarEnergy.FromKilojoulesPerMole(Convert.ToDouble(value)); - - /// - public static MolarEnergy MegajoulesPerMole(this T value) => MolarEnergy.FromMegajoulesPerMole(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs deleted file mode 100644 index ec727f851d..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarEntropyExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMolarEntropy -{ - public static class NumberToMolarEntropyExtensions - { - /// - public static MolarEntropy JoulesPerMoleKelvin(this T value) => MolarEntropy.FromJoulesPerMoleKelvin(Convert.ToDouble(value)); - - /// - public static MolarEntropy KilojoulesPerMoleKelvin(this T value) => MolarEntropy.FromKilojoulesPerMoleKelvin(Convert.ToDouble(value)); - - /// - public static MolarEntropy MegajoulesPerMoleKelvin(this T value) => MolarEntropy.FromMegajoulesPerMoleKelvin(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs deleted file mode 100644 index 71386056cb..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarMassExtensions.g.cs +++ /dev/null @@ -1,85 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMolarMass -{ - public static class NumberToMolarMassExtensions - { - /// - public static MolarMass CentigramsPerMole(this T value) => MolarMass.FromCentigramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass DecagramsPerMole(this T value) => MolarMass.FromDecagramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass DecigramsPerMole(this T value) => MolarMass.FromDecigramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass GramsPerMole(this T value) => MolarMass.FromGramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass HectogramsPerMole(this T value) => MolarMass.FromHectogramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass KilogramsPerMole(this T value) => MolarMass.FromKilogramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass KilopoundsPerMole(this T value) => MolarMass.FromKilopoundsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass MegapoundsPerMole(this T value) => MolarMass.FromMegapoundsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass MicrogramsPerMole(this T value) => MolarMass.FromMicrogramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass MilligramsPerMole(this T value) => MolarMass.FromMilligramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass NanogramsPerMole(this T value) => MolarMass.FromNanogramsPerMole(Convert.ToDouble(value)); - - /// - public static MolarMass PoundsPerMole(this T value) => MolarMass.FromPoundsPerMole(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs deleted file mode 100644 index 1ac5579802..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMolarityExtensions.g.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMolarity -{ - public static class NumberToMolarityExtensions - { - /// - public static Molarity CentimolesPerLiter(this T value) => Molarity.FromCentimolesPerLiter(Convert.ToDouble(value)); - - /// - public static Molarity DecimolesPerLiter(this T value) => Molarity.FromDecimolesPerLiter(Convert.ToDouble(value)); - - /// - public static Molarity MicromolesPerLiter(this T value) => Molarity.FromMicromolesPerLiter(Convert.ToDouble(value)); - - /// - public static Molarity MillimolesPerLiter(this T value) => Molarity.FromMillimolesPerLiter(Convert.ToDouble(value)); - - /// - public static Molarity MolesPerCubicMeter(this T value) => Molarity.FromMolesPerCubicMeter(Convert.ToDouble(value)); - - /// - public static Molarity MolesPerLiter(this T value) => Molarity.FromMolesPerLiter(Convert.ToDouble(value)); - - /// - public static Molarity NanomolesPerLiter(this T value) => Molarity.FromNanomolesPerLiter(Convert.ToDouble(value)); - - /// - public static Molarity PicomolesPerLiter(this T value) => Molarity.FromPicomolesPerLiter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs deleted file mode 100644 index 823d428c34..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermeabilityExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToPermeability -{ - public static class NumberToPermeabilityExtensions - { - /// - public static Permeability HenriesPerMeter(this T value) => Permeability.FromHenriesPerMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs deleted file mode 100644 index 647088a5c1..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPermittivityExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToPermittivity -{ - public static class NumberToPermittivityExtensions - { - /// - public static Permittivity FaradsPerMeter(this T value) => Permittivity.FromFaradsPerMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs deleted file mode 100644 index e6ed64ac9f..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerDensityExtensions.g.cs +++ /dev/null @@ -1,181 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToPowerDensity -{ - public static class NumberToPowerDensityExtensions - { - /// - public static PowerDensity DecawattsPerCubicFoot(this T value) => PowerDensity.FromDecawattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity DecawattsPerCubicInch(this T value) => PowerDensity.FromDecawattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity DecawattsPerCubicMeter(this T value) => PowerDensity.FromDecawattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity DecawattsPerLiter(this T value) => PowerDensity.FromDecawattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity DeciwattsPerCubicFoot(this T value) => PowerDensity.FromDeciwattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity DeciwattsPerCubicInch(this T value) => PowerDensity.FromDeciwattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity DeciwattsPerCubicMeter(this T value) => PowerDensity.FromDeciwattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity DeciwattsPerLiter(this T value) => PowerDensity.FromDeciwattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity GigawattsPerCubicFoot(this T value) => PowerDensity.FromGigawattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity GigawattsPerCubicInch(this T value) => PowerDensity.FromGigawattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity GigawattsPerCubicMeter(this T value) => PowerDensity.FromGigawattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity GigawattsPerLiter(this T value) => PowerDensity.FromGigawattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity KilowattsPerCubicFoot(this T value) => PowerDensity.FromKilowattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity KilowattsPerCubicInch(this T value) => PowerDensity.FromKilowattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity KilowattsPerCubicMeter(this T value) => PowerDensity.FromKilowattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity KilowattsPerLiter(this T value) => PowerDensity.FromKilowattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity MegawattsPerCubicFoot(this T value) => PowerDensity.FromMegawattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity MegawattsPerCubicInch(this T value) => PowerDensity.FromMegawattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity MegawattsPerCubicMeter(this T value) => PowerDensity.FromMegawattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity MegawattsPerLiter(this T value) => PowerDensity.FromMegawattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity MicrowattsPerCubicFoot(this T value) => PowerDensity.FromMicrowattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity MicrowattsPerCubicInch(this T value) => PowerDensity.FromMicrowattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity MicrowattsPerCubicMeter(this T value) => PowerDensity.FromMicrowattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity MicrowattsPerLiter(this T value) => PowerDensity.FromMicrowattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity MilliwattsPerCubicFoot(this T value) => PowerDensity.FromMilliwattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity MilliwattsPerCubicInch(this T value) => PowerDensity.FromMilliwattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity MilliwattsPerCubicMeter(this T value) => PowerDensity.FromMilliwattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity MilliwattsPerLiter(this T value) => PowerDensity.FromMilliwattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity NanowattsPerCubicFoot(this T value) => PowerDensity.FromNanowattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity NanowattsPerCubicInch(this T value) => PowerDensity.FromNanowattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity NanowattsPerCubicMeter(this T value) => PowerDensity.FromNanowattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity NanowattsPerLiter(this T value) => PowerDensity.FromNanowattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity PicowattsPerCubicFoot(this T value) => PowerDensity.FromPicowattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity PicowattsPerCubicInch(this T value) => PowerDensity.FromPicowattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity PicowattsPerCubicMeter(this T value) => PowerDensity.FromPicowattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity PicowattsPerLiter(this T value) => PowerDensity.FromPicowattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity TerawattsPerCubicFoot(this T value) => PowerDensity.FromTerawattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity TerawattsPerCubicInch(this T value) => PowerDensity.FromTerawattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity TerawattsPerCubicMeter(this T value) => PowerDensity.FromTerawattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity TerawattsPerLiter(this T value) => PowerDensity.FromTerawattsPerLiter(Convert.ToDouble(value)); - - /// - public static PowerDensity WattsPerCubicFoot(this T value) => PowerDensity.FromWattsPerCubicFoot(Convert.ToDouble(value)); - - /// - public static PowerDensity WattsPerCubicInch(this T value) => PowerDensity.FromWattsPerCubicInch(Convert.ToDouble(value)); - - /// - public static PowerDensity WattsPerCubicMeter(this T value) => PowerDensity.FromWattsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static PowerDensity WattsPerLiter(this T value) => PowerDensity.FromWattsPerLiter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs deleted file mode 100644 index 9de02cb592..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerExtensions.g.cs +++ /dev/null @@ -1,109 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToPower -{ - public static class NumberToPowerExtensions - { - /// - public static Power BoilerHorsepower(this T value) => Power.FromBoilerHorsepower(Convert.ToDouble(value)); - - /// - public static Power BritishThermalUnitsPerHour(this T value) => Power.FromBritishThermalUnitsPerHour(Convert.ToDouble(value)); - - /// - public static Power Decawatts(this T value) => Power.FromDecawatts(Convert.ToDouble(value)); - - /// - public static Power Deciwatts(this T value) => Power.FromDeciwatts(Convert.ToDouble(value)); - - /// - public static Power ElectricalHorsepower(this T value) => Power.FromElectricalHorsepower(Convert.ToDouble(value)); - - /// - public static Power Femtowatts(this T value) => Power.FromFemtowatts(Convert.ToDouble(value)); - - /// - public static Power Gigawatts(this T value) => Power.FromGigawatts(Convert.ToDouble(value)); - - /// - public static Power HydraulicHorsepower(this T value) => Power.FromHydraulicHorsepower(Convert.ToDouble(value)); - - /// - public static Power KilobritishThermalUnitsPerHour(this T value) => Power.FromKilobritishThermalUnitsPerHour(Convert.ToDouble(value)); - - /// - public static Power Kilowatts(this T value) => Power.FromKilowatts(Convert.ToDouble(value)); - - /// - public static Power MechanicalHorsepower(this T value) => Power.FromMechanicalHorsepower(Convert.ToDouble(value)); - - /// - public static Power Megawatts(this T value) => Power.FromMegawatts(Convert.ToDouble(value)); - - /// - public static Power MetricHorsepower(this T value) => Power.FromMetricHorsepower(Convert.ToDouble(value)); - - /// - public static Power Microwatts(this T value) => Power.FromMicrowatts(Convert.ToDouble(value)); - - /// - public static Power Milliwatts(this T value) => Power.FromMilliwatts(Convert.ToDouble(value)); - - /// - public static Power Nanowatts(this T value) => Power.FromNanowatts(Convert.ToDouble(value)); - - /// - public static Power Petawatts(this T value) => Power.FromPetawatts(Convert.ToDouble(value)); - - /// - public static Power Picowatts(this T value) => Power.FromPicowatts(Convert.ToDouble(value)); - - /// - public static Power Terawatts(this T value) => Power.FromTerawatts(Convert.ToDouble(value)); - - /// - public static Power Watts(this T value) => Power.FromWatts(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs deleted file mode 100644 index 996e47fbd5..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPowerRatioExtensions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToPowerRatio -{ - public static class NumberToPowerRatioExtensions - { - /// - public static PowerRatio DecibelMilliwatts(this T value) => PowerRatio.FromDecibelMilliwatts(Convert.ToDouble(value)); - - /// - public static PowerRatio DecibelWatts(this T value) => PowerRatio.FromDecibelWatts(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs deleted file mode 100644 index 380cdb9cce..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureChangeRateExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToPressureChangeRate -{ - public static class NumberToPressureChangeRateExtensions - { - /// - public static PressureChangeRate AtmospheresPerSecond(this T value) => PressureChangeRate.FromAtmospheresPerSecond(Convert.ToDouble(value)); - - /// - public static PressureChangeRate KilopascalsPerSecond(this T value) => PressureChangeRate.FromKilopascalsPerSecond(Convert.ToDouble(value)); - - /// - public static PressureChangeRate MegapascalsPerSecond(this T value) => PressureChangeRate.FromMegapascalsPerSecond(Convert.ToDouble(value)); - - /// - public static PressureChangeRate PascalsPerSecond(this T value) => PressureChangeRate.FromPascalsPerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs deleted file mode 100644 index 04fb82fb35..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToPressureExtensions.g.cs +++ /dev/null @@ -1,160 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToPressure -{ - public static class NumberToPressureExtensions - { - /// - public static Pressure Atmospheres(this T value) => Pressure.FromAtmospheres(Convert.ToDouble(value)); - - /// - public static Pressure Bars(this T value) => Pressure.FromBars(Convert.ToDouble(value)); - - /// - public static Pressure Centibars(this T value) => Pressure.FromCentibars(Convert.ToDouble(value)); - - /// - public static Pressure Decapascals(this T value) => Pressure.FromDecapascals(Convert.ToDouble(value)); - - /// - public static Pressure Decibars(this T value) => Pressure.FromDecibars(Convert.ToDouble(value)); - - /// - public static Pressure FeetOfHead(this T value) => Pressure.FromFeetOfHead(Convert.ToDouble(value)); - - /// - public static Pressure Gigapascals(this T value) => Pressure.FromGigapascals(Convert.ToDouble(value)); - - /// - public static Pressure Hectopascals(this T value) => Pressure.FromHectopascals(Convert.ToDouble(value)); - - /// - public static Pressure InchesOfMercury(this T value) => Pressure.FromInchesOfMercury(Convert.ToDouble(value)); - - /// - public static Pressure Kilobars(this T value) => Pressure.FromKilobars(Convert.ToDouble(value)); - - /// - public static Pressure KilogramsForcePerSquareCentimeter(this T value) => Pressure.FromKilogramsForcePerSquareCentimeter(Convert.ToDouble(value)); - - /// - public static Pressure KilogramsForcePerSquareMeter(this T value) => Pressure.FromKilogramsForcePerSquareMeter(Convert.ToDouble(value)); - - /// - public static Pressure KilogramsForcePerSquareMillimeter(this T value) => Pressure.FromKilogramsForcePerSquareMillimeter(Convert.ToDouble(value)); - - /// - public static Pressure KilonewtonsPerSquareCentimeter(this T value) => Pressure.FromKilonewtonsPerSquareCentimeter(Convert.ToDouble(value)); - - /// - public static Pressure KilonewtonsPerSquareMeter(this T value) => Pressure.FromKilonewtonsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static Pressure KilonewtonsPerSquareMillimeter(this T value) => Pressure.FromKilonewtonsPerSquareMillimeter(Convert.ToDouble(value)); - - /// - public static Pressure Kilopascals(this T value) => Pressure.FromKilopascals(Convert.ToDouble(value)); - - /// - public static Pressure KilopoundsForcePerSquareFoot(this T value) => Pressure.FromKilopoundsForcePerSquareFoot(Convert.ToDouble(value)); - - /// - public static Pressure KilopoundsForcePerSquareInch(this T value) => Pressure.FromKilopoundsForcePerSquareInch(Convert.ToDouble(value)); - - /// - public static Pressure Megabars(this T value) => Pressure.FromMegabars(Convert.ToDouble(value)); - - /// - public static Pressure MeganewtonsPerSquareMeter(this T value) => Pressure.FromMeganewtonsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static Pressure Megapascals(this T value) => Pressure.FromMegapascals(Convert.ToDouble(value)); - - /// - public static Pressure MetersOfHead(this T value) => Pressure.FromMetersOfHead(Convert.ToDouble(value)); - - /// - public static Pressure Micropascals(this T value) => Pressure.FromMicropascals(Convert.ToDouble(value)); - - /// - public static Pressure Millibars(this T value) => Pressure.FromMillibars(Convert.ToDouble(value)); - - /// - public static Pressure MillimetersOfMercury(this T value) => Pressure.FromMillimetersOfMercury(Convert.ToDouble(value)); - - /// - public static Pressure NewtonsPerSquareCentimeter(this T value) => Pressure.FromNewtonsPerSquareCentimeter(Convert.ToDouble(value)); - - /// - public static Pressure NewtonsPerSquareMeter(this T value) => Pressure.FromNewtonsPerSquareMeter(Convert.ToDouble(value)); - - /// - public static Pressure NewtonsPerSquareMillimeter(this T value) => Pressure.FromNewtonsPerSquareMillimeter(Convert.ToDouble(value)); - - /// - public static Pressure Pascals(this T value) => Pressure.FromPascals(Convert.ToDouble(value)); - - /// - public static Pressure PoundsForcePerSquareFoot(this T value) => Pressure.FromPoundsForcePerSquareFoot(Convert.ToDouble(value)); - - /// - public static Pressure PoundsForcePerSquareInch(this T value) => Pressure.FromPoundsForcePerSquareInch(Convert.ToDouble(value)); - - /// - public static Pressure TechnicalAtmospheres(this T value) => Pressure.FromTechnicalAtmospheres(Convert.ToDouble(value)); - - /// - public static Pressure TonnesForcePerSquareCentimeter(this T value) => Pressure.FromTonnesForcePerSquareCentimeter(Convert.ToDouble(value)); - - /// - public static Pressure TonnesForcePerSquareMeter(this T value) => Pressure.FromTonnesForcePerSquareMeter(Convert.ToDouble(value)); - - /// - public static Pressure TonnesForcePerSquareMillimeter(this T value) => Pressure.FromTonnesForcePerSquareMillimeter(Convert.ToDouble(value)); - - /// - public static Pressure Torrs(this T value) => Pressure.FromTorrs(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs deleted file mode 100644 index 5d33244679..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRatioExtensions.g.cs +++ /dev/null @@ -1,67 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToRatio -{ - public static class NumberToRatioExtensions - { - /// - public static Ratio DecimalFractions(this T value) => Ratio.FromDecimalFractions(Convert.ToDouble(value)); - - /// - public static Ratio PartsPerBillion(this T value) => Ratio.FromPartsPerBillion(Convert.ToDouble(value)); - - /// - public static Ratio PartsPerMillion(this T value) => Ratio.FromPartsPerMillion(Convert.ToDouble(value)); - - /// - public static Ratio PartsPerThousand(this T value) => Ratio.FromPartsPerThousand(Convert.ToDouble(value)); - - /// - public static Ratio PartsPerTrillion(this T value) => Ratio.FromPartsPerTrillion(Convert.ToDouble(value)); - - /// - public static Ratio Percent(this T value) => Ratio.FromPercent(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs deleted file mode 100644 index 9154910452..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactiveEnergyExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToReactiveEnergy -{ - public static class NumberToReactiveEnergyExtensions - { - /// - public static ReactiveEnergy KilovoltampereReactiveHours(this T value) => ReactiveEnergy.FromKilovoltampereReactiveHours(Convert.ToDouble(value)); - - /// - public static ReactiveEnergy MegavoltampereReactiveHours(this T value) => ReactiveEnergy.FromMegavoltampereReactiveHours(Convert.ToDouble(value)); - - /// - public static ReactiveEnergy VoltampereReactiveHours(this T value) => ReactiveEnergy.FromVoltampereReactiveHours(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs deleted file mode 100644 index efb9839777..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToReactivePowerExtensions.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToReactivePower -{ - public static class NumberToReactivePowerExtensions - { - /// - public static ReactivePower GigavoltamperesReactive(this T value) => ReactivePower.FromGigavoltamperesReactive(Convert.ToDouble(value)); - - /// - public static ReactivePower KilovoltamperesReactive(this T value) => ReactivePower.FromKilovoltamperesReactive(Convert.ToDouble(value)); - - /// - public static ReactivePower MegavoltamperesReactive(this T value) => ReactivePower.FromMegavoltamperesReactive(Convert.ToDouble(value)); - - /// - public static ReactivePower VoltamperesReactive(this T value) => ReactivePower.FromVoltamperesReactive(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs deleted file mode 100644 index d8643581a7..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalAccelerationExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToRotationalAcceleration -{ - public static class NumberToRotationalAccelerationExtensions - { - /// - public static RotationalAcceleration DegreesPerSecondSquared(this T value) => RotationalAcceleration.FromDegreesPerSecondSquared(Convert.ToDouble(value)); - - /// - public static RotationalAcceleration RadiansPerSecondSquared(this T value) => RotationalAcceleration.FromRadiansPerSecondSquared(Convert.ToDouble(value)); - - /// - public static RotationalAcceleration RevolutionsPerMinutePerSecond(this T value) => RotationalAcceleration.FromRevolutionsPerMinutePerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs deleted file mode 100644 index 005f9ab145..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalSpeedExtensions.g.cs +++ /dev/null @@ -1,88 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToRotationalSpeed -{ - public static class NumberToRotationalSpeedExtensions - { - /// - public static RotationalSpeed CentiradiansPerSecond(this T value) => RotationalSpeed.FromCentiradiansPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed DeciradiansPerSecond(this T value) => RotationalSpeed.FromDeciradiansPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed DegreesPerMinute(this T value) => RotationalSpeed.FromDegreesPerMinute(Convert.ToDouble(value)); - - /// - public static RotationalSpeed DegreesPerSecond(this T value) => RotationalSpeed.FromDegreesPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed MicrodegreesPerSecond(this T value) => RotationalSpeed.FromMicrodegreesPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed MicroradiansPerSecond(this T value) => RotationalSpeed.FromMicroradiansPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed MillidegreesPerSecond(this T value) => RotationalSpeed.FromMillidegreesPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed MilliradiansPerSecond(this T value) => RotationalSpeed.FromMilliradiansPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed NanodegreesPerSecond(this T value) => RotationalSpeed.FromNanodegreesPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed NanoradiansPerSecond(this T value) => RotationalSpeed.FromNanoradiansPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed RadiansPerSecond(this T value) => RotationalSpeed.FromRadiansPerSecond(Convert.ToDouble(value)); - - /// - public static RotationalSpeed RevolutionsPerMinute(this T value) => RotationalSpeed.FromRevolutionsPerMinute(Convert.ToDouble(value)); - - /// - public static RotationalSpeed RevolutionsPerSecond(this T value) => RotationalSpeed.FromRevolutionsPerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs deleted file mode 100644 index 36e2e3d4ab..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToRotationalStiffness -{ - public static class NumberToRotationalStiffnessExtensions - { - /// - public static RotationalStiffness KilonewtonMetersPerRadian(this T value) => RotationalStiffness.FromKilonewtonMetersPerRadian(Convert.ToDouble(value)); - - /// - public static RotationalStiffness MeganewtonMetersPerRadian(this T value) => RotationalStiffness.FromMeganewtonMetersPerRadian(Convert.ToDouble(value)); - - /// - public static RotationalStiffness NewtonMetersPerRadian(this T value) => RotationalStiffness.FromNewtonMetersPerRadian(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs deleted file mode 100644 index 972c49dac1..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToRotationalStiffnessPerLengthExtensions.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToRotationalStiffnessPerLength -{ - public static class NumberToRotationalStiffnessPerLengthExtensions - { - /// - public static RotationalStiffnessPerLength KilonewtonMetersPerRadianPerMeter(this T value) => RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - - /// - public static RotationalStiffnessPerLength MeganewtonMetersPerRadianPerMeter(this T value) => RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - - /// - public static RotationalStiffnessPerLength NewtonMetersPerRadianPerMeter(this T value) => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs deleted file mode 100644 index ee15ab2fcf..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSolidAngleExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToSolidAngle -{ - public static class NumberToSolidAngleExtensions - { - /// - public static SolidAngle Steradians(this T value) => SolidAngle.FromSteradians(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs deleted file mode 100644 index eedb73e55d..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEnergyExtensions.g.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToSpecificEnergy -{ - public static class NumberToSpecificEnergyExtensions - { - /// - public static SpecificEnergy CaloriesPerGram(this T value) => SpecificEnergy.FromCaloriesPerGram(Convert.ToDouble(value)); - - /// - public static SpecificEnergy JoulesPerKilogram(this T value) => SpecificEnergy.FromJoulesPerKilogram(Convert.ToDouble(value)); - - /// - public static SpecificEnergy KilocaloriesPerGram(this T value) => SpecificEnergy.FromKilocaloriesPerGram(Convert.ToDouble(value)); - - /// - public static SpecificEnergy KilojoulesPerKilogram(this T value) => SpecificEnergy.FromKilojoulesPerKilogram(Convert.ToDouble(value)); - - /// - public static SpecificEnergy KilowattHoursPerKilogram(this T value) => SpecificEnergy.FromKilowattHoursPerKilogram(Convert.ToDouble(value)); - - /// - public static SpecificEnergy MegajoulesPerKilogram(this T value) => SpecificEnergy.FromMegajoulesPerKilogram(Convert.ToDouble(value)); - - /// - public static SpecificEnergy MegawattHoursPerKilogram(this T value) => SpecificEnergy.FromMegawattHoursPerKilogram(Convert.ToDouble(value)); - - /// - public static SpecificEnergy WattHoursPerKilogram(this T value) => SpecificEnergy.FromWattHoursPerKilogram(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs deleted file mode 100644 index 349c77f35b..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificEntropyExtensions.g.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToSpecificEntropy -{ - public static class NumberToSpecificEntropyExtensions - { - /// - public static SpecificEntropy CaloriesPerGramKelvin(this T value) => SpecificEntropy.FromCaloriesPerGramKelvin(Convert.ToDouble(value)); - - /// - public static SpecificEntropy JoulesPerKilogramDegreeCelsius(this T value) => SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - - /// - public static SpecificEntropy JoulesPerKilogramKelvin(this T value) => SpecificEntropy.FromJoulesPerKilogramKelvin(Convert.ToDouble(value)); - - /// - public static SpecificEntropy KilocaloriesPerGramKelvin(this T value) => SpecificEntropy.FromKilocaloriesPerGramKelvin(Convert.ToDouble(value)); - - /// - public static SpecificEntropy KilojoulesPerKilogramDegreeCelsius(this T value) => SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - - /// - public static SpecificEntropy KilojoulesPerKilogramKelvin(this T value) => SpecificEntropy.FromKilojoulesPerKilogramKelvin(Convert.ToDouble(value)); - - /// - public static SpecificEntropy MegajoulesPerKilogramDegreeCelsius(this T value) => SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(Convert.ToDouble(value)); - - /// - public static SpecificEntropy MegajoulesPerKilogramKelvin(this T value) => SpecificEntropy.FromMegajoulesPerKilogramKelvin(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs deleted file mode 100644 index 38ad063b86..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificVolumeExtensions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToSpecificVolume -{ - public static class NumberToSpecificVolumeExtensions - { - /// - public static SpecificVolume CubicFeetPerPound(this T value) => SpecificVolume.FromCubicFeetPerPound(Convert.ToDouble(value)); - - /// - public static SpecificVolume CubicMetersPerKilogram(this T value) => SpecificVolume.FromCubicMetersPerKilogram(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs deleted file mode 100644 index 53e1155bd6..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpecificWeightExtensions.g.cs +++ /dev/null @@ -1,100 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToSpecificWeight -{ - public static class NumberToSpecificWeightExtensions - { - /// - public static SpecificWeight KilogramsForcePerCubicCentimeter(this T value) => SpecificWeight.FromKilogramsForcePerCubicCentimeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight KilogramsForcePerCubicMeter(this T value) => SpecificWeight.FromKilogramsForcePerCubicMeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight KilogramsForcePerCubicMillimeter(this T value) => SpecificWeight.FromKilogramsForcePerCubicMillimeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight KilonewtonsPerCubicCentimeter(this T value) => SpecificWeight.FromKilonewtonsPerCubicCentimeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight KilonewtonsPerCubicMeter(this T value) => SpecificWeight.FromKilonewtonsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight KilonewtonsPerCubicMillimeter(this T value) => SpecificWeight.FromKilonewtonsPerCubicMillimeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight KilopoundsForcePerCubicFoot(this T value) => SpecificWeight.FromKilopoundsForcePerCubicFoot(Convert.ToDouble(value)); - - /// - public static SpecificWeight KilopoundsForcePerCubicInch(this T value) => SpecificWeight.FromKilopoundsForcePerCubicInch(Convert.ToDouble(value)); - - /// - public static SpecificWeight MeganewtonsPerCubicMeter(this T value) => SpecificWeight.FromMeganewtonsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight NewtonsPerCubicCentimeter(this T value) => SpecificWeight.FromNewtonsPerCubicCentimeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight NewtonsPerCubicMeter(this T value) => SpecificWeight.FromNewtonsPerCubicMeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight NewtonsPerCubicMillimeter(this T value) => SpecificWeight.FromNewtonsPerCubicMillimeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight PoundsForcePerCubicFoot(this T value) => SpecificWeight.FromPoundsForcePerCubicFoot(Convert.ToDouble(value)); - - /// - public static SpecificWeight PoundsForcePerCubicInch(this T value) => SpecificWeight.FromPoundsForcePerCubicInch(Convert.ToDouble(value)); - - /// - public static SpecificWeight TonnesForcePerCubicCentimeter(this T value) => SpecificWeight.FromTonnesForcePerCubicCentimeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight TonnesForcePerCubicMeter(this T value) => SpecificWeight.FromTonnesForcePerCubicMeter(Convert.ToDouble(value)); - - /// - public static SpecificWeight TonnesForcePerCubicMillimeter(this T value) => SpecificWeight.FromTonnesForcePerCubicMillimeter(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs deleted file mode 100644 index d921f92ff2..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToSpeedExtensions.g.cs +++ /dev/null @@ -1,145 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToSpeed -{ - public static class NumberToSpeedExtensions - { - /// - public static Speed CentimetersPerHour(this T value) => Speed.FromCentimetersPerHour(Convert.ToDouble(value)); - - /// - public static Speed CentimetersPerMinutes(this T value) => Speed.FromCentimetersPerMinutes(Convert.ToDouble(value)); - - /// - public static Speed CentimetersPerSecond(this T value) => Speed.FromCentimetersPerSecond(Convert.ToDouble(value)); - - /// - public static Speed DecimetersPerMinutes(this T value) => Speed.FromDecimetersPerMinutes(Convert.ToDouble(value)); - - /// - public static Speed DecimetersPerSecond(this T value) => Speed.FromDecimetersPerSecond(Convert.ToDouble(value)); - - /// - public static Speed FeetPerHour(this T value) => Speed.FromFeetPerHour(Convert.ToDouble(value)); - - /// - public static Speed FeetPerMinute(this T value) => Speed.FromFeetPerMinute(Convert.ToDouble(value)); - - /// - public static Speed FeetPerSecond(this T value) => Speed.FromFeetPerSecond(Convert.ToDouble(value)); - - /// - public static Speed InchesPerHour(this T value) => Speed.FromInchesPerHour(Convert.ToDouble(value)); - - /// - public static Speed InchesPerMinute(this T value) => Speed.FromInchesPerMinute(Convert.ToDouble(value)); - - /// - public static Speed InchesPerSecond(this T value) => Speed.FromInchesPerSecond(Convert.ToDouble(value)); - - /// - public static Speed KilometersPerHour(this T value) => Speed.FromKilometersPerHour(Convert.ToDouble(value)); - - /// - public static Speed KilometersPerMinutes(this T value) => Speed.FromKilometersPerMinutes(Convert.ToDouble(value)); - - /// - public static Speed KilometersPerSecond(this T value) => Speed.FromKilometersPerSecond(Convert.ToDouble(value)); - - /// - public static Speed Knots(this T value) => Speed.FromKnots(Convert.ToDouble(value)); - - /// - public static Speed MetersPerHour(this T value) => Speed.FromMetersPerHour(Convert.ToDouble(value)); - - /// - public static Speed MetersPerMinutes(this T value) => Speed.FromMetersPerMinutes(Convert.ToDouble(value)); - - /// - public static Speed MetersPerSecond(this T value) => Speed.FromMetersPerSecond(Convert.ToDouble(value)); - - /// - public static Speed MicrometersPerMinutes(this T value) => Speed.FromMicrometersPerMinutes(Convert.ToDouble(value)); - - /// - public static Speed MicrometersPerSecond(this T value) => Speed.FromMicrometersPerSecond(Convert.ToDouble(value)); - - /// - public static Speed MilesPerHour(this T value) => Speed.FromMilesPerHour(Convert.ToDouble(value)); - - /// - public static Speed MillimetersPerHour(this T value) => Speed.FromMillimetersPerHour(Convert.ToDouble(value)); - - /// - public static Speed MillimetersPerMinutes(this T value) => Speed.FromMillimetersPerMinutes(Convert.ToDouble(value)); - - /// - public static Speed MillimetersPerSecond(this T value) => Speed.FromMillimetersPerSecond(Convert.ToDouble(value)); - - /// - public static Speed NanometersPerMinutes(this T value) => Speed.FromNanometersPerMinutes(Convert.ToDouble(value)); - - /// - public static Speed NanometersPerSecond(this T value) => Speed.FromNanometersPerSecond(Convert.ToDouble(value)); - - /// - public static Speed UsSurveyFeetPerHour(this T value) => Speed.FromUsSurveyFeetPerHour(Convert.ToDouble(value)); - - /// - public static Speed UsSurveyFeetPerMinute(this T value) => Speed.FromUsSurveyFeetPerMinute(Convert.ToDouble(value)); - - /// - public static Speed UsSurveyFeetPerSecond(this T value) => Speed.FromUsSurveyFeetPerSecond(Convert.ToDouble(value)); - - /// - public static Speed YardsPerHour(this T value) => Speed.FromYardsPerHour(Convert.ToDouble(value)); - - /// - public static Speed YardsPerMinute(this T value) => Speed.FromYardsPerMinute(Convert.ToDouble(value)); - - /// - public static Speed YardsPerSecond(this T value) => Speed.FromYardsPerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs deleted file mode 100644 index 6754a82323..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureChangeRateExtensions.g.cs +++ /dev/null @@ -1,79 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToTemperatureChangeRate -{ - public static class NumberToTemperatureChangeRateExtensions - { - /// - public static TemperatureChangeRate CentidegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate DecadegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate DecidegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate DegreesCelsiusPerMinute(this T value) => TemperatureChangeRate.FromDegreesCelsiusPerMinute(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate DegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromDegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate HectodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate KilodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate MicrodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate MillidegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(Convert.ToDouble(value)); - - /// - public static TemperatureChangeRate NanodegreesCelsiusPerSecond(this T value) => TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs deleted file mode 100644 index d1a62f286e..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureDeltaExtensions.g.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToTemperatureDelta -{ - public static class NumberToTemperatureDeltaExtensions - { - /// - public static TemperatureDelta DegreesCelsius(this T value) => TemperatureDelta.FromDegreesCelsius(Convert.ToDouble(value)); - - /// - public static TemperatureDelta DegreesDelisle(this T value) => TemperatureDelta.FromDegreesDelisle(Convert.ToDouble(value)); - - /// - public static TemperatureDelta DegreesFahrenheit(this T value) => TemperatureDelta.FromDegreesFahrenheit(Convert.ToDouble(value)); - - /// - public static TemperatureDelta DegreesNewton(this T value) => TemperatureDelta.FromDegreesNewton(Convert.ToDouble(value)); - - /// - public static TemperatureDelta DegreesRankine(this T value) => TemperatureDelta.FromDegreesRankine(Convert.ToDouble(value)); - - /// - public static TemperatureDelta DegreesReaumur(this T value) => TemperatureDelta.FromDegreesReaumur(Convert.ToDouble(value)); - - /// - public static TemperatureDelta DegreesRoemer(this T value) => TemperatureDelta.FromDegreesRoemer(Convert.ToDouble(value)); - - /// - public static TemperatureDelta Kelvins(this T value) => TemperatureDelta.FromKelvins(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs deleted file mode 100644 index b04a374531..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTemperatureExtensions.g.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToTemperature -{ - public static class NumberToTemperatureExtensions - { - /// - public static Temperature DegreesCelsius(this T value) => Temperature.FromDegreesCelsius(Convert.ToDouble(value)); - - /// - public static Temperature DegreesDelisle(this T value) => Temperature.FromDegreesDelisle(Convert.ToDouble(value)); - - /// - public static Temperature DegreesFahrenheit(this T value) => Temperature.FromDegreesFahrenheit(Convert.ToDouble(value)); - - /// - public static Temperature DegreesNewton(this T value) => Temperature.FromDegreesNewton(Convert.ToDouble(value)); - - /// - public static Temperature DegreesRankine(this T value) => Temperature.FromDegreesRankine(Convert.ToDouble(value)); - - /// - public static Temperature DegreesReaumur(this T value) => Temperature.FromDegreesReaumur(Convert.ToDouble(value)); - - /// - public static Temperature DegreesRoemer(this T value) => Temperature.FromDegreesRoemer(Convert.ToDouble(value)); - - /// - public static Temperature Kelvins(this T value) => Temperature.FromKelvins(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs deleted file mode 100644 index 74d3658cb4..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalConductivityExtensions.g.cs +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToThermalConductivity -{ - public static class NumberToThermalConductivityExtensions - { - /// - public static ThermalConductivity BtusPerHourFootFahrenheit(this T value) => ThermalConductivity.FromBtusPerHourFootFahrenheit(Convert.ToDouble(value)); - - /// - public static ThermalConductivity WattsPerMeterKelvin(this T value) => ThermalConductivity.FromWattsPerMeterKelvin(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs deleted file mode 100644 index 814e163654..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToThermalResistanceExtensions.g.cs +++ /dev/null @@ -1,64 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToThermalResistance -{ - public static class NumberToThermalResistanceExtensions - { - /// - public static ThermalResistance HourSquareFeetDegreesFahrenheitPerBtu(this T value) => ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(Convert.ToDouble(value)); - - /// - public static ThermalResistance SquareCentimeterHourDegreesCelsiusPerKilocalorie(this T value) => ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(Convert.ToDouble(value)); - - /// - public static ThermalResistance SquareCentimeterKelvinsPerWatt(this T value) => ThermalResistance.FromSquareCentimeterKelvinsPerWatt(Convert.ToDouble(value)); - - /// - public static ThermalResistance SquareMeterDegreesCelsiusPerWatt(this T value) => ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(Convert.ToDouble(value)); - - /// - public static ThermalResistance SquareMeterKelvinsPerKilowatt(this T value) => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs deleted file mode 100644 index 9a1b0c92d8..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToTorqueExtensions.g.cs +++ /dev/null @@ -1,112 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToTorque -{ - public static class NumberToTorqueExtensions - { - /// - public static Torque KilogramForceCentimeters(this T value) => Torque.FromKilogramForceCentimeters(Convert.ToDouble(value)); - - /// - public static Torque KilogramForceMeters(this T value) => Torque.FromKilogramForceMeters(Convert.ToDouble(value)); - - /// - public static Torque KilogramForceMillimeters(this T value) => Torque.FromKilogramForceMillimeters(Convert.ToDouble(value)); - - /// - public static Torque KilonewtonCentimeters(this T value) => Torque.FromKilonewtonCentimeters(Convert.ToDouble(value)); - - /// - public static Torque KilonewtonMeters(this T value) => Torque.FromKilonewtonMeters(Convert.ToDouble(value)); - - /// - public static Torque KilonewtonMillimeters(this T value) => Torque.FromKilonewtonMillimeters(Convert.ToDouble(value)); - - /// - public static Torque KilopoundForceFeet(this T value) => Torque.FromKilopoundForceFeet(Convert.ToDouble(value)); - - /// - public static Torque KilopoundForceInches(this T value) => Torque.FromKilopoundForceInches(Convert.ToDouble(value)); - - /// - public static Torque MeganewtonCentimeters(this T value) => Torque.FromMeganewtonCentimeters(Convert.ToDouble(value)); - - /// - public static Torque MeganewtonMeters(this T value) => Torque.FromMeganewtonMeters(Convert.ToDouble(value)); - - /// - public static Torque MeganewtonMillimeters(this T value) => Torque.FromMeganewtonMillimeters(Convert.ToDouble(value)); - - /// - public static Torque MegapoundForceFeet(this T value) => Torque.FromMegapoundForceFeet(Convert.ToDouble(value)); - - /// - public static Torque MegapoundForceInches(this T value) => Torque.FromMegapoundForceInches(Convert.ToDouble(value)); - - /// - public static Torque NewtonCentimeters(this T value) => Torque.FromNewtonCentimeters(Convert.ToDouble(value)); - - /// - public static Torque NewtonMeters(this T value) => Torque.FromNewtonMeters(Convert.ToDouble(value)); - - /// - public static Torque NewtonMillimeters(this T value) => Torque.FromNewtonMillimeters(Convert.ToDouble(value)); - - /// - public static Torque PoundForceFeet(this T value) => Torque.FromPoundForceFeet(Convert.ToDouble(value)); - - /// - public static Torque PoundForceInches(this T value) => Torque.FromPoundForceInches(Convert.ToDouble(value)); - - /// - public static Torque TonneForceCentimeters(this T value) => Torque.FromTonneForceCentimeters(Convert.ToDouble(value)); - - /// - public static Torque TonneForceMeters(this T value) => Torque.FromTonneForceMeters(Convert.ToDouble(value)); - - /// - public static Torque TonneForceMillimeters(this T value) => Torque.FromTonneForceMillimeters(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs deleted file mode 100644 index 79890adcb2..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVitaminAExtensions.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToVitaminA -{ - public static class NumberToVitaminAExtensions - { - /// - public static VitaminA InternationalUnits(this T value) => VitaminA.FromInternationalUnits(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs deleted file mode 100644 index decaf41eba..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeExtensions.g.cs +++ /dev/null @@ -1,175 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToVolume -{ - public static class NumberToVolumeExtensions - { - /// - public static Volume AuTablespoons(this T value) => Volume.FromAuTablespoons(Convert.ToDouble(value)); - - /// - public static Volume Centiliters(this T value) => Volume.FromCentiliters(Convert.ToDouble(value)); - - /// - public static Volume CubicCentimeters(this T value) => Volume.FromCubicCentimeters(Convert.ToDouble(value)); - - /// - public static Volume CubicDecimeters(this T value) => Volume.FromCubicDecimeters(Convert.ToDouble(value)); - - /// - public static Volume CubicFeet(this T value) => Volume.FromCubicFeet(Convert.ToDouble(value)); - - /// - public static Volume CubicInches(this T value) => Volume.FromCubicInches(Convert.ToDouble(value)); - - /// - public static Volume CubicKilometers(this T value) => Volume.FromCubicKilometers(Convert.ToDouble(value)); - - /// - public static Volume CubicMeters(this T value) => Volume.FromCubicMeters(Convert.ToDouble(value)); - - /// - public static Volume CubicMicrometers(this T value) => Volume.FromCubicMicrometers(Convert.ToDouble(value)); - - /// - public static Volume CubicMiles(this T value) => Volume.FromCubicMiles(Convert.ToDouble(value)); - - /// - public static Volume CubicMillimeters(this T value) => Volume.FromCubicMillimeters(Convert.ToDouble(value)); - - /// - public static Volume CubicYards(this T value) => Volume.FromCubicYards(Convert.ToDouble(value)); - - /// - public static Volume Deciliters(this T value) => Volume.FromDeciliters(Convert.ToDouble(value)); - - /// - public static Volume HectocubicFeet(this T value) => Volume.FromHectocubicFeet(Convert.ToDouble(value)); - - /// - public static Volume HectocubicMeters(this T value) => Volume.FromHectocubicMeters(Convert.ToDouble(value)); - - /// - public static Volume Hectoliters(this T value) => Volume.FromHectoliters(Convert.ToDouble(value)); - - /// - public static Volume ImperialBeerBarrels(this T value) => Volume.FromImperialBeerBarrels(Convert.ToDouble(value)); - - /// - public static Volume ImperialGallons(this T value) => Volume.FromImperialGallons(Convert.ToDouble(value)); - - /// - public static Volume ImperialOunces(this T value) => Volume.FromImperialOunces(Convert.ToDouble(value)); - - /// - public static Volume KilocubicFeet(this T value) => Volume.FromKilocubicFeet(Convert.ToDouble(value)); - - /// - public static Volume KilocubicMeters(this T value) => Volume.FromKilocubicMeters(Convert.ToDouble(value)); - - /// - public static Volume KiloimperialGallons(this T value) => Volume.FromKiloimperialGallons(Convert.ToDouble(value)); - - /// - public static Volume KilousGallons(this T value) => Volume.FromKilousGallons(Convert.ToDouble(value)); - - /// - public static Volume Liters(this T value) => Volume.FromLiters(Convert.ToDouble(value)); - - /// - public static Volume MegacubicFeet(this T value) => Volume.FromMegacubicFeet(Convert.ToDouble(value)); - - /// - public static Volume MegaimperialGallons(this T value) => Volume.FromMegaimperialGallons(Convert.ToDouble(value)); - - /// - public static Volume MegausGallons(this T value) => Volume.FromMegausGallons(Convert.ToDouble(value)); - - /// - public static Volume MetricCups(this T value) => Volume.FromMetricCups(Convert.ToDouble(value)); - - /// - public static Volume MetricTeaspoons(this T value) => Volume.FromMetricTeaspoons(Convert.ToDouble(value)); - - /// - public static Volume Microliters(this T value) => Volume.FromMicroliters(Convert.ToDouble(value)); - - /// - public static Volume Milliliters(this T value) => Volume.FromMilliliters(Convert.ToDouble(value)); - - /// - public static Volume OilBarrels(this T value) => Volume.FromOilBarrels(Convert.ToDouble(value)); - - /// - public static Volume UkTablespoons(this T value) => Volume.FromUkTablespoons(Convert.ToDouble(value)); - - /// - public static Volume UsBeerBarrels(this T value) => Volume.FromUsBeerBarrels(Convert.ToDouble(value)); - - /// - public static Volume UsCustomaryCups(this T value) => Volume.FromUsCustomaryCups(Convert.ToDouble(value)); - - /// - public static Volume UsGallons(this T value) => Volume.FromUsGallons(Convert.ToDouble(value)); - - /// - public static Volume UsLegalCups(this T value) => Volume.FromUsLegalCups(Convert.ToDouble(value)); - - /// - public static Volume UsOunces(this T value) => Volume.FromUsOunces(Convert.ToDouble(value)); - - /// - public static Volume UsPints(this T value) => Volume.FromUsPints(Convert.ToDouble(value)); - - /// - public static Volume UsQuarts(this T value) => Volume.FromUsQuarts(Convert.ToDouble(value)); - - /// - public static Volume UsTablespoons(this T value) => Volume.FromUsTablespoons(Convert.ToDouble(value)); - - /// - public static Volume UsTeaspoons(this T value) => Volume.FromUsTeaspoons(Convert.ToDouble(value)); - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs deleted file mode 100644 index 18e5684f05..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs +++ /dev/null @@ -1,127 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToVolumeFlow -{ - public static class NumberToVolumeFlowExtensions - { - /// - public static VolumeFlow CentilitersPerMinute(this T value) => VolumeFlow.FromCentilitersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicDecimetersPerMinute(this T value) => VolumeFlow.FromCubicDecimetersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicFeetPerHour(this T value) => VolumeFlow.FromCubicFeetPerHour(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicFeetPerMinute(this T value) => VolumeFlow.FromCubicFeetPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicFeetPerSecond(this T value) => VolumeFlow.FromCubicFeetPerSecond(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicMetersPerHour(this T value) => VolumeFlow.FromCubicMetersPerHour(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicMetersPerMinute(this T value) => VolumeFlow.FromCubicMetersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicMetersPerSecond(this T value) => VolumeFlow.FromCubicMetersPerSecond(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicYardsPerHour(this T value) => VolumeFlow.FromCubicYardsPerHour(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicYardsPerMinute(this T value) => VolumeFlow.FromCubicYardsPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow CubicYardsPerSecond(this T value) => VolumeFlow.FromCubicYardsPerSecond(Convert.ToDouble(value)); - - /// - public static VolumeFlow DecilitersPerMinute(this T value) => VolumeFlow.FromDecilitersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow KilolitersPerMinute(this T value) => VolumeFlow.FromKilolitersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow LitersPerHour(this T value) => VolumeFlow.FromLitersPerHour(Convert.ToDouble(value)); - - /// - public static VolumeFlow LitersPerMinute(this T value) => VolumeFlow.FromLitersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow LitersPerSecond(this T value) => VolumeFlow.FromLitersPerSecond(Convert.ToDouble(value)); - - /// - public static VolumeFlow MicrolitersPerMinute(this T value) => VolumeFlow.FromMicrolitersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow MillilitersPerMinute(this T value) => VolumeFlow.FromMillilitersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow MillionUsGallonsPerDay(this T value) => VolumeFlow.FromMillionUsGallonsPerDay(Convert.ToDouble(value)); - - /// - public static VolumeFlow NanolitersPerMinute(this T value) => VolumeFlow.FromNanolitersPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow OilBarrelsPerDay(this T value) => VolumeFlow.FromOilBarrelsPerDay(Convert.ToDouble(value)); - - /// - public static VolumeFlow OilBarrelsPerHour(this T value) => VolumeFlow.FromOilBarrelsPerHour(Convert.ToDouble(value)); - - /// - public static VolumeFlow OilBarrelsPerMinute(this T value) => VolumeFlow.FromOilBarrelsPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow UsGallonsPerHour(this T value) => VolumeFlow.FromUsGallonsPerHour(Convert.ToDouble(value)); - - /// - public static VolumeFlow UsGallonsPerMinute(this T value) => VolumeFlow.FromUsGallonsPerMinute(Convert.ToDouble(value)); - - /// - public static VolumeFlow UsGallonsPerSecond(this T value) => VolumeFlow.FromUsGallonsPerSecond(Convert.ToDouble(value)); - - } -} -#endif From 6521156bdf689a479b6cf4ceccbabc394cc846fd Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 00:58:15 +0200 Subject: [PATCH 032/131] Remove/fix test cases --- UnitsNet.Tests/DecimalOverloadTests.cs | 30 ++------- .../NumberToTimeSpanExtensionsTest.cs | 64 ------------------- UnitsNet.Tests/IntOverloadTests.cs | 30 ++------- UnitsNet.Tests/LongOverloadTests.cs | 30 ++------- UnitsNet.Tests/NumberExtensionsTest.cs | 41 ------------ 5 files changed, 15 insertions(+), 180 deletions(-) delete mode 100644 UnitsNet.Tests/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensionsTest.cs delete mode 100644 UnitsNet.Tests/NumberExtensionsTest.cs diff --git a/UnitsNet.Tests/DecimalOverloadTests.cs b/UnitsNet.Tests/DecimalOverloadTests.cs index 3b38d2e36e..6865026af6 100644 --- a/UnitsNet.Tests/DecimalOverloadTests.cs +++ b/UnitsNet.Tests/DecimalOverloadTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,8 +20,6 @@ // THE SOFTWARE. using Xunit; -using UnitsNet.Extensions.NumberToAcceleration; -using UnitsNet.Extensions.NumberToPower; namespace UnitsNet.Tests { @@ -30,32 +28,14 @@ public class DecimalOverloadTests [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromDecimalReturnsCorrectValue() { - decimal oneMeterPerSecondSquared = 1m; - Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(oneMeterPerSecondSquared); - Assert.Equal(1.0, acceleration.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromDecimalWithExtensionMethodReturnsCorrectValue() - { - decimal oneMeterPerSecondSquared = 1m; - Acceleration acceleration = oneMeterPerSecondSquared.MetersPerSecondSquared(); + Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(1m); Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } [Fact] public static void CreatingQuantityWithDecimalBackingFieldFromDecimalReturnsCorrectValue() { - decimal oneWatt = 1m; - Power power = Power.FromWatts(oneWatt); - Assert.Equal(1.0, power.Watts); - } - - [Fact] - public static void CreatingQuantityWithDecimalBackingFieldFromDecimalWithExtensionMethodReturnsCorrectValue() - { - decimal oneWatt = 1m; - Power power = oneWatt.Watts(); + Power power = Power.FromWatts(1m); Assert.Equal(1.0, power.Watts); } } diff --git a/UnitsNet.Tests/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensionsTest.cs b/UnitsNet.Tests/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensionsTest.cs deleted file mode 100644 index de5e702403..0000000000 --- a/UnitsNet.Tests/Extensions/NumberToTimeSpan/NumberToTimeSpanExtensionsTest.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using Xunit; -using UnitsNet.Extensions.NumberToTimeSpan; - -namespace UnitsNet.Tests.Extensions.NumberToTimeSpan -{ - public class NumberToTimeSpanExtensionsTest - { - [Fact] - public void ExtensionMethodsReturnTimeSpanOfSameValue() - { - Assert.Equal(TimeSpan.FromDays(1), 1.d()); - Assert.Equal(TimeSpan.FromDays(1), 1L.d()); - Assert.Equal(TimeSpan.FromDays(1), 1f.d()); - Assert.Equal(TimeSpan.FromDays(1), 1d.d()); - Assert.Equal(TimeSpan.FromDays(1), 1m.d()); - - Assert.Equal(TimeSpan.FromHours(1), 1.h()); - Assert.Equal(TimeSpan.FromHours(1), 1L.h()); - Assert.Equal(TimeSpan.FromHours(1), 1f.h()); - Assert.Equal(TimeSpan.FromHours(1), 1d.h()); - Assert.Equal(TimeSpan.FromHours(1), 1m.h()); - - Assert.Equal(TimeSpan.FromMinutes(1), 1.m()); - Assert.Equal(TimeSpan.FromMinutes(1), 1L.m()); - Assert.Equal(TimeSpan.FromMinutes(1), 1f.m()); - Assert.Equal(TimeSpan.FromMinutes(1), 1d.m()); - Assert.Equal(TimeSpan.FromMinutes(1), 1m.m()); - - Assert.Equal(TimeSpan.FromSeconds(1), 1.s()); - Assert.Equal(TimeSpan.FromSeconds(1), 1L.s()); - Assert.Equal(TimeSpan.FromSeconds(1), 1f.s()); - Assert.Equal(TimeSpan.FromSeconds(1), 1d.s()); - Assert.Equal(TimeSpan.FromSeconds(1), 1m.s()); - - Assert.Equal(TimeSpan.FromMilliseconds(1), 1.ms()); - Assert.Equal(TimeSpan.FromMilliseconds(1), 1L.ms()); - Assert.Equal(TimeSpan.FromMilliseconds(1), 1f.ms()); - Assert.Equal(TimeSpan.FromMilliseconds(1), 1d.ms()); - Assert.Equal(TimeSpan.FromMilliseconds(1), 1m.ms()); - } - } -} diff --git a/UnitsNet.Tests/IntOverloadTests.cs b/UnitsNet.Tests/IntOverloadTests.cs index 1ffc8c75fa..c1aa279748 100644 --- a/UnitsNet.Tests/IntOverloadTests.cs +++ b/UnitsNet.Tests/IntOverloadTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,8 +20,6 @@ // THE SOFTWARE. using Xunit; -using UnitsNet.Extensions.NumberToAcceleration; -using UnitsNet.Extensions.NumberToPower; namespace UnitsNet.Tests { @@ -30,32 +28,14 @@ public class IntOverloadTests [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromIntReturnsCorrectValue() { - int oneMeterPerSecondSquared = 1; - Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(oneMeterPerSecondSquared); - Assert.Equal(1.0, acceleration.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromIntWithExtensionMethodReturnsCorrectValue() - { - int oneMeterPerSecondSquared = 1; - Acceleration acceleration = oneMeterPerSecondSquared.MetersPerSecondSquared(); + Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(1); Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } [Fact] public static void CreatingQuantityWithIntBackingFieldFromIntReturnsCorrectValue() { - int oneWatt = 1; - Power power = Power.FromWatts(oneWatt); - Assert.Equal(1.0, power.Watts); - } - - [Fact] - public static void CreatingQuantityWithIntBackingFieldFromIntWithExtensionMethodReturnsCorrectValue() - { - int oneWatt = 1; - Power power = oneWatt.Watts(); + Power power = Power.FromWatts(1); Assert.Equal(1.0, power.Watts); } } diff --git a/UnitsNet.Tests/LongOverloadTests.cs b/UnitsNet.Tests/LongOverloadTests.cs index 97851720bf..2423091f72 100644 --- a/UnitsNet.Tests/LongOverloadTests.cs +++ b/UnitsNet.Tests/LongOverloadTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,8 +20,6 @@ // THE SOFTWARE. using Xunit; -using UnitsNet.Extensions.NumberToAcceleration; -using UnitsNet.Extensions.NumberToPower; namespace UnitsNet.Tests { @@ -30,32 +28,14 @@ public class LongOverloadTests [Fact] public static void CreatingQuantityWithDoubleBackingFieldFromLongReturnsCorrectValue() { - long oneMeterPerSecondSquared = 1; - Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(oneMeterPerSecondSquared); - Assert.Equal(1.0, acceleration.MetersPerSecondSquared); - } - - [Fact] - public static void CreatingQuantityWithDoubleBackingFieldFromLongWithExtensionMethodReturnsCorrectValue() - { - long oneMeterPerSecondSquared = 1; - Acceleration acceleration = oneMeterPerSecondSquared.MetersPerSecondSquared(); + Acceleration acceleration = Acceleration.FromMetersPerSecondSquared(1L); Assert.Equal(1.0, acceleration.MetersPerSecondSquared); } [Fact] public static void CreatingQuantityWithLongBackingFieldFromLongReturnsCorrectValue() { - long oneWatt = 1; - Power power = Power.FromWatts(oneWatt); - Assert.Equal(1.0, power.Watts); - } - - [Fact] - public static void CreatingQuantityWithLongBackingFieldFromLongWithExtensionMethodReturnsCorrectValue() - { - long oneWatt = 1; - Power power = oneWatt.Watts(); + Power power = Power.FromWatts(1L); Assert.Equal(1.0, power.Watts); } } diff --git a/UnitsNet.Tests/NumberExtensionsTest.cs b/UnitsNet.Tests/NumberExtensionsTest.cs deleted file mode 100644 index b79ab02e44..0000000000 --- a/UnitsNet.Tests/NumberExtensionsTest.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using Xunit; -using UnitsNet.Extensions.NumberToAngle; -using UnitsNet.Extensions.NumberToForce; -using UnitsNet.Extensions.NumberToLength; -using UnitsNet.Extensions.NumberToMass; - -namespace UnitsNet.Tests -{ - public class NumberExtensionsTest - { - [Fact] - public void SomeArbitraryExtensionMethods_CreatesCorrectValue() - { - Assert.Equal(Length.FromMeters(1), 1.Meters()); - Assert.Equal(Mass.FromTonnes(2), 2.Tonnes()); - Assert.Equal(Force.FromKiloPonds(3), 3.KiloPonds()); - Assert.Equal(Angle.FromRadians(3), 3.Radians()); - } - } -} From 134d0758608953d37f1965435f16bc5504621497 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 00:59:04 +0200 Subject: [PATCH 033/131] Fix code issues flagged by R# Check for null Ignore warn about comparing double with 0. --- UnitsNet/CustomCode/Quantities/Level.extra.cs | 8 +++++--- UnitsNet/CustomCode/QuantityParser.cs | 13 ++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/UnitsNet/CustomCode/Quantities/Level.extra.cs b/UnitsNet/CustomCode/Quantities/Level.extra.cs index 9e25ee2dd0..b222bbcaf6 100644 --- a/UnitsNet/CustomCode/Quantities/Level.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Level.extra.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -44,10 +44,12 @@ public Level(double quantity, double reference) string errorMessage = $"The base-10 logarithm of a number ≤ 0 is undefined ({quantity}/{reference})."; + // ReSharper disable CompareOfFloatsByEqualityOperator if (quantity == 0 || quantity < 0 && reference > 0) throw new ArgumentOutOfRangeException(nameof(quantity), errorMessage); if (reference == 0 || quantity > 0 && reference < 0) throw new ArgumentOutOfRangeException(nameof(reference), errorMessage); + // ReSharper restore CompareOfFloatsByEqualityOperator _value = 10*Math.Log10(quantity/reference); _unit = LevelUnit.Decibel; diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index 7835bf8b72..a8d5ce9ec8 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -48,6 +48,9 @@ internal static TQuantity Parse([NotNull] string str, ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) : NumberFormatInfo.CurrentInfo; + if (numFormat == null) + throw new InvalidOperationException($"No number format was found for the given format provider: {formatProvider}"); + string numRegex = string.Format(@"[\d., {0}{1}]*\d", // allows digits, dots, commas, and spaces in the quantity (must end in digit) numFormat.NumberGroupSeparator, // adds provided (or current) culture's group separator @@ -60,7 +63,7 @@ internal static TQuantity Parse([NotNull] string str, .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error .Select(Regex.Escape) // Escape special regex characters .ToArray(); - + string unitsRegex = $"({String.Join("|", unitAbbreviations)})"; string regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", @@ -83,7 +86,7 @@ internal static TQuantity Parse([NotNull] string str, /// /// Parse a string given a particular regular expression. - /// + /// /// Error parsing string. private static List ParseWithRegex(string regexString, string str, ParseUnit parseUnit, IFormatProvider formatProvider = null) From a0ab229e4234419c2fef6c8d9b7cece63e0e0fb6 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 29 Sep 2018 01:17:07 +0200 Subject: [PATCH 034/131] Update README with v4 changes - Update build targets - Remove extension methods --- README.md | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0fdc875ee0..d2dc2eb6f4 100644 --- a/README.md +++ b/README.md @@ -11,20 +11,18 @@ Stop littering your code with unnecessary calculations, Units.NET gives you all ### Build Targets -* .NET Standard 1.0 +* .NET Standard 2.0 * .NET 4.0 -* .NET 3.5 Client * [Windows Runtime Component](https://docs.microsoft.com/en-us/windows/uwp/winrt-components/) for UWP apps (JavaScript, C++ or C#) ### Overview -* [50+ quantities with a total of 600+ units](UnitsNet/GeneratedCode/Units) generated from [JSON](Common/UnitDefinitions/) by [Powershell scripts](UnitsNet/Scripts) -* [1000+ unit tests](https://ci.appveyor.com/project/angularsen/unitsnet) on conversions and localizations +* [89 quantities with over 750 units](UnitsNet/GeneratedCode/Units) generated from [JSON](Common/UnitDefinitions/) by [Powershell scripts](UnitsNet/Scripts) +* [1900+ unit tests](https://ci.appveyor.com/project/angularsen/unitsnet) on conversions and localizations * Immutable structs that implement `Equatable`, `IComparable` * [Static typing](#static-typing) to avoid ambiguous values or units * [Operator overloads](#operator-overloads) for arithmetic on quantities -* [Extension methods](#extension-methods) for short-hand creation and conversions * [Parse and ToString()](#culture) supports cultures and localization * [Example: Creating a unit converter app](#example-app) * [Example: WPF app using IValueConverter to parse quantities from input](#example-wpf-app-using-ivalueconverter-to-parse-quantities-from-input) @@ -76,21 +74,6 @@ Acceleration a2 = Force.FromNewtons(100) / Mass.FromKilograms(20); RotationalSpeed r = Angle.FromDegrees(90) / TimeSpan.FromSeconds(2); ``` -### Extension Methods - -All units have associated extension methods for a really compact, expressive way to construct values or do arithmetic. -```C# -using UnitsNet.Extensions.NumberToDuration; -using UnitsNet.Extensions.NumberToLength; -using UnitsNet.Extensions.NumberToTimeSpan; - -Speed speed = 30.Kilometers() / 1.Hours(); // 30 km/h (using Duration type) -Length distance = speed * 2.h(); // 60 km (using TimeSpan type) - -Acceleration stdGravity = 9.80665.MetersPerSecondSquared(); -Force weight = 80.Kilograms() * stdGravity; // 80 kilograms-force or 784.532 newtons -``` - ### Culture and Localization The culture for abbreviations defaults to Thread.CurrentUICulture and falls back to US English if not defined. Thread.CurrentCulture affects number formatting unless a custom culture is specified. The relevant methods are: From 0e3dba32912ebf8bd9aaec1be991e13e412ab06d Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 1 Oct 2018 10:37:03 -0400 Subject: [PATCH 035/131] Use FallbackCulture rather than re-defining en-US --- UnitsNet/CustomCode/UnitSystem.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs index e4dbfaf4ce..ea3f4bac28 100644 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ b/UnitsNet/CustomCode/UnitSystem.cs @@ -528,12 +528,11 @@ private void LoadDefaultAbbreviations([NotNull] IFormatProvider culture) foreach (CulturesForEnumValue ev in localization.EnumValues) { int unitEnumValue = ev.Value; - var usCulture = new CultureInfo("en-US"); // Fall back to US English if localization not found - AbbreviationsForCulture matchingCulture = + var matchingCulture = ev.Cultures.FirstOrDefault(a => a.Cult.Equals(culture)) ?? - ev.Cultures.FirstOrDefault(a => a.Cult.Equals(usCulture)); + ev.Cultures.FirstOrDefault(a => a.Cult.Equals(FallbackCulture)); if (matchingCulture == null) continue; From cece5fbef3a55d89fd2b2dcc356f8c59f9cca7b8 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 1 Oct 2018 11:38:13 -0400 Subject: [PATCH 036/131] Throw ArgumentException if constructed with Undefined value --- .../Quantities/Acceleration.Common.g.cs | 5 +++- .../Quantities/AmountOfSubstance.Common.g.cs | 5 +++- .../Quantities/AmplitudeRatio.Common.g.cs | 5 +++- .../Quantities/Angle.Common.g.cs | 5 +++- .../Quantities/ApparentEnergy.Common.g.cs | 5 +++- .../Quantities/ApparentPower.Common.g.cs | 5 +++- .../GeneratedCode/Quantities/Area.Common.g.cs | 5 +++- .../Quantities/AreaDensity.Common.g.cs | 5 +++- .../AreaMomentOfInertia.Common.g.cs | 5 +++- .../Quantities/BitRate.Common.g.cs | 5 +++- .../BrakeSpecificFuelConsumption.Common.g.cs | 5 +++- .../Quantities/Capacitance.Common.g.cs | 5 +++- .../Quantities/Density.Common.g.cs | 5 +++- .../Quantities/Duration.Common.g.cs | 5 +++- .../Quantities/DynamicViscosity.Common.g.cs | 5 +++- .../Quantities/ElectricAdmittance.Common.g.cs | 5 +++- .../Quantities/ElectricCharge.Common.g.cs | 5 +++- .../ElectricChargeDensity.Common.g.cs | 5 +++- .../ElectricConductance.Common.g.cs | 5 +++- .../ElectricConductivity.Common.g.cs | 5 +++- .../Quantities/ElectricCurrent.Common.g.cs | 5 +++- .../ElectricCurrentDensity.Common.g.cs | 5 +++- .../ElectricCurrentGradient.Common.g.cs | 5 +++- .../Quantities/ElectricField.Common.g.cs | 5 +++- .../Quantities/ElectricInductance.Common.g.cs | 5 +++- .../Quantities/ElectricPotential.Common.g.cs | 5 +++- .../ElectricPotentialAc.Common.g.cs | 5 +++- .../ElectricPotentialDc.Common.g.cs | 5 +++- .../Quantities/ElectricResistance.Common.g.cs | 5 +++- .../ElectricResistivity.Common.g.cs | 5 +++- .../Quantities/Energy.Common.g.cs | 5 +++- .../Quantities/Entropy.Common.g.cs | 5 +++- .../Quantities/Force.Common.g.cs | 5 +++- .../Quantities/ForceChangeRate.Common.g.cs | 5 +++- .../Quantities/ForcePerLength.Common.g.cs | 5 +++- .../Quantities/Frequency.Common.g.cs | 5 +++- .../Quantities/HeatFlux.Common.g.cs | 5 +++- .../HeatTransferCoefficient.Common.g.cs | 5 +++- .../Quantities/Illuminance.Common.g.cs | 5 +++- .../Quantities/Information.Common.g.cs | 5 +++- .../Quantities/Irradiance.Common.g.cs | 5 +++- .../Quantities/Irradiation.Common.g.cs | 5 +++- .../Quantities/KinematicViscosity.Common.g.cs | 5 +++- .../Quantities/LapseRate.Common.g.cs | 5 +++- .../Quantities/Length.Common.g.cs | 5 +++- .../Quantities/Level.Common.g.cs | 5 +++- .../Quantities/LinearDensity.Common.g.cs | 5 +++- .../Quantities/LuminousFlux.Common.g.cs | 5 +++- .../Quantities/LuminousIntensity.Common.g.cs | 5 +++- .../Quantities/MagneticField.Common.g.cs | 5 +++- .../Quantities/MagneticFlux.Common.g.cs | 5 +++- .../Quantities/Magnetization.Common.g.cs | 5 +++- .../GeneratedCode/Quantities/Mass.Common.g.cs | 5 +++- .../Quantities/MassFlow.Common.g.cs | 5 +++- .../Quantities/MassFlux.Common.g.cs | 5 +++- .../MassMomentOfInertia.Common.g.cs | 5 +++- .../Quantities/MolarEnergy.Common.g.cs | 5 +++- .../Quantities/MolarEntropy.Common.g.cs | 5 +++- .../Quantities/MolarMass.Common.g.cs | 5 +++- .../Quantities/Molarity.Common.g.cs | 5 +++- .../Quantities/Permeability.Common.g.cs | 5 +++- .../Quantities/Permittivity.Common.g.cs | 5 +++- .../Quantities/Power.Common.g.cs | 5 +++- .../Quantities/PowerDensity.Common.g.cs | 5 +++- .../Quantities/PowerRatio.Common.g.cs | 5 +++- .../Quantities/Pressure.Common.g.cs | 5 +++- .../Quantities/PressureChangeRate.Common.g.cs | 5 +++- .../Quantities/Ratio.Common.g.cs | 5 +++- .../Quantities/ReactiveEnergy.Common.g.cs | 5 +++- .../Quantities/ReactivePower.Common.g.cs | 5 +++- .../RotationalAcceleration.Common.g.cs | 5 +++- .../Quantities/RotationalSpeed.Common.g.cs | 5 +++- .../RotationalStiffness.Common.g.cs | 5 +++- .../RotationalStiffnessPerLength.Common.g.cs | 5 +++- .../Quantities/SolidAngle.Common.g.cs | 5 +++- .../Quantities/SpecificEnergy.Common.g.cs | 5 +++- .../Quantities/SpecificEntropy.Common.g.cs | 5 +++- .../Quantities/SpecificVolume.Common.g.cs | 5 +++- .../Quantities/SpecificWeight.Common.g.cs | 5 +++- .../Quantities/Speed.Common.g.cs | 5 +++- .../Quantities/Temperature.Common.g.cs | 5 +++- .../TemperatureChangeRate.Common.g.cs | 5 +++- .../Quantities/TemperatureDelta.Common.g.cs | 5 +++- .../ThermalConductivity.Common.g.cs | 5 +++- .../Quantities/ThermalResistance.Common.g.cs | 5 +++- .../Quantities/Torque.Common.g.cs | 5 +++- .../Quantities/VitaminA.Common.g.cs | 5 +++- .../Quantities/Volume.Common.g.cs | 5 +++- .../Quantities/VolumeFlow.Common.g.cs | 5 +++- .../GeneratedCode/AccelerationTestsBase.g.cs | 7 ++++- .../AmountOfSubstanceTestsBase.g.cs | 7 ++++- .../AmplitudeRatioTestsBase.g.cs | 7 ++++- .../GeneratedCode/AngleTestsBase.g.cs | 7 ++++- .../ApparentEnergyTestsBase.g.cs | 7 ++++- .../GeneratedCode/ApparentPowerTestsBase.g.cs | 7 ++++- .../GeneratedCode/AreaDensityTestsBase.g.cs | 7 ++++- .../AreaMomentOfInertiaTestsBase.g.cs | 7 ++++- .../GeneratedCode/AreaTestsBase.g.cs | 7 ++++- .../GeneratedCode/BitRateTestsBase.g.cs | 7 ++++- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 7 ++++- .../GeneratedCode/CapacitanceTestsBase.g.cs | 7 ++++- .../GeneratedCode/DensityTestsBase.g.cs | 7 ++++- .../GeneratedCode/DurationTestsBase.g.cs | 7 ++++- .../DynamicViscosityTestsBase.g.cs | 7 ++++- .../ElectricAdmittanceTestsBase.g.cs | 7 ++++- .../ElectricChargeDensityTestsBase.g.cs | 7 ++++- .../ElectricChargeTestsBase.g.cs | 7 ++++- .../ElectricConductanceTestsBase.g.cs | 7 ++++- .../ElectricConductivityTestsBase.g.cs | 7 ++++- .../ElectricCurrentDensityTestsBase.g.cs | 7 ++++- .../ElectricCurrentGradientTestsBase.g.cs | 7 ++++- .../ElectricCurrentTestsBase.g.cs | 7 ++++- .../GeneratedCode/ElectricFieldTestsBase.g.cs | 7 ++++- .../ElectricInductanceTestsBase.g.cs | 7 ++++- .../ElectricPotentialAcTestsBase.g.cs | 7 ++++- .../ElectricPotentialDcTestsBase.g.cs | 7 ++++- .../ElectricPotentialTestsBase.g.cs | 7 ++++- .../ElectricResistanceTestsBase.g.cs | 7 ++++- .../ElectricResistivityTestsBase.g.cs | 7 ++++- .../GeneratedCode/EnergyTestsBase.g.cs | 7 ++++- .../GeneratedCode/EntropyTestsBase.g.cs | 7 ++++- .../ForceChangeRateTestsBase.g.cs | 7 ++++- .../ForcePerLengthTestsBase.g.cs | 7 ++++- .../GeneratedCode/ForceTestsBase.g.cs | 7 ++++- .../GeneratedCode/FrequencyTestsBase.g.cs | 7 ++++- .../GeneratedCode/HeatFluxTestsBase.g.cs | 7 ++++- .../HeatTransferCoefficientTestsBase.g.cs | 7 ++++- .../GeneratedCode/IlluminanceTestsBase.g.cs | 7 ++++- .../GeneratedCode/InformationTestsBase.g.cs | 7 ++++- .../GeneratedCode/IrradianceTestsBase.g.cs | 7 ++++- .../GeneratedCode/IrradiationTestsBase.g.cs | 7 ++++- .../KinematicViscosityTestsBase.g.cs | 7 ++++- .../GeneratedCode/LapseRateTestsBase.g.cs | 7 ++++- .../GeneratedCode/LengthTestsBase.g.cs | 7 ++++- .../GeneratedCode/LevelTestsBase.g.cs | 7 ++++- .../GeneratedCode/LinearDensityTestsBase.g.cs | 7 ++++- .../GeneratedCode/LuminousFluxTestsBase.g.cs | 7 ++++- .../LuminousIntensityTestsBase.g.cs | 7 ++++- .../GeneratedCode/MagneticFieldTestsBase.g.cs | 7 ++++- .../GeneratedCode/MagneticFluxTestsBase.g.cs | 7 ++++- .../GeneratedCode/MagnetizationTestsBase.g.cs | 7 ++++- .../GeneratedCode/MassFlowTestsBase.g.cs | 7 ++++- .../GeneratedCode/MassFluxTestsBase.g.cs | 7 ++++- .../MassMomentOfInertiaTestsBase.g.cs | 7 ++++- .../GeneratedCode/MassTestsBase.g.cs | 7 ++++- .../GeneratedCode/MolarEnergyTestsBase.g.cs | 7 ++++- .../GeneratedCode/MolarEntropyTestsBase.g.cs | 7 ++++- .../GeneratedCode/MolarMassTestsBase.g.cs | 7 ++++- .../GeneratedCode/MolarityTestsBase.g.cs | 7 ++++- .../GeneratedCode/PermeabilityTestsBase.g.cs | 7 ++++- .../GeneratedCode/PermittivityTestsBase.g.cs | 7 ++++- .../GeneratedCode/PowerDensityTestsBase.g.cs | 7 ++++- .../GeneratedCode/PowerRatioTestsBase.g.cs | 7 ++++- .../GeneratedCode/PowerTestsBase.g.cs | 7 ++++- .../PressureChangeRateTestsBase.g.cs | 7 ++++- .../GeneratedCode/PressureTestsBase.g.cs | 7 ++++- .../GeneratedCode/RatioTestsBase.g.cs | 7 ++++- .../ReactiveEnergyTestsBase.g.cs | 7 ++++- .../GeneratedCode/ReactivePowerTestsBase.g.cs | 7 ++++- .../RotationalAccelerationTestsBase.g.cs | 7 ++++- .../RotationalSpeedTestsBase.g.cs | 7 ++++- ...RotationalStiffnessPerLengthTestsBase.g.cs | 7 ++++- .../RotationalStiffnessTestsBase.g.cs | 7 ++++- .../GeneratedCode/SolidAngleTestsBase.g.cs | 7 ++++- .../SpecificEnergyTestsBase.g.cs | 7 ++++- .../SpecificEntropyTestsBase.g.cs | 7 ++++- .../SpecificVolumeTestsBase.g.cs | 7 ++++- .../SpecificWeightTestsBase.g.cs | 7 ++++- .../GeneratedCode/SpeedTestsBase.g.cs | 7 ++++- .../TemperatureChangeRateTestsBase.g.cs | 7 ++++- .../TemperatureDeltaTestsBase.g.cs | 7 ++++- .../GeneratedCode/TemperatureTestsBase.g.cs | 7 ++++- .../ThermalConductivityTestsBase.g.cs | 7 ++++- .../ThermalResistanceTestsBase.g.cs | 7 ++++- .../GeneratedCode/TorqueTestsBase.g.cs | 7 ++++- .../GeneratedCode/VitaminATestsBase.g.cs | 7 ++++- .../GeneratedCode/VolumeFlowTestsBase.g.cs | 7 ++++- .../GeneratedCode/VolumeTestsBase.g.cs | 7 ++++- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 30 ++++--------------- ...GenerateQuantitySourceCodeNetFramework.ps1 | 29 ------------------ ...ntitySourceCodeWindowsRuntimeComponent.ps1 | 29 ------------------ ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 7 ++++- 182 files changed, 902 insertions(+), 261 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index c78845e10f..93d9ed5461 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -85,7 +85,7 @@ static Acceleration() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Acceleration() #endif Acceleration(double numericValue, AccelerationUnit unit) { + if(unit == AccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 2ae69c2105..25a934310e 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -85,7 +85,7 @@ static AmountOfSubstance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static AmountOfSubstance() #endif AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit) { + if(unit == AmountOfSubstanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 21908ddbc5..2a923e3bf9 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -84,7 +84,7 @@ static AmplitudeRatio() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static AmplitudeRatio() #endif AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit) { + if(unit == AmplitudeRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 31f12e70d5..5cf37f370d 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -84,7 +84,7 @@ static Angle() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Angle() #endif Angle(double numericValue, AngleUnit unit) { + if(unit == AngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index d3b738c28f..57c4f21f3c 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -85,7 +85,7 @@ static ApparentEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ApparentEnergy() #endif ApparentEnergy(double numericValue, ApparentEnergyUnit unit) { + if(unit == ApparentEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 0c92300625..2c0e3e803e 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -85,7 +85,7 @@ static ApparentPower() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ApparentPower() #endif ApparentPower(double numericValue, ApparentPowerUnit unit) { + if(unit == ApparentPowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 55d5d0612c..4e8d498356 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -85,7 +85,7 @@ static Area() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Area() #endif Area(double numericValue, AreaUnit unit) { + if(unit == AreaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index cb1cfba4d1..276b89294b 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -85,7 +85,7 @@ static AreaDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static AreaDensity() #endif AreaDensity(double numericValue, AreaDensityUnit unit) { + if(unit == AreaDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 0c8c11b930..060e0cb7c5 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -85,7 +85,7 @@ static AreaMomentOfInertia() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static AreaMomentOfInertia() #endif AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit) { + if(unit == AreaMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index c80cb9103d..bb1962d612 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -84,7 +84,7 @@ static BitRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static BitRate() #endif BitRate(decimal numericValue, BitRateUnit unit) { + if(unit == BitRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index 8451783471..ab489620e6 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -85,7 +85,7 @@ static BrakeSpecificFuelConsumption() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static BrakeSpecificFuelConsumption() #endif BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsumptionUnit unit) { + if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 207d620ce3..40cd1c2f5d 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -85,7 +85,7 @@ static Capacitance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Capacitance() #endif Capacitance(double numericValue, CapacitanceUnit unit) { + if(unit == CapacitanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 424502289b..51d3a376f5 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -85,7 +85,7 @@ static Density() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Density() #endif Density(double numericValue, DensityUnit unit) { + if(unit == DensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index fb65aefdf7..2dd85fa7a0 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -85,7 +85,7 @@ static Duration() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Duration() #endif Duration(double numericValue, DurationUnit unit) { + if(unit == DurationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 019b542850..0d68bf7301 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -85,7 +85,7 @@ static DynamicViscosity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static DynamicViscosity() #endif DynamicViscosity(double numericValue, DynamicViscosityUnit unit) { + if(unit == DynamicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index d80d3e16b4..e9d80577b0 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricAdmittance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricAdmittance() #endif ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit) { + if(unit == ElectricAdmittanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 1c871dbf10..803d924b53 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCharge() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCharge() #endif ElectricCharge(double numericValue, ElectricChargeUnit unit) { + if(unit == ElectricChargeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 0c96f85a45..456266e71f 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricChargeDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricChargeDensity() #endif ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit unit) { + if(unit == ElectricChargeDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index faf9943273..bdf193ed08 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricConductance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricConductance() #endif ElectricConductance(double numericValue, ElectricConductanceUnit unit) { + if(unit == ElectricConductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index b7eecdd660..e738ae597b 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricConductivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricConductivity() #endif ElectricConductivity(double numericValue, ElectricConductivityUnit unit) { + if(unit == ElectricConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index c89040b50b..7e095a01fa 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCurrent() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCurrent() #endif ElectricCurrent(double numericValue, ElectricCurrentUnit unit) { + if(unit == ElectricCurrentUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 07dc957242..80a5896afc 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCurrentDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCurrentDensity() #endif ElectricCurrentDensity(double numericValue, ElectricCurrentDensityUnit unit) { + if(unit == ElectricCurrentDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 98ba0877fa..e3150cf62e 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -85,7 +85,7 @@ static ElectricCurrentGradient() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricCurrentGradient() #endif ElectricCurrentGradient(double numericValue, ElectricCurrentGradientUnit unit) { + if(unit == ElectricCurrentGradientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index c7f4415c0d..1dd721f78d 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -85,7 +85,7 @@ static ElectricField() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricField() #endif ElectricField(double numericValue, ElectricFieldUnit unit) { + if(unit == ElectricFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 5e99aca8fc..604be2d0e7 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricInductance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricInductance() #endif ElectricInductance(double numericValue, ElectricInductanceUnit unit) { + if(unit == ElectricInductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 1335fe4f02..cee26f9c96 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -85,7 +85,7 @@ static ElectricPotential() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricPotential() #endif ElectricPotential(double numericValue, ElectricPotentialUnit unit) { + if(unit == ElectricPotentialUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index ede77df0b7..845b7f15a1 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -84,7 +84,7 @@ static ElectricPotentialAc() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static ElectricPotentialAc() #endif ElectricPotentialAc(double numericValue, ElectricPotentialAcUnit unit) { + if(unit == ElectricPotentialAcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 646534343f..adf2dd26c7 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -84,7 +84,7 @@ static ElectricPotentialDc() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static ElectricPotentialDc() #endif ElectricPotentialDc(double numericValue, ElectricPotentialDcUnit unit) { + if(unit == ElectricPotentialDcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index edfbe3cf3c..38f5aa4f63 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -85,7 +85,7 @@ static ElectricResistance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricResistance() #endif ElectricResistance(double numericValue, ElectricResistanceUnit unit) { + if(unit == ElectricResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 1bf2b97e84..a1196038e5 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -85,7 +85,7 @@ static ElectricResistivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ElectricResistivity() #endif ElectricResistivity(double numericValue, ElectricResistivityUnit unit) { + if(unit == ElectricResistivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 300d8ebd52..21a5e464e8 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -85,7 +85,7 @@ static Energy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Energy() #endif Energy(double numericValue, EnergyUnit unit) { + if(unit == EnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index 58134e394d..e695b349f6 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -85,7 +85,7 @@ static Entropy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Entropy() #endif Entropy(double numericValue, EntropyUnit unit) { + if(unit == EntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 423da91f80..dc687014d4 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -85,7 +85,7 @@ static Force() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Force() #endif Force(double numericValue, ForceUnit unit) { + if(unit == ForceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 8d40ac8eed..185b004d19 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -85,7 +85,7 @@ static ForceChangeRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ForceChangeRate() #endif ForceChangeRate(double numericValue, ForceChangeRateUnit unit) { + if(unit == ForceChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index b125ddab77..095821a376 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -85,7 +85,7 @@ static ForcePerLength() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ForcePerLength() #endif ForcePerLength(double numericValue, ForcePerLengthUnit unit) { + if(unit == ForcePerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index ad20b1e708..28f561007c 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -85,7 +85,7 @@ static Frequency() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Frequency() #endif Frequency(double numericValue, FrequencyUnit unit) { + if(unit == FrequencyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 3924581ad1..60a80f59bc 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -85,7 +85,7 @@ static HeatFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static HeatFlux() #endif HeatFlux(double numericValue, HeatFluxUnit unit) { + if(unit == HeatFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 0af5b86e65..79fbb16f01 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -85,7 +85,7 @@ static HeatTransferCoefficient() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static HeatTransferCoefficient() #endif HeatTransferCoefficient(double numericValue, HeatTransferCoefficientUnit unit) { + if(unit == HeatTransferCoefficientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index fa620ee0f1..b04962702f 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -85,7 +85,7 @@ static Illuminance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Illuminance() #endif Illuminance(double numericValue, IlluminanceUnit unit) { + if(unit == IlluminanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index f970685a84..8faa30c6e9 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -84,7 +84,7 @@ static Information() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Information() #endif Information(decimal numericValue, InformationUnit unit) { + if(unit == InformationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index e88be7e7e5..8ac3e0e0eb 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -85,7 +85,7 @@ static Irradiance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Irradiance() #endif Irradiance(double numericValue, IrradianceUnit unit) { + if(unit == IrradianceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 185c9dc106..7f2d9760b2 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -85,7 +85,7 @@ static Irradiation() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Irradiation() #endif Irradiation(double numericValue, IrradiationUnit unit) { + if(unit == IrradiationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 31ab830023..32a767342a 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -85,7 +85,7 @@ static KinematicViscosity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static KinematicViscosity() #endif KinematicViscosity(double numericValue, KinematicViscosityUnit unit) { + if(unit == KinematicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index f151d87f4b..d35d311ac1 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -85,7 +85,7 @@ static LapseRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LapseRate() #endif LapseRate(double numericValue, LapseRateUnit unit) { + if(unit == LapseRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index df3c766803..6f27d38fca 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -85,7 +85,7 @@ static Length() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Length() #endif Length(double numericValue, LengthUnit unit) { + if(unit == LengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 135559cb2b..5d5b97c5d6 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -84,7 +84,7 @@ static Level() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Level() #endif Level(double numericValue, LevelUnit unit) { + if(unit == LevelUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index ed61cef9dc..12fb970428 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -85,7 +85,7 @@ static LinearDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LinearDensity() #endif LinearDensity(double numericValue, LinearDensityUnit unit) { + if(unit == LinearDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index bbe14681e8..1b85162ec6 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -85,7 +85,7 @@ static LuminousFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LuminousFlux() #endif LuminousFlux(double numericValue, LuminousFluxUnit unit) { + if(unit == LuminousFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 105d0ab1b6..7ab5e508c0 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -85,7 +85,7 @@ static LuminousIntensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static LuminousIntensity() #endif LuminousIntensity(double numericValue, LuminousIntensityUnit unit) { + if(unit == LuminousIntensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 777010fce3..9670600aa0 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -85,7 +85,7 @@ static MagneticField() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MagneticField() #endif MagneticField(double numericValue, MagneticFieldUnit unit) { + if(unit == MagneticFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index eab4ccba84..ecf97a2aa1 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -85,7 +85,7 @@ static MagneticFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MagneticFlux() #endif MagneticFlux(double numericValue, MagneticFluxUnit unit) { + if(unit == MagneticFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 3fe35ea7f5..0cdd76a5f7 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -85,7 +85,7 @@ static Magnetization() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Magnetization() #endif Magnetization(double numericValue, MagnetizationUnit unit) { + if(unit == MagnetizationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 9aeaac81ef..c0292d940d 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -85,7 +85,7 @@ static Mass() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Mass() #endif Mass(double numericValue, MassUnit unit) { + if(unit == MassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index 4920b42077..d94bf06be9 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -85,7 +85,7 @@ static MassFlow() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MassFlow() #endif MassFlow(double numericValue, MassFlowUnit unit) { + if(unit == MassFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index b7eaf6eeff..7fc96defff 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -85,7 +85,7 @@ static MassFlux() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MassFlux() #endif MassFlux(double numericValue, MassFluxUnit unit) { + if(unit == MassFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 6dd62ed4b8..5a7d16d447 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -85,7 +85,7 @@ static MassMomentOfInertia() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MassMomentOfInertia() #endif MassMomentOfInertia(double numericValue, MassMomentOfInertiaUnit unit) { + if(unit == MassMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 7d9bdf58b3..75d55e12a4 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -85,7 +85,7 @@ static MolarEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MolarEnergy() #endif MolarEnergy(double numericValue, MolarEnergyUnit unit) { + if(unit == MolarEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index a198221bc0..d268149d27 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -85,7 +85,7 @@ static MolarEntropy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MolarEntropy() #endif MolarEntropy(double numericValue, MolarEntropyUnit unit) { + if(unit == MolarEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index caaf577f31..3bec571f22 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -85,7 +85,7 @@ static MolarMass() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static MolarMass() #endif MolarMass(double numericValue, MolarMassUnit unit) { + if(unit == MolarMassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index 5a11b934cf..f25cefd5d0 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -85,7 +85,7 @@ static Molarity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Molarity() #endif Molarity(double numericValue, MolarityUnit unit) { + if(unit == MolarityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 605d01f70f..33554f2ecc 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -85,7 +85,7 @@ static Permeability() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Permeability() #endif Permeability(double numericValue, PermeabilityUnit unit) { + if(unit == PermeabilityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 5e478eebca..b52fa37930 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -85,7 +85,7 @@ static Permittivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Permittivity() #endif Permittivity(double numericValue, PermittivityUnit unit) { + if(unit == PermittivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index ba59d32489..f83a8256d0 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -85,7 +85,7 @@ static Power() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Power() #endif Power(decimal numericValue, PowerUnit unit) { + if(unit == PowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 8d8ab2583b..bb32edabf2 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -85,7 +85,7 @@ static PowerDensity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static PowerDensity() #endif PowerDensity(double numericValue, PowerDensityUnit unit) { + if(unit == PowerDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 76a694a796..7f00035b07 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -84,7 +84,7 @@ static PowerRatio() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static PowerRatio() #endif PowerRatio(double numericValue, PowerRatioUnit unit) { + if(unit == PowerRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index ec02f2f093..9b1ed49c46 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -85,7 +85,7 @@ static Pressure() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Pressure() #endif Pressure(double numericValue, PressureUnit unit) { + if(unit == PressureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 5eb9d4e36f..d4272d02f0 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -85,7 +85,7 @@ static PressureChangeRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static PressureChangeRate() #endif PressureChangeRate(double numericValue, PressureChangeRateUnit unit) { + if(unit == PressureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 9a9ed80adf..738f138e7c 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -84,7 +84,7 @@ static Ratio() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static Ratio() #endif Ratio(double numericValue, RatioUnit unit) { + if(unit == RatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index f0c04d4347..dbff2b914b 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -85,7 +85,7 @@ static ReactiveEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ReactiveEnergy() #endif ReactiveEnergy(double numericValue, ReactiveEnergyUnit unit) { + if(unit == ReactiveEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index 58efa1c60c..71565b2f36 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -85,7 +85,7 @@ static ReactivePower() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ReactivePower() #endif ReactivePower(double numericValue, ReactivePowerUnit unit) { + if(unit == ReactivePowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 62db2b62c3..02fb49c631 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -85,7 +85,7 @@ static RotationalAcceleration() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalAcceleration() #endif RotationalAcceleration(double numericValue, RotationalAccelerationUnit unit) { + if(unit == RotationalAccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 62a31f62bf..1e39a23e6c 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -85,7 +85,7 @@ static RotationalSpeed() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalSpeed() #endif RotationalSpeed(double numericValue, RotationalSpeedUnit unit) { + if(unit == RotationalSpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 6b9bff2b71..8bf6de9434 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -85,7 +85,7 @@ static RotationalStiffness() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalStiffness() #endif RotationalStiffness(double numericValue, RotationalStiffnessUnit unit) { + if(unit == RotationalStiffnessUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 67cbb7fb44..450cad0399 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -85,7 +85,7 @@ static RotationalStiffnessPerLength() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static RotationalStiffnessPerLength() #endif RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPerLengthUnit unit) { + if(unit == RotationalStiffnessPerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index ecdbbb4195..cfd85fc85e 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -84,7 +84,7 @@ static SolidAngle() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static SolidAngle() #endif SolidAngle(double numericValue, SolidAngleUnit unit) { + if(unit == SolidAngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index 6ec937c74f..ed49eb7f15 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -85,7 +85,7 @@ static SpecificEnergy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificEnergy() #endif SpecificEnergy(double numericValue, SpecificEnergyUnit unit) { + if(unit == SpecificEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 3842b05971..0ea0131f12 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -85,7 +85,7 @@ static SpecificEntropy() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificEntropy() #endif SpecificEntropy(double numericValue, SpecificEntropyUnit unit) { + if(unit == SpecificEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 2f1280f0aa..0bf0c2a59c 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -85,7 +85,7 @@ static SpecificVolume() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificVolume() #endif SpecificVolume(double numericValue, SpecificVolumeUnit unit) { + if(unit == SpecificVolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 339c20529d..976d3902b6 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -85,7 +85,7 @@ static SpecificWeight() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static SpecificWeight() #endif SpecificWeight(double numericValue, SpecificWeightUnit unit) { + if(unit == SpecificWeightUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 1910b3ae57..9c5f5665d6 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -85,7 +85,7 @@ static Speed() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Speed() #endif Speed(double numericValue, SpeedUnit unit) { + if(unit == SpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 2ee2dd11d2..050bbc24f3 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -85,7 +85,7 @@ static Temperature() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Temperature() #endif Temperature(double numericValue, TemperatureUnit unit) { + if(unit == TemperatureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 3fafb7743b..49b9afafce 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -85,7 +85,7 @@ static TemperatureChangeRate() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static TemperatureChangeRate() #endif TemperatureChangeRate(double numericValue, TemperatureChangeRateUnit unit) { + if(unit == TemperatureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 8728ee1613..0d3bfa2d7b 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -84,7 +84,7 @@ static TemperatureDelta() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static TemperatureDelta() #endif TemperatureDelta(double numericValue, TemperatureDeltaUnit unit) { + if(unit == TemperatureDeltaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index e433887e49..f2c943ea0d 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -85,7 +85,7 @@ static ThermalConductivity() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ThermalConductivity() #endif ThermalConductivity(double numericValue, ThermalConductivityUnit unit) { + if(unit == ThermalConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 9652cb4f1d..24ad6aa00f 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -85,7 +85,7 @@ static ThermalResistance() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static ThermalResistance() #endif ThermalResistance(double numericValue, ThermalResistanceUnit unit) { + if(unit == ThermalResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index d0187fa896..c21a58e936 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -85,7 +85,7 @@ static Torque() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Torque() #endif Torque(double numericValue, TorqueUnit unit) { + if(unit == TorqueUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 43a11b2394..1df049ea0a 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -84,7 +84,7 @@ static VitaminA() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -94,6 +94,9 @@ static VitaminA() #endif VitaminA(double numericValue, VitaminAUnit unit) { + if(unit == VitaminAUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index f4b37e14a4..33fcc4ecd0 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -85,7 +85,7 @@ static Volume() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static Volume() #endif Volume(double numericValue, VolumeUnit unit) { + if(unit == VolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 6d1309ae28..b89e54f5a6 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -85,7 +85,7 @@ static VolumeFlow() /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -95,6 +95,9 @@ static VolumeFlow() #endif VolumeFlow(double numericValue, VolumeFlowUnit unit) { + if(unit == VolumeFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index d5d8d54956..ba2c5b5060 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -83,6 +83,12 @@ public abstract partial class AccelerationTestsBase protected virtual double StandardGravityTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Acceleration((double)0.0, AccelerationUnit.Undefined)); + } + [Fact] public void MeterPerSecondSquaredToAccelerationUnits() { @@ -296,6 +302,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AccelerationUnit.Undefined, Acceleration.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index ad91ab381d..fde1d52585 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -85,6 +85,12 @@ public abstract partial class AmountOfSubstanceTestsBase protected virtual double PoundMolesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AmountOfSubstance((double)0.0, AmountOfSubstanceUnit.Undefined)); + } + [Fact] public void MoleToAmountOfSubstanceUnits() { @@ -306,6 +312,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AmountOfSubstanceUnit.Undefined, AmountOfSubstance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 56400c05f3..7bd0e75139 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class AmplitudeRatioTestsBase protected virtual double DecibelVoltsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AmplitudeRatio((double)0.0, AmplitudeRatioUnit.Undefined)); + } + [Fact] public void DecibelVoltToAmplitudeRatioUnits() { @@ -211,6 +217,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AmplitudeRatioUnit.Undefined, AmplitudeRatio.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index b024d92619..f8e6959e4f 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -85,6 +85,12 @@ public abstract partial class AngleTestsBase protected virtual double RevolutionsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Angle((double)0.0, AngleUnit.Undefined)); + } + [Fact] public void DegreeToAngleUnits() { @@ -306,6 +312,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AngleUnit.Undefined, Angle.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index 6fab19f62f..a7b21d9922 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class ApparentEnergyTestsBase protected virtual double VoltampereHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ApparentEnergy((double)0.0, ApparentEnergyUnit.Undefined)); + } + [Fact] public void VoltampereHourToApparentEnergyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ApparentEnergyUnit.Undefined, ApparentEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index 91ad20b6c2..8a46336a98 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ApparentPowerTestsBase protected virtual double VoltamperesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ApparentPower((double)0.0, ApparentPowerUnit.Undefined)); + } + [Fact] public void VoltampereToApparentPowerUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ApparentPowerUnit.Undefined, ApparentPower.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index 0d2dea3d1a..07df5efd07 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class AreaDensityTestsBase protected virtual double KilogramsPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AreaDensity((double)0.0, AreaDensityUnit.Undefined)); + } + [Fact] public void KilogramPerSquareMeterToAreaDensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaDensityUnit.Undefined, AreaDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index 95e82fc60a..19253d24cd 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -69,6 +69,12 @@ public abstract partial class AreaMomentOfInertiaTestsBase protected virtual double MillimetersToTheFourthTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new AreaMomentOfInertia((double)0.0, AreaMomentOfInertiaUnit.Undefined)); + } + [Fact] public void MeterToTheFourthToAreaMomentOfInertiaUnits() { @@ -226,6 +232,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaMomentOfInertiaUnit.Undefined, AreaMomentOfInertia.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index fd609e9363..229f2a8862 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -83,6 +83,12 @@ public abstract partial class AreaTestsBase protected virtual double UsSurveySquareFeetTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Area((double)0.0, AreaUnit.Undefined)); + } + [Fact] public void SquareMeterToAreaUnits() { @@ -296,6 +302,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaUnit.Undefined, Area.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index 4ffd779db9..12d6add74c 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class BitRateTestsBase protected virtual double TerabytesPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new BitRate((decimal)0.0, BitRateUnit.Undefined)); + } + [Fact] public void BitPerSecondToBitRateUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(BitRateUnit.Undefined, BitRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index f6970db1c4..07bc6fd165 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class BrakeSpecificFuelConsumptionTestsBase protected virtual double PoundsPerMechanicalHorsepowerHourTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new BrakeSpecificFuelConsumption((double)0.0, BrakeSpecificFuelConsumptionUnit.Undefined)); + } + [Fact] public void KilogramPerJouleToBrakeSpecificFuelConsumptionUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(BrakeSpecificFuelConsumptionUnit.Undefined, BrakeSpecificFuelConsumption.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index bf1403edc7..e0b8ea9f19 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class CapacitanceTestsBase protected virtual double FaradsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Capacitance((double)0.0, CapacitanceUnit.Undefined)); + } + [Fact] public void FaradToCapacitanceUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(CapacitanceUnit.Undefined, Capacitance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index 367edee704..c638a5da1c 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -133,6 +133,12 @@ public abstract partial class DensityTestsBase protected virtual double TonnesPerCubicMillimeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Density((double)0.0, DensityUnit.Undefined)); + } + [Fact] public void KilogramPerCubicMeterToDensityUnits() { @@ -546,6 +552,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DensityUnit.Undefined, Density.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index d5c69edeb0..f806a5304f 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -77,6 +77,12 @@ public abstract partial class DurationTestsBase protected virtual double Years365Tolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Duration((double)0.0, DurationUnit.Undefined)); + } + [Fact] public void SecondToDurationUnits() { @@ -266,6 +272,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DurationUnit.Undefined, Duration.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index 3d0034f8bd..be764da352 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -69,6 +69,12 @@ public abstract partial class DynamicViscosityTestsBase protected virtual double PoiseTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new DynamicViscosity((double)0.0, DynamicViscosityUnit.Undefined)); + } + [Fact] public void NewtonSecondPerMeterSquaredToDynamicViscosityUnits() { @@ -226,6 +232,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DynamicViscosityUnit.Undefined, DynamicViscosity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index 52ce56c277..96dedd353c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ElectricAdmittanceTestsBase protected virtual double SiemensTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricAdmittance((double)0.0, ElectricAdmittanceUnit.Undefined)); + } + [Fact] public void SiemensToElectricAdmittanceUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricAdmittanceUnit.Undefined, ElectricAdmittance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index f8db7c5e41..dbb00507bd 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricChargeDensityTestsBase protected virtual double CoulombsPerCubicMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricChargeDensity((double)0.0, ElectricChargeDensityUnit.Undefined)); + } + [Fact] public void CoulombPerCubicMeterToElectricChargeDensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricChargeDensityUnit.Undefined, ElectricChargeDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index dca2f01ccc..f29eb270ae 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricChargeTestsBase protected virtual double CoulombsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCharge((double)0.0, ElectricChargeUnit.Undefined)); + } + [Fact] public void CoulombToElectricChargeUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricChargeUnit.Undefined, ElectricCharge.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index dc0bf955c7..2da4b3b45d 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class ElectricConductanceTestsBase protected virtual double SiemensTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductance((double)0.0, ElectricConductanceUnit.Undefined)); + } + [Fact] public void SiemensToElectricConductanceUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricConductanceUnit.Undefined, ElectricConductance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index e2b68f3af9..30448d33a6 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricConductivityTestsBase protected virtual double SiemensPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductivity((double)0.0, ElectricConductivityUnit.Undefined)); + } + [Fact] public void SiemensPerMeterToElectricConductivityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricConductivityUnit.Undefined, ElectricConductivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index ec9b3c9491..5d27add425 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricCurrentDensityTestsBase protected virtual double AmperesPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentDensity((double)0.0, ElectricCurrentDensityUnit.Undefined)); + } + [Fact] public void AmperePerSquareMeterToElectricCurrentDensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentDensityUnit.Undefined, ElectricCurrentDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 87a2096ef1..2b10f1c8e2 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricCurrentGradientTestsBase protected virtual double AmperesPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentGradient((double)0.0, ElectricCurrentGradientUnit.Undefined)); + } + [Fact] public void AmperePerSecondToElectricCurrentGradientUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentGradientUnit.Undefined, ElectricCurrentGradient.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index fbdc010cd2..593380c1e0 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class ElectricCurrentTestsBase protected virtual double PicoamperesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrent((double)0.0, ElectricCurrentUnit.Undefined)); + } + [Fact] public void AmpereToElectricCurrentUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentUnit.Undefined, ElectricCurrent.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index ee0f64934c..ec025d2ebe 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricFieldTestsBase protected virtual double VoltsPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricField((double)0.0, ElectricFieldUnit.Undefined)); + } + [Fact] public void VoltPerMeterToElectricFieldUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricFieldUnit.Undefined, ElectricField.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index 21cb45fb10..da5260e825 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class ElectricInductanceTestsBase protected virtual double HenriesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricInductance((double)0.0, ElectricInductanceUnit.Undefined)); + } + [Fact] public void HenryToElectricInductanceUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricInductanceUnit.Undefined, ElectricInductance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index 4e00d0f1d4..6135c12ca4 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ElectricPotentialAcTestsBase protected virtual double VoltsAcTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialAc((double)0.0, ElectricPotentialAcUnit.Undefined)); + } + [Fact] public void VoltAcToElectricPotentialAcUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialAcUnit.Undefined, ElectricPotentialAc.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index 31ae99171d..abdb8e516f 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ElectricPotentialDcTestsBase protected virtual double VoltsDcTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialDc((double)0.0, ElectricPotentialDcUnit.Undefined)); + } + [Fact] public void VoltDcToElectricPotentialDcUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialDcUnit.Undefined, ElectricPotentialDc.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index 3418f8e556..ef42925c11 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ElectricPotentialTestsBase protected virtual double VoltsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotential((double)0.0, ElectricPotentialUnit.Undefined)); + } + [Fact] public void VoltToElectricPotentialUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialUnit.Undefined, ElectricPotential.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index 58d093de1f..4ab6ca465b 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ElectricResistanceTestsBase protected virtual double OhmsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistance((double)0.0, ElectricResistanceUnit.Undefined)); + } + [Fact] public void OhmToElectricResistanceUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricResistanceUnit.Undefined, ElectricResistance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index e3f152c82d..93f601197c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ElectricResistivityTestsBase protected virtual double OhmMetersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistivity((double)0.0, ElectricResistivityUnit.Undefined)); + } + [Fact] public void OhmMeterToElectricResistivityUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricResistivityUnit.Undefined, ElectricResistivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 185cb209b8..973c61ae6c 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -101,6 +101,12 @@ public abstract partial class EnergyTestsBase protected virtual double WattHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Energy((double)0.0, EnergyUnit.Undefined)); + } + [Fact] public void JouleToEnergyUnits() { @@ -386,6 +392,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(EnergyUnit.Undefined, Energy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index 9be160a987..b1e00b640f 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -71,6 +71,12 @@ public abstract partial class EntropyTestsBase protected virtual double MegajoulesPerKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Entropy((double)0.0, EntropyUnit.Undefined)); + } + [Fact] public void JoulePerKelvinToEntropyUnits() { @@ -236,6 +242,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(EntropyUnit.Undefined, Entropy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index 71a10c50cd..c87b6b2446 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -79,6 +79,12 @@ public abstract partial class ForceChangeRateTestsBase protected virtual double NewtonsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ForceChangeRate((double)0.0, ForceChangeRateUnit.Undefined)); + } + [Fact] public void NewtonPerSecondToForceChangeRateUnits() { @@ -276,6 +282,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForceChangeRateUnit.Undefined, ForceChangeRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index 475ba70f58..3971157664 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -75,6 +75,12 @@ public abstract partial class ForcePerLengthTestsBase protected virtual double NewtonsPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ForcePerLength((double)0.0, ForcePerLengthUnit.Undefined)); + } + [Fact] public void NewtonPerMeterToForcePerLengthUnits() { @@ -256,6 +262,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForcePerLengthUnit.Undefined, ForcePerLength.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 675e78b0aa..6ddcd62956 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -77,6 +77,12 @@ public abstract partial class ForceTestsBase protected virtual double TonnesForceTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Force((double)0.0, ForceUnit.Undefined)); + } + [Fact] public void NewtonToForceUnits() { @@ -266,6 +272,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForceUnit.Undefined, Force.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index 57829de236..f691f536d3 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class FrequencyTestsBase protected virtual double TerahertzTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Frequency((double)0.0, FrequencyUnit.Undefined)); + } + [Fact] public void HertzToFrequencyUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(FrequencyUnit.Undefined, Frequency.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index 745ab078d4..c2af4c817f 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -89,6 +89,12 @@ public abstract partial class HeatFluxTestsBase protected virtual double WattsPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new HeatFlux((double)0.0, HeatFluxUnit.Undefined)); + } + [Fact] public void WattPerSquareMeterToHeatFluxUnits() { @@ -326,6 +332,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(HeatFluxUnit.Undefined, HeatFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index fbb8dfae1a..34b0b8f95a 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class HeatTransferCoefficientTestsBase protected virtual double WattsPerSquareMeterKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new HeatTransferCoefficient((double)0.0, HeatTransferCoefficientUnit.Undefined)); + } + [Fact] public void WattPerSquareMeterKelvinToHeatTransferCoefficientUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(HeatTransferCoefficientUnit.Undefined, HeatTransferCoefficient.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index bb41e712c1..1c6f6800ea 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class IlluminanceTestsBase protected virtual double MilliluxTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Illuminance((double)0.0, IlluminanceUnit.Undefined)); + } + [Fact] public void LuxToIlluminanceUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IlluminanceUnit.Undefined, Illuminance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 9838aae21a..421a6f0a72 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class InformationTestsBase protected virtual double TerabytesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Information((decimal)0.0, InformationUnit.Undefined)); + } + [Fact] public void BitToInformationUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(InformationUnit.Undefined, Information.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index abafe1662d..02d02ab401 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class IrradianceTestsBase protected virtual double WattsPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Irradiance((double)0.0, IrradianceUnit.Undefined)); + } + [Fact] public void WattPerSquareMeterToIrradianceUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IrradianceUnit.Undefined, Irradiance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index 9beaf2316b..9ca8965d52 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class IrradiationTestsBase protected virtual double WattHoursPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Irradiation((double)0.0, IrradiationUnit.Undefined)); + } + [Fact] public void JoulePerSquareMeterToIrradiationUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IrradiationUnit.Undefined, Irradiation.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 8658aff7ea..92f9a6a96d 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class KinematicViscosityTestsBase protected virtual double StokesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new KinematicViscosity((double)0.0, KinematicViscosityUnit.Undefined)); + } + [Fact] public void SquareMeterPerSecondToKinematicViscosityUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(KinematicViscosityUnit.Undefined, KinematicViscosity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 7d2fcf1f37..41a859da8e 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class LapseRateTestsBase protected virtual double DegreesCelciusPerKilometerTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LapseRate((double)0.0, LapseRateUnit.Undefined)); + } + [Fact] public void DegreeCelsiusPerKilometerToLapseRateUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LapseRateUnit.Undefined, LapseRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index 3b3e68c55a..a758944098 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -101,6 +101,12 @@ public abstract partial class LengthTestsBase protected virtual double YardsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Length((double)0.0, LengthUnit.Undefined)); + } + [Fact] public void MeterToLengthUnits() { @@ -386,6 +392,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LengthUnit.Undefined, Length.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 3bb2e29d6e..9e936cd71b 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class LevelTestsBase protected virtual double NepersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Level((double)0.0, LevelUnit.Undefined)); + } + [Fact] public void DecibelToLevelUnits() { @@ -191,6 +197,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LevelUnit.Undefined, Level.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index f539cd5237..42d59694cc 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class LinearDensityTestsBase protected virtual double PoundsPerFootTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LinearDensity((double)0.0, LinearDensityUnit.Undefined)); + } + [Fact] public void KilogramPerMeterToLinearDensityUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LinearDensityUnit.Undefined, LinearDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index 1d8377c939..0e7f2ffc33 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class LuminousFluxTestsBase protected virtual double LumensTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LuminousFlux((double)0.0, LuminousFluxUnit.Undefined)); + } + [Fact] public void LumenToLuminousFluxUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LuminousFluxUnit.Undefined, LuminousFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index 43a3f8571f..291b37b47f 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class LuminousIntensityTestsBase protected virtual double CandelaTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new LuminousIntensity((double)0.0, LuminousIntensityUnit.Undefined)); + } + [Fact] public void CandelaToLuminousIntensityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LuminousIntensityUnit.Undefined, LuminousIntensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index aa8c49db3f..28eba96a39 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class MagneticFieldTestsBase protected virtual double TeslasTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MagneticField((double)0.0, MagneticFieldUnit.Undefined)); + } + [Fact] public void TeslaToMagneticFieldUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagneticFieldUnit.Undefined, MagneticField.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index 0324d949a3..ef47677788 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class MagneticFluxTestsBase protected virtual double WebersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MagneticFlux((double)0.0, MagneticFluxUnit.Undefined)); + } + [Fact] public void WeberToMagneticFluxUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagneticFluxUnit.Undefined, MagneticFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index 9d0205fa94..f2cf6b5e78 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class MagnetizationTestsBase protected virtual double AmperesPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Magnetization((double)0.0, MagnetizationUnit.Undefined)); + } + [Fact] public void AmperePerMeterToMagnetizationUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagnetizationUnit.Undefined, Magnetization.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 9fd4c1d834..072cd491cd 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -87,6 +87,12 @@ public abstract partial class MassFlowTestsBase protected virtual double TonnesPerHourTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MassFlow((double)0.0, MassFlowUnit.Undefined)); + } + [Fact] public void GramPerSecondToMassFlowUnits() { @@ -316,6 +322,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassFlowUnit.Undefined, MassFlow.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index d8edec8a0b..2f4868ad6c 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class MassFluxTestsBase protected virtual double KilogramsPerSecondPerSquareMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MassFlux((double)0.0, MassFluxUnit.Undefined)); + } + [Fact] public void KilogramPerSecondPerSquareMeterToMassFluxUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassFluxUnit.Undefined, MassFlux.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index ab3adee533..8177a148a0 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class MassMomentOfInertiaTestsBase protected virtual double TonneSquareMilimetersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MassMomentOfInertia((double)0.0, MassMomentOfInertiaUnit.Undefined)); + } + [Fact] public void KilogramSquareMeterToMassMomentOfInertiaUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassMomentOfInertiaUnit.Undefined, MassMomentOfInertia.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index 13586290ae..03d53b92f2 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -99,6 +99,12 @@ public abstract partial class MassTestsBase protected virtual double TonnesTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Mass((double)0.0, MassUnit.Undefined)); + } + [Fact] public void KilogramToMassUnits() { @@ -376,6 +382,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassUnit.Undefined, Mass.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index d513b87f1d..63fdc2a981 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class MolarEnergyTestsBase protected virtual double MegajoulesPerMoleTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MolarEnergy((double)0.0, MolarEnergyUnit.Undefined)); + } + [Fact] public void JoulePerMoleToMolarEnergyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarEnergyUnit.Undefined, MolarEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index fc31da2b01..1fc4cbf18e 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class MolarEntropyTestsBase protected virtual double MegajoulesPerMoleKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MolarEntropy((double)0.0, MolarEntropyUnit.Undefined)); + } + [Fact] public void JoulePerMoleKelvinToMolarEntropyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarEntropyUnit.Undefined, MolarEntropy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index fd8a848e71..2816dbc406 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -81,6 +81,12 @@ public abstract partial class MolarMassTestsBase protected virtual double PoundsPerMoleTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new MolarMass((double)0.0, MolarMassUnit.Undefined)); + } + [Fact] public void KilogramPerMoleToMolarMassUnits() { @@ -286,6 +292,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarMassUnit.Undefined, MolarMass.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index 2d0bdd0d89..05fbb01ed6 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class MolarityTestsBase protected virtual double PicomolesPerLiterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Molarity((double)0.0, MolarityUnit.Undefined)); + } + [Fact] public void MolesPerCubicMeterToMolarityUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarityUnit.Undefined, Molarity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index f307316701..4891e3888d 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class PermeabilityTestsBase protected virtual double HenriesPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Permeability((double)0.0, PermeabilityUnit.Undefined)); + } + [Fact] public void HenryPerMeterToPermeabilityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PermeabilityUnit.Undefined, Permeability.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index 2ab368854a..43a78f4d07 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class PermittivityTestsBase protected virtual double FaradsPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Permittivity((double)0.0, PermittivityUnit.Undefined)); + } + [Fact] public void FaradPerMeterToPermittivityUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PermittivityUnit.Undefined, Permittivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 8bc82409e1..814290401b 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -145,6 +145,12 @@ public abstract partial class PowerDensityTestsBase protected virtual double WattsPerLiterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new PowerDensity((double)0.0, PowerDensityUnit.Undefined)); + } + [Fact] public void WattPerCubicMeterToPowerDensityUnits() { @@ -606,6 +612,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerDensityUnit.Undefined, PowerDensity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index 998f067817..d680f2a4be 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class PowerRatioTestsBase protected virtual double DecibelWattsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new PowerRatio((double)0.0, PowerRatioUnit.Undefined)); + } + [Fact] public void DecibelWattToPowerRatioUnits() { @@ -191,6 +197,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerRatioUnit.Undefined, PowerRatio.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index 965e63128c..e8a5d7314b 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -97,6 +97,12 @@ public abstract partial class PowerTestsBase protected virtual double WattsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Power((decimal)0.0, PowerUnit.Undefined)); + } + [Fact] public void WattToPowerUnits() { @@ -366,6 +372,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerUnit.Undefined, Power.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index 879d0f0cd0..709037cb5b 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class PressureChangeRateTestsBase protected virtual double PascalsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new PressureChangeRate((double)0.0, PressureChangeRateUnit.Undefined)); + } + [Fact] public void PascalPerSecondToPressureChangeRateUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PressureChangeRateUnit.Undefined, PressureChangeRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index 3789e36921..3272a3b016 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -131,6 +131,12 @@ public abstract partial class PressureTestsBase protected virtual double TorrsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Pressure((double)0.0, PressureUnit.Undefined)); + } + [Fact] public void PascalToPressureUnits() { @@ -536,6 +542,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PressureUnit.Undefined, Pressure.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index 2c2397753a..eb06b07354 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -69,6 +69,12 @@ public abstract partial class RatioTestsBase protected virtual double PercentTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Ratio((double)0.0, RatioUnit.Undefined)); + } + [Fact] public void DecimalFractionToRatioUnits() { @@ -226,6 +232,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RatioUnit.Undefined, Ratio.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index 78212a0e1f..576d61d7d8 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class ReactiveEnergyTestsBase protected virtual double VoltampereReactiveHoursTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ReactiveEnergy((double)0.0, ReactiveEnergyUnit.Undefined)); + } + [Fact] public void VoltampereReactiveHourToReactiveEnergyUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ReactiveEnergyUnit.Undefined, ReactiveEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index 9b325f9183..4d148a5aea 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -65,6 +65,12 @@ public abstract partial class ReactivePowerTestsBase protected virtual double VoltamperesReactiveTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ReactivePower((double)0.0, ReactivePowerUnit.Undefined)); + } + [Fact] public void VoltampereReactiveToReactivePowerUnits() { @@ -206,6 +212,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ReactivePowerUnit.Undefined, ReactivePower.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index 3e23884d1c..8fdfcf9640 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class RotationalAccelerationTestsBase protected virtual double RevolutionsPerMinutePerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalAcceleration((double)0.0, RotationalAccelerationUnit.Undefined)); + } + [Fact] public void RadianPerSecondSquaredToRotationalAccelerationUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalAccelerationUnit.Undefined, RotationalAcceleration.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index c031eebfde..4da0c2a40f 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -83,6 +83,12 @@ public abstract partial class RotationalSpeedTestsBase protected virtual double RevolutionsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalSpeed((double)0.0, RotationalSpeedUnit.Undefined)); + } + [Fact] public void RadianPerSecondToRotationalSpeedUnits() { @@ -296,6 +302,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalSpeedUnit.Undefined, RotationalSpeed.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 2d0dab215e..6ddb83a45d 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class RotationalStiffnessPerLengthTestsBase protected virtual double NewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffnessPerLength((double)0.0, RotationalStiffnessPerLengthUnit.Undefined)); + } + [Fact] public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalStiffnessPerLengthUnit.Undefined, RotationalStiffnessPerLength.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index cf8e152fa6..f780416a16 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -63,6 +63,12 @@ public abstract partial class RotationalStiffnessTestsBase protected virtual double NewtonMetersPerRadianTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffness((double)0.0, RotationalStiffnessUnit.Undefined)); + } + [Fact] public void NewtonMeterPerRadianToRotationalStiffnessUnits() { @@ -196,6 +202,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalStiffnessUnit.Undefined, RotationalStiffness.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index f673e26e4e..fd7eaa5e7e 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class SolidAngleTestsBase protected virtual double SteradiansTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SolidAngle((double)0.0, SolidAngleUnit.Undefined)); + } + [Fact] public void SteradianToSolidAngleUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SolidAngleUnit.Undefined, SolidAngle.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index 1072b5c4a3..46c74ab544 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class SpecificEnergyTestsBase protected virtual double WattHoursPerKilogramTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificEnergy((double)0.0, SpecificEnergyUnit.Undefined)); + } + [Fact] public void JoulePerKilogramToSpecificEnergyUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificEnergyUnit.Undefined, SpecificEnergy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 9c49f40558..824d0434ff 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class SpecificEntropyTestsBase protected virtual double MegajoulesPerKilogramKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificEntropy((double)0.0, SpecificEntropyUnit.Undefined)); + } + [Fact] public void JoulePerKilogramKelvinToSpecificEntropyUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificEntropyUnit.Undefined, SpecificEntropy.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 8a91d36863..9b0c7d3f3a 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class SpecificVolumeTestsBase protected virtual double CubicMetersPerKilogramTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificVolume((double)0.0, SpecificVolumeUnit.Undefined)); + } + [Fact] public void CubicMeterPerKilogramToSpecificVolumeUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificVolumeUnit.Undefined, SpecificVolume.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index 6221a093a1..2a1e87bdf5 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -91,6 +91,12 @@ public abstract partial class SpecificWeightTestsBase protected virtual double TonnesForcePerCubicMillimeterTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new SpecificWeight((double)0.0, SpecificWeightUnit.Undefined)); + } + [Fact] public void NewtonPerCubicMeterToSpecificWeightUnits() { @@ -336,6 +342,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificWeightUnit.Undefined, SpecificWeight.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index b26aec893d..186d6cd018 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -121,6 +121,12 @@ public abstract partial class SpeedTestsBase protected virtual double YardsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Speed((double)0.0, SpeedUnit.Undefined)); + } + [Fact] public void MeterPerSecondToSpeedUnits() { @@ -486,6 +492,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpeedUnit.Undefined, Speed.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index 7d5d3aea7f..7d5e999225 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -77,6 +77,12 @@ public abstract partial class TemperatureChangeRateTestsBase protected virtual double NanodegreesCelsiusPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new TemperatureChangeRate((double)0.0, TemperatureChangeRateUnit.Undefined)); + } + [Fact] public void DegreeCelsiusPerSecondToTemperatureChangeRateUnits() { @@ -266,6 +272,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureChangeRateUnit.Undefined, TemperatureChangeRate.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index d22896a6c6..3266bb7e50 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class TemperatureDeltaTestsBase protected virtual double KelvinsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new TemperatureDelta((double)0.0, TemperatureDeltaUnit.Undefined)); + } + [Fact] public void KelvinToTemperatureDeltaUnits() { @@ -246,6 +252,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureDeltaUnit.Undefined, TemperatureDelta.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 43f99b4864..4c2bf7e7db 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -73,6 +73,12 @@ public abstract partial class TemperatureTestsBase protected virtual double KelvinsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Temperature((double)0.0, TemperatureUnit.Undefined)); + } + [Fact] public void KelvinToTemperatureUnits() { @@ -234,6 +240,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureUnit.Undefined, Temperature.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index 8c8c4384b2..83373ac345 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -61,6 +61,12 @@ public abstract partial class ThermalConductivityTestsBase protected virtual double WattsPerMeterKelvinTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ThermalConductivity((double)0.0, ThermalConductivityUnit.Undefined)); + } + [Fact] public void WattPerMeterKelvinToThermalConductivityUnits() { @@ -186,6 +192,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ThermalConductivityUnit.Undefined, ThermalConductivity.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index 5a7b6d6e70..c9402bb963 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -67,6 +67,12 @@ public abstract partial class ThermalResistanceTestsBase protected virtual double SquareMeterKelvinsPerKilowattTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new ThermalResistance((double)0.0, ThermalResistanceUnit.Undefined)); + } + [Fact] public void SquareMeterKelvinPerKilowattToThermalResistanceUnits() { @@ -216,6 +222,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ThermalResistanceUnit.Undefined, ThermalResistance.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index 297647516e..e698b9395d 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -99,6 +99,12 @@ public abstract partial class TorqueTestsBase protected virtual double TonneForceMillimetersTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Torque((double)0.0, TorqueUnit.Undefined)); + } + [Fact] public void NewtonMeterToTorqueUnits() { @@ -376,6 +382,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TorqueUnit.Undefined, Torque.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index 8d5d86f2e6..d3c8577c7c 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -59,6 +59,12 @@ public abstract partial class VitaminATestsBase protected virtual double InternationalUnitsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new VitaminA((double)0.0, VitaminAUnit.Undefined)); + } + [Fact] public void InternationalUnitToVitaminAUnits() { @@ -176,6 +182,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VitaminAUnit.Undefined, VitaminA.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index 2e70cb5e58..bd35c2aed0 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -109,6 +109,12 @@ public abstract partial class VolumeFlowTestsBase protected virtual double UsGallonsPerSecondTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new VolumeFlow((double)0.0, VolumeFlowUnit.Undefined)); + } + [Fact] public void CubicMeterPerSecondToVolumeFlowUnits() { @@ -426,6 +432,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VolumeFlowUnit.Undefined, VolumeFlow.Units); } - } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 7c6ccebad0..572660d5ae 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -141,6 +141,12 @@ public abstract partial class VolumeTestsBase protected virtual double UsTeaspoonsTolerance { get { return 1e-5; } } // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new Volume((double)0.0, VolumeUnit.Undefined)); + } + [Fact] public void CubicMeterToVolumeUnits() { @@ -586,6 +592,5 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VolumeUnit.Undefined, Volume.Units); } - } } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 020ede7da5..5205ca1ff0 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -5,8 +5,6 @@ $baseType = $quantity.BaseType; $baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } $baseUnitSingularName = $baseUnit.SingularName - $baseUnitPluralName = $baseUnit.PluralName - $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() $unitEnumName = "$quantityName" + "Unit" # Base dimensions @@ -19,25 +17,6 @@ $baseDimensionAmountOfSubstance = if($baseDimensions.N){$baseDimensions.N} else{0}; $baseDimensionLuminousIntensity = if($baseDimensions.J){$baseDimensions.J} else{0}; - $convertToBaseType = switch ($baseType) { - "long" { "Convert.ToInt64"; break } - "double" { "Convert.ToDouble"; break } - "decimal" { "Convert.ToDecimal"; break } - default { throw "Base type not supported: $baseType" } - } - - $quantityValueType = switch ($baseType) { - "long" { "QuantityValue"; break } - "double" { "QuantityValue"; break } - "decimal" { "QuantityValue"; break } - default { throw "Base type not supported: $baseType" } - } - - $obsoleteEqualityIfDouble = '' - if ($quantity.BaseType -eq "double") { - $obsoleteEqualityIfDouble = '[Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")]' + "`r`n " - } - @" //------------------------------------------------------------------------------ // @@ -140,7 +119,7 @@ if ($obsoleteAttribute) /// /// Creates the quantity with the given numeric value and unit. /// - /// Numeric value. + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. #if WINDOWS_UWP @@ -150,6 +129,9 @@ if ($obsoleteAttribute) #endif $quantityName($baseType numericValue, $unitEnumName unit) { + if(unit == $unitEnumName.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + _value = numericValue; _unit = unit; } @@ -218,7 +200,7 @@ if ($obsoleteAttribute) [Windows.Foundation.Metadata.DefaultOverload] public static $quantityName From$($unit.PluralName)(double $valueParamName) #else - public static $quantityName From$($unit.PluralName)($quantityValueType $valueParamName) + public static $quantityName From$($unit.PluralName)(QuantityValue $valueParamName) #endif { $baseType value = ($baseType) $valueParamName; @@ -238,7 +220,7 @@ if ($obsoleteAttribute) [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] public static $quantityName From(double value, $unitEnumName fromUnit) #else - public static $quantityName From($quantityValueType value, $unitEnumName fromUnit) + public static $quantityName From(QuantityValue value, $unitEnumName fromUnit) #endif { return new $quantityName(($baseType)value, fromUnit); diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 128543bb3f..d8ecf8a111 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -9,35 +9,6 @@ $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() $unitEnumName = "$quantityName" + "Unit" - # Base dimensions - $baseDimensions = $quantity.BaseDimensions; - $baseDimensionLength = if($baseDimensions.L){$baseDimensions.L} else{0}; - $baseDimensionMass = if($baseDimensions.M){$baseDimensions.M} else{0}; - $baseDimensionTime = if($baseDimensions.T){$baseDimensions.T} else{0}; - $baseDimensionElectricCurrent = if($baseDimensions.I){$baseDimensions.I} else{0}; - $baseDimensionTemperature = if($baseDimensions.Θ){$baseDimensions.Θ} else{0}; - $baseDimensionAmountOfSubstance = if($baseDimensions.N){$baseDimensions.N} else{0}; - $baseDimensionLuminousIntensity = if($baseDimensions.J){$baseDimensions.J} else{0}; - - $convertToBaseType = switch ($baseType) { - "long" { "Convert.ToInt64"; break } - "double" { "Convert.ToDouble"; break } - "decimal" { "Convert.ToDecimal"; break } - default { throw "Base type not supported: $baseType" } - } - - $quantityValueType = switch ($baseType) { - "long" { "QuantityValue"; break } - "double" { "QuantityValue"; break } - "decimal" { "QuantityValue"; break } - default { throw "Base type not supported: $baseType" } - } - - $obsoleteEqualityIfDouble = '' - if ($quantity.BaseType -eq "double") { - $obsoleteEqualityIfDouble = '[Obsolete("It is not safe to compare equality due to 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.")]' + "`r`n " - } - @" //------------------------------------------------------------------------------ // diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index 022f406f83..96146d14e0 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -9,35 +9,6 @@ $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() $unitEnumName = "$quantityName" + "Unit" - # Base dimensions - $baseDimensions = $quantity.BaseDimensions; - $baseDimensionLength = if($baseDimensions.L){$baseDimensions.L} else{0}; - $baseDimensionMass = if($baseDimensions.M){$baseDimensions.M} else{0}; - $baseDimensionTime = if($baseDimensions.T){$baseDimensions.T} else{0}; - $baseDimensionElectricCurrent = if($baseDimensions.I){$baseDimensions.I} else{0}; - $baseDimensionTemperature = if($baseDimensions.Θ){$baseDimensions.Θ} else{0}; - $baseDimensionAmountOfSubstance = if($baseDimensions.N){$baseDimensions.N} else{0}; - $baseDimensionLuminousIntensity = if($baseDimensions.J){$baseDimensions.J} else{0}; - - $convertToBaseType = switch ($baseType) { - "long" { "Convert.ToInt64"; break } - "double" { "Convert.ToDouble"; break } - "decimal" { "Convert.ToDecimal"; break } - default { throw "Base type not supported: $baseType" } - } - - $quantityValueType = switch ($baseType) { - "long" { "QuantityValue"; break } - "double" { "QuantityValue"; break } - "decimal" { "QuantityValue"; break } - default { throw "Base type not supported: $baseType" } - } - - $obsoleteEqualityIfDouble = '' - if ($quantity.BaseType -eq "double") { - $obsoleteEqualityIfDouble = '[Obsolete("It is not safe to compare equality due to 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.")]' + "`r`n " - } - @" //------------------------------------------------------------------------------ // diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index a1ae92fc08..75f3f21644 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -74,6 +74,12 @@ namespace UnitsNet.Tests "@; }@" // ReSharper restore VirtualMemberNeverOverriden.Global + [Fact] + public void ConstructorWithUndefinedUnitThrowsArgumentException() + { + Assert.Throws(() => new $quantityName(($baseType)0.0, $unitEnumName.Undefined)); + } + [Fact] public void $($baseUnit.SingularName)To$($quantityName)Units() { @@ -225,7 +231,6 @@ namespace UnitsNet.Tests { Assert.DoesNotContain($unitEnumName.Undefined, $quantityName.Units); } - } } "@; From f2650dcbb5e2dba152e14f47831ce0d862f5bbd5 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 1 Oct 2018 21:01:29 +0200 Subject: [PATCH 037/131] QuantityValue: Do not allow NaN value This prevents constructing any quantity with a NaN floating point value. Decimal and integer types does not the concept of NaN (nor Infinity), so I'm tempted to argue we should not allow those values either to be consistent with quantities backed by decimal type. --- UnitsNet/InternalHelpers/Guard.cs | 38 +++++++++++++++++++++++++++++++ UnitsNet/QuantityValue.cs | 4 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 UnitsNet/InternalHelpers/Guard.cs diff --git a/UnitsNet/InternalHelpers/Guard.cs b/UnitsNet/InternalHelpers/Guard.cs new file mode 100644 index 0000000000..37ee49b96a --- /dev/null +++ b/UnitsNet/InternalHelpers/Guard.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using JetBrains.Annotations; + +namespace UnitsNet.InternalHelpers +{ + /// + /// Guard methods to ensure parameter values satisfy pre-conditions and use a consistent exception message. + /// + internal static class Guard + { + internal static double EnsureNotNaN(double value, [InvokerParameterName] string paramName) + { + if (double.IsNaN(value)) throw new ArgumentException("'NaN' is not a valid number.", paramName); + return value; + } + } +} diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index d05598705c..793f5ad653 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -21,6 +21,8 @@ // Operator overloads not supported in Windows Runtime Components, we use 'double' type instead +using UnitsNet.InternalHelpers; + #if !WINDOWS_UWP namespace UnitsNet { @@ -55,7 +57,7 @@ public struct QuantityValue private QuantityValue(double val) { - _value = val; + _value = Guard.EnsureNotNaN(val, nameof(val)); _valueDecimal = null; } From fb099e4c4c674c470387bd670188aa72a4a91ea4 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 1 Oct 2018 21:05:05 +0200 Subject: [PATCH 038/131] Revert "QuantityValue: Do not allow NaN value" This reverts commit f2650dcbb5e2dba152e14f47831ce0d862f5bbd5. --- UnitsNet/InternalHelpers/Guard.cs | 38 ------------------------------- UnitsNet/QuantityValue.cs | 4 +--- 2 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 UnitsNet/InternalHelpers/Guard.cs diff --git a/UnitsNet/InternalHelpers/Guard.cs b/UnitsNet/InternalHelpers/Guard.cs deleted file mode 100644 index 37ee49b96a..0000000000 --- a/UnitsNet/InternalHelpers/Guard.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; - -namespace UnitsNet.InternalHelpers -{ - /// - /// Guard methods to ensure parameter values satisfy pre-conditions and use a consistent exception message. - /// - internal static class Guard - { - internal static double EnsureNotNaN(double value, [InvokerParameterName] string paramName) - { - if (double.IsNaN(value)) throw new ArgumentException("'NaN' is not a valid number.", paramName); - return value; - } - } -} diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index 793f5ad653..d05598705c 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -21,8 +21,6 @@ // Operator overloads not supported in Windows Runtime Components, we use 'double' type instead -using UnitsNet.InternalHelpers; - #if !WINDOWS_UWP namespace UnitsNet { @@ -57,7 +55,7 @@ public struct QuantityValue private QuantityValue(double val) { - _value = Guard.EnsureNotNaN(val, nameof(val)); + _value = val; _valueDecimal = null; } From 5d24432ac8fa43b77372cd93acaa75c09723c791 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 1 Oct 2018 21:40:10 +0200 Subject: [PATCH 039/131] Remove all TODOs in code Replace with github issues and update comments to point there. --- .../UnitsNetJsonConverter.cs | 15 +++++++------- UnitsNet.Tests/CustomCode/EnergyTests.cs | 7 +++---- .../RotationalStiffnessPerLengthTests.cs | 12 +++++------ ...-GenerateUnitTestPlaceholderSourceCode.ps1 | 12 +++++------ UnitsNet/UnitConverter.cs | 20 ++++++++++++------- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs b/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs index e8c4300da3..b69e723c09 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs +++ b/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs @@ -130,9 +130,7 @@ private static object CreateQuantity(Type quantityType, double value, object uni object quantityValue = GetFromMethodValueArgument(notNullableFromMethod, value); // Ex: Mass.From(55, MassUnit.Gram) - // TODO: there is a possible loss of precision if base value requires higher precision than double can represent. - // Example: Serializing Information.FromExabytes(100) then deserializing to Information - // will likely return a very different result. Not sure how we can handle this? + // See ValueUnit about precision loss for quantities using decimal type. return notNullableFromMethod.Invoke(null, new[] {quantityValue, unitValue}); } @@ -207,7 +205,7 @@ public override void WriteJson(JsonWriter writer, object obj, JsonSerializer ser serializer.Serialize(writer, new ValueUnit { - // TODO Should we serialize long, decimal and long differently? + // See ValueUnit about precision loss for quantities using decimal type. Value = Convert.ToDouble(quantityValue), Unit = quantityUnitName }); @@ -233,9 +231,7 @@ private static object GetValueOfQuantity(object value, Type quantityType) { FieldInfo valueField = GetPrivateInstanceField(quantityType, ValueFieldName); - // Unit base type can be double, long or decimal, - // so make sure we serialize the real type to avoid - // loss of precision + // See ValueUnit about precision loss for quantities using decimal type. object quantityValue = valueField.GetValue(value); return quantityValue; } @@ -278,10 +274,13 @@ private static FieldInfo GetPrivateInstanceField(Type quantityType, string field /// A structure used to serialize/deserialize Units.NET unit instances. /// /// - /// TODO Units may use decimal, long or double as base value type and might result + /// Quantities may use decimal, long or double as base value type and this might result /// in a loss of precision when serializing/deserializing to decimal. /// Decimal is the highest precision type available in .NET, but has a smaller /// range than double. + /// + /// Json: Support decimal precision #503 + /// https://github.com/angularsen/UnitsNet/issues/503 /// private class ValueUnit { diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index c13006e2f1..3febc639e3 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -23,7 +23,6 @@ namespace UnitsNet.Tests.CustomCode { public class EnergyTests : EnergyTestsBase { - // TODO Override properties in base class here protected override double ThermsImperialInOneJoule => 9.478171203551087813109937767482e-9; protected override double JoulesInOneJoule => 1; diff --git a/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs b/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs index ec848ea3dd..4816c62ae4 100644 --- a/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs +++ b/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs @@ -1,9 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated (once) by \generate-code.bat, but will not be -// regenerated when it already exists. The purpose of creating this file is to make +// regenerated when it already exists. The purpose of creating this file is to make // it easier to remember to implement all the unit conversion test cases. -// +// // Whenever a new unit is added to this quantity and \generate-code.bat is run, // the base test class will get a new abstract property and cause a compile error // in this derived class, reminding the developer to implement the test case @@ -20,17 +20,17 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -46,8 +46,6 @@ namespace UnitsNet.Tests.CustomCode { public class RotationalStiffnessPerLengthTests : RotationalStiffnessPerLengthTestsBase { - // TODO Override properties in base class here - protected override double KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter => 1E-3; protected override double MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter => 1E-6; protected override double NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter => 1; diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 index a2fe7a0239..855d5973a5 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 @@ -5,9 +5,9 @@ function GenerateUnitTestPlaceholderSourceCode($quantity) //------------------------------------------------------------------------------ // // This code was generated (once) by \generate-code.bat, but will not be -// regenerated when it already exists. The purpose of creating this file is to make +// regenerated when it already exists. The purpose of creating this file is to make // it easier to remember to implement all the unit conversion test cases. -// +// // Whenever a new unit is added to this quantity and \generate-code.bat is run, // the base test class will get a new abstract property and cause a compile error // in this derived class, reminding the developer to implement the test case @@ -24,17 +24,17 @@ function GenerateUnitTestPlaceholderSourceCode($quantity) // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -50,7 +50,7 @@ namespace UnitsNet.Tests.CustomCode { public class $($quantityName)Tests : $($quantityName)TestsBase { - // TODO Override properties in base class here + // Override properties in base class here } } "@; diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index 632e8c6374..654f44f37a 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -119,8 +119,11 @@ public static bool TryConvertByName(FromValue inputValue, string quantityName, s { try { - // TODO Reimplement to avoid exceptions where possible, as Try methods are generally recommended for performance and this is cheating + // Re-implement this to avoid exceptions where possible, as Try methods are generally recommended for performance and this is cheating. // https://msdn.microsoft.com/en-us/library/ms229009(v=vs.100).aspx + // + // Implement Try-methods without try-catch #504 + // https://github.com/angularsen/UnitsNet/issues/504 result = ConvertByName(inputValue, quantityName, fromUnit, toUnit); return true; } @@ -201,7 +204,7 @@ public static double ConvertByAbbreviation(FromValue fromValue, string quantityN UnitSystem unitSystem = UnitSystem.GetCached(culture); object fromUnitValue = unitSystem.Parse(fromUnitAbbrev, unitType); // ex: ("m", LengthUnit) => LengthUnit.Meter - object toUnitValue = unitSystem.Parse(toUnitAbbrev, unitType); // ex:("cm", LengthUnit) => LengthUnit.Centimeter + object toUnitValue = unitSystem.Parse(toUnitAbbrev, unitType); // ex:("cm", LengthUnit) => LengthUnit.Centimeter MethodInfo fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) object fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) @@ -277,8 +280,11 @@ public static bool TryConvertByAbbreviation(FromValue fromValue, string quantity { try { - // TODO Reimplement to avoid exceptions where possible, as Try methods are generally recommended for performance and this is cheating + // Re-implement this to avoid exceptions where possible, as Try methods are generally recommended for performance and this is cheating. // https://msdn.microsoft.com/en-us/library/ms229009(v=vs.100).aspx + // + // Implement Try-methods without try-catch #504 + // https://github.com/angularsen/UnitsNet/issues/504 result = ConvertByAbbreviation(fromValue, quantityName, fromUnitAbbrev, toUnitAbbrev, culture); return true; } @@ -373,4 +379,4 @@ private static Type GetQuantityType(string quantityName) return quantityType; } } -} \ No newline at end of file +} From f677ec1475f6af9f9399e3c6f44ea7adc59b1043 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 1 Oct 2018 21:41:29 +0200 Subject: [PATCH 040/131] Remove Length2d (#501) No reason why only Length should have this special type for 2 dimensions. We have later added Area and Volume to cover dimensions. Also removed some overloads taking `double` param for `Acceleration`. --- UnitsNet.Tests/CustomCode/ForceTests.cs | 23 +- UnitsNet.Tests/CustomCode/Length2dTests.cs | 146 ---------- UnitsNet/CustomCode/Quantities/Force.extra.cs | 21 +- UnitsNet/Length2d.cs | 261 ------------------ 4 files changed, 8 insertions(+), 443 deletions(-) delete mode 100644 UnitsNet.Tests/CustomCode/Length2dTests.cs delete mode 100644 UnitsNet/Length2d.cs diff --git a/UnitsNet.Tests/CustomCode/ForceTests.cs b/UnitsNet.Tests/CustomCode/ForceTests.cs index fb348634a8..bbed182da0 100644 --- a/UnitsNet.Tests/CustomCode/ForceTests.cs +++ b/UnitsNet.Tests/CustomCode/ForceTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -51,26 +51,19 @@ public void ForceDividedByAreaEqualsPressure() } [Fact] - public void PressureByAreaEqualsForceUsingArea() + public void PressureByAreaEqualsForce() { Force force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(5), Area.FromSquareMeters(7)); Assert.Equal(force, Force.FromNewtons(35)); } - [Fact] - public void PressureByAreaEqualsForceUsingLength2D() - { - var force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(6), Length2d.FromMeters(5, 2)); - Assert.Equal(force, Force.FromNewtons(60)); - } - [Fact] public void ForceDividedByMassEqualsAcceleration() { Acceleration acceleration = Force.FromNewtons(27)/Mass.FromKilograms(9); Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(3)); } - + [Fact] public void ForceDividedByAccelerationEqualsMass() { @@ -85,12 +78,6 @@ public void ForceDividedByLengthEqualsForcePerLength() Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(4)); } - [Fact] - public void MassByAccelerationEqualsForceUsingDouble() - { - var force = Force.FromMassByAcceleration(Mass.FromKilograms(9), 3); - Assert.Equal(force, Force.FromNewtons(27)); - } [Fact] public void MassByAccelerationEqualsForce() { diff --git a/UnitsNet.Tests/CustomCode/Length2dTests.cs b/UnitsNet.Tests/CustomCode/Length2dTests.cs deleted file mode 100644 index 39cda56ef1..0000000000 --- a/UnitsNet.Tests/CustomCode/Length2dTests.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using Xunit; - -namespace UnitsNet.Tests.CustomCode -{ -// ReSharper disable once InconsistentNaming - public class Length2dTests - { - private const double Delta = 1E-5; - - private static void AssertAreEqual(Vector2 expected, Vector2 actual, double delta) - { - AssertEx.EqualTolerance(expected.X, actual.X, delta); - AssertEx.EqualTolerance(expected.Y, actual.Y, delta); - } - - [Fact] - public void ArithmeticOperators() - { - Length2d v = Length2d.FromMeters(1, 2); - AssertEx.EqualTolerance(-1, -v.Meters.X, Delta); - AssertEx.EqualTolerance(-2, -v.Meters.Y, Delta); - AssertEx.EqualTolerance(2, (Length2d.FromMeters(3, 3) - v).Meters.X, Delta); - AssertEx.EqualTolerance(1, (Length2d.FromMeters(3, 3) - v).Meters.Y, Delta); - AssertEx.EqualTolerance(2, (v + v).Meters.X, Delta); - AssertEx.EqualTolerance(4, (v + v).Meters.Y, Delta); - AssertEx.EqualTolerance(10, (v*10).Meters.X, Delta); - AssertEx.EqualTolerance(20, (v*10).Meters.Y, Delta); - AssertEx.EqualTolerance(10, (10*v).Meters.X, Delta); - AssertEx.EqualTolerance(20, (10*v).Meters.Y, Delta); - AssertEx.EqualTolerance(2, (Length2d.FromMeters(2, 2)*v).Meters.X, Delta); - AssertEx.EqualTolerance(4, (Length2d.FromMeters(2, 2)*v).Meters.Y, Delta); - AssertEx.EqualTolerance(2, (Length2d.FromMeters(10, 20)/5).Meters.X, Delta); - AssertEx.EqualTolerance(4, (Length2d.FromMeters(10, 20)/5).Meters.Y, Delta); - AssertEx.EqualTolerance(2, (Length2d.FromMeters(10, 20)/Length2d.FromMeters(5, 5)).X, Delta); - AssertEx.EqualTolerance(4, (Length2d.FromMeters(10, 20)/Length2d.FromMeters(5, 5)).Y, Delta); - } - - [Fact] - public void DistanceUnitsRoundTrip() - { - Length meter = Length.FromMeters(1); - - AssertEx.EqualTolerance(1, Length.FromKilometers(meter.Kilometers).Meters, Delta); - AssertEx.EqualTolerance(1, Length.FromMeters(meter.Meters).Meters, Delta); - AssertEx.EqualTolerance(1, Length.FromDecimeters(meter.Decimeters).Meters, Delta); - AssertEx.EqualTolerance(1, Length.FromCentimeters(meter.Centimeters).Meters, Delta); - AssertEx.EqualTolerance(1, Length.FromMillimeters(meter.Millimeters).Meters, Delta); - AssertEx.EqualTolerance(1, Length.FromMicrometers(meter.Micrometers).Meters, Delta); - AssertEx.EqualTolerance(1, Length.FromNanometers(meter.Nanometers).Meters, Delta); - } - - [Fact] - public void EqualityOperators() - { - Length2d a = Length2d.FromMeters(1, 2); - Length2d b = Length2d.FromMeters(2, 1); - - // ReSharper disable EqualExpressionComparison - // Disable build warning: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - Assert.True(a == a); - Assert.True(a != b); - - Assert.False(a == b); - Assert.False(a != a); -#pragma warning restore 1718 - // ReSharper restore EqualExpressionComparison - } - - [Fact] - public void EqualsIsImplemented() - { - Length2d v = Length2d.FromMeters(1, 2); - Assert.True(v.Equals(Length2d.FromMeters(1, 2))); - Assert.False(v.Equals(Length2d.Zero)); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Length2d newton = Length2d.FromMeters(1, 2); - Assert.False(newton.Equals(null)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Length2d newton = Length2d.FromMeters(1, 2); - Assert.False(newton.Equals(new object())); - } - - [Fact] - public void MetersToDistanceUnits() - { - Length2d meter = Length2d.FromMeters(1, 1); - - AssertAreEqual(new Vector2(1), meter.Meters, Delta); - AssertAreEqual(new Vector2(1E2), meter.Centimeters, Delta); - AssertAreEqual(new Vector2(1E3), meter.Millimeters, Delta); - AssertAreEqual(new Vector2(1E-3), meter.Kilometers, Delta); - AssertAreEqual(new Vector2(1), meter.Meters, Delta); - AssertAreEqual(new Vector2(1E1), meter.Decimeters, Delta); - AssertAreEqual(new Vector2(1E2), meter.Centimeters, Delta); - AssertAreEqual(new Vector2(1E3), meter.Millimeters, Delta); - AssertAreEqual(new Vector2(1E6), meter.Micrometers, Delta); - AssertAreEqual(new Vector2(1E9), meter.Nanometers, Delta); - - AssertEx.EqualTolerance(0.000621371, meter.Miles.X, Delta); - AssertEx.EqualTolerance(0.000621371, meter.Miles.Y, Delta); - AssertEx.EqualTolerance(1.09361, meter.Yards.X, Delta); - AssertEx.EqualTolerance(1.09361, meter.Yards.Y, Delta); - AssertEx.EqualTolerance(3.28084, meter.Feet.X, Delta); - AssertEx.EqualTolerance(3.28084, meter.Feet.Y, Delta); - AssertEx.EqualTolerance(39.37007874, meter.Inches.X, Delta); - AssertEx.EqualTolerance(39.37007874, meter.Inches.Y, Delta); - } - - [Fact] - public void VectorLength() - { - var v = new Length2d(3, 4); - Assert.Equal(5, v.Length.Meters); - } - } -} diff --git a/UnitsNet/CustomCode/Quantities/Force.extra.cs b/UnitsNet/CustomCode/Quantities/Force.extra.cs index 925f36002d..f88a21dfec 100644 --- a/UnitsNet/CustomCode/Quantities/Force.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Force.extra.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -66,21 +66,6 @@ public partial struct Force } #endif - // Method overloads with same number of argumnets not supported in Universal Windows Platform (WinRT Components) -#if !WINDOWS_UWP - public static Force FromPressureByArea(Pressure p, Length2d area) - { - double metersSquared = area.Meters.X * area.Meters.Y; - double newtons = p.Pascals * metersSquared; - return new Force(newtons, ForceUnit.Newton); - } - - public static Force FromMassByAcceleration(Mass mass, double metersPerSecondSquared) - { - return new Force(mass.Kilograms * metersPerSecondSquared, ForceUnit.Newton); - } -#endif - public static Force FromPressureByArea(Pressure p, Area area) { double newtons = p.Pascals * area.SquareMeters; diff --git a/UnitsNet/Length2d.cs b/UnitsNet/Length2d.cs deleted file mode 100644 index dd43225dca..0000000000 --- a/UnitsNet/Length2d.cs +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#if !WINDOWS_UWP -using System; -using System.Collections.Generic; -using UnitsNet.Units; - -#endif - -namespace UnitsNet -{ - /// - /// A class for representing position in two dimensions. - /// -#if WINDOWS_UWP - public struct Length2d - { - /// - /// Returns a point represented in meters. - /// - public Vector2 Meters; - } -#else - // ReSharper disable once InconsistentNaming - public struct Length2d : IEquatable - { - /// - /// Returns a point represented in meters. - /// - public readonly Vector2 Meters; - - /// - /// Creates an instance based on X and Y in implicitly defined SI units. - /// - public Length2d(double xMeters, double yMeters) - { - Meters = new Vector2(xMeters, yMeters); - } - - public Length2d(Length x, Length y) : this(x.Meters, y.Meters) - { - } - - #region Static - - public static Length GetDistance(Length2d a, Length2d b) - { - Vector2 d = (a - b).Meters; - return Length.FromMeters(Math.Sqrt(d.X*d.X + d.Y*d.Y)); - } - - #endregion - - #region Public properties - - public Length Length - { - get - { - double x = Meters.X; - double y = Meters.Y; - return Length.FromMeters(Math.Sqrt(x*x + y*y)); - } - } - - public Length X => Length.FromMeters(Meters.X); - - public Length Y => Length.FromMeters(Meters.Y); - - public Vector2 Miles => new Vector2(X.Miles, Y.Miles); - - public Vector2 Yards => new Vector2(X.Yards, Y.Yards); - - public Vector2 Feet => new Vector2(X.Feet, Y.Feet); - - public Vector2 Inches => new Vector2(X.Inches, Y.Inches); - - public Vector2 Kilometers => new Vector2(X.Kilometers, Y.Kilometers); - - public Vector2 Decimeters => new Vector2(X.Decimeters, Y.Decimeters); - - /// - /// Returns a point represented in centimeters. - /// - public Vector2 Centimeters => new Vector2(Meters.X*1E2, Meters.Y*1E2); - - /// - /// Returns a point represented in millimeters. - /// - public Vector2 Millimeters => new Vector2(Meters.X*1E3, Meters.Y*1E3); - - public Vector2 Micrometers => new Vector2(X.Micrometers, Y.Micrometers); - - public Vector2 Nanometers => new Vector2(X.Nanometers, Y.Nanometers); - - #endregion - - #region Static methods - - public static Length2d Zero => new Length2d(); - - public static Length2d FromMeters(double xMeters, double yMeters) - { - return new Length2d(xMeters, yMeters); - } - - public static Length2d FromCentimeters(double xCentimeters, double yCentimeters) - { - return new Length2d(xCentimeters*1E-2, yCentimeters*1E-2); - } - - public static Length2d FromMillimeters(double xMillimeters, double yMillimeters) - { - return new Length2d(xMillimeters*1E-3, yMillimeters*1E-3); - } - - #endregion - - #region Arithmetic operators - - public static Length2d operator -(Length2d right) - { - return FromMeters(-right.X.Meters, -right.Y.Meters); - } - - public static Length2d operator +(Length2d left, Length2d right) - { - double x = left.X.Meters + right.X.Meters; - double y = left.Y.Meters + right.Y.Meters; - return FromMeters(x, y); - } - - public static Length2d operator -(Length2d left, Length2d right) - { - double x = left.X.Meters - right.X.Meters; - double y = left.Y.Meters - right.Y.Meters; - return FromMeters(x, y); - } - - public static Length2d operator *(double left, Length2d right) - { - double x = left*right.X.Meters; - double y = left*right.Y.Meters; - return FromMeters(x, y); - } - - public static Length2d operator *(Length2d left, double right) - { - double x = left.X.Meters*right; - double y = left.Y.Meters*right; - return FromMeters(x, y); - } - - public static Length2d operator *(Length2d left, Length2d right) - { - double x = left.X.Meters*right.X.Meters; - double y = left.Y.Meters*right.Y.Meters; - return FromMeters(x, y); - } - - public static Length2d operator /(Length2d left, double right) - { - double x = left.X.Meters/right; - double y = left.Y.Meters/right; - return FromMeters(x, y); - } - - public static Vector2 operator /(Length2d left, Length2d right) - { - double x = left.X.Meters/right.X.Meters; - double y = left.Y.Meters/right.Y.Meters; - return new Vector2(x, y); - } - - #endregion - - #region Public methods - - public override string ToString() - { - return - $"({X.Meters:0.##}, {Y.Meters:0.##}) {UnitSystem.Default.GetDefaultAbbreviation(LengthUnit.Meter)}"; - } - - public Length DistanceTo(Length2d other) - { - double dx = X.Meters - other.X.Meters; - double dy = Y.Meters - other.Y.Meters; - double distance = Math.Sqrt(dx*dx + dy*dy); - - return Length.FromMeters(distance); - } - - #endregion - - #region Equality - - private static IEqualityComparer MetersComparer { get; } = new MetersEqualityComparer(); - - public bool Equals(Length2d other) - { - return MetersComparer.Equals(this, other); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - return obj is Length2d && Equals((Length2d) obj); - } - - public override int GetHashCode() - { - return Meters.GetHashCode(); - } - - public static bool operator !=(Length2d left, Length2d right) - { - return left.Meters != right.Meters; - } - - public static bool operator ==(Length2d left, Length2d right) - { - return left.Meters == right.Meters; - } - - private sealed class MetersEqualityComparer : IEqualityComparer - { - public bool Equals(Length2d x, Length2d y) - { - return x.Meters.Equals(y.Meters); - } - - public int GetHashCode(Length2d obj) - { - return obj.Meters.GetHashCode(); - } - } - - #endregion - } -#endif -} From 4d17f15c9c32947beeb549da5f1aafbfc5bda3d1 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 1 Oct 2018 21:01:29 +0200 Subject: [PATCH 041/131] QuantityValue: Do not allow NaN value This prevents constructing any quantity with a NaN floating point value. Decimal and integer types does not the concept of NaN (nor Infinity), so I'm tempted to argue we should not allow those values either to be consistent with quantities backed by decimal type. --- UnitsNet/InternalHelpers/Guard.cs | 38 +++++++++++++++++++++++++++++++ UnitsNet/QuantityValue.cs | 4 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 UnitsNet/InternalHelpers/Guard.cs diff --git a/UnitsNet/InternalHelpers/Guard.cs b/UnitsNet/InternalHelpers/Guard.cs new file mode 100644 index 0000000000..37ee49b96a --- /dev/null +++ b/UnitsNet/InternalHelpers/Guard.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using JetBrains.Annotations; + +namespace UnitsNet.InternalHelpers +{ + /// + /// Guard methods to ensure parameter values satisfy pre-conditions and use a consistent exception message. + /// + internal static class Guard + { + internal static double EnsureNotNaN(double value, [InvokerParameterName] string paramName) + { + if (double.IsNaN(value)) throw new ArgumentException("'NaN' is not a valid number.", paramName); + return value; + } + } +} diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index d05598705c..793f5ad653 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -21,6 +21,8 @@ // Operator overloads not supported in Windows Runtime Components, we use 'double' type instead +using UnitsNet.InternalHelpers; + #if !WINDOWS_UWP namespace UnitsNet { @@ -55,7 +57,7 @@ public struct QuantityValue private QuantityValue(double val) { - _value = val; + _value = Guard.EnsureNotNaN(val, nameof(val)); _valueDecimal = null; } From f23d389f824156f224bb04e36c062fb8d955ca2c Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 1 Oct 2018 21:55:13 +0200 Subject: [PATCH 042/131] Also throw on infinity values and add tests Add check to quantity ctors of quantities using double type. Add tests. --- .../Quantities/Acceleration.Common.g.cs | 17 ++++++- .../Quantities/AmountOfSubstance.Common.g.cs | 18 ++++++- .../Quantities/AmplitudeRatio.Common.g.cs | 8 +++- .../Quantities/Angle.Common.g.cs | 18 ++++++- .../Quantities/ApparentEnergy.Common.g.cs | 7 ++- .../Quantities/ApparentPower.Common.g.cs | 8 +++- .../GeneratedCode/Quantities/Area.Common.g.cs | 17 ++++++- .../Quantities/AreaDensity.Common.g.cs | 5 +- .../AreaMomentOfInertia.Common.g.cs | 10 +++- .../Quantities/BitRate.Common.g.cs | 28 +++++++++++ .../BrakeSpecificFuelConsumption.Common.g.cs | 7 ++- .../Quantities/Capacitance.Common.g.cs | 5 +- .../Quantities/Density.Common.g.cs | 42 +++++++++++++++- .../Quantities/Duration.Common.g.cs | 14 +++++- .../Quantities/DynamicViscosity.Common.g.cs | 10 +++- .../Quantities/ElectricAdmittance.Common.g.cs | 8 +++- .../Quantities/ElectricCharge.Common.g.cs | 5 +- .../ElectricChargeDensity.Common.g.cs | 5 +- .../ElectricConductance.Common.g.cs | 7 ++- .../ElectricConductivity.Common.g.cs | 5 +- .../Quantities/ElectricCurrent.Common.g.cs | 12 ++++- .../ElectricCurrentDensity.Common.g.cs | 5 +- .../ElectricCurrentGradient.Common.g.cs | 5 +- .../Quantities/ElectricField.Common.g.cs | 5 +- .../Quantities/ElectricInductance.Common.g.cs | 5 +- .../Quantities/ElectricPotential.Common.g.cs | 9 +++- .../ElectricPotentialAc.Common.g.cs | 9 +++- .../ElectricPotentialDc.Common.g.cs | 9 +++- .../Quantities/ElectricResistance.Common.g.cs | 8 +++- .../ElectricResistivity.Common.g.cs | 8 +++- .../Quantities/Energy.Common.g.cs | 26 +++++++++- .../Quantities/Entropy.Common.g.cs | 11 ++++- .../Quantities/Force.Common.g.cs | 14 +++++- .../Quantities/ForceChangeRate.Common.g.cs | 15 +++++- .../Quantities/ForcePerLength.Common.g.cs | 13 ++++- .../Quantities/Frequency.Common.g.cs | 12 ++++- .../Quantities/HeatFlux.Common.g.cs | 20 +++++++- .../HeatTransferCoefficient.Common.g.cs | 6 ++- .../Quantities/Illuminance.Common.g.cs | 8 +++- .../Quantities/Information.Common.g.cs | 28 +++++++++++ .../Quantities/Irradiance.Common.g.cs | 6 ++- .../Quantities/Irradiation.Common.g.cs | 7 ++- .../Quantities/KinematicViscosity.Common.g.cs | 12 ++++- .../Quantities/LapseRate.Common.g.cs | 5 +- .../Quantities/Length.Common.g.cs | 26 +++++++++- .../Quantities/Level.Common.g.cs | 6 ++- .../Quantities/LinearDensity.Common.g.cs | 7 ++- .../Quantities/LuminousFlux.Common.g.cs | 5 +- .../Quantities/LuminousIntensity.Common.g.cs | 5 +- .../Quantities/MagneticField.Common.g.cs | 5 +- .../Quantities/MagneticFlux.Common.g.cs | 5 +- .../Quantities/Magnetization.Common.g.cs | 5 +- .../GeneratedCode/Quantities/Mass.Common.g.cs | 25 +++++++++- .../Quantities/MassFlow.Common.g.cs | 19 +++++++- .../Quantities/MassFlux.Common.g.cs | 6 ++- .../MassMomentOfInertia.Common.g.cs | 30 +++++++++++- .../Quantities/MolarEnergy.Common.g.cs | 7 ++- .../Quantities/MolarEntropy.Common.g.cs | 7 ++- .../Quantities/MolarMass.Common.g.cs | 16 ++++++- .../Quantities/Molarity.Common.g.cs | 12 ++++- .../Quantities/Permeability.Common.g.cs | 5 +- .../Quantities/Permittivity.Common.g.cs | 5 +- .../Quantities/Power.Common.g.cs | 22 +++++++++ .../Quantities/PowerDensity.Common.g.cs | 48 ++++++++++++++++++- .../Quantities/PowerRatio.Common.g.cs | 6 ++- .../Quantities/Pressure.Common.g.cs | 41 +++++++++++++++- .../Quantities/PressureChangeRate.Common.g.cs | 8 +++- .../Quantities/Ratio.Common.g.cs | 10 +++- .../Quantities/ReactiveEnergy.Common.g.cs | 7 ++- .../Quantities/ReactivePower.Common.g.cs | 8 +++- .../RotationalAcceleration.Common.g.cs | 7 ++- .../Quantities/RotationalSpeed.Common.g.cs | 17 ++++++- .../RotationalStiffness.Common.g.cs | 7 ++- .../RotationalStiffnessPerLength.Common.g.cs | 7 ++- .../Quantities/SolidAngle.Common.g.cs | 5 +- .../Quantities/SpecificEnergy.Common.g.cs | 12 ++++- .../Quantities/SpecificEntropy.Common.g.cs | 12 ++++- .../Quantities/SpecificVolume.Common.g.cs | 6 ++- .../Quantities/SpecificWeight.Common.g.cs | 21 +++++++- .../Quantities/Speed.Common.g.cs | 36 +++++++++++++- .../Quantities/Temperature.Common.g.cs | 12 ++++- .../TemperatureChangeRate.Common.g.cs | 14 +++++- .../Quantities/TemperatureDelta.Common.g.cs | 12 ++++- .../ThermalConductivity.Common.g.cs | 6 ++- .../Quantities/ThermalResistance.Common.g.cs | 9 +++- .../Quantities/Torque.Common.g.cs | 25 +++++++++- .../Quantities/VitaminA.Common.g.cs | 5 +- .../Quantities/Volume.Common.g.cs | 46 +++++++++++++++++- .../Quantities/VolumeFlow.Common.g.cs | 30 +++++++++++- .../GeneratedCode/AccelerationTestsBase.g.cs | 28 ++++++++++- .../AmountOfSubstanceTestsBase.g.cs | 28 ++++++++++- .../AmplitudeRatioTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/AngleTestsBase.g.cs | 28 ++++++++++- .../ApparentEnergyTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/ApparentPowerTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/AreaDensityTestsBase.g.cs | 28 ++++++++++- .../AreaMomentOfInertiaTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/AreaTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/BitRateTestsBase.g.cs | 4 +- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/CapacitanceTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/DensityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/DurationTestsBase.g.cs | 28 ++++++++++- .../DynamicViscosityTestsBase.g.cs | 28 ++++++++++- .../ElectricAdmittanceTestsBase.g.cs | 28 ++++++++++- .../ElectricChargeDensityTestsBase.g.cs | 28 ++++++++++- .../ElectricChargeTestsBase.g.cs | 28 ++++++++++- .../ElectricConductanceTestsBase.g.cs | 28 ++++++++++- .../ElectricConductivityTestsBase.g.cs | 28 ++++++++++- .../ElectricCurrentDensityTestsBase.g.cs | 28 ++++++++++- .../ElectricCurrentGradientTestsBase.g.cs | 28 ++++++++++- .../ElectricCurrentTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/ElectricFieldTestsBase.g.cs | 28 ++++++++++- .../ElectricInductanceTestsBase.g.cs | 28 ++++++++++- .../ElectricPotentialAcTestsBase.g.cs | 28 ++++++++++- .../ElectricPotentialDcTestsBase.g.cs | 28 ++++++++++- .../ElectricPotentialTestsBase.g.cs | 28 ++++++++++- .../ElectricResistanceTestsBase.g.cs | 28 ++++++++++- .../ElectricResistivityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/EnergyTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/EntropyTestsBase.g.cs | 28 ++++++++++- .../ForceChangeRateTestsBase.g.cs | 28 ++++++++++- .../ForcePerLengthTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/ForceTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/FrequencyTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/HeatFluxTestsBase.g.cs | 28 ++++++++++- .../HeatTransferCoefficientTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/IlluminanceTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/InformationTestsBase.g.cs | 4 +- .../GeneratedCode/IrradianceTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/IrradiationTestsBase.g.cs | 28 ++++++++++- .../KinematicViscosityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/LapseRateTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/LengthTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/LevelTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/LinearDensityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/LuminousFluxTestsBase.g.cs | 28 ++++++++++- .../LuminousIntensityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MagneticFieldTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MagneticFluxTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MagnetizationTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MassFlowTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MassFluxTestsBase.g.cs | 28 ++++++++++- .../MassMomentOfInertiaTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MassTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MolarEnergyTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MolarEntropyTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MolarMassTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/MolarityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/PermeabilityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/PermittivityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/PowerDensityTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/PowerRatioTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/PowerTestsBase.g.cs | 4 +- .../PressureChangeRateTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/PressureTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/RatioTestsBase.g.cs | 28 ++++++++++- .../ReactiveEnergyTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/ReactivePowerTestsBase.g.cs | 28 ++++++++++- .../RotationalAccelerationTestsBase.g.cs | 28 ++++++++++- .../RotationalSpeedTestsBase.g.cs | 28 ++++++++++- ...RotationalStiffnessPerLengthTestsBase.g.cs | 28 ++++++++++- .../RotationalStiffnessTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/SolidAngleTestsBase.g.cs | 28 ++++++++++- .../SpecificEnergyTestsBase.g.cs | 28 ++++++++++- .../SpecificEntropyTestsBase.g.cs | 28 ++++++++++- .../SpecificVolumeTestsBase.g.cs | 28 ++++++++++- .../SpecificWeightTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/SpeedTestsBase.g.cs | 28 ++++++++++- .../TemperatureChangeRateTestsBase.g.cs | 28 ++++++++++- .../TemperatureDeltaTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/TemperatureTestsBase.g.cs | 28 ++++++++++- .../ThermalConductivityTestsBase.g.cs | 28 ++++++++++- .../ThermalResistanceTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/TorqueTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/VitaminATestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/VolumeFlowTestsBase.g.cs | 28 ++++++++++- .../GeneratedCode/VolumeTestsBase.g.cs | 28 ++++++++++- UnitsNet.Tests/UnitSystemTests.cs | 32 +++---------- UnitsNet/InternalHelpers/Guard.cs | 13 ++++- UnitsNet/QuantityValue.cs | 2 +- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 7 +++ ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 32 ++++++++++++- 183 files changed, 3439 insertions(+), 204 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 93d9ed5461..726ad37b45 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Acceleration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Acceleration from CentimetersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromDecimetersPerSecondSquared(double decimeterspersecondsquared) @@ -232,6 +236,7 @@ public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimete /// /// Get Acceleration from FeetPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromInchesPerSecondSquared(double inchespersecondsquared) @@ -260,6 +266,7 @@ public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersec /// /// Get Acceleration from KilometersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerHour(double knotsperhour) @@ -288,6 +296,7 @@ public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) /// /// Get Acceleration from KnotsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerSecond(double knotspersecond) @@ -316,6 +326,7 @@ public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) /// /// Get Acceleration from MetersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromMicrometersPerSecondSquared(double micrometerspersecondsquared) @@ -344,6 +356,7 @@ public static Acceleration FromMicrometersPerSecondSquared(QuantityValue microme /// /// Get Acceleration from MillimetersPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromNanometersPerSecondSquared(double nanometerspersecondsquared) @@ -372,6 +386,7 @@ public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanomete /// /// Get Acceleration from StandardGravity. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get AmountOfSubstance from Centimoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromCentipoundMoles(double centipoundmoles) @@ -237,6 +241,7 @@ public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmole /// /// Get AmountOfSubstance from Decimoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromDecipoundMoles(double decipoundmoles) @@ -265,6 +271,7 @@ public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) /// /// Get AmountOfSubstance from Kilomoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromKilopoundMoles(double kilopoundmoles) @@ -293,6 +301,7 @@ public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) /// /// Get AmountOfSubstance from Micromoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMicropoundMoles(double micropoundmoles) @@ -321,6 +331,7 @@ public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmole /// /// Get AmountOfSubstance from Millimoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMillipoundMoles(double millipoundmoles) @@ -349,6 +361,7 @@ public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmole /// /// Get AmountOfSubstance from Moles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromNanomoles(double nanomoles) @@ -377,6 +391,7 @@ public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) /// /// Get AmountOfSubstance from NanopoundMoles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromPoundMoles(double poundmoles) diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 2a923e3bf9..e62ef4b362 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static AmplitudeRatio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get AmplitudeRatio from DecibelMicrovolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelMillivolts(double decibelmillivolts) @@ -186,6 +190,7 @@ public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivol /// /// Get AmplitudeRatio from DecibelsUnloaded. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelVolts(double decibelvolts) diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 5cf37f370d..f465134e29 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Angle() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Angle from Arcminutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromArcseconds(double arcseconds) @@ -236,6 +240,7 @@ public static Angle FromArcseconds(QuantityValue arcseconds) /// /// Get Angle from Centiradians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromDeciradians(double deciradians) @@ -264,6 +270,7 @@ public static Angle FromDeciradians(QuantityValue deciradians) /// /// Get Angle from Degrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromGradians(double gradians) @@ -292,6 +300,7 @@ public static Angle FromGradians(QuantityValue gradians) /// /// Get Angle from Microdegrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMicroradians(double microradians) @@ -320,6 +330,7 @@ public static Angle FromMicroradians(QuantityValue microradians) /// /// Get Angle from Millidegrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMilliradians(double milliradians) @@ -348,6 +360,7 @@ public static Angle FromMilliradians(QuantityValue milliradians) /// /// Get Angle from Nanodegrees. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromNanoradians(double nanoradians) @@ -376,6 +390,7 @@ public static Angle FromNanoradians(QuantityValue nanoradians) /// /// Get Angle from Radians. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromRevolutions(double revolutions) diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 57c4f21f3c..62b91718e3 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ApparentEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ApparentEnergy from KilovoltampereHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentEnergy FromMegavoltampereHours(double megavoltamperehours) @@ -182,6 +186,7 @@ public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamper /// /// Get ApparentEnergy from VoltampereHours. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ApparentPower from Gigavoltamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromKilovoltamperes(double kilovoltamperes) @@ -187,6 +191,7 @@ public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) /// /// Get ApparentPower from Megavoltamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromVoltamperes(double voltamperes) diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 4e8d498356..78764a0202 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Area() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Area from Acres. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromHectares(double hectares) @@ -232,6 +236,7 @@ public static Area FromHectares(QuantityValue hectares) /// /// Get Area from SquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareDecimeters(double squaredecimeters) @@ -260,6 +266,7 @@ public static Area FromSquareDecimeters(QuantityValue squaredecimeters) /// /// Get Area from SquareFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareInches(double squareinches) @@ -288,6 +296,7 @@ public static Area FromSquareInches(QuantityValue squareinches) /// /// Get Area from SquareKilometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMeters(double squaremeters) @@ -316,6 +326,7 @@ public static Area FromSquareMeters(QuantityValue squaremeters) /// /// Get Area from SquareMicrometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMiles(double squaremiles) @@ -344,6 +356,7 @@ public static Area FromSquareMiles(QuantityValue squaremiles) /// /// Get Area from SquareMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareYards(double squareyards) @@ -372,6 +386,7 @@ public static Area FromSquareYards(QuantityValue squareyards) /// /// Get Area from UsSurveySquareFeet. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get AreaDensity from KilogramsPerSquareMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get AreaMomentOfInertia from CentimetersToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromDecimetersToTheFourth(double decimeterstothefourth) @@ -197,6 +201,7 @@ public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decime /// /// Get AreaMomentOfInertia from FeetToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromInchesToTheFourth(double inchestothefourth) @@ -225,6 +231,7 @@ public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestoth /// /// Get AreaMomentOfInertia from MetersToTheFourth. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromMillimetersToTheFourth(double millimeterstothefourth) diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index bb1962d612..808d439e9c 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static BitRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromBitsPerSecond(double bitspersecond) @@ -282,6 +285,7 @@ public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) /// /// Get BitRate from BytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExabitsPerSecond(double exabitspersecond) @@ -310,6 +315,7 @@ public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) /// /// Get BitRate from ExabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExbibitsPerSecond(double exbibitspersecond) @@ -338,6 +345,7 @@ public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) /// /// Get BitRate from ExbibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGibibitsPerSecond(double gibibitspersecond) @@ -366,6 +375,7 @@ public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) /// /// Get BitRate from GibibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGigabitsPerSecond(double gigabitspersecond) @@ -394,6 +405,7 @@ public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) /// /// Get BitRate from GigabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKibibitsPerSecond(double kibibitspersecond) @@ -422,6 +435,7 @@ public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) /// /// Get BitRate from KibibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKilobitsPerSecond(double kilobitspersecond) @@ -450,6 +465,7 @@ public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) /// /// Get BitRate from KilobytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMebibitsPerSecond(double mebibitspersecond) @@ -478,6 +495,7 @@ public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) /// /// Get BitRate from MebibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMegabitsPerSecond(double megabitspersecond) @@ -506,6 +525,7 @@ public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) /// /// Get BitRate from MegabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPebibitsPerSecond(double pebibitspersecond) @@ -534,6 +555,7 @@ public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) /// /// Get BitRate from PebibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPetabitsPerSecond(double petabitspersecond) @@ -562,6 +585,7 @@ public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) /// /// Get BitRate from PetabytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTebibitsPerSecond(double tebibitspersecond) @@ -590,6 +615,7 @@ public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) /// /// Get BitRate from TebibytesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTerabitsPerSecond(double terabitspersecond) @@ -618,6 +645,7 @@ public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) /// /// Get BitRate from TerabytesPerSecond. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get BrakeSpecificFuelConsumption from GramsPerKiloWattHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(double kilogramsperjoule) @@ -182,6 +186,7 @@ public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue k /// /// Get BrakeSpecificFuelConsumption from PoundsPerMechanicalHorsepowerHour. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Capacitance from Farads. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Density from CentigramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromCentigramsPerLiter(double centigramsperliter) @@ -357,6 +361,7 @@ public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) /// /// Get Density from CentigramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerDeciLiter(double decigramsperdeciliter) @@ -385,6 +391,7 @@ public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdecili /// /// Get Density from DecigramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerMilliliter(double decigramspermilliliter) @@ -413,6 +421,7 @@ public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilli /// /// Get Density from GramsPerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerCubicMeter(double gramspercubicmeter) @@ -441,6 +451,7 @@ public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) /// /// Get Density from GramsPerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerDeciLiter(double gramsperdeciliter) @@ -469,6 +481,7 @@ public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) /// /// Get Density from GramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerMilliliter(double gramspermilliliter) @@ -497,6 +511,7 @@ public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) /// /// Get Density from KilogramsPerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilogramsPerCubicMeter(double kilogramspercubicmeter) @@ -525,6 +541,7 @@ public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubic /// /// Get Density from KilogramsPerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilopoundsPerCubicFoot(double kilopoundspercubicfoot) @@ -553,6 +571,7 @@ public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubi /// /// Get Density from KilopoundsPerCubicInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerDeciLiter(double microgramsperdeciliter) @@ -581,6 +601,7 @@ public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeci /// /// Get Density from MicrogramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerMilliliter(double microgramspermilliliter) @@ -609,6 +631,7 @@ public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermil /// /// Get Density from MilligramsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerDeciLiter(double milligramsperdeciliter) @@ -637,6 +661,7 @@ public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeci /// /// Get Density from MilligramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerMilliliter(double milligramspermilliliter) @@ -665,6 +691,7 @@ public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermil /// /// Get Density from NanogramsPerDeciLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromNanogramsPerLiter(double nanogramsperliter) @@ -693,6 +721,7 @@ public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) /// /// Get Density from NanogramsPerMilliliter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerDeciLiter(double picogramsperdeciliter) @@ -721,6 +751,7 @@ public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdecili /// /// Get Density from PicogramsPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerMilliliter(double picogramspermilliliter) @@ -749,6 +781,7 @@ public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilli /// /// Get Density from PoundsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerCubicInch(double poundspercubicinch) @@ -777,6 +811,7 @@ public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) /// /// Get Density from PoundsPerImperialGallon. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerUSGallon(double poundsperusgallon) @@ -805,6 +841,7 @@ public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) /// /// Get Density from SlugsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicCentimeter(double tonnespercubiccentimeter) @@ -833,6 +871,7 @@ public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubicc /// /// Get Density from TonnesPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimeter) diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 2dd85fa7a0..cc689dfea9 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Duration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Duration from Days. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromHours(double hours) @@ -217,6 +221,7 @@ public static Duration FromHours(QuantityValue hours) /// /// Get Duration from Microseconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMilliseconds(double milliseconds) @@ -245,6 +251,7 @@ public static Duration FromMilliseconds(QuantityValue milliseconds) /// /// Get Duration from Minutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMonths30(double months30) @@ -273,6 +281,7 @@ public static Duration FromMonths30(QuantityValue months30) /// /// Get Duration from Nanoseconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromSeconds(double seconds) @@ -301,6 +311,7 @@ public static Duration FromSeconds(QuantityValue seconds) /// /// Get Duration from Weeks. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromYears365(double years365) diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 0d68bf7301..9f1d897544 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static DynamicViscosity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get DynamicViscosity from Centipoise. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromMicropascalSeconds(double micropascalseconds) @@ -197,6 +201,7 @@ public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascals /// /// Get DynamicViscosity from MillipascalSeconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromNewtonSecondsPerMeterSquared(double newtonsecondspermetersquared) @@ -225,6 +231,7 @@ public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue ne /// /// Get DynamicViscosity from PascalSeconds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromPoise(double poise) diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index e9d80577b0..a208dfe399 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricAdmittance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricAdmittance from Microsiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromMillisiemens(double millisiemens) @@ -187,6 +191,7 @@ public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) /// /// Get ElectricAdmittance from Nanosiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromSiemens(double siemens) diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 803d924b53..1d101550b2 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricCharge() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricCharge from Coulombs. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricChargeDensity from CoulombsPerCubicMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricConductance from Microsiemens. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductance FromMillisiemens(double millisiemens) @@ -182,6 +186,7 @@ public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) /// /// Get ElectricConductance from Siemens. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricConductivity from SiemensPerMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricCurrent from Amperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromCentiamperes(double centiamperes) @@ -207,6 +211,7 @@ public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) /// /// Get ElectricCurrent from Kiloamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMegaamperes(double megaamperes) @@ -235,6 +241,7 @@ public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) /// /// Get ElectricCurrent from Microamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMilliamperes(double milliamperes) @@ -263,6 +271,7 @@ public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) /// /// Get ElectricCurrent from Nanoamperes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromPicoamperes(double picoamperes) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 80a5896afc..504dc9856a 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricCurrentDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricCurrentDensity from AmperesPerSquareMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricCurrentGradient from AmperesPerSecond. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricField from VoltsPerMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricInductance from Henries. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricPotential from Kilovolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMegavolts(double megavolts) @@ -192,6 +196,7 @@ public static ElectricPotential FromMegavolts(QuantityValue megavolts) /// /// Get ElectricPotential from Microvolts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMillivolts(double millivolts) @@ -220,6 +226,7 @@ public static ElectricPotential FromMillivolts(QuantityValue millivolts) /// /// Get ElectricPotential from Volts. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricPotentialAc from KilovoltsAc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMegavoltsAc(double megavoltsac) @@ -191,6 +195,7 @@ public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) /// /// Get ElectricPotentialAc from MicrovoltsAc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMillivoltsAc(double millivoltsac) @@ -219,6 +225,7 @@ public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) /// /// Get ElectricPotentialAc from VoltsAc. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricPotentialDc from KilovoltsDc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMegavoltsDc(double megavoltsdc) @@ -191,6 +195,7 @@ public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) /// /// Get ElectricPotentialDc from MicrovoltsDc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMillivoltsDc(double millivoltsdc) @@ -219,6 +225,7 @@ public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) /// /// Get ElectricPotentialDc from VoltsDc. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricResistance from Kiloohms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromMegaohms(double megaohms) @@ -187,6 +191,7 @@ public static ElectricResistance FromMegaohms(QuantityValue megaohms) /// /// Get ElectricResistance from Milliohms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromOhms(double ohms) diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index a1196038e5..12b59da5c3 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ElectricResistivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ElectricResistivity from MicroohmMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromMilliohmMeters(double milliohmmeters) @@ -187,6 +191,7 @@ public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeter /// /// Get ElectricResistivity from NanoohmMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromOhmMeters(double ohmmeters) diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 21a5e464e8..2e5226bc1d 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Energy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Energy from BritishThermalUnits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromCalories(double calories) @@ -277,6 +281,7 @@ public static Energy FromCalories(QuantityValue calories) /// /// Get Energy from DecathermsEc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromDecathermsImperial(double decathermsimperial) @@ -305,6 +311,7 @@ public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) /// /// Get Energy from DecathermsUs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromElectronVolts(double electronvolts) @@ -333,6 +341,7 @@ public static Energy FromElectronVolts(QuantityValue electronvolts) /// /// Get Energy from Ergs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromFootPounds(double footpounds) @@ -361,6 +371,7 @@ public static Energy FromFootPounds(QuantityValue footpounds) /// /// Get Energy from GigabritishThermalUnits. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromGigawattHours(double gigawatthours) @@ -389,6 +401,7 @@ public static Energy FromGigawattHours(QuantityValue gigawatthours) /// /// Get Energy from Joules. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilobritishThermalUnits(double kilobritishthermalunits) @@ -417,6 +431,7 @@ public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishtherma /// /// Get Energy from Kilocalories. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilojoules(double kilojoules) @@ -445,6 +461,7 @@ public static Energy FromKilojoules(QuantityValue kilojoules) /// /// Get Energy from KilowattHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegabritishThermalUnits(double megabritishthermalunits) @@ -473,6 +491,7 @@ public static Energy FromMegabritishThermalUnits(QuantityValue megabritishtherma /// /// Get Energy from Megajoules. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegawattHours(double megawatthours) @@ -501,6 +521,7 @@ public static Energy FromMegawattHours(QuantityValue megawatthours) /// /// Get Energy from ThermsEc. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromThermsImperial(double thermsimperial) @@ -529,6 +551,7 @@ public static Energy FromThermsImperial(QuantityValue thermsimperial) /// /// Get Energy from ThermsUs. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromWattHours(double watthours) diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index e695b349f6..fedd5450c3 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Entropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Entropy from CaloriesPerKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromJoulesPerDegreeCelsius(double joulesperdegreecelsius) @@ -202,6 +206,7 @@ public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreece /// /// Get Entropy from JoulesPerKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilocaloriesPerKelvin(double kilocaloriesperkelvin) @@ -230,6 +236,7 @@ public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkel /// /// Get Entropy from KilojoulesPerDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilojoulesPerKelvin(double kilojoulesperkelvin) @@ -258,6 +266,7 @@ public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) /// /// Get Entropy from MegajoulesPerKelvin. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Force from Decanewtons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromDyne(double dyne) @@ -217,6 +221,7 @@ public static Force FromDyne(QuantityValue dyne) /// /// Get Force from KilogramsForce. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromKilonewtons(double kilonewtons) @@ -245,6 +251,7 @@ public static Force FromKilonewtons(QuantityValue kilonewtons) /// /// Get Force from KiloPonds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromMeganewtons(double meganewtons) @@ -273,6 +281,7 @@ public static Force FromMeganewtons(QuantityValue meganewtons) /// /// Get Force from Newtons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromPoundals(double poundals) @@ -301,6 +311,7 @@ public static Force FromPoundals(QuantityValue poundals) /// /// Get Force from PoundsForce. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromTonnesForce(double tonnesforce) diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 185b004d19..45e2a10ca5 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ForceChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ForceChangeRate from CentinewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecanewtonsPerMinute(double decanewtonsperminute) @@ -222,6 +226,7 @@ public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtons /// /// Get ForceChangeRate from DecanewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecinewtonsPerSecond(double decinewtonspersecond) @@ -250,6 +256,7 @@ public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtons /// /// Get ForceChangeRate from KilonewtonsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromKilonewtonsPerSecond(double kilonewtonspersecond) @@ -278,6 +286,7 @@ public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtons /// /// Get ForceChangeRate from MicronewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromMillinewtonsPerSecond(double millinewtonspersecond) @@ -306,6 +316,7 @@ public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewto /// /// Get ForceChangeRate from NanonewtonsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromNewtonsPerMinute(double newtonsperminute) @@ -334,6 +346,7 @@ public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminut /// /// Get ForceChangeRate from NewtonsPerSecond. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ForcePerLength from CentinewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromDecinewtonsPerMeter(double decinewtonspermeter) @@ -212,6 +216,7 @@ public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspe /// /// Get ForcePerLength from KilogramsForcePerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromKilonewtonsPerMeter(double kilonewtonspermeter) @@ -240,6 +246,7 @@ public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspe /// /// Get ForcePerLength from MeganewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromMicronewtonsPerMeter(double micronewtonspermeter) @@ -268,6 +276,7 @@ public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtons /// /// Get ForcePerLength from MillinewtonsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromNanonewtonsPerMeter(double nanonewtonspermeter) @@ -296,6 +306,7 @@ public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspe /// /// Get ForcePerLength from NewtonsPerMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Frequency from CyclesPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromCyclesPerMinute(double cyclesperminute) @@ -207,6 +211,7 @@ public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) /// /// Get Frequency from Gigahertz. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromHertz(double hertz) @@ -235,6 +241,7 @@ public static Frequency FromHertz(QuantityValue hertz) /// /// Get Frequency from Kilohertz. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromMegahertz(double megahertz) @@ -263,6 +271,7 @@ public static Frequency FromMegahertz(QuantityValue megahertz) /// /// Get Frequency from RadiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromTerahertz(double terahertz) diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 60a80f59bc..f60999b9ed 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static HeatFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get HeatFlux from BtusPerHourSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerMinuteSquareFoot(double btusperminutesquarefoot) @@ -247,6 +251,7 @@ public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesq /// /// Get HeatFlux from BtusPerSecondSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerSecondSquareInch(double btuspersecondsquareinch) @@ -275,6 +281,7 @@ public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsq /// /// Get HeatFlux from CaloriesPerSecondSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromCentiwattsPerSquareMeter(double centiwattspersquaremeter) @@ -303,6 +311,7 @@ public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspers /// /// Get HeatFlux from DeciwattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilocaloriesPerHourSquareMeter(double kilocaloriesperhoursquaremeter) @@ -331,6 +341,7 @@ public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocalo /// /// Get HeatFlux from KilocaloriesPerSecondSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilowattsPerSquareMeter(double kilowattspersquaremeter) @@ -359,6 +371,7 @@ public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersqu /// /// Get HeatFlux from MicrowattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromMilliwattsPerSquareMeter(double milliwattspersquaremeter) @@ -387,6 +401,7 @@ public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspers /// /// Get HeatFlux from NanowattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareFoot(double wattspersquarefoot) @@ -415,6 +431,7 @@ public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) /// /// Get HeatFlux from WattsPerSquareInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareMeter(double wattspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 79fbb16f01..eea62f4e0c 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static HeatTransferCoefficient() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get HeatTransferCoefficient from WattsPerSquareMeterCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(double wattspersquaremeterkelvin) diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index b04962702f..cf383398d4 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Illuminance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Illuminance from Kilolux. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromLux(double lux) @@ -187,6 +191,7 @@ public static Illuminance FromLux(QuantityValue lux) /// /// Get Illuminance from Megalux. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromMillilux(double millilux) diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 8faa30c6e9..cc21cc4178 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Information() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromBits(double bits) @@ -282,6 +285,7 @@ public static Information FromBits(QuantityValue bits) /// /// Get Information from Bytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExabits(double exabits) @@ -310,6 +315,7 @@ public static Information FromExabits(QuantityValue exabits) /// /// Get Information from Exabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExbibits(double exbibits) @@ -338,6 +345,7 @@ public static Information FromExbibits(QuantityValue exbibits) /// /// Get Information from Exbibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGibibits(double gibibits) @@ -366,6 +375,7 @@ public static Information FromGibibits(QuantityValue gibibits) /// /// Get Information from Gibibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGigabits(double gigabits) @@ -394,6 +405,7 @@ public static Information FromGigabits(QuantityValue gigabits) /// /// Get Information from Gigabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKibibits(double kibibits) @@ -422,6 +435,7 @@ public static Information FromKibibits(QuantityValue kibibits) /// /// Get Information from Kibibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKilobits(double kilobits) @@ -450,6 +465,7 @@ public static Information FromKilobits(QuantityValue kilobits) /// /// Get Information from Kilobytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMebibits(double mebibits) @@ -478,6 +495,7 @@ public static Information FromMebibits(QuantityValue mebibits) /// /// Get Information from Mebibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMegabits(double megabits) @@ -506,6 +525,7 @@ public static Information FromMegabits(QuantityValue megabits) /// /// Get Information from Megabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPebibits(double pebibits) @@ -534,6 +555,7 @@ public static Information FromPebibits(QuantityValue pebibits) /// /// Get Information from Pebibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPetabits(double petabits) @@ -562,6 +585,7 @@ public static Information FromPetabits(QuantityValue petabits) /// /// Get Information from Petabytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTebibits(double tebibits) @@ -590,6 +615,7 @@ public static Information FromTebibits(QuantityValue tebibits) /// /// Get Information from Tebibytes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTerabits(double terabits) @@ -618,6 +645,7 @@ public static Information FromTerabits(QuantityValue terabits) /// /// Get Information from Terabytes. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Irradiance from KilowattsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiance FromWattsPerSquareMeter(double wattspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 7f2d9760b2..e90062574a 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Irradiation() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Irradiation from JoulesPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiation FromKilowattHoursPerSquareMeter(double kilowatthourspersquaremeter) @@ -182,6 +186,7 @@ public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatt /// /// Get Irradiation from WattHoursPerSquareMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get KinematicViscosity from Centistokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromDecistokes(double decistokes) @@ -207,6 +211,7 @@ public static KinematicViscosity FromDecistokes(QuantityValue decistokes) /// /// Get KinematicViscosity from Kilostokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromMicrostokes(double microstokes) @@ -235,6 +241,7 @@ public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) /// /// Get KinematicViscosity from Millistokes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromNanostokes(double nanostokes) @@ -263,6 +271,7 @@ public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) /// /// Get KinematicViscosity from SquareMetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromStokes(double stokes) diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index d35d311ac1..b88b9a7c58 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static LapseRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get LapseRate from DegreesCelciusPerKilometer. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Length from Centimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDecimeters(double decimeters) @@ -277,6 +281,7 @@ public static Length FromDecimeters(QuantityValue decimeters) /// /// Get Length from DtpPicas. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDtpPoints(double dtppoints) @@ -305,6 +311,7 @@ public static Length FromDtpPoints(QuantityValue dtppoints) /// /// Get Length from Fathoms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromFeet(double feet) @@ -333,6 +341,7 @@ public static Length FromFeet(QuantityValue feet) /// /// Get Length from Inches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromKilometers(double kilometers) @@ -361,6 +371,7 @@ public static Length FromKilometers(QuantityValue kilometers) /// /// Get Length from Meters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMicroinches(double microinches) @@ -389,6 +401,7 @@ public static Length FromMicroinches(QuantityValue microinches) /// /// Get Length from Micrometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMils(double mils) @@ -417,6 +431,7 @@ public static Length FromMils(QuantityValue mils) /// /// Get Length from Miles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMillimeters(double millimeters) @@ -445,6 +461,7 @@ public static Length FromMillimeters(QuantityValue millimeters) /// /// Get Length from Nanometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromNauticalMiles(double nauticalmiles) @@ -473,6 +491,7 @@ public static Length FromNauticalMiles(QuantityValue nauticalmiles) /// /// Get Length from PrinterPicas. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromPrinterPoints(double printerpoints) @@ -501,6 +521,7 @@ public static Length FromPrinterPoints(QuantityValue printerpoints) /// /// Get Length from Shackles. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromTwips(double twips) @@ -529,6 +551,7 @@ public static Length FromTwips(QuantityValue twips) /// /// Get Length from UsSurveyFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromYards(double yards) diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 5d5b97c5d6..aca18a8155 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Level() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Level from Decibels. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Level FromNepers(double nepers) diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 12fb970428..60aaa20323 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static LinearDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get LinearDensity from GramsPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LinearDensity FromKilogramsPerMeter(double kilogramspermeter) @@ -182,6 +186,7 @@ public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermete /// /// Get LinearDensity from PoundsPerFoot. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get LuminousFlux from Lumens. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get LuminousIntensity from Candela. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MagneticField from Teslas. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MagneticFlux from Webers. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Magnetization from AmperesPerMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Mass from Centigrams. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromDecagrams(double decagrams) @@ -272,6 +276,7 @@ public static Mass FromDecagrams(QuantityValue decagrams) /// /// Get Mass from Decigrams. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromGrams(double grams) @@ -300,6 +306,7 @@ public static Mass FromGrams(QuantityValue grams) /// /// Get Mass from Hectograms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilograms(double kilograms) @@ -328,6 +336,7 @@ public static Mass FromKilograms(QuantityValue kilograms) /// /// Get Mass from Kilopounds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilotonnes(double kilotonnes) @@ -356,6 +366,7 @@ public static Mass FromKilotonnes(QuantityValue kilotonnes) /// /// Get Mass from LongHundredweight. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromLongTons(double longtons) @@ -384,6 +396,7 @@ public static Mass FromLongTons(QuantityValue longtons) /// /// Get Mass from Megapounds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMegatonnes(double megatonnes) @@ -412,6 +426,7 @@ public static Mass FromMegatonnes(QuantityValue megatonnes) /// /// Get Mass from Micrograms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMilligrams(double milligrams) @@ -440,6 +456,7 @@ public static Mass FromMilligrams(QuantityValue milligrams) /// /// Get Mass from Nanograms. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromOunces(double ounces) @@ -468,6 +486,7 @@ public static Mass FromOunces(QuantityValue ounces) /// /// Get Mass from Pounds. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromShortHundredweight(double shorthundredweight) @@ -496,6 +516,7 @@ public static Mass FromShortHundredweight(QuantityValue shorthundredweight) /// /// Get Mass from ShortTons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromStone(double stone) @@ -524,6 +546,7 @@ public static Mass FromStone(QuantityValue stone) /// /// Get Mass from Tonnes. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MassFlow from CentigramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromDecagramsPerSecond(double decagramspersecond) @@ -242,6 +246,7 @@ public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) /// /// Get MassFlow from DecigramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromGramsPerSecond(double gramspersecond) @@ -270,6 +276,7 @@ public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) /// /// Get MassFlow from HectogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromKilogramsPerHour(double kilogramsperhour) @@ -298,6 +306,7 @@ public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) /// /// Get MassFlow from KilogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMegapoundsPerHour(double megapoundsperhour) @@ -326,6 +336,7 @@ public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) /// /// Get MassFlow from MicrogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMilligramsPerSecond(double milligramspersecond) @@ -354,6 +366,7 @@ public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond /// /// Get MassFlow from NanogramsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromPoundsPerHour(double poundsperhour) @@ -382,6 +396,7 @@ public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) /// /// Get MassFlow from ShortTonsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromTonnesPerDay(double tonnesperday) @@ -410,6 +426,7 @@ public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) /// /// Get MassFlow from TonnesPerHour. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MassFlux from GramsPerSecondPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlux FromKilogramsPerSecondPerSquareMeter(double kilogramspersecondpersquaremeter) diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 5a7d16d447..704316dc93 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MassMomentOfInertia() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MassMomentOfInertia from GramSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareDecimeters(double gramsquaredecimeters) @@ -297,6 +301,7 @@ public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsqu /// /// Get MassMomentOfInertia from GramSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareMillimeters(double gramsquaremillimeters) @@ -325,6 +331,7 @@ public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsq /// /// Get MassMomentOfInertia from KilogramSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareDecimeters(double kilogramsquaredecimeters) @@ -353,6 +361,7 @@ public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kil /// /// Get MassMomentOfInertia from KilogramSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareMillimeters(double kilogramsquaremillimeters) @@ -381,6 +391,7 @@ public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilotonneSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareDecimeters(double kilotonnesquaredecimeters) @@ -409,6 +421,7 @@ public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilotonneSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareMilimeters(double kilotonnesquaremilimeters) @@ -437,6 +451,7 @@ public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue ki /// /// Get MassMomentOfInertia from MegatonneSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareDecimeters(double megatonnesquaredecimeters) @@ -465,6 +481,7 @@ public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue me /// /// Get MassMomentOfInertia from MegatonneSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareMilimeters(double megatonnesquaremilimeters) @@ -493,6 +511,7 @@ public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue me /// /// Get MassMomentOfInertia from MilligramSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareDecimeters(double milligramsquaredecimeters) @@ -521,6 +541,7 @@ public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue mi /// /// Get MassMomentOfInertia from MilligramSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareMillimeters(double milligramsquaremillimeters) @@ -549,6 +571,7 @@ public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue m /// /// Get MassMomentOfInertia from PoundSquareFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromPoundSquareInches(double poundsquareinches) @@ -577,6 +601,7 @@ public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquar /// /// Get MassMomentOfInertia from TonneSquareCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareDecimeters(double tonnesquaredecimeters) @@ -605,6 +631,7 @@ public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnes /// /// Get MassMomentOfInertia from TonneSquareMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareMilimeters(double tonnesquaremilimeters) diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 75d55e12a4..e2387f671f 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static MolarEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MolarEnergy from JoulesPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEnergy FromKilojoulesPerMole(double kilojoulespermole) @@ -182,6 +186,7 @@ public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) /// /// Get MolarEnergy from MegajoulesPerMole. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MolarEntropy from JoulesPerMoleKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEntropy FromKilojoulesPerMoleKelvin(double kilojoulespermolekelvin) @@ -182,6 +186,7 @@ public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulesp /// /// Get MolarEntropy from MegajoulesPerMoleKelvin. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get MolarMass from CentigramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromDecagramsPerMole(double decagramspermole) @@ -227,6 +231,7 @@ public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) /// /// Get MolarMass from DecigramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromGramsPerMole(double gramspermole) @@ -255,6 +261,7 @@ public static MolarMass FromGramsPerMole(QuantityValue gramspermole) /// /// Get MolarMass from HectogramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromKilogramsPerMole(double kilogramspermole) @@ -283,6 +291,7 @@ public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) /// /// Get MolarMass from KilopoundsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMegapoundsPerMole(double megapoundspermole) @@ -311,6 +321,7 @@ public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) /// /// Get MolarMass from MicrogramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMilligramsPerMole(double milligramspermole) @@ -339,6 +351,7 @@ public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) /// /// Get MolarMass from NanogramsPerMole. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromPoundsPerMole(double poundspermole) diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index f25cefd5d0..4b8a1d2b91 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Molarity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Molarity from CentimolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromDecimolesPerLiter(double decimolesperliter) @@ -207,6 +211,7 @@ public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) /// /// Get Molarity from MicromolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMillimolesPerLiter(double millimolesperliter) @@ -235,6 +241,7 @@ public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) /// /// Get Molarity from MolesPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMolesPerLiter(double molesperliter) @@ -263,6 +271,7 @@ public static Molarity FromMolesPerLiter(QuantityValue molesperliter) /// /// Get Molarity from NanomolesPerLiter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromPicomolesPerLiter(double picomolesperliter) diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 33554f2ecc..af018b2f6a 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Permeability() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Permeability from HenriesPerMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Permittivity from FaradsPerMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromBoilerHorsepower(double boilerhorsepower) @@ -253,6 +256,7 @@ public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) /// /// Get Power from BritishThermalUnitsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromDecawatts(double decawatts) @@ -281,6 +286,7 @@ public static Power FromDecawatts(QuantityValue decawatts) /// /// Get Power from Deciwatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromElectricalHorsepower(double electricalhorsepower) @@ -309,6 +316,7 @@ public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) /// /// Get Power from Femtowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromGigawatts(double gigawatts) @@ -337,6 +346,7 @@ public static Power FromGigawatts(QuantityValue gigawatts) /// /// Get Power from HydraulicHorsepower. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromKilobritishThermalUnitsPerHour(double kilobritishthermalunitsperhour) @@ -365,6 +376,7 @@ public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritish /// /// Get Power from Kilowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMechanicalHorsepower(double mechanicalhorsepower) @@ -393,6 +406,7 @@ public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) /// /// Get Power from Megawatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMetricHorsepower(double metrichorsepower) @@ -421,6 +436,7 @@ public static Power FromMetricHorsepower(QuantityValue metrichorsepower) /// /// Get Power from Microwatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMilliwatts(double milliwatts) @@ -449,6 +466,7 @@ public static Power FromMilliwatts(QuantityValue milliwatts) /// /// Get Power from Nanowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromPetawatts(double petawatts) @@ -477,6 +496,7 @@ public static Power FromPetawatts(QuantityValue petawatts) /// /// Get Power from Picowatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromTerawatts(double terawatts) @@ -505,6 +526,7 @@ public static Power FromTerawatts(QuantityValue terawatts) /// /// Get Power from Watts. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get PowerDensity from DecawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerCubicInch(double decawattspercubicinch) @@ -387,6 +391,7 @@ public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattsperc /// /// Get PowerDensity from DecawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerLiter(double decawattsperliter) @@ -415,6 +421,7 @@ public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter /// /// Get PowerDensity from DeciwattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerCubicInch(double deciwattspercubicinch) @@ -443,6 +451,7 @@ public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattsperc /// /// Get PowerDensity from DeciwattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerLiter(double deciwattsperliter) @@ -471,6 +481,7 @@ public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter /// /// Get PowerDensity from GigawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerCubicInch(double gigawattspercubicinch) @@ -499,6 +511,7 @@ public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattsperc /// /// Get PowerDensity from GigawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerLiter(double gigawattsperliter) @@ -527,6 +541,7 @@ public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter /// /// Get PowerDensity from KilowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerCubicInch(double kilowattspercubicinch) @@ -555,6 +571,7 @@ public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattsperc /// /// Get PowerDensity from KilowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerLiter(double kilowattsperliter) @@ -583,6 +601,7 @@ public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter /// /// Get PowerDensity from MegawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerCubicInch(double megawattspercubicinch) @@ -611,6 +631,7 @@ public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattsperc /// /// Get PowerDensity from MegawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerLiter(double megawattsperliter) @@ -639,6 +661,7 @@ public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter /// /// Get PowerDensity from MicrowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerCubicInch(double microwattspercubicinch) @@ -667,6 +691,7 @@ public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspe /// /// Get PowerDensity from MicrowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerLiter(double microwattsperliter) @@ -695,6 +721,7 @@ public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperlit /// /// Get PowerDensity from MilliwattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerCubicInch(double milliwattspercubicinch) @@ -723,6 +751,7 @@ public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspe /// /// Get PowerDensity from MilliwattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerLiter(double milliwattsperliter) @@ -751,6 +781,7 @@ public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperlit /// /// Get PowerDensity from NanowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerCubicInch(double nanowattspercubicinch) @@ -779,6 +811,7 @@ public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattsperc /// /// Get PowerDensity from NanowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerLiter(double nanowattsperliter) @@ -807,6 +841,7 @@ public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter /// /// Get PowerDensity from PicowattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerCubicInch(double picowattspercubicinch) @@ -835,6 +871,7 @@ public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattsperc /// /// Get PowerDensity from PicowattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerLiter(double picowattsperliter) @@ -863,6 +901,7 @@ public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter /// /// Get PowerDensity from TerawattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerCubicInch(double terawattspercubicinch) @@ -891,6 +931,7 @@ public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattsperc /// /// Get PowerDensity from TerawattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerLiter(double terawattsperliter) @@ -919,6 +961,7 @@ public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter /// /// Get PowerDensity from WattsPerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerCubicInch(double wattspercubicinch) @@ -947,6 +991,7 @@ public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch /// /// Get PowerDensity from WattsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerLiter(double wattsperliter) diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 7f00035b07..c29b805dea 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static PowerRatio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get PowerRatio from DecibelMilliwatts. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerRatio FromDecibelWatts(double decibelwatts) diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 9b1ed49c46..cd493da2b2 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Pressure() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Pressure from Atmospheres. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromBars(double bars) @@ -352,6 +356,7 @@ public static Pressure FromBars(QuantityValue bars) /// /// Get Pressure from Centibars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromDecapascals(double decapascals) @@ -380,6 +386,7 @@ public static Pressure FromDecapascals(QuantityValue decapascals) /// /// Get Pressure from Decibars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromFeetOfHead(double feetofhead) @@ -408,6 +416,7 @@ public static Pressure FromFeetOfHead(QuantityValue feetofhead) /// /// Get Pressure from Gigapascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromHectopascals(double hectopascals) @@ -436,6 +446,7 @@ public static Pressure FromHectopascals(QuantityValue hectopascals) /// /// Get Pressure from InchesOfMercury. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilobars(double kilobars) @@ -464,6 +476,7 @@ public static Pressure FromKilobars(QuantityValue kilobars) /// /// Get Pressure from KilogramsForcePerSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilogramsForcePerSquareMeter(double kilogramsforcepersquaremeter) @@ -492,6 +506,7 @@ public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsf /// /// Get Pressure from KilogramsForcePerSquareMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareCentimeter(double kilonewtonspersquarecentimeter) @@ -520,6 +536,7 @@ public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewt /// /// Get Pressure from KilonewtonsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareMillimeter(double kilonewtonspersquaremillimeter) @@ -548,6 +566,7 @@ public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewt /// /// Get Pressure from Kilopascals. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilopoundsForcePerSquareFoot(double kilopoundsforcepersquarefoot) @@ -576,6 +596,7 @@ public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopounds /// /// Get Pressure from KilopoundsForcePerSquareInch. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMegabars(double megabars) @@ -604,6 +626,7 @@ public static Pressure FromMegabars(QuantityValue megabars) /// /// Get Pressure from MeganewtonsPerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMegapascals(double megapascals) @@ -632,6 +656,7 @@ public static Pressure FromMegapascals(QuantityValue megapascals) /// /// Get Pressure from MetersOfHead. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMicropascals(double micropascals) @@ -660,6 +686,7 @@ public static Pressure FromMicropascals(QuantityValue micropascals) /// /// Get Pressure from Millibars. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMillimetersOfMercury(double millimetersofmercury) @@ -688,6 +716,7 @@ public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercu /// /// Get Pressure from NewtonsPerSquareCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromNewtonsPerSquareMeter(double newtonspersquaremeter) @@ -716,6 +746,7 @@ public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquarem /// /// Get Pressure from NewtonsPerSquareMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPascals(double pascals) @@ -744,6 +776,7 @@ public static Pressure FromPascals(QuantityValue pascals) /// /// Get Pressure from PoundsForcePerSquareFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPoundsForcePerSquareInch(double poundsforcepersquareinch) @@ -772,6 +806,7 @@ public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforceper /// /// Get Pressure from TechnicalAtmospheres. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareCentimeter(double tonnesforcepersquarecentimeter) @@ -800,6 +836,7 @@ public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesfo /// /// Get Pressure from TonnesForcePerSquareMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareMillimeter(double tonnesforcepersquaremillimeter) @@ -828,6 +866,7 @@ public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesfo /// /// Get Pressure from Torrs. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get PressureChangeRate from AtmospheresPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromKilopascalsPerSecond(double kilopascalspersecond) @@ -187,6 +191,7 @@ public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopasc /// /// Get PressureChangeRate from MegapascalsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromPascalsPerSecond(double pascalspersecond) diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 738f138e7c..c8dc7585b2 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static Ratio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Ratio from DecimalFractions. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerBillion(double partsperbillion) @@ -196,6 +200,7 @@ public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) /// /// Get Ratio from PartsPerMillion. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerThousand(double partsperthousand) @@ -224,6 +230,7 @@ public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) /// /// Get Ratio from PartsPerTrillion. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPercent(double percent) diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index dbff2b914b..87082d3a0c 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ReactiveEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ReactiveEnergy from KilovoltampereReactiveHours. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactiveEnergy FromMegavoltampereReactiveHours(double megavoltamperereactivehours) @@ -182,6 +186,7 @@ public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megav /// /// Get ReactiveEnergy from VoltampereReactiveHours. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ReactivePower from GigavoltamperesReactive. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromKilovoltamperesReactive(double kilovoltamperesreactive) @@ -187,6 +191,7 @@ public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltam /// /// Get ReactivePower from MegavoltamperesReactive. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromVoltamperesReactive(double voltamperesreactive) diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 02fb49c631..5ed3448120 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static RotationalAcceleration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get RotationalAcceleration from DegreesPerSecondSquared. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalAcceleration FromRadiansPerSecondSquared(double radianspersecondsquared) @@ -182,6 +186,7 @@ public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue r /// /// Get RotationalAcceleration from RevolutionsPerMinutePerSecond. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get RotationalSpeed from CentiradiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDeciradiansPerSecond(double deciradianspersecond) @@ -232,6 +236,7 @@ public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradians /// /// Get RotationalSpeed from DegreesPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDegreesPerSecond(double degreespersecond) @@ -260,6 +266,7 @@ public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecon /// /// Get RotationalSpeed from MicrodegreesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMicroradiansPerSecond(double microradianspersecond) @@ -288,6 +296,7 @@ public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradia /// /// Get RotationalSpeed from MillidegreesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMilliradiansPerSecond(double milliradianspersecond) @@ -316,6 +326,7 @@ public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradia /// /// Get RotationalSpeed from NanodegreesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromNanoradiansPerSecond(double nanoradianspersecond) @@ -344,6 +356,7 @@ public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradians /// /// Get RotationalSpeed from RadiansPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromRevolutionsPerMinute(double revolutionsperminute) @@ -372,6 +386,7 @@ public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutions /// /// Get RotationalSpeed from RevolutionsPerSecond. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get RotationalStiffness from KilonewtonMetersPerRadian. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffness FromMeganewtonMetersPerRadian(double meganewtonmetersperradian) @@ -182,6 +186,7 @@ public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue me /// /// Get RotationalStiffness from NewtonMetersPerRadian. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(double meganewtonmetersperradianpermeter) @@ -182,6 +186,7 @@ public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter /// /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get SolidAngle from Steradians. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get SpecificEnergy from CaloriesPerGram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromJoulesPerKilogram(double joulesperkilogram) @@ -207,6 +211,7 @@ public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogr /// /// Get SpecificEnergy from KilocaloriesPerGram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromKilojoulesPerKilogram(double kilojoulesperkilogram) @@ -235,6 +241,7 @@ public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesp /// /// Get SpecificEnergy from KilowattHoursPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromMegajoulesPerKilogram(double megajoulesperkilogram) @@ -263,6 +271,7 @@ public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesp /// /// Get SpecificEnergy from MegawattHoursPerKilogram. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromWattHoursPerKilogram(double watthoursperkilogram) diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 0ea0131f12..709f4e1e5f 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static SpecificEntropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get SpecificEntropy from CaloriesPerGramKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(double joulesperkilogramdegreecelsius) @@ -207,6 +211,7 @@ public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue j /// /// Get SpecificEntropy from JoulesPerKilogramKelvin. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilocaloriesPerGramKelvin(double kilocaloriespergramkelvin) @@ -235,6 +241,7 @@ public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kiloca /// /// Get SpecificEntropy from KilojoulesPerKilogramDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilojoulesPerKilogramKelvin(double kilojoulesperkilogramkelvin) @@ -263,6 +271,7 @@ public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilo /// /// Get SpecificEntropy from MegajoulesPerKilogramDegreeCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromMegajoulesPerKilogramKelvin(double megajoulesperkilogramkelvin) diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 0bf0c2a59c..74b6afc20d 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static SpecificVolume() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get SpecificVolume from CubicFeetPerPound. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificVolume FromCubicMetersPerKilogram(double cubicmetersperkilogram) diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 976d3902b6..cae4a22cb7 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static SpecificWeight() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get SpecificWeight from KilogramsForcePerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilogramsForcePerCubicMeter(double kilogramsforcepercubicmeter) @@ -252,6 +256,7 @@ public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilog /// /// Get SpecificWeight from KilogramsForcePerCubicMillimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicCentimeter(double kilonewtonspercubiccentimeter) @@ -280,6 +286,7 @@ public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kil /// /// Get SpecificWeight from KilonewtonsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicMillimeter(double kilonewtonspercubicmillimeter) @@ -308,6 +316,7 @@ public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kil /// /// Get SpecificWeight from KilopoundsForcePerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilopoundsForcePerCubicInch(double kilopoundsforcepercubicinch) @@ -336,6 +346,7 @@ public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilop /// /// Get SpecificWeight from MeganewtonsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicCentimeter(double newtonspercubiccentimeter) @@ -364,6 +376,7 @@ public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtons /// /// Get SpecificWeight from NewtonsPerCubicMeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicMillimeter(double newtonspercubicmillimeter) @@ -392,6 +406,7 @@ public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtons /// /// Get SpecificWeight from PoundsForcePerCubicFoot. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromPoundsForcePerCubicInch(double poundsforcepercubicinch) @@ -420,6 +436,7 @@ public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsfor /// /// Get SpecificWeight from TonnesForcePerCubicCentimeter. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromTonnesForcePerCubicMeter(double tonnesforcepercubicmeter) @@ -448,6 +466,7 @@ public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesfo /// /// Get SpecificWeight from TonnesForcePerCubicMillimeter. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Speed from CentimetersPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromCentimetersPerMinutes(double centimetersperminutes) @@ -327,6 +331,7 @@ public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminute /// /// Get Speed from CentimetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromDecimetersPerMinutes(double decimetersperminutes) @@ -355,6 +361,7 @@ public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) /// /// Get Speed from DecimetersPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerHour(double feetperhour) @@ -383,6 +391,7 @@ public static Speed FromFeetPerHour(QuantityValue feetperhour) /// /// Get Speed from FeetPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerSecond(double feetpersecond) @@ -411,6 +421,7 @@ public static Speed FromFeetPerSecond(QuantityValue feetpersecond) /// /// Get Speed from InchesPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromInchesPerMinute(double inchesperminute) @@ -439,6 +451,7 @@ public static Speed FromInchesPerMinute(QuantityValue inchesperminute) /// /// Get Speed from InchesPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerHour(double kilometersperhour) @@ -467,6 +481,7 @@ public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) /// /// Get Speed from KilometersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerSecond(double kilometerspersecond) @@ -495,6 +511,7 @@ public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) /// /// Get Speed from Knots. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerHour(double metersperhour) @@ -523,6 +541,7 @@ public static Speed FromMetersPerHour(QuantityValue metersperhour) /// /// Get Speed from MetersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerSecond(double meterspersecond) @@ -551,6 +571,7 @@ public static Speed FromMetersPerSecond(QuantityValue meterspersecond) /// /// Get Speed from MicrometersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMicrometersPerSecond(double micrometerspersecond) @@ -579,6 +601,7 @@ public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) /// /// Get Speed from MilesPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerHour(double millimetersperhour) @@ -607,6 +631,7 @@ public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) /// /// Get Speed from MillimetersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerSecond(double millimeterspersecond) @@ -635,6 +661,7 @@ public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) /// /// Get Speed from NanometersPerMinutes. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromNanometersPerSecond(double nanometerspersecond) @@ -663,6 +691,7 @@ public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) /// /// Get Speed from UsSurveyFeetPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromUsSurveyFeetPerMinute(double ussurveyfeetperminute) @@ -691,6 +721,7 @@ public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminut /// /// Get Speed from UsSurveyFeetPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerHour(double yardsperhour) @@ -719,6 +751,7 @@ public static Speed FromYardsPerHour(QuantityValue yardsperhour) /// /// Get Speed from YardsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerSecond(double yardspersecond) diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 050bbc24f3..169c3d73cf 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static Temperature() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Temperature from DegreesCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesDelisle(double degreesdelisle) @@ -207,6 +211,7 @@ public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) /// /// Get Temperature from DegreesFahrenheit. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesNewton(double degreesnewton) @@ -235,6 +241,7 @@ public static Temperature FromDegreesNewton(QuantityValue degreesnewton) /// /// Get Temperature from DegreesRankine. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesReaumur(double degreesreaumur) @@ -263,6 +271,7 @@ public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) /// /// Get Temperature from DegreesRoemer. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromKelvins(double kelvins) diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 49b9afafce..73d3a39302 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static TemperatureChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get TemperatureChangeRate from CentidegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(double decadegreescelsiuspersecond) @@ -217,6 +221,7 @@ public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValu /// /// Get TemperatureChangeRate from DecidegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDegreesCelsiusPerMinute(double degreescelsiusperminute) @@ -245,6 +251,7 @@ public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue de /// /// Get TemperatureChangeRate from DegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(double hectodegreescelsiuspersecond) @@ -273,6 +281,7 @@ public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from KilodegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(double microdegreescelsiuspersecond) @@ -301,6 +311,7 @@ public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from MillidegreesCelsiusPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(double nanodegreescelsiuspersecond) diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 0d3bfa2d7b..c33e4e3b6c 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -87,6 +88,7 @@ static TemperatureDelta() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get TemperatureDelta from DegreesCelsius. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesDelisle(double degreesdelisle) @@ -206,6 +210,7 @@ public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) /// /// Get TemperatureDelta from DegreesFahrenheit. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesNewton(double degreesnewton) @@ -234,6 +240,7 @@ public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) /// /// Get TemperatureDelta from DegreesRankine. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesReaumur(double degreesreaumur) @@ -262,6 +270,7 @@ public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) /// /// Get TemperatureDelta from DegreesRoemer. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromKelvins(double kelvins) diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index f2c943ea0d..1d725f6e98 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ThermalConductivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ThermalConductivity from BtusPerHourFootFahrenheit. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalConductivity FromWattsPerMeterKelvin(double wattspermeterkelvin) diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 24ad6aa00f..c2742c7044 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static ThermalResistance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get ThermalResistance from HourSquareFeetDegreesFahrenheitPerBtu. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(double squarecentimeterhourdegreescelsiusperkilocalorie) @@ -192,6 +196,7 @@ public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocal /// /// Get ThermalResistance from SquareCentimeterKelvinsPerWatt. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(double squaremeterdegreescelsiusperwatt) @@ -220,6 +226,7 @@ public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityVal /// /// Get ThermalResistance from SquareMeterKelvinsPerKilowatt. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Torque from KilogramForceCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilogramForceMeters(double kilogramforcemeters) @@ -272,6 +276,7 @@ public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) /// /// Get Torque from KilogramForceMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonCentimeters(double kilonewtoncentimeters) @@ -300,6 +306,7 @@ public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimete /// /// Get Torque from KilonewtonMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonMillimeters(double kilonewtonmillimeters) @@ -328,6 +336,7 @@ public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimete /// /// Get Torque from KilopoundForceFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilopoundForceInches(double kilopoundforceinches) @@ -356,6 +366,7 @@ public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches /// /// Get Torque from MeganewtonCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMeganewtonMeters(double meganewtonmeters) @@ -384,6 +396,7 @@ public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) /// /// Get Torque from MeganewtonMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMegapoundForceFeet(double megapoundforcefeet) @@ -412,6 +426,7 @@ public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) /// /// Get Torque from MegapoundForceInches. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonCentimeters(double newtoncentimeters) @@ -440,6 +456,7 @@ public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) /// /// Get Torque from NewtonMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonMillimeters(double newtonmillimeters) @@ -468,6 +486,7 @@ public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) /// /// Get Torque from PoundForceFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromPoundForceInches(double poundforceinches) @@ -496,6 +516,7 @@ public static Torque FromPoundForceInches(QuantityValue poundforceinches) /// /// Get Torque from TonneForceCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromTonneForceMeters(double tonneforcemeters) @@ -524,6 +546,7 @@ public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) /// /// Get Torque from TonneForceMillimeters. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get VitaminA from InternationalUnits. /// + /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get Volume from AuTablespoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCentiliters(double centiliters) @@ -377,6 +381,7 @@ public static Volume FromCentiliters(QuantityValue centiliters) /// /// Get Volume from CubicCentimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicDecimeters(double cubicdecimeters) @@ -405,6 +411,7 @@ public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) /// /// Get Volume from CubicFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicInches(double cubicinches) @@ -433,6 +441,7 @@ public static Volume FromCubicInches(QuantityValue cubicinches) /// /// Get Volume from CubicKilometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMeters(double cubicmeters) @@ -461,6 +471,7 @@ public static Volume FromCubicMeters(QuantityValue cubicmeters) /// /// Get Volume from CubicMicrometers. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMiles(double cubicmiles) @@ -489,6 +501,7 @@ public static Volume FromCubicMiles(QuantityValue cubicmiles) /// /// Get Volume from CubicMillimeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicYards(double cubicyards) @@ -517,6 +531,7 @@ public static Volume FromCubicYards(QuantityValue cubicyards) /// /// Get Volume from Deciliters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectocubicFeet(double hectocubicfeet) @@ -545,6 +561,7 @@ public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) /// /// Get Volume from HectocubicMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectoliters(double hectoliters) @@ -573,6 +591,7 @@ public static Volume FromHectoliters(QuantityValue hectoliters) /// /// Get Volume from ImperialBeerBarrels. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromImperialGallons(double imperialgallons) @@ -601,6 +621,7 @@ public static Volume FromImperialGallons(QuantityValue imperialgallons) /// /// Get Volume from ImperialOunces. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKilocubicFeet(double kilocubicfeet) @@ -629,6 +651,7 @@ public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) /// /// Get Volume from KilocubicMeters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKiloimperialGallons(double kiloimperialgallons) @@ -657,6 +681,7 @@ public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) /// /// Get Volume from KilousGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromLiters(double liters) @@ -685,6 +711,7 @@ public static Volume FromLiters(QuantityValue liters) /// /// Get Volume from MegacubicFeet. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMegaimperialGallons(double megaimperialgallons) @@ -713,6 +741,7 @@ public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) /// /// Get Volume from MegausGallons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMetricCups(double metriccups) @@ -741,6 +771,7 @@ public static Volume FromMetricCups(QuantityValue metriccups) /// /// Get Volume from MetricTeaspoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMicroliters(double microliters) @@ -769,6 +801,7 @@ public static Volume FromMicroliters(QuantityValue microliters) /// /// Get Volume from Milliliters. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromOilBarrels(double oilbarrels) @@ -797,6 +831,7 @@ public static Volume FromOilBarrels(QuantityValue oilbarrels) /// /// Get Volume from UkTablespoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsBeerBarrels(double usbeerbarrels) @@ -825,6 +861,7 @@ public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) /// /// Get Volume from UsCustomaryCups. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsGallons(double usgallons) @@ -853,6 +891,7 @@ public static Volume FromUsGallons(QuantityValue usgallons) /// /// Get Volume from UsLegalCups. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsOunces(double usounces) @@ -881,6 +921,7 @@ public static Volume FromUsOunces(QuantityValue usounces) /// /// Get Volume from UsPints. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsQuarts(double usquarts) @@ -909,6 +951,7 @@ public static Volume FromUsQuarts(QuantityValue usquarts) /// /// Get Volume from UsTablespoons. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsTeaspoons(double usteaspoons) diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index b89e54f5a6..92fe5cb645 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -42,6 +42,7 @@ using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -88,6 +89,7 @@ static VolumeFlow() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get VolumeFlow from CentilitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) @@ -297,6 +301,7 @@ public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimet /// /// Get VolumeFlow from CubicFeetPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicFeetPerMinute(double cubicfeetperminute) @@ -325,6 +331,7 @@ public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute /// /// Get VolumeFlow from CubicFeetPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerHour(double cubicmetersperhour) @@ -353,6 +361,7 @@ public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour /// /// Get VolumeFlow from CubicMetersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerSecond(double cubicmeterspersecond) @@ -381,6 +391,7 @@ public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmetersperse /// /// Get VolumeFlow from CubicYardsPerHour. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicYardsPerMinute(double cubicyardsperminute) @@ -409,6 +421,7 @@ public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminu /// /// Get VolumeFlow from CubicYardsPerSecond. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromDecilitersPerMinute(double decilitersperminute) @@ -437,6 +451,7 @@ public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminu /// /// Get VolumeFlow from KilolitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerHour(double litersperhour) @@ -465,6 +481,7 @@ public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) /// /// Get VolumeFlow from LitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerSecond(double literspersecond) @@ -493,6 +511,7 @@ public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) /// /// Get VolumeFlow from MicrolitersPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromMillilitersPerMinute(double millilitersperminute) @@ -521,6 +541,7 @@ public static VolumeFlow FromMillilitersPerMinute(QuantityValue milliliterspermi /// /// Get VolumeFlow from MillionUsGallonsPerDay. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromNanolitersPerMinute(double nanolitersperminute) @@ -549,6 +571,7 @@ public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminu /// /// Get VolumeFlow from OilBarrelsPerDay. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromOilBarrelsPerHour(double oilbarrelsperhour) @@ -577,6 +601,7 @@ public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) /// /// Get VolumeFlow from OilBarrelsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerHour(double usgallonsperhour) @@ -605,6 +631,7 @@ public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) /// /// Get VolumeFlow from UsGallonsPerMinute. /// + /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerSecond(double usgallonspersecond) diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index ba2c5b5060..7b18a64aed 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -84,11 +84,24 @@ public abstract partial class AccelerationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Acceleration((double)0.0, AccelerationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Acceleration(double.PositiveInfinity, AccelerationUnit.MeterPerSecondSquared)); + Assert.Throws(() => new Acceleration(double.NegativeInfinity, AccelerationUnit.MeterPerSecondSquared)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Acceleration(double.NaN, AccelerationUnit.MeterPerSecondSquared)); + } + [Fact] public void MeterPerSecondSquaredToAccelerationUnits() { @@ -126,6 +139,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.StandardGravity).StandardGravity, StandardGravityTolerance); } + [Fact] + public void FromMetersPerSecondSquared_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.PositiveInfinity)); + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NegativeInfinity)); + } + + [Fact] + public void FromMetersPerSecondSquared_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index fde1d52585..4cf9ee0468 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -86,11 +86,24 @@ public abstract partial class AmountOfSubstanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AmountOfSubstance((double)0.0, AmountOfSubstanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmountOfSubstance(double.PositiveInfinity, AmountOfSubstanceUnit.Mole)); + Assert.Throws(() => new AmountOfSubstance(double.NegativeInfinity, AmountOfSubstanceUnit.Mole)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmountOfSubstance(double.NaN, AmountOfSubstanceUnit.Mole)); + } + [Fact] public void MoleToAmountOfSubstanceUnits() { @@ -130,6 +143,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.PoundMole).PoundMoles, PoundMolesTolerance); } + [Fact] + public void FromMoles_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AmountOfSubstance.FromMoles(double.PositiveInfinity)); + Assert.Throws(() => AmountOfSubstance.FromMoles(double.NegativeInfinity)); + } + + [Fact] + public void FromMoles_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AmountOfSubstance.FromMoles(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 7bd0e75139..5c422ba55c 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class AmplitudeRatioTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AmplitudeRatio((double)0.0, AmplitudeRatioUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmplitudeRatio(double.PositiveInfinity, AmplitudeRatioUnit.DecibelVolt)); + Assert.Throws(() => new AmplitudeRatio(double.NegativeInfinity, AmplitudeRatioUnit.DecibelVolt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AmplitudeRatio(double.NaN, AmplitudeRatioUnit.DecibelVolt)); + } + [Fact] public void DecibelVoltToAmplitudeRatioUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelVolt).DecibelVolts, DecibelVoltsTolerance); } + [Fact] + public void FromDecibelVolts_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.PositiveInfinity)); + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NegativeInfinity)); + } + + [Fact] + public void FromDecibelVolts_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index f8e6959e4f..46ea30e6b0 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -86,11 +86,24 @@ public abstract partial class AngleTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Angle((double)0.0, AngleUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Angle(double.PositiveInfinity, AngleUnit.Degree)); + Assert.Throws(() => new Angle(double.NegativeInfinity, AngleUnit.Degree)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Angle(double.NaN, AngleUnit.Degree)); + } + [Fact] public void DegreeToAngleUnits() { @@ -130,6 +143,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Revolution).Revolutions, RevolutionsTolerance); } + [Fact] + public void FromDegrees_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Angle.FromDegrees(double.PositiveInfinity)); + Assert.Throws(() => Angle.FromDegrees(double.NegativeInfinity)); + } + + [Fact] + public void FromDegrees_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Angle.FromDegrees(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index a7b21d9922..c2a2b63781 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class ApparentEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ApparentEnergy((double)0.0, ApparentEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentEnergy(double.PositiveInfinity, ApparentEnergyUnit.VoltampereHour)); + Assert.Throws(() => new ApparentEnergy(double.NegativeInfinity, ApparentEnergyUnit.VoltampereHour)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentEnergy(double.NaN, ApparentEnergyUnit.VoltampereHour)); + } + [Fact] public void VoltampereHourToApparentEnergyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.VoltampereHour).VoltampereHours, VoltampereHoursTolerance); } + [Fact] + public void FromVoltampereHours_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.PositiveInfinity)); + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltampereHours_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index 8a46336a98..18946640ac 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ApparentPowerTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ApparentPower((double)0.0, ApparentPowerUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentPower(double.PositiveInfinity, ApparentPowerUnit.Voltampere)); + Assert.Throws(() => new ApparentPower(double.NegativeInfinity, ApparentPowerUnit.Voltampere)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ApparentPower(double.NaN, ApparentPowerUnit.Voltampere)); + } + [Fact] public void VoltampereToApparentPowerUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Voltampere).Voltamperes, VoltamperesTolerance); } + [Fact] + public void FromVoltamperes_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentPower.FromVoltamperes(double.PositiveInfinity)); + Assert.Throws(() => ApparentPower.FromVoltamperes(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltamperes_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ApparentPower.FromVoltamperes(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index 07df5efd07..5cedc1a4dc 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class AreaDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AreaDensity((double)0.0, AreaDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaDensity(double.PositiveInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + Assert.Throws(() => new AreaDensity(double.NegativeInfinity, AreaDensityUnit.KilogramPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaDensity(double.NaN, AreaDensityUnit.KilogramPerSquareMeter)); + } + [Fact] public void KilogramPerSquareMeterToAreaDensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AreaDensity.From(1, AreaDensityUnit.KilogramPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); } + [Fact] + public void FromKilogramsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index 19253d24cd..d8a0e19d48 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -70,11 +70,24 @@ public abstract partial class AreaMomentOfInertiaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new AreaMomentOfInertia((double)0.0, AreaMomentOfInertiaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaMomentOfInertia(double.PositiveInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + Assert.Throws(() => new AreaMomentOfInertia(double.NegativeInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new AreaMomentOfInertia(double.NaN, AreaMomentOfInertiaUnit.MeterToTheFourth)); + } + [Fact] public void MeterToTheFourthToAreaMomentOfInertiaUnits() { @@ -98,6 +111,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MillimeterToTheFourth).MillimetersToTheFourth, MillimetersToTheFourthTolerance); } + [Fact] + public void FromMetersToTheFourth_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity)); + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity)); + } + + [Fact] + public void FromMetersToTheFourth_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index 229f2a8862..bbff05e91b 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -84,11 +84,24 @@ public abstract partial class AreaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Area((double)0.0, AreaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Area(double.PositiveInfinity, AreaUnit.SquareMeter)); + Assert.Throws(() => new Area(double.NegativeInfinity, AreaUnit.SquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Area(double.NaN, AreaUnit.SquareMeter)); + } + [Fact] public void SquareMeterToAreaUnits() { @@ -126,6 +139,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.UsSurveySquareFoot).UsSurveySquareFeet, UsSurveySquareFeetTolerance); } + [Fact] + public void FromSquareMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Area.FromSquareMeters(double.PositiveInfinity)); + Assert.Throws(() => Area.FromSquareMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromSquareMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Area.FromSquareMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index 12d6add74c..3d6e1b5d08 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -110,11 +110,12 @@ public abstract partial class BitRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new BitRate((decimal)0.0, BitRateUnit.Undefined)); } + [Fact] public void BitPerSecondToBitRateUnits() { @@ -178,6 +179,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabytePerSecond).TerabytesPerSecond, TerabytesPerSecondTolerance); } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index 07bc6fd165..7b39afd362 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class BrakeSpecificFuelConsumptionTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new BrakeSpecificFuelConsumption((double)0.0, BrakeSpecificFuelConsumptionUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.PositiveInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NegativeInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NaN, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); + } + [Fact] public void KilogramPerJouleToBrakeSpecificFuelConsumptionUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour).PoundsPerMechanicalHorsepowerHour, PoundsPerMechanicalHorsepowerHourTolerance); } + [Fact] + public void FromKilogramsPerJoule_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerJoule_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index e0b8ea9f19..f7aae142a9 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class CapacitanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Capacitance((double)0.0, CapacitanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Capacitance(double.PositiveInfinity, CapacitanceUnit.Farad)); + Assert.Throws(() => new Capacitance(double.NegativeInfinity, CapacitanceUnit.Farad)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Capacitance(double.NaN, CapacitanceUnit.Farad)); + } + [Fact] public void FaradToCapacitanceUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Farad).Farads, FaradsTolerance); } + [Fact] + public void FromFarads_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Capacitance.FromFarads(double.PositiveInfinity)); + Assert.Throws(() => Capacitance.FromFarads(double.NegativeInfinity)); + } + + [Fact] + public void FromFarads_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Capacitance.FromFarads(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index c638a5da1c..eb815b3870 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -134,11 +134,24 @@ public abstract partial class DensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Density((double)0.0, DensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Density(double.PositiveInfinity, DensityUnit.KilogramPerCubicMeter)); + Assert.Throws(() => new Density(double.NegativeInfinity, DensityUnit.KilogramPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Density(double.NaN, DensityUnit.KilogramPerCubicMeter)); + } + [Fact] public void KilogramPerCubicMeterToDensityUnits() { @@ -226,6 +239,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMillimeter).TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); } + [Fact] + public void FromKilogramsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index f806a5304f..26d57866ab 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -78,11 +78,24 @@ public abstract partial class DurationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Duration((double)0.0, DurationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Duration(double.PositiveInfinity, DurationUnit.Second)); + Assert.Throws(() => new Duration(double.NegativeInfinity, DurationUnit.Second)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Duration(double.NaN, DurationUnit.Second)); + } + [Fact] public void SecondToDurationUnits() { @@ -114,6 +127,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Year365).Years365, Years365Tolerance); } + [Fact] + public void FromSeconds_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Duration.FromSeconds(double.PositiveInfinity)); + Assert.Throws(() => Duration.FromSeconds(double.NegativeInfinity)); + } + + [Fact] + public void FromSeconds_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Duration.FromSeconds(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index be764da352..89975d0345 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -70,11 +70,24 @@ public abstract partial class DynamicViscosityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new DynamicViscosity((double)0.0, DynamicViscosityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new DynamicViscosity(double.PositiveInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + Assert.Throws(() => new DynamicViscosity(double.NegativeInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new DynamicViscosity(double.NaN, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); + } + [Fact] public void NewtonSecondPerMeterSquaredToDynamicViscosityUnits() { @@ -98,6 +111,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Poise).Poise, PoiseTolerance); } + [Fact] + public void FromNewtonSecondsPerMeterSquared_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.PositiveInfinity)); + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonSecondsPerMeterSquared_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index 96dedd353c..d785668635 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ElectricAdmittanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricAdmittance((double)0.0, ElectricAdmittanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricAdmittance(double.PositiveInfinity, ElectricAdmittanceUnit.Siemens)); + Assert.Throws(() => new ElectricAdmittance(double.NegativeInfinity, ElectricAdmittanceUnit.Siemens)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricAdmittance(double.NaN, ElectricAdmittanceUnit.Siemens)); + } + [Fact] public void SiemensToElectricAdmittanceUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Siemens).Siemens, SiemensTolerance); } + [Fact] + public void FromSiemens_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.PositiveInfinity)); + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NegativeInfinity)); + } + + [Fact] + public void FromSiemens_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index dbb00507bd..494ae2e6a2 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricChargeDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricChargeDensity((double)0.0, ElectricChargeDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricChargeDensity(double.PositiveInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + Assert.Throws(() => new ElectricChargeDensity(double.NegativeInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricChargeDensity(double.NaN, ElectricChargeDensityUnit.CoulombPerCubicMeter)); + } + [Fact] public void CoulombPerCubicMeterToElectricChargeDensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricChargeDensity.From(1, ElectricChargeDensityUnit.CoulombPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); } + [Fact] + public void FromCoulombsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromCoulombsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index f29eb270ae..117118a2e7 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricChargeTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCharge((double)0.0, ElectricChargeUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCharge(double.PositiveInfinity, ElectricChargeUnit.Coulomb)); + Assert.Throws(() => new ElectricCharge(double.NegativeInfinity, ElectricChargeUnit.Coulomb)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCharge(double.NaN, ElectricChargeUnit.Coulomb)); + } + [Fact] public void CoulombToElectricChargeUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.Coulomb).Coulombs, CoulombsTolerance); } + [Fact] + public void FromCoulombs_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCharge.FromCoulombs(double.PositiveInfinity)); + Assert.Throws(() => ElectricCharge.FromCoulombs(double.NegativeInfinity)); + } + + [Fact] + public void FromCoulombs_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCharge.FromCoulombs(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index 2da4b3b45d..84f5d077a7 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class ElectricConductanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricConductance((double)0.0, ElectricConductanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductance(double.PositiveInfinity, ElectricConductanceUnit.Siemens)); + Assert.Throws(() => new ElectricConductance(double.NegativeInfinity, ElectricConductanceUnit.Siemens)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductance(double.NaN, ElectricConductanceUnit.Siemens)); + } + [Fact] public void SiemensToElectricConductanceUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Siemens).Siemens, SiemensTolerance); } + [Fact] + public void FromSiemens_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductance.FromSiemens(double.PositiveInfinity)); + Assert.Throws(() => ElectricConductance.FromSiemens(double.NegativeInfinity)); + } + + [Fact] + public void FromSiemens_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductance.FromSiemens(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index 30448d33a6..54f544901f 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricConductivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricConductivity((double)0.0, ElectricConductivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductivity(double.PositiveInfinity, ElectricConductivityUnit.SiemensPerMeter)); + Assert.Throws(() => new ElectricConductivity(double.NegativeInfinity, ElectricConductivityUnit.SiemensPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricConductivity(double.NaN, ElectricConductivityUnit.SiemensPerMeter)); + } + [Fact] public void SiemensPerMeterToElectricConductivityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); } + [Fact] + public void FromSiemensPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromSiemensPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index 5d27add425..3b9a125a06 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricCurrentDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCurrentDensity((double)0.0, ElectricCurrentDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentDensity(double.PositiveInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + Assert.Throws(() => new ElectricCurrentDensity(double.NegativeInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentDensity(double.NaN, ElectricCurrentDensityUnit.AmperePerSquareMeter)); + } + [Fact] public void AmperePerSquareMeterToElectricCurrentDensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); } + [Fact] + public void FromAmperesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperesPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 2b10f1c8e2..6367b5468d 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricCurrentGradientTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCurrentGradient((double)0.0, ElectricCurrentGradientUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentGradient(double.PositiveInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + Assert.Throws(() => new ElectricCurrentGradient(double.NegativeInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrentGradient(double.NaN, ElectricCurrentGradientUnit.AmperePerSecond)); + } + [Fact] public void AmperePerSecondToElectricCurrentGradientUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCurrentGradient.From(1, ElectricCurrentGradientUnit.AmperePerSecond).AmperesPerSecond, AmperesPerSecondTolerance); } + [Fact] + public void FromAmperesPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperesPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index 593380c1e0..849c84bf48 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class ElectricCurrentTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricCurrent((double)0.0, ElectricCurrentUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrent(double.PositiveInfinity, ElectricCurrentUnit.Ampere)); + Assert.Throws(() => new ElectricCurrent(double.NegativeInfinity, ElectricCurrentUnit.Ampere)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricCurrent(double.NaN, ElectricCurrentUnit.Ampere)); + } + [Fact] public void AmpereToElectricCurrentUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Picoampere).Picoamperes, PicoamperesTolerance); } + [Fact] + public void FromAmperes_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); + Assert.Throws(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperes_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricCurrent.FromAmperes(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index ec025d2ebe..8fd41e31ee 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricFieldTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricField((double)0.0, ElectricFieldUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricField(double.PositiveInfinity, ElectricFieldUnit.VoltPerMeter)); + Assert.Throws(() => new ElectricField(double.NegativeInfinity, ElectricFieldUnit.VoltPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricField(double.NaN, ElectricFieldUnit.VoltPerMeter)); + } + [Fact] public void VoltPerMeterToElectricFieldUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricField.From(1, ElectricFieldUnit.VoltPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); } + [Fact] + public void FromVoltsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index da5260e825..c58c40cac1 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class ElectricInductanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricInductance((double)0.0, ElectricInductanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricInductance(double.PositiveInfinity, ElectricInductanceUnit.Henry)); + Assert.Throws(() => new ElectricInductance(double.NegativeInfinity, ElectricInductanceUnit.Henry)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricInductance(double.NaN, ElectricInductanceUnit.Henry)); + } + [Fact] public void HenryToElectricInductanceUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Henry).Henries, HenriesTolerance); } + [Fact] + public void FromHenries_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricInductance.FromHenries(double.PositiveInfinity)); + Assert.Throws(() => ElectricInductance.FromHenries(double.NegativeInfinity)); + } + + [Fact] + public void FromHenries_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricInductance.FromHenries(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index 6135c12ca4..6b45e51e6c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ElectricPotentialAcTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricPotentialAc((double)0.0, ElectricPotentialAcUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialAc(double.PositiveInfinity, ElectricPotentialAcUnit.VoltAc)); + Assert.Throws(() => new ElectricPotentialAc(double.NegativeInfinity, ElectricPotentialAcUnit.VoltAc)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialAc(double.NaN, ElectricPotentialAcUnit.VoltAc)); + } + [Fact] public void VoltAcToElectricPotentialAcUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.VoltAc).VoltsAc, VoltsAcTolerance); } + [Fact] + public void FromVoltsAc_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltsAc_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index abdb8e516f..173ce57a76 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ElectricPotentialDcTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricPotentialDc((double)0.0, ElectricPotentialDcUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialDc(double.PositiveInfinity, ElectricPotentialDcUnit.VoltDc)); + Assert.Throws(() => new ElectricPotentialDc(double.NegativeInfinity, ElectricPotentialDcUnit.VoltDc)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotentialDc(double.NaN, ElectricPotentialDcUnit.VoltDc)); + } + [Fact] public void VoltDcToElectricPotentialDcUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.VoltDc).VoltsDc, VoltsDcTolerance); } + [Fact] + public void FromVoltsDc_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltsDc_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index ef42925c11..91bfc02e4a 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ElectricPotentialTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricPotential((double)0.0, ElectricPotentialUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotential(double.PositiveInfinity, ElectricPotentialUnit.Volt)); + Assert.Throws(() => new ElectricPotential(double.NegativeInfinity, ElectricPotentialUnit.Volt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricPotential(double.NaN, ElectricPotentialUnit.Volt)); + } + [Fact] public void VoltToElectricPotentialUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Volt).Volts, VoltsTolerance); } + [Fact] + public void FromVolts_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotential.FromVolts(double.PositiveInfinity)); + Assert.Throws(() => ElectricPotential.FromVolts(double.NegativeInfinity)); + } + + [Fact] + public void FromVolts_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricPotential.FromVolts(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index 4ab6ca465b..cc2955db23 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ElectricResistanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricResistance((double)0.0, ElectricResistanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistance(double.PositiveInfinity, ElectricResistanceUnit.Ohm)); + Assert.Throws(() => new ElectricResistance(double.NegativeInfinity, ElectricResistanceUnit.Ohm)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistance(double.NaN, ElectricResistanceUnit.Ohm)); + } + [Fact] public void OhmToElectricResistanceUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Ohm).Ohms, OhmsTolerance); } + [Fact] + public void FromOhms_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistance.FromOhms(double.PositiveInfinity)); + Assert.Throws(() => ElectricResistance.FromOhms(double.NegativeInfinity)); + } + + [Fact] + public void FromOhms_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistance.FromOhms(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index 93f601197c..5e3a728fd1 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ElectricResistivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ElectricResistivity((double)0.0, ElectricResistivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistivity(double.PositiveInfinity, ElectricResistivityUnit.OhmMeter)); + Assert.Throws(() => new ElectricResistivity(double.NegativeInfinity, ElectricResistivityUnit.OhmMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ElectricResistivity(double.NaN, ElectricResistivityUnit.OhmMeter)); + } + [Fact] public void OhmMeterToElectricResistivityUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.OhmMeter).OhmMeters, OhmMetersTolerance); } + [Fact] + public void FromOhmMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.PositiveInfinity)); + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromOhmMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 973c61ae6c..c9d444df67 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -102,11 +102,24 @@ public abstract partial class EnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Energy((double)0.0, EnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Energy(double.PositiveInfinity, EnergyUnit.Joule)); + Assert.Throws(() => new Energy(double.NegativeInfinity, EnergyUnit.Joule)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Energy(double.NaN, EnergyUnit.Joule)); + } + [Fact] public void JouleToEnergyUnits() { @@ -162,6 +175,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.WattHour).WattHours, WattHoursTolerance); } + [Fact] + public void FromJoules_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Energy.FromJoules(double.PositiveInfinity)); + Assert.Throws(() => Energy.FromJoules(double.NegativeInfinity)); + } + + [Fact] + public void FromJoules_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Energy.FromJoules(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index b1e00b640f..0b99099f16 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -72,11 +72,24 @@ public abstract partial class EntropyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Entropy((double)0.0, EntropyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Entropy(double.PositiveInfinity, EntropyUnit.JoulePerKelvin)); + Assert.Throws(() => new Entropy(double.NegativeInfinity, EntropyUnit.JoulePerKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Entropy(double.NaN, EntropyUnit.JoulePerKelvin)); + } + [Fact] public void JoulePerKelvinToEntropyUnits() { @@ -102,6 +115,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.MegajoulePerKelvin).MegajoulesPerKelvin, MegajoulesPerKelvinTolerance); } + [Fact] + public void FromJoulesPerKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.PositiveInfinity)); + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index c87b6b2446..675ee4bfac 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -80,11 +80,24 @@ public abstract partial class ForceChangeRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ForceChangeRate((double)0.0, ForceChangeRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForceChangeRate(double.PositiveInfinity, ForceChangeRateUnit.NewtonPerSecond)); + Assert.Throws(() => new ForceChangeRate(double.NegativeInfinity, ForceChangeRateUnit.NewtonPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForceChangeRate(double.NaN, ForceChangeRateUnit.NewtonPerSecond)); + } + [Fact] public void NewtonPerSecondToForceChangeRateUnits() { @@ -118,6 +131,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); } + [Fact] + public void FromNewtonsPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonsPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index 3971157664..5d06b028f1 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -76,11 +76,24 @@ public abstract partial class ForcePerLengthTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ForcePerLength((double)0.0, ForcePerLengthUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForcePerLength(double.PositiveInfinity, ForcePerLengthUnit.NewtonPerMeter)); + Assert.Throws(() => new ForcePerLength(double.NegativeInfinity, ForcePerLengthUnit.NewtonPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ForcePerLength(double.NaN, ForcePerLengthUnit.NewtonPerMeter)); + } + [Fact] public void NewtonPerMeterToForcePerLengthUnits() { @@ -110,6 +123,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); } + [Fact] + public void FromNewtonsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 6ddcd62956..f2e05bbe08 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -78,11 +78,24 @@ public abstract partial class ForceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Force((double)0.0, ForceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Force(double.PositiveInfinity, ForceUnit.Newton)); + Assert.Throws(() => new Force(double.NegativeInfinity, ForceUnit.Newton)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Force(double.NaN, ForceUnit.Newton)); + } + [Fact] public void NewtonToForceUnits() { @@ -114,6 +127,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.TonneForce).TonnesForce, TonnesForceTolerance); } + [Fact] + public void FromNewtons_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Force.FromNewtons(double.PositiveInfinity)); + Assert.Throws(() => Force.FromNewtons(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtons_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Force.FromNewtons(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index f691f536d3..5c2cdc4e26 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class FrequencyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Frequency((double)0.0, FrequencyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Frequency(double.PositiveInfinity, FrequencyUnit.Hertz)); + Assert.Throws(() => new Frequency(double.NegativeInfinity, FrequencyUnit.Hertz)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Frequency(double.NaN, FrequencyUnit.Hertz)); + } + [Fact] public void HertzToFrequencyUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Terahertz).Terahertz, TerahertzTolerance); } + [Fact] + public void FromHertz_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Frequency.FromHertz(double.PositiveInfinity)); + Assert.Throws(() => Frequency.FromHertz(double.NegativeInfinity)); + } + + [Fact] + public void FromHertz_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Frequency.FromHertz(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index c2af4c817f..b7c744d95c 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -90,11 +90,24 @@ public abstract partial class HeatFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new HeatFlux((double)0.0, HeatFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatFlux(double.PositiveInfinity, HeatFluxUnit.WattPerSquareMeter)); + Assert.Throws(() => new HeatFlux(double.NegativeInfinity, HeatFluxUnit.WattPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatFlux(double.NaN, HeatFluxUnit.WattPerSquareMeter)); + } + [Fact] public void WattPerSquareMeterToHeatFluxUnits() { @@ -138,6 +151,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } + [Fact] + public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index 34b0b8f95a..f94c2693f0 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class HeatTransferCoefficientTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new HeatTransferCoefficient((double)0.0, HeatTransferCoefficientUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatTransferCoefficient(double.PositiveInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + Assert.Throws(() => new HeatTransferCoefficient(double.NegativeInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new HeatTransferCoefficient(double.NaN, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); + } + [Fact] public void WattPerSquareMeterKelvinToHeatTransferCoefficientUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); } + [Fact] + public void FromWattsPerSquareMeterKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.PositiveInfinity)); + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerSquareMeterKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index 1c6f6800ea..22d7ca8dfc 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class IlluminanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Illuminance((double)0.0, IlluminanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Illuminance(double.PositiveInfinity, IlluminanceUnit.Lux)); + Assert.Throws(() => new Illuminance(double.NegativeInfinity, IlluminanceUnit.Lux)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Illuminance(double.NaN, IlluminanceUnit.Lux)); + } + [Fact] public void LuxToIlluminanceUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Millilux).Millilux, MilliluxTolerance); } + [Fact] + public void FromLux_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Illuminance.FromLux(double.PositiveInfinity)); + Assert.Throws(() => Illuminance.FromLux(double.NegativeInfinity)); + } + + [Fact] + public void FromLux_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Illuminance.FromLux(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 421a6f0a72..c4278ad1c4 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -110,11 +110,12 @@ public abstract partial class InformationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Information((decimal)0.0, InformationUnit.Undefined)); } + [Fact] public void BitToInformationUnits() { @@ -178,6 +179,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Information.From(1, InformationUnit.Terabyte).Terabytes, TerabytesTolerance); } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index 02d02ab401..9a934b5337 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class IrradianceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Irradiance((double)0.0, IrradianceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiance(double.PositiveInfinity, IrradianceUnit.WattPerSquareMeter)); + Assert.Throws(() => new Irradiance(double.NegativeInfinity, IrradianceUnit.WattPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiance(double.NaN, IrradianceUnit.WattPerSquareMeter)); + } + [Fact] public void WattPerSquareMeterToIrradianceUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); } + [Fact] + public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index 9ca8965d52..f78cce335b 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class IrradiationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Irradiation((double)0.0, IrradiationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiation(double.PositiveInfinity, IrradiationUnit.JoulePerSquareMeter)); + Assert.Throws(() => new Irradiation(double.NegativeInfinity, IrradiationUnit.JoulePerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Irradiation(double.NaN, IrradiationUnit.JoulePerSquareMeter)); + } + [Fact] public void JoulePerSquareMeterToIrradiationUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.WattHourPerSquareMeter).WattHoursPerSquareMeter, WattHoursPerSquareMeterTolerance); } + [Fact] + public void FromJoulesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 92f9a6a96d..84360b2c9f 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class KinematicViscosityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new KinematicViscosity((double)0.0, KinematicViscosityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new KinematicViscosity(double.PositiveInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + Assert.Throws(() => new KinematicViscosity(double.NegativeInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new KinematicViscosity(double.NaN, KinematicViscosityUnit.SquareMeterPerSecond)); + } + [Fact] public void SquareMeterPerSecondToKinematicViscosityUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Stokes).Stokes, StokesTolerance); } + [Fact] + public void FromSquareMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromSquareMetersPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 41a859da8e..452f0871cf 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class LapseRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LapseRate((double)0.0, LapseRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LapseRate(double.PositiveInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); + Assert.Throws(() => new LapseRate(double.NegativeInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LapseRate(double.NaN, LapseRateUnit.DegreeCelsiusPerKilometer)); + } + [Fact] public void DegreeCelsiusPerKilometerToLapseRateUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LapseRate.From(1, LapseRateUnit.DegreeCelsiusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); } + [Fact] + public void FromDegreesCelciusPerKilometer_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.PositiveInfinity)); + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NegativeInfinity)); + } + + [Fact] + public void FromDegreesCelciusPerKilometer_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index a758944098..49991bdce6 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -102,11 +102,24 @@ public abstract partial class LengthTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Length((double)0.0, LengthUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Length(double.PositiveInfinity, LengthUnit.Meter)); + Assert.Throws(() => new Length(double.NegativeInfinity, LengthUnit.Meter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Length(double.NaN, LengthUnit.Meter)); + } + [Fact] public void MeterToLengthUnits() { @@ -162,6 +175,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Length.From(1, LengthUnit.Yard).Yards, YardsTolerance); } + [Fact] + public void FromMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Length.FromMeters(double.PositiveInfinity)); + Assert.Throws(() => Length.FromMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Length.FromMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 9e936cd71b..5dbdf5b200 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class LevelTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Level((double)0.0, LevelUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Level(double.PositiveInfinity, LevelUnit.Decibel)); + Assert.Throws(() => new Level(double.NegativeInfinity, LevelUnit.Decibel)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Level(double.NaN, LevelUnit.Decibel)); + } + [Fact] public void DecibelToLevelUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Level.From(1, LevelUnit.Neper).Nepers, NepersTolerance); } + [Fact] + public void FromDecibels_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Level.FromDecibels(double.PositiveInfinity)); + Assert.Throws(() => Level.FromDecibels(double.NegativeInfinity)); + } + + [Fact] + public void FromDecibels_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Level.FromDecibels(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index 42d59694cc..5008bfd430 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class LinearDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LinearDensity((double)0.0, LinearDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LinearDensity(double.PositiveInfinity, LinearDensityUnit.KilogramPerMeter)); + Assert.Throws(() => new LinearDensity(double.NegativeInfinity, LinearDensityUnit.KilogramPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LinearDensity(double.NaN, LinearDensityUnit.KilogramPerMeter)); + } + [Fact] public void KilogramPerMeterToLinearDensityUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.PoundPerFoot).PoundsPerFoot, PoundsPerFootTolerance); } + [Fact] + public void FromKilogramsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index 0e7f2ffc33..e8a1ab1366 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class LuminousFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LuminousFlux((double)0.0, LuminousFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousFlux(double.PositiveInfinity, LuminousFluxUnit.Lumen)); + Assert.Throws(() => new LuminousFlux(double.NegativeInfinity, LuminousFluxUnit.Lumen)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousFlux(double.NaN, LuminousFluxUnit.Lumen)); + } + [Fact] public void LumenToLuminousFluxUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LuminousFlux.From(1, LuminousFluxUnit.Lumen).Lumens, LumensTolerance); } + [Fact] + public void FromLumens_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousFlux.FromLumens(double.PositiveInfinity)); + Assert.Throws(() => LuminousFlux.FromLumens(double.NegativeInfinity)); + } + + [Fact] + public void FromLumens_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousFlux.FromLumens(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index 291b37b47f..b9fb9c5467 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class LuminousIntensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new LuminousIntensity((double)0.0, LuminousIntensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousIntensity(double.PositiveInfinity, LuminousIntensityUnit.Candela)); + Assert.Throws(() => new LuminousIntensity(double.NegativeInfinity, LuminousIntensityUnit.Candela)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new LuminousIntensity(double.NaN, LuminousIntensityUnit.Candela)); + } + [Fact] public void CandelaToLuminousIntensityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, LuminousIntensity.From(1, LuminousIntensityUnit.Candela).Candela, CandelaTolerance); } + [Fact] + public void FromCandela_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousIntensity.FromCandela(double.PositiveInfinity)); + Assert.Throws(() => LuminousIntensity.FromCandela(double.NegativeInfinity)); + } + + [Fact] + public void FromCandela_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => LuminousIntensity.FromCandela(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index 28eba96a39..0d6062b97e 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class MagneticFieldTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MagneticField((double)0.0, MagneticFieldUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticField(double.PositiveInfinity, MagneticFieldUnit.Tesla)); + Assert.Throws(() => new MagneticField(double.NegativeInfinity, MagneticFieldUnit.Tesla)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticField(double.NaN, MagneticFieldUnit.Tesla)); + } + [Fact] public void TeslaToMagneticFieldUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Tesla).Teslas, TeslasTolerance); } + [Fact] + public void FromTeslas_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticField.FromTeslas(double.PositiveInfinity)); + Assert.Throws(() => MagneticField.FromTeslas(double.NegativeInfinity)); + } + + [Fact] + public void FromTeslas_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticField.FromTeslas(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index ef47677788..be8ee57bee 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class MagneticFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MagneticFlux((double)0.0, MagneticFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticFlux(double.PositiveInfinity, MagneticFluxUnit.Weber)); + Assert.Throws(() => new MagneticFlux(double.NegativeInfinity, MagneticFluxUnit.Weber)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MagneticFlux(double.NaN, MagneticFluxUnit.Weber)); + } + [Fact] public void WeberToMagneticFluxUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MagneticFlux.From(1, MagneticFluxUnit.Weber).Webers, WebersTolerance); } + [Fact] + public void FromWebers_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticFlux.FromWebers(double.PositiveInfinity)); + Assert.Throws(() => MagneticFlux.FromWebers(double.NegativeInfinity)); + } + + [Fact] + public void FromWebers_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MagneticFlux.FromWebers(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index f2cf6b5e78..d22a725500 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class MagnetizationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Magnetization((double)0.0, MagnetizationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Magnetization(double.PositiveInfinity, MagnetizationUnit.AmperePerMeter)); + Assert.Throws(() => new Magnetization(double.NegativeInfinity, MagnetizationUnit.AmperePerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Magnetization(double.NaN, MagnetizationUnit.AmperePerMeter)); + } + [Fact] public void AmperePerMeterToMagnetizationUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Magnetization.From(1, MagnetizationUnit.AmperePerMeter).AmperesPerMeter, AmperesPerMeterTolerance); } + [Fact] + public void FromAmperesPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromAmperesPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 072cd491cd..2643a81f73 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -88,11 +88,24 @@ public abstract partial class MassFlowTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MassFlow((double)0.0, MassFlowUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlow(double.PositiveInfinity, MassFlowUnit.GramPerSecond)); + Assert.Throws(() => new MassFlow(double.NegativeInfinity, MassFlowUnit.GramPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlow(double.NaN, MassFlowUnit.GramPerSecond)); + } + [Fact] public void GramPerSecondToMassFlowUnits() { @@ -134,6 +147,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerHour).TonnesPerHour, TonnesPerHourTolerance); } + [Fact] + public void FromGramsPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromGramsPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index 2f4868ad6c..a80ad1086d 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class MassFluxTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MassFlux((double)0.0, MassFluxUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlux(double.PositiveInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + Assert.Throws(() => new MassFlux(double.NegativeInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassFlux(double.NaN, MassFluxUnit.KilogramPerSecondPerSquareMeter)); + } + [Fact] public void KilogramPerSecondPerSquareMeterToMassFluxUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.KilogramPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); } + [Fact] + public void FromKilogramsPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.PositiveInfinity)); + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index 8177a148a0..a1001c2cf4 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -110,11 +110,24 @@ public abstract partial class MassMomentOfInertiaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MassMomentOfInertia((double)0.0, MassMomentOfInertiaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassMomentOfInertia(double.PositiveInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + Assert.Throws(() => new MassMomentOfInertia(double.NegativeInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MassMomentOfInertia(double.NaN, MassMomentOfInertiaUnit.KilogramSquareMeter)); + } + [Fact] public void KilogramSquareMeterToMassMomentOfInertiaUnits() { @@ -178,6 +191,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMilimeter).TonneSquareMilimeters, TonneSquareMilimetersTolerance); } + [Fact] + public void FromKilogramSquareMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.PositiveInfinity)); + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramSquareMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index 03d53b92f2..e9fef6fe84 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -100,11 +100,24 @@ public abstract partial class MassTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Mass((double)0.0, MassUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Mass(double.PositiveInfinity, MassUnit.Kilogram)); + Assert.Throws(() => new Mass(double.NegativeInfinity, MassUnit.Kilogram)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Mass(double.NaN, MassUnit.Kilogram)); + } + [Fact] public void KilogramToMassUnits() { @@ -158,6 +171,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Tonne).Tonnes, TonnesTolerance); } + [Fact] + public void FromKilograms_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Mass.FromKilograms(double.PositiveInfinity)); + Assert.Throws(() => Mass.FromKilograms(double.NegativeInfinity)); + } + + [Fact] + public void FromKilograms_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Mass.FromKilograms(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index 63fdc2a981..1da87494a1 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class MolarEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MolarEnergy((double)0.0, MolarEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEnergy(double.PositiveInfinity, MolarEnergyUnit.JoulePerMole)); + Assert.Throws(() => new MolarEnergy(double.NegativeInfinity, MolarEnergyUnit.JoulePerMole)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEnergy(double.NaN, MolarEnergyUnit.JoulePerMole)); + } + [Fact] public void JoulePerMoleToMolarEnergyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.MegajoulePerMole).MegajoulesPerMole, MegajoulesPerMoleTolerance); } + [Fact] + public void FromJoulesPerMole_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerMole_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index 1fc4cbf18e..0d55e75664 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class MolarEntropyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MolarEntropy((double)0.0, MolarEntropyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEntropy(double.PositiveInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + Assert.Throws(() => new MolarEntropy(double.NegativeInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin)); + } + [Fact] public void JoulePerMoleKelvinToMolarEntropyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.MegajoulePerMoleKelvin).MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); } + [Fact] + public void FromJoulesPerMoleKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerMoleKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index 2816dbc406..bb35d0fdb5 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -82,11 +82,24 @@ public abstract partial class MolarMassTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new MolarMass((double)0.0, MolarMassUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarMass(double.PositiveInfinity, MolarMassUnit.KilogramPerMole)); + Assert.Throws(() => new MolarMass(double.NegativeInfinity, MolarMassUnit.KilogramPerMole)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new MolarMass(double.NaN, MolarMassUnit.KilogramPerMole)); + } + [Fact] public void KilogramPerMoleToMolarMassUnits() { @@ -122,6 +135,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.PoundPerMole).PoundsPerMole, PoundsPerMoleTolerance); } + [Fact] + public void FromKilogramsPerMole_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.PositiveInfinity)); + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NegativeInfinity)); + } + + [Fact] + public void FromKilogramsPerMole_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index 05fbb01ed6..fd08d90e38 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class MolarityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Molarity((double)0.0, MolarityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Molarity(double.PositiveInfinity, MolarityUnit.MolesPerCubicMeter)); + Assert.Throws(() => new Molarity(double.NegativeInfinity, MolarityUnit.MolesPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Molarity(double.NaN, MolarityUnit.MolesPerCubicMeter)); + } + [Fact] public void MolesPerCubicMeterToMolarityUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.PicomolesPerLiter).PicomolesPerLiter, PicomolesPerLiterTolerance); } + [Fact] + public void FromMolesPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromMolesPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index 4891e3888d..ea63a72d15 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class PermeabilityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Permeability((double)0.0, PermeabilityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permeability(double.PositiveInfinity, PermeabilityUnit.HenryPerMeter)); + Assert.Throws(() => new Permeability(double.NegativeInfinity, PermeabilityUnit.HenryPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permeability(double.NaN, PermeabilityUnit.HenryPerMeter)); + } + [Fact] public void HenryPerMeterToPermeabilityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Permeability.From(1, PermeabilityUnit.HenryPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); } + [Fact] + public void FromHenriesPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromHenriesPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index 43a78f4d07..b49b0cc95a 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class PermittivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Permittivity((double)0.0, PermittivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permittivity(double.PositiveInfinity, PermittivityUnit.FaradPerMeter)); + Assert.Throws(() => new Permittivity(double.NegativeInfinity, PermittivityUnit.FaradPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Permittivity(double.NaN, PermittivityUnit.FaradPerMeter)); + } + [Fact] public void FaradPerMeterToPermittivityUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Permittivity.From(1, PermittivityUnit.FaradPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); } + [Fact] + public void FromFaradsPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.PositiveInfinity)); + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromFaradsPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 814290401b..426bced7ce 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -146,11 +146,24 @@ public abstract partial class PowerDensityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new PowerDensity((double)0.0, PowerDensityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerDensity(double.PositiveInfinity, PowerDensityUnit.WattPerCubicMeter)); + Assert.Throws(() => new PowerDensity(double.NegativeInfinity, PowerDensityUnit.WattPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerDensity(double.NaN, PowerDensityUnit.WattPerCubicMeter)); + } + [Fact] public void WattPerCubicMeterToPowerDensityUnits() { @@ -250,6 +263,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerLiter).WattsPerLiter, WattsPerLiterTolerance); } + [Fact] + public void FromWattsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index d680f2a4be..ffffca4554 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class PowerRatioTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new PowerRatio((double)0.0, PowerRatioUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerRatio(double.PositiveInfinity, PowerRatioUnit.DecibelWatt)); + Assert.Throws(() => new PowerRatio(double.NegativeInfinity, PowerRatioUnit.DecibelWatt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new PowerRatio(double.NaN, PowerRatioUnit.DecibelWatt)); + } + [Fact] public void DecibelWattToPowerRatioUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelWatt).DecibelWatts, DecibelWattsTolerance); } + [Fact] + public void FromDecibelWatts_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.PositiveInfinity)); + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NegativeInfinity)); + } + + [Fact] + public void FromDecibelWatts_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index e8a5d7314b..54ccd97f4d 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -98,11 +98,12 @@ public abstract partial class PowerTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Power((decimal)0.0, PowerUnit.Undefined)); } + [Fact] public void WattToPowerUnits() { @@ -154,6 +155,7 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Watt).Watts, WattsTolerance); } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index 709037cb5b..6e07c3765c 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class PressureChangeRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new PressureChangeRate((double)0.0, PressureChangeRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new PressureChangeRate(double.PositiveInfinity, PressureChangeRateUnit.PascalPerSecond)); + Assert.Throws(() => new PressureChangeRate(double.NegativeInfinity, PressureChangeRateUnit.PascalPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new PressureChangeRate(double.NaN, PressureChangeRateUnit.PascalPerSecond)); + } + [Fact] public void PascalPerSecondToPressureChangeRateUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.PascalPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); } + [Fact] + public void FromPascalsPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.PositiveInfinity)); + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromPascalsPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index 3272a3b016..88357133c9 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -132,11 +132,24 @@ public abstract partial class PressureTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Pressure((double)0.0, PressureUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Pressure(double.PositiveInfinity, PressureUnit.Pascal)); + Assert.Throws(() => new Pressure(double.NegativeInfinity, PressureUnit.Pascal)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Pressure(double.NaN, PressureUnit.Pascal)); + } + [Fact] public void PascalToPressureUnits() { @@ -222,6 +235,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Torr).Torrs, TorrsTolerance); } + [Fact] + public void FromPascals_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Pressure.FromPascals(double.PositiveInfinity)); + Assert.Throws(() => Pressure.FromPascals(double.NegativeInfinity)); + } + + [Fact] + public void FromPascals_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Pressure.FromPascals(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index eb06b07354..1fe1c27335 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -70,11 +70,24 @@ public abstract partial class RatioTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Ratio((double)0.0, RatioUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Ratio(double.PositiveInfinity, RatioUnit.DecimalFraction)); + Assert.Throws(() => new Ratio(double.NegativeInfinity, RatioUnit.DecimalFraction)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Ratio(double.NaN, RatioUnit.DecimalFraction)); + } + [Fact] public void DecimalFractionToRatioUnits() { @@ -98,6 +111,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.Percent).Percent, PercentTolerance); } + [Fact] + public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Ratio.FromDecimalFractions(double.PositiveInfinity)); + Assert.Throws(() => Ratio.FromDecimalFractions(double.NegativeInfinity)); + } + + [Fact] + public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Ratio.FromDecimalFractions(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index 576d61d7d8..80e88fcc3c 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class ReactiveEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ReactiveEnergy((double)0.0, ReactiveEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactiveEnergy(double.PositiveInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + Assert.Throws(() => new ReactiveEnergy(double.NegativeInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactiveEnergy(double.NaN, ReactiveEnergyUnit.VoltampereReactiveHour)); + } + [Fact] public void VoltampereReactiveHourToReactiveEnergyUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.VoltampereReactiveHour).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); } + [Fact] + public void FromVoltampereReactiveHours_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.PositiveInfinity)); + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltampereReactiveHours_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index 4d148a5aea..7b4aa25e4e 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -66,11 +66,24 @@ public abstract partial class ReactivePowerTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ReactivePower((double)0.0, ReactivePowerUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactivePower(double.PositiveInfinity, ReactivePowerUnit.VoltampereReactive)); + Assert.Throws(() => new ReactivePower(double.NegativeInfinity, ReactivePowerUnit.VoltampereReactive)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ReactivePower(double.NaN, ReactivePowerUnit.VoltampereReactive)); + } + [Fact] public void VoltampereReactiveToReactivePowerUnits() { @@ -90,6 +103,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.VoltampereReactive).VoltamperesReactive, VoltamperesReactiveTolerance); } + [Fact] + public void FromVoltamperesReactive_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity)); + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity)); + } + + [Fact] + public void FromVoltamperesReactive_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index 8fdfcf9640..7f6a67fba4 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class RotationalAccelerationTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalAcceleration((double)0.0, RotationalAccelerationUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalAcceleration(double.PositiveInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + Assert.Throws(() => new RotationalAcceleration(double.NegativeInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalAcceleration(double.NaN, RotationalAccelerationUnit.RadianPerSecondSquared)); + } + [Fact] public void RadianPerSecondSquaredToRotationalAccelerationUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RevolutionPerMinutePerSecond).RevolutionsPerMinutePerSecond, RevolutionsPerMinutePerSecondTolerance); } + [Fact] + public void FromRadiansPerSecondSquared_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity)); + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity)); + } + + [Fact] + public void FromRadiansPerSecondSquared_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index 4da0c2a40f..4fa2fb3306 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -84,11 +84,24 @@ public abstract partial class RotationalSpeedTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalSpeed((double)0.0, RotationalSpeedUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalSpeed(double.PositiveInfinity, RotationalSpeedUnit.RadianPerSecond)); + Assert.Throws(() => new RotationalSpeed(double.NegativeInfinity, RotationalSpeedUnit.RadianPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalSpeed(double.NaN, RotationalSpeedUnit.RadianPerSecond)); + } + [Fact] public void RadianPerSecondToRotationalSpeedUnits() { @@ -126,6 +139,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerSecond).RevolutionsPerSecond, RevolutionsPerSecondTolerance); } + [Fact] + public void FromRadiansPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.PositiveInfinity)); + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromRadiansPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 6ddb83a45d..6cc08e489b 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class RotationalStiffnessPerLengthTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalStiffnessPerLength((double)0.0, RotationalStiffnessPerLengthUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffnessPerLength(double.PositiveInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + Assert.Throws(() => new RotationalStiffnessPerLength(double.NegativeInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffnessPerLength(double.NaN, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); + } + [Fact] public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); } + [Fact] + public void FromNewtonMetersPerRadianPerMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.PositiveInfinity)); + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonMetersPerRadianPerMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index f780416a16..d8f7be14f2 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -64,11 +64,24 @@ public abstract partial class RotationalStiffnessTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new RotationalStiffness((double)0.0, RotationalStiffnessUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffness(double.PositiveInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + Assert.Throws(() => new RotationalStiffness(double.NegativeInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new RotationalStiffness(double.NaN, RotationalStiffnessUnit.NewtonMeterPerRadian)); + } + [Fact] public void NewtonMeterPerRadianToRotationalStiffnessUnits() { @@ -86,6 +99,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.NewtonMeterPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); } + [Fact] + public void FromNewtonMetersPerRadian_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.PositiveInfinity)); + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonMetersPerRadian_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index fd7eaa5e7e..874043dcad 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class SolidAngleTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SolidAngle((double)0.0, SolidAngleUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SolidAngle(double.PositiveInfinity, SolidAngleUnit.Steradian)); + Assert.Throws(() => new SolidAngle(double.NegativeInfinity, SolidAngleUnit.Steradian)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SolidAngle(double.NaN, SolidAngleUnit.Steradian)); + } + [Fact] public void SteradianToSolidAngleUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SolidAngle.From(1, SolidAngleUnit.Steradian).Steradians, SteradiansTolerance); } + [Fact] + public void FromSteradians_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SolidAngle.FromSteradians(double.PositiveInfinity)); + Assert.Throws(() => SolidAngle.FromSteradians(double.NegativeInfinity)); + } + + [Fact] + public void FromSteradians_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SolidAngle.FromSteradians(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index 46c74ab544..f0971fb50c 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class SpecificEnergyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificEnergy((double)0.0, SpecificEnergyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEnergy(double.PositiveInfinity, SpecificEnergyUnit.JoulePerKilogram)); + Assert.Throws(() => new SpecificEnergy(double.NegativeInfinity, SpecificEnergyUnit.JoulePerKilogram)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEnergy(double.NaN, SpecificEnergyUnit.JoulePerKilogram)); + } + [Fact] public void JoulePerKilogramToSpecificEnergyUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.WattHourPerKilogram).WattHoursPerKilogram, WattHoursPerKilogramTolerance); } + [Fact] + public void FromJoulesPerKilogram_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.PositiveInfinity)); + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerKilogram_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 824d0434ff..45608cd8b2 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class SpecificEntropyTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificEntropy((double)0.0, SpecificEntropyUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEntropy(double.PositiveInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + Assert.Throws(() => new SpecificEntropy(double.NegativeInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificEntropy(double.NaN, SpecificEntropyUnit.JoulePerKilogramKelvin)); + } + [Fact] public void JoulePerKilogramKelvinToSpecificEntropyUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramKelvin).MegajoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); } + [Fact] + public void FromJoulesPerKilogramKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.PositiveInfinity)); + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerKilogramKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 9b0c7d3f3a..0229fb2026 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class SpecificVolumeTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificVolume((double)0.0, SpecificVolumeUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificVolume(double.PositiveInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + Assert.Throws(() => new SpecificVolume(double.NegativeInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificVolume(double.NaN, SpecificVolumeUnit.CubicMeterPerKilogram)); + } + [Fact] public void CubicMeterPerKilogramToSpecificVolumeUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicMeterPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); } + [Fact] + public void FromCubicMetersPerKilogram_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.PositiveInfinity)); + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NegativeInfinity)); + } + + [Fact] + public void FromCubicMetersPerKilogram_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index 2a1e87bdf5..c0711185df 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -92,11 +92,24 @@ public abstract partial class SpecificWeightTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new SpecificWeight((double)0.0, SpecificWeightUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificWeight(double.PositiveInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + Assert.Throws(() => new SpecificWeight(double.NegativeInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new SpecificWeight(double.NaN, SpecificWeightUnit.NewtonPerCubicMeter)); + } + [Fact] public void NewtonPerCubicMeterToSpecificWeightUnits() { @@ -142,6 +155,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMillimeter).TonnesForcePerCubicMillimeter, TonnesForcePerCubicMillimeterTolerance); } + [Fact] + public void FromNewtonsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.PositiveInfinity)); + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonsPerCubicMeter_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index 186d6cd018..fc710bd753 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -122,11 +122,24 @@ public abstract partial class SpeedTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Speed((double)0.0, SpeedUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Speed(double.PositiveInfinity, SpeedUnit.MeterPerSecond)); + Assert.Throws(() => new Speed(double.NegativeInfinity, SpeedUnit.MeterPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Speed(double.NaN, SpeedUnit.MeterPerSecond)); + } + [Fact] public void MeterPerSecondToSpeedUnits() { @@ -202,6 +215,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerSecond).YardsPerSecond, YardsPerSecondTolerance); } + [Fact] + public void FromMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Speed.FromMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => Speed.FromMetersPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromMetersPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Speed.FromMetersPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index 7d5e999225..b67ce8681e 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -78,11 +78,24 @@ public abstract partial class TemperatureChangeRateTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new TemperatureChangeRate((double)0.0, TemperatureChangeRateUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureChangeRate(double.PositiveInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + Assert.Throws(() => new TemperatureChangeRate(double.NegativeInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureChangeRate(double.NaN, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); + } + [Fact] public void DegreeCelsiusPerSecondToTemperatureChangeRateUnits() { @@ -114,6 +127,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond).NanodegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); } + [Fact] + public void FromDegreesCelsiusPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.PositiveInfinity)); + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromDegreesCelsiusPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index 3266bb7e50..2328b0d091 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class TemperatureDeltaTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new TemperatureDelta((double)0.0, TemperatureDeltaUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureDelta(double.PositiveInfinity, TemperatureDeltaUnit.Kelvin)); + Assert.Throws(() => new TemperatureDelta(double.NegativeInfinity, TemperatureDeltaUnit.Kelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new TemperatureDelta(double.NaN, TemperatureDeltaUnit.Kelvin)); + } + [Fact] public void KelvinToTemperatureDeltaUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance); } + [Fact] + public void FromKelvins_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureDelta.FromKelvins(double.PositiveInfinity)); + Assert.Throws(() => TemperatureDelta.FromKelvins(double.NegativeInfinity)); + } + + [Fact] + public void FromKelvins_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => TemperatureDelta.FromKelvins(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 4c2bf7e7db..47bd0cd872 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -74,11 +74,24 @@ public abstract partial class TemperatureTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Temperature((double)0.0, TemperatureUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Temperature(double.PositiveInfinity, TemperatureUnit.Kelvin)); + Assert.Throws(() => new Temperature(double.NegativeInfinity, TemperatureUnit.Kelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Temperature(double.NaN, TemperatureUnit.Kelvin)); + } + [Fact] public void KelvinToTemperatureUnits() { @@ -106,6 +119,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.Kelvin).Kelvins, KelvinsTolerance); } + [Fact] + public void FromKelvins_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Temperature.FromKelvins(double.PositiveInfinity)); + Assert.Throws(() => Temperature.FromKelvins(double.NegativeInfinity)); + } + + [Fact] + public void FromKelvins_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Temperature.FromKelvins(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index 83373ac345..d592216369 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -62,11 +62,24 @@ public abstract partial class ThermalConductivityTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ThermalConductivity((double)0.0, ThermalConductivityUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalConductivity(double.PositiveInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + Assert.Throws(() => new ThermalConductivity(double.NegativeInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalConductivity(double.NaN, ThermalConductivityUnit.WattPerMeterKelvin)); + } + [Fact] public void WattPerMeterKelvinToThermalConductivityUnits() { @@ -82,6 +95,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.WattPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); } + [Fact] + public void FromWattsPerMeterKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.PositiveInfinity)); + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromWattsPerMeterKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index c9402bb963..9119cb1719 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -68,11 +68,24 @@ public abstract partial class ThermalResistanceTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new ThermalResistance((double)0.0, ThermalResistanceUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalResistance(double.PositiveInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + Assert.Throws(() => new ThermalResistance(double.NegativeInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new ThermalResistance(double.NaN, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); + } + [Fact] public void SquareMeterKelvinPerKilowattToThermalResistanceUnits() { @@ -94,6 +107,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); } + [Fact] + public void FromSquareMeterKelvinsPerKilowatt_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.PositiveInfinity)); + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NegativeInfinity)); + } + + [Fact] + public void FromSquareMeterKelvinsPerKilowatt_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index e698b9395d..b1ae59349f 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -100,11 +100,24 @@ public abstract partial class TorqueTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Torque((double)0.0, TorqueUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Torque(double.PositiveInfinity, TorqueUnit.NewtonMeter)); + Assert.Throws(() => new Torque(double.NegativeInfinity, TorqueUnit.NewtonMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Torque(double.NaN, TorqueUnit.NewtonMeter)); + } + [Fact] public void NewtonMeterToTorqueUnits() { @@ -158,6 +171,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMillimeter).TonneForceMillimeters, TonneForceMillimetersTolerance); } + [Fact] + public void FromNewtonMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Torque.FromNewtonMeters(double.PositiveInfinity)); + Assert.Throws(() => Torque.FromNewtonMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromNewtonMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Torque.FromNewtonMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index d3c8577c7c..e1fc3be467 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -60,11 +60,24 @@ public abstract partial class VitaminATestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new VitaminA((double)0.0, VitaminAUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new VitaminA(double.PositiveInfinity, VitaminAUnit.InternationalUnit)); + Assert.Throws(() => new VitaminA(double.NegativeInfinity, VitaminAUnit.InternationalUnit)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new VitaminA(double.NaN, VitaminAUnit.InternationalUnit)); + } + [Fact] public void InternationalUnitToVitaminAUnits() { @@ -78,6 +91,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, VitaminA.From(1, VitaminAUnit.InternationalUnit).InternationalUnits, InternationalUnitsTolerance); } + [Fact] + public void FromInternationalUnits_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => VitaminA.FromInternationalUnits(double.PositiveInfinity)); + Assert.Throws(() => VitaminA.FromInternationalUnits(double.NegativeInfinity)); + } + + [Fact] + public void FromInternationalUnits_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => VitaminA.FromInternationalUnits(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index bd35c2aed0..d12c99c555 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -110,11 +110,24 @@ public abstract partial class VolumeFlowTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new VolumeFlow((double)0.0, VolumeFlowUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new VolumeFlow(double.PositiveInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + Assert.Throws(() => new VolumeFlow(double.NegativeInfinity, VolumeFlowUnit.CubicMeterPerSecond)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new VolumeFlow(double.NaN, VolumeFlowUnit.CubicMeterPerSecond)); + } + [Fact] public void CubicMeterPerSecondToVolumeFlowUnits() { @@ -178,6 +191,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); } + [Fact] + public void FromCubicMetersPerSecond_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.PositiveInfinity)); + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NegativeInfinity)); + } + + [Fact] + public void FromCubicMetersPerSecond_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 572660d5ae..d4bdc9c534 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -142,11 +142,24 @@ public abstract partial class VolumeTestsBase // ReSharper restore VirtualMemberNeverOverriden.Global [Fact] - public void ConstructorWithUndefinedUnitThrowsArgumentException() + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { Assert.Throws(() => new Volume((double)0.0, VolumeUnit.Undefined)); } + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new Volume(double.PositiveInfinity, VolumeUnit.CubicMeter)); + Assert.Throws(() => new Volume(double.NegativeInfinity, VolumeUnit.CubicMeter)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new Volume(double.NaN, VolumeUnit.CubicMeter)); + } + [Fact] public void CubicMeterToVolumeUnits() { @@ -242,6 +255,19 @@ public void FromValueAndUnit() AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTeaspoon).UsTeaspoons, UsTeaspoonsTolerance); } + [Fact] + public void FromCubicMeters_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => Volume.FromCubicMeters(double.PositiveInfinity)); + Assert.Throws(() => Volume.FromCubicMeters(double.NegativeInfinity)); + } + + [Fact] + public void FromCubicMeters_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => Volume.FromCubicMeters(double.NaN)); + } + [Fact] public void As() { diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index 3a040d7343..002c691134 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -277,7 +277,7 @@ public void ShouldUseCorrectMicroSign() Assert.Equal(VolumeUnit.CubicMicrometer, Volume.ParseUnit("\u00b5m³")); Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, VolumeFlow.ParseUnit("\u00b5LPM")); - // "\u03bc" = Lower case greek letter 'Mu' + // "\u03bc" = Lower case greek letter 'Mu' Assert.Throws(() => Acceleration.ParseUnit("\u03bcm/s²")); Assert.Throws(() => AmplitudeRatio.ParseUnit("dB\u03bcV")); Assert.Throws(() => Angle.ParseUnit("\u03bc°")); @@ -328,7 +328,7 @@ public void AllUnitAbbreviationsImplemented(string cultureName) .ToList(); // We want to flag if any localizations are missing, but not break the build - // or flag an error for pull requests. For now they are not considered + // or flag an error for pull requests. For now they are not considered // critical and it is cumbersome to have a third person review the pull request // and add in any translations before merging it in. if (unitValuesMissingAbbreviations.Any()) @@ -410,7 +410,7 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() CultureInfo oldCurrentCulture = CultureInfo.CurrentCulture; CultureInfo oldCurrentUICulture = CultureInfo.CurrentUICulture; - try + try { // CurrentCulture affects number formatting, such as comma or dot as decimal separator. // CurrentUICulture affects localization, in this case the abbreviation. @@ -428,7 +428,7 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() // Assert Assert.Equal("US english abbreviation for Unit1", abbreviation); } - finally + finally { CultureInfo.CurrentCulture = oldCurrentCulture; CultureInfo.CurrentUICulture = oldCurrentUICulture; @@ -444,18 +444,6 @@ public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviati Assert.Equal("m²", unitSystem.GetDefaultAbbreviation(AreaUnit.SquareMeter)); } - [Fact] - public void NegativeInfinityFormatting() - { - Assert.Equal("-Infinity m", Length.FromMeters(double.NegativeInfinity).ToString(LengthUnit.Meter, CultureInfo.InvariantCulture)); - } - - [Fact] - public void NotANumberFormatting() - { - Assert.Equal("NaN m", Length.FromMeters(double.NaN).ToString()); - } - [Fact] public void Parse_AmbiguousUnitsThrowsException() { @@ -480,12 +468,6 @@ public void Parse_UnambiguousUnitsDoesNotThrow() Assert.Equal(Volume.FromLiters(1), unit); } - [Fact] - public void PositiveInfinityFormatting() - { - Assert.Equal("Infinity m", Length.FromMeters(double.PositiveInfinity).ToString(LengthUnit.Meter, CultureInfo.InvariantCulture)); - } - /// /// Convenience method to the proper culture parameter type. /// diff --git a/UnitsNet/InternalHelpers/Guard.cs b/UnitsNet/InternalHelpers/Guard.cs index 37ee49b96a..9a30d55ecc 100644 --- a/UnitsNet/InternalHelpers/Guard.cs +++ b/UnitsNet/InternalHelpers/Guard.cs @@ -29,9 +29,18 @@ namespace UnitsNet.InternalHelpers /// internal static class Guard { - internal static double EnsureNotNaN(double value, [InvokerParameterName] string paramName) + /// + /// Throws if value is , + /// or . + /// + /// The value to check. + /// Name of parameter in calling method. + /// The given if valid. + /// If is invalid. + internal static double EnsureValidNumber(double value, [InvokerParameterName] string paramName) { - if (double.IsNaN(value)) throw new ArgumentException("'NaN' is not a valid number.", paramName); + if (double.IsNaN(value)) throw new ArgumentException("NaN is not a valid number.", paramName); + if (double.IsInfinity(value)) throw new ArgumentException("PositiveInfinity or NegativeInfinity is not a valid number.", paramName); return value; } } diff --git a/UnitsNet/QuantityValue.cs b/UnitsNet/QuantityValue.cs index 793f5ad653..2838e37c50 100644 --- a/UnitsNet/QuantityValue.cs +++ b/UnitsNet/QuantityValue.cs @@ -57,7 +57,7 @@ public struct QuantityValue private QuantityValue(double val) { - _value = Guard.EnsureNotNaN(val, nameof(val)); + _value = Guard.EnsureValidNumber(val, nameof(val)); _valueDecimal = null; } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 5205ca1ff0..871268b1ef 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -62,6 +62,7 @@ using System.Globalization; using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; +using UnitsNet.InternalHelpers; using UnitsNet.Units; // ReSharper disable once CheckNamespace @@ -122,6 +123,7 @@ if ($obsoleteAttribute) /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// /// Get $quantityName from $($unit.PluralName). /// $($obsoleteAttribute) + /// (() => new $quantityName(double.PositiveInfinity, $unitEnumName.$($baseUnit.SingularName))); + Assert.Throws(() => new $quantityName(double.NegativeInfinity, $unitEnumName.$($baseUnit.SingularName))); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new $quantityName(double.NaN, $unitEnumName.$($baseUnit.SingularName))); + } +"@; }@" + [Fact] public void $($baseUnit.SingularName)To$($quantityName)Units() { @@ -97,6 +112,21 @@ namespace UnitsNet.Tests "@; }@" } +"@; if ($quantity.BaseType -eq "double") {@" + [Fact] + public void From$($baseUnit.PluralName)_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => $quantityName.From$($baseUnit.PluralName)(double.PositiveInfinity)); + Assert.Throws(() => $quantityName.From$($baseUnit.PluralName)(double.NegativeInfinity)); + } + + [Fact] + public void From$($baseUnit.PluralName)_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => $quantityName.From$($baseUnit.PluralName)(double.NaN)); + } +"@; }@" + [Fact] public void As() { From 83db4ec88b93e227d5b12f112ff5728a95394934 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 1 Oct 2018 23:00:36 +0200 Subject: [PATCH 043/131] Fix xmldoc error --- .../Quantities/Acceleration.Common.g.cs | 28 +++--- .../Quantities/AmountOfSubstance.Common.g.cs | 30 +++---- .../Quantities/AmplitudeRatio.Common.g.cs | 10 +-- .../Quantities/Angle.Common.g.cs | 30 +++---- .../Quantities/ApparentEnergy.Common.g.cs | 8 +- .../Quantities/ApparentPower.Common.g.cs | 10 +-- .../GeneratedCode/Quantities/Area.Common.g.cs | 28 +++--- .../Quantities/AreaDensity.Common.g.cs | 4 +- .../AreaMomentOfInertia.Common.g.cs | 14 +-- .../Quantities/BitRate.Common.g.cs | 54 +++++------ .../BrakeSpecificFuelConsumption.Common.g.cs | 8 +- .../Quantities/Capacitance.Common.g.cs | 4 +- .../Quantities/Density.Common.g.cs | 78 ++++++++-------- .../Quantities/Duration.Common.g.cs | 22 ++--- .../Quantities/DynamicViscosity.Common.g.cs | 14 +-- .../Quantities/ElectricAdmittance.Common.g.cs | 10 +-- .../Quantities/ElectricCharge.Common.g.cs | 4 +- .../ElectricChargeDensity.Common.g.cs | 4 +- .../ElectricConductance.Common.g.cs | 8 +- .../ElectricConductivity.Common.g.cs | 4 +- .../Quantities/ElectricCurrent.Common.g.cs | 18 ++-- .../ElectricCurrentDensity.Common.g.cs | 4 +- .../ElectricCurrentGradient.Common.g.cs | 4 +- .../Quantities/ElectricField.Common.g.cs | 4 +- .../Quantities/ElectricInductance.Common.g.cs | 4 +- .../Quantities/ElectricPotential.Common.g.cs | 12 +-- .../ElectricPotentialAc.Common.g.cs | 12 +-- .../ElectricPotentialDc.Common.g.cs | 12 +-- .../Quantities/ElectricResistance.Common.g.cs | 10 +-- .../ElectricResistivity.Common.g.cs | 10 +-- .../Quantities/Energy.Common.g.cs | 46 +++++----- .../Quantities/Entropy.Common.g.cs | 16 ++-- .../Quantities/Force.Common.g.cs | 22 ++--- .../Quantities/ForceChangeRate.Common.g.cs | 24 ++--- .../Quantities/ForcePerLength.Common.g.cs | 20 ++--- .../Quantities/Frequency.Common.g.cs | 18 ++-- .../Quantities/HeatFlux.Common.g.cs | 34 +++---- .../HeatTransferCoefficient.Common.g.cs | 6 +- .../Quantities/Illuminance.Common.g.cs | 10 +-- .../Quantities/Information.Common.g.cs | 54 +++++------ .../Quantities/Irradiance.Common.g.cs | 6 +- .../Quantities/Irradiation.Common.g.cs | 8 +- .../Quantities/KinematicViscosity.Common.g.cs | 18 ++-- .../Quantities/LapseRate.Common.g.cs | 4 +- .../Quantities/Length.Common.g.cs | 46 +++++----- .../Quantities/Level.Common.g.cs | 6 +- .../Quantities/LinearDensity.Common.g.cs | 8 +- .../Quantities/LuminousFlux.Common.g.cs | 4 +- .../Quantities/LuminousIntensity.Common.g.cs | 4 +- .../Quantities/MagneticField.Common.g.cs | 4 +- .../Quantities/MagneticFlux.Common.g.cs | 4 +- .../Quantities/Magnetization.Common.g.cs | 4 +- .../GeneratedCode/Quantities/Mass.Common.g.cs | 44 ++++----- .../Quantities/MassFlow.Common.g.cs | 32 +++---- .../Quantities/MassFlux.Common.g.cs | 6 +- .../MassMomentOfInertia.Common.g.cs | 54 +++++------ .../Quantities/MolarEnergy.Common.g.cs | 8 +- .../Quantities/MolarEntropy.Common.g.cs | 8 +- .../Quantities/MolarMass.Common.g.cs | 26 +++--- .../Quantities/Molarity.Common.g.cs | 18 ++-- .../Quantities/Permeability.Common.g.cs | 4 +- .../Quantities/Permittivity.Common.g.cs | 4 +- .../Quantities/Power.Common.g.cs | 42 ++++----- .../Quantities/PowerDensity.Common.g.cs | 90 +++++++++---------- .../Quantities/PowerRatio.Common.g.cs | 6 +- .../Quantities/Pressure.Common.g.cs | 76 ++++++++-------- .../Quantities/PressureChangeRate.Common.g.cs | 10 +-- .../Quantities/Ratio.Common.g.cs | 14 +-- .../Quantities/ReactiveEnergy.Common.g.cs | 8 +- .../Quantities/ReactivePower.Common.g.cs | 10 +-- .../RotationalAcceleration.Common.g.cs | 8 +- .../Quantities/RotationalSpeed.Common.g.cs | 28 +++--- .../RotationalStiffness.Common.g.cs | 8 +- .../RotationalStiffnessPerLength.Common.g.cs | 8 +- .../Quantities/SolidAngle.Common.g.cs | 4 +- .../Quantities/SpecificEnergy.Common.g.cs | 18 ++-- .../Quantities/SpecificEntropy.Common.g.cs | 18 ++-- .../Quantities/SpecificVolume.Common.g.cs | 6 +- .../Quantities/SpecificWeight.Common.g.cs | 36 ++++---- .../Quantities/Speed.Common.g.cs | 66 +++++++------- .../Quantities/Temperature.Common.g.cs | 18 ++-- .../TemperatureChangeRate.Common.g.cs | 22 ++--- .../Quantities/TemperatureDelta.Common.g.cs | 18 ++-- .../ThermalConductivity.Common.g.cs | 6 +- .../Quantities/ThermalResistance.Common.g.cs | 12 +-- .../Quantities/Torque.Common.g.cs | 44 ++++----- .../Quantities/VitaminA.Common.g.cs | 4 +- .../Quantities/Volume.Common.g.cs | 86 +++++++++--------- .../Quantities/VolumeFlow.Common.g.cs | 54 +++++------ ...clude-GenerateQuantitySourceCodeCommon.ps1 | 4 +- 90 files changed, 878 insertions(+), 878 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 726ad37b45..532ba6ddba 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -89,7 +89,7 @@ static Acceleration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -206,7 +206,7 @@ public static BaseDimensions BaseDimensions /// /// Get Acceleration from CentimetersPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromCentimetersPerSecondSquared(double centimeterspersecondsquared) @@ -221,7 +221,7 @@ public static Acceleration FromCentimetersPerSecondSquared(QuantityValue centime /// /// Get Acceleration from DecimetersPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromDecimetersPerSecondSquared(double decimeterspersecondsquared) @@ -236,7 +236,7 @@ public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimete /// /// Get Acceleration from FeetPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromFeetPerSecondSquared(double feetpersecondsquared) @@ -251,7 +251,7 @@ public static Acceleration FromFeetPerSecondSquared(QuantityValue feetperseconds /// /// Get Acceleration from InchesPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromInchesPerSecondSquared(double inchespersecondsquared) @@ -266,7 +266,7 @@ public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersec /// /// Get Acceleration from KilometersPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKilometersPerSecondSquared(double kilometerspersecondsquared) @@ -281,7 +281,7 @@ public static Acceleration FromKilometersPerSecondSquared(QuantityValue kilomete /// /// Get Acceleration from KnotsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerHour(double knotsperhour) @@ -296,7 +296,7 @@ public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) /// /// Get Acceleration from KnotsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerMinute(double knotsperminute) @@ -311,7 +311,7 @@ public static Acceleration FromKnotsPerMinute(QuantityValue knotsperminute) /// /// Get Acceleration from KnotsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromKnotsPerSecond(double knotspersecond) @@ -326,7 +326,7 @@ public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) /// /// Get Acceleration from MetersPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromMetersPerSecondSquared(double meterspersecondsquared) @@ -341,7 +341,7 @@ public static Acceleration FromMetersPerSecondSquared(QuantityValue meterspersec /// /// Get Acceleration from MicrometersPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromMicrometersPerSecondSquared(double micrometerspersecondsquared) @@ -356,7 +356,7 @@ public static Acceleration FromMicrometersPerSecondSquared(QuantityValue microme /// /// Get Acceleration from MillimetersPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromMillimetersPerSecondSquared(double millimeterspersecondsquared) @@ -371,7 +371,7 @@ public static Acceleration FromMillimetersPerSecondSquared(QuantityValue millime /// /// Get Acceleration from NanometersPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromNanometersPerSecondSquared(double nanometerspersecondsquared) @@ -386,7 +386,7 @@ public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanomete /// /// Get Acceleration from StandardGravity. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Acceleration FromStandardGravity(double standardgravity) diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 0b3d2e6844..f457b97678 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -89,7 +89,7 @@ static AmountOfSubstance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -211,7 +211,7 @@ public static BaseDimensions BaseDimensions /// /// Get AmountOfSubstance from Centimoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromCentimoles(double centimoles) @@ -226,7 +226,7 @@ public static AmountOfSubstance FromCentimoles(QuantityValue centimoles) /// /// Get AmountOfSubstance from CentipoundMoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromCentipoundMoles(double centipoundmoles) @@ -241,7 +241,7 @@ public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmole /// /// Get AmountOfSubstance from Decimoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromDecimoles(double decimoles) @@ -256,7 +256,7 @@ public static AmountOfSubstance FromDecimoles(QuantityValue decimoles) /// /// Get AmountOfSubstance from DecipoundMoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromDecipoundMoles(double decipoundmoles) @@ -271,7 +271,7 @@ public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) /// /// Get AmountOfSubstance from Kilomoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromKilomoles(double kilomoles) @@ -286,7 +286,7 @@ public static AmountOfSubstance FromKilomoles(QuantityValue kilomoles) /// /// Get AmountOfSubstance from KilopoundMoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromKilopoundMoles(double kilopoundmoles) @@ -301,7 +301,7 @@ public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) /// /// Get AmountOfSubstance from Micromoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMicromoles(double micromoles) @@ -316,7 +316,7 @@ public static AmountOfSubstance FromMicromoles(QuantityValue micromoles) /// /// Get AmountOfSubstance from MicropoundMoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMicropoundMoles(double micropoundmoles) @@ -331,7 +331,7 @@ public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmole /// /// Get AmountOfSubstance from Millimoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMillimoles(double millimoles) @@ -346,7 +346,7 @@ public static AmountOfSubstance FromMillimoles(QuantityValue millimoles) /// /// Get AmountOfSubstance from MillipoundMoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMillipoundMoles(double millipoundmoles) @@ -361,7 +361,7 @@ public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmole /// /// Get AmountOfSubstance from Moles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromMoles(double moles) @@ -376,7 +376,7 @@ public static AmountOfSubstance FromMoles(QuantityValue moles) /// /// Get AmountOfSubstance from Nanomoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromNanomoles(double nanomoles) @@ -391,7 +391,7 @@ public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) /// /// Get AmountOfSubstance from NanopoundMoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromNanopoundMoles(double nanopoundmoles) @@ -406,7 +406,7 @@ public static AmountOfSubstance FromNanopoundMoles(QuantityValue nanopoundmoles) /// /// Get AmountOfSubstance from PoundMoles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmountOfSubstance FromPoundMoles(double poundmoles) diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index e62ef4b362..e2404063fc 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -88,7 +88,7 @@ static AmplitudeRatio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -160,7 +160,7 @@ public static BaseDimensions BaseDimensions /// /// Get AmplitudeRatio from DecibelMicrovolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelMicrovolts(double decibelmicrovolts) @@ -175,7 +175,7 @@ public static AmplitudeRatio FromDecibelMicrovolts(QuantityValue decibelmicrovol /// /// Get AmplitudeRatio from DecibelMillivolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelMillivolts(double decibelmillivolts) @@ -190,7 +190,7 @@ public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivol /// /// Get AmplitudeRatio from DecibelsUnloaded. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelsUnloaded(double decibelsunloaded) @@ -205,7 +205,7 @@ public static AmplitudeRatio FromDecibelsUnloaded(QuantityValue decibelsunloaded /// /// Get AmplitudeRatio from DecibelVolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AmplitudeRatio FromDecibelVolts(double decibelvolts) diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index f465134e29..47bedaa99c 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -88,7 +88,7 @@ static Angle() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -210,7 +210,7 @@ public static BaseDimensions BaseDimensions /// /// Get Angle from Arcminutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromArcminutes(double arcminutes) @@ -225,7 +225,7 @@ public static Angle FromArcminutes(QuantityValue arcminutes) /// /// Get Angle from Arcseconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromArcseconds(double arcseconds) @@ -240,7 +240,7 @@ public static Angle FromArcseconds(QuantityValue arcseconds) /// /// Get Angle from Centiradians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromCentiradians(double centiradians) @@ -255,7 +255,7 @@ public static Angle FromCentiradians(QuantityValue centiradians) /// /// Get Angle from Deciradians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromDeciradians(double deciradians) @@ -270,7 +270,7 @@ public static Angle FromDeciradians(QuantityValue deciradians) /// /// Get Angle from Degrees. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromDegrees(double degrees) @@ -285,7 +285,7 @@ public static Angle FromDegrees(QuantityValue degrees) /// /// Get Angle from Gradians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromGradians(double gradians) @@ -300,7 +300,7 @@ public static Angle FromGradians(QuantityValue gradians) /// /// Get Angle from Microdegrees. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMicrodegrees(double microdegrees) @@ -315,7 +315,7 @@ public static Angle FromMicrodegrees(QuantityValue microdegrees) /// /// Get Angle from Microradians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMicroradians(double microradians) @@ -330,7 +330,7 @@ public static Angle FromMicroradians(QuantityValue microradians) /// /// Get Angle from Millidegrees. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMillidegrees(double millidegrees) @@ -345,7 +345,7 @@ public static Angle FromMillidegrees(QuantityValue millidegrees) /// /// Get Angle from Milliradians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromMilliradians(double milliradians) @@ -360,7 +360,7 @@ public static Angle FromMilliradians(QuantityValue milliradians) /// /// Get Angle from Nanodegrees. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromNanodegrees(double nanodegrees) @@ -375,7 +375,7 @@ public static Angle FromNanodegrees(QuantityValue nanodegrees) /// /// Get Angle from Nanoradians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromNanoradians(double nanoradians) @@ -390,7 +390,7 @@ public static Angle FromNanoradians(QuantityValue nanoradians) /// /// Get Angle from Radians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromRadians(double radians) @@ -405,7 +405,7 @@ public static Angle FromRadians(QuantityValue radians) /// /// Get Angle from Revolutions. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Angle FromRevolutions(double revolutions) diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 62b91718e3..9d1b65e372 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -89,7 +89,7 @@ static ApparentEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get ApparentEnergy from KilovoltampereHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentEnergy FromKilovoltampereHours(double kilovoltamperehours) @@ -171,7 +171,7 @@ public static ApparentEnergy FromKilovoltampereHours(QuantityValue kilovoltamper /// /// Get ApparentEnergy from MegavoltampereHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentEnergy FromMegavoltampereHours(double megavoltamperehours) @@ -186,7 +186,7 @@ public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamper /// /// Get ApparentEnergy from VoltampereHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentEnergy FromVoltampereHours(double voltamperehours) diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 2b418d55e7..1e36aa827f 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -89,7 +89,7 @@ static ApparentPower() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -161,7 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ApparentPower from Gigavoltamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromGigavoltamperes(double gigavoltamperes) @@ -176,7 +176,7 @@ public static ApparentPower FromGigavoltamperes(QuantityValue gigavoltamperes) /// /// Get ApparentPower from Kilovoltamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromKilovoltamperes(double kilovoltamperes) @@ -191,7 +191,7 @@ public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) /// /// Get ApparentPower from Megavoltamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromMegavoltamperes(double megavoltamperes) @@ -206,7 +206,7 @@ public static ApparentPower FromMegavoltamperes(QuantityValue megavoltamperes) /// /// Get ApparentPower from Voltamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ApparentPower FromVoltamperes(double voltamperes) diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 78764a0202..47414cbe3a 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -89,7 +89,7 @@ static Area() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -206,7 +206,7 @@ public static BaseDimensions BaseDimensions /// /// Get Area from Acres. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromAcres(double acres) @@ -221,7 +221,7 @@ public static Area FromAcres(QuantityValue acres) /// /// Get Area from Hectares. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromHectares(double hectares) @@ -236,7 +236,7 @@ public static Area FromHectares(QuantityValue hectares) /// /// Get Area from SquareCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareCentimeters(double squarecentimeters) @@ -251,7 +251,7 @@ public static Area FromSquareCentimeters(QuantityValue squarecentimeters) /// /// Get Area from SquareDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareDecimeters(double squaredecimeters) @@ -266,7 +266,7 @@ public static Area FromSquareDecimeters(QuantityValue squaredecimeters) /// /// Get Area from SquareFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareFeet(double squarefeet) @@ -281,7 +281,7 @@ public static Area FromSquareFeet(QuantityValue squarefeet) /// /// Get Area from SquareInches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareInches(double squareinches) @@ -296,7 +296,7 @@ public static Area FromSquareInches(QuantityValue squareinches) /// /// Get Area from SquareKilometers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareKilometers(double squarekilometers) @@ -311,7 +311,7 @@ public static Area FromSquareKilometers(QuantityValue squarekilometers) /// /// Get Area from SquareMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMeters(double squaremeters) @@ -326,7 +326,7 @@ public static Area FromSquareMeters(QuantityValue squaremeters) /// /// Get Area from SquareMicrometers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMicrometers(double squaremicrometers) @@ -341,7 +341,7 @@ public static Area FromSquareMicrometers(QuantityValue squaremicrometers) /// /// Get Area from SquareMiles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMiles(double squaremiles) @@ -356,7 +356,7 @@ public static Area FromSquareMiles(QuantityValue squaremiles) /// /// Get Area from SquareMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareMillimeters(double squaremillimeters) @@ -371,7 +371,7 @@ public static Area FromSquareMillimeters(QuantityValue squaremillimeters) /// /// Get Area from SquareYards. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromSquareYards(double squareyards) @@ -386,7 +386,7 @@ public static Area FromSquareYards(QuantityValue squareyards) /// /// Get Area from UsSurveySquareFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Area FromUsSurveySquareFeet(double ussurveysquarefeet) diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 9858cd3ec5..4803c6cf44 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -89,7 +89,7 @@ static AreaDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get AreaDensity from KilogramsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaDensity FromKilogramsPerSquareMeter(double kilogramspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index dac21921a7..04d1cb2c9a 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -89,7 +89,7 @@ static AreaMomentOfInertia() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -171,7 +171,7 @@ public static BaseDimensions BaseDimensions /// /// Get AreaMomentOfInertia from CentimetersToTheFourth. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromCentimetersToTheFourth(double centimeterstothefourth) @@ -186,7 +186,7 @@ public static AreaMomentOfInertia FromCentimetersToTheFourth(QuantityValue centi /// /// Get AreaMomentOfInertia from DecimetersToTheFourth. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromDecimetersToTheFourth(double decimeterstothefourth) @@ -201,7 +201,7 @@ public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decime /// /// Get AreaMomentOfInertia from FeetToTheFourth. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromFeetToTheFourth(double feettothefourth) @@ -216,7 +216,7 @@ public static AreaMomentOfInertia FromFeetToTheFourth(QuantityValue feettothefou /// /// Get AreaMomentOfInertia from InchesToTheFourth. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromInchesToTheFourth(double inchestothefourth) @@ -231,7 +231,7 @@ public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestoth /// /// Get AreaMomentOfInertia from MetersToTheFourth. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromMetersToTheFourth(double meterstothefourth) @@ -246,7 +246,7 @@ public static AreaMomentOfInertia FromMetersToTheFourth(QuantityValue meterstoth /// /// Get AreaMomentOfInertia from MillimetersToTheFourth. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static AreaMomentOfInertia FromMillimetersToTheFourth(double millimeterstothefourth) diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index 808d439e9c..d571141a92 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -88,7 +88,7 @@ static BitRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -270,7 +270,7 @@ public static BaseDimensions BaseDimensions /// /// Get BitRate from BitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromBitsPerSecond(double bitspersecond) @@ -285,7 +285,7 @@ public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) /// /// Get BitRate from BytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromBytesPerSecond(double bytespersecond) @@ -300,7 +300,7 @@ public static BitRate FromBytesPerSecond(QuantityValue bytespersecond) /// /// Get BitRate from ExabitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExabitsPerSecond(double exabitspersecond) @@ -315,7 +315,7 @@ public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) /// /// Get BitRate from ExabytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExabytesPerSecond(double exabytespersecond) @@ -330,7 +330,7 @@ public static BitRate FromExabytesPerSecond(QuantityValue exabytespersecond) /// /// Get BitRate from ExbibitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExbibitsPerSecond(double exbibitspersecond) @@ -345,7 +345,7 @@ public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) /// /// Get BitRate from ExbibytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromExbibytesPerSecond(double exbibytespersecond) @@ -360,7 +360,7 @@ public static BitRate FromExbibytesPerSecond(QuantityValue exbibytespersecond) /// /// Get BitRate from GibibitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGibibitsPerSecond(double gibibitspersecond) @@ -375,7 +375,7 @@ public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) /// /// Get BitRate from GibibytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGibibytesPerSecond(double gibibytespersecond) @@ -390,7 +390,7 @@ public static BitRate FromGibibytesPerSecond(QuantityValue gibibytespersecond) /// /// Get BitRate from GigabitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGigabitsPerSecond(double gigabitspersecond) @@ -405,7 +405,7 @@ public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) /// /// Get BitRate from GigabytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromGigabytesPerSecond(double gigabytespersecond) @@ -420,7 +420,7 @@ public static BitRate FromGigabytesPerSecond(QuantityValue gigabytespersecond) /// /// Get BitRate from KibibitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKibibitsPerSecond(double kibibitspersecond) @@ -435,7 +435,7 @@ public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) /// /// Get BitRate from KibibytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKibibytesPerSecond(double kibibytespersecond) @@ -450,7 +450,7 @@ public static BitRate FromKibibytesPerSecond(QuantityValue kibibytespersecond) /// /// Get BitRate from KilobitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKilobitsPerSecond(double kilobitspersecond) @@ -465,7 +465,7 @@ public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) /// /// Get BitRate from KilobytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromKilobytesPerSecond(double kilobytespersecond) @@ -480,7 +480,7 @@ public static BitRate FromKilobytesPerSecond(QuantityValue kilobytespersecond) /// /// Get BitRate from MebibitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMebibitsPerSecond(double mebibitspersecond) @@ -495,7 +495,7 @@ public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) /// /// Get BitRate from MebibytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMebibytesPerSecond(double mebibytespersecond) @@ -510,7 +510,7 @@ public static BitRate FromMebibytesPerSecond(QuantityValue mebibytespersecond) /// /// Get BitRate from MegabitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMegabitsPerSecond(double megabitspersecond) @@ -525,7 +525,7 @@ public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) /// /// Get BitRate from MegabytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromMegabytesPerSecond(double megabytespersecond) @@ -540,7 +540,7 @@ public static BitRate FromMegabytesPerSecond(QuantityValue megabytespersecond) /// /// Get BitRate from PebibitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPebibitsPerSecond(double pebibitspersecond) @@ -555,7 +555,7 @@ public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) /// /// Get BitRate from PebibytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPebibytesPerSecond(double pebibytespersecond) @@ -570,7 +570,7 @@ public static BitRate FromPebibytesPerSecond(QuantityValue pebibytespersecond) /// /// Get BitRate from PetabitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPetabitsPerSecond(double petabitspersecond) @@ -585,7 +585,7 @@ public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) /// /// Get BitRate from PetabytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromPetabytesPerSecond(double petabytespersecond) @@ -600,7 +600,7 @@ public static BitRate FromPetabytesPerSecond(QuantityValue petabytespersecond) /// /// Get BitRate from TebibitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTebibitsPerSecond(double tebibitspersecond) @@ -615,7 +615,7 @@ public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) /// /// Get BitRate from TebibytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTebibytesPerSecond(double tebibytespersecond) @@ -630,7 +630,7 @@ public static BitRate FromTebibytesPerSecond(QuantityValue tebibytespersecond) /// /// Get BitRate from TerabitsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTerabitsPerSecond(double terabitspersecond) @@ -645,7 +645,7 @@ public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) /// /// Get BitRate from TerabytesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BitRate FromTerabytesPerSecond(double terabytespersecond) diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index 214e63bbe7..25d0357c72 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -89,7 +89,7 @@ static BrakeSpecificFuelConsumption() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get BrakeSpecificFuelConsumption from GramsPerKiloWattHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(double gramsperkilowatthour) @@ -171,7 +171,7 @@ public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(QuantityValu /// /// Get BrakeSpecificFuelConsumption from KilogramsPerJoule. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(double kilogramsperjoule) @@ -186,7 +186,7 @@ public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue k /// /// Get BrakeSpecificFuelConsumption from PoundsPerMechanicalHorsepowerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(double poundspermechanicalhorsepowerhour) diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 1ec4a79e61..cbe629571a 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -89,7 +89,7 @@ static Capacitance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Capacitance from Farads. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Capacitance FromFarads(double farads) diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 17bb5b39ce..5a3418ee6f 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -89,7 +89,7 @@ static Density() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -331,7 +331,7 @@ public static BaseDimensions BaseDimensions /// /// Get Density from CentigramsPerDeciLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromCentigramsPerDeciLiter(double centigramsperdeciliter) @@ -346,7 +346,7 @@ public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeci /// /// Get Density from CentigramsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromCentigramsPerLiter(double centigramsperliter) @@ -361,7 +361,7 @@ public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) /// /// Get Density from CentigramsPerMilliliter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromCentigramsPerMilliliter(double centigramspermilliliter) @@ -376,7 +376,7 @@ public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermil /// /// Get Density from DecigramsPerDeciLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerDeciLiter(double decigramsperdeciliter) @@ -391,7 +391,7 @@ public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdecili /// /// Get Density from DecigramsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerLiter(double decigramsperliter) @@ -406,7 +406,7 @@ public static Density FromDecigramsPerLiter(QuantityValue decigramsperliter) /// /// Get Density from DecigramsPerMilliliter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromDecigramsPerMilliliter(double decigramspermilliliter) @@ -421,7 +421,7 @@ public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilli /// /// Get Density from GramsPerCubicCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerCubicCentimeter(double gramspercubiccentimeter) @@ -436,7 +436,7 @@ public static Density FromGramsPerCubicCentimeter(QuantityValue gramspercubiccen /// /// Get Density from GramsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerCubicMeter(double gramspercubicmeter) @@ -451,7 +451,7 @@ public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) /// /// Get Density from GramsPerCubicMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerCubicMillimeter(double gramspercubicmillimeter) @@ -466,7 +466,7 @@ public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmil /// /// Get Density from GramsPerDeciLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerDeciLiter(double gramsperdeciliter) @@ -481,7 +481,7 @@ public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) /// /// Get Density from GramsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerLiter(double gramsperliter) @@ -496,7 +496,7 @@ public static Density FromGramsPerLiter(QuantityValue gramsperliter) /// /// Get Density from GramsPerMilliliter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromGramsPerMilliliter(double gramspermilliliter) @@ -511,7 +511,7 @@ public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) /// /// Get Density from KilogramsPerCubicCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilogramsPerCubicCentimeter(double kilogramspercubiccentimeter) @@ -526,7 +526,7 @@ public static Density FromKilogramsPerCubicCentimeter(QuantityValue kilogramsper /// /// Get Density from KilogramsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilogramsPerCubicMeter(double kilogramspercubicmeter) @@ -541,7 +541,7 @@ public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubic /// /// Get Density from KilogramsPerCubicMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilogramsPerCubicMillimeter(double kilogramspercubicmillimeter) @@ -556,7 +556,7 @@ public static Density FromKilogramsPerCubicMillimeter(QuantityValue kilogramsper /// /// Get Density from KilopoundsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilopoundsPerCubicFoot(double kilopoundspercubicfoot) @@ -571,7 +571,7 @@ public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubi /// /// Get Density from KilopoundsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromKilopoundsPerCubicInch(double kilopoundspercubicinch) @@ -586,7 +586,7 @@ public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubi /// /// Get Density from MicrogramsPerDeciLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerDeciLiter(double microgramsperdeciliter) @@ -601,7 +601,7 @@ public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeci /// /// Get Density from MicrogramsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerLiter(double microgramsperliter) @@ -616,7 +616,7 @@ public static Density FromMicrogramsPerLiter(QuantityValue microgramsperliter) /// /// Get Density from MicrogramsPerMilliliter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMicrogramsPerMilliliter(double microgramspermilliliter) @@ -631,7 +631,7 @@ public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermil /// /// Get Density from MilligramsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerCubicMeter(double milligramspercubicmeter) @@ -646,7 +646,7 @@ public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercub /// /// Get Density from MilligramsPerDeciLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerDeciLiter(double milligramsperdeciliter) @@ -661,7 +661,7 @@ public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeci /// /// Get Density from MilligramsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerLiter(double milligramsperliter) @@ -676,7 +676,7 @@ public static Density FromMilligramsPerLiter(QuantityValue milligramsperliter) /// /// Get Density from MilligramsPerMilliliter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromMilligramsPerMilliliter(double milligramspermilliliter) @@ -691,7 +691,7 @@ public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermil /// /// Get Density from NanogramsPerDeciLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromNanogramsPerDeciLiter(double nanogramsperdeciliter) @@ -706,7 +706,7 @@ public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdecili /// /// Get Density from NanogramsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromNanogramsPerLiter(double nanogramsperliter) @@ -721,7 +721,7 @@ public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) /// /// Get Density from NanogramsPerMilliliter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromNanogramsPerMilliliter(double nanogramspermilliliter) @@ -736,7 +736,7 @@ public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilli /// /// Get Density from PicogramsPerDeciLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerDeciLiter(double picogramsperdeciliter) @@ -751,7 +751,7 @@ public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdecili /// /// Get Density from PicogramsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerLiter(double picogramsperliter) @@ -766,7 +766,7 @@ public static Density FromPicogramsPerLiter(QuantityValue picogramsperliter) /// /// Get Density from PicogramsPerMilliliter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPicogramsPerMilliliter(double picogramspermilliliter) @@ -781,7 +781,7 @@ public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilli /// /// Get Density from PoundsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerCubicFoot(double poundspercubicfoot) @@ -796,7 +796,7 @@ public static Density FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) /// /// Get Density from PoundsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerCubicInch(double poundspercubicinch) @@ -811,7 +811,7 @@ public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) /// /// Get Density from PoundsPerImperialGallon. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerImperialGallon(double poundsperimperialgallon) @@ -826,7 +826,7 @@ public static Density FromPoundsPerImperialGallon(QuantityValue poundsperimperia /// /// Get Density from PoundsPerUSGallon. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromPoundsPerUSGallon(double poundsperusgallon) @@ -841,7 +841,7 @@ public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) /// /// Get Density from SlugsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromSlugsPerCubicFoot(double slugspercubicfoot) @@ -856,7 +856,7 @@ public static Density FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) /// /// Get Density from TonnesPerCubicCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicCentimeter(double tonnespercubiccentimeter) @@ -871,7 +871,7 @@ public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubicc /// /// Get Density from TonnesPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicMeter(double tonnespercubicmeter) @@ -886,7 +886,7 @@ public static Density FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) /// /// Get Density from TonnesPerCubicMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimeter) diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index cc689dfea9..158c58491d 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -89,7 +89,7 @@ static Duration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -191,7 +191,7 @@ public static BaseDimensions BaseDimensions /// /// Get Duration from Days. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromDays(double days) @@ -206,7 +206,7 @@ public static Duration FromDays(QuantityValue days) /// /// Get Duration from Hours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromHours(double hours) @@ -221,7 +221,7 @@ public static Duration FromHours(QuantityValue hours) /// /// Get Duration from Microseconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMicroseconds(double microseconds) @@ -236,7 +236,7 @@ public static Duration FromMicroseconds(QuantityValue microseconds) /// /// Get Duration from Milliseconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMilliseconds(double milliseconds) @@ -251,7 +251,7 @@ public static Duration FromMilliseconds(QuantityValue milliseconds) /// /// Get Duration from Minutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMinutes(double minutes) @@ -266,7 +266,7 @@ public static Duration FromMinutes(QuantityValue minutes) /// /// Get Duration from Months30. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromMonths30(double months30) @@ -281,7 +281,7 @@ public static Duration FromMonths30(QuantityValue months30) /// /// Get Duration from Nanoseconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromNanoseconds(double nanoseconds) @@ -296,7 +296,7 @@ public static Duration FromNanoseconds(QuantityValue nanoseconds) /// /// Get Duration from Seconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromSeconds(double seconds) @@ -311,7 +311,7 @@ public static Duration FromSeconds(QuantityValue seconds) /// /// Get Duration from Weeks. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromWeeks(double weeks) @@ -326,7 +326,7 @@ public static Duration FromWeeks(QuantityValue weeks) /// /// Get Duration from Years365. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Duration FromYears365(double years365) diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 9f1d897544..7a6ef0b68e 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -89,7 +89,7 @@ static DynamicViscosity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -171,7 +171,7 @@ public static BaseDimensions BaseDimensions /// /// Get DynamicViscosity from Centipoise. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromCentipoise(double centipoise) @@ -186,7 +186,7 @@ public static DynamicViscosity FromCentipoise(QuantityValue centipoise) /// /// Get DynamicViscosity from MicropascalSeconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromMicropascalSeconds(double micropascalseconds) @@ -201,7 +201,7 @@ public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascals /// /// Get DynamicViscosity from MillipascalSeconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromMillipascalSeconds(double millipascalseconds) @@ -216,7 +216,7 @@ public static DynamicViscosity FromMillipascalSeconds(QuantityValue millipascals /// /// Get DynamicViscosity from NewtonSecondsPerMeterSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromNewtonSecondsPerMeterSquared(double newtonsecondspermetersquared) @@ -231,7 +231,7 @@ public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue ne /// /// Get DynamicViscosity from PascalSeconds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromPascalSeconds(double pascalseconds) @@ -246,7 +246,7 @@ public static DynamicViscosity FromPascalSeconds(QuantityValue pascalseconds) /// /// Get DynamicViscosity from Poise. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static DynamicViscosity FromPoise(double poise) diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index a208dfe399..bcb4a4e495 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -89,7 +89,7 @@ static ElectricAdmittance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -161,7 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricAdmittance from Microsiemens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromMicrosiemens(double microsiemens) @@ -176,7 +176,7 @@ public static ElectricAdmittance FromMicrosiemens(QuantityValue microsiemens) /// /// Get ElectricAdmittance from Millisiemens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromMillisiemens(double millisiemens) @@ -191,7 +191,7 @@ public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) /// /// Get ElectricAdmittance from Nanosiemens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromNanosiemens(double nanosiemens) @@ -206,7 +206,7 @@ public static ElectricAdmittance FromNanosiemens(QuantityValue nanosiemens) /// /// Get ElectricAdmittance from Siemens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricAdmittance FromSiemens(double siemens) diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 1d101550b2..b859665a87 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -89,7 +89,7 @@ static ElectricCharge() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCharge from Coulombs. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCharge FromCoulombs(double coulombs) diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 08ca9f5aa1..990164f694 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -89,7 +89,7 @@ static ElectricChargeDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricChargeDensity from CoulombsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricChargeDensity FromCoulombsPerCubicMeter(double coulombspercubicmeter) diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index 10a5b0128c..341cfe24a9 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -89,7 +89,7 @@ static ElectricConductance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricConductance from Microsiemens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductance FromMicrosiemens(double microsiemens) @@ -171,7 +171,7 @@ public static ElectricConductance FromMicrosiemens(QuantityValue microsiemens) /// /// Get ElectricConductance from Millisiemens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductance FromMillisiemens(double millisiemens) @@ -186,7 +186,7 @@ public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) /// /// Get ElectricConductance from Siemens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductance FromSiemens(double siemens) diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 7f5b77bddc..d7f670d96f 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -89,7 +89,7 @@ static ElectricConductivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricConductivity from SiemensPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricConductivity FromSiemensPerMeter(double siemenspermeter) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index ad8848ea5f..7ac87cd1ce 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -89,7 +89,7 @@ static ElectricCurrent() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -181,7 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCurrent from Amperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromAmperes(double amperes) @@ -196,7 +196,7 @@ public static ElectricCurrent FromAmperes(QuantityValue amperes) /// /// Get ElectricCurrent from Centiamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromCentiamperes(double centiamperes) @@ -211,7 +211,7 @@ public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) /// /// Get ElectricCurrent from Kiloamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromKiloamperes(double kiloamperes) @@ -226,7 +226,7 @@ public static ElectricCurrent FromKiloamperes(QuantityValue kiloamperes) /// /// Get ElectricCurrent from Megaamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMegaamperes(double megaamperes) @@ -241,7 +241,7 @@ public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) /// /// Get ElectricCurrent from Microamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMicroamperes(double microamperes) @@ -256,7 +256,7 @@ public static ElectricCurrent FromMicroamperes(QuantityValue microamperes) /// /// Get ElectricCurrent from Milliamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromMilliamperes(double milliamperes) @@ -271,7 +271,7 @@ public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) /// /// Get ElectricCurrent from Nanoamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromNanoamperes(double nanoamperes) @@ -286,7 +286,7 @@ public static ElectricCurrent FromNanoamperes(QuantityValue nanoamperes) /// /// Get ElectricCurrent from Picoamperes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrent FromPicoamperes(double picoamperes) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 504dc9856a..0f3e70a0e4 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -89,7 +89,7 @@ static ElectricCurrentDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCurrentDensity from AmperesPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrentDensity FromAmperesPerSquareMeter(double amperespersquaremeter) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 78f185a474..c3bc0c0a09 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -89,7 +89,7 @@ static ElectricCurrentGradient() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricCurrentGradient from AmperesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricCurrentGradient FromAmperesPerSecond(double amperespersecond) diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 233cc51ff0..ba9c8500b1 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -89,7 +89,7 @@ static ElectricField() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricField from VoltsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricField FromVoltsPerMeter(double voltspermeter) diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index e9d8d8b73c..7d9f39fd11 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -89,7 +89,7 @@ static ElectricInductance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricInductance from Henries. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricInductance FromHenries(double henries) diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 1d259d36cf..8231a34342 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -89,7 +89,7 @@ static ElectricPotential() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -166,7 +166,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricPotential from Kilovolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromKilovolts(double kilovolts) @@ -181,7 +181,7 @@ public static ElectricPotential FromKilovolts(QuantityValue kilovolts) /// /// Get ElectricPotential from Megavolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMegavolts(double megavolts) @@ -196,7 +196,7 @@ public static ElectricPotential FromMegavolts(QuantityValue megavolts) /// /// Get ElectricPotential from Microvolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMicrovolts(double microvolts) @@ -211,7 +211,7 @@ public static ElectricPotential FromMicrovolts(QuantityValue microvolts) /// /// Get ElectricPotential from Millivolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromMillivolts(double millivolts) @@ -226,7 +226,7 @@ public static ElectricPotential FromMillivolts(QuantityValue millivolts) /// /// Get ElectricPotential from Volts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotential FromVolts(double volts) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index d5e49ad3df..fcf63810c1 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -88,7 +88,7 @@ static ElectricPotentialAc() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -165,7 +165,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricPotentialAc from KilovoltsAc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromKilovoltsAc(double kilovoltsac) @@ -180,7 +180,7 @@ public static ElectricPotentialAc FromKilovoltsAc(QuantityValue kilovoltsac) /// /// Get ElectricPotentialAc from MegavoltsAc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMegavoltsAc(double megavoltsac) @@ -195,7 +195,7 @@ public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) /// /// Get ElectricPotentialAc from MicrovoltsAc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMicrovoltsAc(double microvoltsac) @@ -210,7 +210,7 @@ public static ElectricPotentialAc FromMicrovoltsAc(QuantityValue microvoltsac) /// /// Get ElectricPotentialAc from MillivoltsAc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromMillivoltsAc(double millivoltsac) @@ -225,7 +225,7 @@ public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) /// /// Get ElectricPotentialAc from VoltsAc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialAc FromVoltsAc(double voltsac) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 99fc272d8b..88be3d5059 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -88,7 +88,7 @@ static ElectricPotentialDc() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -165,7 +165,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricPotentialDc from KilovoltsDc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromKilovoltsDc(double kilovoltsdc) @@ -180,7 +180,7 @@ public static ElectricPotentialDc FromKilovoltsDc(QuantityValue kilovoltsdc) /// /// Get ElectricPotentialDc from MegavoltsDc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMegavoltsDc(double megavoltsdc) @@ -195,7 +195,7 @@ public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) /// /// Get ElectricPotentialDc from MicrovoltsDc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMicrovoltsDc(double microvoltsdc) @@ -210,7 +210,7 @@ public static ElectricPotentialDc FromMicrovoltsDc(QuantityValue microvoltsdc) /// /// Get ElectricPotentialDc from MillivoltsDc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromMillivoltsDc(double millivoltsdc) @@ -225,7 +225,7 @@ public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) /// /// Get ElectricPotentialDc from VoltsDc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricPotentialDc FromVoltsDc(double voltsdc) diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 1b43df0f8f..d6a6515d32 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -89,7 +89,7 @@ static ElectricResistance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -161,7 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricResistance from Kiloohms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromKiloohms(double kiloohms) @@ -176,7 +176,7 @@ public static ElectricResistance FromKiloohms(QuantityValue kiloohms) /// /// Get ElectricResistance from Megaohms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromMegaohms(double megaohms) @@ -191,7 +191,7 @@ public static ElectricResistance FromMegaohms(QuantityValue megaohms) /// /// Get ElectricResistance from Milliohms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromMilliohms(double milliohms) @@ -206,7 +206,7 @@ public static ElectricResistance FromMilliohms(QuantityValue milliohms) /// /// Get ElectricResistance from Ohms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistance FromOhms(double ohms) diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 12b59da5c3..4023ff5c3c 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -89,7 +89,7 @@ static ElectricResistivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -161,7 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ElectricResistivity from MicroohmMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromMicroohmMeters(double microohmmeters) @@ -176,7 +176,7 @@ public static ElectricResistivity FromMicroohmMeters(QuantityValue microohmmeter /// /// Get ElectricResistivity from MilliohmMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromMilliohmMeters(double milliohmmeters) @@ -191,7 +191,7 @@ public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeter /// /// Get ElectricResistivity from NanoohmMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromNanoohmMeters(double nanoohmmeters) @@ -206,7 +206,7 @@ public static ElectricResistivity FromNanoohmMeters(QuantityValue nanoohmmeters) /// /// Get ElectricResistivity from OhmMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ElectricResistivity FromOhmMeters(double ohmmeters) diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 2e5226bc1d..e44892aa62 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -89,7 +89,7 @@ static Energy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -251,7 +251,7 @@ public static BaseDimensions BaseDimensions /// /// Get Energy from BritishThermalUnits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromBritishThermalUnits(double britishthermalunits) @@ -266,7 +266,7 @@ public static Energy FromBritishThermalUnits(QuantityValue britishthermalunits) /// /// Get Energy from Calories. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromCalories(double calories) @@ -281,7 +281,7 @@ public static Energy FromCalories(QuantityValue calories) /// /// Get Energy from DecathermsEc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromDecathermsEc(double decathermsec) @@ -296,7 +296,7 @@ public static Energy FromDecathermsEc(QuantityValue decathermsec) /// /// Get Energy from DecathermsImperial. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromDecathermsImperial(double decathermsimperial) @@ -311,7 +311,7 @@ public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) /// /// Get Energy from DecathermsUs. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromDecathermsUs(double decathermsus) @@ -326,7 +326,7 @@ public static Energy FromDecathermsUs(QuantityValue decathermsus) /// /// Get Energy from ElectronVolts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromElectronVolts(double electronvolts) @@ -341,7 +341,7 @@ public static Energy FromElectronVolts(QuantityValue electronvolts) /// /// Get Energy from Ergs. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromErgs(double ergs) @@ -356,7 +356,7 @@ public static Energy FromErgs(QuantityValue ergs) /// /// Get Energy from FootPounds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromFootPounds(double footpounds) @@ -371,7 +371,7 @@ public static Energy FromFootPounds(QuantityValue footpounds) /// /// Get Energy from GigabritishThermalUnits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromGigabritishThermalUnits(double gigabritishthermalunits) @@ -386,7 +386,7 @@ public static Energy FromGigabritishThermalUnits(QuantityValue gigabritishtherma /// /// Get Energy from GigawattHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromGigawattHours(double gigawatthours) @@ -401,7 +401,7 @@ public static Energy FromGigawattHours(QuantityValue gigawatthours) /// /// Get Energy from Joules. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromJoules(double joules) @@ -416,7 +416,7 @@ public static Energy FromJoules(QuantityValue joules) /// /// Get Energy from KilobritishThermalUnits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilobritishThermalUnits(double kilobritishthermalunits) @@ -431,7 +431,7 @@ public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishtherma /// /// Get Energy from Kilocalories. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilocalories(double kilocalories) @@ -446,7 +446,7 @@ public static Energy FromKilocalories(QuantityValue kilocalories) /// /// Get Energy from Kilojoules. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilojoules(double kilojoules) @@ -461,7 +461,7 @@ public static Energy FromKilojoules(QuantityValue kilojoules) /// /// Get Energy from KilowattHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromKilowattHours(double kilowatthours) @@ -476,7 +476,7 @@ public static Energy FromKilowattHours(QuantityValue kilowatthours) /// /// Get Energy from MegabritishThermalUnits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegabritishThermalUnits(double megabritishthermalunits) @@ -491,7 +491,7 @@ public static Energy FromMegabritishThermalUnits(QuantityValue megabritishtherma /// /// Get Energy from Megajoules. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegajoules(double megajoules) @@ -506,7 +506,7 @@ public static Energy FromMegajoules(QuantityValue megajoules) /// /// Get Energy from MegawattHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromMegawattHours(double megawatthours) @@ -521,7 +521,7 @@ public static Energy FromMegawattHours(QuantityValue megawatthours) /// /// Get Energy from ThermsEc. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromThermsEc(double thermsec) @@ -536,7 +536,7 @@ public static Energy FromThermsEc(QuantityValue thermsec) /// /// Get Energy from ThermsImperial. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromThermsImperial(double thermsimperial) @@ -551,7 +551,7 @@ public static Energy FromThermsImperial(QuantityValue thermsimperial) /// /// Get Energy from ThermsUs. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromThermsUs(double thermsus) @@ -566,7 +566,7 @@ public static Energy FromThermsUs(QuantityValue thermsus) /// /// Get Energy from WattHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Energy FromWattHours(double watthours) diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index fedd5450c3..c36252ab99 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -89,7 +89,7 @@ static Entropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -176,7 +176,7 @@ public static BaseDimensions BaseDimensions /// /// Get Entropy from CaloriesPerKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromCaloriesPerKelvin(double caloriesperkelvin) @@ -191,7 +191,7 @@ public static Entropy FromCaloriesPerKelvin(QuantityValue caloriesperkelvin) /// /// Get Entropy from JoulesPerDegreeCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromJoulesPerDegreeCelsius(double joulesperdegreecelsius) @@ -206,7 +206,7 @@ public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreece /// /// Get Entropy from JoulesPerKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromJoulesPerKelvin(double joulesperkelvin) @@ -221,7 +221,7 @@ public static Entropy FromJoulesPerKelvin(QuantityValue joulesperkelvin) /// /// Get Entropy from KilocaloriesPerKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilocaloriesPerKelvin(double kilocaloriesperkelvin) @@ -236,7 +236,7 @@ public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkel /// /// Get Entropy from KilojoulesPerDegreeCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilojoulesPerDegreeCelsius(double kilojoulesperdegreecelsius) @@ -251,7 +251,7 @@ public static Entropy FromKilojoulesPerDegreeCelsius(QuantityValue kilojoulesper /// /// Get Entropy from KilojoulesPerKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromKilojoulesPerKelvin(double kilojoulesperkelvin) @@ -266,7 +266,7 @@ public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) /// /// Get Entropy from MegajoulesPerKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Entropy FromMegajoulesPerKelvin(double megajoulesperkelvin) diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 58827e66bd..24a6e1a777 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -89,7 +89,7 @@ static Force() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -191,7 +191,7 @@ public static BaseDimensions BaseDimensions /// /// Get Force from Decanewtons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromDecanewtons(double decanewtons) @@ -206,7 +206,7 @@ public static Force FromDecanewtons(QuantityValue decanewtons) /// /// Get Force from Dyne. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromDyne(double dyne) @@ -221,7 +221,7 @@ public static Force FromDyne(QuantityValue dyne) /// /// Get Force from KilogramsForce. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromKilogramsForce(double kilogramsforce) @@ -236,7 +236,7 @@ public static Force FromKilogramsForce(QuantityValue kilogramsforce) /// /// Get Force from Kilonewtons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromKilonewtons(double kilonewtons) @@ -251,7 +251,7 @@ public static Force FromKilonewtons(QuantityValue kilonewtons) /// /// Get Force from KiloPonds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromKiloPonds(double kiloponds) @@ -266,7 +266,7 @@ public static Force FromKiloPonds(QuantityValue kiloponds) /// /// Get Force from Meganewtons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromMeganewtons(double meganewtons) @@ -281,7 +281,7 @@ public static Force FromMeganewtons(QuantityValue meganewtons) /// /// Get Force from Newtons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromNewtons(double newtons) @@ -296,7 +296,7 @@ public static Force FromNewtons(QuantityValue newtons) /// /// Get Force from Poundals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromPoundals(double poundals) @@ -311,7 +311,7 @@ public static Force FromPoundals(QuantityValue poundals) /// /// Get Force from PoundsForce. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromPoundsForce(double poundsforce) @@ -326,7 +326,7 @@ public static Force FromPoundsForce(QuantityValue poundsforce) /// /// Get Force from TonnesForce. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Force FromTonnesForce(double tonnesforce) diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 45e2a10ca5..d3597b7083 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -89,7 +89,7 @@ static ForceChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -196,7 +196,7 @@ public static BaseDimensions BaseDimensions /// /// Get ForceChangeRate from CentinewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromCentinewtonsPerSecond(double centinewtonspersecond) @@ -211,7 +211,7 @@ public static ForceChangeRate FromCentinewtonsPerSecond(QuantityValue centinewto /// /// Get ForceChangeRate from DecanewtonsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecanewtonsPerMinute(double decanewtonsperminute) @@ -226,7 +226,7 @@ public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtons /// /// Get ForceChangeRate from DecanewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecanewtonsPerSecond(double decanewtonspersecond) @@ -241,7 +241,7 @@ public static ForceChangeRate FromDecanewtonsPerSecond(QuantityValue decanewtons /// /// Get ForceChangeRate from DecinewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromDecinewtonsPerSecond(double decinewtonspersecond) @@ -256,7 +256,7 @@ public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtons /// /// Get ForceChangeRate from KilonewtonsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromKilonewtonsPerMinute(double kilonewtonsperminute) @@ -271,7 +271,7 @@ public static ForceChangeRate FromKilonewtonsPerMinute(QuantityValue kilonewtons /// /// Get ForceChangeRate from KilonewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromKilonewtonsPerSecond(double kilonewtonspersecond) @@ -286,7 +286,7 @@ public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtons /// /// Get ForceChangeRate from MicronewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromMicronewtonsPerSecond(double micronewtonspersecond) @@ -301,7 +301,7 @@ public static ForceChangeRate FromMicronewtonsPerSecond(QuantityValue micronewto /// /// Get ForceChangeRate from MillinewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromMillinewtonsPerSecond(double millinewtonspersecond) @@ -316,7 +316,7 @@ public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewto /// /// Get ForceChangeRate from NanonewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromNanonewtonsPerSecond(double nanonewtonspersecond) @@ -331,7 +331,7 @@ public static ForceChangeRate FromNanonewtonsPerSecond(QuantityValue nanonewtons /// /// Get ForceChangeRate from NewtonsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromNewtonsPerMinute(double newtonsperminute) @@ -346,7 +346,7 @@ public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminut /// /// Get ForceChangeRate from NewtonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForceChangeRate FromNewtonsPerSecond(double newtonspersecond) diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index 54fe02d103..da8a54d874 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -89,7 +89,7 @@ static ForcePerLength() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -186,7 +186,7 @@ public static BaseDimensions BaseDimensions /// /// Get ForcePerLength from CentinewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromCentinewtonsPerMeter(double centinewtonspermeter) @@ -201,7 +201,7 @@ public static ForcePerLength FromCentinewtonsPerMeter(QuantityValue centinewtons /// /// Get ForcePerLength from DecinewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromDecinewtonsPerMeter(double decinewtonspermeter) @@ -216,7 +216,7 @@ public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspe /// /// Get ForcePerLength from KilogramsForcePerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromKilogramsForcePerMeter(double kilogramsforcepermeter) @@ -231,7 +231,7 @@ public static ForcePerLength FromKilogramsForcePerMeter(QuantityValue kilogramsf /// /// Get ForcePerLength from KilonewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromKilonewtonsPerMeter(double kilonewtonspermeter) @@ -246,7 +246,7 @@ public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspe /// /// Get ForcePerLength from MeganewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromMeganewtonsPerMeter(double meganewtonspermeter) @@ -261,7 +261,7 @@ public static ForcePerLength FromMeganewtonsPerMeter(QuantityValue meganewtonspe /// /// Get ForcePerLength from MicronewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromMicronewtonsPerMeter(double micronewtonspermeter) @@ -276,7 +276,7 @@ public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtons /// /// Get ForcePerLength from MillinewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromMillinewtonsPerMeter(double millinewtonspermeter) @@ -291,7 +291,7 @@ public static ForcePerLength FromMillinewtonsPerMeter(QuantityValue millinewtons /// /// Get ForcePerLength from NanonewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromNanonewtonsPerMeter(double nanonewtonspermeter) @@ -306,7 +306,7 @@ public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspe /// /// Get ForcePerLength from NewtonsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ForcePerLength FromNewtonsPerMeter(double newtonspermeter) diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index e4a90cccec..72866114d7 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -89,7 +89,7 @@ static Frequency() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -181,7 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get Frequency from CyclesPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromCyclesPerHour(double cyclesperhour) @@ -196,7 +196,7 @@ public static Frequency FromCyclesPerHour(QuantityValue cyclesperhour) /// /// Get Frequency from CyclesPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromCyclesPerMinute(double cyclesperminute) @@ -211,7 +211,7 @@ public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) /// /// Get Frequency from Gigahertz. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromGigahertz(double gigahertz) @@ -226,7 +226,7 @@ public static Frequency FromGigahertz(QuantityValue gigahertz) /// /// Get Frequency from Hertz. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromHertz(double hertz) @@ -241,7 +241,7 @@ public static Frequency FromHertz(QuantityValue hertz) /// /// Get Frequency from Kilohertz. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromKilohertz(double kilohertz) @@ -256,7 +256,7 @@ public static Frequency FromKilohertz(QuantityValue kilohertz) /// /// Get Frequency from Megahertz. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromMegahertz(double megahertz) @@ -271,7 +271,7 @@ public static Frequency FromMegahertz(QuantityValue megahertz) /// /// Get Frequency from RadiansPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromRadiansPerSecond(double radianspersecond) @@ -286,7 +286,7 @@ public static Frequency FromRadiansPerSecond(QuantityValue radianspersecond) /// /// Get Frequency from Terahertz. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Frequency FromTerahertz(double terahertz) diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index f60999b9ed..67877a4372 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -89,7 +89,7 @@ static HeatFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -221,7 +221,7 @@ public static BaseDimensions BaseDimensions /// /// Get HeatFlux from BtusPerHourSquareFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerHourSquareFoot(double btusperhoursquarefoot) @@ -236,7 +236,7 @@ public static HeatFlux FromBtusPerHourSquareFoot(QuantityValue btusperhoursquare /// /// Get HeatFlux from BtusPerMinuteSquareFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerMinuteSquareFoot(double btusperminutesquarefoot) @@ -251,7 +251,7 @@ public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesq /// /// Get HeatFlux from BtusPerSecondSquareFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerSecondSquareFoot(double btuspersecondsquarefoot) @@ -266,7 +266,7 @@ public static HeatFlux FromBtusPerSecondSquareFoot(QuantityValue btuspersecondsq /// /// Get HeatFlux from BtusPerSecondSquareInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromBtusPerSecondSquareInch(double btuspersecondsquareinch) @@ -281,7 +281,7 @@ public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsq /// /// Get HeatFlux from CaloriesPerSecondSquareCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromCaloriesPerSecondSquareCentimeter(double caloriespersecondsquarecentimeter) @@ -296,7 +296,7 @@ public static HeatFlux FromCaloriesPerSecondSquareCentimeter(QuantityValue calor /// /// Get HeatFlux from CentiwattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromCentiwattsPerSquareMeter(double centiwattspersquaremeter) @@ -311,7 +311,7 @@ public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspers /// /// Get HeatFlux from DeciwattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromDeciwattsPerSquareMeter(double deciwattspersquaremeter) @@ -326,7 +326,7 @@ public static HeatFlux FromDeciwattsPerSquareMeter(QuantityValue deciwattspersqu /// /// Get HeatFlux from KilocaloriesPerHourSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilocaloriesPerHourSquareMeter(double kilocaloriesperhoursquaremeter) @@ -341,7 +341,7 @@ public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocalo /// /// Get HeatFlux from KilocaloriesPerSecondSquareCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(double kilocaloriespersecondsquarecentimeter) @@ -356,7 +356,7 @@ public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(QuantityValue k /// /// Get HeatFlux from KilowattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromKilowattsPerSquareMeter(double kilowattspersquaremeter) @@ -371,7 +371,7 @@ public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersqu /// /// Get HeatFlux from MicrowattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromMicrowattsPerSquareMeter(double microwattspersquaremeter) @@ -386,7 +386,7 @@ public static HeatFlux FromMicrowattsPerSquareMeter(QuantityValue microwattspers /// /// Get HeatFlux from MilliwattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromMilliwattsPerSquareMeter(double milliwattspersquaremeter) @@ -401,7 +401,7 @@ public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspers /// /// Get HeatFlux from NanowattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromNanowattsPerSquareMeter(double nanowattspersquaremeter) @@ -416,7 +416,7 @@ public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersqu /// /// Get HeatFlux from WattsPerSquareFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareFoot(double wattspersquarefoot) @@ -431,7 +431,7 @@ public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) /// /// Get HeatFlux from WattsPerSquareInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareInch(double wattspersquareinch) @@ -446,7 +446,7 @@ public static HeatFlux FromWattsPerSquareInch(QuantityValue wattspersquareinch) /// /// Get HeatFlux from WattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatFlux FromWattsPerSquareMeter(double wattspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index eea62f4e0c..c0c60c5e38 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -89,7 +89,7 @@ static HeatTransferCoefficient() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -151,7 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get HeatTransferCoefficient from WattsPerSquareMeterCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(double wattspersquaremetercelsius) @@ -166,7 +166,7 @@ public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(QuantityVal /// /// Get HeatTransferCoefficient from WattsPerSquareMeterKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(double wattspersquaremeterkelvin) diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index cf383398d4..fdd8c4efd8 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -89,7 +89,7 @@ static Illuminance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -161,7 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get Illuminance from Kilolux. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromKilolux(double kilolux) @@ -176,7 +176,7 @@ public static Illuminance FromKilolux(QuantityValue kilolux) /// /// Get Illuminance from Lux. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromLux(double lux) @@ -191,7 +191,7 @@ public static Illuminance FromLux(QuantityValue lux) /// /// Get Illuminance from Megalux. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromMegalux(double megalux) @@ -206,7 +206,7 @@ public static Illuminance FromMegalux(QuantityValue megalux) /// /// Get Illuminance from Millilux. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Illuminance FromMillilux(double millilux) diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index cc21cc4178..976c240afb 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -88,7 +88,7 @@ static Information() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -270,7 +270,7 @@ public static BaseDimensions BaseDimensions /// /// Get Information from Bits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromBits(double bits) @@ -285,7 +285,7 @@ public static Information FromBits(QuantityValue bits) /// /// Get Information from Bytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromBytes(double bytes) @@ -300,7 +300,7 @@ public static Information FromBytes(QuantityValue bytes) /// /// Get Information from Exabits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExabits(double exabits) @@ -315,7 +315,7 @@ public static Information FromExabits(QuantityValue exabits) /// /// Get Information from Exabytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExabytes(double exabytes) @@ -330,7 +330,7 @@ public static Information FromExabytes(QuantityValue exabytes) /// /// Get Information from Exbibits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExbibits(double exbibits) @@ -345,7 +345,7 @@ public static Information FromExbibits(QuantityValue exbibits) /// /// Get Information from Exbibytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromExbibytes(double exbibytes) @@ -360,7 +360,7 @@ public static Information FromExbibytes(QuantityValue exbibytes) /// /// Get Information from Gibibits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGibibits(double gibibits) @@ -375,7 +375,7 @@ public static Information FromGibibits(QuantityValue gibibits) /// /// Get Information from Gibibytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGibibytes(double gibibytes) @@ -390,7 +390,7 @@ public static Information FromGibibytes(QuantityValue gibibytes) /// /// Get Information from Gigabits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGigabits(double gigabits) @@ -405,7 +405,7 @@ public static Information FromGigabits(QuantityValue gigabits) /// /// Get Information from Gigabytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromGigabytes(double gigabytes) @@ -420,7 +420,7 @@ public static Information FromGigabytes(QuantityValue gigabytes) /// /// Get Information from Kibibits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKibibits(double kibibits) @@ -435,7 +435,7 @@ public static Information FromKibibits(QuantityValue kibibits) /// /// Get Information from Kibibytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKibibytes(double kibibytes) @@ -450,7 +450,7 @@ public static Information FromKibibytes(QuantityValue kibibytes) /// /// Get Information from Kilobits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKilobits(double kilobits) @@ -465,7 +465,7 @@ public static Information FromKilobits(QuantityValue kilobits) /// /// Get Information from Kilobytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromKilobytes(double kilobytes) @@ -480,7 +480,7 @@ public static Information FromKilobytes(QuantityValue kilobytes) /// /// Get Information from Mebibits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMebibits(double mebibits) @@ -495,7 +495,7 @@ public static Information FromMebibits(QuantityValue mebibits) /// /// Get Information from Mebibytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMebibytes(double mebibytes) @@ -510,7 +510,7 @@ public static Information FromMebibytes(QuantityValue mebibytes) /// /// Get Information from Megabits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMegabits(double megabits) @@ -525,7 +525,7 @@ public static Information FromMegabits(QuantityValue megabits) /// /// Get Information from Megabytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromMegabytes(double megabytes) @@ -540,7 +540,7 @@ public static Information FromMegabytes(QuantityValue megabytes) /// /// Get Information from Pebibits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPebibits(double pebibits) @@ -555,7 +555,7 @@ public static Information FromPebibits(QuantityValue pebibits) /// /// Get Information from Pebibytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPebibytes(double pebibytes) @@ -570,7 +570,7 @@ public static Information FromPebibytes(QuantityValue pebibytes) /// /// Get Information from Petabits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPetabits(double petabits) @@ -585,7 +585,7 @@ public static Information FromPetabits(QuantityValue petabits) /// /// Get Information from Petabytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromPetabytes(double petabytes) @@ -600,7 +600,7 @@ public static Information FromPetabytes(QuantityValue petabytes) /// /// Get Information from Tebibits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTebibits(double tebibits) @@ -615,7 +615,7 @@ public static Information FromTebibits(QuantityValue tebibits) /// /// Get Information from Tebibytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTebibytes(double tebibytes) @@ -630,7 +630,7 @@ public static Information FromTebibytes(QuantityValue tebibytes) /// /// Get Information from Terabits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTerabits(double terabits) @@ -645,7 +645,7 @@ public static Information FromTerabits(QuantityValue terabits) /// /// Get Information from Terabytes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Information FromTerabytes(double terabytes) diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 7313bc992e..03773eae0f 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -89,7 +89,7 @@ static Irradiance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -151,7 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get Irradiance from KilowattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiance FromKilowattsPerSquareMeter(double kilowattspersquaremeter) @@ -166,7 +166,7 @@ public static Irradiance FromKilowattsPerSquareMeter(QuantityValue kilowattspers /// /// Get Irradiance from WattsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiance FromWattsPerSquareMeter(double wattspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index e90062574a..d495d594da 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -89,7 +89,7 @@ static Irradiation() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get Irradiation from JoulesPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiation FromJoulesPerSquareMeter(double joulespersquaremeter) @@ -171,7 +171,7 @@ public static Irradiation FromJoulesPerSquareMeter(QuantityValue joulespersquare /// /// Get Irradiation from KilowattHoursPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiation FromKilowattHoursPerSquareMeter(double kilowatthourspersquaremeter) @@ -186,7 +186,7 @@ public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatt /// /// Get Irradiation from WattHoursPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Irradiation FromWattHoursPerSquareMeter(double watthourspersquaremeter) diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index f7b6c2b7ec..ad40138c55 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -89,7 +89,7 @@ static KinematicViscosity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -181,7 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get KinematicViscosity from Centistokes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromCentistokes(double centistokes) @@ -196,7 +196,7 @@ public static KinematicViscosity FromCentistokes(QuantityValue centistokes) /// /// Get KinematicViscosity from Decistokes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromDecistokes(double decistokes) @@ -211,7 +211,7 @@ public static KinematicViscosity FromDecistokes(QuantityValue decistokes) /// /// Get KinematicViscosity from Kilostokes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromKilostokes(double kilostokes) @@ -226,7 +226,7 @@ public static KinematicViscosity FromKilostokes(QuantityValue kilostokes) /// /// Get KinematicViscosity from Microstokes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromMicrostokes(double microstokes) @@ -241,7 +241,7 @@ public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) /// /// Get KinematicViscosity from Millistokes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromMillistokes(double millistokes) @@ -256,7 +256,7 @@ public static KinematicViscosity FromMillistokes(QuantityValue millistokes) /// /// Get KinematicViscosity from Nanostokes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromNanostokes(double nanostokes) @@ -271,7 +271,7 @@ public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) /// /// Get KinematicViscosity from SquareMetersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromSquareMetersPerSecond(double squaremeterspersecond) @@ -286,7 +286,7 @@ public static KinematicViscosity FromSquareMetersPerSecond(QuantityValue squarem /// /// Get KinematicViscosity from Stokes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static KinematicViscosity FromStokes(double stokes) diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index b88b9a7c58..63db7bef58 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -89,7 +89,7 @@ static LapseRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get LapseRate from DegreesCelciusPerKilometer. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LapseRate FromDegreesCelciusPerKilometer(double degreescelciusperkilometer) diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index ee4ae05e15..a0515554d4 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -89,7 +89,7 @@ static Length() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -251,7 +251,7 @@ public static BaseDimensions BaseDimensions /// /// Get Length from Centimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromCentimeters(double centimeters) @@ -266,7 +266,7 @@ public static Length FromCentimeters(QuantityValue centimeters) /// /// Get Length from Decimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDecimeters(double decimeters) @@ -281,7 +281,7 @@ public static Length FromDecimeters(QuantityValue decimeters) /// /// Get Length from DtpPicas. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDtpPicas(double dtppicas) @@ -296,7 +296,7 @@ public static Length FromDtpPicas(QuantityValue dtppicas) /// /// Get Length from DtpPoints. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromDtpPoints(double dtppoints) @@ -311,7 +311,7 @@ public static Length FromDtpPoints(QuantityValue dtppoints) /// /// Get Length from Fathoms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromFathoms(double fathoms) @@ -326,7 +326,7 @@ public static Length FromFathoms(QuantityValue fathoms) /// /// Get Length from Feet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromFeet(double feet) @@ -341,7 +341,7 @@ public static Length FromFeet(QuantityValue feet) /// /// Get Length from Inches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromInches(double inches) @@ -356,7 +356,7 @@ public static Length FromInches(QuantityValue inches) /// /// Get Length from Kilometers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromKilometers(double kilometers) @@ -371,7 +371,7 @@ public static Length FromKilometers(QuantityValue kilometers) /// /// Get Length from Meters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMeters(double meters) @@ -386,7 +386,7 @@ public static Length FromMeters(QuantityValue meters) /// /// Get Length from Microinches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMicroinches(double microinches) @@ -401,7 +401,7 @@ public static Length FromMicroinches(QuantityValue microinches) /// /// Get Length from Micrometers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMicrometers(double micrometers) @@ -416,7 +416,7 @@ public static Length FromMicrometers(QuantityValue micrometers) /// /// Get Length from Mils. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMils(double mils) @@ -431,7 +431,7 @@ public static Length FromMils(QuantityValue mils) /// /// Get Length from Miles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMiles(double miles) @@ -446,7 +446,7 @@ public static Length FromMiles(QuantityValue miles) /// /// Get Length from Millimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromMillimeters(double millimeters) @@ -461,7 +461,7 @@ public static Length FromMillimeters(QuantityValue millimeters) /// /// Get Length from Nanometers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromNanometers(double nanometers) @@ -476,7 +476,7 @@ public static Length FromNanometers(QuantityValue nanometers) /// /// Get Length from NauticalMiles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromNauticalMiles(double nauticalmiles) @@ -491,7 +491,7 @@ public static Length FromNauticalMiles(QuantityValue nauticalmiles) /// /// Get Length from PrinterPicas. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromPrinterPicas(double printerpicas) @@ -506,7 +506,7 @@ public static Length FromPrinterPicas(QuantityValue printerpicas) /// /// Get Length from PrinterPoints. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromPrinterPoints(double printerpoints) @@ -521,7 +521,7 @@ public static Length FromPrinterPoints(QuantityValue printerpoints) /// /// Get Length from Shackles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromShackles(double shackles) @@ -536,7 +536,7 @@ public static Length FromShackles(QuantityValue shackles) /// /// Get Length from Twips. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromTwips(double twips) @@ -551,7 +551,7 @@ public static Length FromTwips(QuantityValue twips) /// /// Get Length from UsSurveyFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromUsSurveyFeet(double ussurveyfeet) @@ -566,7 +566,7 @@ public static Length FromUsSurveyFeet(QuantityValue ussurveyfeet) /// /// Get Length from Yards. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Length FromYards(double yards) diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index aca18a8155..6c91ecd36f 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -88,7 +88,7 @@ static Level() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -150,7 +150,7 @@ public static BaseDimensions BaseDimensions /// /// Get Level from Decibels. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Level FromDecibels(double decibels) @@ -165,7 +165,7 @@ public static Level FromDecibels(QuantityValue decibels) /// /// Get Level from Nepers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Level FromNepers(double nepers) diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 60aaa20323..348f941c22 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -89,7 +89,7 @@ static LinearDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get LinearDensity from GramsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LinearDensity FromGramsPerMeter(double gramspermeter) @@ -171,7 +171,7 @@ public static LinearDensity FromGramsPerMeter(QuantityValue gramspermeter) /// /// Get LinearDensity from KilogramsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LinearDensity FromKilogramsPerMeter(double kilogramspermeter) @@ -186,7 +186,7 @@ public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermete /// /// Get LinearDensity from PoundsPerFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LinearDensity FromPoundsPerFoot(double poundsperfoot) diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index 69eb8ae7eb..41c198207e 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -89,7 +89,7 @@ static LuminousFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get LuminousFlux from Lumens. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LuminousFlux FromLumens(double lumens) diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 6cfd918629..ac1ce0f294 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -89,7 +89,7 @@ static LuminousIntensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get LuminousIntensity from Candela. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static LuminousIntensity FromCandela(double candela) diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 5b972243e6..e3ec597be8 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -89,7 +89,7 @@ static MagneticField() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get MagneticField from Teslas. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MagneticField FromTeslas(double teslas) diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index 4446684dac..03a99e9c45 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -89,7 +89,7 @@ static MagneticFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get MagneticFlux from Webers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MagneticFlux FromWebers(double webers) diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index fae42338b9..cb8998db5e 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -89,7 +89,7 @@ static Magnetization() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Magnetization from AmperesPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Magnetization FromAmperesPerMeter(double amperespermeter) diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 3a5e07b86a..bfab2fd9ea 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -89,7 +89,7 @@ static Mass() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -246,7 +246,7 @@ public static BaseDimensions BaseDimensions /// /// Get Mass from Centigrams. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromCentigrams(double centigrams) @@ -261,7 +261,7 @@ public static Mass FromCentigrams(QuantityValue centigrams) /// /// Get Mass from Decagrams. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromDecagrams(double decagrams) @@ -276,7 +276,7 @@ public static Mass FromDecagrams(QuantityValue decagrams) /// /// Get Mass from Decigrams. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromDecigrams(double decigrams) @@ -291,7 +291,7 @@ public static Mass FromDecigrams(QuantityValue decigrams) /// /// Get Mass from Grams. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromGrams(double grams) @@ -306,7 +306,7 @@ public static Mass FromGrams(QuantityValue grams) /// /// Get Mass from Hectograms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromHectograms(double hectograms) @@ -321,7 +321,7 @@ public static Mass FromHectograms(QuantityValue hectograms) /// /// Get Mass from Kilograms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilograms(double kilograms) @@ -336,7 +336,7 @@ public static Mass FromKilograms(QuantityValue kilograms) /// /// Get Mass from Kilopounds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilopounds(double kilopounds) @@ -351,7 +351,7 @@ public static Mass FromKilopounds(QuantityValue kilopounds) /// /// Get Mass from Kilotonnes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromKilotonnes(double kilotonnes) @@ -366,7 +366,7 @@ public static Mass FromKilotonnes(QuantityValue kilotonnes) /// /// Get Mass from LongHundredweight. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromLongHundredweight(double longhundredweight) @@ -381,7 +381,7 @@ public static Mass FromLongHundredweight(QuantityValue longhundredweight) /// /// Get Mass from LongTons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromLongTons(double longtons) @@ -396,7 +396,7 @@ public static Mass FromLongTons(QuantityValue longtons) /// /// Get Mass from Megapounds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMegapounds(double megapounds) @@ -411,7 +411,7 @@ public static Mass FromMegapounds(QuantityValue megapounds) /// /// Get Mass from Megatonnes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMegatonnes(double megatonnes) @@ -426,7 +426,7 @@ public static Mass FromMegatonnes(QuantityValue megatonnes) /// /// Get Mass from Micrograms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMicrograms(double micrograms) @@ -441,7 +441,7 @@ public static Mass FromMicrograms(QuantityValue micrograms) /// /// Get Mass from Milligrams. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromMilligrams(double milligrams) @@ -456,7 +456,7 @@ public static Mass FromMilligrams(QuantityValue milligrams) /// /// Get Mass from Nanograms. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromNanograms(double nanograms) @@ -471,7 +471,7 @@ public static Mass FromNanograms(QuantityValue nanograms) /// /// Get Mass from Ounces. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromOunces(double ounces) @@ -486,7 +486,7 @@ public static Mass FromOunces(QuantityValue ounces) /// /// Get Mass from Pounds. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromPounds(double pounds) @@ -501,7 +501,7 @@ public static Mass FromPounds(QuantityValue pounds) /// /// Get Mass from ShortHundredweight. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromShortHundredweight(double shorthundredweight) @@ -516,7 +516,7 @@ public static Mass FromShortHundredweight(QuantityValue shorthundredweight) /// /// Get Mass from ShortTons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromShortTons(double shorttons) @@ -531,7 +531,7 @@ public static Mass FromShortTons(QuantityValue shorttons) /// /// Get Mass from Stone. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromStone(double stone) @@ -546,7 +546,7 @@ public static Mass FromStone(QuantityValue stone) /// /// Get Mass from Tonnes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Mass FromTonnes(double tonnes) diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index 6f58d0f63f..a15dacc580 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -89,7 +89,7 @@ static MassFlow() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -216,7 +216,7 @@ public static BaseDimensions BaseDimensions /// /// Get MassFlow from CentigramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromCentigramsPerSecond(double centigramspersecond) @@ -231,7 +231,7 @@ public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond /// /// Get MassFlow from DecagramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromDecagramsPerSecond(double decagramspersecond) @@ -246,7 +246,7 @@ public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) /// /// Get MassFlow from DecigramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromDecigramsPerSecond(double decigramspersecond) @@ -261,7 +261,7 @@ public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) /// /// Get MassFlow from GramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromGramsPerSecond(double gramspersecond) @@ -276,7 +276,7 @@ public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) /// /// Get MassFlow from HectogramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromHectogramsPerSecond(double hectogramspersecond) @@ -291,7 +291,7 @@ public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond /// /// Get MassFlow from KilogramsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromKilogramsPerHour(double kilogramsperhour) @@ -306,7 +306,7 @@ public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) /// /// Get MassFlow from KilogramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromKilogramsPerSecond(double kilogramspersecond) @@ -321,7 +321,7 @@ public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) /// /// Get MassFlow from MegapoundsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMegapoundsPerHour(double megapoundsperhour) @@ -336,7 +336,7 @@ public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) /// /// Get MassFlow from MicrogramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMicrogramsPerSecond(double microgramspersecond) @@ -351,7 +351,7 @@ public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond /// /// Get MassFlow from MilligramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromMilligramsPerSecond(double milligramspersecond) @@ -366,7 +366,7 @@ public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond /// /// Get MassFlow from NanogramsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromNanogramsPerSecond(double nanogramspersecond) @@ -381,7 +381,7 @@ public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) /// /// Get MassFlow from PoundsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromPoundsPerHour(double poundsperhour) @@ -396,7 +396,7 @@ public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) /// /// Get MassFlow from ShortTonsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromShortTonsPerHour(double shorttonsperhour) @@ -411,7 +411,7 @@ public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) /// /// Get MassFlow from TonnesPerDay. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromTonnesPerDay(double tonnesperday) @@ -426,7 +426,7 @@ public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) /// /// Get MassFlow from TonnesPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlow FromTonnesPerHour(double tonnesperhour) diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index e46300d159..f88493f6a0 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -89,7 +89,7 @@ static MassFlux() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -151,7 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get MassFlux from GramsPerSecondPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlux FromGramsPerSecondPerSquareMeter(double gramspersecondpersquaremeter) @@ -166,7 +166,7 @@ public static MassFlux FromGramsPerSecondPerSquareMeter(QuantityValue gramsperse /// /// Get MassFlux from KilogramsPerSecondPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassFlux FromKilogramsPerSecondPerSquareMeter(double kilogramspersecondpersquaremeter) diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 704316dc93..c20bf95dff 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -89,7 +89,7 @@ static MassMomentOfInertia() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -271,7 +271,7 @@ public static BaseDimensions BaseDimensions /// /// Get MassMomentOfInertia from GramSquareCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareCentimeters(double gramsquarecentimeters) @@ -286,7 +286,7 @@ public static MassMomentOfInertia FromGramSquareCentimeters(QuantityValue gramsq /// /// Get MassMomentOfInertia from GramSquareDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareDecimeters(double gramsquaredecimeters) @@ -301,7 +301,7 @@ public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsqu /// /// Get MassMomentOfInertia from GramSquareMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareMeters(double gramsquaremeters) @@ -316,7 +316,7 @@ public static MassMomentOfInertia FromGramSquareMeters(QuantityValue gramsquarem /// /// Get MassMomentOfInertia from GramSquareMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromGramSquareMillimeters(double gramsquaremillimeters) @@ -331,7 +331,7 @@ public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsq /// /// Get MassMomentOfInertia from KilogramSquareCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareCentimeters(double kilogramsquarecentimeters) @@ -346,7 +346,7 @@ public static MassMomentOfInertia FromKilogramSquareCentimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilogramSquareDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareDecimeters(double kilogramsquaredecimeters) @@ -361,7 +361,7 @@ public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kil /// /// Get MassMomentOfInertia from KilogramSquareMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareMeters(double kilogramsquaremeters) @@ -376,7 +376,7 @@ public static MassMomentOfInertia FromKilogramSquareMeters(QuantityValue kilogra /// /// Get MassMomentOfInertia from KilogramSquareMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilogramSquareMillimeters(double kilogramsquaremillimeters) @@ -391,7 +391,7 @@ public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilotonneSquareCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareCentimeters(double kilotonnesquarecentimeters) @@ -406,7 +406,7 @@ public static MassMomentOfInertia FromKilotonneSquareCentimeters(QuantityValue k /// /// Get MassMomentOfInertia from KilotonneSquareDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareDecimeters(double kilotonnesquaredecimeters) @@ -421,7 +421,7 @@ public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue ki /// /// Get MassMomentOfInertia from KilotonneSquareMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareMeters(double kilotonnesquaremeters) @@ -436,7 +436,7 @@ public static MassMomentOfInertia FromKilotonneSquareMeters(QuantityValue kiloto /// /// Get MassMomentOfInertia from KilotonneSquareMilimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromKilotonneSquareMilimeters(double kilotonnesquaremilimeters) @@ -451,7 +451,7 @@ public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue ki /// /// Get MassMomentOfInertia from MegatonneSquareCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareCentimeters(double megatonnesquarecentimeters) @@ -466,7 +466,7 @@ public static MassMomentOfInertia FromMegatonneSquareCentimeters(QuantityValue m /// /// Get MassMomentOfInertia from MegatonneSquareDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareDecimeters(double megatonnesquaredecimeters) @@ -481,7 +481,7 @@ public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue me /// /// Get MassMomentOfInertia from MegatonneSquareMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareMeters(double megatonnesquaremeters) @@ -496,7 +496,7 @@ public static MassMomentOfInertia FromMegatonneSquareMeters(QuantityValue megato /// /// Get MassMomentOfInertia from MegatonneSquareMilimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMegatonneSquareMilimeters(double megatonnesquaremilimeters) @@ -511,7 +511,7 @@ public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue me /// /// Get MassMomentOfInertia from MilligramSquareCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareCentimeters(double milligramsquarecentimeters) @@ -526,7 +526,7 @@ public static MassMomentOfInertia FromMilligramSquareCentimeters(QuantityValue m /// /// Get MassMomentOfInertia from MilligramSquareDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareDecimeters(double milligramsquaredecimeters) @@ -541,7 +541,7 @@ public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue mi /// /// Get MassMomentOfInertia from MilligramSquareMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareMeters(double milligramsquaremeters) @@ -556,7 +556,7 @@ public static MassMomentOfInertia FromMilligramSquareMeters(QuantityValue millig /// /// Get MassMomentOfInertia from MilligramSquareMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromMilligramSquareMillimeters(double milligramsquaremillimeters) @@ -571,7 +571,7 @@ public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue m /// /// Get MassMomentOfInertia from PoundSquareFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromPoundSquareFeet(double poundsquarefeet) @@ -586,7 +586,7 @@ public static MassMomentOfInertia FromPoundSquareFeet(QuantityValue poundsquaref /// /// Get MassMomentOfInertia from PoundSquareInches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromPoundSquareInches(double poundsquareinches) @@ -601,7 +601,7 @@ public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquar /// /// Get MassMomentOfInertia from TonneSquareCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareCentimeters(double tonnesquarecentimeters) @@ -616,7 +616,7 @@ public static MassMomentOfInertia FromTonneSquareCentimeters(QuantityValue tonne /// /// Get MassMomentOfInertia from TonneSquareDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareDecimeters(double tonnesquaredecimeters) @@ -631,7 +631,7 @@ public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnes /// /// Get MassMomentOfInertia from TonneSquareMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareMeters(double tonnesquaremeters) @@ -646,7 +646,7 @@ public static MassMomentOfInertia FromTonneSquareMeters(QuantityValue tonnesquar /// /// Get MassMomentOfInertia from TonneSquareMilimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MassMomentOfInertia FromTonneSquareMilimeters(double tonnesquaremilimeters) diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index e2387f671f..89522b44f4 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -89,7 +89,7 @@ static MolarEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get MolarEnergy from JoulesPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEnergy FromJoulesPerMole(double joulespermole) @@ -171,7 +171,7 @@ public static MolarEnergy FromJoulesPerMole(QuantityValue joulespermole) /// /// Get MolarEnergy from KilojoulesPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEnergy FromKilojoulesPerMole(double kilojoulespermole) @@ -186,7 +186,7 @@ public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) /// /// Get MolarEnergy from MegajoulesPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEnergy FromMegajoulesPerMole(double megajoulespermole) diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index 5c36ca81bc..be9e2836f4 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -89,7 +89,7 @@ static MolarEntropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get MolarEntropy from JoulesPerMoleKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEntropy FromJoulesPerMoleKelvin(double joulespermolekelvin) @@ -171,7 +171,7 @@ public static MolarEntropy FromJoulesPerMoleKelvin(QuantityValue joulespermoleke /// /// Get MolarEntropy from KilojoulesPerMoleKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEntropy FromKilojoulesPerMoleKelvin(double kilojoulespermolekelvin) @@ -186,7 +186,7 @@ public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulesp /// /// Get MolarEntropy from MegajoulesPerMoleKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarEntropy FromMegajoulesPerMoleKelvin(double megajoulespermolekelvin) diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 239b03bc66..415482397c 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -89,7 +89,7 @@ static MolarMass() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -201,7 +201,7 @@ public static BaseDimensions BaseDimensions /// /// Get MolarMass from CentigramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromCentigramsPerMole(double centigramspermole) @@ -216,7 +216,7 @@ public static MolarMass FromCentigramsPerMole(QuantityValue centigramspermole) /// /// Get MolarMass from DecagramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromDecagramsPerMole(double decagramspermole) @@ -231,7 +231,7 @@ public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) /// /// Get MolarMass from DecigramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromDecigramsPerMole(double decigramspermole) @@ -246,7 +246,7 @@ public static MolarMass FromDecigramsPerMole(QuantityValue decigramspermole) /// /// Get MolarMass from GramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromGramsPerMole(double gramspermole) @@ -261,7 +261,7 @@ public static MolarMass FromGramsPerMole(QuantityValue gramspermole) /// /// Get MolarMass from HectogramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromHectogramsPerMole(double hectogramspermole) @@ -276,7 +276,7 @@ public static MolarMass FromHectogramsPerMole(QuantityValue hectogramspermole) /// /// Get MolarMass from KilogramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromKilogramsPerMole(double kilogramspermole) @@ -291,7 +291,7 @@ public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) /// /// Get MolarMass from KilopoundsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromKilopoundsPerMole(double kilopoundspermole) @@ -306,7 +306,7 @@ public static MolarMass FromKilopoundsPerMole(QuantityValue kilopoundspermole) /// /// Get MolarMass from MegapoundsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMegapoundsPerMole(double megapoundspermole) @@ -321,7 +321,7 @@ public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) /// /// Get MolarMass from MicrogramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMicrogramsPerMole(double microgramspermole) @@ -336,7 +336,7 @@ public static MolarMass FromMicrogramsPerMole(QuantityValue microgramspermole) /// /// Get MolarMass from MilligramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromMilligramsPerMole(double milligramspermole) @@ -351,7 +351,7 @@ public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) /// /// Get MolarMass from NanogramsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromNanogramsPerMole(double nanogramspermole) @@ -366,7 +366,7 @@ public static MolarMass FromNanogramsPerMole(QuantityValue nanogramspermole) /// /// Get MolarMass from PoundsPerMole. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static MolarMass FromPoundsPerMole(double poundspermole) diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index 4b8a1d2b91..f124e5f0de 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -89,7 +89,7 @@ static Molarity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -181,7 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get Molarity from CentimolesPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromCentimolesPerLiter(double centimolesperliter) @@ -196,7 +196,7 @@ public static Molarity FromCentimolesPerLiter(QuantityValue centimolesperliter) /// /// Get Molarity from DecimolesPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromDecimolesPerLiter(double decimolesperliter) @@ -211,7 +211,7 @@ public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) /// /// Get Molarity from MicromolesPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMicromolesPerLiter(double micromolesperliter) @@ -226,7 +226,7 @@ public static Molarity FromMicromolesPerLiter(QuantityValue micromolesperliter) /// /// Get Molarity from MillimolesPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMillimolesPerLiter(double millimolesperliter) @@ -241,7 +241,7 @@ public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) /// /// Get Molarity from MolesPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMolesPerCubicMeter(double molespercubicmeter) @@ -256,7 +256,7 @@ public static Molarity FromMolesPerCubicMeter(QuantityValue molespercubicmeter) /// /// Get Molarity from MolesPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromMolesPerLiter(double molesperliter) @@ -271,7 +271,7 @@ public static Molarity FromMolesPerLiter(QuantityValue molesperliter) /// /// Get Molarity from NanomolesPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromNanomolesPerLiter(double nanomolesperliter) @@ -286,7 +286,7 @@ public static Molarity FromNanomolesPerLiter(QuantityValue nanomolesperliter) /// /// Get Molarity from PicomolesPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Molarity FromPicomolesPerLiter(double picomolesperliter) diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index af018b2f6a..6f5328b446 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -89,7 +89,7 @@ static Permeability() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Permeability from HenriesPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Permeability FromHenriesPerMeter(double henriespermeter) diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 81285076ec..b30afd7fee 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -89,7 +89,7 @@ static Permittivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -146,7 +146,7 @@ public static BaseDimensions BaseDimensions /// /// Get Permittivity from FaradsPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Permittivity FromFaradsPerMeter(double faradspermeter) diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index 2da8b1cbd6..48b7f3e2c3 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -89,7 +89,7 @@ static Power() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -241,7 +241,7 @@ public static BaseDimensions BaseDimensions /// /// Get Power from BoilerHorsepower. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromBoilerHorsepower(double boilerhorsepower) @@ -256,7 +256,7 @@ public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) /// /// Get Power from BritishThermalUnitsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromBritishThermalUnitsPerHour(double britishthermalunitsperhour) @@ -271,7 +271,7 @@ public static Power FromBritishThermalUnitsPerHour(QuantityValue britishthermalu /// /// Get Power from Decawatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromDecawatts(double decawatts) @@ -286,7 +286,7 @@ public static Power FromDecawatts(QuantityValue decawatts) /// /// Get Power from Deciwatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromDeciwatts(double deciwatts) @@ -301,7 +301,7 @@ public static Power FromDeciwatts(QuantityValue deciwatts) /// /// Get Power from ElectricalHorsepower. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromElectricalHorsepower(double electricalhorsepower) @@ -316,7 +316,7 @@ public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) /// /// Get Power from Femtowatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromFemtowatts(double femtowatts) @@ -331,7 +331,7 @@ public static Power FromFemtowatts(QuantityValue femtowatts) /// /// Get Power from Gigawatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromGigawatts(double gigawatts) @@ -346,7 +346,7 @@ public static Power FromGigawatts(QuantityValue gigawatts) /// /// Get Power from HydraulicHorsepower. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromHydraulicHorsepower(double hydraulichorsepower) @@ -361,7 +361,7 @@ public static Power FromHydraulicHorsepower(QuantityValue hydraulichorsepower) /// /// Get Power from KilobritishThermalUnitsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromKilobritishThermalUnitsPerHour(double kilobritishthermalunitsperhour) @@ -376,7 +376,7 @@ public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritish /// /// Get Power from Kilowatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromKilowatts(double kilowatts) @@ -391,7 +391,7 @@ public static Power FromKilowatts(QuantityValue kilowatts) /// /// Get Power from MechanicalHorsepower. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMechanicalHorsepower(double mechanicalhorsepower) @@ -406,7 +406,7 @@ public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) /// /// Get Power from Megawatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMegawatts(double megawatts) @@ -421,7 +421,7 @@ public static Power FromMegawatts(QuantityValue megawatts) /// /// Get Power from MetricHorsepower. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMetricHorsepower(double metrichorsepower) @@ -436,7 +436,7 @@ public static Power FromMetricHorsepower(QuantityValue metrichorsepower) /// /// Get Power from Microwatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMicrowatts(double microwatts) @@ -451,7 +451,7 @@ public static Power FromMicrowatts(QuantityValue microwatts) /// /// Get Power from Milliwatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromMilliwatts(double milliwatts) @@ -466,7 +466,7 @@ public static Power FromMilliwatts(QuantityValue milliwatts) /// /// Get Power from Nanowatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromNanowatts(double nanowatts) @@ -481,7 +481,7 @@ public static Power FromNanowatts(QuantityValue nanowatts) /// /// Get Power from Petawatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromPetawatts(double petawatts) @@ -496,7 +496,7 @@ public static Power FromPetawatts(QuantityValue petawatts) /// /// Get Power from Picowatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromPicowatts(double picowatts) @@ -511,7 +511,7 @@ public static Power FromPicowatts(QuantityValue picowatts) /// /// Get Power from Terawatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromTerawatts(double terawatts) @@ -526,7 +526,7 @@ public static Power FromTerawatts(QuantityValue terawatts) /// /// Get Power from Watts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Power FromWatts(double watts) diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 8fc50c7df5..96475c0e53 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -89,7 +89,7 @@ static PowerDensity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -361,7 +361,7 @@ public static BaseDimensions BaseDimensions /// /// Get PowerDensity from DecawattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerCubicFoot(double decawattspercubicfoot) @@ -376,7 +376,7 @@ public static PowerDensity FromDecawattsPerCubicFoot(QuantityValue decawattsperc /// /// Get PowerDensity from DecawattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerCubicInch(double decawattspercubicinch) @@ -391,7 +391,7 @@ public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattsperc /// /// Get PowerDensity from DecawattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerCubicMeter(double decawattspercubicmeter) @@ -406,7 +406,7 @@ public static PowerDensity FromDecawattsPerCubicMeter(QuantityValue decawattsper /// /// Get PowerDensity from DecawattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDecawattsPerLiter(double decawattsperliter) @@ -421,7 +421,7 @@ public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter /// /// Get PowerDensity from DeciwattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerCubicFoot(double deciwattspercubicfoot) @@ -436,7 +436,7 @@ public static PowerDensity FromDeciwattsPerCubicFoot(QuantityValue deciwattsperc /// /// Get PowerDensity from DeciwattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerCubicInch(double deciwattspercubicinch) @@ -451,7 +451,7 @@ public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattsperc /// /// Get PowerDensity from DeciwattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerCubicMeter(double deciwattspercubicmeter) @@ -466,7 +466,7 @@ public static PowerDensity FromDeciwattsPerCubicMeter(QuantityValue deciwattsper /// /// Get PowerDensity from DeciwattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromDeciwattsPerLiter(double deciwattsperliter) @@ -481,7 +481,7 @@ public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter /// /// Get PowerDensity from GigawattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerCubicFoot(double gigawattspercubicfoot) @@ -496,7 +496,7 @@ public static PowerDensity FromGigawattsPerCubicFoot(QuantityValue gigawattsperc /// /// Get PowerDensity from GigawattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerCubicInch(double gigawattspercubicinch) @@ -511,7 +511,7 @@ public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattsperc /// /// Get PowerDensity from GigawattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerCubicMeter(double gigawattspercubicmeter) @@ -526,7 +526,7 @@ public static PowerDensity FromGigawattsPerCubicMeter(QuantityValue gigawattsper /// /// Get PowerDensity from GigawattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromGigawattsPerLiter(double gigawattsperliter) @@ -541,7 +541,7 @@ public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter /// /// Get PowerDensity from KilowattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerCubicFoot(double kilowattspercubicfoot) @@ -556,7 +556,7 @@ public static PowerDensity FromKilowattsPerCubicFoot(QuantityValue kilowattsperc /// /// Get PowerDensity from KilowattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerCubicInch(double kilowattspercubicinch) @@ -571,7 +571,7 @@ public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattsperc /// /// Get PowerDensity from KilowattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerCubicMeter(double kilowattspercubicmeter) @@ -586,7 +586,7 @@ public static PowerDensity FromKilowattsPerCubicMeter(QuantityValue kilowattsper /// /// Get PowerDensity from KilowattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromKilowattsPerLiter(double kilowattsperliter) @@ -601,7 +601,7 @@ public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter /// /// Get PowerDensity from MegawattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerCubicFoot(double megawattspercubicfoot) @@ -616,7 +616,7 @@ public static PowerDensity FromMegawattsPerCubicFoot(QuantityValue megawattsperc /// /// Get PowerDensity from MegawattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerCubicInch(double megawattspercubicinch) @@ -631,7 +631,7 @@ public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattsperc /// /// Get PowerDensity from MegawattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerCubicMeter(double megawattspercubicmeter) @@ -646,7 +646,7 @@ public static PowerDensity FromMegawattsPerCubicMeter(QuantityValue megawattsper /// /// Get PowerDensity from MegawattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMegawattsPerLiter(double megawattsperliter) @@ -661,7 +661,7 @@ public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter /// /// Get PowerDensity from MicrowattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerCubicFoot(double microwattspercubicfoot) @@ -676,7 +676,7 @@ public static PowerDensity FromMicrowattsPerCubicFoot(QuantityValue microwattspe /// /// Get PowerDensity from MicrowattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerCubicInch(double microwattspercubicinch) @@ -691,7 +691,7 @@ public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspe /// /// Get PowerDensity from MicrowattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerCubicMeter(double microwattspercubicmeter) @@ -706,7 +706,7 @@ public static PowerDensity FromMicrowattsPerCubicMeter(QuantityValue microwattsp /// /// Get PowerDensity from MicrowattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMicrowattsPerLiter(double microwattsperliter) @@ -721,7 +721,7 @@ public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperlit /// /// Get PowerDensity from MilliwattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerCubicFoot(double milliwattspercubicfoot) @@ -736,7 +736,7 @@ public static PowerDensity FromMilliwattsPerCubicFoot(QuantityValue milliwattspe /// /// Get PowerDensity from MilliwattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerCubicInch(double milliwattspercubicinch) @@ -751,7 +751,7 @@ public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspe /// /// Get PowerDensity from MilliwattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerCubicMeter(double milliwattspercubicmeter) @@ -766,7 +766,7 @@ public static PowerDensity FromMilliwattsPerCubicMeter(QuantityValue milliwattsp /// /// Get PowerDensity from MilliwattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromMilliwattsPerLiter(double milliwattsperliter) @@ -781,7 +781,7 @@ public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperlit /// /// Get PowerDensity from NanowattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerCubicFoot(double nanowattspercubicfoot) @@ -796,7 +796,7 @@ public static PowerDensity FromNanowattsPerCubicFoot(QuantityValue nanowattsperc /// /// Get PowerDensity from NanowattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerCubicInch(double nanowattspercubicinch) @@ -811,7 +811,7 @@ public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattsperc /// /// Get PowerDensity from NanowattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerCubicMeter(double nanowattspercubicmeter) @@ -826,7 +826,7 @@ public static PowerDensity FromNanowattsPerCubicMeter(QuantityValue nanowattsper /// /// Get PowerDensity from NanowattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromNanowattsPerLiter(double nanowattsperliter) @@ -841,7 +841,7 @@ public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter /// /// Get PowerDensity from PicowattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerCubicFoot(double picowattspercubicfoot) @@ -856,7 +856,7 @@ public static PowerDensity FromPicowattsPerCubicFoot(QuantityValue picowattsperc /// /// Get PowerDensity from PicowattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerCubicInch(double picowattspercubicinch) @@ -871,7 +871,7 @@ public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattsperc /// /// Get PowerDensity from PicowattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerCubicMeter(double picowattspercubicmeter) @@ -886,7 +886,7 @@ public static PowerDensity FromPicowattsPerCubicMeter(QuantityValue picowattsper /// /// Get PowerDensity from PicowattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromPicowattsPerLiter(double picowattsperliter) @@ -901,7 +901,7 @@ public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter /// /// Get PowerDensity from TerawattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerCubicFoot(double terawattspercubicfoot) @@ -916,7 +916,7 @@ public static PowerDensity FromTerawattsPerCubicFoot(QuantityValue terawattsperc /// /// Get PowerDensity from TerawattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerCubicInch(double terawattspercubicinch) @@ -931,7 +931,7 @@ public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattsperc /// /// Get PowerDensity from TerawattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerCubicMeter(double terawattspercubicmeter) @@ -946,7 +946,7 @@ public static PowerDensity FromTerawattsPerCubicMeter(QuantityValue terawattsper /// /// Get PowerDensity from TerawattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromTerawattsPerLiter(double terawattsperliter) @@ -961,7 +961,7 @@ public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter /// /// Get PowerDensity from WattsPerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerCubicFoot(double wattspercubicfoot) @@ -976,7 +976,7 @@ public static PowerDensity FromWattsPerCubicFoot(QuantityValue wattspercubicfoot /// /// Get PowerDensity from WattsPerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerCubicInch(double wattspercubicinch) @@ -991,7 +991,7 @@ public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch /// /// Get PowerDensity from WattsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerCubicMeter(double wattspercubicmeter) @@ -1006,7 +1006,7 @@ public static PowerDensity FromWattsPerCubicMeter(QuantityValue wattspercubicmet /// /// Get PowerDensity from WattsPerLiter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerDensity FromWattsPerLiter(double wattsperliter) diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index c29b805dea..fb6fa26a3e 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -88,7 +88,7 @@ static PowerRatio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -150,7 +150,7 @@ public static BaseDimensions BaseDimensions /// /// Get PowerRatio from DecibelMilliwatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerRatio FromDecibelMilliwatts(double decibelmilliwatts) @@ -165,7 +165,7 @@ public static PowerRatio FromDecibelMilliwatts(QuantityValue decibelmilliwatts) /// /// Get PowerRatio from DecibelWatts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PowerRatio FromDecibelWatts(double decibelwatts) diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index cd493da2b2..d41790233a 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -89,7 +89,7 @@ static Pressure() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -326,7 +326,7 @@ public static BaseDimensions BaseDimensions /// /// Get Pressure from Atmospheres. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromAtmospheres(double atmospheres) @@ -341,7 +341,7 @@ public static Pressure FromAtmospheres(QuantityValue atmospheres) /// /// Get Pressure from Bars. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromBars(double bars) @@ -356,7 +356,7 @@ public static Pressure FromBars(QuantityValue bars) /// /// Get Pressure from Centibars. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromCentibars(double centibars) @@ -371,7 +371,7 @@ public static Pressure FromCentibars(QuantityValue centibars) /// /// Get Pressure from Decapascals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromDecapascals(double decapascals) @@ -386,7 +386,7 @@ public static Pressure FromDecapascals(QuantityValue decapascals) /// /// Get Pressure from Decibars. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromDecibars(double decibars) @@ -401,7 +401,7 @@ public static Pressure FromDecibars(QuantityValue decibars) /// /// Get Pressure from FeetOfHead. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromFeetOfHead(double feetofhead) @@ -416,7 +416,7 @@ public static Pressure FromFeetOfHead(QuantityValue feetofhead) /// /// Get Pressure from Gigapascals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromGigapascals(double gigapascals) @@ -431,7 +431,7 @@ public static Pressure FromGigapascals(QuantityValue gigapascals) /// /// Get Pressure from Hectopascals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromHectopascals(double hectopascals) @@ -446,7 +446,7 @@ public static Pressure FromHectopascals(QuantityValue hectopascals) /// /// Get Pressure from InchesOfMercury. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromInchesOfMercury(double inchesofmercury) @@ -461,7 +461,7 @@ public static Pressure FromInchesOfMercury(QuantityValue inchesofmercury) /// /// Get Pressure from Kilobars. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilobars(double kilobars) @@ -476,7 +476,7 @@ public static Pressure FromKilobars(QuantityValue kilobars) /// /// Get Pressure from KilogramsForcePerSquareCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilogramsForcePerSquareCentimeter(double kilogramsforcepersquarecentimeter) @@ -491,7 +491,7 @@ public static Pressure FromKilogramsForcePerSquareCentimeter(QuantityValue kilog /// /// Get Pressure from KilogramsForcePerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilogramsForcePerSquareMeter(double kilogramsforcepersquaremeter) @@ -506,7 +506,7 @@ public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsf /// /// Get Pressure from KilogramsForcePerSquareMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilogramsForcePerSquareMillimeter(double kilogramsforcepersquaremillimeter) @@ -521,7 +521,7 @@ public static Pressure FromKilogramsForcePerSquareMillimeter(QuantityValue kilog /// /// Get Pressure from KilonewtonsPerSquareCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareCentimeter(double kilonewtonspersquarecentimeter) @@ -536,7 +536,7 @@ public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewt /// /// Get Pressure from KilonewtonsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareMeter(double kilonewtonspersquaremeter) @@ -551,7 +551,7 @@ public static Pressure FromKilonewtonsPerSquareMeter(QuantityValue kilonewtonspe /// /// Get Pressure from KilonewtonsPerSquareMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilonewtonsPerSquareMillimeter(double kilonewtonspersquaremillimeter) @@ -566,7 +566,7 @@ public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewt /// /// Get Pressure from Kilopascals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilopascals(double kilopascals) @@ -581,7 +581,7 @@ public static Pressure FromKilopascals(QuantityValue kilopascals) /// /// Get Pressure from KilopoundsForcePerSquareFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilopoundsForcePerSquareFoot(double kilopoundsforcepersquarefoot) @@ -596,7 +596,7 @@ public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopounds /// /// Get Pressure from KilopoundsForcePerSquareInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromKilopoundsForcePerSquareInch(double kilopoundsforcepersquareinch) @@ -611,7 +611,7 @@ public static Pressure FromKilopoundsForcePerSquareInch(QuantityValue kilopounds /// /// Get Pressure from Megabars. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMegabars(double megabars) @@ -626,7 +626,7 @@ public static Pressure FromMegabars(QuantityValue megabars) /// /// Get Pressure from MeganewtonsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMeganewtonsPerSquareMeter(double meganewtonspersquaremeter) @@ -641,7 +641,7 @@ public static Pressure FromMeganewtonsPerSquareMeter(QuantityValue meganewtonspe /// /// Get Pressure from Megapascals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMegapascals(double megapascals) @@ -656,7 +656,7 @@ public static Pressure FromMegapascals(QuantityValue megapascals) /// /// Get Pressure from MetersOfHead. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMetersOfHead(double metersofhead) @@ -671,7 +671,7 @@ public static Pressure FromMetersOfHead(QuantityValue metersofhead) /// /// Get Pressure from Micropascals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMicropascals(double micropascals) @@ -686,7 +686,7 @@ public static Pressure FromMicropascals(QuantityValue micropascals) /// /// Get Pressure from Millibars. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMillibars(double millibars) @@ -701,7 +701,7 @@ public static Pressure FromMillibars(QuantityValue millibars) /// /// Get Pressure from MillimetersOfMercury. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromMillimetersOfMercury(double millimetersofmercury) @@ -716,7 +716,7 @@ public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercu /// /// Get Pressure from NewtonsPerSquareCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromNewtonsPerSquareCentimeter(double newtonspersquarecentimeter) @@ -731,7 +731,7 @@ public static Pressure FromNewtonsPerSquareCentimeter(QuantityValue newtonspersq /// /// Get Pressure from NewtonsPerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromNewtonsPerSquareMeter(double newtonspersquaremeter) @@ -746,7 +746,7 @@ public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquarem /// /// Get Pressure from NewtonsPerSquareMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromNewtonsPerSquareMillimeter(double newtonspersquaremillimeter) @@ -761,7 +761,7 @@ public static Pressure FromNewtonsPerSquareMillimeter(QuantityValue newtonspersq /// /// Get Pressure from Pascals. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPascals(double pascals) @@ -776,7 +776,7 @@ public static Pressure FromPascals(QuantityValue pascals) /// /// Get Pressure from PoundsForcePerSquareFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPoundsForcePerSquareFoot(double poundsforcepersquarefoot) @@ -791,7 +791,7 @@ public static Pressure FromPoundsForcePerSquareFoot(QuantityValue poundsforceper /// /// Get Pressure from PoundsForcePerSquareInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromPoundsForcePerSquareInch(double poundsforcepersquareinch) @@ -806,7 +806,7 @@ public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforceper /// /// Get Pressure from TechnicalAtmospheres. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTechnicalAtmospheres(double technicalatmospheres) @@ -821,7 +821,7 @@ public static Pressure FromTechnicalAtmospheres(QuantityValue technicalatmospher /// /// Get Pressure from TonnesForcePerSquareCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareCentimeter(double tonnesforcepersquarecentimeter) @@ -836,7 +836,7 @@ public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesfo /// /// Get Pressure from TonnesForcePerSquareMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareMeter(double tonnesforcepersquaremeter) @@ -851,7 +851,7 @@ public static Pressure FromTonnesForcePerSquareMeter(QuantityValue tonnesforcepe /// /// Get Pressure from TonnesForcePerSquareMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTonnesForcePerSquareMillimeter(double tonnesforcepersquaremillimeter) @@ -866,7 +866,7 @@ public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesfo /// /// Get Pressure from Torrs. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Pressure FromTorrs(double torrs) diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index a7bca66b8d..ae29fd01b2 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -89,7 +89,7 @@ static PressureChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -161,7 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get PressureChangeRate from AtmospheresPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromAtmospheresPerSecond(double atmospherespersecond) @@ -176,7 +176,7 @@ public static PressureChangeRate FromAtmospheresPerSecond(QuantityValue atmosphe /// /// Get PressureChangeRate from KilopascalsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromKilopascalsPerSecond(double kilopascalspersecond) @@ -191,7 +191,7 @@ public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopasc /// /// Get PressureChangeRate from MegapascalsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromMegapascalsPerSecond(double megapascalspersecond) @@ -206,7 +206,7 @@ public static PressureChangeRate FromMegapascalsPerSecond(QuantityValue megapasc /// /// Get PressureChangeRate from PascalsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static PressureChangeRate FromPascalsPerSecond(double pascalspersecond) diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index c8dc7585b2..5cd499aca0 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -88,7 +88,7 @@ static Ratio() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -170,7 +170,7 @@ public static BaseDimensions BaseDimensions /// /// Get Ratio from DecimalFractions. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromDecimalFractions(double decimalfractions) @@ -185,7 +185,7 @@ public static Ratio FromDecimalFractions(QuantityValue decimalfractions) /// /// Get Ratio from PartsPerBillion. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerBillion(double partsperbillion) @@ -200,7 +200,7 @@ public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) /// /// Get Ratio from PartsPerMillion. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerMillion(double partspermillion) @@ -215,7 +215,7 @@ public static Ratio FromPartsPerMillion(QuantityValue partspermillion) /// /// Get Ratio from PartsPerThousand. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerThousand(double partsperthousand) @@ -230,7 +230,7 @@ public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) /// /// Get Ratio from PartsPerTrillion. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPartsPerTrillion(double partspertrillion) @@ -245,7 +245,7 @@ public static Ratio FromPartsPerTrillion(QuantityValue partspertrillion) /// /// Get Ratio from Percent. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Ratio FromPercent(double percent) diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index 87082d3a0c..8aeda23be5 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -89,7 +89,7 @@ static ReactiveEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get ReactiveEnergy from KilovoltampereReactiveHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactiveEnergy FromKilovoltampereReactiveHours(double kilovoltamperereactivehours) @@ -171,7 +171,7 @@ public static ReactiveEnergy FromKilovoltampereReactiveHours(QuantityValue kilov /// /// Get ReactiveEnergy from MegavoltampereReactiveHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactiveEnergy FromMegavoltampereReactiveHours(double megavoltamperereactivehours) @@ -186,7 +186,7 @@ public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megav /// /// Get ReactiveEnergy from VoltampereReactiveHours. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactiveEnergy FromVoltampereReactiveHours(double voltamperereactivehours) diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index 81ce0dcb4c..dd16e29098 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -89,7 +89,7 @@ static ReactivePower() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -161,7 +161,7 @@ public static BaseDimensions BaseDimensions /// /// Get ReactivePower from GigavoltamperesReactive. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromGigavoltamperesReactive(double gigavoltamperesreactive) @@ -176,7 +176,7 @@ public static ReactivePower FromGigavoltamperesReactive(QuantityValue gigavoltam /// /// Get ReactivePower from KilovoltamperesReactive. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromKilovoltamperesReactive(double kilovoltamperesreactive) @@ -191,7 +191,7 @@ public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltam /// /// Get ReactivePower from MegavoltamperesReactive. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromMegavoltamperesReactive(double megavoltamperesreactive) @@ -206,7 +206,7 @@ public static ReactivePower FromMegavoltamperesReactive(QuantityValue megavoltam /// /// Get ReactivePower from VoltamperesReactive. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ReactivePower FromVoltamperesReactive(double voltamperesreactive) diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 5ed3448120..b3da859a51 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -89,7 +89,7 @@ static RotationalAcceleration() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalAcceleration from DegreesPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalAcceleration FromDegreesPerSecondSquared(double degreespersecondsquared) @@ -171,7 +171,7 @@ public static RotationalAcceleration FromDegreesPerSecondSquared(QuantityValue d /// /// Get RotationalAcceleration from RadiansPerSecondSquared. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalAcceleration FromRadiansPerSecondSquared(double radianspersecondsquared) @@ -186,7 +186,7 @@ public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue r /// /// Get RotationalAcceleration from RevolutionsPerMinutePerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(double revolutionsperminutepersecond) diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index e2507c8cf2..bac0b2696a 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -89,7 +89,7 @@ static RotationalSpeed() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -206,7 +206,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalSpeed from CentiradiansPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromCentiradiansPerSecond(double centiradianspersecond) @@ -221,7 +221,7 @@ public static RotationalSpeed FromCentiradiansPerSecond(QuantityValue centiradia /// /// Get RotationalSpeed from DeciradiansPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDeciradiansPerSecond(double deciradianspersecond) @@ -236,7 +236,7 @@ public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradians /// /// Get RotationalSpeed from DegreesPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDegreesPerMinute(double degreesperminute) @@ -251,7 +251,7 @@ public static RotationalSpeed FromDegreesPerMinute(QuantityValue degreesperminut /// /// Get RotationalSpeed from DegreesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromDegreesPerSecond(double degreespersecond) @@ -266,7 +266,7 @@ public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecon /// /// Get RotationalSpeed from MicrodegreesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMicrodegreesPerSecond(double microdegreespersecond) @@ -281,7 +281,7 @@ public static RotationalSpeed FromMicrodegreesPerSecond(QuantityValue microdegre /// /// Get RotationalSpeed from MicroradiansPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMicroradiansPerSecond(double microradianspersecond) @@ -296,7 +296,7 @@ public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradia /// /// Get RotationalSpeed from MillidegreesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMillidegreesPerSecond(double millidegreespersecond) @@ -311,7 +311,7 @@ public static RotationalSpeed FromMillidegreesPerSecond(QuantityValue millidegre /// /// Get RotationalSpeed from MilliradiansPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromMilliradiansPerSecond(double milliradianspersecond) @@ -326,7 +326,7 @@ public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradia /// /// Get RotationalSpeed from NanodegreesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromNanodegreesPerSecond(double nanodegreespersecond) @@ -341,7 +341,7 @@ public static RotationalSpeed FromNanodegreesPerSecond(QuantityValue nanodegrees /// /// Get RotationalSpeed from NanoradiansPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromNanoradiansPerSecond(double nanoradianspersecond) @@ -356,7 +356,7 @@ public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradians /// /// Get RotationalSpeed from RadiansPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromRadiansPerSecond(double radianspersecond) @@ -371,7 +371,7 @@ public static RotationalSpeed FromRadiansPerSecond(QuantityValue radianspersecon /// /// Get RotationalSpeed from RevolutionsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromRevolutionsPerMinute(double revolutionsperminute) @@ -386,7 +386,7 @@ public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutions /// /// Get RotationalSpeed from RevolutionsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalSpeed FromRevolutionsPerSecond(double revolutionspersecond) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 01e440954e..3e1c56dcb9 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -89,7 +89,7 @@ static RotationalStiffness() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalStiffness from KilonewtonMetersPerRadian. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffness FromKilonewtonMetersPerRadian(double kilonewtonmetersperradian) @@ -171,7 +171,7 @@ public static RotationalStiffness FromKilonewtonMetersPerRadian(QuantityValue ki /// /// Get RotationalStiffness from MeganewtonMetersPerRadian. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffness FromMeganewtonMetersPerRadian(double meganewtonmetersperradian) @@ -186,7 +186,7 @@ public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue me /// /// Get RotationalStiffness from NewtonMetersPerRadian. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffness FromNewtonMetersPerRadian(double newtonmetersperradian) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 96621d76bd..5caca3d77f 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -89,7 +89,7 @@ static RotationalStiffnessPerLength() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -156,7 +156,7 @@ public static BaseDimensions BaseDimensions /// /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(double kilonewtonmetersperradianpermeter) @@ -171,7 +171,7 @@ public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter /// /// Get RotationalStiffnessPerLength from MeganewtonMetersPerRadianPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(double meganewtonmetersperradianpermeter) @@ -186,7 +186,7 @@ public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter /// /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(double newtonmetersperradianpermeter) diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 36100ea60a..c0ca84ee21 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -88,7 +88,7 @@ static SolidAngle() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -145,7 +145,7 @@ public static BaseDimensions BaseDimensions /// /// Get SolidAngle from Steradians. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SolidAngle FromSteradians(double steradians) diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index ee2c24a778..e54e9bfa4c 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -89,7 +89,7 @@ static SpecificEnergy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -181,7 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificEnergy from CaloriesPerGram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromCaloriesPerGram(double caloriespergram) @@ -196,7 +196,7 @@ public static SpecificEnergy FromCaloriesPerGram(QuantityValue caloriespergram) /// /// Get SpecificEnergy from JoulesPerKilogram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromJoulesPerKilogram(double joulesperkilogram) @@ -211,7 +211,7 @@ public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogr /// /// Get SpecificEnergy from KilocaloriesPerGram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromKilocaloriesPerGram(double kilocaloriespergram) @@ -226,7 +226,7 @@ public static SpecificEnergy FromKilocaloriesPerGram(QuantityValue kilocaloriesp /// /// Get SpecificEnergy from KilojoulesPerKilogram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromKilojoulesPerKilogram(double kilojoulesperkilogram) @@ -241,7 +241,7 @@ public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesp /// /// Get SpecificEnergy from KilowattHoursPerKilogram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromKilowattHoursPerKilogram(double kilowatthoursperkilogram) @@ -256,7 +256,7 @@ public static SpecificEnergy FromKilowattHoursPerKilogram(QuantityValue kilowatt /// /// Get SpecificEnergy from MegajoulesPerKilogram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromMegajoulesPerKilogram(double megajoulesperkilogram) @@ -271,7 +271,7 @@ public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesp /// /// Get SpecificEnergy from MegawattHoursPerKilogram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromMegawattHoursPerKilogram(double megawatthoursperkilogram) @@ -286,7 +286,7 @@ public static SpecificEnergy FromMegawattHoursPerKilogram(QuantityValue megawatt /// /// Get SpecificEnergy from WattHoursPerKilogram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEnergy FromWattHoursPerKilogram(double watthoursperkilogram) diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 709f4e1e5f..8532c5d830 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -89,7 +89,7 @@ static SpecificEntropy() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -181,7 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificEntropy from CaloriesPerGramKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromCaloriesPerGramKelvin(double caloriespergramkelvin) @@ -196,7 +196,7 @@ public static SpecificEntropy FromCaloriesPerGramKelvin(QuantityValue caloriespe /// /// Get SpecificEntropy from JoulesPerKilogramDegreeCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(double joulesperkilogramdegreecelsius) @@ -211,7 +211,7 @@ public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue j /// /// Get SpecificEntropy from JoulesPerKilogramKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromJoulesPerKilogramKelvin(double joulesperkilogramkelvin) @@ -226,7 +226,7 @@ public static SpecificEntropy FromJoulesPerKilogramKelvin(QuantityValue joulespe /// /// Get SpecificEntropy from KilocaloriesPerGramKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilocaloriesPerGramKelvin(double kilocaloriespergramkelvin) @@ -241,7 +241,7 @@ public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kiloca /// /// Get SpecificEntropy from KilojoulesPerKilogramDegreeCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(double kilojoulesperkilogramdegreecelsius) @@ -256,7 +256,7 @@ public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(QuantityVal /// /// Get SpecificEntropy from KilojoulesPerKilogramKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromKilojoulesPerKilogramKelvin(double kilojoulesperkilogramkelvin) @@ -271,7 +271,7 @@ public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilo /// /// Get SpecificEntropy from MegajoulesPerKilogramDegreeCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(double megajoulesperkilogramdegreecelsius) @@ -286,7 +286,7 @@ public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(QuantityVal /// /// Get SpecificEntropy from MegajoulesPerKilogramKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificEntropy FromMegajoulesPerKilogramKelvin(double megajoulesperkilogramkelvin) diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 74b6afc20d..2e2a36831c 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -89,7 +89,7 @@ static SpecificVolume() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -151,7 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificVolume from CubicFeetPerPound. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificVolume FromCubicFeetPerPound(double cubicfeetperpound) @@ -166,7 +166,7 @@ public static SpecificVolume FromCubicFeetPerPound(QuantityValue cubicfeetperpou /// /// Get SpecificVolume from CubicMetersPerKilogram. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificVolume FromCubicMetersPerKilogram(double cubicmetersperkilogram) diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index cae4a22cb7..7c6102ff5b 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -89,7 +89,7 @@ static SpecificWeight() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -226,7 +226,7 @@ public static BaseDimensions BaseDimensions /// /// Get SpecificWeight from KilogramsForcePerCubicCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilogramsForcePerCubicCentimeter(double kilogramsforcepercubiccentimeter) @@ -241,7 +241,7 @@ public static SpecificWeight FromKilogramsForcePerCubicCentimeter(QuantityValue /// /// Get SpecificWeight from KilogramsForcePerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilogramsForcePerCubicMeter(double kilogramsforcepercubicmeter) @@ -256,7 +256,7 @@ public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilog /// /// Get SpecificWeight from KilogramsForcePerCubicMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilogramsForcePerCubicMillimeter(double kilogramsforcepercubicmillimeter) @@ -271,7 +271,7 @@ public static SpecificWeight FromKilogramsForcePerCubicMillimeter(QuantityValue /// /// Get SpecificWeight from KilonewtonsPerCubicCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicCentimeter(double kilonewtonspercubiccentimeter) @@ -286,7 +286,7 @@ public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kil /// /// Get SpecificWeight from KilonewtonsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicMeter(double kilonewtonspercubicmeter) @@ -301,7 +301,7 @@ public static SpecificWeight FromKilonewtonsPerCubicMeter(QuantityValue kilonewt /// /// Get SpecificWeight from KilonewtonsPerCubicMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilonewtonsPerCubicMillimeter(double kilonewtonspercubicmillimeter) @@ -316,7 +316,7 @@ public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kil /// /// Get SpecificWeight from KilopoundsForcePerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilopoundsForcePerCubicFoot(double kilopoundsforcepercubicfoot) @@ -331,7 +331,7 @@ public static SpecificWeight FromKilopoundsForcePerCubicFoot(QuantityValue kilop /// /// Get SpecificWeight from KilopoundsForcePerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromKilopoundsForcePerCubicInch(double kilopoundsforcepercubicinch) @@ -346,7 +346,7 @@ public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilop /// /// Get SpecificWeight from MeganewtonsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromMeganewtonsPerCubicMeter(double meganewtonspercubicmeter) @@ -361,7 +361,7 @@ public static SpecificWeight FromMeganewtonsPerCubicMeter(QuantityValue meganewt /// /// Get SpecificWeight from NewtonsPerCubicCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicCentimeter(double newtonspercubiccentimeter) @@ -376,7 +376,7 @@ public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtons /// /// Get SpecificWeight from NewtonsPerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicMeter(double newtonspercubicmeter) @@ -391,7 +391,7 @@ public static SpecificWeight FromNewtonsPerCubicMeter(QuantityValue newtonspercu /// /// Get SpecificWeight from NewtonsPerCubicMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromNewtonsPerCubicMillimeter(double newtonspercubicmillimeter) @@ -406,7 +406,7 @@ public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtons /// /// Get SpecificWeight from PoundsForcePerCubicFoot. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromPoundsForcePerCubicFoot(double poundsforcepercubicfoot) @@ -421,7 +421,7 @@ public static SpecificWeight FromPoundsForcePerCubicFoot(QuantityValue poundsfor /// /// Get SpecificWeight from PoundsForcePerCubicInch. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromPoundsForcePerCubicInch(double poundsforcepercubicinch) @@ -436,7 +436,7 @@ public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsfor /// /// Get SpecificWeight from TonnesForcePerCubicCentimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromTonnesForcePerCubicCentimeter(double tonnesforcepercubiccentimeter) @@ -451,7 +451,7 @@ public static SpecificWeight FromTonnesForcePerCubicCentimeter(QuantityValue ton /// /// Get SpecificWeight from TonnesForcePerCubicMeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromTonnesForcePerCubicMeter(double tonnesforcepercubicmeter) @@ -466,7 +466,7 @@ public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesfo /// /// Get SpecificWeight from TonnesForcePerCubicMillimeter. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static SpecificWeight FromTonnesForcePerCubicMillimeter(double tonnesforcepercubicmillimeter) diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index c028f1a85e..6ded617e3f 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -89,7 +89,7 @@ static Speed() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -301,7 +301,7 @@ public static BaseDimensions BaseDimensions /// /// Get Speed from CentimetersPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromCentimetersPerHour(double centimetersperhour) @@ -316,7 +316,7 @@ public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) /// /// Get Speed from CentimetersPerMinutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromCentimetersPerMinutes(double centimetersperminutes) @@ -331,7 +331,7 @@ public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminute /// /// Get Speed from CentimetersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromCentimetersPerSecond(double centimeterspersecond) @@ -346,7 +346,7 @@ public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) /// /// Get Speed from DecimetersPerMinutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromDecimetersPerMinutes(double decimetersperminutes) @@ -361,7 +361,7 @@ public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) /// /// Get Speed from DecimetersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromDecimetersPerSecond(double decimeterspersecond) @@ -376,7 +376,7 @@ public static Speed FromDecimetersPerSecond(QuantityValue decimeterspersecond) /// /// Get Speed from FeetPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerHour(double feetperhour) @@ -391,7 +391,7 @@ public static Speed FromFeetPerHour(QuantityValue feetperhour) /// /// Get Speed from FeetPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerMinute(double feetperminute) @@ -406,7 +406,7 @@ public static Speed FromFeetPerMinute(QuantityValue feetperminute) /// /// Get Speed from FeetPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromFeetPerSecond(double feetpersecond) @@ -421,7 +421,7 @@ public static Speed FromFeetPerSecond(QuantityValue feetpersecond) /// /// Get Speed from InchesPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromInchesPerHour(double inchesperhour) @@ -436,7 +436,7 @@ public static Speed FromInchesPerHour(QuantityValue inchesperhour) /// /// Get Speed from InchesPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromInchesPerMinute(double inchesperminute) @@ -451,7 +451,7 @@ public static Speed FromInchesPerMinute(QuantityValue inchesperminute) /// /// Get Speed from InchesPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromInchesPerSecond(double inchespersecond) @@ -466,7 +466,7 @@ public static Speed FromInchesPerSecond(QuantityValue inchespersecond) /// /// Get Speed from KilometersPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerHour(double kilometersperhour) @@ -481,7 +481,7 @@ public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) /// /// Get Speed from KilometersPerMinutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerMinutes(double kilometersperminutes) @@ -496,7 +496,7 @@ public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) /// /// Get Speed from KilometersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKilometersPerSecond(double kilometerspersecond) @@ -511,7 +511,7 @@ public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) /// /// Get Speed from Knots. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromKnots(double knots) @@ -526,7 +526,7 @@ public static Speed FromKnots(QuantityValue knots) /// /// Get Speed from MetersPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerHour(double metersperhour) @@ -541,7 +541,7 @@ public static Speed FromMetersPerHour(QuantityValue metersperhour) /// /// Get Speed from MetersPerMinutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerMinutes(double metersperminutes) @@ -556,7 +556,7 @@ public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) /// /// Get Speed from MetersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMetersPerSecond(double meterspersecond) @@ -571,7 +571,7 @@ public static Speed FromMetersPerSecond(QuantityValue meterspersecond) /// /// Get Speed from MicrometersPerMinutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMicrometersPerMinutes(double micrometersperminutes) @@ -586,7 +586,7 @@ public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminute /// /// Get Speed from MicrometersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMicrometersPerSecond(double micrometerspersecond) @@ -601,7 +601,7 @@ public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) /// /// Get Speed from MilesPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMilesPerHour(double milesperhour) @@ -616,7 +616,7 @@ public static Speed FromMilesPerHour(QuantityValue milesperhour) /// /// Get Speed from MillimetersPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerHour(double millimetersperhour) @@ -631,7 +631,7 @@ public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) /// /// Get Speed from MillimetersPerMinutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerMinutes(double millimetersperminutes) @@ -646,7 +646,7 @@ public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminute /// /// Get Speed from MillimetersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromMillimetersPerSecond(double millimeterspersecond) @@ -661,7 +661,7 @@ public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) /// /// Get Speed from NanometersPerMinutes. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromNanometersPerMinutes(double nanometersperminutes) @@ -676,7 +676,7 @@ public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) /// /// Get Speed from NanometersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromNanometersPerSecond(double nanometerspersecond) @@ -691,7 +691,7 @@ public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) /// /// Get Speed from UsSurveyFeetPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromUsSurveyFeetPerHour(double ussurveyfeetperhour) @@ -706,7 +706,7 @@ public static Speed FromUsSurveyFeetPerHour(QuantityValue ussurveyfeetperhour) /// /// Get Speed from UsSurveyFeetPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromUsSurveyFeetPerMinute(double ussurveyfeetperminute) @@ -721,7 +721,7 @@ public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminut /// /// Get Speed from UsSurveyFeetPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromUsSurveyFeetPerSecond(double ussurveyfeetpersecond) @@ -736,7 +736,7 @@ public static Speed FromUsSurveyFeetPerSecond(QuantityValue ussurveyfeetpersecon /// /// Get Speed from YardsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerHour(double yardsperhour) @@ -751,7 +751,7 @@ public static Speed FromYardsPerHour(QuantityValue yardsperhour) /// /// Get Speed from YardsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerMinute(double yardsperminute) @@ -766,7 +766,7 @@ public static Speed FromYardsPerMinute(QuantityValue yardsperminute) /// /// Get Speed from YardsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Speed FromYardsPerSecond(double yardspersecond) diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 169c3d73cf..5d2447f2a0 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -89,7 +89,7 @@ static Temperature() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -181,7 +181,7 @@ public static BaseDimensions BaseDimensions /// /// Get Temperature from DegreesCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesCelsius(double degreescelsius) @@ -196,7 +196,7 @@ public static Temperature FromDegreesCelsius(QuantityValue degreescelsius) /// /// Get Temperature from DegreesDelisle. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesDelisle(double degreesdelisle) @@ -211,7 +211,7 @@ public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) /// /// Get Temperature from DegreesFahrenheit. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesFahrenheit(double degreesfahrenheit) @@ -226,7 +226,7 @@ public static Temperature FromDegreesFahrenheit(QuantityValue degreesfahrenheit) /// /// Get Temperature from DegreesNewton. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesNewton(double degreesnewton) @@ -241,7 +241,7 @@ public static Temperature FromDegreesNewton(QuantityValue degreesnewton) /// /// Get Temperature from DegreesRankine. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesRankine(double degreesrankine) @@ -256,7 +256,7 @@ public static Temperature FromDegreesRankine(QuantityValue degreesrankine) /// /// Get Temperature from DegreesReaumur. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesReaumur(double degreesreaumur) @@ -271,7 +271,7 @@ public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) /// /// Get Temperature from DegreesRoemer. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromDegreesRoemer(double degreesroemer) @@ -286,7 +286,7 @@ public static Temperature FromDegreesRoemer(QuantityValue degreesroemer) /// /// Get Temperature from Kelvins. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Temperature FromKelvins(double kelvins) diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 73d3a39302..37f9778815 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -89,7 +89,7 @@ static TemperatureChangeRate() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -191,7 +191,7 @@ public static BaseDimensions BaseDimensions /// /// Get TemperatureChangeRate from CentidegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(double centidegreescelsiuspersecond) @@ -206,7 +206,7 @@ public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from DecadegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(double decadegreescelsiuspersecond) @@ -221,7 +221,7 @@ public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValu /// /// Get TemperatureChangeRate from DecidegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(double decidegreescelsiuspersecond) @@ -236,7 +236,7 @@ public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(QuantityValu /// /// Get TemperatureChangeRate from DegreesCelsiusPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDegreesCelsiusPerMinute(double degreescelsiusperminute) @@ -251,7 +251,7 @@ public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue de /// /// Get TemperatureChangeRate from DegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromDegreesCelsiusPerSecond(double degreescelsiuspersecond) @@ -266,7 +266,7 @@ public static TemperatureChangeRate FromDegreesCelsiusPerSecond(QuantityValue de /// /// Get TemperatureChangeRate from HectodegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(double hectodegreescelsiuspersecond) @@ -281,7 +281,7 @@ public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from KilodegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(double kilodegreescelsiuspersecond) @@ -296,7 +296,7 @@ public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(QuantityValu /// /// Get TemperatureChangeRate from MicrodegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(double microdegreescelsiuspersecond) @@ -311,7 +311,7 @@ public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from MillidegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(double millidegreescelsiuspersecond) @@ -326,7 +326,7 @@ public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(QuantityVal /// /// Get TemperatureChangeRate from NanodegreesCelsiusPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(double nanodegreescelsiuspersecond) diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index c33e4e3b6c..92107dc00b 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -88,7 +88,7 @@ static TemperatureDelta() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -180,7 +180,7 @@ public static BaseDimensions BaseDimensions /// /// Get TemperatureDelta from DegreesCelsius. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesCelsius(double degreescelsius) @@ -195,7 +195,7 @@ public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) /// /// Get TemperatureDelta from DegreesDelisle. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesDelisle(double degreesdelisle) @@ -210,7 +210,7 @@ public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) /// /// Get TemperatureDelta from DegreesFahrenheit. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesFahrenheit(double degreesfahrenheit) @@ -225,7 +225,7 @@ public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahren /// /// Get TemperatureDelta from DegreesNewton. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesNewton(double degreesnewton) @@ -240,7 +240,7 @@ public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) /// /// Get TemperatureDelta from DegreesRankine. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesRankine(double degreesrankine) @@ -255,7 +255,7 @@ public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) /// /// Get TemperatureDelta from DegreesReaumur. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesReaumur(double degreesreaumur) @@ -270,7 +270,7 @@ public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) /// /// Get TemperatureDelta from DegreesRoemer. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromDegreesRoemer(double degreesroemer) @@ -285,7 +285,7 @@ public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) /// /// Get TemperatureDelta from Kelvins. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static TemperatureDelta FromKelvins(double kelvins) diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index 1d725f6e98..d7c3926e7e 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -89,7 +89,7 @@ static ThermalConductivity() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -151,7 +151,7 @@ public static BaseDimensions BaseDimensions /// /// Get ThermalConductivity from BtusPerHourFootFahrenheit. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalConductivity FromBtusPerHourFootFahrenheit(double btusperhourfootfahrenheit) @@ -166,7 +166,7 @@ public static ThermalConductivity FromBtusPerHourFootFahrenheit(QuantityValue bt /// /// Get ThermalConductivity from WattsPerMeterKelvin. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalConductivity FromWattsPerMeterKelvin(double wattspermeterkelvin) diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index c2742c7044..091113d46a 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -89,7 +89,7 @@ static ThermalResistance() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -166,7 +166,7 @@ public static BaseDimensions BaseDimensions /// /// Get ThermalResistance from HourSquareFeetDegreesFahrenheitPerBtu. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(double hoursquarefeetdegreesfahrenheitperbtu) @@ -181,7 +181,7 @@ public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(Quanti /// /// Get ThermalResistance from SquareCentimeterHourDegreesCelsiusPerKilocalorie. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(double squarecentimeterhourdegreescelsiusperkilocalorie) @@ -196,7 +196,7 @@ public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocal /// /// Get ThermalResistance from SquareCentimeterKelvinsPerWatt. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(double squarecentimeterkelvinsperwatt) @@ -211,7 +211,7 @@ public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(QuantityValue /// /// Get ThermalResistance from SquareMeterDegreesCelsiusPerWatt. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(double squaremeterdegreescelsiusperwatt) @@ -226,7 +226,7 @@ public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityVal /// /// Get ThermalResistance from SquareMeterKelvinsPerKilowatt. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(double squaremeterkelvinsperkilowatt) diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index 6c243f3593..ba8f2958e8 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -89,7 +89,7 @@ static Torque() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -246,7 +246,7 @@ public static BaseDimensions BaseDimensions /// /// Get Torque from KilogramForceCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilogramForceCentimeters(double kilogramforcecentimeters) @@ -261,7 +261,7 @@ public static Torque FromKilogramForceCentimeters(QuantityValue kilogramforcecen /// /// Get Torque from KilogramForceMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilogramForceMeters(double kilogramforcemeters) @@ -276,7 +276,7 @@ public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) /// /// Get Torque from KilogramForceMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilogramForceMillimeters(double kilogramforcemillimeters) @@ -291,7 +291,7 @@ public static Torque FromKilogramForceMillimeters(QuantityValue kilogramforcemil /// /// Get Torque from KilonewtonCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonCentimeters(double kilonewtoncentimeters) @@ -306,7 +306,7 @@ public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimete /// /// Get Torque from KilonewtonMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonMeters(double kilonewtonmeters) @@ -321,7 +321,7 @@ public static Torque FromKilonewtonMeters(QuantityValue kilonewtonmeters) /// /// Get Torque from KilonewtonMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilonewtonMillimeters(double kilonewtonmillimeters) @@ -336,7 +336,7 @@ public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimete /// /// Get Torque from KilopoundForceFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilopoundForceFeet(double kilopoundforcefeet) @@ -351,7 +351,7 @@ public static Torque FromKilopoundForceFeet(QuantityValue kilopoundforcefeet) /// /// Get Torque from KilopoundForceInches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromKilopoundForceInches(double kilopoundforceinches) @@ -366,7 +366,7 @@ public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches /// /// Get Torque from MeganewtonCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMeganewtonCentimeters(double meganewtoncentimeters) @@ -381,7 +381,7 @@ public static Torque FromMeganewtonCentimeters(QuantityValue meganewtoncentimete /// /// Get Torque from MeganewtonMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMeganewtonMeters(double meganewtonmeters) @@ -396,7 +396,7 @@ public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) /// /// Get Torque from MeganewtonMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMeganewtonMillimeters(double meganewtonmillimeters) @@ -411,7 +411,7 @@ public static Torque FromMeganewtonMillimeters(QuantityValue meganewtonmillimete /// /// Get Torque from MegapoundForceFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMegapoundForceFeet(double megapoundforcefeet) @@ -426,7 +426,7 @@ public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) /// /// Get Torque from MegapoundForceInches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromMegapoundForceInches(double megapoundforceinches) @@ -441,7 +441,7 @@ public static Torque FromMegapoundForceInches(QuantityValue megapoundforceinches /// /// Get Torque from NewtonCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonCentimeters(double newtoncentimeters) @@ -456,7 +456,7 @@ public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) /// /// Get Torque from NewtonMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonMeters(double newtonmeters) @@ -471,7 +471,7 @@ public static Torque FromNewtonMeters(QuantityValue newtonmeters) /// /// Get Torque from NewtonMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromNewtonMillimeters(double newtonmillimeters) @@ -486,7 +486,7 @@ public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) /// /// Get Torque from PoundForceFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromPoundForceFeet(double poundforcefeet) @@ -501,7 +501,7 @@ public static Torque FromPoundForceFeet(QuantityValue poundforcefeet) /// /// Get Torque from PoundForceInches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromPoundForceInches(double poundforceinches) @@ -516,7 +516,7 @@ public static Torque FromPoundForceInches(QuantityValue poundforceinches) /// /// Get Torque from TonneForceCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromTonneForceCentimeters(double tonneforcecentimeters) @@ -531,7 +531,7 @@ public static Torque FromTonneForceCentimeters(QuantityValue tonneforcecentimete /// /// Get Torque from TonneForceMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromTonneForceMeters(double tonneforcemeters) @@ -546,7 +546,7 @@ public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) /// /// Get Torque from TonneForceMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Torque FromTonneForceMillimeters(double tonneforcemillimeters) diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 3d141b1e31..abf8b640ac 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -88,7 +88,7 @@ static VitaminA() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -145,7 +145,7 @@ public static BaseDimensions BaseDimensions /// /// Get VitaminA from InternationalUnits. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VitaminA FromInternationalUnits(double internationalunits) diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 0f30f9f93e..fae05ffe42 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -89,7 +89,7 @@ static Volume() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -351,7 +351,7 @@ public static BaseDimensions BaseDimensions /// /// Get Volume from AuTablespoons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromAuTablespoons(double autablespoons) @@ -366,7 +366,7 @@ public static Volume FromAuTablespoons(QuantityValue autablespoons) /// /// Get Volume from Centiliters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCentiliters(double centiliters) @@ -381,7 +381,7 @@ public static Volume FromCentiliters(QuantityValue centiliters) /// /// Get Volume from CubicCentimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicCentimeters(double cubiccentimeters) @@ -396,7 +396,7 @@ public static Volume FromCubicCentimeters(QuantityValue cubiccentimeters) /// /// Get Volume from CubicDecimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicDecimeters(double cubicdecimeters) @@ -411,7 +411,7 @@ public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) /// /// Get Volume from CubicFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicFeet(double cubicfeet) @@ -426,7 +426,7 @@ public static Volume FromCubicFeet(QuantityValue cubicfeet) /// /// Get Volume from CubicInches. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicInches(double cubicinches) @@ -441,7 +441,7 @@ public static Volume FromCubicInches(QuantityValue cubicinches) /// /// Get Volume from CubicKilometers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicKilometers(double cubickilometers) @@ -456,7 +456,7 @@ public static Volume FromCubicKilometers(QuantityValue cubickilometers) /// /// Get Volume from CubicMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMeters(double cubicmeters) @@ -471,7 +471,7 @@ public static Volume FromCubicMeters(QuantityValue cubicmeters) /// /// Get Volume from CubicMicrometers. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMicrometers(double cubicmicrometers) @@ -486,7 +486,7 @@ public static Volume FromCubicMicrometers(QuantityValue cubicmicrometers) /// /// Get Volume from CubicMiles. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMiles(double cubicmiles) @@ -501,7 +501,7 @@ public static Volume FromCubicMiles(QuantityValue cubicmiles) /// /// Get Volume from CubicMillimeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicMillimeters(double cubicmillimeters) @@ -516,7 +516,7 @@ public static Volume FromCubicMillimeters(QuantityValue cubicmillimeters) /// /// Get Volume from CubicYards. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromCubicYards(double cubicyards) @@ -531,7 +531,7 @@ public static Volume FromCubicYards(QuantityValue cubicyards) /// /// Get Volume from Deciliters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromDeciliters(double deciliters) @@ -546,7 +546,7 @@ public static Volume FromDeciliters(QuantityValue deciliters) /// /// Get Volume from HectocubicFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectocubicFeet(double hectocubicfeet) @@ -561,7 +561,7 @@ public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) /// /// Get Volume from HectocubicMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectocubicMeters(double hectocubicmeters) @@ -576,7 +576,7 @@ public static Volume FromHectocubicMeters(QuantityValue hectocubicmeters) /// /// Get Volume from Hectoliters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromHectoliters(double hectoliters) @@ -591,7 +591,7 @@ public static Volume FromHectoliters(QuantityValue hectoliters) /// /// Get Volume from ImperialBeerBarrels. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromImperialBeerBarrels(double imperialbeerbarrels) @@ -606,7 +606,7 @@ public static Volume FromImperialBeerBarrels(QuantityValue imperialbeerbarrels) /// /// Get Volume from ImperialGallons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromImperialGallons(double imperialgallons) @@ -621,7 +621,7 @@ public static Volume FromImperialGallons(QuantityValue imperialgallons) /// /// Get Volume from ImperialOunces. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromImperialOunces(double imperialounces) @@ -636,7 +636,7 @@ public static Volume FromImperialOunces(QuantityValue imperialounces) /// /// Get Volume from KilocubicFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKilocubicFeet(double kilocubicfeet) @@ -651,7 +651,7 @@ public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) /// /// Get Volume from KilocubicMeters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKilocubicMeters(double kilocubicmeters) @@ -666,7 +666,7 @@ public static Volume FromKilocubicMeters(QuantityValue kilocubicmeters) /// /// Get Volume from KiloimperialGallons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKiloimperialGallons(double kiloimperialgallons) @@ -681,7 +681,7 @@ public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) /// /// Get Volume from KilousGallons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromKilousGallons(double kilousgallons) @@ -696,7 +696,7 @@ public static Volume FromKilousGallons(QuantityValue kilousgallons) /// /// Get Volume from Liters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromLiters(double liters) @@ -711,7 +711,7 @@ public static Volume FromLiters(QuantityValue liters) /// /// Get Volume from MegacubicFeet. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMegacubicFeet(double megacubicfeet) @@ -726,7 +726,7 @@ public static Volume FromMegacubicFeet(QuantityValue megacubicfeet) /// /// Get Volume from MegaimperialGallons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMegaimperialGallons(double megaimperialgallons) @@ -741,7 +741,7 @@ public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) /// /// Get Volume from MegausGallons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMegausGallons(double megausgallons) @@ -756,7 +756,7 @@ public static Volume FromMegausGallons(QuantityValue megausgallons) /// /// Get Volume from MetricCups. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMetricCups(double metriccups) @@ -771,7 +771,7 @@ public static Volume FromMetricCups(QuantityValue metriccups) /// /// Get Volume from MetricTeaspoons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMetricTeaspoons(double metricteaspoons) @@ -786,7 +786,7 @@ public static Volume FromMetricTeaspoons(QuantityValue metricteaspoons) /// /// Get Volume from Microliters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMicroliters(double microliters) @@ -801,7 +801,7 @@ public static Volume FromMicroliters(QuantityValue microliters) /// /// Get Volume from Milliliters. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromMilliliters(double milliliters) @@ -816,7 +816,7 @@ public static Volume FromMilliliters(QuantityValue milliliters) /// /// Get Volume from OilBarrels. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromOilBarrels(double oilbarrels) @@ -831,7 +831,7 @@ public static Volume FromOilBarrels(QuantityValue oilbarrels) /// /// Get Volume from UkTablespoons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUkTablespoons(double uktablespoons) @@ -846,7 +846,7 @@ public static Volume FromUkTablespoons(QuantityValue uktablespoons) /// /// Get Volume from UsBeerBarrels. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsBeerBarrels(double usbeerbarrels) @@ -861,7 +861,7 @@ public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) /// /// Get Volume from UsCustomaryCups. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsCustomaryCups(double uscustomarycups) @@ -876,7 +876,7 @@ public static Volume FromUsCustomaryCups(QuantityValue uscustomarycups) /// /// Get Volume from UsGallons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsGallons(double usgallons) @@ -891,7 +891,7 @@ public static Volume FromUsGallons(QuantityValue usgallons) /// /// Get Volume from UsLegalCups. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsLegalCups(double uslegalcups) @@ -906,7 +906,7 @@ public static Volume FromUsLegalCups(QuantityValue uslegalcups) /// /// Get Volume from UsOunces. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsOunces(double usounces) @@ -921,7 +921,7 @@ public static Volume FromUsOunces(QuantityValue usounces) /// /// Get Volume from UsPints. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsPints(double uspints) @@ -936,7 +936,7 @@ public static Volume FromUsPints(QuantityValue uspints) /// /// Get Volume from UsQuarts. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsQuarts(double usquarts) @@ -951,7 +951,7 @@ public static Volume FromUsQuarts(QuantityValue usquarts) /// /// Get Volume from UsTablespoons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsTablespoons(double ustablespoons) @@ -966,7 +966,7 @@ public static Volume FromUsTablespoons(QuantityValue ustablespoons) /// /// Get Volume from UsTeaspoons. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static Volume FromUsTeaspoons(double usteaspoons) diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 92fe5cb645..103e01bdb5 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -89,7 +89,7 @@ static VolumeFlow() /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -271,7 +271,7 @@ public static BaseDimensions BaseDimensions /// /// Get VolumeFlow from CentilitersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCentilitersPerMinute(double centilitersperminute) @@ -286,7 +286,7 @@ public static VolumeFlow FromCentilitersPerMinute(QuantityValue centiliterspermi /// /// Get VolumeFlow from CubicDecimetersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) @@ -301,7 +301,7 @@ public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimet /// /// Get VolumeFlow from CubicFeetPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicFeetPerHour(double cubicfeetperhour) @@ -316,7 +316,7 @@ public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) /// /// Get VolumeFlow from CubicFeetPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicFeetPerMinute(double cubicfeetperminute) @@ -331,7 +331,7 @@ public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute /// /// Get VolumeFlow from CubicFeetPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicFeetPerSecond(double cubicfeetpersecond) @@ -346,7 +346,7 @@ public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond /// /// Get VolumeFlow from CubicMetersPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerHour(double cubicmetersperhour) @@ -361,7 +361,7 @@ public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour /// /// Get VolumeFlow from CubicMetersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerMinute(double cubicmetersperminute) @@ -376,7 +376,7 @@ public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmeterspermi /// /// Get VolumeFlow from CubicMetersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicMetersPerSecond(double cubicmeterspersecond) @@ -391,7 +391,7 @@ public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmetersperse /// /// Get VolumeFlow from CubicYardsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicYardsPerHour(double cubicyardsperhour) @@ -406,7 +406,7 @@ public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) /// /// Get VolumeFlow from CubicYardsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicYardsPerMinute(double cubicyardsperminute) @@ -421,7 +421,7 @@ public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminu /// /// Get VolumeFlow from CubicYardsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromCubicYardsPerSecond(double cubicyardspersecond) @@ -436,7 +436,7 @@ public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardsperseco /// /// Get VolumeFlow from DecilitersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromDecilitersPerMinute(double decilitersperminute) @@ -451,7 +451,7 @@ public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminu /// /// Get VolumeFlow from KilolitersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromKilolitersPerMinute(double kilolitersperminute) @@ -466,7 +466,7 @@ public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminu /// /// Get VolumeFlow from LitersPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerHour(double litersperhour) @@ -481,7 +481,7 @@ public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) /// /// Get VolumeFlow from LitersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerMinute(double litersperminute) @@ -496,7 +496,7 @@ public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) /// /// Get VolumeFlow from LitersPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromLitersPerSecond(double literspersecond) @@ -511,7 +511,7 @@ public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) /// /// Get VolumeFlow from MicrolitersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromMicrolitersPerMinute(double microlitersperminute) @@ -526,7 +526,7 @@ public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microliterspermi /// /// Get VolumeFlow from MillilitersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromMillilitersPerMinute(double millilitersperminute) @@ -541,7 +541,7 @@ public static VolumeFlow FromMillilitersPerMinute(QuantityValue milliliterspermi /// /// Get VolumeFlow from MillionUsGallonsPerDay. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromMillionUsGallonsPerDay(double millionusgallonsperday) @@ -556,7 +556,7 @@ public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallo /// /// Get VolumeFlow from NanolitersPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromNanolitersPerMinute(double nanolitersperminute) @@ -571,7 +571,7 @@ public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminu /// /// Get VolumeFlow from OilBarrelsPerDay. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromOilBarrelsPerDay(double oilbarrelsperday) @@ -586,7 +586,7 @@ public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) /// /// Get VolumeFlow from OilBarrelsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromOilBarrelsPerHour(double oilbarrelsperhour) @@ -601,7 +601,7 @@ public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) /// /// Get VolumeFlow from OilBarrelsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromOilBarrelsPerMinute(double oilbarrelsperminute) @@ -616,7 +616,7 @@ public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminu /// /// Get VolumeFlow from UsGallonsPerHour. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerHour(double usgallonsperhour) @@ -631,7 +631,7 @@ public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) /// /// Get VolumeFlow from UsGallonsPerMinute. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerMinute(double usgallonsperminute) @@ -646,7 +646,7 @@ public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute /// /// Get VolumeFlow from UsGallonsPerSecond. /// - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static VolumeFlow FromUsGallonsPerSecond(double usgallonspersecond) diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 871268b1ef..f4a9a1a28c 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -123,7 +123,7 @@ if ($obsoleteAttribute) /// The numeric value to contruct this quantity with. /// The unit representation to contruct this quantity with. /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. #if WINDOWS_UWP private #else @@ -202,7 +202,7 @@ if ($obsoleteAttribute) /// /// Get $quantityName from $($unit.PluralName). /// $($obsoleteAttribute) - /// If value is NaN or Infinity. #if WINDOWS_UWP [Windows.Foundation.Metadata.DefaultOverload] public static $quantityName From$($unit.PluralName)(double $valueParamName) From c84aadd5933bb9d216779df1178b81b77d83c2da Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 3 Oct 2018 02:13:01 -0400 Subject: [PATCH 044/131] Remove extension methods (#505) * Prefer code in extra.cs to extension methods * Removing extensions comments in headers to fully deprecate extension metods. Removing unused script code for extensions. * Fix for WRC * Favor instance methods over statics for ToXXX conversions. * Area.extra.cs: Minor code cleanup --- .../Quantities/Acceleration.Common.g.cs | 1 - .../Quantities/AmountOfSubstance.Common.g.cs | 1 - .../Quantities/AmplitudeRatio.Common.g.cs | 1 - .../Quantities/Angle.Common.g.cs | 1 - .../Quantities/ApparentEnergy.Common.g.cs | 1 - .../Quantities/ApparentPower.Common.g.cs | 1 - .../GeneratedCode/Quantities/Area.Common.g.cs | 1 - .../Quantities/AreaDensity.Common.g.cs | 1 - .../AreaMomentOfInertia.Common.g.cs | 1 - .../Quantities/BitRate.Common.g.cs | 1 - .../BrakeSpecificFuelConsumption.Common.g.cs | 1 - .../Quantities/Capacitance.Common.g.cs | 1 - .../Quantities/Density.Common.g.cs | 1 - .../Quantities/Duration.Common.g.cs | 1 - .../Quantities/DynamicViscosity.Common.g.cs | 1 - .../Quantities/ElectricAdmittance.Common.g.cs | 1 - .../Quantities/ElectricCharge.Common.g.cs | 1 - .../ElectricChargeDensity.Common.g.cs | 1 - .../ElectricConductance.Common.g.cs | 1 - .../ElectricConductivity.Common.g.cs | 1 - .../Quantities/ElectricCurrent.Common.g.cs | 1 - .../ElectricCurrentDensity.Common.g.cs | 1 - .../ElectricCurrentGradient.Common.g.cs | 1 - .../Quantities/ElectricField.Common.g.cs | 1 - .../Quantities/ElectricInductance.Common.g.cs | 1 - .../Quantities/ElectricPotential.Common.g.cs | 1 - .../ElectricPotentialAc.Common.g.cs | 1 - .../ElectricPotentialDc.Common.g.cs | 1 - .../Quantities/ElectricResistance.Common.g.cs | 1 - .../ElectricResistivity.Common.g.cs | 1 - .../Quantities/Energy.Common.g.cs | 1 - .../Quantities/Entropy.Common.g.cs | 1 - .../Quantities/Force.Common.g.cs | 1 - .../Quantities/ForceChangeRate.Common.g.cs | 1 - .../Quantities/ForcePerLength.Common.g.cs | 1 - .../Quantities/Frequency.Common.g.cs | 1 - .../Quantities/HeatFlux.Common.g.cs | 1 - .../HeatTransferCoefficient.Common.g.cs | 1 - .../Quantities/Illuminance.Common.g.cs | 1 - .../Quantities/Information.Common.g.cs | 1 - .../Quantities/Irradiance.Common.g.cs | 1 - .../Quantities/Irradiation.Common.g.cs | 1 - .../Quantities/KinematicViscosity.Common.g.cs | 1 - .../Quantities/LapseRate.Common.g.cs | 1 - .../Quantities/Length.Common.g.cs | 1 - .../Quantities/Level.Common.g.cs | 1 - .../Quantities/LinearDensity.Common.g.cs | 1 - .../Quantities/LuminousFlux.Common.g.cs | 1 - .../Quantities/LuminousIntensity.Common.g.cs | 1 - .../Quantities/MagneticField.Common.g.cs | 1 - .../Quantities/MagneticFlux.Common.g.cs | 1 - .../Quantities/Magnetization.Common.g.cs | 1 - .../GeneratedCode/Quantities/Mass.Common.g.cs | 1 - .../Quantities/MassFlow.Common.g.cs | 1 - .../Quantities/MassFlux.Common.g.cs | 1 - .../MassMomentOfInertia.Common.g.cs | 1 - .../Quantities/MolarEnergy.Common.g.cs | 1 - .../Quantities/MolarEntropy.Common.g.cs | 1 - .../Quantities/MolarMass.Common.g.cs | 1 - .../Quantities/Molarity.Common.g.cs | 1 - .../Quantities/Permeability.Common.g.cs | 1 - .../Quantities/Permittivity.Common.g.cs | 1 - .../Quantities/Power.Common.g.cs | 1 - .../Quantities/PowerDensity.Common.g.cs | 1 - .../Quantities/PowerRatio.Common.g.cs | 1 - .../Quantities/Pressure.Common.g.cs | 1 - .../Quantities/PressureChangeRate.Common.g.cs | 1 - .../Quantities/Ratio.Common.g.cs | 1 - .../Quantities/ReactiveEnergy.Common.g.cs | 1 - .../Quantities/ReactivePower.Common.g.cs | 1 - .../RotationalAcceleration.Common.g.cs | 1 - .../Quantities/RotationalSpeed.Common.g.cs | 1 - .../RotationalStiffness.Common.g.cs | 1 - .../RotationalStiffnessPerLength.Common.g.cs | 1 - .../Quantities/SolidAngle.Common.g.cs | 1 - .../Quantities/SpecificEnergy.Common.g.cs | 1 - .../Quantities/SpecificEntropy.Common.g.cs | 1 - .../Quantities/SpecificVolume.Common.g.cs | 1 - .../Quantities/SpecificWeight.Common.g.cs | 1 - .../Quantities/Speed.Common.g.cs | 1 - .../Quantities/Temperature.Common.g.cs | 1 - .../TemperatureChangeRate.Common.g.cs | 1 - .../Quantities/TemperatureDelta.Common.g.cs | 1 - .../ThermalConductivity.Common.g.cs | 1 - .../Quantities/ThermalResistance.Common.g.cs | 1 - .../Quantities/Torque.Common.g.cs | 1 - .../Quantities/VitaminA.Common.g.cs | 1 - .../Quantities/Volume.Common.g.cs | 1 - .../Quantities/VolumeFlow.Common.g.cs | 1 - .../CustomCode/AmountOfSubstanceTests.cs | 1 - .../CustomCode/AmplitudeRatioTests.cs | 5 +- .../CustomCode/ApparentEnergyTests.cs | 1 - .../CustomCode/ApparentPowerTests.cs | 1 - UnitsNet.Tests/CustomCode/AreaDensityTests.cs | 1 - .../CustomCode/AreaMomentOfInertiaTests.cs | 1 - UnitsNet.Tests/CustomCode/BitRateTests.cs | 1 - UnitsNet.Tests/CustomCode/CapacitanceTests.cs | 1 - UnitsNet.Tests/CustomCode/DensityTests.cs | 1 - .../CustomCode/ElectricAdmittanceTests.cs | 1 - .../CustomCode/ElectricChargeDensityTests.cs | 1 - .../CustomCode/ElectricChargeTests.cs | 1 - .../CustomCode/ElectricConductanceTests.cs | 1 - .../CustomCode/ElectricConductivityTests.cs | 1 - .../CustomCode/ElectricCurrentDensityTests.cs | 1 - .../ElectricCurrentGradientTests.cs | 1 - .../CustomCode/ElectricFieldTests.cs | 1 - .../CustomCode/ElectricInductanceTests.cs | 1 - .../CustomCode/ElectricPotentialAcTests.cs | 1 - .../CustomCode/ElectricPotentialDcTests.cs | 1 - .../CustomCode/ElectricResistivityTests.cs | 1 - UnitsNet.Tests/CustomCode/EntropyTests.cs | 1 - .../CustomCode/ForcePerLengthTests.cs | 1 - UnitsNet.Tests/CustomCode/HeatFluxTests.cs | 1 - .../HeatTransferCoefficientTests.cs | 1 - UnitsNet.Tests/CustomCode/IlluminanceTests.cs | 1 - UnitsNet.Tests/CustomCode/IrradianceTests.cs | 1 - UnitsNet.Tests/CustomCode/IrradiationTests.cs | 1 - UnitsNet.Tests/CustomCode/LapseRateTests.cs | 1 - .../CustomCode/LinearDensityTests.cs | 1 - .../CustomCode/LuminousFluxTests.cs | 1 - .../CustomCode/LuminousIntensityTests.cs | 1 - .../CustomCode/MagneticFieldTests.cs | 1 - .../CustomCode/MagneticFluxTests.cs | 1 - .../CustomCode/MagnetizationTests.cs | 1 - UnitsNet.Tests/CustomCode/MassFluxTests.cs | 1 - .../CustomCode/MassMomentOfInertiaTests.cs | 1 - UnitsNet.Tests/CustomCode/MolarEnergyTests.cs | 1 - .../CustomCode/MolarEntropyTests.cs | 1 - UnitsNet.Tests/CustomCode/MolarMassTests.cs | 1 - UnitsNet.Tests/CustomCode/MolarityTests.cs | 2 - .../CustomCode/PermeabilityTests.cs | 1 - .../CustomCode/PermittivityTests.cs | 1 - .../CustomCode/PowerDensityTests.cs | 1 - UnitsNet.Tests/CustomCode/PowerRatioTests.cs | 5 +- .../CustomCode/ReactiveEnergyTests.cs | 1 - .../CustomCode/ReactivePowerTests.cs | 1 - .../CustomCode/RotationalAccelerationTests.cs | 1 - .../RotationalStiffnessPerLengthTests.cs | 1 - .../CustomCode/RotationalStiffnessTests.cs | 1 - UnitsNet.Tests/CustomCode/SolidAngleTests.cs | 1 - .../CustomCode/SpecificEntropyTests.cs | 1 - .../CustomCode/SpecificVolumeTests.cs | 1 - .../CustomCode/TemperatureDeltaTests.cs | 1 - .../CustomCode/ThermalConductivityTests.cs | 1 - .../CustomCode/ThermalResistanceTests.cs | 1 - UnitsNet.Tests/CustomCode/VolumeFlowTests.cs | 1 - .../GeneratedCode/AccelerationTestsBase.g.cs | 1 - .../AmountOfSubstanceTestsBase.g.cs | 1 - .../AmplitudeRatioTestsBase.g.cs | 1 - .../GeneratedCode/AngleTestsBase.g.cs | 1 - .../ApparentEnergyTestsBase.g.cs | 1 - .../GeneratedCode/ApparentPowerTestsBase.g.cs | 1 - .../GeneratedCode/AreaDensityTestsBase.g.cs | 1 - .../AreaMomentOfInertiaTestsBase.g.cs | 1 - .../GeneratedCode/AreaTestsBase.g.cs | 1 - .../GeneratedCode/BitRateTestsBase.g.cs | 1 - ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 1 - .../GeneratedCode/CapacitanceTestsBase.g.cs | 1 - .../GeneratedCode/DensityTestsBase.g.cs | 1 - .../GeneratedCode/DurationTestsBase.g.cs | 1 - .../DynamicViscosityTestsBase.g.cs | 1 - .../ElectricAdmittanceTestsBase.g.cs | 1 - .../ElectricChargeDensityTestsBase.g.cs | 1 - .../ElectricChargeTestsBase.g.cs | 1 - .../ElectricConductanceTestsBase.g.cs | 1 - .../ElectricConductivityTestsBase.g.cs | 1 - .../ElectricCurrentDensityTestsBase.g.cs | 1 - .../ElectricCurrentGradientTestsBase.g.cs | 1 - .../ElectricCurrentTestsBase.g.cs | 1 - .../GeneratedCode/ElectricFieldTestsBase.g.cs | 1 - .../ElectricInductanceTestsBase.g.cs | 1 - .../ElectricPotentialAcTestsBase.g.cs | 1 - .../ElectricPotentialDcTestsBase.g.cs | 1 - .../ElectricPotentialTestsBase.g.cs | 1 - .../ElectricResistanceTestsBase.g.cs | 1 - .../ElectricResistivityTestsBase.g.cs | 1 - .../GeneratedCode/EnergyTestsBase.g.cs | 1 - .../GeneratedCode/EntropyTestsBase.g.cs | 1 - .../ForceChangeRateTestsBase.g.cs | 1 - .../ForcePerLengthTestsBase.g.cs | 1 - .../GeneratedCode/ForceTestsBase.g.cs | 1 - .../GeneratedCode/FrequencyTestsBase.g.cs | 1 - .../GeneratedCode/HeatFluxTestsBase.g.cs | 1 - .../HeatTransferCoefficientTestsBase.g.cs | 1 - .../GeneratedCode/IlluminanceTestsBase.g.cs | 1 - .../GeneratedCode/InformationTestsBase.g.cs | 1 - .../GeneratedCode/IrradianceTestsBase.g.cs | 1 - .../GeneratedCode/IrradiationTestsBase.g.cs | 1 - .../KinematicViscosityTestsBase.g.cs | 1 - .../GeneratedCode/LapseRateTestsBase.g.cs | 1 - .../GeneratedCode/LengthTestsBase.g.cs | 1 - .../GeneratedCode/LevelTestsBase.g.cs | 1 - .../GeneratedCode/LinearDensityTestsBase.g.cs | 1 - .../GeneratedCode/LuminousFluxTestsBase.g.cs | 1 - .../LuminousIntensityTestsBase.g.cs | 1 - .../GeneratedCode/MagneticFieldTestsBase.g.cs | 1 - .../GeneratedCode/MagneticFluxTestsBase.g.cs | 1 - .../GeneratedCode/MagnetizationTestsBase.g.cs | 1 - .../GeneratedCode/MassFlowTestsBase.g.cs | 1 - .../GeneratedCode/MassFluxTestsBase.g.cs | 1 - .../MassMomentOfInertiaTestsBase.g.cs | 1 - .../GeneratedCode/MassTestsBase.g.cs | 1 - .../GeneratedCode/MolarEnergyTestsBase.g.cs | 1 - .../GeneratedCode/MolarEntropyTestsBase.g.cs | 1 - .../GeneratedCode/MolarMassTestsBase.g.cs | 1 - .../GeneratedCode/MolarityTestsBase.g.cs | 1 - .../GeneratedCode/PermeabilityTestsBase.g.cs | 1 - .../GeneratedCode/PermittivityTestsBase.g.cs | 1 - .../GeneratedCode/PowerDensityTestsBase.g.cs | 1 - .../GeneratedCode/PowerRatioTestsBase.g.cs | 1 - .../GeneratedCode/PowerTestsBase.g.cs | 1 - .../PressureChangeRateTestsBase.g.cs | 1 - .../GeneratedCode/PressureTestsBase.g.cs | 1 - .../GeneratedCode/RatioTestsBase.g.cs | 1 - .../ReactiveEnergyTestsBase.g.cs | 1 - .../GeneratedCode/ReactivePowerTestsBase.g.cs | 1 - .../RotationalAccelerationTestsBase.g.cs | 1 - .../RotationalSpeedTestsBase.g.cs | 1 - ...RotationalStiffnessPerLengthTestsBase.g.cs | 1 - .../RotationalStiffnessTestsBase.g.cs | 1 - .../GeneratedCode/SolidAngleTestsBase.g.cs | 1 - .../SpecificEnergyTestsBase.g.cs | 1 - .../SpecificEntropyTestsBase.g.cs | 1 - .../SpecificVolumeTestsBase.g.cs | 1 - .../SpecificWeightTestsBase.g.cs | 1 - .../GeneratedCode/SpeedTestsBase.g.cs | 1 - .../TemperatureChangeRateTestsBase.g.cs | 1 - .../TemperatureDeltaTestsBase.g.cs | 1 - .../GeneratedCode/TemperatureTestsBase.g.cs | 1 - .../ThermalConductivityTestsBase.g.cs | 1 - .../ThermalResistanceTestsBase.g.cs | 1 - .../GeneratedCode/TorqueTestsBase.g.cs | 1 - .../GeneratedCode/VitaminATestsBase.g.cs | 1 - .../GeneratedCode/VolumeFlowTestsBase.g.cs | 1 - .../GeneratedCode/VolumeTestsBase.g.cs | 1 - .../Acceleration.WindowsRuntimeComponent.g.cs | 1 - ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 1 - ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 1 - .../Angle.WindowsRuntimeComponent.g.cs | 1 - ...pparentEnergy.WindowsRuntimeComponent.g.cs | 1 - ...ApparentPower.WindowsRuntimeComponent.g.cs | 1 - .../Area.WindowsRuntimeComponent.g.cs | 1 - .../AreaDensity.WindowsRuntimeComponent.g.cs | 1 - ...mentOfInertia.WindowsRuntimeComponent.g.cs | 1 - .../BitRate.WindowsRuntimeComponent.g.cs | 1 - ...elConsumption.WindowsRuntimeComponent.g.cs | 1 - .../Capacitance.WindowsRuntimeComponent.g.cs | 1 - .../Density.WindowsRuntimeComponent.g.cs | 1 - .../Duration.WindowsRuntimeComponent.g.cs | 1 - ...amicViscosity.WindowsRuntimeComponent.g.cs | 1 - ...ricAdmittance.WindowsRuntimeComponent.g.cs | 1 - ...lectricCharge.WindowsRuntimeComponent.g.cs | 1 - ...ChargeDensity.WindowsRuntimeComponent.g.cs | 1 - ...icConductance.WindowsRuntimeComponent.g.cs | 1 - ...cConductivity.WindowsRuntimeComponent.g.cs | 1 - ...ectricCurrent.WindowsRuntimeComponent.g.cs | 1 - ...urrentDensity.WindowsRuntimeComponent.g.cs | 1 - ...rrentGradient.WindowsRuntimeComponent.g.cs | 1 - ...ElectricField.WindowsRuntimeComponent.g.cs | 1 - ...ricInductance.WindowsRuntimeComponent.g.cs | 1 - ...tricPotential.WindowsRuntimeComponent.g.cs | 1 - ...icPotentialAc.WindowsRuntimeComponent.g.cs | 1 - ...icPotentialDc.WindowsRuntimeComponent.g.cs | 1 - ...ricResistance.WindowsRuntimeComponent.g.cs | 1 - ...icResistivity.WindowsRuntimeComponent.g.cs | 1 - .../Energy.WindowsRuntimeComponent.g.cs | 1 - .../Entropy.WindowsRuntimeComponent.g.cs | 1 - .../Force.WindowsRuntimeComponent.g.cs | 1 - ...rceChangeRate.WindowsRuntimeComponent.g.cs | 1 - ...orcePerLength.WindowsRuntimeComponent.g.cs | 1 - .../Frequency.WindowsRuntimeComponent.g.cs | 1 - .../HeatFlux.WindowsRuntimeComponent.g.cs | 1 - ...erCoefficient.WindowsRuntimeComponent.g.cs | 1 - .../Illuminance.WindowsRuntimeComponent.g.cs | 1 - .../Information.WindowsRuntimeComponent.g.cs | 1 - .../Irradiance.WindowsRuntimeComponent.g.cs | 1 - .../Irradiation.WindowsRuntimeComponent.g.cs | 1 - ...aticViscosity.WindowsRuntimeComponent.g.cs | 1 - .../LapseRate.WindowsRuntimeComponent.g.cs | 1 - .../Length.WindowsRuntimeComponent.g.cs | 1 - .../Level.WindowsRuntimeComponent.g.cs | 1 - ...LinearDensity.WindowsRuntimeComponent.g.cs | 1 - .../LuminousFlux.WindowsRuntimeComponent.g.cs | 1 - ...nousIntensity.WindowsRuntimeComponent.g.cs | 1 - ...MagneticField.WindowsRuntimeComponent.g.cs | 1 - .../MagneticFlux.WindowsRuntimeComponent.g.cs | 1 - ...Magnetization.WindowsRuntimeComponent.g.cs | 1 - .../Mass.WindowsRuntimeComponent.g.cs | 1 - .../MassFlow.WindowsRuntimeComponent.g.cs | 1 - .../MassFlux.WindowsRuntimeComponent.g.cs | 1 - ...mentOfInertia.WindowsRuntimeComponent.g.cs | 1 - .../MolarEnergy.WindowsRuntimeComponent.g.cs | 1 - .../MolarEntropy.WindowsRuntimeComponent.g.cs | 1 - .../MolarMass.WindowsRuntimeComponent.g.cs | 1 - .../Molarity.WindowsRuntimeComponent.g.cs | 1 - .../Permeability.WindowsRuntimeComponent.g.cs | 1 - .../Permittivity.WindowsRuntimeComponent.g.cs | 1 - .../Power.WindowsRuntimeComponent.g.cs | 1 - .../PowerDensity.WindowsRuntimeComponent.g.cs | 1 - .../PowerRatio.WindowsRuntimeComponent.g.cs | 1 - .../Pressure.WindowsRuntimeComponent.g.cs | 1 - ...ureChangeRate.WindowsRuntimeComponent.g.cs | 1 - .../Ratio.WindowsRuntimeComponent.g.cs | 1 - ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 1 - ...ReactivePower.WindowsRuntimeComponent.g.cs | 1 - ...lAcceleration.WindowsRuntimeComponent.g.cs | 1 - ...tationalSpeed.WindowsRuntimeComponent.g.cs | 1 - ...onalStiffness.WindowsRuntimeComponent.g.cs | 1 - ...nessPerLength.WindowsRuntimeComponent.g.cs | 1 - .../SolidAngle.WindowsRuntimeComponent.g.cs | 1 - ...pecificEnergy.WindowsRuntimeComponent.g.cs | 1 - ...ecificEntropy.WindowsRuntimeComponent.g.cs | 1 - ...pecificVolume.WindowsRuntimeComponent.g.cs | 1 - ...pecificWeight.WindowsRuntimeComponent.g.cs | 1 - .../Speed.WindowsRuntimeComponent.g.cs | 1 - .../Temperature.WindowsRuntimeComponent.g.cs | 1 - ...ureChangeRate.WindowsRuntimeComponent.g.cs | 1 - ...peratureDelta.WindowsRuntimeComponent.g.cs | 1 - ...lConductivity.WindowsRuntimeComponent.g.cs | 1 - ...malResistance.WindowsRuntimeComponent.g.cs | 1 - .../Torque.WindowsRuntimeComponent.g.cs | 1 - .../VitaminA.WindowsRuntimeComponent.g.cs | 1 - .../Volume.WindowsRuntimeComponent.g.cs | 1 - .../VolumeFlow.WindowsRuntimeComponent.g.cs | 1 - .../Extensions/AmplitudeRatioExtensions.cs | 55 ------------------- .../Extensions/DensityExtensions.cs | 37 ------------- .../Extensions/MolarityExtensions.cs | 37 ------------- .../CustomCode/Extensions/PowerExtensions.cs | 43 --------------- .../Extensions/PowerRatioExtensions.cs | 53 ------------------ .../Quantities/AmplitudeRatio.extra.cs | 42 ++++++++------ UnitsNet/CustomCode/Quantities/Angle.extra.cs | 5 +- UnitsNet/CustomCode/Quantities/Area.extra.cs | 27 +++++---- .../CustomCode/Quantities/Density.extra.cs | 16 ++++-- .../CustomCode/Quantities/Duration.extra.cs | 26 ++++----- .../ElectricPotential.extra.cs} | 27 +++++---- UnitsNet/CustomCode/Quantities/Force.extra.cs | 22 ++++---- .../Quantities/KinematicViscosity.extra.cs | 5 +- .../CustomCode/Quantities/MassFlow.extra.cs | 3 - .../CustomCode/Quantities/Molarity.extra.cs | 20 ++++--- UnitsNet/CustomCode/Quantities/Power.extra.cs | 17 +++++- .../CustomCode/Quantities/PowerRatio.extra.cs | 39 +++++++------ .../Quantities/RotationalSpeed.extra.cs | 5 +- UnitsNet/CustomCode/Quantities/Speed.extra.cs | 3 - .../Quantities/Acceleration.NetFramework.g.cs | 1 - .../AmountOfSubstance.NetFramework.g.cs | 1 - .../AmplitudeRatio.NetFramework.g.cs | 1 - .../Quantities/Angle.NetFramework.g.cs | 1 - .../ApparentEnergy.NetFramework.g.cs | 1 - .../ApparentPower.NetFramework.g.cs | 1 - .../Quantities/Area.NetFramework.g.cs | 1 - .../Quantities/AreaDensity.NetFramework.g.cs | 1 - .../AreaMomentOfInertia.NetFramework.g.cs | 1 - .../Quantities/BitRate.NetFramework.g.cs | 1 - ...eSpecificFuelConsumption.NetFramework.g.cs | 1 - .../Quantities/Capacitance.NetFramework.g.cs | 1 - .../Quantities/Density.NetFramework.g.cs | 1 - .../Quantities/Duration.NetFramework.g.cs | 1 - .../DynamicViscosity.NetFramework.g.cs | 1 - .../ElectricAdmittance.NetFramework.g.cs | 1 - .../ElectricCharge.NetFramework.g.cs | 1 - .../ElectricChargeDensity.NetFramework.g.cs | 1 - .../ElectricConductance.NetFramework.g.cs | 1 - .../ElectricConductivity.NetFramework.g.cs | 1 - .../ElectricCurrent.NetFramework.g.cs | 1 - .../ElectricCurrentDensity.NetFramework.g.cs | 1 - .../ElectricCurrentGradient.NetFramework.g.cs | 1 - .../ElectricField.NetFramework.g.cs | 1 - .../ElectricInductance.NetFramework.g.cs | 1 - .../ElectricPotential.NetFramework.g.cs | 1 - .../ElectricPotentialAc.NetFramework.g.cs | 1 - .../ElectricPotentialDc.NetFramework.g.cs | 1 - .../ElectricResistance.NetFramework.g.cs | 1 - .../ElectricResistivity.NetFramework.g.cs | 1 - .../Quantities/Energy.NetFramework.g.cs | 1 - .../Quantities/Entropy.NetFramework.g.cs | 1 - .../Quantities/Force.NetFramework.g.cs | 1 - .../ForceChangeRate.NetFramework.g.cs | 1 - .../ForcePerLength.NetFramework.g.cs | 1 - .../Quantities/Frequency.NetFramework.g.cs | 1 - .../Quantities/HeatFlux.NetFramework.g.cs | 1 - .../HeatTransferCoefficient.NetFramework.g.cs | 1 - .../Quantities/Illuminance.NetFramework.g.cs | 1 - .../Quantities/Information.NetFramework.g.cs | 1 - .../Quantities/Irradiance.NetFramework.g.cs | 1 - .../Quantities/Irradiation.NetFramework.g.cs | 1 - .../KinematicViscosity.NetFramework.g.cs | 1 - .../Quantities/LapseRate.NetFramework.g.cs | 1 - .../Quantities/Length.NetFramework.g.cs | 1 - .../Quantities/Level.NetFramework.g.cs | 1 - .../LinearDensity.NetFramework.g.cs | 1 - .../Quantities/LuminousFlux.NetFramework.g.cs | 1 - .../LuminousIntensity.NetFramework.g.cs | 1 - .../MagneticField.NetFramework.g.cs | 1 - .../Quantities/MagneticFlux.NetFramework.g.cs | 1 - .../Magnetization.NetFramework.g.cs | 1 - .../Quantities/Mass.NetFramework.g.cs | 1 - .../Quantities/MassFlow.NetFramework.g.cs | 1 - .../Quantities/MassFlux.NetFramework.g.cs | 1 - .../MassMomentOfInertia.NetFramework.g.cs | 1 - .../Quantities/MolarEnergy.NetFramework.g.cs | 1 - .../Quantities/MolarEntropy.NetFramework.g.cs | 1 - .../Quantities/MolarMass.NetFramework.g.cs | 1 - .../Quantities/Molarity.NetFramework.g.cs | 1 - .../Quantities/Permeability.NetFramework.g.cs | 1 - .../Quantities/Permittivity.NetFramework.g.cs | 1 - .../Quantities/Power.NetFramework.g.cs | 1 - .../Quantities/PowerDensity.NetFramework.g.cs | 1 - .../Quantities/PowerRatio.NetFramework.g.cs | 1 - .../Quantities/Pressure.NetFramework.g.cs | 1 - .../PressureChangeRate.NetFramework.g.cs | 1 - .../Quantities/Ratio.NetFramework.g.cs | 1 - .../ReactiveEnergy.NetFramework.g.cs | 1 - .../ReactivePower.NetFramework.g.cs | 1 - .../RotationalAcceleration.NetFramework.g.cs | 1 - .../RotationalSpeed.NetFramework.g.cs | 1 - .../RotationalStiffness.NetFramework.g.cs | 1 - ...tionalStiffnessPerLength.NetFramework.g.cs | 1 - .../Quantities/SolidAngle.NetFramework.g.cs | 1 - .../SpecificEnergy.NetFramework.g.cs | 1 - .../SpecificEntropy.NetFramework.g.cs | 1 - .../SpecificVolume.NetFramework.g.cs | 1 - .../SpecificWeight.NetFramework.g.cs | 1 - .../Quantities/Speed.NetFramework.g.cs | 1 - .../Quantities/Temperature.NetFramework.g.cs | 1 - .../TemperatureChangeRate.NetFramework.g.cs | 1 - .../TemperatureDelta.NetFramework.g.cs | 1 - .../ThermalConductivity.NetFramework.g.cs | 1 - .../ThermalResistance.NetFramework.g.cs | 1 - .../Quantities/Torque.NetFramework.g.cs | 1 - .../Quantities/VitaminA.NetFramework.g.cs | 1 - .../Quantities/Volume.NetFramework.g.cs | 1 - .../Quantities/VolumeFlow.NetFramework.g.cs | 1 - UnitsNet/GeneratedCode/QuantityType.g.cs | 1 - .../GeneratedCode/UnitSystem.Default.g.cs | 1 - .../GeneratedCode/Units/AccelerationUnit.g.cs | 1 - .../Units/AmountOfSubstanceUnit.g.cs | 1 - .../Units/AmplitudeRatioUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/AngleUnit.g.cs | 1 - .../Units/ApparentEnergyUnit.g.cs | 1 - .../Units/ApparentPowerUnit.g.cs | 1 - .../GeneratedCode/Units/AreaDensityUnit.g.cs | 1 - .../Units/AreaMomentOfInertiaUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/AreaUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs | 1 - .../BrakeSpecificFuelConsumptionUnit.g.cs | 1 - .../GeneratedCode/Units/CapacitanceUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/DensityUnit.g.cs | 1 - .../GeneratedCode/Units/DurationUnit.g.cs | 1 - .../Units/DynamicViscosityUnit.g.cs | 1 - .../Units/ElectricAdmittanceUnit.g.cs | 1 - .../Units/ElectricChargeDensityUnit.g.cs | 1 - .../Units/ElectricChargeUnit.g.cs | 1 - .../Units/ElectricConductanceUnit.g.cs | 1 - .../Units/ElectricConductivityUnit.g.cs | 1 - .../Units/ElectricCurrentDensityUnit.g.cs | 1 - .../Units/ElectricCurrentGradientUnit.g.cs | 1 - .../Units/ElectricCurrentUnit.g.cs | 1 - .../Units/ElectricFieldUnit.g.cs | 1 - .../Units/ElectricInductanceUnit.g.cs | 1 - .../Units/ElectricPotentialAcUnit.g.cs | 1 - .../Units/ElectricPotentialDcUnit.g.cs | 1 - .../Units/ElectricPotentialUnit.g.cs | 1 - .../Units/ElectricResistanceUnit.g.cs | 1 - .../Units/ElectricResistivityUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs | 1 - .../Units/ForceChangeRateUnit.g.cs | 1 - .../Units/ForcePerLengthUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/ForceUnit.g.cs | 1 - .../GeneratedCode/Units/FrequencyUnit.g.cs | 1 - .../GeneratedCode/Units/HeatFluxUnit.g.cs | 1 - .../Units/HeatTransferCoefficientUnit.g.cs | 1 - .../GeneratedCode/Units/IlluminanceUnit.g.cs | 1 - .../GeneratedCode/Units/InformationUnit.g.cs | 1 - .../GeneratedCode/Units/IrradianceUnit.g.cs | 1 - .../GeneratedCode/Units/IrradiationUnit.g.cs | 1 - .../Units/KinematicViscosityUnit.g.cs | 1 - .../GeneratedCode/Units/LapseRateUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/LengthUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/LevelUnit.g.cs | 1 - .../Units/LinearDensityUnit.g.cs | 1 - .../GeneratedCode/Units/LuminousFluxUnit.g.cs | 1 - .../Units/LuminousIntensityUnit.g.cs | 1 - .../Units/MagneticFieldUnit.g.cs | 1 - .../GeneratedCode/Units/MagneticFluxUnit.g.cs | 1 - .../Units/MagnetizationUnit.g.cs | 1 - .../GeneratedCode/Units/MassFlowUnit.g.cs | 1 - .../GeneratedCode/Units/MassFluxUnit.g.cs | 1 - .../Units/MassMomentOfInertiaUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/MassUnit.g.cs | 1 - .../GeneratedCode/Units/MolarEnergyUnit.g.cs | 1 - .../GeneratedCode/Units/MolarEntropyUnit.g.cs | 1 - .../GeneratedCode/Units/MolarMassUnit.g.cs | 1 - .../GeneratedCode/Units/MolarityUnit.g.cs | 1 - .../GeneratedCode/Units/PermeabilityUnit.g.cs | 1 - .../GeneratedCode/Units/PermittivityUnit.g.cs | 1 - .../GeneratedCode/Units/PowerDensityUnit.g.cs | 1 - .../GeneratedCode/Units/PowerRatioUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/PowerUnit.g.cs | 1 - .../Units/PressureChangeRateUnit.g.cs | 1 - .../GeneratedCode/Units/PressureUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/RatioUnit.g.cs | 1 - .../Units/ReactiveEnergyUnit.g.cs | 1 - .../Units/ReactivePowerUnit.g.cs | 1 - .../Units/RotationalAccelerationUnit.g.cs | 1 - .../Units/RotationalSpeedUnit.g.cs | 1 - .../RotationalStiffnessPerLengthUnit.g.cs | 1 - .../Units/RotationalStiffnessUnit.g.cs | 1 - .../GeneratedCode/Units/SolidAngleUnit.g.cs | 1 - .../Units/SpecificEnergyUnit.g.cs | 1 - .../Units/SpecificEntropyUnit.g.cs | 1 - .../Units/SpecificVolumeUnit.g.cs | 1 - .../Units/SpecificWeightUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs | 1 - .../Units/TemperatureChangeRateUnit.g.cs | 1 - .../Units/TemperatureDeltaUnit.g.cs | 1 - .../GeneratedCode/Units/TemperatureUnit.g.cs | 1 - .../Units/ThermalConductivityUnit.g.cs | 1 - .../Units/ThermalResistanceUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs | 1 - .../GeneratedCode/Units/VitaminAUnit.g.cs | 1 - .../GeneratedCode/Units/VolumeFlowUnit.g.cs | 1 - UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs | 1 - UnitsNet/Scripts/GenerateUnits.ps1 | 17 ------ ...clude-GenerateQuantitySourceCodeCommon.ps1 | 1 - ...GenerateQuantitySourceCodeNetFramework.ps1 | 1 - ...ntitySourceCodeWindowsRuntimeComponent.ps1 | 1 - ...Include-GenerateQuantityTypeSourceCode.ps1 | 1 - ...de-GenerateUnitSystemDefaultSourceCode.ps1 | 3 +- ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 1 - ...-GenerateUnitTestPlaceholderSourceCode.ps1 | 1 - .../Include-GenerateUnitTypeSourceCode.ps1 | 1 - 532 files changed, 151 insertions(+), 871 deletions(-) delete mode 100644 UnitsNet/CustomCode/Extensions/AmplitudeRatioExtensions.cs delete mode 100644 UnitsNet/CustomCode/Extensions/DensityExtensions.cs delete mode 100644 UnitsNet/CustomCode/Extensions/MolarityExtensions.cs delete mode 100644 UnitsNet/CustomCode/Extensions/PowerExtensions.cs delete mode 100644 UnitsNet/CustomCode/Extensions/PowerRatioExtensions.cs rename UnitsNet/CustomCode/{Extensions/ElectricPotentialExtensions.cs => Quantities/ElectricPotential.extra.cs} (63%) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 532ba6ddba..a8e5593371 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index f457b97678..d1fe0633cf 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index e2404063fc..4048cfb0d5 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 47bedaa99c..4c09a3ccea 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 9d1b65e372..b981fce2f8 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 1e36aa827f..64adcc030f 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 47414cbe3a..bfe37ddb0f 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 4803c6cf44..4805aa43fe 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 04d1cb2c9a..5cc7ada85c 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index d571141a92..81ef3af1f2 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index 25d0357c72..6a68250d36 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index cbe629571a..c3ca20dd2b 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 5a3418ee6f..1dcd99a874 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 158c58491d..0a0f8a7223 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 7a6ef0b68e..7526692cb4 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index bcb4a4e495..bd7b8dcf11 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index b859665a87..7ef87f20ea 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 990164f694..bfbdc89bec 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index 341cfe24a9..ce2c3adec5 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index d7f670d96f..058190485c 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 7ac87cd1ce..7426711345 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 0f3e70a0e4..dc541c4669 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index c3bc0c0a09..7ed7bacd30 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index ba9c8500b1..eeb5b8a477 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 7d9f39fd11..09d9b21491 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 8231a34342..3154a2aa61 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index fcf63810c1..ac85ea5c43 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 88be3d5059..054cf090b3 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index d6a6515d32..97800ecf71 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 4023ff5c3c..943897b0d9 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index e44892aa62..cf89bec60b 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index c36252ab99..9ab2a50a45 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 24a6e1a777..542712a8ad 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index d3597b7083..1787168a08 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index da8a54d874..4db68929fb 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 72866114d7..58c7df8fe3 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 67877a4372..14db30b59c 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index c0c60c5e38..e86ec8d9ed 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index fdd8c4efd8..dd6cc24532 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 976c240afb..5905735552 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 03773eae0f..49ac93a5e3 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index d495d594da..7c8d78acba 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index ad40138c55..625e8d8937 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 63db7bef58..50c2ea8b12 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index a0515554d4..4982b78f36 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 6c91ecd36f..b4640f5b36 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 348f941c22..f1be384a2c 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index 41c198207e..765ecf5c1b 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index ac1ce0f294..af5593c6ee 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index e3ec597be8..259d3481cd 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index 03a99e9c45..af6a381b1b 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index cb8998db5e..546065e358 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index bfab2fd9ea..de9eee1663 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index a15dacc580..118ac8d6c9 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index f88493f6a0..af499ab871 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index c20bf95dff..b8811b4670 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 89522b44f4..5a9f136423 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index be9e2836f4..7a35c6dd34 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 415482397c..1a9a547d86 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index f124e5f0de..d876910eae 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 6f5328b446..bac1639711 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index b30afd7fee..21ec46f21f 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index 48b7f3e2c3..c68df87cc6 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 96475c0e53..acc9d1ef2b 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index fb6fa26a3e..95a3cbbe3c 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index d41790233a..7c7051c2da 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index ae29fd01b2..5624876bbf 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 5cd499aca0..07aca3ebd8 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index 8aeda23be5..bcfbc66da1 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index dd16e29098..0af904f487 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index b3da859a51..8f19c5888d 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index bac0b2696a..6d68dc12bc 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 3e1c56dcb9..e45e2e8ed7 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 5caca3d77f..b136447df9 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index c0ca84ee21..216f1004ed 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index e54e9bfa4c..4c17911621 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 8532c5d830..e18e5d9138 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 2e2a36831c..f1576aa45a 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 7c6102ff5b..dd444e0451 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 6ded617e3f..37510683ae 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 5d2447f2a0..1db9b0d530 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 37f9778815..2321cdf29d 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 92107dc00b..0964975291 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index d7c3926e7e..a0eae874d9 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 091113d46a..347feafd51 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index ba8f2958e8..7d53e59fbc 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index abf8b640ac..aa5c351adc 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index fae05ffe42..1c10d748c5 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 103e01bdb5..0ee33107e6 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs b/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs index b48d41c8ea..b36e6cdca5 100644 --- a/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs +++ b/UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs b/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs index 9b7482563f..a650941520 100644 --- a/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs +++ b/UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs @@ -21,7 +21,6 @@ using System; using Xunit; -using UnitsNet.CustomCode.Extensions; namespace UnitsNet.Tests.CustomCode { @@ -84,7 +83,7 @@ public void ExpectAmplitudeRatioConvertedToVoltageCorrectly(double amplitudeRati // Voltage increases by powers of 10 for every 20 dBV increase in amplitude ratio. AmplitudeRatio ar = AmplitudeRatio.FromDecibelVolts(amplitudeRatio); - double actual = AmplitudeRatio.ToElectricPotential(ar).Volts; + double actual = ar.ToElectricPotential().Volts; Assert.Equal(expected, actual); } @@ -116,4 +115,4 @@ public void AmplitudeRatioToPowerRatio_75OhmImpedance(double dBmV, double expect Assert.Equal(expected, actual); } } -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/CustomCode/ApparentEnergyTests.cs b/UnitsNet.Tests/CustomCode/ApparentEnergyTests.cs index bc236df045..b001be250f 100644 --- a/UnitsNet.Tests/CustomCode/ApparentEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/ApparentEnergyTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ApparentPowerTests.cs b/UnitsNet.Tests/CustomCode/ApparentPowerTests.cs index 07a48e333e..066da56e4f 100644 --- a/UnitsNet.Tests/CustomCode/ApparentPowerTests.cs +++ b/UnitsNet.Tests/CustomCode/ApparentPowerTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/AreaDensityTests.cs b/UnitsNet.Tests/CustomCode/AreaDensityTests.cs index 922c143ebb..b6bf0a4f41 100644 --- a/UnitsNet.Tests/CustomCode/AreaDensityTests.cs +++ b/UnitsNet.Tests/CustomCode/AreaDensityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs b/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs index 280bab5459..b19e8aa559 100644 --- a/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs +++ b/UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/BitRateTests.cs b/UnitsNet.Tests/CustomCode/BitRateTests.cs index 8976f45049..2029c00eca 100644 --- a/UnitsNet.Tests/CustomCode/BitRateTests.cs +++ b/UnitsNet.Tests/CustomCode/BitRateTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/CapacitanceTests.cs b/UnitsNet.Tests/CustomCode/CapacitanceTests.cs index 96cb7ff3fd..a8c1d21bbb 100644 --- a/UnitsNet.Tests/CustomCode/CapacitanceTests.cs +++ b/UnitsNet.Tests/CustomCode/CapacitanceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/DensityTests.cs b/UnitsNet.Tests/CustomCode/DensityTests.cs index 428ef7f325..4905088137 100644 --- a/UnitsNet.Tests/CustomCode/DensityTests.cs +++ b/UnitsNet.Tests/CustomCode/DensityTests.cs @@ -20,7 +20,6 @@ // THE SOFTWARE. using Xunit; -using UnitsNet.CustomCode.Extensions; namespace UnitsNet.Tests.CustomCode { diff --git a/UnitsNet.Tests/CustomCode/ElectricAdmittanceTests.cs b/UnitsNet.Tests/CustomCode/ElectricAdmittanceTests.cs index f959da1045..835c7855a8 100644 --- a/UnitsNet.Tests/CustomCode/ElectricAdmittanceTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricAdmittanceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricChargeDensityTests.cs b/UnitsNet.Tests/CustomCode/ElectricChargeDensityTests.cs index b5008086dd..abcd5331a1 100644 --- a/UnitsNet.Tests/CustomCode/ElectricChargeDensityTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricChargeDensityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricChargeTests.cs b/UnitsNet.Tests/CustomCode/ElectricChargeTests.cs index e2107792e7..98075fb856 100644 --- a/UnitsNet.Tests/CustomCode/ElectricChargeTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricChargeTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricConductanceTests.cs b/UnitsNet.Tests/CustomCode/ElectricConductanceTests.cs index 32ee7dc2ff..fa3cf847dd 100644 --- a/UnitsNet.Tests/CustomCode/ElectricConductanceTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricConductanceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricConductivityTests.cs b/UnitsNet.Tests/CustomCode/ElectricConductivityTests.cs index 10ea9c0615..ac2f37a5e7 100644 --- a/UnitsNet.Tests/CustomCode/ElectricConductivityTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricConductivityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricCurrentDensityTests.cs b/UnitsNet.Tests/CustomCode/ElectricCurrentDensityTests.cs index fd8ab2446f..421f3f14d0 100644 --- a/UnitsNet.Tests/CustomCode/ElectricCurrentDensityTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricCurrentDensityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricCurrentGradientTests.cs b/UnitsNet.Tests/CustomCode/ElectricCurrentGradientTests.cs index 937e22b069..9e62a7759c 100644 --- a/UnitsNet.Tests/CustomCode/ElectricCurrentGradientTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricCurrentGradientTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricFieldTests.cs b/UnitsNet.Tests/CustomCode/ElectricFieldTests.cs index 61e5f68e53..40d8a00324 100644 --- a/UnitsNet.Tests/CustomCode/ElectricFieldTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricFieldTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricInductanceTests.cs b/UnitsNet.Tests/CustomCode/ElectricInductanceTests.cs index 5f89367687..c66e509548 100644 --- a/UnitsNet.Tests/CustomCode/ElectricInductanceTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricInductanceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricPotentialAcTests.cs b/UnitsNet.Tests/CustomCode/ElectricPotentialAcTests.cs index 8a5f7a5cc3..1be6811f5a 100644 --- a/UnitsNet.Tests/CustomCode/ElectricPotentialAcTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricPotentialAcTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricPotentialDcTests.cs b/UnitsNet.Tests/CustomCode/ElectricPotentialDcTests.cs index 56fc31aaa6..80036962cc 100644 --- a/UnitsNet.Tests/CustomCode/ElectricPotentialDcTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricPotentialDcTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/ElectricResistivityTests.cs b/UnitsNet.Tests/CustomCode/ElectricResistivityTests.cs index 8ed53eaeac..0ddb5cc712 100644 --- a/UnitsNet.Tests/CustomCode/ElectricResistivityTests.cs +++ b/UnitsNet.Tests/CustomCode/ElectricResistivityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/EntropyTests.cs b/UnitsNet.Tests/CustomCode/EntropyTests.cs index 69c474b096..9f98fcf392 100644 --- a/UnitsNet.Tests/CustomCode/EntropyTests.cs +++ b/UnitsNet.Tests/CustomCode/EntropyTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs b/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs index 38a9735808..5d5b8241b3 100644 --- a/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs +++ b/UnitsNet.Tests/CustomCode/ForcePerLengthTests.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/HeatFluxTests.cs b/UnitsNet.Tests/CustomCode/HeatFluxTests.cs index 7b9a24687b..e30c4c849a 100644 --- a/UnitsNet.Tests/CustomCode/HeatFluxTests.cs +++ b/UnitsNet.Tests/CustomCode/HeatFluxTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/HeatTransferCoefficientTests.cs b/UnitsNet.Tests/CustomCode/HeatTransferCoefficientTests.cs index 382367f6a7..80e8eec10f 100644 --- a/UnitsNet.Tests/CustomCode/HeatTransferCoefficientTests.cs +++ b/UnitsNet.Tests/CustomCode/HeatTransferCoefficientTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/IlluminanceTests.cs b/UnitsNet.Tests/CustomCode/IlluminanceTests.cs index b7888ebb4d..3857dd38e8 100644 --- a/UnitsNet.Tests/CustomCode/IlluminanceTests.cs +++ b/UnitsNet.Tests/CustomCode/IlluminanceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/IrradianceTests.cs b/UnitsNet.Tests/CustomCode/IrradianceTests.cs index 3ee6591e6b..ec11504bc0 100644 --- a/UnitsNet.Tests/CustomCode/IrradianceTests.cs +++ b/UnitsNet.Tests/CustomCode/IrradianceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/IrradiationTests.cs b/UnitsNet.Tests/CustomCode/IrradiationTests.cs index 555b488d70..4881e68d08 100644 --- a/UnitsNet.Tests/CustomCode/IrradiationTests.cs +++ b/UnitsNet.Tests/CustomCode/IrradiationTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/LapseRateTests.cs b/UnitsNet.Tests/CustomCode/LapseRateTests.cs index e78920162e..f65015bd56 100644 --- a/UnitsNet.Tests/CustomCode/LapseRateTests.cs +++ b/UnitsNet.Tests/CustomCode/LapseRateTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/LinearDensityTests.cs b/UnitsNet.Tests/CustomCode/LinearDensityTests.cs index 12a3e096d7..dba00a625b 100644 --- a/UnitsNet.Tests/CustomCode/LinearDensityTests.cs +++ b/UnitsNet.Tests/CustomCode/LinearDensityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/LuminousFluxTests.cs b/UnitsNet.Tests/CustomCode/LuminousFluxTests.cs index 28249e44b2..bcffaaaa54 100644 --- a/UnitsNet.Tests/CustomCode/LuminousFluxTests.cs +++ b/UnitsNet.Tests/CustomCode/LuminousFluxTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/LuminousIntensityTests.cs b/UnitsNet.Tests/CustomCode/LuminousIntensityTests.cs index e5628edd65..f23f7f7901 100644 --- a/UnitsNet.Tests/CustomCode/LuminousIntensityTests.cs +++ b/UnitsNet.Tests/CustomCode/LuminousIntensityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MagneticFieldTests.cs b/UnitsNet.Tests/CustomCode/MagneticFieldTests.cs index 3da50c0368..61addee041 100644 --- a/UnitsNet.Tests/CustomCode/MagneticFieldTests.cs +++ b/UnitsNet.Tests/CustomCode/MagneticFieldTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MagneticFluxTests.cs b/UnitsNet.Tests/CustomCode/MagneticFluxTests.cs index 40cf6c214f..647cc7e9d4 100644 --- a/UnitsNet.Tests/CustomCode/MagneticFluxTests.cs +++ b/UnitsNet.Tests/CustomCode/MagneticFluxTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MagnetizationTests.cs b/UnitsNet.Tests/CustomCode/MagnetizationTests.cs index d2be75815d..bb4ab57af1 100644 --- a/UnitsNet.Tests/CustomCode/MagnetizationTests.cs +++ b/UnitsNet.Tests/CustomCode/MagnetizationTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MassFluxTests.cs b/UnitsNet.Tests/CustomCode/MassFluxTests.cs index 797e0f01aa..18ff2333d8 100644 --- a/UnitsNet.Tests/CustomCode/MassFluxTests.cs +++ b/UnitsNet.Tests/CustomCode/MassFluxTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs b/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs index 076f89e01b..20121a0665 100644 --- a/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs +++ b/UnitsNet.Tests/CustomCode/MassMomentOfInertiaTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/MolarEnergyTests.cs b/UnitsNet.Tests/CustomCode/MolarEnergyTests.cs index 3bf535be10..b9aaf18adf 100644 --- a/UnitsNet.Tests/CustomCode/MolarEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/MolarEnergyTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MolarEntropyTests.cs b/UnitsNet.Tests/CustomCode/MolarEntropyTests.cs index 1b24dd86bf..b8a012804f 100644 --- a/UnitsNet.Tests/CustomCode/MolarEntropyTests.cs +++ b/UnitsNet.Tests/CustomCode/MolarEntropyTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MolarMassTests.cs b/UnitsNet.Tests/CustomCode/MolarMassTests.cs index d05b1e8f40..231ecab43e 100644 --- a/UnitsNet.Tests/CustomCode/MolarMassTests.cs +++ b/UnitsNet.Tests/CustomCode/MolarMassTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/MolarityTests.cs b/UnitsNet.Tests/CustomCode/MolarityTests.cs index 305fa12c2d..92ebb8735e 100644 --- a/UnitsNet.Tests/CustomCode/MolarityTests.cs +++ b/UnitsNet.Tests/CustomCode/MolarityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // @@ -42,7 +41,6 @@ using Xunit; using System; -using UnitsNet.CustomCode.Extensions; namespace UnitsNet.Tests.CustomCode { diff --git a/UnitsNet.Tests/CustomCode/PermeabilityTests.cs b/UnitsNet.Tests/CustomCode/PermeabilityTests.cs index 05a96b3d83..6e111e4400 100644 --- a/UnitsNet.Tests/CustomCode/PermeabilityTests.cs +++ b/UnitsNet.Tests/CustomCode/PermeabilityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/PermittivityTests.cs b/UnitsNet.Tests/CustomCode/PermittivityTests.cs index 71d26f7f1d..9cd30ffd5d 100644 --- a/UnitsNet.Tests/CustomCode/PermittivityTests.cs +++ b/UnitsNet.Tests/CustomCode/PermittivityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/PowerDensityTests.cs b/UnitsNet.Tests/CustomCode/PowerDensityTests.cs index abc3dfac11..39194a47b9 100644 --- a/UnitsNet.Tests/CustomCode/PowerDensityTests.cs +++ b/UnitsNet.Tests/CustomCode/PowerDensityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/PowerRatioTests.cs b/UnitsNet.Tests/CustomCode/PowerRatioTests.cs index 3229634f59..5d84f0cab3 100644 --- a/UnitsNet.Tests/CustomCode/PowerRatioTests.cs +++ b/UnitsNet.Tests/CustomCode/PowerRatioTests.cs @@ -21,7 +21,6 @@ using System; using Xunit; -using UnitsNet.CustomCode.Extensions; namespace UnitsNet.Tests.CustomCode { @@ -72,7 +71,7 @@ public void ExpectPowerConvertedCorrectly(double power, double expected) public void ExpectPowerRatioConvertedCorrectly(double powerRatio, double expected) { PowerRatio pr = PowerRatio.FromDecibelWatts(powerRatio); - double actual = PowerRatio.ToPower(pr).Watts; + double actual = pr.ToPower().Watts; Assert.Equal(expected, actual); } @@ -104,4 +103,4 @@ public void PowerRatioToAmplitudeRatio_75OhmImpedance(double dBmW, double expect Assert.Equal(expected, actual); } } -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/CustomCode/ReactiveEnergyTests.cs b/UnitsNet.Tests/CustomCode/ReactiveEnergyTests.cs index f31bd68f08..8fa7fe3ad5 100644 --- a/UnitsNet.Tests/CustomCode/ReactiveEnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/ReactiveEnergyTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ReactivePowerTests.cs b/UnitsNet.Tests/CustomCode/ReactivePowerTests.cs index a000168a07..6cf738d778 100644 --- a/UnitsNet.Tests/CustomCode/ReactivePowerTests.cs +++ b/UnitsNet.Tests/CustomCode/ReactivePowerTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/RotationalAccelerationTests.cs b/UnitsNet.Tests/CustomCode/RotationalAccelerationTests.cs index 11b1be4f50..e390d5adc5 100644 --- a/UnitsNet.Tests/CustomCode/RotationalAccelerationTests.cs +++ b/UnitsNet.Tests/CustomCode/RotationalAccelerationTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs b/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs index 4816c62ae4..cb77d0f51d 100644 --- a/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs +++ b/UnitsNet.Tests/CustomCode/RotationalStiffnessPerLengthTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/RotationalStiffnessTests.cs b/UnitsNet.Tests/CustomCode/RotationalStiffnessTests.cs index af62b987fd..a1dae7613d 100644 --- a/UnitsNet.Tests/CustomCode/RotationalStiffnessTests.cs +++ b/UnitsNet.Tests/CustomCode/RotationalStiffnessTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/SolidAngleTests.cs b/UnitsNet.Tests/CustomCode/SolidAngleTests.cs index 0b0fde3e05..523833f0b3 100644 --- a/UnitsNet.Tests/CustomCode/SolidAngleTests.cs +++ b/UnitsNet.Tests/CustomCode/SolidAngleTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/SpecificEntropyTests.cs b/UnitsNet.Tests/CustomCode/SpecificEntropyTests.cs index d3417e7e43..7c928f8f52 100644 --- a/UnitsNet.Tests/CustomCode/SpecificEntropyTests.cs +++ b/UnitsNet.Tests/CustomCode/SpecificEntropyTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs b/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs index 49d9dbf222..7f5ced0f45 100644 --- a/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs +++ b/UnitsNet.Tests/CustomCode/SpecificVolumeTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs index ae78d91649..a4f51502d4 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/ThermalConductivityTests.cs b/UnitsNet.Tests/CustomCode/ThermalConductivityTests.cs index 469f727fe2..1a4f97977d 100644 --- a/UnitsNet.Tests/CustomCode/ThermalConductivityTests.cs +++ b/UnitsNet.Tests/CustomCode/ThermalConductivityTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/CustomCode/ThermalResistanceTests.cs b/UnitsNet.Tests/CustomCode/ThermalResistanceTests.cs index 44d65ef57f..2cba064ee4 100644 --- a/UnitsNet.Tests/CustomCode/ThermalResistanceTests.cs +++ b/UnitsNet.Tests/CustomCode/ThermalResistanceTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\UnitClasses\MyQuantity.extra.cs files to add code to generated unit classes. -// Add Extensions\MyQuantityExtensions.cs to decorate unit classes with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or unit classes. // // diff --git a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs index 2ac87c4a07..9ae11ca489 100644 --- a/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeFlowTests.cs @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index 7b18a64aed..7b49302279 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index 4cf9ee0468..2129e44b09 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 5c422ba55c..6d13762c0b 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index 46ea30e6b0..7151ec9fa2 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index c2a2b63781..dda4932cdb 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index 18946640ac..e730b2700d 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index 5cedc1a4dc..79320935f0 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index d8a0e19d48..2a369af9e6 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index bbff05e91b..9365e10f0a 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index 3d6e1b5d08..861cda6509 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index 7b39afd362..3beb3c353f 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index f7aae142a9..6385fd50a2 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index eb815b3870..3d8421eff0 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index 26d57866ab..2fe5abf875 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index 89975d0345..c9f9f49e86 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index d785668635..67695b34b0 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index 494ae2e6a2..4cc65d8407 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index 117118a2e7..5776d39831 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index 84f5d077a7..5656a0a3ad 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index 54f544901f..80e71dfe8e 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index 3b9a125a06..0c88f46b2b 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 6367b5468d..1c21ecb1b0 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index 849c84bf48..40844e8659 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index 8fd41e31ee..fd5fcae774 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index c58c40cac1..ac826e4163 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index 6b45e51e6c..5f587aec5a 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index 173ce57a76..d9f293882c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index 91bfc02e4a..bec6edf669 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index cc2955db23..2bf62f1204 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index 5e3a728fd1..6cf6a8a148 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index c9d444df67..62cf8b6134 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index 0b99099f16..ed7e66168b 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index 675ee4bfac..7cbbab3751 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index 5d06b028f1..6810c32318 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index f2e05bbe08..09809b5b07 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index 5c2cdc4e26..7bdceaceff 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index b7c744d95c..94cb0b7c13 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index f94c2693f0..9ede5c3f94 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index 22d7ca8dfc..c037e7aa74 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index c4278ad1c4..58380f674a 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index 9a934b5337..f5051c157f 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index f78cce335b..e88703f095 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 84360b2c9f..5108174c1b 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 452f0871cf..0da6b54a4c 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index 49991bdce6..6a0e2e693c 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 5dbdf5b200..477f42c897 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index 5008bfd430..966f4b5d8c 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index e8a1ab1366..e65918815d 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index b9fb9c5467..2f881bc3d9 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index 0d6062b97e..36025ddecd 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index be8ee57bee..48bcaaa349 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index d22a725500..f49c7d22ba 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 2643a81f73..576ef7cda9 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index a80ad1086d..0aab5bf7c7 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index a1001c2cf4..b13bb41bbf 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index e9fef6fe84..1ce590cae4 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index 1da87494a1..23861cf0b5 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index 0d55e75664..c8af96df28 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index bb35d0fdb5..d2bfdca333 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index fd08d90e38..0243e33307 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index ea63a72d15..9c834ec393 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index b49b0cc95a..98442204f3 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 426bced7ce..96469be4c8 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index ffffca4554..5887d9503e 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index 54ccd97f4d..a2e73297cc 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index 6e07c3765c..8624f9418c 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index 88357133c9..db5e3e05cd 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index 1fe1c27335..25a7836ef2 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index 80e88fcc3c..2440cae1f4 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index 7b4aa25e4e..f8cd3e0725 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index 7f6a67fba4..44588aa447 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index 4fa2fb3306..4cd839be52 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 6cc08e489b..10ccb63fde 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index d8f7be14f2..c184492cc3 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index 874043dcad..8c5c9e7036 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index f0971fb50c..a3eec8b439 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 45608cd8b2..2667996816 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 0229fb2026..9be33bad1f 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index c0711185df..7823c1cf21 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index fc710bd753..53f23afb83 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index b67ce8681e..fcf47caa78 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index 2328b0d091..db935d7004 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 47bd0cd872..910c83bc80 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index d592216369..5717714882 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index 9119cb1719..27591d4434 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index b1ae59349f..fc55235190 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index e1fc3be467..964c3b3450 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index d12c99c555..9cd31cd02c 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index d4bdc9c534..4e34d02338 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 1832f89807..18746bc96e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index 47a945e754..bff21fd0dd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index 71328ad967..e1430d991f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 9300463407..13dfeb0c5e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 44e60f0419..414dda709b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 3ccc80c7a9..a00dbb607b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 1a618f6b96..74dd8cbcc6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index 14910ca0b6..24ecfcfb23 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index eef219081f..b39f364461 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 3a5e50f278..03b50ceab3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index cb392121fb..006f32ec76 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 673e10abbd..a10d6a61bd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index b36da8240a..c4b4771424 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 6629015d75..010db722e3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index c618b94c4a..fe01d15737 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index 9eef04267e..71783fb1ef 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index a967b0fd5f..67d112ec66 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index b964325a3e..79610f936e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index ec4734b3f5..b784e572d7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 659eb4a048..9a82c5b900 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 74dc0b4cfb..1c0a2c1a9a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index c0893a10d3..9755b633e4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 8f7055a8ff..5a367e848f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index 0d3882d3fb..7e512ad02e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index 306892156d..303ebcafa6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index d2e374ae8d..ef1f260682 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 8db3b6ef8f..9cb0fe0375 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 9446dfaee1..03b22635cc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index fcc1d95375..527ff133e9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index e8259ace93..f0019b31a8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index 8ecbcbd9b8..ba97efc1cc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 9388a4a857..52e53931eb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index cfcd6b7e06..cb1c716a3d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index f7eae0b524..efcb1c9178 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index 08af39e126..de92aafc6b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index faa4ffba54..1d05349c9c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index e48abae075..361072352d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 68cce5ecda..4053939c81 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 6e9cdd4b6c..940d567e73 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index a976942c87..b10a5189c7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index 2fa88e6256..11b0484b66 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 0d20227817..0a6b23eefd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 2419cc1607..e1f7360402 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index baa0846609..a717e64840 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 0153958518..bef41113d5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index da2464eb8b..af0eb875e2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 581e09735a..d7f76489c2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 1d4f6a0277..73c78d323c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index a2f7408e30..c2d8e462da 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index ccf856bbf4..17172c2d98 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 99daf87c26..3e79d79033 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index cadd0acb99..18ec44f9a6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 8be9a9df40..fe7084ecbd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index a83681536d..8dd07a0876 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 011f10d707..ec7f1dfbd6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index a3002b38e7..aa25e45134 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index 2ce16e7f46..6afd487121 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 9884724641..ba306d4db6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index cb4669e427..a80752f3cb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index 55ab72cfa5..9728874cf2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index 4da2995f20..e30d8049e0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index affe190eb0..81dfdbff6b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index a59fa54f37..f7c601374f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index b914aef018..d972403d48 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index 568003e2d4..eef9ea4d32 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 47af2646de..7a856a0d3a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index 0dde9096ad..066d81fea6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index b20e662734..79f3e76917 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 5264152de7..5fae7fcaa2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 52599537a8..f8b8de44b0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index 8b3430abee..2199b771cd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 48fdd0b7bb..05e4b877e9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index 4bf0f028cc..dceedfc1f5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index 8f07a81fee..a79b01f8ff 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index f29c944af5..99fd7e3df6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index 1fb196ef50..e67b373b20 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 3bb722e5d0..59b9a8f2d9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index 60ed38e097..284823b572 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index 142cd79d25..98511176b3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 761ba4fbe3..c09a619cde 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index be55387c1f..bb30b7ccaf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index 53014f02b2..34ae85b29a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index a2ebc7ac84..5becd4fccf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index 319d539066..eff5b5b651 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index 4025d018a6..2eb2fcfb5e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index e157f03a47..42209d4c38 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 9c5a83161d..ac12630410 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 84d4e028ab..8353a0926b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 52ec8f1b72..8bba24413d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/CustomCode/Extensions/AmplitudeRatioExtensions.cs b/UnitsNet/CustomCode/Extensions/AmplitudeRatioExtensions.cs deleted file mode 100644 index 6dfc38e269..0000000000 --- a/UnitsNet/CustomCode/Extensions/AmplitudeRatioExtensions.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -namespace UnitsNet.CustomCode.Extensions -{ - /// - /// Extension methods for . - /// - public static class AmplitudeRatioExtensions - { - /// - /// Gets an from . - /// - /// The amplitude ratio to convert. - /// - /// Provides a nicer syntax for converting an amplitude ratio back to a voltage. - /// - /// var voltage = voltageRatio.ToElectricPotential(); - /// - /// - public static ElectricPotential ToElectricPotential(this AmplitudeRatio amplitudeRatio) - { - return AmplitudeRatio.ToElectricPotential(amplitudeRatio); - } - - /// - /// Converts a to a . - /// - /// The amplitude ratio to convert. - /// The input impedance of the load. This is usually 50, 75 or 600 ohms. - /// http://www.maximintegrated.com/en/app-notes/index.mvp/id/808 - public static PowerRatio ToPowerRatio(this AmplitudeRatio amplitudeRatio, ElectricResistance impedance) - { - return AmplitudeRatio.ToPowerRatio(amplitudeRatio, impedance); - } - } -} \ No newline at end of file diff --git a/UnitsNet/CustomCode/Extensions/DensityExtensions.cs b/UnitsNet/CustomCode/Extensions/DensityExtensions.cs deleted file mode 100644 index e0a6585758..0000000000 --- a/UnitsNet/CustomCode/Extensions/DensityExtensions.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -namespace UnitsNet.CustomCode.Extensions -{ - /// - /// Extension methods for . - /// - public static class DensityExtensions - { - /// - /// Gets from . - /// - public static Molarity ToMolarity(this Density density, Mass molecularWeight) - { - return Density.ToMolarity(density, molecularWeight); - } - } -} diff --git a/UnitsNet/CustomCode/Extensions/MolarityExtensions.cs b/UnitsNet/CustomCode/Extensions/MolarityExtensions.cs deleted file mode 100644 index 98cecee7f0..0000000000 --- a/UnitsNet/CustomCode/Extensions/MolarityExtensions.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -namespace UnitsNet.CustomCode.Extensions -{ - /// - /// Extensions for . - /// - public static class MolarityExtensions - { - /// - /// Get from . - /// - public static Density ToDensity(this Molarity molarity, Mass molecularWeight) - { - return Molarity.ToDensity(molarity, molecularWeight); - } - } -} diff --git a/UnitsNet/CustomCode/Extensions/PowerExtensions.cs b/UnitsNet/CustomCode/Extensions/PowerExtensions.cs deleted file mode 100644 index e57d18ebd2..0000000000 --- a/UnitsNet/CustomCode/Extensions/PowerExtensions.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -namespace UnitsNet.CustomCode.Extensions -{ - /// - /// Extension methods for . - /// - public static class PowerExtensions - { - /// - /// Gets a from a relative to one watt. - /// - /// - /// Provides a nicer syntax for converting a power to a power ratio (relative to 1 watt). - /// - /// var powerRatio = power.ToPowerRatio(); - /// - /// - public static PowerRatio ToPowerRatio(this Power power) - { - return PowerRatio.FromPower(power); - } - } -} \ No newline at end of file diff --git a/UnitsNet/CustomCode/Extensions/PowerRatioExtensions.cs b/UnitsNet/CustomCode/Extensions/PowerRatioExtensions.cs deleted file mode 100644 index 4012c78e1b..0000000000 --- a/UnitsNet/CustomCode/Extensions/PowerRatioExtensions.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -namespace UnitsNet.CustomCode.Extensions -{ - /// - /// Extension methods for . - /// - public static class PowerRatioExtensions - { - /// - /// Gets a from a . - /// - /// - /// Provides a nicer syntax for converting a power ratio back to a power. - /// - /// var power = powerRatio.ToPower(); - /// - /// - public static Power ToPower(this PowerRatio powerRatio) - { - return PowerRatio.ToPower(powerRatio); - } - - /// - /// Gets a from a . - /// - /// The power ratio. - /// The input impedance of the load. This is usually 50, 75 or 600 ohms. - public static AmplitudeRatio ToAmplitudeRatio(this PowerRatio powerRatio, ElectricResistance impedance) - { - return PowerRatio.ToAmplitudeRatio(powerRatio, impedance); - } - } -} \ No newline at end of file diff --git a/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs b/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs index 5933fbbf48..0e68fb595b 100644 --- a/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs +++ b/UnitsNet/CustomCode/Quantities/AmplitudeRatio.extra.cs @@ -62,35 +62,43 @@ public partial struct AmplitudeRatio } /// - /// Gets an in decibels (dB) relative to 1 volt RMS from an - /// . + /// Gets an from this . /// - /// The voltage (electric potential) relative to one volt RMS. - public static AmplitudeRatio FromElectricPotential(ElectricPotential voltage) + /// + /// Provides a nicer syntax for converting an amplitude ratio back to a voltage. + /// + /// var voltage = voltageRatio.ToElectricPotential(); + /// + /// + public ElectricPotential ToElectricPotential() { - return new AmplitudeRatio(voltage); + // E(V) = 1V * 10^(E(dBV)/20) + return ElectricPotential.FromVolts( Math.Pow( 10, DecibelVolts / 20 ) ); } /// - /// Gets an from . + /// Converts this to a . /// - /// The voltage ratio to convert to voltage (electric potential). - public static ElectricPotential ToElectricPotential(AmplitudeRatio voltageRatio) + /// The input impedance of the load. This is usually 50, 75 or 600 ohms. + /// http://www.maximintegrated.com/en/app-notes/index.mvp/id/808 + public PowerRatio ToPowerRatio( ElectricResistance impedance ) { - // E(V) = 1V * 10^(E(dBV)/20) - return ElectricPotential.FromVolts(Math.Pow(10, voltageRatio.DecibelVolts / 20)); + // P(dBW) = E(dBV) - 10*log10(Z(Ω)/1) + return PowerRatio.FromDecibelWatts( DecibelVolts - 10 * Math.Log10( impedance.Ohms / 1 ) ); } + #region Static Methods + /// - /// Converts a to a . + /// Gets an in decibels (dB) relative to 1 volt RMS from an + /// . /// - /// The amplitude ratio to convert. - /// The input impedance of the load. This is usually 50, 75 or 600 ohms. - /// http://www.maximintegrated.com/en/app-notes/index.mvp/id/808 - public static PowerRatio ToPowerRatio(AmplitudeRatio amplitudeRatio, ElectricResistance impedance) + /// The voltage (electric potential) relative to one volt RMS. + public static AmplitudeRatio FromElectricPotential(ElectricPotential voltage) { - // P(dBW) = E(dBV) - 10*log10(Z(Ω)/1) - return PowerRatio.FromDecibelWatts(amplitudeRatio.DecibelVolts - 10 * Math.Log10(impedance.Ohms / 1)); + return new AmplitudeRatio(voltage); } + + #endregion } } diff --git a/UnitsNet/CustomCode/Quantities/Angle.extra.cs b/UnitsNet/CustomCode/Quantities/Angle.extra.cs index fdcd60cbcb..68676d7e50 100644 --- a/UnitsNet/CustomCode/Quantities/Angle.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Angle.extra.cs @@ -19,11 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if !WINDOWS_UWP using System; -#endif - // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -49,4 +46,4 @@ public partial struct Angle } #endif } -} \ No newline at end of file +} diff --git a/UnitsNet/CustomCode/Quantities/Area.extra.cs b/UnitsNet/CustomCode/Quantities/Area.extra.cs index 1b7c5c5de4..f6fc2770c4 100644 --- a/UnitsNet/CustomCode/Quantities/Area.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Area.extra.cs @@ -19,6 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; + // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -31,6 +33,21 @@ public sealed partial class Area public partial struct Area #endif { + #region Static Methods + + public static Area FromCircleDiameter(Length diameter) + { + var radius = Length.FromMeters(diameter.Meters / 2d); + return FromCircleRadius(radius); + } + + public static Area FromCircleRadius(Length radius) + { + return FromSquareMeters(Math.PI * radius.Meters * radius.Meters); + } + + #endregion + // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP public static Length operator /(Area area, Length length) @@ -47,16 +64,6 @@ public partial struct Area { return VolumeFlow.FromCubicMetersPerSecond(area.SquareMeters * speed.MetersPerSecond); } - - public static Area FromCircleDiameter(Length diameter) - { - return System.Math.PI * diameter * diameter / 4; - } - - public static Area FromCircleRadius(Length radius) - { - return System.Math.PI * radius * radius; - } #endif } } diff --git a/UnitsNet/CustomCode/Quantities/Density.extra.cs b/UnitsNet/CustomCode/Quantities/Density.extra.cs index d82336f64c..6fd11240ff 100644 --- a/UnitsNet/CustomCode/Quantities/Density.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Density.extra.cs @@ -33,6 +33,17 @@ public sealed partial class Density public partial struct Density #endif { + /// + /// Gets from this . + /// + /// + public Molarity ToMolarity(Mass molecularWeight) + { + return Molarity.FromMolesPerCubicMeter(KilogramsPerCubicMeter / molecularWeight.Kilograms); + } + + #region Static Methods + /// /// Get from . /// @@ -43,10 +54,7 @@ public static Density FromMolarity(Molarity molarity, Mass molecularWeight) return new Density(molarity.MolesPerCubicMeter * molecularWeight.Kilograms, DensityUnit.KilogramPerCubicMeter); } - public static Molarity ToMolarity(Density density, Mass molecularWeight) - { - return Molarity.FromMolesPerCubicMeter(density.KilogramsPerCubicMeter / molecularWeight.Kilograms); - } + #endregion // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP diff --git a/UnitsNet/CustomCode/Quantities/Duration.extra.cs b/UnitsNet/CustomCode/Quantities/Duration.extra.cs index dd0c691cdf..5748f67250 100644 --- a/UnitsNet/CustomCode/Quantities/Duration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Duration.extra.cs @@ -33,6 +33,19 @@ public sealed partial class Duration public partial struct Duration #endif { + /// + /// Convert a Duration to a TimeSpan. + /// + /// Throws if the TimeSpan can't represent the Duration exactly + /// The TimeSpan with the same time as the duration + public TimeSpan ToTimeSpan() + { + if( Seconds > TimeSpan.MaxValue.TotalSeconds || + Seconds < TimeSpan.MinValue.TotalSeconds ) + throw new ArgumentOutOfRangeException( nameof( Duration ), "The duration is too large or small to fit in a TimeSpan" ); + return TimeSpan.FromSeconds( Seconds ); + } + // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP public static DateTime operator +(DateTime time, Duration duration) @@ -100,18 +113,5 @@ public static explicit operator Duration(TimeSpan duration) return Volume.FromCubicMeters(volumeFlow.CubicMetersPerSecond * duration.Seconds); } #endif - - /// - /// Convert a Duration to a TimeSpan. - /// - /// Throws if the TimeSpan can't represent the Duration exactly - /// The TimeSpan with the same time as the duration - public TimeSpan ToTimeSpan() - { - if (Seconds > TimeSpan.MaxValue.TotalSeconds || - Seconds < TimeSpan.MinValue.TotalSeconds) - throw new ArgumentOutOfRangeException(nameof(Duration), "The duration is too large or small to fit in a TimeSpan"); - return TimeSpan.FromSeconds(Seconds); - } } } diff --git a/UnitsNet/CustomCode/Extensions/ElectricPotentialExtensions.cs b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs similarity index 63% rename from UnitsNet/CustomCode/Extensions/ElectricPotentialExtensions.cs rename to UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs index b7d6433311..6f1fc43ea7 100644 --- a/UnitsNet/CustomCode/Extensions/ElectricPotentialExtensions.cs +++ b/UnitsNet/CustomCode/Quantities/ElectricPotential.extra.cs @@ -19,16 +19,23 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -namespace UnitsNet.CustomCode.Extensions +using System; +using UnitsNet.Units; + +// ReSharper disable once CheckNamespace +namespace UnitsNet { - /// - /// Extension methods for . - /// - public static class ElectricPotentialExtensions + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. +#if WINDOWS_UWP + public sealed partial class ElectricPotential +#else + public partial struct ElectricPotential +#endif { /// - /// Gets an in decibels (dB) relative to 1 volt RMS from an - /// . + /// Gets an in decibels (dB) relative to 1 volt RMS from this . /// /// /// Provides a nicer syntax for converting a voltage to an amplitude ratio (relative to 1 volt RMS). @@ -36,9 +43,9 @@ public static class ElectricPotentialExtensions /// var voltageRatio = voltage.ToAmplitudeRatio(); /// /// - public static AmplitudeRatio ToAmplitudeRatio(this ElectricPotential voltage) + public AmplitudeRatio ToAmplitudeRatio() { - return AmplitudeRatio.FromElectricPotential(voltage); + return AmplitudeRatio.FromElectricPotential(this); } } -} \ No newline at end of file +} diff --git a/UnitsNet/CustomCode/Quantities/Force.extra.cs b/UnitsNet/CustomCode/Quantities/Force.extra.cs index f88a21dfec..f13fd8cbcd 100644 --- a/UnitsNet/CustomCode/Quantities/Force.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Force.extra.cs @@ -33,6 +33,17 @@ public sealed partial class Force public partial struct Force #endif { + public static Force FromPressureByArea(Pressure p, Area area) + { + double newtons = p.Pascals * area.SquareMeters; + return new Force(newtons, ForceUnit.Newton); + } + + public static Force FromMassByAcceleration(Mass mass, Acceleration acceleration) + { + return new Force(mass.Kilograms * acceleration.MetersPerSecondSquared, ForceUnit.Newton); + } + // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP public static Power operator *(Force force, Speed speed) @@ -65,16 +76,5 @@ public partial struct Force return ForcePerLength.FromNewtonsPerMeter(force.Newtons / length.Meters); } #endif - - public static Force FromPressureByArea(Pressure p, Area area) - { - double newtons = p.Pascals * area.SquareMeters; - return new Force(newtons, ForceUnit.Newton); - } - - public static Force FromMassByAcceleration(Mass mass, Acceleration acceleration) - { - return new Force(mass.Kilograms * acceleration.MetersPerSecondSquared, ForceUnit.Newton); - } } } diff --git a/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs b/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs index bc637de97e..72dbd14940 100644 --- a/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/KinematicViscosity.extra.cs @@ -19,11 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if !WINDOWS_UWP using System; -#endif - // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -69,4 +66,4 @@ public partial struct KinematicViscosity } #endif } -} \ No newline at end of file +} diff --git a/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs b/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs index 9bbdac03b3..49288cfe60 100644 --- a/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs +++ b/UnitsNet/CustomCode/Quantities/MassFlow.extra.cs @@ -19,11 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if !WINDOWS_UWP using System; -#endif - // ReSharper disable once CheckNamespace namespace UnitsNet { diff --git a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs index a34a1a026d..9226caed22 100644 --- a/UnitsNet/CustomCode/Quantities/Molarity.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Molarity.extra.cs @@ -26,24 +26,26 @@ public partial struct Molarity } /// - /// Get from . + /// Get a from this . /// - /// /// - public static Molarity FromDensity(Density density, Mass molecularWeight) + public Density ToDensity(Mass molecularWeight) { - return new Molarity(density, molecularWeight); + return Density.FromKilogramsPerCubicMeter(MolesPerCubicMeter * molecularWeight.Kilograms); } + #region Static Methods + /// - /// Get from . + /// Get from . /// - /// + /// /// - /// - public static Density ToDensity(Molarity molarity, Mass molecularWeight) + public static Molarity FromDensity(Density density, Mass molecularWeight) { - return Density.FromKilogramsPerCubicMeter(molarity.MolesPerCubicMeter * molecularWeight.Kilograms); + return new Molarity(density, molecularWeight); } + + #endregion } } diff --git a/UnitsNet/CustomCode/Quantities/Power.extra.cs b/UnitsNet/CustomCode/Quantities/Power.extra.cs index 5db0ad8aa1..77b1616860 100644 --- a/UnitsNet/CustomCode/Quantities/Power.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Power.extra.cs @@ -19,11 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if !WINDOWS_UWP using System; -#endif - // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -36,6 +33,20 @@ public sealed partial class Power public partial struct Power #endif { + /// + /// Gets a from this relative to one watt. + /// + /// + /// Provides a nicer syntax for converting a power to a power ratio (relative to 1 watt). + /// + /// var powerRatio = power.ToPowerRatio(); + /// + /// + public PowerRatio ToPowerRatio() + { + return PowerRatio.FromPower(this); + } + // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP public static Energy operator *(Power power, TimeSpan time) diff --git a/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs b/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs index a0b00e0d9a..4180da4d89 100644 --- a/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs +++ b/UnitsNet/CustomCode/Quantities/PowerRatio.extra.cs @@ -58,34 +58,41 @@ public partial struct PowerRatio } /// - /// Gets a from a relative to one watt. + /// Gets a from this (which is a power level relative to one watt). /// - /// The power relative to one watt. - public static PowerRatio FromPower(Power power) + /// + /// Provides a nicer syntax for converting a power ratio back to a power. + /// + /// var power = powerRatio.ToPower(); + /// + /// + public Power ToPower() { - return new PowerRatio(power); + // P(W) = 1W * 10^(P(dBW)/10) + return Power.FromWatts(Math.Pow(10, DecibelWatts / 10)); } /// - /// Gets a from a (which is a power level relative to one watt). + /// Gets a from this . /// - /// The power level relative to one watt. - public static Power ToPower(PowerRatio powerRatio) + /// The input impedance of the load. This is usually 50, 75 or 600 ohms. + public AmplitudeRatio ToAmplitudeRatio(ElectricResistance impedance) { - // P(W) = 1W * 10^(P(dBW)/10) - return Power.FromWatts(Math.Pow(10, powerRatio.DecibelWatts / 10)); + // E(dBV) = 10*log10(Z(Ω)/1) + P(dBW) + return AmplitudeRatio.FromDecibelVolts(10 * Math.Log10(impedance.Ohms / 1) + DecibelWatts); } + #region Static Methods + /// - /// Gets a from a . + /// Gets a from a relative to one watt. /// - /// The power ratio. - /// The input impedance of the load. This is usually 50, 75 or 600 ohms. - /// http://www.maximintegrated.com/en/app-notes/index.mvp/id/808 - public static AmplitudeRatio ToAmplitudeRatio(PowerRatio powerRatio, ElectricResistance impedance) + /// The power relative to one watt. + public static PowerRatio FromPower(Power power) { - // E(dBV) = 10*log10(Z(Ω)/1) + P(dBW) - return AmplitudeRatio.FromDecibelVolts(10 * Math.Log10(impedance.Ohms / 1) + powerRatio.DecibelWatts); + return new PowerRatio(power); } + + #endregion } } diff --git a/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs b/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs index 5282a13ee0..0afa95479d 100644 --- a/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs +++ b/UnitsNet/CustomCode/Quantities/RotationalSpeed.extra.cs @@ -19,11 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if !WINDOWS_UWP using System; -#endif - // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -59,4 +56,4 @@ public partial struct RotationalSpeed } #endif } -} \ No newline at end of file +} diff --git a/UnitsNet/CustomCode/Quantities/Speed.extra.cs b/UnitsNet/CustomCode/Quantities/Speed.extra.cs index f27bd4d765..8e5eaab04d 100644 --- a/UnitsNet/CustomCode/Quantities/Speed.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Speed.extra.cs @@ -19,11 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if !WINDOWS_UWP using System; -#endif - // ReSharper disable once CheckNamespace namespace UnitsNet { diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 0e89ea1a12..1b07fe26ee 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 86d4278cd0..a644c32be9 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index e0fa81cd5d..c70a98038d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 51753db5d2..9fd7307afb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 41bfe2d46f..051f4c69cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 992613a95a..ac9a694fc2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index a4bfa9e295..60a1dc3826 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 6b09e42eac..bd75e73e5b 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index d036010068..8148968622 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index cff763ba49..a6a92ac3ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 37117d872c..5e7156515a 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index aadea1f0ba..af6e9c637b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index c6f7ba50ad..e491b219c5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index a79dbc61c0..1d0d18b70a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index d9ce2d1c0f..eb45c1c136 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index e3b6f3a675..263c6de064 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index 3b730d7636..b73452a549 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 8acc8b5ae7..7d546ced0d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 070ece5b15..5991df998d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 6ce3b2e513..0cd21c684c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 8871210be8..1b4d40cfa9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 3539d817cb..e9f57b6edc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index a6c8c1147b..f65e48d975 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index ebe7da9c35..4f889665e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index fd65f779ff..c70d46afb5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index 5274b4408b..f682141e0c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index 1cc663ba20..f45d171288 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 27cca700b0..49b4cd99fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index 3e8a9c21ab..78999740f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index d99910acb6..974ed78d36 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index df820fd0f7..858b4dab8e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index fed433b0eb..67aec88196 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index fea2fa4acf..f77b5517fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index c61e9c3e84..fe2a36ad69 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 7ab074def9..f99af625c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 7bb6f55ee9..808ae842de 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 84ecd3f8ba..4a536af266 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 8108210b8e..782c372609 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index bd3a431902..91f95e532d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 7a9bd15f06..fc2a2db57d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index dfdc82a528..8125249276 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 14e0412c7e..9de210c9e1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index df4c9fa5ea..89b7292c8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index bfb092ff67..b8f2e7c54e 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 555d9d433c..affe48ffb6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index cbefbe65ed..eddeb0487c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index fcb1d06321..9c7d0fa666 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index d14b4ee9e4..a7cdd9f6e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index c26523eddc..e4273f49a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 067cea1f87..4f6410d595 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 4422776439..004a649b85 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 3ca49af665..0b89647188 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 86076f6624..ef690ea9e7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index bf68b78921..1028bec32c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index db65fd8e30..d158b77d95 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index aefa2e81c8..b1d3435bdf 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 80d8afb19f..1bb371ad77 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 41d856b93b..a65e4cda72 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 52f9603a76..5ec81eb213 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 2d95d42b4a..5a119af8d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 81e66bc7d2..1d5ad93d6d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 07356c0d81..70ff35b4bd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index c2829747c5..443733eac9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 215fba3ef2..5482e33348 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 53e5e4ec00..77191aecd0 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 1591939f2f..e84ab74bc8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 4f19dd87ed..98bf53bbbd 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 8598f87910..a627e7be80 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index db75cedd3d..d92acc5f57 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index a65bfc0bdc..45ec1844c5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index e61be585d8..41b084d2d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 8bb5adb58f..ab81a13b9a 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index cb5e6ae90a..5529da419e 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index f25f52cf57..e5e2dd73a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index f5b2911984..096a0ff8d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 1b8bfa30e4..c8c029e3c5 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 9bb56976fc..ee4e4a200c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 515e44ad2e..7fa18edac4 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 8c5f837d8c..2afcec90b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 1e0b626c3b..1c89926821 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index c723d62da2..2fd541ddba 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index ffbe4cf16a..7e53c56fd0 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index e5bdee0b8d..db1081453e 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 79852a7b14..837c5cb743 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 5852961f37..3f292a7c8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 997983261d..2af13bb0b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 940e7bf0b6..1f994609a1 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 81e0f4c884..333fb49dbb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 144be8f24b..816a12a8f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/QuantityType.g.cs b/UnitsNet/GeneratedCode/QuantityType.g.cs index 932cce055f..42961ed2d1 100644 --- a/UnitsNet/GeneratedCode/QuantityType.g.cs +++ b/UnitsNet/GeneratedCode/QuantityType.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index ce797d70f4..54d79bc605 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs b/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs index c7d465c66b..b0c49bde87 100644 --- a/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs index f671d26d15..bcabd91e77 100644 --- a/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs b/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs index 2a1b14f392..6fb4962a34 100644 --- a/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs b/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs index e87eb277ff..3279d5821e 100644 --- a/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs index 5edcebcffb..7a1acff4e8 100644 --- a/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs index 0969f561f4..e4bcbfa34e 100644 --- a/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs index ea36d2a3e4..1ed64cfae3 100644 --- a/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs b/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs index b455360b49..fec0b2c008 100644 --- a/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs b/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs index 135571a5f7..c6a16021ad 100644 --- a/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs index 3f614382db..9b7411b170 100644 --- a/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs b/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs index 4857a03eca..d5b7857368 100644 --- a/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs index 5ca7d09725..984e8dd83f 100644 --- a/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs index 4727857808..5ef6bd4e77 100644 --- a/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs b/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs index 8131bbf267..961559a051 100644 --- a/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs b/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs index e8013f83e7..84b74d6442 100644 --- a/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs index 45cbd5cb79..b2de3ce9d4 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs index a126176d3c..195bd7eec8 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs index 9c913a156f..d36e438166 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs index b6761351a4..efb2d3b628 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs index 911c4a8c7e..42b02561de 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs index 152242cd4c..52eb62d9d8 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs index 4037b39966..a3095b0518 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs index d6fa1465d3..1df148e23c 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs index 0a32aa3db6..c27481604e 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs index 4e4cb43c9b..d453a32a83 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs index 6f8f152361..0eeaf32d88 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs index 1aca06144a..06072a5d5f 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs index 89ed37b2f5..b084204e83 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs index 195ad52d75..df05e507d4 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs index ee4288fd78..a87d79ae8e 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs index 4a718a8d27..df09fa777e 100644 --- a/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs b/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs index 6e06983b3e..afe6b86cd8 100644 --- a/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs index 546be5314c..4e62ae2f78 100644 --- a/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs index d4dc08cf6e..37989ccfc6 100644 --- a/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs index d8984dc616..7b9f27c7c3 100644 --- a/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs b/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs index 68f512532f..abf9231bcd 100644 --- a/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs index 393997a215..c8d50957b8 100644 --- a/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs b/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs index cb02c9f7e2..e15edddb3c 100644 --- a/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs index 28fcead57b..aa20dfe390 100644 --- a/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs b/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs index c31497b843..c3d9fd3b08 100644 --- a/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs b/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs index b83ad004ad..8cffb9aaac 100644 --- a/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs b/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs index 7231cbb235..3d0443e105 100644 --- a/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs b/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs index 1e69957f97..b4f5dcb200 100644 --- a/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs index 7fbba2dd45..73ac4f8b88 100644 --- a/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs index 218be595e1..6444e3c960 100644 --- a/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs b/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs index d1524dc87f..fe01e7447e 100644 --- a/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs index b5c66ed948..4906903b18 100644 --- a/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs index 4625ee4185..ee19dae739 100644 --- a/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs index 498896fa94..ada0c10463 100644 --- a/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs b/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs index 7b98e8c5c6..61cb705d5b 100644 --- a/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs index b3e5cafba6..bd93eb48f2 100644 --- a/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs b/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs index d599c500af..8e3e345034 100644 --- a/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs index 930d6bf0b0..6788b21f7d 100644 --- a/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs index 5b21271a1c..3af4d5e64e 100644 --- a/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs index ead75b9e45..3e326b2f8b 100644 --- a/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MassUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassUnit.g.cs index 43a14081fc..1cfaeb791f 100644 --- a/UnitsNet/GeneratedCode/Units/MassUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs index 759d06b3ba..c12f6ce671 100644 --- a/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs index 25ca54d2fa..faec0c8cef 100644 --- a/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs index d31ab60a5f..cd665b84f9 100644 --- a/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs index 567a931817..212ccab116 100644 --- a/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs b/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs index e67d119055..ce35038c53 100644 --- a/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs index 2594d47d3b..e6b0ce6f26 100644 --- a/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs index 33bc13a7b2..a28b6b1436 100644 --- a/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs b/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs index a797980b87..901d65c6d4 100644 --- a/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs index b29758e9ac..a9edfce06a 100644 --- a/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs index 7964555547..9097656205 100644 --- a/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs b/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs index 4077f28533..04cc9ef9cc 100644 --- a/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs b/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs index eb6107144c..b9ade5c47e 100644 --- a/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs index 7d97715256..d32891faa6 100644 --- a/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs index 9541472dcb..023770095a 100644 --- a/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs index 4fc4d56c38..99692cc035 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs index 14562f4fe9..9f4e87a1d5 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs index e8c63c082a..2b1d9d5fc0 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs index 51f31b86ed..b26767d649 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs b/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs index f187c8988a..0d5b869ec6 100644 --- a/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs index 6720646ab7..abd1b1e766 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs index e114267b4f..8dc5047030 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs index 9bb8b0d64a..31dee77c70 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs index 8b40c5726d..5749bb693c 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs index cd9acd74ba..e9240af553 100644 --- a/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs index 6173593193..cfdec582d9 100644 --- a/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs b/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs index ef6299db7d..a5413b1cf6 100644 --- a/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs b/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs index c979602734..828b7f01ed 100644 --- a/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs index 95cf039361..29cdbf2738 100644 --- a/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs index b45da3be26..dbc524b022 100644 --- a/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs b/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs index f7b8cf22c5..ba96c3420c 100644 --- a/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs b/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs index 7381aa35e0..7159afbbcb 100644 --- a/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs index bc04eaddfe..25a68d9047 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs index 100a3162f3..1df0696f47 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs @@ -9,7 +9,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/Scripts/GenerateUnits.ps1 b/UnitsNet/Scripts/GenerateUnits.ps1 index 3954e765bf..902b326510 100644 --- a/UnitsNet/Scripts/GenerateUnits.ps1 +++ b/UnitsNet/Scripts/GenerateUnits.ps1 @@ -99,22 +99,6 @@ function GenerateQuantityType($quantities, $outDir) Write-Host "(OK) " } -function GenerateNumberExtensions($quantity, $numberExtensionsDir) -{ - $outDir = "$numberExtensionsDir" - $fileName = "NumberTo$($quantity.Name)Extensions.g.cs" - $outFilePath = "$outDir/$fileName" - EnsureDirExists $outDir - Write-Host -NoNewline "NumberExtensions" - - GenerateNumberExtensionsSourceCode $quantity | Out-File -Encoding "UTF8" -Force $outFilePath | Out-Null - if (!$?) { - Write-Host -NoNewline "(error) " - exit 1 - } - Write-Host -NoNewline "(OK) " -} - function EnsureDirExists([String] $dirPath) { New-Item -ItemType Directory -Force -Path $dirPath | Out-Null if (!$?) { @@ -272,7 +256,6 @@ EnsureDirExists ($quantityDir = "$PSScriptRoot/../GeneratedCode/Quantities") EnsureDirExists ($unitEnumDir = "$PSScriptRoot/../GeneratedCode/Units") EnsureDirExists ($unitSystemDir = "$PSScriptRoot/../GeneratedCode") EnsureDirExists ($testsDir = "$PSScriptRoot/../../UnitsNet.Tests/GeneratedCode") -EnsureDirExists ($numberExtensionsDir = "$PSScriptRoot/../GeneratedCode/Extensions/Number") EnsureDirExists ($testsCustomCodeDir = "$PSScriptRoot/../../UnitsNet.Tests/CustomCode") $templatesDir = "$PSScriptRoot/../../Common/UnitDefinitions" diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index f4a9a1a28c..b39e85678a 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -29,7 +29,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index d8ecf8a111..a3fbb86bed 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -21,7 +21,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index 96146d14e0..f3e1538611 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -21,7 +21,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 index 3fd76fd4dd..f88f1152f2 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 @@ -12,7 +12,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 index b8ca8382e2..4b7e374f5a 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 @@ -12,7 +12,6 @@ function GenerateUnitSystemDefaultSourceCode($quantities) // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // @@ -93,4 +92,4 @@ namespace UnitsNet } } "@; -} \ No newline at end of file +} diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index bfa0e781df..4643a87e8f 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -20,7 +20,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 index 855d5973a5..03ac77c224 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 @@ -16,7 +16,6 @@ function GenerateUnitTestPlaceholderSourceCode($quantity) // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // diff --git a/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 index 9459d05e78..3d8ab0c635 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 @@ -14,7 +14,6 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. // Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. // // From 9a134f5080307aea85f89d4ba10f5ba81d4f9dd7 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 3 Oct 2018 15:30:12 -0400 Subject: [PATCH 045/131] Do not throw in TryXXX methods in UnitConverter Reimplement instead of wrapping in try/catch, which has some performance overhead. Also it incorrectly catches exceptions like OutOfMemoryException, that it simply can't handle. --- UnitsNet/UnitConverter.cs | 186 +++++++++++++++++++++++--------------- 1 file changed, 111 insertions(+), 75 deletions(-) diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index 654f44f37a..f4e25b8073 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -69,23 +69,38 @@ public static class UnitConverter /// /// double centimeters = ConvertByName(5, "Length", "Meter", "Centimeter"); // 500 /// Output value as the result of converting to . + /// No quantities were found that match . /// No units match the abbreviation. /// More than one unit matches the abbrevation. public static double ConvertByName(FromValue fromValue, string quantityName, string fromUnit, string toUnit) { - Type quantityType = GetQuantityType(quantityName); - Type unitType = GetUnitType(quantityName); + if(!TryGetQuantityType(quantityName, out var quantityType)) + throw new QuantityNotFoundException($"The given quantity name was not found: {quantityName}"); - object fromUnitValue = ParseUnit(unitType, fromUnit); // ex: LengthUnit.Meter - object toUnitValue = ParseUnit(unitType, toUnit); // ex: LengthUnit.Centimeter + if(!TryGetUnitType(quantityName, out var unitType)) + throw new UnitNotFoundException($"The unit type for the given quantity was not found: {quantityName}"); - MethodInfo fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) - object fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) + if(!TryParseUnit(unitType, fromUnit, out var fromUnitValue)) // ex: LengthUnit.Meter + { + var e = new UnitNotFoundException($"Unit not found [{fromUnit}]."); + e.Data["unitName"] = fromUnit; + throw e; + } + + if(!TryParseUnit(unitType, toUnit, out var toUnitValue)) // ex: LengthUnit.Centimeter + { + var e = new UnitNotFoundException($"Unit not found [{toUnit}]."); + e.Data["unitName"] = toUnit; + throw e; + } + + var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) + var fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) - MethodInfo asMethod = GetAsMethod(quantityType, unitType); // ex: quantity.As(LengthUnit outputUnit) - object asResult = asMethod.Invoke(fromResult, new[] {toUnitValue}); // ex: double outputValue = quantity.As(LengthUnit.Centimeter) + var asMethod = GetAsMethod(quantityType, unitType); // ex: quantity.As(LengthUnit outputUnit) + var asResult = asMethod.Invoke(fromResult, new[] {toUnitValue}); // ex: double outputValue = quantity.As(LengthUnit.Centimeter) - return (double) asResult; + return (double)asResult; } /// @@ -117,21 +132,28 @@ public static double ConvertByName(FromValue fromValue, string quantityName, str /// True if conversion was successful. public static bool TryConvertByName(FromValue inputValue, string quantityName, string fromUnit, string toUnit, out double result) { - try - { - // Re-implement this to avoid exceptions where possible, as Try methods are generally recommended for performance and this is cheating. - // https://msdn.microsoft.com/en-us/library/ms229009(v=vs.100).aspx - // - // Implement Try-methods without try-catch #504 - // https://github.com/angularsen/UnitsNet/issues/504 - result = ConvertByName(inputValue, quantityName, fromUnit, toUnit); - return true; - } - catch - { - result = 0; + result = 0d; + + if(!TryGetQuantityType(quantityName, out var quantityType)) return false; - } + + if(!TryGetUnitType(quantityName, out var unitType)) + return false; + + if(!TryParseUnit(unitType, fromUnit, out var fromUnitValue)) // ex: LengthUnit.Meter + return false; + + if(!TryParseUnit(unitType, toUnit, out var toUnitValue)) // ex: LengthUnit.Centimeter + return false; + + var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) + var fromResult = fromMethod.Invoke(null, new[] {inputValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) + + var asMethod = GetAsMethod(quantityType, unitType); // ex: quantity.As(LengthUnit outputUnit) + var asResult = asMethod.Invoke(fromResult, new[] {toUnitValue}); // ex: double outputValue = quantity.As(LengthUnit.Centimeter) + + result = (double)asResult; + return true; } /// @@ -199,20 +221,23 @@ public static double ConvertByAbbreviation(FromValue fromValue, string quantityN /// More than one unit matches the abbrevation. public static double ConvertByAbbreviation(FromValue fromValue, string quantityName, string fromUnitAbbrev, string toUnitAbbrev, string culture) { - Type quantityType = GetQuantityType(quantityName); - Type unitType = GetUnitType(quantityName); + if(!TryGetQuantityType(quantityName, out var quantityType)) + throw new QuantityNotFoundException($"The given quantity name was not found: {quantityName}"); + + if(!TryGetUnitType(quantityName, out var unitType)) + throw new UnitNotFoundException($"The unit type for the given quantity was not found: {quantityName}"); - UnitSystem unitSystem = UnitSystem.GetCached(culture); - object fromUnitValue = unitSystem.Parse(fromUnitAbbrev, unitType); // ex: ("m", LengthUnit) => LengthUnit.Meter - object toUnitValue = unitSystem.Parse(toUnitAbbrev, unitType); // ex:("cm", LengthUnit) => LengthUnit.Centimeter + var unitSystem = UnitSystem.GetCached(culture); + var fromUnitValue = unitSystem.Parse(fromUnitAbbrev, unitType); // ex: ("m", LengthUnit) => LengthUnit.Meter + var toUnitValue = unitSystem.Parse(toUnitAbbrev, unitType); // ex:("cm", LengthUnit) => LengthUnit.Centimeter - MethodInfo fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) - object fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) + var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) + var fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) - MethodInfo asMethod = GetAsMethod(quantityType, unitType); // ex: quantity.As(LengthUnit outputUnit) - object asResult = asMethod.Invoke(fromResult, new[] {toUnitValue}); // ex: double outputValue = quantity.As(LengthUnit.Centimeter) + var asMethod = GetAsMethod(quantityType, unitType); // ex: quantity.As(LengthUnit outputUnit) + var asResult = asMethod.Invoke(fromResult, new[] {toUnitValue}); // ex: double outputValue = quantity.As(LengthUnit.Centimeter) - return (double) asResult; + return (double)asResult; } /// @@ -278,23 +303,31 @@ public static bool TryConvertByAbbreviation(FromValue fromValue, string quantity public static bool TryConvertByAbbreviation(FromValue fromValue, string quantityName, string fromUnitAbbrev, string toUnitAbbrev, out double result, string culture) { - try - { - // Re-implement this to avoid exceptions where possible, as Try methods are generally recommended for performance and this is cheating. - // https://msdn.microsoft.com/en-us/library/ms229009(v=vs.100).aspx - // - // Implement Try-methods without try-catch #504 - // https://github.com/angularsen/UnitsNet/issues/504 - result = ConvertByAbbreviation(fromValue, quantityName, fromUnitAbbrev, toUnitAbbrev, culture); - return true; - } - catch - { - result = 0; + result = 0d; + + if(!TryGetQuantityType(quantityName, out var quantityType)) return false; - } - } + if(!TryGetUnitType(quantityName, out var unitType)) + return false; + + var unitSystem = UnitSystem.GetCached(culture); + + if(!unitSystem.TryParse(fromUnitAbbrev, unitType, out var fromUnitValue)) // ex: ("m", LengthUnit) => LengthUnit.Meter + return false; + + if(!unitSystem.TryParse(toUnitAbbrev, unitType, out var toUnitValue)) // ex:("cm", LengthUnit) => LengthUnit.Centimeter + return false; + + var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) + var fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) + + var asMethod = GetAsMethod(quantityType, unitType); // ex: quantity.As(LengthUnit outputUnit) + var asResult = asMethod.Invoke(fromResult, new[] {toUnitValue}); // ex: double outputValue = quantity.As(LengthUnit.Centimeter) + + result = (double)asResult; + return true; + } private static MethodInfo GetAsMethod(Type quantityType, Type unitType) { @@ -322,14 +355,14 @@ private static MethodInfo GetStaticFromMethod(Type quantityType, Type unitType) private static bool HasParameterTypes(MethodInfo methodInfo, params Type[] expectedTypes) { - ParameterInfo[] parameters = methodInfo.GetParameters(); + var parameters = methodInfo.GetParameters(); if (parameters.Length != expectedTypes.Length) throw new ArgumentException($"The number of parameters {parameters.Length} did not match the number of types {expectedTypes.Length}."); for (var i = 0; i < parameters.Length; i++) { - ParameterInfo p = parameters[i]; - Type t = expectedTypes[i]; + var p = parameters[i]; + var t = expectedTypes[i]; if (p.ParameterType != t) return false; } @@ -343,40 +376,43 @@ private static bool HasParameterTypes(MethodInfo methodInfo, params Type[] expec /// /// Unit type, such as . /// Unit name, such as "Meter" corresponding to . - /// Unit enum value, such as boxed as an object. + /// The return enum value, such as boxed as an object. + /// True if succeeded, otherwise false. /// No unit values match the . - private static object ParseUnit(Type unitType, string unitName) + private static bool TryParseUnit(Type unitType, string unitName, out object unitValue) { - object unitValue; // ex: LengthUnit.Meter - try - { - unitValue = Enum.Parse(unitType, unitName); - } - catch (Exception e) - { - var e2 = new UnitNotFoundException($"Unit not found [{unitName}].", e); - e2.Data["unitName"] = unitName; - throw e2; - } - return unitValue; + unitValue = null; + + if(!Enum.IsDefined(unitType, unitName)) + return false; + + unitValue = Enum.Parse(unitType, unitName); + if(unitValue == null) + return false; + + return true; } - private static Type GetUnitType(string quantityName) + private static bool TryGetUnitType(string quantityName, out Type unitType) { string unitTypeName = $"{UnitTypeNamespace}.{quantityName}Unit"; - Type unitType = UnitsNetAssembly.GetType(unitTypeName); // ex: UnitsNet.Units.LengthUnit enum - if (unitType == null) - throw new UnitNotFoundException($"Unit type name not found: {unitTypeName}"); - return unitType; + + unitType = UnitsNetAssembly.GetType(unitTypeName); // ex: UnitsNet.Units.LengthUnit enum + if(unitType == null) + return false; + + return true; } - private static Type GetQuantityType(string quantityName) + private static bool TryGetQuantityType(string quantityName, out Type quantityType) { string quantityTypeName = $"{QuantityNamespace}.{quantityName}"; - Type quantityType = UnitsNetAssembly.GetType(quantityTypeName); // ex: UnitsNet.Length struct - if (quantityType == null) - throw new QuantityNotFoundException($"Quantity type name not found: {quantityTypeName}"); - return quantityType; + + quantityType = UnitsNetAssembly.GetType(quantityTypeName); // ex: UnitsNet.Length struct + if(quantityType == null) + return false; + + return true; } } } From 2c39cbfef5379a65c3e4446308287f120d1313e8 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 5 Oct 2018 16:28:15 -0400 Subject: [PATCH 046/131] Implementing TryParse methods to not do try/catch. (#507) --- .../Quantities/Acceleration.Common.g.cs | 139 ++++++++++++++++- .../Quantities/AmountOfSubstance.Common.g.cs | 139 ++++++++++++++++- .../Quantities/AmplitudeRatio.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Angle.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ApparentEnergy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ApparentPower.Common.g.cs | 139 ++++++++++++++++- .../GeneratedCode/Quantities/Area.Common.g.cs | 139 ++++++++++++++++- .../Quantities/AreaDensity.Common.g.cs | 139 ++++++++++++++++- .../AreaMomentOfInertia.Common.g.cs | 139 ++++++++++++++++- .../Quantities/BitRate.Common.g.cs | 139 ++++++++++++++++- .../BrakeSpecificFuelConsumption.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Capacitance.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Density.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Duration.Common.g.cs | 139 ++++++++++++++++- .../Quantities/DynamicViscosity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ElectricAdmittance.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ElectricCharge.Common.g.cs | 139 ++++++++++++++++- .../ElectricChargeDensity.Common.g.cs | 139 ++++++++++++++++- .../ElectricConductance.Common.g.cs | 139 ++++++++++++++++- .../ElectricConductivity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ElectricCurrent.Common.g.cs | 139 ++++++++++++++++- .../ElectricCurrentDensity.Common.g.cs | 139 ++++++++++++++++- .../ElectricCurrentGradient.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ElectricField.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ElectricInductance.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ElectricPotential.Common.g.cs | 139 ++++++++++++++++- .../ElectricPotentialAc.Common.g.cs | 139 ++++++++++++++++- .../ElectricPotentialDc.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ElectricResistance.Common.g.cs | 139 ++++++++++++++++- .../ElectricResistivity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Energy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Entropy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Force.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ForceChangeRate.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ForcePerLength.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Frequency.Common.g.cs | 139 ++++++++++++++++- .../Quantities/HeatFlux.Common.g.cs | 139 ++++++++++++++++- .../HeatTransferCoefficient.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Illuminance.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Information.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Irradiance.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Irradiation.Common.g.cs | 139 ++++++++++++++++- .../Quantities/KinematicViscosity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/LapseRate.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Length.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Level.Common.g.cs | 139 ++++++++++++++++- .../Quantities/LinearDensity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/LuminousFlux.Common.g.cs | 139 ++++++++++++++++- .../Quantities/LuminousIntensity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/MagneticField.Common.g.cs | 139 ++++++++++++++++- .../Quantities/MagneticFlux.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Magnetization.Common.g.cs | 139 ++++++++++++++++- .../GeneratedCode/Quantities/Mass.Common.g.cs | 139 ++++++++++++++++- .../Quantities/MassFlow.Common.g.cs | 139 ++++++++++++++++- .../Quantities/MassFlux.Common.g.cs | 139 ++++++++++++++++- .../MassMomentOfInertia.Common.g.cs | 139 ++++++++++++++++- .../Quantities/MolarEnergy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/MolarEntropy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/MolarMass.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Molarity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Permeability.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Permittivity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Power.Common.g.cs | 139 ++++++++++++++++- .../Quantities/PowerDensity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/PowerRatio.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Pressure.Common.g.cs | 139 ++++++++++++++++- .../Quantities/PressureChangeRate.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Ratio.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ReactiveEnergy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ReactivePower.Common.g.cs | 139 ++++++++++++++++- .../RotationalAcceleration.Common.g.cs | 139 ++++++++++++++++- .../Quantities/RotationalSpeed.Common.g.cs | 139 ++++++++++++++++- .../RotationalStiffness.Common.g.cs | 139 ++++++++++++++++- .../RotationalStiffnessPerLength.Common.g.cs | 139 ++++++++++++++++- .../Quantities/SolidAngle.Common.g.cs | 139 ++++++++++++++++- .../Quantities/SpecificEnergy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/SpecificEntropy.Common.g.cs | 139 ++++++++++++++++- .../Quantities/SpecificVolume.Common.g.cs | 139 ++++++++++++++++- .../Quantities/SpecificWeight.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Speed.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Temperature.Common.g.cs | 139 ++++++++++++++++- .../TemperatureChangeRate.Common.g.cs | 139 ++++++++++++++++- .../Quantities/TemperatureDelta.Common.g.cs | 139 ++++++++++++++++- .../ThermalConductivity.Common.g.cs | 139 ++++++++++++++++- .../Quantities/ThermalResistance.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Torque.Common.g.cs | 139 ++++++++++++++++- .../Quantities/VitaminA.Common.g.cs | 139 ++++++++++++++++- .../Quantities/Volume.Common.g.cs | 139 ++++++++++++++++- .../Quantities/VolumeFlow.Common.g.cs | 139 ++++++++++++++++- .../Acceleration.WindowsRuntimeComponent.g.cs | 55 +++---- ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 55 +++---- ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 55 +++---- .../Angle.WindowsRuntimeComponent.g.cs | 55 +++---- ...pparentEnergy.WindowsRuntimeComponent.g.cs | 55 +++---- ...ApparentPower.WindowsRuntimeComponent.g.cs | 55 +++---- .../Area.WindowsRuntimeComponent.g.cs | 55 +++---- .../AreaDensity.WindowsRuntimeComponent.g.cs | 55 +++---- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 55 +++---- .../BitRate.WindowsRuntimeComponent.g.cs | 55 +++---- ...elConsumption.WindowsRuntimeComponent.g.cs | 55 +++---- .../Capacitance.WindowsRuntimeComponent.g.cs | 55 +++---- .../Density.WindowsRuntimeComponent.g.cs | 55 +++---- .../Duration.WindowsRuntimeComponent.g.cs | 55 +++---- ...amicViscosity.WindowsRuntimeComponent.g.cs | 55 +++---- ...ricAdmittance.WindowsRuntimeComponent.g.cs | 55 +++---- ...lectricCharge.WindowsRuntimeComponent.g.cs | 55 +++---- ...ChargeDensity.WindowsRuntimeComponent.g.cs | 55 +++---- ...icConductance.WindowsRuntimeComponent.g.cs | 55 +++---- ...cConductivity.WindowsRuntimeComponent.g.cs | 55 +++---- ...ectricCurrent.WindowsRuntimeComponent.g.cs | 55 +++---- ...urrentDensity.WindowsRuntimeComponent.g.cs | 55 +++---- ...rrentGradient.WindowsRuntimeComponent.g.cs | 55 +++---- ...ElectricField.WindowsRuntimeComponent.g.cs | 55 +++---- ...ricInductance.WindowsRuntimeComponent.g.cs | 55 +++---- ...tricPotential.WindowsRuntimeComponent.g.cs | 55 +++---- ...icPotentialAc.WindowsRuntimeComponent.g.cs | 55 +++---- ...icPotentialDc.WindowsRuntimeComponent.g.cs | 55 +++---- ...ricResistance.WindowsRuntimeComponent.g.cs | 55 +++---- ...icResistivity.WindowsRuntimeComponent.g.cs | 55 +++---- .../Energy.WindowsRuntimeComponent.g.cs | 55 +++---- .../Entropy.WindowsRuntimeComponent.g.cs | 55 +++---- .../Force.WindowsRuntimeComponent.g.cs | 55 +++---- ...rceChangeRate.WindowsRuntimeComponent.g.cs | 55 +++---- ...orcePerLength.WindowsRuntimeComponent.g.cs | 55 +++---- .../Frequency.WindowsRuntimeComponent.g.cs | 55 +++---- .../HeatFlux.WindowsRuntimeComponent.g.cs | 55 +++---- ...erCoefficient.WindowsRuntimeComponent.g.cs | 55 +++---- .../Illuminance.WindowsRuntimeComponent.g.cs | 55 +++---- .../Information.WindowsRuntimeComponent.g.cs | 55 +++---- .../Irradiance.WindowsRuntimeComponent.g.cs | 55 +++---- .../Irradiation.WindowsRuntimeComponent.g.cs | 55 +++---- ...aticViscosity.WindowsRuntimeComponent.g.cs | 55 +++---- .../LapseRate.WindowsRuntimeComponent.g.cs | 55 +++---- .../Length.WindowsRuntimeComponent.g.cs | 55 +++---- .../Level.WindowsRuntimeComponent.g.cs | 55 +++---- ...LinearDensity.WindowsRuntimeComponent.g.cs | 55 +++---- .../LuminousFlux.WindowsRuntimeComponent.g.cs | 55 +++---- ...nousIntensity.WindowsRuntimeComponent.g.cs | 55 +++---- ...MagneticField.WindowsRuntimeComponent.g.cs | 55 +++---- .../MagneticFlux.WindowsRuntimeComponent.g.cs | 55 +++---- ...Magnetization.WindowsRuntimeComponent.g.cs | 55 +++---- .../Mass.WindowsRuntimeComponent.g.cs | 55 +++---- .../MassFlow.WindowsRuntimeComponent.g.cs | 55 +++---- .../MassFlux.WindowsRuntimeComponent.g.cs | 55 +++---- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 55 +++---- .../MolarEnergy.WindowsRuntimeComponent.g.cs | 55 +++---- .../MolarEntropy.WindowsRuntimeComponent.g.cs | 55 +++---- .../MolarMass.WindowsRuntimeComponent.g.cs | 55 +++---- .../Molarity.WindowsRuntimeComponent.g.cs | 55 +++---- .../Permeability.WindowsRuntimeComponent.g.cs | 55 +++---- .../Permittivity.WindowsRuntimeComponent.g.cs | 55 +++---- .../Power.WindowsRuntimeComponent.g.cs | 55 +++---- .../PowerDensity.WindowsRuntimeComponent.g.cs | 55 +++---- .../PowerRatio.WindowsRuntimeComponent.g.cs | 55 +++---- .../Pressure.WindowsRuntimeComponent.g.cs | 55 +++---- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 55 +++---- .../Ratio.WindowsRuntimeComponent.g.cs | 55 +++---- ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 55 +++---- ...ReactivePower.WindowsRuntimeComponent.g.cs | 55 +++---- ...lAcceleration.WindowsRuntimeComponent.g.cs | 55 +++---- ...tationalSpeed.WindowsRuntimeComponent.g.cs | 55 +++---- ...onalStiffness.WindowsRuntimeComponent.g.cs | 55 +++---- ...nessPerLength.WindowsRuntimeComponent.g.cs | 55 +++---- .../SolidAngle.WindowsRuntimeComponent.g.cs | 55 +++---- ...pecificEnergy.WindowsRuntimeComponent.g.cs | 55 +++---- ...ecificEntropy.WindowsRuntimeComponent.g.cs | 55 +++---- ...pecificVolume.WindowsRuntimeComponent.g.cs | 55 +++---- ...pecificWeight.WindowsRuntimeComponent.g.cs | 55 +++---- .../Speed.WindowsRuntimeComponent.g.cs | 55 +++---- .../Temperature.WindowsRuntimeComponent.g.cs | 55 +++---- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 55 +++---- ...peratureDelta.WindowsRuntimeComponent.g.cs | 55 +++---- ...lConductivity.WindowsRuntimeComponent.g.cs | 55 +++---- ...malResistance.WindowsRuntimeComponent.g.cs | 55 +++---- .../Torque.WindowsRuntimeComponent.g.cs | 55 +++---- .../VitaminA.WindowsRuntimeComponent.g.cs | 55 +++---- .../Volume.WindowsRuntimeComponent.g.cs | 55 +++---- .../VolumeFlow.WindowsRuntimeComponent.g.cs | 55 +++---- UnitsNet/CustomCode/QuantityParser.cs | 91 +++++++++++- .../Quantities/Acceleration.NetFramework.g.cs | 56 ++----- .../AmountOfSubstance.NetFramework.g.cs | 56 ++----- .../AmplitudeRatio.NetFramework.g.cs | 56 ++----- .../Quantities/Angle.NetFramework.g.cs | 56 ++----- .../ApparentEnergy.NetFramework.g.cs | 56 ++----- .../ApparentPower.NetFramework.g.cs | 56 ++----- .../Quantities/Area.NetFramework.g.cs | 56 ++----- .../Quantities/AreaDensity.NetFramework.g.cs | 56 ++----- .../AreaMomentOfInertia.NetFramework.g.cs | 56 ++----- .../Quantities/BitRate.NetFramework.g.cs | 56 ++----- ...eSpecificFuelConsumption.NetFramework.g.cs | 56 ++----- .../Quantities/Capacitance.NetFramework.g.cs | 56 ++----- .../Quantities/Density.NetFramework.g.cs | 56 ++----- .../Quantities/Duration.NetFramework.g.cs | 56 ++----- .../DynamicViscosity.NetFramework.g.cs | 56 ++----- .../ElectricAdmittance.NetFramework.g.cs | 56 ++----- .../ElectricCharge.NetFramework.g.cs | 56 ++----- .../ElectricChargeDensity.NetFramework.g.cs | 56 ++----- .../ElectricConductance.NetFramework.g.cs | 56 ++----- .../ElectricConductivity.NetFramework.g.cs | 56 ++----- .../ElectricCurrent.NetFramework.g.cs | 56 ++----- .../ElectricCurrentDensity.NetFramework.g.cs | 56 ++----- .../ElectricCurrentGradient.NetFramework.g.cs | 56 ++----- .../ElectricField.NetFramework.g.cs | 56 ++----- .../ElectricInductance.NetFramework.g.cs | 56 ++----- .../ElectricPotential.NetFramework.g.cs | 56 ++----- .../ElectricPotentialAc.NetFramework.g.cs | 56 ++----- .../ElectricPotentialDc.NetFramework.g.cs | 56 ++----- .../ElectricResistance.NetFramework.g.cs | 56 ++----- .../ElectricResistivity.NetFramework.g.cs | 56 ++----- .../Quantities/Energy.NetFramework.g.cs | 56 ++----- .../Quantities/Entropy.NetFramework.g.cs | 56 ++----- .../Quantities/Force.NetFramework.g.cs | 56 ++----- .../ForceChangeRate.NetFramework.g.cs | 56 ++----- .../ForcePerLength.NetFramework.g.cs | 56 ++----- .../Quantities/Frequency.NetFramework.g.cs | 56 ++----- .../Quantities/HeatFlux.NetFramework.g.cs | 56 ++----- .../HeatTransferCoefficient.NetFramework.g.cs | 56 ++----- .../Quantities/Illuminance.NetFramework.g.cs | 56 ++----- .../Quantities/Information.NetFramework.g.cs | 56 ++----- .../Quantities/Irradiance.NetFramework.g.cs | 56 ++----- .../Quantities/Irradiation.NetFramework.g.cs | 56 ++----- .../KinematicViscosity.NetFramework.g.cs | 56 ++----- .../Quantities/LapseRate.NetFramework.g.cs | 56 ++----- .../Quantities/Length.NetFramework.g.cs | 56 ++----- .../Quantities/Level.NetFramework.g.cs | 56 ++----- .../LinearDensity.NetFramework.g.cs | 56 ++----- .../Quantities/LuminousFlux.NetFramework.g.cs | 56 ++----- .../LuminousIntensity.NetFramework.g.cs | 56 ++----- .../MagneticField.NetFramework.g.cs | 56 ++----- .../Quantities/MagneticFlux.NetFramework.g.cs | 56 ++----- .../Magnetization.NetFramework.g.cs | 56 ++----- .../Quantities/Mass.NetFramework.g.cs | 56 ++----- .../Quantities/MassFlow.NetFramework.g.cs | 56 ++----- .../Quantities/MassFlux.NetFramework.g.cs | 56 ++----- .../MassMomentOfInertia.NetFramework.g.cs | 56 ++----- .../Quantities/MolarEnergy.NetFramework.g.cs | 56 ++----- .../Quantities/MolarEntropy.NetFramework.g.cs | 56 ++----- .../Quantities/MolarMass.NetFramework.g.cs | 56 ++----- .../Quantities/Molarity.NetFramework.g.cs | 56 ++----- .../Quantities/Permeability.NetFramework.g.cs | 56 ++----- .../Quantities/Permittivity.NetFramework.g.cs | 56 ++----- .../Quantities/Power.NetFramework.g.cs | 56 ++----- .../Quantities/PowerDensity.NetFramework.g.cs | 56 ++----- .../Quantities/PowerRatio.NetFramework.g.cs | 56 ++----- .../Quantities/Pressure.NetFramework.g.cs | 56 ++----- .../PressureChangeRate.NetFramework.g.cs | 56 ++----- .../Quantities/Ratio.NetFramework.g.cs | 56 ++----- .../ReactiveEnergy.NetFramework.g.cs | 56 ++----- .../ReactivePower.NetFramework.g.cs | 56 ++----- .../RotationalAcceleration.NetFramework.g.cs | 56 ++----- .../RotationalSpeed.NetFramework.g.cs | 56 ++----- .../RotationalStiffness.NetFramework.g.cs | 56 ++----- ...tionalStiffnessPerLength.NetFramework.g.cs | 56 ++----- .../Quantities/SolidAngle.NetFramework.g.cs | 56 ++----- .../SpecificEnergy.NetFramework.g.cs | 56 ++----- .../SpecificEntropy.NetFramework.g.cs | 56 ++----- .../SpecificVolume.NetFramework.g.cs | 56 ++----- .../SpecificWeight.NetFramework.g.cs | 56 ++----- .../Quantities/Speed.NetFramework.g.cs | 56 ++----- .../Quantities/Temperature.NetFramework.g.cs | 56 ++----- .../TemperatureChangeRate.NetFramework.g.cs | 56 ++----- .../TemperatureDelta.NetFramework.g.cs | 56 ++----- .../ThermalConductivity.NetFramework.g.cs | 56 ++----- .../ThermalResistance.NetFramework.g.cs | 56 ++----- .../Quantities/Torque.NetFramework.g.cs | 56 ++----- .../Quantities/VitaminA.NetFramework.g.cs | 56 ++----- .../Quantities/Volume.NetFramework.g.cs | 56 ++----- .../Quantities/VolumeFlow.NetFramework.g.cs | 56 ++----- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 140 +++++++++++++++++- ...GenerateQuantitySourceCodeNetFramework.ps1 | 56 ++----- ...ntitySourceCodeWindowsRuntimeComponent.ps1 | 55 +++---- 271 files changed, 14938 insertions(+), 7654 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index a8e5593371..44dc8104cc 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -618,7 +618,7 @@ private double AsBaseNumericType(AccelerationUnit unit) /// public static Acceleration Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -631,7 +631,7 @@ public static Acceleration Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Acceleration result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -645,7 +645,140 @@ public static bool TryParse([CanBeNull] string str, out Acceleration result) /// Error parsing string. public static AccelerationUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out AccelerationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) + { + result = default(Acceleration); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Acceleration parsedAcceleration ) + { + parsedAcceleration = default(Acceleration); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedAcceleration = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static AccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == AccelerationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AccelerationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AccelerationUnit unit) + { + unit = AccelerationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == AccelerationUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index d1fe0633cf..bd5e39bcd5 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -640,7 +640,7 @@ private double AsBaseNumericType(AmountOfSubstanceUnit unit) /// public static AmountOfSubstance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -653,7 +653,7 @@ public static AmountOfSubstance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -667,7 +667,140 @@ public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result /// Error parsing string. public static AmountOfSubstanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out AmountOfSubstanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Moles + y.Moles, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) + { + result = default(AmountOfSubstance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out AmountOfSubstance parsedAmountOfSubstance ) + { + parsedAmountOfSubstance = default(AmountOfSubstance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedAmountOfSubstance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Moles + y.Moles, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == AmountOfSubstanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmountOfSubstanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmountOfSubstanceUnit unit) + { + unit = AmountOfSubstanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == AmountOfSubstanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 4048cfb0d5..5da1f9d3d7 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -419,7 +419,7 @@ private double AsBaseNumericType(AmplitudeRatioUnit unit) /// public static AmplitudeRatio Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -432,7 +432,7 @@ public static AmplitudeRatio Parse(string str) /// public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -446,7 +446,140 @@ public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) /// Error parsing string. public static AmplitudeRatioUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out AmplitudeRatioUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) + { + result = default(AmplitudeRatio); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out AmplitudeRatio parsedAmplitudeRatio ) + { + parsedAmplitudeRatio = default(AmplitudeRatio); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedAmplitudeRatio = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == AmplitudeRatioUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmplitudeRatioUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmplitudeRatioUnit unit) + { + unit = AmplitudeRatioUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == AmplitudeRatioUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 4c09a3ccea..6ac9137610 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -639,7 +639,7 @@ private double AsBaseNumericType(AngleUnit unit) /// public static Angle Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -652,7 +652,7 @@ public static Angle Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Angle result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -666,7 +666,140 @@ public static bool TryParse([CanBeNull] string str, out Angle result) /// Error parsing string. public static AngleUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out AngleUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Degrees + y.Degrees, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) + { + result = default(Angle); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Angle parsedAngle ) + { + parsedAngle = default(Angle); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedAngle = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Degrees + y.Degrees, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static AngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == AngleUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AngleUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AngleUnit unit) + { + unit = AngleUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == AngleUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index b981fce2f8..9ec6fc65e1 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(ApparentEnergyUnit unit) /// public static ApparentEnergy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static ApparentEnergy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) /// Error parsing string. public static ApparentEnergyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ApparentEnergyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) + { + result = default(ApparentEnergy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ApparentEnergy parsedApparentEnergy ) + { + parsedApparentEnergy = default(ApparentEnergy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedApparentEnergy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ApparentEnergyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentEnergyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentEnergyUnit unit) + { + unit = ApparentEnergyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ApparentEnergyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 64adcc030f..948e8e1d8d 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -420,7 +420,7 @@ private double AsBaseNumericType(ApparentPowerUnit unit) /// public static ApparentPower Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -433,7 +433,7 @@ public static ApparentPower Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ApparentPower result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -447,7 +447,140 @@ public static bool TryParse([CanBeNull] string str, out ApparentPower result) /// Error parsing string. public static ApparentPowerUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ApparentPowerUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) + { + result = default(ApparentPower); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ApparentPower parsedApparentPower ) + { + parsedApparentPower = default(ApparentPower); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedApparentPower = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ApparentPowerUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentPowerUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentPowerUnit unit) + { + unit = ApparentPowerUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ApparentPowerUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index bfe37ddb0f..94a4cf7e2b 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -618,7 +618,7 @@ private double AsBaseNumericType(AreaUnit unit) /// public static Area Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -631,7 +631,7 @@ public static Area Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Area result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -645,7 +645,140 @@ public static bool TryParse([CanBeNull] string str, out Area result) /// Error parsing string. public static AreaUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out AreaUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Area ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) + { + result = default(Area); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Area parsedArea ) + { + parsedArea = default(Area); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedArea = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == AreaUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaUnit unit) + { + unit = AreaUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == AreaUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 4805aa43fe..939ca16520 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(AreaDensityUnit unit) /// public static AreaDensity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static AreaDensity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out AreaDensity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out AreaDensity result) /// Error parsing string. public static AreaDensityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out AreaDensityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) + { + result = default(AreaDensity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out AreaDensity parsedAreaDensity ) + { + parsedAreaDensity = default(AreaDensity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedAreaDensity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == AreaDensityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaDensityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaDensityUnit unit) + { + unit = AreaDensityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == AreaDensityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 5cc7ada85c..81907ff61c 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -464,7 +464,7 @@ private double AsBaseNumericType(AreaMomentOfInertiaUnit unit) /// public static AreaMomentOfInertia Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -477,7 +477,7 @@ public static AreaMomentOfInertia Parse(string str) /// public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -491,7 +491,140 @@ public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia resu /// Error parsing string. public static AreaMomentOfInertiaUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out AreaMomentOfInertiaUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) + { + result = default(AreaMomentOfInertia); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out AreaMomentOfInertia parsedAreaMomentOfInertia ) + { + parsedAreaMomentOfInertia = default(AreaMomentOfInertia); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedAreaMomentOfInertia = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == AreaMomentOfInertiaUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaMomentOfInertiaUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaMomentOfInertiaUnit unit) + { + unit = AreaMomentOfInertiaUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == AreaMomentOfInertiaUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index 81ef3af1f2..9ea16d6800 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -903,7 +903,7 @@ private decimal AsBaseNumericType(BitRateUnit unit) /// public static BitRate Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -916,7 +916,7 @@ public static BitRate Parse(string str) /// public static bool TryParse([CanBeNull] string str, out BitRate result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -930,7 +930,140 @@ public static bool TryParse([CanBeNull] string str, out BitRate result) /// Error parsing string. public static BitRateUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out BitRateUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) + { + result = default(BitRate); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out BitRate parsedBitRate ) + { + parsedBitRate = default(BitRate); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedBitRate = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static BitRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == BitRateUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BitRateUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out BitRateUnit unit) + { + unit = BitRateUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == BitRateUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index 6a68250d36..a0968da781 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(BrakeSpecificFuelConsumptionUnit unit) /// public static BrakeSpecificFuelConsumption Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static BrakeSpecificFuelConsumption Parse(string str) /// public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsumption result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsump /// Error parsing string. public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out BrakeSpecificFuelConsumptionUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) + { + result = default(BrakeSpecificFuelConsumption); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out BrakeSpecificFuelConsumption parsedBrakeSpecificFuelConsumption ) + { + parsedBrakeSpecificFuelConsumption = default(BrakeSpecificFuelConsumption); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedBrakeSpecificFuelConsumption = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BrakeSpecificFuelConsumptionUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out BrakeSpecificFuelConsumptionUnit unit) + { + unit = BrakeSpecificFuelConsumptionUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index c3ca20dd2b..07e602b6c1 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(CapacitanceUnit unit) /// public static Capacitance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static Capacitance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Capacitance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out Capacitance result) /// Error parsing string. public static CapacitanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out CapacitanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Farads + y.Farads, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) + { + result = default(Capacitance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Capacitance parsedCapacitance ) + { + parsedCapacitance = default(Capacitance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedCapacitance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Farads + y.Farads, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == CapacitanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized CapacitanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out CapacitanceUnit unit) + { + unit = CapacitanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == CapacitanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 1dcd99a874..1518011407 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -1168,7 +1168,7 @@ private double AsBaseNumericType(DensityUnit unit) /// public static Density Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -1181,7 +1181,7 @@ public static Density Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Density result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -1195,7 +1195,140 @@ public static bool TryParse([CanBeNull] string str, out Density result) /// Error parsing string. public static DensityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out DensityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Density ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) + { + result = default(Density); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Density parsedDensity ) + { + parsedDensity = default(Density); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedDensity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static DensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == DensityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DensityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out DensityUnit unit) + { + unit = DensityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == DensityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 0a0f8a7223..5b689b53d3 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -552,7 +552,7 @@ private double AsBaseNumericType(DurationUnit unit) /// public static Duration Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -565,7 +565,7 @@ public static Duration Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Duration result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -579,7 +579,140 @@ public static bool TryParse([CanBeNull] string str, out Duration result) /// Error parsing string. public static DurationUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out DurationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Duration ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Seconds + y.Seconds, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) + { + result = default(Duration); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Duration parsedDuration ) + { + parsedDuration = default(Duration); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedDuration = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Seconds + y.Seconds, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static DurationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == DurationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DurationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out DurationUnit unit) + { + unit = DurationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == DurationUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 7526692cb4..5dd82ed68f 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -464,7 +464,7 @@ private double AsBaseNumericType(DynamicViscosityUnit unit) /// public static DynamicViscosity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -477,7 +477,7 @@ public static DynamicViscosity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -491,7 +491,140 @@ public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) /// Error parsing string. public static DynamicViscosityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out DynamicViscosityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) + { + result = default(DynamicViscosity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out DynamicViscosity parsedDynamicViscosity ) + { + parsedDynamicViscosity = default(DynamicViscosity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedDynamicViscosity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == DynamicViscosityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DynamicViscosityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out DynamicViscosityUnit unit) + { + unit = DynamicViscosityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == DynamicViscosityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index bd7b8dcf11..4be3969368 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -420,7 +420,7 @@ private double AsBaseNumericType(ElectricAdmittanceUnit unit) /// public static ElectricAdmittance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -433,7 +433,7 @@ public static ElectricAdmittance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricAdmittance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -447,7 +447,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricAdmittance resul /// Error parsing string. public static ElectricAdmittanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricAdmittanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) + { + result = default(ElectricAdmittance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricAdmittance parsedElectricAdmittance ) + { + parsedElectricAdmittance = default(ElectricAdmittance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricAdmittance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricAdmittanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricAdmittanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricAdmittanceUnit unit) + { + unit = ElectricAdmittanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricAdmittanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 7ef87f20ea..cca446beed 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(ElectricChargeUnit unit) /// public static ElectricCharge Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static ElectricCharge Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricCharge result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricCharge result) /// Error parsing string. public static ElectricChargeUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricChargeUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) + { + result = default(ElectricCharge); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCharge parsedElectricCharge ) + { + parsedElectricCharge = default(ElectricCharge); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricCharge = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricChargeUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeUnit unit) + { + unit = ElectricChargeUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricChargeUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index bfbdc89bec..e0a41c7261 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(ElectricChargeDensityUnit unit) /// public static ElectricChargeDensity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static ElectricChargeDensity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity re /// Error parsing string. public static ElectricChargeDensityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricChargeDensityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) + { + result = default(ElectricChargeDensity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricChargeDensity parsedElectricChargeDensity ) + { + parsedElectricChargeDensity = default(ElectricChargeDensity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricChargeDensity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricChargeDensityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeDensityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeDensityUnit unit) + { + unit = ElectricChargeDensityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricChargeDensityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index ce2c3adec5..9afad9ed94 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(ElectricConductanceUnit unit) /// public static ElectricConductance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static ElectricConductance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricConductance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricConductance resu /// Error parsing string. public static ElectricConductanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricConductanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricConductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) + { + result = default(ElectricConductance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricConductance parsedElectricConductance ) + { + parsedElectricConductance = default(ElectricConductance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricConductance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricConductanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductanceUnit unit) + { + unit = ElectricConductanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricConductanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 058190485c..1c9763be5e 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(ElectricConductivityUnit unit) /// public static ElectricConductivity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static ElectricConductivity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricConductivity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricConductivity res /// Error parsing string. public static ElectricConductivityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricConductivityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) + { + result = default(ElectricConductivity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricConductivity parsedElectricConductivity ) + { + parsedElectricConductivity = default(ElectricConductivity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricConductivity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricConductivityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductivityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductivityUnit unit) + { + unit = ElectricConductivityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricConductivityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 7426711345..54219f2138 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -508,7 +508,7 @@ private double AsBaseNumericType(ElectricCurrentUnit unit) /// public static ElectricCurrent Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -521,7 +521,7 @@ public static ElectricCurrent Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -535,7 +535,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) /// Error parsing string. public static ElectricCurrentUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricCurrentUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Amperes + y.Amperes, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) + { + result = default(ElectricCurrent); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCurrent parsedElectricCurrent ) + { + parsedElectricCurrent = default(ElectricCurrent); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricCurrent = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Amperes + y.Amperes, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricCurrentUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentUnit unit) + { + unit = ElectricCurrentUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricCurrentUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index dc541c4669..91b9fe8bf3 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(ElectricCurrentDensityUnit unit) /// public static ElectricCurrentDensity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static ElectricCurrentDensity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity r /// Error parsing string. public static ElectricCurrentDensityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricCurrentDensityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) + { + result = default(ElectricCurrentDensity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCurrentDensity parsedElectricCurrentDensity ) + { + parsedElectricCurrentDensity = default(ElectricCurrentDensity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricCurrentDensity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricCurrentDensityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentDensityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentDensityUnit unit) + { + unit = ElectricCurrentDensityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricCurrentDensityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 7ed7bacd30..9087f1d84e 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(ElectricCurrentGradientUnit unit) /// public static ElectricCurrentGradient Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static ElectricCurrentGradient Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient /// Error parsing string. public static ElectricCurrentGradientUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricCurrentGradientUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) + { + result = default(ElectricCurrentGradient); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCurrentGradient parsedElectricCurrentGradient ) + { + parsedElectricCurrentGradient = default(ElectricCurrentGradient); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricCurrentGradient = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricCurrentGradientUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentGradientUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentGradientUnit unit) + { + unit = ElectricCurrentGradientUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricCurrentGradientUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index eeb5b8a477..976ff9665b 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(ElectricFieldUnit unit) /// public static ElectricField Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static ElectricField Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricField result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricField result) /// Error parsing string. public static ElectricFieldUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricFieldUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) + { + result = default(ElectricField); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricField parsedElectricField ) + { + parsedElectricField = default(ElectricField); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricField = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricFieldUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricFieldUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricFieldUnit unit) + { + unit = ElectricFieldUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricFieldUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 09d9b21491..a777c367bb 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(ElectricInductanceUnit unit) /// public static ElectricInductance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static ElectricInductance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricInductance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricInductance resul /// Error parsing string. public static ElectricInductanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricInductanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Henries + y.Henries, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) + { + result = default(ElectricInductance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricInductance parsedElectricInductance ) + { + parsedElectricInductance = default(ElectricInductance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricInductance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Henries + y.Henries, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricInductanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricInductanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricInductanceUnit unit) + { + unit = ElectricInductanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricInductanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 3154a2aa61..3068a1e051 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -442,7 +442,7 @@ private double AsBaseNumericType(ElectricPotentialUnit unit) /// public static ElectricPotential Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -455,7 +455,7 @@ public static ElectricPotential Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricPotential result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -469,7 +469,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricPotential result /// Error parsing string. public static ElectricPotentialUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricPotentialUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Volts + y.Volts, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) + { + result = default(ElectricPotential); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricPotential parsedElectricPotential ) + { + parsedElectricPotential = default(ElectricPotential); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricPotential = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Volts + y.Volts, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricPotentialUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialUnit unit) + { + unit = ElectricPotentialUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricPotentialUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index ac85ea5c43..2240bddba4 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -441,7 +441,7 @@ private double AsBaseNumericType(ElectricPotentialAcUnit unit) /// public static ElectricPotentialAc Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -454,7 +454,7 @@ public static ElectricPotentialAc Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -468,7 +468,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc resu /// Error parsing string. public static ElectricPotentialAcUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricPotentialAcUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) + { + result = default(ElectricPotentialAc); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricPotentialAc parsedElectricPotentialAc ) + { + parsedElectricPotentialAc = default(ElectricPotentialAc); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricPotentialAc = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricPotentialAcUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialAcUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialAcUnit unit) + { + unit = ElectricPotentialAcUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricPotentialAcUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 054cf090b3..623378c8ba 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -441,7 +441,7 @@ private double AsBaseNumericType(ElectricPotentialDcUnit unit) /// public static ElectricPotentialDc Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -454,7 +454,7 @@ public static ElectricPotentialDc Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -468,7 +468,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc resu /// Error parsing string. public static ElectricPotentialDcUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricPotentialDcUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) + { + result = default(ElectricPotentialDc); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricPotentialDc parsedElectricPotentialDc ) + { + parsedElectricPotentialDc = default(ElectricPotentialDc); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricPotentialDc = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricPotentialDcUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialDcUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialDcUnit unit) + { + unit = ElectricPotentialDcUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricPotentialDcUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 97800ecf71..0659067ba1 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -420,7 +420,7 @@ private double AsBaseNumericType(ElectricResistanceUnit unit) /// public static ElectricResistance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -433,7 +433,7 @@ public static ElectricResistance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricResistance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -447,7 +447,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricResistance resul /// Error parsing string. public static ElectricResistanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricResistanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Ohms + y.Ohms, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) + { + result = default(ElectricResistance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricResistance parsedElectricResistance ) + { + parsedElectricResistance = default(ElectricResistance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricResistance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Ohms + y.Ohms, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricResistanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistanceUnit unit) + { + unit = ElectricResistanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricResistanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 943897b0d9..0fda40944f 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -420,7 +420,7 @@ private double AsBaseNumericType(ElectricResistivityUnit unit) /// public static ElectricResistivity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -433,7 +433,7 @@ public static ElectricResistivity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ElectricResistivity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -447,7 +447,140 @@ public static bool TryParse([CanBeNull] string str, out ElectricResistivity resu /// Error parsing string. public static ElectricResistivityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ElectricResistivityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) + { + result = default(ElectricResistivity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricResistivity parsedElectricResistivity ) + { + parsedElectricResistivity = default(ElectricResistivity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedElectricResistivity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ElectricResistivityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistivityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistivityUnit unit) + { + unit = ElectricResistivityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ElectricResistivityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index cf89bec60b..f1f840a76c 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -816,7 +816,7 @@ private double AsBaseNumericType(EnergyUnit unit) /// public static Energy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -829,7 +829,7 @@ public static Energy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Energy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -843,7 +843,140 @@ public static bool TryParse([CanBeNull] string str, out Energy result) /// Error parsing string. public static EnergyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out EnergyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Energy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Joules + y.Joules, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) + { + result = default(Energy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Energy parsedEnergy ) + { + parsedEnergy = default(Energy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedEnergy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Joules + y.Joules, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == EnergyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EnergyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out EnergyUnit unit) + { + unit = EnergyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == EnergyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index 9ab2a50a45..e216af68f9 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -486,7 +486,7 @@ private double AsBaseNumericType(EntropyUnit unit) /// public static Entropy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -499,7 +499,7 @@ public static Entropy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Entropy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -513,7 +513,140 @@ public static bool TryParse([CanBeNull] string str, out Entropy result) /// Error parsing string. public static EntropyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out EntropyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) + { + result = default(Entropy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Entropy parsedEntropy ) + { + parsedEntropy = default(Entropy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedEntropy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static EntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == EntropyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EntropyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out EntropyUnit unit) + { + unit = EntropyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == EntropyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 542712a8ad..5f939f5860 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -552,7 +552,7 @@ private double AsBaseNumericType(ForceUnit unit) /// public static Force Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -565,7 +565,7 @@ public static Force Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Force result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -579,7 +579,140 @@ public static bool TryParse([CanBeNull] string str, out Force result) /// Error parsing string. public static ForceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ForceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Force ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Newtons + y.Newtons, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) + { + result = default(Force); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Force parsedForce ) + { + parsedForce = default(Force); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedForce = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Newtons + y.Newtons, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ForceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ForceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceUnit unit) + { + unit = ForceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ForceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 1787168a08..3ff3ad25c4 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -574,7 +574,7 @@ private double AsBaseNumericType(ForceChangeRateUnit unit) /// public static ForceChangeRate Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -587,7 +587,7 @@ public static ForceChangeRate Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -601,7 +601,140 @@ public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) /// Error parsing string. public static ForceChangeRateUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ForceChangeRateUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) + { + result = default(ForceChangeRate); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ForceChangeRate parsedForceChangeRate ) + { + parsedForceChangeRate = default(ForceChangeRate); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedForceChangeRate = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ForceChangeRateUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceChangeRateUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceChangeRateUnit unit) + { + unit = ForceChangeRateUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ForceChangeRateUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index 4db68929fb..3f7b1f1523 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -530,7 +530,7 @@ private double AsBaseNumericType(ForcePerLengthUnit unit) /// public static ForcePerLength Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -543,7 +543,7 @@ public static ForcePerLength Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ForcePerLength result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -557,7 +557,140 @@ public static bool TryParse([CanBeNull] string str, out ForcePerLength result) /// Error parsing string. public static ForcePerLengthUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ForcePerLengthUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) + { + result = default(ForcePerLength); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ForcePerLength parsedForcePerLength ) + { + parsedForcePerLength = default(ForcePerLength); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedForcePerLength = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ForcePerLengthUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForcePerLengthUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForcePerLengthUnit unit) + { + unit = ForcePerLengthUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ForcePerLengthUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 58c7df8fe3..86c6cfa121 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -508,7 +508,7 @@ private double AsBaseNumericType(FrequencyUnit unit) /// public static Frequency Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -521,7 +521,7 @@ public static Frequency Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Frequency result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -535,7 +535,140 @@ public static bool TryParse([CanBeNull] string str, out Frequency result) /// Error parsing string. public static FrequencyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out FrequencyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Hertz + y.Hertz, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) + { + result = default(Frequency); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Frequency parsedFrequency ) + { + parsedFrequency = default(Frequency); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedFrequency = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Hertz + y.Hertz, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == FrequencyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized FrequencyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out FrequencyUnit unit) + { + unit = FrequencyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == FrequencyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 14db30b59c..428b14478b 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -684,7 +684,7 @@ private double AsBaseNumericType(HeatFluxUnit unit) /// public static HeatFlux Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -697,7 +697,7 @@ public static HeatFlux Parse(string str) /// public static bool TryParse([CanBeNull] string str, out HeatFlux result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -711,7 +711,140 @@ public static bool TryParse([CanBeNull] string str, out HeatFlux result) /// Error parsing string. public static HeatFluxUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out HeatFluxUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) + { + result = default(HeatFlux); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out HeatFlux parsedHeatFlux ) + { + parsedHeatFlux = default(HeatFlux); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedHeatFlux = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == HeatFluxUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatFluxUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatFluxUnit unit) + { + unit = HeatFluxUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == HeatFluxUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index e86ec8d9ed..26f1fc97ac 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -376,7 +376,7 @@ private double AsBaseNumericType(HeatTransferCoefficientUnit unit) /// public static HeatTransferCoefficient Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -389,7 +389,7 @@ public static HeatTransferCoefficient Parse(string str) /// public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -403,7 +403,140 @@ public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient /// Error parsing string. public static HeatTransferCoefficientUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out HeatTransferCoefficientUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) + { + result = default(HeatTransferCoefficient); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out HeatTransferCoefficient parsedHeatTransferCoefficient ) + { + parsedHeatTransferCoefficient = default(HeatTransferCoefficient); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedHeatTransferCoefficient = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == HeatTransferCoefficientUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatTransferCoefficientUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatTransferCoefficientUnit unit) + { + unit = HeatTransferCoefficientUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == HeatTransferCoefficientUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index dd6cc24532..20cd40b396 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -420,7 +420,7 @@ private double AsBaseNumericType(IlluminanceUnit unit) /// public static Illuminance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -433,7 +433,7 @@ public static Illuminance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Illuminance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -447,7 +447,140 @@ public static bool TryParse([CanBeNull] string str, out Illuminance result) /// Error parsing string. public static IlluminanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out IlluminanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Lux + y.Lux, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) + { + result = default(Illuminance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Illuminance parsedIlluminance ) + { + parsedIlluminance = default(Illuminance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedIlluminance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Lux + y.Lux, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == IlluminanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IlluminanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out IlluminanceUnit unit) + { + unit = IlluminanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == IlluminanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 5905735552..7c09535991 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -903,7 +903,7 @@ private decimal AsBaseNumericType(InformationUnit unit) /// public static Information Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -916,7 +916,7 @@ public static Information Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Information result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -930,7 +930,140 @@ public static bool TryParse([CanBeNull] string str, out Information result) /// Error parsing string. public static InformationUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out InformationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Bits + y.Bits, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) + { + result = default(Information); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Information parsedInformation ) + { + parsedInformation = default(Information); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedInformation = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Bits + y.Bits, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == InformationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) + { + unit = InformationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == InformationUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 49ac93a5e3..df55015452 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -376,7 +376,7 @@ private double AsBaseNumericType(IrradianceUnit unit) /// public static Irradiance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -389,7 +389,7 @@ public static Irradiance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Irradiance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -403,7 +403,140 @@ public static bool TryParse([CanBeNull] string str, out Irradiance result) /// Error parsing string. public static IrradianceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out IrradianceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) + { + result = default(Irradiance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Irradiance parsedIrradiance ) + { + parsedIrradiance = default(Irradiance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedIrradiance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static IrradianceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == IrradianceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradianceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradianceUnit unit) + { + unit = IrradianceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == IrradianceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 7c8d78acba..90b7346376 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(IrradiationUnit unit) /// public static Irradiation Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static Irradiation Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Irradiation result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out Irradiation result) /// Error parsing string. public static IrradiationUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out IrradiationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) + { + result = default(Irradiation); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Irradiation parsedIrradiation ) + { + parsedIrradiation = default(Irradiation); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedIrradiation = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static IrradiationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == IrradiationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradiationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradiationUnit unit) + { + unit = IrradiationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == IrradiationUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 625e8d8937..066cb6d6c5 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -508,7 +508,7 @@ private double AsBaseNumericType(KinematicViscosityUnit unit) /// public static KinematicViscosity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -521,7 +521,7 @@ public static KinematicViscosity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out KinematicViscosity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -535,7 +535,140 @@ public static bool TryParse([CanBeNull] string str, out KinematicViscosity resul /// Error parsing string. public static KinematicViscosityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out KinematicViscosityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) + { + result = default(KinematicViscosity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out KinematicViscosity parsedKinematicViscosity ) + { + parsedKinematicViscosity = default(KinematicViscosity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedKinematicViscosity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == KinematicViscosityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized KinematicViscosityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out KinematicViscosityUnit unit) + { + unit = KinematicViscosityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == KinematicViscosityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 50c2ea8b12..0843f8e0d8 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(LapseRateUnit unit) /// public static LapseRate Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static LapseRate Parse(string str) /// public static bool TryParse([CanBeNull] string str, out LapseRate result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out LapseRate result) /// Error parsing string. public static LapseRateUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out LapseRateUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) + { + result = default(LapseRate); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out LapseRate parsedLapseRate ) + { + parsedLapseRate = default(LapseRate); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedLapseRate = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == LapseRateUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LapseRateUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LapseRateUnit unit) + { + unit = LapseRateUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == LapseRateUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index 4982b78f36..eeb97d31e2 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -816,7 +816,7 @@ private double AsBaseNumericType(LengthUnit unit) /// public static Length Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -829,7 +829,7 @@ public static Length Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Length result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -843,7 +843,140 @@ public static bool TryParse([CanBeNull] string str, out Length result) /// Error parsing string. public static LengthUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out LengthUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Meters + y.Meters, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) + { + result = default(Length); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Length parsedLength ) + { + parsedLength = default(Length); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedLength = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Meters + y.Meters, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == LengthUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) + { + unit = LengthUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == LengthUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index b4640f5b36..53db49c76f 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -375,7 +375,7 @@ private double AsBaseNumericType(LevelUnit unit) /// public static Level Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -388,7 +388,7 @@ public static Level Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Level result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -402,7 +402,140 @@ public static bool TryParse([CanBeNull] string str, out Level result) /// Error parsing string. public static LevelUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out LevelUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Decibels + y.Decibels, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) + { + result = default(Level); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Level parsedLevel ) + { + parsedLevel = default(Level); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedLevel = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Decibels + y.Decibels, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == LevelUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) + { + unit = LevelUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == LevelUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index f1be384a2c..58f0144fdf 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(LinearDensityUnit unit) /// public static LinearDensity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static LinearDensity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out LinearDensity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out LinearDensity result) /// Error parsing string. public static LinearDensityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out LinearDensityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) + { + result = default(LinearDensity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out LinearDensity parsedLinearDensity ) + { + parsedLinearDensity = default(LinearDensity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedLinearDensity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == LinearDensityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LinearDensityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LinearDensityUnit unit) + { + unit = LinearDensityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == LinearDensityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index 765ecf5c1b..9745b504fd 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(LuminousFluxUnit unit) /// public static LuminousFlux Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static LuminousFlux Parse(string str) /// public static bool TryParse([CanBeNull] string str, out LuminousFlux result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out LuminousFlux result) /// Error parsing string. public static LuminousFluxUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out LuminousFluxUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Lumens + y.Lumens, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) + { + result = default(LuminousFlux); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out LuminousFlux parsedLuminousFlux ) + { + parsedLuminousFlux = default(LuminousFlux); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedLuminousFlux = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Lumens + y.Lumens, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == LuminousFluxUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousFluxUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousFluxUnit unit) + { + unit = LuminousFluxUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == LuminousFluxUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index af5593c6ee..782ec54fdf 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(LuminousIntensityUnit unit) /// public static LuminousIntensity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static LuminousIntensity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out LuminousIntensity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out LuminousIntensity result /// Error parsing string. public static LuminousIntensityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out LuminousIntensityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Candela + y.Candela, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) + { + result = default(LuminousIntensity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out LuminousIntensity parsedLuminousIntensity ) + { + parsedLuminousIntensity = default(LuminousIntensity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedLuminousIntensity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Candela + y.Candela, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == LuminousIntensityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousIntensityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousIntensityUnit unit) + { + unit = LuminousIntensityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == LuminousIntensityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 259d3481cd..7607a1933e 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(MagneticFieldUnit unit) /// public static MagneticField Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static MagneticField Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MagneticField result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out MagneticField result) /// Error parsing string. public static MagneticFieldUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MagneticFieldUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Teslas + y.Teslas, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) + { + result = default(MagneticField); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MagneticField parsedMagneticField ) + { + parsedMagneticField = default(MagneticField); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMagneticField = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Teslas + y.Teslas, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MagneticFieldUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFieldUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFieldUnit unit) + { + unit = MagneticFieldUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MagneticFieldUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index af6a381b1b..846167753e 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(MagneticFluxUnit unit) /// public static MagneticFlux Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static MagneticFlux Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MagneticFlux result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out MagneticFlux result) /// Error parsing string. public static MagneticFluxUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MagneticFluxUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Webers + y.Webers, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) + { + result = default(MagneticFlux); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MagneticFlux parsedMagneticFlux ) + { + parsedMagneticFlux = default(MagneticFlux); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMagneticFlux = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Webers + y.Webers, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MagneticFluxUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFluxUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFluxUnit unit) + { + unit = MagneticFluxUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MagneticFluxUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 546065e358..a28f1051d3 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(MagnetizationUnit unit) /// public static Magnetization Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static Magnetization Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Magnetization result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out Magnetization result) /// Error parsing string. public static MagnetizationUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MagnetizationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) + { + result = default(Magnetization); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Magnetization parsedMagnetization ) + { + parsedMagnetization = default(Magnetization); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMagnetization = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MagnetizationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagnetizationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagnetizationUnit unit) + { + unit = MagnetizationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MagnetizationUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index de9eee1663..7daec50642 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -794,7 +794,7 @@ private double AsBaseNumericType(MassUnit unit) /// public static Mass Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -807,7 +807,7 @@ public static Mass Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Mass result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -821,7 +821,140 @@ public static bool TryParse([CanBeNull] string str, out Mass result) /// Error parsing string. public static MassUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MassUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) + { + result = default(Mass); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Mass parsedMass ) + { + parsedMass = default(Mass); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMass = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MassUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MassUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassUnit unit) + { + unit = MassUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MassUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index 118ac8d6c9..fb559f851f 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -662,7 +662,7 @@ private double AsBaseNumericType(MassFlowUnit unit) /// public static MassFlow Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -675,7 +675,7 @@ public static MassFlow Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MassFlow result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -689,7 +689,140 @@ public static bool TryParse([CanBeNull] string str, out MassFlow result) /// Error parsing string. public static MassFlowUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MassFlowUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) + { + result = default(MassFlow); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MassFlow parsedMassFlow ) + { + parsedMassFlow = default(MassFlow); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMassFlow = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MassFlowUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFlowUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFlowUnit unit) + { + unit = MassFlowUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MassFlowUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index af499ab871..0eda7452d3 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -376,7 +376,7 @@ private double AsBaseNumericType(MassFluxUnit unit) /// public static MassFlux Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -389,7 +389,7 @@ public static MassFlux Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MassFlux result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -403,7 +403,140 @@ public static bool TryParse([CanBeNull] string str, out MassFlux result) /// Error parsing string. public static MassFluxUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MassFluxUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) + { + result = default(MassFlux); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MassFlux parsedMassFlux ) + { + parsedMassFlux = default(MassFlux); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMassFlux = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MassFluxUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFluxUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFluxUnit unit) + { + unit = MassFluxUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MassFluxUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index b8811b4670..9eb4da362a 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -904,7 +904,7 @@ private double AsBaseNumericType(MassMomentOfInertiaUnit unit) /// public static MassMomentOfInertia Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -917,7 +917,7 @@ public static MassMomentOfInertia Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -931,7 +931,140 @@ public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia resu /// Error parsing string. public static MassMomentOfInertiaUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MassMomentOfInertiaUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) + { + result = default(MassMomentOfInertia); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MassMomentOfInertia parsedMassMomentOfInertia ) + { + parsedMassMomentOfInertia = default(MassMomentOfInertia); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMassMomentOfInertia = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MassMomentOfInertiaUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassMomentOfInertiaUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassMomentOfInertiaUnit unit) + { + unit = MassMomentOfInertiaUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MassMomentOfInertiaUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 5a9f136423..76edcbb3d2 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(MolarEnergyUnit unit) /// public static MolarEnergy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static MolarEnergy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MolarEnergy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out MolarEnergy result) /// Error parsing string. public static MolarEnergyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MolarEnergyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) + { + result = default(MolarEnergy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MolarEnergy parsedMolarEnergy ) + { + parsedMolarEnergy = default(MolarEnergy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMolarEnergy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MolarEnergyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEnergyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEnergyUnit unit) + { + unit = MolarEnergyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MolarEnergyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index 7a35c6dd34..8a09d28c7f 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(MolarEntropyUnit unit) /// public static MolarEntropy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static MolarEntropy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MolarEntropy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out MolarEntropy result) /// Error parsing string. public static MolarEntropyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MolarEntropyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) + { + result = default(MolarEntropy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MolarEntropy parsedMolarEntropy ) + { + parsedMolarEntropy = default(MolarEntropy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMolarEntropy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MolarEntropyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEntropyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEntropyUnit unit) + { + unit = MolarEntropyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MolarEntropyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 1a9a547d86..5bfeb81d45 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -596,7 +596,7 @@ private double AsBaseNumericType(MolarMassUnit unit) /// public static MolarMass Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -609,7 +609,7 @@ public static MolarMass Parse(string str) /// public static bool TryParse([CanBeNull] string str, out MolarMass result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -623,7 +623,140 @@ public static bool TryParse([CanBeNull] string str, out MolarMass result) /// Error parsing string. public static MolarMassUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MolarMassUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) + { + result = default(MolarMass); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out MolarMass parsedMolarMass ) + { + parsedMolarMass = default(MolarMass); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMolarMass = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MolarMassUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarMassUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarMassUnit unit) + { + unit = MolarMassUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MolarMassUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index d876910eae..94ff4ae771 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -508,7 +508,7 @@ private double AsBaseNumericType(MolarityUnit unit) /// public static Molarity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -521,7 +521,7 @@ public static Molarity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Molarity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -535,7 +535,140 @@ public static bool TryParse([CanBeNull] string str, out Molarity result) /// Error parsing string. public static MolarityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out MolarityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) + { + result = default(Molarity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Molarity parsedMolarity ) + { + parsedMolarity = default(Molarity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedMolarity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static MolarityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == MolarityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarityUnit unit) + { + unit = MolarityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == MolarityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index bac1639711..46ed68e53d 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(PermeabilityUnit unit) /// public static Permeability Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static Permeability Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Permeability result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out Permeability result) /// Error parsing string. public static PermeabilityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out PermeabilityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Permeability ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) + { + result = default(Permeability); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Permeability parsedPermeability ) + { + parsedPermeability = default(Permeability); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedPermeability = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == PermeabilityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermeabilityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermeabilityUnit unit) + { + unit = PermeabilityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == PermeabilityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 21ec46f21f..5100aa00f6 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -354,7 +354,7 @@ private double AsBaseNumericType(PermittivityUnit unit) /// public static Permittivity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -367,7 +367,7 @@ public static Permittivity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Permittivity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -381,7 +381,140 @@ public static bool TryParse([CanBeNull] string str, out Permittivity result) /// Error parsing string. public static PermittivityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out PermittivityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) + { + result = default(Permittivity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Permittivity parsedPermittivity ) + { + parsedPermittivity = default(Permittivity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedPermittivity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static PermittivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == PermittivityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermittivityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermittivityUnit unit) + { + unit = PermittivityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == PermittivityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index c68df87cc6..94dede4a38 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -772,7 +772,7 @@ private decimal AsBaseNumericType(PowerUnit unit) /// public static Power Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -785,7 +785,7 @@ public static Power Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Power result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -799,7 +799,140 @@ public static bool TryParse([CanBeNull] string str, out Power result) /// Error parsing string. public static PowerUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out PowerUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Power ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Watts + y.Watts, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) + { + result = default(Power); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Power parsedPower ) + { + parsedPower = default(Power); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedPower = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Watts + y.Watts, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static PowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == PowerUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerUnit unit) + { + unit = PowerUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == PowerUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index acc9d1ef2b..ea99def73b 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -1300,7 +1300,7 @@ private double AsBaseNumericType(PowerDensityUnit unit) /// public static PowerDensity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -1313,7 +1313,7 @@ public static PowerDensity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out PowerDensity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -1327,7 +1327,140 @@ public static bool TryParse([CanBeNull] string str, out PowerDensity result) /// Error parsing string. public static PowerDensityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out PowerDensityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) + { + result = default(PowerDensity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out PowerDensity parsedPowerDensity ) + { + parsedPowerDensity = default(PowerDensity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedPowerDensity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == PowerDensityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerDensityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerDensityUnit unit) + { + unit = PowerDensityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == PowerDensityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 95a3cbbe3c..2b9975902b 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -375,7 +375,7 @@ private double AsBaseNumericType(PowerRatioUnit unit) /// public static PowerRatio Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -388,7 +388,7 @@ public static PowerRatio Parse(string str) /// public static bool TryParse([CanBeNull] string str, out PowerRatio result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -402,7 +402,140 @@ public static bool TryParse([CanBeNull] string str, out PowerRatio result) /// Error parsing string. public static PowerRatioUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out PowerRatioUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) + { + result = default(PowerRatio); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out PowerRatio parsedPowerRatio ) + { + parsedPowerRatio = default(PowerRatio); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedPowerRatio = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == PowerRatioUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerRatioUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerRatioUnit unit) + { + unit = PowerRatioUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == PowerRatioUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 7c7051c2da..657bff9fb9 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -1146,7 +1146,7 @@ private double AsBaseNumericType(PressureUnit unit) /// public static Pressure Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -1159,7 +1159,7 @@ public static Pressure Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Pressure result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -1173,7 +1173,140 @@ public static bool TryParse([CanBeNull] string str, out Pressure result) /// Error parsing string. public static PressureUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out PressureUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Pascals + y.Pascals, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) + { + result = default(Pressure); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Pressure parsedPressure ) + { + parsedPressure = default(Pressure); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedPressure = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Pascals + y.Pascals, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static PressureUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == PressureUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureUnit unit) + { + unit = PressureUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == PressureUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 5624876bbf..d83bba6e44 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -420,7 +420,7 @@ private double AsBaseNumericType(PressureChangeRateUnit unit) /// public static PressureChangeRate Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -433,7 +433,7 @@ public static PressureChangeRate Parse(string str) /// public static bool TryParse([CanBeNull] string str, out PressureChangeRate result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -447,7 +447,140 @@ public static bool TryParse([CanBeNull] string str, out PressureChangeRate resul /// Error parsing string. public static PressureChangeRateUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out PressureChangeRateUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) + { + result = default(PressureChangeRate); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out PressureChangeRate parsedPressureChangeRate ) + { + parsedPressureChangeRate = default(PressureChangeRate); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedPressureChangeRate = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == PressureChangeRateUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureChangeRateUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureChangeRateUnit unit) + { + unit = PressureChangeRateUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == PressureChangeRateUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 07aca3ebd8..06773052d1 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -463,7 +463,7 @@ private double AsBaseNumericType(RatioUnit unit) /// public static Ratio Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -476,7 +476,7 @@ public static Ratio Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Ratio result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -490,7 +490,140 @@ public static bool TryParse([CanBeNull] string str, out Ratio result) /// Error parsing string. public static RatioUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out RatioUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) + { + result = default(Ratio); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Ratio parsedRatio ) + { + parsedRatio = default(Ratio); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedRatio = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static RatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == RatioUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RatioUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RatioUnit unit) + { + unit = RatioUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == RatioUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index bcfbc66da1..bb8b829a39 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(ReactiveEnergyUnit unit) /// public static ReactiveEnergy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static ReactiveEnergy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) /// Error parsing string. public static ReactiveEnergyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ReactiveEnergyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) + { + result = default(ReactiveEnergy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ReactiveEnergy parsedReactiveEnergy ) + { + parsedReactiveEnergy = default(ReactiveEnergy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedReactiveEnergy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ReactiveEnergyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactiveEnergyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactiveEnergyUnit unit) + { + unit = ReactiveEnergyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ReactiveEnergyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index 0af904f487..69faf15a50 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -420,7 +420,7 @@ private double AsBaseNumericType(ReactivePowerUnit unit) /// public static ReactivePower Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -433,7 +433,7 @@ public static ReactivePower Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ReactivePower result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -447,7 +447,140 @@ public static bool TryParse([CanBeNull] string str, out ReactivePower result) /// Error parsing string. public static ReactivePowerUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ReactivePowerUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) + { + result = default(ReactivePower); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ReactivePower parsedReactivePower ) + { + parsedReactivePower = default(ReactivePower); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedReactivePower = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ReactivePowerUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactivePowerUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactivePowerUnit unit) + { + unit = ReactivePowerUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ReactivePowerUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 8f19c5888d..11219a3681 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(RotationalAccelerationUnit unit) /// public static RotationalAcceleration Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static RotationalAcceleration Parse(string str) /// public static bool TryParse([CanBeNull] string str, out RotationalAcceleration result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out RotationalAcceleration r /// Error parsing string. public static RotationalAccelerationUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out RotationalAccelerationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) + { + result = default(RotationalAcceleration); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalAcceleration parsedRotationalAcceleration ) + { + parsedRotationalAcceleration = default(RotationalAcceleration); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedRotationalAcceleration = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == RotationalAccelerationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalAccelerationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalAccelerationUnit unit) + { + unit = RotationalAccelerationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == RotationalAccelerationUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 6d68dc12bc..7648661d40 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -618,7 +618,7 @@ private double AsBaseNumericType(RotationalSpeedUnit unit) /// public static RotationalSpeed Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -631,7 +631,7 @@ public static RotationalSpeed Parse(string str) /// public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -645,7 +645,140 @@ public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) /// Error parsing string. public static RotationalSpeedUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out RotationalSpeedUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) + { + result = default(RotationalSpeed); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalSpeed parsedRotationalSpeed ) + { + parsedRotationalSpeed = default(RotationalSpeed); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedRotationalSpeed = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == RotationalSpeedUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalSpeedUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalSpeedUnit unit) + { + unit = RotationalSpeedUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == RotationalSpeedUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index e45e2e8ed7..242dfa7c16 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(RotationalStiffnessUnit unit) /// public static RotationalStiffness Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static RotationalStiffness Parse(string str) /// public static bool TryParse([CanBeNull] string str, out RotationalStiffness result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out RotationalStiffness resu /// Error parsing string. public static RotationalStiffnessUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out RotationalStiffnessUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) + { + result = default(RotationalStiffness); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalStiffness parsedRotationalStiffness ) + { + parsedRotationalStiffness = default(RotationalStiffness); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedRotationalStiffness = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == RotationalStiffnessUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessUnit unit) + { + unit = RotationalStiffnessUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == RotationalStiffnessUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index b136447df9..e5da2f3769 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -398,7 +398,7 @@ private double AsBaseNumericType(RotationalStiffnessPerLengthUnit unit) /// public static RotationalStiffnessPerLength Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -411,7 +411,7 @@ public static RotationalStiffnessPerLength Parse(string str) /// public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLength result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -425,7 +425,140 @@ public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLe /// Error parsing string. public static RotationalStiffnessPerLengthUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out RotationalStiffnessPerLengthUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) + { + result = default(RotationalStiffnessPerLength); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalStiffnessPerLength parsedRotationalStiffnessPerLength ) + { + parsedRotationalStiffnessPerLength = default(RotationalStiffnessPerLength); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedRotationalStiffnessPerLength = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == RotationalStiffnessPerLengthUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessPerLengthUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessPerLengthUnit unit) + { + unit = RotationalStiffnessPerLengthUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == RotationalStiffnessPerLengthUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 216f1004ed..9d05fc10f5 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -353,7 +353,7 @@ private double AsBaseNumericType(SolidAngleUnit unit) /// public static SolidAngle Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -366,7 +366,7 @@ public static SolidAngle Parse(string str) /// public static bool TryParse([CanBeNull] string str, out SolidAngle result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -380,7 +380,140 @@ public static bool TryParse([CanBeNull] string str, out SolidAngle result) /// Error parsing string. public static SolidAngleUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out SolidAngleUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Steradians + y.Steradians, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) + { + result = default(SolidAngle); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out SolidAngle parsedSolidAngle ) + { + parsedSolidAngle = default(SolidAngle); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedSolidAngle = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Steradians + y.Steradians, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == SolidAngleUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SolidAngleUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SolidAngleUnit unit) + { + unit = SolidAngleUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == SolidAngleUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index 4c17911621..95fbc1820b 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -508,7 +508,7 @@ private double AsBaseNumericType(SpecificEnergyUnit unit) /// public static SpecificEnergy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -521,7 +521,7 @@ public static SpecificEnergy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -535,7 +535,140 @@ public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) /// Error parsing string. public static SpecificEnergyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out SpecificEnergyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) + { + result = default(SpecificEnergy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificEnergy parsedSpecificEnergy ) + { + parsedSpecificEnergy = default(SpecificEnergy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedSpecificEnergy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == SpecificEnergyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEnergyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEnergyUnit unit) + { + unit = SpecificEnergyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == SpecificEnergyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index e18e5d9138..3036763f6d 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -508,7 +508,7 @@ private double AsBaseNumericType(SpecificEntropyUnit unit) /// public static SpecificEntropy Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -521,7 +521,7 @@ public static SpecificEntropy Parse(string str) /// public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -535,7 +535,140 @@ public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) /// Error parsing string. public static SpecificEntropyUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out SpecificEntropyUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) + { + result = default(SpecificEntropy); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificEntropy parsedSpecificEntropy ) + { + parsedSpecificEntropy = default(SpecificEntropy); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedSpecificEntropy = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == SpecificEntropyUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEntropyUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEntropyUnit unit) + { + unit = SpecificEntropyUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == SpecificEntropyUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index f1576aa45a..7abb0a56be 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -376,7 +376,7 @@ private double AsBaseNumericType(SpecificVolumeUnit unit) /// public static SpecificVolume Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -389,7 +389,7 @@ public static SpecificVolume Parse(string str) /// public static bool TryParse([CanBeNull] string str, out SpecificVolume result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -403,7 +403,140 @@ public static bool TryParse([CanBeNull] string str, out SpecificVolume result) /// Error parsing string. public static SpecificVolumeUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out SpecificVolumeUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) + { + result = default(SpecificVolume); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificVolume parsedSpecificVolume ) + { + parsedSpecificVolume = default(SpecificVolume); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedSpecificVolume = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == SpecificVolumeUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificVolumeUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificVolumeUnit unit) + { + unit = SpecificVolumeUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == SpecificVolumeUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index dd444e0451..8dfe18a0dd 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -706,7 +706,7 @@ private double AsBaseNumericType(SpecificWeightUnit unit) /// public static SpecificWeight Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -719,7 +719,7 @@ public static SpecificWeight Parse(string str) /// public static bool TryParse([CanBeNull] string str, out SpecificWeight result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -733,7 +733,140 @@ public static bool TryParse([CanBeNull] string str, out SpecificWeight result) /// Error parsing string. public static SpecificWeightUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out SpecificWeightUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) + { + result = default(SpecificWeight); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificWeight parsedSpecificWeight ) + { + parsedSpecificWeight = default(SpecificWeight); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedSpecificWeight = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == SpecificWeightUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificWeightUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificWeightUnit unit) + { + unit = SpecificWeightUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == SpecificWeightUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 37510683ae..1b3c50decf 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -1036,7 +1036,7 @@ private double AsBaseNumericType(SpeedUnit unit) /// public static Speed Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -1049,7 +1049,7 @@ public static Speed Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Speed result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -1063,7 +1063,140 @@ public static bool TryParse([CanBeNull] string str, out Speed result) /// Error parsing string. public static SpeedUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out SpeedUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) + { + result = default(Speed); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Speed parsedSpeed ) + { + parsedSpeed = default(Speed); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedSpeed = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == SpeedUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpeedUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpeedUnit unit) + { + unit = SpeedUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == SpeedUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 1db9b0d530..c5075f99f9 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -508,7 +508,7 @@ private double AsBaseNumericType(TemperatureUnit unit) /// public static Temperature Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -521,7 +521,7 @@ public static Temperature Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Temperature result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -535,7 +535,140 @@ public static bool TryParse([CanBeNull] string str, out Temperature result) /// Error parsing string. public static TemperatureUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out TemperatureUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) + { + result = default(Temperature); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Temperature parsedTemperature ) + { + parsedTemperature = default(Temperature); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedTemperature = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static TemperatureUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == TemperatureUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureUnit unit) + { + unit = TemperatureUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == TemperatureUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 2321cdf29d..8b8a518ebe 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -552,7 +552,7 @@ private double AsBaseNumericType(TemperatureChangeRateUnit unit) /// public static TemperatureChangeRate Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -565,7 +565,7 @@ public static TemperatureChangeRate Parse(string str) /// public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -579,7 +579,140 @@ public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate re /// Error parsing string. public static TemperatureChangeRateUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out TemperatureChangeRateUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) + { + result = default(TemperatureChangeRate); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out TemperatureChangeRate parsedTemperatureChangeRate ) + { + parsedTemperatureChangeRate = default(TemperatureChangeRate); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedTemperatureChangeRate = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == TemperatureChangeRateUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureChangeRateUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureChangeRateUnit unit) + { + unit = TemperatureChangeRateUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == TemperatureChangeRateUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 0964975291..258f953247 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -507,7 +507,7 @@ private double AsBaseNumericType(TemperatureDeltaUnit unit) /// public static TemperatureDelta Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -520,7 +520,7 @@ public static TemperatureDelta Parse(string str) /// public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -534,7 +534,140 @@ public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) /// Error parsing string. public static TemperatureDeltaUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out TemperatureDeltaUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) + { + result = default(TemperatureDelta); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out TemperatureDelta parsedTemperatureDelta ) + { + parsedTemperatureDelta = default(TemperatureDelta); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedTemperatureDelta = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == TemperatureDeltaUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureDeltaUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureDeltaUnit unit) + { + unit = TemperatureDeltaUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == TemperatureDeltaUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index a0eae874d9..8f75cb0481 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -376,7 +376,7 @@ private double AsBaseNumericType(ThermalConductivityUnit unit) /// public static ThermalConductivity Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -389,7 +389,7 @@ public static ThermalConductivity Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ThermalConductivity result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -403,7 +403,140 @@ public static bool TryParse([CanBeNull] string str, out ThermalConductivity resu /// Error parsing string. public static ThermalConductivityUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ThermalConductivityUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) + { + result = default(ThermalConductivity); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ThermalConductivity parsedThermalConductivity ) + { + parsedThermalConductivity = default(ThermalConductivity); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedThermalConductivity = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ThermalConductivityUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalConductivityUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalConductivityUnit unit) + { + unit = ThermalConductivityUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ThermalConductivityUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 347feafd51..2b4b999e51 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -442,7 +442,7 @@ private double AsBaseNumericType(ThermalResistanceUnit unit) /// public static ThermalResistance Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -455,7 +455,7 @@ public static ThermalResistance Parse(string str) /// public static bool TryParse([CanBeNull] string str, out ThermalResistance result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -469,7 +469,140 @@ public static bool TryParse([CanBeNull] string str, out ThermalResistance result /// Error parsing string. public static ThermalResistanceUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out ThermalResistanceUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) + { + result = default(ThermalResistance); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out ThermalResistance parsedThermalResistance ) + { + parsedThermalResistance = default(ThermalResistance); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedThermalResistance = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == ThermalResistanceUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalResistanceUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalResistanceUnit unit) + { + unit = ThermalResistanceUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == ThermalResistanceUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index 7d53e59fbc..6183876f8e 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -794,7 +794,7 @@ private double AsBaseNumericType(TorqueUnit unit) /// public static Torque Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -807,7 +807,7 @@ public static Torque Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Torque result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -821,7 +821,140 @@ public static bool TryParse([CanBeNull] string str, out Torque result) /// Error parsing string. public static TorqueUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out TorqueUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Torque ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) + { + result = default(Torque); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Torque parsedTorque ) + { + parsedTorque = default(Torque); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedTorque = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == TorqueUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TorqueUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TorqueUnit unit) + { + unit = TorqueUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == TorqueUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index aa5c351adc..a77e3c33c0 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -353,7 +353,7 @@ private double AsBaseNumericType(VitaminAUnit unit) /// public static VitaminA Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -366,7 +366,7 @@ public static VitaminA Parse(string str) /// public static bool TryParse([CanBeNull] string str, out VitaminA result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -380,7 +380,140 @@ public static bool TryParse([CanBeNull] string str, out VitaminA result) /// Error parsing string. public static VitaminAUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out VitaminAUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) + { + result = default(VitaminA); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out VitaminA parsedVitaminA ) + { + parsedVitaminA = default(VitaminA); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedVitaminA = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == VitaminAUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VitaminAUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out VitaminAUnit unit) + { + unit = VitaminAUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == VitaminAUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 1c10d748c5..1f378dc9ea 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -1256,7 +1256,7 @@ private double AsBaseNumericType(VolumeUnit unit) /// public static Volume Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -1269,7 +1269,7 @@ public static Volume Parse(string str) /// public static bool TryParse([CanBeNull] string str, out Volume result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -1283,7 +1283,140 @@ public static bool TryParse([CanBeNull] string str, out Volume result) /// Error parsing string. public static VolumeUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out VolumeUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static Volume ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) + { + result = default(Volume); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out Volume parsedVolume ) + { + parsedVolume = default(Volume); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedVolume = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == VolumeUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeUnit unit) + { + unit = VolumeUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == VolumeUnit.Undefined) + return false; + + return true; } #endregion diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 0ee33107e6..7da599ead9 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -904,7 +904,7 @@ private double AsBaseNumericType(VolumeFlowUnit unit) /// public static VolumeFlow Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -917,7 +917,7 @@ public static VolumeFlow Parse(string str) /// public static bool TryParse([CanBeNull] string str, out VolumeFlow result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -931,7 +931,140 @@ public static bool TryParse([CanBeNull] string str, out VolumeFlow result) /// Error parsing string. public static VolumeFlowUnit ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out VolumeFlowUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) + { + result = default(VolumeFlow); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out VolumeFlow parsedVolumeFlow ) + { + parsedVolumeFlow = default(VolumeFlow); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsedVolumeFlow = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse(str.Trim()); + + if (unit == VolumeFlowUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeFlowUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeFlowUnit unit) + { + unit = VolumeFlowUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse(str.Trim(), out unit)) + return false; + + if(unit == VolumeFlowUnit.Undefined) + return false; + + return true; } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 18746bc96e..36adbe7a7f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Acceleration Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AccelerationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMetersPerSecondSquared(x.MetersPerSecondSquared + y.MetersPerSecondSquared)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Acceleration Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Acceleration result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Acceleration); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static AccelerationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AccelerationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AccelerationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AccelerationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index bff21fd0dd..b8c3e51fe0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] string cultureName // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AmountOfSubstanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMoles(x.Moles + y.Moles)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] string cultureName /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmountOfSubstance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(AmountOfSubstance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static AmountOfSubstanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmountOfSubstanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AmountOfSubstanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmountOfSubstanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index e1430d991f..8c0c861b2a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AmplitudeRatioUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecibelVolts(x.DecibelVolts + y.DecibelVolts)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmplitudeRatio result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(AmplitudeRatio); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static AmplitudeRatioUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmplitudeRatioUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AmplitudeRatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmplitudeRatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 13dfeb0c5e..9c66956bb0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Angle Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AngleUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDegrees(x.Degrees + y.Degrees)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Angle Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Angle result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Angle); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static AngleUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AngleUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AngleUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AngleUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 414dda709b..a514d06881 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ApparentEnergy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ApparentEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltampereHours(x.VoltampereHours + y.VoltampereHours)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ApparentEnergy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentEnergy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ApparentEnergy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ApparentEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ApparentEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index a00dbb607b..1236902125 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ApparentPower Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ApparentPowerUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltamperes(x.Voltamperes + y.Voltamperes)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ApparentPower Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentPower result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ApparentPower); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ApparentPowerUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentPowerUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ApparentPowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentPowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 74dd8cbcc6..30082a1026 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Area Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AreaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSquareMeters(x.SquareMeters + y.SquareMeters)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Area Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Area result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Area); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static AreaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AreaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index 24ecfcfb23..cc0e65e6db 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static AreaDensity Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AreaDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerSquareMeter(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static AreaDensity Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaDensity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(AreaDensity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static AreaDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AreaDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index b39f364461..f67ed8a765 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AreaMomentOfInertiaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMetersToTheFourth(x.MetersToTheFourth + y.MetersToTheFourth)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaMomentOfInertia result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(AreaMomentOfInertia); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static AreaMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaMomentOfInertiaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AreaMomentOfInertiaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaMomentOfInertiaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 03b50ceab3..bdbc535ff5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static BitRate Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - BitRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromBitsPerSecond(x.BitsPerSecond + y.BitsPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static BitRate Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BitRate result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(BitRate); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static BitRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BitRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == BitRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BitRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 006f32ec76..bd7b47a40f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - BrakeSpecificFuelConsumptionUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerJoule(x.KilogramsPerJoule + y.KilogramsPerJoule)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] string /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumption result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(BrakeSpecificFuelConsumption); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumptionUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BrakeSpecificFuelConsumptionUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index a10d6a61bd..2d7ed7bce0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Capacitance Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - CapacitanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromFarads(x.Farads + y.Farads)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Capacitance Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Capacitance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Capacitance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static CapacitanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out CapacitanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == CapacitanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized CapacitanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index c4b4771424..f6b2aa5d6a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Density Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - DensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerCubicMeter(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Density Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Density result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Density); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static DensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == DensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 010db722e3..857451b9cb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Duration Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - DurationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSeconds(x.Seconds + y.Seconds)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Duration Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Duration result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Duration); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static DurationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DurationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == DurationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DurationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index fe01d15737..05a6bc7c93 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static DynamicViscosity Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - DynamicViscosityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonSecondsPerMeterSquared(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static DynamicViscosity Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out DynamicViscosity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(DynamicViscosity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static DynamicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DynamicViscosityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == DynamicViscosityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DynamicViscosityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index 71783fb1ef..f1d7203013 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] string cultureNam // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricAdmittanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSiemens(x.Siemens + y.Siemens)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] string cultureNam /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricAdmittance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricAdmittance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricAdmittanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricAdmittanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricAdmittanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricAdmittanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 67d112ec66..030fea6f4b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricCharge Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricChargeUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCoulombs(x.Coulombs + y.Coulombs)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricCharge Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCharge result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricCharge); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricChargeUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricChargeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 79610f936e..93c916d3e5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] string culture // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricChargeDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCoulombsPerCubicMeter(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] string culture /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricChargeDensity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricChargeDensity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricChargeDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricChargeDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index b784e572d7..6dca359e02 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricConductance Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricConductanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSiemens(x.Siemens + y.Siemens)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricConductance Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricConductance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricConductanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricConductanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 9a82c5b900..65c463f8fb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricConductivity Parse(string str, [CanBeNull] string cultureN // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricConductivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSiemensPerMeter(x.SiemensPerMeter + y.SiemensPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricConductivity Parse(string str, [CanBeNull] string cultureN /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductivity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricConductivity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricConductivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricConductivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 1c0a2c1a9a..63e71a0ba4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricCurrent Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricCurrentUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperes(x.Amperes + y.Amperes)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricCurrent Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrent result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricCurrent); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricCurrentUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricCurrentUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index 9755b633e4..a69f16d89b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] string cultur // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricCurrentDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperesPerSquareMeter(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] string cultur /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentDensity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricCurrentDensity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricCurrentDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricCurrentDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 5a367e848f..a46a284f90 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricCurrentGradientUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperesPerSecond(x.AmperesPerSecond + y.AmperesPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] string cultu /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentGradient result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricCurrentGradient); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricCurrentGradientUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentGradientUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricCurrentGradientUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentGradientUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index 7e512ad02e..54baf6e0a4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricField Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricFieldUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltsPerMeter(x.VoltsPerMeter + y.VoltsPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricField Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricField result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricField); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricFieldUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricFieldUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricFieldUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricFieldUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index 303ebcafa6..ac39bf3719 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricInductance Parse(string str, [CanBeNull] string cultureNam // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricInductanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromHenries(x.Henries + y.Henries)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricInductance Parse(string str, [CanBeNull] string cultureNam /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricInductance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricInductance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricInductanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricInductanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricInductanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricInductanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index ef1f260682..4134d167c3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricPotential Parse(string str, [CanBeNull] string cultureName // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricPotentialUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVolts(x.Volts + y.Volts)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricPotential Parse(string str, [CanBeNull] string cultureName /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotential result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricPotential); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricPotentialUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricPotentialUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 9cb0fe0375..94133dafae 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricPotentialAcUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltsAc(x.VoltsAc + y.VoltsAc)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialAc result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricPotentialAc); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricPotentialAcUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialAcUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricPotentialAcUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialAcUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 03b22635cc..60cde2349f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricPotentialDcUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltsDc(x.VoltsDc + y.VoltsDc)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialDc result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricPotentialDc); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricPotentialDcUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialDcUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricPotentialDcUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialDcUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index 527ff133e9..1bf8d39d9f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricResistance Parse(string str, [CanBeNull] string cultureNam // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricResistanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromOhms(x.Ohms + y.Ohms)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricResistance Parse(string str, [CanBeNull] string cultureNam /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricResistance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricResistanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricResistanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index f0019b31a8..b782e93278 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ElectricResistivity Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricResistivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromOhmMeters(x.OhmMeters + y.OhmMeters)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ElectricResistivity Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistivity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ElectricResistivity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ElectricResistivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricResistivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index ba97efc1cc..8c0111ca47 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Energy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - EnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoules(x.Joules + y.Joules)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Energy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Energy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Energy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static EnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == EnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 52e53931eb..bfc36363d6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Entropy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - EntropyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerKelvin(x.JoulesPerKelvin + y.JoulesPerKelvin)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Entropy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Entropy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Entropy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static EntropyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EntropyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == EntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index cb1c716a3d..d4d5189513 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Force Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ForceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtons(x.Newtons + y.Newtons)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Force Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Force result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Force); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ForceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ForceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index efcb1c9178..fff218396e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ForceChangeRate Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ForceChangeRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonsPerSecond(x.NewtonsPerSecond + y.NewtonsPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ForceChangeRate Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForceChangeRate result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ForceChangeRate); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ForceChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceChangeRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ForceChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index de92aafc6b..db107fe183 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ForcePerLength Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ForcePerLengthUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonsPerMeter(x.NewtonsPerMeter + y.NewtonsPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ForcePerLength Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForcePerLength result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ForcePerLength); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ForcePerLengthUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForcePerLengthUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ForcePerLengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForcePerLengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index 1d05349c9c..482a7e2568 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Frequency Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - FrequencyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromHertz(x.Hertz + y.Hertz)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Frequency Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Frequency result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Frequency); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static FrequencyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out FrequencyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == FrequencyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized FrequencyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 361072352d..aee2c60ae3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static HeatFlux Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - HeatFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerSquareMeter(x.WattsPerSquareMeter + y.WattsPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static HeatFlux Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatFlux result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(HeatFlux); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static HeatFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == HeatFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 4053939c81..038a858590 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - HeatTransferCoefficientUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerSquareMeterKelvin(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] string cultu /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatTransferCoefficient result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(HeatTransferCoefficient); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static HeatTransferCoefficientUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatTransferCoefficientUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == HeatTransferCoefficientUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatTransferCoefficientUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 940d567e73..2c0f8e99d8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Illuminance Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - IlluminanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromLux(x.Lux + y.Lux)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Illuminance Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Illuminance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Illuminance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static IlluminanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IlluminanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == IlluminanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IlluminanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index b10a5189c7..261900e2bd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Information Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - InformationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromBits(x.Bits + y.Bits)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Information Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Information result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Information); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static InformationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out InformationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == InformationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index 11b0484b66..0f2c1c6dfc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Irradiance Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - IrradianceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerSquareMeter(x.WattsPerSquareMeter + y.WattsPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Irradiance Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Irradiance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static IrradianceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradianceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == IrradianceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradianceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 0a6b23eefd..810eb6816f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Irradiation Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - IrradiationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerSquareMeter(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Irradiation Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiation result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Irradiation); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static IrradiationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradiationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == IrradiationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradiationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index e1f7360402..597eb8825c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static KinematicViscosity Parse(string str, [CanBeNull] string cultureNam // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - KinematicViscosityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSquareMetersPerSecond(x.SquareMetersPerSecond + y.SquareMetersPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static KinematicViscosity Parse(string str, [CanBeNull] string cultureNam /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out KinematicViscosity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(KinematicViscosity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static KinematicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out KinematicViscosityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == KinematicViscosityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized KinematicViscosityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index a717e64840..8ae87aa8dc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static LapseRate Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LapseRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDegreesCelciusPerKilometer(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static LapseRate Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LapseRate result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(LapseRate); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static LapseRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LapseRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LapseRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LapseRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index bef41113d5..9455b150e6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Length Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LengthUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMeters(x.Meters + y.Meters)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Length Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Length result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Length); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static LengthUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LengthUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index af0eb875e2..626f905c21 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Level Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LevelUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecibels(x.Decibels + y.Decibels)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Level Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Level result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Level); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static LevelUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LevelUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LevelUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index d7f76489c2..5dbc90f8a0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static LinearDensity Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LinearDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerMeter(x.KilogramsPerMeter + y.KilogramsPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static LinearDensity Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LinearDensity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(LinearDensity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static LinearDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LinearDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LinearDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LinearDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 73c78d323c..c2c033c875 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static LuminousFlux Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LuminousFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromLumens(x.Lumens + y.Lumens)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static LuminousFlux Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousFlux result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(LuminousFlux); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static LuminousFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LuminousFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index c2d8e462da..a60457862e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static LuminousIntensity Parse(string str, [CanBeNull] string cultureName // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LuminousIntensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCandela(x.Candela + y.Candela)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static LuminousIntensity Parse(string str, [CanBeNull] string cultureName /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousIntensity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(LuminousIntensity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static LuminousIntensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousIntensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LuminousIntensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousIntensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index 17172c2d98..e42d212939 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MagneticField Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MagneticFieldUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromTeslas(x.Teslas + y.Teslas)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MagneticField Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticField result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MagneticField); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MagneticFieldUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFieldUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MagneticFieldUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFieldUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 3e79d79033..bcdf967e0d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MagneticFlux Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MagneticFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWebers(x.Webers + y.Webers)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MagneticFlux Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticFlux result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MagneticFlux); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MagneticFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MagneticFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index 18ec44f9a6..d652d7e489 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Magnetization Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MagnetizationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperesPerMeter(x.AmperesPerMeter + y.AmperesPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Magnetization Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Magnetization result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Magnetization); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MagnetizationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagnetizationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MagnetizationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagnetizationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index fe7084ecbd..e5c34f63f5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Mass Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilograms(x.Kilograms + y.Kilograms)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Mass Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Mass result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Mass); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MassUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index 8dd07a0876..0e56510a1c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MassFlow Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassFlowUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromGramsPerSecond(x.GramsPerSecond + y.GramsPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MassFlow Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlow result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MassFlow); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MassFlowUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFlowUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassFlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index ec7f1dfbd6..458ee89ed8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MassFlux Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerSecondPerSquareMeter(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MassFlux Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlux result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MassFlux); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MassFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index aa25e45134..e432419055 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassMomentOfInertiaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramSquareMeters(x.KilogramSquareMeters + y.KilogramSquareMeters)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassMomentOfInertia result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MassMomentOfInertia); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MassMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassMomentOfInertiaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassMomentOfInertiaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassMomentOfInertiaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index 6afd487121..f2fee24aa1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MolarEnergy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerMole(x.JoulesPerMole + y.JoulesPerMole)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MolarEnergy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEnergy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MolarEnergy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MolarEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index ba306d4db6..da90f6e830 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MolarEntropy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarEntropyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerMoleKelvin(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MolarEntropy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEntropy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MolarEntropy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MolarEntropyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEntropyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarEntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index a80752f3cb..f47ad6ba3f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static MolarMass Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarMassUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerMole(x.KilogramsPerMole + y.KilogramsPerMole)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static MolarMass Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarMass result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(MolarMass); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MolarMassUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarMassUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarMassUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarMassUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index 9728874cf2..19dcfc251d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Molarity Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMolesPerCubicMeter(x.MolesPerCubicMeter + y.MolesPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Molarity Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Molarity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Molarity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static MolarityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index e30d8049e0..49ba0d62f9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Permeability Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PermeabilityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromHenriesPerMeter(x.HenriesPerMeter + y.HenriesPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Permeability Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permeability result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Permeability); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static PermeabilityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermeabilityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PermeabilityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermeabilityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index 81dfdbff6b..dfc3ae41a7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Permittivity Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PermittivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromFaradsPerMeter(x.FaradsPerMeter + y.FaradsPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Permittivity Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permittivity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Permittivity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static PermittivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermittivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PermittivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermittivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index f7c601374f..b6e9b06086 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Power Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PowerUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWatts(x.Watts + y.Watts)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Power Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Power result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Power); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static PowerUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index d972403d48..0578c19ed1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static PowerDensity Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PowerDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerCubicMeter(x.WattsPerCubicMeter + y.WattsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static PowerDensity Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerDensity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(PowerDensity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static PowerDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PowerDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index eef9ea4d32..e25d40f08a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static PowerRatio Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PowerRatioUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecibelWatts(x.DecibelWatts + y.DecibelWatts)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static PowerRatio Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerRatio result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(PowerRatio); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static PowerRatioUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerRatioUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PowerRatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerRatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 7a856a0d3a..4e7090a06d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Pressure Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PressureUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromPascals(x.Pascals + y.Pascals)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Pressure Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Pressure result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Pressure); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static PressureUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PressureUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index 066d81fea6..37dc694287 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static PressureChangeRate Parse(string str, [CanBeNull] string cultureNam // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PressureChangeRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromPascalsPerSecond(x.PascalsPerSecond + y.PascalsPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static PressureChangeRate Parse(string str, [CanBeNull] string cultureNam /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PressureChangeRate result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(PressureChangeRate); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static PressureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureChangeRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PressureChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 79f3e76917..fd9f15c9fc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Ratio Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RatioUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecimalFractions(x.DecimalFractions + y.DecimalFractions)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Ratio Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Ratio result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Ratio); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static RatioUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RatioUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 5fae7fcaa2..fde190ed38 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ReactiveEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltampereReactiveHours(x.VoltampereReactiveHours + y.VoltampereReactiveHours)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactiveEnergy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ReactiveEnergy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ReactiveEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactiveEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ReactiveEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactiveEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index f8b8de44b0..20625eb5ba 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ReactivePower Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ReactivePowerUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltamperesReactive(x.VoltamperesReactive + y.VoltamperesReactive)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ReactivePower Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactivePower result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ReactivePower); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ReactivePowerUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactivePowerUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ReactivePowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactivePowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index 2199b771cd..ea7eaf618b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] string cultur // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalAccelerationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromRadiansPerSecondSquared(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] string cultur /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalAcceleration result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(RotationalAcceleration); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static RotationalAccelerationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalAccelerationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalAccelerationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalAccelerationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 05e4b877e9..0f3d419b1e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static RotationalSpeed Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalSpeedUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromRadiansPerSecond(x.RadiansPerSecond + y.RadiansPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static RotationalSpeed Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalSpeed result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(RotationalSpeed); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static RotationalSpeedUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalSpeedUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalSpeedUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalSpeedUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index dceedfc1f5..f44d536789 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static RotationalStiffness Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalStiffnessUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonMetersPerRadian(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static RotationalStiffness Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffness result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(RotationalStiffness); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static RotationalStiffnessUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalStiffnessUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index a79b01f8ff..bbf2841753 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalStiffnessPerLengthUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonMetersPerRadianPerMeter(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] string /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLength result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(RotationalStiffnessPerLength); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLengthUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalStiffnessPerLengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessPerLengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index 99fd7e3df6..c7e3cadd98 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static SolidAngle Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SolidAngleUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSteradians(x.Steradians + y.Steradians)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static SolidAngle Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SolidAngle result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(SolidAngle); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static SolidAngleUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SolidAngleUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SolidAngleUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SolidAngleUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index e67b373b20..14effbb767 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static SpecificEnergy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerKilogram(x.JoulesPerKilogram + y.JoulesPerKilogram)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static SpecificEnergy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEnergy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(SpecificEnergy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static SpecificEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 59b9a8f2d9..1dbcdc540b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static SpecificEntropy Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificEntropyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerKilogramKelvin(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static SpecificEntropy Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEntropy result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(SpecificEntropy); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static SpecificEntropyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEntropyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificEntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index 284823b572..46a406ae2d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static SpecificVolume Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificVolumeUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMetersPerKilogram(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static SpecificVolume Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificVolume result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(SpecificVolume); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static SpecificVolumeUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificVolumeUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificVolumeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificVolumeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index 98511176b3..512637bd7c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static SpecificWeight Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificWeightUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonsPerCubicMeter(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static SpecificWeight Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificWeight result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(SpecificWeight); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static SpecificWeightUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificWeightUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificWeightUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificWeightUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index c09a619cde..ed8f5f1427 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Speed Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpeedUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMetersPerSecond(x.MetersPerSecond + y.MetersPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Speed Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Speed result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Speed); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static SpeedUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpeedUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpeedUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpeedUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index bb30b7ccaf..27e76f6820 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Temperature Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TemperatureUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKelvins(x.Kelvins + y.Kelvins)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Temperature Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Temperature result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Temperature); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static TemperatureUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TemperatureUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index 34ae85b29a..e90335b363 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] string culture // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TemperatureChangeRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDegreesCelsiusPerSecond(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] string culture /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureChangeRate result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(TemperatureChangeRate); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static TemperatureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureChangeRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TemperatureChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 5becd4fccf..58eb389dd4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static TemperatureDelta Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TemperatureDeltaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKelvins(x.Kelvins + y.Kelvins)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static TemperatureDelta Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureDelta result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(TemperatureDelta); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static TemperatureDeltaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureDeltaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TemperatureDeltaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureDeltaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index eff5b5b651..1744861824 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ThermalConductivity Parse(string str, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ThermalConductivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerMeterKelvin(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ThermalConductivity Parse(string str, [CanBeNull] string cultureNa /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalConductivity result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ThermalConductivity); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ThermalConductivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalConductivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ThermalConductivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalConductivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index 2eb2fcfb5e..c09bb66716 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static ThermalResistance Parse(string str, [CanBeNull] string cultureName // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ThermalResistanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSquareMeterKelvinsPerKilowatt(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static ThermalResistance Parse(string str, [CanBeNull] string cultureName /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalResistance result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(ThermalResistance); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static ThermalResistanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalResistanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ThermalResistanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalResistanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index 42209d4c38..8165ec641f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Torque Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TorqueUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonMeters(x.NewtonMeters + y.NewtonMeters)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Torque Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Torque result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Torque); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static TorqueUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TorqueUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TorqueUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TorqueUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index ac12630410..926d723a6e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static VitaminA Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - VitaminAUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromInternationalUnits(x.InternationalUnits + y.InternationalUnits)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static VitaminA Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VitaminA result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(VitaminA); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static VitaminAUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VitaminAUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == VitaminAUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VitaminAUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 8353a0926b..4770b1fd4a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static Volume Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - VolumeUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMeters(x.CubicMeters + y.CubicMeters)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static Volume Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Volume result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(Volume); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static VolumeUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == VolumeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 8bba24413d..b9273f6170 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -121,13 +121,7 @@ public static VolumeFlow Parse(string str, [CanBeNull] string cultureName) // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - VolumeFlowUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMetersPerSecond(x.CubicMetersPerSecond + y.CubicMetersPerSecond)); + return ParseInternal(str, provider); } /// @@ -141,16 +135,10 @@ public static VolumeFlow Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VolumeFlow result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default(VolumeFlow); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -165,35 +153,28 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static VolumeFlowUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeFlowUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == VolumeFlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeFlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index a8d5ce9ec8..149d117349 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -31,6 +31,7 @@ namespace UnitsNet { internal delegate TQuantity ParseUnit(string value, string unit, IFormatProvider formatProvider = null); + internal delegate bool TryParseUnit(string valueString, string unit, IFormatProvider formatProvider, out TQuantity value); internal static class QuantityParser { @@ -44,14 +45,14 @@ internal static TQuantity Parse([NotNull] string str, if (parseUnit == null) throw new ArgumentNullException(nameof(parseUnit)); if (add == null) throw new ArgumentNullException(nameof(add)); - NumberFormatInfo numFormat = formatProvider != null + var numFormat = formatProvider != null ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) : NumberFormatInfo.CurrentInfo; if (numFormat == null) throw new InvalidOperationException($"No number format was found for the given format provider: {formatProvider}"); - string numRegex = string.Format(@"[\d., {0}{1}]*\d", + var numRegex = string.Format(@"[\d., {0}{1}]*\d", // allows digits, dots, commas, and spaces in the quantity (must end in digit) numFormat.NumberGroupSeparator, // adds provided (or current) culture's group separator numFormat.NumberDecimalSeparator); // adds provided (or current) culture's decimal separator @@ -66,7 +67,7 @@ internal static TQuantity Parse([NotNull] string str, string unitsRegex = $"({String.Join("|", unitAbbreviations)})"; - string regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", + var regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", numRegex, // capture base (integral) Quantity value exponentialRegex, // capture exponential (if any), end of Quantity capturing @"\s?", // ignore whitespace (allows both "1kg", "1 kg") @@ -74,7 +75,7 @@ internal static TQuantity Parse([NotNull] string str, @"(and)?,?", // allow "and" & "," separators between quantities @"(?[a-z]*)?"); // capture invalid input - List quantities = ParseWithRegex(regexString, str, parseUnit, formatProvider); + var quantities = ParseWithRegex(regexString, str, parseUnit, formatProvider); if (quantities.Count == 0) { throw new ArgumentException( @@ -132,5 +133,87 @@ private static List ParseWithRegex(string regexString, str } return converted; } + + [SuppressMessage("ReSharper", "UseStringInterpolation")] + internal static bool TryParse([NotNull] string str, + [CanBeNull] IFormatProvider formatProvider, + [NotNull] TryParseUnit parseUnit, + [NotNull] Func add, out TQuantity value) + { + value = default(TQuantity); + + if(string.IsNullOrWhiteSpace(str)) return false; + if(parseUnit == null) return false; + if(add == null) return false; + + var numFormat = formatProvider != null + ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) + : NumberFormatInfo.CurrentInfo; + + if(numFormat == null) + return false; + + var numRegex = string.Format(@"[\d., {0}{1}]*\d", + // allows digits, dots, commas, and spaces in the quantity (must end in digit) + numFormat.NumberGroupSeparator, // adds provided (or current) culture's group separator + numFormat.NumberDecimalSeparator); // adds provided (or current) culture's decimal separator + + const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; + + string[] unitAbbreviations = UnitSystem.GetCached(formatProvider) + .GetAllAbbreviations(typeof(TUnitType)) + .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error + .Select(Regex.Escape) // Escape special regex characters + .ToArray(); + + string unitsRegex = $"({String.Join("|", unitAbbreviations)})"; + + var regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", + numRegex, // capture base (integral) Quantity value + exponentialRegex, // capture exponential (if any), end of Quantity capturing + @"\s?", // ignore whitespace (allows both "1kg", "1 kg") + $@"(?{unitsRegex})", // capture Unit by list of abbreviations + @"(and)?,?", // allow "and" & "," separators between quantities + @"(?[a-z]*)?"); // capture invalid input + + if(!TryParseWithRegex(regexString, str, parseUnit, formatProvider, out var quantities)) + return false; + + value = quantities.Aggregate(add); + return true; + } + + /// + /// Parse a string given a particular regular expression. + /// + /// Error parsing string. + private static bool TryParseWithRegex(string regexString, string str, TryParseUnit tryParseUnit, + IFormatProvider formatProvider, out List converted ) + { + converted = new List(); + + var regex = new Regex(regexString); + var matches = regex.Matches(str.Trim()); + + foreach(Match match in matches) + { + var groups = match.Groups; + + var valueString = groups["value"].Value; + var unitString = groups["unit"].Value; + if(groups["invalid"].Value != string.Empty) + return false; + + if((valueString == string.Empty) && (unitString == string.Empty)) + continue; + + if(!tryParseUnit(valueString, unitString, formatProvider, out var parsed)) + return false; + + converted.Add(parsed); + } + + return true; + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 1b07fe26ee..2325dadcee 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatP /// public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AccelerationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMetersPerSecondSquared(x.MetersPerSecondSquared + y.MetersPerSecondSquared)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Acceleration); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static AccelerationUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureN /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AccelerationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out AccelerationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AccelerationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AccelerationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index a644c32be9..3dde09393d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFo /// public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AmountOfSubstanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMoles(x.Moles + y.Moles)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider pr /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(AmountOfSubstance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static AmountOfSubstanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cul /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmountOfSubstanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out AmountOfSubstanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AmountOfSubstanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmountOfSubstanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index c70a98038d..aca0015b2e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -167,17 +167,7 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IForma /// public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AmplitudeRatioUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecibelVolts(x.DecibelVolts + y.DecibelVolts)); + return ParseInternal(str, provider); } /// @@ -186,39 +176,28 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(AmplitudeRatio); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static AmplitudeRatioUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -226,27 +205,14 @@ public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmplitudeRatioUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out AmplitudeRatioUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AmplitudeRatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmplitudeRatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 9fd7307afb..74594e0d60 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider /// public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AngleUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDegrees(x.Degrees + y.Degrees)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Angle); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static AngleUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AngleUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out AngleUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AngleUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AngleUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 051f4c69cb..6befa51f75 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IForma /// public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ApparentEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltampereHours(x.VoltampereHours + y.VoltampereHours)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ApparentEnergy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ApparentEnergyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ApparentEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ApparentEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index ac9a694fc2..79d9c80500 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormat /// public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ApparentPowerUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltamperes(x.Voltamperes + y.Voltamperes)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ApparentPower); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ApparentPowerUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string culture /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentPowerUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ApparentPowerUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ApparentPowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentPowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 60a1dc3826..72a65906b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider /// public static Area Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AreaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSquareMeters(x.SquareMeters + y.SquareMeters)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Area Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Area); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static AreaUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AreaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index bd75e73e5b..5dac998354 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatPr /// public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AreaDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerSquareMeter(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(AreaDensity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static AreaDensityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureNa /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AreaDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 8148968622..48f99e9ebb 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] I /// public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - AreaMomentOfInertiaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMetersToTheFourth(x.MetersToTheFourth + y.MetersToTheFourth)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(AreaMomentOfInertia); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static AreaMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMomentOfInertiaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == AreaMomentOfInertiaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaMomentOfInertiaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index a6a92ac3ca..8dd63b7d65 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvid /// public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - BitRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromBitsPerSecond(x.BitsPerSecond + y.BitsPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(BitRate); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static BitRateUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BitRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out BitRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == BitRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BitRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 5e7156515a..66b1ce63b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can /// public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - BrakeSpecificFuelConsumptionUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerJoule(x.KilogramsPerJoule + y.KilogramsPerJoule)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormat /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(BrakeSpecificFuelConsumption); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeSpecificFuelConsumptionUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BrakeSpecificFuelConsumptionUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index af6e9c637b..2e85ccaab1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatPr /// public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - CapacitanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromFarads(x.Farads + y.Farads)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Capacitance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static CapacitanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureNa /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static CapacitanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out CapacitanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == CapacitanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized CapacitanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index e491b219c5..35b3ed857a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvid /// public static Density Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - DensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerCubicMeter(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Density Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Density); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static DensityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out DensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == DensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 1d0d18b70a..d65f2ac0e0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvi /// public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - DurationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSeconds(x.Seconds + y.Seconds)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Duration); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static DurationUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DurationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out DurationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == DurationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DurationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index eb45c1c136..76413b4919 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFor /// public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - DynamicViscosityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonSecondsPerMeterSquared(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider pro /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(DynamicViscosity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static DynamicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cult /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DynamicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out DynamicViscosityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == DynamicViscosityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DynamicViscosityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 263c6de064..95cd9cf751 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IF /// public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricAdmittanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSiemens(x.Siemens + y.Siemens)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider p /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricAdmittance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricAdmittanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricAdmittanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricAdmittanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricAdmittanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricAdmittanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index b73452a549..8444e93d75 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IForma /// public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricChargeUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCoulombs(x.Coulombs + y.Coulombs)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricCharge); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricChargeUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricChargeUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricChargeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 7d546ced0d..c33625785d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] /// public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricChargeDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCoulombsPerCubicMeter(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricChargeDensity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricChargeDensityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricChargeDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricChargeDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 5991df998d..3fe4b43514 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] I /// public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricConductanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSiemens(x.Siemens + y.Siemens)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricConductance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricConductanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricConductanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricConductanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 0cd21c684c..6e249a4a2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] /// public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricConductivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSiemensPerMeter(x.SiemensPerMeter + y.SiemensPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricConductivity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricConductivityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricConductivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricConductivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 1b4d40cfa9..10f4edcf23 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IForm /// public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricCurrentUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperes(x.Amperes + y.Amperes)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider prov /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricCurrent); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricCurrentUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricCurrentUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index e9f57b6edc..fe14e6b3aa 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull /// public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricCurrentDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperesPerSquareMeter(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricCurrentDensity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricCurrentDensityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] strin /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricCurrentDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index f65e48d975..257c4525f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul /// public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricCurrentGradientUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperesPerSecond(x.AmperesPerSecond + y.AmperesPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricCurrentGradient); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricCurrentGradientUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] stri /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentGradientUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentGradientUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricCurrentGradientUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentGradientUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 4f889665e5..d4ff73246c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormat /// public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricFieldUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltsPerMeter(x.VoltsPerMeter + y.VoltsPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricField); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricFieldUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string culture /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricFieldUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricFieldUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricFieldUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricFieldUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index c70d46afb5..b2c8413319 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IF /// public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricInductanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromHenries(x.Henries + y.Henries)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider p /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricInductance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricInductanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricInductanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricInductanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricInductanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricInductanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index f682141e0c..ea5f9c8a2c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFo /// public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricPotentialUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVolts(x.Volts + y.Volts)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider pr /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricPotential); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricPotentialUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cul /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricPotentialUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index f45d171288..cb9b5e3f19 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] I /// public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricPotentialAcUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltsAc(x.VoltsAc + y.VoltsAc)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricPotentialAc); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricPotentialAcUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialAcUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialAcUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricPotentialAcUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialAcUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 49b4cd99fc..157ed29891 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] I /// public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricPotentialDcUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltsDc(x.VoltsDc + y.VoltsDc)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricPotentialDc); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricPotentialDcUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialDcUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialDcUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricPotentialDcUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialDcUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index 78999740f5..1fea365dab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IF /// public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricResistanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromOhms(x.Ohms + y.Ohms)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider p /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricResistance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricResistanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricResistanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricResistanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index 974ed78d36..fb6be91793 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] I /// public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ElectricResistivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromOhmMeters(x.OhmMeters + y.OhmMeters)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ElectricResistivity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ElectricResistivityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricResistivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ElectricResistivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 858b4dab8e..3482ceb297 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvide /// public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - EnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoules(x.Joules + y.Joules)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Energy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static EnergyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out EnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == EnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 67aec88196..1635b3a002 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvid /// public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - EntropyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerKelvin(x.JoulesPerKelvin + y.JoulesPerKelvin)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Entropy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static EntropyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EntropyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out EntropyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == EntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index f77b5517fc..7af1fe358d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider /// public static Force Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ForceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtons(x.Newtons + y.Newtons)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Force Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Force); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ForceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ForceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ForceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index fe2a36ad69..91ac577409 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IForm /// public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ForceChangeRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonsPerSecond(x.NewtonsPerSecond + y.NewtonsPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider prov /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ForceChangeRate); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ForceChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ForceChangeRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ForceChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index f99af625c2..60f2ae4175 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IForma /// public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ForcePerLengthUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonsPerMeter(x.NewtonsPerMeter + y.NewtonsPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ForcePerLength); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ForcePerLengthUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForcePerLengthUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ForcePerLengthUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ForcePerLengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForcePerLengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 808ae842de..15372682d8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProv /// public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - FrequencyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromHertz(x.Hertz + y.Hertz)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Frequency); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static FrequencyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static FrequencyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out FrequencyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == FrequencyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized FrequencyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 4a536af266..3e1993d621 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvi /// public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - HeatFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerSquareMeter(x.WattsPerSquareMeter + y.WattsPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(HeatFlux); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static HeatFluxUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == HeatFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 782c372609..3331bad989 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul /// public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - HeatTransferCoefficientUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerSquareMeterKelvin(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(HeatTransferCoefficient); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static HeatTransferCoefficientUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] stri /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatTransferCoefficientUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTransferCoefficientUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == HeatTransferCoefficientUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatTransferCoefficientUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 91f95e532d..dd15c12d66 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatPr /// public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - IlluminanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromLux(x.Lux + y.Lux)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Illuminance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static IlluminanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureNa /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IlluminanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out IlluminanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == IlluminanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IlluminanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index fc2a2db57d..e78fe76622 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr /// public static Information Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - InformationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromBits(x.Bits + y.Bits)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Information Parse(string str, [CanBeNull] IFormatProvider provider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Information); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static InformationUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureNa /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static InformationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out InformationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == InformationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 8125249276..6ff5a850bc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatPro /// public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - IrradianceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerSquareMeter(x.WattsPerSquareMeter + y.WattsPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Irradiance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static IrradianceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureNam /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradianceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out IrradianceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == IrradianceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradianceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 9de210c9e1..e0be2e850c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatPr /// public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - IrradiationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerSquareMeter(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Irradiation); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static IrradiationUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureNa /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradiationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out IrradiationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == IrradiationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradiationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index 89b7292c8d..f00c4de6c0 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IF /// public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - KinematicViscosityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSquareMetersPerSecond(x.SquareMetersPerSecond + y.SquareMetersPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider p /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(KinematicViscosity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static KinematicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static KinematicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out KinematicViscosityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == KinematicViscosityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized KinematicViscosityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index b8f2e7c54e..5890c5290e 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProv /// public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LapseRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDegreesCelciusPerKilometer(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(LapseRate); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LapseRateUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LapseRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out LapseRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LapseRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LapseRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index affe48ffb6..c5b210b857 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvide /// public static Length Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LengthUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMeters(x.Meters + y.Meters)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Length Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Length); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LengthUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LengthUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out LengthUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index eddeb0487c..6451de8caa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -167,17 +167,7 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider /// public static Level Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LevelUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecibels(x.Decibels + y.Decibels)); + return ParseInternal(str, provider); } /// @@ -186,39 +176,28 @@ public static Level Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Level); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LevelUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -226,27 +205,14 @@ public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LevelUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out LevelUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LevelUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 9c7d0fa666..6c35aff755 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormat /// public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LinearDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerMeter(x.KilogramsPerMeter + y.KilogramsPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(LinearDensity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LinearDensityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string culture /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LinearDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out LinearDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LinearDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LinearDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index a7cdd9f6e3..4baca6ab60 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatP /// public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LuminousFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromLumens(x.Lumens + y.Lumens)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(LuminousFlux); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LuminousFluxUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureN /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out LuminousFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LuminousFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index e4273f49a0..891bb06996 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFo /// public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - LuminousIntensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCandela(x.Candela + y.Candela)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider pr /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(LuminousIntensity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LuminousIntensityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cul /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousIntensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out LuminousIntensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == LuminousIntensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousIntensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 4f6410d595..072de3398b 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormat /// public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MagneticFieldUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromTeslas(x.Teslas + y.Teslas)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MagneticField); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MagneticFieldUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string culture /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFieldUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MagneticFieldUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MagneticFieldUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFieldUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 004a649b85..066d3140ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatP /// public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MagneticFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWebers(x.Webers + y.Webers)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MagneticFlux); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MagneticFluxUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureN /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MagneticFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MagneticFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 0b89647188..838dded44e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormat /// public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MagnetizationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromAmperesPerMeter(x.AmperesPerMeter + y.AmperesPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Magnetization); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MagnetizationUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string culture /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagnetizationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MagnetizationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MagnetizationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagnetizationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index ef690ea9e7..24f2b22b8f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider /// public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilograms(x.Kilograms + y.Kilograms)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Mass); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MassUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MassUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 1028bec32c..c13aa7b743 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvi /// public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassFlowUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromGramsPerSecond(x.GramsPerSecond + y.GramsPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MassFlow); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MassFlowUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFlowUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MassFlowUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassFlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index d158b77d95..591732027d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvi /// public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassFluxUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerSecondPerSquareMeter(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MassFlux); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MassFluxUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFluxUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MassFluxUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index b1d3435bdf..e8025e9218 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] I /// public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MassMomentOfInertiaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramSquareMeters(x.KilogramSquareMeters + y.KilogramSquareMeters)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MassMomentOfInertia); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MassMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MassMomentOfInertiaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MassMomentOfInertiaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassMomentOfInertiaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 1bb371ad77..c19ce85b47 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatPr /// public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerMole(x.JoulesPerMole + y.JoulesPerMole)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MolarEnergy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MolarEnergyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureNa /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index a65e4cda72..3e0c567f89 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatP /// public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarEntropyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerMoleKelvin(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MolarEntropy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MolarEntropyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureN /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEntropyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarEntropyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarEntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 5ec81eb213..8359bcd7f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProv /// public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarMassUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKilogramsPerMole(x.KilogramsPerMole + y.KilogramsPerMole)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(MolarMass); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MolarMassUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarMassUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarMassUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarMassUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarMassUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 5a119af8d3..9f29e99f44 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvi /// public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - MolarityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMolesPerCubicMeter(x.MolesPerCubicMeter + y.MolesPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Molarity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static MolarityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == MolarityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 1d5ad93d6d..8c27d18663 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatP /// public static Permeability Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PermeabilityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromHenriesPerMeter(x.HenriesPerMeter + y.HenriesPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Permeability Parse(string str, [CanBeNull] IFormatProvider provide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Permeability); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static PermeabilityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureN /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermeabilityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out PermeabilityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PermeabilityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermeabilityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 70ff35b4bd..45a078a8be 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatP /// public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PermittivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromFaradsPerMeter(x.FaradsPerMeter + y.FaradsPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Permittivity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static PermittivityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureN /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermittivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out PermittivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PermittivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermittivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 443733eac9..3621a1c702 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider /// public static Power Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PowerUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWatts(x.Watts + y.Watts)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Power Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Power); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static PowerUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out PowerUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 5482e33348..31e670a0dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatP /// public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PowerDensityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerCubicMeter(x.WattsPerCubicMeter + y.WattsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(PowerDensity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static PowerDensityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureN /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerDensityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out PowerDensityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PowerDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 77191aecd0..b2d1f1c0ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -167,17 +167,7 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatPro /// public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PowerRatioUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecibelWatts(x.DecibelWatts + y.DecibelWatts)); + return ParseInternal(str, provider); } /// @@ -186,39 +176,28 @@ public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(PowerRatio); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static PowerRatioUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -226,27 +205,14 @@ public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureNam /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerRatioUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out PowerRatioUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PowerRatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerRatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index e84ab74bc8..cafceace96 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvi /// public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PressureUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromPascals(x.Pascals + y.Pascals)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Pressure); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static PressureUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out PressureUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PressureUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 98bf53bbbd..a994f15ca0 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IF /// public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - PressureChangeRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromPascalsPerSecond(x.PascalsPerSecond + y.PascalsPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider p /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(PressureChangeRate); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static PressureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out PressureChangeRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == PressureChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index a627e7be80..35b06ba59a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider /// public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RatioUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDecimalFractions(x.DecimalFractions + y.DecimalFractions)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Ratio); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static RatioUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RatioUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out RatioUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index d92acc5f57..7db8605a22 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IForma /// public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ReactiveEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltampereReactiveHours(x.VoltampereReactiveHours + y.VoltampereReactiveHours)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ReactiveEnergy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ReactiveEnergyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactiveEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ReactiveEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ReactiveEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactiveEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index 45ec1844c5..0fdceb9a43 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormat /// public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ReactivePowerUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromVoltamperesReactive(x.VoltamperesReactive + y.VoltamperesReactive)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ReactivePower); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ReactivePowerUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string culture /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactivePowerUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ReactivePowerUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ReactivePowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactivePowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 41b084d2d0..ace547f299 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull /// public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalAccelerationUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromRadiansPerSecondSquared(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvid /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(RotationalAcceleration); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static RotationalAccelerationUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] strin /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalAccelerationUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalAccelerationUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalAccelerationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalAccelerationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index ab81a13b9a..8ff386ae37 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IForm /// public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalSpeedUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromRadiansPerSecond(x.RadiansPerSecond + y.RadiansPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider prov /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(RotationalSpeed); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static RotationalSpeedUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalSpeedUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalSpeedUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalSpeedUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalSpeedUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index 5529da419e..ea2a46733f 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] I /// public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalStiffnessUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonMetersPerRadian(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(RotationalStiffness); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static RotationalStiffnessUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalStiffnessUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalStiffnessUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index e5e2dd73a4..6195452621 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can /// public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - RotationalStiffnessPerLengthUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonMetersPerRadianPerMeter(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormat /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(RotationalStiffnessPerLength); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalStiffnessPerLengthUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == RotationalStiffnessPerLengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessPerLengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 096a0ff8d1..4aea67061b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatPro /// public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SolidAngleUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSteradians(x.Steradians + y.Steradians)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(SolidAngle); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static SolidAngleUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureNam /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SolidAngleUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out SolidAngleUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SolidAngleUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SolidAngleUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index c8c029e3c5..3b1a92cc76 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IForma /// public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificEnergyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerKilogram(x.JoulesPerKilogram + y.JoulesPerKilogram)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(SpecificEnergy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static SpecificEnergyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificEnergyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index ee4e4a200c..e8aa120bbd 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IForm /// public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificEntropyUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromJoulesPerKilogramKelvin(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider prov /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(SpecificEntropy); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static SpecificEntropyUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultu /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEntropyUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificEntropyUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificEntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 7fa18edac4..58b9339a91 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IForma /// public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificVolumeUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMetersPerKilogram(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(SpecificVolume); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static SpecificVolumeUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificVolumeUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificVolumeUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificVolumeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificVolumeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 2afcec90b2..2df6fdf98d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IForma /// public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpecificWeightUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonsPerCubicMeter(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provi /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(SpecificWeight); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static SpecificWeightUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultur /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificWeightUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificWeightUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpecificWeightUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificWeightUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 1c89926821..1acc6c2f5e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider /// public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - SpeedUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromMetersPerSecond(x.MetersPerSecond + y.MetersPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Speed); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static SpeedUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpeedUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == SpeedUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpeedUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 2fd541ddba..56dc7ce9d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -120,17 +120,7 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatPr /// public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TemperatureUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKelvins(x.Kelvins + y.Kelvins)); + return ParseInternal(str, provider); } /// @@ -139,39 +129,28 @@ public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Temperature); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static TemperatureUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -179,27 +158,14 @@ public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureNa /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TemperatureUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 7e53c56fd0..bcb70fb0a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] /// public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TemperatureChangeRateUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromDegreesCelsiusPerSecond(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvide /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(TemperatureChangeRate); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static TemperatureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureChangeRateUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TemperatureChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index db1081453e..a7f3141437 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFor /// public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TemperatureDeltaUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromKelvins(x.Kelvins + y.Kelvins)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider pro /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(TemperatureDelta); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static TemperatureDeltaUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cult /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureDeltaUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureDeltaUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TemperatureDeltaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureDeltaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 837c5cb743..7992a4505e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] I /// public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ThermalConductivityUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromWattsPerMeterKelvin(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ThermalConductivity); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ThermalConductivityUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string c /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalConductivityUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ThermalConductivityUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ThermalConductivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalConductivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 3f292a7c8d..b97d9e6b7b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFo /// public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - ThermalResistanceUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromSquareMeterKelvinsPerKilowatt(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider pr /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(ThermalResistance); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static ThermalResistanceUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cul /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalResistanceUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out ThermalResistanceUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == ThermalResistanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalResistanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 2af13bb0b7..d16002ecda 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvide /// public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - TorqueUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromNewtonMeters(x.NewtonMeters + y.NewtonMeters)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Torque); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static TorqueUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TorqueUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out TorqueUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == TorqueUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TorqueUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 1f994609a1..2b230be959 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvi /// public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - VitaminAUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromInternationalUnits(x.InternationalUnits + y.InternationalUnits)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(VitaminA); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static VitaminAUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VitaminAUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out VitaminAUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == VitaminAUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VitaminAUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 333fb49dbb..4775fd8baf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvide /// public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - VolumeUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMeters(x.CubicMeters + y.CubicMeters)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(Volume); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static VolumeUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out VolumeUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == VolumeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 816a12a8f2..83f543ccb8 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -159,17 +159,7 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatPro /// public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - VolumeFlowUnit parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => FromCubicMetersPerSecond(x.CubicMetersPerSecond + y.CubicMetersPerSecond)); + return ParseInternal(str, provider); } /// @@ -178,39 +168,28 @@ public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default(VolumeFlow); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static VolumeFlowUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -218,27 +197,14 @@ public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureNam /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeFlowUnit ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out VolumeFlowUnit unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); - - if (unit == VolumeFlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeFlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index b39e85678a..b9eb6e5f01 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -5,6 +5,7 @@ $baseType = $quantity.BaseType; $baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } $baseUnitSingularName = $baseUnit.SingularName + $baseUnitPluralName = $baseUnit.PluralName $unitEnumName = "$quantityName" + "Unit" # Base dimensions @@ -417,7 +418,7 @@ if ($obsoleteAttribute) /// public static $quantityName Parse(string str) { - return Parse(str, null); + return ParseInternal(str, null); } /// @@ -430,7 +431,7 @@ if ($obsoleteAttribute) /// public static bool TryParse([CanBeNull] string str, out $quantityName result) { - return TryParse(str, null, out result); + return TryParseInternal(str, null, out result); } /// @@ -444,7 +445,140 @@ if ($obsoleteAttribute) /// Error parsing string. public static $unitEnumName ParseUnit(string str) { - return ParseUnit(str, (IFormatProvider)null); + return ParseUnitInternal(str, null); + } + + public static bool TryParseUnit(string str, out $unitEnumName unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + internal static $quantityName ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.Parse<$quantityName, $unitEnumName>(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2) + { + var parsedValue = double.Parse(value, formatProvider2); + var parsedUnit = ParseUnitInternal(unit, formatProvider2); + return From(parsedValue, parsedUnit); + }, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit)); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) + { + result = default($quantityName); + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? UnitSystem.DefaultCulture; + + return QuantityParser.TryParse<$quantityName, $unitEnumName>(str, provider, + delegate(string value, string unit, IFormatProvider formatProvider2, out $quantityName parsed$quantityName ) + { + parsed$quantityName = default($quantityName); + + if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) + return false; + + if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) + return false; + + parsed$quantityName = From(parsedValue, parsedUnit); + return true; + }, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit), out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + internal static $unitEnumName ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unitSystem = UnitSystem.GetCached(provider); + var unit = unitSystem.Parse<$unitEnumName>(str.Trim()); + + if (unit == $unitEnumName.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized $unitEnumName."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out $unitEnumName unit) + { + unit = $unitEnumName.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + var unitSystem = UnitSystem.GetCached(provider); + if(!unitSystem.TryParse<$unitEnumName>(str.Trim(), out unit)) + return false; + + if(unit == $unitEnumName.Undefined) + return false; + + return true; } #endregion diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index a3fbb86bed..1e5fe12de7 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -178,17 +178,7 @@ namespace UnitsNet /// public static $quantityName Parse(string str, [CanBeNull] IFormatProvider provider) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? UnitSystem.DefaultCulture; - - return QuantityParser.Parse<$quantityName, $unitEnumName>(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - $unitEnumName parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From$baseUnitPluralName(x.$baseUnitPluralName + y.$baseUnitPluralName)); + return ParseInternal(str, provider); } /// @@ -197,39 +187,28 @@ namespace UnitsNet /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. + /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) { - provider = provider ?? UnitSystem.DefaultCulture; - - try - { - result = Parse(str, provider); - return true; - } - catch - { - result = default($quantityName); - return false; - } + return TryParseInternal(str, provider, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - [Obsolete("Use overload that takes IFormatProvider instead of culture name. This method was only added to support WindowsRuntimeComponent and will be removed from .NET Framework targets.")] - public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) + public static $unitEnumName ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + return ParseUnitInternal(str, provider); } /// @@ -237,27 +216,14 @@ namespace UnitsNet /// /// String to parse. Typically in the form: {number} {unit} /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static $unitEnumName ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, IFormatProvider provider, out $unitEnumName unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse<$unitEnumName>(str.Trim()); - - if (unit == $unitEnumName.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized $unitEnumName."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index f3e1538611..c644f60676 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -133,13 +133,7 @@ namespace UnitsNet // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return QuantityParser.Parse<$quantityName, $unitEnumName>(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - double parsedValue = double.Parse(value, formatProvider2); - $unitEnumName parsedUnit = ParseUnit(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From$baseUnitPluralName(x.$baseUnitPluralName + y.$baseUnitPluralName)); + return ParseInternal(str, provider); } /// @@ -153,16 +147,10 @@ namespace UnitsNet /// public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out $quantityName result) { - try - { - result = Parse(str, cultureName); - return true; - } - catch - { - result = default($quantityName); - return false; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return TryParseInternal(str, provider, out result); } /// @@ -177,35 +165,28 @@ namespace UnitsNet /// Error parsing string. public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) { - return ParseUnit(str, cultureName == null ? null : new CultureInfo(cultureName)); + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + + return ParseUnitInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// The parsed unit if successful. + /// True if successful, otherwise false. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - internal static $unitEnumName ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out $unitEnumName unit) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse<$unitEnumName>(str.Trim()); - - if (unit == $unitEnumName.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized $unitEnumName."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } + // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx + IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); - return unit; + return TryParseUnitInternal(str, provider, out unit); } #endregion From 2aa68471a6155ab33392acb66722d1257ecd6329 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 8 Oct 2018 16:16:52 -0400 Subject: [PATCH 047/131] Don't use try/catch for Tryparse in UnitSystem (#508) * Don't use try/catch for Tryparse in UnitSystem --- UnitsNet/CustomCode/UnitSystem.cs | 46 ++++++++++++++----------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs index ea3f4bac28..ed24837d60 100644 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ b/UnitsNet/CustomCode/UnitSystem.cs @@ -28,6 +28,8 @@ using UnitsNet.InternalHelpers; using UnitsNet.Units; +using AbbreviationMap = System.Collections.Generic.Dictionary>; + // ReSharper disable once CheckNamespace namespace UnitsNet { @@ -411,16 +413,13 @@ void MapUnitToAbbreviation(Type unitType, int unitValue, [NotNull] params string bool TryParse(string unitAbbreviation, out TUnitType unit) where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable { - try - { - unit = (TUnitType) Parse(unitAbbreviation, typeof(TUnitType)); - return true; - } - catch - { - unit = default(TUnitType); + unit = default(TUnitType); + + if(!TryParse(unitAbbreviation, typeof(TUnitType), out var unitObj)) return false; - } + + unit = (TUnitType)unitObj; + return true; } /// @@ -433,16 +432,20 @@ bool TryParse(string unitAbbreviation, out TUnitType unit) [PublicAPI] public bool TryParse(string unitAbbreviation, Type unitType, out object unit) { - try - { - unit = Parse(unitAbbreviation, unitType); - return true; - } - catch - { - unit = GetDefault(unitType); + unit = GetDefault(unitType); + + if (!_unitTypeToAbbrevToUnitValue.TryGetValue(unitType, out var abbrevToUnitValue)) return false; - } + + var unitValues = abbrevToUnitValue.TryGetValue(unitAbbreviation, out var unitIntValues) + ? unitIntValues.Distinct().Cast().ToList() + : new List(); + + if(unitValues.Count != 1) + return false; + + unit = unitValues[0]; + return true; } /// @@ -542,13 +545,6 @@ private void LoadDefaultAbbreviations([NotNull] IFormatProvider culture) } } - /// - /// Avoids having too many nested generics for code clarity - /// - private class AbbreviationMap : Dictionary> - { - } - /// /// Get default(Type) of /// From ff76c27b04469ac73ef7d9dcfa717c71cc9cd182 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 9 Oct 2018 17:12:47 -0400 Subject: [PATCH 048/131] Updating language version to C# 7.3 to allow for Enum constraints (#509) --- ...Net.Serialization.JsonNet.CompatibilityTests.csproj | 1 + .../UnitsNet.Serialization.JsonNet.Tests.csproj | 1 + .../UnitsNet.Serialization.JsonNet.Signed.csproj | 1 + .../UnitsNet.Serialization.JsonNet.csproj | 3 +++ UnitsNet.Tests/UnitSystemTests.cs | 2 +- UnitsNet.Tests/UnitsNet.Tests.csproj | 1 + .../UnitsNet.WindowsRuntimeComponent.csproj | 1 + UnitsNet/CustomCode/UnitSystem.cs | 10 +++++----- UnitsNet/UnitFormatter.cs | 4 ++-- UnitsNet/UnitsNet.Signed.csproj | 1 + UnitsNet/UnitsNet.csproj | 3 +++ 11 files changed, 20 insertions(+), 8 deletions(-) diff --git a/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj b/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj index bac5624720..af1807ea71 100644 --- a/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj +++ b/UnitsNet.Serialization.JsonNet.CompatibilityTests/UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj @@ -3,6 +3,7 @@ netcoreapp2.0 UnitsNet.Serialization.JsonNet.CompatibilityTests + 7.3 diff --git a/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj b/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj index e019de3970..4f7084831d 100644 --- a/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj +++ b/UnitsNet.Serialization.JsonNet.Tests/UnitsNet.Serialization.JsonNet.Tests.csproj @@ -3,6 +3,7 @@ netcoreapp2.0 UnitsNet.Serialization.JsonNet.Tests + 7.3 diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj index 7bd5d4bbd4..217a0f9674 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj @@ -12,6 +12,7 @@ SIGNED true $(MSBuildProjectDirectory)\..\UnitsNet.snk + 7.3 diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj index e2f31d9cec..9e9c93daff 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj @@ -1,5 +1,8 @@  + + 7.3 + diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index 002c691134..bc6c1d991f 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -70,7 +70,7 @@ private enum CustomUnit private static IEnumerable GetUnitTypesWithMissingAbbreviations(string cultureName, IEnumerable unitValues) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable + where TUnitType : Enum { UnitSystem unitSystem = UnitSystem.GetCached(GetCulture(cultureName)); diff --git a/UnitsNet.Tests/UnitsNet.Tests.csproj b/UnitsNet.Tests/UnitsNet.Tests.csproj index 42ac56c225..f85034390c 100644 --- a/UnitsNet.Tests/UnitsNet.Tests.csproj +++ b/UnitsNet.Tests/UnitsNet.Tests.csproj @@ -4,6 +4,7 @@ netcoreapp2.0 UnitsNet.Tests CS1701;CS1702;CS1705;CS0618 + 7.3 diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj index 645817f4cf..0162ca3fff 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj @@ -19,6 +19,7 @@ false ..\Artifacts\UnitsNet.WindowsRuntimeComponent CS1701;CS1702;CS1705;CS0618;CS0809;CS1591 + 7.3 AnyCPU diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs index ed24837d60..093b996d83 100644 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ b/UnitsNet/CustomCode/UnitSystem.cs @@ -242,7 +242,7 @@ static UnitSystem GetCached([CanBeNull] IFormatProvider cultureInfo) public #endif TUnitType Parse(string unitAbbreviation) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable + where TUnitType : Enum { return (TUnitType) Parse(unitAbbreviation, typeof(TUnitType)); } @@ -297,7 +297,7 @@ public object Parse(string unitAbbreviation, Type unitType) public #endif string GetDefaultAbbreviation(TUnitType unit) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable + where TUnitType : Enum { return GetAllAbbreviations(unit).First(); } @@ -332,7 +332,7 @@ public string GetDefaultAbbreviation(Type unitType, int unitValue) public #endif void MapUnitToAbbreviation(TUnitType unit, params string[] abbreviations) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable + where TUnitType : Enum { // Assuming TUnitType is an enum, this conversion is safe. Seems not possible to enforce this today. // Src: http://stackoverflow.com/questions/908543/how-to-convert-from-system-enum-to-base-integer @@ -411,7 +411,7 @@ void MapUnitToAbbreviation(Type unitType, int unitValue, [NotNull] params string public #endif bool TryParse(string unitAbbreviation, out TUnitType unit) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable + where TUnitType : Enum { unit = default(TUnitType); @@ -462,7 +462,7 @@ public bool TryParse(string unitAbbreviation, Type unitType, out object unit) public #endif string[] GetAllAbbreviations(TUnitType unit) - where TUnitType : /*Enum constraint hack*/ struct, IComparable, IFormattable + where TUnitType : Enum { Dictionary> unitValueToAbbrevs; List abbrevs; diff --git a/UnitsNet/UnitFormatter.cs b/UnitsNet/UnitFormatter.cs index ef1cfbfc5f..a8387d584d 100644 --- a/UnitsNet/UnitFormatter.cs +++ b/UnitsNet/UnitFormatter.cs @@ -90,10 +90,10 @@ private static bool NearlyEqual(double a, double b) /// The list of format arguments. /// An array of ToString format arguments. public static object[] GetFormatArgs(TUnitType unit, double value, [CanBeNull] IFormatProvider culture, IEnumerable args) - where TUnitType : struct, IComparable, IFormattable + where TUnitType : Enum { string abbreviation = UnitSystem.GetCached(culture).GetDefaultAbbreviation(typeof(TUnitType), Convert.ToInt32(unit)); return new object[] {value, abbreviation}.Concat(args).ToArray(); } } -} \ No newline at end of file +} diff --git a/UnitsNet/UnitsNet.Signed.csproj b/UnitsNet/UnitsNet.Signed.csproj index dd4c51e7c7..feef296be7 100644 --- a/UnitsNet/UnitsNet.Signed.csproj +++ b/UnitsNet/UnitsNet.Signed.csproj @@ -12,6 +12,7 @@ SIGNED true $(MSBuildProjectDirectory)\..\UnitsNet.snk + 7.3 diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index ed28e5fbcf..9c83b4a665 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -1,3 +1,6 @@  + + 7.3 + From 3c0b22a4675f9cfa99518f4f7ef02e9b0dac43fe Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 10 Oct 2018 18:28:04 -0400 Subject: [PATCH 049/131] Simplify Parse/TryParse methods They were doing the same thing, so simplifying them by passing the ParseUnit and From methods as delegates to QuantityParser. --- .../Quantities/Acceleration.Common.g.cs | 36 ++------- .../Quantities/AmountOfSubstance.Common.g.cs | 36 ++------- .../Quantities/AmplitudeRatio.Common.g.cs | 36 ++------- .../Quantities/Angle.Common.g.cs | 36 ++------- .../Quantities/ApparentEnergy.Common.g.cs | 36 ++------- .../Quantities/ApparentPower.Common.g.cs | 36 ++------- .../GeneratedCode/Quantities/Area.Common.g.cs | 36 ++------- .../Quantities/AreaDensity.Common.g.cs | 36 ++------- .../AreaMomentOfInertia.Common.g.cs | 36 ++------- .../Quantities/BitRate.Common.g.cs | 36 ++------- .../BrakeSpecificFuelConsumption.Common.g.cs | 36 ++------- .../Quantities/Capacitance.Common.g.cs | 36 ++------- .../Quantities/Density.Common.g.cs | 36 ++------- .../Quantities/Duration.Common.g.cs | 36 ++------- .../Quantities/DynamicViscosity.Common.g.cs | 36 ++------- .../Quantities/ElectricAdmittance.Common.g.cs | 36 ++------- .../Quantities/ElectricCharge.Common.g.cs | 36 ++------- .../ElectricChargeDensity.Common.g.cs | 36 ++------- .../ElectricConductance.Common.g.cs | 36 ++------- .../ElectricConductivity.Common.g.cs | 36 ++------- .../Quantities/ElectricCurrent.Common.g.cs | 36 ++------- .../ElectricCurrentDensity.Common.g.cs | 36 ++------- .../ElectricCurrentGradient.Common.g.cs | 36 ++------- .../Quantities/ElectricField.Common.g.cs | 36 ++------- .../Quantities/ElectricInductance.Common.g.cs | 36 ++------- .../Quantities/ElectricPotential.Common.g.cs | 36 ++------- .../ElectricPotentialAc.Common.g.cs | 36 ++------- .../ElectricPotentialDc.Common.g.cs | 36 ++------- .../Quantities/ElectricResistance.Common.g.cs | 36 ++------- .../ElectricResistivity.Common.g.cs | 36 ++------- .../Quantities/Energy.Common.g.cs | 36 ++------- .../Quantities/Entropy.Common.g.cs | 36 ++------- .../Quantities/Force.Common.g.cs | 36 ++------- .../Quantities/ForceChangeRate.Common.g.cs | 36 ++------- .../Quantities/ForcePerLength.Common.g.cs | 36 ++------- .../Quantities/Frequency.Common.g.cs | 36 ++------- .../Quantities/HeatFlux.Common.g.cs | 36 ++------- .../HeatTransferCoefficient.Common.g.cs | 36 ++------- .../Quantities/Illuminance.Common.g.cs | 36 ++------- .../Quantities/Information.Common.g.cs | 36 ++------- .../Quantities/Irradiance.Common.g.cs | 36 ++------- .../Quantities/Irradiation.Common.g.cs | 36 ++------- .../Quantities/KinematicViscosity.Common.g.cs | 36 ++------- .../Quantities/LapseRate.Common.g.cs | 36 ++------- .../Quantities/Length.Common.g.cs | 36 ++------- .../Quantities/Level.Common.g.cs | 36 ++------- .../Quantities/LinearDensity.Common.g.cs | 36 ++------- .../Quantities/LuminousFlux.Common.g.cs | 36 ++------- .../Quantities/LuminousIntensity.Common.g.cs | 36 ++------- .../Quantities/MagneticField.Common.g.cs | 36 ++------- .../Quantities/MagneticFlux.Common.g.cs | 36 ++------- .../Quantities/Magnetization.Common.g.cs | 36 ++------- .../GeneratedCode/Quantities/Mass.Common.g.cs | 36 ++------- .../Quantities/MassFlow.Common.g.cs | 36 ++------- .../Quantities/MassFlux.Common.g.cs | 36 ++------- .../MassMomentOfInertia.Common.g.cs | 36 ++------- .../Quantities/MolarEnergy.Common.g.cs | 36 ++------- .../Quantities/MolarEntropy.Common.g.cs | 36 ++------- .../Quantities/MolarMass.Common.g.cs | 36 ++------- .../Quantities/Molarity.Common.g.cs | 36 ++------- .../Quantities/Permeability.Common.g.cs | 36 ++------- .../Quantities/Permittivity.Common.g.cs | 36 ++------- .../Quantities/Power.Common.g.cs | 36 ++------- .../Quantities/PowerDensity.Common.g.cs | 36 ++------- .../Quantities/PowerRatio.Common.g.cs | 36 ++------- .../Quantities/Pressure.Common.g.cs | 36 ++------- .../Quantities/PressureChangeRate.Common.g.cs | 36 ++------- .../Quantities/Ratio.Common.g.cs | 36 ++------- .../Quantities/ReactiveEnergy.Common.g.cs | 36 ++------- .../Quantities/ReactivePower.Common.g.cs | 36 ++------- .../RotationalAcceleration.Common.g.cs | 36 ++------- .../Quantities/RotationalSpeed.Common.g.cs | 36 ++------- .../RotationalStiffness.Common.g.cs | 36 ++------- .../RotationalStiffnessPerLength.Common.g.cs | 36 ++------- .../Quantities/SolidAngle.Common.g.cs | 36 ++------- .../Quantities/SpecificEnergy.Common.g.cs | 36 ++------- .../Quantities/SpecificEntropy.Common.g.cs | 36 ++------- .../Quantities/SpecificVolume.Common.g.cs | 36 ++------- .../Quantities/SpecificWeight.Common.g.cs | 36 ++------- .../Quantities/Speed.Common.g.cs | 36 ++------- .../Quantities/Temperature.Common.g.cs | 36 ++------- .../TemperatureChangeRate.Common.g.cs | 36 ++------- .../Quantities/TemperatureDelta.Common.g.cs | 36 ++------- .../ThermalConductivity.Common.g.cs | 36 ++------- .../Quantities/ThermalResistance.Common.g.cs | 36 ++------- .../Quantities/Torque.Common.g.cs | 36 ++------- .../Quantities/VitaminA.Common.g.cs | 36 ++------- .../Quantities/Volume.Common.g.cs | 36 ++------- .../Quantities/VolumeFlow.Common.g.cs | 36 ++------- .../Acceleration.WindowsRuntimeComponent.g.cs | 3 - ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 3 - ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 3 - .../Angle.WindowsRuntimeComponent.g.cs | 3 - ...pparentEnergy.WindowsRuntimeComponent.g.cs | 3 - ...ApparentPower.WindowsRuntimeComponent.g.cs | 3 - .../Area.WindowsRuntimeComponent.g.cs | 3 - .../AreaDensity.WindowsRuntimeComponent.g.cs | 3 - ...mentOfInertia.WindowsRuntimeComponent.g.cs | 3 - .../BitRate.WindowsRuntimeComponent.g.cs | 3 - ...elConsumption.WindowsRuntimeComponent.g.cs | 3 - .../Capacitance.WindowsRuntimeComponent.g.cs | 3 - .../Density.WindowsRuntimeComponent.g.cs | 3 - .../Duration.WindowsRuntimeComponent.g.cs | 3 - ...amicViscosity.WindowsRuntimeComponent.g.cs | 3 - ...ricAdmittance.WindowsRuntimeComponent.g.cs | 3 - ...lectricCharge.WindowsRuntimeComponent.g.cs | 3 - ...ChargeDensity.WindowsRuntimeComponent.g.cs | 3 - ...icConductance.WindowsRuntimeComponent.g.cs | 3 - ...cConductivity.WindowsRuntimeComponent.g.cs | 3 - ...ectricCurrent.WindowsRuntimeComponent.g.cs | 3 - ...urrentDensity.WindowsRuntimeComponent.g.cs | 3 - ...rrentGradient.WindowsRuntimeComponent.g.cs | 3 - ...ElectricField.WindowsRuntimeComponent.g.cs | 3 - ...ricInductance.WindowsRuntimeComponent.g.cs | 3 - ...tricPotential.WindowsRuntimeComponent.g.cs | 3 - ...icPotentialAc.WindowsRuntimeComponent.g.cs | 3 - ...icPotentialDc.WindowsRuntimeComponent.g.cs | 3 - ...ricResistance.WindowsRuntimeComponent.g.cs | 3 - ...icResistivity.WindowsRuntimeComponent.g.cs | 3 - .../Energy.WindowsRuntimeComponent.g.cs | 3 - .../Entropy.WindowsRuntimeComponent.g.cs | 3 - .../Force.WindowsRuntimeComponent.g.cs | 3 - ...rceChangeRate.WindowsRuntimeComponent.g.cs | 3 - ...orcePerLength.WindowsRuntimeComponent.g.cs | 3 - .../Frequency.WindowsRuntimeComponent.g.cs | 3 - .../HeatFlux.WindowsRuntimeComponent.g.cs | 3 - ...erCoefficient.WindowsRuntimeComponent.g.cs | 3 - .../Illuminance.WindowsRuntimeComponent.g.cs | 3 - .../Information.WindowsRuntimeComponent.g.cs | 3 - .../Irradiance.WindowsRuntimeComponent.g.cs | 3 - .../Irradiation.WindowsRuntimeComponent.g.cs | 3 - ...aticViscosity.WindowsRuntimeComponent.g.cs | 3 - .../LapseRate.WindowsRuntimeComponent.g.cs | 3 - .../Length.WindowsRuntimeComponent.g.cs | 3 - .../Level.WindowsRuntimeComponent.g.cs | 3 - ...LinearDensity.WindowsRuntimeComponent.g.cs | 3 - .../LuminousFlux.WindowsRuntimeComponent.g.cs | 3 - ...nousIntensity.WindowsRuntimeComponent.g.cs | 3 - ...MagneticField.WindowsRuntimeComponent.g.cs | 3 - .../MagneticFlux.WindowsRuntimeComponent.g.cs | 3 - ...Magnetization.WindowsRuntimeComponent.g.cs | 3 - .../Mass.WindowsRuntimeComponent.g.cs | 3 - .../MassFlow.WindowsRuntimeComponent.g.cs | 3 - .../MassFlux.WindowsRuntimeComponent.g.cs | 3 - ...mentOfInertia.WindowsRuntimeComponent.g.cs | 3 - .../MolarEnergy.WindowsRuntimeComponent.g.cs | 3 - .../MolarEntropy.WindowsRuntimeComponent.g.cs | 3 - .../MolarMass.WindowsRuntimeComponent.g.cs | 3 - .../Molarity.WindowsRuntimeComponent.g.cs | 3 - .../Permeability.WindowsRuntimeComponent.g.cs | 3 - .../Permittivity.WindowsRuntimeComponent.g.cs | 3 - .../Power.WindowsRuntimeComponent.g.cs | 3 - .../PowerDensity.WindowsRuntimeComponent.g.cs | 3 - .../PowerRatio.WindowsRuntimeComponent.g.cs | 3 - .../Pressure.WindowsRuntimeComponent.g.cs | 3 - ...ureChangeRate.WindowsRuntimeComponent.g.cs | 3 - .../Ratio.WindowsRuntimeComponent.g.cs | 3 - ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 3 - ...ReactivePower.WindowsRuntimeComponent.g.cs | 3 - ...lAcceleration.WindowsRuntimeComponent.g.cs | 3 - ...tationalSpeed.WindowsRuntimeComponent.g.cs | 3 - ...onalStiffness.WindowsRuntimeComponent.g.cs | 3 - ...nessPerLength.WindowsRuntimeComponent.g.cs | 3 - .../SolidAngle.WindowsRuntimeComponent.g.cs | 3 - ...pecificEnergy.WindowsRuntimeComponent.g.cs | 3 - ...ecificEntropy.WindowsRuntimeComponent.g.cs | 3 - ...pecificVolume.WindowsRuntimeComponent.g.cs | 3 - ...pecificWeight.WindowsRuntimeComponent.g.cs | 3 - .../Speed.WindowsRuntimeComponent.g.cs | 3 - .../Temperature.WindowsRuntimeComponent.g.cs | 3 - ...ureChangeRate.WindowsRuntimeComponent.g.cs | 3 - ...peratureDelta.WindowsRuntimeComponent.g.cs | 3 - ...lConductivity.WindowsRuntimeComponent.g.cs | 3 - ...malResistance.WindowsRuntimeComponent.g.cs | 3 - .../Torque.WindowsRuntimeComponent.g.cs | 3 - .../VitaminA.WindowsRuntimeComponent.g.cs | 3 - .../Volume.WindowsRuntimeComponent.g.cs | 3 - .../VolumeFlow.WindowsRuntimeComponent.g.cs | 3 - UnitsNet/CustomCode/QuantityParser.cs | 79 +++++++++++++------ .../Quantities/Acceleration.NetFramework.g.cs | 4 - .../AmountOfSubstance.NetFramework.g.cs | 4 - .../AmplitudeRatio.NetFramework.g.cs | 4 - .../Quantities/Angle.NetFramework.g.cs | 4 - .../ApparentEnergy.NetFramework.g.cs | 4 - .../ApparentPower.NetFramework.g.cs | 4 - .../Quantities/Area.NetFramework.g.cs | 4 - .../Quantities/AreaDensity.NetFramework.g.cs | 4 - .../AreaMomentOfInertia.NetFramework.g.cs | 4 - .../Quantities/BitRate.NetFramework.g.cs | 4 - ...eSpecificFuelConsumption.NetFramework.g.cs | 4 - .../Quantities/Capacitance.NetFramework.g.cs | 4 - .../Quantities/Density.NetFramework.g.cs | 4 - .../Quantities/Duration.NetFramework.g.cs | 4 - .../DynamicViscosity.NetFramework.g.cs | 4 - .../ElectricAdmittance.NetFramework.g.cs | 4 - .../ElectricCharge.NetFramework.g.cs | 4 - .../ElectricChargeDensity.NetFramework.g.cs | 4 - .../ElectricConductance.NetFramework.g.cs | 4 - .../ElectricConductivity.NetFramework.g.cs | 4 - .../ElectricCurrent.NetFramework.g.cs | 4 - .../ElectricCurrentDensity.NetFramework.g.cs | 4 - .../ElectricCurrentGradient.NetFramework.g.cs | 4 - .../ElectricField.NetFramework.g.cs | 4 - .../ElectricInductance.NetFramework.g.cs | 4 - .../ElectricPotential.NetFramework.g.cs | 4 - .../ElectricPotentialAc.NetFramework.g.cs | 4 - .../ElectricPotentialDc.NetFramework.g.cs | 4 - .../ElectricResistance.NetFramework.g.cs | 4 - .../ElectricResistivity.NetFramework.g.cs | 4 - .../Quantities/Energy.NetFramework.g.cs | 4 - .../Quantities/Entropy.NetFramework.g.cs | 4 - .../Quantities/Force.NetFramework.g.cs | 4 - .../ForceChangeRate.NetFramework.g.cs | 4 - .../ForcePerLength.NetFramework.g.cs | 4 - .../Quantities/Frequency.NetFramework.g.cs | 4 - .../Quantities/HeatFlux.NetFramework.g.cs | 4 - .../HeatTransferCoefficient.NetFramework.g.cs | 4 - .../Quantities/Illuminance.NetFramework.g.cs | 4 - .../Quantities/Information.NetFramework.g.cs | 4 - .../Quantities/Irradiance.NetFramework.g.cs | 4 - .../Quantities/Irradiation.NetFramework.g.cs | 4 - .../KinematicViscosity.NetFramework.g.cs | 4 - .../Quantities/LapseRate.NetFramework.g.cs | 4 - .../Quantities/Length.NetFramework.g.cs | 4 - .../Quantities/Level.NetFramework.g.cs | 4 - .../LinearDensity.NetFramework.g.cs | 4 - .../Quantities/LuminousFlux.NetFramework.g.cs | 4 - .../LuminousIntensity.NetFramework.g.cs | 4 - .../MagneticField.NetFramework.g.cs | 4 - .../Quantities/MagneticFlux.NetFramework.g.cs | 4 - .../Magnetization.NetFramework.g.cs | 4 - .../Quantities/Mass.NetFramework.g.cs | 4 - .../Quantities/MassFlow.NetFramework.g.cs | 4 - .../Quantities/MassFlux.NetFramework.g.cs | 4 - .../MassMomentOfInertia.NetFramework.g.cs | 4 - .../Quantities/MolarEnergy.NetFramework.g.cs | 4 - .../Quantities/MolarEntropy.NetFramework.g.cs | 4 - .../Quantities/MolarMass.NetFramework.g.cs | 4 - .../Quantities/Molarity.NetFramework.g.cs | 4 - .../Quantities/Permeability.NetFramework.g.cs | 4 - .../Quantities/Permittivity.NetFramework.g.cs | 4 - .../Quantities/Power.NetFramework.g.cs | 4 - .../Quantities/PowerDensity.NetFramework.g.cs | 4 - .../Quantities/PowerRatio.NetFramework.g.cs | 4 - .../Quantities/Pressure.NetFramework.g.cs | 4 - .../PressureChangeRate.NetFramework.g.cs | 4 - .../Quantities/Ratio.NetFramework.g.cs | 4 - .../ReactiveEnergy.NetFramework.g.cs | 4 - .../ReactivePower.NetFramework.g.cs | 4 - .../RotationalAcceleration.NetFramework.g.cs | 4 - .../RotationalSpeed.NetFramework.g.cs | 4 - .../RotationalStiffness.NetFramework.g.cs | 4 - ...tionalStiffnessPerLength.NetFramework.g.cs | 4 - .../Quantities/SolidAngle.NetFramework.g.cs | 4 - .../SpecificEnergy.NetFramework.g.cs | 4 - .../SpecificEntropy.NetFramework.g.cs | 4 - .../SpecificVolume.NetFramework.g.cs | 4 - .../SpecificWeight.NetFramework.g.cs | 4 - .../Quantities/Speed.NetFramework.g.cs | 4 - .../Quantities/Temperature.NetFramework.g.cs | 4 - .../TemperatureChangeRate.NetFramework.g.cs | 4 - .../TemperatureDelta.NetFramework.g.cs | 4 - .../ThermalConductivity.NetFramework.g.cs | 4 - .../ThermalResistance.NetFramework.g.cs | 4 - .../Quantities/Torque.NetFramework.g.cs | 4 - .../Quantities/VitaminA.NetFramework.g.cs | 4 - .../Quantities/Volume.NetFramework.g.cs | 4 - .../Quantities/VolumeFlow.NetFramework.g.cs | 4 - ...clude-GenerateQuantitySourceCodeCommon.ps1 | 36 ++------- ...GenerateQuantitySourceCodeNetFramework.ps1 | 4 - ...ntitySourceCodeWindowsRuntimeComponent.ps1 | 3 - 271 files changed, 776 insertions(+), 3173 deletions(-) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 44dc8104cc..cba8fe1bce 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -676,19 +673,14 @@ public static bool TryParseUnit(string str, out AccelerationUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit)); } /// @@ -701,7 +693,7 @@ internal static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) { result = default(Acceleration); @@ -710,20 +702,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Acceleration parsedAcceleration ) - { - parsedAcceleration = default(Acceleration); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedAcceleration = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit), out result); } /// @@ -736,7 +716,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static AccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static AccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -764,7 +744,7 @@ internal static AccelerationUnit ParseUnitInternal(string str, IFormatProvider p /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AccelerationUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AccelerationUnit unit) { unit = AccelerationUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index bd5e39bcd5..516b472288 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -698,19 +695,14 @@ public static bool TryParseUnit(string str, out AmountOfSubstanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Moles + y.Moles, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Moles + y.Moles, BaseUnit)); } /// @@ -723,7 +715,7 @@ internal static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatP /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) { result = default(AmountOfSubstance); @@ -732,20 +724,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out AmountOfSubstance parsedAmountOfSubstance ) - { - parsedAmountOfSubstance = default(AmountOfSubstance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedAmountOfSubstance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Moles + y.Moles, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Moles + y.Moles, BaseUnit), out result); } /// @@ -758,7 +738,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -786,7 +766,7 @@ internal static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmountOfSubstanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmountOfSubstanceUnit unit) { unit = AmountOfSubstanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 5da1f9d3d7..86538e528d 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -477,19 +474,14 @@ public static bool TryParseUnit(string str, out AmplitudeRatioUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit)); } /// @@ -502,7 +494,7 @@ internal static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) { result = default(AmplitudeRatio); @@ -511,20 +503,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out AmplitudeRatio parsedAmplitudeRatio ) - { - parsedAmplitudeRatio = default(AmplitudeRatio); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedAmplitudeRatio = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit), out result); } /// @@ -537,7 +517,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -565,7 +545,7 @@ internal static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmplitudeRatioUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmplitudeRatioUnit unit) { unit = AmplitudeRatioUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 6ac9137610..88843462d0 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -697,19 +694,14 @@ public static bool TryParseUnit(string str, out AngleUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Degrees + y.Degrees, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Degrees + y.Degrees, BaseUnit)); } /// @@ -722,7 +714,7 @@ internal static Angle ParseInternal(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) { result = default(Angle); @@ -731,20 +723,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Angle parsedAngle ) - { - parsedAngle = default(Angle); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedAngle = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Degrees + y.Degrees, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Degrees + y.Degrees, BaseUnit), out result); } /// @@ -757,7 +737,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static AngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static AngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -785,7 +765,7 @@ internal static AngleUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AngleUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AngleUnit unit) { unit = AngleUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 9ec6fc65e1..214884fd87 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out ApparentEnergyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) { result = default(ApparentEnergy); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ApparentEnergy parsedApparentEnergy ) - { - parsedApparentEnergy = default(ApparentEnergy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedApparentEnergy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentEnergyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentEnergyUnit unit) { unit = ApparentEnergyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 948e8e1d8d..2017da090e 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -478,19 +475,14 @@ public static bool TryParseUnit(string str, out ApparentPowerUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit)); } /// @@ -503,7 +495,7 @@ internal static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) { result = default(ApparentPower); @@ -512,20 +504,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ApparentPower parsedApparentPower ) - { - parsedApparentPower = default(ApparentPower); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedApparentPower = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit), out result); } /// @@ -538,7 +518,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -566,7 +546,7 @@ internal static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentPowerUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentPowerUnit unit) { unit = ApparentPowerUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 94a4cf7e2b..b14b167d93 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -676,19 +673,14 @@ public static bool TryParseUnit(string str, out AreaUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Area ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Area ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit)); } /// @@ -701,7 +693,7 @@ internal static Area ParseInternal(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) { result = default(Area); @@ -710,20 +702,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Area parsedArea ) - { - parsedArea = default(Area); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedArea = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit), out result); } /// @@ -736,7 +716,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -764,7 +744,7 @@ internal static AreaUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaUnit unit) { unit = AreaUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 939ca16520..80f223686b 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out AreaDensityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) { result = default(AreaDensity); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out AreaDensity parsedAreaDensity ) - { - parsedAreaDensity = default(AreaDensity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedAreaDensity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider pr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaDensityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaDensityUnit unit) { unit = AreaDensityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 81907ff61c..959390b242 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -522,19 +519,14 @@ public static bool TryParseUnit(string str, out AreaMomentOfInertiaUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit)); } /// @@ -547,7 +539,7 @@ internal static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) { result = default(AreaMomentOfInertia); @@ -556,20 +548,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out AreaMomentOfInertia parsedAreaMomentOfInertia ) - { - parsedAreaMomentOfInertia = default(AreaMomentOfInertia); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedAreaMomentOfInertia = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit), out result); } /// @@ -582,7 +562,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -610,7 +590,7 @@ internal static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaMomentOfInertiaUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaMomentOfInertiaUnit unit) { unit = AreaMomentOfInertiaUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index 9ea16d6800..dd5f043cf7 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -961,19 +958,14 @@ public static bool TryParseUnit(string str, out BitRateUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit)); } /// @@ -986,7 +978,7 @@ internal static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) { result = default(BitRate); @@ -995,20 +987,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out BitRate parsedBitRate ) - { - parsedBitRate = default(BitRate); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedBitRate = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit), out result); } /// @@ -1021,7 +1001,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static BitRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static BitRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1049,7 +1029,7 @@ internal static BitRateUnit ParseUnitInternal(string str, IFormatProvider provid /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out BitRateUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out BitRateUnit unit) { unit = BitRateUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index a0968da781..c129254490 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out BrakeSpecificFuelConsumptionUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNul /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) { result = default(BrakeSpecificFuelConsumption); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out BrakeSpecificFuelConsumption parsedBrakeSpecificFuelConsumption ) - { - parsedBrakeSpecificFuelConsumption = default(BrakeSpecificFuelConsumption); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedBrakeSpecificFuelConsumption = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, I /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out BrakeSpecificFuelConsumptionUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out BrakeSpecificFuelConsumptionUnit unit) { unit = BrakeSpecificFuelConsumptionUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index 07e602b6c1..ff900457e8 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out CapacitanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Farads + y.Farads, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Farads + y.Farads, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) { result = default(Capacitance); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Capacitance parsedCapacitance ) - { - parsedCapacitance = default(Capacitance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedCapacitance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Farads + y.Farads, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Farads + y.Farads, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider pr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out CapacitanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out CapacitanceUnit unit) { unit = CapacitanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 1518011407..9a2db8a4e4 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -1226,19 +1223,14 @@ public static bool TryParseUnit(string str, out DensityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Density ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Density ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit)); } /// @@ -1251,7 +1243,7 @@ internal static Density ParseInternal(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) { result = default(Density); @@ -1260,20 +1252,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Density parsedDensity ) - { - parsedDensity = default(Density); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedDensity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit), out result); } /// @@ -1286,7 +1266,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static DensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static DensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1314,7 +1294,7 @@ internal static DensityUnit ParseUnitInternal(string str, IFormatProvider provid /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out DensityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out DensityUnit unit) { unit = DensityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index 5b689b53d3..c6ff19f56c 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -610,19 +607,14 @@ public static bool TryParseUnit(string str, out DurationUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Duration ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Duration ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Seconds + y.Seconds, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Seconds + y.Seconds, BaseUnit)); } /// @@ -635,7 +627,7 @@ internal static Duration ParseInternal(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) { result = default(Duration); @@ -644,20 +636,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Duration parsedDuration ) - { - parsedDuration = default(Duration); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedDuration = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Seconds + y.Seconds, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Seconds + y.Seconds, BaseUnit), out result); } /// @@ -670,7 +650,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static DurationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static DurationUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -698,7 +678,7 @@ internal static DurationUnit ParseUnitInternal(string str, IFormatProvider provi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out DurationUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out DurationUnit unit) { unit = DurationUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 5dd82ed68f..aa705cf796 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -522,19 +519,14 @@ public static bool TryParseUnit(string str, out DynamicViscosityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit)); } /// @@ -547,7 +539,7 @@ internal static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatPr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) { result = default(DynamicViscosity); @@ -556,20 +548,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out DynamicViscosity parsedDynamicViscosity ) - { - parsedDynamicViscosity = default(DynamicViscosity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedDynamicViscosity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit), out result); } /// @@ -582,7 +562,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -610,7 +590,7 @@ internal static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvid /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out DynamicViscosityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out DynamicViscosityUnit unit) { unit = DynamicViscosityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index 4be3969368..2bd519fe9d 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -478,19 +475,14 @@ public static bool TryParseUnit(string str, out ElectricAdmittanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); } /// @@ -503,7 +495,7 @@ internal static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) { result = default(ElectricAdmittance); @@ -512,20 +504,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricAdmittance parsedElectricAdmittance ) - { - parsedElectricAdmittance = default(ElectricAdmittance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricAdmittance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); } /// @@ -538,7 +518,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -566,7 +546,7 @@ internal static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProv /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricAdmittanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricAdmittanceUnit unit) { unit = ElectricAdmittanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index cca446beed..12f1099aff 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out ElectricChargeUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) { result = default(ElectricCharge); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCharge parsedElectricCharge ) - { - parsedElectricCharge = default(ElectricCharge); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricCharge = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeUnit unit) { unit = ElectricChargeUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index e0a41c7261..5fbf42db81 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out ElectricChargeDensityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IFor /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) { result = default(ElectricChargeDensity); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricChargeDensity parsedElectricChargeDensity ) - { - parsedElectricChargeDensity = default(ElectricChargeDensity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricChargeDensity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatP /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeDensityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeDensityUnit unit) { unit = ElectricChargeDensityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index 9afad9ed94..3a2bd2bdd5 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out ElectricConductanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricConductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricConductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static ElectricConductance ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) { result = default(ElectricConductance); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricConductance parsedElectricConductance ) - { - parsedElectricConductance = default(ElectricConductance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricConductance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static ElectricConductanceUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductanceUnit unit) { unit = ElectricConductanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 1c9763be5e..3db2d42f99 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out ElectricConductivityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static ElectricConductivity ParseInternal(string str, [CanBeNull] IForm /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) { result = default(ElectricConductivity); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricConductivity parsedElectricConductivity ) - { - parsedElectricConductivity = default(ElectricConductivity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricConductivity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static ElectricConductivityUnit ParseUnitInternal(string str, IFormatPr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductivityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductivityUnit unit) { unit = ElectricConductivityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 54219f2138..d21a2077cc 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -566,19 +563,14 @@ public static bool TryParseUnit(string str, out ElectricCurrentUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Amperes + y.Amperes, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Amperes + y.Amperes, BaseUnit)); } /// @@ -591,7 +583,7 @@ internal static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatPro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) { result = default(ElectricCurrent); @@ -600,20 +592,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCurrent parsedElectricCurrent ) - { - parsedElectricCurrent = default(ElectricCurrent); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricCurrent = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Amperes + y.Amperes, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Amperes + y.Amperes, BaseUnit), out result); } /// @@ -626,7 +606,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -654,7 +634,7 @@ internal static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentUnit unit) { unit = ElectricCurrentUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 91b9fe8bf3..c1a8547859 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out ElectricCurrentDensityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFo /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) { result = default(ElectricCurrentDensity); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCurrentDensity parsedElectricCurrentDensity ) - { - parsedElectricCurrentDensity = default(ElectricCurrentDensity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricCurrentDensity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormat /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentDensityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentDensityUnit unit) { unit = ElectricCurrentDensityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 9087f1d84e..4722ff9f2b 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out ElectricCurrentGradientUnit unit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IF /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) { result = default(ElectricCurrentGradient); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricCurrentGradient parsedElectricCurrentGradient ) - { - parsedElectricCurrentGradient = default(ElectricCurrentGradient); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricCurrentGradient = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static ElectricCurrentGradientUnit ParseUnitInternal(string str, IForma /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentGradientUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentGradientUnit unit) { unit = ElectricCurrentGradientUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 976ff9665b..2871698887 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out ElectricFieldUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) { result = default(ElectricField); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricField parsedElectricField ) - { - parsedElectricField = default(ElectricField); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricField = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricFieldUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricFieldUnit unit) { unit = ElectricFieldUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index a777c367bb..358a172ee2 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out ElectricInductanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Henries + y.Henries, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Henries + y.Henries, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static ElectricInductance ParseInternal(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) { result = default(ElectricInductance); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricInductance parsedElectricInductance ) - { - parsedElectricInductance = default(ElectricInductance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricInductance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Henries + y.Henries, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Henries + y.Henries, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProv /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricInductanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricInductanceUnit unit) { unit = ElectricInductanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 3068a1e051..fb2417cfa6 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -500,19 +497,14 @@ public static bool TryParseUnit(string str, out ElectricPotentialUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Volts + y.Volts, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Volts + y.Volts, BaseUnit)); } /// @@ -525,7 +517,7 @@ internal static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatP /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) { result = default(ElectricPotential); @@ -534,20 +526,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricPotential parsedElectricPotential ) - { - parsedElectricPotential = default(ElectricPotential); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricPotential = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Volts + y.Volts, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Volts + y.Volts, BaseUnit), out result); } /// @@ -560,7 +540,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -588,7 +568,7 @@ internal static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialUnit unit) { unit = ElectricPotentialUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 2240bddba4..21635d6e17 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -499,19 +496,14 @@ public static bool TryParseUnit(string str, out ElectricPotentialAcUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit)); } /// @@ -524,7 +516,7 @@ internal static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) { result = default(ElectricPotentialAc); @@ -533,20 +525,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricPotentialAc parsedElectricPotentialAc ) - { - parsedElectricPotentialAc = default(ElectricPotentialAc); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricPotentialAc = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit), out result); } /// @@ -559,7 +539,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -587,7 +567,7 @@ internal static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialAcUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialAcUnit unit) { unit = ElectricPotentialAcUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 623378c8ba..153e9f2964 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -499,19 +496,14 @@ public static bool TryParseUnit(string str, out ElectricPotentialDcUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit)); } /// @@ -524,7 +516,7 @@ internal static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) { result = default(ElectricPotentialDc); @@ -533,20 +525,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricPotentialDc parsedElectricPotentialDc ) - { - parsedElectricPotentialDc = default(ElectricPotentialDc); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricPotentialDc = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit), out result); } /// @@ -559,7 +539,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -587,7 +567,7 @@ internal static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialDcUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialDcUnit unit) { unit = ElectricPotentialDcUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 0659067ba1..e28fadbe9f 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -478,19 +475,14 @@ public static bool TryParseUnit(string str, out ElectricResistanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Ohms + y.Ohms, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Ohms + y.Ohms, BaseUnit)); } /// @@ -503,7 +495,7 @@ internal static ElectricResistance ParseInternal(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) { result = default(ElectricResistance); @@ -512,20 +504,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricResistance parsedElectricResistance ) - { - parsedElectricResistance = default(ElectricResistance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricResistance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Ohms + y.Ohms, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Ohms + y.Ohms, BaseUnit), out result); } /// @@ -538,7 +518,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -566,7 +546,7 @@ internal static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProv /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistanceUnit unit) { unit = ElectricResistanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 0fda40944f..fb99a9fbfa 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -478,19 +475,14 @@ public static bool TryParseUnit(string str, out ElectricResistivityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit)); } /// @@ -503,7 +495,7 @@ internal static ElectricResistivity ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) { result = default(ElectricResistivity); @@ -512,20 +504,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ElectricResistivity parsedElectricResistivity ) - { - parsedElectricResistivity = default(ElectricResistivity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedElectricResistivity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit), out result); } /// @@ -538,7 +518,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -566,7 +546,7 @@ internal static ElectricResistivityUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistivityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistivityUnit unit) { unit = ElectricResistivityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index f1f840a76c..038253d55c 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -874,19 +871,14 @@ public static bool TryParseUnit(string str, out EnergyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Energy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Energy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Joules + y.Joules, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Joules + y.Joules, BaseUnit)); } /// @@ -899,7 +891,7 @@ internal static Energy ParseInternal(string str, [CanBeNull] IFormatProvider pro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) { result = default(Energy); @@ -908,20 +900,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Energy parsedEnergy ) - { - parsedEnergy = default(Energy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedEnergy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Joules + y.Joules, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Joules + y.Joules, BaseUnit), out result); } /// @@ -934,7 +914,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -962,7 +942,7 @@ internal static EnergyUnit ParseUnitInternal(string str, IFormatProvider provide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out EnergyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out EnergyUnit unit) { unit = EnergyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index e216af68f9..342d852a4a 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -544,19 +541,14 @@ public static bool TryParseUnit(string str, out EntropyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit)); } /// @@ -569,7 +561,7 @@ internal static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider pr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) { result = default(Entropy); @@ -578,20 +570,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Entropy parsedEntropy ) - { - parsedEntropy = default(Entropy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedEntropy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit), out result); } /// @@ -604,7 +584,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static EntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static EntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -632,7 +612,7 @@ internal static EntropyUnit ParseUnitInternal(string str, IFormatProvider provid /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out EntropyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out EntropyUnit unit) { unit = EntropyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 5f939f5860..7ed58bcd11 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -610,19 +607,14 @@ public static bool TryParseUnit(string str, out ForceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Force ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Force ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Newtons + y.Newtons, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Newtons + y.Newtons, BaseUnit)); } /// @@ -635,7 +627,7 @@ internal static Force ParseInternal(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) { result = default(Force); @@ -644,20 +636,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Force parsedForce ) - { - parsedForce = default(Force); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedForce = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Newtons + y.Newtons, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Newtons + y.Newtons, BaseUnit), out result); } /// @@ -670,7 +650,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ForceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ForceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -698,7 +678,7 @@ internal static ForceUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceUnit unit) { unit = ForceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 3ff3ad25c4..a46427fe32 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -632,19 +629,14 @@ public static bool TryParseUnit(string str, out ForceChangeRateUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit)); } /// @@ -657,7 +649,7 @@ internal static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatPro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) { result = default(ForceChangeRate); @@ -666,20 +658,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ForceChangeRate parsedForceChangeRate ) - { - parsedForceChangeRate = default(ForceChangeRate); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedForceChangeRate = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit), out result); } /// @@ -692,7 +672,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -720,7 +700,7 @@ internal static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceChangeRateUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceChangeRateUnit unit) { unit = ForceChangeRateUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index 3f7b1f1523..153b28faf4 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -588,19 +585,14 @@ public static bool TryParseUnit(string str, out ForcePerLengthUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit)); } /// @@ -613,7 +605,7 @@ internal static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) { result = default(ForcePerLength); @@ -622,20 +614,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ForcePerLength parsedForcePerLength ) - { - parsedForcePerLength = default(ForcePerLength); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedForcePerLength = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit), out result); } /// @@ -648,7 +628,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -676,7 +656,7 @@ internal static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForcePerLengthUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForcePerLengthUnit unit) { unit = ForcePerLengthUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 86c6cfa121..6c371e8c90 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -566,19 +563,14 @@ public static bool TryParseUnit(string str, out FrequencyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Hertz + y.Hertz, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Hertz + y.Hertz, BaseUnit)); } /// @@ -591,7 +583,7 @@ internal static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) { result = default(Frequency); @@ -600,20 +592,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Frequency parsedFrequency ) - { - parsedFrequency = default(Frequency); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedFrequency = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Hertz + y.Hertz, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Hertz + y.Hertz, BaseUnit), out result); } /// @@ -626,7 +606,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -654,7 +634,7 @@ internal static FrequencyUnit ParseUnitInternal(string str, IFormatProvider prov /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out FrequencyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out FrequencyUnit unit) { unit = FrequencyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 428b14478b..dc7f57bb0b 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -742,19 +739,14 @@ public static bool TryParseUnit(string str, out HeatFluxUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); } /// @@ -767,7 +759,7 @@ internal static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) { result = default(HeatFlux); @@ -776,20 +768,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out HeatFlux parsedHeatFlux ) - { - parsedHeatFlux = default(HeatFlux); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedHeatFlux = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); } /// @@ -802,7 +782,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -830,7 +810,7 @@ internal static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatFluxUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatFluxUnit unit) { unit = HeatFluxUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 26f1fc97ac..188099a016 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -434,19 +431,14 @@ public static bool TryParseUnit(string str, out HeatTransferCoefficientUnit unit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit)); } /// @@ -459,7 +451,7 @@ internal static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IF /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) { result = default(HeatTransferCoefficient); @@ -468,20 +460,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out HeatTransferCoefficient parsedHeatTransferCoefficient ) - { - parsedHeatTransferCoefficient = default(HeatTransferCoefficient); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedHeatTransferCoefficient = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit), out result); } /// @@ -494,7 +474,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -522,7 +502,7 @@ internal static HeatTransferCoefficientUnit ParseUnitInternal(string str, IForma /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatTransferCoefficientUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatTransferCoefficientUnit unit) { unit = HeatTransferCoefficientUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index 20cd40b396..8186819993 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -478,19 +475,14 @@ public static bool TryParseUnit(string str, out IlluminanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Lux + y.Lux, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Lux + y.Lux, BaseUnit)); } /// @@ -503,7 +495,7 @@ internal static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) { result = default(Illuminance); @@ -512,20 +504,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Illuminance parsedIlluminance ) - { - parsedIlluminance = default(Illuminance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedIlluminance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Lux + y.Lux, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Lux + y.Lux, BaseUnit), out result); } /// @@ -538,7 +518,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -566,7 +546,7 @@ internal static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider pr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out IlluminanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out IlluminanceUnit unit) { unit = IlluminanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 7c09535991..abd094f999 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -961,19 +958,14 @@ public static bool TryParseUnit(string str, out InformationUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Bits + y.Bits, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Bits + y.Bits, BaseUnit)); } /// @@ -986,7 +978,7 @@ internal static Information ParseInternal(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) { result = default(Information); @@ -995,20 +987,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Information parsedInformation ) - { - parsedInformation = default(Information); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedInformation = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Bits + y.Bits, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Bits + y.Bits, BaseUnit), out result); } /// @@ -1021,7 +1001,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1049,7 +1029,7 @@ internal static InformationUnit ParseUnitInternal(string str, IFormatProvider pr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) { unit = InformationUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index df55015452..4578bc7162 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -434,19 +431,14 @@ public static bool TryParseUnit(string str, out IrradianceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); } /// @@ -459,7 +451,7 @@ internal static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) { result = default(Irradiance); @@ -468,20 +460,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Irradiance parsedIrradiance ) - { - parsedIrradiance = default(Irradiance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedIrradiance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); } /// @@ -494,7 +474,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static IrradianceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static IrradianceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -522,7 +502,7 @@ internal static IrradianceUnit ParseUnitInternal(string str, IFormatProvider pro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradianceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradianceUnit unit) { unit = IrradianceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 90b7346376..30def78c80 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out IrradiationUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) { result = default(Irradiation); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Irradiation parsedIrradiation ) - { - parsedIrradiation = default(Irradiation); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedIrradiation = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static IrradiationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static IrradiationUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static IrradiationUnit ParseUnitInternal(string str, IFormatProvider pr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradiationUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradiationUnit unit) { unit = IrradiationUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 066cb6d6c5..06778bd89d 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -566,19 +563,14 @@ public static bool TryParseUnit(string str, out KinematicViscosityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit)); } /// @@ -591,7 +583,7 @@ internal static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) { result = default(KinematicViscosity); @@ -600,20 +592,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out KinematicViscosity parsedKinematicViscosity ) - { - parsedKinematicViscosity = default(KinematicViscosity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedKinematicViscosity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit), out result); } /// @@ -626,7 +606,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -654,7 +634,7 @@ internal static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProv /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out KinematicViscosityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out KinematicViscosityUnit unit) { unit = KinematicViscosityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 0843f8e0d8..70b2770fa0 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out LapseRateUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) { result = default(LapseRate); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out LapseRate parsedLapseRate ) - { - parsedLapseRate = default(LapseRate); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedLapseRate = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static LapseRateUnit ParseUnitInternal(string str, IFormatProvider prov /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LapseRateUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LapseRateUnit unit) { unit = LapseRateUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index eeb97d31e2..44c329c7b5 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -874,19 +871,14 @@ public static bool TryParseUnit(string str, out LengthUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Meters + y.Meters, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Meters + y.Meters, BaseUnit)); } /// @@ -899,7 +891,7 @@ internal static Length ParseInternal(string str, [CanBeNull] IFormatProvider pro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) { result = default(Length); @@ -908,20 +900,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Length parsedLength ) - { - parsedLength = default(Length); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedLength = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Meters + y.Meters, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Meters + y.Meters, BaseUnit), out result); } /// @@ -934,7 +914,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -962,7 +942,7 @@ internal static LengthUnit ParseUnitInternal(string str, IFormatProvider provide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) { unit = LengthUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 53db49c76f..3aed68a538 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -433,19 +430,14 @@ public static bool TryParseUnit(string str, out LevelUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Decibels + y.Decibels, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Decibels + y.Decibels, BaseUnit)); } /// @@ -458,7 +450,7 @@ internal static Level ParseInternal(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) { result = default(Level); @@ -467,20 +459,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Level parsedLevel ) - { - parsedLevel = default(Level); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedLevel = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Decibels + y.Decibels, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Decibels + y.Decibels, BaseUnit), out result); } /// @@ -493,7 +473,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -521,7 +501,7 @@ internal static LevelUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) { unit = LevelUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 58f0144fdf..b1ae457df6 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out LinearDensityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) { result = default(LinearDensity); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out LinearDensity parsedLinearDensity ) - { - parsedLinearDensity = default(LinearDensity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedLinearDensity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LinearDensityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LinearDensityUnit unit) { unit = LinearDensityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index 9745b504fd..9993387070 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out LuminousFluxUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Lumens + y.Lumens, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Lumens + y.Lumens, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) { result = default(LuminousFlux); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out LuminousFlux parsedLuminousFlux ) - { - parsedLuminousFlux = default(LuminousFlux); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedLuminousFlux = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Lumens + y.Lumens, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Lumens + y.Lumens, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider p /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousFluxUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousFluxUnit unit) { unit = LuminousFluxUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 782ec54fdf..43ffeb153d 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out LuminousIntensityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Candela + y.Candela, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Candela + y.Candela, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatP /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) { result = default(LuminousIntensity); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out LuminousIntensity parsedLuminousIntensity ) - { - parsedLuminousIntensity = default(LuminousIntensity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedLuminousIntensity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Candela + y.Candela, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Candela + y.Candela, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousIntensityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousIntensityUnit unit) { unit = LuminousIntensityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 7607a1933e..338f12394d 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out MagneticFieldUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Teslas + y.Teslas, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Teslas + y.Teslas, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) { result = default(MagneticField); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MagneticField parsedMagneticField ) - { - parsedMagneticField = default(MagneticField); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMagneticField = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Teslas + y.Teslas, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Teslas + y.Teslas, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFieldUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFieldUnit unit) { unit = MagneticFieldUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index 846167753e..c24f656e01 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out MagneticFluxUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Webers + y.Webers, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Webers + y.Webers, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) { result = default(MagneticFlux); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MagneticFlux parsedMagneticFlux ) - { - parsedMagneticFlux = default(MagneticFlux); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMagneticFlux = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Webers + y.Webers, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Webers + y.Webers, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider p /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFluxUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFluxUnit unit) { unit = MagneticFluxUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index a28f1051d3..559a1b9525 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out MagnetizationUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) { result = default(Magnetization); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Magnetization parsedMagnetization ) - { - parsedMagnetization = default(Magnetization); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMagnetization = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagnetizationUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagnetizationUnit unit) { unit = MagnetizationUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 7daec50642..e65d6724fa 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -852,19 +849,14 @@ public static bool TryParseUnit(string str, out MassUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit)); } /// @@ -877,7 +869,7 @@ internal static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) { result = default(Mass); @@ -886,20 +878,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Mass parsedMass ) - { - parsedMass = default(Mass); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMass = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit), out result); } /// @@ -912,7 +892,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MassUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MassUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -940,7 +920,7 @@ internal static MassUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassUnit unit) { unit = MassUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index fb559f851f..fe735e38a8 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -720,19 +717,14 @@ public static bool TryParseUnit(string str, out MassFlowUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit)); } /// @@ -745,7 +737,7 @@ internal static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) { result = default(MassFlow); @@ -754,20 +746,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MassFlow parsedMassFlow ) - { - parsedMassFlow = default(MassFlow); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMassFlow = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit), out result); } /// @@ -780,7 +760,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -808,7 +788,7 @@ internal static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFlowUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFlowUnit unit) { unit = MassFlowUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index 0eda7452d3..28d7063020 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -434,19 +431,14 @@ public static bool TryParseUnit(string str, out MassFluxUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit)); } /// @@ -459,7 +451,7 @@ internal static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) { result = default(MassFlux); @@ -468,20 +460,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MassFlux parsedMassFlux ) - { - parsedMassFlux = default(MassFlux); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMassFlux = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit), out result); } /// @@ -494,7 +474,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -522,7 +502,7 @@ internal static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFluxUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFluxUnit unit) { unit = MassFluxUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 9eb4da362a..891dc9c33f 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -962,19 +959,14 @@ public static bool TryParseUnit(string str, out MassMomentOfInertiaUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit)); } /// @@ -987,7 +979,7 @@ internal static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) { result = default(MassMomentOfInertia); @@ -996,20 +988,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MassMomentOfInertia parsedMassMomentOfInertia ) - { - parsedMassMomentOfInertia = default(MassMomentOfInertia); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMassMomentOfInertia = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit), out result); } /// @@ -1022,7 +1002,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1050,7 +1030,7 @@ internal static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassMomentOfInertiaUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassMomentOfInertiaUnit unit) { unit = MassMomentOfInertiaUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 76edcbb3d2..612787188a 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out MolarEnergyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) { result = default(MolarEnergy); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MolarEnergy parsedMolarEnergy ) - { - parsedMolarEnergy = default(MolarEnergy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMolarEnergy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider pr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEnergyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEnergyUnit unit) { unit = MolarEnergyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index 8a09d28c7f..297ad648ad 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out MolarEntropyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) { result = default(MolarEntropy); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MolarEntropy parsedMolarEntropy ) - { - parsedMolarEntropy = default(MolarEntropy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMolarEntropy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider p /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEntropyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEntropyUnit unit) { unit = MolarEntropyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 5bfeb81d45..16f8196406 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -654,19 +651,14 @@ public static bool TryParseUnit(string str, out MolarMassUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit)); } /// @@ -679,7 +671,7 @@ internal static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) { result = default(MolarMass); @@ -688,20 +680,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out MolarMass parsedMolarMass ) - { - parsedMolarMass = default(MolarMass); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMolarMass = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit), out result); } /// @@ -714,7 +694,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -742,7 +722,7 @@ internal static MolarMassUnit ParseUnitInternal(string str, IFormatProvider prov /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarMassUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarMassUnit unit) { unit = MolarMassUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index 94ff4ae771..0ea54a59dd 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -566,19 +563,14 @@ public static bool TryParseUnit(string str, out MolarityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit)); } /// @@ -591,7 +583,7 @@ internal static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) { result = default(Molarity); @@ -600,20 +592,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Molarity parsedMolarity ) - { - parsedMolarity = default(Molarity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedMolarity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit), out result); } /// @@ -626,7 +606,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static MolarityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static MolarityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -654,7 +634,7 @@ internal static MolarityUnit ParseUnitInternal(string str, IFormatProvider provi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarityUnit unit) { unit = MolarityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 46ed68e53d..02d92598ce 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out PermeabilityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Permeability ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Permeability ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static Permeability ParseInternal(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) { result = default(Permeability); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Permeability parsedPermeability ) - { - parsedPermeability = default(Permeability); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedPermeability = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider p /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermeabilityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermeabilityUnit unit) { unit = PermeabilityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 5100aa00f6..55990cbedf 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -412,19 +409,14 @@ public static bool TryParseUnit(string str, out PermittivityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit)); } /// @@ -437,7 +429,7 @@ internal static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) { result = default(Permittivity); @@ -446,20 +438,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Permittivity parsedPermittivity ) - { - parsedPermittivity = default(Permittivity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedPermittivity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit), out result); } /// @@ -472,7 +452,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static PermittivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static PermittivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -500,7 +480,7 @@ internal static PermittivityUnit ParseUnitInternal(string str, IFormatProvider p /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermittivityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermittivityUnit unit) { unit = PermittivityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index 94dede4a38..3405f4e4ca 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -830,19 +827,14 @@ public static bool TryParseUnit(string str, out PowerUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Power ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Power ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Watts + y.Watts, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Watts + y.Watts, BaseUnit)); } /// @@ -855,7 +847,7 @@ internal static Power ParseInternal(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) { result = default(Power); @@ -864,20 +856,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Power parsedPower ) - { - parsedPower = default(Power); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedPower = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Watts + y.Watts, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Watts + y.Watts, BaseUnit), out result); } /// @@ -890,7 +870,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static PowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static PowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -918,7 +898,7 @@ internal static PowerUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerUnit unit) { unit = PowerUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index ea99def73b..0ac96afaaa 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -1358,19 +1355,14 @@ public static bool TryParseUnit(string str, out PowerDensityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit)); } /// @@ -1383,7 +1375,7 @@ internal static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvid /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) { result = default(PowerDensity); @@ -1392,20 +1384,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out PowerDensity parsedPowerDensity ) - { - parsedPowerDensity = default(PowerDensity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedPowerDensity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit), out result); } /// @@ -1418,7 +1398,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1446,7 +1426,7 @@ internal static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider p /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerDensityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerDensityUnit unit) { unit = PowerDensityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 2b9975902b..b405c6b095 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -433,19 +430,14 @@ public static bool TryParseUnit(string str, out PowerRatioUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit)); } /// @@ -458,7 +450,7 @@ internal static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) { result = default(PowerRatio); @@ -467,20 +459,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out PowerRatio parsedPowerRatio ) - { - parsedPowerRatio = default(PowerRatio); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedPowerRatio = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit), out result); } /// @@ -493,7 +473,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -521,7 +501,7 @@ internal static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider pro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerRatioUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerRatioUnit unit) { unit = PowerRatioUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 657bff9fb9..b8862674a0 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -1204,19 +1201,14 @@ public static bool TryParseUnit(string str, out PressureUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Pascals + y.Pascals, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Pascals + y.Pascals, BaseUnit)); } /// @@ -1229,7 +1221,7 @@ internal static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) { result = default(Pressure); @@ -1238,20 +1230,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Pressure parsedPressure ) - { - parsedPressure = default(Pressure); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedPressure = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Pascals + y.Pascals, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Pascals + y.Pascals, BaseUnit), out result); } /// @@ -1264,7 +1244,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static PressureUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static PressureUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1292,7 +1272,7 @@ internal static PressureUnit ParseUnitInternal(string str, IFormatProvider provi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureUnit unit) { unit = PressureUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index d83bba6e44..38805fcba3 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -478,19 +475,14 @@ public static bool TryParseUnit(string str, out PressureChangeRateUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit)); } /// @@ -503,7 +495,7 @@ internal static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormat /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) { result = default(PressureChangeRate); @@ -512,20 +504,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out PressureChangeRate parsedPressureChangeRate ) - { - parsedPressureChangeRate = default(PressureChangeRate); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedPressureChangeRate = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit), out result); } /// @@ -538,7 +518,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -566,7 +546,7 @@ internal static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProv /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureChangeRateUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureChangeRateUnit unit) { unit = PressureChangeRateUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 06773052d1..6fa1bba751 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -521,19 +518,14 @@ public static bool TryParseUnit(string str, out RatioUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit)); } /// @@ -546,7 +538,7 @@ internal static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) { result = default(Ratio); @@ -555,20 +547,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Ratio parsedRatio ) - { - parsedRatio = default(Ratio); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedRatio = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit), out result); } /// @@ -581,7 +561,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static RatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static RatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -609,7 +589,7 @@ internal static RatioUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RatioUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RatioUnit unit) { unit = RatioUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index bb8b829a39..7ade9799e4 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out ReactiveEnergyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) { result = default(ReactiveEnergy); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ReactiveEnergy parsedReactiveEnergy ) - { - parsedReactiveEnergy = default(ReactiveEnergy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedReactiveEnergy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactiveEnergyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactiveEnergyUnit unit) { unit = ReactiveEnergyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index 69faf15a50..50cec3b0c5 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -478,19 +475,14 @@ public static bool TryParseUnit(string str, out ReactivePowerUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit)); } /// @@ -503,7 +495,7 @@ internal static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvi /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) { result = default(ReactivePower); @@ -512,20 +504,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ReactivePower parsedReactivePower ) - { - parsedReactivePower = default(ReactivePower); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedReactivePower = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit), out result); } /// @@ -538,7 +518,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -566,7 +546,7 @@ internal static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactivePowerUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactivePowerUnit unit) { unit = ReactivePowerUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 11219a3681..48d10968b2 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out RotationalAccelerationUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFo /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) { result = default(RotationalAcceleration); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalAcceleration parsedRotationalAcceleration ) - { - parsedRotationalAcceleration = default(RotationalAcceleration); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedRotationalAcceleration = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static RotationalAccelerationUnit ParseUnitInternal(string str, IFormat /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalAccelerationUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalAccelerationUnit unit) { unit = RotationalAccelerationUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 7648661d40..d0fbb57524 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -676,19 +673,14 @@ public static bool TryParseUnit(string str, out RotationalSpeedUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit)); } /// @@ -701,7 +693,7 @@ internal static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatPro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) { result = default(RotationalSpeed); @@ -710,20 +702,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalSpeed parsedRotationalSpeed ) - { - parsedRotationalSpeed = default(RotationalSpeed); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedRotationalSpeed = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit), out result); } /// @@ -736,7 +716,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -764,7 +744,7 @@ internal static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalSpeedUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalSpeedUnit unit) { unit = RotationalSpeedUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 242dfa7c16..b7bb2172ac 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out RotationalStiffnessUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static RotationalStiffness ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) { result = default(RotationalStiffness); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalStiffness parsedRotationalStiffness ) - { - parsedRotationalStiffness = default(RotationalStiffness); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedRotationalStiffness = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessUnit unit) { unit = RotationalStiffnessUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index e5da2f3769..f7ee8f83ef 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -456,19 +453,14 @@ public static bool TryParseUnit(string str, out RotationalStiffnessPerLengthUnit /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit)); } /// @@ -481,7 +473,7 @@ internal static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNul /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) { result = default(RotationalStiffnessPerLength); @@ -490,20 +482,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out RotationalStiffnessPerLength parsedRotationalStiffnessPerLength ) - { - parsedRotationalStiffnessPerLength = default(RotationalStiffnessPerLength); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedRotationalStiffnessPerLength = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit), out result); } /// @@ -516,7 +496,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -544,7 +524,7 @@ internal static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, I /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessPerLengthUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessPerLengthUnit unit) { unit = RotationalStiffnessPerLengthUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 9d05fc10f5..4027cb2774 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -411,19 +408,14 @@ public static bool TryParseUnit(string str, out SolidAngleUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Steradians + y.Steradians, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Steradians + y.Steradians, BaseUnit)); } /// @@ -436,7 +428,7 @@ internal static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) { result = default(SolidAngle); @@ -445,20 +437,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out SolidAngle parsedSolidAngle ) - { - parsedSolidAngle = default(SolidAngle); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedSolidAngle = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Steradians + y.Steradians, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Steradians + y.Steradians, BaseUnit), out result); } /// @@ -471,7 +451,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -499,7 +479,7 @@ internal static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider pro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SolidAngleUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SolidAngleUnit unit) { unit = SolidAngleUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index 95fbc1820b..f838b0d74d 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -566,19 +563,14 @@ public static bool TryParseUnit(string str, out SpecificEnergyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit)); } /// @@ -591,7 +583,7 @@ internal static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) { result = default(SpecificEnergy); @@ -600,20 +592,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificEnergy parsedSpecificEnergy ) - { - parsedSpecificEnergy = default(SpecificEnergy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedSpecificEnergy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit), out result); } /// @@ -626,7 +606,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -654,7 +634,7 @@ internal static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEnergyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEnergyUnit unit) { unit = SpecificEnergyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index 3036763f6d..e3397502a0 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -566,19 +563,14 @@ public static bool TryParseUnit(string str, out SpecificEntropyUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit)); } /// @@ -591,7 +583,7 @@ internal static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatPro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) { result = default(SpecificEntropy); @@ -600,20 +592,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificEntropy parsedSpecificEntropy ) - { - parsedSpecificEntropy = default(SpecificEntropy); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedSpecificEntropy = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit), out result); } /// @@ -626,7 +606,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -654,7 +634,7 @@ internal static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEntropyUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEntropyUnit unit) { unit = SpecificEntropyUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 7abb0a56be..8d610f6fd5 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -434,19 +431,14 @@ public static bool TryParseUnit(string str, out SpecificVolumeUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit)); } /// @@ -459,7 +451,7 @@ internal static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) { result = default(SpecificVolume); @@ -468,20 +460,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificVolume parsedSpecificVolume ) - { - parsedSpecificVolume = default(SpecificVolume); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedSpecificVolume = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit), out result); } /// @@ -494,7 +474,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -522,7 +502,7 @@ internal static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificVolumeUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificVolumeUnit unit) { unit = SpecificVolumeUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 8dfe18a0dd..533c6cef8d 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -764,19 +761,14 @@ public static bool TryParseUnit(string str, out SpecificWeightUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit)); } /// @@ -789,7 +781,7 @@ internal static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProv /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) { result = default(SpecificWeight); @@ -798,20 +790,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out SpecificWeight parsedSpecificWeight ) - { - parsedSpecificWeight = default(SpecificWeight); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedSpecificWeight = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit), out result); } /// @@ -824,7 +804,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -852,7 +832,7 @@ internal static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificWeightUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificWeightUnit unit) { unit = SpecificWeightUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 1b3c50decf..f22a08efa2 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -1094,19 +1091,14 @@ public static bool TryParseUnit(string str, out SpeedUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit)); } /// @@ -1119,7 +1111,7 @@ internal static Speed ParseInternal(string str, [CanBeNull] IFormatProvider prov /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) { result = default(Speed); @@ -1128,20 +1120,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Speed parsedSpeed ) - { - parsedSpeed = default(Speed); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedSpeed = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit), out result); } /// @@ -1154,7 +1134,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1182,7 +1162,7 @@ internal static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpeedUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpeedUnit unit) { unit = SpeedUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index c5075f99f9..1358a921bd 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -566,19 +563,14 @@ public static bool TryParseUnit(string str, out TemperatureUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); } /// @@ -591,7 +583,7 @@ internal static Temperature ParseInternal(string str, [CanBeNull] IFormatProvide /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) { result = default(Temperature); @@ -600,20 +592,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Temperature parsedTemperature ) - { - parsedTemperature = default(Temperature); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedTemperature = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); } /// @@ -626,7 +606,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static TemperatureUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static TemperatureUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -654,7 +634,7 @@ internal static TemperatureUnit ParseUnitInternal(string str, IFormatProvider pr /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureUnit unit) { unit = TemperatureUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 8b8a518ebe..b4ac5aac24 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -610,19 +607,14 @@ public static bool TryParseUnit(string str, out TemperatureChangeRateUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit)); } /// @@ -635,7 +627,7 @@ internal static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IFor /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) { result = default(TemperatureChangeRate); @@ -644,20 +636,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out TemperatureChangeRate parsedTemperatureChangeRate ) - { - parsedTemperatureChangeRate = default(TemperatureChangeRate); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedTemperatureChangeRate = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit), out result); } /// @@ -670,7 +650,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -698,7 +678,7 @@ internal static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatP /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureChangeRateUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureChangeRateUnit unit) { unit = TemperatureChangeRateUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 258f953247..61df23e355 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -565,19 +562,14 @@ public static bool TryParseUnit(string str, out TemperatureDeltaUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); } /// @@ -590,7 +582,7 @@ internal static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatPr /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) { result = default(TemperatureDelta); @@ -599,20 +591,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out TemperatureDelta parsedTemperatureDelta ) - { - parsedTemperatureDelta = default(TemperatureDelta); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedTemperatureDelta = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); } /// @@ -625,7 +605,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -653,7 +633,7 @@ internal static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvid /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureDeltaUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureDeltaUnit unit) { unit = TemperatureDeltaUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index 8f75cb0481..fbd7f0df50 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -434,19 +431,14 @@ public static bool TryParseUnit(string str, out ThermalConductivityUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit)); } /// @@ -459,7 +451,7 @@ internal static ThermalConductivity ParseInternal(string str, [CanBeNull] IForma /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) { result = default(ThermalConductivity); @@ -468,20 +460,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ThermalConductivity parsedThermalConductivity ) - { - parsedThermalConductivity = default(ThermalConductivity); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedThermalConductivity = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit), out result); } /// @@ -494,7 +474,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -522,7 +502,7 @@ internal static ThermalConductivityUnit ParseUnitInternal(string str, IFormatPro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalConductivityUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalConductivityUnit unit) { unit = ThermalConductivityUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 2b4b999e51..abb8267004 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -500,19 +497,14 @@ public static bool TryParseUnit(string str, out ThermalResistanceUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit)); } /// @@ -525,7 +517,7 @@ internal static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatP /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) { result = default(ThermalResistance); @@ -534,20 +526,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out ThermalResistance parsedThermalResistance ) - { - parsedThermalResistance = default(ThermalResistance); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedThermalResistance = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit), out result); } /// @@ -560,7 +540,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -588,7 +568,7 @@ internal static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalResistanceUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalResistanceUnit unit) { unit = ThermalResistanceUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index 6183876f8e..58de35e1c8 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -852,19 +849,14 @@ public static bool TryParseUnit(string str, out TorqueUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Torque ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Torque ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit)); } /// @@ -877,7 +869,7 @@ internal static Torque ParseInternal(string str, [CanBeNull] IFormatProvider pro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) { result = default(Torque); @@ -886,20 +878,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Torque parsedTorque ) - { - parsedTorque = default(Torque); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedTorque = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit), out result); } /// @@ -912,7 +892,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -940,7 +920,7 @@ internal static TorqueUnit ParseUnitInternal(string str, IFormatProvider provide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out TorqueUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TorqueUnit unit) { unit = TorqueUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index a77e3c33c0..b88bfe7e18 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -411,19 +408,14 @@ public static bool TryParseUnit(string str, out VitaminAUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit)); } /// @@ -436,7 +428,7 @@ internal static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider p /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) { result = default(VitaminA); @@ -445,20 +437,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out VitaminA parsedVitaminA ) - { - parsedVitaminA = default(VitaminA); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedVitaminA = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit), out result); } /// @@ -471,7 +451,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -499,7 +479,7 @@ internal static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provi /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out VitaminAUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out VitaminAUnit unit) { unit = VitaminAUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 1f378dc9ea..54d3477a18 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -1314,19 +1311,14 @@ public static bool TryParseUnit(string str, out VolumeUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static Volume ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static Volume ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit)); } /// @@ -1339,7 +1331,7 @@ internal static Volume ParseInternal(string str, [CanBeNull] IFormatProvider pro /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) { result = default(Volume); @@ -1348,20 +1340,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out Volume parsedVolume ) - { - parsedVolume = default(Volume); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedVolume = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit), out result); } /// @@ -1374,7 +1354,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1402,7 +1382,7 @@ internal static VolumeUnit ParseUnitInternal(string str, IFormatProvider provide /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeUnit unit) { unit = VolumeUnit.Undefined; diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 7da599ead9..803bec605b 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -36,9 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -962,19 +959,14 @@ public static bool TryParseUnit(string str, out VolumeFlowUnit unit) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit)); + return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit)); } /// @@ -987,7 +979,7 @@ internal static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) { result = default(VolumeFlow); @@ -996,20 +988,8 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out VolumeFlow parsedVolumeFlow ) - { - parsedVolumeFlow = default(VolumeFlow); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsedVolumeFlow = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit), out result); + return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit), out result); } /// @@ -1022,7 +1002,7 @@ internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IForma /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) + private static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -1050,7 +1030,7 @@ internal static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider pro /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeFlowUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeFlowUnit unit) { unit = VolumeFlowUnit.Undefined; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 36adbe7a7f..90132ae5b4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index b8c3e51fe0..67b430c6ac 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index 8c0c861b2a..7d95344135 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 9c66956bb0..7bcfcaf7be 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index a514d06881..004f69b9a8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 1236902125..6d1e61d566 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 30082a1026..725e07f47f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index cc0e65e6db..4157332524 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index f67ed8a765..0818c8c6ea 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index bdbc535ff5..a09929679f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index bd7b47a40f..1fe82aee1b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 2d7ed7bce0..5086457608 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index f6b2aa5d6a..6cf673ce94 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 857451b9cb..bdbb6ff198 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index 05a6bc7c93..465975ea18 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index f1d7203013..ea559b1873 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 030fea6f4b..375ceac634 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 93c916d3e5..cd14f1219d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 6dca359e02..bdd939509c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 65c463f8fb..5923d3ea9a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 63e71a0ba4..b4fa9c06e3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index a69f16d89b..78c6ab373a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index a46a284f90..ca654f0d41 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index 54baf6e0a4..2bb0ac6369 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index ac39bf3719..f2ac6c2209 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index 4134d167c3..93044739cd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 94133dafae..2659748ede 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 60cde2349f..6392eb049b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index 1bf8d39d9f..f96c786750 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index b782e93278..e88f35e270 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index 8c0111ca47..a0b9f69272 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index bfc36363d6..6238f030e2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index d4d5189513..29ed543d22 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index fff218396e..faaa0aaf03 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index db107fe183..505d5cce29 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index 482a7e2568..f43fc48bfb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index aee2c60ae3..7b87f226c9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 038a858590..286d1243a6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 2c0f8e99d8..07f1f26b49 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index 261900e2bd..ed5fbcc5ca 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index 0f2c1c6dfc..e2d9a225ea 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 810eb6816f..09d1e729b6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 597eb8825c..c2cfdd447f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index 8ae87aa8dc..1b1bcf1f3f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 9455b150e6..1fe61a1803 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 626f905c21..e77bdf8f9c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 5dbc90f8a0..d6859befda 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index c2c033c875..9d5cd0ba26 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index a60457862e..60859ccd65 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index e42d212939..00bb4eace6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index bcdf967e0d..a6c0d46120 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index d652d7e489..324aea2a43 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index e5c34f63f5..8bbd6d33ee 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index 0e56510a1c..b49c2bb42f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 458ee89ed8..03e608e980 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index e432419055..1b9a15559f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index f2fee24aa1..eafb8fc227 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index da90f6e830..3a6f2d883e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index f47ad6ba3f..c15dea65b6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index 19dcfc251d..c71aeb8074 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index 49ba0d62f9..6e9cc6f93d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index dfc3ae41a7..01b3d63cf6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index b6e9b06086..70c6dce198 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 0578c19ed1..14bb5d0c27 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index e25d40f08a..caf66a3345 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 4e7090a06d..5c2d080a92 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index 37dc694287..f895402639 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index fd9f15c9fc..4a3e0e9ff6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index fde190ed38..3fa3b36804 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 20625eb5ba..dbc704bc4d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index ea7eaf618b..a79093d3f0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 0f3d419b1e..18469f858f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index f44d536789..1dffe90992 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index bbf2841753..98cc7e53df 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index c7e3cadd98..5ca279aed8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index 14effbb767..c791bf4cc2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 1dbcdc540b..92f9bebf49 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index 46a406ae2d..d9dbb9e54a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index 512637bd7c..b97dd29318 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index ed8f5f1427..ea81e1bda2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index 27e76f6820..1d9ff640f9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index e90335b363..50189cdb79 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 58eb389dd4..50f518c8af 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index 1744861824..1e250e9c7f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index c09bb66716..4f477dbe22 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index 8165ec641f..da0729e268 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 926d723a6e..50dcdf73ca 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 4770b1fd4a..e4300f61dc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index b9273f6170..fd606b2710 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -36,10 +36,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index 149d117349..85481901d0 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -30,16 +30,29 @@ // ReSharper disable once CheckNamespace namespace UnitsNet { - internal delegate TQuantity ParseUnit(string value, string unit, IFormatProvider formatProvider = null); - internal delegate bool TryParseUnit(string valueString, string unit, IFormatProvider formatProvider, out TQuantity value); + internal delegate TUnitType ParseUnitDelegate(string unitString, IFormatProvider formatProvider) where TUnitType : Enum; + internal delegate bool TryParseUnitDelegate(string unitString, IFormatProvider formatProvider, out TUnitType unit) where TUnitType : Enum; + +#if !WINDOWS_UWP + internal delegate TQuantity QuantityFromDelegate(QuantityValue value, TUnitType fromUnit) + where TQuantity : IQuantity + where TUnitType : Enum; +#else + internal delegate TQuantity QuantityFromDelegate(double value, TUnitType fromUnit) + where TQuantity : IQuantity + where TUnitType : Enum; +#endif internal static class QuantityParser { [SuppressMessage("ReSharper", "UseStringInterpolation")] internal static TQuantity Parse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, - [NotNull] ParseUnit parseUnit, + [NotNull] ParseUnitDelegate parseUnit, + [NotNull] QuantityFromDelegate fromDelegate, [NotNull] Func add) + where TQuantity : IQuantity + where TUnitType : Enum { if (str == null) throw new ArgumentNullException(nameof(str)); if (parseUnit == null) throw new ArgumentNullException(nameof(parseUnit)); @@ -59,13 +72,13 @@ internal static TQuantity Parse([NotNull] string str, const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; - string[] unitAbbreviations = UnitSystem.GetCached(formatProvider) + var unitAbbreviations = UnitSystem.GetCached(formatProvider) .GetAllAbbreviations(typeof(TUnitType)) .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error .Select(Regex.Escape) // Escape special regex characters .ToArray(); - string unitsRegex = $"({String.Join("|", unitAbbreviations)})"; + var unitsRegex = $"({String.Join("|", unitAbbreviations)})"; var regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", numRegex, // capture base (integral) Quantity value @@ -75,13 +88,14 @@ internal static TQuantity Parse([NotNull] string str, @"(and)?,?", // allow "and" & "," separators between quantities @"(?[a-z]*)?"); // capture invalid input - var quantities = ParseWithRegex(regexString, str, parseUnit, formatProvider); + var quantities = ParseWithRegex(regexString, str, parseUnit, fromDelegate, formatProvider); if (quantities.Count == 0) { throw new ArgumentException( "Expected string to have at least one pair of quantity and unit in the format" + " \"<quantity> <unit>\". Eg. \"5.5 m\" or \"1ft 2in\""); } + return quantities.Aggregate(add); } @@ -89,20 +103,22 @@ internal static TQuantity Parse([NotNull] string str, /// Parse a string given a particular regular expression. /// /// Error parsing string. - private static List ParseWithRegex(string regexString, string str, ParseUnit parseUnit, - IFormatProvider formatProvider = null) + private static List ParseWithRegex(string regexString, string str, ParseUnitDelegate parseUnit, + QuantityFromDelegate fromDelegate, IFormatProvider formatProvider = null) + where TQuantity : IQuantity + where TUnitType : Enum { var regex = new Regex(regexString); - MatchCollection matches = regex.Matches(str.Trim()); + var matches = regex.Matches(str.Trim()); var converted = new List(); foreach (Match match in matches) { - GroupCollection groups = match.Groups; + var groups = match.Groups; - string valueString = groups["value"].Value; - string unitString = groups["unit"].Value; - if (groups["invalid"].Value != "") + var valueString = groups["value"].Value; + var unitString = groups["unit"].Value; + if (groups["invalid"].Value != string.Empty) { var newEx = new UnitsNetException("Invalid string detected: " + groups["invalid"].Value); newEx.Data["input"] = str; @@ -111,11 +127,17 @@ private static List ParseWithRegex(string regexString, str newEx.Data["formatprovider"] = formatProvider?.ToString(); throw newEx; } - if ((valueString == "") && (unitString == "")) continue; + + if ((valueString == string.Empty) && (unitString == string.Empty)) + continue; try { - converted.Add(parseUnit(valueString, unitString, formatProvider)); + var value = double.Parse(valueString, formatProvider); + var parsedUnit = parseUnit(unitString, formatProvider); + var quantity = fromDelegate(value, parsedUnit); + + converted.Add(quantity); } catch (AmbiguousUnitParseException) { @@ -131,14 +153,18 @@ private static List ParseWithRegex(string regexString, str throw newEx; } } + return converted; } [SuppressMessage("ReSharper", "UseStringInterpolation")] internal static bool TryParse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, - [NotNull] TryParseUnit parseUnit, + [NotNull] TryParseUnitDelegate parseUnit, + [NotNull] QuantityFromDelegate fromDelegate, [NotNull] Func add, out TQuantity value) + where TQuantity : IQuantity + where TUnitType : Enum { value = default(TQuantity); @@ -160,13 +186,13 @@ internal static bool TryParse([NotNull] string str, const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; - string[] unitAbbreviations = UnitSystem.GetCached(formatProvider) + var unitAbbreviations = UnitSystem.GetCached(formatProvider) .GetAllAbbreviations(typeof(TUnitType)) .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error .Select(Regex.Escape) // Escape special regex characters .ToArray(); - string unitsRegex = $"({String.Join("|", unitAbbreviations)})"; + var unitsRegex = $"({String.Join("|", unitAbbreviations)})"; var regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", numRegex, // capture base (integral) Quantity value @@ -176,7 +202,7 @@ internal static bool TryParse([NotNull] string str, @"(and)?,?", // allow "and" & "," separators between quantities @"(?[a-z]*)?"); // capture invalid input - if(!TryParseWithRegex(regexString, str, parseUnit, formatProvider, out var quantities)) + if(!TryParseWithRegex(regexString, str, parseUnit, fromDelegate, formatProvider, out var quantities)) return false; value = quantities.Aggregate(add); @@ -187,8 +213,10 @@ internal static bool TryParse([NotNull] string str, /// Parse a string given a particular regular expression. /// /// Error parsing string. - private static bool TryParseWithRegex(string regexString, string str, TryParseUnit tryParseUnit, - IFormatProvider formatProvider, out List converted ) + private static bool TryParseWithRegex(string regexString, string str, TryParseUnitDelegate tryParseUnit, + QuantityFromDelegate fromDelegate, IFormatProvider formatProvider, out List converted ) + where TQuantity : IQuantity + where TUnitType : Enum { converted = new List(); @@ -207,10 +235,15 @@ private static bool TryParseWithRegex(string regexString, if((valueString == string.Empty) && (unitString == string.Empty)) continue; - if(!tryParseUnit(valueString, unitString, formatProvider, out var parsed)) + if(!double.TryParse(valueString, NumberStyles.Any, formatProvider, out var value)) return false; - converted.Add(parsed); + if(!tryParseUnit(unitString, formatProvider, out var parsedUnit)) + return false; + + var quantity = fromDelegate(value, parsedUnit); + + converted.Add( quantity ); } return true; diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 2325dadcee..17c68035b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 3dde09393d..b8f5b3a0a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index aca0015b2e..b9c8db3e23 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 74594e0d60..4f9de940f6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 6befa51f75..ce3dc8509c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 79d9c80500..cbba8dc42e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 72a65906b4..9b6edc1576 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 5dac998354..cfe0a699de 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 48f99e9ebb..53ad358201 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 8dd63b7d65..5971ec1578 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 66b1ce63b3..241000d0b9 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 2e85ccaab1..9b3c7a0933 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index 35b3ed857a..f66ca45817 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index d65f2ac0e0..7a3a4fab46 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index 76413b4919..e1bfdd23ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 95cd9cf751..f50a5b13ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index 8444e93d75..b19e60c6de 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index c33625785d..1d34a16d28 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 3fe4b43514..6b85a4f6f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 6e249a4a2a..d42fe704f1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 10f4edcf23..969eab80eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index fe14e6b3aa..6af4b6ad5e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 257c4525f9..0925c10eee 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index d4ff73246c..34422cbe13 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index b2c8413319..71a13074cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index ea5f9c8a2c..a1e80720d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index cb9b5e3f19..ae3dd8e3b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 157ed29891..14aeef4d40 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index 1fea365dab..e04e3a48fb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index fb6be91793..17aab17c43 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 3482ceb297..489cc3ae42 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 1635b3a002..3fca77f43b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 7af1fe358d..5a0bb18cb1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 91ac577409..122bf832af 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 60f2ae4175..ceb715a729 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 15372682d8..f3b88f7823 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 3e1993d621..0231e6db80 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 3331bad989..dfd78a967f 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index dd15c12d66..00fd3d118e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index e78fe76622..c04c5c21b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 6ff5a850bc..6e67586fe6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index e0be2e850c..b3e2c0c909 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index f00c4de6c0..132d645d22 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 5890c5290e..b3846512b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index c5b210b857..b7c77fa5a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 6451de8caa..c29d8ffad0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 6c35aff755..2916b154ed 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 4baca6ab60..9d8920230d 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 891bb06996..a72b8799a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 072de3398b..facf165281 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 066d3140ef..762bca7ae5 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 838dded44e..811e928e87 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 24f2b22b8f..de72d48d67 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index c13aa7b743..d85b0d9d79 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 591732027d..5b2df59052 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index e8025e9218..3b101edaa9 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index c19ce85b47..6dd15a91bc 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 3e0c567f89..64af88145d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 8359bcd7f0..fbdcf735da 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 9f29e99f44..bedab70433 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 8c27d18663..ad0c7c80f4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 45a078a8be..fb607f4362 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 3621a1c702..a685a662a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 31e670a0dd..2d00a4b257 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index b2d1f1c0ae..a84a589612 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index cafceace96..ec7fca9073 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index a994f15ca0..4d383d8f23 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 35b06ba59a..48fd4f0e0c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 7db8605a22..83daf56a96 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index 0fdceb9a43..c9ce36cb18 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index ace547f299..33ba321bf4 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 8ff386ae37..04edff4b44 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index ea2a46733f..a152130c88 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index 6195452621..a2dea7df02 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 4aea67061b..80225f8aed 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 3b1a92cc76..56b28c4f3c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index e8aa120bbd..3427d39572 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 58b9339a91..d21734ffbb 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 2df6fdf98d..465bc22c3d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 1acc6c2f5e..464bed263a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 56dc7ce9d9..2b35a5d5cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index bcb70fb0a3..1808c6edff 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index a7f3141437..59f8c1616f 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 7992a4505e..3d46274d40 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index b97d9e6b7b..461efae1c8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index d16002ecda..905fdeee46 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 2b230be959..41922e4b2d 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 4775fd8baf..0daf2c5859 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 83f543ccb8..7f2402d932 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index b9eb6e5f01..087fd38440 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -57,9 +57,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -476,19 +473,14 @@ if ($obsoleteAttribute) /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - internal static $quantityName ParseInternal(string str, [CanBeNull] IFormatProvider provider) + private static $quantityName ParseInternal(string str, [CanBeNull] IFormatProvider provider) { if (str == null) throw new ArgumentNullException(nameof(str)); provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.Parse<$quantityName, $unitEnumName>(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2) - { - var parsedValue = double.Parse(value, formatProvider2); - var parsedUnit = ParseUnitInternal(unit, formatProvider2); - return From(parsedValue, parsedUnit); - }, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit)); + return QuantityParser.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From, + (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit)); } /// @@ -501,7 +493,7 @@ if ($obsoleteAttribute) /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - internal static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) { result = default($quantityName); @@ -510,20 +502,8 @@ if ($obsoleteAttribute) provider = provider ?? UnitSystem.DefaultCulture; - return QuantityParser.TryParse<$quantityName, $unitEnumName>(str, provider, - delegate(string value, string unit, IFormatProvider formatProvider2, out $quantityName parsed$quantityName ) - { - parsed$quantityName = default($quantityName); - - if(!double.TryParse(value, NumberStyles.Any, formatProvider2, out var parsedValue)) - return false; - - if(!TryParseUnitInternal(unit, formatProvider2, out var parsedUnit)) - return false; - - parsed$quantityName = From(parsedValue, parsedUnit); - return true; - }, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit), out result); + return QuantityParser.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, + (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit), out result); } /// @@ -536,7 +516,7 @@ if ($obsoleteAttribute) /// /// The value of 'str' cannot be null. /// Error parsing string. - internal static $unitEnumName ParseUnitInternal(string str, IFormatProvider provider = null) + private static $unitEnumName ParseUnitInternal(string str, IFormatProvider provider = null) { if (str == null) throw new ArgumentNullException(nameof(str)); @@ -564,7 +544,7 @@ if ($obsoleteAttribute) /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - internal static bool TryParseUnitInternal(string str, IFormatProvider provider, out $unitEnumName unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out $unitEnumName unit) { unit = $unitEnumName.Undefined; diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 1e5fe12de7..328952bbd5 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -48,10 +48,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index c644f60676..b04d24fe73 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -48,10 +48,7 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; From 1bf14a8363e36cdd4343b14956c689e37232c5d1 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 11 Oct 2018 10:07:37 -0400 Subject: [PATCH 050/131] Splitting UnitSystem class into more focused classes --- .../Quantities/Acceleration.Common.g.cs | 18 +- .../Quantities/AmountOfSubstance.Common.g.cs | 18 +- .../Quantities/AmplitudeRatio.Common.g.cs | 18 +- .../Quantities/Angle.Common.g.cs | 18 +- .../Quantities/ApparentEnergy.Common.g.cs | 18 +- .../Quantities/ApparentPower.Common.g.cs | 18 +- .../GeneratedCode/Quantities/Area.Common.g.cs | 18 +- .../Quantities/AreaDensity.Common.g.cs | 18 +- .../AreaMomentOfInertia.Common.g.cs | 18 +- .../Quantities/BitRate.Common.g.cs | 18 +- .../BrakeSpecificFuelConsumption.Common.g.cs | 18 +- .../Quantities/Capacitance.Common.g.cs | 18 +- .../Quantities/Density.Common.g.cs | 18 +- .../Quantities/Duration.Common.g.cs | 18 +- .../Quantities/DynamicViscosity.Common.g.cs | 18 +- .../Quantities/ElectricAdmittance.Common.g.cs | 18 +- .../Quantities/ElectricCharge.Common.g.cs | 18 +- .../ElectricChargeDensity.Common.g.cs | 18 +- .../ElectricConductance.Common.g.cs | 18 +- .../ElectricConductivity.Common.g.cs | 18 +- .../Quantities/ElectricCurrent.Common.g.cs | 18 +- .../ElectricCurrentDensity.Common.g.cs | 18 +- .../ElectricCurrentGradient.Common.g.cs | 18 +- .../Quantities/ElectricField.Common.g.cs | 18 +- .../Quantities/ElectricInductance.Common.g.cs | 18 +- .../Quantities/ElectricPotential.Common.g.cs | 18 +- .../ElectricPotentialAc.Common.g.cs | 18 +- .../ElectricPotentialDc.Common.g.cs | 18 +- .../Quantities/ElectricResistance.Common.g.cs | 18 +- .../ElectricResistivity.Common.g.cs | 18 +- .../Quantities/Energy.Common.g.cs | 18 +- .../Quantities/Entropy.Common.g.cs | 18 +- .../Quantities/Force.Common.g.cs | 18 +- .../Quantities/ForceChangeRate.Common.g.cs | 18 +- .../Quantities/ForcePerLength.Common.g.cs | 18 +- .../Quantities/Frequency.Common.g.cs | 18 +- .../Quantities/HeatFlux.Common.g.cs | 18 +- .../HeatTransferCoefficient.Common.g.cs | 18 +- .../Quantities/Illuminance.Common.g.cs | 18 +- .../Quantities/Information.Common.g.cs | 18 +- .../Quantities/Irradiance.Common.g.cs | 18 +- .../Quantities/Irradiation.Common.g.cs | 18 +- .../Quantities/KinematicViscosity.Common.g.cs | 18 +- .../Quantities/LapseRate.Common.g.cs | 18 +- .../Quantities/Length.Common.g.cs | 18 +- .../Quantities/Level.Common.g.cs | 18 +- .../Quantities/LinearDensity.Common.g.cs | 18 +- .../Quantities/LuminousFlux.Common.g.cs | 18 +- .../Quantities/LuminousIntensity.Common.g.cs | 18 +- .../Quantities/MagneticField.Common.g.cs | 18 +- .../Quantities/MagneticFlux.Common.g.cs | 18 +- .../Quantities/Magnetization.Common.g.cs | 18 +- .../GeneratedCode/Quantities/Mass.Common.g.cs | 18 +- .../Quantities/MassFlow.Common.g.cs | 18 +- .../Quantities/MassFlux.Common.g.cs | 18 +- .../MassMomentOfInertia.Common.g.cs | 18 +- .../Quantities/MolarEnergy.Common.g.cs | 18 +- .../Quantities/MolarEntropy.Common.g.cs | 18 +- .../Quantities/MolarMass.Common.g.cs | 18 +- .../Quantities/Molarity.Common.g.cs | 18 +- .../Quantities/Permeability.Common.g.cs | 18 +- .../Quantities/Permittivity.Common.g.cs | 18 +- .../Quantities/Power.Common.g.cs | 18 +- .../Quantities/PowerDensity.Common.g.cs | 18 +- .../Quantities/PowerRatio.Common.g.cs | 18 +- .../Quantities/Pressure.Common.g.cs | 18 +- .../Quantities/PressureChangeRate.Common.g.cs | 18 +- .../Quantities/Ratio.Common.g.cs | 18 +- .../Quantities/ReactiveEnergy.Common.g.cs | 18 +- .../Quantities/ReactivePower.Common.g.cs | 18 +- .../RotationalAcceleration.Common.g.cs | 18 +- .../Quantities/RotationalSpeed.Common.g.cs | 18 +- .../RotationalStiffness.Common.g.cs | 18 +- .../RotationalStiffnessPerLength.Common.g.cs | 18 +- .../Quantities/SolidAngle.Common.g.cs | 18 +- .../Quantities/SpecificEnergy.Common.g.cs | 18 +- .../Quantities/SpecificEntropy.Common.g.cs | 18 +- .../Quantities/SpecificVolume.Common.g.cs | 18 +- .../Quantities/SpecificWeight.Common.g.cs | 18 +- .../Quantities/Speed.Common.g.cs | 18 +- .../Quantities/Temperature.Common.g.cs | 18 +- .../TemperatureChangeRate.Common.g.cs | 18 +- .../Quantities/TemperatureDelta.Common.g.cs | 18 +- .../ThermalConductivity.Common.g.cs | 18 +- .../Quantities/ThermalResistance.Common.g.cs | 18 +- .../Quantities/Torque.Common.g.cs | 18 +- .../Quantities/VitaminA.Common.g.cs | 18 +- .../Quantities/Volume.Common.g.cs | 18 +- .../Quantities/VolumeFlow.Common.g.cs | 18 +- UnitsNet.Tests/CustomCode/ParseTests.cs | 8 +- UnitsNet.Tests/QuantityTests.ToString.cs | 24 +- UnitsNet.Tests/UnitSystemTests.cs | 35 +- .../Acceleration.WindowsRuntimeComponent.g.cs | 14 +- ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 14 +- ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 14 +- .../Angle.WindowsRuntimeComponent.g.cs | 14 +- ...pparentEnergy.WindowsRuntimeComponent.g.cs | 14 +- ...ApparentPower.WindowsRuntimeComponent.g.cs | 14 +- .../Area.WindowsRuntimeComponent.g.cs | 14 +- .../AreaDensity.WindowsRuntimeComponent.g.cs | 14 +- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 14 +- .../BitRate.WindowsRuntimeComponent.g.cs | 14 +- ...elConsumption.WindowsRuntimeComponent.g.cs | 14 +- .../Capacitance.WindowsRuntimeComponent.g.cs | 14 +- .../Density.WindowsRuntimeComponent.g.cs | 14 +- .../Duration.WindowsRuntimeComponent.g.cs | 14 +- ...amicViscosity.WindowsRuntimeComponent.g.cs | 14 +- ...ricAdmittance.WindowsRuntimeComponent.g.cs | 14 +- ...lectricCharge.WindowsRuntimeComponent.g.cs | 14 +- ...ChargeDensity.WindowsRuntimeComponent.g.cs | 14 +- ...icConductance.WindowsRuntimeComponent.g.cs | 14 +- ...cConductivity.WindowsRuntimeComponent.g.cs | 14 +- ...ectricCurrent.WindowsRuntimeComponent.g.cs | 14 +- ...urrentDensity.WindowsRuntimeComponent.g.cs | 14 +- ...rrentGradient.WindowsRuntimeComponent.g.cs | 14 +- ...ElectricField.WindowsRuntimeComponent.g.cs | 14 +- ...ricInductance.WindowsRuntimeComponent.g.cs | 14 +- ...tricPotential.WindowsRuntimeComponent.g.cs | 14 +- ...icPotentialAc.WindowsRuntimeComponent.g.cs | 14 +- ...icPotentialDc.WindowsRuntimeComponent.g.cs | 14 +- ...ricResistance.WindowsRuntimeComponent.g.cs | 14 +- ...icResistivity.WindowsRuntimeComponent.g.cs | 14 +- .../Energy.WindowsRuntimeComponent.g.cs | 14 +- .../Entropy.WindowsRuntimeComponent.g.cs | 14 +- .../Force.WindowsRuntimeComponent.g.cs | 14 +- ...rceChangeRate.WindowsRuntimeComponent.g.cs | 14 +- ...orcePerLength.WindowsRuntimeComponent.g.cs | 14 +- .../Frequency.WindowsRuntimeComponent.g.cs | 14 +- .../HeatFlux.WindowsRuntimeComponent.g.cs | 14 +- ...erCoefficient.WindowsRuntimeComponent.g.cs | 14 +- .../Illuminance.WindowsRuntimeComponent.g.cs | 14 +- .../Information.WindowsRuntimeComponent.g.cs | 14 +- .../Irradiance.WindowsRuntimeComponent.g.cs | 14 +- .../Irradiation.WindowsRuntimeComponent.g.cs | 14 +- ...aticViscosity.WindowsRuntimeComponent.g.cs | 14 +- .../LapseRate.WindowsRuntimeComponent.g.cs | 14 +- .../Length.WindowsRuntimeComponent.g.cs | 14 +- .../Level.WindowsRuntimeComponent.g.cs | 14 +- ...LinearDensity.WindowsRuntimeComponent.g.cs | 14 +- .../LuminousFlux.WindowsRuntimeComponent.g.cs | 14 +- ...nousIntensity.WindowsRuntimeComponent.g.cs | 14 +- ...MagneticField.WindowsRuntimeComponent.g.cs | 14 +- .../MagneticFlux.WindowsRuntimeComponent.g.cs | 14 +- ...Magnetization.WindowsRuntimeComponent.g.cs | 14 +- .../Mass.WindowsRuntimeComponent.g.cs | 14 +- .../MassFlow.WindowsRuntimeComponent.g.cs | 14 +- .../MassFlux.WindowsRuntimeComponent.g.cs | 14 +- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 14 +- .../MolarEnergy.WindowsRuntimeComponent.g.cs | 14 +- .../MolarEntropy.WindowsRuntimeComponent.g.cs | 14 +- .../MolarMass.WindowsRuntimeComponent.g.cs | 14 +- .../Molarity.WindowsRuntimeComponent.g.cs | 14 +- .../Permeability.WindowsRuntimeComponent.g.cs | 14 +- .../Permittivity.WindowsRuntimeComponent.g.cs | 14 +- .../Power.WindowsRuntimeComponent.g.cs | 14 +- .../PowerDensity.WindowsRuntimeComponent.g.cs | 14 +- .../PowerRatio.WindowsRuntimeComponent.g.cs | 14 +- .../Pressure.WindowsRuntimeComponent.g.cs | 14 +- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 14 +- .../Ratio.WindowsRuntimeComponent.g.cs | 14 +- ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 14 +- ...ReactivePower.WindowsRuntimeComponent.g.cs | 14 +- ...lAcceleration.WindowsRuntimeComponent.g.cs | 14 +- ...tationalSpeed.WindowsRuntimeComponent.g.cs | 14 +- ...onalStiffness.WindowsRuntimeComponent.g.cs | 14 +- ...nessPerLength.WindowsRuntimeComponent.g.cs | 14 +- .../SolidAngle.WindowsRuntimeComponent.g.cs | 14 +- ...pecificEnergy.WindowsRuntimeComponent.g.cs | 14 +- ...ecificEntropy.WindowsRuntimeComponent.g.cs | 14 +- ...pecificVolume.WindowsRuntimeComponent.g.cs | 14 +- ...pecificWeight.WindowsRuntimeComponent.g.cs | 14 +- .../Speed.WindowsRuntimeComponent.g.cs | 14 +- .../Temperature.WindowsRuntimeComponent.g.cs | 14 +- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 14 +- ...peratureDelta.WindowsRuntimeComponent.g.cs | 14 +- ...lConductivity.WindowsRuntimeComponent.g.cs | 14 +- ...malResistance.WindowsRuntimeComponent.g.cs | 14 +- .../Torque.WindowsRuntimeComponent.g.cs | 14 +- .../VitaminA.WindowsRuntimeComponent.g.cs | 14 +- .../Volume.WindowsRuntimeComponent.g.cs | 14 +- .../VolumeFlow.WindowsRuntimeComponent.g.cs | 14 +- UnitsNet/CustomCode/GlobalConfiguration.cs | 42 + .../CustomCode/Quantities/Length.extra.cs | 7 +- UnitsNet/CustomCode/Quantities/Mass.extra.cs | 7 +- UnitsNet/CustomCode/QuantityParser.cs | 10 +- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 293 + UnitsNet/CustomCode/UnitParser.cs | 192 + UnitsNet/CustomCode/UnitSystem.cs | 562 -- .../CustomCode/UnitValueAbbreviationLookup.cs | 78 + .../Quantities/Acceleration.NetFramework.g.cs | 22 +- .../AmountOfSubstance.NetFramework.g.cs | 22 +- .../AmplitudeRatio.NetFramework.g.cs | 22 +- .../Quantities/Angle.NetFramework.g.cs | 22 +- .../ApparentEnergy.NetFramework.g.cs | 22 +- .../ApparentPower.NetFramework.g.cs | 22 +- .../Quantities/Area.NetFramework.g.cs | 22 +- .../Quantities/AreaDensity.NetFramework.g.cs | 22 +- .../AreaMomentOfInertia.NetFramework.g.cs | 22 +- .../Quantities/BitRate.NetFramework.g.cs | 22 +- ...eSpecificFuelConsumption.NetFramework.g.cs | 22 +- .../Quantities/Capacitance.NetFramework.g.cs | 22 +- .../Quantities/Density.NetFramework.g.cs | 22 +- .../Quantities/Duration.NetFramework.g.cs | 22 +- .../DynamicViscosity.NetFramework.g.cs | 22 +- .../ElectricAdmittance.NetFramework.g.cs | 22 +- .../ElectricCharge.NetFramework.g.cs | 22 +- .../ElectricChargeDensity.NetFramework.g.cs | 22 +- .../ElectricConductance.NetFramework.g.cs | 22 +- .../ElectricConductivity.NetFramework.g.cs | 22 +- .../ElectricCurrent.NetFramework.g.cs | 22 +- .../ElectricCurrentDensity.NetFramework.g.cs | 22 +- .../ElectricCurrentGradient.NetFramework.g.cs | 22 +- .../ElectricField.NetFramework.g.cs | 22 +- .../ElectricInductance.NetFramework.g.cs | 22 +- .../ElectricPotential.NetFramework.g.cs | 22 +- .../ElectricPotentialAc.NetFramework.g.cs | 22 +- .../ElectricPotentialDc.NetFramework.g.cs | 22 +- .../ElectricResistance.NetFramework.g.cs | 22 +- .../ElectricResistivity.NetFramework.g.cs | 22 +- .../Quantities/Energy.NetFramework.g.cs | 22 +- .../Quantities/Entropy.NetFramework.g.cs | 22 +- .../Quantities/Force.NetFramework.g.cs | 22 +- .../ForceChangeRate.NetFramework.g.cs | 22 +- .../ForcePerLength.NetFramework.g.cs | 22 +- .../Quantities/Frequency.NetFramework.g.cs | 22 +- .../Quantities/HeatFlux.NetFramework.g.cs | 22 +- .../HeatTransferCoefficient.NetFramework.g.cs | 22 +- .../Quantities/Illuminance.NetFramework.g.cs | 22 +- .../Quantities/Information.NetFramework.g.cs | 22 +- .../Quantities/Irradiance.NetFramework.g.cs | 22 +- .../Quantities/Irradiation.NetFramework.g.cs | 22 +- .../KinematicViscosity.NetFramework.g.cs | 22 +- .../Quantities/LapseRate.NetFramework.g.cs | 22 +- .../Quantities/Length.NetFramework.g.cs | 22 +- .../Quantities/Level.NetFramework.g.cs | 22 +- .../LinearDensity.NetFramework.g.cs | 22 +- .../Quantities/LuminousFlux.NetFramework.g.cs | 22 +- .../LuminousIntensity.NetFramework.g.cs | 22 +- .../MagneticField.NetFramework.g.cs | 22 +- .../Quantities/MagneticFlux.NetFramework.g.cs | 22 +- .../Magnetization.NetFramework.g.cs | 22 +- .../Quantities/Mass.NetFramework.g.cs | 22 +- .../Quantities/MassFlow.NetFramework.g.cs | 22 +- .../Quantities/MassFlux.NetFramework.g.cs | 22 +- .../MassMomentOfInertia.NetFramework.g.cs | 22 +- .../Quantities/MolarEnergy.NetFramework.g.cs | 22 +- .../Quantities/MolarEntropy.NetFramework.g.cs | 22 +- .../Quantities/MolarMass.NetFramework.g.cs | 22 +- .../Quantities/Molarity.NetFramework.g.cs | 22 +- .../Quantities/Permeability.NetFramework.g.cs | 22 +- .../Quantities/Permittivity.NetFramework.g.cs | 22 +- .../Quantities/Power.NetFramework.g.cs | 22 +- .../Quantities/PowerDensity.NetFramework.g.cs | 22 +- .../Quantities/PowerRatio.NetFramework.g.cs | 22 +- .../Quantities/Pressure.NetFramework.g.cs | 22 +- .../PressureChangeRate.NetFramework.g.cs | 22 +- .../Quantities/Ratio.NetFramework.g.cs | 22 +- .../ReactiveEnergy.NetFramework.g.cs | 22 +- .../ReactivePower.NetFramework.g.cs | 22 +- .../RotationalAcceleration.NetFramework.g.cs | 22 +- .../RotationalSpeed.NetFramework.g.cs | 22 +- .../RotationalStiffness.NetFramework.g.cs | 22 +- ...tionalStiffnessPerLength.NetFramework.g.cs | 22 +- .../Quantities/SolidAngle.NetFramework.g.cs | 22 +- .../SpecificEnergy.NetFramework.g.cs | 22 +- .../SpecificEntropy.NetFramework.g.cs | 22 +- .../SpecificVolume.NetFramework.g.cs | 22 +- .../SpecificWeight.NetFramework.g.cs | 22 +- .../Quantities/Speed.NetFramework.g.cs | 22 +- .../Quantities/Temperature.NetFramework.g.cs | 22 +- .../TemperatureChangeRate.NetFramework.g.cs | 22 +- .../TemperatureDelta.NetFramework.g.cs | 22 +- .../ThermalConductivity.NetFramework.g.cs | 22 +- .../ThermalResistance.NetFramework.g.cs | 22 +- .../Quantities/Torque.NetFramework.g.cs | 22 +- .../Quantities/VitaminA.NetFramework.g.cs | 22 +- .../Quantities/Volume.NetFramework.g.cs | 22 +- .../Quantities/VolumeFlow.NetFramework.g.cs | 22 +- .../GeneratedCode/UnitSystem.Default.g.cs | 5490 +++-------------- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 18 +- ...GenerateQuantitySourceCodeNetFramework.ps1 | 22 +- ...ntitySourceCodeWindowsRuntimeComponent.ps1 | 14 +- ...de-GenerateUnitSystemDefaultSourceCode.ps1 | 30 +- UnitsNet/UnitConverter.cs | 14 +- UnitsNet/UnitFormatter.cs | 2 +- 285 files changed, 3906 insertions(+), 7748 deletions(-) create mode 100644 UnitsNet/CustomCode/GlobalConfiguration.cs create mode 100644 UnitsNet/CustomCode/UnitAbbreviationsCache.cs create mode 100644 UnitsNet/CustomCode/UnitParser.cs delete mode 100644 UnitsNet/CustomCode/UnitSystem.cs create mode 100644 UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index cba8fe1bce..3d041be1f9 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -654,7 +654,7 @@ public static bool TryParseUnit(string str, out AccelerationUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -677,7 +677,7 @@ private static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit)); @@ -687,7 +687,7 @@ private static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -700,7 +700,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit), out result); @@ -710,7 +710,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -720,8 +720,7 @@ private static AccelerationUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == AccelerationUnit.Undefined) { @@ -738,7 +737,7 @@ private static AccelerationUnit ParseUnitInternal(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -751,8 +750,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AccelerationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 516b472288..3481418f3f 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -676,7 +676,7 @@ public static bool TryParseUnit(string str, out AmountOfSubstanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -699,7 +699,7 @@ private static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Moles + y.Moles, BaseUnit)); @@ -709,7 +709,7 @@ private static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatPr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -722,7 +722,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Moles + y.Moles, BaseUnit), out result); @@ -732,7 +732,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -742,8 +742,7 @@ private static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == AmountOfSubstanceUnit.Undefined) { @@ -760,7 +759,7 @@ private static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -773,8 +772,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AmountOfSubstanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 86538e528d..5582ceb536 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -455,7 +455,7 @@ public static bool TryParseUnit(string str, out AmplitudeRatioUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -478,7 +478,7 @@ private static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit)); @@ -488,7 +488,7 @@ private static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -501,7 +501,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit), out result); @@ -511,7 +511,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -521,8 +521,7 @@ private static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == AmplitudeRatioUnit.Undefined) { @@ -539,7 +538,7 @@ private static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -552,8 +551,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AmplitudeRatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 88843462d0..81695f57f1 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -675,7 +675,7 @@ public static bool TryParseUnit(string str, out AngleUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -698,7 +698,7 @@ private static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Degrees + y.Degrees, BaseUnit)); @@ -708,7 +708,7 @@ private static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -721,7 +721,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Degrees + y.Degrees, BaseUnit), out result); @@ -731,7 +731,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -741,8 +741,7 @@ private static AngleUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == AngleUnit.Undefined) { @@ -759,7 +758,7 @@ private static AngleUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -772,8 +771,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AngleUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 214884fd87..fab0af3569 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out ApparentEnergyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit)); @@ -467,7 +467,7 @@ private static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ApparentEnergyUnit.Undefined) { @@ -518,7 +517,7 @@ private static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ApparentEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 2017da090e..184cc5573b 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -456,7 +456,7 @@ public static bool TryParseUnit(string str, out ApparentPowerUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -479,7 +479,7 @@ private static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit)); @@ -489,7 +489,7 @@ private static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -502,7 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit), out result); @@ -512,7 +512,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -522,8 +522,7 @@ private static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ApparentPowerUnit.Undefined) { @@ -540,7 +539,7 @@ private static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -553,8 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ApparentPowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index b14b167d93..4103a1db74 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -654,7 +654,7 @@ public static bool TryParseUnit(string str, out AreaUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -677,7 +677,7 @@ private static Area ParseInternal(string str, [CanBeNull] IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit)); @@ -687,7 +687,7 @@ private static Area ParseInternal(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -700,7 +700,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit), out result); @@ -710,7 +710,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -720,8 +720,7 @@ private static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == AreaUnit.Undefined) { @@ -738,7 +737,7 @@ private static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -751,8 +750,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AreaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 80f223686b..e94e3911b9 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out AreaDensityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == AreaDensityUnit.Undefined) { @@ -474,7 +473,7 @@ private static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AreaDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 959390b242..203367d7b0 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -500,7 +500,7 @@ public static bool TryParseUnit(string str, out AreaMomentOfInertiaUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -523,7 +523,7 @@ private static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit)); @@ -533,7 +533,7 @@ private static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -546,7 +546,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit), out result); @@ -556,7 +556,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -566,8 +566,7 @@ private static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == AreaMomentOfInertiaUnit.Undefined) { @@ -584,7 +583,7 @@ private static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -597,8 +596,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AreaMomentOfInertiaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index dd5f043cf7..a054c86a85 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -939,7 +939,7 @@ public static bool TryParseUnit(string str, out BitRateUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -962,7 +962,7 @@ private static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit)); @@ -972,7 +972,7 @@ private static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider pro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -985,7 +985,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit), out result); @@ -995,7 +995,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1005,8 +1005,7 @@ private static BitRateUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == BitRateUnit.Undefined) { @@ -1023,7 +1022,7 @@ private static BitRateUnit ParseUnitInternal(string str, IFormatProvider provide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1036,8 +1035,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == BitRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index c129254490..f3dada2c00 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out BrakeSpecificFuelConsumptionUnit /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit)); @@ -467,7 +467,7 @@ private static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IF { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) { @@ -518,7 +517,7 @@ private static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IF /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index ff900457e8..ab48631583 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out CapacitanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Farads + y.Farads, BaseUnit)); @@ -423,7 +423,7 @@ private static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Farads + y.Farads, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == CapacitanceUnit.Undefined) { @@ -474,7 +473,7 @@ private static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == CapacitanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 9a2db8a4e4..2d1f86d33a 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -1204,7 +1204,7 @@ public static bool TryParseUnit(string str, out DensityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -1227,7 +1227,7 @@ private static Density ParseInternal(string str, [CanBeNull] IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit)); @@ -1237,7 +1237,7 @@ private static Density ParseInternal(string str, [CanBeNull] IFormatProvider pro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -1250,7 +1250,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit), out result); @@ -1260,7 +1260,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1270,8 +1270,7 @@ private static DensityUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == DensityUnit.Undefined) { @@ -1288,7 +1287,7 @@ private static DensityUnit ParseUnitInternal(string str, IFormatProvider provide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1301,8 +1300,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == DensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index c6ff19f56c..e86de60c7a 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -588,7 +588,7 @@ public static bool TryParseUnit(string str, out DurationUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -611,7 +611,7 @@ private static Duration ParseInternal(string str, [CanBeNull] IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Seconds + y.Seconds, BaseUnit)); @@ -621,7 +621,7 @@ private static Duration ParseInternal(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -634,7 +634,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Seconds + y.Seconds, BaseUnit), out result); @@ -644,7 +644,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -654,8 +654,7 @@ private static DurationUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == DurationUnit.Undefined) { @@ -672,7 +671,7 @@ private static DurationUnit ParseUnitInternal(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -685,8 +684,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == DurationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index aa705cf796..2f5a1c02bb 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -500,7 +500,7 @@ public static bool TryParseUnit(string str, out DynamicViscosityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -523,7 +523,7 @@ private static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatPro { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit)); @@ -533,7 +533,7 @@ private static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatPro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -546,7 +546,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit), out result); @@ -556,7 +556,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -566,8 +566,7 @@ private static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == DynamicViscosityUnit.Undefined) { @@ -584,7 +583,7 @@ private static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -597,8 +596,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == DynamicViscosityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index 2bd519fe9d..098b0ccb99 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -456,7 +456,7 @@ public static bool TryParseUnit(string str, out ElectricAdmittanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -479,7 +479,7 @@ private static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); @@ -489,7 +489,7 @@ private static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatP /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -502,7 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); @@ -512,7 +512,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -522,8 +522,7 @@ private static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricAdmittanceUnit.Undefined) { @@ -540,7 +539,7 @@ private static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -553,8 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricAdmittanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 12f1099aff..e1b8c1320c 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out ElectricChargeUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit)); @@ -423,7 +423,7 @@ private static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricChargeUnit.Undefined) { @@ -474,7 +473,7 @@ private static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricChargeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 5fbf42db81..1aa1ff21a1 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out ElectricChargeDensityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IForm { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IForm /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricChargeDensityUnit.Undefined) { @@ -474,7 +473,7 @@ private static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatPr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricChargeDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index 3a2bd2bdd5..66894fce47 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out ElectricConductanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static ElectricConductance ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); @@ -467,7 +467,7 @@ private static ElectricConductance ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricConductanceUnit.Undefined) { @@ -518,7 +517,7 @@ private static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricConductanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 3db2d42f99..9d3952f53c 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out ElectricConductivityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static ElectricConductivity ParseInternal(string str, [CanBeNull] IForma { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static ElectricConductivity ParseInternal(string str, [CanBeNull] IForma /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static ElectricConductivityUnit ParseUnitInternal(string str, IFormatPro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricConductivityUnit.Undefined) { @@ -474,7 +473,7 @@ private static ElectricConductivityUnit ParseUnitInternal(string str, IFormatPro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricConductivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index d21a2077cc..53591c0f8c 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -544,7 +544,7 @@ public static bool TryParseUnit(string str, out ElectricCurrentUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -567,7 +567,7 @@ private static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Amperes + y.Amperes, BaseUnit)); @@ -577,7 +577,7 @@ private static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProv /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -590,7 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Amperes + y.Amperes, BaseUnit), out result); @@ -600,7 +600,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -610,8 +610,7 @@ private static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricCurrentUnit.Undefined) { @@ -628,7 +627,7 @@ private static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -641,8 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricCurrentUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index c1a8547859..75fd541ee1 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out ElectricCurrentDensityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFor { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFor /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricCurrentDensityUnit.Undefined) { @@ -474,7 +473,7 @@ private static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatP /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricCurrentDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 4722ff9f2b..3bc14db71b 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out ElectricCurrentGradientUnit unit /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFo { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit)); @@ -423,7 +423,7 @@ private static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFo /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricCurrentGradientUnit.Undefined) { @@ -474,7 +473,7 @@ private static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricCurrentGradientUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 2871698887..0bca606819 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out ElectricFieldUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricFieldUnit.Undefined) { @@ -474,7 +473,7 @@ private static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricFieldUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 358a172ee2..d32388c2e9 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out ElectricInductanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Henries + y.Henries, BaseUnit)); @@ -423,7 +423,7 @@ private static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatP /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Henries + y.Henries, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricInductanceUnit.Undefined) { @@ -474,7 +473,7 @@ private static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricInductanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index fb2417cfa6..14b27fd69b 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -478,7 +478,7 @@ public static bool TryParseUnit(string str, out ElectricPotentialUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -501,7 +501,7 @@ private static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Volts + y.Volts, BaseUnit)); @@ -511,7 +511,7 @@ private static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatPr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -524,7 +524,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Volts + y.Volts, BaseUnit), out result); @@ -534,7 +534,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -544,8 +544,7 @@ private static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricPotentialUnit.Undefined) { @@ -562,7 +561,7 @@ private static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -575,8 +574,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricPotentialUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 21635d6e17..5f05893521 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -477,7 +477,7 @@ public static bool TryParseUnit(string str, out ElectricPotentialAcUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -500,7 +500,7 @@ private static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit)); @@ -510,7 +510,7 @@ private static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -523,7 +523,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit), out result); @@ -533,7 +533,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -543,8 +543,7 @@ private static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricPotentialAcUnit.Undefined) { @@ -561,7 +560,7 @@ private static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -574,8 +573,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricPotentialAcUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 153e9f2964..8a2d4d6211 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -477,7 +477,7 @@ public static bool TryParseUnit(string str, out ElectricPotentialDcUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -500,7 +500,7 @@ private static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit)); @@ -510,7 +510,7 @@ private static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -523,7 +523,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit), out result); @@ -533,7 +533,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -543,8 +543,7 @@ private static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricPotentialDcUnit.Undefined) { @@ -561,7 +560,7 @@ private static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -574,8 +573,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricPotentialDcUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index e28fadbe9f..01996250d7 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -456,7 +456,7 @@ public static bool TryParseUnit(string str, out ElectricResistanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -479,7 +479,7 @@ private static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Ohms + y.Ohms, BaseUnit)); @@ -489,7 +489,7 @@ private static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatP /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -502,7 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Ohms + y.Ohms, BaseUnit), out result); @@ -512,7 +512,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -522,8 +522,7 @@ private static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricResistanceUnit.Undefined) { @@ -540,7 +539,7 @@ private static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -553,8 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricResistanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index fb99a9fbfa..112e8066dc 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -456,7 +456,7 @@ public static bool TryParseUnit(string str, out ElectricResistivityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -479,7 +479,7 @@ private static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit)); @@ -489,7 +489,7 @@ private static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -502,7 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit), out result); @@ -512,7 +512,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -522,8 +522,7 @@ private static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ElectricResistivityUnit.Undefined) { @@ -540,7 +539,7 @@ private static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -553,8 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricResistivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 038253d55c..e6bea32ef1 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -852,7 +852,7 @@ public static bool TryParseUnit(string str, out EnergyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -875,7 +875,7 @@ private static Energy ParseInternal(string str, [CanBeNull] IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Joules + y.Joules, BaseUnit)); @@ -885,7 +885,7 @@ private static Energy ParseInternal(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -898,7 +898,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Joules + y.Joules, BaseUnit), out result); @@ -908,7 +908,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -918,8 +918,7 @@ private static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == EnergyUnit.Undefined) { @@ -936,7 +935,7 @@ private static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -949,8 +948,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == EnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index 342d852a4a..8192bda935 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -522,7 +522,7 @@ public static bool TryParseUnit(string str, out EntropyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -545,7 +545,7 @@ private static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit)); @@ -555,7 +555,7 @@ private static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider pro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -568,7 +568,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit), out result); @@ -578,7 +578,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -588,8 +588,7 @@ private static EntropyUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == EntropyUnit.Undefined) { @@ -606,7 +605,7 @@ private static EntropyUnit ParseUnitInternal(string str, IFormatProvider provide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -619,8 +618,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == EntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 7ed58bcd11..3ac553ea52 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -588,7 +588,7 @@ public static bool TryParseUnit(string str, out ForceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -611,7 +611,7 @@ private static Force ParseInternal(string str, [CanBeNull] IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Newtons + y.Newtons, BaseUnit)); @@ -621,7 +621,7 @@ private static Force ParseInternal(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -634,7 +634,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Newtons + y.Newtons, BaseUnit), out result); @@ -644,7 +644,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -654,8 +654,7 @@ private static ForceUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ForceUnit.Undefined) { @@ -672,7 +671,7 @@ private static ForceUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -685,8 +684,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ForceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index a46427fe32..ba6dc13a06 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -610,7 +610,7 @@ public static bool TryParseUnit(string str, out ForceChangeRateUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -633,7 +633,7 @@ private static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit)); @@ -643,7 +643,7 @@ private static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProv /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -656,7 +656,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit), out result); @@ -666,7 +666,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -676,8 +676,7 @@ private static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ForceChangeRateUnit.Undefined) { @@ -694,7 +693,7 @@ private static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -707,8 +706,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ForceChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index 153b28faf4..4a1f159e5b 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -566,7 +566,7 @@ public static bool TryParseUnit(string str, out ForcePerLengthUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -589,7 +589,7 @@ private static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit)); @@ -599,7 +599,7 @@ private static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -612,7 +612,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit), out result); @@ -622,7 +622,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -632,8 +632,7 @@ private static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ForcePerLengthUnit.Undefined) { @@ -650,7 +649,7 @@ private static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -663,8 +662,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ForcePerLengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 6c371e8c90..398744fcf5 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -544,7 +544,7 @@ public static bool TryParseUnit(string str, out FrequencyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -567,7 +567,7 @@ private static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Hertz + y.Hertz, BaseUnit)); @@ -577,7 +577,7 @@ private static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -590,7 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Hertz + y.Hertz, BaseUnit), out result); @@ -600,7 +600,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -610,8 +610,7 @@ private static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == FrequencyUnit.Undefined) { @@ -628,7 +627,7 @@ private static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -641,8 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == FrequencyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index dc7f57bb0b..62102f2171 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -720,7 +720,7 @@ public static bool TryParseUnit(string str, out HeatFluxUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -743,7 +743,7 @@ private static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); @@ -753,7 +753,7 @@ private static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -766,7 +766,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); @@ -776,7 +776,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -786,8 +786,7 @@ private static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == HeatFluxUnit.Undefined) { @@ -804,7 +803,7 @@ private static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -817,8 +816,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == HeatFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 188099a016..618aeef718 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -412,7 +412,7 @@ public static bool TryParseUnit(string str, out HeatTransferCoefficientUnit unit /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -435,7 +435,7 @@ private static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFo { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit)); @@ -445,7 +445,7 @@ private static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFo /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -458,7 +458,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit), out result); @@ -468,7 +468,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -478,8 +478,7 @@ private static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == HeatTransferCoefficientUnit.Undefined) { @@ -496,7 +495,7 @@ private static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -509,8 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == HeatTransferCoefficientUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index 8186819993..0c64b59c82 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -456,7 +456,7 @@ public static bool TryParseUnit(string str, out IlluminanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -479,7 +479,7 @@ private static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Lux + y.Lux, BaseUnit)); @@ -489,7 +489,7 @@ private static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -502,7 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Lux + y.Lux, BaseUnit), out result); @@ -512,7 +512,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -522,8 +522,7 @@ private static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == IlluminanceUnit.Undefined) { @@ -540,7 +539,7 @@ private static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -553,8 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == IlluminanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index abd094f999..67ac281640 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -939,7 +939,7 @@ public static bool TryParseUnit(string str, out InformationUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -962,7 +962,7 @@ private static Information ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Bits + y.Bits, BaseUnit)); @@ -972,7 +972,7 @@ private static Information ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -985,7 +985,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Bits + y.Bits, BaseUnit), out result); @@ -995,7 +995,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1005,8 +1005,7 @@ private static InformationUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == InformationUnit.Undefined) { @@ -1023,7 +1022,7 @@ private static InformationUnit ParseUnitInternal(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1036,8 +1035,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == InformationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 4578bc7162..6744354fa3 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -412,7 +412,7 @@ public static bool TryParseUnit(string str, out IrradianceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -435,7 +435,7 @@ private static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); @@ -445,7 +445,7 @@ private static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -458,7 +458,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); @@ -468,7 +468,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -478,8 +478,7 @@ private static IrradianceUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == IrradianceUnit.Undefined) { @@ -496,7 +495,7 @@ private static IrradianceUnit ParseUnitInternal(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -509,8 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == IrradianceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 30def78c80..971390e447 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out IrradiationUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit)); @@ -467,7 +467,7 @@ private static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static IrradiationUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == IrradiationUnit.Undefined) { @@ -518,7 +517,7 @@ private static IrradiationUnit ParseUnitInternal(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == IrradiationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 06778bd89d..9a4ff29130 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -544,7 +544,7 @@ public static bool TryParseUnit(string str, out KinematicViscosityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -567,7 +567,7 @@ private static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit)); @@ -577,7 +577,7 @@ private static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatP /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -590,7 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit), out result); @@ -600,7 +600,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -610,8 +610,7 @@ private static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == KinematicViscosityUnit.Undefined) { @@ -628,7 +627,7 @@ private static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -641,8 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == KinematicViscosityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 70b2770fa0..4fe7d8dd6c 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out LapseRateUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit)); @@ -423,7 +423,7 @@ private static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == LapseRateUnit.Undefined) { @@ -474,7 +473,7 @@ private static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LapseRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index 44c329c7b5..b6d9faa60e 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -852,7 +852,7 @@ public static bool TryParseUnit(string str, out LengthUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -875,7 +875,7 @@ private static Length ParseInternal(string str, [CanBeNull] IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Meters + y.Meters, BaseUnit)); @@ -885,7 +885,7 @@ private static Length ParseInternal(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -898,7 +898,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Meters + y.Meters, BaseUnit), out result); @@ -908,7 +908,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -918,8 +918,7 @@ private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == LengthUnit.Undefined) { @@ -936,7 +935,7 @@ private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -949,8 +948,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 3aed68a538..1c95d89a95 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -411,7 +411,7 @@ public static bool TryParseUnit(string str, out LevelUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -434,7 +434,7 @@ private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Decibels + y.Decibels, BaseUnit)); @@ -444,7 +444,7 @@ private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -457,7 +457,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Decibels + y.Decibels, BaseUnit), out result); @@ -467,7 +467,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -477,8 +477,7 @@ private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == LevelUnit.Undefined) { @@ -495,7 +494,7 @@ private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -508,8 +507,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LevelUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index b1ae457df6..3ec72bd6b9 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out LinearDensityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit)); @@ -467,7 +467,7 @@ private static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == LinearDensityUnit.Undefined) { @@ -518,7 +517,7 @@ private static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LinearDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index 9993387070..cbc1aaa99f 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out LuminousFluxUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Lumens + y.Lumens, BaseUnit)); @@ -423,7 +423,7 @@ private static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Lumens + y.Lumens, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == LuminousFluxUnit.Undefined) { @@ -474,7 +473,7 @@ private static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LuminousFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 43ffeb153d..1db655152d 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out LuminousIntensityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Candela + y.Candela, BaseUnit)); @@ -423,7 +423,7 @@ private static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatPr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Candela + y.Candela, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == LuminousIntensityUnit.Undefined) { @@ -474,7 +473,7 @@ private static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LuminousIntensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 338f12394d..43b210acff 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out MagneticFieldUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Teslas + y.Teslas, BaseUnit)); @@ -423,7 +423,7 @@ private static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Teslas + y.Teslas, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MagneticFieldUnit.Undefined) { @@ -474,7 +473,7 @@ private static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MagneticFieldUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index c24f656e01..2393e8bfe5 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out MagneticFluxUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Webers + y.Webers, BaseUnit)); @@ -423,7 +423,7 @@ private static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Webers + y.Webers, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MagneticFluxUnit.Undefined) { @@ -474,7 +473,7 @@ private static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MagneticFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 559a1b9525..e05b82f408 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out MagnetizationUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MagnetizationUnit.Undefined) { @@ -474,7 +473,7 @@ private static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MagnetizationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index e65d6724fa..41c0d656d6 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -830,7 +830,7 @@ public static bool TryParseUnit(string str, out MassUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -853,7 +853,7 @@ private static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit)); @@ -863,7 +863,7 @@ private static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -876,7 +876,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit), out result); @@ -886,7 +886,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -896,8 +896,7 @@ private static MassUnit ParseUnitInternal(string str, IFormatProvider provider = { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MassUnit.Undefined) { @@ -914,7 +913,7 @@ private static MassUnit ParseUnitInternal(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -927,8 +926,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index fe735e38a8..b97c8814cd 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -698,7 +698,7 @@ public static bool TryParseUnit(string str, out MassFlowUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -721,7 +721,7 @@ private static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit)); @@ -731,7 +731,7 @@ private static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -744,7 +744,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit), out result); @@ -754,7 +754,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -764,8 +764,7 @@ private static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MassFlowUnit.Undefined) { @@ -782,7 +781,7 @@ private static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -795,8 +794,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassFlowUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index 28d7063020..96dca48ada 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -412,7 +412,7 @@ public static bool TryParseUnit(string str, out MassFluxUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -435,7 +435,7 @@ private static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit)); @@ -445,7 +445,7 @@ private static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -458,7 +458,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit), out result); @@ -468,7 +468,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -478,8 +478,7 @@ private static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MassFluxUnit.Undefined) { @@ -496,7 +495,7 @@ private static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -509,8 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index 891dc9c33f..df7e27088c 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -940,7 +940,7 @@ public static bool TryParseUnit(string str, out MassMomentOfInertiaUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -963,7 +963,7 @@ private static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit)); @@ -973,7 +973,7 @@ private static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -986,7 +986,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit), out result); @@ -996,7 +996,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1006,8 +1006,7 @@ private static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MassMomentOfInertiaUnit.Undefined) { @@ -1024,7 +1023,7 @@ private static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1037,8 +1036,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassMomentOfInertiaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 612787188a..f8bff0a68b 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out MolarEnergyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit)); @@ -467,7 +467,7 @@ private static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MolarEnergyUnit.Undefined) { @@ -518,7 +517,7 @@ private static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index 297ad648ad..7ef0297c57 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out MolarEntropyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit)); @@ -467,7 +467,7 @@ private static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MolarEntropyUnit.Undefined) { @@ -518,7 +517,7 @@ private static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarEntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 16f8196406..5a2f25a21f 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -632,7 +632,7 @@ public static bool TryParseUnit(string str, out MolarMassUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -655,7 +655,7 @@ private static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit)); @@ -665,7 +665,7 @@ private static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -678,7 +678,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit), out result); @@ -688,7 +688,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -698,8 +698,7 @@ private static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MolarMassUnit.Undefined) { @@ -716,7 +715,7 @@ private static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -729,8 +728,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarMassUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index 0ea54a59dd..b11fad7276 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -544,7 +544,7 @@ public static bool TryParseUnit(string str, out MolarityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -567,7 +567,7 @@ private static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit)); @@ -577,7 +577,7 @@ private static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -590,7 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit), out result); @@ -600,7 +600,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -610,8 +610,7 @@ private static MolarityUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == MolarityUnit.Undefined) { @@ -628,7 +627,7 @@ private static MolarityUnit ParseUnitInternal(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -641,8 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 02d92598ce..41e31414d9 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out PermeabilityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static Permeability ParseInternal(string str, [CanBeNull] IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static Permeability ParseInternal(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == PermeabilityUnit.Undefined) { @@ -474,7 +473,7 @@ private static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PermeabilityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 55990cbedf..8de3351773 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -390,7 +390,7 @@ public static bool TryParseUnit(string str, out PermittivityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -413,7 +413,7 @@ private static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit)); @@ -423,7 +423,7 @@ private static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -436,7 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit), out result); @@ -446,7 +446,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -456,8 +456,7 @@ private static PermittivityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == PermittivityUnit.Undefined) { @@ -474,7 +473,7 @@ private static PermittivityUnit ParseUnitInternal(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -487,8 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PermittivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index 3405f4e4ca..e62445518e 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -808,7 +808,7 @@ public static bool TryParseUnit(string str, out PowerUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -831,7 +831,7 @@ private static Power ParseInternal(string str, [CanBeNull] IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Watts + y.Watts, BaseUnit)); @@ -841,7 +841,7 @@ private static Power ParseInternal(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -854,7 +854,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Watts + y.Watts, BaseUnit), out result); @@ -864,7 +864,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -874,8 +874,7 @@ private static PowerUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == PowerUnit.Undefined) { @@ -892,7 +891,7 @@ private static PowerUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -905,8 +904,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 0ac96afaaa..92eab71c3f 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -1336,7 +1336,7 @@ public static bool TryParseUnit(string str, out PowerDensityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -1359,7 +1359,7 @@ private static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit)); @@ -1369,7 +1369,7 @@ private static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -1382,7 +1382,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit), out result); @@ -1392,7 +1392,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1402,8 +1402,7 @@ private static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == PowerDensityUnit.Undefined) { @@ -1420,7 +1419,7 @@ private static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1433,8 +1432,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PowerDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index b405c6b095..8024d025ff 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -411,7 +411,7 @@ public static bool TryParseUnit(string str, out PowerRatioUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -434,7 +434,7 @@ private static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit)); @@ -444,7 +444,7 @@ private static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -457,7 +457,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit), out result); @@ -467,7 +467,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -477,8 +477,7 @@ private static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == PowerRatioUnit.Undefined) { @@ -495,7 +494,7 @@ private static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -508,8 +507,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PowerRatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index b8862674a0..8a5e494f7b 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -1182,7 +1182,7 @@ public static bool TryParseUnit(string str, out PressureUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -1205,7 +1205,7 @@ private static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Pascals + y.Pascals, BaseUnit)); @@ -1215,7 +1215,7 @@ private static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -1228,7 +1228,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Pascals + y.Pascals, BaseUnit), out result); @@ -1238,7 +1238,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1248,8 +1248,7 @@ private static PressureUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == PressureUnit.Undefined) { @@ -1266,7 +1265,7 @@ private static PressureUnit ParseUnitInternal(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1279,8 +1278,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PressureUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 38805fcba3..3278b87148 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -456,7 +456,7 @@ public static bool TryParseUnit(string str, out PressureChangeRateUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -479,7 +479,7 @@ private static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit)); @@ -489,7 +489,7 @@ private static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatP /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -502,7 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit), out result); @@ -512,7 +512,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -522,8 +522,7 @@ private static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == PressureChangeRateUnit.Undefined) { @@ -540,7 +539,7 @@ private static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -553,8 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PressureChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 6fa1bba751..d8b7e7db44 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -499,7 +499,7 @@ public static bool TryParseUnit(string str, out RatioUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -522,7 +522,7 @@ private static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit)); @@ -532,7 +532,7 @@ private static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -545,7 +545,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit), out result); @@ -555,7 +555,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -565,8 +565,7 @@ private static RatioUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == RatioUnit.Undefined) { @@ -583,7 +582,7 @@ private static RatioUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -596,8 +595,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index 7ade9799e4..8948f59da7 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out ReactiveEnergyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit)); @@ -467,7 +467,7 @@ private static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ReactiveEnergyUnit.Undefined) { @@ -518,7 +517,7 @@ private static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ReactiveEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index 50cec3b0c5..f87897edc9 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -456,7 +456,7 @@ public static bool TryParseUnit(string str, out ReactivePowerUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -479,7 +479,7 @@ private static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit)); @@ -489,7 +489,7 @@ private static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -502,7 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit), out result); @@ -512,7 +512,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -522,8 +522,7 @@ private static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ReactivePowerUnit.Undefined) { @@ -540,7 +539,7 @@ private static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -553,8 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ReactivePowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 48d10968b2..46edcadcb8 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out RotationalAccelerationUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFor { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit)); @@ -467,7 +467,7 @@ private static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFor /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == RotationalAccelerationUnit.Undefined) { @@ -518,7 +517,7 @@ private static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatP /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalAccelerationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index d0fbb57524..9d414f3062 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -654,7 +654,7 @@ public static bool TryParseUnit(string str, out RotationalSpeedUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -677,7 +677,7 @@ private static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit)); @@ -687,7 +687,7 @@ private static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProv /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -700,7 +700,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit), out result); @@ -710,7 +710,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -720,8 +720,7 @@ private static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == RotationalSpeedUnit.Undefined) { @@ -738,7 +737,7 @@ private static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -751,8 +750,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalSpeedUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index b7bb2172ac..fdec50e8e6 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out RotationalStiffnessUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit)); @@ -467,7 +467,7 @@ private static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == RotationalStiffnessUnit.Undefined) { @@ -518,7 +517,7 @@ private static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalStiffnessUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index f7ee8f83ef..21c05d3c36 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -434,7 +434,7 @@ public static bool TryParseUnit(string str, out RotationalStiffnessPerLengthUnit /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -457,7 +457,7 @@ private static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit)); @@ -467,7 +467,7 @@ private static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -480,7 +480,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit), out result); @@ -490,7 +490,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -500,8 +500,7 @@ private static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IF { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == RotationalStiffnessPerLengthUnit.Undefined) { @@ -518,7 +517,7 @@ private static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IF /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -531,8 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalStiffnessPerLengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 4027cb2774..585aea32ca 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -389,7 +389,7 @@ public static bool TryParseUnit(string str, out SolidAngleUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -412,7 +412,7 @@ private static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Steradians + y.Steradians, BaseUnit)); @@ -422,7 +422,7 @@ private static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -435,7 +435,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Steradians + y.Steradians, BaseUnit), out result); @@ -445,7 +445,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -455,8 +455,7 @@ private static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == SolidAngleUnit.Undefined) { @@ -473,7 +472,7 @@ private static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -486,8 +485,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SolidAngleUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index f838b0d74d..f3d7ae1ce3 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -544,7 +544,7 @@ public static bool TryParseUnit(string str, out SpecificEnergyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -567,7 +567,7 @@ private static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit)); @@ -577,7 +577,7 @@ private static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -590,7 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit), out result); @@ -600,7 +600,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -610,8 +610,7 @@ private static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == SpecificEnergyUnit.Undefined) { @@ -628,7 +627,7 @@ private static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -641,8 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index e3397502a0..d9793d57c0 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -544,7 +544,7 @@ public static bool TryParseUnit(string str, out SpecificEntropyUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -567,7 +567,7 @@ private static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit)); @@ -577,7 +577,7 @@ private static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProv /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -590,7 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit), out result); @@ -600,7 +600,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -610,8 +610,7 @@ private static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == SpecificEntropyUnit.Undefined) { @@ -628,7 +627,7 @@ private static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -641,8 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificEntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index 8d610f6fd5..c014c31bff 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -412,7 +412,7 @@ public static bool TryParseUnit(string str, out SpecificVolumeUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -435,7 +435,7 @@ private static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit)); @@ -445,7 +445,7 @@ private static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -458,7 +458,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit), out result); @@ -468,7 +468,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -478,8 +478,7 @@ private static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == SpecificVolumeUnit.Undefined) { @@ -496,7 +495,7 @@ private static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -509,8 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificVolumeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 533c6cef8d..0e1975dab3 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -742,7 +742,7 @@ public static bool TryParseUnit(string str, out SpecificWeightUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -765,7 +765,7 @@ private static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit)); @@ -775,7 +775,7 @@ private static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -788,7 +788,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit), out result); @@ -798,7 +798,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -808,8 +808,7 @@ private static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == SpecificWeightUnit.Undefined) { @@ -826,7 +825,7 @@ private static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -839,8 +838,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificWeightUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index f22a08efa2..65ea2b585c 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -1072,7 +1072,7 @@ public static bool TryParseUnit(string str, out SpeedUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -1095,7 +1095,7 @@ private static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit)); @@ -1105,7 +1105,7 @@ private static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -1118,7 +1118,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit), out result); @@ -1128,7 +1128,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1138,8 +1138,7 @@ private static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == SpeedUnit.Undefined) { @@ -1156,7 +1155,7 @@ private static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1169,8 +1168,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpeedUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 1358a921bd..51e9653746 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -544,7 +544,7 @@ public static bool TryParseUnit(string str, out TemperatureUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -567,7 +567,7 @@ private static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); @@ -577,7 +577,7 @@ private static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -590,7 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); @@ -600,7 +600,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -610,8 +610,7 @@ private static TemperatureUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == TemperatureUnit.Undefined) { @@ -628,7 +627,7 @@ private static TemperatureUnit ParseUnitInternal(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -641,8 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TemperatureUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index b4ac5aac24..2ad614f696 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -588,7 +588,7 @@ public static bool TryParseUnit(string str, out TemperatureChangeRateUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -611,7 +611,7 @@ private static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IForm { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit)); @@ -621,7 +621,7 @@ private static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IForm /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -634,7 +634,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit), out result); @@ -644,7 +644,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -654,8 +654,7 @@ private static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == TemperatureChangeRateUnit.Undefined) { @@ -672,7 +671,7 @@ private static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatPr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -685,8 +684,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TemperatureChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 61df23e355..649166194d 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -543,7 +543,7 @@ public static bool TryParseUnit(string str, out TemperatureDeltaUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -566,7 +566,7 @@ private static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatPro { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); @@ -576,7 +576,7 @@ private static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatPro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -589,7 +589,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); @@ -599,7 +599,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -609,8 +609,7 @@ private static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == TemperatureDeltaUnit.Undefined) { @@ -627,7 +626,7 @@ private static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -640,8 +639,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TemperatureDeltaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index fbd7f0df50..1ef64b75bd 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -412,7 +412,7 @@ public static bool TryParseUnit(string str, out ThermalConductivityUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -435,7 +435,7 @@ private static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit)); @@ -445,7 +445,7 @@ private static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -458,7 +458,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit), out result); @@ -468,7 +468,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -478,8 +478,7 @@ private static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ThermalConductivityUnit.Undefined) { @@ -496,7 +495,7 @@ private static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -509,8 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ThermalConductivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index abb8267004..37131cd0cb 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -478,7 +478,7 @@ public static bool TryParseUnit(string str, out ThermalResistanceUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -501,7 +501,7 @@ private static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit)); @@ -511,7 +511,7 @@ private static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatPr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -524,7 +524,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit), out result); @@ -534,7 +534,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -544,8 +544,7 @@ private static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == ThermalResistanceUnit.Undefined) { @@ -562,7 +561,7 @@ private static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -575,8 +574,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ThermalResistanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index 58de35e1c8..ac9dbe8ea3 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -830,7 +830,7 @@ public static bool TryParseUnit(string str, out TorqueUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -853,7 +853,7 @@ private static Torque ParseInternal(string str, [CanBeNull] IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit)); @@ -863,7 +863,7 @@ private static Torque ParseInternal(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -876,7 +876,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit), out result); @@ -886,7 +886,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -896,8 +896,7 @@ private static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == TorqueUnit.Undefined) { @@ -914,7 +913,7 @@ private static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -927,8 +926,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TorqueUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index b88bfe7e18..38eeeba73f 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -389,7 +389,7 @@ public static bool TryParseUnit(string str, out VitaminAUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -412,7 +412,7 @@ private static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit)); @@ -422,7 +422,7 @@ private static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -435,7 +435,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit), out result); @@ -445,7 +445,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -455,8 +455,7 @@ private static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == VitaminAUnit.Undefined) { @@ -473,7 +472,7 @@ private static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -486,8 +485,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == VitaminAUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 54d3477a18..7376e63319 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -1292,7 +1292,7 @@ public static bool TryParseUnit(string str, out VolumeUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -1315,7 +1315,7 @@ private static Volume ParseInternal(string str, [CanBeNull] IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit)); @@ -1325,7 +1325,7 @@ private static Volume ParseInternal(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -1338,7 +1338,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit), out result); @@ -1348,7 +1348,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1358,8 +1358,7 @@ private static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == VolumeUnit.Undefined) { @@ -1376,7 +1375,7 @@ private static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1389,8 +1388,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == VolumeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 803bec605b..38483f78bc 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -940,7 +940,7 @@ public static bool TryParseUnit(string str, out VolumeFlowUnit unit) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -963,7 +963,7 @@ private static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit)); @@ -973,7 +973,7 @@ private static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -986,7 +986,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit), out result); @@ -996,7 +996,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -1006,8 +1006,7 @@ private static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse(str.Trim()); + var unit = UnitParser.Parse(str.Trim(), provider); if (unit == VolumeFlowUnit.Undefined) { @@ -1024,7 +1023,7 @@ private static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -1037,8 +1036,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse(str.Trim(), out unit)) + if(!UnitParser.TryParse(str.Trim(), provider, out unit)) return false; if(unit == VolumeFlowUnit.Undefined) diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index f19995b13e..293f1d84e6 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -188,11 +188,10 @@ public void TryParseLengthUnitAbbreviationSpecialCharacters(string s) { string abbrev = $"m{s}s"; - var unitSystem = UnitSystem.Default; - unitSystem.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); + UnitAbbreviationsCache.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act - bool ok = unitSystem.TryParse(abbrev, out LengthUnit result); + bool ok = UnitParser.TryParse(abbrev, out LengthUnit result); // Assert Assert.True(ok, "TryParse " + abbrev); @@ -217,8 +216,7 @@ public void TryParseLengthSpecialCharacters(string s) { string abbrev = $"m{s}s"; - var unitSystem = UnitSystem.Default; - unitSystem.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); + UnitAbbreviationsCache.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act bool ok = Length.TryParse($"10 {abbrev}", out Length result); diff --git a/UnitsNet.Tests/QuantityTests.ToString.cs b/UnitsNet.Tests/QuantityTests.ToString.cs index d0cad78e31..c5df4717cd 100644 --- a/UnitsNet.Tests/QuantityTests.ToString.cs +++ b/UnitsNet.Tests/QuantityTests.ToString.cs @@ -79,10 +79,10 @@ public void CreatedByCtorWithValueAndUnit_ReturnsValueAndUnit() [Fact] public void ReturnsTheOriginalValueAndUnit() { - var oldCulture = UnitSystem.DefaultCulture; + var oldCulture = GlobalConfiguration.DefaultCulture; try { - UnitSystem.DefaultCulture = CultureInfo.InvariantCulture; + GlobalConfiguration.DefaultCulture = CultureInfo.InvariantCulture; Assert.Equal("5 kg", Mass.FromKilograms(5).ToString()); Assert.Equal("5,000 g", Mass.FromGrams(5000).ToString()); Assert.Equal("1e-04 long tn", Mass.FromLongTons(1e-4).ToString()); @@ -95,17 +95,17 @@ public void ReturnsTheOriginalValueAndUnit() } finally { - UnitSystem.DefaultCulture = oldCulture; + GlobalConfiguration.DefaultCulture = oldCulture; } } [Fact] public void ConvertsToTheGivenUnit() { - var oldCulture = UnitSystem.DefaultCulture; + var oldCulture = GlobalConfiguration.DefaultCulture; try { - UnitSystem.DefaultCulture = CultureInfo.InvariantCulture; + GlobalConfiguration.DefaultCulture = CultureInfo.InvariantCulture; Assert.Equal("5,000 g", Mass.FromKilograms(5).ToString(MassUnit.Gram)); Assert.Equal("5 kg", Mass.FromGrams(5000).ToString(MassUnit.Kilogram)); Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter)); @@ -113,41 +113,41 @@ public void ConvertsToTheGivenUnit() } finally { - UnitSystem.DefaultCulture = oldCulture; + GlobalConfiguration.DefaultCulture = oldCulture; } } [Fact] public void FormatsNumberUsingGivenCulture() { - var oldCulture = UnitSystem.DefaultCulture; + var oldCulture = GlobalConfiguration.DefaultCulture; try { - UnitSystem.DefaultCulture = CultureInfo.InvariantCulture; + GlobalConfiguration.DefaultCulture = CultureInfo.InvariantCulture; Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, null)); Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, CultureInfo.InvariantCulture)); Assert.Equal("0,05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, new CultureInfo("nb-NO"))); } finally { - UnitSystem.DefaultCulture = oldCulture; + GlobalConfiguration.DefaultCulture = oldCulture; } } [Fact] public void FormatsNumberUsingGivenDigitsAfterRadix() { - var oldCulture = UnitSystem.DefaultCulture; + var oldCulture = GlobalConfiguration.DefaultCulture; try { - UnitSystem.DefaultCulture = CultureInfo.InvariantCulture; + GlobalConfiguration.DefaultCulture = CultureInfo.InvariantCulture; Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, null, 4)); Assert.Equal("1.97 in", Length.FromCentimeters(5).ToString(LengthUnit.Inch, null, 2)); Assert.Equal("1.9685 in", Length.FromCentimeters(5).ToString(LengthUnit.Inch, null, 4)); } finally { - UnitSystem.DefaultCulture = oldCulture; + GlobalConfiguration.DefaultCulture = oldCulture; } } } diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index bc6c1d991f..034588c024 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -72,14 +72,12 @@ private static IEnumerable GetUnitTypesWithMissingAbbreviations unitValues) where TUnitType : Enum { - UnitSystem unitSystem = UnitSystem.GetCached(GetCulture(cultureName)); - var unitsMissingAbbreviations = new List(); - foreach (TUnitType unit in unitValues) + foreach (var unit in unitValues) { try { - unitSystem.GetDefaultAbbreviation(unit); + UnitAbbreviationsCache.GetDefaultAbbreviation(unit); } catch { @@ -161,16 +159,15 @@ public void DecimalPointDigitGroupingCultureFormatting(string culture) [InlineData("cm^^2", AreaUnit.SquareCentimeter)] public void Parse_ReturnsUnitMappedByCustomAbbreviation(string customAbbreviation, AreaUnit expected) { - UnitSystem unitSystem = UnitSystem.Default; - unitSystem.MapUnitToAbbreviation(expected, customAbbreviation); - var actual = unitSystem.Parse(customAbbreviation); + UnitAbbreviationsCache.MapUnitToAbbreviation(expected, customAbbreviation); + var actual = UnitParser.Parse(customAbbreviation); Assert.Equal(expected, actual); } [Fact] public void Parse_UnknownAbbreviationThrowsUnitNotFoundException() { - Assert.Throws(() => UnitSystem.Default.Parse("nonexistingunit")); + Assert.Throws(() => UnitParser.Parse("nonexistingunit")); } [Theory] @@ -302,7 +299,7 @@ public void ShouldUseCorrectMicroSign() Assert.Throws(() => TemperatureChangeRate.ParseUnit("\u03bc°C/s")); Assert.Throws(() => Volume.ParseUnit("\u03bcl")); Assert.Throws(() => Volume.ParseUnit("\u03bcm³")); - Assert.Throws( () => VolumeFlow.ParseUnit( "\u03bcLPM" ) ); + Assert.Throws(() => VolumeFlow.ParseUnit("\u03bcLPM")); } [Theory] @@ -399,8 +396,7 @@ public void ToString_WithRussianCulture() [Fact] public void GetDefaultAbbreviationFallsBackToDefaultStringIfNotSpecified() { - UnitSystem usUnits = new UnitSystem(AmericanCultureName); - string abbreviation = usUnits.GetDefaultAbbreviation(CustomUnit.Unit1); + string abbreviation = UnitAbbreviationsCache.GetDefaultAbbreviation(CustomUnit.Unit1); Assert.Equal("(no abbreviation for CustomUnit.Unit1)", abbreviation); } @@ -416,14 +412,13 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() // CurrentUICulture affects localization, in this case the abbreviation. // Zulu (South Africa) var zuluCulture = new CultureInfo("zu-ZA"); - UnitSystem zuluUnits = UnitSystem.GetCached(zuluCulture); CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = zuluCulture; - UnitSystem usUnits = UnitSystem.GetCached(AmericanCultureName); - usUnits.MapUnitToAbbreviation(CustomUnit.Unit1, "US english abbreviation for Unit1"); + var americanCulture = new CultureInfo(AmericanCultureName); + UnitAbbreviationsCache.MapUnitToAbbreviation(CustomUnit.Unit1, americanCulture, "US english abbreviation for Unit1"); // Act - string abbreviation = zuluUnits.GetDefaultAbbreviation(CustomUnit.Unit1); + string abbreviation = UnitAbbreviationsCache.GetDefaultAbbreviation(CustomUnit.Unit1, zuluCulture); // Assert Assert.Equal("US english abbreviation for Unit1", abbreviation); @@ -438,19 +433,17 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() [Fact] public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviationForAlreadyMappedUnits() { - UnitSystem unitSystem = UnitSystem.GetCached(AmericanCultureName); - unitSystem.MapUnitToAbbreviation(AreaUnit.SquareMeter, "m^2"); + var americanCulture = new CultureInfo(AmericanCultureName); + UnitAbbreviationsCache.MapUnitToAbbreviation(AreaUnit.SquareMeter, americanCulture, "m^2"); - Assert.Equal("m²", unitSystem.GetDefaultAbbreviation(AreaUnit.SquareMeter)); + Assert.Equal("m²", UnitAbbreviationsCache.GetDefaultAbbreviation(AreaUnit.SquareMeter)); } [Fact] public void Parse_AmbiguousUnitsThrowsException() { - UnitSystem unitSystem = UnitSystem.Default; - // Act 1 - var exception1 = Assert.Throws(() => unitSystem.Parse("pt")); + var exception1 = Assert.Throws(() => UnitParser.Parse("pt")); // Act 2 var exception2 = Assert.Throws(() => Length.Parse("1 pt")); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 90132ae5b4..7c86a5ea66 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Acceleration() public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Acceleration Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Acceleration Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Acceleration result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureN public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AccelerationUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] string cultureName, [N if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index 67b430c6ac..073e9534f4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public AmountOfSubstance() public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] string cultureName if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] string cultureName public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmountOfSubstance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cul public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmountOfSubstanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] string cultureNam if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index 7d95344135..75ec82396a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public AmplitudeRatio() public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmplitudeRatio result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmplitudeRatioUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 7bcfcaf7be..a74fb2d285 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Angle() public static string GetAbbreviation(AngleUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Angle Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Angle Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Angle result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AngleUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(AngleUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 004f69b9a8..bcbc14890e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ApparentEnergy() public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ApparentEnergy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ApparentEnergy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentEnergy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentEnergyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 6d1e61d566..ca2c7be32a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ApparentPower() public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ApparentPower Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ApparentPower Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentPower result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string culture public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentPowerUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] string cultureName, [ if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 725e07f47f..28f5d491b8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Area() public static string GetAbbreviation(AreaUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Area Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Area Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Area result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(AreaUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index 4157332524..e585464bc2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public AreaDensity() public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static AreaDensity Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static AreaDensity Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaDensity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureNa public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaDensityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] string cultureName, [No if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index 0818c8c6ea..dcd1c4f340 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public AreaMomentOfInertia() public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaMomentOfInertia result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaMomentOfInertiaUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index a09929679f..3b2fd588c5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public BitRate() public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static BitRate Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static BitRate Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BitRate result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BitRateUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] string cultureName, [NotNul if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 1fe82aee1b..42df78c48e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public BrakeSpecificFuelConsumption() public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] string if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] string public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumption result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumptionUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 5086457608..3025f548f2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Capacitance() public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Capacitance Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Capacitance Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Capacitance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureNa public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out CapacitanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] string cultureName, [No if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index 6cf673ce94..4d8cd02030 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Density() public static string GetAbbreviation(DensityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Density Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Density Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Density result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DensityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(DensityUnit unit, [CanBeNull] string cultureName, [NotNul if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index bdbb6ff198..9795d15848 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Duration() public static string GetAbbreviation(DurationUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Duration Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Duration Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Duration result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DurationUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(DurationUnit unit, [CanBeNull] string cultureName, [NotNu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index 465975ea18..7654825282 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public DynamicViscosity() public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static DynamicViscosity Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static DynamicViscosity Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out DynamicViscosity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cult public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DynamicViscosityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] string cultureName if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index ea559b1873..8c637e53da 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricAdmittance() public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] string cultureNam if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] string cultureNam public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricAdmittance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricAdmittanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] string cultureNa if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 375ceac634..f729f7eec7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricCharge() public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricCharge Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricCharge Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCharge result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index cd14f1219d..64e841d3d4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricChargeDensity() public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] string culture if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] string culture public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricChargeDensity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeDensityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] string cultur if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index bdd939509c..8623719ffb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricConductance() public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricConductance Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricConductance Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 5923d3ea9a..29ac150fc4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricConductivity() public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricConductivity Parse(string str, [CanBeNull] string cultureN if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricConductivity Parse(string str, [CanBeNull] string cultureN public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductivity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductivityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] string culture if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index b4fa9c06e3..07b88a476d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricCurrent() public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricCurrent Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricCurrent Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrent result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index 78c6ab373a..914b1d0dd8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricCurrentDensity() public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] string cultur if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] string cultur public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentDensity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] strin public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentDensityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] string cultu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index ca654f0d41..2357287b44 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricCurrentGradient() public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] string cultu if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] string cultu public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentGradient result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] stri public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentGradientUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] string cult if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index 2bb0ac6369..dcab5dcb26 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricField() public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricField Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricField Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricField result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string culture public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricFieldUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] string cultureName, [ if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index f2ac6c2209..2c11f4a8a1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricInductance() public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricInductance Parse(string str, [CanBeNull] string cultureNam if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricInductance Parse(string str, [CanBeNull] string cultureNam public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricInductance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricInductanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] string cultureNa if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index 93044739cd..b703e40efd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricPotential() public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricPotential Parse(string str, [CanBeNull] string cultureName if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricPotential Parse(string str, [CanBeNull] string cultureName public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotential result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cul public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] string cultureNam if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 2659748ede..e5d8a31a6c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricPotentialAc() public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialAc result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialAcUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 6392eb049b..b1ea7f972a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricPotentialDc() public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialDc result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialDcUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index f96c786750..e71a015780 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricResistance() public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricResistance Parse(string str, [CanBeNull] string cultureNam if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricResistance Parse(string str, [CanBeNull] string cultureNam public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] string cultureNa if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index e88f35e270..90a5f4361d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ElectricResistivity() public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ElectricResistivity Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ElectricResistivity Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistivity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistivityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index a0b9f69272..9bd1087cad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Energy() public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Energy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Energy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Energy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EnergyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] string cultureName, [NotNull if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 6238f030e2..211977e1b4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Entropy() public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Entropy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Entropy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Entropy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EntropyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] string cultureName, [NotNul if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index 29ed543d22..082ff74541 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Force() public static string GetAbbreviation(ForceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Force Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Force Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Force result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ForceUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index faaa0aaf03..f6c4f8a255 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ForceChangeRate() public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ForceChangeRate Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ForceChangeRate Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForceChangeRate result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceChangeRateUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index 505d5cce29..16c9d930c6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ForcePerLength() public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ForcePerLength Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ForcePerLength Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForcePerLength result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForcePerLengthUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index f43fc48bfb..977ac9a01f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Frequency() public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Frequency Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Frequency Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Frequency result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out FrequencyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] string cultureName, [NotN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 7b87f226c9..7350674c43 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public HeatFlux() public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static HeatFlux Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static HeatFlux Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatFlux result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatFluxUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] string cultureName, [NotNu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 286d1243a6..5153ccdff7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public HeatTransferCoefficient() public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] string cultu if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] string cultu public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatTransferCoefficient result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] stri public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatTransferCoefficientUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] string cult if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 07f1f26b49..612c9eee1a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Illuminance() public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Illuminance Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Illuminance Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Illuminance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureNa public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IlluminanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] string cultureName, [No if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index ed5fbcc5ca..31a2671d1a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Information() public static string GetAbbreviation(InformationUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Information Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Information Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Information result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureNa public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out InformationUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(InformationUnit unit, [CanBeNull] string cultureName, [No if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index e2d9a225ea..94a77f6ca5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Irradiance() public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Irradiance Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Irradiance Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureNam public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradianceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] string cultureName, [Not if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 09d1e729b6..41e31c3efe 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Irradiation() public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Irradiation Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Irradiation Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiation result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureNa public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradiationUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] string cultureName, [No if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index c2cfdd447f..2d7dc3b877 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public KinematicViscosity() public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static KinematicViscosity Parse(string str, [CanBeNull] string cultureNam if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static KinematicViscosity Parse(string str, [CanBeNull] string cultureNam public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out KinematicViscosity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out KinematicViscosityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] string cultureNa if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index 1b1bcf1f3f..165ecdc862 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public LapseRate() public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static LapseRate Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static LapseRate Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LapseRate result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LapseRateUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] string cultureName, [NotN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 1fe61a1803..5ce080de11 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Length() public static string GetAbbreviation(LengthUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Length Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Length Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Length result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LengthUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(LengthUnit unit, [CanBeNull] string cultureName, [NotNull if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index e77bdf8f9c..0f79a190d1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Level() public static string GetAbbreviation(LevelUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Level Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Level Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Level result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LevelUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(LevelUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index d6859befda..5c7c07a6c2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public LinearDensity() public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static LinearDensity Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static LinearDensity Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LinearDensity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string culture public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LinearDensityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] string cultureName, [ if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 9d5cd0ba26..75dfbba4f5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public LuminousFlux() public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static LuminousFlux Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static LuminousFlux Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousFlux result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureN public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousFluxUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] string cultureName, [N if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index 60859ccd65..0467d51044 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public LuminousIntensity() public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static LuminousIntensity Parse(string str, [CanBeNull] string cultureName if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static LuminousIntensity Parse(string str, [CanBeNull] string cultureName public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousIntensity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cul public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousIntensityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] string cultureNam if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index 00bb4eace6..cf0f43bb21 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MagneticField() public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MagneticField Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MagneticField Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticField result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string culture public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFieldUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] string cultureName, [ if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index a6c0d46120..007e2c7d27 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MagneticFlux() public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MagneticFlux Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MagneticFlux Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticFlux result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureN public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFluxUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] string cultureName, [N if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index 324aea2a43..9c1258685c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Magnetization() public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Magnetization Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Magnetization Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Magnetization result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string culture public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagnetizationUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] string cultureName, [ if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 8bbd6d33ee..52aae57cc6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Mass() public static string GetAbbreviation(MassUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Mass Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Mass Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Mass result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MassUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index b49c2bb42f..252cc4f8e5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MassFlow() public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MassFlow Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MassFlow Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlow result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFlowUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName, [NotNu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 03e608e980..382ea6842b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MassFlux() public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MassFlux Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MassFlux Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlux result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFluxUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] string cultureName, [NotNu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index 1b9a15559f..b84acc5608 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MassMomentOfInertia() public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassMomentOfInertia result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassMomentOfInertiaUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index eafb8fc227..9e4374bfef 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MolarEnergy() public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MolarEnergy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MolarEnergy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEnergy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureNa public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEnergyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] string cultureName, [No if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 3a6f2d883e..414020baea 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MolarEntropy() public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MolarEntropy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MolarEntropy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEntropy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureN public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEntropyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] string cultureName, [N if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index c15dea65b6..2af53a13dd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public MolarMass() public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static MolarMass Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static MolarMass Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarMass result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarMassUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] string cultureName, [NotN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index c71aeb8074..0702b360fb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Molarity() public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Molarity Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Molarity Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Molarity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] string cultureName, [NotNu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index 6e9cc6f93d..a466c8c529 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Permeability() public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Permeability Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Permeability Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permeability result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureN public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermeabilityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] string cultureName, [N if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index 01b3d63cf6..78b8c243a6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Permittivity() public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Permittivity Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Permittivity Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permittivity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureN public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermittivityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] string cultureName, [N if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index 70c6dce198..f1b23f1636 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Power() public static string GetAbbreviation(PowerUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Power Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Power Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Power result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(PowerUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 14bb5d0c27..7a2eabee60 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public PowerDensity() public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static PowerDensity Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static PowerDensity Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerDensity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureN public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerDensityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] string cultureName, [N if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index caf66a3345..bd18917819 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public PowerRatio() public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static PowerRatio Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static PowerRatio Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerRatio result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureNam public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerRatioUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] string cultureName, [Not if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 5c2d080a92..b24e08ae06 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Pressure() public static string GetAbbreviation(PressureUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Pressure Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Pressure Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Pressure result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(PressureUnit unit, [CanBeNull] string cultureName, [NotNu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index f895402639..955d42afbe 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public PressureChangeRate() public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static PressureChangeRate Parse(string str, [CanBeNull] string cultureNam if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static PressureChangeRate Parse(string str, [CanBeNull] string cultureNam public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PressureChangeRate result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureChangeRateUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] string cultureNa if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 4a3e0e9ff6..279f42ad89 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Ratio() public static string GetAbbreviation(RatioUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Ratio Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Ratio Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Ratio result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RatioUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(RatioUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 3fa3b36804..052d6146b2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ReactiveEnergy() public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactiveEnergy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactiveEnergyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index dbc704bc4d..99e76a5dd2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ReactivePower() public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ReactivePower Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ReactivePower Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactivePower result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string culture public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactivePowerUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] string cultureName, [ if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index a79093d3f0..7c598f2087 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public RotationalAcceleration() public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] string cultur if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] string cultur public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalAcceleration result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] strin public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalAccelerationUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] string cultu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 18469f858f..0832ae75a0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public RotationalSpeed() public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static RotationalSpeed Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static RotationalSpeed Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalSpeed result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalSpeedUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index 1dffe90992..17dac2ba7a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public RotationalStiffness() public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static RotationalStiffness Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static RotationalStiffness Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffness result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index 98cc7e53df..014fc73211 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public RotationalStiffnessPerLength() public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] string if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] string public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLength result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLengthUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index 5ca279aed8..b7e92d9917 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public SolidAngle() public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static SolidAngle Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static SolidAngle Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SolidAngle result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureNam public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SolidAngleUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] string cultureName, [Not if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index c791bf4cc2..72996cfc4a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public SpecificEnergy() public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static SpecificEnergy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static SpecificEnergy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEnergy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEnergyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 92f9bebf49..2ec0fcaba8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public SpecificEntropy() public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static SpecificEntropy Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static SpecificEntropy Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEntropy result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultu public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEntropyUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index d9dbb9e54a..c363999760 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public SpecificVolume() public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static SpecificVolume Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static SpecificVolume Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificVolume result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificVolumeUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index b97dd29318..98fa990414 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public SpecificWeight() public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static SpecificWeight Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static SpecificWeight Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificWeight result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultur public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificWeightUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] string cultureName, if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index ea81e1bda2..8a8917df9d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Speed() public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Speed Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Speed Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Speed result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpeedUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] string cultureName, [NotNull] if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index 1d9ff640f9..2c681a50e7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Temperature() public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Temperature Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Temperature Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Temperature result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureNa public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] string cultureName, [No if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index 50189cdb79..b6f7f9d38e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public TemperatureChangeRate() public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] string culture if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] string culture public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureChangeRate result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureChangeRateUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] string cultur if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 50f518c8af..03141e7c9f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public TemperatureDelta() public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static TemperatureDelta Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static TemperatureDelta Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureDelta result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cult public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureDeltaUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] string cultureName if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index 1e250e9c7f..e2e52066ac 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ThermalConductivity() public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ThermalConductivity Parse(string str, [CanBeNull] string cultureNa if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ThermalConductivity Parse(string str, [CanBeNull] string cultureNa public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalConductivity result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string c public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalConductivityUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] string cultureN if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index 4f477dbe22..2e5b909ebb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public ThermalResistance() public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static ThermalResistance Parse(string str, [CanBeNull] string cultureName if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static ThermalResistance Parse(string str, [CanBeNull] string cultureName public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalResistance result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cul public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalResistanceUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] string cultureNam if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index da0729e268..349b3d9d6a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Torque() public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Torque Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Torque Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Torque result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TorqueUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] string cultureName, [NotNull if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 50dcdf73ca..3bd43a4de7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public VitaminA() public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static VitaminA Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static VitaminA Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VitaminA result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VitaminAUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] string cultureName, [NotNu if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index e4300f61dc..3d8c208964 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public Volume() public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static Volume Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static Volume Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Volume result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] string cultureName, [NotNull if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index fd606b2710..6dfabf538e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -81,9 +81,9 @@ public VolumeFlow() public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -116,7 +116,7 @@ public static VolumeFlow Parse(string str, [CanBeNull] string cultureName) if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -133,7 +133,7 @@ public static VolumeFlow Parse(string str, [CanBeNull] string cultureName) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VolumeFlow result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -151,7 +151,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -169,7 +169,7 @@ public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureNam public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeFlowUnit unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -219,7 +219,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] string cultureName, [Not if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/CustomCode/GlobalConfiguration.cs b/UnitsNet/CustomCode/GlobalConfiguration.cs new file mode 100644 index 0000000000..396eb0ca07 --- /dev/null +++ b/UnitsNet/CustomCode/GlobalConfiguration.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; + +// ReSharper disable once CheckNamespace +namespace UnitsNet +{ + public sealed class GlobalConfiguration + { + /// + /// Defaults to when creating an instance with no culture provided. + /// Can be overridden, but note that this is static and will affect all subsequent usages. + /// +#if WINDOWS_UWP + // Windows Runtime Component does not support exposing the IFormatProvider type in public API + internal +#else + public +#endif + static IFormatProvider DefaultCulture { get; set; } = CultureInfo.CurrentUICulture; + } +} diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index 8ba55134c1..f57541d31b 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -140,11 +140,10 @@ public string ToString([CanBeNull] Culture cultureInfo) { // Note that it isn't customary to use fractions - one wouldn't say "I am 5 feet and 4.5 inches". // So inches are rounded when converting from base units to feet/inches. - UnitSystem unitSystem = UnitSystem.GetCached(cultureInfo); - string footUnit = unitSystem.GetDefaultAbbreviation(LengthUnit.Foot); - string inchUnit = unitSystem.GetDefaultAbbreviation(LengthUnit.Inch); + var footUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(LengthUnit.Foot); + var inchUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(LengthUnit.Inch); - return string.Format(unitSystem.Culture, "{0:n0} {1} {2:n0} {3}", Feet, footUnit, Math.Round(Inches), + return string.Format(GlobalConfiguration.DefaultCulture, "{0:n0} {1} {2:n0} {3}", Feet, footUnit, Math.Round(Inches), inchUnit); } } diff --git a/UnitsNet/CustomCode/Quantities/Mass.extra.cs b/UnitsNet/CustomCode/Quantities/Mass.extra.cs index d3bcb95044..9a35bb6554 100644 --- a/UnitsNet/CustomCode/Quantities/Mass.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Mass.extra.cs @@ -130,11 +130,10 @@ public string ToString([CanBeNull] Culture cultureInfo) // Note that it isn't customary to use fractions - one wouldn't say "I am 11 stone and 4.5 pounds". // So pounds are rounded here. - UnitSystem unitSystem = UnitSystem.GetCached(cultureInfo); - string stoneUnit = unitSystem.GetDefaultAbbreviation(MassUnit.Stone); - string poundUnit = unitSystem.GetDefaultAbbreviation(MassUnit.Pound); + var stoneUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(MassUnit.Stone); + var poundUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(MassUnit.Pound); - return string.Format(unitSystem.Culture, "{0:n0} {1} {2:n0} {3}", + return string.Format(GlobalConfiguration.DefaultCulture, "{0:n0} {1} {2:n0} {3}", Stone, stoneUnit, Math.Round(Pounds), poundUnit); } } diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index 85481901d0..6bfe6bedee 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -72,8 +72,7 @@ internal static TQuantity Parse([NotNull] string str, const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; - var unitAbbreviations = UnitSystem.GetCached(formatProvider) - .GetAllAbbreviations(typeof(TUnitType)) + var unitAbbreviations = UnitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error .Select(Regex.Escape) // Escape special regex characters .ToArray(); @@ -186,8 +185,7 @@ internal static bool TryParse([NotNull] string str, const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; - var unitAbbreviations = UnitSystem.GetCached(formatProvider) - .GetAllAbbreviations(typeof(TUnitType)) + var unitAbbreviations = UnitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error .Select(Regex.Escape) // Escape special regex characters .ToArray(); @@ -214,7 +212,7 @@ internal static bool TryParse([NotNull] string str, /// /// Error parsing string. private static bool TryParseWithRegex(string regexString, string str, TryParseUnitDelegate tryParseUnit, - QuantityFromDelegate fromDelegate, IFormatProvider formatProvider, out List converted ) + QuantityFromDelegate fromDelegate, IFormatProvider formatProvider, out List converted) where TQuantity : IQuantity where TUnitType : Enum { @@ -243,7 +241,7 @@ private static bool TryParseWithRegex(string regexString, var quantity = fromDelegate(value, parsedUnit); - converted.Add( quantity ); + converted.Add(quantity); } return true; diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs new file mode 100644 index 0000000000..c5212817d8 --- /dev/null +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -0,0 +1,293 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.InternalHelpers; +using UnitsNet.Units; + +using UnitTypeToLookup = System.Collections.Generic.Dictionary; + +// ReSharper disable once CheckNamespace +namespace UnitsNet +{ + public static partial class UnitAbbreviationsCache + { + private static Dictionary looksupsForCulture; + + /// + /// Fallback culture used by and + /// if no abbreviations are found with a given culture. + /// + /// + /// User wants to call or with Russian + /// culture, but no translation is defined, so we return the US English definition as a last resort. If it's not + /// defined there either, an exception is thrown. + /// + private static readonly CultureInfo FallbackCulture = new CultureInfo("en-US"); + + static UnitAbbreviationsCache() + { + looksupsForCulture = new Dictionary(); + + LoadGeneratedAbbreviations(); + } + + private static void LoadGeneratedAbbreviations() + { + foreach(var localization in DefaultLocalizations) + { + var culture = new CultureInfo(localization.Item1); + MapUnitToAbbreviation(localization.Item2, localization.Item3, culture, localization.Item4); + } + } + + /// + /// Adds one or more unit abbreviation for the given unit enum value. + /// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums + /// in order to or on them later. + /// + /// The unit enum value. + /// Unit abbreviations to add. + /// The type of unit enum. + [PublicAPI] + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods +#if WINDOWS_UWP + internal +#else + public +#endif + static void MapUnitToAbbreviation(TUnitType unit, params string[] abbreviations) where TUnitType : Enum + { + MapUnitToAbbreviation(typeof(TUnitType), Convert.ToInt32(unit), GlobalConfiguration.DefaultCulture, abbreviations); + } + + /// + /// Adds one or more unit abbreviation for the given unit enum value. + /// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums + /// in order to or on them later. + /// + /// The unit enum value. + /// The format provider to use for lookup. Defaults to if null. + /// Unit abbreviations to add. + /// The type of unit enum. + [PublicAPI] + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods +#if WINDOWS_UWP + internal +#else + public +#endif + static void MapUnitToAbbreviation(TUnitType unit, IFormatProvider formatProvider, params string[] abbreviations) where TUnitType : Enum + { + // Assuming TUnitType is an enum, this conversion is safe. Seems not possible to enforce this today. + // Src: http://stackoverflow.com/questions/908543/how-to-convert-from-system-enum-to-base-integer + // http://stackoverflow.com/questions/79126/create-generic-method-constraining-t-to-an-enum + var unitValue = Convert.ToInt32(unit); + var unitType = typeof(TUnitType); + + MapUnitToAbbreviation(unitType, unitValue, formatProvider, abbreviations); + } + + /// + /// Adds one or more unit abbreviation for the given unit enum value. + /// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums + /// in order to or on them later. + /// + /// The unit enum type. + /// The unit enum value. + /// The format provider to use for lookup. Defaults to if null. + /// Unit abbreviations to add. + [PublicAPI] + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods +#if WINDOWS_UWP + internal +#else + public +#endif + static void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider, [NotNull] params string[] abbreviations) + { + if (!unitType.IsEnum()) + throw new ArgumentException("Must be an enum type.", nameof(unitType)); + + if (abbreviations == null) + throw new ArgumentNullException(nameof(abbreviations)); + + formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; + + if(!looksupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) + quantitiesForProvider = looksupsForCulture[formatProvider] = new UnitTypeToLookup(); + + if(!quantitiesForProvider.TryGetValue(unitType, out var unitToAbbreviations)) + unitToAbbreviations = quantitiesForProvider[unitType] = new UnitValueAbbreviationLookup(); + + foreach(var abbr in abbreviations) + { + unitToAbbreviations.Add(unitValue, abbr); + } + } + + /// + /// Gets the default abbreviation for a given unit. If a unit has more than one abbreviation defined, then it returns the first one. + /// Example: GetDefaultAbbreviation<LengthUnit>(LengthUnit.Kilometer) => "km" + /// + /// The unit enum value. + /// The format provider to use for lookup. Defaults to if null. + /// The type of unit enum. + /// The default unit abbreviation string. + [PublicAPI] + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods +#if WINDOWS_UWP + internal +#else + public +#endif + static string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum + { + var unitType = typeof(TUnitType); + var unitValue = Convert.ToInt32(unit); + + var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); + if(lookup == null) + return $"(no abbreviation for {unitType.Name}.{unit})"; + + var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); + if(abbreviations.Count == 0) + return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture) : $"(no abbreviation for {unitType.Name}.{unit})"; + + return abbreviations.First(); + } + + /// + /// Gets the default abbreviation for a given unit type and its numeric enum value. + /// If a unit has more than one abbreviation defined, then it returns the first one. + /// Example: GetDefaultAbbreviation<LengthUnit>(typeof(LengthUnit), 1) => "cm" + /// + /// The unit enum type. + /// The unit enum value. + /// The format provider to use for lookup. Defaults to if null. + /// The default unit abbreviation string. + [PublicAPI] +#if WINDOWS_UWP + internal +#else + public +#endif + static string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider = null) + { + var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); + if(lookup == null) + return $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; + + var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); + if(abbreviations.Count == 0) + return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture) : $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; + + return abbreviations.First(); + } + + /// + /// Get all abbreviations for unit. + /// + /// Enum type for units. + /// Enum value for unit. + /// The format provider to use for lookup. Defaults to if null. + /// Unit abbreviations associated with unit. + [PublicAPI] + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods +#if WINDOWS_UWP + internal +#else + public +#endif + static string[] GetAllAbbreviations(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum + { + return GetAllAbbreviations(typeof(TUnitType), formatProvider); + } + + /// + /// Get all abbreviations for unit. + /// + /// Enum type for unit. + /// Enum value for unit. + /// The format provider to use for lookup. Defaults to if null. + /// Unit abbreviations associated with unit. + [PublicAPI] +#if WINDOWS_UWP + internal +#else + public +#endif + static string[] GetAllAbbreviations(Type unitType, int unitValue, IFormatProvider formatProvider = null) + { + formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; + + var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); + if(lookup == null) + return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; + + var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); + if(abbreviations.Count == 0) + return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; + + return abbreviations.ToArray(); + } + + /// + /// Get all abbreviations for unit. + /// + /// Enum type for unit. + /// The format provider to use for lookup. Defaults to if null. + /// Unit abbreviations associated with unit. + [PublicAPI] +#if WINDOWS_UWP + internal +#else + public +#endif + static string[] GetAllAbbreviations(Type unitType, IFormatProvider formatProvider = null) + { + formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; + + var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); + if(lookup == null) + return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, FallbackCulture) : new string[] { }; + + return lookup.GetAllAbbreviations(); + } + + internal static UnitValueAbbreviationLookup GetUnitValueAbbreviationLookup(Type unitType, IFormatProvider formatProvider = null) + { + formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; + + if(!looksupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) + return formatProvider != FallbackCulture ? GetUnitValueAbbreviationLookup(unitType, FallbackCulture) : null; + + if(!quantitiesForProvider.TryGetValue(unitType, out var unitToAbbreviations)) + return formatProvider != FallbackCulture ? GetUnitValueAbbreviationLookup(unitType, FallbackCulture) : null; + + return unitToAbbreviations; + } + } +} diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs new file mode 100644 index 0000000000..1f4b7b94bc --- /dev/null +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -0,0 +1,192 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.InternalHelpers; +using UnitsNet.Units; + +// ReSharper disable once CheckNamespace +namespace UnitsNet +{ + public static class UnitParser + { + /// + /// Parses a unit abbreviation for a given unit enumeration type. + /// Example: Parse<LengthUnit>("km") => LengthUnit.Kilometer + /// + /// + /// The format provider to use for lookup. Defaults to if null. + /// + /// + [PublicAPI] +#if WINDOWS_UWP + internal +#else + public +#endif + static TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider formatProvider = null) where TUnitType : Enum + { + return (TUnitType)Parse(unitAbbreviation, typeof(TUnitType)); + } + + /// + /// Parse a unit abbreviation, such as "kg" or "m", to the unit enum value of the enum type + /// . + /// + /// + /// Unit abbreviation, such as "kg" or "m" for and + /// respectively. + /// + /// Unit enum type, such as and . + /// The format provider to use for lookup. Defaults to if null. + /// Unit enum value, such as . + /// No units match the abbreviation. + /// More than one unit matches the abbrevation. + [PublicAPI] +#if WINDOWS_UWP + internal +#else + public +#endif + static object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null) + { + var abbreviations = UnitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); + if(abbreviations == null) + throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}]."); + + var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); + + switch (unitIntValues.Count) + { + case 1: + return unitIntValues[0]; + case 0: + throw new UnitNotFoundException($"Unit not found with abbreviation [{unitAbbreviation}] for unit type [{unitType}]."); + default: + string unitsCsv = string.Join(", ", unitIntValues.Select(x => Enum.GetName(unitType, x)).ToArray()); + throw new AmbiguousUnitParseException( + $"Cannot parse \"{unitAbbreviation}\" since it could be either of these: {unitsCsv}"); + } + } + + /// + /// Try to parse a unit abbreviation. + /// + /// The string value. + /// The unit enum value as out result. + /// Type of unit enum. + /// True if successful. + [PublicAPI] + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods +#if WINDOWS_UWP + internal +#else + public +#endif + static bool TryParse(string unitAbbreviation, out TUnitType unit) where TUnitType : Enum + { + return TryParse(unitAbbreviation, null, out unit); + } + + /// + /// Try to parse a unit abbreviation. + /// + /// The string value. + /// The format provider to use for lookup. Defaults to if null. + /// The unit enum value as out result. + /// Type of unit enum. + /// True if successful. + [PublicAPI] + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods +#if WINDOWS_UWP + internal +#else + public +#endif + static bool TryParse(string unitAbbreviation, [CanBeNull] IFormatProvider formatProvider, out TUnitType unit) where TUnitType : Enum + { + unit = default(TUnitType); + + if(!TryParse(unitAbbreviation, typeof(TUnitType), formatProvider, out var unitObj)) + return false; + + unit = (TUnitType)unitObj; + return true; + } + + /// + /// Try to parse a unit abbreviation. + /// + /// The string value. + /// Type of unit enum. + /// The unit enum value as out result. + /// True if successful. + [PublicAPI] + public static bool TryParse(string unitAbbreviation, Type unitType, out object unit) + { + return TryParse(unitAbbreviation, unitType, null, out unit); + } + + /// + /// Try to parse a unit abbreviation. + /// + /// The string value. + /// Type of unit enum. + /// The format provider to use for lookup. Defaults to if null. + /// The unit enum value as out result. + /// True if successful. + [PublicAPI] +#if WINDOWS_UWP + internal +#else + public +#endif + static bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider, out object unit) + { + unit = GetDefault(unitType); + + var abbreviations = UnitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); + if(abbreviations == null) + return false; + + var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); + if(unitIntValues.Count != 1) + return false; + + unit = unitIntValues[0]; + return true; + } + + /// + /// Get default(Type) of + /// + /// . + /// Null for reference types, 0 for numeric types and default constructor for the rest. + /// + private static object GetDefault(Type type) + { + return type.IsValueType() ? Activator.CreateInstance(type): null; + } + } +} diff --git a/UnitsNet/CustomCode/UnitSystem.cs b/UnitsNet/CustomCode/UnitSystem.cs deleted file mode 100644 index 093b996d83..0000000000 --- a/UnitsNet/CustomCode/UnitSystem.cs +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.I18n; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -using AbbreviationMap = System.Collections.Generic.Dictionary>; - -// ReSharper disable once CheckNamespace -namespace UnitsNet -{ - /// - /// Main facade for working with units dynamically and configuring default behavior for quantities' ToString(): - /// - Instance per culture via , for caching number formatting and unit abbreviation localization - /// - Use for local system's current culture - /// - Override to affect number formatting and localization of all quantities' ToString() when culture is not specified - /// - unit abbreviations with dynamic types - /// - Dynamically add abbreviations to unit enums with - /// - [PublicAPI] - public sealed partial class UnitSystem - { - private static readonly Dictionary CultureToInstance; - - /// - /// Fallback culture used by and - /// - /// if no abbreviations are found with current . - /// - /// - /// User wants to call or with Russian - /// culture, but no translation is defined, so we return the US English definition as a last resort. If it's not - /// defined there either, an exception is thrown. - /// - private static readonly CultureInfo FallbackCulture = new CultureInfo("en-US"); - - private static readonly object LockUnitSystemCache = new object(); - - /// - /// Per-unit-type dictionary of enum values by abbreviation. This is the inverse of - /// . - /// - private readonly Dictionary _unitTypeToAbbrevToUnitValue; - - /// - /// Per-unit-type dictionary of abbreviations by enum value. This is the inverse of - /// . - /// - private readonly Dictionary>> _unitTypeToUnitValueToAbbrevs; - - /// - /// The culture of which this unit system is based on. Either passed in to constructor or the default culture. - /// - [NotNull] [PublicAPI] internal readonly IFormatProvider Culture; - - static UnitSystem() - { - CultureToInstance = new Dictionary(); - Default = GetCached((CultureInfo) null); - } - - /// - /// Create unit system for parsing and generating strings with the English US culture. - /// - public UnitSystem() : this(DefaultCulture) - { - - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - /// - /// Create unit system for parsing and generating strings of the specified culture. - /// If null is specified, the default English US culture will be used. - /// - /// - public UnitSystem([CanBeNull] string cultureInfo) : this(cultureInfo != null ? new CultureInfo(cultureInfo) : DefaultCulture) - { - } -#else - /// - /// Create unit system for parsing and generating strings of the specified culture. - /// If null is specified, the default English US culture will be used. - /// - /// - /// - /// If true (default), loads abbreviations per unit defined in - /// /UnitsNet/UnitDefinitions/*.json files. Otherwise, creates an empty instance. - /// - public UnitSystem([CanBeNull] string cultureInfo, bool loadDefaultAbbreviations = true) : this(cultureInfo != null ? new CultureInfo(cultureInfo) : DefaultCulture) - { - } -#endif - - /// - /// Create unit system for parsing and generating strings of the specified culture. - /// If null is specified, the default English US culture will be used. - /// - /// - /// - /// If true (default), loads abbreviations per unit defined in - /// /UnitsNet/UnitDefinitions/*.json files. Otherwise, creates an empty instance. - /// - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - UnitSystem([CanBeNull] IFormatProvider cultureInfo, bool loadDefaultAbbreviations = true) - { - if (cultureInfo == null) - cultureInfo = DefaultCulture; - - Culture = cultureInfo; - _unitTypeToUnitValueToAbbrevs = new Dictionary>>(); - _unitTypeToAbbrevToUnitValue = new Dictionary(); - - if (loadDefaultAbbreviations) - LoadDefaultAbbreviations(cultureInfo); - } - - /// - /// Defaults to when creating an instance with no culture provided. - /// Can be overridden, but note that this is static and will affect all subsequent usages. - /// -#if WINDOWS_UWP - // Windows Runtime Component does not support exposing the IFormatProvider type in public API - internal -#else - public -#endif - static IFormatProvider DefaultCulture { get; set; } = CultureInfo.CurrentUICulture; - - /// - /// Whether this instance is for the . - /// - private bool IsFallbackCulture => Culture.Equals(FallbackCulture); - - /// - /// Clear the cached singleton instances. - /// Calling or afterwards will create a new instance. - /// - [PublicAPI] - public static void ClearCache() - { - lock (LockUnitSystemCache) - { - CultureToInstance.Clear(); - } - } - - /// - /// The default singleton instance based on the system default UI culture . - /// This instance is used internally for all parsing and string formatting where culture is not explicitly specified, - /// so use this if you want extend with new units via - /// and make the new units available to methods like ; when culture is not - /// explicitly - /// specified. - /// If you do explicitly specify culture when parsing and calling ToString(), then just make sure to call - /// with the same culture. - /// - public static UnitSystem Default { get; } - - /// - /// Get or create a unit system for parsing and presenting numbers, units and abbreviations. - /// Creating can be a little expensive, so it will use a static cache. - /// To always create, use the constructor. - /// - /// Culture to use. If null then will be used. - /// - [PublicAPI] - public static UnitSystem GetCached([CanBeNull] string cultureName) - { - IFormatProvider cultureInfo = cultureName == null ? DefaultCulture : new CultureInfo(cultureName); - return GetCached(cultureInfo); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Gets or creates the singleton instance configured with localized unit abbreviations and number formatting for the given culture. - /// - /// The culture. - /// The instance. -#if WINDOWS_UWP - internal -#else - public -#endif - static UnitSystem GetCached([CanBeNull] IFormatProvider cultureInfo) - { - if (cultureInfo == null) - cultureInfo = DefaultCulture; - - lock (LockUnitSystemCache) - { - if (CultureToInstance.ContainsKey(cultureInfo)) - return CultureToInstance[cultureInfo]; - - CultureToInstance[cultureInfo] = new UnitSystem(cultureInfo); - return CultureToInstance[cultureInfo]; - } - } - - /// - /// Parses a unit abbreviation for a given unit enumeration type. - /// Example: Parse<LengthUnit>("km") => LengthUnit.Kilometer - /// - /// - /// - /// - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - TUnitType Parse(string unitAbbreviation) - where TUnitType : Enum - { - return (TUnitType) Parse(unitAbbreviation, typeof(TUnitType)); - } - - /// - /// Parse a unit abbreviation, such as "kg" or "m", to the unit enum value of the enum type - /// . - /// - /// - /// Unit abbreviation, such as "kg" or "m" for and - /// respectively. - /// - /// Unit enum type, such as and . - /// Unit enum value, such as . - /// No units match the abbreviation. - /// More than one unit matches the abbrevation. - [PublicAPI] - public object Parse(string unitAbbreviation, Type unitType) - { - if (!_unitTypeToAbbrevToUnitValue.TryGetValue(unitType, out var abbrevToUnitValue)) - throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{Culture}]."); - - List unitValues = abbrevToUnitValue.TryGetValue(unitAbbreviation, out var unitIntValues) - ? unitIntValues.Distinct().Cast().ToList() - : new List(); - - switch (unitValues.Count) - { - case 1: - return unitValues[0]; - case 0: - throw new UnitNotFoundException($"Unit not found with abbreviation [{unitAbbreviation}] for unit type [{unitType}]."); - default: - string unitsCsv = string.Join(", ", unitValues.Select(x => Enum.GetName(unitType, x)).ToArray()); - throw new AmbiguousUnitParseException( - $"Cannot parse \"{unitAbbreviation}\" since it could be either of these: {unitsCsv}"); - } - } - - /// - /// Gets the default abbreviation for a given unit. If a unit has more than one abbreviation defined, then it returns the first one. - /// Example: GetDefaultAbbreviation<LengthUnit>(LengthUnit.Kilometer) => "km" - /// - /// The unit enum value. - /// The type of unit enum. - /// The default unit abbreviation string. - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - string GetDefaultAbbreviation(TUnitType unit) - where TUnitType : Enum - { - return GetAllAbbreviations(unit).First(); - } - - /// - /// Gets the default abbreviation for a given unit type and its numeric enum value. - /// If a unit has more than one abbreviation defined, then it returns the first one. - /// Example: GetDefaultAbbreviation<LengthUnit>(typeof(LengthUnit), 1) => "cm" - /// - /// The unit enum type. - /// The unit enum value. - /// The default unit abbreviation string. - [PublicAPI] - public string GetDefaultAbbreviation(Type unitType, int unitValue) - { - return GetAllAbbreviations(unitType, unitValue).First(); - } - - /// - /// Adds one or more unit abbreviation for the given unit enum value. - /// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums - /// in order to or on them later. - /// - /// The unit enum value. - /// Unit abbreviations to add. - /// The type of unit enum. - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - void MapUnitToAbbreviation(TUnitType unit, params string[] abbreviations) - where TUnitType : Enum - { - // Assuming TUnitType is an enum, this conversion is safe. Seems not possible to enforce this today. - // Src: http://stackoverflow.com/questions/908543/how-to-convert-from-system-enum-to-base-integer - // http://stackoverflow.com/questions/79126/create-generic-method-constraining-t-to-an-enum - int unitValue = Convert.ToInt32(unit); - Type unitType = typeof(TUnitType); - MapUnitToAbbreviation(unitType, unitValue, abbreviations); - } - - /// - /// Adds one or more unit abbreviation for the given unit enum value. - /// This is used to dynamically add abbreviations for existing unit enums such as or to extend with third-party unit enums - /// in order to or on them later. - /// - /// The unit enum type. - /// The unit enum value. - /// Unit abbreviations to add. - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - void MapUnitToAbbreviation(Type unitType, int unitValue, [NotNull] params string[] abbreviations) - { - if (!unitType.IsEnum()) - throw new ArgumentException("Must be an enum type.", nameof(unitType)); - - if (abbreviations == null) - throw new ArgumentNullException(nameof(abbreviations)); - - Dictionary> unitValueToAbbrev; - if (!_unitTypeToUnitValueToAbbrevs.TryGetValue(unitType, out unitValueToAbbrev)) - { - unitValueToAbbrev = _unitTypeToUnitValueToAbbrevs[unitType] = new Dictionary>(); - } - - List existingAbbreviations; - if (!unitValueToAbbrev.TryGetValue(unitValue, out existingAbbreviations)) - { - existingAbbreviations = unitValueToAbbrev[unitValue] = new List(); - } - - // Append new abbreviations to any existing abbreviations so that we don't - // change the result of GetDefaultAbbreviation() if already defined. - unitValueToAbbrev[unitValue] = existingAbbreviations.Concat(abbreviations).Distinct().ToList(); - foreach (string abbreviation in abbreviations) - { - AbbreviationMap abbrevToUnitValue; - if (!_unitTypeToAbbrevToUnitValue.TryGetValue(unitType, out abbrevToUnitValue)) - { - abbrevToUnitValue = _unitTypeToAbbrevToUnitValue[unitType] = new AbbreviationMap(); - } - - if (!abbrevToUnitValue.ContainsKey(abbreviation)) - { - abbrevToUnitValue[abbreviation] = new List(); - } - abbrevToUnitValue[abbreviation].Add(unitValue); - } - } - - /// - /// Try to parse a unit abbreviation. - /// - /// The string value. - /// The unit enum value as out result. - /// Type of unit enum. - /// True if successful. - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - bool TryParse(string unitAbbreviation, out TUnitType unit) - where TUnitType : Enum - { - unit = default(TUnitType); - - if(!TryParse(unitAbbreviation, typeof(TUnitType), out var unitObj)) - return false; - - unit = (TUnitType)unitObj; - return true; - } - - /// - /// Try to parse a unit abbreviation. - /// - /// The string value. - /// Type of unit enum. - /// The unit enum value as out result. - /// True if successful. - [PublicAPI] - public bool TryParse(string unitAbbreviation, Type unitType, out object unit) - { - unit = GetDefault(unitType); - - if (!_unitTypeToAbbrevToUnitValue.TryGetValue(unitType, out var abbrevToUnitValue)) - return false; - - var unitValues = abbrevToUnitValue.TryGetValue(unitAbbreviation, out var unitIntValues) - ? unitIntValues.Distinct().Cast().ToList() - : new List(); - - if(unitValues.Count != 1) - return false; - - unit = unitValues[0]; - return true; - } - - /// - /// Get all abbreviations for unit. - /// - /// Enum type for units. - /// Enum value for unit. - /// Unit abbreviations associated with unit. - [PublicAPI] - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - string[] GetAllAbbreviations(TUnitType unit) - where TUnitType : Enum - { - Dictionary> unitValueToAbbrevs; - List abbrevs; - - if (_unitTypeToUnitValueToAbbrevs.TryGetValue(typeof(TUnitType), out unitValueToAbbrevs) && - unitValueToAbbrevs.TryGetValue((int) (object) unit, out abbrevs)) - { - return abbrevs.ToArray(); - } - - return IsFallbackCulture - ? new[] {$"(no abbreviation for {typeof(TUnitType).Name}.{unit})"} - : GetCached(FallbackCulture).GetAllAbbreviations(unit); - } - - /// - /// Get all abbreviations for unit. - /// - /// Enum type for unit. - /// Enum value for unit. - /// Unit abbreviations associated with unit. - [PublicAPI] - public string[] GetAllAbbreviations(Type unitType, int unitValue) - { - Dictionary> unitValueToAbbrevs; - List abbrevs; - - if (_unitTypeToUnitValueToAbbrevs.TryGetValue(unitType, out unitValueToAbbrevs) && - unitValueToAbbrevs.TryGetValue(unitValue, out abbrevs)) - { - return abbrevs.ToArray(); - } - - // Fall back to default culture - return IsFallbackCulture - ? new[] {$"(no abbreviation for {unitType.Name} with numeric value {unitValue})"} - : GetCached(FallbackCulture).GetAllAbbreviations(unitType, unitValue); - } - - /// - /// Get all abbreviations for unit. - /// - /// Enum type for unit. - /// Unit abbreviations associated with unit. - [PublicAPI] - public string[] GetAllAbbreviations(Type unitType) - { - Dictionary> unitValueToAbbrevs; - if (_unitTypeToUnitValueToAbbrevs.TryGetValue(unitType, out unitValueToAbbrevs)) - { - return unitValueToAbbrevs.Values.SelectMany(x => x).ToArray(); - } - - // Fall back to default culture - return IsFallbackCulture - ? new[] {$"(no abbreviations for {unitType.Name})"} - : GetCached(FallbackCulture).GetAllAbbreviations(unitType); - } - - private void LoadDefaultAbbreviations([NotNull] IFormatProvider culture) - { - foreach (UnitLocalization localization in DefaultLocalizations) - { - Type unitEnumType = localization.UnitEnumType; - - foreach (CulturesForEnumValue ev in localization.EnumValues) - { - int unitEnumValue = ev.Value; - - // Fall back to US English if localization not found - var matchingCulture = - ev.Cultures.FirstOrDefault(a => a.Cult.Equals(culture)) ?? - ev.Cultures.FirstOrDefault(a => a.Cult.Equals(FallbackCulture)); - - if (matchingCulture == null) - continue; - - MapUnitToAbbreviation(unitEnumType, unitEnumValue, matchingCulture.Abbreviations.ToArray()); - } - } - } - - /// - /// Get default(Type) of - /// - /// . - /// Null for reference types, 0 for numeric types and default constructor for the rest. - /// - private static object GetDefault(Type type) - { - return type - .IsValueType() - ? Activator.CreateInstance(type) - : null; - } - } -} diff --git a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs new file mode 100644 index 0000000000..6cc5277852 --- /dev/null +++ b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs @@ -0,0 +1,78 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System.Collections.Generic; +using System.Linq; + +using UnitToAbbreviationMap = System.Collections.Generic.Dictionary>; +using AbbreviationToUnitMap = System.Collections.Generic.Dictionary>; + +// ReSharper disable once CheckNamespace +namespace UnitsNet +{ + internal class UnitValueAbbreviationLookup + { + private UnitToAbbreviationMap unitToAbbreviationMap = new UnitToAbbreviationMap(); + private AbbreviationToUnitMap abbreviationToUnitMap = new AbbreviationToUnitMap(); + + internal UnitValueAbbreviationLookup() + { + unitToAbbreviationMap = new UnitToAbbreviationMap(); + abbreviationToUnitMap = new AbbreviationToUnitMap(); + } + + internal string[] GetAllAbbreviations() + { + return unitToAbbreviationMap.Values.SelectMany((abbreviations) => + { + return abbreviations; + } ).ToArray(); + } + + internal List GetAbbreviationsForUnit(int unit) + { + if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviations)) + unitToAbbreviationMap[unit] = abbreviations = new List(); + + return abbreviations; + } + + internal List GetUnitsForAbbreviation(string abbreviation) + { + if(!abbreviationToUnitMap.TryGetValue(abbreviation, out var units)) + abbreviationToUnitMap[abbreviation] = units = new List(); + + return units; + } + + internal void Add(int unit, string abbreviation) + { + if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviations)) + abbreviations = unitToAbbreviationMap[unit] = new List(); + + if(!abbreviationToUnitMap.TryGetValue(abbreviation, out var units)) + abbreviationToUnitMap[abbreviation] = units = new List(); + + abbreviations.Add(abbreviation); + units.Add(unit); + } + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 17c68035b7..320fa02b8a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Acceleration : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static AccelerationUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index b8f5b3a0a5..cbb79cba28 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct AmountOfSubstance : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static AmountOfSubstanceUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider p if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index b9c8db3e23..04ee681117 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct AmplitudeRatio : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Logarithmic Arithmetic Operators @@ -142,7 +140,7 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -170,7 +168,7 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -185,7 +183,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -200,7 +198,7 @@ public static AmplitudeRatioUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -219,7 +217,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) { @@ -230,7 +228,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -244,7 +242,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -255,7 +253,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 4f9de940f6..c5a171ebe2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Angle : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static AngleUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider, [No if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index ce3dc8509c..a2932a0d17 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ApparentEnergy : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ApparentEnergyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index cbba8dc42e..b44cfe9250 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ApparentPower : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ApparentPowerUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 9b6edc1576..6301c2c3a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Area : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Area Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static AreaUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider, [Not if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index cfe0a699de..b264b07995 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct AreaDensity : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static AreaDensityUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 53ad358201..8cb191b760 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct AreaMomentOfInertia : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 5971ec1578..c0dadac170 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct BitRate : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvid /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static BitRateUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider, i /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider, [ if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 241000d0b9..705f59dd81 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct BrakeSpecificFuelConsumption : IComparable, IComparable
/// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IForma /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IForma /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IForma if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 9b3c7a0933..1edbf1eb24 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Capacitance : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static CapacitanceUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index f66ca45817..ccf2ee22fe 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Density : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvid /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Density Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static DensityUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider, i /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider, [ if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 7a3a4fab46..9c7da87e2e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Duration : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static DurationUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index e1bfdd23ac..60af6dd2af 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct DynamicViscosity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFor /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider pro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static DynamicViscosityUnit ParseUnit(string str, IFormatProvider provide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider pr /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider pr /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider pr if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index f50a5b13ba..a429444afa 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricAdmittance : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricAdmittanceUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index b19e60c6de..b28f5de879 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricCharge : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricChargeUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 1d34a16d28..5b991c41b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricChargeDensity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricChargeDensityUnit ParseUnit(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 6b85a4f6f5..d2849fae93 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricConductance : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricConductanceUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index d42fe704f1..49458fed15 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricConductivity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricConductivityUnit ParseUnit(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 969eab80eb..11a246c5a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricCurrent : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricCurrentUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider pro if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 6af4b6ad5e..0912674502 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricCurrentDensity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricCurrentDensityUnit ParseUnit(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 0925c10eee..72c2ad0cc6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricCurrentGradient : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricCurrentGradientUnit ParseUnit(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProv /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProv /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProv if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 34422cbe13..4c18163a42 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricField : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricFieldUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 71a13074cb..97dda20018 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricInductance : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricInductanceUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index a1e80720d4..afdc8b2783 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricPotential : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricPotentialUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider p if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index ae3dd8e3b8..61b985e5b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricPotentialAc : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricPotentialAcUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 14aeef4d40..ba46f2fc28 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricPotentialDc : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricPotentialDcUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index e04e3a48fb..70ded015cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricResistance : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricResistanceUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index 17aab17c43..e7394a4043 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ElectricResistivity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ElectricResistivityUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 489cc3ae42..f0612d76ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Energy : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static EnergyUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider, [N if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 3fca77f43b..ae59ce8957 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Entropy : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvid /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static EntropyUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider, i /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider, [ if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 5a0bb18cb1..e3f199fb0a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Force : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Force Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ForceUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider, [No if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 122bf832af..6dcce2bc44 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ForceChangeRate : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ForceChangeRateUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider pro if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index ceb715a729..6d940b989a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ForcePerLength : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ForcePerLengthUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index f3b88f7823..1a9f0bd194 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Frequency : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProv /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static FrequencyUnit ParseUnit(string str, IFormatProvider provider = nul /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 0231e6db80..4d74727e2c 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct HeatFlux : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static HeatFluxUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index dfd78a967f..16d848af84 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct HeatTransferCoefficient : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static HeatTransferCoefficientUnit ParseUnit(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProv /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProv /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProv if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 00fd3d118e..697f5f74eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Illuminance : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static IlluminanceUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index c04c5c21b3..3e1d5928b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Information : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Information Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static InformationUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 6e67586fe6..6207011a7e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Irradiance : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static IrradianceUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index b3e2c0c909..4c3c0e040f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Irradiation : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static IrradiationUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index 132d645d22..ca79859036 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct KinematicViscosity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static KinematicViscosityUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index b3846512b8..6619a6e125 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct LapseRate : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProv /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static LapseRateUnit ParseUnit(string str, IFormatProvider provider = nul /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index b7c77fa5a5..f4ffda28c9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Length : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Length Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static LengthUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, [N if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index c29d8ffad0..6fd6959f10 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Level : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Logarithmic Arithmetic Operators @@ -142,7 +140,7 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -170,7 +168,7 @@ public static Level Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -185,7 +183,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -200,7 +198,7 @@ public static LevelUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -219,7 +217,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LevelU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider) { @@ -230,7 +228,7 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -244,7 +242,7 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -255,7 +253,7 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, [No if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 2916b154ed..b0b8c417de 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct LinearDensity : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static LinearDensityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 9d8920230d..922bb58493 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct LuminousFlux : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static LuminousFluxUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index a72b8799a6..bdd4fb3891 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct LuminousIntensity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static LuminousIntensityUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider p if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index facf165281..e3d15ac8c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MagneticField : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MagneticFieldUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 762bca7ae5..fc1f5d6ab7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MagneticFlux : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MagneticFluxUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 811e928e87..e020736566 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Magnetization : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MagnetizationUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index de72d48d67..f890178bf4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Mass : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MassUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider, [Not if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index d85b0d9d79..2cec9d17b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MassFlow : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MassFlowUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 5b2df59052..696af19250 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MassFlux : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MassFluxUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 3b101edaa9..d51fbfc3d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MassMomentOfInertia : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MassMomentOfInertiaUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 6dd15a91bc..e4e8ba203f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MolarEnergy : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MolarEnergyUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 64af88145d..b6c115456c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MolarEntropy : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MolarEntropyUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index fbdcf735da..38a4472271 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct MolarMass : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProv /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MolarMassUnit ParseUnit(string str, IFormatProvider provider = nul /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index bedab70433..132b57e609 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Molarity : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static MolarityUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index ad0c7c80f4..cf9864b24f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Permeability : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Permeability Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static PermeabilityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index fb607f4362..7812cc8043 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Permittivity : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static PermittivityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index a685a662a8..071b70ce1e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Power : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Power Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static PowerUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider, [No if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 2d00a4b257..07fe8e821d 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct PowerDensity : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static PowerDensityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index a84a589612..843a9544ec 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct PowerRatio : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Logarithmic Arithmetic Operators @@ -142,7 +140,7 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -170,7 +168,7 @@ public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -185,7 +183,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -200,7 +198,7 @@ public static PowerRatioUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -219,7 +217,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerR /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) { @@ -230,7 +228,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -244,7 +242,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -255,7 +253,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index ec7fca9073..e6afd91b0f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Pressure : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static PressureUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 4d383d8f23..a02467f2cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct PressureChangeRate : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static PressureChangeRateUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 48fd4f0e0c..7e41c50411 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Ratio : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static RatioUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider, [No if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 83daf56a96..9919e0afe5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ReactiveEnergy : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ReactiveEnergyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index c9ce36cb18..7fed7619af 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ReactivePower : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ReactivePowerUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 33ba321bf4..740ea60370 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct RotationalAcceleration : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static RotationalAccelerationUnit ParseUnit(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvi if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 04edff4b44..8e20efd50f 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct RotationalSpeed : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static RotationalSpeedUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider pro if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index a152130c88..0a111b3440 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct RotationalStiffness : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static RotationalStiffnessUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index a2dea7df02..a7c127609e 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct RotationalStiffnessPerLength : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IForma /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IForma /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IForma if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 80225f8aed..1f135e8d70 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct SolidAngle : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static SolidAngleUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 56b28c4f3c..b73579cdb1 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct SpecificEnergy : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static SpecificEnergyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 3427d39572..3ae214a638 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct SpecificEntropy : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static SpecificEntropyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider pro if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index d21734ffbb..0ec1a79d4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct SpecificVolume : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static SpecificVolumeUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 465bc22c3d..22862f0a5f 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct SpecificWeight : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static SpecificWeightUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider prov if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 464bed263a..5920219141 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Speed : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static SpeedUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider, [No if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 2b35a5d5cd..2b9b7d651f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Temperature : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } public static bool operator <=(Temperature left, Temperature right) @@ -95,7 +93,7 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -123,7 +121,7 @@ public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -138,7 +136,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -153,7 +151,7 @@ public static TemperatureUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -172,7 +170,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) { @@ -183,7 +181,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -197,7 +195,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -208,7 +206,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provide if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 1808c6edff..d1c5e5156d 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct TemperatureChangeRate : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static TemperatureChangeRateUnit ParseUnit(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvid if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 59f8c1616f..e5bb060b68 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct TemperatureDelta : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFor /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider pro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static TemperatureDeltaUnit ParseUnit(string str, IFormatProvider provide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider pr /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider pr /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider pr if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 3d46274d40..276d07e5d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ThermalConductivity : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ThermalConductivityUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 461efae1c8..e54604aa0c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct ThermalResistance : IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static ThermalResistanceUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider p if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 905fdeee46..5c19422307 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Torque : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static TorqueUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider, [N if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 41922e4b2d..64c8749c8e 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct VitaminA : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static VitaminAUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider, if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 0daf2c5859..0249cb6709 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct Volume : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static VolumeUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider, [N if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 7f2402d932..161c1f6f1d 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -59,14 +59,12 @@ public partial struct VolumeFlow : IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators @@ -134,7 +132,7 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -162,7 +160,7 @@ public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -177,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -192,7 +190,7 @@ public static VolumeFlowUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -211,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) { @@ -222,7 +220,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -236,7 +234,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -247,7 +245,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs index 54d79bc605..891b866ae0 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs @@ -35,6 +35,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; +using System.Globalization; using System.Collections.Generic; using System.Collections.ObjectModel; using UnitsNet.I18n; @@ -45,4503 +47,999 @@ namespace UnitsNet { - public sealed partial class UnitSystem + public static partial class UnitAbbreviationsCache { - private static readonly ReadOnlyCollection DefaultLocalizations - = new ReadOnlyCollection(new List + private static readonly Tuple[] DefaultLocalizations + = new Tuple[] { - new UnitLocalization(typeof (AccelerationUnit), - new[] - { - new CulturesForEnumValue((int) AccelerationUnit.CentimeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "cm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.DecimeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "dm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.FootPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "ft/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.InchPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "in/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KilometerPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "km/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KnotPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "kn/h"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KnotPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kn/min"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KnotPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kn/s"), - }), - new CulturesForEnumValue((int) AccelerationUnit.MeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "m/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.MicrometerPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "µm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.MillimeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "mm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.NanometerPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "nm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.StandardGravity, - new[] - { - new AbbreviationsForCulture("en-US", "g"), - }), - }), - new UnitLocalization(typeof (AmountOfSubstanceUnit), - new[] - { - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Centimole, - new[] - { - new AbbreviationsForCulture("en-US", "cmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.CentipoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "clbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Decimole, - new[] - { - new AbbreviationsForCulture("en-US", "dmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.DecipoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "dlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Kilomole, - new[] - { - new AbbreviationsForCulture("en-US", "kmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.KilopoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "klbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Micromole, - new[] - { - new AbbreviationsForCulture("en-US", "µmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.MicropoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "µlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Millimole, - new[] - { - new AbbreviationsForCulture("en-US", "mmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.MillipoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "mlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Mole, - new[] - { - new AbbreviationsForCulture("en-US", "mol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Nanomole, - new[] - { - new AbbreviationsForCulture("en-US", "nmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.NanopoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "nlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.PoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "lbmol"), - }), - }), - new UnitLocalization(typeof (AmplitudeRatioUnit), - new[] - { - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelMicrovolt, - new[] - { - new AbbreviationsForCulture("en-US", "dBµV"), - }), - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelMillivolt, - new[] - { - new AbbreviationsForCulture("en-US", "dBmV"), - }), - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelUnloaded, - new[] - { - new AbbreviationsForCulture("en-US", "dBu"), - }), - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelVolt, - new[] - { - new AbbreviationsForCulture("en-US", "dBV"), - }), - }), - new UnitLocalization(typeof (AngleUnit), - new[] - { - new CulturesForEnumValue((int) AngleUnit.Arcminute, - new[] - { - new AbbreviationsForCulture("en-US", "'", "arcmin", "amin", "min"), - }), - new CulturesForEnumValue((int) AngleUnit.Arcsecond, - new[] - { - new AbbreviationsForCulture("en-US", "″", "arcsec", "asec", "sec"), - }), - new CulturesForEnumValue((int) AngleUnit.Centiradian, - new[] - { - new AbbreviationsForCulture("en-US", "crad"), - new AbbreviationsForCulture("ru-RU", "cрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Deciradian, - new[] - { - new AbbreviationsForCulture("en-US", "drad"), - new AbbreviationsForCulture("ru-RU", "dрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Degree, - new[] - { - new AbbreviationsForCulture("en-US", "°", "deg"), - new AbbreviationsForCulture("ru-RU", "°"), - }), - new CulturesForEnumValue((int) AngleUnit.Gradian, - new[] - { - new AbbreviationsForCulture("en-US", "g"), - new AbbreviationsForCulture("ru-RU", "g"), - }), - new CulturesForEnumValue((int) AngleUnit.Microdegree, - new[] - { - new AbbreviationsForCulture("en-US", "µ°"), - new AbbreviationsForCulture("ru-RU", "µ°"), - }), - new CulturesForEnumValue((int) AngleUnit.Microradian, - new[] - { - new AbbreviationsForCulture("en-US", "µrad"), - new AbbreviationsForCulture("ru-RU", "µрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Millidegree, - new[] - { - new AbbreviationsForCulture("en-US", "m°"), - new AbbreviationsForCulture("ru-RU", "m°"), - }), - new CulturesForEnumValue((int) AngleUnit.Milliradian, - new[] - { - new AbbreviationsForCulture("en-US", "mrad"), - new AbbreviationsForCulture("ru-RU", "mрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Nanodegree, - new[] - { - new AbbreviationsForCulture("en-US", "n°"), - new AbbreviationsForCulture("ru-RU", "n°"), - }), - new CulturesForEnumValue((int) AngleUnit.Nanoradian, - new[] - { - new AbbreviationsForCulture("en-US", "nrad"), - new AbbreviationsForCulture("ru-RU", "nрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Radian, - new[] - { - new AbbreviationsForCulture("en-US", "rad"), - new AbbreviationsForCulture("ru-RU", "рад"), - }), - new CulturesForEnumValue((int) AngleUnit.Revolution, - new[] - { - new AbbreviationsForCulture("en-US", "r"), - new AbbreviationsForCulture("ru-RU", "r"), - }), - }), - new UnitLocalization(typeof (ApparentEnergyUnit), - new[] - { - new CulturesForEnumValue((int) ApparentEnergyUnit.KilovoltampereHour, - new[] - { - new AbbreviationsForCulture("en-US", "kVAh"), - }), - new CulturesForEnumValue((int) ApparentEnergyUnit.MegavoltampereHour, - new[] - { - new AbbreviationsForCulture("en-US", "MVAh"), - }), - new CulturesForEnumValue((int) ApparentEnergyUnit.VoltampereHour, - new[] - { - new AbbreviationsForCulture("en-US", "VAh"), - }), - }), - new UnitLocalization(typeof (ApparentPowerUnit), - new[] - { - new CulturesForEnumValue((int) ApparentPowerUnit.Gigavoltampere, - new[] - { - new AbbreviationsForCulture("en-US", "GVA"), - }), - new CulturesForEnumValue((int) ApparentPowerUnit.Kilovoltampere, - new[] - { - new AbbreviationsForCulture("en-US", "kVA"), - }), - new CulturesForEnumValue((int) ApparentPowerUnit.Megavoltampere, - new[] - { - new AbbreviationsForCulture("en-US", "MVA"), - }), - new CulturesForEnumValue((int) ApparentPowerUnit.Voltampere, - new[] - { - new AbbreviationsForCulture("en-US", "VA"), - }), - }), - new UnitLocalization(typeof (AreaUnit), - new[] - { - new CulturesForEnumValue((int) AreaUnit.Acre, - new[] - { - new AbbreviationsForCulture("en-US", "ac"), - }), - new CulturesForEnumValue((int) AreaUnit.Hectare, - new[] - { - new AbbreviationsForCulture("en-US", "ha"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cm²"), - new AbbreviationsForCulture("ru-RU", "см²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "dm²"), - new AbbreviationsForCulture("ru-RU", "дм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ft²"), - new AbbreviationsForCulture("ru-RU", "фут²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "in²"), - new AbbreviationsForCulture("ru-RU", "дюйм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareKilometer, - new[] - { - new AbbreviationsForCulture("en-US", "km²"), - new AbbreviationsForCulture("ru-RU", "км²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "m²"), - new AbbreviationsForCulture("ru-RU", "м²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMicrometer, - new[] - { - new AbbreviationsForCulture("en-US", "µm²"), - new AbbreviationsForCulture("ru-RU", "мкм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMile, - new[] - { - new AbbreviationsForCulture("en-US", "mi²"), - new AbbreviationsForCulture("ru-RU", "миля²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mm²"), - new AbbreviationsForCulture("ru-RU", "мм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareYard, - new[] - { - new AbbreviationsForCulture("en-US", "yd²"), - new AbbreviationsForCulture("ru-RU", "ярд²"), - }), - new CulturesForEnumValue((int) AreaUnit.UsSurveySquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ft² (US)"), - }), - }), - new UnitLocalization(typeof (AreaDensityUnit), - new[] - { - new CulturesForEnumValue((int) AreaDensityUnit.KilogramPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/m²"), - }), - }), - new UnitLocalization(typeof (AreaMomentOfInertiaUnit), - new[] - { - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.CentimeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "cm⁴", "cm^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.DecimeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "dm⁴", "dm^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.FootToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "ft⁴", "ft^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.InchToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "in⁴", "in^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.MeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "m⁴", "m^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.MillimeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "mm⁴", "mm^4"), - }), - }), - new UnitLocalization(typeof (BitRateUnit), - new[] - { - new CulturesForEnumValue((int) BitRateUnit.BitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "bit/s", "bps"), - }), - new CulturesForEnumValue((int) BitRateUnit.BytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "B/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Ebit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "EB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExbibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Eibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExbibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "EiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GibibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Gibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GibibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "GiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GigabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Gbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GigabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "GB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KibibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Kibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KibibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "KiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KilobitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KilobytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MebibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Mibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MebibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "MiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MegabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Mbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MegabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "MB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PebibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Pibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PebibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "PiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PetabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Pbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PetabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "PB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TebibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Tibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TebibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "TiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TerabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Tbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TerabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "TB/s"), - }), - }), - new UnitLocalization(typeof (BrakeSpecificFuelConsumptionUnit), - new[] - { - new CulturesForEnumValue((int) BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, - new[] - { - new AbbreviationsForCulture("en-US", "g/kWh"), - }), - new CulturesForEnumValue((int) BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, - new[] - { - new AbbreviationsForCulture("en-US", "kg/J"), - }), - new CulturesForEnumValue((int) BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, - new[] - { - new AbbreviationsForCulture("en-US", "lb/hph"), - }), - }), - new UnitLocalization(typeof (CapacitanceUnit), - new[] - { - new CulturesForEnumValue((int) CapacitanceUnit.Farad, - new[] - { - new AbbreviationsForCulture("en-US", "F"), - }), - }), - new UnitLocalization(typeof (DensityUnit), - new[] - { - new CulturesForEnumValue((int) DensityUnit.CentigramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "cg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.CentigramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "cg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.CentigramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "cg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.DecigramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "dg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.DecigramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "dg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.DecigramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "dg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/cm³"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/m³"), - new AbbreviationsForCulture("ru-RU", "г/м³"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/mm³"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "g/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "g/L"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "g/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.KilogramPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/cm³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilogramPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/m³"), - new AbbreviationsForCulture("ru-RU", "kг/м³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilogramPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/mm³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilopoundPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kip/ft³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilopoundPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "kip/in³"), - }), - new CulturesForEnumValue((int) DensityUnit.MicrogramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "µg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.MicrogramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "µg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.MicrogramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "µg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/m³"), - new AbbreviationsForCulture("ru-RU", "mг/м³"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.NanogramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "ng/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.NanogramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "ng/L"), - }), - new CulturesForEnumValue((int) DensityUnit.NanogramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "ng/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.PicogramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "pg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.PicogramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "pg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.PicogramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "pg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb/ft³"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "lb/in³"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerImperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "ppg (imp.)"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerUSGallon, - new[] - { - new AbbreviationsForCulture("en-US", "ppg (U.S.)"), - }), - new CulturesForEnumValue((int) DensityUnit.SlugPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "slug/ft³"), - }), - new CulturesForEnumValue((int) DensityUnit.TonnePerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t/cm³"), - }), - new CulturesForEnumValue((int) DensityUnit.TonnePerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "t/m³"), - }), - new CulturesForEnumValue((int) DensityUnit.TonnePerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t/mm³"), - }), - }), - new UnitLocalization(typeof (DurationUnit), - new[] - { - new CulturesForEnumValue((int) DurationUnit.Day, - new[] - { - new AbbreviationsForCulture("en-US", "d", "day", "days"), - new AbbreviationsForCulture("ru-RU", "д"), - }), - new CulturesForEnumValue((int) DurationUnit.Hour, - new[] - { - new AbbreviationsForCulture("en-US", "h", "hr", "hrs", "hour", "hours"), - new AbbreviationsForCulture("ru-RU", "ч"), - }), - new CulturesForEnumValue((int) DurationUnit.Microsecond, - new[] - { - new AbbreviationsForCulture("en-US", "µs"), - new AbbreviationsForCulture("ru-RU", "мкс"), - }), - new CulturesForEnumValue((int) DurationUnit.Millisecond, - new[] - { - new AbbreviationsForCulture("en-US", "ms"), - new AbbreviationsForCulture("ru-RU", "мс"), - }), - new CulturesForEnumValue((int) DurationUnit.Minute, - new[] - { - new AbbreviationsForCulture("en-US", "m", "min", "minute", "minutes"), - new AbbreviationsForCulture("ru-RU", "мин"), - }), - new CulturesForEnumValue((int) DurationUnit.Month30, - new[] - { - new AbbreviationsForCulture("en-US", "mo", "month", "months"), - new AbbreviationsForCulture("ru-RU", "месяц"), - }), - new CulturesForEnumValue((int) DurationUnit.Nanosecond, - new[] - { - new AbbreviationsForCulture("en-US", "ns"), - new AbbreviationsForCulture("ru-RU", "нс"), - }), - new CulturesForEnumValue((int) DurationUnit.Second, - new[] - { - new AbbreviationsForCulture("en-US", "s", "sec", "secs", "second", "seconds"), - new AbbreviationsForCulture("ru-RU", "с"), - }), - new CulturesForEnumValue((int) DurationUnit.Week, - new[] - { - new AbbreviationsForCulture("en-US", "wk", "week", "weeks"), - new AbbreviationsForCulture("ru-RU", "мин"), - }), - new CulturesForEnumValue((int) DurationUnit.Year365, - new[] - { - new AbbreviationsForCulture("en-US", "yr", "year", "years"), - new AbbreviationsForCulture("ru-RU", "год"), - }), - }), - new UnitLocalization(typeof (DynamicViscosityUnit), - new[] - { - new CulturesForEnumValue((int) DynamicViscosityUnit.Centipoise, - new[] - { - new AbbreviationsForCulture("en-US", "cP"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.MicropascalSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µPaS"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.MillipascalSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mPaS"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.NewtonSecondPerMeterSquared, - new[] - { - new AbbreviationsForCulture("en-US", "Ns/m²"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.PascalSecond, - new[] - { - new AbbreviationsForCulture("en-US", "PaS"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.Poise, - new[] - { - new AbbreviationsForCulture("en-US", "P"), - }), - }), - new UnitLocalization(typeof (ElectricAdmittanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Microsiemens, - new[] - { - new AbbreviationsForCulture("en-US", "µS"), - }), - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Millisiemens, - new[] - { - new AbbreviationsForCulture("en-US", "mS"), - }), - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Nanosiemens, - new[] - { - new AbbreviationsForCulture("en-US", "nS"), - }), - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Siemens, - new[] - { - new AbbreviationsForCulture("en-US", "S"), - }), - }), - new UnitLocalization(typeof (ElectricChargeUnit), - new[] - { - new CulturesForEnumValue((int) ElectricChargeUnit.Coulomb, - new[] - { - new AbbreviationsForCulture("en-US", "C"), - }), - }), - new UnitLocalization(typeof (ElectricChargeDensityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricChargeDensityUnit.CoulombPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "C/m³"), - }), - }), - new UnitLocalization(typeof (ElectricConductanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricConductanceUnit.Microsiemens, - new[] - { - new AbbreviationsForCulture("en-US", "µS"), - }), - new CulturesForEnumValue((int) ElectricConductanceUnit.Millisiemens, - new[] - { - new AbbreviationsForCulture("en-US", "mS"), - }), - new CulturesForEnumValue((int) ElectricConductanceUnit.Siemens, - new[] - { - new AbbreviationsForCulture("en-US", "S"), - }), - }), - new UnitLocalization(typeof (ElectricConductivityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricConductivityUnit.SiemensPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "S/m"), - }), - }), - new UnitLocalization(typeof (ElectricCurrentUnit), - new[] - { - new CulturesForEnumValue((int) ElectricCurrentUnit.Ampere, - new[] - { - new AbbreviationsForCulture("en-US", "A"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Centiampere, - new[] - { - new AbbreviationsForCulture("en-US", "cA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Kiloampere, - new[] - { - new AbbreviationsForCulture("en-US", "kA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Megaampere, - new[] - { - new AbbreviationsForCulture("en-US", "MA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Microampere, - new[] - { - new AbbreviationsForCulture("en-US", "µA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Milliampere, - new[] - { - new AbbreviationsForCulture("en-US", "mA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Nanoampere, - new[] - { - new AbbreviationsForCulture("en-US", "nA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Picoampere, - new[] - { - new AbbreviationsForCulture("en-US", "pA"), - }), - }), - new UnitLocalization(typeof (ElectricCurrentDensityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricCurrentDensityUnit.AmperePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "A/m²"), - }), - }), - new UnitLocalization(typeof (ElectricCurrentGradientUnit), - new[] - { - new CulturesForEnumValue((int) ElectricCurrentGradientUnit.AmperePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "A/s"), - }), - }), - new UnitLocalization(typeof (ElectricFieldUnit), - new[] - { - new CulturesForEnumValue((int) ElectricFieldUnit.VoltPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "V/m"), - }), - }), - new UnitLocalization(typeof (ElectricInductanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricInductanceUnit.Henry, - new[] - { - new AbbreviationsForCulture("en-US", "H"), - }), - }), - new UnitLocalization(typeof (ElectricPotentialUnit), - new[] - { - new CulturesForEnumValue((int) ElectricPotentialUnit.Kilovolt, - new[] - { - new AbbreviationsForCulture("en-US", "kV"), - new AbbreviationsForCulture("ru-RU", "kВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Megavolt, - new[] - { - new AbbreviationsForCulture("en-US", "MV"), - new AbbreviationsForCulture("ru-RU", "MВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Microvolt, - new[] - { - new AbbreviationsForCulture("en-US", "µV"), - new AbbreviationsForCulture("ru-RU", "µВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Millivolt, - new[] - { - new AbbreviationsForCulture("en-US", "mV"), - new AbbreviationsForCulture("ru-RU", "mВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Volt, - new[] - { - new AbbreviationsForCulture("en-US", "V"), - new AbbreviationsForCulture("ru-RU", "В"), - }), - }), - new UnitLocalization(typeof (ElectricPotentialAcUnit), - new[] - { - new CulturesForEnumValue((int) ElectricPotentialAcUnit.KilovoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "kVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.MegavoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "MVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.MicrovoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "µVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.MillivoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "mVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.VoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "Vac"), - }), - }), - new UnitLocalization(typeof (ElectricPotentialDcUnit), - new[] - { - new CulturesForEnumValue((int) ElectricPotentialDcUnit.KilovoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "kVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.MegavoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "MVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.MicrovoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "µVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.MillivoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "mVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.VoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "Vdc"), - }), - }), - new UnitLocalization(typeof (ElectricResistanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricResistanceUnit.Kiloohm, - new[] - { - new AbbreviationsForCulture("en-US", "kΩ"), - }), - new CulturesForEnumValue((int) ElectricResistanceUnit.Megaohm, - new[] - { - new AbbreviationsForCulture("en-US", "MΩ"), - }), - new CulturesForEnumValue((int) ElectricResistanceUnit.Milliohm, - new[] - { - new AbbreviationsForCulture("en-US", "mΩ"), - }), - new CulturesForEnumValue((int) ElectricResistanceUnit.Ohm, - new[] - { - new AbbreviationsForCulture("en-US", "Ω"), - }), - }), - new UnitLocalization(typeof (ElectricResistivityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricResistivityUnit.MicroohmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µΩ·m"), - }), - new CulturesForEnumValue((int) ElectricResistivityUnit.MilliohmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mΩ·m"), - }), - new CulturesForEnumValue((int) ElectricResistivityUnit.NanoohmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nΩ·m"), - }), - new CulturesForEnumValue((int) ElectricResistivityUnit.OhmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "Ω·m"), - }), - }), - new UnitLocalization(typeof (EnergyUnit), - new[] - { - new CulturesForEnumValue((int) EnergyUnit.BritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "BTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.Calorie, - new[] - { - new AbbreviationsForCulture("en-US", "cal"), - }), - new CulturesForEnumValue((int) EnergyUnit.DecathermEc, - new[] - { - new AbbreviationsForCulture("en-US", "Dth (E.C.)"), - new AbbreviationsForCulture("ru-RU", "Европейский декатерм"), - }), - new CulturesForEnumValue((int) EnergyUnit.DecathermImperial, - new[] - { - new AbbreviationsForCulture("en-US", "Dth (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский декатерм"), - }), - new CulturesForEnumValue((int) EnergyUnit.DecathermUs, - new[] - { - new AbbreviationsForCulture("en-US", "Dth (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американский декатерм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ElectronVolt, - new[] - { - new AbbreviationsForCulture("en-US", "eV"), - }), - new CulturesForEnumValue((int) EnergyUnit.Erg, - new[] - { - new AbbreviationsForCulture("en-US", "erg"), - }), - new CulturesForEnumValue((int) EnergyUnit.FootPound, - new[] - { - new AbbreviationsForCulture("en-US", "ft·lb"), - }), - new CulturesForEnumValue((int) EnergyUnit.GigabritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "GBTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.GigawattHour, - new[] - { - new AbbreviationsForCulture("en-US", "GWh"), - new AbbreviationsForCulture("en-US", "GВт/ч"), - }), - new CulturesForEnumValue((int) EnergyUnit.Joule, - new[] - { - new AbbreviationsForCulture("en-US", "J"), - }), - new CulturesForEnumValue((int) EnergyUnit.KilobritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "kBTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.Kilocalorie, - new[] - { - new AbbreviationsForCulture("en-US", "kcal"), - }), - new CulturesForEnumValue((int) EnergyUnit.Kilojoule, - new[] - { - new AbbreviationsForCulture("en-US", "kJ"), - }), - new CulturesForEnumValue((int) EnergyUnit.KilowattHour, - new[] - { - new AbbreviationsForCulture("en-US", "kWh"), - new AbbreviationsForCulture("en-US", "kВт/ч"), - }), - new CulturesForEnumValue((int) EnergyUnit.MegabritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "MBTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.Megajoule, - new[] - { - new AbbreviationsForCulture("en-US", "MJ"), - }), - new CulturesForEnumValue((int) EnergyUnit.MegawattHour, - new[] - { - new AbbreviationsForCulture("en-US", "MWh"), - new AbbreviationsForCulture("en-US", "MВт/ч"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermEc, - new[] - { - new AbbreviationsForCulture("en-US", "th (E.C.)"), - new AbbreviationsForCulture("ru-RU", "Европейский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermImperial, - new[] - { - new AbbreviationsForCulture("en-US", "th (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermUs, - new[] - { - new AbbreviationsForCulture("en-US", "th (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.WattHour, - new[] - { - new AbbreviationsForCulture("en-US", "Wh"), - new AbbreviationsForCulture("en-US", "Вт/ч"), - }), - }), - new UnitLocalization(typeof (EntropyUnit), - new[] - { - new CulturesForEnumValue((int) EntropyUnit.CaloriePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "cal/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.JoulePerDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "J/C"), - }), - new CulturesForEnumValue((int) EntropyUnit.JoulePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "J/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.KilocaloriePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.KilojoulePerDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/C"), - }), - new CulturesForEnumValue((int) EntropyUnit.KilojoulePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.MegajoulePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/K"), - }), - }), - new UnitLocalization(typeof (ForceUnit), - new[] - { - new CulturesForEnumValue((int) ForceUnit.Decanewton, - new[] - { - new AbbreviationsForCulture("en-US", "daN"), - new AbbreviationsForCulture("ru-RU", "даН"), - }), - new CulturesForEnumValue((int) ForceUnit.Dyn, - new[] - { - new AbbreviationsForCulture("en-US", "dyn"), - new AbbreviationsForCulture("ru-RU", "дин"), - }), - new CulturesForEnumValue((int) ForceUnit.KilogramForce, - new[] - { - new AbbreviationsForCulture("en-US", "kgf"), - new AbbreviationsForCulture("ru-RU", "кгс"), - }), - new CulturesForEnumValue((int) ForceUnit.Kilonewton, - new[] - { - new AbbreviationsForCulture("en-US", "kN"), - new AbbreviationsForCulture("ru-RU", "кН"), - }), - new CulturesForEnumValue((int) ForceUnit.KiloPond, - new[] - { - new AbbreviationsForCulture("en-US", "kp"), - new AbbreviationsForCulture("ru-RU", "кгс"), - }), - new CulturesForEnumValue((int) ForceUnit.Meganewton, - new[] - { - new AbbreviationsForCulture("en-US", "MN"), - new AbbreviationsForCulture("ru-RU", ""), - }), - new CulturesForEnumValue((int) ForceUnit.Newton, - new[] - { - new AbbreviationsForCulture("en-US", "N"), - new AbbreviationsForCulture("ru-RU", "Н"), - }), - new CulturesForEnumValue((int) ForceUnit.Poundal, - new[] - { - new AbbreviationsForCulture("en-US", "pdl"), - new AbbreviationsForCulture("ru-RU", "паундаль"), - }), - new CulturesForEnumValue((int) ForceUnit.PoundForce, - new[] - { - new AbbreviationsForCulture("en-US", "lbf"), - new AbbreviationsForCulture("ru-RU", "фунт-сила"), - }), - new CulturesForEnumValue((int) ForceUnit.TonneForce, - new[] - { - new AbbreviationsForCulture("en-US", "Ton"), - new AbbreviationsForCulture("ru-RU", "тс"), - }), - }), - new UnitLocalization(typeof (ForceChangeRateUnit), - new[] - { - new CulturesForEnumValue((int) ForceChangeRateUnit.CentinewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "cN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.DecanewtonPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "daN/min"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.DecanewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "daN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.DecinewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.KilonewtonPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kN/min"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.KilonewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.MicronewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.MillinewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.NanonewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "nN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.NewtonPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "N/min"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.NewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "N/s"), - }), - }), - new UnitLocalization(typeof (ForcePerLengthUnit), - new[] - { - new CulturesForEnumValue((int) ForcePerLengthUnit.CentinewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "cN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.DecinewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "dN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.KilogramForcePerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/m"), - new AbbreviationsForCulture("ru-RU", "кгс/м"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.KilonewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.MeganewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.MicronewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.MillinewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.NanonewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.NewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/m"), - }), - }), - new UnitLocalization(typeof (FrequencyUnit), - new[] - { - new CulturesForEnumValue((int) FrequencyUnit.CyclePerHour, - new[] - { - new AbbreviationsForCulture("en-US", "cph"), - }), - new CulturesForEnumValue((int) FrequencyUnit.CyclePerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cpm"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Gigahertz, - new[] - { - new AbbreviationsForCulture("en-US", "GHz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Hertz, - new[] - { - new AbbreviationsForCulture("en-US", "Hz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Kilohertz, - new[] - { - new AbbreviationsForCulture("en-US", "kHz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Megahertz, - new[] - { - new AbbreviationsForCulture("en-US", "MHz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.RadianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "rad/s"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Terahertz, - new[] - { - new AbbreviationsForCulture("en-US", "THz"), - }), - }), - new UnitLocalization(typeof (HeatFluxUnit), - new[] - { - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerHourSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/h·ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerMinuteSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/min·ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerSecondSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/s·ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerSecondSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/s·in²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.CaloriePerSecondSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cal/s·cm²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.CentiwattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "cW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.DeciwattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "dW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.KilocaloriePerHourSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/h·m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/s·cm²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.KilowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.MicrowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.MilliwattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.NanowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.WattPerSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "W/ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.WattPerSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "W/in²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.WattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²"), - }), - }), - new UnitLocalization(typeof (HeatTransferCoefficientUnit), - new[] - { - new CulturesForEnumValue((int) HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²·°C"), - }), - new CulturesForEnumValue((int) HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²·K"), - }), - }), - new UnitLocalization(typeof (IlluminanceUnit), - new[] - { - new CulturesForEnumValue((int) IlluminanceUnit.Kilolux, - new[] - { - new AbbreviationsForCulture("en-US", "klx"), - }), - new CulturesForEnumValue((int) IlluminanceUnit.Lux, - new[] - { - new AbbreviationsForCulture("en-US", "lx"), - }), - new CulturesForEnumValue((int) IlluminanceUnit.Megalux, - new[] - { - new AbbreviationsForCulture("en-US", "Mlx"), - }), - new CulturesForEnumValue((int) IlluminanceUnit.Millilux, - new[] - { - new AbbreviationsForCulture("en-US", "mlx"), - }), - }), - new UnitLocalization(typeof (InformationUnit), - new[] - { - new CulturesForEnumValue((int) InformationUnit.Bit, - new[] - { - new AbbreviationsForCulture("en-US", "b"), - }), - new CulturesForEnumValue((int) InformationUnit.Byte, - new[] - { - new AbbreviationsForCulture("en-US", "B"), - }), - new CulturesForEnumValue((int) InformationUnit.Exabit, - new[] - { - new AbbreviationsForCulture("en-US", "Eb"), - }), - new CulturesForEnumValue((int) InformationUnit.Exabyte, - new[] - { - new AbbreviationsForCulture("en-US", "EB"), - }), - new CulturesForEnumValue((int) InformationUnit.Exbibit, - new[] - { - new AbbreviationsForCulture("en-US", "Eib"), - }), - new CulturesForEnumValue((int) InformationUnit.Exbibyte, - new[] - { - new AbbreviationsForCulture("en-US", "EiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Gibibit, - new[] - { - new AbbreviationsForCulture("en-US", "Gib"), - }), - new CulturesForEnumValue((int) InformationUnit.Gibibyte, - new[] - { - new AbbreviationsForCulture("en-US", "GiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Gigabit, - new[] - { - new AbbreviationsForCulture("en-US", "Gb"), - }), - new CulturesForEnumValue((int) InformationUnit.Gigabyte, - new[] - { - new AbbreviationsForCulture("en-US", "GB"), - }), - new CulturesForEnumValue((int) InformationUnit.Kibibit, - new[] - { - new AbbreviationsForCulture("en-US", "Kib"), - }), - new CulturesForEnumValue((int) InformationUnit.Kibibyte, - new[] - { - new AbbreviationsForCulture("en-US", "KiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Kilobit, - new[] - { - new AbbreviationsForCulture("en-US", "kb"), - }), - new CulturesForEnumValue((int) InformationUnit.Kilobyte, - new[] - { - new AbbreviationsForCulture("en-US", "kB"), - }), - new CulturesForEnumValue((int) InformationUnit.Mebibit, - new[] - { - new AbbreviationsForCulture("en-US", "Mib"), - }), - new CulturesForEnumValue((int) InformationUnit.Mebibyte, - new[] - { - new AbbreviationsForCulture("en-US", "MiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Megabit, - new[] - { - new AbbreviationsForCulture("en-US", "Mb"), - }), - new CulturesForEnumValue((int) InformationUnit.Megabyte, - new[] - { - new AbbreviationsForCulture("en-US", "MB"), - }), - new CulturesForEnumValue((int) InformationUnit.Pebibit, - new[] - { - new AbbreviationsForCulture("en-US", "Pib"), - }), - new CulturesForEnumValue((int) InformationUnit.Pebibyte, - new[] - { - new AbbreviationsForCulture("en-US", "PiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Petabit, - new[] - { - new AbbreviationsForCulture("en-US", "Pb"), - }), - new CulturesForEnumValue((int) InformationUnit.Petabyte, - new[] - { - new AbbreviationsForCulture("en-US", "PB"), - }), - new CulturesForEnumValue((int) InformationUnit.Tebibit, - new[] - { - new AbbreviationsForCulture("en-US", "Tib"), - }), - new CulturesForEnumValue((int) InformationUnit.Tebibyte, - new[] - { - new AbbreviationsForCulture("en-US", "TiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Terabit, - new[] - { - new AbbreviationsForCulture("en-US", "Tb"), - }), - new CulturesForEnumValue((int) InformationUnit.Terabyte, - new[] - { - new AbbreviationsForCulture("en-US", "TB"), - }), - }), - new UnitLocalization(typeof (IrradianceUnit), - new[] - { - new CulturesForEnumValue((int) IrradianceUnit.KilowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/m²"), - }), - new CulturesForEnumValue((int) IrradianceUnit.WattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²"), - }), - }), - new UnitLocalization(typeof (IrradiationUnit), - new[] - { - new CulturesForEnumValue((int) IrradiationUnit.JoulePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "J/m²"), - }), - new CulturesForEnumValue((int) IrradiationUnit.KilowattHourPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kWh/m²"), - }), - new CulturesForEnumValue((int) IrradiationUnit.WattHourPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "Wh/m²"), - }), - }), - new UnitLocalization(typeof (KinematicViscosityUnit), - new[] - { - new CulturesForEnumValue((int) KinematicViscosityUnit.Centistokes, - new[] - { - new AbbreviationsForCulture("en-US", "cSt"), - new AbbreviationsForCulture("ru-RU", "сСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Decistokes, - new[] - { - new AbbreviationsForCulture("en-US", "dSt"), - new AbbreviationsForCulture("ru-RU", "дСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Kilostokes, - new[] - { - new AbbreviationsForCulture("en-US", "kSt"), - new AbbreviationsForCulture("ru-RU", "кСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Microstokes, - new[] - { - new AbbreviationsForCulture("en-US", "µSt"), - new AbbreviationsForCulture("ru-RU", "мкСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Millistokes, - new[] - { - new AbbreviationsForCulture("en-US", "mSt"), - new AbbreviationsForCulture("ru-RU", "мСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Nanostokes, - new[] - { - new AbbreviationsForCulture("en-US", "nSt"), - new AbbreviationsForCulture("ru-RU", "нСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.SquareMeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m²/s"), - new AbbreviationsForCulture("ru-RU", "м²/с"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Stokes, - new[] - { - new AbbreviationsForCulture("en-US", "St"), - new AbbreviationsForCulture("ru-RU", "Ст"), - }), - }), - new UnitLocalization(typeof (LapseRateUnit), - new[] - { - new CulturesForEnumValue((int) LapseRateUnit.DegreeCelsiusPerKilometer, - new[] - { - new AbbreviationsForCulture("en-US", "∆°C/km"), - }), - }), - new UnitLocalization(typeof (LengthUnit), - new[] - { - new CulturesForEnumValue((int) LengthUnit.Centimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cm"), - new AbbreviationsForCulture("ru-RU", "см"), - }), - new CulturesForEnumValue((int) LengthUnit.Decimeter, - new[] - { - new AbbreviationsForCulture("en-US", "dm"), - new AbbreviationsForCulture("ru-RU", "дм"), - }), - new CulturesForEnumValue((int) LengthUnit.DtpPica, - new[] - { - new AbbreviationsForCulture("en-US", "pica"), - }), - new CulturesForEnumValue((int) LengthUnit.DtpPoint, - new[] - { - new AbbreviationsForCulture("en-US", "pt"), - }), - new CulturesForEnumValue((int) LengthUnit.Fathom, - new[] - { - new AbbreviationsForCulture("en-US", "fathom"), - }), - new CulturesForEnumValue((int) LengthUnit.Foot, - new[] - { - new AbbreviationsForCulture("en-US", "ft", "'"), - new AbbreviationsForCulture("ru-RU", "фут"), - }), - new CulturesForEnumValue((int) LengthUnit.Inch, - new[] - { - new AbbreviationsForCulture("en-US", "in", "\""), - new AbbreviationsForCulture("ru-RU", "дюйм"), - }), - new CulturesForEnumValue((int) LengthUnit.Kilometer, - new[] - { - new AbbreviationsForCulture("en-US", "km"), - new AbbreviationsForCulture("ru-RU", "км"), - }), - new CulturesForEnumValue((int) LengthUnit.Meter, - new[] - { - new AbbreviationsForCulture("en-US", "m"), - new AbbreviationsForCulture("ru-RU", "м"), - }), - new CulturesForEnumValue((int) LengthUnit.Microinch, - new[] - { - new AbbreviationsForCulture("en-US", "µin"), - new AbbreviationsForCulture("ru-RU", "микродюйм"), - }), - new CulturesForEnumValue((int) LengthUnit.Micrometer, - new[] - { - new AbbreviationsForCulture("en-US", "µm"), - new AbbreviationsForCulture("ru-RU", "мкм"), - }), - new CulturesForEnumValue((int) LengthUnit.Mil, - new[] - { - new AbbreviationsForCulture("en-US", "mil"), - new AbbreviationsForCulture("ru-RU", "мил"), - }), - new CulturesForEnumValue((int) LengthUnit.Mile, - new[] - { - new AbbreviationsForCulture("en-US", "mi"), - new AbbreviationsForCulture("ru-RU", "миля"), - }), - new CulturesForEnumValue((int) LengthUnit.Millimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mm"), - new AbbreviationsForCulture("ru-RU", "мм"), - }), - new CulturesForEnumValue((int) LengthUnit.Nanometer, - new[] - { - new AbbreviationsForCulture("en-US", "nm"), - new AbbreviationsForCulture("ru-RU", "нм"), - }), - new CulturesForEnumValue((int) LengthUnit.NauticalMile, - new[] - { - new AbbreviationsForCulture("en-US", "NM"), - new AbbreviationsForCulture("ru-RU", "мил"), - }), - new CulturesForEnumValue((int) LengthUnit.PrinterPica, - new[] - { - new AbbreviationsForCulture("en-US", "pica"), - }), - new CulturesForEnumValue((int) LengthUnit.PrinterPoint, - new[] - { - new AbbreviationsForCulture("en-US", "pt"), - }), - new CulturesForEnumValue((int) LengthUnit.Shackle, - new[] - { - new AbbreviationsForCulture("en-US", "shackle"), - }), - new CulturesForEnumValue((int) LengthUnit.Twip, - new[] - { - new AbbreviationsForCulture("en-US", "twip"), - }), - new CulturesForEnumValue((int) LengthUnit.UsSurveyFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS"), - }), - new CulturesForEnumValue((int) LengthUnit.Yard, - new[] - { - new AbbreviationsForCulture("en-US", "yd"), - new AbbreviationsForCulture("ru-RU", "ярд"), - }), - }), - new UnitLocalization(typeof (LevelUnit), - new[] - { - new CulturesForEnumValue((int) LevelUnit.Decibel, - new[] - { - new AbbreviationsForCulture("en-US", "dB"), - }), - new CulturesForEnumValue((int) LevelUnit.Neper, - new[] - { - new AbbreviationsForCulture("en-US", "Np"), - }), - }), - new UnitLocalization(typeof (LinearDensityUnit), - new[] - { - new CulturesForEnumValue((int) LinearDensityUnit.GramPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/m"), - }), - new CulturesForEnumValue((int) LinearDensityUnit.KilogramPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/m"), - }), - new CulturesForEnumValue((int) LinearDensityUnit.PoundPerFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb/ft"), - }), - }), - new UnitLocalization(typeof (LuminousFluxUnit), - new[] - { - new CulturesForEnumValue((int) LuminousFluxUnit.Lumen, - new[] - { - new AbbreviationsForCulture("en-US", "lm"), - }), - }), - new UnitLocalization(typeof (LuminousIntensityUnit), - new[] - { - new CulturesForEnumValue((int) LuminousIntensityUnit.Candela, - new[] - { - new AbbreviationsForCulture("en-US", "cd"), - }), - }), - new UnitLocalization(typeof (MagneticFieldUnit), - new[] - { - new CulturesForEnumValue((int) MagneticFieldUnit.Tesla, - new[] - { - new AbbreviationsForCulture("en-US", "T"), - }), - }), - new UnitLocalization(typeof (MagneticFluxUnit), - new[] - { - new CulturesForEnumValue((int) MagneticFluxUnit.Weber, - new[] - { - new AbbreviationsForCulture("en-US", "Wb"), - }), - }), - new UnitLocalization(typeof (MagnetizationUnit), - new[] - { - new CulturesForEnumValue((int) MagnetizationUnit.AmperePerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "A/m"), - }), - }), - new UnitLocalization(typeof (MassUnit), - new[] - { - new CulturesForEnumValue((int) MassUnit.Centigram, - new[] - { - new AbbreviationsForCulture("en-US", "cg"), - new AbbreviationsForCulture("ru-RU", "сг"), - }), - new CulturesForEnumValue((int) MassUnit.Decagram, - new[] - { - new AbbreviationsForCulture("en-US", "dag"), - new AbbreviationsForCulture("ru-RU", "даг"), - }), - new CulturesForEnumValue((int) MassUnit.Decigram, - new[] - { - new AbbreviationsForCulture("en-US", "dg"), - new AbbreviationsForCulture("ru-RU", "дг"), - }), - new CulturesForEnumValue((int) MassUnit.Gram, - new[] - { - new AbbreviationsForCulture("en-US", "g"), - new AbbreviationsForCulture("ru-RU", "г"), - }), - new CulturesForEnumValue((int) MassUnit.Hectogram, - new[] - { - new AbbreviationsForCulture("en-US", "hg"), - new AbbreviationsForCulture("ru-RU", "гг"), - }), - new CulturesForEnumValue((int) MassUnit.Kilogram, - new[] - { - new AbbreviationsForCulture("en-US", "kg"), - new AbbreviationsForCulture("ru-RU", "кг"), - }), - new CulturesForEnumValue((int) MassUnit.Kilopound, - new[] - { - new AbbreviationsForCulture("en-US", "klb"), - new AbbreviationsForCulture("ru-RU", "kфунт"), - }), - new CulturesForEnumValue((int) MassUnit.Kilotonne, - new[] - { - new AbbreviationsForCulture("en-US", "kt"), - new AbbreviationsForCulture("ru-RU", "кт"), - }), - new CulturesForEnumValue((int) MassUnit.LongHundredweight, - new[] - { - new AbbreviationsForCulture("en-US", "cwt"), - }), - new CulturesForEnumValue((int) MassUnit.LongTon, - new[] - { - new AbbreviationsForCulture("en-US", "long tn"), - new AbbreviationsForCulture("ru-RU", "тонна большая"), - }), - new CulturesForEnumValue((int) MassUnit.Megapound, - new[] - { - new AbbreviationsForCulture("en-US", "Mlb"), - new AbbreviationsForCulture("ru-RU", "Mфунт"), - }), - new CulturesForEnumValue((int) MassUnit.Megatonne, - new[] - { - new AbbreviationsForCulture("en-US", "Mt"), - new AbbreviationsForCulture("ru-RU", "Мт"), - }), - new CulturesForEnumValue((int) MassUnit.Microgram, - new[] - { - new AbbreviationsForCulture("en-US", "µg"), - new AbbreviationsForCulture("ru-RU", "мкг"), - }), - new CulturesForEnumValue((int) MassUnit.Milligram, - new[] - { - new AbbreviationsForCulture("en-US", "mg"), - new AbbreviationsForCulture("ru-RU", "мг"), - }), - new CulturesForEnumValue((int) MassUnit.Nanogram, - new[] - { - new AbbreviationsForCulture("en-US", "ng"), - new AbbreviationsForCulture("ru-RU", "нг"), - }), - new CulturesForEnumValue((int) MassUnit.Ounce, - new[] - { - new AbbreviationsForCulture("en-US", "oz"), - }), - new CulturesForEnumValue((int) MassUnit.Pound, - new[] - { - new AbbreviationsForCulture("en-US", "lb", "lbs", "lbm"), - new AbbreviationsForCulture("ru-RU", "фунт"), - }), - new CulturesForEnumValue((int) MassUnit.ShortHundredweight, - new[] - { - new AbbreviationsForCulture("en-US", "cwt"), - }), - new CulturesForEnumValue((int) MassUnit.ShortTon, - new[] - { - new AbbreviationsForCulture("en-US", "short tn"), - new AbbreviationsForCulture("ru-RU", "тонна малая"), - }), - new CulturesForEnumValue((int) MassUnit.Stone, - new[] - { - new AbbreviationsForCulture("en-US", "st"), - }), - new CulturesForEnumValue((int) MassUnit.Tonne, - new[] - { - new AbbreviationsForCulture("en-US", "t"), - new AbbreviationsForCulture("ru-RU", "т"), - }), - }), - new UnitLocalization(typeof (MassFlowUnit), - new[] - { - new CulturesForEnumValue((int) MassFlowUnit.CentigramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "cg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.DecagramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dag/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.DecigramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.GramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "g/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.HectogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "hg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.KilogramPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "kg/h"), - new AbbreviationsForCulture("ru-RU", "кг/ч"), - }), - new CulturesForEnumValue((int) MassFlowUnit.KilogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.MegapoundPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "Mlb/h"), - }), - new CulturesForEnumValue((int) MassFlowUnit.MicrogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.MilligramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.NanogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ng/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.PoundPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "lb/h"), - }), - new CulturesForEnumValue((int) MassFlowUnit.ShortTonPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "short tn/h"), - }), - new CulturesForEnumValue((int) MassFlowUnit.TonnePerDay, - new[] - { - new AbbreviationsForCulture("en-US", "t/d"), - }), - new CulturesForEnumValue((int) MassFlowUnit.TonnePerHour, - new[] - { - new AbbreviationsForCulture("en-US", "t/h"), - }), - }), - new UnitLocalization(typeof (MassFluxUnit), - new[] - { - new CulturesForEnumValue((int) MassFluxUnit.GramPerSecondPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·s⁻¹·m⁻²"), - }), - new CulturesForEnumValue((int) MassFluxUnit.KilogramPerSecondPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·s⁻¹·m⁻²"), - }), - }), - new UnitLocalization(typeof (MassMomentOfInertiaUnit), - new[] - { - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareMilimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareMilimeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.PoundSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb·ft²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.PoundSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "lb·in²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareMilimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·mm²"), - }), - }), - new UnitLocalization(typeof (MolarEnergyUnit), - new[] - { - new CulturesForEnumValue((int) MolarEnergyUnit.JoulePerMole, - new[] - { - new AbbreviationsForCulture("en-US", "J/mol"), - }), - new CulturesForEnumValue((int) MolarEnergyUnit.KilojoulePerMole, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/mol"), - }), - new CulturesForEnumValue((int) MolarEnergyUnit.MegajoulePerMole, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/mol"), - }), - }), - new UnitLocalization(typeof (MolarEntropyUnit), - new[] - { - new CulturesForEnumValue((int) MolarEntropyUnit.JoulePerMoleKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "J/(mol*K)"), - }), - new CulturesForEnumValue((int) MolarEntropyUnit.KilojoulePerMoleKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/(mol*K)"), - }), - new CulturesForEnumValue((int) MolarEntropyUnit.MegajoulePerMoleKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/(mol*K)"), - }), - }), - new UnitLocalization(typeof (MolarityUnit), - new[] - { - new CulturesForEnumValue((int) MolarityUnit.CentimolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "cmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.DecimolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "dmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.MicromolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "µmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.MillimolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.MolesPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mol/m³"), - }), - new CulturesForEnumValue((int) MolarityUnit.MolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.NanomolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "nmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.PicomolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "pmol/L"), - }), - }), - new UnitLocalization(typeof (MolarMassUnit), - new[] - { - new CulturesForEnumValue((int) MolarMassUnit.CentigramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "cg/mol"), - new AbbreviationsForCulture("ru-RU", "сг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.DecagramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "dag/mol"), - new AbbreviationsForCulture("ru-RU", "даг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.DecigramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "dg/mol"), - new AbbreviationsForCulture("ru-RU", "дг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.GramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "g/mol"), - new AbbreviationsForCulture("ru-RU", "г/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.HectogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "hg/mol"), - new AbbreviationsForCulture("ru-RU", "гг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.KilogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "kg/mol"), - new AbbreviationsForCulture("ru-RU", "кг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.KilopoundPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "klb/mol"), - new AbbreviationsForCulture("ru-RU", "kфунт/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.MegapoundPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "Mlb/mol"), - new AbbreviationsForCulture("ru-RU", "Mфунт/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.MicrogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "µg/mol"), - new AbbreviationsForCulture("ru-RU", "мкг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.MilligramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "mg/mol"), - new AbbreviationsForCulture("ru-RU", "мг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.NanogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "ng/mol"), - new AbbreviationsForCulture("ru-RU", "нг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.PoundPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "lb/mol"), - new AbbreviationsForCulture("ru-RU", "фунт/моль"), - }), - }), - new UnitLocalization(typeof (PermeabilityUnit), - new[] - { - new CulturesForEnumValue((int) PermeabilityUnit.HenryPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "H/m"), - }), - }), - new UnitLocalization(typeof (PermittivityUnit), - new[] - { - new CulturesForEnumValue((int) PermittivityUnit.FaradPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "F/m"), - }), - }), - new UnitLocalization(typeof (PowerUnit), - new[] - { - new CulturesForEnumValue((int) PowerUnit.BoilerHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(S)"), - }), - new CulturesForEnumValue((int) PowerUnit.BritishThermalUnitPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "Btu/hr"), - }), - new CulturesForEnumValue((int) PowerUnit.Decawatt, - new[] - { - new AbbreviationsForCulture("en-US", "daW"), - }), - new CulturesForEnumValue((int) PowerUnit.Deciwatt, - new[] - { - new AbbreviationsForCulture("en-US", "dW"), - }), - new CulturesForEnumValue((int) PowerUnit.ElectricalHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(E)"), - }), - new CulturesForEnumValue((int) PowerUnit.Femtowatt, - new[] - { - new AbbreviationsForCulture("en-US", "fW"), - }), - new CulturesForEnumValue((int) PowerUnit.Gigawatt, - new[] - { - new AbbreviationsForCulture("en-US", "GW"), - }), - new CulturesForEnumValue((int) PowerUnit.HydraulicHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(H)"), - }), - new CulturesForEnumValue((int) PowerUnit.KilobritishThermalUnitPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "kBtu/hr"), - }), - new CulturesForEnumValue((int) PowerUnit.Kilowatt, - new[] - { - new AbbreviationsForCulture("en-US", "kW"), - }), - new CulturesForEnumValue((int) PowerUnit.MechanicalHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(I)"), - }), - new CulturesForEnumValue((int) PowerUnit.Megawatt, - new[] - { - new AbbreviationsForCulture("en-US", "MW"), - }), - new CulturesForEnumValue((int) PowerUnit.MetricHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(M)"), - }), - new CulturesForEnumValue((int) PowerUnit.Microwatt, - new[] - { - new AbbreviationsForCulture("en-US", "µW"), - }), - new CulturesForEnumValue((int) PowerUnit.Milliwatt, - new[] - { - new AbbreviationsForCulture("en-US", "mW"), - }), - new CulturesForEnumValue((int) PowerUnit.Nanowatt, - new[] - { - new AbbreviationsForCulture("en-US", "nW"), - }), - new CulturesForEnumValue((int) PowerUnit.Petawatt, - new[] - { - new AbbreviationsForCulture("en-US", "PW"), - }), - new CulturesForEnumValue((int) PowerUnit.Picowatt, - new[] - { - new AbbreviationsForCulture("en-US", "pW"), - }), - new CulturesForEnumValue((int) PowerUnit.Terawatt, - new[] - { - new AbbreviationsForCulture("en-US", "TW"), - }), - new CulturesForEnumValue((int) PowerUnit.Watt, - new[] - { - new AbbreviationsForCulture("en-US", "W"), - }), - }), - new UnitLocalization(typeof (PowerDensityUnit), - new[] - { - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "daW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "daW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "daW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "daW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "dW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "dW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "dW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "dW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "GW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "GW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "GW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "GW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "kW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "MW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "MW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "MW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "µW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "µW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "µW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "mW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "mW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "nW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "nW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "nW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "pW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "pW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "pW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "pW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "TW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "TW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "TW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "TW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "W/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "W/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "W/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "W/l"), - }), - }), - new UnitLocalization(typeof (PowerRatioUnit), - new[] - { - new CulturesForEnumValue((int) PowerRatioUnit.DecibelMilliwatt, - new[] - { - new AbbreviationsForCulture("en-US", "dBmW", "dBm"), - }), - new CulturesForEnumValue((int) PowerRatioUnit.DecibelWatt, - new[] - { - new AbbreviationsForCulture("en-US", "dBW"), - }), - }), - new UnitLocalization(typeof (PressureUnit), - new[] - { - new CulturesForEnumValue((int) PressureUnit.Atmosphere, - new[] - { - new AbbreviationsForCulture("en-US", "atm"), - new AbbreviationsForCulture("ru-RU", "атм"), - }), - new CulturesForEnumValue((int) PressureUnit.Bar, - new[] - { - new AbbreviationsForCulture("en-US", "bar"), - new AbbreviationsForCulture("ru-RU", "бар"), - }), - new CulturesForEnumValue((int) PressureUnit.Centibar, - new[] - { - new AbbreviationsForCulture("en-US", "cbar"), - new AbbreviationsForCulture("ru-RU", "cбар"), - }), - new CulturesForEnumValue((int) PressureUnit.Decapascal, - new[] - { - new AbbreviationsForCulture("en-US", "daPa"), - new AbbreviationsForCulture("ru-RU", "даПа"), - }), - new CulturesForEnumValue((int) PressureUnit.Decibar, - new[] - { - new AbbreviationsForCulture("en-US", "dbar"), - new AbbreviationsForCulture("ru-RU", "dбар"), - }), - new CulturesForEnumValue((int) PressureUnit.FootOfHead, - new[] - { - new AbbreviationsForCulture("en-US", "ft of head"), - }), - new CulturesForEnumValue((int) PressureUnit.Gigapascal, - new[] - { - new AbbreviationsForCulture("en-US", "GPa"), - new AbbreviationsForCulture("ru-RU", "ГПа"), - }), - new CulturesForEnumValue((int) PressureUnit.Hectopascal, - new[] - { - new AbbreviationsForCulture("en-US", "hPa"), - new AbbreviationsForCulture("ru-RU", "гПа"), - }), - new CulturesForEnumValue((int) PressureUnit.InchOfMercury, - new[] - { - new AbbreviationsForCulture("en-US", "inHg"), - }), - new CulturesForEnumValue((int) PressureUnit.Kilobar, - new[] - { - new AbbreviationsForCulture("en-US", "kbar"), - new AbbreviationsForCulture("ru-RU", "kбар"), - }), - new CulturesForEnumValue((int) PressureUnit.KilogramForcePerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/cm²"), - new AbbreviationsForCulture("ru-RU", "кгс/см²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilogramForcePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/m²"), - new AbbreviationsForCulture("ru-RU", "кгс/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilogramForcePerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/mm²"), - new AbbreviationsForCulture("ru-RU", "кгс/мм²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilonewtonPerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/cm²"), - new AbbreviationsForCulture("ru-RU", "кН/см²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilonewtonPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/m²"), - new AbbreviationsForCulture("ru-RU", "кН/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilonewtonPerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/mm²"), - new AbbreviationsForCulture("ru-RU", "кН/мм²"), - }), - new CulturesForEnumValue((int) PressureUnit.Kilopascal, - new[] - { - new AbbreviationsForCulture("en-US", "kPa"), - new AbbreviationsForCulture("ru-RU", "кПа"), - }), - new CulturesForEnumValue((int) PressureUnit.KilopoundForcePerSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/ft²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilopoundForcePerSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/in²"), - }), - new CulturesForEnumValue((int) PressureUnit.Megabar, - new[] - { - new AbbreviationsForCulture("en-US", "Mbar"), - new AbbreviationsForCulture("ru-RU", "Mбар"), - }), - new CulturesForEnumValue((int) PressureUnit.MeganewtonPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN/m²"), - new AbbreviationsForCulture("ru-RU", "Мн/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.Megapascal, - new[] - { - new AbbreviationsForCulture("en-US", "MPa"), - new AbbreviationsForCulture("ru-RU", "МПа"), - }), - new CulturesForEnumValue((int) PressureUnit.MeterOfHead, - new[] - { - new AbbreviationsForCulture("en-US", "m of head"), - }), - new CulturesForEnumValue((int) PressureUnit.Micropascal, - new[] - { - new AbbreviationsForCulture("en-US", "µPa"), - new AbbreviationsForCulture("ru-RU", "мкПа"), - }), - new CulturesForEnumValue((int) PressureUnit.Millibar, - new[] - { - new AbbreviationsForCulture("en-US", "mbar"), - new AbbreviationsForCulture("ru-RU", "mбар"), - }), - new CulturesForEnumValue((int) PressureUnit.MillimeterOfMercury, - new[] - { - new AbbreviationsForCulture("en-US", "mmHg"), - }), - new CulturesForEnumValue((int) PressureUnit.NewtonPerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/cm²"), - new AbbreviationsForCulture("ru-RU", "Н/см²"), - }), - new CulturesForEnumValue((int) PressureUnit.NewtonPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/m²"), - new AbbreviationsForCulture("ru-RU", "Н/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.NewtonPerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/mm²"), - new AbbreviationsForCulture("ru-RU", "Н/мм²"), - }), - new CulturesForEnumValue((int) PressureUnit.Pascal, - new[] - { - new AbbreviationsForCulture("en-US", "Pa"), - new AbbreviationsForCulture("ru-RU", "Па"), - }), - new CulturesForEnumValue((int) PressureUnit.PoundForcePerSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb/ft²"), - }), - new CulturesForEnumValue((int) PressureUnit.PoundForcePerSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "psi", "lb/in²"), - }), - new CulturesForEnumValue((int) PressureUnit.TechnicalAtmosphere, - new[] - { - new AbbreviationsForCulture("en-US", "at"), - new AbbreviationsForCulture("ru-RU", "ат"), - }), - new CulturesForEnumValue((int) PressureUnit.TonneForcePerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/cm²"), - }), - new CulturesForEnumValue((int) PressureUnit.TonneForcePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/m²"), - }), - new CulturesForEnumValue((int) PressureUnit.TonneForcePerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/mm²"), - }), - new CulturesForEnumValue((int) PressureUnit.Torr, - new[] - { - new AbbreviationsForCulture("en-US", "torr"), - new AbbreviationsForCulture("ru-RU", "торр"), - }), - }), - new UnitLocalization(typeof (PressureChangeRateUnit), - new[] - { - new CulturesForEnumValue((int) PressureChangeRateUnit.AtmospherePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "atm/s"), - new AbbreviationsForCulture("ru-RU", "атм/с"), - }), - new CulturesForEnumValue((int) PressureChangeRateUnit.KilopascalPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kPa/s"), - new AbbreviationsForCulture("ru-RU", "кПа/с"), - }), - new CulturesForEnumValue((int) PressureChangeRateUnit.MegapascalPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "MPa/s"), - new AbbreviationsForCulture("ru-RU", "МПа/с"), - }), - new CulturesForEnumValue((int) PressureChangeRateUnit.PascalPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Pa/s"), - new AbbreviationsForCulture("ru-RU", "Па/с"), - }), - }), - new UnitLocalization(typeof (RatioUnit), - new[] - { - new CulturesForEnumValue((int) RatioUnit.DecimalFraction, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerBillion, - new[] - { - new AbbreviationsForCulture("en-US", "ppb"), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerMillion, - new[] - { - new AbbreviationsForCulture("en-US", "ppm"), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerThousand, - new[] - { - new AbbreviationsForCulture("en-US", "‰"), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerTrillion, - new[] - { - new AbbreviationsForCulture("en-US", "ppt"), - }), - new CulturesForEnumValue((int) RatioUnit.Percent, - new[] - { - new AbbreviationsForCulture("en-US", "%"), - }), - }), - new UnitLocalization(typeof (ReactiveEnergyUnit), - new[] - { - new CulturesForEnumValue((int) ReactiveEnergyUnit.KilovoltampereReactiveHour, - new[] - { - new AbbreviationsForCulture("en-US", "kvarh"), - }), - new CulturesForEnumValue((int) ReactiveEnergyUnit.MegavoltampereReactiveHour, - new[] - { - new AbbreviationsForCulture("en-US", "Mvarh"), - }), - new CulturesForEnumValue((int) ReactiveEnergyUnit.VoltampereReactiveHour, - new[] - { - new AbbreviationsForCulture("en-US", "varh"), - }), - }), - new UnitLocalization(typeof (ReactivePowerUnit), - new[] - { - new CulturesForEnumValue((int) ReactivePowerUnit.GigavoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "Gvar"), - }), - new CulturesForEnumValue((int) ReactivePowerUnit.KilovoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "kvar"), - }), - new CulturesForEnumValue((int) ReactivePowerUnit.MegavoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "Mvar"), - }), - new CulturesForEnumValue((int) ReactivePowerUnit.VoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "var"), - }), - }), - new UnitLocalization(typeof (RotationalAccelerationUnit), - new[] - { - new CulturesForEnumValue((int) RotationalAccelerationUnit.DegreePerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "°/s²", "deg/s²"), - }), - new CulturesForEnumValue((int) RotationalAccelerationUnit.RadianPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "rad/s²"), - }), - new CulturesForEnumValue((int) RotationalAccelerationUnit.RevolutionPerMinutePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "rpm/s"), - }), - }), - new UnitLocalization(typeof (RotationalSpeedUnit), - new[] - { - new CulturesForEnumValue((int) RotationalSpeedUnit.CentiradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "crad/s"), - new AbbreviationsForCulture("ru-RU", "cрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.DeciradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "drad/s"), - new AbbreviationsForCulture("ru-RU", "dрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.DegreePerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "°/min", "deg/min"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.DegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "°/s", "deg/s"), - new AbbreviationsForCulture("ru-RU", "°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MicrodegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µ°/s"), - new AbbreviationsForCulture("ru-RU", "µ°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MicroradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µrad/s"), - new AbbreviationsForCulture("ru-RU", "µрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MillidegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m°/s"), - new AbbreviationsForCulture("ru-RU", "m°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MilliradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mrad/s"), - new AbbreviationsForCulture("ru-RU", "mрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.NanodegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "n°/s"), - new AbbreviationsForCulture("ru-RU", "n°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.NanoradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "nrad/s"), - new AbbreviationsForCulture("ru-RU", "nрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.RadianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "rad/s"), - new AbbreviationsForCulture("ru-RU", "рад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.RevolutionPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "rpm", "r/min"), - new AbbreviationsForCulture("ru-RU", "об/мин"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.RevolutionPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "r/s"), - new AbbreviationsForCulture("ru-RU", "об/с"), - }), - }), - new UnitLocalization(typeof (RotationalStiffnessUnit), - new[] - { - new CulturesForEnumValue((int) RotationalStiffnessUnit.KilonewtonMeterPerRadian, - new[] - { - new AbbreviationsForCulture("en-US", "kN·m/rad"), - }), - new CulturesForEnumValue((int) RotationalStiffnessUnit.MeganewtonMeterPerRadian, - new[] - { - new AbbreviationsForCulture("en-US", "MN·m/rad"), - }), - new CulturesForEnumValue((int) RotationalStiffnessUnit.NewtonMeterPerRadian, - new[] - { - new AbbreviationsForCulture("en-US", "N·m/rad", "Nm/rad"), - }), - }), - new UnitLocalization(typeof (RotationalStiffnessPerLengthUnit), - new[] - { - new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·m/rad/m"), - }), - new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·m/rad/m"), - }), - new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·m/rad/m", "Nm/rad/m"), - }), - }), - new UnitLocalization(typeof (SolidAngleUnit), - new[] - { - new CulturesForEnumValue((int) SolidAngleUnit.Steradian, - new[] - { - new AbbreviationsForCulture("en-US", "sr"), - }), - }), - new UnitLocalization(typeof (SpecificEnergyUnit), - new[] - { - new CulturesForEnumValue((int) SpecificEnergyUnit.CaloriePerGram, - new[] - { - new AbbreviationsForCulture("en-US", "cal/g"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.JoulePerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "J/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.KilocaloriePerGram, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/g"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.KilojoulePerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.KilowattHourPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "kWh/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.MegajoulePerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.MegawattHourPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "MWh/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.WattHourPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "Wh/kg"), - }), - }), - new UnitLocalization(typeof (SpecificEntropyUnit), - new[] - { - new CulturesForEnumValue((int) SpecificEntropyUnit.CaloriePerGramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "cal/g.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "J/kg.C"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.JoulePerKilogramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "J/kg.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.KilocaloriePerGramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/g.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/kg.C"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.KilojoulePerKilogramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/kg.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/kg.C"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.MegajoulePerKilogramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/kg.K"), - }), - }), - new UnitLocalization(typeof (SpecificVolumeUnit), - new[] - { - new CulturesForEnumValue((int) SpecificVolumeUnit.CubicFootPerPound, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/lb"), - }), - new CulturesForEnumValue((int) SpecificVolumeUnit.CubicMeterPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "m³/kg"), - }), - }), - new UnitLocalization(typeof (SpecificWeightUnit), - new[] - { - new CulturesForEnumValue((int) SpecificWeightUnit.KilogramForcePerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilogramForcePerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilogramForcePerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/mm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilonewtonPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilonewtonPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilonewtonPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/mm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilopoundForcePerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/ft³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilopoundForcePerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/in³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.MeganewtonPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.NewtonPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.NewtonPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.NewtonPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/mm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.PoundForcePerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lbf/ft³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.PoundForcePerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "lbf/in³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.TonneForcePerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.TonneForcePerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.TonneForcePerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/mm³"), - }), - }), - new UnitLocalization(typeof (SpeedUnit), - new[] - { - new CulturesForEnumValue((int) SpeedUnit.CentimeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "cm/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.CentimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.CentimeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "cm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.DecimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.DecimeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.FootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ft/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.FootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ft/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.FootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ft/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.InchPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "in/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.InchPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "in/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.InchPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "in/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.KilometerPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "km/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.KilometerPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "km/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.KilometerPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "km/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.Knot, - new[] - { - new AbbreviationsForCulture("en-US", "kn", "kt", "knot", "knots"), - }), - new CulturesForEnumValue((int) SpeedUnit.MeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "m/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.MeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "m/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.MeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.MicrometerPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "µm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.MicrometerPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.MilePerHour, - new[] - { - new AbbreviationsForCulture("en-US", "mph"), - }), - new CulturesForEnumValue((int) SpeedUnit.MillimeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "mm/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.MillimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "mm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.MillimeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.NanometerPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "nm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.NanometerPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "nm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.UsSurveyFootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.UsSurveyFootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.UsSurveyFootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.YardPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "yd/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.YardPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "yd/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.YardPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "yd/s"), - }), - }), - new UnitLocalization(typeof (TemperatureUnit), - new[] - { - new CulturesForEnumValue((int) TemperatureUnit.DegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "°C"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeDelisle, - new[] - { - new AbbreviationsForCulture("en-US", "°De"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeFahrenheit, - new[] - { - new AbbreviationsForCulture("en-US", "°F"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeNewton, - new[] - { - new AbbreviationsForCulture("en-US", "°N"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeRankine, - new[] - { - new AbbreviationsForCulture("en-US", "°R"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeReaumur, - new[] - { - new AbbreviationsForCulture("en-US", "°Ré"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeRoemer, - new[] - { - new AbbreviationsForCulture("en-US", "°Rø"), - }), - new CulturesForEnumValue((int) TemperatureUnit.Kelvin, - new[] - { - new AbbreviationsForCulture("en-US", "K"), - }), - }), - new UnitLocalization(typeof (TemperatureChangeRateUnit), - new[] - { - new CulturesForEnumValue((int) TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "c°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "da°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "d°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DegreeCelsiusPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "°C/min"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "h°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "k°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µ°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "n°C/s"), - }), - }), - new UnitLocalization(typeof (TemperatureDeltaUnit), - new[] - { - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "∆°C"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeDelisle, - new[] - { - new AbbreviationsForCulture("en-US", "∆°De"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeFahrenheit, - new[] - { - new AbbreviationsForCulture("en-US", "∆°F"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeNewton, - new[] - { - new AbbreviationsForCulture("en-US", "∆°N"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRankine, - new[] - { - new AbbreviationsForCulture("en-US", "∆°R"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeReaumur, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Ré"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRoemer, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Rø"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.Kelvin, - new[] - { - new AbbreviationsForCulture("en-US", "∆K"), - }), - }), - new UnitLocalization(typeof (ThermalConductivityUnit), - new[] - { - new CulturesForEnumValue((int) ThermalConductivityUnit.BtuPerHourFootFahrenheit, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/h·ft·°F"), - }), - new CulturesForEnumValue((int) ThermalConductivityUnit.WattPerMeterKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "W/m·K"), - }), - }), - new UnitLocalization(typeof (ThermalResistanceUnit), - new[] - { - new CulturesForEnumValue((int) ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, - new[] - { - new AbbreviationsForCulture("en-US", "Hrft²°F/Btu"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, - new[] - { - new AbbreviationsForCulture("en-US", "cm²Hr°C/kcal"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, - new[] - { - new AbbreviationsForCulture("en-US", "cm²K/W"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, - new[] - { - new AbbreviationsForCulture("en-US", "m²°C/W"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, - new[] - { - new AbbreviationsForCulture("en-US", "m²K/kW"), - }), - }), - new UnitLocalization(typeof (TorqueUnit), - new[] - { - new CulturesForEnumValue((int) TorqueUnit.KilogramForceCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilogramForceMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf·m"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilogramForceMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilonewtonCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilonewtonMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·m"), - new AbbreviationsForCulture("ru-RU", "кН·м"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilonewtonMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilopoundForceFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kipf·ft"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilopoundForceInch, - new[] - { - new AbbreviationsForCulture("en-US", "kipf·in"), - }), - new CulturesForEnumValue((int) TorqueUnit.MeganewtonCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.MeganewtonMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·m"), - new AbbreviationsForCulture("ru-RU", ""), - }), - new CulturesForEnumValue((int) TorqueUnit.MeganewtonMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.MegapoundForceFoot, - new[] - { - new AbbreviationsForCulture("en-US", "Mlbf·ft"), - }), - new CulturesForEnumValue((int) TorqueUnit.MegapoundForceInch, - new[] - { - new AbbreviationsForCulture("en-US", "Mlbf·in"), - }), - new CulturesForEnumValue((int) TorqueUnit.NewtonCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.NewtonMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·m"), - new AbbreviationsForCulture("ru-RU", "Н·м"), - }), - new CulturesForEnumValue((int) TorqueUnit.NewtonMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.PoundForceFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lbf·ft"), - }), - new CulturesForEnumValue((int) TorqueUnit.PoundForceInch, - new[] - { - new AbbreviationsForCulture("en-US", "lbf·in"), - }), - new CulturesForEnumValue((int) TorqueUnit.TonneForceCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.TonneForceMeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf·m"), - }), - new CulturesForEnumValue((int) TorqueUnit.TonneForceMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf·mm"), - }), - }), - new UnitLocalization(typeof (VitaminAUnit), - new[] - { - new CulturesForEnumValue((int) VitaminAUnit.InternationalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "IU"), - }), - }), - new UnitLocalization(typeof (VolumeUnit), - new[] - { - new CulturesForEnumValue((int) VolumeUnit.AuTablespoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.Centiliter, - new[] - { - new AbbreviationsForCulture("en-US", "cl"), - new AbbreviationsForCulture("ru-RU", "сл"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cm³"), - new AbbreviationsForCulture("ru-RU", "см³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "dm³"), - new AbbreviationsForCulture("ru-RU", "дм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ft³"), - new AbbreviationsForCulture("ru-RU", "фут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "in³"), - new AbbreviationsForCulture("ru-RU", "дюйм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicKilometer, - new[] - { - new AbbreviationsForCulture("en-US", "km³"), - new AbbreviationsForCulture("ru-RU", "км³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "m³"), - new AbbreviationsForCulture("ru-RU", "м³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMicrometer, - new[] - { - new AbbreviationsForCulture("en-US", "µm³"), - new AbbreviationsForCulture("ru-RU", "мкм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMile, - new[] - { - new AbbreviationsForCulture("en-US", "mi³"), - new AbbreviationsForCulture("ru-RU", "миля³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mm³"), - new AbbreviationsForCulture("ru-RU", "мм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicYard, - new[] - { - new AbbreviationsForCulture("en-US", "yd³"), - new AbbreviationsForCulture("ru-RU", "ярд³"), - }), - new CulturesForEnumValue((int) VolumeUnit.Deciliter, - new[] - { - new AbbreviationsForCulture("en-US", "dl"), - new AbbreviationsForCulture("ru-RU", "дл"), - }), - new CulturesForEnumValue((int) VolumeUnit.HectocubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "hft³"), - new AbbreviationsForCulture("ru-RU", "hфут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.HectocubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "hm³"), - new AbbreviationsForCulture("ru-RU", "hм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.Hectoliter, - new[] - { - new AbbreviationsForCulture("en-US", "hl"), - new AbbreviationsForCulture("ru-RU", "гл"), - }), - new CulturesForEnumValue((int) VolumeUnit.ImperialBeerBarrel, - new[] - { - new AbbreviationsForCulture("en-US", "bl (imp.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.ImperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "gal (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.ImperialOunce, - new[] - { - new AbbreviationsForCulture("en-US", "oz (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английская унция"), - }), - new CulturesForEnumValue((int) VolumeUnit.KilocubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kft³"), - new AbbreviationsForCulture("ru-RU", "kфут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.KilocubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "km³"), - new AbbreviationsForCulture("ru-RU", "kм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.KiloimperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "kgal (imp.)"), - new AbbreviationsForCulture("ru-RU", "kАнглийский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.KilousGallon, - new[] - { - new AbbreviationsForCulture("en-US", "kgal (U.S.)"), - new AbbreviationsForCulture("ru-RU", "kАмериканский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.Liter, - new[] - { - new AbbreviationsForCulture("en-US", "l"), - new AbbreviationsForCulture("ru-RU", "л"), - }), - new CulturesForEnumValue((int) VolumeUnit.MegacubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "Mft³"), - new AbbreviationsForCulture("ru-RU", "Mфут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.MegaimperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "Mgal (imp.)"), - new AbbreviationsForCulture("ru-RU", "MАнглийский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.MegausGallon, - new[] - { - new AbbreviationsForCulture("en-US", "Mgal (U.S.)"), - new AbbreviationsForCulture("ru-RU", "MАмериканский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.MetricCup, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.MetricTeaspoon, - new[] - { - new AbbreviationsForCulture("en-US", "tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.Microliter, - new[] - { - new AbbreviationsForCulture("en-US", "µl"), - new AbbreviationsForCulture("ru-RU", "мкл"), - }), - new CulturesForEnumValue((int) VolumeUnit.Milliliter, - new[] - { - new AbbreviationsForCulture("en-US", "ml"), - new AbbreviationsForCulture("ru-RU", "мл"), - }), - new CulturesForEnumValue((int) VolumeUnit.OilBarrel, - new[] - { - new AbbreviationsForCulture("en-US", "bbl"), - }), - new CulturesForEnumValue((int) VolumeUnit.UkTablespoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsBeerBarrel, - new[] - { - new AbbreviationsForCulture("en-US", "bl (U.S.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsCustomaryCup, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsGallon, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsLegalCup, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsOunce, - new[] - { - new AbbreviationsForCulture("en-US", "oz (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американская унция"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsPint, - new[] - { - new AbbreviationsForCulture("en-US", "pt (U.S.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsQuart, - new[] - { - new AbbreviationsForCulture("en-US", "qt (U.S.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsTablespoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsTeaspoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - }), - new UnitLocalization(typeof (VolumeFlowUnit), - new[] - { - new CulturesForEnumValue((int) VolumeFlowUnit.CentiliterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicDecimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dm³/min"), - new AbbreviationsForCulture("ru-RU", "дм³/мин"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicFootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/h", "cf/hr"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicFootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/min"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicFootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/s"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicMeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "m³/h"), - new AbbreviationsForCulture("ru-RU", "м³/ч"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicMeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "m³/min"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicMeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m³/s"), - new AbbreviationsForCulture("ru-RU", "м³/с"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicYardPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/h"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicYardPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/min"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicYardPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/s"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.DeciliterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.KiloliterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.LiterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "LPH"), - new AbbreviationsForCulture("ru-RU", "л/ч"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.LiterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "LPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.LiterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "LPS"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.MicroliterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "µLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.MilliliterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "mLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.MillionUsGallonsPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "MGD"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.NanoliterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "nLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/d", "BOPD"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/hr", "bph"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/min", "bpm"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/h"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/min", "GPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/s"), - }), - }), - }); + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.CentimeterPerSecondSquared, new string[]{"cm/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.DecimeterPerSecondSquared, new string[]{"dm/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.FootPerSecondSquared, new string[]{"ft/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.InchPerSecondSquared, new string[]{"in/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KilometerPerSecondSquared, new string[]{"km/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerHour, new string[]{"kn/h"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerMinute, new string[]{"kn/min"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerSecond, new string[]{"kn/s"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MeterPerSecondSquared, new string[]{"m/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MicrometerPerSecondSquared, new string[]{"µm/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MillimeterPerSecondSquared, new string[]{"mm/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.NanometerPerSecondSquared, new string[]{"nm/s²"}), + Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.StandardGravity, new string[]{"g"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Centimole, new string[]{"cmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.CentipoundMole, new string[]{"clbmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Decimole, new string[]{"dmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.DecipoundMole, new string[]{"dlbmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Kilomole, new string[]{"kmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.KilopoundMole, new string[]{"klbmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Micromole, new string[]{"µmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.MicropoundMole, new string[]{"µlbmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Millimole, new string[]{"mmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.MillipoundMole, new string[]{"mlbmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Mole, new string[]{"mol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Nanomole, new string[]{"nmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.NanopoundMole, new string[]{"nlbmol"}), + Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.PoundMole, new string[]{"lbmol"}), + Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelMicrovolt, new string[]{"dBµV"}), + Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelMillivolt, new string[]{"dBmV"}), + Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelUnloaded, new string[]{"dBu"}), + Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelVolt, new string[]{"dBV"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Arcminute, new string[]{"'", "arcmin", "amin", "min"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Arcsecond, new string[]{"″", "arcsec", "asec", "sec"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Centiradian, new string[]{"crad"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Centiradian, new string[]{"cрад"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Deciradian, new string[]{"drad"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Deciradian, new string[]{"dрад"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Degree, new string[]{"°", "deg"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Degree, new string[]{"°"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µrad"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µрад"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mrad"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mрад"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nrad"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nрад"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Radian, new string[]{"rad"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Radian, new string[]{"рад"}), + Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Revolution, new string[]{"r"}), + Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Revolution, new string[]{"r"}), + Tuple.Create("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.KilovoltampereHour, new string[]{"kVAh"}), + Tuple.Create("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.MegavoltampereHour, new string[]{"MVAh"}), + Tuple.Create("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.VoltampereHour, new string[]{"VAh"}), + Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Gigavoltampere, new string[]{"GVA"}), + Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Kilovoltampere, new string[]{"kVA"}), + Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Megavoltampere, new string[]{"MVA"}), + Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Voltampere, new string[]{"VA"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.Acre, new string[]{"ac"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.Hectare, new string[]{"ha"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareCentimeter, new string[]{"cm²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareCentimeter, new string[]{"см²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareDecimeter, new string[]{"dm²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareDecimeter, new string[]{"дм²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareFoot, new string[]{"ft²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareFoot, new string[]{"фут²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareInch, new string[]{"in²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareInch, new string[]{"дюйм²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareKilometer, new string[]{"km²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareKilometer, new string[]{"км²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMeter, new string[]{"m²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMeter, new string[]{"м²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMicrometer, new string[]{"µm²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMicrometer, new string[]{"мкм²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMile, new string[]{"mi²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMile, new string[]{"миля²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMillimeter, new string[]{"mm²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMillimeter, new string[]{"мм²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareYard, new string[]{"yd²"}), + Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareYard, new string[]{"ярд²"}), + Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.UsSurveySquareFoot, new string[]{"ft² (US)"}), + Tuple.Create("en-US", typeof(AreaDensityUnit), (int)AreaDensityUnit.KilogramPerSquareMeter, new string[]{"kg/m²"}), + Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.CentimeterToTheFourth, new string[]{"cm⁴", "cm^4"}), + Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.DecimeterToTheFourth, new string[]{"dm⁴", "dm^4"}), + Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.FootToTheFourth, new string[]{"ft⁴", "ft^4"}), + Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.InchToTheFourth, new string[]{"in⁴", "in^4"}), + Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.MeterToTheFourth, new string[]{"m⁴", "m^4"}), + Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.MillimeterToTheFourth, new string[]{"mm⁴", "mm^4"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.BitPerSecond, new string[]{"bit/s", "bps"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.BytePerSecond, new string[]{"B/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabitPerSecond, new string[]{"Ebit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabytePerSecond, new string[]{"EB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibitPerSecond, new string[]{"Eibit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibytePerSecond, new string[]{"EiB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibitPerSecond, new string[]{"Gibit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibytePerSecond, new string[]{"GiB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabitPerSecond, new string[]{"Gbit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabytePerSecond, new string[]{"GB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibitPerSecond, new string[]{"Kibit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibytePerSecond, new string[]{"KiB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobitPerSecond, new string[]{"kbit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobytePerSecond, new string[]{"kB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibitPerSecond, new string[]{"Mibit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibytePerSecond, new string[]{"MiB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabitPerSecond, new string[]{"Mbit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabytePerSecond, new string[]{"MB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibitPerSecond, new string[]{"Pibit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibytePerSecond, new string[]{"PiB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabitPerSecond, new string[]{"Pbit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabytePerSecond, new string[]{"PB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibitPerSecond, new string[]{"Tibit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibytePerSecond, new string[]{"TiB/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabitPerSecond, new string[]{"Tbit/s"}), + Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabytePerSecond, new string[]{"TB/s"}), + Tuple.Create("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, new string[]{"g/kWh"}), + Tuple.Create("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, new string[]{"kg/J"}), + Tuple.Create("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, new string[]{"lb/hph"}), + Tuple.Create("en-US", typeof(CapacitanceUnit), (int)CapacitanceUnit.Farad, new string[]{"F"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerDeciliter, new string[]{"cg/dl"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerLiter, new string[]{"cg/L"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerMilliliter, new string[]{"cg/ml"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerDeciliter, new string[]{"dg/dl"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerLiter, new string[]{"dg/L"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerMilliliter, new string[]{"dg/ml"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicCentimeter, new string[]{"g/cm³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMeter, new string[]{"g/m³"}), + Tuple.Create("ru-RU", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMeter, new string[]{"г/м³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMillimeter, new string[]{"g/mm³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerDeciliter, new string[]{"g/dl"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerLiter, new string[]{"g/L"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerMilliliter, new string[]{"g/ml"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicCentimeter, new string[]{"kg/cm³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMeter, new string[]{"kg/m³"}), + Tuple.Create("ru-RU", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMeter, new string[]{"kг/м³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMillimeter, new string[]{"kg/mm³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilopoundPerCubicFoot, new string[]{"kip/ft³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilopoundPerCubicInch, new string[]{"kip/in³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerDeciliter, new string[]{"µg/dl"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerLiter, new string[]{"µg/L"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerMilliliter, new string[]{"µg/ml"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerCubicMeter, new string[]{"mg/m³"}), + Tuple.Create("ru-RU", typeof(DensityUnit), (int)DensityUnit.MilligramPerCubicMeter, new string[]{"mг/м³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerDeciliter, new string[]{"mg/dl"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerLiter, new string[]{"mg/L"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerMilliliter, new string[]{"mg/ml"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerDeciliter, new string[]{"ng/dl"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerLiter, new string[]{"ng/L"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerMilliliter, new string[]{"ng/ml"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerDeciliter, new string[]{"pg/dl"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerLiter, new string[]{"pg/L"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerMilliliter, new string[]{"pg/ml"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerCubicFoot, new string[]{"lb/ft³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerCubicInch, new string[]{"lb/in³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerImperialGallon, new string[]{"ppg (imp.)"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerUSGallon, new string[]{"ppg (U.S.)"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.SlugPerCubicFoot, new string[]{"slug/ft³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicCentimeter, new string[]{"t/cm³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicMeter, new string[]{"t/m³"}), + Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicMillimeter, new string[]{"t/mm³"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Day, new string[]{"d", "day", "days"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Day, new string[]{"д"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"h", "hr", "hrs", "hour", "hours"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"ч"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µs"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мкс"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"ms"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мс"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"m", "min", "minute", "minutes"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"мин"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"mo", "month", "months"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"месяц"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"ns"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нс"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"s", "sec", "secs", "second", "seconds"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"с"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"wk", "week", "weeks"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"мин"}), + Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"yr", "year", "years"}), + Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"год"}), + Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.Centipoise, new string[]{"cP"}), + Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.MicropascalSecond, new string[]{"µPaS"}), + Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.MillipascalSecond, new string[]{"mPaS"}), + Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.NewtonSecondPerMeterSquared, new string[]{"Ns/m²"}), + Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.PascalSecond, new string[]{"PaS"}), + Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.Poise, new string[]{"P"}), + Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Microsiemens, new string[]{"µS"}), + Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Millisiemens, new string[]{"mS"}), + Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Nanosiemens, new string[]{"nS"}), + Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Siemens, new string[]{"S"}), + Tuple.Create("en-US", typeof(ElectricChargeUnit), (int)ElectricChargeUnit.Coulomb, new string[]{"C"}), + Tuple.Create("en-US", typeof(ElectricChargeDensityUnit), (int)ElectricChargeDensityUnit.CoulombPerCubicMeter, new string[]{"C/m³"}), + Tuple.Create("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Microsiemens, new string[]{"µS"}), + Tuple.Create("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Millisiemens, new string[]{"mS"}), + Tuple.Create("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Siemens, new string[]{"S"}), + Tuple.Create("en-US", typeof(ElectricConductivityUnit), (int)ElectricConductivityUnit.SiemensPerMeter, new string[]{"S/m"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Ampere, new string[]{"A"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Centiampere, new string[]{"cA"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Kiloampere, new string[]{"kA"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Megaampere, new string[]{"MA"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Microampere, new string[]{"µA"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Milliampere, new string[]{"mA"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Nanoampere, new string[]{"nA"}), + Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Picoampere, new string[]{"pA"}), + Tuple.Create("en-US", typeof(ElectricCurrentDensityUnit), (int)ElectricCurrentDensityUnit.AmperePerSquareMeter, new string[]{"A/m²"}), + Tuple.Create("en-US", typeof(ElectricCurrentGradientUnit), (int)ElectricCurrentGradientUnit.AmperePerSecond, new string[]{"A/s"}), + Tuple.Create("en-US", typeof(ElectricFieldUnit), (int)ElectricFieldUnit.VoltPerMeter, new string[]{"V/m"}), + Tuple.Create("en-US", typeof(ElectricInductanceUnit), (int)ElectricInductanceUnit.Henry, new string[]{"H"}), + Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Kilovolt, new string[]{"kV"}), + Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Kilovolt, new string[]{"kВ"}), + Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Megavolt, new string[]{"MV"}), + Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Megavolt, new string[]{"MВ"}), + Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Microvolt, new string[]{"µV"}), + Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Microvolt, new string[]{"µВ"}), + Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Millivolt, new string[]{"mV"}), + Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Millivolt, new string[]{"mВ"}), + Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Volt, new string[]{"V"}), + Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Volt, new string[]{"В"}), + Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.KilovoltAc, new string[]{"kVac"}), + Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MegavoltAc, new string[]{"MVac"}), + Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MicrovoltAc, new string[]{"µVac"}), + Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MillivoltAc, new string[]{"mVac"}), + Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.VoltAc, new string[]{"Vac"}), + Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.KilovoltDc, new string[]{"kVdc"}), + Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MegavoltDc, new string[]{"MVdc"}), + Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MicrovoltDc, new string[]{"µVdc"}), + Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MillivoltDc, new string[]{"mVdc"}), + Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.VoltDc, new string[]{"Vdc"}), + Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Kiloohm, new string[]{"kΩ"}), + Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Megaohm, new string[]{"MΩ"}), + Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Milliohm, new string[]{"mΩ"}), + Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Ohm, new string[]{"Ω"}), + Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.MicroohmMeter, new string[]{"µΩ·m"}), + Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.MilliohmMeter, new string[]{"mΩ·m"}), + Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.NanoohmMeter, new string[]{"nΩ·m"}), + Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.OhmMeter, new string[]{"Ω·m"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.BritishThermalUnit, new string[]{"BTU"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Calorie, new string[]{"cal"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermEc, new string[]{"Dth (E.C.)"}), + Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermEc, new string[]{"Европейский декатерм"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermImperial, new string[]{"Dth (imp.)"}), + Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermImperial, new string[]{"Английский декатерм"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermUs, new string[]{"Dth (U.S.)"}), + Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermUs, new string[]{"Американский декатерм"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ElectronVolt, new string[]{"eV"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Erg, new string[]{"erg"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.FootPound, new string[]{"ft·lb"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigabritishThermalUnit, new string[]{"GBTU"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigawattHour, new string[]{"GWh"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigawattHour, new string[]{"GВт/ч"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Joule, new string[]{"J"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilobritishThermalUnit, new string[]{"kBTU"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Kilocalorie, new string[]{"kcal"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Kilojoule, new string[]{"kJ"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilowattHour, new string[]{"kWh"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilowattHour, new string[]{"kВт/ч"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegabritishThermalUnit, new string[]{"MBTU"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Megajoule, new string[]{"MJ"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegawattHour, new string[]{"MWh"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegawattHour, new string[]{"MВт/ч"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermEc, new string[]{"th (E.C.)"}), + Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermEc, new string[]{"Европейский терм"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermImperial, new string[]{"th (imp.)"}), + Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermImperial, new string[]{"Английский терм"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermUs, new string[]{"th (U.S.)"}), + Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermUs, new string[]{"Американский терм"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.WattHour, new string[]{"Wh"}), + Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.WattHour, new string[]{"Вт/ч"}), + Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.CaloriePerKelvin, new string[]{"cal/K"}), + Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.JoulePerDegreeCelsius, new string[]{"J/C"}), + Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.JoulePerKelvin, new string[]{"J/K"}), + Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilocaloriePerKelvin, new string[]{"kcal/K"}), + Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilojoulePerDegreeCelsius, new string[]{"kJ/C"}), + Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilojoulePerKelvin, new string[]{"kJ/K"}), + Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.MegajoulePerKelvin, new string[]{"MJ/K"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Decanewton, new string[]{"daN"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Decanewton, new string[]{"даН"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Dyn, new string[]{"dyn"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Dyn, new string[]{"дин"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.KilogramForce, new string[]{"kgf"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.KilogramForce, new string[]{"кгс"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Kilonewton, new string[]{"kN"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Kilonewton, new string[]{"кН"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.KiloPond, new string[]{"kp"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.KiloPond, new string[]{"кгс"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Meganewton, new string[]{"MN"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Meganewton, new string[]{""}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Newton, new string[]{"N"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Newton, new string[]{"Н"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Poundal, new string[]{"pdl"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Poundal, new string[]{"паундаль"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.PoundForce, new string[]{"lbf"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.PoundForce, new string[]{"фунт-сила"}), + Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.TonneForce, new string[]{"Ton"}), + Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.TonneForce, new string[]{"тс"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.CentinewtonPerSecond, new string[]{"cN/s"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecanewtonPerMinute, new string[]{"daN/min"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecanewtonPerSecond, new string[]{"daN/s"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecinewtonPerSecond, new string[]{"dN/s"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.KilonewtonPerMinute, new string[]{"kN/min"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.KilonewtonPerSecond, new string[]{"kN/s"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.MicronewtonPerSecond, new string[]{"µN/s"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.MillinewtonPerSecond, new string[]{"mN/s"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NanonewtonPerSecond, new string[]{"nN/s"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NewtonPerMinute, new string[]{"N/min"}), + Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NewtonPerSecond, new string[]{"N/s"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.CentinewtonPerMeter, new string[]{"cN/m"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.DecinewtonPerMeter, new string[]{"dN/m"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"kgf/m"}), + Tuple.Create("ru-RU", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"кгс/м"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilonewtonPerMeter, new string[]{"kN/m"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MeganewtonPerMeter, new string[]{"MN/m"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MicronewtonPerMeter, new string[]{"µN/m"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MillinewtonPerMeter, new string[]{"mN/m"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.NanonewtonPerMeter, new string[]{"nN/m"}), + Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.NewtonPerMeter, new string[]{"N/m"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.CyclePerHour, new string[]{"cph"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.CyclePerMinute, new string[]{"cpm"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Gigahertz, new string[]{"GHz"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Hertz, new string[]{"Hz"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Kilohertz, new string[]{"kHz"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Megahertz, new string[]{"MHz"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.RadianPerSecond, new string[]{"rad/s"}), + Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Terahertz, new string[]{"THz"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerHourSquareFoot, new string[]{"BTU/h·ft²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerMinuteSquareFoot, new string[]{"BTU/min·ft²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerSecondSquareFoot, new string[]{"BTU/s·ft²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerSecondSquareInch, new string[]{"BTU/s·in²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.CaloriePerSecondSquareCentimeter, new string[]{"cal/s·cm²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.CentiwattPerSquareMeter, new string[]{"cW/m²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.DeciwattPerSquareMeter, new string[]{"dW/m²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilocaloriePerHourSquareMeter, new string[]{"kcal/h·m²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, new string[]{"kcal/s·cm²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilowattPerSquareMeter, new string[]{"kW/m²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MicrowattPerSquareMeter, new string[]{"µW/m²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MilliwattPerSquareMeter, new string[]{"mW/m²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.NanowattPerSquareMeter, new string[]{"nW/m²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareFoot, new string[]{"W/ft²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareInch, new string[]{"W/in²"}), + Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareMeter, new string[]{"W/m²"}), + Tuple.Create("en-US", typeof(HeatTransferCoefficientUnit), (int)HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, new string[]{"W/m²·°C"}), + Tuple.Create("en-US", typeof(HeatTransferCoefficientUnit), (int)HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, new string[]{"W/m²·K"}), + Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Kilolux, new string[]{"klx"}), + Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Lux, new string[]{"lx"}), + Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Megalux, new string[]{"Mlx"}), + Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Millilux, new string[]{"mlx"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Bit, new string[]{"b"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Byte, new string[]{"B"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exabit, new string[]{"Eb"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exabyte, new string[]{"EB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exbibit, new string[]{"Eib"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exbibyte, new string[]{"EiB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gibibit, new string[]{"Gib"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gibibyte, new string[]{"GiB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gigabit, new string[]{"Gb"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gigabyte, new string[]{"GB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kibibit, new string[]{"Kib"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kibibyte, new string[]{"KiB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kilobit, new string[]{"kb"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kilobyte, new string[]{"kB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Mebibit, new string[]{"Mib"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Mebibyte, new string[]{"MiB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Megabit, new string[]{"Mb"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Megabyte, new string[]{"MB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Pebibit, new string[]{"Pib"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Pebibyte, new string[]{"PiB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Petabit, new string[]{"Pb"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Petabyte, new string[]{"PB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Tebibit, new string[]{"Tib"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Tebibyte, new string[]{"TiB"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Terabit, new string[]{"Tb"}), + Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Terabyte, new string[]{"TB"}), + Tuple.Create("en-US", typeof(IrradianceUnit), (int)IrradianceUnit.KilowattPerSquareMeter, new string[]{"kW/m²"}), + Tuple.Create("en-US", typeof(IrradianceUnit), (int)IrradianceUnit.WattPerSquareMeter, new string[]{"W/m²"}), + Tuple.Create("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.JoulePerSquareMeter, new string[]{"J/m²"}), + Tuple.Create("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.KilowattHourPerSquareMeter, new string[]{"kWh/m²"}), + Tuple.Create("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.WattHourPerSquareMeter, new string[]{"Wh/m²"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Centistokes, new string[]{"cSt"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Centistokes, new string[]{"сСт"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Decistokes, new string[]{"dSt"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Decistokes, new string[]{"дСт"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Kilostokes, new string[]{"kSt"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Kilostokes, new string[]{"кСт"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Microstokes, new string[]{"µSt"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Microstokes, new string[]{"мкСт"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Millistokes, new string[]{"mSt"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Millistokes, new string[]{"мСт"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Nanostokes, new string[]{"nSt"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Nanostokes, new string[]{"нСт"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.SquareMeterPerSecond, new string[]{"m²/s"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.SquareMeterPerSecond, new string[]{"м²/с"}), + Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Stokes, new string[]{"St"}), + Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Stokes, new string[]{"Ст"}), + Tuple.Create("en-US", typeof(LapseRateUnit), (int)LapseRateUnit.DegreeCelsiusPerKilometer, new string[]{"∆°C/km"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Centimeter, new string[]{"cm"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Centimeter, new string[]{"см"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Decimeter, new string[]{"dm"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Decimeter, new string[]{"дм"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPica, new string[]{"pica"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPoint, new string[]{"pt"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Fathom, new string[]{"fathom"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"ft", "'"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"фут"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"in", "\""}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"дюйм"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"km"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"км"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Meter, new string[]{"m"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Meter, new string[]{"м"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Microinch, new string[]{"µin"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Microinch, new string[]{"микродюйм"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Micrometer, new string[]{"µm"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Micrometer, new string[]{"мкм"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Mil, new string[]{"mil"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Mil, new string[]{"мил"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Mile, new string[]{"mi"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Mile, new string[]{"миля"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Millimeter, new string[]{"mm"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Millimeter, new string[]{"мм"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Nanometer, new string[]{"nm"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Nanometer, new string[]{"нм"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.NauticalMile, new string[]{"NM"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.NauticalMile, new string[]{"мил"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.PrinterPica, new string[]{"pica"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.PrinterPoint, new string[]{"pt"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Shackle, new string[]{"shackle"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Twip, new string[]{"twip"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.UsSurveyFoot, new string[]{"ftUS"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Yard, new string[]{"yd"}), + Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Yard, new string[]{"ярд"}), + Tuple.Create("en-US", typeof(LevelUnit), (int)LevelUnit.Decibel, new string[]{"dB"}), + Tuple.Create("en-US", typeof(LevelUnit), (int)LevelUnit.Neper, new string[]{"Np"}), + Tuple.Create("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.GramPerMeter, new string[]{"g/m"}), + Tuple.Create("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.KilogramPerMeter, new string[]{"kg/m"}), + Tuple.Create("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.PoundPerFoot, new string[]{"lb/ft"}), + Tuple.Create("en-US", typeof(LuminousFluxUnit), (int)LuminousFluxUnit.Lumen, new string[]{"lm"}), + Tuple.Create("en-US", typeof(LuminousIntensityUnit), (int)LuminousIntensityUnit.Candela, new string[]{"cd"}), + Tuple.Create("en-US", typeof(MagneticFieldUnit), (int)MagneticFieldUnit.Tesla, new string[]{"T"}), + Tuple.Create("en-US", typeof(MagneticFluxUnit), (int)MagneticFluxUnit.Weber, new string[]{"Wb"}), + Tuple.Create("en-US", typeof(MagnetizationUnit), (int)MagnetizationUnit.AmperePerMeter, new string[]{"A/m"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Centigram, new string[]{"cg"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Centigram, new string[]{"сг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Decagram, new string[]{"dag"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Decagram, new string[]{"даг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Decigram, new string[]{"dg"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Decigram, new string[]{"дг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Gram, new string[]{"g"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Gram, new string[]{"г"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Hectogram, new string[]{"hg"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Hectogram, new string[]{"гг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"kg"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"кг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klb"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"kфунт"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"kt"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"кт"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.LongHundredweight, new string[]{"cwt"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"long tn"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"тонна большая"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlb"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mфунт"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Mt"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Мт"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Microgram, new string[]{"µg"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Microgram, new string[]{"мкг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Milligram, new string[]{"mg"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Milligram, new string[]{"мг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Nanogram, new string[]{"ng"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Nanogram, new string[]{"нг"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Ounce, new string[]{"oz"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Pound, new string[]{"lb", "lbs", "lbm"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Pound, new string[]{"фунт"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.ShortHundredweight, new string[]{"cwt"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.ShortTon, new string[]{"short tn"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.ShortTon, new string[]{"тонна малая"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Stone, new string[]{"st"}), + Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Tonne, new string[]{"t"}), + Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Tonne, new string[]{"т"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.CentigramPerSecond, new string[]{"cg/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.DecagramPerSecond, new string[]{"dag/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.DecigramPerSecond, new string[]{"dg/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.GramPerSecond, new string[]{"g/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.HectogramPerSecond, new string[]{"hg/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerHour, new string[]{"kg/h"}), + Tuple.Create("ru-RU", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerHour, new string[]{"кг/ч"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerSecond, new string[]{"kg/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MegapoundPerHour, new string[]{"Mlb/h"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MicrogramPerSecond, new string[]{"µg/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MilligramPerSecond, new string[]{"mg/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.NanogramPerSecond, new string[]{"ng/S"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.PoundPerHour, new string[]{"lb/h"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.ShortTonPerHour, new string[]{"short tn/h"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerDay, new string[]{"t/d"}), + Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerHour, new string[]{"t/h"}), + Tuple.Create("en-US", typeof(MassFluxUnit), (int)MassFluxUnit.GramPerSecondPerSquareMeter, new string[]{"g·s⁻¹·m⁻²"}), + Tuple.Create("en-US", typeof(MassFluxUnit), (int)MassFluxUnit.KilogramPerSecondPerSquareMeter, new string[]{"kg·s⁻¹·m⁻²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareCentimeter, new string[]{"g·cm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareDecimeter, new string[]{"g·dm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareMeter, new string[]{"g·m²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareMillimeter, new string[]{"g·mm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareCentimeter, new string[]{"kg·cm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareDecimeter, new string[]{"kg·dm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareMeter, new string[]{"kg·m²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareMillimeter, new string[]{"kg·mm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareCentimeter, new string[]{"kt·cm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareDecimeter, new string[]{"kt·dm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareMeter, new string[]{"kt·m²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareMilimeter, new string[]{"kt·mm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareCentimeter, new string[]{"Mt·cm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareDecimeter, new string[]{"Mt·dm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareMeter, new string[]{"Mt·m²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareMilimeter, new string[]{"Mt·mm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareCentimeter, new string[]{"mg·cm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareDecimeter, new string[]{"mg·dm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareMeter, new string[]{"mg·m²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareMillimeter, new string[]{"mg·mm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.PoundSquareFoot, new string[]{"lb·ft²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.PoundSquareInch, new string[]{"lb·in²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareCentimeter, new string[]{"t·cm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareDecimeter, new string[]{"t·dm²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareMeter, new string[]{"t·m²"}), + Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareMilimeter, new string[]{"t·mm²"}), + Tuple.Create("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.JoulePerMole, new string[]{"J/mol"}), + Tuple.Create("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.KilojoulePerMole, new string[]{"kJ/mol"}), + Tuple.Create("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.MegajoulePerMole, new string[]{"MJ/mol"}), + Tuple.Create("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.JoulePerMoleKelvin, new string[]{"J/(mol*K)"}), + Tuple.Create("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.KilojoulePerMoleKelvin, new string[]{"kJ/(mol*K)"}), + Tuple.Create("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.MegajoulePerMoleKelvin, new string[]{"MJ/(mol*K)"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.CentimolesPerLiter, new string[]{"cmol/L"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.DecimolesPerLiter, new string[]{"dmol/L"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MicromolesPerLiter, new string[]{"µmol/L"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MillimolesPerLiter, new string[]{"mmol/L"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerCubicMeter, new string[]{"mol/m³"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerLiter, new string[]{"mol/L"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.NanomolesPerLiter, new string[]{"nmol/L"}), + Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.PicomolesPerLiter, new string[]{"pmol/L"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"cg/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"сг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"dag/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"даг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecigramPerMole, new string[]{"dg/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.DecigramPerMole, new string[]{"дг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.GramPerMole, new string[]{"g/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.GramPerMole, new string[]{"г/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.HectogramPerMole, new string[]{"hg/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.HectogramPerMole, new string[]{"гг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.KilogramPerMole, new string[]{"kg/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.KilogramPerMole, new string[]{"кг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.KilopoundPerMole, new string[]{"klb/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.KilopoundPerMole, new string[]{"kфунт/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MegapoundPerMole, new string[]{"Mlb/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MegapoundPerMole, new string[]{"Mфунт/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MicrogramPerMole, new string[]{"µg/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MicrogramPerMole, new string[]{"мкг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MilligramPerMole, new string[]{"mg/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MilligramPerMole, new string[]{"мг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.NanogramPerMole, new string[]{"ng/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.NanogramPerMole, new string[]{"нг/моль"}), + Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.PoundPerMole, new string[]{"lb/mol"}), + Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.PoundPerMole, new string[]{"фунт/моль"}), + Tuple.Create("en-US", typeof(PermeabilityUnit), (int)PermeabilityUnit.HenryPerMeter, new string[]{"H/m"}), + Tuple.Create("en-US", typeof(PermittivityUnit), (int)PermittivityUnit.FaradPerMeter, new string[]{"F/m"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.BoilerHorsepower, new string[]{"hp(S)"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.BritishThermalUnitPerHour, new string[]{"Btu/hr"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Decawatt, new string[]{"daW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Deciwatt, new string[]{"dW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.ElectricalHorsepower, new string[]{"hp(E)"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Femtowatt, new string[]{"fW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Gigawatt, new string[]{"GW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.HydraulicHorsepower, new string[]{"hp(H)"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.KilobritishThermalUnitPerHour, new string[]{"kBtu/hr"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Kilowatt, new string[]{"kW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.MechanicalHorsepower, new string[]{"hp(I)"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Megawatt, new string[]{"MW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.MetricHorsepower, new string[]{"hp(M)"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Microwatt, new string[]{"µW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Milliwatt, new string[]{"mW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Nanowatt, new string[]{"nW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Petawatt, new string[]{"PW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Picowatt, new string[]{"pW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Terawatt, new string[]{"TW"}), + Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Watt, new string[]{"W"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicFoot, new string[]{"daW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicInch, new string[]{"daW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicMeter, new string[]{"daW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerLiter, new string[]{"daW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicFoot, new string[]{"dW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicInch, new string[]{"dW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicMeter, new string[]{"dW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerLiter, new string[]{"dW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicFoot, new string[]{"GW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicInch, new string[]{"GW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicMeter, new string[]{"GW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerLiter, new string[]{"GW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicFoot, new string[]{"kW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicInch, new string[]{"kW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicMeter, new string[]{"kW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerLiter, new string[]{"kW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicFoot, new string[]{"MW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicInch, new string[]{"MW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicMeter, new string[]{"MW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerLiter, new string[]{"MW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicFoot, new string[]{"µW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicInch, new string[]{"µW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicMeter, new string[]{"µW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerLiter, new string[]{"µW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicFoot, new string[]{"mW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicInch, new string[]{"mW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicMeter, new string[]{"mW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerLiter, new string[]{"mW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicFoot, new string[]{"nW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicInch, new string[]{"nW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicMeter, new string[]{"nW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerLiter, new string[]{"nW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicFoot, new string[]{"pW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicInch, new string[]{"pW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicMeter, new string[]{"pW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerLiter, new string[]{"pW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicFoot, new string[]{"TW/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicInch, new string[]{"TW/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicMeter, new string[]{"TW/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerLiter, new string[]{"TW/l"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicFoot, new string[]{"W/ft³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicInch, new string[]{"W/in³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicMeter, new string[]{"W/m³"}), + Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerLiter, new string[]{"W/l"}), + Tuple.Create("en-US", typeof(PowerRatioUnit), (int)PowerRatioUnit.DecibelMilliwatt, new string[]{"dBmW", "dBm"}), + Tuple.Create("en-US", typeof(PowerRatioUnit), (int)PowerRatioUnit.DecibelWatt, new string[]{"dBW"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Atmosphere, new string[]{"atm"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Atmosphere, new string[]{"атм"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Bar, new string[]{"bar"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Bar, new string[]{"бар"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Centibar, new string[]{"cbar"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Centibar, new string[]{"cбар"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Decapascal, new string[]{"daPa"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Decapascal, new string[]{"даПа"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Decibar, new string[]{"dbar"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Decibar, new string[]{"dбар"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.FootOfHead, new string[]{"ft of head"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Gigapascal, new string[]{"GPa"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Gigapascal, new string[]{"ГПа"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Hectopascal, new string[]{"hPa"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Hectopascal, new string[]{"гПа"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.InchOfMercury, new string[]{"inHg"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Kilobar, new string[]{"kbar"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilobar, new string[]{"kбар"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareCentimeter, new string[]{"kgf/cm²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareCentimeter, new string[]{"кгс/см²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMeter, new string[]{"kgf/m²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMeter, new string[]{"кгс/м²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMillimeter, new string[]{"kgf/mm²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMillimeter, new string[]{"кгс/мм²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareCentimeter, new string[]{"kN/cm²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareCentimeter, new string[]{"кН/см²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMeter, new string[]{"kN/m²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMeter, new string[]{"кН/м²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMillimeter, new string[]{"kN/mm²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMillimeter, new string[]{"кН/мм²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"kPa"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"кПа"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareFoot, new string[]{"kipf/ft²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareInch, new string[]{"kipf/in²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mbar"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mбар"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"MN/m²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"Мн/м²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Megapascal, new string[]{"MPa"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megapascal, new string[]{"МПа"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.MeterOfHead, new string[]{"m of head"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Micropascal, new string[]{"µPa"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Micropascal, new string[]{"мкПа"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Millibar, new string[]{"mbar"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Millibar, new string[]{"mбар"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.MillimeterOfMercury, new string[]{"mmHg"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareCentimeter, new string[]{"N/cm²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareCentimeter, new string[]{"Н/см²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMeter, new string[]{"N/m²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMeter, new string[]{"Н/м²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMillimeter, new string[]{"N/mm²"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMillimeter, new string[]{"Н/мм²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Pascal, new string[]{"Pa"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Pascal, new string[]{"Па"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.PoundForcePerSquareFoot, new string[]{"lb/ft²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.PoundForcePerSquareInch, new string[]{"psi", "lb/in²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TechnicalAtmosphere, new string[]{"at"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.TechnicalAtmosphere, new string[]{"ат"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareCentimeter, new string[]{"tf/cm²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareMeter, new string[]{"tf/m²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareMillimeter, new string[]{"tf/mm²"}), + Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Torr, new string[]{"torr"}), + Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Torr, new string[]{"торр"}), + Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.AtmospherePerSecond, new string[]{"atm/s"}), + Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.AtmospherePerSecond, new string[]{"атм/с"}), + Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.KilopascalPerSecond, new string[]{"kPa/s"}), + Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.KilopascalPerSecond, new string[]{"кПа/с"}), + Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.MegapascalPerSecond, new string[]{"MPa/s"}), + Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.MegapascalPerSecond, new string[]{"МПа/с"}), + Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.PascalPerSecond, new string[]{"Pa/s"}), + Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.PascalPerSecond, new string[]{"Па/с"}), + Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.DecimalFraction, new string[]{""}), + Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerBillion, new string[]{"ppb"}), + Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerMillion, new string[]{"ppm"}), + Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerThousand, new string[]{"‰"}), + Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerTrillion, new string[]{"ppt"}), + Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.Percent, new string[]{"%"}), + Tuple.Create("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.KilovoltampereReactiveHour, new string[]{"kvarh"}), + Tuple.Create("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.MegavoltampereReactiveHour, new string[]{"Mvarh"}), + Tuple.Create("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.VoltampereReactiveHour, new string[]{"varh"}), + Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.GigavoltampereReactive, new string[]{"Gvar"}), + Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.KilovoltampereReactive, new string[]{"kvar"}), + Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.MegavoltampereReactive, new string[]{"Mvar"}), + Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.VoltampereReactive, new string[]{"var"}), + Tuple.Create("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.DegreePerSecondSquared, new string[]{"°/s²", "deg/s²"}), + Tuple.Create("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.RadianPerSecondSquared, new string[]{"rad/s²"}), + Tuple.Create("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.RevolutionPerMinutePerSecond, new string[]{"rpm/s"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.CentiradianPerSecond, new string[]{"crad/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.CentiradianPerSecond, new string[]{"cрад/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DeciradianPerSecond, new string[]{"drad/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DeciradianPerSecond, new string[]{"dрад/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerMinute, new string[]{"°/min", "deg/min"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/s", "deg/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µrad/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µрад/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mrad/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mрад/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nrad/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nрад/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RadianPerSecond, new string[]{"rad/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RadianPerSecond, new string[]{"рад/с"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerMinute, new string[]{"rpm", "r/min"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerMinute, new string[]{"об/мин"}), + Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"r/s"}), + Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"об/с"}), + Tuple.Create("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.KilonewtonMeterPerRadian, new string[]{"kN·m/rad"}), + Tuple.Create("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.MeganewtonMeterPerRadian, new string[]{"MN·m/rad"}), + Tuple.Create("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.NewtonMeterPerRadian, new string[]{"N·m/rad", "Nm/rad"}), + Tuple.Create("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, new string[]{"kN·m/rad/m"}), + Tuple.Create("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, new string[]{"MN·m/rad/m"}), + Tuple.Create("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, new string[]{"N·m/rad/m", "Nm/rad/m"}), + Tuple.Create("en-US", typeof(SolidAngleUnit), (int)SolidAngleUnit.Steradian, new string[]{"sr"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.CaloriePerGram, new string[]{"cal/g"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.JoulePerKilogram, new string[]{"J/kg"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilocaloriePerGram, new string[]{"kcal/g"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilojoulePerKilogram, new string[]{"kJ/kg"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilowattHourPerKilogram, new string[]{"kWh/kg"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.MegajoulePerKilogram, new string[]{"MJ/kg"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.MegawattHourPerKilogram, new string[]{"MWh/kg"}), + Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.WattHourPerKilogram, new string[]{"Wh/kg"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.CaloriePerGramKelvin, new string[]{"cal/g.K"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, new string[]{"J/kg.C"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.JoulePerKilogramKelvin, new string[]{"J/kg.K"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilocaloriePerGramKelvin, new string[]{"kcal/g.K"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, new string[]{"kJ/kg.C"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilojoulePerKilogramKelvin, new string[]{"kJ/kg.K"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, new string[]{"MJ/kg.C"}), + Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.MegajoulePerKilogramKelvin, new string[]{"MJ/kg.K"}), + Tuple.Create("en-US", typeof(SpecificVolumeUnit), (int)SpecificVolumeUnit.CubicFootPerPound, new string[]{"ft³/lb"}), + Tuple.Create("en-US", typeof(SpecificVolumeUnit), (int)SpecificVolumeUnit.CubicMeterPerKilogram, new string[]{"m³/kg"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicCentimeter, new string[]{"kgf/cm³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicMeter, new string[]{"kgf/m³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicMillimeter, new string[]{"kgf/mm³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicCentimeter, new string[]{"kN/cm³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicMeter, new string[]{"kN/m³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicMillimeter, new string[]{"kN/mm³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilopoundForcePerCubicFoot, new string[]{"kipf/ft³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilopoundForcePerCubicInch, new string[]{"kipf/in³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.MeganewtonPerCubicMeter, new string[]{"MN/m³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicCentimeter, new string[]{"N/cm³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicMeter, new string[]{"N/m³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicMillimeter, new string[]{"N/mm³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.PoundForcePerCubicFoot, new string[]{"lbf/ft³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.PoundForcePerCubicInch, new string[]{"lbf/in³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicCentimeter, new string[]{"tf/cm³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicMeter, new string[]{"tf/m³"}), + Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicMillimeter, new string[]{"tf/mm³"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerHour, new string[]{"cm/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerMinute, new string[]{"cm/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerSecond, new string[]{"cm/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.DecimeterPerMinute, new string[]{"dm/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.DecimeterPerSecond, new string[]{"dm/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerHour, new string[]{"ft/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerMinute, new string[]{"ft/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerSecond, new string[]{"ft/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerHour, new string[]{"in/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerMinute, new string[]{"in/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerSecond, new string[]{"in/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerHour, new string[]{"km/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerMinute, new string[]{"km/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerSecond, new string[]{"km/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.Knot, new string[]{"kn", "kt", "knot", "knots"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerHour, new string[]{"m/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerMinute, new string[]{"m/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerSecond, new string[]{"m/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MicrometerPerMinute, new string[]{"µm/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MicrometerPerSecond, new string[]{"µm/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MilePerHour, new string[]{"mph"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerHour, new string[]{"mm/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerMinute, new string[]{"mm/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerSecond, new string[]{"mm/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.NanometerPerMinute, new string[]{"nm/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.NanometerPerSecond, new string[]{"nm/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerHour, new string[]{"ftUS/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerMinute, new string[]{"ftUS/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerSecond, new string[]{"ftUS/s"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerHour, new string[]{"yd/h"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerMinute, new string[]{"yd/min"}), + Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerSecond, new string[]{"yd/s"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeCelsius, new string[]{"°C"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeDelisle, new string[]{"°De"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeFahrenheit, new string[]{"°F"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeNewton, new string[]{"°N"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeRankine, new string[]{"°R"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeReaumur, new string[]{"°Ré"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeRoemer, new string[]{"°Rø"}), + Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.Kelvin, new string[]{"K"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, new string[]{"c°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, new string[]{"da°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, new string[]{"d°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DegreeCelsiusPerMinute, new string[]{"°C/min"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DegreeCelsiusPerSecond, new string[]{"°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, new string[]{"h°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, new string[]{"k°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, new string[]{"µ°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, new string[]{"m°C/s"}), + Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, new string[]{"n°C/s"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeCelsius, new string[]{"∆°C"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeDelisle, new string[]{"∆°De"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeFahrenheit, new string[]{"∆°F"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeNewton, new string[]{"∆°N"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeRankine, new string[]{"∆°R"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeReaumur, new string[]{"∆°Ré"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeRoemer, new string[]{"∆°Rø"}), + Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.Kelvin, new string[]{"∆K"}), + Tuple.Create("en-US", typeof(ThermalConductivityUnit), (int)ThermalConductivityUnit.BtuPerHourFootFahrenheit, new string[]{"BTU/h·ft·°F"}), + Tuple.Create("en-US", typeof(ThermalConductivityUnit), (int)ThermalConductivityUnit.WattPerMeterKelvin, new string[]{"W/m·K"}), + Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, new string[]{"Hrft²°F/Btu"}), + Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, new string[]{"cm²Hr°C/kcal"}), + Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, new string[]{"cm²K/W"}), + Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, new string[]{"m²°C/W"}), + Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, new string[]{"m²K/kW"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceCentimeter, new string[]{"kgf·cm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceMeter, new string[]{"kgf·m"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceMillimeter, new string[]{"kgf·mm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonCentimeter, new string[]{"kN·cm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMeter, new string[]{"kN·m"}), + Tuple.Create("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMeter, new string[]{"кН·м"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMillimeter, new string[]{"kN·mm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilopoundForceFoot, new string[]{"kipf·ft"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilopoundForceInch, new string[]{"kipf·in"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonCentimeter, new string[]{"MN·cm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMeter, new string[]{"MN·m"}), + Tuple.Create("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMeter, new string[]{""}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMillimeter, new string[]{"MN·mm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MegapoundForceFoot, new string[]{"Mlbf·ft"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MegapoundForceInch, new string[]{"Mlbf·in"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonCentimeter, new string[]{"N·cm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonMeter, new string[]{"N·m"}), + Tuple.Create("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.NewtonMeter, new string[]{"Н·м"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonMillimeter, new string[]{"N·mm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.PoundForceFoot, new string[]{"lbf·ft"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.PoundForceInch, new string[]{"lbf·in"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceCentimeter, new string[]{"tf·cm"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceMeter, new string[]{"tf·m"}), + Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceMillimeter, new string[]{"tf·mm"}), + Tuple.Create("en-US", typeof(VitaminAUnit), (int)VitaminAUnit.InternationalUnit, new string[]{"IU"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), + Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Centiliter, new string[]{"cl"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Centiliter, new string[]{"сл"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicCentimeter, new string[]{"cm³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicCentimeter, new string[]{"см³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicDecimeter, new string[]{"dm³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicDecimeter, new string[]{"дм³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicFoot, new string[]{"ft³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicFoot, new string[]{"фут³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicInch, new string[]{"in³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicInch, new string[]{"дюйм³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicKilometer, new string[]{"km³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicKilometer, new string[]{"км³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMeter, new string[]{"m³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMeter, new string[]{"м³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMicrometer, new string[]{"µm³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMicrometer, new string[]{"мкм³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMile, new string[]{"mi³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMile, new string[]{"миля³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"mm³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"мм³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"yd³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"ярд³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"dl"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"дл"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hft³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hфут³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hm³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hм³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"hl"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"гл"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialBeerBarrel, new string[]{"bl (imp.)"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"gal (imp.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"Английский галлон"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialOunce, new string[]{"oz (imp.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialOunce, new string[]{"Английская унция"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilocubicFoot, new string[]{"kft³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilocubicFoot, new string[]{"kфут³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilocubicMeter, new string[]{"km³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilocubicMeter, new string[]{"kм³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kgal (imp.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kАнглийский галлон"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kgal (U.S.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kАмериканский галлон"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Liter, new string[]{"l"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Liter, new string[]{"л"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegacubicFoot, new string[]{"Mft³"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegacubicFoot, new string[]{"Mфут³"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegaimperialGallon, new string[]{"Mgal (imp.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegaimperialGallon, new string[]{"MАнглийский галлон"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegausGallon, new string[]{"Mgal (U.S.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegausGallon, new string[]{"MАмериканский галлон"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MetricCup, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{"tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{""}), + Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Microliter, new string[]{"µl"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Microliter, new string[]{"мкл"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Milliliter, new string[]{"ml"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Milliliter, new string[]{"мл"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.OilBarrel, new string[]{"bbl"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), + Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsBeerBarrel, new string[]{"bl (U.S.)"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsCustomaryCup, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsGallon, new string[]{"gal (U.S.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsGallon, new string[]{"Американский галлон"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsLegalCup, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsOunce, new string[]{"oz (U.S.)"}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsOunce, new string[]{"Американская унция"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsPint, new string[]{"pt (U.S.)"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsQuart, new string[]{"qt (U.S.)"}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), + Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), + Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), + Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerMinute, new string[]{"cLPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"dm³/min"}), + Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"дм³/мин"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerHour, new string[]{"ft³/h", "cf/hr"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerMinute, new string[]{"ft³/min"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerSecond, new string[]{"ft³/s"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerHour, new string[]{"m³/h"}), + Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerHour, new string[]{"м³/ч"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerMinute, new string[]{"m³/min"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerSecond, new string[]{"m³/s"}), + Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerSecond, new string[]{"м³/с"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerHour, new string[]{"yd³/h"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerMinute, new string[]{"yd³/min"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerSecond, new string[]{"yd³/s"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerMinute, new string[]{"dLPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerMinute, new string[]{"kLPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerHour, new string[]{"LPH"}), + Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerHour, new string[]{"л/ч"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerMinute, new string[]{"LPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerSecond, new string[]{"LPS"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerMinute, new string[]{"µLPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerMinute, new string[]{"mLPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MillionUsGallonsPerDay, new string[]{"MGD"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerMinute, new string[]{"nLPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerDay, new string[]{"bbl/d", "BOPD"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerHour, new string[]{"bbl/hr", "bph"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerMinute, new string[]{"bbl/min", "bpm"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerHour, new string[]{"gal (U.S.)/h"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerMinute, new string[]{"gal (U.S.)/min", "GPM"}), + Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerSecond, new string[]{"gal (U.S.)/s"}), + }; } } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 087fd38440..30f33a0501 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -454,7 +454,7 @@ if ($obsoleteAttribute) /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -477,7 +477,7 @@ if ($obsoleteAttribute) { if (str == null) throw new ArgumentNullException(nameof(str)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit)); @@ -487,7 +487,7 @@ if ($obsoleteAttribute) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -500,7 +500,7 @@ if ($obsoleteAttribute) if(string.IsNullOrWhiteSpace(str)) return false; - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; return QuantityParser.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit), out result); @@ -510,7 +510,7 @@ if ($obsoleteAttribute) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -520,8 +520,7 @@ if ($obsoleteAttribute) { if (str == null) throw new ArgumentNullException(nameof(str)); - var unitSystem = UnitSystem.GetCached(provider); - var unit = unitSystem.Parse<$unitEnumName>(str.Trim()); + var unit = UnitParser.Parse<$unitEnumName>(str.Trim(), provider); if (unit == $unitEnumName.Undefined) { @@ -538,7 +537,7 @@ if ($obsoleteAttribute) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -551,8 +550,7 @@ if ($obsoleteAttribute) if(string.IsNullOrWhiteSpace(str)) return false; - var unitSystem = UnitSystem.GetCached(provider); - if(!unitSystem.TryParse<$unitEnumName>(str.Trim(), out unit)) + if(!UnitParser.TryParse<$unitEnumName>(str.Trim(), provider, out unit)) return false; if(unit == $unitEnumName.Undefined) diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 328952bbd5..fde66d6fd3 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -71,14 +71,12 @@ namespace UnitsNet /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to . /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation($unitEnumName unit, [CanBeNull] IFormatProvider provider) { - provider = provider ?? UnitSystem.DefaultCulture; - - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } "@; if ($quantity.Logarithmic -eq $true) { @@ -153,7 +151,7 @@ namespace UnitsNet /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -181,7 +179,7 @@ namespace UnitsNet /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -196,7 +194,7 @@ namespace UnitsNet /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -211,7 +209,7 @@ namespace UnitsNet /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -230,7 +228,7 @@ namespace UnitsNet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// String representation. public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider) { @@ -241,7 +239,7 @@ namespace UnitsNet /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -255,7 +253,7 @@ namespace UnitsNet /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to . /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. @@ -266,7 +264,7 @@ namespace UnitsNet if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - provider = provider ?? UnitSystem.DefaultCulture; + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index b04d24fe73..6116bce2c3 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -93,9 +93,9 @@ namespace UnitsNet public static string GetAbbreviation($unitEnumName unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit); + return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); } #region Parsing @@ -128,7 +128,7 @@ namespace UnitsNet if (str == null) throw new ArgumentNullException(nameof(str)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseInternal(str, provider); } @@ -145,7 +145,7 @@ namespace UnitsNet public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out $quantityName result) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseInternal(str, provider, out result); } @@ -163,7 +163,7 @@ namespace UnitsNet public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return ParseUnitInternal(str, provider); } @@ -181,7 +181,7 @@ namespace UnitsNet public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out $unitEnumName unit) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); return TryParseUnitInternal(str, provider, out unit); } @@ -231,7 +231,7 @@ namespace UnitsNet if (args == null) throw new ArgumentNullException(nameof(args)); // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); + IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); diff --git a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 index 4b7e374f5a..af6d3cbbca 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 @@ -38,6 +38,8 @@ function GenerateUnitSystemDefaultSourceCode($quantities) // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; +using System.Globalization; using System.Collections.Generic; using System.Collections.ObjectModel; using UnitsNet.I18n; @@ -48,47 +50,33 @@ using UnitsNet.Units; namespace UnitsNet { - public sealed partial class UnitSystem + public static partial class UnitAbbreviationsCache { - private static readonly ReadOnlyCollection DefaultLocalizations - = new ReadOnlyCollection(new List + private static readonly Tuple[] DefaultLocalizations + = new Tuple[] { "@; foreach ($quantity in $quantities) { $quantityName = $quantity.Name; $unitEnumName = "$quantityName" + "Unit"; -@" - new UnitLocalization(typeof ($unitEnumName), - new[] - { -"@; + foreach ($unit in $quantity.Units) { $enumValue = $unit.SingularName; -@" - new CulturesForEnumValue((int) $unitEnumName.$enumValue, - new[] - { -"@; + foreach ($localization in $unit.Localization) { $cultureName = $localization.Culture; $abbreviationParams = $localization.Abbreviations -join '", "' @" - new AbbreviationsForCulture("$cultureName", "$abbreviationParams"), + Tuple.Create(`"$cultureName`", typeof($unitEnumName), (int)$unitEnumName.$enumValue, new string[]{`"$abbreviationParams`"}), "@; } -@" - }), -"@; } -@" - }), -"@; } @" - }); + }; } } "@; diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index f4e25b8073..cf0d5aa771 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -20,6 +20,7 @@ // THE SOFTWARE. using System; +using System.Globalization; using System.Linq; using System.Reflection; using UnitsNet.InternalHelpers; @@ -227,9 +228,10 @@ public static double ConvertByAbbreviation(FromValue fromValue, string quantityN if(!TryGetUnitType(quantityName, out var unitType)) throw new UnitNotFoundException($"The unit type for the given quantity was not found: {quantityName}"); - var unitSystem = UnitSystem.GetCached(culture); - var fromUnitValue = unitSystem.Parse(fromUnitAbbrev, unitType); // ex: ("m", LengthUnit) => LengthUnit.Meter - var toUnitValue = unitSystem.Parse(toUnitAbbrev, unitType); // ex:("cm", LengthUnit) => LengthUnit.Centimeter + var cultureInfo = string.IsNullOrWhiteSpace(culture)? GlobalConfiguration.DefaultCulture : new CultureInfo(culture); + + var fromUnitValue = UnitParser.Parse(fromUnitAbbrev, unitType, cultureInfo); // ex: ("m", LengthUnit) => LengthUnit.Meter + var toUnitValue = UnitParser.Parse(toUnitAbbrev, unitType, cultureInfo); // ex:("cm", LengthUnit) => LengthUnit.Centimeter var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) var fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) @@ -311,12 +313,12 @@ public static bool TryConvertByAbbreviation(FromValue fromValue, string quantity if(!TryGetUnitType(quantityName, out var unitType)) return false; - var unitSystem = UnitSystem.GetCached(culture); + var cultureInfo = string.IsNullOrWhiteSpace(culture)? GlobalConfiguration.DefaultCulture : new CultureInfo(culture); - if(!unitSystem.TryParse(fromUnitAbbrev, unitType, out var fromUnitValue)) // ex: ("m", LengthUnit) => LengthUnit.Meter + if(!UnitParser.TryParse(fromUnitAbbrev, unitType, cultureInfo, out var fromUnitValue)) // ex: ("m", LengthUnit) => LengthUnit.Meter return false; - if(!unitSystem.TryParse(toUnitAbbrev, unitType, out var toUnitValue)) // ex:("cm", LengthUnit) => LengthUnit.Centimeter + if(!UnitParser.TryParse(toUnitAbbrev, unitType, cultureInfo, out var toUnitValue)) // ex:("cm", LengthUnit) => LengthUnit.Centimeter return false; var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) diff --git a/UnitsNet/UnitFormatter.cs b/UnitsNet/UnitFormatter.cs index a8387d584d..c0da76ab51 100644 --- a/UnitsNet/UnitFormatter.cs +++ b/UnitsNet/UnitFormatter.cs @@ -92,7 +92,7 @@ private static bool NearlyEqual(double a, double b) public static object[] GetFormatArgs(TUnitType unit, double value, [CanBeNull] IFormatProvider culture, IEnumerable args) where TUnitType : Enum { - string abbreviation = UnitSystem.GetCached(culture).GetDefaultAbbreviation(typeof(TUnitType), Convert.ToInt32(unit)); + string abbreviation = UnitAbbreviationsCache.GetDefaultAbbreviation(typeof(TUnitType), Convert.ToInt32(unit), culture); return new object[] {value, abbreviation}.Concat(args).ToArray(); } } From 79ce236c424e558ebf11c9d3bdfb099c2dd79987 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 11 Oct 2018 13:07:11 -0400 Subject: [PATCH 051/131] GetDefaultAbbreviation should recursively call itself rather than the int version --- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 5 ++--- UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index c5212817d8..dc82f81de7 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -166,15 +166,14 @@ static void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider static string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum { var unitType = typeof(TUnitType); - var unitValue = Convert.ToInt32(unit); var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); if(lookup == null) return $"(no abbreviation for {unitType.Name}.{unit})"; - var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); + var abbreviations = lookup.GetAbbreviationsForUnit(unit); if(abbreviations.Count == 0) - return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture) : $"(no abbreviation for {unitType.Name}.{unit})"; + return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unit, FallbackCulture) : $"(no abbreviation for {unitType.Name}.{unit})"; return abbreviations.First(); } diff --git a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs index 6cc5277852..4c8ba40540 100644 --- a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs +++ b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs @@ -19,6 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; using System.Collections.Generic; using System.Linq; @@ -47,6 +48,11 @@ internal string[] GetAllAbbreviations() } ).ToArray(); } + internal List GetAbbreviationsForUnit(UnitType unit) where UnitType : Enum + { + return GetAbbreviationsForUnit(Convert.ToInt32(unit)); + } + internal List GetAbbreviationsForUnit(int unit) { if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviations)) From f9c67905ab575a3d88a2041d0c531ef5ed94d34a Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 11 Oct 2018 16:30:16 -0400 Subject: [PATCH 052/131] Making parser and unit abbreviation caches non-static and making a static "Default" property for singleton access. --- .../Quantities/Acceleration.Common.g.cs | 8 ++--- .../Quantities/AmountOfSubstance.Common.g.cs | 8 ++--- .../Quantities/AmplitudeRatio.Common.g.cs | 8 ++--- .../Quantities/Angle.Common.g.cs | 8 ++--- .../Quantities/ApparentEnergy.Common.g.cs | 8 ++--- .../Quantities/ApparentPower.Common.g.cs | 8 ++--- .../GeneratedCode/Quantities/Area.Common.g.cs | 8 ++--- .../Quantities/AreaDensity.Common.g.cs | 8 ++--- .../AreaMomentOfInertia.Common.g.cs | 8 ++--- .../Quantities/BitRate.Common.g.cs | 8 ++--- .../BrakeSpecificFuelConsumption.Common.g.cs | 8 ++--- .../Quantities/Capacitance.Common.g.cs | 8 ++--- .../Quantities/Density.Common.g.cs | 8 ++--- .../Quantities/Duration.Common.g.cs | 8 ++--- .../Quantities/DynamicViscosity.Common.g.cs | 8 ++--- .../Quantities/ElectricAdmittance.Common.g.cs | 8 ++--- .../Quantities/ElectricCharge.Common.g.cs | 8 ++--- .../ElectricChargeDensity.Common.g.cs | 8 ++--- .../ElectricConductance.Common.g.cs | 8 ++--- .../ElectricConductivity.Common.g.cs | 8 ++--- .../Quantities/ElectricCurrent.Common.g.cs | 8 ++--- .../ElectricCurrentDensity.Common.g.cs | 8 ++--- .../ElectricCurrentGradient.Common.g.cs | 8 ++--- .../Quantities/ElectricField.Common.g.cs | 8 ++--- .../Quantities/ElectricInductance.Common.g.cs | 8 ++--- .../Quantities/ElectricPotential.Common.g.cs | 8 ++--- .../ElectricPotentialAc.Common.g.cs | 8 ++--- .../ElectricPotentialDc.Common.g.cs | 8 ++--- .../Quantities/ElectricResistance.Common.g.cs | 8 ++--- .../ElectricResistivity.Common.g.cs | 8 ++--- .../Quantities/Energy.Common.g.cs | 8 ++--- .../Quantities/Entropy.Common.g.cs | 8 ++--- .../Quantities/Force.Common.g.cs | 8 ++--- .../Quantities/ForceChangeRate.Common.g.cs | 8 ++--- .../Quantities/ForcePerLength.Common.g.cs | 8 ++--- .../Quantities/Frequency.Common.g.cs | 8 ++--- .../Quantities/HeatFlux.Common.g.cs | 8 ++--- .../HeatTransferCoefficient.Common.g.cs | 8 ++--- .../Quantities/Illuminance.Common.g.cs | 8 ++--- .../Quantities/Information.Common.g.cs | 8 ++--- .../Quantities/Irradiance.Common.g.cs | 8 ++--- .../Quantities/Irradiation.Common.g.cs | 8 ++--- .../Quantities/KinematicViscosity.Common.g.cs | 8 ++--- .../Quantities/LapseRate.Common.g.cs | 8 ++--- .../Quantities/Length.Common.g.cs | 8 ++--- .../Quantities/Level.Common.g.cs | 8 ++--- .../Quantities/LinearDensity.Common.g.cs | 8 ++--- .../Quantities/LuminousFlux.Common.g.cs | 8 ++--- .../Quantities/LuminousIntensity.Common.g.cs | 8 ++--- .../Quantities/MagneticField.Common.g.cs | 8 ++--- .../Quantities/MagneticFlux.Common.g.cs | 8 ++--- .../Quantities/Magnetization.Common.g.cs | 8 ++--- .../GeneratedCode/Quantities/Mass.Common.g.cs | 8 ++--- .../Quantities/MassFlow.Common.g.cs | 8 ++--- .../Quantities/MassFlux.Common.g.cs | 8 ++--- .../MassMomentOfInertia.Common.g.cs | 8 ++--- .../Quantities/MolarEnergy.Common.g.cs | 8 ++--- .../Quantities/MolarEntropy.Common.g.cs | 8 ++--- .../Quantities/MolarMass.Common.g.cs | 8 ++--- .../Quantities/Molarity.Common.g.cs | 8 ++--- .../Quantities/Permeability.Common.g.cs | 8 ++--- .../Quantities/Permittivity.Common.g.cs | 8 ++--- .../Quantities/Power.Common.g.cs | 8 ++--- .../Quantities/PowerDensity.Common.g.cs | 8 ++--- .../Quantities/PowerRatio.Common.g.cs | 8 ++--- .../Quantities/Pressure.Common.g.cs | 8 ++--- .../Quantities/PressureChangeRate.Common.g.cs | 8 ++--- .../Quantities/Ratio.Common.g.cs | 8 ++--- .../Quantities/ReactiveEnergy.Common.g.cs | 8 ++--- .../Quantities/ReactivePower.Common.g.cs | 8 ++--- .../RotationalAcceleration.Common.g.cs | 8 ++--- .../Quantities/RotationalSpeed.Common.g.cs | 8 ++--- .../RotationalStiffness.Common.g.cs | 8 ++--- .../RotationalStiffnessPerLength.Common.g.cs | 8 ++--- .../Quantities/SolidAngle.Common.g.cs | 8 ++--- .../Quantities/SpecificEnergy.Common.g.cs | 8 ++--- .../Quantities/SpecificEntropy.Common.g.cs | 8 ++--- .../Quantities/SpecificVolume.Common.g.cs | 8 ++--- .../Quantities/SpecificWeight.Common.g.cs | 8 ++--- .../Quantities/Speed.Common.g.cs | 8 ++--- .../Quantities/Temperature.Common.g.cs | 8 ++--- .../TemperatureChangeRate.Common.g.cs | 8 ++--- .../Quantities/TemperatureDelta.Common.g.cs | 8 ++--- .../ThermalConductivity.Common.g.cs | 8 ++--- .../Quantities/ThermalResistance.Common.g.cs | 8 ++--- .../Quantities/Torque.Common.g.cs | 8 ++--- .../Quantities/VitaminA.Common.g.cs | 8 ++--- .../Quantities/Volume.Common.g.cs | 8 ++--- .../Quantities/VolumeFlow.Common.g.cs | 8 ++--- UnitsNet.Tests/CustomCode/ParseTests.cs | 13 ++++--- UnitsNet.Tests/UnitSystemTests.cs | 27 ++++++++------ .../Acceleration.WindowsRuntimeComponent.g.cs | 2 +- ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 2 +- ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 2 +- .../Angle.WindowsRuntimeComponent.g.cs | 2 +- ...pparentEnergy.WindowsRuntimeComponent.g.cs | 2 +- ...ApparentPower.WindowsRuntimeComponent.g.cs | 2 +- .../Area.WindowsRuntimeComponent.g.cs | 2 +- .../AreaDensity.WindowsRuntimeComponent.g.cs | 2 +- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 2 +- .../BitRate.WindowsRuntimeComponent.g.cs | 2 +- ...elConsumption.WindowsRuntimeComponent.g.cs | 2 +- .../Capacitance.WindowsRuntimeComponent.g.cs | 2 +- .../Density.WindowsRuntimeComponent.g.cs | 2 +- .../Duration.WindowsRuntimeComponent.g.cs | 2 +- ...amicViscosity.WindowsRuntimeComponent.g.cs | 2 +- ...ricAdmittance.WindowsRuntimeComponent.g.cs | 2 +- ...lectricCharge.WindowsRuntimeComponent.g.cs | 2 +- ...ChargeDensity.WindowsRuntimeComponent.g.cs | 2 +- ...icConductance.WindowsRuntimeComponent.g.cs | 2 +- ...cConductivity.WindowsRuntimeComponent.g.cs | 2 +- ...ectricCurrent.WindowsRuntimeComponent.g.cs | 2 +- ...urrentDensity.WindowsRuntimeComponent.g.cs | 2 +- ...rrentGradient.WindowsRuntimeComponent.g.cs | 2 +- ...ElectricField.WindowsRuntimeComponent.g.cs | 2 +- ...ricInductance.WindowsRuntimeComponent.g.cs | 2 +- ...tricPotential.WindowsRuntimeComponent.g.cs | 2 +- ...icPotentialAc.WindowsRuntimeComponent.g.cs | 2 +- ...icPotentialDc.WindowsRuntimeComponent.g.cs | 2 +- ...ricResistance.WindowsRuntimeComponent.g.cs | 2 +- ...icResistivity.WindowsRuntimeComponent.g.cs | 2 +- .../Energy.WindowsRuntimeComponent.g.cs | 2 +- .../Entropy.WindowsRuntimeComponent.g.cs | 2 +- .../Force.WindowsRuntimeComponent.g.cs | 2 +- ...rceChangeRate.WindowsRuntimeComponent.g.cs | 2 +- ...orcePerLength.WindowsRuntimeComponent.g.cs | 2 +- .../Frequency.WindowsRuntimeComponent.g.cs | 2 +- .../HeatFlux.WindowsRuntimeComponent.g.cs | 2 +- ...erCoefficient.WindowsRuntimeComponent.g.cs | 2 +- .../Illuminance.WindowsRuntimeComponent.g.cs | 2 +- .../Information.WindowsRuntimeComponent.g.cs | 2 +- .../Irradiance.WindowsRuntimeComponent.g.cs | 2 +- .../Irradiation.WindowsRuntimeComponent.g.cs | 2 +- ...aticViscosity.WindowsRuntimeComponent.g.cs | 2 +- .../LapseRate.WindowsRuntimeComponent.g.cs | 2 +- .../Length.WindowsRuntimeComponent.g.cs | 2 +- .../Level.WindowsRuntimeComponent.g.cs | 2 +- ...LinearDensity.WindowsRuntimeComponent.g.cs | 2 +- .../LuminousFlux.WindowsRuntimeComponent.g.cs | 2 +- ...nousIntensity.WindowsRuntimeComponent.g.cs | 2 +- ...MagneticField.WindowsRuntimeComponent.g.cs | 2 +- .../MagneticFlux.WindowsRuntimeComponent.g.cs | 2 +- ...Magnetization.WindowsRuntimeComponent.g.cs | 2 +- .../Mass.WindowsRuntimeComponent.g.cs | 2 +- .../MassFlow.WindowsRuntimeComponent.g.cs | 2 +- .../MassFlux.WindowsRuntimeComponent.g.cs | 2 +- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 2 +- .../MolarEnergy.WindowsRuntimeComponent.g.cs | 2 +- .../MolarEntropy.WindowsRuntimeComponent.g.cs | 2 +- .../MolarMass.WindowsRuntimeComponent.g.cs | 2 +- .../Molarity.WindowsRuntimeComponent.g.cs | 2 +- .../Permeability.WindowsRuntimeComponent.g.cs | 2 +- .../Permittivity.WindowsRuntimeComponent.g.cs | 2 +- .../Power.WindowsRuntimeComponent.g.cs | 2 +- .../PowerDensity.WindowsRuntimeComponent.g.cs | 2 +- .../PowerRatio.WindowsRuntimeComponent.g.cs | 2 +- .../Pressure.WindowsRuntimeComponent.g.cs | 2 +- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 2 +- .../Ratio.WindowsRuntimeComponent.g.cs | 2 +- ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 2 +- ...ReactivePower.WindowsRuntimeComponent.g.cs | 2 +- ...lAcceleration.WindowsRuntimeComponent.g.cs | 2 +- ...tationalSpeed.WindowsRuntimeComponent.g.cs | 2 +- ...onalStiffness.WindowsRuntimeComponent.g.cs | 2 +- ...nessPerLength.WindowsRuntimeComponent.g.cs | 2 +- .../SolidAngle.WindowsRuntimeComponent.g.cs | 2 +- ...pecificEnergy.WindowsRuntimeComponent.g.cs | 2 +- ...ecificEntropy.WindowsRuntimeComponent.g.cs | 2 +- ...pecificVolume.WindowsRuntimeComponent.g.cs | 2 +- ...pecificWeight.WindowsRuntimeComponent.g.cs | 2 +- .../Speed.WindowsRuntimeComponent.g.cs | 2 +- .../Temperature.WindowsRuntimeComponent.g.cs | 2 +- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 2 +- ...peratureDelta.WindowsRuntimeComponent.g.cs | 2 +- ...lConductivity.WindowsRuntimeComponent.g.cs | 2 +- ...malResistance.WindowsRuntimeComponent.g.cs | 2 +- .../Torque.WindowsRuntimeComponent.g.cs | 2 +- .../VitaminA.WindowsRuntimeComponent.g.cs | 2 +- .../Volume.WindowsRuntimeComponent.g.cs | 2 +- .../VolumeFlow.WindowsRuntimeComponent.g.cs | 2 +- .../CustomCode/Quantities/Length.extra.cs | 4 +-- UnitsNet/CustomCode/Quantities/Mass.extra.cs | 4 +-- UnitsNet/CustomCode/QuantityParser.cs | 24 ++++++++++--- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 35 +++++++++++-------- UnitsNet/CustomCode/UnitParser.cs | 32 ++++++++++++----- .../Quantities/Acceleration.NetFramework.g.cs | 2 +- .../AmountOfSubstance.NetFramework.g.cs | 2 +- .../AmplitudeRatio.NetFramework.g.cs | 2 +- .../Quantities/Angle.NetFramework.g.cs | 2 +- .../ApparentEnergy.NetFramework.g.cs | 2 +- .../ApparentPower.NetFramework.g.cs | 2 +- .../Quantities/Area.NetFramework.g.cs | 2 +- .../Quantities/AreaDensity.NetFramework.g.cs | 2 +- .../AreaMomentOfInertia.NetFramework.g.cs | 2 +- .../Quantities/BitRate.NetFramework.g.cs | 2 +- ...eSpecificFuelConsumption.NetFramework.g.cs | 2 +- .../Quantities/Capacitance.NetFramework.g.cs | 2 +- .../Quantities/Density.NetFramework.g.cs | 2 +- .../Quantities/Duration.NetFramework.g.cs | 2 +- .../DynamicViscosity.NetFramework.g.cs | 2 +- .../ElectricAdmittance.NetFramework.g.cs | 2 +- .../ElectricCharge.NetFramework.g.cs | 2 +- .../ElectricChargeDensity.NetFramework.g.cs | 2 +- .../ElectricConductance.NetFramework.g.cs | 2 +- .../ElectricConductivity.NetFramework.g.cs | 2 +- .../ElectricCurrent.NetFramework.g.cs | 2 +- .../ElectricCurrentDensity.NetFramework.g.cs | 2 +- .../ElectricCurrentGradient.NetFramework.g.cs | 2 +- .../ElectricField.NetFramework.g.cs | 2 +- .../ElectricInductance.NetFramework.g.cs | 2 +- .../ElectricPotential.NetFramework.g.cs | 2 +- .../ElectricPotentialAc.NetFramework.g.cs | 2 +- .../ElectricPotentialDc.NetFramework.g.cs | 2 +- .../ElectricResistance.NetFramework.g.cs | 2 +- .../ElectricResistivity.NetFramework.g.cs | 2 +- .../Quantities/Energy.NetFramework.g.cs | 2 +- .../Quantities/Entropy.NetFramework.g.cs | 2 +- .../Quantities/Force.NetFramework.g.cs | 2 +- .../ForceChangeRate.NetFramework.g.cs | 2 +- .../ForcePerLength.NetFramework.g.cs | 2 +- .../Quantities/Frequency.NetFramework.g.cs | 2 +- .../Quantities/HeatFlux.NetFramework.g.cs | 2 +- .../HeatTransferCoefficient.NetFramework.g.cs | 2 +- .../Quantities/Illuminance.NetFramework.g.cs | 2 +- .../Quantities/Information.NetFramework.g.cs | 2 +- .../Quantities/Irradiance.NetFramework.g.cs | 2 +- .../Quantities/Irradiation.NetFramework.g.cs | 2 +- .../KinematicViscosity.NetFramework.g.cs | 2 +- .../Quantities/LapseRate.NetFramework.g.cs | 2 +- .../Quantities/Length.NetFramework.g.cs | 2 +- .../Quantities/Level.NetFramework.g.cs | 2 +- .../LinearDensity.NetFramework.g.cs | 2 +- .../Quantities/LuminousFlux.NetFramework.g.cs | 2 +- .../LuminousIntensity.NetFramework.g.cs | 2 +- .../MagneticField.NetFramework.g.cs | 2 +- .../Quantities/MagneticFlux.NetFramework.g.cs | 2 +- .../Magnetization.NetFramework.g.cs | 2 +- .../Quantities/Mass.NetFramework.g.cs | 2 +- .../Quantities/MassFlow.NetFramework.g.cs | 2 +- .../Quantities/MassFlux.NetFramework.g.cs | 2 +- .../MassMomentOfInertia.NetFramework.g.cs | 2 +- .../Quantities/MolarEnergy.NetFramework.g.cs | 2 +- .../Quantities/MolarEntropy.NetFramework.g.cs | 2 +- .../Quantities/MolarMass.NetFramework.g.cs | 2 +- .../Quantities/Molarity.NetFramework.g.cs | 2 +- .../Quantities/Permeability.NetFramework.g.cs | 2 +- .../Quantities/Permittivity.NetFramework.g.cs | 2 +- .../Quantities/Power.NetFramework.g.cs | 2 +- .../Quantities/PowerDensity.NetFramework.g.cs | 2 +- .../Quantities/PowerRatio.NetFramework.g.cs | 2 +- .../Quantities/Pressure.NetFramework.g.cs | 2 +- .../PressureChangeRate.NetFramework.g.cs | 2 +- .../Quantities/Ratio.NetFramework.g.cs | 2 +- .../ReactiveEnergy.NetFramework.g.cs | 2 +- .../ReactivePower.NetFramework.g.cs | 2 +- .../RotationalAcceleration.NetFramework.g.cs | 2 +- .../RotationalSpeed.NetFramework.g.cs | 2 +- .../RotationalStiffness.NetFramework.g.cs | 2 +- ...tionalStiffnessPerLength.NetFramework.g.cs | 2 +- .../Quantities/SolidAngle.NetFramework.g.cs | 2 +- .../SpecificEnergy.NetFramework.g.cs | 2 +- .../SpecificEntropy.NetFramework.g.cs | 2 +- .../SpecificVolume.NetFramework.g.cs | 2 +- .../SpecificWeight.NetFramework.g.cs | 2 +- .../Quantities/Speed.NetFramework.g.cs | 2 +- .../Quantities/Temperature.NetFramework.g.cs | 2 +- .../TemperatureChangeRate.NetFramework.g.cs | 2 +- .../TemperatureDelta.NetFramework.g.cs | 2 +- .../ThermalConductivity.NetFramework.g.cs | 2 +- .../ThermalResistance.NetFramework.g.cs | 2 +- .../Quantities/Torque.NetFramework.g.cs | 2 +- .../Quantities/VitaminA.NetFramework.g.cs | 2 +- .../Quantities/Volume.NetFramework.g.cs | 2 +- .../Quantities/VolumeFlow.NetFramework.g.cs | 2 +- ...fault.g.cs => UnitAbbreviationsCache.g.cs} | 4 +-- UnitsNet/Scripts/GenerateUnits.ps1 | 4 +-- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 8 ++--- ...GenerateQuantitySourceCodeNetFramework.ps1 | 2 +- ...ntitySourceCodeWindowsRuntimeComponent.ps1 | 2 +- ...de-GenerateUnitSystemDefaultSourceCode.ps1 | 6 ++-- UnitsNet/UnitConverter.cs | 8 ++--- UnitsNet/UnitFormatter.cs | 2 +- 282 files changed, 644 insertions(+), 599 deletions(-) rename UnitsNet/GeneratedCode/{UnitSystem.Default.g.cs => UnitAbbreviationsCache.g.cs} (99%) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index 3d041be1f9..d2a979a292 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -679,7 +679,7 @@ private static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit)); } @@ -702,7 +702,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit), out result); } @@ -720,7 +720,7 @@ private static AccelerationUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == AccelerationUnit.Undefined) { @@ -750,7 +750,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AccelerationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 3481418f3f..8ffdaf8cfc 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -701,7 +701,7 @@ private static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Moles + y.Moles, BaseUnit)); } @@ -724,7 +724,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Moles + y.Moles, BaseUnit), out result); } @@ -742,7 +742,7 @@ private static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == AmountOfSubstanceUnit.Undefined) { @@ -772,7 +772,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AmountOfSubstanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 5582ceb536..4c179be8cd 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -480,7 +480,7 @@ private static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit)); } @@ -503,7 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit), out result); } @@ -521,7 +521,7 @@ private static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == AmplitudeRatioUnit.Undefined) { @@ -551,7 +551,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AmplitudeRatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index 81695f57f1..a1f6eebf89 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -700,7 +700,7 @@ private static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Degrees + y.Degrees, BaseUnit)); } @@ -723,7 +723,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Degrees + y.Degrees, BaseUnit), out result); } @@ -741,7 +741,7 @@ private static AngleUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == AngleUnit.Undefined) { @@ -771,7 +771,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AngleUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index fab0af3569..78cd8fb5eb 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -459,7 +459,7 @@ private static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ApparentEnergyUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ApparentEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index 184cc5573b..a818ec550d 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -481,7 +481,7 @@ private static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit)); } @@ -504,7 +504,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit), out result); } @@ -522,7 +522,7 @@ private static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ApparentPowerUnit.Undefined) { @@ -552,7 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ApparentPowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 4103a1db74..2459b00b7a 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -679,7 +679,7 @@ private static Area ParseInternal(string str, [CanBeNull] IFormatProvider provid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit)); } @@ -702,7 +702,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit), out result); } @@ -720,7 +720,7 @@ private static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == AreaUnit.Undefined) { @@ -750,7 +750,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AreaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index e94e3911b9..4cd4aa2f13 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -415,7 +415,7 @@ private static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == AreaDensityUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AreaDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 203367d7b0..5b0cd13dcf 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -525,7 +525,7 @@ private static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit)); } @@ -548,7 +548,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit), out result); } @@ -566,7 +566,7 @@ private static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == AreaMomentOfInertiaUnit.Undefined) { @@ -596,7 +596,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == AreaMomentOfInertiaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index a054c86a85..6ddc4d0c32 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -964,7 +964,7 @@ private static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider pro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit)); } @@ -987,7 +987,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit), out result); } @@ -1005,7 +1005,7 @@ private static BitRateUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == BitRateUnit.Undefined) { @@ -1035,7 +1035,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == BitRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index f3dada2c00..4af2b1ac17 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -459,7 +459,7 @@ private static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IF { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index ab48631583..f6b0b7356c 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -415,7 +415,7 @@ private static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Farads + y.Farads, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Farads + y.Farads, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == CapacitanceUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == CapacitanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 2d1f86d33a..181c7b6999 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -1229,7 +1229,7 @@ private static Density ParseInternal(string str, [CanBeNull] IFormatProvider pro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit)); } @@ -1252,7 +1252,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit), out result); } @@ -1270,7 +1270,7 @@ private static DensityUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == DensityUnit.Undefined) { @@ -1300,7 +1300,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == DensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index e86de60c7a..d74a34cb93 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -613,7 +613,7 @@ private static Duration ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Seconds + y.Seconds, BaseUnit)); } @@ -636,7 +636,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Seconds + y.Seconds, BaseUnit), out result); } @@ -654,7 +654,7 @@ private static DurationUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == DurationUnit.Undefined) { @@ -684,7 +684,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == DurationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 2f5a1c02bb..5497bb6261 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -525,7 +525,7 @@ private static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatPro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit)); } @@ -548,7 +548,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit), out result); } @@ -566,7 +566,7 @@ private static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == DynamicViscosityUnit.Undefined) { @@ -596,7 +596,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == DynamicViscosityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index 098b0ccb99..cc03d6012c 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -481,7 +481,7 @@ private static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); } @@ -504,7 +504,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); } @@ -522,7 +522,7 @@ private static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricAdmittanceUnit.Undefined) { @@ -552,7 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricAdmittanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index e1b8c1320c..87390b5eb6 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -415,7 +415,7 @@ private static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricChargeUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricChargeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 1aa1ff21a1..7f3ad066a1 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -415,7 +415,7 @@ private static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IForm provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricChargeDensityUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricChargeDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index 66894fce47..ef04132634 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -459,7 +459,7 @@ private static ElectricConductance ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricConductanceUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricConductanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 9d3952f53c..82edcd345e 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -415,7 +415,7 @@ private static ElectricConductivity ParseInternal(string str, [CanBeNull] IForma provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static ElectricConductivityUnit ParseUnitInternal(string str, IFormatPro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricConductivityUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricConductivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 53591c0f8c..22c01b3809 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -569,7 +569,7 @@ private static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Amperes + y.Amperes, BaseUnit)); } @@ -592,7 +592,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Amperes + y.Amperes, BaseUnit), out result); } @@ -610,7 +610,7 @@ private static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricCurrentUnit.Undefined) { @@ -640,7 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricCurrentUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index 75fd541ee1..e230b33786 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -415,7 +415,7 @@ private static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFor provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricCurrentDensityUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricCurrentDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 3bc14db71b..6cffa791ec 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -415,7 +415,7 @@ private static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFo provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricCurrentGradientUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricCurrentGradientUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 0bca606819..98b9072347 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -415,7 +415,7 @@ private static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricFieldUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricFieldUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index d32388c2e9..2cfb8999f0 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -415,7 +415,7 @@ private static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Henries + y.Henries, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Henries + y.Henries, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricInductanceUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricInductanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index 14b27fd69b..d6736fbd4a 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -503,7 +503,7 @@ private static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Volts + y.Volts, BaseUnit)); } @@ -526,7 +526,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Volts + y.Volts, BaseUnit), out result); } @@ -544,7 +544,7 @@ private static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricPotentialUnit.Undefined) { @@ -574,7 +574,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricPotentialUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 5f05893521..0c96db267e 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -502,7 +502,7 @@ private static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit)); } @@ -525,7 +525,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit), out result); } @@ -543,7 +543,7 @@ private static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricPotentialAcUnit.Undefined) { @@ -573,7 +573,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricPotentialAcUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index 8a2d4d6211..e9e585ee64 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -502,7 +502,7 @@ private static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit)); } @@ -525,7 +525,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit), out result); } @@ -543,7 +543,7 @@ private static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricPotentialDcUnit.Undefined) { @@ -573,7 +573,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricPotentialDcUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index 01996250d7..d33552494b 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -481,7 +481,7 @@ private static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Ohms + y.Ohms, BaseUnit)); } @@ -504,7 +504,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Ohms + y.Ohms, BaseUnit), out result); } @@ -522,7 +522,7 @@ private static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricResistanceUnit.Undefined) { @@ -552,7 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricResistanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 112e8066dc..5d96e7af87 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -481,7 +481,7 @@ private static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit)); } @@ -504,7 +504,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit), out result); } @@ -522,7 +522,7 @@ private static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ElectricResistivityUnit.Undefined) { @@ -552,7 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ElectricResistivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index e6bea32ef1..3169bc23e6 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -877,7 +877,7 @@ private static Energy ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Joules + y.Joules, BaseUnit)); } @@ -900,7 +900,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Joules + y.Joules, BaseUnit), out result); } @@ -918,7 +918,7 @@ private static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == EnergyUnit.Undefined) { @@ -948,7 +948,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == EnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index 8192bda935..70a74a9194 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -547,7 +547,7 @@ private static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider pro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit)); } @@ -570,7 +570,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit), out result); } @@ -588,7 +588,7 @@ private static EntropyUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == EntropyUnit.Undefined) { @@ -618,7 +618,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == EntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 3ac553ea52..4b809d9614 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -613,7 +613,7 @@ private static Force ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Newtons + y.Newtons, BaseUnit)); } @@ -636,7 +636,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Newtons + y.Newtons, BaseUnit), out result); } @@ -654,7 +654,7 @@ private static ForceUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ForceUnit.Undefined) { @@ -684,7 +684,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ForceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index ba6dc13a06..16b2cf0449 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -635,7 +635,7 @@ private static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit)); } @@ -658,7 +658,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit), out result); } @@ -676,7 +676,7 @@ private static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ForceChangeRateUnit.Undefined) { @@ -706,7 +706,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ForceChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index 4a1f159e5b..cf736506b2 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -591,7 +591,7 @@ private static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit)); } @@ -614,7 +614,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit), out result); } @@ -632,7 +632,7 @@ private static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ForcePerLengthUnit.Undefined) { @@ -662,7 +662,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ForcePerLengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 398744fcf5..9f5b6f7b3a 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -569,7 +569,7 @@ private static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider p provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Hertz + y.Hertz, BaseUnit)); } @@ -592,7 +592,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Hertz + y.Hertz, BaseUnit), out result); } @@ -610,7 +610,7 @@ private static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == FrequencyUnit.Undefined) { @@ -640,7 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == FrequencyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index 62102f2171..c15cb25a98 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -745,7 +745,7 @@ private static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); } @@ -768,7 +768,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); } @@ -786,7 +786,7 @@ private static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == HeatFluxUnit.Undefined) { @@ -816,7 +816,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == HeatFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 618aeef718..7ca816dd36 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -437,7 +437,7 @@ private static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFo provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit)); } @@ -460,7 +460,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit), out result); } @@ -478,7 +478,7 @@ private static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == HeatTransferCoefficientUnit.Undefined) { @@ -508,7 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == HeatTransferCoefficientUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index 0c64b59c82..a76f397653 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -481,7 +481,7 @@ private static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Lux + y.Lux, BaseUnit)); } @@ -504,7 +504,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Lux + y.Lux, BaseUnit), out result); } @@ -522,7 +522,7 @@ private static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == IlluminanceUnit.Undefined) { @@ -552,7 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == IlluminanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 67ac281640..43f53d807f 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -964,7 +964,7 @@ private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Bits + y.Bits, BaseUnit)); } @@ -987,7 +987,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Bits + y.Bits, BaseUnit), out result); } @@ -1005,7 +1005,7 @@ private static InformationUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == InformationUnit.Undefined) { @@ -1035,7 +1035,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == InformationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 6744354fa3..18fb6c4551 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -437,7 +437,7 @@ private static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); } @@ -460,7 +460,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); } @@ -478,7 +478,7 @@ private static IrradianceUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == IrradianceUnit.Undefined) { @@ -508,7 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == IrradianceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 971390e447..31b6c55e97 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -459,7 +459,7 @@ private static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static IrradiationUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == IrradiationUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == IrradiationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 9a4ff29130..1557709422 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -569,7 +569,7 @@ private static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit)); } @@ -592,7 +592,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit), out result); } @@ -610,7 +610,7 @@ private static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == KinematicViscosityUnit.Undefined) { @@ -640,7 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == KinematicViscosityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 4fe7d8dd6c..74bb128ac6 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -415,7 +415,7 @@ private static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider p provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == LapseRateUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LapseRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index b6d9faa60e..d96924eb0a 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -877,7 +877,7 @@ private static Length ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Meters + y.Meters, BaseUnit)); } @@ -900,7 +900,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Meters + y.Meters, BaseUnit), out result); } @@ -918,7 +918,7 @@ private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == LengthUnit.Undefined) { @@ -948,7 +948,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 1c95d89a95..460c901c68 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -436,7 +436,7 @@ private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Decibels + y.Decibels, BaseUnit)); } @@ -459,7 +459,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Decibels + y.Decibels, BaseUnit), out result); } @@ -477,7 +477,7 @@ private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == LevelUnit.Undefined) { @@ -507,7 +507,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LevelUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index 3ec72bd6b9..f944bdb31b 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -459,7 +459,7 @@ private static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == LinearDensityUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LinearDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index cbc1aaa99f..84875930a8 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -415,7 +415,7 @@ private static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Lumens + y.Lumens, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Lumens + y.Lumens, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == LuminousFluxUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LuminousFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index 1db655152d..e3c2665457 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -415,7 +415,7 @@ private static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Candela + y.Candela, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Candela + y.Candela, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == LuminousIntensityUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == LuminousIntensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 43b210acff..2731a33f19 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -415,7 +415,7 @@ private static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Teslas + y.Teslas, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Teslas + y.Teslas, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MagneticFieldUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MagneticFieldUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index 2393e8bfe5..5a1e968acd 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -415,7 +415,7 @@ private static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Webers + y.Webers, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Webers + y.Webers, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MagneticFluxUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MagneticFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index e05b82f408..52cce6354d 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -415,7 +415,7 @@ private static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MagnetizationUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MagnetizationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 41c0d656d6..2cac9f8c05 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -855,7 +855,7 @@ private static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit)); } @@ -878,7 +878,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit), out result); } @@ -896,7 +896,7 @@ private static MassUnit ParseUnitInternal(string str, IFormatProvider provider = { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MassUnit.Undefined) { @@ -926,7 +926,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index b97c8814cd..7b941233f2 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -723,7 +723,7 @@ private static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit)); } @@ -746,7 +746,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit), out result); } @@ -764,7 +764,7 @@ private static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MassFlowUnit.Undefined) { @@ -794,7 +794,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassFlowUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index 96dca48ada..e9dcb735fa 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -437,7 +437,7 @@ private static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit)); } @@ -460,7 +460,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit), out result); } @@ -478,7 +478,7 @@ private static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MassFluxUnit.Undefined) { @@ -508,7 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index df7e27088c..8c67c4ee9d 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -965,7 +965,7 @@ private static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit)); } @@ -988,7 +988,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit), out result); } @@ -1006,7 +1006,7 @@ private static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MassMomentOfInertiaUnit.Undefined) { @@ -1036,7 +1036,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MassMomentOfInertiaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index f8bff0a68b..245c2b9db4 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -459,7 +459,7 @@ private static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MolarEnergyUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index 7ef0297c57..a2079795df 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -459,7 +459,7 @@ private static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MolarEntropyUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarEntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index 5a2f25a21f..cde782d394 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -657,7 +657,7 @@ private static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider p provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit)); } @@ -680,7 +680,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit), out result); } @@ -698,7 +698,7 @@ private static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MolarMassUnit.Undefined) { @@ -728,7 +728,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarMassUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index b11fad7276..b551f2e57a 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -569,7 +569,7 @@ private static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit)); } @@ -592,7 +592,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit), out result); } @@ -610,7 +610,7 @@ private static MolarityUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == MolarityUnit.Undefined) { @@ -640,7 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == MolarityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 41e31414d9..26b3a79c94 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -415,7 +415,7 @@ private static Permeability ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == PermeabilityUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PermeabilityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index 8de3351773..a96cf85386 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -415,7 +415,7 @@ private static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit)); } @@ -438,7 +438,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit), out result); } @@ -456,7 +456,7 @@ private static PermittivityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == PermittivityUnit.Undefined) { @@ -486,7 +486,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PermittivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index e62445518e..89037f0f1a 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -833,7 +833,7 @@ private static Power ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Watts + y.Watts, BaseUnit)); } @@ -856,7 +856,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Watts + y.Watts, BaseUnit), out result); } @@ -874,7 +874,7 @@ private static PowerUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == PowerUnit.Undefined) { @@ -904,7 +904,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 92eab71c3f..5d273e3417 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -1361,7 +1361,7 @@ private static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit)); } @@ -1384,7 +1384,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit), out result); } @@ -1402,7 +1402,7 @@ private static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == PowerDensityUnit.Undefined) { @@ -1432,7 +1432,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PowerDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 8024d025ff..518471df32 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -436,7 +436,7 @@ private static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit)); } @@ -459,7 +459,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit), out result); } @@ -477,7 +477,7 @@ private static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == PowerRatioUnit.Undefined) { @@ -507,7 +507,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PowerRatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index 8a5e494f7b..c3db07bf24 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -1207,7 +1207,7 @@ private static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Pascals + y.Pascals, BaseUnit)); } @@ -1230,7 +1230,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Pascals + y.Pascals, BaseUnit), out result); } @@ -1248,7 +1248,7 @@ private static PressureUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == PressureUnit.Undefined) { @@ -1278,7 +1278,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PressureUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 3278b87148..7b3b600e5f 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -481,7 +481,7 @@ private static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit)); } @@ -504,7 +504,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit), out result); } @@ -522,7 +522,7 @@ private static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == PressureChangeRateUnit.Undefined) { @@ -552,7 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == PressureChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index d8b7e7db44..55e0b0ab88 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -524,7 +524,7 @@ private static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit)); } @@ -547,7 +547,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit), out result); } @@ -565,7 +565,7 @@ private static RatioUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == RatioUnit.Undefined) { @@ -595,7 +595,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index 8948f59da7..001687c404 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -459,7 +459,7 @@ private static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ReactiveEnergyUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ReactiveEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index f87897edc9..a447e75069 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -481,7 +481,7 @@ private static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit)); } @@ -504,7 +504,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit), out result); } @@ -522,7 +522,7 @@ private static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ReactivePowerUnit.Undefined) { @@ -552,7 +552,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ReactivePowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 46edcadcb8..84c60712c6 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -459,7 +459,7 @@ private static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFor provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == RotationalAccelerationUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalAccelerationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 9d414f3062..3620080e25 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -679,7 +679,7 @@ private static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit)); } @@ -702,7 +702,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit), out result); } @@ -720,7 +720,7 @@ private static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == RotationalSpeedUnit.Undefined) { @@ -750,7 +750,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalSpeedUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index fdec50e8e6..21cacb0712 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -459,7 +459,7 @@ private static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == RotationalStiffnessUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalStiffnessUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 21c05d3c36..943f679024 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -459,7 +459,7 @@ private static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit)); } @@ -482,7 +482,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit), out result); } @@ -500,7 +500,7 @@ private static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IF { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == RotationalStiffnessPerLengthUnit.Undefined) { @@ -530,7 +530,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == RotationalStiffnessPerLengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 585aea32ca..7a445f8f83 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -414,7 +414,7 @@ private static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Steradians + y.Steradians, BaseUnit)); } @@ -437,7 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Steradians + y.Steradians, BaseUnit), out result); } @@ -455,7 +455,7 @@ private static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == SolidAngleUnit.Undefined) { @@ -485,7 +485,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SolidAngleUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index f3d7ae1ce3..87278341dd 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -569,7 +569,7 @@ private static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit)); } @@ -592,7 +592,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit), out result); } @@ -610,7 +610,7 @@ private static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == SpecificEnergyUnit.Undefined) { @@ -640,7 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index d9793d57c0..f9d7cd18be 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -569,7 +569,7 @@ private static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit)); } @@ -592,7 +592,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit), out result); } @@ -610,7 +610,7 @@ private static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == SpecificEntropyUnit.Undefined) { @@ -640,7 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificEntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index c014c31bff..d697f500be 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -437,7 +437,7 @@ private static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit)); } @@ -460,7 +460,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit), out result); } @@ -478,7 +478,7 @@ private static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == SpecificVolumeUnit.Undefined) { @@ -508,7 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificVolumeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 0e1975dab3..644612dfa6 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -767,7 +767,7 @@ private static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit)); } @@ -790,7 +790,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit), out result); } @@ -808,7 +808,7 @@ private static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == SpecificWeightUnit.Undefined) { @@ -838,7 +838,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpecificWeightUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 65ea2b585c..048ddd0502 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -1097,7 +1097,7 @@ private static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit)); } @@ -1120,7 +1120,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit), out result); } @@ -1138,7 +1138,7 @@ private static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == SpeedUnit.Undefined) { @@ -1168,7 +1168,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == SpeedUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 51e9653746..939ab11ba7 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -569,7 +569,7 @@ private static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); } @@ -592,7 +592,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); } @@ -610,7 +610,7 @@ private static TemperatureUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == TemperatureUnit.Undefined) { @@ -640,7 +640,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TemperatureUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 2ad614f696..36cde49a47 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -613,7 +613,7 @@ private static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IForm provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit)); } @@ -636,7 +636,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit), out result); } @@ -654,7 +654,7 @@ private static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == TemperatureChangeRateUnit.Undefined) { @@ -684,7 +684,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TemperatureChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 649166194d..84833c4fd7 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -568,7 +568,7 @@ private static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatPro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); } @@ -591,7 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); } @@ -609,7 +609,7 @@ private static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == TemperatureDeltaUnit.Undefined) { @@ -639,7 +639,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TemperatureDeltaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index 1ef64b75bd..a09d0982fa 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -437,7 +437,7 @@ private static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit)); } @@ -460,7 +460,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit), out result); } @@ -478,7 +478,7 @@ private static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ThermalConductivityUnit.Undefined) { @@ -508,7 +508,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ThermalConductivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 37131cd0cb..13068ea152 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -503,7 +503,7 @@ private static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit)); } @@ -526,7 +526,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit), out result); } @@ -544,7 +544,7 @@ private static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == ThermalResistanceUnit.Undefined) { @@ -574,7 +574,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == ThermalResistanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index ac9dbe8ea3..83e93c1cb2 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -855,7 +855,7 @@ private static Torque ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit)); } @@ -878,7 +878,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit), out result); } @@ -896,7 +896,7 @@ private static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == TorqueUnit.Undefined) { @@ -926,7 +926,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == TorqueUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 38eeeba73f..4d6b0c5a4c 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -414,7 +414,7 @@ private static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit)); } @@ -437,7 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit), out result); } @@ -455,7 +455,7 @@ private static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == VitaminAUnit.Undefined) { @@ -485,7 +485,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == VitaminAUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 7376e63319..0bad7a2881 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -1317,7 +1317,7 @@ private static Volume ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit)); } @@ -1340,7 +1340,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit), out result); } @@ -1358,7 +1358,7 @@ private static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == VolumeUnit.Undefined) { @@ -1388,7 +1388,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == VolumeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 38483f78bc..6201e6011e 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -965,7 +965,7 @@ private static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit)); } @@ -988,7 +988,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit), out result); } @@ -1006,7 +1006,7 @@ private static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str.Trim(), provider); if (unit == VolumeFlowUnit.Undefined) { @@ -1036,7 +1036,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) return false; if(unit == VolumeFlowUnit.Undefined) diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 293f1d84e6..7ddaea57d3 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -188,10 +188,12 @@ public void TryParseLengthUnitAbbreviationSpecialCharacters(string s) { string abbrev = $"m{s}s"; - UnitAbbreviationsCache.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); + var unitAbbreviationsCache = new UnitAbbreviationsCache(); + unitAbbreviationsCache.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act - bool ok = UnitParser.TryParse(abbrev, out LengthUnit result); + var parser = new UnitParser(unitAbbreviationsCache); + bool ok = parser.TryParse(abbrev, out LengthUnit result); // Assert Assert.True(ok, "TryParse " + abbrev); @@ -216,10 +218,12 @@ public void TryParseLengthSpecialCharacters(string s) { string abbrev = $"m{s}s"; - UnitAbbreviationsCache.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); + var tempCulture = (CultureInfo)(new CultureInfo("en-US").Clone()); + + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, tempCulture, abbrev ); // Act - bool ok = Length.TryParse($"10 {abbrev}", out Length result); + bool ok = Length.TryParse($"10 {abbrev}", tempCulture, out Length result); // Assert Assert.True(ok, $"TryParse \"10 {abbrev}\""); @@ -231,6 +235,5 @@ private static string AssertExceptionAndGetFullTypeName(Action code) var exception = Assert.ThrowsAny(code); return exception.GetType().FullName; } - } } diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index 034588c024..bace29a674 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -77,7 +77,7 @@ private static IEnumerable GetUnitTypesWithMissingAbbreviations(customAbbreviation); + var unitAbbreviationsCache = new UnitAbbreviationsCache(); + unitAbbreviationsCache.MapUnitToAbbreviation(expected, customAbbreviation); + + var parser = new UnitParser(unitAbbreviationsCache); + var actual = parser.Parse(customAbbreviation); Assert.Equal(expected, actual); } [Fact] public void Parse_UnknownAbbreviationThrowsUnitNotFoundException() { - Assert.Throws(() => UnitParser.Parse("nonexistingunit")); + Assert.Throws(() => UnitParser.Default.Parse("nonexistingunit")); } [Theory] @@ -396,7 +399,7 @@ public void ToString_WithRussianCulture() [Fact] public void GetDefaultAbbreviationFallsBackToDefaultStringIfNotSpecified() { - string abbreviation = UnitAbbreviationsCache.GetDefaultAbbreviation(CustomUnit.Unit1); + string abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(CustomUnit.Unit1); Assert.Equal("(no abbreviation for CustomUnit.Unit1)", abbreviation); } @@ -415,10 +418,12 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = zuluCulture; var americanCulture = new CultureInfo(AmericanCultureName); - UnitAbbreviationsCache.MapUnitToAbbreviation(CustomUnit.Unit1, americanCulture, "US english abbreviation for Unit1"); + + var unitAbbreviationsCache = new UnitAbbreviationsCache(); + unitAbbreviationsCache.MapUnitToAbbreviation(CustomUnit.Unit1, americanCulture, "US english abbreviation for Unit1"); // Act - string abbreviation = UnitAbbreviationsCache.GetDefaultAbbreviation(CustomUnit.Unit1, zuluCulture); + string abbreviation = unitAbbreviationsCache.GetDefaultAbbreviation(CustomUnit.Unit1, zuluCulture); // Assert Assert.Equal("US english abbreviation for Unit1", abbreviation); @@ -434,16 +439,18 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviationForAlreadyMappedUnits() { var americanCulture = new CultureInfo(AmericanCultureName); - UnitAbbreviationsCache.MapUnitToAbbreviation(AreaUnit.SquareMeter, americanCulture, "m^2"); - Assert.Equal("m²", UnitAbbreviationsCache.GetDefaultAbbreviation(AreaUnit.SquareMeter)); + var unitAbbreviationsCache = new UnitAbbreviationsCache(); + unitAbbreviationsCache.MapUnitToAbbreviation(AreaUnit.SquareMeter, americanCulture, "m^2"); + + Assert.Equal("m²", unitAbbreviationsCache.GetDefaultAbbreviation(AreaUnit.SquareMeter)); } [Fact] public void Parse_AmbiguousUnitsThrowsException() { // Act 1 - var exception1 = Assert.Throws(() => UnitParser.Parse("pt")); + var exception1 = Assert.Throws(() => UnitParser.Default.Parse("pt")); // Act 2 var exception2 = Assert.Throws(() => Length.Parse("1 pt")); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 7c86a5ea66..d3d2212a46 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] string c // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index 073e9534f4..4da424e064 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] str // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index 75ec82396a..c9270a8538 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index a74fb2d285..5036e53c96 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] string cultureN // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index bcbc14890e..24b31c0617 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index ca2c7be32a..72fb2c1bef 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 28f5d491b8..cb6d72caea 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index e585464bc2..7e28efb832 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] string cu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index dcd1c4f340..fc6e9f9902 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 3b2fd588c5..0f875ab24a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] string cultur // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 42df78c48e..2160df5d95 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 3025f548f2..94fcb0b36e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] string cu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index 4d8cd02030..1794f2a44f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] string cultur // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index 9795d15848..af28ffc607 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index 7654825282..c3a4ab5fca 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] stri // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index 8c637e53da..ed03518d17 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] st // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index f729f7eec7..9365baaad6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 64e841d3d4..509ae88774 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 8623719ffb..ebf6ac5b03 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 29ac150fc4..adb498b27f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 07b88a476d..48ed28a513 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] strin // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index 914b1d0dd8..e4d84162be 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 2357287b44..3017be3239 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index dcab5dcb26..331c07b4aa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index 2c11f4a8a1..eeb669c921 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] st // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index b703e40efd..a27f3d9e38 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] str // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index e5d8a31a6c..259ba4a547 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index b1ea7f972a..1b5f2f6ddc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index e71a015780..5fea52fa15 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] st // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index 90a5f4361d..90c88d527b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index 9bd1087cad..afeee41670 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] string culture // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 211977e1b4..93cbd769ae 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] string cultur // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index 082ff74541..d56bd5414c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] string cultureN // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index f6c4f8a255..eee5d4a37a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] strin // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index 16c9d930c6..2f58de763a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index 977ac9a01f..c807d00919 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] string cult // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 7350674c43..83592800e8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 5153ccdff7..fb471c80fb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 612c9eee1a..b26e54eb80 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] string cu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index 31a2671d1a..4b9a8667aa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] string cu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index 94a77f6ca5..174012ea9f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] string cul // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 41e31c3efe..5763e4b6af 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] string cu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 2d7dc3b877..6e36d35404 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] st // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index 165ecdc862..449268027d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] string cult // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 5ce080de11..1d44338323 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] string culture // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 0f79a190d1..c60a2ac451 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] string cultureN // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 5c7c07a6c2..5493ea8b86 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 75dfbba4f5..5dfe071b48 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] string c // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index 0467d51044..c40325194c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] str // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index cf0f43bb21..a5190e0166 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 007e2c7d27..63426964ad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] string c // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index 9c1258685c..2d5b84adaa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 52aae57cc6..712f6ff3b3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] string cultureNa // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index 252cc4f8e5..5c67104615 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 382ea6842b..dc56146423 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index b84acc5608..469d291d79 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index 9e4374bfef..3b578ddeff 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] string cu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 414020baea..02e0c6651a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] string c // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index 2af53a13dd..1e30d9aad3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] string cult // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index 0702b360fb..b7d8ad5382 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index a466c8c529..b257e73ac5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] string c // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index 78b8c243a6..e2ddaa78dd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] string c // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index f1b23f1636..bde99ca61a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] string cultureN // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 7a2eabee60..72622645aa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] string c // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index bd18917819..445dc4987a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] string cul // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index b24e08ae06..215e4fbff9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index 955d42afbe..c4a66e7ab7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] st // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 279f42ad89..1b7545d5bb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] string cultureN // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 052d6146b2..e3bb377b5d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 99e76a5dd2..162cd0797e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index 7c598f2087..c90cbe6a26 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 0832ae75a0..56b88c20b9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] strin // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index 17dac2ba7a..012227d3eb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index 014fc73211..785266428c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index b7e92d9917..df48f6d637 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] string cul // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index 72996cfc4a..48838d794f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 2ec0fcaba8..2322be408b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] strin // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index c363999760..493b494770 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index 98fa990414..30730d151a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] string // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 8a8917df9d..67c2fc8bf3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] string cultureN // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index 2c681a50e7..9625122fe6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] string cu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index b6f7f9d38e..710be255b6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 03141e7c9f..6ae270222f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] stri // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index e2e52066ac..a4e48ad02a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] s // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index 2e5b909ebb..d2e143d2a3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] str // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index 349b3d9d6a..42d5684138 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] string culture // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 3bd43a4de7..0a31e87f1b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] string cultu // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 3d8c208964..2086f59c7a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] string culture // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 6dfabf538e..7a3e8b4b4a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -83,7 +83,7 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] string cul // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index f57541d31b..118ccdb360 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -140,8 +140,8 @@ public string ToString([CanBeNull] Culture cultureInfo) { // Note that it isn't customary to use fractions - one wouldn't say "I am 5 feet and 4.5 inches". // So inches are rounded when converting from base units to feet/inches. - var footUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(LengthUnit.Foot); - var inchUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(LengthUnit.Inch); + var footUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(LengthUnit.Foot); + var inchUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(LengthUnit.Inch); return string.Format(GlobalConfiguration.DefaultCulture, "{0:n0} {1} {2:n0} {3}", Feet, footUnit, Math.Round(Inches), inchUnit); diff --git a/UnitsNet/CustomCode/Quantities/Mass.extra.cs b/UnitsNet/CustomCode/Quantities/Mass.extra.cs index 9a35bb6554..3811be83dc 100644 --- a/UnitsNet/CustomCode/Quantities/Mass.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Mass.extra.cs @@ -130,8 +130,8 @@ public string ToString([CanBeNull] Culture cultureInfo) // Note that it isn't customary to use fractions - one wouldn't say "I am 11 stone and 4.5 pounds". // So pounds are rounded here. - var stoneUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(MassUnit.Stone); - var poundUnit = UnitAbbreviationsCache.GetDefaultAbbreviation(MassUnit.Pound); + var stoneUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(MassUnit.Stone); + var poundUnit = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(MassUnit.Pound); return string.Format(GlobalConfiguration.DefaultCulture, "{0:n0} {1} {2:n0} {3}", Stone, stoneUnit, Math.Round(Pounds), poundUnit); diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index 6bfe6bedee..f4b1ea767d 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -43,10 +43,24 @@ internal delegate TQuantity QuantityFromDelegate(doubl where TUnitType : Enum; #endif - internal static class QuantityParser + internal class QuantityParser { + private readonly UnitAbbreviationsCache unitAbbreviationsCache; + + public static QuantityParser Default { get; } + + public QuantityParser(UnitAbbreviationsCache unitAbbreviationsCache) + { + this.unitAbbreviationsCache = unitAbbreviationsCache ?? UnitAbbreviationsCache.Default; + } + + static QuantityParser() + { + Default = new QuantityParser(UnitAbbreviationsCache.Default); + } + [SuppressMessage("ReSharper", "UseStringInterpolation")] - internal static TQuantity Parse([NotNull] string str, + internal TQuantity Parse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, [NotNull] ParseUnitDelegate parseUnit, [NotNull] QuantityFromDelegate fromDelegate, @@ -72,7 +86,7 @@ internal static TQuantity Parse([NotNull] string str, const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; - var unitAbbreviations = UnitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) + var unitAbbreviations = unitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error .Select(Regex.Escape) // Escape special regex characters .ToArray(); @@ -157,7 +171,7 @@ private static List ParseWithRegex(string regex } [SuppressMessage("ReSharper", "UseStringInterpolation")] - internal static bool TryParse([NotNull] string str, + internal bool TryParse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, [NotNull] TryParseUnitDelegate parseUnit, [NotNull] QuantityFromDelegate fromDelegate, @@ -185,7 +199,7 @@ internal static bool TryParse([NotNull] string str, const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; - var unitAbbreviations = UnitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) + var unitAbbreviations = unitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error .Select(Regex.Escape) // Escape special regex characters .ToArray(); diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index dc82f81de7..03c2015d93 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -32,9 +32,9 @@ // ReSharper disable once CheckNamespace namespace UnitsNet { - public static partial class UnitAbbreviationsCache + public sealed partial class UnitAbbreviationsCache { - private static Dictionary looksupsForCulture; + private Dictionary looksupsForCulture; /// /// Fallback culture used by and @@ -47,16 +47,23 @@ public static partial class UnitAbbreviationsCache /// private static readonly CultureInfo FallbackCulture = new CultureInfo("en-US"); - static UnitAbbreviationsCache() + public static UnitAbbreviationsCache Default { get; } + + public UnitAbbreviationsCache() { looksupsForCulture = new Dictionary(); LoadGeneratedAbbreviations(); } - private static void LoadGeneratedAbbreviations() + static UnitAbbreviationsCache() + { + Default = new UnitAbbreviationsCache(); + } + + private void LoadGeneratedAbbreviations() { - foreach(var localization in DefaultLocalizations) + foreach(var localization in GeneratedLocalizations) { var culture = new CultureInfo(localization.Item1); MapUnitToAbbreviation(localization.Item2, localization.Item3, culture, localization.Item4); @@ -78,7 +85,7 @@ private static void LoadGeneratedAbbreviations() #else public #endif - static void MapUnitToAbbreviation(TUnitType unit, params string[] abbreviations) where TUnitType : Enum + void MapUnitToAbbreviation(TUnitType unit, params string[] abbreviations) where TUnitType : Enum { MapUnitToAbbreviation(typeof(TUnitType), Convert.ToInt32(unit), GlobalConfiguration.DefaultCulture, abbreviations); } @@ -99,7 +106,7 @@ static void MapUnitToAbbreviation(TUnitType unit, params string[] abb #else public #endif - static void MapUnitToAbbreviation(TUnitType unit, IFormatProvider formatProvider, params string[] abbreviations) where TUnitType : Enum + void MapUnitToAbbreviation(TUnitType unit, IFormatProvider formatProvider, params string[] abbreviations) where TUnitType : Enum { // Assuming TUnitType is an enum, this conversion is safe. Seems not possible to enforce this today. // Src: http://stackoverflow.com/questions/908543/how-to-convert-from-system-enum-to-base-integer @@ -126,7 +133,7 @@ static void MapUnitToAbbreviation(TUnitType unit, IFormatProvider for #else public #endif - static void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider, [NotNull] params string[] abbreviations) + void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider, [NotNull] params string[] abbreviations) { if (!unitType.IsEnum()) throw new ArgumentException("Must be an enum type.", nameof(unitType)); @@ -163,7 +170,7 @@ static void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider #else public #endif - static string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum + string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum { var unitType = typeof(TUnitType); @@ -193,7 +200,7 @@ static string GetDefaultAbbreviation(TUnitType unit, IFormatProvider #else public #endif - static string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider = null) + string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider = null) { var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); if(lookup == null) @@ -220,7 +227,7 @@ static string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvid #else public #endif - static string[] GetAllAbbreviations(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum + string[] GetAllAbbreviations(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum { return GetAllAbbreviations(typeof(TUnitType), formatProvider); } @@ -238,7 +245,7 @@ static string[] GetAllAbbreviations(TUnitType unit, IFormatProvider f #else public #endif - static string[] GetAllAbbreviations(Type unitType, int unitValue, IFormatProvider formatProvider = null) + string[] GetAllAbbreviations(Type unitType, int unitValue, IFormatProvider formatProvider = null) { formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; @@ -265,7 +272,7 @@ static string[] GetAllAbbreviations(Type unitType, int unitValue, IFormatProvide #else public #endif - static string[] GetAllAbbreviations(Type unitType, IFormatProvider formatProvider = null) + string[] GetAllAbbreviations(Type unitType, IFormatProvider formatProvider = null) { formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; @@ -276,7 +283,7 @@ static string[] GetAllAbbreviations(Type unitType, IFormatProvider formatProvide return lookup.GetAllAbbreviations(); } - internal static UnitValueAbbreviationLookup GetUnitValueAbbreviationLookup(Type unitType, IFormatProvider formatProvider = null) + internal UnitValueAbbreviationLookup GetUnitValueAbbreviationLookup(Type unitType, IFormatProvider formatProvider = null) { formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index 1f4b7b94bc..2d01c15eaf 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -29,8 +29,22 @@ // ReSharper disable once CheckNamespace namespace UnitsNet { - public static class UnitParser + public sealed class UnitParser { + private readonly UnitAbbreviationsCache unitAbbreviationsCache; + + public static UnitParser Default { get; } + + public UnitParser(UnitAbbreviationsCache unitAbbreviationsCache) + { + this.unitAbbreviationsCache = unitAbbreviationsCache ?? UnitAbbreviationsCache.Default; ; + } + + static UnitParser() + { + Default = new UnitParser(UnitAbbreviationsCache.Default); + } + /// /// Parses a unit abbreviation for a given unit enumeration type. /// Example: Parse<LengthUnit>("km") => LengthUnit.Kilometer @@ -45,7 +59,7 @@ public static class UnitParser #else public #endif - static TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider formatProvider = null) where TUnitType : Enum + TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider formatProvider = null) where TUnitType : Enum { return (TUnitType)Parse(unitAbbreviation, typeof(TUnitType)); } @@ -69,9 +83,9 @@ static TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatPr #else public #endif - static object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null) + object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null) { - var abbreviations = UnitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); + var abbreviations = unitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); if(abbreviations == null) throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}]."); @@ -104,7 +118,7 @@ static object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatP #else public #endif - static bool TryParse(string unitAbbreviation, out TUnitType unit) where TUnitType : Enum + bool TryParse(string unitAbbreviation, out TUnitType unit) where TUnitType : Enum { return TryParse(unitAbbreviation, null, out unit); } @@ -124,7 +138,7 @@ static bool TryParse(string unitAbbreviation, out TUnitType unit) whe #else public #endif - static bool TryParse(string unitAbbreviation, [CanBeNull] IFormatProvider formatProvider, out TUnitType unit) where TUnitType : Enum + bool TryParse(string unitAbbreviation, [CanBeNull] IFormatProvider formatProvider, out TUnitType unit) where TUnitType : Enum { unit = default(TUnitType); @@ -143,7 +157,7 @@ static bool TryParse(string unitAbbreviation, [CanBeNull] IFormatProv /// The unit enum value as out result. /// True if successful. [PublicAPI] - public static bool TryParse(string unitAbbreviation, Type unitType, out object unit) + public bool TryParse(string unitAbbreviation, Type unitType, out object unit) { return TryParse(unitAbbreviation, unitType, null, out unit); } @@ -162,11 +176,11 @@ public static bool TryParse(string unitAbbreviation, Type unitType, out object u #else public #endif - static bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider, out object unit) + bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider, out object unit) { unit = GetDefault(unitType); - var abbreviations = UnitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); + var abbreviations = unitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); if(abbreviations == null) return false; diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 320fa02b8a..2a821d2291 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Acceleration : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index cbb79cba28..af1f54ac03 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct AmountOfSubstance : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Logarithmic Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index c5a171ebe2..b6fcddf6dc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Angle : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index a2932a0d17..cd4cc9b5cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct ApparentEnergy : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index b44cfe9250..49c83ccf41 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct ApparentPower : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 6301c2c3a8..2e76227328 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Area : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index b264b07995..b587d6e81b 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct AreaDensity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 8cb191b760..c8cc7f1c65 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct AreaMomentOfInertia : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 705f59dd81..9d20bb71ea 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct BrakeSpecificFuelConsumption : IComparable, IComparable
[UsedImplicitly] public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index ccf2ee22fe..2f4ae3169b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Density : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 9c7da87e2e..e939e55eb3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Duration : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index 60af6dd2af..0592f7257c 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct DynamicViscosity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 5b991c41b8..b5d74a008b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct ElectricChargeDensity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 97dda20018..46ed8d369d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct ElectricInductance : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index ae59ce8957..6daa65c745 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Entropy : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index e3f199fb0a..c52aa7cf46 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Force : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 6dcce2bc44..79cb9ae3f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct ForceChangeRate : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 1a9f0bd194..2a81047c44 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Frequency : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 4d74727e2c..59b7ca954d 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct HeatFlux : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 16d848af84..dbb53bb1f6 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct HeatTransferCoefficient : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 3e1d5928b2..4411396fb9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Information : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 6207011a7e..7f795dc704 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Irradiance : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 4c3c0e040f..7e7691330f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Irradiation : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index ca79859036..85db0e7324 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct KinematicViscosity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index f4ffda28c9..8ef90012f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Length : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 6fd6959f10..0c2f06d178 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Level : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Logarithmic Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index b0b8c417de..e31d72e8cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct LinearDensity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 922bb58493..328bd8f5da 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct LuminousFlux : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index bdd4fb3891..efc985d2be 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct LuminousIntensity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index fc1f5d6ab7..d4f88b977e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct MagneticFlux : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index e020736566..7432e78aa4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Magnetization : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index f890178bf4..a81a160184 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Mass : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 2cec9d17b7..de11a1c67a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct MassFlow : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 696af19250..52798888a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct MassFlux : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index d51fbfc3d1..1906959c41 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct MassMomentOfInertia : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index b6c115456c..033d8a7e6e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct MolarEntropy : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 38a4472271..95c5e75247 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct MolarMass : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 132b57e609..e39eba2a8b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Molarity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index cf9864b24f..cb59eaaa16 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Permeability : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 7812cc8043..9ca95e37b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Permittivity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 071b70ce1e..7fd4b35897 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Power : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 07fe8e821d..933752a72e 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct PowerDensity : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 843a9544ec..6570ae7bbe 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct PowerRatio : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Logarithmic Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index e6afd91b0f..638fcc44c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Pressure : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index a02467f2cd..97c976f2db 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct PressureChangeRate : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 9919e0afe5..7fc621b108 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct ReactiveEnergy : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index 7fed7619af..fce420bddb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct ReactivePower : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 740ea60370..64975291d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct RotationalAcceleration : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index b73579cdb1..090a310d87 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct SpecificEnergy : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 3ae214a638..1890c22aaa 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct SpecificEntropy : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 22862f0a5f..172b13b358 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct SpecificWeight : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 5920219141..2d82477282 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Speed : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 2b9b7d651f..87831b40d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Temperature : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } public static bool operator <=(Temperature left, Temperature right) diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index d1c5e5156d..02213b9ead 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct TemperatureChangeRate : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 64c8749c8e..4fe828c6e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct VitaminA : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 0249cb6709..a5924e5de0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct Volume : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 161c1f6f1d..a119dce282 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -64,7 +64,7 @@ public partial struct VolumeFlow : IComparable, IComparable [UsedImplicitly] public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Arithmetic Operators diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs similarity index 99% rename from UnitsNet/GeneratedCode/UnitSystem.Default.g.cs rename to UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index 891b866ae0..93eb2c2888 100644 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -47,9 +47,9 @@ namespace UnitsNet { - public static partial class UnitAbbreviationsCache + public partial class UnitAbbreviationsCache { - private static readonly Tuple[] DefaultLocalizations + private static readonly Tuple[] GeneratedLocalizations = new Tuple[] { Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.CentimeterPerSecondSquared, new string[]{"cm/s²"}), diff --git a/UnitsNet/Scripts/GenerateUnits.ps1 b/UnitsNet/Scripts/GenerateUnits.ps1 index 902b326510..4a8b0736db 100644 --- a/UnitsNet/Scripts/GenerateUnits.ps1 +++ b/UnitsNet/Scripts/GenerateUnits.ps1 @@ -75,8 +75,8 @@ function GenerateUnitType($quantity, $outDir) function GenerateUnitSystemDefault($quantities, $outDir) { - Write-Host -NoNewline "UnitSystem.Default.g.cs: " - $outFileName = "$outDir/UnitSystem.Default.g.cs" + Write-Host -NoNewline "UnitAbbreviationsCache.g.cs: " + $outFileName = "$outDir/UnitAbbreviationsCache.g.cs" GenerateUnitSystemDefaultSourceCode $quantities | Out-File -Encoding "UTF8" -Force $outFileName | Out-Null if (!$?) { diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 30f33a0501..696c788078 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -479,7 +479,7 @@ if ($obsoleteAttribute) provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From, + return QuantityParser.Default.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit)); } @@ -502,7 +502,7 @@ if ($obsoleteAttribute) provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, + return QuantityParser.Default.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit), out result); } @@ -520,7 +520,7 @@ if ($obsoleteAttribute) { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Parse<$unitEnumName>(str.Trim(), provider); + var unit = UnitParser.Default.Parse<$unitEnumName>(str.Trim(), provider); if (unit == $unitEnumName.Undefined) { @@ -550,7 +550,7 @@ if ($obsoleteAttribute) if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.TryParse<$unitEnumName>(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse<$unitEnumName>(str.Trim(), provider, out unit)) return false; if(unit == $unitEnumName.Undefined) diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index fde66d6fd3..afd597e592 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -76,7 +76,7 @@ namespace UnitsNet [UsedImplicitly] public static string GetAbbreviation($unitEnumName unit, [CanBeNull] IFormatProvider provider) { - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } "@; if ($quantity.Logarithmic -eq $true) { diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index 6116bce2c3..bbd1692147 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -95,7 +95,7 @@ namespace UnitsNet // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - return UnitAbbreviationsCache.GetDefaultAbbreviation(unit, provider); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } #region Parsing diff --git a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 index af6d3cbbca..a46758d8d6 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 @@ -1,4 +1,4 @@ -function GenerateUnitSystemDefaultSourceCode($quantities) +function GenerateUnitSystemDefaultSourceCode($quantities) { @" //------------------------------------------------------------------------------ @@ -50,9 +50,9 @@ using UnitsNet.Units; namespace UnitsNet { - public static partial class UnitAbbreviationsCache + public partial class UnitAbbreviationsCache { - private static readonly Tuple[] DefaultLocalizations + private static readonly Tuple[] GeneratedLocalizations = new Tuple[] { "@; diff --git a/UnitsNet/UnitConverter.cs b/UnitsNet/UnitConverter.cs index cf0d5aa771..cf5ac3a15a 100644 --- a/UnitsNet/UnitConverter.cs +++ b/UnitsNet/UnitConverter.cs @@ -230,8 +230,8 @@ public static double ConvertByAbbreviation(FromValue fromValue, string quantityN var cultureInfo = string.IsNullOrWhiteSpace(culture)? GlobalConfiguration.DefaultCulture : new CultureInfo(culture); - var fromUnitValue = UnitParser.Parse(fromUnitAbbrev, unitType, cultureInfo); // ex: ("m", LengthUnit) => LengthUnit.Meter - var toUnitValue = UnitParser.Parse(toUnitAbbrev, unitType, cultureInfo); // ex:("cm", LengthUnit) => LengthUnit.Centimeter + var fromUnitValue = UnitParser.Default.Parse(fromUnitAbbrev, unitType, cultureInfo); // ex: ("m", LengthUnit) => LengthUnit.Meter + var toUnitValue = UnitParser.Default.Parse(toUnitAbbrev, unitType, cultureInfo); // ex:("cm", LengthUnit) => LengthUnit.Centimeter var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) var fromResult = fromMethod.Invoke(null, new[] {fromValue, fromUnitValue}); // ex: Length quantity = UnitsNet.Length.From(5, LengthUnit.Meter) @@ -315,10 +315,10 @@ public static bool TryConvertByAbbreviation(FromValue fromValue, string quantity var cultureInfo = string.IsNullOrWhiteSpace(culture)? GlobalConfiguration.DefaultCulture : new CultureInfo(culture); - if(!UnitParser.TryParse(fromUnitAbbrev, unitType, cultureInfo, out var fromUnitValue)) // ex: ("m", LengthUnit) => LengthUnit.Meter + if(!UnitParser.Default.TryParse(fromUnitAbbrev, unitType, cultureInfo, out var fromUnitValue)) // ex: ("m", LengthUnit) => LengthUnit.Meter return false; - if(!UnitParser.TryParse(toUnitAbbrev, unitType, cultureInfo, out var toUnitValue)) // ex:("cm", LengthUnit) => LengthUnit.Centimeter + if(!UnitParser.Default.TryParse(toUnitAbbrev, unitType, cultureInfo, out var toUnitValue)) // ex:("cm", LengthUnit) => LengthUnit.Centimeter return false; var fromMethod = GetStaticFromMethod(quantityType, unitType); // ex: UnitsNet.Length.From(double inputValue, LengthUnit inputUnit) diff --git a/UnitsNet/UnitFormatter.cs b/UnitsNet/UnitFormatter.cs index c0da76ab51..a60e1ac65c 100644 --- a/UnitsNet/UnitFormatter.cs +++ b/UnitsNet/UnitFormatter.cs @@ -92,7 +92,7 @@ private static bool NearlyEqual(double a, double b) public static object[] GetFormatArgs(TUnitType unit, double value, [CanBeNull] IFormatProvider culture, IEnumerable args) where TUnitType : Enum { - string abbreviation = UnitAbbreviationsCache.GetDefaultAbbreviation(typeof(TUnitType), Convert.ToInt32(unit), culture); + string abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(typeof(TUnitType), Convert.ToInt32(unit), culture); return new object[] {value, abbreviation}.Concat(args).ToArray(); } } From b9f569812c9b33891ee366877215a57868f5184f Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 11 Oct 2018 18:28:16 -0400 Subject: [PATCH 053/131] Adding generic IQuantity interface for .NET Framework targets (#512) --- .../Quantities/Acceleration.NetFramework.g.cs | 2 +- .../AmountOfSubstance.NetFramework.g.cs | 2 +- .../AmplitudeRatio.NetFramework.g.cs | 2 +- .../Quantities/Angle.NetFramework.g.cs | 2 +- .../ApparentEnergy.NetFramework.g.cs | 2 +- .../ApparentPower.NetFramework.g.cs | 2 +- .../Quantities/Area.NetFramework.g.cs | 2 +- .../Quantities/AreaDensity.NetFramework.g.cs | 2 +- .../AreaMomentOfInertia.NetFramework.g.cs | 2 +- .../Quantities/BitRate.NetFramework.g.cs | 2 +- ...eSpecificFuelConsumption.NetFramework.g.cs | 2 +- .../Quantities/Capacitance.NetFramework.g.cs | 2 +- .../Quantities/Density.NetFramework.g.cs | 2 +- .../Quantities/Duration.NetFramework.g.cs | 2 +- .../DynamicViscosity.NetFramework.g.cs | 2 +- .../ElectricAdmittance.NetFramework.g.cs | 2 +- .../ElectricCharge.NetFramework.g.cs | 2 +- .../ElectricChargeDensity.NetFramework.g.cs | 2 +- .../ElectricConductance.NetFramework.g.cs | 2 +- .../ElectricConductivity.NetFramework.g.cs | 2 +- .../ElectricCurrent.NetFramework.g.cs | 2 +- .../ElectricCurrentDensity.NetFramework.g.cs | 2 +- .../ElectricCurrentGradient.NetFramework.g.cs | 2 +- .../ElectricField.NetFramework.g.cs | 2 +- .../ElectricInductance.NetFramework.g.cs | 2 +- .../ElectricPotential.NetFramework.g.cs | 2 +- .../ElectricPotentialAc.NetFramework.g.cs | 2 +- .../ElectricPotentialDc.NetFramework.g.cs | 2 +- .../ElectricResistance.NetFramework.g.cs | 2 +- .../ElectricResistivity.NetFramework.g.cs | 2 +- .../Quantities/Energy.NetFramework.g.cs | 2 +- .../Quantities/Entropy.NetFramework.g.cs | 2 +- .../Quantities/Force.NetFramework.g.cs | 2 +- .../ForceChangeRate.NetFramework.g.cs | 2 +- .../ForcePerLength.NetFramework.g.cs | 2 +- .../Quantities/Frequency.NetFramework.g.cs | 2 +- .../Quantities/HeatFlux.NetFramework.g.cs | 2 +- .../HeatTransferCoefficient.NetFramework.g.cs | 2 +- .../Quantities/Illuminance.NetFramework.g.cs | 2 +- .../Quantities/Information.NetFramework.g.cs | 2 +- .../Quantities/Irradiance.NetFramework.g.cs | 2 +- .../Quantities/Irradiation.NetFramework.g.cs | 2 +- .../KinematicViscosity.NetFramework.g.cs | 2 +- .../Quantities/LapseRate.NetFramework.g.cs | 2 +- .../Quantities/Length.NetFramework.g.cs | 2 +- .../Quantities/Level.NetFramework.g.cs | 2 +- .../LinearDensity.NetFramework.g.cs | 2 +- .../Quantities/LuminousFlux.NetFramework.g.cs | 2 +- .../LuminousIntensity.NetFramework.g.cs | 2 +- .../MagneticField.NetFramework.g.cs | 2 +- .../Quantities/MagneticFlux.NetFramework.g.cs | 2 +- .../Magnetization.NetFramework.g.cs | 2 +- .../Quantities/Mass.NetFramework.g.cs | 2 +- .../Quantities/MassFlow.NetFramework.g.cs | 2 +- .../Quantities/MassFlux.NetFramework.g.cs | 2 +- .../MassMomentOfInertia.NetFramework.g.cs | 2 +- .../Quantities/MolarEnergy.NetFramework.g.cs | 2 +- .../Quantities/MolarEntropy.NetFramework.g.cs | 2 +- .../Quantities/MolarMass.NetFramework.g.cs | 2 +- .../Quantities/Molarity.NetFramework.g.cs | 2 +- .../Quantities/Permeability.NetFramework.g.cs | 2 +- .../Quantities/Permittivity.NetFramework.g.cs | 2 +- .../Quantities/Power.NetFramework.g.cs | 2 +- .../Quantities/PowerDensity.NetFramework.g.cs | 2 +- .../Quantities/PowerRatio.NetFramework.g.cs | 2 +- .../Quantities/Pressure.NetFramework.g.cs | 2 +- .../PressureChangeRate.NetFramework.g.cs | 2 +- .../Quantities/Ratio.NetFramework.g.cs | 2 +- .../ReactiveEnergy.NetFramework.g.cs | 2 +- .../ReactivePower.NetFramework.g.cs | 2 +- .../RotationalAcceleration.NetFramework.g.cs | 2 +- .../RotationalSpeed.NetFramework.g.cs | 2 +- .../RotationalStiffness.NetFramework.g.cs | 2 +- ...tionalStiffnessPerLength.NetFramework.g.cs | 2 +- .../Quantities/SolidAngle.NetFramework.g.cs | 2 +- .../SpecificEnergy.NetFramework.g.cs | 2 +- .../SpecificEntropy.NetFramework.g.cs | 2 +- .../SpecificVolume.NetFramework.g.cs | 2 +- .../SpecificWeight.NetFramework.g.cs | 2 +- .../Quantities/Speed.NetFramework.g.cs | 2 +- .../Quantities/Temperature.NetFramework.g.cs | 2 +- .../TemperatureChangeRate.NetFramework.g.cs | 2 +- .../TemperatureDelta.NetFramework.g.cs | 2 +- .../ThermalConductivity.NetFramework.g.cs | 2 +- .../ThermalResistance.NetFramework.g.cs | 2 +- .../Quantities/Torque.NetFramework.g.cs | 2 +- .../Quantities/VitaminA.NetFramework.g.cs | 2 +- .../Quantities/Volume.NetFramework.g.cs | 2 +- .../Quantities/VolumeFlow.NetFramework.g.cs | 2 +- UnitsNet/IQuantity.cs | 20 +++++++++++++++++++ ...GenerateQuantitySourceCodeNetFramework.ps1 | 2 +- 91 files changed, 110 insertions(+), 90 deletions(-) diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 17c68035b7..f247f15815 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Acceleration : IComparable, IComparable + public partial struct Acceleration : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index b8f5b3a0a5..11e3aac790 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct AmountOfSubstance : IComparable, IComparable + public partial struct AmountOfSubstance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index b9c8db3e23..437d21b67c 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct AmplitudeRatio : IComparable, IComparable + public partial struct AmplitudeRatio : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 4f9de940f6..74917787b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Angle : IComparable, IComparable + public partial struct Angle : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index ce3dc8509c..838458cf14 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ApparentEnergy : IComparable, IComparable + public partial struct ApparentEnergy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index cbba8dc42e..cf6550efbc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ApparentPower : IComparable, IComparable + public partial struct ApparentPower : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 9b6edc1576..4af397727d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Area : IComparable, IComparable + public partial struct Area : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index cfe0a699de..1f01cb12cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct AreaDensity : IComparable, IComparable + public partial struct AreaDensity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 53ad358201..45909f9e3a 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct AreaMomentOfInertia : IComparable, IComparable + public partial struct AreaMomentOfInertia : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 5971ec1578..8300a5ae1f 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct BitRate : IComparable, IComparable + public partial struct BitRate : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 241000d0b9..d2383076a4 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct BrakeSpecificFuelConsumption : IComparable, IComparable + public partial struct BrakeSpecificFuelConsumption : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 9b3c7a0933..a6bc5a5d61 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Capacitance : IComparable, IComparable + public partial struct Capacitance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index f66ca45817..30ac2918bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Density : IComparable, IComparable + public partial struct Density : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 7a3a4fab46..eda192616c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Duration : IComparable, IComparable + public partial struct Duration : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index e1bfdd23ac..58f29dfb74 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct DynamicViscosity : IComparable, IComparable + public partial struct DynamicViscosity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index f50a5b13ba..2637c8608e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricAdmittance : IComparable, IComparable + public partial struct ElectricAdmittance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index b19e60c6de..a0e16628a1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricCharge : IComparable, IComparable + public partial struct ElectricCharge : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 1d34a16d28..f9c8e6f368 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricChargeDensity : IComparable, IComparable + public partial struct ElectricChargeDensity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 6b85a4f6f5..9d6430f04f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricConductance : IComparable, IComparable + public partial struct ElectricConductance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index d42fe704f1..6c28657095 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricConductivity : IComparable, IComparable + public partial struct ElectricConductivity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 969eab80eb..2fadb79fee 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricCurrent : IComparable, IComparable + public partial struct ElectricCurrent : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 6af4b6ad5e..f49680e522 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricCurrentDensity : IComparable, IComparable + public partial struct ElectricCurrentDensity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 0925c10eee..84665d5ce5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricCurrentGradient : IComparable, IComparable + public partial struct ElectricCurrentGradient : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 34422cbe13..3033cacdc5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricField : IComparable, IComparable + public partial struct ElectricField : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 71a13074cb..0e5a4690e1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricInductance : IComparable, IComparable + public partial struct ElectricInductance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index a1e80720d4..81b7e4f924 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricPotential : IComparable, IComparable + public partial struct ElectricPotential : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index ae3dd8e3b8..c857cef0ac 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricPotentialAc : IComparable, IComparable + public partial struct ElectricPotentialAc : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 14aeef4d40..549722a1f4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricPotentialDc : IComparable, IComparable + public partial struct ElectricPotentialDc : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index e04e3a48fb..9b8e54d810 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricResistance : IComparable, IComparable + public partial struct ElectricResistance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index 17aab17c43..91ee605ed8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ElectricResistivity : IComparable, IComparable + public partial struct ElectricResistivity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 489cc3ae42..7ae3ecd70d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Energy : IComparable, IComparable + public partial struct Energy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 3fca77f43b..bd3d2a87f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Entropy : IComparable, IComparable + public partial struct Entropy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 5a0bb18cb1..4b1acf6a0a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Force : IComparable, IComparable + public partial struct Force : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 122bf832af..52835a3b82 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ForceChangeRate : IComparable, IComparable + public partial struct ForceChangeRate : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index ceb715a729..4eb1c5e4e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ForcePerLength : IComparable, IComparable + public partial struct ForcePerLength : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index f3b88f7823..e1ae32b742 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Frequency : IComparable, IComparable + public partial struct Frequency : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 0231e6db80..370c65da6a 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct HeatFlux : IComparable, IComparable + public partial struct HeatFlux : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index dfd78a967f..3e864e6baa 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct HeatTransferCoefficient : IComparable, IComparable + public partial struct HeatTransferCoefficient : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 00fd3d118e..751b940cb4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Illuminance : IComparable, IComparable + public partial struct Illuminance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index c04c5c21b3..baea4e37a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Information : IComparable, IComparable + public partial struct Information : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 6e67586fe6..962574267a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Irradiance : IComparable, IComparable + public partial struct Irradiance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index b3e2c0c909..419ee94fe7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Irradiation : IComparable, IComparable + public partial struct Irradiation : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index 132d645d22..0610bebcd2 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct KinematicViscosity : IComparable, IComparable + public partial struct KinematicViscosity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index b3846512b8..cf80796e79 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct LapseRate : IComparable, IComparable + public partial struct LapseRate : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index b7c77fa5a5..80b4b27345 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Length : IComparable, IComparable + public partial struct Length : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index c29d8ffad0..ba248341cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Level : IComparable, IComparable + public partial struct Level : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 2916b154ed..253a582c42 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct LinearDensity : IComparable, IComparable + public partial struct LinearDensity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 9d8920230d..12b9be30fb 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct LuminousFlux : IComparable, IComparable + public partial struct LuminousFlux : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index a72b8799a6..62913332ad 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct LuminousIntensity : IComparable, IComparable + public partial struct LuminousIntensity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index facf165281..970f491c6c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MagneticField : IComparable, IComparable + public partial struct MagneticField : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 762bca7ae5..57ee7c46fd 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MagneticFlux : IComparable, IComparable + public partial struct MagneticFlux : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 811e928e87..c5c4c12841 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Magnetization : IComparable, IComparable + public partial struct Magnetization : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index de72d48d67..0a88a65ae3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Mass : IComparable, IComparable + public partial struct Mass : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index d85b0d9d79..103f0d63f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MassFlow : IComparable, IComparable + public partial struct MassFlow : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 5b2df59052..bad877a07a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MassFlux : IComparable, IComparable + public partial struct MassFlux : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 3b101edaa9..f85c419198 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MassMomentOfInertia : IComparable, IComparable + public partial struct MassMomentOfInertia : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 6dd15a91bc..8df0479d37 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MolarEnergy : IComparable, IComparable + public partial struct MolarEnergy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 64af88145d..ce5a9a68e0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MolarEntropy : IComparable, IComparable + public partial struct MolarEntropy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index fbdcf735da..42bc823494 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct MolarMass : IComparable, IComparable + public partial struct MolarMass : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index bedab70433..dbd04ee3a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Molarity : IComparable, IComparable + public partial struct Molarity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index ad0c7c80f4..3904708915 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Permeability : IComparable, IComparable + public partial struct Permeability : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index fb607f4362..38495d9867 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Permittivity : IComparable, IComparable + public partial struct Permittivity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index a685a662a8..58cf0caa82 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Power : IComparable, IComparable + public partial struct Power : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 2d00a4b257..45f742ab03 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct PowerDensity : IComparable, IComparable + public partial struct PowerDensity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index a84a589612..e91b1fd7d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct PowerRatio : IComparable, IComparable + public partial struct PowerRatio : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index ec7fca9073..074fada39d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Pressure : IComparable, IComparable + public partial struct Pressure : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 4d383d8f23..59acca488c 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct PressureChangeRate : IComparable, IComparable + public partial struct PressureChangeRate : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 48fd4f0e0c..6e2fb123e6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Ratio : IComparable, IComparable + public partial struct Ratio : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 83daf56a96..43c8a649b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ReactiveEnergy : IComparable, IComparable + public partial struct ReactiveEnergy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index c9ce36cb18..3ea8162612 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ReactivePower : IComparable, IComparable + public partial struct ReactivePower : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 33ba321bf4..165eb92efb 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct RotationalAcceleration : IComparable, IComparable + public partial struct RotationalAcceleration : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 04edff4b44..74ac35275c 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct RotationalSpeed : IComparable, IComparable + public partial struct RotationalSpeed : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index a152130c88..dd15bbbd92 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct RotationalStiffness : IComparable, IComparable + public partial struct RotationalStiffness : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index a2dea7df02..e28db557a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct RotationalStiffnessPerLength : IComparable, IComparable + public partial struct RotationalStiffnessPerLength : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 80225f8aed..7403d45a1c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct SolidAngle : IComparable, IComparable + public partial struct SolidAngle : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 56b28c4f3c..4d721814b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct SpecificEnergy : IComparable, IComparable + public partial struct SpecificEnergy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 3427d39572..948fbbf877 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct SpecificEntropy : IComparable, IComparable + public partial struct SpecificEntropy : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index d21734ffbb..8c31e296ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct SpecificVolume : IComparable, IComparable + public partial struct SpecificVolume : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 465bc22c3d..cf5fbcbd09 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct SpecificWeight : IComparable, IComparable + public partial struct SpecificWeight : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 464bed263a..9d3d61588d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Speed : IComparable, IComparable + public partial struct Speed : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 2b35a5d5cd..a3b946d63f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Temperature : IComparable, IComparable + public partial struct Temperature : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 1808c6edff..ab265b9594 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct TemperatureChangeRate : IComparable, IComparable + public partial struct TemperatureChangeRate : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 59f8c1616f..83dacde89b 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct TemperatureDelta : IComparable, IComparable + public partial struct TemperatureDelta : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 3d46274d40..c91072a95e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ThermalConductivity : IComparable, IComparable + public partial struct ThermalConductivity : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 461efae1c8..bde8f9178a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct ThermalResistance : IComparable, IComparable + public partial struct ThermalResistance : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 905fdeee46..be91c9e053 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Torque : IComparable, IComparable + public partial struct Torque : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 41922e4b2d..228ce93fde 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct VitaminA : IComparable, IComparable + public partial struct VitaminA : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 0daf2c5859..a187469cdd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Volume : IComparable, IComparable + public partial struct Volume : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 7f2402d932..ba55a32703 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -48,7 +48,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct VolumeFlow : IComparable, IComparable + public partial struct VolumeFlow : IQuantity, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index e49f7f7ee3..07d0c250a0 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -19,6 +19,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; + namespace UnitsNet { /// @@ -42,4 +44,22 @@ BaseDimensions Dimensions get; } } + +#if !WINDOWS_UWP + public interface IQuantity : IQuantity where UnitType : Enum + { + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + double As(UnitType unit); + + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + string ToString(UnitType unit); + } +#endif } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 328952bbd5..b846dd74be 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -60,7 +60,7 @@ namespace UnitsNet /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct $quantityName : IComparable, IComparable<$quantityName> + public partial struct $quantityName : IQuantity<$unitEnumName>, IComparable, IComparable<$quantityName> { /// /// The numeric value this quantity was constructed with. From 4a6783230057bf6fb450526f1e6d4e1daf898f3e Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 12 Oct 2018 10:19:45 -0400 Subject: [PATCH 054/131] Matching behavior in tests to previous ones. Adding [Collection(nameof(UnitSystemFixture))] to prevent running in parallel as other tests were modifying the default abbreviation cache and causing wrong formats to be provided --- UnitsNet.Tests/CustomCode/ParseTests.cs | 15 ++++---- UnitsNet.Tests/UnitSystemTests.cs | 37 +++++++++---------- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 4 +- .../CustomCode/UnitValueAbbreviationLookup.cs | 18 ++++----- 4 files changed, 35 insertions(+), 39 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 7ddaea57d3..c8186b73db 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -33,6 +33,7 @@ namespace UnitsNet.Tests.CustomCode /// reasonable to assume that testing one unit class would cover /// all of them. Obviously, that can change in the future. /// + [Collection(nameof(UnitSystemFixture))] public class ParseTests { [Theory] @@ -188,12 +189,12 @@ public void TryParseLengthUnitAbbreviationSpecialCharacters(string s) { string abbrev = $"m{s}s"; - var unitAbbreviationsCache = new UnitAbbreviationsCache(); - unitAbbreviationsCache.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); + //var unitAbbreviationsCache = new UnitAbbreviationsCache(); + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act - var parser = new UnitParser(unitAbbreviationsCache); - bool ok = parser.TryParse(abbrev, out LengthUnit result); + //var parser = new UnitParser(unitAbbreviationsCache); + bool ok = UnitParser.Default.TryParse(abbrev, out LengthUnit result); // Assert Assert.True(ok, "TryParse " + abbrev); @@ -218,12 +219,10 @@ public void TryParseLengthSpecialCharacters(string s) { string abbrev = $"m{s}s"; - var tempCulture = (CultureInfo)(new CultureInfo("en-US").Clone()); - - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, tempCulture, abbrev ); + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, abbrev ); // Act - bool ok = Length.TryParse($"10 {abbrev}", tempCulture, out Length result); + var ok = Length.TryParse($"10 {abbrev}", out var result); // Assert Assert.True(ok, $"TryParse \"10 {abbrev}\""); diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index bace29a674..fdcc4767cf 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -72,12 +72,14 @@ private static IEnumerable GetUnitTypesWithMissingAbbreviations unitValues) where TUnitType : Enum { + var culture = GetCulture(cultureName); var unitsMissingAbbreviations = new List(); - foreach (var unit in unitValues) + + foreach(var unit in unitValues) { try { - UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, culture); } catch { @@ -159,11 +161,11 @@ public void DecimalPointDigitGroupingCultureFormatting(string culture) [InlineData("cm^^2", AreaUnit.SquareCentimeter)] public void Parse_ReturnsUnitMappedByCustomAbbreviation(string customAbbreviation, AreaUnit expected) { - var unitAbbreviationsCache = new UnitAbbreviationsCache(); - unitAbbreviationsCache.MapUnitToAbbreviation(expected, customAbbreviation); + //var unitAbbreviationsCache = new UnitAbbreviationsCache(); + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(expected, customAbbreviation); - var parser = new UnitParser(unitAbbreviationsCache); - var actual = parser.Parse(customAbbreviation); + //var parser = new UnitParser(unitAbbreviationsCache); + var actual = UnitParser.Default.Parse(customAbbreviation); Assert.Equal(expected, actual); } @@ -399,15 +401,16 @@ public void ToString_WithRussianCulture() [Fact] public void GetDefaultAbbreviationFallsBackToDefaultStringIfNotSpecified() { - string abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(CustomUnit.Unit1); + var unitAbbreviationCache = new UnitAbbreviationsCache(); + string abbreviation = unitAbbreviationCache.GetDefaultAbbreviation(CustomUnit.Unit1, AmericanCulture); Assert.Equal("(no abbreviation for CustomUnit.Unit1)", abbreviation); } [Fact] public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() { - CultureInfo oldCurrentCulture = CultureInfo.CurrentCulture; - CultureInfo oldCurrentUICulture = CultureInfo.CurrentUICulture; + var oldCurrentCulture = CultureInfo.CurrentCulture; + var oldCurrentUICulture = CultureInfo.CurrentUICulture; try { @@ -417,13 +420,10 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() var zuluCulture = new CultureInfo("zu-ZA"); CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = zuluCulture; - var americanCulture = new CultureInfo(AmericanCultureName); - - var unitAbbreviationsCache = new UnitAbbreviationsCache(); - unitAbbreviationsCache.MapUnitToAbbreviation(CustomUnit.Unit1, americanCulture, "US english abbreviation for Unit1"); + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(CustomUnit.Unit1, AmericanCulture, "US english abbreviation for Unit1"); // Act - string abbreviation = unitAbbreviationsCache.GetDefaultAbbreviation(CustomUnit.Unit1, zuluCulture); + string abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(CustomUnit.Unit1, zuluCulture); // Assert Assert.Equal("US english abbreviation for Unit1", abbreviation); @@ -438,12 +438,9 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() [Fact] public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviationForAlreadyMappedUnits() { - var americanCulture = new CultureInfo(AmericanCultureName); - - var unitAbbreviationsCache = new UnitAbbreviationsCache(); - unitAbbreviationsCache.MapUnitToAbbreviation(AreaUnit.SquareMeter, americanCulture, "m^2"); + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(AreaUnit.SquareMeter, AmericanCulture, "m^2"); - Assert.Equal("m²", unitAbbreviationsCache.GetDefaultAbbreviation(AreaUnit.SquareMeter)); + Assert.Equal("m²", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(AreaUnit.SquareMeter)); } [Fact] @@ -463,7 +460,7 @@ public void Parse_AmbiguousUnitsThrowsException() [Fact] public void Parse_UnambiguousUnitsDoesNotThrow() { - Volume unit = Volume.Parse("1 l"); + var unit = Volume.Parse("1 l"); Assert.Equal(Volume.FromLiters(1), unit); } diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index 03c2015d93..777f61508f 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -176,7 +176,7 @@ string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatP var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); if(lookup == null) - return $"(no abbreviation for {unitType.Name}.{unit})"; + return formatProvider != FallbackCulture ? GetDefaultAbbreviation( unit, FallbackCulture ) : $"(no abbreviation for {unitType.Name}.{unit})"; var abbreviations = lookup.GetAbbreviationsForUnit(unit); if(abbreviations.Count == 0) @@ -204,7 +204,7 @@ string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider form { var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); if(lookup == null) - return $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; + return formatProvider != FallbackCulture ? GetDefaultAbbreviation( unitType, unitValue, FallbackCulture ) : $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); if(abbreviations.Count == 0) diff --git a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs index 4c8ba40540..012abee1b5 100644 --- a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs +++ b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs @@ -45,7 +45,7 @@ internal string[] GetAllAbbreviations() return unitToAbbreviationMap.Values.SelectMany((abbreviations) => { return abbreviations; - } ).ToArray(); + } ).Distinct().ToArray(); } internal List GetAbbreviationsForUnit(UnitType unit) where UnitType : Enum @@ -58,7 +58,7 @@ internal List GetAbbreviationsForUnit(int unit) if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviations)) unitToAbbreviationMap[unit] = abbreviations = new List(); - return abbreviations; + return abbreviations.Distinct().ToList(); } internal List GetUnitsForAbbreviation(string abbreviation) @@ -66,19 +66,19 @@ internal List GetUnitsForAbbreviation(string abbreviation) if(!abbreviationToUnitMap.TryGetValue(abbreviation, out var units)) abbreviationToUnitMap[abbreviation] = units = new List(); - return units; + return units.Distinct().ToList(); } internal void Add(int unit, string abbreviation) { - if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviations)) - abbreviations = unitToAbbreviationMap[unit] = new List(); + if(!unitToAbbreviationMap.TryGetValue(unit, out var abbreviationsForUnit)) + abbreviationsForUnit = unitToAbbreviationMap[unit] = new List(); - if(!abbreviationToUnitMap.TryGetValue(abbreviation, out var units)) - abbreviationToUnitMap[abbreviation] = units = new List(); + if(!abbreviationToUnitMap.TryGetValue(abbreviation, out var unitsForAbbreviation)) + abbreviationToUnitMap[abbreviation] = unitsForAbbreviation = new List(); - abbreviations.Add(abbreviation); - units.Add(unit); + abbreviationsForUnit.Add(abbreviation); + unitsForAbbreviation.Add(unit); } } } From 6d86563bbdec943d96b0073a4b0d7ef20c513255 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 12 Oct 2018 11:17:01 -0400 Subject: [PATCH 055/131] Removing commented code --- UnitsNet.Tests/CustomCode/ParseTests.cs | 2 -- UnitsNet.Tests/UnitSystemTests.cs | 2 -- 2 files changed, 4 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index c8186b73db..20e74ca4d7 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -189,11 +189,9 @@ public void TryParseLengthUnitAbbreviationSpecialCharacters(string s) { string abbrev = $"m{s}s"; - //var unitAbbreviationsCache = new UnitAbbreviationsCache(); UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act - //var parser = new UnitParser(unitAbbreviationsCache); bool ok = UnitParser.Default.TryParse(abbrev, out LengthUnit result); // Assert diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index fdcc4767cf..2372bf11fd 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -161,10 +161,8 @@ public void DecimalPointDigitGroupingCultureFormatting(string culture) [InlineData("cm^^2", AreaUnit.SquareCentimeter)] public void Parse_ReturnsUnitMappedByCustomAbbreviation(string customAbbreviation, AreaUnit expected) { - //var unitAbbreviationsCache = new UnitAbbreviationsCache(); UnitAbbreviationsCache.Default.MapUnitToAbbreviation(expected, customAbbreviation); - //var parser = new UnitParser(unitAbbreviationsCache); var actual = UnitParser.Default.Parse(customAbbreviation); Assert.Equal(expected, actual); } From 2d9e9c2cd31875f21169a90a21619406bc853e49 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 12 Oct 2018 13:20:43 -0400 Subject: [PATCH 056/131] Fixing XML documentation --- .../Acceleration.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...mountOfSubstance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../AmplitudeRatio.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Angle.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ApparentEnergy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ApparentPower.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Quantities/Area.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../AreaDensity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...aMomentOfInertia.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../BitRate.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...cFuelConsumption.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Capacitance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Density.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Duration.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...DynamicViscosity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ectricAdmittance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ElectricCharge.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ricChargeDensity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ctricConductance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...tricConductivity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ElectricCurrent.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...icCurrentDensity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...cCurrentGradient.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ElectricField.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ectricInductance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...lectricPotential.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ctricPotentialAc.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ctricPotentialDc.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ectricResistance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ctricResistivity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Energy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Entropy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Force.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ForceChangeRate.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ForcePerLength.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Frequency.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../HeatFlux.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...nsferCoefficient.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Illuminance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Information.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Irradiance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Irradiation.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...nematicViscosity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../LapseRate.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Length.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Level.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../LinearDensity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../LuminousFlux.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...uminousIntensity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../MagneticField.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../MagneticFlux.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Magnetization.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Quantities/Mass.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../MassFlow.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../MassFlux.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...sMomentOfInertia.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../MolarEnergy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../MolarEntropy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../MolarMass.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Molarity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Permeability.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Permittivity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Power.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../PowerDensity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../PowerRatio.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Pressure.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...essureChangeRate.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Ratio.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ReactiveEnergy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../ReactivePower.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...onalAcceleration.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../RotationalSpeed.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ationalStiffness.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...iffnessPerLength.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../SolidAngle.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../SpecificEnergy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../SpecificEntropy.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../SpecificVolume.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../SpecificWeight.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Speed.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Temperature.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...ratureChangeRate.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...TemperatureDelta.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...rmalConductivity.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- ...hermalResistance.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Torque.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../VitaminA.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Volume.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../VolumeFlow.WindowsRuntimeComponent.g.cs | 16 ++++++++-------- .../Quantities/Acceleration.NetFramework.g.cs | 16 ++++++++-------- .../AmountOfSubstance.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/AmplitudeRatio.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Angle.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ApparentEnergy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ApparentPower.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Area.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/AreaDensity.NetFramework.g.cs | 16 ++++++++-------- .../AreaMomentOfInertia.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/BitRate.NetFramework.g.cs | 16 ++++++++-------- ...rakeSpecificFuelConsumption.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Capacitance.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Density.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Duration.NetFramework.g.cs | 16 ++++++++-------- .../DynamicViscosity.NetFramework.g.cs | 16 ++++++++-------- .../ElectricAdmittance.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ElectricCharge.NetFramework.g.cs | 16 ++++++++-------- .../ElectricChargeDensity.NetFramework.g.cs | 16 ++++++++-------- .../ElectricConductance.NetFramework.g.cs | 16 ++++++++-------- .../ElectricConductivity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ElectricCurrent.NetFramework.g.cs | 16 ++++++++-------- .../ElectricCurrentDensity.NetFramework.g.cs | 16 ++++++++-------- .../ElectricCurrentGradient.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ElectricField.NetFramework.g.cs | 16 ++++++++-------- .../ElectricInductance.NetFramework.g.cs | 16 ++++++++-------- .../ElectricPotential.NetFramework.g.cs | 16 ++++++++-------- .../ElectricPotentialAc.NetFramework.g.cs | 16 ++++++++-------- .../ElectricPotentialDc.NetFramework.g.cs | 16 ++++++++-------- .../ElectricResistance.NetFramework.g.cs | 16 ++++++++-------- .../ElectricResistivity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Energy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Entropy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Force.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ForceChangeRate.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ForcePerLength.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Frequency.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/HeatFlux.NetFramework.g.cs | 16 ++++++++-------- .../HeatTransferCoefficient.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Illuminance.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Information.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Irradiance.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Irradiation.NetFramework.g.cs | 16 ++++++++-------- .../KinematicViscosity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/LapseRate.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Length.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Level.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/LinearDensity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/LuminousFlux.NetFramework.g.cs | 16 ++++++++-------- .../LuminousIntensity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/MagneticField.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/MagneticFlux.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Magnetization.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Mass.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/MassFlow.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/MassFlux.NetFramework.g.cs | 16 ++++++++-------- .../MassMomentOfInertia.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/MolarEnergy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/MolarEntropy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/MolarMass.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Molarity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Permeability.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Permittivity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Power.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/PowerDensity.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/PowerRatio.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Pressure.NetFramework.g.cs | 16 ++++++++-------- .../PressureChangeRate.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Ratio.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ReactiveEnergy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/ReactivePower.NetFramework.g.cs | 16 ++++++++-------- .../RotationalAcceleration.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/RotationalSpeed.NetFramework.g.cs | 16 ++++++++-------- .../RotationalStiffness.NetFramework.g.cs | 16 ++++++++-------- ...otationalStiffnessPerLength.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/SolidAngle.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/SpecificEnergy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/SpecificEntropy.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/SpecificVolume.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/SpecificWeight.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Speed.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Temperature.NetFramework.g.cs | 16 ++++++++-------- .../TemperatureChangeRate.NetFramework.g.cs | 16 ++++++++-------- .../TemperatureDelta.NetFramework.g.cs | 16 ++++++++-------- .../ThermalConductivity.NetFramework.g.cs | 16 ++++++++-------- .../ThermalResistance.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Torque.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/VitaminA.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/Volume.NetFramework.g.cs | 16 ++++++++-------- .../Quantities/VolumeFlow.NetFramework.g.cs | 16 ++++++++-------- ...de-GenerateQuantitySourceCodeNetFramework.ps1 | 16 ++++++++-------- ...QuantitySourceCodeWindowsRuntimeComponent.ps1 | 16 ++++++++-------- 180 files changed, 1440 insertions(+), 1440 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index d3d2212a46..a45c494ec5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Acceleration() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] string c /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Acceleration Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureN /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AccelerationUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] string cultureName, in /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index 4da424e064..214f8bbc0e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public AmountOfSubstance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] str /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] string cultureName /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cul /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] string cultureNam /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] string cultureNam /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index c9270a8538..1e7448a359 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public AmplitudeRatio() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AmplitudeRatioUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 5036e53c96..a2f2b72365 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Angle() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AngleUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] string cultureN /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Angle Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AngleUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(AngleUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(AngleUnit unit, [CanBeNull] string cultureName, int signi /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 24b31c0617..d2efb99122 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ApparentEnergy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ApparentEnergy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ApparentEnergyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 72fb2c1bef..b46b1ae749 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ApparentPower() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ApparentPower Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string culture /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ApparentPowerUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] string cultureName, i /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index cb6d72caea..a576fd4523 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Area() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] string cultureNa /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Area Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AreaUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(AreaUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(AreaUnit unit, [CanBeNull] string cultureName, int signif /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index 7e28efb832..679d22895e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public AreaDensity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] string cu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static AreaDensity Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureNa /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AreaDensityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index fc6e9f9902..b5b83dee33 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public AreaMomentOfInertia() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 0f875ab24a..72de41bbeb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public BitRate() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] string cultur /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static BitRate Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(BitRateUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] string cultureName, int sig /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 2160df5d95..857bb74135 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public BrakeSpecificFuelConsumption() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] string /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 94fcb0b36e..99170ac0d0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Capacitance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] string cu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Capacitance Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureNa /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(CapacitanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index 1794f2a44f..6542afa116 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Density() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DensityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] string cultur /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Density Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(DensityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(DensityUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(DensityUnit unit, [CanBeNull] string cultureName, int sig /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index af28ffc607..bfa821c8df 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Duration() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DurationUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] string cultu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Duration Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(DurationUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(DurationUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(DurationUnit unit, [CanBeNull] string cultureName, int si /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index c3a4ab5fca..b8f7423ec0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public DynamicViscosity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] stri /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static DynamicViscosity Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cult /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(DynamicViscosityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] string cultureName /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] string cultureName /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index ed03518d17..f98848f31b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricAdmittance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] st /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] string cultureNam /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] string cultureNa /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] string cultureNa /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 9365baaad6..e55c73587c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricCharge() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricCharge Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricChargeUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 509ae88774..6bc5551015 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricChargeDensity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] string culture /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] string cultur /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] string cultur /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index ebf6ac5b03..3b34579952 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricConductance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricConductance Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricConductanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index adb498b27f..fabebf025b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricConductivity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricConductivity Parse(string str, [CanBeNull] string cultureN /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricConductivityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] string culture /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] string culture /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 48ed28a513..58ee6674d4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricCurrent() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] strin /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricCurrent Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricCurrentUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index e4d84162be..e953d96a71 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricCurrentDensity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] string cultur /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] strin /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] string cultu /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] string cultu /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 3017be3239..c23ebe7d81 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricCurrentGradient() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] string cultu /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] stri /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] string cult /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] string cult /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index 331c07b4aa..68259cc6b8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricField() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricField Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string culture /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricFieldUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] string cultureName, i /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index eeb669c921..4595158219 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricInductance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] st /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricInductance Parse(string str, [CanBeNull] string cultureNam /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricInductanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] string cultureNa /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] string cultureNa /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index a27f3d9e38..f0ff11138f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricPotential() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] str /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricPotential Parse(string str, [CanBeNull] string cultureName /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cul /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricPotentialUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] string cultureNam /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] string cultureNam /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 259ba4a547..66623baf00 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricPotentialAc() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 1b5f2f6ddc..c1a2dd5bc2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricPotentialDc() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index 5fea52fa15..768d40145d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricResistance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] st /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricResistance Parse(string str, [CanBeNull] string cultureNam /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricResistanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] string cultureNa /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] string cultureNa /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index 90c88d527b..8ab4d1d871 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ElectricResistivity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ElectricResistivity Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricResistivityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index afeee41670..6a940453a1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Energy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] string culture /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Energy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(EnergyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] string cultureName, int sign /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 93cbd769ae..8bcf4aff38 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Entropy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] string cultur /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Entropy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(EntropyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] string cultureName, int sig /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index d56bd5414c..6bf4b59dbd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Force() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] string cultureN /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Force Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ForceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ForceUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ForceUnit unit, [CanBeNull] string cultureName, int signi /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index eee5d4a37a..38c6c80748 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ForceChangeRate() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] strin /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ForceChangeRate Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ForceChangeRateUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index 2f58de763a..18e43de5a2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ForcePerLength() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ForcePerLength Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ForcePerLengthUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index c807d00919..3fba3e57d3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Frequency() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] string cult /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Frequency Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(FrequencyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] string cultureName, int s /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 83592800e8..9125a8f131 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public HeatFlux() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] string cultu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static HeatFlux Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(HeatFluxUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] string cultureName, int si /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index fb471c80fb..a901cebe96 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public HeatTransferCoefficient() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] string cultu /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] stri /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] string cult /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] string cult /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index b26e54eb80..b0a2196fe0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Illuminance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] string cu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Illuminance Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureNa /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(IlluminanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index 4b9a8667aa..e79efac2f0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Information() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(InformationUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] string cu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Information Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureNa /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(InformationUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(InformationUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(InformationUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index 174012ea9f..6adb423de1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Irradiance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] string cul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Irradiance Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureNam /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(IrradianceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 5763e4b6af..3703575edf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Irradiation() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] string cu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Irradiation Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureNa /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(IrradiationUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 6e36d35404..711b5b0248 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public KinematicViscosity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] st /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static KinematicViscosity Parse(string str, [CanBeNull] string cultureNam /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(KinematicViscosityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] string cultureNa /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] string cultureNa /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index 449268027d..beeee3a548 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public LapseRate() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] string cult /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static LapseRate Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LapseRateUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] string cultureName, int s /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 1d44338323..c4cfae8972 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Length() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LengthUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] string culture /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Length Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LengthUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(LengthUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(LengthUnit unit, [CanBeNull] string cultureName, int sign /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index c60a2ac451..5f81235665 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Level() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LevelUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] string cultureN /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Level Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LevelUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(LevelUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(LevelUnit unit, [CanBeNull] string cultureName, int signi /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 5493ea8b86..136a143111 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public LinearDensity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static LinearDensity Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string culture /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LinearDensityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] string cultureName, i /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 5dfe071b48..50c52d4883 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public LuminousFlux() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] string c /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static LuminousFlux Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureN /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LuminousFluxUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] string cultureName, in /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index c40325194c..ec61f3d2ed 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public LuminousIntensity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] str /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static LuminousIntensity Parse(string str, [CanBeNull] string cultureName /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cul /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LuminousIntensityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] string cultureNam /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] string cultureNam /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index a5190e0166..dc2cfbec14 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MagneticField() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MagneticField Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string culture /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MagneticFieldUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] string cultureName, i /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 63426964ad..0c4db90b0a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MagneticFlux() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] string c /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MagneticFlux Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureN /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MagneticFluxUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] string cultureName, in /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index 2d5b84adaa..df6122df15 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Magnetization() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Magnetization Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string culture /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MagnetizationUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] string cultureName, i /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 712f6ff3b3..dd88588d64 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Mass() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] string cultureNa /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Mass Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MassUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MassUnit unit, [CanBeNull] string cultureName, int signif /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index 5c67104615..a3c27c6f8f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MassFlow() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] string cultu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MassFlow Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName, int si /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index dc56146423..e87cd58a63 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MassFlux() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] string cultu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MassFlux Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassFluxUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] string cultureName, int si /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index 469d291d79..73f219fccb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MassMomentOfInertia() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index 3b578ddeff..120b9ba32f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MolarEnergy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] string cu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MolarEnergy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureNa /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarEnergyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 02e0c6651a..d348b24e1f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MolarEntropy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] string c /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MolarEntropy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureN /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarEntropyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] string cultureName, in /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index 1e30d9aad3..d5618bfbac 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public MolarMass() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] string cult /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static MolarMass Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarMassUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] string cultureName, int s /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index b7d8ad5382..197fa15f13 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Molarity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] string cultu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Molarity Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] string cultureName, int si /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index b257e73ac5..c68ae6bffc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Permeability() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] string c /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Permeability Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureN /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PermeabilityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] string cultureName, in /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index e2ddaa78dd..8716115ce4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Permittivity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] string c /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Permittivity Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureN /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PermittivityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] string cultureName, in /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index bde99ca61a..8a5aaac6d3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Power() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] string cultureN /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Power Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PowerUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(PowerUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(PowerUnit unit, [CanBeNull] string cultureName, int signi /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 72622645aa..512a92ef7e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public PowerDensity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] string c /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static PowerDensity Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureN /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PowerDensityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] string cultureName, in /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index 445dc4987a..a5037f3441 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public PowerRatio() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] string cul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static PowerRatio Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureNam /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PowerRatioUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 215e4fbff9..9397ffd2ab 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Pressure() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PressureUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] string cultu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Pressure Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PressureUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(PressureUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(PressureUnit unit, [CanBeNull] string cultureName, int si /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index c4a66e7ab7..fdf0439fe6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public PressureChangeRate() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] st /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static PressureChangeRate Parse(string str, [CanBeNull] string cultureNam /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PressureChangeRateUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] string cultureNa /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] string cultureNa /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 1b7545d5bb..4bced5a9cc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Ratio() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RatioUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] string cultureN /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Ratio Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RatioUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(RatioUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(RatioUnit unit, [CanBeNull] string cultureName, int signi /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index e3bb377b5d..664aa9064d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ReactiveEnergy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ReactiveEnergyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 162cd0797e..cbe699321f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ReactivePower() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ReactivePower Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string culture /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ReactivePowerUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] string cultureName, i /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index c90cbe6a26..3c1c4e1e05 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public RotationalAcceleration() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] string cultur /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] strin /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalAccelerationUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] string cultu /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] string cultu /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 56b88c20b9..5468f1c1ac 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public RotationalSpeed() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] strin /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static RotationalSpeed Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalSpeedUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index 012227d3eb..e2d8a74511 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public RotationalStiffness() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static RotationalStiffness Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index 785266428c..6d9cd67bf2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public RotationalStiffnessPerLength() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] string /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index df48f6d637..f939656416 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public SolidAngle() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] string cul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static SolidAngle Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureNam /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SolidAngleUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index 48838d794f..d0eb1b0a00 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public SpecificEnergy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static SpecificEnergy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificEnergyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 2322be408b..8fb3035be0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public SpecificEntropy() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] strin /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static SpecificEntropy Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultu /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificEntropyUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index 493b494770..121a9dd36a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public SpecificVolume() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static SpecificVolume Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificVolumeUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index 30730d151a..5f54dad281 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public SpecificWeight() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] string /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static SpecificWeight Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultur /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificWeightUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] string cultureName, /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 67c2fc8bf3..a858b0b9ff 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Speed() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] string cultureN /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Speed Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpeedUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] string cultureName, int signi /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index 9625122fe6..30753ab9bd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Temperature() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] string cu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Temperature Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureNa /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TemperatureUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index 710be255b6..3380443ca3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public TemperatureChangeRate() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] string culture /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] string cultur /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] string cultur /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 6ae270222f..336838a71d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public TemperatureDelta() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] stri /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static TemperatureDelta Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cult /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TemperatureDeltaUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] string cultureName /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] string cultureName /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index a4e48ad02a..e6614e1faa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ThermalConductivity() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] s /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ThermalConductivity Parse(string str, [CanBeNull] string cultureNa /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string c /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ThermalConductivityUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] string cultureN /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] string cultureN /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index d2e143d2a3..c3be673b8a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public ThermalResistance() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] str /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static ThermalResistance Parse(string str, [CanBeNull] string cultureName /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cul /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ThermalResistanceUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] string cultureNam /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] string cultureNam /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index 42d5684138..1a3a81870b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Torque() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] string culture /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Torque Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TorqueUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] string cultureName, int sign /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 0a31e87f1b..a8525698dd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public VitaminA() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] string cultu /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static VitaminA Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(VitaminAUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] string cultureName, int si /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 2086f59c7a..83c489e9c3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public Volume() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] string culture /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static Volume Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(VolumeUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] string cultureName, int sign /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 7a3e8b4b4a..4bb74d2535 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -75,7 +75,7 @@ public VolumeFlow() /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] string cultureName) @@ -92,7 +92,7 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] string cul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -125,7 +125,7 @@ public static VolumeFlow Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -142,7 +142,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureNam /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -182,7 +182,7 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(VolumeFlowUnit unit, [CanBeNull] string cultureName) { @@ -193,7 +193,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] string cultureName) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -207,7 +207,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] string cultureName, int /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index eae3f0217e..e0d03f88d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Acceleration : IQuantity, IComparable, I /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static AccelerationUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index d0b6db3400..596bbf331a 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct AmountOfSubstance : IQuantity, ICom /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static AmountOfSubstanceUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index 01de3337a4..9831a12fcd 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct AmplitudeRatio : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) @@ -140,7 +140,7 @@ public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -168,7 +168,7 @@ public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -183,7 +183,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -198,7 +198,7 @@ public static AmplitudeRatioUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -217,7 +217,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) { @@ -228,7 +228,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -242,7 +242,7 @@ public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 6760d03e32..fe22eb9bb5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Angle : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static AngleUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 37a0b6b5fd..9a1222eafb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ApparentEnergy : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ApparentEnergyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 205fdc6c0f..57dccceec8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ApparentPower : IQuantity, IComparable, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ApparentPowerUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 4586d63775..5d3e334154 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Area : IQuantity, IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Area Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static AreaUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index d542aaa8af..d86e306a85 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct AreaDensity : IQuantity, IComparable, ICo /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static AreaDensityUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index fe1b1fde47..e946f82fed 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct AreaMomentOfInertia : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static AreaMomentOfInertiaUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 359d090e57..1d3aa67fba 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct BitRate : IQuantity, IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvid /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static BitRateUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider, i /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 7584c3323f..b48dee1a68 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct BrakeSpecificFuelConsumption : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [Can /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IForma /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IForma /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 90b1b976b6..e0e1033fd6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Capacitance : IQuantity, IComparable, ICo /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static CapacitanceUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index b8f9268f89..d3736f1b92 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Density : IQuantity, IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvid /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Density Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static DensityUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider, i /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 1ac7ca34ed..cbfb3a0180 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Duration : IQuantity, IComparable, IComparab /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static DurationUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index f1cfd25e56..3690948760 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct DynamicViscosity : IQuantity, ICompa /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFor /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider pro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static DynamicViscosityUnit ParseUnit(string str, IFormatProvider provide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider pr /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider pr /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 08936fb065..3fcc8c49da 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricAdmittance : IQuantity, IC /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricAdmittanceUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index 118474aaab..d8090f6f81 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricCharge : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricChargeUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 012b9b3207..227179e559 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricChargeDensity : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricChargeDensityUnit ParseUnit(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 2c45e88ff8..c045a2d192 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricConductance : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricConductanceUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 9d2454a3e8..c18a48035f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricConductivity : IQuantity /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricConductivityUnit ParseUnit(string str, IFormatProvider pro /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index a1d10abc7e..11cf2c1d65 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricCurrent : IQuantity, ICompara /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricCurrentUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 8a15995213..0e62d6135c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricCurrentDensity : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricCurrentDensityUnit ParseUnit(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index f3fb2ab200..6ef5cefa3d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricCurrentGradient : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricCurrentGradientUnit ParseUnit(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProv /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProv /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index a2b7a2d348..6c72290465 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricField : IQuantity, IComparable, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricFieldUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 92feb13a02..17fc45bc3d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricInductance : IQuantity, IC /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricInductanceUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index 1912527a7e..71dbaf29bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricPotential : IQuantity, ICom /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricPotentialUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index 38aa78caf4..255233f3dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricPotentialAc : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricPotentialAcUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 6bf08ce116..926ef6f3f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricPotentialDc : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricPotentialDcUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index b044b29d2a..3afd5122b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricResistance : IQuantity, IC /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricResistanceUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index 16ac26c74e..ec96e90f0c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ElectricResistivity : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ElectricResistivityUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 0a910bd61b..7c4b11676a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Energy : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static EnergyUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index f53969a2c2..2d87ca690e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Entropy : IQuantity, IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvid /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static EntropyUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider, i /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 0645759ed4..f159cc97df 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Force : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Force Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ForceUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 5fbddc48e8..fa1dc47d4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ForceChangeRate : IQuantity, ICompara /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ForceChangeRateUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 2ca6345015..ef1dd5e594 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ForcePerLength : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ForcePerLengthUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index ad0f6b9fda..b98dc90358 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Frequency : IQuantity, IComparable, ICompar /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProv /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static FrequencyUnit ParseUnit(string str, IFormatProvider provider = nul /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index f61b3bd249..c2cc3171ce 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct HeatFlux : IQuantity, IComparable, IComparab /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static HeatFluxUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 76d3e4a0da..6f1cbff42b 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct HeatTransferCoefficient : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNul /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static HeatTransferCoefficientUnit ParseUnit(string str, IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProv /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProv /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index ecefb855ac..b05cf37df7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Illuminance : IQuantity, IComparable, ICo /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static IlluminanceUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 44f62f4205..bce1c207a8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Information : IQuantity, IComparable, ICo /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Information Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static InformationUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index aa5886ac65..33cb41231e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Irradiance : IQuantity, IComparable, IComp /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static IrradianceUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 5170402f0d..a25b0768b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Irradiation : IQuantity, IComparable, ICo /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static IrradiationUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index 0267a5fe6a..cd436e2d91 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct KinematicViscosity : IQuantity, IC /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static KinematicViscosityUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 9e79786aa0..2ae477073f 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct LapseRate : IQuantity, IComparable, ICompar /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProv /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static LapseRateUnit ParseUnit(string str, IFormatProvider provider = nul /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 939426c1b8..02136fc7f6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Length : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Length Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static LengthUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index b114b25ec1..92fb22feab 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Level : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider provider) @@ -140,7 +140,7 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -168,7 +168,7 @@ public static Level Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -183,7 +183,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -198,7 +198,7 @@ public static LevelUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -217,7 +217,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LevelU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider) { @@ -228,7 +228,7 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -242,7 +242,7 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index c3aff94ab8..24b1954401 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct LinearDensity : IQuantity, IComparable, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static LinearDensityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 4ce73579f2..8515eea26b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct LuminousFlux : IQuantity, IComparable, I /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static LuminousFluxUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 5c7a80bafe..f72029b842 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct LuminousIntensity : IQuantity, ICom /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static LuminousIntensityUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index f673d98609..bee35db212 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MagneticField : IQuantity, IComparable, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MagneticFieldUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 6d5e2322f2..14a2e5dd17 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MagneticFlux : IQuantity, IComparable, I /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MagneticFluxUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 15090595d3..9a3d3d1c1d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Magnetization : IQuantity, IComparable, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MagnetizationUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 573de4588a..17f601c6a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Mass : IQuantity, IComparable, IComparable /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MassUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 9e39305bd1..4c9521793f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MassFlow : IQuantity, IComparable, IComparab /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MassFlowUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index c4fa94c14a..ce3f1b33dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MassFlux : IQuantity, IComparable, IComparab /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MassFluxUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index a55aefcdd1..a5275cbcc1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MassMomentOfInertia : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MassMomentOfInertiaUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index b8a1d24c95..764df4ac93 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MolarEnergy : IQuantity, IComparable, ICo /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MolarEnergyUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 8e18049334..9743cb951a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MolarEntropy : IQuantity, IComparable, I /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MolarEntropyUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index b0b81099cd..3e45048445 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct MolarMass : IQuantity, IComparable, ICompar /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProv /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MolarMassUnit ParseUnit(string str, IFormatProvider provider = nul /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 67e7b00271..28331ff265 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Molarity : IQuantity, IComparable, IComparab /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static MolarityUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index d730c1fa89..6948b9a7ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Permeability : IQuantity, IComparable, I /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Permeability Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static PermeabilityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 371c658d25..d3a0b0bd31 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Permittivity : IQuantity, IComparable, I /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static PermittivityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 940ea1336a..7b9d90e6aa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Power : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Power Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static PowerUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 2ec49ddab1..e2cf704591 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct PowerDensity : IQuantity, IComparable, I /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatP /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static PowerDensityUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 03e5571da5..938b3b1cb3 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct PowerRatio : IQuantity, IComparable, IComp /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) @@ -140,7 +140,7 @@ public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -168,7 +168,7 @@ public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -183,7 +183,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -198,7 +198,7 @@ public static PowerRatioUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -217,7 +217,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerR /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) { @@ -228,7 +228,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -242,7 +242,7 @@ public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 09beceb53c..1a6336cb21 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Pressure : IQuantity, IComparable, IComparab /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static PressureUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index e373babd0e..9dcb51be29 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct PressureChangeRate : IQuantity, IC /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IF /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider p /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static PressureChangeRateUnit ParseUnit(string str, IFormatProvider provi /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index ae1fdcefd0..f84e5a5413 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Ratio : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static RatioUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index f2717f4bff..09c76f52f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ReactiveEnergy : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ReactiveEnergyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index d1d41bbe8f..a18fac198e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ReactivePower : IQuantity, IComparable, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormat /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ReactivePowerUnit ParseUnit(string str, IFormatProvider provider = /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 48584b0995..323a07ba49 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct RotationalAcceleration : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvid /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static RotationalAccelerationUnit ParseUnit(string str, IFormatProvider p /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvi /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvi /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 159eb38477..64340a1738 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct RotationalSpeed : IQuantity, ICompara /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static RotationalSpeedUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index 0730417acb..c87ee978ee 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct RotationalStiffness : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static RotationalStiffnessUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index 34f84220cf..890d852ccf 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct RotationalStiffnessPerLength : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [Can /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormat /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProv /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IForma /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IForma /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index c35981d11d..97ede7078d 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct SolidAngle : IQuantity, IComparable, IComp /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static SolidAngleUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 7ff7e899a4..2fbd3a02bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct SpecificEnergy : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static SpecificEnergyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 855fdae855..e34d2a598b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct SpecificEntropy : IQuantity, ICompara /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IForm /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider prov /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static SpecificEntropyUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider pro /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider pro /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 22d0a15caa..9e41de61c9 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct SpecificVolume : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static SpecificVolumeUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 455b263f5f..0d55548287 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct SpecificWeight : IQuantity, IComparabl /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IForma /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provi /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static SpecificWeightUnit ParseUnit(string str, IFormatProvider provider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider prov /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider prov /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index d27a141c56..da700edf4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Speed : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static SpeedUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index b1b4abaf29..14deecd463 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Temperature : IQuantity, IComparable, ICo /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) @@ -93,7 +93,7 @@ public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatPr /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -121,7 +121,7 @@ public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -136,7 +136,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -151,7 +151,7 @@ public static TemperatureUnit ParseUnit(string str, IFormatProvider provider = n /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -170,7 +170,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) { @@ -181,7 +181,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -195,7 +195,7 @@ public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 080a24c6f9..ced55e78c7 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct TemperatureChangeRate : IQuantity /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvide /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static TemperatureChangeRateUnit ParseUnit(string str, IFormatProvider pr /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvid /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvid /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index a184047b9e..66cc79764a 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct TemperatureDelta : IQuantity, ICompa /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFor /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider pro /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static TemperatureDeltaUnit ParseUnit(string str, IFormatProvider provide /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider pr /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider pr /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index cedf82e2b2..53cbf33e51 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ThermalConductivity : IQuantity, /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] I /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ThermalConductivityUnit ParseUnit(string str, IFormatProvider prov /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index f241d1466e..6c8b039a6b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct ThermalResistance : IQuantity, ICom /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFo /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider pr /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static ThermalResistanceUnit ParseUnit(string str, IFormatProvider provid /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider p /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider p /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 3c89f3636d..9f3b86de1b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Torque : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static TorqueUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 5b0a30d151..7cf2605ffb 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct VitaminA : IQuantity, IComparable, IComparab /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvi /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static VitaminAUnit ParseUnit(string str, IFormatProvider provider = null /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider, /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 6ecae4663f..2af23f07e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct Volume : IQuantity, IComparable, IComparable /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvide /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static VolumeUnit ParseUnit(string str, IFormatProvider provider = null) /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 7287fd8337..a012a9d203 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -59,7 +59,7 @@ public partial struct VolumeFlow : IQuantity, IComparable, IComp /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) @@ -132,7 +132,7 @@ public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatPro /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -160,7 +160,7 @@ public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -175,7 +175,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -190,7 +190,7 @@ public static VolumeFlowUnit ParseUnit(string str, IFormatProvider provider = nu /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -209,7 +209,7 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) { @@ -220,7 +220,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -234,7 +234,7 @@ public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 2425b89915..050d62b676 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -71,7 +71,7 @@ namespace UnitsNet /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to . + /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation($unitEnumName unit, [CanBeNull] IFormatProvider provider) @@ -151,7 +151,7 @@ namespace UnitsNet /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -179,7 +179,7 @@ namespace UnitsNet /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// @@ -194,7 +194,7 @@ namespace UnitsNet /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -209,7 +209,7 @@ namespace UnitsNet /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . + /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -228,7 +228,7 @@ namespace UnitsNet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider) { @@ -239,7 +239,7 @@ namespace UnitsNet /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -253,7 +253,7 @@ namespace UnitsNet /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to . + /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 index bbd1692147..b7e7d54fb5 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 @@ -87,7 +87,7 @@ namespace UnitsNet /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. [UsedImplicitly] public static string GetAbbreviation($unitEnumName unit, [CanBeNull] string cultureName) @@ -104,7 +104,7 @@ namespace UnitsNet /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -137,7 +137,7 @@ namespace UnitsNet /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); @@ -154,7 +154,7 @@ namespace UnitsNet /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// @@ -172,7 +172,7 @@ namespace UnitsNet /// Try to parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// @@ -194,7 +194,7 @@ namespace UnitsNet /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. public string ToString($unitEnumName unit, [CanBeNull] string cultureName) { @@ -205,7 +205,7 @@ namespace UnitsNet /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. [UsedImplicitly] @@ -219,7 +219,7 @@ namespace UnitsNet /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to 's default culture. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. From e429c29405ff540c992109f716d33f1b4967c27e Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 12 Oct 2018 13:30:23 -0400 Subject: [PATCH 057/131] Breaking apart/renaming test classes to match library --- UnitsNet.Tests/CustomCode/LengthTests.cs | 2 +- UnitsNet.Tests/CustomCode/ParseTests.cs | 4 +- UnitsNet.Tests/QuantityTests.ToString.cs | 2 +- .../UnitAbbreviationsCacheFixture.cs | 16 +++ ...ests.cs => UnitAbbreviationsCacheTests.cs} | 107 +-------------- UnitsNet.Tests/UnitParserTests.cs | 127 ++++++++++++++++++ UnitsNet.Tests/UnitSystemFixture.cs | 18 --- 7 files changed, 152 insertions(+), 124 deletions(-) create mode 100644 UnitsNet.Tests/UnitAbbreviationsCacheFixture.cs rename UnitsNet.Tests/{UnitSystemTests.cs => UnitAbbreviationsCacheTests.cs} (74%) create mode 100644 UnitsNet.Tests/UnitParserTests.cs delete mode 100644 UnitsNet.Tests/UnitSystemFixture.cs diff --git a/UnitsNet.Tests/CustomCode/LengthTests.cs b/UnitsNet.Tests/CustomCode/LengthTests.cs index f427b12387..83faafb8c1 100644 --- a/UnitsNet.Tests/CustomCode/LengthTests.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.cs @@ -27,7 +27,7 @@ namespace UnitsNet.Tests.CustomCode // Avoid accessing static prop DefaultToString in parallel from multiple tests: // UnitSystemTests.DefaultToStringFormatting() // LengthTests.ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit() - [Collection(nameof(UnitSystemFixture))] + [Collection(nameof(UnitAbbreviationsCacheFixture))] public class LengthTests : LengthTestsBase { protected override double CentimetersInOneMeter => 100; diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 20e74ca4d7..04da5f999e 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -21,8 +21,8 @@ using System; using System.Globalization; -using Xunit; using UnitsNet.Units; +using Xunit; namespace UnitsNet.Tests.CustomCode { @@ -33,7 +33,7 @@ namespace UnitsNet.Tests.CustomCode /// reasonable to assume that testing one unit class would cover /// all of them. Obviously, that can change in the future. /// - [Collection(nameof(UnitSystemFixture))] + [Collection(nameof(UnitAbbreviationsCacheFixture))] public class ParseTests { [Theory] diff --git a/UnitsNet.Tests/QuantityTests.ToString.cs b/UnitsNet.Tests/QuantityTests.ToString.cs index c5df4717cd..970fccb3a6 100644 --- a/UnitsNet.Tests/QuantityTests.ToString.cs +++ b/UnitsNet.Tests/QuantityTests.ToString.cs @@ -25,7 +25,7 @@ namespace UnitsNet.Tests { - [Collection(nameof(UnitSystemFixture))] + [Collection(nameof(UnitAbbreviationsCacheFixture))] public partial class QuantityTests { public class ToStringTests diff --git a/UnitsNet.Tests/UnitAbbreviationsCacheFixture.cs b/UnitsNet.Tests/UnitAbbreviationsCacheFixture.cs new file mode 100644 index 0000000000..ce7a36b980 --- /dev/null +++ b/UnitsNet.Tests/UnitAbbreviationsCacheFixture.cs @@ -0,0 +1,16 @@ +using Xunit; + +namespace UnitsNet.Tests +{ + [CollectionDefinition(nameof(UnitAbbreviationsCacheFixture), DisableParallelization = true)] + public class UnitAbbreviationsCacheFixture : ICollectionFixture + { + // This class has no code, and is never created. Its purpose is simply + // to be the place to apply [CollectionDefinition] and all the + // ICollectionFixture<> interfaces. + + // Apply this collection fixture to classes: + // 1. That rely on manipulating CultureInfo. See https://github.com/angularsen/UnitsNet/issues/436 + // 2. To avoid accessing static ToString/Parse from multiple tests where UnitAbbreviationsCache.Default is modified + } +} diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs similarity index 74% rename from UnitsNet.Tests/UnitSystemTests.cs rename to UnitsNet.Tests/UnitAbbreviationsCacheTests.cs index 2372bf11fd..93191f96e7 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs @@ -21,16 +21,16 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; -using Xunit; using UnitsNet.Units; +using Xunit; using Xunit.Abstractions; -using System.Globalization; namespace UnitsNet.Tests { - [Collection(nameof(UnitSystemFixture))] - public class UnitSystemTests + [Collection(nameof(UnitAbbreviationsCacheFixture))] + public class UnitAbbreviationsCacheTests { private readonly ITestOutputHelper _output; private const string AmericanCultureName = "en-US"; @@ -41,7 +41,7 @@ public class UnitSystemTests private static readonly IFormatProvider NorwegianCulture = new CultureInfo(NorwegianCultureName); private static readonly IFormatProvider RussianCulture = new CultureInfo(RussianCultureName); - public UnitSystemTests(ITestOutputHelper output) + public UnitAbbreviationsCacheTests(ITestOutputHelper output) { _output = output; } @@ -156,23 +156,6 @@ public void DecimalPointDigitGroupingCultureFormatting(string culture) Assert.Equal("1.111 m", Length.FromMeters(1111).ToString(LengthUnit.Meter, GetCulture(culture))); } - [Theory] - [InlineData("m^^2", AreaUnit.SquareMeter)] - [InlineData("cm^^2", AreaUnit.SquareCentimeter)] - public void Parse_ReturnsUnitMappedByCustomAbbreviation(string customAbbreviation, AreaUnit expected) - { - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(expected, customAbbreviation); - - var actual = UnitParser.Default.Parse(customAbbreviation); - Assert.Equal(expected, actual); - } - - [Fact] - public void Parse_UnknownAbbreviationThrowsUnitNotFoundException() - { - Assert.Throws(() => UnitParser.Default.Parse("nonexistingunit")); - } - [Theory] [InlineData(1, "1.1 m")] [InlineData(2, "1.12 m")] @@ -247,64 +230,6 @@ public void ScientificNotationUpperIntervalFormatting(double value, string expec Assert.Equal(expected, actual); } - [Fact] - public void ShouldUseCorrectMicroSign() - { - // "\u00b5" = Micro sign - Assert.Equal(AccelerationUnit.MicrometerPerSecondSquared, Acceleration.ParseUnit("\u00b5m/s²")); - Assert.Equal(AmplitudeRatioUnit.DecibelMicrovolt, AmplitudeRatio.ParseUnit("dB\u00b5V")); - Assert.Equal(AngleUnit.Microdegree, Angle.ParseUnit("\u00b5°")); - Assert.Equal(AngleUnit.Microradian, Angle.ParseUnit("\u00b5rad")); - Assert.Equal(AreaUnit.SquareMicrometer, Area.ParseUnit("\u00b5m²")); - Assert.Equal(DurationUnit.Microsecond, Duration.ParseUnit("\u00b5s")); - Assert.Equal(ElectricCurrentUnit.Microampere, ElectricCurrent.ParseUnit("\u00b5A")); - Assert.Equal(ElectricPotentialUnit.Microvolt, ElectricPotential.ParseUnit("\u00b5V")); - Assert.Equal(ForceChangeRateUnit.MicronewtonPerSecond, ForceChangeRate.ParseUnit("\u00b5N/s")); - Assert.Equal(ForcePerLengthUnit.MicronewtonPerMeter, ForcePerLength.ParseUnit("\u00b5N/m")); - Assert.Equal(KinematicViscosityUnit.Microstokes, KinematicViscosity.ParseUnit("\u00b5St")); - Assert.Equal(LengthUnit.Microinch, Length.ParseUnit("\u00b5in")); - Assert.Equal(LengthUnit.Micrometer, Length.ParseUnit("\u00b5m")); - Assert.Equal(MassFlowUnit.MicrogramPerSecond, MassFlow.ParseUnit("\u00b5g/S")); - Assert.Equal(MassUnit.Microgram, Mass.ParseUnit("\u00b5g")); - Assert.Equal(PowerUnit.Microwatt, Power.ParseUnit("\u00b5W")); - Assert.Equal(PressureUnit.Micropascal, Pressure.ParseUnit("\u00b5Pa")); - Assert.Equal(RotationalSpeedUnit.MicrodegreePerSecond, RotationalSpeed.ParseUnit("\u00b5°/s")); - Assert.Equal(RotationalSpeedUnit.MicroradianPerSecond, RotationalSpeed.ParseUnit("\u00b5rad/s")); - Assert.Equal(SpeedUnit.MicrometerPerMinute, Speed.ParseUnit("\u00b5m/min")); - Assert.Equal(SpeedUnit.MicrometerPerSecond, Speed.ParseUnit("\u00b5m/s")); - Assert.Equal(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, TemperatureChangeRate.ParseUnit("\u00b5°C/s")); - Assert.Equal(VolumeUnit.Microliter, Volume.ParseUnit("\u00b5l")); - Assert.Equal(VolumeUnit.CubicMicrometer, Volume.ParseUnit("\u00b5m³")); - Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, VolumeFlow.ParseUnit("\u00b5LPM")); - - // "\u03bc" = Lower case greek letter 'Mu' - Assert.Throws(() => Acceleration.ParseUnit("\u03bcm/s²")); - Assert.Throws(() => AmplitudeRatio.ParseUnit("dB\u03bcV")); - Assert.Throws(() => Angle.ParseUnit("\u03bc°")); - Assert.Throws(() => Angle.ParseUnit("\u03bcrad")); - Assert.Throws(() => Area.ParseUnit("\u03bcm²")); - Assert.Throws(() => Duration.ParseUnit("\u03bcs")); - Assert.Throws(() => ElectricCurrent.ParseUnit("\u03bcA")); - Assert.Throws(() => ElectricPotential.ParseUnit("\u03bcV")); - Assert.Throws(() => ForceChangeRate.ParseUnit("\u03bcN/s")); - Assert.Throws(() => ForcePerLength.ParseUnit("\u03bcN/m")); - Assert.Throws(() => KinematicViscosity.ParseUnit("\u03bcSt")); - Assert.Throws(() => Length.ParseUnit("\u03bcin")); - Assert.Throws(() => Length.ParseUnit("\u03bcm")); - Assert.Throws(() => MassFlow.ParseUnit("\u03bcg/S")); - Assert.Throws(() => Mass.ParseUnit("\u03bcg")); - Assert.Throws(() => Power.ParseUnit("\u03bcW")); - Assert.Throws(() => Pressure.ParseUnit("\u03bcPa")); - Assert.Throws(() => RotationalSpeed.ParseUnit("\u03bc°/s")); - Assert.Throws(() => RotationalSpeed.ParseUnit("\u03bcrad/s")); - Assert.Throws(() => Speed.ParseUnit("\u03bcm/min")); - Assert.Throws(() => Speed.ParseUnit("\u03bcm/s")); - Assert.Throws(() => TemperatureChangeRate.ParseUnit("\u03bc°C/s")); - Assert.Throws(() => Volume.ParseUnit("\u03bcl")); - Assert.Throws(() => Volume.ParseUnit("\u03bcm³")); - Assert.Throws(() => VolumeFlow.ParseUnit("\u03bcLPM")); - } - [Theory] [InlineData("en-US")] [InlineData("nb-NO")] @@ -441,28 +366,6 @@ public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviati Assert.Equal("m²", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(AreaUnit.SquareMeter)); } - [Fact] - public void Parse_AmbiguousUnitsThrowsException() - { - // Act 1 - var exception1 = Assert.Throws(() => UnitParser.Default.Parse("pt")); - - // Act 2 - var exception2 = Assert.Throws(() => Length.Parse("1 pt")); - - // Assert - Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception1.Message); - Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception2.Message); - } - - [Fact] - public void Parse_UnambiguousUnitsDoesNotThrow() - { - var unit = Volume.Parse("1 l"); - - Assert.Equal(Volume.FromLiters(1), unit); - } - /// /// Convenience method to the proper culture parameter type. /// diff --git a/UnitsNet.Tests/UnitParserTests.cs b/UnitsNet.Tests/UnitParserTests.cs new file mode 100644 index 0000000000..bd717addd2 --- /dev/null +++ b/UnitsNet.Tests/UnitParserTests.cs @@ -0,0 +1,127 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using UnitsNet.Units; +using Xunit; + +namespace UnitsNet.Tests +{ + [Collection( nameof( UnitAbbreviationsCacheFixture ) )] + public class UnitParserTests + { + [Theory] + [InlineData("m^^2", AreaUnit.SquareMeter)] + [InlineData("cm^^2", AreaUnit.SquareCentimeter)] + public void Parse_ReturnsUnitMappedByCustomAbbreviation(string customAbbreviation, AreaUnit expected) + { + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(expected, customAbbreviation); + + var actual = UnitParser.Default.Parse(customAbbreviation); + Assert.Equal(expected, actual); + } + + [Fact] + public void Parse_UnknownAbbreviationThrowsUnitNotFoundException() + { + Assert.Throws(() => UnitParser.Default.Parse("nonexistingunit")); + } + + [Fact] + public void ShouldUseCorrectMicroSign() + { + // "\u00b5" = Micro sign + Assert.Equal(AccelerationUnit.MicrometerPerSecondSquared, Acceleration.ParseUnit("\u00b5m/s²")); + Assert.Equal(AmplitudeRatioUnit.DecibelMicrovolt, AmplitudeRatio.ParseUnit("dB\u00b5V")); + Assert.Equal(AngleUnit.Microdegree, Angle.ParseUnit("\u00b5°")); + Assert.Equal(AngleUnit.Microradian, Angle.ParseUnit("\u00b5rad")); + Assert.Equal(AreaUnit.SquareMicrometer, Area.ParseUnit("\u00b5m²")); + Assert.Equal(DurationUnit.Microsecond, Duration.ParseUnit("\u00b5s")); + Assert.Equal(ElectricCurrentUnit.Microampere, ElectricCurrent.ParseUnit("\u00b5A")); + Assert.Equal(ElectricPotentialUnit.Microvolt, ElectricPotential.ParseUnit("\u00b5V")); + Assert.Equal(ForceChangeRateUnit.MicronewtonPerSecond, ForceChangeRate.ParseUnit("\u00b5N/s")); + Assert.Equal(ForcePerLengthUnit.MicronewtonPerMeter, ForcePerLength.ParseUnit("\u00b5N/m")); + Assert.Equal(KinematicViscosityUnit.Microstokes, KinematicViscosity.ParseUnit("\u00b5St")); + Assert.Equal(LengthUnit.Microinch, Length.ParseUnit("\u00b5in")); + Assert.Equal(LengthUnit.Micrometer, Length.ParseUnit("\u00b5m")); + Assert.Equal(MassFlowUnit.MicrogramPerSecond, MassFlow.ParseUnit("\u00b5g/S")); + Assert.Equal(MassUnit.Microgram, Mass.ParseUnit("\u00b5g")); + Assert.Equal(PowerUnit.Microwatt, Power.ParseUnit("\u00b5W")); + Assert.Equal(PressureUnit.Micropascal, Pressure.ParseUnit("\u00b5Pa")); + Assert.Equal(RotationalSpeedUnit.MicrodegreePerSecond, RotationalSpeed.ParseUnit("\u00b5°/s")); + Assert.Equal(RotationalSpeedUnit.MicroradianPerSecond, RotationalSpeed.ParseUnit("\u00b5rad/s")); + Assert.Equal(SpeedUnit.MicrometerPerMinute, Speed.ParseUnit("\u00b5m/min")); + Assert.Equal(SpeedUnit.MicrometerPerSecond, Speed.ParseUnit("\u00b5m/s")); + Assert.Equal(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, TemperatureChangeRate.ParseUnit("\u00b5°C/s")); + Assert.Equal(VolumeUnit.Microliter, Volume.ParseUnit("\u00b5l")); + Assert.Equal(VolumeUnit.CubicMicrometer, Volume.ParseUnit("\u00b5m³")); + Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, VolumeFlow.ParseUnit("\u00b5LPM")); + + // "\u03bc" = Lower case greek letter 'Mu' + Assert.Throws(() => Acceleration.ParseUnit("\u03bcm/s²")); + Assert.Throws(() => AmplitudeRatio.ParseUnit("dB\u03bcV")); + Assert.Throws(() => Angle.ParseUnit("\u03bc°")); + Assert.Throws(() => Angle.ParseUnit("\u03bcrad")); + Assert.Throws(() => Area.ParseUnit("\u03bcm²")); + Assert.Throws(() => Duration.ParseUnit("\u03bcs")); + Assert.Throws(() => ElectricCurrent.ParseUnit("\u03bcA")); + Assert.Throws(() => ElectricPotential.ParseUnit("\u03bcV")); + Assert.Throws(() => ForceChangeRate.ParseUnit("\u03bcN/s")); + Assert.Throws(() => ForcePerLength.ParseUnit("\u03bcN/m")); + Assert.Throws(() => KinematicViscosity.ParseUnit("\u03bcSt")); + Assert.Throws(() => Length.ParseUnit("\u03bcin")); + Assert.Throws(() => Length.ParseUnit("\u03bcm")); + Assert.Throws(() => MassFlow.ParseUnit("\u03bcg/S")); + Assert.Throws(() => Mass.ParseUnit("\u03bcg")); + Assert.Throws(() => Power.ParseUnit("\u03bcW")); + Assert.Throws(() => Pressure.ParseUnit("\u03bcPa")); + Assert.Throws(() => RotationalSpeed.ParseUnit("\u03bc°/s")); + Assert.Throws(() => RotationalSpeed.ParseUnit("\u03bcrad/s")); + Assert.Throws(() => Speed.ParseUnit("\u03bcm/min")); + Assert.Throws(() => Speed.ParseUnit("\u03bcm/s")); + Assert.Throws(() => TemperatureChangeRate.ParseUnit("\u03bc°C/s")); + Assert.Throws(() => Volume.ParseUnit("\u03bcl")); + Assert.Throws(() => Volume.ParseUnit("\u03bcm³")); + Assert.Throws(() => VolumeFlow.ParseUnit("\u03bcLPM")); + } + + [Fact] + public void Parse_AmbiguousUnitsThrowsException() + { + // Act 1 + var exception1 = Assert.Throws(() => UnitParser.Default.Parse("pt")); + + // Act 2 + var exception2 = Assert.Throws(() => Length.Parse("1 pt")); + + // Assert + Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception1.Message); + Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception2.Message); + } + + [Fact] + public void Parse_UnambiguousUnitsDoesNotThrow() + { + var unit = Volume.Parse("1 l"); + + Assert.Equal(Volume.FromLiters(1), unit); + } + } +} diff --git a/UnitsNet.Tests/UnitSystemFixture.cs b/UnitsNet.Tests/UnitSystemFixture.cs deleted file mode 100644 index a396cb0b2f..0000000000 --- a/UnitsNet.Tests/UnitSystemFixture.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Xunit; - -namespace UnitsNet.Tests -{ - [CollectionDefinition(nameof(UnitSystemFixture), DisableParallelization = true)] - public class UnitSystemFixture : ICollectionFixture - { - // This class has no code, and is never created. Its purpose is simply - // to be the place to apply [CollectionDefinition] and all the - // ICollectionFixture<> interfaces. - - // Apply this collection fixture to classes: - // 1. that rely on manipulating CultureInfo. See https://github.com/angularsen/UnitsNet/issues/436 - // 2. to avoid accessing static prop DefaultToString in parallel from multiple tests: - // a. UnitSystemTests.DefaultToStringFormatting() - // b. LengthTests.ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit() - } -} From 53ba68d980e68a0432fdf87a91f82fcd225a649a Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 12 Oct 2018 13:43:43 -0400 Subject: [PATCH 058/131] Making internal method a bool Try for ease of use --- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 28 +++++++++---------- UnitsNet/CustomCode/UnitParser.cs | 6 ++-- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index 777f61508f..395d036b2f 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -174,9 +174,8 @@ string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatP { var unitType = typeof(TUnitType); - var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); - if(lookup == null) - return formatProvider != FallbackCulture ? GetDefaultAbbreviation( unit, FallbackCulture ) : $"(no abbreviation for {unitType.Name}.{unit})"; + if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) + return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unit, FallbackCulture) : $"(no abbreviation for {unitType.Name}.{unit})"; var abbreviations = lookup.GetAbbreviationsForUnit(unit); if(abbreviations.Count == 0) @@ -202,9 +201,8 @@ string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatP #endif string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider = null) { - var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); - if(lookup == null) - return formatProvider != FallbackCulture ? GetDefaultAbbreviation( unitType, unitValue, FallbackCulture ) : $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; + if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) + return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture) : $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); if(abbreviations.Count == 0) @@ -249,8 +247,7 @@ string[] GetAllAbbreviations(Type unitType, int unitValue, IFormatProvider forma { formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; - var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); - if(lookup == null) + if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); @@ -276,24 +273,25 @@ string[] GetAllAbbreviations(Type unitType, IFormatProvider formatProvider = nul { formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; - var lookup = GetUnitValueAbbreviationLookup(unitType, formatProvider); - if(lookup == null) + if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, FallbackCulture) : new string[] { }; return lookup.GetAllAbbreviations(); } - internal UnitValueAbbreviationLookup GetUnitValueAbbreviationLookup(Type unitType, IFormatProvider formatProvider = null) + internal bool TryGetUnitValueAbbreviationLookup(Type unitType, IFormatProvider formatProvider, out UnitValueAbbreviationLookup unitToAbbreviations) { + unitToAbbreviations = null; + formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; if(!looksupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) - return formatProvider != FallbackCulture ? GetUnitValueAbbreviationLookup(unitType, FallbackCulture) : null; + return formatProvider != FallbackCulture ? TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations) : false; - if(!quantitiesForProvider.TryGetValue(unitType, out var unitToAbbreviations)) - return formatProvider != FallbackCulture ? GetUnitValueAbbreviationLookup(unitType, FallbackCulture) : null; + if(!quantitiesForProvider.TryGetValue(unitType, out unitToAbbreviations)) + return formatProvider != FallbackCulture ? TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations) : false; - return unitToAbbreviations; + return true; } } } diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index 2d01c15eaf..e3aa7aad18 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -85,8 +85,7 @@ TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider #endif object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null) { - var abbreviations = unitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); - if(abbreviations == null) + if(!unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}]."); var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); @@ -180,8 +179,7 @@ bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvide { unit = GetDefault(unitType); - var abbreviations = unitAbbreviationsCache.GetUnitValueAbbreviationLookup(unitType, formatProvider); - if(abbreviations == null) + if(!unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) return false; var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); From 8dd5866c41562eaae860389468bdb58a7cd3bf6d Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 12 Oct 2018 13:54:33 -0400 Subject: [PATCH 059/131] Use exception type with Assert.Throws --- UnitsNet.Tests/CustomCode/ParseTests.cs | 52 ++++++++++--------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 04da5f999e..6512be2852 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -50,17 +50,16 @@ public void ParseLengthToMetersUsEnglish(string s, double expected) } [Theory] - [InlineData(null, "System.ArgumentNullException")] // Can't parse null. - [InlineData("1", "System.ArgumentException")] // No unit abbreviation. - [InlineData("km", "UnitsNet.UnitsNetException")] // No value, wrong measurement type. - [InlineData("1 kg", "UnitsNet.UnitsNetException")] // Wrong measurement type. - [InlineData("1ft monkey 1in", "UnitsNet.UnitsNetException")] // Invalid separator between two valid measurements. - [InlineData("1ft 1invalid", "UnitsNet.UnitsNetException")] // Valid - public void ParseLength_InvalidString_USEnglish_ThrowsException(string s, string expected) + [InlineData(null, typeof(ArgumentNullException))] // Can't parse null. + [InlineData("1", typeof(ArgumentException))] // No unit abbreviation. + [InlineData("km", typeof(UnitsNetException))] // No value, wrong measurement type. + [InlineData("1 kg", typeof(UnitsNetException))] // Wrong measurement type. + [InlineData("1ft monkey 1in", typeof(UnitsNetException))] // Invalid separator between two valid measurements. + [InlineData("1ft 1invalid", typeof(UnitsNetException))] // Valid + public void ParseLength_InvalidString_USEnglish_ThrowsException(string s, Type expectedExceptionType) { - CultureInfo usEnglish = new CultureInfo("en-US"); - string actual = AssertExceptionAndGetFullTypeName(() => Length.Parse(s, usEnglish)); - Assert.Equal(expected, actual); + var usEnglish = new CultureInfo("en-US"); + Assert.Throws(expectedExceptionType, () => Length.Parse(s, usEnglish)); } [Theory] @@ -93,16 +92,15 @@ public void ParseWithCultureUsingSpaceAsThousandSeparators(string s, double expe } [Theory] - [InlineData("500.005.050,001 m", "UnitsNet.UnitsNetException")] + [InlineData("500.005.050,001 m", typeof(UnitsNetException))] // quantity doesn't match number format - public void ParseWithCultureUsingSpaceAsThousandSeparators_ThrowsExceptionOnInvalidString(string s, string expected) + public void ParseWithCultureUsingSpaceAsThousandSeparators_ThrowsExceptionOnInvalidString(string s, Type expectedExceptionType) { var numberFormat = (NumberFormatInfo) CultureInfo.InvariantCulture.NumberFormat.Clone(); numberFormat.NumberGroupSeparator = " "; numberFormat.NumberDecimalSeparator = "."; - string actual = AssertExceptionAndGetFullTypeName(() => Length.Parse(s, numberFormat)); - Assert.Equal(expected, actual); + Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); } /// Error parsing string. @@ -128,15 +126,14 @@ public void ParseMultiWordAbbreviations() } [Theory] - [InlineData("500 005 m", "UnitsNet.UnitsNetException")] // Quantity doesn't match number format. - public void ParseWithCultureUsingDotAsThousandSeparators_ThrowsExceptionOnInvalidString(string s, string expected) + [InlineData("500 005 m", typeof(UnitsNetException))] // Quantity doesn't match number format. + public void ParseWithCultureUsingDotAsThousandSeparators_ThrowsExceptionOnInvalidString(string s, Type expectedExceptionType) { var numberFormat = (NumberFormatInfo) CultureInfo.InvariantCulture.NumberFormat.Clone(); numberFormat.NumberGroupSeparator = "."; numberFormat.NumberDecimalSeparator = ","; - string actual = AssertExceptionAndGetFullTypeName(() => Length.Parse(s, numberFormat)); - Assert.Equal(expected, actual); + Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); } [Theory] @@ -149,13 +146,12 @@ public void ParseLengthUnitUsEnglish(string s, LengthUnit expected) } [Theory] - [InlineData("kg", "UnitsNet.UnitNotFoundException")] - [InlineData(null, "System.ArgumentNullException")] - public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string s, string expected) + [InlineData("kg", typeof(UnitNotFoundException))] + [InlineData(null, typeof(ArgumentNullException))] + public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string s, Type expectedExceptionType) { - CultureInfo usEnglish = new CultureInfo("en-US"); - string actual = AssertExceptionAndGetFullTypeName(() => Length.ParseUnit(s, usEnglish)); - Assert.Equal(expected, actual); + var usEnglish = new CultureInfo("en-US"); + Assert.Throws(expectedExceptionType, () => Length.ParseUnit(s, usEnglish)); } [Theory] @@ -217,7 +213,7 @@ public void TryParseLengthSpecialCharacters(string s) { string abbrev = $"m{s}s"; - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, abbrev ); + UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); // Act var ok = Length.TryParse($"10 {abbrev}", out var result); @@ -226,11 +222,5 @@ public void TryParseLengthSpecialCharacters(string s) Assert.True(ok, $"TryParse \"10 {abbrev}\""); Assert.Equal(10, result.Meters); } - - private static string AssertExceptionAndGetFullTypeName(Action code) - { - var exception = Assert.ThrowsAny(code); - return exception.GetType().FullName; - } } } From b7523d256ec714a66da33d2835aba39a76907043 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 12 Oct 2018 14:18:51 -0400 Subject: [PATCH 060/131] Throw NotImplementedException when no abbreviations are added for a unit. Adding a test for all units to make sure one is specified. --- .../GeneratedCode/AccelerationTestsBase.g.cs | 13 ++++ .../AmountOfSubstanceTestsBase.g.cs | 13 ++++ .../AmplitudeRatioTestsBase.g.cs | 13 ++++ .../GeneratedCode/AngleTestsBase.g.cs | 13 ++++ .../ApparentEnergyTestsBase.g.cs | 13 ++++ .../GeneratedCode/ApparentPowerTestsBase.g.cs | 13 ++++ .../GeneratedCode/AreaDensityTestsBase.g.cs | 13 ++++ .../AreaMomentOfInertiaTestsBase.g.cs | 13 ++++ .../GeneratedCode/AreaTestsBase.g.cs | 13 ++++ .../GeneratedCode/BitRateTestsBase.g.cs | 13 ++++ ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 13 ++++ .../GeneratedCode/CapacitanceTestsBase.g.cs | 13 ++++ .../GeneratedCode/DensityTestsBase.g.cs | 13 ++++ .../GeneratedCode/DurationTestsBase.g.cs | 13 ++++ .../DynamicViscosityTestsBase.g.cs | 13 ++++ .../ElectricAdmittanceTestsBase.g.cs | 13 ++++ .../ElectricChargeDensityTestsBase.g.cs | 13 ++++ .../ElectricChargeTestsBase.g.cs | 13 ++++ .../ElectricConductanceTestsBase.g.cs | 13 ++++ .../ElectricConductivityTestsBase.g.cs | 13 ++++ .../ElectricCurrentDensityTestsBase.g.cs | 13 ++++ .../ElectricCurrentGradientTestsBase.g.cs | 13 ++++ .../ElectricCurrentTestsBase.g.cs | 13 ++++ .../GeneratedCode/ElectricFieldTestsBase.g.cs | 13 ++++ .../ElectricInductanceTestsBase.g.cs | 13 ++++ .../ElectricPotentialAcTestsBase.g.cs | 13 ++++ .../ElectricPotentialDcTestsBase.g.cs | 13 ++++ .../ElectricPotentialTestsBase.g.cs | 13 ++++ .../ElectricResistanceTestsBase.g.cs | 13 ++++ .../ElectricResistivityTestsBase.g.cs | 13 ++++ .../GeneratedCode/EnergyTestsBase.g.cs | 13 ++++ .../GeneratedCode/EntropyTestsBase.g.cs | 13 ++++ .../ForceChangeRateTestsBase.g.cs | 13 ++++ .../ForcePerLengthTestsBase.g.cs | 13 ++++ .../GeneratedCode/ForceTestsBase.g.cs | 13 ++++ .../GeneratedCode/FrequencyTestsBase.g.cs | 13 ++++ .../GeneratedCode/HeatFluxTestsBase.g.cs | 13 ++++ .../HeatTransferCoefficientTestsBase.g.cs | 13 ++++ .../GeneratedCode/IlluminanceTestsBase.g.cs | 13 ++++ .../GeneratedCode/InformationTestsBase.g.cs | 13 ++++ .../GeneratedCode/IrradianceTestsBase.g.cs | 13 ++++ .../GeneratedCode/IrradiationTestsBase.g.cs | 13 ++++ .../KinematicViscosityTestsBase.g.cs | 13 ++++ .../GeneratedCode/LapseRateTestsBase.g.cs | 13 ++++ .../GeneratedCode/LengthTestsBase.g.cs | 13 ++++ .../GeneratedCode/LevelTestsBase.g.cs | 13 ++++ .../GeneratedCode/LinearDensityTestsBase.g.cs | 13 ++++ .../GeneratedCode/LuminousFluxTestsBase.g.cs | 13 ++++ .../LuminousIntensityTestsBase.g.cs | 13 ++++ .../GeneratedCode/MagneticFieldTestsBase.g.cs | 13 ++++ .../GeneratedCode/MagneticFluxTestsBase.g.cs | 13 ++++ .../GeneratedCode/MagnetizationTestsBase.g.cs | 13 ++++ .../GeneratedCode/MassFlowTestsBase.g.cs | 13 ++++ .../GeneratedCode/MassFluxTestsBase.g.cs | 13 ++++ .../MassMomentOfInertiaTestsBase.g.cs | 13 ++++ .../GeneratedCode/MassTestsBase.g.cs | 13 ++++ .../GeneratedCode/MolarEnergyTestsBase.g.cs | 13 ++++ .../GeneratedCode/MolarEntropyTestsBase.g.cs | 13 ++++ .../GeneratedCode/MolarMassTestsBase.g.cs | 13 ++++ .../GeneratedCode/MolarityTestsBase.g.cs | 13 ++++ .../GeneratedCode/PermeabilityTestsBase.g.cs | 13 ++++ .../GeneratedCode/PermittivityTestsBase.g.cs | 13 ++++ .../GeneratedCode/PowerDensityTestsBase.g.cs | 13 ++++ .../GeneratedCode/PowerRatioTestsBase.g.cs | 13 ++++ .../GeneratedCode/PowerTestsBase.g.cs | 13 ++++ .../PressureChangeRateTestsBase.g.cs | 13 ++++ .../GeneratedCode/PressureTestsBase.g.cs | 13 ++++ .../GeneratedCode/RatioTestsBase.g.cs | 13 ++++ .../ReactiveEnergyTestsBase.g.cs | 13 ++++ .../GeneratedCode/ReactivePowerTestsBase.g.cs | 13 ++++ .../RotationalAccelerationTestsBase.g.cs | 13 ++++ .../RotationalSpeedTestsBase.g.cs | 13 ++++ ...RotationalStiffnessPerLengthTestsBase.g.cs | 13 ++++ .../RotationalStiffnessTestsBase.g.cs | 13 ++++ .../GeneratedCode/SolidAngleTestsBase.g.cs | 13 ++++ .../SpecificEnergyTestsBase.g.cs | 13 ++++ .../SpecificEntropyTestsBase.g.cs | 13 ++++ .../SpecificVolumeTestsBase.g.cs | 13 ++++ .../SpecificWeightTestsBase.g.cs | 13 ++++ .../GeneratedCode/SpeedTestsBase.g.cs | 13 ++++ .../TemperatureChangeRateTestsBase.g.cs | 13 ++++ .../TemperatureDeltaTestsBase.g.cs | 13 ++++ .../GeneratedCode/TemperatureTestsBase.g.cs | 13 ++++ .../ThermalConductivityTestsBase.g.cs | 13 ++++ .../ThermalResistanceTestsBase.g.cs | 13 ++++ .../GeneratedCode/TorqueTestsBase.g.cs | 13 ++++ .../GeneratedCode/VitaminATestsBase.g.cs | 13 ++++ .../GeneratedCode/VolumeFlowTestsBase.g.cs | 13 ++++ .../GeneratedCode/VolumeTestsBase.g.cs | 13 ++++ UnitsNet.Tests/UnitAbbreviationsCacheTests.cs | 64 +------------------ UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 28 ++++++-- ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 13 ++++ 92 files changed, 1196 insertions(+), 66 deletions(-) diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs index 7b49302279..a2265bb678 100644 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs @@ -327,5 +327,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AccelerationUnit.Undefined, Acceleration.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(AccelerationUnit)).Cast(); + foreach(var unit in units) + { + if(unit == AccelerationUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs index 2129e44b09..e72fb73a08 100644 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs @@ -337,5 +337,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AmountOfSubstanceUnit.Undefined, AmountOfSubstance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(AmountOfSubstanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == AmountOfSubstanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs index 6d13762c0b..cfdaee8eca 100644 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs @@ -242,5 +242,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AmplitudeRatioUnit.Undefined, AmplitudeRatio.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(AmplitudeRatioUnit)).Cast(); + foreach(var unit in units) + { + if(unit == AmplitudeRatioUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs index 7151ec9fa2..8ef19e88cc 100644 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs @@ -337,5 +337,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AngleUnit.Undefined, Angle.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(AngleUnit)).Cast(); + foreach(var unit in units) + { + if(unit == AngleUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs index dda4932cdb..fa4c403cd7 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ApparentEnergyUnit.Undefined, ApparentEnergy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ApparentEnergyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ApparentEnergyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs index e730b2700d..061fbb9aae 100644 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs @@ -237,5 +237,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ApparentPowerUnit.Undefined, ApparentPower.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ApparentPowerUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ApparentPowerUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs index 79320935f0..b6120fd28a 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaDensityUnit.Undefined, AreaDensity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(AreaDensityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == AreaDensityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs index 2a369af9e6..10207a9f29 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs @@ -257,5 +257,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaMomentOfInertiaUnit.Undefined, AreaMomentOfInertia.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(AreaMomentOfInertiaUnit)).Cast(); + foreach(var unit in units) + { + if(unit == AreaMomentOfInertiaUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs index 9365e10f0a..205d6d77df 100644 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs @@ -327,5 +327,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(AreaUnit.Undefined, Area.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(AreaUnit)).Cast(); + foreach(var unit in units) + { + if(unit == AreaUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs index 861cda6509..3050aa4ad4 100644 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs @@ -433,5 +433,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(BitRateUnit.Undefined, BitRate.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(BitRateUnit)).Cast(); + foreach(var unit in units) + { + if(unit == BitRateUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs index 3beb3c353f..c424b3e7fb 100644 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(BrakeSpecificFuelConsumptionUnit.Undefined, BrakeSpecificFuelConsumption.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(BrakeSpecificFuelConsumptionUnit)).Cast(); + foreach(var unit in units) + { + if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs index 6385fd50a2..08850f7618 100644 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(CapacitanceUnit.Undefined, Capacitance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(CapacitanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == CapacitanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs index 3d8421eff0..7c9cfc75cb 100644 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs @@ -577,5 +577,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DensityUnit.Undefined, Density.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(DensityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == DensityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs index 2fe5abf875..72f080eb89 100644 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs @@ -297,5 +297,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DurationUnit.Undefined, Duration.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(DurationUnit)).Cast(); + foreach(var unit in units) + { + if(unit == DurationUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs index c9f9f49e86..7bfb997f2b 100644 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs @@ -257,5 +257,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(DynamicViscosityUnit.Undefined, DynamicViscosity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(DynamicViscosityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == DynamicViscosityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs index 67695b34b0..38917b9776 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs @@ -237,5 +237,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricAdmittanceUnit.Undefined, ElectricAdmittance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricAdmittanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricAdmittanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs index 4cc65d8407..9e9f244019 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricChargeDensityUnit.Undefined, ElectricChargeDensity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricChargeDensityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricChargeDensityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs index 5776d39831..eda26be3cb 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricChargeUnit.Undefined, ElectricCharge.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricChargeUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricChargeUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs index 5656a0a3ad..9ed876aeed 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricConductanceUnit.Undefined, ElectricConductance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricConductanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricConductanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs index 80e71dfe8e..ea049f0f48 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricConductivityUnit.Undefined, ElectricConductivity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricConductivityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricConductivityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs index 0c88f46b2b..dd5e6399ba 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentDensityUnit.Undefined, ElectricCurrentDensity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricCurrentDensityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricCurrentDensityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs index 1c21ecb1b0..fe5682a5fe 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentGradientUnit.Undefined, ElectricCurrentGradient.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricCurrentGradientUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricCurrentGradientUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs index 40844e8659..3fd63c38a0 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs @@ -277,5 +277,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricCurrentUnit.Undefined, ElectricCurrent.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricCurrentUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricCurrentUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs index fd5fcae774..3d74928898 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricFieldUnit.Undefined, ElectricField.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricFieldUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricFieldUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs index ac826e4163..0200aec8be 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricInductanceUnit.Undefined, ElectricInductance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricInductanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricInductanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs index 5f587aec5a..7b4d02bbcb 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs @@ -247,5 +247,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialAcUnit.Undefined, ElectricPotentialAc.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricPotentialAcUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricPotentialAcUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs index d9f293882c..35bfbf279b 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs @@ -247,5 +247,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialDcUnit.Undefined, ElectricPotentialDc.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricPotentialDcUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricPotentialDcUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs index bec6edf669..c1572878e3 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs @@ -247,5 +247,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricPotentialUnit.Undefined, ElectricPotential.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricPotentialUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricPotentialUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs index 2bf62f1204..4fc90f533c 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs @@ -237,5 +237,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricResistanceUnit.Undefined, ElectricResistance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricResistanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricResistanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs index 6cf6a8a148..d04adb92ba 100644 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs @@ -237,5 +237,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ElectricResistivityUnit.Undefined, ElectricResistivity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ElectricResistivityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ElectricResistivityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs index 62cf8b6134..697884b711 100644 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs @@ -417,5 +417,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(EnergyUnit.Undefined, Energy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(EnergyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == EnergyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs index ed7e66168b..98cd982765 100644 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs @@ -267,5 +267,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(EntropyUnit.Undefined, Entropy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(EntropyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == EntropyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs index 7cbbab3751..3aa6fd1817 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs @@ -307,5 +307,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForceChangeRateUnit.Undefined, ForceChangeRate.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ForceChangeRateUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ForceChangeRateUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs index 6810c32318..3d38fe444d 100644 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs @@ -287,5 +287,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForcePerLengthUnit.Undefined, ForcePerLength.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ForcePerLengthUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ForcePerLengthUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs index 09809b5b07..1e1e29d3a6 100644 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs @@ -297,5 +297,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ForceUnit.Undefined, Force.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ForceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ForceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs index 7bdceaceff..ab9735e592 100644 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs @@ -277,5 +277,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(FrequencyUnit.Undefined, Frequency.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(FrequencyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == FrequencyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs index 94cb0b7c13..08ad882829 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs @@ -357,5 +357,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(HeatFluxUnit.Undefined, HeatFlux.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(HeatFluxUnit)).Cast(); + foreach(var unit in units) + { + if(unit == HeatFluxUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs index 9ede5c3f94..a4d21f5b50 100644 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs @@ -217,5 +217,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(HeatTransferCoefficientUnit.Undefined, HeatTransferCoefficient.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(HeatTransferCoefficientUnit)).Cast(); + foreach(var unit in units) + { + if(unit == HeatTransferCoefficientUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs index c037e7aa74..25c2b1a2cf 100644 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs @@ -237,5 +237,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IlluminanceUnit.Undefined, Illuminance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(IlluminanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == IlluminanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 58380f674a..86a6c376d0 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -433,5 +433,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(InformationUnit.Undefined, Information.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(InformationUnit)).Cast(); + foreach(var unit in units) + { + if(unit == InformationUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs index f5051c157f..2268311347 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs @@ -217,5 +217,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IrradianceUnit.Undefined, Irradiance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(IrradianceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == IrradianceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs index e88703f095..43d552bb87 100644 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(IrradiationUnit.Undefined, Irradiation.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(IrradiationUnit)).Cast(); + foreach(var unit in units) + { + if(unit == IrradiationUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs index 5108174c1b..d33d786534 100644 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs @@ -277,5 +277,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(KinematicViscosityUnit.Undefined, KinematicViscosity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(KinematicViscosityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == KinematicViscosityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs index 0da6b54a4c..58b372765f 100644 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LapseRateUnit.Undefined, LapseRate.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(LapseRateUnit)).Cast(); + foreach(var unit in units) + { + if(unit == LapseRateUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index 6a0e2e693c..e6ec38cd20 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -417,5 +417,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LengthUnit.Undefined, Length.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(LengthUnit)).Cast(); + foreach(var unit in units) + { + if(unit == LengthUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 477f42c897..210411b811 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -222,5 +222,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LevelUnit.Undefined, Level.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(LevelUnit)).Cast(); + foreach(var unit in units) + { + if(unit == LevelUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs index 966f4b5d8c..dc840ffffa 100644 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LinearDensityUnit.Undefined, LinearDensity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(LinearDensityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == LinearDensityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs index e65918815d..dbda252867 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LuminousFluxUnit.Undefined, LuminousFlux.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(LuminousFluxUnit)).Cast(); + foreach(var unit in units) + { + if(unit == LuminousFluxUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs index 2f881bc3d9..c2148222b4 100644 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(LuminousIntensityUnit.Undefined, LuminousIntensity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(LuminousIntensityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == LuminousIntensityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs index 36025ddecd..583899910f 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagneticFieldUnit.Undefined, MagneticField.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MagneticFieldUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MagneticFieldUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs index 48bcaaa349..ccdfe5ce08 100644 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagneticFluxUnit.Undefined, MagneticFlux.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MagneticFluxUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MagneticFluxUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs index f49c7d22ba..f6c59a23fd 100644 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MagnetizationUnit.Undefined, Magnetization.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MagnetizationUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MagnetizationUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs index 576ef7cda9..5cc46b5239 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs @@ -347,5 +347,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassFlowUnit.Undefined, MassFlow.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MassFlowUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MassFlowUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs index 0aab5bf7c7..c115b35589 100644 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs @@ -217,5 +217,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassFluxUnit.Undefined, MassFlux.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MassFluxUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MassFluxUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs index a119b0e110..72152d393a 100644 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs @@ -477,5 +477,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassMomentOfInertiaUnit.Undefined, MassMomentOfInertia.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MassMomentOfInertiaUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MassMomentOfInertiaUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs index 30c958ff20..0f604d58fc 100644 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs @@ -417,5 +417,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MassUnit.Undefined, Mass.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MassUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MassUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs index 23861cf0b5..96940b97aa 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarEnergyUnit.Undefined, MolarEnergy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MolarEnergyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MolarEnergyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs index c8af96df28..c7ad28d7cd 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarEntropyUnit.Undefined, MolarEntropy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MolarEntropyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MolarEntropyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs index d2bfdca333..b52831982c 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs @@ -317,5 +317,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarMassUnit.Undefined, MolarMass.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MolarMassUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MolarMassUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs index 0243e33307..a8fe1eed37 100644 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs @@ -277,5 +277,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(MolarityUnit.Undefined, Molarity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(MolarityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == MolarityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs index 9c834ec393..69aae1e7c0 100644 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PermeabilityUnit.Undefined, Permeability.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(PermeabilityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == PermeabilityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs index 98442204f3..8c183d36af 100644 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PermittivityUnit.Undefined, Permittivity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(PermittivityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == PermittivityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs index 96469be4c8..f904dec7e3 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs @@ -637,5 +637,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerDensityUnit.Undefined, PowerDensity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(PowerDensityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == PowerDensityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs index 5887d9503e..6b544593f8 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs @@ -222,5 +222,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerRatioUnit.Undefined, PowerRatio.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(PowerRatioUnit)).Cast(); + foreach(var unit in units) + { + if(unit == PowerRatioUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs index a2e73297cc..efb6e9a3c0 100644 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs @@ -373,5 +373,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PowerUnit.Undefined, Power.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(PowerUnit)).Cast(); + foreach(var unit in units) + { + if(unit == PowerUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs index 8624f9418c..44e37ef45e 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs @@ -237,5 +237,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PressureChangeRateUnit.Undefined, PressureChangeRate.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(PressureChangeRateUnit)).Cast(); + foreach(var unit in units) + { + if(unit == PressureChangeRateUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs index db5e3e05cd..2204eb0ee3 100644 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs @@ -567,5 +567,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(PressureUnit.Undefined, Pressure.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(PressureUnit)).Cast(); + foreach(var unit in units) + { + if(unit == PressureUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs index 25a7836ef2..d3829553fb 100644 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs @@ -257,5 +257,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RatioUnit.Undefined, Ratio.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(RatioUnit)).Cast(); + foreach(var unit in units) + { + if(unit == RatioUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs index 2440cae1f4..587e16695c 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ReactiveEnergyUnit.Undefined, ReactiveEnergy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ReactiveEnergyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ReactiveEnergyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs index f8cd3e0725..4c99d361b4 100644 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs @@ -237,5 +237,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ReactivePowerUnit.Undefined, ReactivePower.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ReactivePowerUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ReactivePowerUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs index 44588aa447..8312e239ce 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalAccelerationUnit.Undefined, RotationalAcceleration.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(RotationalAccelerationUnit)).Cast(); + foreach(var unit in units) + { + if(unit == RotationalAccelerationUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs index 4cd839be52..8f109fd011 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs @@ -327,5 +327,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalSpeedUnit.Undefined, RotationalSpeed.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(RotationalSpeedUnit)).Cast(); + foreach(var unit in units) + { + if(unit == RotationalSpeedUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs index 10ccb63fde..9ab73ea579 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalStiffnessPerLengthUnit.Undefined, RotationalStiffnessPerLength.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast(); + foreach(var unit in units) + { + if(unit == RotationalStiffnessPerLengthUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs index c184492cc3..8813ed8ae6 100644 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs @@ -227,5 +227,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(RotationalStiffnessUnit.Undefined, RotationalStiffness.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(RotationalStiffnessUnit)).Cast(); + foreach(var unit in units) + { + if(unit == RotationalStiffnessUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs index 8c5c9e7036..ffef4404df 100644 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SolidAngleUnit.Undefined, SolidAngle.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(SolidAngleUnit)).Cast(); + foreach(var unit in units) + { + if(unit == SolidAngleUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs index a3eec8b439..1335fdae20 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs @@ -277,5 +277,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificEnergyUnit.Undefined, SpecificEnergy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(SpecificEnergyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == SpecificEnergyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs index 2667996816..7e26f65596 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs @@ -277,5 +277,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificEntropyUnit.Undefined, SpecificEntropy.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(SpecificEntropyUnit)).Cast(); + foreach(var unit in units) + { + if(unit == SpecificEntropyUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs index 9be33bad1f..dd4e38f4fe 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs @@ -217,5 +217,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificVolumeUnit.Undefined, SpecificVolume.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(SpecificVolumeUnit)).Cast(); + foreach(var unit in units) + { + if(unit == SpecificVolumeUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs index 7823c1cf21..c2191684bf 100644 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs @@ -367,5 +367,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpecificWeightUnit.Undefined, SpecificWeight.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(SpecificWeightUnit)).Cast(); + foreach(var unit in units) + { + if(unit == SpecificWeightUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs index 53f23afb83..d9b733b984 100644 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs @@ -517,5 +517,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(SpeedUnit.Undefined, Speed.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(SpeedUnit)).Cast(); + foreach(var unit in units) + { + if(unit == SpeedUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs index fcf47caa78..8e645c2a51 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs @@ -297,5 +297,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureChangeRateUnit.Undefined, TemperatureChangeRate.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(TemperatureChangeRateUnit)).Cast(); + foreach(var unit in units) + { + if(unit == TemperatureChangeRateUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs index db935d7004..a5bcad847b 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs @@ -277,5 +277,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureDeltaUnit.Undefined, TemperatureDelta.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(TemperatureDeltaUnit)).Cast(); + foreach(var unit in units) + { + if(unit == TemperatureDeltaUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs index 910c83bc80..d16929aaa9 100644 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs @@ -265,5 +265,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TemperatureUnit.Undefined, Temperature.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(TemperatureUnit)).Cast(); + foreach(var unit in units) + { + if(unit == TemperatureUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs index 5717714882..e7c5d0d8ab 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs @@ -217,5 +217,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ThermalConductivityUnit.Undefined, ThermalConductivity.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ThermalConductivityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs index 27591d4434..12b4acc98b 100644 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs @@ -247,5 +247,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(ThermalResistanceUnit.Undefined, ThermalResistance.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(ThermalResistanceUnit)).Cast(); + foreach(var unit in units) + { + if(unit == ThermalResistanceUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs index fc55235190..3bba357325 100644 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs @@ -407,5 +407,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(TorqueUnit.Undefined, Torque.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(TorqueUnit)).Cast(); + foreach(var unit in units) + { + if(unit == TorqueUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs index 964c3b3450..8558740f27 100644 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs @@ -207,5 +207,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VitaminAUnit.Undefined, VitaminA.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(VitaminAUnit)).Cast(); + foreach(var unit in units) + { + if(unit == VitaminAUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs index 9cd31cd02c..918bfb736d 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs @@ -457,5 +457,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VolumeFlowUnit.Undefined, VolumeFlow.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(VolumeFlowUnit)).Cast(); + foreach(var unit in units) + { + if(unit == VolumeFlowUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs index 4e34d02338..bd480669ff 100644 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs @@ -617,5 +617,18 @@ public void UnitsDoesNotContainUndefined() { Assert.DoesNotContain(VolumeUnit.Undefined, Volume.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(VolumeUnit)).Cast(); + foreach(var unit in units) + { + if(unit == VolumeUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } diff --git a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs index 93191f96e7..b42c9c4b8c 100644 --- a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs +++ b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs @@ -68,28 +68,6 @@ private enum CustomUnit // ReSharper restore UnusedMember.Local } - private static IEnumerable GetUnitTypesWithMissingAbbreviations(string cultureName, - IEnumerable unitValues) - where TUnitType : Enum - { - var culture = GetCulture(cultureName); - var unitsMissingAbbreviations = new List(); - - foreach(var unit in unitValues) - { - try - { - UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, culture); - } - catch - { - unitsMissingAbbreviations.Add(unit); - } - } - - return unitsMissingAbbreviations.Cast(); - } - // These cultures all use a comma for the radix point [Theory] [InlineData("de-DE")] @@ -230,43 +208,6 @@ public void ScientificNotationUpperIntervalFormatting(double value, string expec Assert.Equal(expected, actual); } - [Theory] - [InlineData("en-US")] - [InlineData("nb-NO")] - [InlineData("ru-RU")] - public void AllUnitAbbreviationsImplemented(string cultureName) - { - List unitValuesMissingAbbreviations = new List() - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues())) - .ToList(); - - // We want to flag if any localizations are missing, but not break the build - // or flag an error for pull requests. For now they are not considered - // critical and it is cumbersome to have a third person review the pull request - // and add in any translations before merging it in. - if (unitValuesMissingAbbreviations.Any()) - { - string unitsWithNoAbbrev = string.Join(", ", - unitValuesMissingAbbreviations.Select(unitValue => unitValue.GetType().Name + "." + unitValue).ToArray()); - - string message = "Units missing abbreviations: " + unitsWithNoAbbrev; - _output.WriteLine(message); - } - Assert.Empty(unitValuesMissingAbbreviations); - } - [Fact] public void AllUnitsImplementToStringForInvariantCulture() { @@ -322,11 +263,10 @@ public void ToString_WithRussianCulture() } [Fact] - public void GetDefaultAbbreviationFallsBackToDefaultStringIfNotSpecified() + public void GetDefaultAbbreviationThrowsNotImplementedExceptionIfNoneExist() { var unitAbbreviationCache = new UnitAbbreviationsCache(); - string abbreviation = unitAbbreviationCache.GetDefaultAbbreviation(CustomUnit.Unit1, AmericanCulture); - Assert.Equal("(no abbreviation for CustomUnit.Unit1)", abbreviation); + Assert.Throws(() => unitAbbreviationCache.GetDefaultAbbreviation(CustomUnit.Unit1)); } [Fact] diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index 395d036b2f..ee4523084d 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -175,11 +175,21 @@ string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatP var unitType = typeof(TUnitType); if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) - return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unit, FallbackCulture) : $"(no abbreviation for {unitType.Name}.{unit})"; + { + if(formatProvider != FallbackCulture) + return GetDefaultAbbreviation(unit, FallbackCulture); + else + throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}"); + } var abbreviations = lookup.GetAbbreviationsForUnit(unit); if(abbreviations.Count == 0) - return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unit, FallbackCulture) : $"(no abbreviation for {unitType.Name}.{unit})"; + { + if(formatProvider != FallbackCulture) + return GetDefaultAbbreviation(unit, FallbackCulture); + else + throw new NotImplementedException($"No abbreviation is specified for {unitType.Name}.{unit}"); + } return abbreviations.First(); } @@ -202,11 +212,21 @@ string GetDefaultAbbreviation(TUnitType unit, IFormatProvider formatP string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider formatProvider = null) { if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) - return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture) : $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; + { + if(formatProvider != FallbackCulture) + return GetDefaultAbbreviation(unitType, unitValue, FallbackCulture); + else + throw new NotImplementedException($"No abbreviation is specified for {unitType.Name} with numeric value {unitValue}."); + } var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); if(abbreviations.Count == 0) - return formatProvider != FallbackCulture ? GetDefaultAbbreviation(unitType, unitValue, FallbackCulture) : $"(no abbreviation for {unitType.Name} with numeric value {unitValue})"; + { + if(formatProvider != FallbackCulture) + return GetDefaultAbbreviation(unitType, unitValue, FallbackCulture); + else + throw new NotImplementedException($"No abbreviation is specified for {unitType.Name} with numeric value {unitValue}."); + } return abbreviations.First(); } diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index 4643a87e8f..d93612a493 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -260,6 +260,19 @@ namespace UnitsNet.Tests { Assert.DoesNotContain($unitEnumName.Undefined, $quantityName.Units); } + + [Fact] + public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof($unitEnumName)).Cast<$unitEnumName>(); + foreach(var unit in units) + { + if(unit == $unitEnumName.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } } } "@; From 46ff4e8ebc50c58cad07b25fb23a0427abadec68 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 14 Oct 2018 07:54:38 +0200 Subject: [PATCH 061/131] UnitsNet: 4.0.0-alpha4 --- .../UnitsNet.WindowsRuntimeComponent.nuspec | 2 +- UnitsNet/UnitsNet.Common.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec index a2363d3b6b..b69fc8e802 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec @@ -2,7 +2,7 @@ UnitsNet.WindowsRuntimeComponent - 4.0.0-alpha3 + 4.0.0-alpha4 Units.NET - Windows Runtime Component Andreas Gullberg Larsen Andreas Gullberg Larsen diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index 6d02af829d..92ff16127f 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -2,7 +2,7 @@ UnitsNet - 4.0.0-alpha3 + 4.0.0-alpha4 Andreas Gullberg Larsen Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. From 320263c085799c878fd4195868d18264b6c0788c Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 14 Oct 2018 07:54:44 +0200 Subject: [PATCH 062/131] JsonNet: 4.0.0-alpha4 --- .../UnitsNet.Serialization.JsonNet.Common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props index 3869e8bb9b..2854b8b1cb 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props @@ -2,7 +2,7 @@ UnitsNet.Serialization.JsonNet - 4.0.0-alpha3 + 4.0.0-alpha4 Andreas Gullberg Larsen Units.NET Serialization with Json.NET A helper library for serializing and deserializing types in Units.NET using Json.NET. From f914132239d51c0679f55bb10e0567cd92813452 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 14 Oct 2018 22:38:17 +0200 Subject: [PATCH 063/131] Ignore generated code except Length, Information, Level (#517) Length is a well known quantity with 'double' value Information is a well known quantity with 'decimal' value Level is a well known quantity with logarithmic value --- .../GeneratedCode/Quantities/.gitignore | 4 + .../Acceleration.WindowsRuntimeComponent.g.cs | 231 --------------- ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 231 --------------- ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 231 --------------- .../Angle.WindowsRuntimeComponent.g.cs | 231 --------------- ...pparentEnergy.WindowsRuntimeComponent.g.cs | 231 --------------- ...ApparentPower.WindowsRuntimeComponent.g.cs | 231 --------------- .../Area.WindowsRuntimeComponent.g.cs | 231 --------------- .../AreaDensity.WindowsRuntimeComponent.g.cs | 231 --------------- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 231 --------------- .../BitRate.WindowsRuntimeComponent.g.cs | 231 --------------- ...elConsumption.WindowsRuntimeComponent.g.cs | 231 --------------- .../Capacitance.WindowsRuntimeComponent.g.cs | 231 --------------- .../Density.WindowsRuntimeComponent.g.cs | 231 --------------- .../Duration.WindowsRuntimeComponent.g.cs | 231 --------------- ...amicViscosity.WindowsRuntimeComponent.g.cs | 231 --------------- ...ricAdmittance.WindowsRuntimeComponent.g.cs | 231 --------------- ...lectricCharge.WindowsRuntimeComponent.g.cs | 231 --------------- ...ChargeDensity.WindowsRuntimeComponent.g.cs | 231 --------------- ...icConductance.WindowsRuntimeComponent.g.cs | 231 --------------- ...cConductivity.WindowsRuntimeComponent.g.cs | 231 --------------- ...ectricCurrent.WindowsRuntimeComponent.g.cs | 231 --------------- ...urrentDensity.WindowsRuntimeComponent.g.cs | 231 --------------- ...rrentGradient.WindowsRuntimeComponent.g.cs | 231 --------------- ...ElectricField.WindowsRuntimeComponent.g.cs | 231 --------------- ...ricInductance.WindowsRuntimeComponent.g.cs | 231 --------------- ...tricPotential.WindowsRuntimeComponent.g.cs | 231 --------------- ...icPotentialAc.WindowsRuntimeComponent.g.cs | 231 --------------- ...icPotentialDc.WindowsRuntimeComponent.g.cs | 231 --------------- ...ricResistance.WindowsRuntimeComponent.g.cs | 231 --------------- ...icResistivity.WindowsRuntimeComponent.g.cs | 231 --------------- .../Energy.WindowsRuntimeComponent.g.cs | 231 --------------- .../Entropy.WindowsRuntimeComponent.g.cs | 231 --------------- .../Force.WindowsRuntimeComponent.g.cs | 231 --------------- ...rceChangeRate.WindowsRuntimeComponent.g.cs | 231 --------------- ...orcePerLength.WindowsRuntimeComponent.g.cs | 231 --------------- .../Frequency.WindowsRuntimeComponent.g.cs | 231 --------------- .../HeatFlux.WindowsRuntimeComponent.g.cs | 231 --------------- ...erCoefficient.WindowsRuntimeComponent.g.cs | 231 --------------- .../Illuminance.WindowsRuntimeComponent.g.cs | 231 --------------- .../Irradiance.WindowsRuntimeComponent.g.cs | 231 --------------- .../Irradiation.WindowsRuntimeComponent.g.cs | 231 --------------- ...aticViscosity.WindowsRuntimeComponent.g.cs | 231 --------------- .../LapseRate.WindowsRuntimeComponent.g.cs | 231 --------------- ...LinearDensity.WindowsRuntimeComponent.g.cs | 231 --------------- .../LuminousFlux.WindowsRuntimeComponent.g.cs | 231 --------------- ...nousIntensity.WindowsRuntimeComponent.g.cs | 231 --------------- ...MagneticField.WindowsRuntimeComponent.g.cs | 231 --------------- .../MagneticFlux.WindowsRuntimeComponent.g.cs | 231 --------------- ...Magnetization.WindowsRuntimeComponent.g.cs | 231 --------------- .../Mass.WindowsRuntimeComponent.g.cs | 231 --------------- .../MassFlow.WindowsRuntimeComponent.g.cs | 231 --------------- .../MassFlux.WindowsRuntimeComponent.g.cs | 231 --------------- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 231 --------------- .../MolarEnergy.WindowsRuntimeComponent.g.cs | 231 --------------- .../MolarEntropy.WindowsRuntimeComponent.g.cs | 231 --------------- .../MolarMass.WindowsRuntimeComponent.g.cs | 231 --------------- .../Molarity.WindowsRuntimeComponent.g.cs | 231 --------------- .../Permeability.WindowsRuntimeComponent.g.cs | 231 --------------- .../Permittivity.WindowsRuntimeComponent.g.cs | 231 --------------- .../Power.WindowsRuntimeComponent.g.cs | 231 --------------- .../PowerDensity.WindowsRuntimeComponent.g.cs | 231 --------------- .../PowerRatio.WindowsRuntimeComponent.g.cs | 231 --------------- .../Pressure.WindowsRuntimeComponent.g.cs | 231 --------------- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 231 --------------- .../Ratio.WindowsRuntimeComponent.g.cs | 231 --------------- ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 231 --------------- ...ReactivePower.WindowsRuntimeComponent.g.cs | 231 --------------- ...lAcceleration.WindowsRuntimeComponent.g.cs | 231 --------------- ...tationalSpeed.WindowsRuntimeComponent.g.cs | 231 --------------- ...onalStiffness.WindowsRuntimeComponent.g.cs | 231 --------------- ...nessPerLength.WindowsRuntimeComponent.g.cs | 231 --------------- .../SolidAngle.WindowsRuntimeComponent.g.cs | 231 --------------- ...pecificEnergy.WindowsRuntimeComponent.g.cs | 231 --------------- ...ecificEntropy.WindowsRuntimeComponent.g.cs | 231 --------------- ...pecificVolume.WindowsRuntimeComponent.g.cs | 231 --------------- ...pecificWeight.WindowsRuntimeComponent.g.cs | 231 --------------- .../Speed.WindowsRuntimeComponent.g.cs | 231 --------------- .../Temperature.WindowsRuntimeComponent.g.cs | 231 --------------- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 231 --------------- ...peratureDelta.WindowsRuntimeComponent.g.cs | 231 --------------- ...lConductivity.WindowsRuntimeComponent.g.cs | 231 --------------- ...malResistance.WindowsRuntimeComponent.g.cs | 231 --------------- .../Torque.WindowsRuntimeComponent.g.cs | 231 --------------- .../VitaminA.WindowsRuntimeComponent.g.cs | 231 --------------- .../Volume.WindowsRuntimeComponent.g.cs | 231 --------------- .../VolumeFlow.WindowsRuntimeComponent.g.cs | 231 --------------- UnitsNet/GeneratedCode/Quantities/.gitignore | 4 + .../Quantities/Acceleration.NetFramework.g.cs | 257 ----------------- .../AmountOfSubstance.NetFramework.g.cs | 257 ----------------- .../AmplitudeRatio.NetFramework.g.cs | 265 ------------------ .../Quantities/Angle.NetFramework.g.cs | 257 ----------------- .../ApparentEnergy.NetFramework.g.cs | 257 ----------------- .../ApparentPower.NetFramework.g.cs | 257 ----------------- .../Quantities/Area.NetFramework.g.cs | 257 ----------------- .../Quantities/AreaDensity.NetFramework.g.cs | 257 ----------------- .../AreaMomentOfInertia.NetFramework.g.cs | 257 ----------------- .../Quantities/BitRate.NetFramework.g.cs | 257 ----------------- ...eSpecificFuelConsumption.NetFramework.g.cs | 257 ----------------- .../Quantities/Capacitance.NetFramework.g.cs | 257 ----------------- .../Quantities/Density.NetFramework.g.cs | 257 ----------------- .../Quantities/Duration.NetFramework.g.cs | 257 ----------------- .../DynamicViscosity.NetFramework.g.cs | 257 ----------------- .../ElectricAdmittance.NetFramework.g.cs | 257 ----------------- .../ElectricCharge.NetFramework.g.cs | 257 ----------------- .../ElectricChargeDensity.NetFramework.g.cs | 257 ----------------- .../ElectricConductance.NetFramework.g.cs | 257 ----------------- .../ElectricConductivity.NetFramework.g.cs | 257 ----------------- .../ElectricCurrent.NetFramework.g.cs | 257 ----------------- .../ElectricCurrentDensity.NetFramework.g.cs | 257 ----------------- .../ElectricCurrentGradient.NetFramework.g.cs | 257 ----------------- .../ElectricField.NetFramework.g.cs | 257 ----------------- .../ElectricInductance.NetFramework.g.cs | 257 ----------------- .../ElectricPotential.NetFramework.g.cs | 257 ----------------- .../ElectricPotentialAc.NetFramework.g.cs | 257 ----------------- .../ElectricPotentialDc.NetFramework.g.cs | 257 ----------------- .../ElectricResistance.NetFramework.g.cs | 257 ----------------- .../ElectricResistivity.NetFramework.g.cs | 257 ----------------- .../Quantities/Energy.NetFramework.g.cs | 257 ----------------- .../Quantities/Entropy.NetFramework.g.cs | 257 ----------------- .../Quantities/Force.NetFramework.g.cs | 257 ----------------- .../ForceChangeRate.NetFramework.g.cs | 257 ----------------- .../ForcePerLength.NetFramework.g.cs | 257 ----------------- .../Quantities/Frequency.NetFramework.g.cs | 257 ----------------- .../Quantities/HeatFlux.NetFramework.g.cs | 257 ----------------- .../HeatTransferCoefficient.NetFramework.g.cs | 257 ----------------- .../Quantities/Illuminance.NetFramework.g.cs | 257 ----------------- .../Quantities/Irradiance.NetFramework.g.cs | 257 ----------------- .../Quantities/Irradiation.NetFramework.g.cs | 257 ----------------- .../KinematicViscosity.NetFramework.g.cs | 257 ----------------- .../Quantities/LapseRate.NetFramework.g.cs | 257 ----------------- .../Quantities/Level.NetFramework.g.cs | 73 ++++- .../LinearDensity.NetFramework.g.cs | 257 ----------------- .../Quantities/LuminousFlux.NetFramework.g.cs | 257 ----------------- .../LuminousIntensity.NetFramework.g.cs | 257 ----------------- .../MagneticField.NetFramework.g.cs | 257 ----------------- .../Quantities/MagneticFlux.NetFramework.g.cs | 257 ----------------- .../Magnetization.NetFramework.g.cs | 257 ----------------- .../Quantities/Mass.NetFramework.g.cs | 257 ----------------- .../Quantities/MassFlow.NetFramework.g.cs | 257 ----------------- .../Quantities/MassFlux.NetFramework.g.cs | 257 ----------------- .../MassMomentOfInertia.NetFramework.g.cs | 257 ----------------- .../Quantities/MolarEnergy.NetFramework.g.cs | 257 ----------------- .../Quantities/MolarEntropy.NetFramework.g.cs | 257 ----------------- .../Quantities/MolarMass.NetFramework.g.cs | 257 ----------------- .../Quantities/Molarity.NetFramework.g.cs | 257 ----------------- .../Quantities/Permeability.NetFramework.g.cs | 257 ----------------- .../Quantities/Permittivity.NetFramework.g.cs | 257 ----------------- .../Quantities/Power.NetFramework.g.cs | 257 ----------------- .../Quantities/PowerDensity.NetFramework.g.cs | 257 ----------------- .../Quantities/PowerRatio.NetFramework.g.cs | 265 ------------------ .../Quantities/Pressure.NetFramework.g.cs | 257 ----------------- .../PressureChangeRate.NetFramework.g.cs | 257 ----------------- .../Quantities/Ratio.NetFramework.g.cs | 257 ----------------- .../ReactiveEnergy.NetFramework.g.cs | 257 ----------------- .../ReactivePower.NetFramework.g.cs | 257 ----------------- .../RotationalAcceleration.NetFramework.g.cs | 257 ----------------- .../RotationalSpeed.NetFramework.g.cs | 257 ----------------- .../RotationalStiffness.NetFramework.g.cs | 257 ----------------- ...tionalStiffnessPerLength.NetFramework.g.cs | 257 ----------------- .../Quantities/SolidAngle.NetFramework.g.cs | 257 ----------------- .../SpecificEnergy.NetFramework.g.cs | 257 ----------------- .../SpecificEntropy.NetFramework.g.cs | 257 ----------------- .../SpecificVolume.NetFramework.g.cs | 257 ----------------- .../SpecificWeight.NetFramework.g.cs | 257 ----------------- .../Quantities/Speed.NetFramework.g.cs | 257 ----------------- .../Quantities/Temperature.NetFramework.g.cs | 218 -------------- .../TemperatureChangeRate.NetFramework.g.cs | 257 ----------------- .../TemperatureDelta.NetFramework.g.cs | 257 ----------------- .../ThermalConductivity.NetFramework.g.cs | 257 ----------------- .../ThermalResistance.NetFramework.g.cs | 257 ----------------- .../Quantities/Torque.NetFramework.g.cs | 257 ----------------- .../Quantities/VitaminA.NetFramework.g.cs | 257 ----------------- .../Quantities/Volume.NetFramework.g.cs | 257 ----------------- .../Quantities/VolumeFlow.NetFramework.g.cs | 257 ----------------- 175 files changed, 80 insertions(+), 41946 deletions(-) create mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/.gitignore delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs delete mode 100644 UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs create mode 100644 UnitsNet/GeneratedCode/Quantities/.gitignore delete mode 100644 UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs delete mode 100644 UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/.gitignore b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/.gitignore new file mode 100644 index 0000000000..ccb86a88b8 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/.gitignore @@ -0,0 +1,4 @@ +*.g.cs +!Information.WindowsRuntimeComponent.g.cs +!Length.WindowsRuntimeComponent.g.cs +!Level.WindowsRuntimeComponent.g.cs diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a45c494ec5..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Acceleration - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit MeterPerSecondSquared. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Acceleration() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Acceleration Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Acceleration result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AccelerationUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AccelerationUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AccelerationUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AccelerationUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 214f8bbc0e..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class AmountOfSubstance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Mole. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public AmountOfSubstance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AmountOfSubstance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmountOfSubstance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmountOfSubstanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 1e7448a359..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class AmplitudeRatio - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit DecibelVolt. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public AmplitudeRatio() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AmplitudeRatio Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmplitudeRatio result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmplitudeRatioUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AmplitudeRatioUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AmplitudeRatioUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AmplitudeRatioUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a2f2b72365..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Angle - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Degree. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Angle() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AngleUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Angle Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Angle result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AngleUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AngleUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AngleUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AngleUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index d2efb99122..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ApparentEnergy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit VoltampereHour. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ApparentEnergy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ApparentEnergy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentEnergy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentEnergyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ApparentEnergyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentEnergyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentEnergyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs deleted file mode 100644 index b46b1ae749..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ApparentPower - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Voltampere. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ApparentPower() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ApparentPower Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentPower result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentPowerUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ApparentPowerUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentPowerUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentPowerUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a576fd4523..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Area - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit SquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Area() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Area Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Area result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AreaUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AreaUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AreaUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 679d22895e..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The area density of a two-dimensional object is calculated as the mass per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class AreaDensity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit KilogramPerSquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public AreaDensity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AreaDensity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaDensity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaDensityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AreaDensityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AreaDensityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AreaDensityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs deleted file mode 100644 index b5b83dee33..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A geometric property of an area that reflects how its points are distributed with regard to an axis. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class AreaMomentOfInertia - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit MeterToTheFourth. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public AreaMomentOfInertia() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AreaMomentOfInertia Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaMomentOfInertia result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaMomentOfInertiaUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 72de41bbeb..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In telecommunications and computing, bit rate is the number of bits that are conveyed or processed per unit of time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class BitRate - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit BitPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public BitRate() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static BitRate Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BitRate result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BitRateUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(BitRateUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(BitRateUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(BitRateUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 857bb74135..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class BrakeSpecificFuelConsumption - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit KilogramPerJoule. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public BrakeSpecificFuelConsumption() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumption result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumptionUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 99170ac0d0..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Capacitance is the ability of a body to store an electric charge. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Capacitance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Farad. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Capacitance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Capacitance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Capacitance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out CapacitanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(CapacitanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(CapacitanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(CapacitanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 6542afa116..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The density, or more precisely, the volumetric mass density, of a substance is its mass per unit volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Density - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit KilogramPerCubicMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Density() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DensityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Density Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Density result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DensityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(DensityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(DensityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(DensityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs deleted file mode 100644 index bfa821c8df..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Duration - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Second. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Duration() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DurationUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Duration Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Duration result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DurationUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(DurationUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(DurationUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(DurationUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index b8f7423ec0..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The dynamic (shear) viscosity of a fluid expresses its resistance to shearing flows, where adjacent layers move parallel to each other with different speeds - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class DynamicViscosity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public DynamicViscosity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static DynamicViscosity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out DynamicViscosity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DynamicViscosityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(DynamicViscosityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(DynamicViscosityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(DynamicViscosityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index f98848f31b..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricAdmittance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Siemens. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricAdmittance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricAdmittance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricAdmittance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricAdmittanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs deleted file mode 100644 index e55c73587c..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electric charge is the physical property of matter that causes it to experience a force when placed in an electromagnetic field. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricCharge - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Coulomb. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricCharge() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCharge Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCharge result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricChargeUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 6bc5551015..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, charge density is a measure of the amount of electric charge per unit length, surface area, or volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricChargeDensity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit CoulombPerCubicMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricChargeDensity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricChargeDensity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricChargeDensity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeDensityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 3b34579952..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The electrical conductance of an electrical conductor is a measure of the easeness to pass an electric current through that conductor. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricConductance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Siemens. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricConductance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricConductance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricConductanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index fabebf025b..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electrical conductivity or specific conductance is the reciprocal of electrical resistivity, and measures a material's ability to conduct an electric current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricConductivity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit SiemensPerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricConductivity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricConductivity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductivity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductivityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricConductivityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductivityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductivityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 58ee6674d4..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricCurrent - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Ampere. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricCurrent() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrent Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrent result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricCurrentUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index e953d96a71..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, current density is the electric current per unit area of cross section. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricCurrentDensity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit AmperePerSquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricCurrentDensity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrentDensity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentDensity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentDensityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs deleted file mode 100644 index c23ebe7d81..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, the current gradient describes how the current changes in time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricCurrentGradient - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit AmperePerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricCurrentGradient() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrentGradient Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentGradient result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentGradientUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 68259cc6b8..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// An electric field is a force field that surrounds electric charges that attracts or repels other electric charges. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricField - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit VoltPerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricField() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricField Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricField result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricFieldUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricFieldUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricFieldUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricFieldUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 4595158219..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Inductance is a property of an electrical conductor which opposes a change in current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricInductance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Henry. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricInductance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricInductance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricInductance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricInductanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricInductanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricInductanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricInductanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs deleted file mode 100644 index f0ff11138f..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricPotential - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Volt. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricPotential() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotential Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotential result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricPotentialUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 66623baf00..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Electric Potential of a system known to use Alternating Current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricPotentialAc - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit VoltAc. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricPotentialAc() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotentialAc Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialAc result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialAcUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs deleted file mode 100644 index c1a2dd5bc2..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Electric Potential of a system known to use Direct Current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricPotentialDc - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit VoltDc. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricPotentialDc() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotentialDc Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialDc result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialDcUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 768d40145d..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricResistance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Ohm. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricResistance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricResistance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricResistanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 8ab4d1d871..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electrical resistivity (also known as resistivity, specific electrical resistance, or volume resistivity) is a fundamental property that quantifies how strongly a given material opposes the flow of electric current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ElectricResistivity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit OhmMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ElectricResistivity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricResistivity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistivity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistivityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricResistivityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistivityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistivityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 6a940453a1..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Energy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Joule. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Energy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Energy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Energy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EnergyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(EnergyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(EnergyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(EnergyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 8bcf4aff38..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Entropy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit JoulePerKelvin. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Entropy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Entropy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Entropy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EntropyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(EntropyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(EntropyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(EntropyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 6bf4b59dbd..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Force - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Newton. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Force() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Force Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Force result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ForceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ForceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ForceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 38c6c80748..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ForceChangeRate - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit NewtonPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ForceChangeRate() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ForceChangeRate Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForceChangeRate result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceChangeRateUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ForceChangeRateUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ForceChangeRateUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ForceChangeRateUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 18e43de5a2..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The magnitude of force per unit length. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ForcePerLength - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit NewtonPerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ForcePerLength() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ForcePerLength Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForcePerLength result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForcePerLengthUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ForcePerLengthUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ForcePerLengthUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ForcePerLengthUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 3fba3e57d3..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The number of occurrences of a repeating event per unit time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Frequency - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Hertz. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Frequency() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Frequency Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Frequency result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out FrequencyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(FrequencyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(FrequencyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(FrequencyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 9125a8f131..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Heat flux is the flow of energy per unit of area per unit of time - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class HeatFlux - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit WattPerSquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public HeatFlux() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static HeatFlux Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatFlux result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatFluxUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(HeatFluxUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(HeatFluxUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(HeatFluxUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a901cebe96..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class HeatTransferCoefficient - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public HeatTransferCoefficient() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static HeatTransferCoefficient Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatTransferCoefficient result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatTransferCoefficientUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index b0a2196fe0..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, illuminance is the total luminous flux incident on a surface, per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Illuminance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Lux. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Illuminance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Illuminance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Illuminance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IlluminanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(IlluminanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(IlluminanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(IlluminanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 6adb423de1..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Irradiance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit WattPerSquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Irradiance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Irradiance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradianceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(IrradianceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(IrradianceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(IrradianceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 3703575edf..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Irradiation is the process by which an object is exposed to radiation. The exposure can originate from various sources, including natural sources. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Irradiation - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit JoulePerSquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Irradiation() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Irradiation Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiation result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradiationUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(IrradiationUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(IrradiationUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(IrradiationUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 711b5b0248..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class KinematicViscosity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit SquareMeterPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public KinematicViscosity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static KinematicViscosity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out KinematicViscosity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out KinematicViscosityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(KinematicViscosityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(KinematicViscosityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(KinematicViscosityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs deleted file mode 100644 index beeee3a548..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class LapseRate - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public LapseRate() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LapseRate Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LapseRate result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LapseRateUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LapseRateUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LapseRateUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LapseRateUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 136a143111..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Linear Density, or more precisely, the linear mass density, of a substance is its mass per unit length. The term linear density is most often used when describing the characteristics of one-dimensional objects, although linear density can also be used to describe the density of a three-dimensional quantity along one particular dimension. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class LinearDensity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit KilogramPerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public LinearDensity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LinearDensity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LinearDensity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LinearDensityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LinearDensityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LinearDensityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LinearDensityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 50c52d4883..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, luminous flux or luminous power is the measure of the perceived power of light. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class LuminousFlux - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Lumen. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public LuminousFlux() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LuminousFlux Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousFlux result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousFluxUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LuminousFluxUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousFluxUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousFluxUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index ec61f3d2ed..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, luminous intensity is a measure of the wavelength-weighted power emitted by a light source in a particular direction per unit solid angle, based on the luminosity function, a standardized model of the sensitivity of the human eye. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class LuminousIntensity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Candela. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public LuminousIntensity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LuminousIntensity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousIntensity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousIntensityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LuminousIntensityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousIntensityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousIntensityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs deleted file mode 100644 index dc2cfbec14..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A magnetic field is a force field that is created by moving electric charges (electric currents) and magnetic dipoles, and exerts a force on other nearby moving charges and magnetic dipoles. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MagneticField - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Tesla. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MagneticField() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MagneticField Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticField result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFieldUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MagneticFieldUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFieldUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFieldUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 0c4db90b0a..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, specifically electromagnetism, the magnetic flux through a surface is the surface integral of the normal component of the magnetic field B passing through that surface. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MagneticFlux - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Weber. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MagneticFlux() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MagneticFlux Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticFlux result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFluxUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MagneticFluxUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFluxUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFluxUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs deleted file mode 100644 index df6122df15..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In classical electromagnetism, magnetization is the vector field that expresses the density of permanent or induced magnetic dipole moments in a magnetic material. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Magnetization - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit AmperePerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Magnetization() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Magnetization Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Magnetization result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagnetizationUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MagnetizationUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MagnetizationUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MagnetizationUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs deleted file mode 100644 index dd88588d64..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Mass - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Kilogram. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Mass() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Mass Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Mass result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a3c27c6f8f..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MassFlow - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit GramPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MassFlow() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassFlow Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlow result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFlowUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassFlowUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs deleted file mode 100644 index e87cd58a63..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mass flux is the mass flow rate per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MassFlux - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MassFlux() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassFlux Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlux result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFluxUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassFluxUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassFluxUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassFluxUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 73f219fccb..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A property of body reflects how its mass is distributed with regard to an axis. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MassMomentOfInertia - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit KilogramSquareMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MassMomentOfInertia() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassMomentOfInertia Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassMomentOfInertia result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassMomentOfInertiaUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 120b9ba32f..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar energy is the amount of energy stored in 1 mole of a substance. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MolarEnergy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit JoulePerMole. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MolarEnergy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarEnergy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEnergy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEnergyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarEnergyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEnergyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEnergyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index d348b24e1f..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MolarEntropy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit JoulePerMoleKelvin. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MolarEntropy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarEntropy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEntropy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEntropyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarEntropyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEntropyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEntropyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs deleted file mode 100644 index d5618bfbac..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class MolarMass - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit KilogramPerMole. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public MolarMass() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarMass Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarMass result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarMassUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarMassUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarMassUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarMassUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 197fa15f13..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar concentration, also called molarity, amount concentration or substance concentration, is a measure of the concentration of a solute in a solution, or of any chemical species, in terms of amount of substance in a given volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Molarity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit MolesPerCubicMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Molarity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Molarity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Molarity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs deleted file mode 100644 index c68ae6bffc..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, permeability is the measure of the ability of a material to support the formation of a magnetic field within itself. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Permeability - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit HenryPerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Permeability() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Permeability Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permeability result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermeabilityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PermeabilityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PermeabilityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PermeabilityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 8716115ce4..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, permittivity is the measure of resistance that is encountered when forming an electric field in a particular medium. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Permittivity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit FaradPerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Permittivity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Permittivity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permittivity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermittivityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PermittivityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PermittivityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PermittivityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 8a5aaac6d3..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Power - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Watt. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Power() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Power Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Power result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PowerUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PowerUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PowerUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 512a92ef7e..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The amount of power in a volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class PowerDensity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit WattPerCubicMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public PowerDensity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PowerDensity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerDensity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerDensityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PowerDensityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PowerDensityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PowerDensityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a5037f3441..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The strength of a signal expressed in decibels (dB) relative to one watt. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class PowerRatio - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit DecibelWatt. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public PowerRatio() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PowerRatio Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerRatio result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerRatioUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PowerRatioUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PowerRatioUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PowerRatioUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 9397ffd2ab..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Pressure - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Pascal. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Pressure() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PressureUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Pressure Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Pressure result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PressureUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PressureUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PressureUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs deleted file mode 100644 index fdf0439fe6..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class PressureChangeRate - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit PascalPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public PressureChangeRate() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PressureChangeRate Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PressureChangeRate result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureChangeRateUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PressureChangeRateUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PressureChangeRateUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PressureChangeRateUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 4bced5a9cc..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Ratio - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit DecimalFraction. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Ratio() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RatioUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Ratio Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Ratio result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RatioUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RatioUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RatioUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RatioUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 664aa9064d..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ReactiveEnergy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit VoltampereReactiveHour. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ReactiveEnergy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ReactiveEnergy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactiveEnergy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactiveEnergyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ReactiveEnergyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ReactiveEnergyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ReactiveEnergyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs deleted file mode 100644 index cbe699321f..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ReactivePower - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit VoltampereReactive. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ReactivePower() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ReactivePower Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactivePower result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactivePowerUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ReactivePowerUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ReactivePowerUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ReactivePowerUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 3c1c4e1e05..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Angular acceleration is the rate of change of rotational speed. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class RotationalAcceleration - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit RadianPerSecondSquared. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public RotationalAcceleration() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalAcceleration Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalAcceleration result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalAccelerationUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalAccelerationUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalAccelerationUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalAccelerationUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 5468f1c1ac..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class RotationalSpeed - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit RadianPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public RotationalSpeed() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalSpeed Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalSpeed result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalSpeedUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalSpeedUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalSpeedUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalSpeedUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs deleted file mode 100644 index e2d8a74511..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class RotationalStiffness - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit NewtonMeterPerRadian. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public RotationalStiffness() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalStiffness Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffness result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 6d9cd67bf2..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class RotationalStiffnessPerLength - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public RotationalStiffnessPerLength() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLength result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLengthUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs deleted file mode 100644 index f939656416..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In geometry, a solid angle is the two-dimensional angle in three-dimensional space that an object subtends at a point. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class SolidAngle - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Steradian. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public SolidAngle() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SolidAngle Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SolidAngle result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SolidAngleUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SolidAngleUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SolidAngleUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SolidAngleUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index d0eb1b0a00..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The SpecificEnergy - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class SpecificEnergy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit JoulePerKilogram. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public SpecificEnergy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificEnergy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEnergy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEnergyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificEnergyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEnergyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEnergyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 8fb3035be0..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class SpecificEntropy - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit JoulePerKilogramKelvin. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public SpecificEntropy() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificEntropy Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEntropy result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEntropyUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificEntropyUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEntropyUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEntropyUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 121a9dd36a..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class SpecificVolume - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit CubicMeterPerKilogram. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public SpecificVolume() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificVolume Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificVolume result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificVolumeUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificVolumeUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificVolumeUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificVolumeUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 5f54dad281..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The SpecificWeight, or more precisely, the volumetric weight density, of a substance is its weight per unit volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class SpecificWeight - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit NewtonPerCubicMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public SpecificWeight() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificWeight Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificWeight result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificWeightUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificWeightUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificWeightUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificWeightUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a858b0b9ff..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Speed - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit MeterPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Speed() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Speed Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Speed result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpeedUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpeedUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpeedUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpeedUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 30753ab9bd..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Temperature - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Kelvin. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Temperature() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Temperature Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Temperature result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TemperatureUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 3380443ca3..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class TemperatureChangeRate - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public TemperatureChangeRate() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static TemperatureChangeRate Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureChangeRate result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureChangeRateUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 336838a71d..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Difference between two temperatures. The conversions are different than for Temperature. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class TemperatureDelta - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit Kelvin. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public TemperatureDelta() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static TemperatureDelta Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureDelta result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureDeltaUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TemperatureDeltaUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureDeltaUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureDeltaUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs deleted file mode 100644 index e6614e1faa..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Thermal conductivity is the property of a material to conduct heat. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ThermalConductivity - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit WattPerMeterKelvin. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ThermalConductivity() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ThermalConductivity Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalConductivity result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalConductivityUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ThermalConductivityUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalConductivityUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalConductivityUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs deleted file mode 100644 index c3be673b8a..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class ThermalResistance - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public ThermalResistance() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ThermalResistance Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalResistance result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalResistanceUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ThermalResistanceUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalResistanceUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalResistanceUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 1a3a81870b..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Torque - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit NewtonMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Torque() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Torque Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Torque result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TorqueUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TorqueUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TorqueUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TorqueUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs deleted file mode 100644 index a8525698dd..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class VitaminA - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit InternationalUnit. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public VitaminA() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static VitaminA Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VitaminA result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VitaminAUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(VitaminAUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(VitaminAUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(VitaminAUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 83c489e9c3..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Volume - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit CubicMeter. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public Volume() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Volume Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Volume result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(VolumeUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs deleted file mode 100644 index 4bb74d2535..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ /dev/null @@ -1,231 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class VolumeFlow - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit CubicMeterPerSecond. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public VolumeFlow() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static VolumeFlow Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VolumeFlow result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeFlowUnit unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(VolumeFlowUnit unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeFlowUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeFlowUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/.gitignore b/UnitsNet/GeneratedCode/Quantities/.gitignore new file mode 100644 index 0000000000..0360dd5ae9 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/.gitignore @@ -0,0 +1,4 @@ +*.g.cs +!Information.NetFramework.g.cs +!Length.NetFramework.g.cs +!Level.NetFramework.g.cs diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs deleted file mode 100644 index e0d03f88d0..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Acceleration : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AccelerationUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out AccelerationUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AccelerationUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs deleted file mode 100644 index 596bbf331a..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct AmountOfSubstance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmountOfSubstanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out AmountOfSubstanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs deleted file mode 100644 index 9831a12fcd..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ /dev/null @@ -1,265 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct AmplitudeRatio : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmplitudeRatioUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out AmplitudeRatioUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs deleted file mode 100644 index fe22eb9bb5..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Angle : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AngleUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out AngleUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AngleUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs deleted file mode 100644 index 9a1222eafb..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ApparentEnergy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentEnergyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ApparentEnergyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs deleted file mode 100644 index 57dccceec8..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ApparentPower : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentPowerUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ApparentPowerUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs deleted file mode 100644 index 5d3e334154..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Area : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Area Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AreaUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs deleted file mode 100644 index d86e306a85..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The area density of a two-dimensional object is calculated as the mass per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct AreaDensity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaDensityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDensityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs deleted file mode 100644 index e946f82fed..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A geometric property of an area that reflects how its points are distributed with regard to an axis. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct AreaMomentOfInertia : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMomentOfInertiaUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs deleted file mode 100644 index 1d3aa67fba..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In telecommunications and computing, bit rate is the number of bits that are conveyed or processed per unit of time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct BitRate : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public decimal Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BitRateUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out BitRateUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(BitRateUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs deleted file mode 100644 index b48dee1a68..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct BrakeSpecificFuelConsumption : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeSpecificFuelConsumptionUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs deleted file mode 100644 index e0e1033fd6..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Capacitance is the ability of a body to store an electric charge. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Capacitance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static CapacitanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out CapacitanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs deleted file mode 100644 index d3736f1b92..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The density, or more precisely, the volumetric mass density, of a substance is its mass per unit volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Density : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Density Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DensityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out DensityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(DensityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs deleted file mode 100644 index cbfb3a0180..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Duration : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DurationUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out DurationUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(DurationUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs deleted file mode 100644 index 3690948760..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The dynamic (shear) viscosity of a fluid expresses its resistance to shearing flows, where adjacent layers move parallel to each other with different speeds - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct DynamicViscosity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DynamicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out DynamicViscosityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs deleted file mode 100644 index 3fcc8c49da..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricAdmittance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricAdmittanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricAdmittanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs deleted file mode 100644 index d8090f6f81..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electric charge is the physical property of matter that causes it to experience a force when placed in an electromagnetic field. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricCharge : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricChargeUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs deleted file mode 100644 index 227179e559..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, charge density is a measure of the amount of electric charge per unit length, surface area, or volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricChargeDensity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeDensityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricChargeDensityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs deleted file mode 100644 index c045a2d192..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The electrical conductance of an electrical conductor is a measure of the easeness to pass an electric current through that conductor. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricConductance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricConductanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs deleted file mode 100644 index c18a48035f..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electrical conductivity or specific conductance is the reciprocal of electrical resistivity, and measures a material's ability to conduct an electric current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricConductivity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductivityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricConductivityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs deleted file mode 100644 index 11cf2c1d65..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricCurrent : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs deleted file mode 100644 index 0e62d6135c..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, current density is the electric current per unit area of cross section. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricCurrentDensity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentDensityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentDensityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs deleted file mode 100644 index 6ef5cefa3d..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, the current gradient describes how the current changes in time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricCurrentGradient : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentGradientUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentGradientUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs deleted file mode 100644 index 6c72290465..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// An electric field is a force field that surrounds electric charges that attracts or repels other electric charges. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricField : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricFieldUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricFieldUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs deleted file mode 100644 index 17fc45bc3d..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Inductance is a property of an electrical conductor which opposes a change in current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricInductance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricInductanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricInductanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs deleted file mode 100644 index 71dbaf29bb..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricPotential : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs deleted file mode 100644 index 255233f3dd..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Electric Potential of a system known to use Alternating Current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricPotentialAc : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialAcUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialAcUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs deleted file mode 100644 index 926ef6f3f7..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Electric Potential of a system known to use Direct Current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricPotentialDc : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialDcUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialDcUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs deleted file mode 100644 index 3afd5122b8..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricResistance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricResistanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs deleted file mode 100644 index ec96e90f0c..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electrical resistivity (also known as resistivity, specific electrical resistance, or volume resistivity) is a fundamental property that quantifies how strongly a given material opposes the flow of electric current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ElectricResistivity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistivityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricResistivityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs deleted file mode 100644 index 7c4b11676a..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Energy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EnergyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out EnergyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(EnergyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs deleted file mode 100644 index 2d87ca690e..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Entropy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EntropyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out EntropyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(EntropyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs deleted file mode 100644 index f159cc97df..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Force : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Force Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ForceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ForceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs deleted file mode 100644 index fa1dc47d4c..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ForceChangeRate : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ForceChangeRateUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs deleted file mode 100644 index ef1dd5e594..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The magnitude of force per unit length. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ForcePerLength : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForcePerLengthUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ForcePerLengthUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs deleted file mode 100644 index b98dc90358..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The number of occurrences of a repeating event per unit time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Frequency : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static FrequencyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out FrequencyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(FrequencyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs deleted file mode 100644 index c2cc3171ce..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Heat flux is the flow of energy per unit of area per unit of time - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct HeatFlux : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatFluxUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFluxUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs deleted file mode 100644 index 6f1cbff42b..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct HeatTransferCoefficient : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatTransferCoefficientUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTransferCoefficientUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs deleted file mode 100644 index b05cf37df7..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, illuminance is the total luminous flux incident on a surface, per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Illuminance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IlluminanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out IlluminanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs deleted file mode 100644 index 33cb41231e..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Irradiance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradianceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out IrradianceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(IrradianceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs deleted file mode 100644 index a25b0768b6..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Irradiation is the process by which an object is exposed to radiation. The exposure can originate from various sources, including natural sources. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Irradiation : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradiationUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out IrradiationUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(IrradiationUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs deleted file mode 100644 index cd436e2d91..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct KinematicViscosity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static KinematicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out KinematicViscosityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs deleted file mode 100644 index 2ae477073f..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct LapseRate : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LapseRateUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out LapseRateUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LapseRateUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 92fb22feab..becab22f5c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -47,9 +47,43 @@ namespace UnitsNet /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// // ReSharper disable once PartialTypeWithSinglePart - public partial struct Level : IQuantity, IComparable, IComparable { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LevelUnit? _unit; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + static Level() + { + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Level(double numericValue, LevelUnit unit) + { + if(unit == LevelUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + /// /// The numeric value this quantity was constructed with. /// @@ -67,6 +101,43 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } + #region Properties + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Level; + + /// + /// The base unit of Level, which is Decibel. All conversions go via this value. + /// + public static LevelUnit BaseUnit => LevelUnit.Decibel; + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions + { + get; + } + + /// + /// All units of measurement for the Level quantity. + /// + public static LevelUnit[] Units { get; } = Enum.GetValues(typeof(LevelUnit)).Cast().Except(new LevelUnit[]{ LevelUnit.Undefined }).ToArray(); + + /// + /// Get Level in Decibels. + /// + public double Decibels => As(LevelUnit.Decibel); + + /// + /// Get Level in Nepers. + /// + public double Nepers => As(LevelUnit.Neper); + + #endregion + #region Logarithmic Arithmetic Operators public static Level operator -(Level right) diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs deleted file mode 100644 index 24b1954401..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Linear Density, or more precisely, the linear mass density, of a substance is its mass per unit length. The term linear density is most often used when describing the characteristics of one-dimensional objects, although linear density can also be used to describe the density of a three-dimensional quantity along one particular dimension. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct LinearDensity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LinearDensityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out LinearDensityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs deleted file mode 100644 index 8515eea26b..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, luminous flux or luminous power is the measure of the perceived power of light. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct LuminousFlux : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousFluxUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out LuminousFluxUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs deleted file mode 100644 index f72029b842..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, luminous intensity is a measure of the wavelength-weighted power emitted by a light source in a particular direction per unit solid angle, based on the luminosity function, a standardized model of the sensitivity of the human eye. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct LuminousIntensity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousIntensityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out LuminousIntensityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs deleted file mode 100644 index bee35db212..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A magnetic field is a force field that is created by moving electric charges (electric currents) and magnetic dipoles, and exerts a force on other nearby moving charges and magnetic dipoles. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MagneticField : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFieldUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MagneticFieldUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs deleted file mode 100644 index 14a2e5dd17..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, specifically electromagnetism, the magnetic flux through a surface is the surface integral of the normal component of the magnetic field B passing through that surface. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MagneticFlux : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFluxUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MagneticFluxUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs deleted file mode 100644 index 9a3d3d1c1d..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In classical electromagnetism, magnetization is the vector field that expresses the density of permanent or induced magnetic dipole moments in a magnetic material. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Magnetization : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagnetizationUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MagnetizationUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs deleted file mode 100644 index 17f601c6a0..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Mass : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MassUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs deleted file mode 100644 index 4c9521793f..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MassFlow : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFlowUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MassFlowUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassFlowUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs deleted file mode 100644 index ce3f1b33dd..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mass flux is the mass flow rate per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MassFlux : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFluxUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MassFluxUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassFluxUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs deleted file mode 100644 index a5275cbcc1..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A property of body reflects how its mass is distributed with regard to an axis. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MassMomentOfInertia : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MassMomentOfInertiaUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs deleted file mode 100644 index 764df4ac93..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar energy is the amount of energy stored in 1 mole of a substance. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MolarEnergy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEnergyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MolarEnergyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs deleted file mode 100644 index 9743cb951a..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MolarEntropy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEntropyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MolarEntropyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs deleted file mode 100644 index 3e45048445..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct MolarMass : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarMassUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MolarMassUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarMassUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs deleted file mode 100644 index 28331ff265..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar concentration, also called molarity, amount concentration or substance concentration, is a measure of the concentration of a solute in a solution, or of any chemical species, in terms of amount of substance in a given volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Molarity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out MolarityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(MolarityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs deleted file mode 100644 index 6948b9a7ae..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, permeability is the measure of the ability of a material to support the formation of a magnetic field within itself. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Permeability : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Permeability Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermeabilityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out PermeabilityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs deleted file mode 100644 index d3a0b0bd31..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, permittivity is the measure of resistance that is encountered when forming an electric field in a particular medium. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Permittivity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermittivityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out PermittivityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PermittivityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs deleted file mode 100644 index 7b9d90e6aa..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Power : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public decimal Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Power Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out PowerUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PowerUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs deleted file mode 100644 index e2cf704591..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The amount of power in a volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct PowerDensity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerDensityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out PowerDensityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs deleted file mode 100644 index 938b3b1cb3..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ /dev/null @@ -1,265 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The strength of a signal expressed in decibels (dB) relative to one watt. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct PowerRatio : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerRatioUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out PowerRatioUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs deleted file mode 100644 index 1a6336cb21..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Pressure : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out PressureUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PressureUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs deleted file mode 100644 index 9dcb51be29..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct PressureChangeRate : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out PressureChangeRateUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs deleted file mode 100644 index f84e5a5413..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Ratio : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RatioUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out RatioUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RatioUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs deleted file mode 100644 index 09c76f52f9..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ReactiveEnergy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactiveEnergyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ReactiveEnergyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs deleted file mode 100644 index a18fac198e..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ReactivePower : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactivePowerUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ReactivePowerUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs deleted file mode 100644 index 323a07ba49..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Angular acceleration is the rate of change of rotational speed. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct RotationalAcceleration : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalAccelerationUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalAccelerationUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs deleted file mode 100644 index 64340a1738..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct RotationalSpeed : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalSpeedUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalSpeedUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs deleted file mode 100644 index c87ee978ee..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct RotationalStiffness : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalStiffnessUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs deleted file mode 100644 index 890d852ccf..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct RotationalStiffnessPerLength : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalStiffnessPerLengthUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs deleted file mode 100644 index 97ede7078d..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In geometry, a solid angle is the two-dimensional angle in three-dimensional space that an object subtends at a point. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct SolidAngle : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SolidAngleUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out SolidAngleUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs deleted file mode 100644 index 2fbd3a02bf..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The SpecificEnergy - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct SpecificEnergy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEnergyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificEnergyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs deleted file mode 100644 index e34d2a598b..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct SpecificEntropy : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEntropyUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificEntropyUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs deleted file mode 100644 index 9e41de61c9..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct SpecificVolume : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificVolumeUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificVolumeUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs deleted file mode 100644 index 0d55548287..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The SpecificWeight, or more precisely, the volumetric weight density, of a substance is its weight per unit volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct SpecificWeight : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificWeightUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificWeightUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs deleted file mode 100644 index da700edf4d..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Speed : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpeedUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(SpeedUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs deleted file mode 100644 index 14deecd463..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ /dev/null @@ -1,218 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Temperature : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - 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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs deleted file mode 100644 index ced55e78c7..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct TemperatureChangeRate : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureChangeRateUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs deleted file mode 100644 index 66cc79764a..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Difference between two temperatures. The conversions are different than for Temperature. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct TemperatureDelta : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureDeltaUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureDeltaUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs deleted file mode 100644 index 53cbf33e51..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Thermal conductivity is the property of a material to conduct heat. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ThermalConductivity : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalConductivityUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ThermalConductivityUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs deleted file mode 100644 index 6c8b039a6b..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct ThermalResistance : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalResistanceUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out ThermalResistanceUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs deleted file mode 100644 index 9f3b86de1b..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Torque : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TorqueUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out TorqueUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(TorqueUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs deleted file mode 100644 index 7cf2605ffb..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct VitaminA : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VitaminAUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out VitaminAUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(VitaminAUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs deleted file mode 100644 index 2af23f07e5..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct Volume : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out VolumeUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs deleted file mode 100644 index a012a9d203..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ /dev/null @@ -1,257 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. - /// - // ReSharper disable once PartialTypeWithSinglePart - - public partial struct VolumeFlow : IQuantity, IComparable, IComparable - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => _value; - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) - { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #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); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) - { - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) - { - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeFlowUnit ParseUnit(string str, IFormatProvider provider = null) - { - return ParseUnitInternal(str, provider); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out VolumeFlowUnit unit) - { - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) - { - return ToString(unit, provider, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} From 74e54cff450829761dec7a5a3b31ccf7fbb3f860 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 13 Oct 2018 23:35:14 +0200 Subject: [PATCH 064/131] Use instance of UnitAbbrevationsCache in test It broke other tests depending on sequence of running tests. --- UnitsNet.Tests/UnitAbbreviationsCacheTests.cs | 10 ++++++---- UnitsNet.Tests/UnitParserTests.cs | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs index b42c9c4b8c..449c5cf042 100644 --- a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs +++ b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs @@ -283,10 +283,11 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() var zuluCulture = new CultureInfo("zu-ZA"); CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = zuluCulture; - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(CustomUnit.Unit1, AmericanCulture, "US english abbreviation for Unit1"); + var abbreviationsCache = new UnitAbbreviationsCache(); + abbreviationsCache.MapUnitToAbbreviation(CustomUnit.Unit1, AmericanCulture, "US english abbreviation for Unit1"); // Act - string abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(CustomUnit.Unit1, zuluCulture); + string abbreviation = abbreviationsCache.GetDefaultAbbreviation(CustomUnit.Unit1, zuluCulture); // Assert Assert.Equal("US english abbreviation for Unit1", abbreviation); @@ -301,9 +302,10 @@ public void GetDefaultAbbreviationFallsBackToUsEnglishCulture() [Fact] public void MapUnitToAbbreviation_AddCustomUnit_DoesNotOverrideDefaultAbbreviationForAlreadyMappedUnits() { - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(AreaUnit.SquareMeter, AmericanCulture, "m^2"); + var cache = new UnitAbbreviationsCache(); + cache.MapUnitToAbbreviation(AreaUnit.SquareMeter, AmericanCulture, "m^2"); - Assert.Equal("m²", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(AreaUnit.SquareMeter)); + Assert.Equal("m²", cache.GetDefaultAbbreviation(AreaUnit.SquareMeter)); } /// diff --git a/UnitsNet.Tests/UnitParserTests.cs b/UnitsNet.Tests/UnitParserTests.cs index bd717addd2..5270fcb328 100644 --- a/UnitsNet.Tests/UnitParserTests.cs +++ b/UnitsNet.Tests/UnitParserTests.cs @@ -32,9 +32,12 @@ public class UnitParserTests [InlineData("cm^^2", AreaUnit.SquareCentimeter)] public void Parse_ReturnsUnitMappedByCustomAbbreviation(string customAbbreviation, AreaUnit expected) { - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(expected, customAbbreviation); + var abbrevCache = new UnitAbbreviationsCache(); + abbrevCache.MapUnitToAbbreviation(expected, customAbbreviation); + var parser = new UnitParser(abbrevCache); + + var actual = parser.Parse(customAbbreviation); - var actual = UnitParser.Default.Parse(customAbbreviation); Assert.Equal(expected, actual); } From be269995b0155567a2ea9000da528c8b6244e8b9 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 13 Oct 2018 17:17:45 +0200 Subject: [PATCH 065/131] Remove weird tests --- UnitsNet.Tests/CustomCode/ParseTests.cs | 76 +------------------------ 1 file changed, 3 insertions(+), 73 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 6512be2852..3a05a64df8 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -62,20 +62,6 @@ public void ParseLength_InvalidString_USEnglish_ThrowsException(string s, Type e Assert.Throws(expectedExceptionType, () => Length.Parse(s, usEnglish)); } - [Theory] - [InlineData("1 ft 1 in", 13)] - [InlineData("1ft 1in", 13)] - [InlineData("1' 1\"", 13)] - [InlineData("1'1\"", 13)] - [InlineData("1ft1in", 13)] - [InlineData("1ft and 1in", 13)] - public void ParseLength_FeetInchesString_USEnglish(string s, double expected) - { - CultureInfo usEnglish = new CultureInfo("en-US"); - double actual = Length.Parse(s, usEnglish).Inches; - Assert.Equal(expected, actual); - } - /// Error parsing string. [Theory] [InlineData("5.5 m", 5.5)] @@ -166,61 +152,5 @@ public void TryParseLengthUnitUsEnglish(string s, bool expected) bool actual = Length.TryParse(s, usEnglish, out Length _); Assert.Equal(expected, actual); } - - [Theory] - [InlineData("!")] - [InlineData("@")] - [InlineData("#")] - [InlineData("$")] - [InlineData("%")] - [InlineData("^")] - [InlineData("&")] - [InlineData("*")] - [InlineData("-")] - [InlineData("_")] - [InlineData("?")] - [InlineData("123")] - [InlineData(" ")] - public void TryParseLengthUnitAbbreviationSpecialCharacters(string s) - { - string abbrev = $"m{s}s"; - - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); - - // Act - bool ok = UnitParser.Default.TryParse(abbrev, out LengthUnit result); - - // Assert - Assert.True(ok, "TryParse " + abbrev); - Assert.Equal(LengthUnit.Meter, result); - } - - [Theory] - [InlineData("!")] - [InlineData("@")] - [InlineData("#")] - [InlineData("$")] - [InlineData("%")] - [InlineData("^")] - [InlineData("&")] - [InlineData("*")] - [InlineData("-")] - [InlineData("_")] - [InlineData("?")] - [InlineData("123")] - [InlineData(" ")] - public void TryParseLengthSpecialCharacters(string s) - { - string abbrev = $"m{s}s"; - - UnitAbbreviationsCache.Default.MapUnitToAbbreviation(LengthUnit.Meter, abbrev); - - // Act - var ok = Length.TryParse($"10 {abbrev}", out var result); - - // Assert - Assert.True(ok, $"TryParse \"10 {abbrev}\""); - Assert.Equal(10, result.Meters); - } } } From 632d6afaa250d4bf44cc99cada42641f61493615 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 13 Oct 2018 18:39:24 +0200 Subject: [PATCH 066/131] UnitParser: Minor cleanup --- UnitsNet/CustomCode/UnitParser.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index e3aa7aad18..f31f39b7ec 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -20,7 +20,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using UnitsNet.InternalHelpers; @@ -31,13 +30,13 @@ namespace UnitsNet { public sealed class UnitParser { - private readonly UnitAbbreviationsCache unitAbbreviationsCache; + private readonly UnitAbbreviationsCache _unitAbbreviationsCache; public static UnitParser Default { get; } public UnitParser(UnitAbbreviationsCache unitAbbreviationsCache) { - this.unitAbbreviationsCache = unitAbbreviationsCache ?? UnitAbbreviationsCache.Default; ; + _unitAbbreviationsCache = unitAbbreviationsCache ?? UnitAbbreviationsCache.Default; } static UnitParser() @@ -76,7 +75,7 @@ TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider /// The format provider to use for lookup. Defaults to if null. /// Unit enum value, such as . /// No units match the abbreviation. - /// More than one unit matches the abbrevation. + /// More than one unit matches the abbreviation. [PublicAPI] #if WINDOWS_UWP internal @@ -85,7 +84,7 @@ TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider #endif object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null) { - if(!unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) + if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}]."); var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); @@ -139,7 +138,7 @@ bool TryParse(string unitAbbreviation, out TUnitType unit) where TUni #endif bool TryParse(string unitAbbreviation, [CanBeNull] IFormatProvider formatProvider, out TUnitType unit) where TUnitType : Enum { - unit = default(TUnitType); + unit = default; if(!TryParse(unitAbbreviation, typeof(TUnitType), formatProvider, out var unitObj)) return false; @@ -179,7 +178,7 @@ bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvide { unit = GetDefault(unitType); - if(!unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) + if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) return false; var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); From 86b2efcef08ae73f9310e77560064475383890db Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 15 Oct 2018 16:14:44 +0200 Subject: [PATCH 067/131] Stricter parsing (#516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add abbreviations ″ and ′ to inch and foot Found in the wiki * Rename to LengthTests.FeetInches.cs * Length: Add TryParseFeetInches() and ParseFeetInches() Since parsing is generally made more strict, this method adds back the special parsing to handle strings like: 1' 2" * QuantityParser: Make parsing more strict - Only parse the format "{value} {unit abbreviation}" where the spacing is optional - No longer support parsing multiple quantities like "1 ft 2 in", use Length.ParseFeetInches() for that - Move Trim() to inner-most level * Regen * Trim input in TryParseFeetInches() --- .../Quantities/Acceleration.Common.g.cs | 10 +- .../Quantities/AmountOfSubstance.Common.g.cs | 10 +- .../Quantities/AmplitudeRatio.Common.g.cs | 10 +- .../Quantities/Angle.Common.g.cs | 10 +- .../Quantities/ApparentEnergy.Common.g.cs | 10 +- .../Quantities/ApparentPower.Common.g.cs | 10 +- .../GeneratedCode/Quantities/Area.Common.g.cs | 10 +- .../Quantities/AreaDensity.Common.g.cs | 10 +- .../AreaMomentOfInertia.Common.g.cs | 10 +- .../Quantities/BitRate.Common.g.cs | 10 +- .../BrakeSpecificFuelConsumption.Common.g.cs | 10 +- .../Quantities/Capacitance.Common.g.cs | 10 +- .../Quantities/Density.Common.g.cs | 10 +- .../Quantities/Duration.Common.g.cs | 10 +- .../Quantities/DynamicViscosity.Common.g.cs | 10 +- .../Quantities/ElectricAdmittance.Common.g.cs | 10 +- .../Quantities/ElectricCharge.Common.g.cs | 10 +- .../ElectricChargeDensity.Common.g.cs | 10 +- .../ElectricConductance.Common.g.cs | 10 +- .../ElectricConductivity.Common.g.cs | 10 +- .../Quantities/ElectricCurrent.Common.g.cs | 10 +- .../ElectricCurrentDensity.Common.g.cs | 10 +- .../ElectricCurrentGradient.Common.g.cs | 10 +- .../Quantities/ElectricField.Common.g.cs | 10 +- .../Quantities/ElectricInductance.Common.g.cs | 10 +- .../Quantities/ElectricPotential.Common.g.cs | 10 +- .../ElectricPotentialAc.Common.g.cs | 10 +- .../ElectricPotentialDc.Common.g.cs | 10 +- .../Quantities/ElectricResistance.Common.g.cs | 10 +- .../ElectricResistivity.Common.g.cs | 10 +- .../Quantities/Energy.Common.g.cs | 10 +- .../Quantities/Entropy.Common.g.cs | 10 +- .../Quantities/Force.Common.g.cs | 10 +- .../Quantities/ForceChangeRate.Common.g.cs | 10 +- .../Quantities/ForcePerLength.Common.g.cs | 10 +- .../Quantities/Frequency.Common.g.cs | 10 +- .../Quantities/HeatFlux.Common.g.cs | 10 +- .../HeatTransferCoefficient.Common.g.cs | 10 +- .../Quantities/Illuminance.Common.g.cs | 10 +- .../Quantities/Information.Common.g.cs | 10 +- .../Quantities/Irradiance.Common.g.cs | 10 +- .../Quantities/Irradiation.Common.g.cs | 10 +- .../Quantities/KinematicViscosity.Common.g.cs | 10 +- .../Quantities/LapseRate.Common.g.cs | 10 +- .../Quantities/Length.Common.g.cs | 10 +- .../Quantities/Level.Common.g.cs | 10 +- .../Quantities/LinearDensity.Common.g.cs | 10 +- .../Quantities/LuminousFlux.Common.g.cs | 10 +- .../Quantities/LuminousIntensity.Common.g.cs | 10 +- .../Quantities/MagneticField.Common.g.cs | 10 +- .../Quantities/MagneticFlux.Common.g.cs | 10 +- .../Quantities/Magnetization.Common.g.cs | 10 +- .../GeneratedCode/Quantities/Mass.Common.g.cs | 10 +- .../Quantities/MassFlow.Common.g.cs | 10 +- .../Quantities/MassFlux.Common.g.cs | 10 +- .../MassMomentOfInertia.Common.g.cs | 10 +- .../Quantities/MolarEnergy.Common.g.cs | 10 +- .../Quantities/MolarEntropy.Common.g.cs | 10 +- .../Quantities/MolarMass.Common.g.cs | 10 +- .../Quantities/Molarity.Common.g.cs | 10 +- .../Quantities/Permeability.Common.g.cs | 10 +- .../Quantities/Permittivity.Common.g.cs | 10 +- .../Quantities/Power.Common.g.cs | 10 +- .../Quantities/PowerDensity.Common.g.cs | 10 +- .../Quantities/PowerRatio.Common.g.cs | 10 +- .../Quantities/Pressure.Common.g.cs | 10 +- .../Quantities/PressureChangeRate.Common.g.cs | 10 +- .../Quantities/Ratio.Common.g.cs | 10 +- .../Quantities/ReactiveEnergy.Common.g.cs | 10 +- .../Quantities/ReactivePower.Common.g.cs | 10 +- .../RotationalAcceleration.Common.g.cs | 10 +- .../Quantities/RotationalSpeed.Common.g.cs | 10 +- .../RotationalStiffness.Common.g.cs | 10 +- .../RotationalStiffnessPerLength.Common.g.cs | 10 +- .../Quantities/SolidAngle.Common.g.cs | 10 +- .../Quantities/SpecificEnergy.Common.g.cs | 10 +- .../Quantities/SpecificEntropy.Common.g.cs | 10 +- .../Quantities/SpecificVolume.Common.g.cs | 10 +- .../Quantities/SpecificWeight.Common.g.cs | 10 +- .../Quantities/Speed.Common.g.cs | 10 +- .../Quantities/Temperature.Common.g.cs | 10 +- .../TemperatureChangeRate.Common.g.cs | 10 +- .../Quantities/TemperatureDelta.Common.g.cs | 10 +- .../ThermalConductivity.Common.g.cs | 10 +- .../Quantities/ThermalResistance.Common.g.cs | 10 +- .../Quantities/Torque.Common.g.cs | 10 +- .../Quantities/VitaminA.Common.g.cs | 10 +- .../Quantities/Volume.Common.g.cs | 10 +- .../Quantities/VolumeFlow.Common.g.cs | 10 +- Common/UnitDefinitions/Length.json | 6 +- ...chesTests.cs => LengthTests.FeetInches.cs} | 49 +++- UnitsNet.Tests/CustomCode/ParseTests.cs | 25 +- UnitsNet.Tests/UnitParserTests.cs | 10 +- .../CustomCode/Quantities/Length.extra.cs | 68 ++++- UnitsNet/CustomCode/QuantityParser.cs | 237 ++++++++---------- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 34 +-- UnitsNet/CustomCode/UnitParser.cs | 4 +- .../CustomCode/UnitValueAbbreviationLookup.cs | 2 +- .../Quantities/Level.NetFramework.g.cs | 73 +----- .../GeneratedCode/UnitAbbreviationsCache.g.cs | 4 +- ...clude-GenerateQuantitySourceCodeCommon.ps1 | 10 +- 101 files changed, 612 insertions(+), 800 deletions(-) rename UnitsNet.Tests/CustomCode/{FeetInchesTests.cs => LengthTests.FeetInches.cs} (54%) diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs index d2a979a292..6d0a2a93e2 100644 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs @@ -679,8 +679,7 @@ private static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -702,8 +701,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.MetersPerSecondSquared + y.MetersPerSecondSquared, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -720,7 +718,7 @@ private static AccelerationUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == AccelerationUnit.Undefined) { @@ -750,7 +748,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == AccelerationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs index 8ffdaf8cfc..9c4fb9a21c 100644 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs @@ -701,8 +701,7 @@ private static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Moles + y.Moles, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -724,8 +723,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Moles + y.Moles, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -742,7 +740,7 @@ private static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == AmountOfSubstanceUnit.Undefined) { @@ -772,7 +770,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == AmountOfSubstanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs index 4c179be8cd..c1fe46ff67 100644 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs @@ -480,8 +480,7 @@ private static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -503,8 +502,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.DecibelVolts + y.DecibelVolts, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -521,7 +519,7 @@ private static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == AmplitudeRatioUnit.Undefined) { @@ -551,7 +549,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == AmplitudeRatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs index a1f6eebf89..83cdf163dd 100644 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Angle.Common.g.cs @@ -700,8 +700,7 @@ private static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Degrees + y.Degrees, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -723,8 +722,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Degrees + y.Degrees, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -741,7 +739,7 @@ private static AngleUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == AngleUnit.Undefined) { @@ -771,7 +769,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == AngleUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs index 78cd8fb5eb..0ecc9b3128 100644 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs @@ -459,8 +459,7 @@ private static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.VoltampereHours + y.VoltampereHours, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ApparentEnergyUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ApparentEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs index a818ec550d..9df3c1f890 100644 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs @@ -481,8 +481,7 @@ private static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -504,8 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Voltamperes + y.Voltamperes, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -522,7 +520,7 @@ private static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ApparentPowerUnit.Undefined) { @@ -552,7 +550,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ApparentPowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs index 2459b00b7a..c58c270ae2 100644 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Area.Common.g.cs @@ -679,8 +679,7 @@ private static Area ParseInternal(string str, [CanBeNull] IFormatProvider provid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -702,8 +701,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.SquareMeters + y.SquareMeters, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -720,7 +718,7 @@ private static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == AreaUnit.Undefined) { @@ -750,7 +748,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == AreaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs index 4cd4aa2f13..2499aca212 100644 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs @@ -415,8 +415,7 @@ private static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.KilogramsPerSquareMeter + y.KilogramsPerSquareMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == AreaDensityUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == AreaDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs index 5b0cd13dcf..0b60cdd202 100644 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs @@ -525,8 +525,7 @@ private static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -548,8 +547,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.MetersToTheFourth + y.MetersToTheFourth, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -566,7 +564,7 @@ private static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == AreaMomentOfInertiaUnit.Undefined) { @@ -596,7 +594,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == AreaMomentOfInertiaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs index 6ddc4d0c32..1ad1293a07 100644 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs @@ -964,8 +964,7 @@ private static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider pro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -987,8 +986,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.BitsPerSecond + y.BitsPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1005,7 +1003,7 @@ private static BitRateUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == BitRateUnit.Undefined) { @@ -1035,7 +1033,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == BitRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs index 4af2b1ac17..0608d7e48d 100644 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs @@ -459,8 +459,7 @@ private static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.KilogramsPerJoule + y.KilogramsPerJoule, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IF { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs index f6b0b7356c..1fde587a73 100644 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs @@ -415,8 +415,7 @@ private static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Farads + y.Farads, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Farads + y.Farads, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == CapacitanceUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == CapacitanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs index 181c7b6999..dc2aee8589 100644 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Density.Common.g.cs @@ -1229,8 +1229,7 @@ private static Density ParseInternal(string str, [CanBeNull] IFormatProvider pro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -1252,8 +1251,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.KilogramsPerCubicMeter + y.KilogramsPerCubicMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1270,7 +1268,7 @@ private static DensityUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == DensityUnit.Undefined) { @@ -1300,7 +1298,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == DensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs index d74a34cb93..73439f778c 100644 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Duration.Common.g.cs @@ -613,8 +613,7 @@ private static Duration ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Seconds + y.Seconds, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -636,8 +635,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Seconds + y.Seconds, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -654,7 +652,7 @@ private static DurationUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == DurationUnit.Undefined) { @@ -684,7 +682,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == DurationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs index 5497bb6261..23979f9711 100644 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs @@ -525,8 +525,7 @@ private static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatPro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -548,8 +547,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.NewtonSecondsPerMeterSquared + y.NewtonSecondsPerMeterSquared, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -566,7 +564,7 @@ private static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == DynamicViscosityUnit.Undefined) { @@ -596,7 +594,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == DynamicViscosityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs index cc03d6012c..63a672f664 100644 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs @@ -481,8 +481,7 @@ private static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -504,8 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -522,7 +520,7 @@ private static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricAdmittanceUnit.Undefined) { @@ -552,7 +550,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricAdmittanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs index 87390b5eb6..5dbfebef04 100644 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs @@ -415,8 +415,7 @@ private static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Coulombs + y.Coulombs, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricChargeUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricChargeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs index 7f3ad066a1..6cb2bad778 100644 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs @@ -415,8 +415,7 @@ private static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IForm provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.CoulombsPerCubicMeter + y.CoulombsPerCubicMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricChargeDensityUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricChargeDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs index ef04132634..56d39d998a 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs @@ -459,8 +459,7 @@ private static ElectricConductance ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Siemens + y.Siemens, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Siemens + y.Siemens, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricConductanceUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricConductanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs index 82edcd345e..b1079413da 100644 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs @@ -415,8 +415,7 @@ private static ElectricConductivity ParseInternal(string str, [CanBeNull] IForma provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.SiemensPerMeter + y.SiemensPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static ElectricConductivityUnit ParseUnitInternal(string str, IFormatPro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricConductivityUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricConductivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs index 22c01b3809..c05dd17d91 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs @@ -569,8 +569,7 @@ private static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Amperes + y.Amperes, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -592,8 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Amperes + y.Amperes, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -610,7 +608,7 @@ private static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricCurrentUnit.Undefined) { @@ -640,7 +638,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricCurrentUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs index e230b33786..2bb80eac60 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs @@ -415,8 +415,7 @@ private static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFor provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.AmperesPerSquareMeter + y.AmperesPerSquareMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricCurrentDensityUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricCurrentDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs index 6cffa791ec..625f5f3f12 100644 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs @@ -415,8 +415,7 @@ private static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFo provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.AmperesPerSecond + y.AmperesPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricCurrentGradientUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricCurrentGradientUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs index 98b9072347..58e01b2c4b 100644 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs @@ -415,8 +415,7 @@ private static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.VoltsPerMeter + y.VoltsPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricFieldUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricFieldUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs index 2cfb8999f0..2e5b239d35 100644 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs @@ -415,8 +415,7 @@ private static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Henries + y.Henries, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Henries + y.Henries, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricInductanceUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricInductanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs index d6736fbd4a..36d1bc9933 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs @@ -503,8 +503,7 @@ private static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Volts + y.Volts, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -526,8 +525,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Volts + y.Volts, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -544,7 +542,7 @@ private static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricPotentialUnit.Undefined) { @@ -574,7 +572,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricPotentialUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs index 0c96db267e..25aece9384 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs @@ -502,8 +502,7 @@ private static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -525,8 +524,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.VoltsAc + y.VoltsAc, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -543,7 +541,7 @@ private static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricPotentialAcUnit.Undefined) { @@ -573,7 +571,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricPotentialAcUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs index e9e585ee64..1d2005ec42 100644 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs @@ -502,8 +502,7 @@ private static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -525,8 +524,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.VoltsDc + y.VoltsDc, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -543,7 +541,7 @@ private static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricPotentialDcUnit.Undefined) { @@ -573,7 +571,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricPotentialDcUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs index d33552494b..45f27e3218 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs @@ -481,8 +481,7 @@ private static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Ohms + y.Ohms, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -504,8 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Ohms + y.Ohms, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -522,7 +520,7 @@ private static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricResistanceUnit.Undefined) { @@ -552,7 +550,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricResistanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs index 5d96e7af87..bc1a12ad0c 100644 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs @@ -481,8 +481,7 @@ private static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -504,8 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.OhmMeters + y.OhmMeters, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -522,7 +520,7 @@ private static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ElectricResistivityUnit.Undefined) { @@ -552,7 +550,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ElectricResistivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs index 3169bc23e6..679d4ecf0e 100644 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Energy.Common.g.cs @@ -877,8 +877,7 @@ private static Energy ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Joules + y.Joules, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -900,8 +899,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Joules + y.Joules, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -918,7 +916,7 @@ private static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == EnergyUnit.Undefined) { @@ -948,7 +946,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == EnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs index 70a74a9194..d2b8047b4a 100644 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs @@ -547,8 +547,7 @@ private static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider pro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -570,8 +569,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.JoulesPerKelvin + y.JoulesPerKelvin, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -588,7 +586,7 @@ private static EntropyUnit ParseUnitInternal(string str, IFormatProvider provide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == EntropyUnit.Undefined) { @@ -618,7 +616,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == EntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs index 4b809d9614..527bd45208 100644 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Force.Common.g.cs @@ -613,8 +613,7 @@ private static Force ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Newtons + y.Newtons, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -636,8 +635,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Newtons + y.Newtons, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -654,7 +652,7 @@ private static ForceUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ForceUnit.Undefined) { @@ -684,7 +682,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ForceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs index 16b2cf0449..9c1f7f2341 100644 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs @@ -635,8 +635,7 @@ private static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -658,8 +657,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.NewtonsPerSecond + y.NewtonsPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -676,7 +674,7 @@ private static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ForceChangeRateUnit.Undefined) { @@ -706,7 +704,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ForceChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs index cf736506b2..a4099b4aa0 100644 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs @@ -591,8 +591,7 @@ private static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -614,8 +613,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.NewtonsPerMeter + y.NewtonsPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -632,7 +630,7 @@ private static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ForcePerLengthUnit.Undefined) { @@ -662,7 +660,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ForcePerLengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs index 9f5b6f7b3a..b9f4b25715 100644 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs @@ -569,8 +569,7 @@ private static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider p provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Hertz + y.Hertz, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -592,8 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Hertz + y.Hertz, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -610,7 +608,7 @@ private static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == FrequencyUnit.Undefined) { @@ -640,7 +638,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == FrequencyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs index c15cb25a98..4c5dc74008 100644 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs @@ -745,8 +745,7 @@ private static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -768,8 +767,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -786,7 +784,7 @@ private static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == HeatFluxUnit.Undefined) { @@ -816,7 +814,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == HeatFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs index 7ca816dd36..c3e53a657e 100644 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs @@ -437,8 +437,7 @@ private static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFo provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -460,8 +459,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.WattsPerSquareMeterKelvin + y.WattsPerSquareMeterKelvin, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -478,7 +476,7 @@ private static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormat { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == HeatTransferCoefficientUnit.Undefined) { @@ -508,7 +506,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == HeatTransferCoefficientUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs index a76f397653..461747c421 100644 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs @@ -481,8 +481,7 @@ private static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Lux + y.Lux, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -504,8 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Lux + y.Lux, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -522,7 +520,7 @@ private static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == IlluminanceUnit.Undefined) { @@ -552,7 +550,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == IlluminanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs index 43f53d807f..4dc7772045 100644 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Information.Common.g.cs @@ -964,8 +964,7 @@ private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Bits + y.Bits, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -987,8 +986,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Bits + y.Bits, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1005,7 +1003,7 @@ private static InformationUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == InformationUnit.Undefined) { @@ -1035,7 +1033,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == InformationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs index 18fb6c4551..9cf07001d2 100644 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs @@ -437,8 +437,7 @@ private static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -460,8 +459,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.WattsPerSquareMeter + y.WattsPerSquareMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -478,7 +476,7 @@ private static IrradianceUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == IrradianceUnit.Undefined) { @@ -508,7 +506,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == IrradianceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs index 31b6c55e97..f200105b05 100644 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs @@ -459,8 +459,7 @@ private static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.JoulesPerSquareMeter + y.JoulesPerSquareMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static IrradiationUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == IrradiationUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == IrradiationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs index 1557709422..1c52767722 100644 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs @@ -569,8 +569,7 @@ private static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -592,8 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.SquareMetersPerSecond + y.SquareMetersPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -610,7 +608,7 @@ private static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == KinematicViscosityUnit.Undefined) { @@ -640,7 +638,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == KinematicViscosityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs index 74bb128ac6..95ecc9ff70 100644 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs @@ -415,8 +415,7 @@ private static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider p provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.DegreesCelciusPerKilometer + y.DegreesCelciusPerKilometer, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == LapseRateUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == LapseRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs index d96924eb0a..5cf0e59579 100644 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Length.Common.g.cs @@ -877,8 +877,7 @@ private static Length ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Meters + y.Meters, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -900,8 +899,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Meters + y.Meters, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -918,7 +916,7 @@ private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == LengthUnit.Undefined) { @@ -948,7 +946,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == LengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs index 460c901c68..fb8bc39905 100644 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Level.Common.g.cs @@ -436,8 +436,7 @@ private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Decibels + y.Decibels, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -459,8 +458,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Decibels + y.Decibels, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -477,7 +475,7 @@ private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == LevelUnit.Undefined) { @@ -507,7 +505,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == LevelUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs index f944bdb31b..bf93d8745a 100644 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs @@ -459,8 +459,7 @@ private static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.KilogramsPerMeter + y.KilogramsPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == LinearDensityUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == LinearDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs index 84875930a8..1ec661ec2f 100644 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs @@ -415,8 +415,7 @@ private static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Lumens + y.Lumens, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Lumens + y.Lumens, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == LuminousFluxUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == LuminousFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs index e3c2665457..76d83c9d9e 100644 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs @@ -415,8 +415,7 @@ private static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Candela + y.Candela, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Candela + y.Candela, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == LuminousIntensityUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == LuminousIntensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs index 2731a33f19..6d97502e59 100644 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs @@ -415,8 +415,7 @@ private static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Teslas + y.Teslas, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Teslas + y.Teslas, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MagneticFieldUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MagneticFieldUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs index 5a1e968acd..8fa9e01791 100644 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs @@ -415,8 +415,7 @@ private static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Webers + y.Webers, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Webers + y.Webers, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MagneticFluxUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MagneticFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs index 52cce6354d..4e2cf27b84 100644 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs @@ -415,8 +415,7 @@ private static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.AmperesPerMeter + y.AmperesPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MagnetizationUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MagnetizationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs index 564c87dc4b..eb7891bca8 100644 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Mass.Common.g.cs @@ -877,8 +877,7 @@ private static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -900,8 +899,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Kilograms + y.Kilograms, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -918,7 +916,7 @@ private static MassUnit ParseUnitInternal(string str, IFormatProvider provider = { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MassUnit.Undefined) { @@ -948,7 +946,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MassUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs index 7b941233f2..e27aa6b919 100644 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs @@ -723,8 +723,7 @@ private static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -746,8 +745,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.GramsPerSecond + y.GramsPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -764,7 +762,7 @@ private static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MassFlowUnit.Undefined) { @@ -794,7 +792,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MassFlowUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs index e9dcb735fa..b23e5aca4b 100644 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs @@ -437,8 +437,7 @@ private static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -460,8 +459,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.KilogramsPerSecondPerSquareMeter + y.KilogramsPerSecondPerSquareMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -478,7 +476,7 @@ private static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MassFluxUnit.Undefined) { @@ -508,7 +506,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MassFluxUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs index d8ffb92ba3..00650df202 100644 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs @@ -1009,8 +1009,7 @@ private static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -1032,8 +1031,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.KilogramSquareMeters + y.KilogramSquareMeters, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1050,7 +1048,7 @@ private static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MassMomentOfInertiaUnit.Undefined) { @@ -1080,7 +1078,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MassMomentOfInertiaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs index 245c2b9db4..c7976e833c 100644 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs @@ -459,8 +459,7 @@ private static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.JoulesPerMole + y.JoulesPerMole, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MolarEnergyUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MolarEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs index a2079795df..dfc6fdcff9 100644 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs @@ -459,8 +459,7 @@ private static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.JoulesPerMoleKelvin + y.JoulesPerMoleKelvin, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MolarEntropyUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MolarEntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs index cde782d394..b4522ad436 100644 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs @@ -657,8 +657,7 @@ private static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider p provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -680,8 +679,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.KilogramsPerMole + y.KilogramsPerMole, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -698,7 +696,7 @@ private static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MolarMassUnit.Undefined) { @@ -728,7 +726,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MolarMassUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs index b551f2e57a..a433111a73 100644 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs @@ -569,8 +569,7 @@ private static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -592,8 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.MolesPerCubicMeter + y.MolesPerCubicMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -610,7 +608,7 @@ private static MolarityUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == MolarityUnit.Undefined) { @@ -640,7 +638,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == MolarityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs index 26b3a79c94..b04f222029 100644 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs @@ -415,8 +415,7 @@ private static Permeability ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.HenriesPerMeter + y.HenriesPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == PermeabilityUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == PermeabilityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs index a96cf85386..3fb2bd490f 100644 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs @@ -415,8 +415,7 @@ private static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -438,8 +437,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.FaradsPerMeter + y.FaradsPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -456,7 +454,7 @@ private static PermittivityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == PermittivityUnit.Undefined) { @@ -486,7 +484,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == PermittivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs index 89037f0f1a..03c8a5e79e 100644 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Power.Common.g.cs @@ -833,8 +833,7 @@ private static Power ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Watts + y.Watts, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -856,8 +855,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Watts + y.Watts, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -874,7 +872,7 @@ private static PowerUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == PowerUnit.Undefined) { @@ -904,7 +902,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == PowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs index 5d273e3417..8ec46a9658 100644 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs @@ -1361,8 +1361,7 @@ private static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvide provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -1384,8 +1383,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.WattsPerCubicMeter + y.WattsPerCubicMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1402,7 +1400,7 @@ private static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider pr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == PowerDensityUnit.Undefined) { @@ -1432,7 +1430,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == PowerDensityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs index 518471df32..66d9f5d959 100644 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs @@ -436,8 +436,7 @@ private static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -459,8 +458,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.DecibelWatts + y.DecibelWatts, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -477,7 +475,7 @@ private static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == PowerRatioUnit.Undefined) { @@ -507,7 +505,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == PowerRatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs index c3db07bf24..baadedff81 100644 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs @@ -1207,8 +1207,7 @@ private static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Pascals + y.Pascals, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -1230,8 +1229,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Pascals + y.Pascals, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1248,7 +1246,7 @@ private static PressureUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == PressureUnit.Undefined) { @@ -1278,7 +1276,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == PressureUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs index 7b3b600e5f..db9a9d9670 100644 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs @@ -481,8 +481,7 @@ private static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatP provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -504,8 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.PascalsPerSecond + y.PascalsPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -522,7 +520,7 @@ private static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvi { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == PressureChangeRateUnit.Undefined) { @@ -552,7 +550,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == PressureChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs index 55e0b0ab88..2f15162ea9 100644 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs @@ -524,8 +524,7 @@ private static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -547,8 +546,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.DecimalFractions + y.DecimalFractions, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -565,7 +563,7 @@ private static RatioUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == RatioUnit.Undefined) { @@ -595,7 +593,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == RatioUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs index 001687c404..b6e38f715b 100644 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs @@ -459,8 +459,7 @@ private static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.VoltampereReactiveHours + y.VoltampereReactiveHours, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ReactiveEnergyUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ReactiveEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs index a447e75069..e97faed80e 100644 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs @@ -481,8 +481,7 @@ private static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvid provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -504,8 +503,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.VoltamperesReactive + y.VoltamperesReactive, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -522,7 +520,7 @@ private static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider p { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ReactivePowerUnit.Undefined) { @@ -552,7 +550,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ReactivePowerUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs index 84c60712c6..54863e9bca 100644 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs @@ -459,8 +459,7 @@ private static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFor provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.RadiansPerSecondSquared + y.RadiansPerSecondSquared, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatP { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == RotationalAccelerationUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == RotationalAccelerationUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs index 3620080e25..c03e2d0da3 100644 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs @@ -679,8 +679,7 @@ private static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -702,8 +701,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.RadiansPerSecond + y.RadiansPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -720,7 +718,7 @@ private static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == RotationalSpeedUnit.Undefined) { @@ -750,7 +748,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == RotationalSpeedUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs index 21cacb0712..f3a2d2b280 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs @@ -459,8 +459,7 @@ private static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.NewtonMetersPerRadian + y.NewtonMetersPerRadian, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == RotationalStiffnessUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == RotationalStiffnessUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs index 943f679024..d8b10b8930 100644 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs @@ -459,8 +459,7 @@ private static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -482,8 +481,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.NewtonMetersPerRadianPerMeter + y.NewtonMetersPerRadianPerMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -500,7 +498,7 @@ private static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IF { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == RotationalStiffnessPerLengthUnit.Undefined) { @@ -530,7 +528,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == RotationalStiffnessPerLengthUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs index 7a445f8f83..344b7d5050 100644 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs @@ -414,8 +414,7 @@ private static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Steradians + y.Steradians, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -437,8 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Steradians + y.Steradians, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -455,7 +453,7 @@ private static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == SolidAngleUnit.Undefined) { @@ -485,7 +483,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == SolidAngleUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs index 87278341dd..e93fce1dab 100644 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs @@ -569,8 +569,7 @@ private static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -592,8 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.JoulesPerKilogram + y.JoulesPerKilogram, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -610,7 +608,7 @@ private static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == SpecificEnergyUnit.Undefined) { @@ -640,7 +638,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == SpecificEnergyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs index f9d7cd18be..b94fb65d1d 100644 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs @@ -569,8 +569,7 @@ private static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProv provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -592,8 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.JoulesPerKilogramKelvin + y.JoulesPerKilogramKelvin, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -610,7 +608,7 @@ private static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == SpecificEntropyUnit.Undefined) { @@ -640,7 +638,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == SpecificEntropyUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs index d697f500be..f56d086df0 100644 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs @@ -437,8 +437,7 @@ private static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -460,8 +459,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.CubicMetersPerKilogram + y.CubicMetersPerKilogram, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -478,7 +476,7 @@ private static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == SpecificVolumeUnit.Undefined) { @@ -508,7 +506,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == SpecificVolumeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs index 644612dfa6..6ecacc9fec 100644 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs @@ -767,8 +767,7 @@ private static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -790,8 +789,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.NewtonsPerCubicMeter + y.NewtonsPerCubicMeter, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -808,7 +806,7 @@ private static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == SpecificWeightUnit.Undefined) { @@ -838,7 +836,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == SpecificWeightUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs index 048ddd0502..630d1f1ff3 100644 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Speed.Common.g.cs @@ -1097,8 +1097,7 @@ private static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provi provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -1120,8 +1119,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.MetersPerSecond + y.MetersPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1138,7 +1136,7 @@ private static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == SpeedUnit.Undefined) { @@ -1168,7 +1166,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == SpeedUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs index 939ab11ba7..5d4c748cb7 100644 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs @@ -569,8 +569,7 @@ private static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -592,8 +591,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -610,7 +608,7 @@ private static TemperatureUnit ParseUnitInternal(string str, IFormatProvider pro { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == TemperatureUnit.Undefined) { @@ -640,7 +638,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == TemperatureUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs index 36cde49a47..7fd42725ee 100644 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs @@ -613,8 +613,7 @@ private static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IForm provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -636,8 +635,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.DegreesCelsiusPerSecond + y.DegreesCelsiusPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -654,7 +652,7 @@ private static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatPr { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == TemperatureChangeRateUnit.Undefined) { @@ -684,7 +682,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == TemperatureChangeRateUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs index 84833c4fd7..0cd1a49739 100644 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs @@ -568,8 +568,7 @@ private static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatPro provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -591,8 +590,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.Kelvins + y.Kelvins, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -609,7 +607,7 @@ private static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvide { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == TemperatureDeltaUnit.Undefined) { @@ -639,7 +637,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == TemperatureDeltaUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs index a09d0982fa..1c23b158ee 100644 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs @@ -437,8 +437,7 @@ private static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -460,8 +459,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.WattsPerMeterKelvin + y.WattsPerMeterKelvin, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -478,7 +476,7 @@ private static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProv { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ThermalConductivityUnit.Undefined) { @@ -508,7 +506,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ThermalConductivityUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs index 13068ea152..a50ef603b4 100644 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs @@ -503,8 +503,7 @@ private static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatPr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -526,8 +525,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.SquareMeterKelvinsPerKilowatt + y.SquareMeterKelvinsPerKilowatt, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -544,7 +542,7 @@ private static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == ThermalResistanceUnit.Undefined) { @@ -574,7 +572,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == ThermalResistanceUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs index 83e93c1cb2..fd91c3cca3 100644 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Torque.Common.g.cs @@ -855,8 +855,7 @@ private static Torque ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -878,8 +877,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.NewtonMeters + y.NewtonMeters, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -896,7 +894,7 @@ private static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == TorqueUnit.Undefined) { @@ -926,7 +924,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == TorqueUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs index 4d6b0c5a4c..cbf92fdf97 100644 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs @@ -414,8 +414,7 @@ private static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider pr provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -437,8 +436,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.InternationalUnits + y.InternationalUnits, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -455,7 +453,7 @@ private static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provid { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == VitaminAUnit.Undefined) { @@ -485,7 +483,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == VitaminAUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs index 0bad7a2881..be78c8f41e 100644 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ b/Common/GeneratedCode/Quantities/Volume.Common.g.cs @@ -1317,8 +1317,7 @@ private static Volume ParseInternal(string str, [CanBeNull] IFormatProvider prov provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -1340,8 +1339,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.CubicMeters + y.CubicMeters, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1358,7 +1356,7 @@ private static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == VolumeUnit.Undefined) { @@ -1388,7 +1386,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == VolumeUnit.Undefined) diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs index 6201e6011e..1965904664 100644 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs @@ -965,8 +965,7 @@ private static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From, - (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit)); + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// @@ -988,8 +987,7 @@ private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormat provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.CubicMetersPerSecond + y.CubicMetersPerSecond, BaseUnit), out result); + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// @@ -1006,7 +1004,7 @@ private static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider prov { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse(str.Trim(), provider); + var unit = UnitParser.Default.Parse(str, provider); if (unit == VolumeFlowUnit.Undefined) { @@ -1036,7 +1034,7 @@ private static bool TryParseUnitInternal(string str, IFormatProvider provider, o if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse(str, provider, out unit)) return false; if(unit == VolumeFlowUnit.Undefined) diff --git a/Common/UnitDefinitions/Length.json b/Common/UnitDefinitions/Length.json index 2ee0fd3767..ea24e97c88 100644 --- a/Common/UnitDefinitions/Length.json +++ b/Common/UnitDefinitions/Length.json @@ -64,7 +64,7 @@ "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "ft", "'" ] + "Abbreviations": [ "ft", "'", "′" ] }, { "Culture": "ru-RU", @@ -92,7 +92,7 @@ "Localization": [ { "Culture": "en-US", - "Abbreviations": [ "in", "\\\"" ] + "Abbreviations": [ "in", "\\\"", "″" ] }, { "Culture": "ru-RU", @@ -233,4 +233,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/CustomCode/FeetInchesTests.cs b/UnitsNet.Tests/CustomCode/LengthTests.FeetInches.cs similarity index 54% rename from UnitsNet.Tests/CustomCode/FeetInchesTests.cs rename to UnitsNet.Tests/CustomCode/LengthTests.FeetInches.cs index 73dd817f8e..715a655fed 100644 --- a/UnitsNet.Tests/CustomCode/FeetInchesTests.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.FeetInches.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -46,5 +46,46 @@ public void FeetInchesRoundTrip() AssertEx.EqualTolerance(2, feetInches.Feet, FeetTolerance); AssertEx.EqualTolerance(3, feetInches.Inches, InchesTolerance); } + + [Theory] + [InlineData("1'", 1)] // Feet only + [InlineData("1′", 1)] // Feet only + [InlineData("1\"", 0.08333333)] // Inches only + [InlineData("1″", 0.08333333)] // Inches only + [InlineData("1' 1\"", 1.08333333)] // Normal form + [InlineData("1′ 1″", 1.08333333)] // Normal form + [InlineData(" 1′ 1″ ", 1.08333333)] // Normal form, requires trimming + [InlineData("1'1\"", 1.08333333)] // Without space + [InlineData("1′1″", 1.08333333)] // Without space + [InlineData("1 ft 1 in", 1.08333333)] + [InlineData("1ft 1in", 1.08333333)] + public void TryParseFeetInches(string str, double expectedFeet) + { + Assert.True(Length.TryParseFeetInches(str, out Length result)); + AssertEx.EqualTolerance(expectedFeet, result.Feet, 1e-5); + } + + [Theory] + [InlineData("a")] // Missing or invalid apostrophe or double prime chars + [InlineData("1")] + [InlineData("1`")] + [InlineData("1^")] + [InlineData("1' 1'")] // Feet apostrophe twice + [InlineData("1′ 1′")] + [InlineData("1' 1")] // No inches double prime + [InlineData("1′ 1")] + [InlineData("1′ 1`")] // Invalid inches double prime + [InlineData("1' 1`")] + [InlineData("1'1'")] // Same without space + [InlineData("1′1′")] + [InlineData("1'1")] + [InlineData("1′1")] + [InlineData("1′1`")] + [InlineData("1'1`")] + public void TryParseFeetInches_GivenInvalidString_ReturnsFalseAndZeroOut(string str) + { + Assert.False(Length.TryParseFeetInches(str, out Length result)); + Assert.Equal(Length.Zero, result); + } } -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/CustomCode/ParseTests.cs b/UnitsNet.Tests/CustomCode/ParseTests.cs index 3a05a64df8..294c12d0e1 100644 --- a/UnitsNet.Tests/CustomCode/ParseTests.cs +++ b/UnitsNet.Tests/CustomCode/ParseTests.cs @@ -38,6 +38,7 @@ public class ParseTests { [Theory] [InlineData("1km", 1000)] + [InlineData(" 1km ", 1000)] // Check that it also trims string [InlineData("1 km", 1000)] [InlineData("1e-3 km", 1)] [InlineData("5.5 m", 5.5)] @@ -51,11 +52,11 @@ public void ParseLengthToMetersUsEnglish(string s, double expected) [Theory] [InlineData(null, typeof(ArgumentNullException))] // Can't parse null. - [InlineData("1", typeof(ArgumentException))] // No unit abbreviation. - [InlineData("km", typeof(UnitsNetException))] // No value, wrong measurement type. - [InlineData("1 kg", typeof(UnitsNetException))] // Wrong measurement type. - [InlineData("1ft monkey 1in", typeof(UnitsNetException))] // Invalid separator between two valid measurements. - [InlineData("1ft 1invalid", typeof(UnitsNetException))] // Valid + [InlineData("1", typeof(FormatException))] // No unit abbreviation. + [InlineData("km", typeof(FormatException))] // No value, wrong measurement type. + [InlineData("1 kg", typeof(FormatException))] // Wrong measurement type. + [InlineData("1ft monkey 1in", typeof(FormatException))] // Invalid separator between two valid measurements. + [InlineData("1ft 1invalid", typeof(FormatException))] // Valid public void ParseLength_InvalidString_USEnglish_ThrowsException(string s, Type expectedExceptionType) { var usEnglish = new CultureInfo("en-US"); @@ -71,20 +72,24 @@ public void ParseWithCultureUsingSpaceAsThousandSeparators(string s, double expe { var numberFormat = (NumberFormatInfo) CultureInfo.InvariantCulture.NumberFormat.Clone(); numberFormat.NumberGroupSeparator = " "; + numberFormat.CurrencyGroupSeparator = " "; numberFormat.NumberDecimalSeparator = "."; + numberFormat.CurrencyDecimalSeparator = "."; double actual = Length.Parse(s, numberFormat).Meters; Assert.Equal(expected, actual); } [Theory] - [InlineData("500.005.050,001 m", typeof(UnitsNetException))] + [InlineData("500.005.050,001 m", typeof(FormatException))] // quantity doesn't match number format public void ParseWithCultureUsingSpaceAsThousandSeparators_ThrowsExceptionOnInvalidString(string s, Type expectedExceptionType) { var numberFormat = (NumberFormatInfo) CultureInfo.InvariantCulture.NumberFormat.Clone(); numberFormat.NumberGroupSeparator = " "; + numberFormat.CurrencyGroupSeparator = " "; numberFormat.NumberDecimalSeparator = "."; + numberFormat.CurrencyDecimalSeparator = "."; Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); } @@ -98,7 +103,9 @@ public void ParseWithCultureUsingDotAsThousandSeparators(string s, double expect { var numberFormat = (NumberFormatInfo) CultureInfo.InvariantCulture.NumberFormat.Clone(); numberFormat.NumberGroupSeparator = "."; + numberFormat.CurrencyGroupSeparator = "."; numberFormat.NumberDecimalSeparator = ","; + numberFormat.CurrencyDecimalSeparator = ","; double actual = Length.Parse(s, numberFormat).Meters; Assert.Equal(expected, actual); @@ -112,12 +119,14 @@ public void ParseMultiWordAbbreviations() } [Theory] - [InlineData("500 005 m", typeof(UnitsNetException))] // Quantity doesn't match number format. + [InlineData("500 005 m", typeof(FormatException))] // Quantity doesn't match number format. public void ParseWithCultureUsingDotAsThousandSeparators_ThrowsExceptionOnInvalidString(string s, Type expectedExceptionType) { var numberFormat = (NumberFormatInfo) CultureInfo.InvariantCulture.NumberFormat.Clone(); numberFormat.NumberGroupSeparator = "."; + numberFormat.CurrencyGroupSeparator = "."; numberFormat.NumberDecimalSeparator = ","; + numberFormat.CurrencyDecimalSeparator = ","; Assert.Throws(expectedExceptionType, () => Length.Parse(s, numberFormat)); } @@ -142,7 +151,7 @@ public void ParseLengthUnitUsEnglish_ThrowsExceptionOnInvalidString(string s, Ty [Theory] [InlineData("1 m", true)] - [InlineData("1 m 50 cm", true)] + [InlineData("1 m 50 cm", false)] [InlineData("2 kg", false)] [InlineData(null, false)] [InlineData("foo", false)] diff --git a/UnitsNet.Tests/UnitParserTests.cs b/UnitsNet.Tests/UnitParserTests.cs index 5270fcb328..a6d1dafd8f 100644 --- a/UnitsNet.Tests/UnitParserTests.cs +++ b/UnitsNet.Tests/UnitParserTests.cs @@ -48,7 +48,7 @@ public void Parse_UnknownAbbreviationThrowsUnitNotFoundException() } [Fact] - public void ShouldUseCorrectMicroSign() + public void ParseUnit_ShouldUseCorrectMicroSign() { // "\u00b5" = Micro sign Assert.Equal(AccelerationUnit.MicrometerPerSecondSquared, Acceleration.ParseUnit("\u00b5m/s²")); @@ -118,13 +118,5 @@ public void Parse_AmbiguousUnitsThrowsException() Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception1.Message); Assert.Equal("Cannot parse \"pt\" since it could be either of these: DtpPoint, PrinterPoint", exception2.Message); } - - [Fact] - public void Parse_UnambiguousUnitsDoesNotThrow() - { - var unit = Volume.Parse("1 l"); - - Assert.Equal(Volume.FromLiters(1), unit); - } } } diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index 118ccdb360..20bc2af780 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,6 +20,7 @@ // THE SOFTWARE. using System; +using System.Text.RegularExpressions; using JetBrains.Annotations; using UnitsNet.Units; @@ -68,6 +69,67 @@ public static Length FromFeetInches(double feet, double inches) // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP + + /// + /// Special parsing of feet/inches strings, commonly used. + /// 2 feet 4 inches is sometimes denoted as 2′−4″, 2′ 4″, 2′4″, 2 ft 4 in. + /// The apostrophe can be ′ and '. + /// The double prime can be ″ and ". + /// https://en.wikipedia.org/wiki/Foot_(unit) + /// + /// + /// Optionally specify the culture format numbers and localize unit abbreviations. Defaults to thread's culture. + /// Parsed length. + public static Length ParseFeetInches(string str, IFormatProvider formatProvider = null) + { + if (!TryParseFeetInches(str, out Length result, formatProvider)) + { + // A bit lazy, but I didn't want to duplicate this edge case implementation just to get more narrow exception descriptions. + throw new FormatException("Unable to parse feet and inches. Expected format \"2' 4\"\" or \"2 ft 4 in\". Whitespace is optional."); + } + + return result; + } + + /// + /// Special parsing of feet/inches strings, commonly used. + /// 2 feet 4 inches is sometimes denoted as 2′−4″, 2′ 4″, 2′4″, 2 ft 4 in. + /// The apostrophe can be ′ and '. + /// The double prime can be ″ and ". + /// https://en.wikipedia.org/wiki/Foot_(unit) + /// + /// + /// Parsed length. + /// Optionally specify the culture format numbers and localize unit abbreviations. Defaults to thread's culture. + public static bool TryParseFeetInches(string str, out Length result, IFormatProvider formatProvider = null) + { + // This succeeds if only feet or inches are given, not both + if (TryParseInternal(str, formatProvider, out result)) + return true; + + var quantityParser = QuantityParser.Default; + string footRegex = quantityParser.CreateRegexPatternForUnit(LengthUnit.Foot, formatProvider, matchEntireString: false); + string inchRegex = quantityParser.CreateRegexPatternForUnit(LengthUnit.Inch, formatProvider, matchEntireString: false); + + // Match entire string exactly + string pattern = $@"^(?{footRegex})\s?(?{inchRegex})$"; + + var match = new Regex(pattern, RegexOptions.Singleline).Match(str.Trim()); + if (!match.Success) return false; + + var feetGroup = match.Groups["feet"]; + var inchesGroup = match.Groups["inches"]; + if (TryParseInternal(feetGroup.Value, formatProvider, out Length feet) && + TryParseInternal(inchesGroup.Value, formatProvider, out Length inches)) + { + result = feet + inches; + return true; + } + + result = default; + return false; + } + public static Speed operator /(Length length, TimeSpan timeSpan) { return Speed.FromMetersPerSecond(length.Meters/timeSpan.TotalSeconds); diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index f4b1ea767d..41c02aecd7 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -34,24 +34,29 @@ namespace UnitsNet internal delegate bool TryParseUnitDelegate(string unitString, IFormatProvider formatProvider, out TUnitType unit) where TUnitType : Enum; #if !WINDOWS_UWP - internal delegate TQuantity QuantityFromDelegate(QuantityValue value, TUnitType fromUnit) + internal delegate TQuantity QuantityFromDelegate(QuantityValue value, TUnitType fromUnit) where TQuantity : IQuantity where TUnitType : Enum; #else - internal delegate TQuantity QuantityFromDelegate(double value, TUnitType fromUnit) + internal delegate TQuantity QuantityFromDelegate(double value, TUnitType fromUnit) where TQuantity : IQuantity where TUnitType : Enum; #endif internal class QuantityParser { - private readonly UnitAbbreviationsCache unitAbbreviationsCache; + /// + /// Allow integer, floating point or exponential number formats. + /// + private const NumberStyles ParseNumberStyles = NumberStyles.Number | NumberStyles.Float | NumberStyles.AllowExponent; + + private readonly UnitAbbreviationsCache _unitAbbreviationsCache; public static QuantityParser Default { get; } public QuantityParser(UnitAbbreviationsCache unitAbbreviationsCache) { - this.unitAbbreviationsCache = unitAbbreviationsCache ?? UnitAbbreviationsCache.Default; + _unitAbbreviationsCache = unitAbbreviationsCache ?? UnitAbbreviationsCache.Default; } static QuantityParser() @@ -63,14 +68,12 @@ static QuantityParser() internal TQuantity Parse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, [NotNull] ParseUnitDelegate parseUnit, - [NotNull] QuantityFromDelegate fromDelegate, - [NotNull] Func add) + [NotNull] QuantityFromDelegate fromDelegate) where TQuantity : IQuantity where TUnitType : Enum { if (str == null) throw new ArgumentNullException(nameof(str)); if (parseUnit == null) throw new ArgumentNullException(nameof(parseUnit)); - if (add == null) throw new ArgumentNullException(nameof(add)); var numFormat = formatProvider != null ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) @@ -79,95 +82,16 @@ internal TQuantity Parse([NotNull] string str, if (numFormat == null) throw new InvalidOperationException($"No number format was found for the given format provider: {formatProvider}"); - var numRegex = string.Format(@"[\d., {0}{1}]*\d", - // allows digits, dots, commas, and spaces in the quantity (must end in digit) - numFormat.NumberGroupSeparator, // adds provided (or current) culture's group separator - numFormat.NumberDecimalSeparator); // adds provided (or current) culture's decimal separator - - const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; - - var unitAbbreviations = unitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) - .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error - .Select(Regex.Escape) // Escape special regex characters - .ToArray(); - - var unitsRegex = $"({String.Join("|", unitAbbreviations)})"; - - var regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", - numRegex, // capture base (integral) Quantity value - exponentialRegex, // capture exponential (if any), end of Quantity capturing - @"\s?", // ignore whitespace (allows both "1kg", "1 kg") - $@"(?{unitsRegex})", // capture Unit by list of abbreviations - @"(and)?,?", // allow "and" & "," separators between quantities - @"(?[a-z]*)?"); // capture invalid input - - var quantities = ParseWithRegex(regexString, str, parseUnit, fromDelegate, formatProvider); - if (quantities.Count == 0) - { - throw new ArgumentException( - "Expected string to have at least one pair of quantity and unit in the format" - + " \"<quantity> <unit>\". Eg. \"5.5 m\" or \"1ft 2in\""); - } - - return quantities.Aggregate(add); - } - - /// - /// Parse a string given a particular regular expression. - /// - /// Error parsing string. - private static List ParseWithRegex(string regexString, string str, ParseUnitDelegate parseUnit, - QuantityFromDelegate fromDelegate, IFormatProvider formatProvider = null) - where TQuantity : IQuantity - where TUnitType : Enum - { - var regex = new Regex(regexString); - var matches = regex.Matches(str.Trim()); - var converted = new List(); + var regex = CreateRegexForQuantity(formatProvider); - foreach (Match match in matches) + if (!ExtractValueAndUnit(regex, str, out var valueString, out var unitString)) { - var groups = match.Groups; - - var valueString = groups["value"].Value; - var unitString = groups["unit"].Value; - if (groups["invalid"].Value != string.Empty) - { - var newEx = new UnitsNetException("Invalid string detected: " + groups["invalid"].Value); - newEx.Data["input"] = str; - newEx.Data["matched value"] = valueString; - newEx.Data["matched unit"] = unitString; - newEx.Data["formatprovider"] = formatProvider?.ToString(); - throw newEx; - } - - if ((valueString == string.Empty) && (unitString == string.Empty)) - continue; - - try - { - var value = double.Parse(valueString, formatProvider); - var parsedUnit = parseUnit(unitString, formatProvider); - var quantity = fromDelegate(value, parsedUnit); - - converted.Add(quantity); - } - catch (AmbiguousUnitParseException) - { - throw; - } - catch (Exception ex) - { - var newEx = new UnitsNetException("Error parsing string.", ex); - newEx.Data["input"] = str; - newEx.Data["matched value"] = valueString; - newEx.Data["matched unit"] = unitString; - newEx.Data["formatprovider"] = formatProvider?.ToString(); - throw newEx; - } + var ex = new FormatException("Unable to parse quantity. Expected the form \"{value} {unit abbreviation}\", such as \"5.5 m\". The spacing is optional."); + ex.Data["input"] = str; + throw ex; } - return converted; + return ParseWithRegex(valueString, unitString, parseUnit, fromDelegate, formatProvider); } [SuppressMessage("ReSharper", "UseStringInterpolation")] @@ -175,15 +99,13 @@ internal bool TryParse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, [NotNull] TryParseUnitDelegate parseUnit, [NotNull] QuantityFromDelegate fromDelegate, - [NotNull] Func add, out TQuantity value) + out TQuantity result) where TQuantity : IQuantity where TUnitType : Enum { - value = default(TQuantity); + result = default; if(string.IsNullOrWhiteSpace(str)) return false; - if(parseUnit == null) return false; - if(add == null) return false; var numFormat = formatProvider != null ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) @@ -192,73 +114,110 @@ internal bool TryParse([NotNull] string str, if(numFormat == null) return false; - var numRegex = string.Format(@"[\d., {0}{1}]*\d", - // allows digits, dots, commas, and spaces in the quantity (must end in digit) - numFormat.NumberGroupSeparator, // adds provided (or current) culture's group separator - numFormat.NumberDecimalSeparator); // adds provided (or current) culture's decimal separator + var regex = CreateRegexForQuantity(formatProvider); - const string exponentialRegex = @"(?:[eE][-+]?\d+)?)"; + if (!ExtractValueAndUnit(regex, str, out var valueString, out var unitString)) + return false; - var unitAbbreviations = unitAbbreviationsCache.GetAllAbbreviations(typeof(TUnitType)) - .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" and throw invalid string error - .Select(Regex.Escape) // Escape special regex characters - .ToArray(); + return TryParseWithRegex(valueString, unitString, parseUnit, fromDelegate, formatProvider, out result); + } - var unitsRegex = $"({String.Join("|", unitAbbreviations)})"; + internal string CreateRegexPatternForUnit( + TUnitType unit, + IFormatProvider formatProvider, + bool matchEntireString = true) + where TUnitType : Enum + { + var unitAbbreviations = _unitAbbreviationsCache.GetUnitAbbreviations(unit, formatProvider); + var pattern = GetRegexPatternForUnitAbbreviations(unitAbbreviations); + return matchEntireString ? $"^{pattern}$" : pattern; + } - var regexString = string.Format(@"(?:\s*(?[-+]?{0}{1}{2}{3})?{4}{5}", - numRegex, // capture base (integral) Quantity value - exponentialRegex, // capture exponential (if any), end of Quantity capturing - @"\s?", // ignore whitespace (allows both "1kg", "1 kg") - $@"(?{unitsRegex})", // capture Unit by list of abbreviations - @"(and)?,?", // allow "and" & "," separators between quantities - @"(?[a-z]*)?"); // capture invalid input + private static string GetRegexPatternForUnitAbbreviations(IEnumerable abbreviations) + { + var orderedAbbreviations = abbreviations + .OrderByDescending(s => s.Length) // Important to order by length -- if "m" is before "mm" and the input is "mm", it will match just "m" + .Select(Regex.Escape) // Escape special regex characters + .ToArray(); - if(!TryParseWithRegex(regexString, str, parseUnit, fromDelegate, formatProvider, out var quantities)) - return false; + var abbreviationsPiped = $"{string.Join("|", orderedAbbreviations)}"; + return $@"(?.*?)\s?(?{abbreviationsPiped})"; + } - value = quantities.Aggregate(add); - return true; + /// + /// Parse a string given a particular regular expression. + /// + /// Error parsing string. + private static TQuantity ParseWithRegex(string valueString, + string unitString, + ParseUnitDelegate parseUnit, + QuantityFromDelegate fromDelegate, + IFormatProvider formatProvider) + where TQuantity : IQuantity + where TUnitType : Enum + { + var value = double.Parse(valueString, ParseNumberStyles, formatProvider); + var parsedUnit = parseUnit(unitString, formatProvider); + return fromDelegate(value, parsedUnit); } /// /// Parse a string given a particular regular expression. /// /// Error parsing string. - private static bool TryParseWithRegex(string regexString, string str, TryParseUnitDelegate tryParseUnit, - QuantityFromDelegate fromDelegate, IFormatProvider formatProvider, out List converted) + private static bool TryParseWithRegex(string valueString, + string unitString, + TryParseUnitDelegate tryParseUnit, + QuantityFromDelegate fromDelegate, + IFormatProvider formatProvider, + out TQuantity result) where TQuantity : IQuantity where TUnitType : Enum { - converted = new List(); + result = default; - var regex = new Regex(regexString); - var matches = regex.Matches(str.Trim()); + if (!double.TryParse(valueString, ParseNumberStyles, formatProvider, out var value)) + return false; - foreach(Match match in matches) - { - var groups = match.Groups; + if (!tryParseUnit(unitString, formatProvider, out var parsedUnit)) + return false; - var valueString = groups["value"].Value; - var unitString = groups["unit"].Value; - if(groups["invalid"].Value != string.Empty) - return false; + result = fromDelegate(value, parsedUnit); + return true; + } - if((valueString == string.Empty) && (unitString == string.Empty)) - continue; + private static bool ExtractValueAndUnit(Regex regex, string str, out string valueString, out string unitString) + { + var match = regex.Match(str.Trim()); + var groups = match.Groups; - if(!double.TryParse(valueString, NumberStyles.Any, formatProvider, out var value)) - return false; + var valueGroup = groups["value"]; + var unitGroup = groups["unit"]; + if (!valueGroup.Success || !unitGroup.Success) + { + valueString = null; + unitString = null; + return false; + } - if(!tryParseUnit(unitString, formatProvider, out var parsedUnit)) - return false; + valueString = valueGroup.Value; + unitString = unitGroup.Value; + return true; + } - var quantity = fromDelegate(value, parsedUnit); + private string CreateRegexPatternForQuantity(IFormatProvider formatProvider) where TUnitType : Enum + { + var unitAbbreviations = _unitAbbreviationsCache.GetAllUnitAbbreviationsForQuantity(typeof(TUnitType), formatProvider); + var pattern = GetRegexPatternForUnitAbbreviations(unitAbbreviations); - converted.Add(quantity); - } + // Match entire string exactly + return $"^{pattern}$"; + } - return true; + private Regex CreateRegexForQuantity([CanBeNull] IFormatProvider formatProvider) where TUnitType : Enum + { + var pattern = CreateRegexPatternForQuantity(formatProvider); + return new Regex(pattern, RegexOptions.Singleline); } } } diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index ee4523084d..7b7ec1cdd1 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -34,10 +34,10 @@ namespace UnitsNet { public sealed partial class UnitAbbreviationsCache { - private Dictionary looksupsForCulture; + private readonly Dictionary _lookupsForCulture; /// - /// Fallback culture used by and + /// Fallback culture used by and /// if no abbreviations are found with a given culture. /// /// @@ -51,7 +51,7 @@ public sealed partial class UnitAbbreviationsCache public UnitAbbreviationsCache() { - looksupsForCulture = new Dictionary(); + _lookupsForCulture = new Dictionary(); LoadGeneratedAbbreviations(); } @@ -143,8 +143,8 @@ void MapUnitToAbbreviation(Type unitType, int unitValue, IFormatProvider formatP formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; - if(!looksupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) - quantitiesForProvider = looksupsForCulture[formatProvider] = new UnitTypeToLookup(); + if(!_lookupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) + quantitiesForProvider = _lookupsForCulture[formatProvider] = new UnitTypeToLookup(); if(!quantitiesForProvider.TryGetValue(unitType, out var unitToAbbreviations)) unitToAbbreviations = quantitiesForProvider[unitType] = new UnitValueAbbreviationLookup(); @@ -245,9 +245,9 @@ string GetDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider form #else public #endif - string[] GetAllAbbreviations(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum + string[] GetUnitAbbreviations(TUnitType unit, IFormatProvider formatProvider = null) where TUnitType : Enum { - return GetAllAbbreviations(typeof(TUnitType), formatProvider); + return GetUnitAbbreviations(typeof(TUnitType), Convert.ToInt32(unit), formatProvider); } /// @@ -263,24 +263,24 @@ string[] GetAllAbbreviations(TUnitType unit, IFormatProvider formatPr #else public #endif - string[] GetAllAbbreviations(Type unitType, int unitValue, IFormatProvider formatProvider = null) + string[] GetUnitAbbreviations(Type unitType, int unitValue, IFormatProvider formatProvider = null) { formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) - return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; + return formatProvider != FallbackCulture ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; var abbreviations = lookup.GetAbbreviationsForUnit(unitValue); if(abbreviations.Count == 0) - return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; + return formatProvider != FallbackCulture ? GetUnitAbbreviations(unitType, unitValue, FallbackCulture) : new string[] { }; return abbreviations.ToArray(); } /// - /// Get all abbreviations for unit. + /// Get all abbreviations for all units of a quantity. /// - /// Enum type for unit. + /// Enum type for unit. /// The format provider to use for lookup. Defaults to if null. /// Unit abbreviations associated with unit. [PublicAPI] @@ -289,14 +289,14 @@ string[] GetAllAbbreviations(Type unitType, int unitValue, IFormatProvider forma #else public #endif - string[] GetAllAbbreviations(Type unitType, IFormatProvider formatProvider = null) + string[] GetAllUnitAbbreviationsForQuantity(Type unitEnumType, IFormatProvider formatProvider = null) { formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; - if(!TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var lookup)) - return formatProvider != FallbackCulture ? GetAllAbbreviations(unitType, FallbackCulture) : new string[] { }; + if(!TryGetUnitValueAbbreviationLookup(unitEnumType, formatProvider, out var lookup)) + return formatProvider != FallbackCulture ? GetAllUnitAbbreviationsForQuantity(unitEnumType, FallbackCulture) : new string[] { }; - return lookup.GetAllAbbreviations(); + return lookup.GetAllUnitAbbreviationsForQuantity(); } internal bool TryGetUnitValueAbbreviationLookup(Type unitType, IFormatProvider formatProvider, out UnitValueAbbreviationLookup unitToAbbreviations) @@ -305,7 +305,7 @@ internal bool TryGetUnitValueAbbreviationLookup(Type unitType, IFormatProvider f formatProvider = formatProvider ?? GlobalConfiguration.DefaultCulture; - if(!looksupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) + if(!_lookupsForCulture.TryGetValue(formatProvider, out var quantitiesForProvider)) return formatProvider != FallbackCulture ? TryGetUnitValueAbbreviationLookup(unitType, FallbackCulture, out unitToAbbreviations) : false; if(!quantitiesForProvider.TryGetValue(unitType, out unitToAbbreviations)) diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index f31f39b7ec..cc265b585c 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -87,7 +87,7 @@ object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}]."); - var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); + var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation.Trim()); switch (unitIntValues.Count) { @@ -181,7 +181,7 @@ bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvide if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) return false; - var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); + var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation.Trim()); if(unitIntValues.Count != 1) return false; diff --git a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs index 012abee1b5..18b8e8c171 100644 --- a/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs +++ b/UnitsNet/CustomCode/UnitValueAbbreviationLookup.cs @@ -40,7 +40,7 @@ internal UnitValueAbbreviationLookup() abbreviationToUnitMap = new AbbreviationToUnitMap(); } - internal string[] GetAllAbbreviations() + internal string[] GetAllUnitAbbreviationsForQuantity() { return unitToAbbreviationMap.Values.SelectMany((abbreviations) => { diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index becab22f5c..92fb22feab 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -47,43 +47,9 @@ namespace UnitsNet /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// // ReSharper disable once PartialTypeWithSinglePart + public partial struct Level : IQuantity, IComparable, IComparable { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LevelUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Level() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. - public Level(double numericValue, LevelUnit unit) - { - if(unit == LevelUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - /// /// The numeric value this quantity was constructed with. /// @@ -101,43 +67,6 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Level; - - /// - /// The base unit of Level, which is Decibel. All conversions go via this value. - /// - public static LevelUnit BaseUnit => LevelUnit.Decibel; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Level quantity. - /// - public static LevelUnit[] Units { get; } = Enum.GetValues(typeof(LevelUnit)).Cast().Except(new LevelUnit[]{ LevelUnit.Undefined }).ToArray(); - - /// - /// Get Level in Decibels. - /// - public double Decibels => As(LevelUnit.Decibel); - - /// - /// Get Level in Nepers. - /// - public double Nepers => As(LevelUnit.Neper); - - #endregion - #region Logarithmic Arithmetic Operators public static Level operator -(Level right) diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index 7325754b68..da7fe81ca9 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -458,9 +458,9 @@ private static readonly Tuple[] GeneratedLocalizati Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPica, new string[]{"pica"}), Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPoint, new string[]{"pt"}), Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Fathom, new string[]{"fathom"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"ft", "'"}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"ft", "'", "′"}), Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"фут"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"in", "\""}), + Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"in", "\"", "″"}), Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"дюйм"}), Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"km"}), Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"км"}), diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 696c788078..1ac1d02089 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -479,8 +479,7 @@ if ($obsoleteAttribute) provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From, - (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit)); + return QuantityParser.Default.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From); } /// @@ -502,8 +501,7 @@ if ($obsoleteAttribute) provider = provider ?? GlobalConfiguration.DefaultCulture; - return QuantityParser.Default.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, - (x, y) => From(x.$baseUnitPluralName + y.$baseUnitPluralName, BaseUnit), out result); + return QuantityParser.Default.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, out result); } /// @@ -520,7 +518,7 @@ if ($obsoleteAttribute) { if (str == null) throw new ArgumentNullException(nameof(str)); - var unit = UnitParser.Default.Parse<$unitEnumName>(str.Trim(), provider); + var unit = UnitParser.Default.Parse<$unitEnumName>(str, provider); if (unit == $unitEnumName.Undefined) { @@ -550,7 +548,7 @@ if ($obsoleteAttribute) if(string.IsNullOrWhiteSpace(str)) return false; - if(!UnitParser.Default.TryParse<$unitEnumName>(str.Trim(), provider, out unit)) + if(!UnitParser.Default.TryParse<$unitEnumName>(str, provider, out unit)) return false; if(unit == $unitEnumName.Undefined) From c5c6e511405882bcf675a3d02c4c22a84ae0b2f7 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 15 Oct 2018 16:54:37 +0200 Subject: [PATCH 068/131] Merge generator scripts for WRC and NetFramework (#520) * Merge generator scripts for WRC and NetFramework Handle WRC special cases in code generator scripts instead of in generated code. This removes all the #if sections and merges the "Common" partial code back into each of the WRC and NetFramework files so it is in one place and easy to read. - Arrange huge quantity code into #regions, easier to navigate - Move code generation into functions, easier to read - Add Types.psm1 with types for intellisense on parsed JSON* - Require PowerShell 5.1 (for classes) * VS and VSCode struggle with intellisense when importing types with 'using module', this is relatively new and will probably improve later. * Remove generated common code for quantities * generate-code.bat: Set workdir to scripts folder Needed for 'using module' in powershell to work, it can't have variables. * Regen * Fix WRC compile errors Fix build warns about xmldoc * Fix for code changes --- .../Quantities/Acceleration.Common.g.cs | 801 --------- .../Quantities/AmountOfSubstance.Common.g.cs | 823 --------- .../Quantities/AmplitudeRatio.Common.g.cs | 602 ------- .../Quantities/Angle.Common.g.cs | 822 --------- .../Quantities/ApparentEnergy.Common.g.cs | 581 ------- .../Quantities/ApparentPower.Common.g.cs | 603 ------- .../GeneratedCode/Quantities/Area.Common.g.cs | 801 --------- .../Quantities/AreaDensity.Common.g.cs | 537 ------ .../AreaMomentOfInertia.Common.g.cs | 647 ------- .../Quantities/BitRate.Common.g.cs | 1086 ------------ .../BrakeSpecificFuelConsumption.Common.g.cs | 581 ------- .../Quantities/Capacitance.Common.g.cs | 537 ------ .../Quantities/Density.Common.g.cs | 1351 --------------- .../Quantities/Duration.Common.g.cs | 735 -------- .../Quantities/DynamicViscosity.Common.g.cs | 647 ------- .../Quantities/ElectricAdmittance.Common.g.cs | 603 ------- .../Quantities/ElectricCharge.Common.g.cs | 537 ------ .../ElectricChargeDensity.Common.g.cs | 537 ------ .../ElectricConductance.Common.g.cs | 581 ------- .../ElectricConductivity.Common.g.cs | 537 ------ .../Quantities/ElectricCurrent.Common.g.cs | 691 -------- .../ElectricCurrentDensity.Common.g.cs | 537 ------ .../ElectricCurrentGradient.Common.g.cs | 537 ------ .../Quantities/ElectricField.Common.g.cs | 537 ------ .../Quantities/ElectricInductance.Common.g.cs | 537 ------ .../Quantities/ElectricPotential.Common.g.cs | 625 ------- .../ElectricPotentialAc.Common.g.cs | 624 ------- .../ElectricPotentialDc.Common.g.cs | 624 ------- .../Quantities/ElectricResistance.Common.g.cs | 603 ------- .../ElectricResistivity.Common.g.cs | 603 ------- .../Quantities/Energy.Common.g.cs | 999 ----------- .../Quantities/Entropy.Common.g.cs | 669 -------- .../Quantities/Force.Common.g.cs | 735 -------- .../Quantities/ForceChangeRate.Common.g.cs | 757 --------- .../Quantities/ForcePerLength.Common.g.cs | 713 -------- .../Quantities/Frequency.Common.g.cs | 691 -------- .../Quantities/HeatFlux.Common.g.cs | 867 ---------- .../HeatTransferCoefficient.Common.g.cs | 559 ------- .../Quantities/Illuminance.Common.g.cs | 603 ------- .../Quantities/Information.Common.g.cs | 1086 ------------ .../Quantities/Irradiance.Common.g.cs | 559 ------- .../Quantities/Irradiation.Common.g.cs | 581 ------- .../Quantities/KinematicViscosity.Common.g.cs | 691 -------- .../Quantities/LapseRate.Common.g.cs | 537 ------ .../Quantities/Length.Common.g.cs | 999 ----------- .../Quantities/Level.Common.g.cs | 558 ------- .../Quantities/LinearDensity.Common.g.cs | 581 ------- .../Quantities/LuminousFlux.Common.g.cs | 537 ------ .../Quantities/LuminousIntensity.Common.g.cs | 537 ------ .../Quantities/MagneticField.Common.g.cs | 537 ------ .../Quantities/MagneticFlux.Common.g.cs | 537 ------ .../Quantities/Magnetization.Common.g.cs | 537 ------ .../GeneratedCode/Quantities/Mass.Common.g.cs | 999 ----------- .../Quantities/MassFlow.Common.g.cs | 845 ---------- .../Quantities/MassFlux.Common.g.cs | 559 ------- .../MassMomentOfInertia.Common.g.cs | 1131 ------------- .../Quantities/MolarEnergy.Common.g.cs | 581 ------- .../Quantities/MolarEntropy.Common.g.cs | 581 ------- .../Quantities/MolarMass.Common.g.cs | 779 --------- .../Quantities/Molarity.Common.g.cs | 691 -------- .../Quantities/Permeability.Common.g.cs | 537 ------ .../Quantities/Permittivity.Common.g.cs | 537 ------ .../Quantities/Power.Common.g.cs | 955 ----------- .../Quantities/PowerDensity.Common.g.cs | 1483 ----------------- .../Quantities/PowerRatio.Common.g.cs | 558 ------- .../Quantities/Pressure.Common.g.cs | 1329 --------------- .../Quantities/PressureChangeRate.Common.g.cs | 603 ------- .../Quantities/Ratio.Common.g.cs | 646 ------- .../Quantities/ReactiveEnergy.Common.g.cs | 581 ------- .../Quantities/ReactivePower.Common.g.cs | 603 ------- .../RotationalAcceleration.Common.g.cs | 581 ------- .../Quantities/RotationalSpeed.Common.g.cs | 801 --------- .../RotationalStiffness.Common.g.cs | 581 ------- .../RotationalStiffnessPerLength.Common.g.cs | 581 ------- .../Quantities/SolidAngle.Common.g.cs | 536 ------ .../Quantities/SpecificEnergy.Common.g.cs | 691 -------- .../Quantities/SpecificEntropy.Common.g.cs | 691 -------- .../Quantities/SpecificVolume.Common.g.cs | 559 ------- .../Quantities/SpecificWeight.Common.g.cs | 889 ---------- .../Quantities/Speed.Common.g.cs | 1219 -------------- .../Quantities/Temperature.Common.g.cs | 691 -------- .../TemperatureChangeRate.Common.g.cs | 735 -------- .../Quantities/TemperatureDelta.Common.g.cs | 690 -------- .../ThermalConductivity.Common.g.cs | 559 ------- .../Quantities/ThermalResistance.Common.g.cs | 625 ------- .../Quantities/Torque.Common.g.cs | 977 ----------- .../Quantities/VitaminA.Common.g.cs | 536 ------ .../Quantities/Volume.Common.g.cs | 1439 ---------------- .../Quantities/VolumeFlow.Common.g.cs | 1087 ------------ .../Information.WindowsRuntimeComponent.g.cs | 953 ++++++++++- .../Length.WindowsRuntimeComponent.g.cs | 885 +++++++++- .../Level.WindowsRuntimeComponent.g.cs | 545 +++++- .../UnitsNet.WindowsRuntimeComponent.csproj | 90 +- .../Quantities/Acceleration.extra.cs | 4 + .../Quantities/Information.NetFramework.g.cs | 998 ++++++++++- .../Quantities/Length.NetFramework.g.cs | 888 +++++++++- .../Quantities/Level.NetFramework.g.cs | 588 ++++++- UnitsNet/Scripts/GenerateUnits.ps1 | 108 +- .../Include-GenerateLogarithmicCode.ps1 | 72 - ...clude-GenerateQuantitySourceCodeCommon.ps1 | 603 ------- ...GenerateQuantitySourceCodeNetFramework.ps1 | 992 +++++++++-- ...ntitySourceCodeWindowsRuntimeComponent.ps1 | 245 --- .../Scripts/Include-GenerateTemplates.ps1 | 8 +- ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 18 +- UnitsNet/Scripts/Types.psm1 | 43 + generate-code.bat | 4 +- 106 files changed, 5674 insertions(+), 64573 deletions(-) delete mode 100644 Common/GeneratedCode/Quantities/Acceleration.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Angle.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Area.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/BitRate.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Capacitance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Density.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Duration.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricField.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Energy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Entropy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Force.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Frequency.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Illuminance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Information.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Irradiance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Irradiation.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/LapseRate.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Length.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Level.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MagneticField.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Magnetization.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Mass.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MassFlow.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MassFlux.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/MolarMass.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Molarity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Permeability.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Permittivity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Power.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Pressure.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Ratio.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Speed.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Temperature.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Torque.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/VitaminA.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/Volume.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs delete mode 100644 UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 delete mode 100644 UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 delete mode 100644 UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 create mode 100644 UnitsNet/Scripts/Types.psm1 diff --git a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs b/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs deleted file mode 100644 index 6d0a2a93e2..0000000000 --- a/Common/GeneratedCode/Quantities/Acceleration.Common.g.cs +++ /dev/null @@ -1,801 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Acceleration : IQuantity -#else - public partial struct Acceleration : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly AccelerationUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public AccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Acceleration() - { - BaseDimensions = new BaseDimensions(1, 0, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Acceleration(double numericValue, AccelerationUnit unit) - { - if(unit == AccelerationUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Acceleration; - - /// - /// The base unit of Acceleration, which is MeterPerSecondSquared. All conversions go via this value. - /// - public static AccelerationUnit BaseUnit => AccelerationUnit.MeterPerSecondSquared; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Acceleration quantity. - /// - public static AccelerationUnit[] Units { get; } = Enum.GetValues(typeof(AccelerationUnit)).Cast().Except(new AccelerationUnit[]{ AccelerationUnit.Undefined }).ToArray(); - - /// - /// Get Acceleration in CentimetersPerSecondSquared. - /// - public double CentimetersPerSecondSquared => As(AccelerationUnit.CentimeterPerSecondSquared); - - /// - /// Get Acceleration in DecimetersPerSecondSquared. - /// - public double DecimetersPerSecondSquared => As(AccelerationUnit.DecimeterPerSecondSquared); - - /// - /// Get Acceleration in FeetPerSecondSquared. - /// - public double FeetPerSecondSquared => As(AccelerationUnit.FootPerSecondSquared); - - /// - /// Get Acceleration in InchesPerSecondSquared. - /// - public double InchesPerSecondSquared => As(AccelerationUnit.InchPerSecondSquared); - - /// - /// Get Acceleration in KilometersPerSecondSquared. - /// - public double KilometersPerSecondSquared => As(AccelerationUnit.KilometerPerSecondSquared); - - /// - /// Get Acceleration in KnotsPerHour. - /// - public double KnotsPerHour => As(AccelerationUnit.KnotPerHour); - - /// - /// Get Acceleration in KnotsPerMinute. - /// - public double KnotsPerMinute => As(AccelerationUnit.KnotPerMinute); - - /// - /// Get Acceleration in KnotsPerSecond. - /// - public double KnotsPerSecond => As(AccelerationUnit.KnotPerSecond); - - /// - /// Get Acceleration in MetersPerSecondSquared. - /// - public double MetersPerSecondSquared => As(AccelerationUnit.MeterPerSecondSquared); - - /// - /// Get Acceleration in MicrometersPerSecondSquared. - /// - public double MicrometersPerSecondSquared => As(AccelerationUnit.MicrometerPerSecondSquared); - - /// - /// Get Acceleration in MillimetersPerSecondSquared. - /// - public double MillimetersPerSecondSquared => As(AccelerationUnit.MillimeterPerSecondSquared); - - /// - /// Get Acceleration in NanometersPerSecondSquared. - /// - public double NanometersPerSecondSquared => As(AccelerationUnit.NanometerPerSecondSquared); - - /// - /// Get Acceleration in StandardGravity. - /// - public double StandardGravity => As(AccelerationUnit.StandardGravity); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecondSquared. - /// - public static Acceleration Zero => new Acceleration(0, BaseUnit); - - /// - /// Get Acceleration from CentimetersPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromCentimetersPerSecondSquared(double centimeterspersecondsquared) -#else - public static Acceleration FromCentimetersPerSecondSquared(QuantityValue centimeterspersecondsquared) -#endif - { - double value = (double) centimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.CentimeterPerSecondSquared); - } - - /// - /// Get Acceleration from DecimetersPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromDecimetersPerSecondSquared(double decimeterspersecondsquared) -#else - public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimeterspersecondsquared) -#endif - { - double value = (double) decimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.DecimeterPerSecondSquared); - } - - /// - /// Get Acceleration from FeetPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromFeetPerSecondSquared(double feetpersecondsquared) -#else - public static Acceleration FromFeetPerSecondSquared(QuantityValue feetpersecondsquared) -#endif - { - double value = (double) feetpersecondsquared; - return new Acceleration(value, AccelerationUnit.FootPerSecondSquared); - } - - /// - /// Get Acceleration from InchesPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromInchesPerSecondSquared(double inchespersecondsquared) -#else - public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersecondsquared) -#endif - { - double value = (double) inchespersecondsquared; - return new Acceleration(value, AccelerationUnit.InchPerSecondSquared); - } - - /// - /// Get Acceleration from KilometersPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromKilometersPerSecondSquared(double kilometerspersecondsquared) -#else - public static Acceleration FromKilometersPerSecondSquared(QuantityValue kilometerspersecondsquared) -#endif - { - double value = (double) kilometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.KilometerPerSecondSquared); - } - - /// - /// Get Acceleration from KnotsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromKnotsPerHour(double knotsperhour) -#else - public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) -#endif - { - double value = (double) knotsperhour; - return new Acceleration(value, AccelerationUnit.KnotPerHour); - } - - /// - /// Get Acceleration from KnotsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromKnotsPerMinute(double knotsperminute) -#else - public static Acceleration FromKnotsPerMinute(QuantityValue knotsperminute) -#endif - { - double value = (double) knotsperminute; - return new Acceleration(value, AccelerationUnit.KnotPerMinute); - } - - /// - /// Get Acceleration from KnotsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromKnotsPerSecond(double knotspersecond) -#else - public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) -#endif - { - double value = (double) knotspersecond; - return new Acceleration(value, AccelerationUnit.KnotPerSecond); - } - - /// - /// Get Acceleration from MetersPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromMetersPerSecondSquared(double meterspersecondsquared) -#else - public static Acceleration FromMetersPerSecondSquared(QuantityValue meterspersecondsquared) -#endif - { - double value = (double) meterspersecondsquared; - return new Acceleration(value, AccelerationUnit.MeterPerSecondSquared); - } - - /// - /// Get Acceleration from MicrometersPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromMicrometersPerSecondSquared(double micrometerspersecondsquared) -#else - public static Acceleration FromMicrometersPerSecondSquared(QuantityValue micrometerspersecondsquared) -#endif - { - double value = (double) micrometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.MicrometerPerSecondSquared); - } - - /// - /// Get Acceleration from MillimetersPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromMillimetersPerSecondSquared(double millimeterspersecondsquared) -#else - public static Acceleration FromMillimetersPerSecondSquared(QuantityValue millimeterspersecondsquared) -#endif - { - double value = (double) millimeterspersecondsquared; - return new Acceleration(value, AccelerationUnit.MillimeterPerSecondSquared); - } - - /// - /// Get Acceleration from NanometersPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromNanometersPerSecondSquared(double nanometerspersecondsquared) -#else - public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanometerspersecondsquared) -#endif - { - double value = (double) nanometerspersecondsquared; - return new Acceleration(value, AccelerationUnit.NanometerPerSecondSquared); - } - - /// - /// Get Acceleration from StandardGravity. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Acceleration FromStandardGravity(double standardgravity) -#else - public static Acceleration FromStandardGravity(QuantityValue standardgravity) -#endif - { - double value = (double) standardgravity; - return new Acceleration(value, AccelerationUnit.StandardGravity); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Acceleration unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Acceleration From(double value, AccelerationUnit fromUnit) -#else - public static Acceleration From(QuantityValue value, AccelerationUnit fromUnit) -#endif - { - return new Acceleration((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AccelerationUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Acceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); - - return CompareTo((Acceleration)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Acceleration other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Acceleration within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Acceleration. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(AccelerationUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Acceleration to another Acceleration with the unit representation . - /// - /// A Acceleration with the specified unit. - public Acceleration ToUnit(AccelerationUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Acceleration(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case AccelerationUnit.CentimeterPerSecondSquared: return (_value) * 1e-2d; - case AccelerationUnit.DecimeterPerSecondSquared: return (_value) * 1e-1d; - case AccelerationUnit.FootPerSecondSquared: return _value*0.304800; - case AccelerationUnit.InchPerSecondSquared: return _value*0.0254; - case AccelerationUnit.KilometerPerSecondSquared: return (_value) * 1e3d; - case AccelerationUnit.KnotPerHour: return _value*0.5144444444444/3600; - case AccelerationUnit.KnotPerMinute: return _value*0.5144444444444/60; - case AccelerationUnit.KnotPerSecond: return _value*0.5144444444444; - case AccelerationUnit.MeterPerSecondSquared: return _value; - case AccelerationUnit.MicrometerPerSecondSquared: return (_value) * 1e-6d; - case AccelerationUnit.MillimeterPerSecondSquared: return (_value) * 1e-3d; - case AccelerationUnit.NanometerPerSecondSquared: return (_value) * 1e-9d; - case AccelerationUnit.StandardGravity: return _value*9.80665; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(AccelerationUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case AccelerationUnit.CentimeterPerSecondSquared: return (baseUnitValue) / 1e-2d; - case AccelerationUnit.DecimeterPerSecondSquared: return (baseUnitValue) / 1e-1d; - case AccelerationUnit.FootPerSecondSquared: return baseUnitValue/0.304800; - case AccelerationUnit.InchPerSecondSquared: return baseUnitValue/0.0254; - case AccelerationUnit.KilometerPerSecondSquared: return (baseUnitValue) / 1e3d; - case AccelerationUnit.KnotPerHour: return baseUnitValue/0.5144444444444*3600; - case AccelerationUnit.KnotPerMinute: return baseUnitValue/0.5144444444444*60; - case AccelerationUnit.KnotPerSecond: return baseUnitValue/0.5144444444444; - case AccelerationUnit.MeterPerSecondSquared: return baseUnitValue; - case AccelerationUnit.MicrometerPerSecondSquared: return (baseUnitValue) / 1e-6d; - case AccelerationUnit.MillimeterPerSecondSquared: return (baseUnitValue) / 1e-3d; - case AccelerationUnit.NanometerPerSecondSquared: return (baseUnitValue) / 1e-9d; - case AccelerationUnit.StandardGravity: return baseUnitValue/9.80665; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Acceleration Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Acceleration result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AccelerationUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out AccelerationUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Acceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) - { - result = default(Acceleration); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static AccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == AccelerationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AccelerationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AccelerationUnit unit) - { - unit = AccelerationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == AccelerationUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(AccelerationUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Acceleration - /// - public static Acceleration MaxValue => new Acceleration(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Acceleration - /// - public static Acceleration MinValue => new Acceleration(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Acceleration.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Acceleration.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs b/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs deleted file mode 100644 index 9c4fb9a21c..0000000000 --- a/Common/GeneratedCode/Quantities/AmountOfSubstance.Common.g.cs +++ /dev/null @@ -1,823 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class AmountOfSubstance : IQuantity -#else - public partial struct AmountOfSubstance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly AmountOfSubstanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public AmountOfSubstanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static AmountOfSubstance() - { - BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 1, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit) - { - if(unit == AmountOfSubstanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.AmountOfSubstance; - - /// - /// The base unit of AmountOfSubstance, which is Mole. All conversions go via this value. - /// - public static AmountOfSubstanceUnit BaseUnit => AmountOfSubstanceUnit.Mole; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the AmountOfSubstance quantity. - /// - public static AmountOfSubstanceUnit[] Units { get; } = Enum.GetValues(typeof(AmountOfSubstanceUnit)).Cast().Except(new AmountOfSubstanceUnit[]{ AmountOfSubstanceUnit.Undefined }).ToArray(); - - /// - /// Get AmountOfSubstance in Centimoles. - /// - public double Centimoles => As(AmountOfSubstanceUnit.Centimole); - - /// - /// Get AmountOfSubstance in CentipoundMoles. - /// - public double CentipoundMoles => As(AmountOfSubstanceUnit.CentipoundMole); - - /// - /// Get AmountOfSubstance in Decimoles. - /// - public double Decimoles => As(AmountOfSubstanceUnit.Decimole); - - /// - /// Get AmountOfSubstance in DecipoundMoles. - /// - public double DecipoundMoles => As(AmountOfSubstanceUnit.DecipoundMole); - - /// - /// Get AmountOfSubstance in Kilomoles. - /// - public double Kilomoles => As(AmountOfSubstanceUnit.Kilomole); - - /// - /// Get AmountOfSubstance in KilopoundMoles. - /// - public double KilopoundMoles => As(AmountOfSubstanceUnit.KilopoundMole); - - /// - /// Get AmountOfSubstance in Micromoles. - /// - public double Micromoles => As(AmountOfSubstanceUnit.Micromole); - - /// - /// Get AmountOfSubstance in MicropoundMoles. - /// - public double MicropoundMoles => As(AmountOfSubstanceUnit.MicropoundMole); - - /// - /// Get AmountOfSubstance in Millimoles. - /// - public double Millimoles => As(AmountOfSubstanceUnit.Millimole); - - /// - /// Get AmountOfSubstance in MillipoundMoles. - /// - public double MillipoundMoles => As(AmountOfSubstanceUnit.MillipoundMole); - - /// - /// Get AmountOfSubstance in Moles. - /// - public double Moles => As(AmountOfSubstanceUnit.Mole); - - /// - /// Get AmountOfSubstance in Nanomoles. - /// - public double Nanomoles => As(AmountOfSubstanceUnit.Nanomole); - - /// - /// Get AmountOfSubstance in NanopoundMoles. - /// - public double NanopoundMoles => As(AmountOfSubstanceUnit.NanopoundMole); - - /// - /// Get AmountOfSubstance in PoundMoles. - /// - public double PoundMoles => As(AmountOfSubstanceUnit.PoundMole); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Mole. - /// - public static AmountOfSubstance Zero => new AmountOfSubstance(0, BaseUnit); - - /// - /// Get AmountOfSubstance from Centimoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromCentimoles(double centimoles) -#else - public static AmountOfSubstance FromCentimoles(QuantityValue centimoles) -#endif - { - double value = (double) centimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Centimole); - } - - /// - /// Get AmountOfSubstance from CentipoundMoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromCentipoundMoles(double centipoundmoles) -#else - public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmoles) -#endif - { - double value = (double) centipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.CentipoundMole); - } - - /// - /// Get AmountOfSubstance from Decimoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromDecimoles(double decimoles) -#else - public static AmountOfSubstance FromDecimoles(QuantityValue decimoles) -#endif - { - double value = (double) decimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Decimole); - } - - /// - /// Get AmountOfSubstance from DecipoundMoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromDecipoundMoles(double decipoundmoles) -#else - public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) -#endif - { - double value = (double) decipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.DecipoundMole); - } - - /// - /// Get AmountOfSubstance from Kilomoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromKilomoles(double kilomoles) -#else - public static AmountOfSubstance FromKilomoles(QuantityValue kilomoles) -#endif - { - double value = (double) kilomoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Kilomole); - } - - /// - /// Get AmountOfSubstance from KilopoundMoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromKilopoundMoles(double kilopoundmoles) -#else - public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) -#endif - { - double value = (double) kilopoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.KilopoundMole); - } - - /// - /// Get AmountOfSubstance from Micromoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromMicromoles(double micromoles) -#else - public static AmountOfSubstance FromMicromoles(QuantityValue micromoles) -#endif - { - double value = (double) micromoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Micromole); - } - - /// - /// Get AmountOfSubstance from MicropoundMoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromMicropoundMoles(double micropoundmoles) -#else - public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmoles) -#endif - { - double value = (double) micropoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.MicropoundMole); - } - - /// - /// Get AmountOfSubstance from Millimoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromMillimoles(double millimoles) -#else - public static AmountOfSubstance FromMillimoles(QuantityValue millimoles) -#endif - { - double value = (double) millimoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Millimole); - } - - /// - /// Get AmountOfSubstance from MillipoundMoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromMillipoundMoles(double millipoundmoles) -#else - public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmoles) -#endif - { - double value = (double) millipoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.MillipoundMole); - } - - /// - /// Get AmountOfSubstance from Moles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromMoles(double moles) -#else - public static AmountOfSubstance FromMoles(QuantityValue moles) -#endif - { - double value = (double) moles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Mole); - } - - /// - /// Get AmountOfSubstance from Nanomoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromNanomoles(double nanomoles) -#else - public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) -#endif - { - double value = (double) nanomoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.Nanomole); - } - - /// - /// Get AmountOfSubstance from NanopoundMoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromNanopoundMoles(double nanopoundmoles) -#else - public static AmountOfSubstance FromNanopoundMoles(QuantityValue nanopoundmoles) -#endif - { - double value = (double) nanopoundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.NanopoundMole); - } - - /// - /// Get AmountOfSubstance from PoundMoles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmountOfSubstance FromPoundMoles(double poundmoles) -#else - public static AmountOfSubstance FromPoundMoles(QuantityValue poundmoles) -#endif - { - double value = (double) poundmoles; - return new AmountOfSubstance(value, AmountOfSubstanceUnit.PoundMole); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AmountOfSubstance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static AmountOfSubstance From(double value, AmountOfSubstanceUnit fromUnit) -#else - public static AmountOfSubstance From(QuantityValue value, AmountOfSubstanceUnit fromUnit) -#endif - { - return new AmountOfSubstance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AmountOfSubstanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); - - return CompareTo((AmountOfSubstance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(AmountOfSubstance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current AmountOfSubstance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(AmountOfSubstanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this AmountOfSubstance to another AmountOfSubstance with the unit representation . - /// - /// A AmountOfSubstance with the specified unit. - public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new AmountOfSubstance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case AmountOfSubstanceUnit.Centimole: return (_value) * 1e-2d; - case AmountOfSubstanceUnit.CentipoundMole: return (_value*453.59237) * 1e-2d; - case AmountOfSubstanceUnit.Decimole: return (_value) * 1e-1d; - case AmountOfSubstanceUnit.DecipoundMole: return (_value*453.59237) * 1e-1d; - case AmountOfSubstanceUnit.Kilomole: return (_value) * 1e3d; - case AmountOfSubstanceUnit.KilopoundMole: return (_value*453.59237) * 1e3d; - case AmountOfSubstanceUnit.Micromole: return (_value) * 1e-6d; - case AmountOfSubstanceUnit.MicropoundMole: return (_value*453.59237) * 1e-6d; - case AmountOfSubstanceUnit.Millimole: return (_value) * 1e-3d; - case AmountOfSubstanceUnit.MillipoundMole: return (_value*453.59237) * 1e-3d; - case AmountOfSubstanceUnit.Mole: return _value; - case AmountOfSubstanceUnit.Nanomole: return (_value) * 1e-9d; - case AmountOfSubstanceUnit.NanopoundMole: return (_value*453.59237) * 1e-9d; - case AmountOfSubstanceUnit.PoundMole: return _value*453.59237; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(AmountOfSubstanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case AmountOfSubstanceUnit.Centimole: return (baseUnitValue) / 1e-2d; - case AmountOfSubstanceUnit.CentipoundMole: return (baseUnitValue/453.59237) / 1e-2d; - case AmountOfSubstanceUnit.Decimole: return (baseUnitValue) / 1e-1d; - case AmountOfSubstanceUnit.DecipoundMole: return (baseUnitValue/453.59237) / 1e-1d; - case AmountOfSubstanceUnit.Kilomole: return (baseUnitValue) / 1e3d; - case AmountOfSubstanceUnit.KilopoundMole: return (baseUnitValue/453.59237) / 1e3d; - case AmountOfSubstanceUnit.Micromole: return (baseUnitValue) / 1e-6d; - case AmountOfSubstanceUnit.MicropoundMole: return (baseUnitValue/453.59237) / 1e-6d; - case AmountOfSubstanceUnit.Millimole: return (baseUnitValue) / 1e-3d; - case AmountOfSubstanceUnit.MillipoundMole: return (baseUnitValue/453.59237) / 1e-3d; - case AmountOfSubstanceUnit.Mole: return baseUnitValue; - case AmountOfSubstanceUnit.Nanomole: return (baseUnitValue) / 1e-9d; - case AmountOfSubstanceUnit.NanopoundMole: return (baseUnitValue/453.59237) / 1e-9d; - case AmountOfSubstanceUnit.PoundMole: return baseUnitValue/453.59237; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AmountOfSubstance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmountOfSubstanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out AmountOfSubstanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static AmountOfSubstance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) - { - result = default(AmountOfSubstance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static AmountOfSubstanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == AmountOfSubstanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmountOfSubstanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmountOfSubstanceUnit unit) - { - unit = AmountOfSubstanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == AmountOfSubstanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(AmountOfSubstanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of AmountOfSubstance - /// - public static AmountOfSubstance MaxValue => new AmountOfSubstance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of AmountOfSubstance - /// - public static AmountOfSubstance MinValue => new AmountOfSubstance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => AmountOfSubstance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => AmountOfSubstance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs b/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs deleted file mode 100644 index c1fe46ff67..0000000000 --- a/Common/GeneratedCode/Quantities/AmplitudeRatio.Common.g.cs +++ /dev/null @@ -1,602 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class AmplitudeRatio : IQuantity -#else - public partial struct AmplitudeRatio : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly AmplitudeRatioUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public AmplitudeRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static AmplitudeRatio() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit) - { - if(unit == AmplitudeRatioUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.AmplitudeRatio; - - /// - /// The base unit of AmplitudeRatio, which is DecibelVolt. All conversions go via this value. - /// - public static AmplitudeRatioUnit BaseUnit => AmplitudeRatioUnit.DecibelVolt; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the AmplitudeRatio quantity. - /// - public static AmplitudeRatioUnit[] Units { get; } = Enum.GetValues(typeof(AmplitudeRatioUnit)).Cast().Except(new AmplitudeRatioUnit[]{ AmplitudeRatioUnit.Undefined }).ToArray(); - - /// - /// Get AmplitudeRatio in DecibelMicrovolts. - /// - public double DecibelMicrovolts => As(AmplitudeRatioUnit.DecibelMicrovolt); - - /// - /// Get AmplitudeRatio in DecibelMillivolts. - /// - public double DecibelMillivolts => As(AmplitudeRatioUnit.DecibelMillivolt); - - /// - /// Get AmplitudeRatio in DecibelsUnloaded. - /// - public double DecibelsUnloaded => As(AmplitudeRatioUnit.DecibelUnloaded); - - /// - /// Get AmplitudeRatio in DecibelVolts. - /// - public double DecibelVolts => As(AmplitudeRatioUnit.DecibelVolt); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit DecibelVolt. - /// - public static AmplitudeRatio Zero => new AmplitudeRatio(0, BaseUnit); - - /// - /// Get AmplitudeRatio from DecibelMicrovolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmplitudeRatio FromDecibelMicrovolts(double decibelmicrovolts) -#else - public static AmplitudeRatio FromDecibelMicrovolts(QuantityValue decibelmicrovolts) -#endif - { - double value = (double) decibelmicrovolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMicrovolt); - } - - /// - /// Get AmplitudeRatio from DecibelMillivolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmplitudeRatio FromDecibelMillivolts(double decibelmillivolts) -#else - public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivolts) -#endif - { - double value = (double) decibelmillivolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMillivolt); - } - - /// - /// Get AmplitudeRatio from DecibelsUnloaded. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmplitudeRatio FromDecibelsUnloaded(double decibelsunloaded) -#else - public static AmplitudeRatio FromDecibelsUnloaded(QuantityValue decibelsunloaded) -#endif - { - double value = (double) decibelsunloaded; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelUnloaded); - } - - /// - /// Get AmplitudeRatio from DecibelVolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AmplitudeRatio FromDecibelVolts(double decibelvolts) -#else - public static AmplitudeRatio FromDecibelVolts(QuantityValue decibelvolts) -#endif - { - double value = (double) decibelvolts; - return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelVolt); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AmplitudeRatio unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static AmplitudeRatio From(double value, AmplitudeRatioUnit fromUnit) -#else - public static AmplitudeRatio From(QuantityValue value, AmplitudeRatioUnit fromUnit) -#endif - { - return new AmplitudeRatio((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AmplitudeRatioUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); - - return CompareTo((AmplitudeRatio)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(AmplitudeRatio other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current AmplitudeRatio. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(AmplitudeRatioUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this AmplitudeRatio to another AmplitudeRatio with the unit representation . - /// - /// A AmplitudeRatio with the specified unit. - public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new AmplitudeRatio(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case AmplitudeRatioUnit.DecibelMicrovolt: return _value - 120; - case AmplitudeRatioUnit.DecibelMillivolt: return _value - 60; - case AmplitudeRatioUnit.DecibelUnloaded: return _value - 2.218487499; - case AmplitudeRatioUnit.DecibelVolt: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(AmplitudeRatioUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case AmplitudeRatioUnit.DecibelMicrovolt: return baseUnitValue + 120; - case AmplitudeRatioUnit.DecibelMillivolt: return baseUnitValue + 60; - case AmplitudeRatioUnit.DecibelUnloaded: return baseUnitValue + 2.218487499; - case AmplitudeRatioUnit.DecibelVolt: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AmplitudeRatio Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AmplitudeRatioUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out AmplitudeRatioUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static AmplitudeRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) - { - result = default(AmplitudeRatio); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static AmplitudeRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == AmplitudeRatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AmplitudeRatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AmplitudeRatioUnit unit) - { - unit = AmplitudeRatioUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == AmplitudeRatioUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(AmplitudeRatioUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of AmplitudeRatio - /// - public static AmplitudeRatio MaxValue => new AmplitudeRatio(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of AmplitudeRatio - /// - public static AmplitudeRatio MinValue => new AmplitudeRatio(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => AmplitudeRatio.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => AmplitudeRatio.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Angle.Common.g.cs b/Common/GeneratedCode/Quantities/Angle.Common.g.cs deleted file mode 100644 index 83cdf163dd..0000000000 --- a/Common/GeneratedCode/Quantities/Angle.Common.g.cs +++ /dev/null @@ -1,822 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Angle : IQuantity -#else - public partial struct Angle : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly AngleUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public AngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Angle() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Angle(double numericValue, AngleUnit unit) - { - if(unit == AngleUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Angle; - - /// - /// The base unit of Angle, which is Degree. All conversions go via this value. - /// - public static AngleUnit BaseUnit => AngleUnit.Degree; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Angle quantity. - /// - public static AngleUnit[] Units { get; } = Enum.GetValues(typeof(AngleUnit)).Cast().Except(new AngleUnit[]{ AngleUnit.Undefined }).ToArray(); - - /// - /// Get Angle in Arcminutes. - /// - public double Arcminutes => As(AngleUnit.Arcminute); - - /// - /// Get Angle in Arcseconds. - /// - public double Arcseconds => As(AngleUnit.Arcsecond); - - /// - /// Get Angle in Centiradians. - /// - public double Centiradians => As(AngleUnit.Centiradian); - - /// - /// Get Angle in Deciradians. - /// - public double Deciradians => As(AngleUnit.Deciradian); - - /// - /// Get Angle in Degrees. - /// - public double Degrees => As(AngleUnit.Degree); - - /// - /// Get Angle in Gradians. - /// - public double Gradians => As(AngleUnit.Gradian); - - /// - /// Get Angle in Microdegrees. - /// - public double Microdegrees => As(AngleUnit.Microdegree); - - /// - /// Get Angle in Microradians. - /// - public double Microradians => As(AngleUnit.Microradian); - - /// - /// Get Angle in Millidegrees. - /// - public double Millidegrees => As(AngleUnit.Millidegree); - - /// - /// Get Angle in Milliradians. - /// - public double Milliradians => As(AngleUnit.Milliradian); - - /// - /// Get Angle in Nanodegrees. - /// - public double Nanodegrees => As(AngleUnit.Nanodegree); - - /// - /// Get Angle in Nanoradians. - /// - public double Nanoradians => As(AngleUnit.Nanoradian); - - /// - /// Get Angle in Radians. - /// - public double Radians => As(AngleUnit.Radian); - - /// - /// Get Angle in Revolutions. - /// - public double Revolutions => As(AngleUnit.Revolution); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Degree. - /// - public static Angle Zero => new Angle(0, BaseUnit); - - /// - /// Get Angle from Arcminutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromArcminutes(double arcminutes) -#else - public static Angle FromArcminutes(QuantityValue arcminutes) -#endif - { - double value = (double) arcminutes; - return new Angle(value, AngleUnit.Arcminute); - } - - /// - /// Get Angle from Arcseconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromArcseconds(double arcseconds) -#else - public static Angle FromArcseconds(QuantityValue arcseconds) -#endif - { - double value = (double) arcseconds; - return new Angle(value, AngleUnit.Arcsecond); - } - - /// - /// Get Angle from Centiradians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromCentiradians(double centiradians) -#else - public static Angle FromCentiradians(QuantityValue centiradians) -#endif - { - double value = (double) centiradians; - return new Angle(value, AngleUnit.Centiradian); - } - - /// - /// Get Angle from Deciradians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromDeciradians(double deciradians) -#else - public static Angle FromDeciradians(QuantityValue deciradians) -#endif - { - double value = (double) deciradians; - return new Angle(value, AngleUnit.Deciradian); - } - - /// - /// Get Angle from Degrees. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromDegrees(double degrees) -#else - public static Angle FromDegrees(QuantityValue degrees) -#endif - { - double value = (double) degrees; - return new Angle(value, AngleUnit.Degree); - } - - /// - /// Get Angle from Gradians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromGradians(double gradians) -#else - public static Angle FromGradians(QuantityValue gradians) -#endif - { - double value = (double) gradians; - return new Angle(value, AngleUnit.Gradian); - } - - /// - /// Get Angle from Microdegrees. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromMicrodegrees(double microdegrees) -#else - public static Angle FromMicrodegrees(QuantityValue microdegrees) -#endif - { - double value = (double) microdegrees; - return new Angle(value, AngleUnit.Microdegree); - } - - /// - /// Get Angle from Microradians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromMicroradians(double microradians) -#else - public static Angle FromMicroradians(QuantityValue microradians) -#endif - { - double value = (double) microradians; - return new Angle(value, AngleUnit.Microradian); - } - - /// - /// Get Angle from Millidegrees. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromMillidegrees(double millidegrees) -#else - public static Angle FromMillidegrees(QuantityValue millidegrees) -#endif - { - double value = (double) millidegrees; - return new Angle(value, AngleUnit.Millidegree); - } - - /// - /// Get Angle from Milliradians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromMilliradians(double milliradians) -#else - public static Angle FromMilliradians(QuantityValue milliradians) -#endif - { - double value = (double) milliradians; - return new Angle(value, AngleUnit.Milliradian); - } - - /// - /// Get Angle from Nanodegrees. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromNanodegrees(double nanodegrees) -#else - public static Angle FromNanodegrees(QuantityValue nanodegrees) -#endif - { - double value = (double) nanodegrees; - return new Angle(value, AngleUnit.Nanodegree); - } - - /// - /// Get Angle from Nanoradians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromNanoradians(double nanoradians) -#else - public static Angle FromNanoradians(QuantityValue nanoradians) -#endif - { - double value = (double) nanoradians; - return new Angle(value, AngleUnit.Nanoradian); - } - - /// - /// Get Angle from Radians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromRadians(double radians) -#else - public static Angle FromRadians(QuantityValue radians) -#endif - { - double value = (double) radians; - return new Angle(value, AngleUnit.Radian); - } - - /// - /// Get Angle from Revolutions. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Angle FromRevolutions(double revolutions) -#else - public static Angle FromRevolutions(QuantityValue revolutions) -#endif - { - double value = (double) revolutions; - return new Angle(value, AngleUnit.Revolution); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Angle unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Angle From(double value, AngleUnit fromUnit) -#else - public static Angle From(QuantityValue value, AngleUnit fromUnit) -#endif - { - return new Angle((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AngleUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Angle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); - - return CompareTo((Angle)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Angle other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Angle within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Angle. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(AngleUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Angle to another Angle with the unit representation . - /// - /// A Angle with the specified unit. - public Angle ToUnit(AngleUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Angle(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case AngleUnit.Arcminute: return _value/60; - case AngleUnit.Arcsecond: return _value/3600; - case AngleUnit.Centiradian: return (_value*180/Math.PI) * 1e-2d; - case AngleUnit.Deciradian: return (_value*180/Math.PI) * 1e-1d; - case AngleUnit.Degree: return _value; - case AngleUnit.Gradian: return _value*0.9; - case AngleUnit.Microdegree: return (_value) * 1e-6d; - case AngleUnit.Microradian: return (_value*180/Math.PI) * 1e-6d; - case AngleUnit.Millidegree: return (_value) * 1e-3d; - case AngleUnit.Milliradian: return (_value*180/Math.PI) * 1e-3d; - case AngleUnit.Nanodegree: return (_value) * 1e-9d; - case AngleUnit.Nanoradian: return (_value*180/Math.PI) * 1e-9d; - case AngleUnit.Radian: return _value*180/Math.PI; - case AngleUnit.Revolution: return _value*360; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(AngleUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case AngleUnit.Arcminute: return baseUnitValue*60; - case AngleUnit.Arcsecond: return baseUnitValue*3600; - case AngleUnit.Centiradian: return (baseUnitValue/180*Math.PI) / 1e-2d; - case AngleUnit.Deciradian: return (baseUnitValue/180*Math.PI) / 1e-1d; - case AngleUnit.Degree: return baseUnitValue; - case AngleUnit.Gradian: return baseUnitValue/0.9; - case AngleUnit.Microdegree: return (baseUnitValue) / 1e-6d; - case AngleUnit.Microradian: return (baseUnitValue/180*Math.PI) / 1e-6d; - case AngleUnit.Millidegree: return (baseUnitValue) / 1e-3d; - case AngleUnit.Milliradian: return (baseUnitValue/180*Math.PI) / 1e-3d; - case AngleUnit.Nanodegree: return (baseUnitValue) / 1e-9d; - case AngleUnit.Nanoradian: return (baseUnitValue/180*Math.PI) / 1e-9d; - case AngleUnit.Radian: return baseUnitValue/180*Math.PI; - case AngleUnit.Revolution: return baseUnitValue/360; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Angle Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Angle result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AngleUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out AngleUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Angle ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) - { - result = default(Angle); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static AngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == AngleUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AngleUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AngleUnit unit) - { - unit = AngleUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == AngleUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(AngleUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Angle - /// - public static Angle MaxValue => new Angle(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Angle - /// - public static Angle MinValue => new Angle(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Angle.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Angle.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs deleted file mode 100644 index 0ecc9b3128..0000000000 --- a/Common/GeneratedCode/Quantities/ApparentEnergy.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ApparentEnergy : IQuantity -#else - public partial struct ApparentEnergy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ApparentEnergyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ApparentEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ApparentEnergy() - { - BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ApparentEnergy(double numericValue, ApparentEnergyUnit unit) - { - if(unit == ApparentEnergyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ApparentEnergy; - - /// - /// The base unit of ApparentEnergy, which is VoltampereHour. All conversions go via this value. - /// - public static ApparentEnergyUnit BaseUnit => ApparentEnergyUnit.VoltampereHour; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ApparentEnergy quantity. - /// - public static ApparentEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ApparentEnergyUnit)).Cast().Except(new ApparentEnergyUnit[]{ ApparentEnergyUnit.Undefined }).ToArray(); - - /// - /// Get ApparentEnergy in KilovoltampereHours. - /// - public double KilovoltampereHours => As(ApparentEnergyUnit.KilovoltampereHour); - - /// - /// Get ApparentEnergy in MegavoltampereHours. - /// - public double MegavoltampereHours => As(ApparentEnergyUnit.MegavoltampereHour); - - /// - /// Get ApparentEnergy in VoltampereHours. - /// - public double VoltampereHours => As(ApparentEnergyUnit.VoltampereHour); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereHour. - /// - public static ApparentEnergy Zero => new ApparentEnergy(0, BaseUnit); - - /// - /// Get ApparentEnergy from KilovoltampereHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ApparentEnergy FromKilovoltampereHours(double kilovoltamperehours) -#else - public static ApparentEnergy FromKilovoltampereHours(QuantityValue kilovoltamperehours) -#endif - { - double value = (double) kilovoltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.KilovoltampereHour); - } - - /// - /// Get ApparentEnergy from MegavoltampereHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ApparentEnergy FromMegavoltampereHours(double megavoltamperehours) -#else - public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamperehours) -#endif - { - double value = (double) megavoltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.MegavoltampereHour); - } - - /// - /// Get ApparentEnergy from VoltampereHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ApparentEnergy FromVoltampereHours(double voltamperehours) -#else - public static ApparentEnergy FromVoltampereHours(QuantityValue voltamperehours) -#endif - { - double value = (double) voltamperehours; - return new ApparentEnergy(value, ApparentEnergyUnit.VoltampereHour); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ApparentEnergy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ApparentEnergy From(double value, ApparentEnergyUnit fromUnit) -#else - public static ApparentEnergy From(QuantityValue value, ApparentEnergyUnit fromUnit) -#endif - { - return new ApparentEnergy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ApparentEnergyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); - - return CompareTo((ApparentEnergy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ApparentEnergy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ApparentEnergy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ApparentEnergy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ApparentEnergyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ApparentEnergy to another ApparentEnergy with the unit representation . - /// - /// A ApparentEnergy with the specified unit. - public ApparentEnergy ToUnit(ApparentEnergyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ApparentEnergy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ApparentEnergyUnit.KilovoltampereHour: return (_value) * 1e3d; - case ApparentEnergyUnit.MegavoltampereHour: return (_value) * 1e6d; - case ApparentEnergyUnit.VoltampereHour: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ApparentEnergyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ApparentEnergyUnit.KilovoltampereHour: return (baseUnitValue) / 1e3d; - case ApparentEnergyUnit.MegavoltampereHour: return (baseUnitValue) / 1e6d; - case ApparentEnergyUnit.VoltampereHour: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ApparentEnergy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentEnergyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ApparentEnergyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ApparentEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) - { - result = default(ApparentEnergy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ApparentEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ApparentEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentEnergyUnit unit) - { - unit = ApparentEnergyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ApparentEnergyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ApparentEnergyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ApparentEnergy - /// - public static ApparentEnergy MaxValue => new ApparentEnergy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ApparentEnergy - /// - public static ApparentEnergy MinValue => new ApparentEnergy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ApparentEnergy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ApparentEnergy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs b/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs deleted file mode 100644 index 9df3c1f890..0000000000 --- a/Common/GeneratedCode/Quantities/ApparentPower.Common.g.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ApparentPower : IQuantity -#else - public partial struct ApparentPower : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ApparentPowerUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ApparentPowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ApparentPower() - { - BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ApparentPower(double numericValue, ApparentPowerUnit unit) - { - if(unit == ApparentPowerUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ApparentPower; - - /// - /// The base unit of ApparentPower, which is Voltampere. All conversions go via this value. - /// - public static ApparentPowerUnit BaseUnit => ApparentPowerUnit.Voltampere; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ApparentPower quantity. - /// - public static ApparentPowerUnit[] Units { get; } = Enum.GetValues(typeof(ApparentPowerUnit)).Cast().Except(new ApparentPowerUnit[]{ ApparentPowerUnit.Undefined }).ToArray(); - - /// - /// Get ApparentPower in Gigavoltamperes. - /// - public double Gigavoltamperes => As(ApparentPowerUnit.Gigavoltampere); - - /// - /// Get ApparentPower in Kilovoltamperes. - /// - public double Kilovoltamperes => As(ApparentPowerUnit.Kilovoltampere); - - /// - /// Get ApparentPower in Megavoltamperes. - /// - public double Megavoltamperes => As(ApparentPowerUnit.Megavoltampere); - - /// - /// Get ApparentPower in Voltamperes. - /// - public double Voltamperes => As(ApparentPowerUnit.Voltampere); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Voltampere. - /// - public static ApparentPower Zero => new ApparentPower(0, BaseUnit); - - /// - /// Get ApparentPower from Gigavoltamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ApparentPower FromGigavoltamperes(double gigavoltamperes) -#else - public static ApparentPower FromGigavoltamperes(QuantityValue gigavoltamperes) -#endif - { - double value = (double) gigavoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Gigavoltampere); - } - - /// - /// Get ApparentPower from Kilovoltamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ApparentPower FromKilovoltamperes(double kilovoltamperes) -#else - public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) -#endif - { - double value = (double) kilovoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Kilovoltampere); - } - - /// - /// Get ApparentPower from Megavoltamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ApparentPower FromMegavoltamperes(double megavoltamperes) -#else - public static ApparentPower FromMegavoltamperes(QuantityValue megavoltamperes) -#endif - { - double value = (double) megavoltamperes; - return new ApparentPower(value, ApparentPowerUnit.Megavoltampere); - } - - /// - /// Get ApparentPower from Voltamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ApparentPower FromVoltamperes(double voltamperes) -#else - public static ApparentPower FromVoltamperes(QuantityValue voltamperes) -#endif - { - double value = (double) voltamperes; - return new ApparentPower(value, ApparentPowerUnit.Voltampere); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ApparentPower unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ApparentPower From(double value, ApparentPowerUnit fromUnit) -#else - public static ApparentPower From(QuantityValue value, ApparentPowerUnit fromUnit) -#endif - { - return new ApparentPower((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ApparentPowerUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); - - return CompareTo((ApparentPower)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ApparentPower other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ApparentPower within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ApparentPower. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ApparentPowerUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ApparentPower to another ApparentPower with the unit representation . - /// - /// A ApparentPower with the specified unit. - public ApparentPower ToUnit(ApparentPowerUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ApparentPower(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ApparentPowerUnit.Gigavoltampere: return (_value) * 1e9d; - case ApparentPowerUnit.Kilovoltampere: return (_value) * 1e3d; - case ApparentPowerUnit.Megavoltampere: return (_value) * 1e6d; - case ApparentPowerUnit.Voltampere: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ApparentPowerUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ApparentPowerUnit.Gigavoltampere: return (baseUnitValue) / 1e9d; - case ApparentPowerUnit.Kilovoltampere: return (baseUnitValue) / 1e3d; - case ApparentPowerUnit.Megavoltampere: return (baseUnitValue) / 1e6d; - case ApparentPowerUnit.Voltampere: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ApparentPower Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ApparentPower result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ApparentPowerUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ApparentPowerUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ApparentPower ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) - { - result = default(ApparentPower); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ApparentPowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ApparentPowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ApparentPowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ApparentPowerUnit unit) - { - unit = ApparentPowerUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ApparentPowerUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ApparentPowerUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ApparentPower - /// - public static ApparentPower MaxValue => new ApparentPower(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ApparentPower - /// - public static ApparentPower MinValue => new ApparentPower(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ApparentPower.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ApparentPower.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Area.Common.g.cs b/Common/GeneratedCode/Quantities/Area.Common.g.cs deleted file mode 100644 index c58c270ae2..0000000000 --- a/Common/GeneratedCode/Quantities/Area.Common.g.cs +++ /dev/null @@ -1,801 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Area : IQuantity -#else - public partial struct Area : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly AreaUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public AreaUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Area() - { - BaseDimensions = new BaseDimensions(2, 0, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Area(double numericValue, AreaUnit unit) - { - if(unit == AreaUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Area; - - /// - /// The base unit of Area, which is SquareMeter. All conversions go via this value. - /// - public static AreaUnit BaseUnit => AreaUnit.SquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Area quantity. - /// - public static AreaUnit[] Units { get; } = Enum.GetValues(typeof(AreaUnit)).Cast().Except(new AreaUnit[]{ AreaUnit.Undefined }).ToArray(); - - /// - /// Get Area in Acres. - /// - public double Acres => As(AreaUnit.Acre); - - /// - /// Get Area in Hectares. - /// - public double Hectares => As(AreaUnit.Hectare); - - /// - /// Get Area in SquareCentimeters. - /// - public double SquareCentimeters => As(AreaUnit.SquareCentimeter); - - /// - /// Get Area in SquareDecimeters. - /// - public double SquareDecimeters => As(AreaUnit.SquareDecimeter); - - /// - /// Get Area in SquareFeet. - /// - public double SquareFeet => As(AreaUnit.SquareFoot); - - /// - /// Get Area in SquareInches. - /// - public double SquareInches => As(AreaUnit.SquareInch); - - /// - /// Get Area in SquareKilometers. - /// - public double SquareKilometers => As(AreaUnit.SquareKilometer); - - /// - /// Get Area in SquareMeters. - /// - public double SquareMeters => As(AreaUnit.SquareMeter); - - /// - /// Get Area in SquareMicrometers. - /// - public double SquareMicrometers => As(AreaUnit.SquareMicrometer); - - /// - /// Get Area in SquareMiles. - /// - public double SquareMiles => As(AreaUnit.SquareMile); - - /// - /// Get Area in SquareMillimeters. - /// - public double SquareMillimeters => As(AreaUnit.SquareMillimeter); - - /// - /// Get Area in SquareYards. - /// - public double SquareYards => As(AreaUnit.SquareYard); - - /// - /// Get Area in UsSurveySquareFeet. - /// - public double UsSurveySquareFeet => As(AreaUnit.UsSurveySquareFoot); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeter. - /// - public static Area Zero => new Area(0, BaseUnit); - - /// - /// Get Area from Acres. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromAcres(double acres) -#else - public static Area FromAcres(QuantityValue acres) -#endif - { - double value = (double) acres; - return new Area(value, AreaUnit.Acre); - } - - /// - /// Get Area from Hectares. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromHectares(double hectares) -#else - public static Area FromHectares(QuantityValue hectares) -#endif - { - double value = (double) hectares; - return new Area(value, AreaUnit.Hectare); - } - - /// - /// Get Area from SquareCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareCentimeters(double squarecentimeters) -#else - public static Area FromSquareCentimeters(QuantityValue squarecentimeters) -#endif - { - double value = (double) squarecentimeters; - return new Area(value, AreaUnit.SquareCentimeter); - } - - /// - /// Get Area from SquareDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareDecimeters(double squaredecimeters) -#else - public static Area FromSquareDecimeters(QuantityValue squaredecimeters) -#endif - { - double value = (double) squaredecimeters; - return new Area(value, AreaUnit.SquareDecimeter); - } - - /// - /// Get Area from SquareFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareFeet(double squarefeet) -#else - public static Area FromSquareFeet(QuantityValue squarefeet) -#endif - { - double value = (double) squarefeet; - return new Area(value, AreaUnit.SquareFoot); - } - - /// - /// Get Area from SquareInches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareInches(double squareinches) -#else - public static Area FromSquareInches(QuantityValue squareinches) -#endif - { - double value = (double) squareinches; - return new Area(value, AreaUnit.SquareInch); - } - - /// - /// Get Area from SquareKilometers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareKilometers(double squarekilometers) -#else - public static Area FromSquareKilometers(QuantityValue squarekilometers) -#endif - { - double value = (double) squarekilometers; - return new Area(value, AreaUnit.SquareKilometer); - } - - /// - /// Get Area from SquareMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareMeters(double squaremeters) -#else - public static Area FromSquareMeters(QuantityValue squaremeters) -#endif - { - double value = (double) squaremeters; - return new Area(value, AreaUnit.SquareMeter); - } - - /// - /// Get Area from SquareMicrometers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareMicrometers(double squaremicrometers) -#else - public static Area FromSquareMicrometers(QuantityValue squaremicrometers) -#endif - { - double value = (double) squaremicrometers; - return new Area(value, AreaUnit.SquareMicrometer); - } - - /// - /// Get Area from SquareMiles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareMiles(double squaremiles) -#else - public static Area FromSquareMiles(QuantityValue squaremiles) -#endif - { - double value = (double) squaremiles; - return new Area(value, AreaUnit.SquareMile); - } - - /// - /// Get Area from SquareMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareMillimeters(double squaremillimeters) -#else - public static Area FromSquareMillimeters(QuantityValue squaremillimeters) -#endif - { - double value = (double) squaremillimeters; - return new Area(value, AreaUnit.SquareMillimeter); - } - - /// - /// Get Area from SquareYards. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromSquareYards(double squareyards) -#else - public static Area FromSquareYards(QuantityValue squareyards) -#endif - { - double value = (double) squareyards; - return new Area(value, AreaUnit.SquareYard); - } - - /// - /// Get Area from UsSurveySquareFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Area FromUsSurveySquareFeet(double ussurveysquarefeet) -#else - public static Area FromUsSurveySquareFeet(QuantityValue ussurveysquarefeet) -#endif - { - double value = (double) ussurveysquarefeet; - return new Area(value, AreaUnit.UsSurveySquareFoot); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Area unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Area From(double value, AreaUnit fromUnit) -#else - public static Area From(QuantityValue value, AreaUnit fromUnit) -#endif - { - return new Area((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Area)) throw new ArgumentException("Expected type Area.", nameof(obj)); - - return CompareTo((Area)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Area other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Area within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Area other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Area. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(AreaUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Area to another Area with the unit representation . - /// - /// A Area with the specified unit. - public Area ToUnit(AreaUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Area(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case AreaUnit.Acre: return _value*4046.85642; - case AreaUnit.Hectare: return _value*1e4; - case AreaUnit.SquareCentimeter: return _value*1e-4; - case AreaUnit.SquareDecimeter: return _value*1e-2; - case AreaUnit.SquareFoot: return _value*0.092903; - case AreaUnit.SquareInch: return _value*0.00064516; - case AreaUnit.SquareKilometer: return _value*1e6; - case AreaUnit.SquareMeter: return _value; - case AreaUnit.SquareMicrometer: return _value*1e-12; - case AreaUnit.SquareMile: return _value*2.59e6; - case AreaUnit.SquareMillimeter: return _value*1e-6; - case AreaUnit.SquareYard: return _value*0.836127; - case AreaUnit.UsSurveySquareFoot: return _value*0.09290341161; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(AreaUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case AreaUnit.Acre: return baseUnitValue/4046.85642; - case AreaUnit.Hectare: return baseUnitValue/1e4; - case AreaUnit.SquareCentimeter: return baseUnitValue/1e-4; - case AreaUnit.SquareDecimeter: return baseUnitValue/1e-2; - case AreaUnit.SquareFoot: return baseUnitValue/0.092903; - case AreaUnit.SquareInch: return baseUnitValue/0.00064516; - case AreaUnit.SquareKilometer: return baseUnitValue/1e6; - case AreaUnit.SquareMeter: return baseUnitValue; - case AreaUnit.SquareMicrometer: return baseUnitValue/1e-12; - case AreaUnit.SquareMile: return baseUnitValue/2.59e6; - case AreaUnit.SquareMillimeter: return baseUnitValue/1e-6; - case AreaUnit.SquareYard: return baseUnitValue/0.836127; - case AreaUnit.UsSurveySquareFoot: return baseUnitValue/0.09290341161; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Area Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Area result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out AreaUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Area ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) - { - result = default(Area); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static AreaUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == AreaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaUnit unit) - { - unit = AreaUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == AreaUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(AreaUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Area - /// - public static Area MaxValue => new Area(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Area - /// - public static Area MinValue => new Area(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Area.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Area.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs b/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs deleted file mode 100644 index 2499aca212..0000000000 --- a/Common/GeneratedCode/Quantities/AreaDensity.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The area density of a two-dimensional object is calculated as the mass per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class AreaDensity : IQuantity -#else - public partial struct AreaDensity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly AreaDensityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public AreaDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static AreaDensity() - { - BaseDimensions = new BaseDimensions(-2, 1, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - AreaDensity(double numericValue, AreaDensityUnit unit) - { - if(unit == AreaDensityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.AreaDensity; - - /// - /// The base unit of AreaDensity, which is KilogramPerSquareMeter. All conversions go via this value. - /// - public static AreaDensityUnit BaseUnit => AreaDensityUnit.KilogramPerSquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the AreaDensity quantity. - /// - public static AreaDensityUnit[] Units { get; } = Enum.GetValues(typeof(AreaDensityUnit)).Cast().Except(new AreaDensityUnit[]{ AreaDensityUnit.Undefined }).ToArray(); - - /// - /// Get AreaDensity in KilogramsPerSquareMeter. - /// - public double KilogramsPerSquareMeter => As(AreaDensityUnit.KilogramPerSquareMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSquareMeter. - /// - public static AreaDensity Zero => new AreaDensity(0, BaseUnit); - - /// - /// Get AreaDensity from KilogramsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AreaDensity FromKilogramsPerSquareMeter(double kilogramspersquaremeter) -#else - public static AreaDensity FromKilogramsPerSquareMeter(QuantityValue kilogramspersquaremeter) -#endif - { - double value = (double) kilogramspersquaremeter; - return new AreaDensity(value, AreaDensityUnit.KilogramPerSquareMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AreaDensity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static AreaDensity From(double value, AreaDensityUnit fromUnit) -#else - public static AreaDensity From(QuantityValue value, AreaDensityUnit fromUnit) -#endif - { - return new AreaDensity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaDensityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); - - return CompareTo((AreaDensity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(AreaDensity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another AreaDensity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current AreaDensity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(AreaDensityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this AreaDensity to another AreaDensity with the unit representation . - /// - /// A AreaDensity with the specified unit. - public AreaDensity ToUnit(AreaDensityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new AreaDensity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case AreaDensityUnit.KilogramPerSquareMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(AreaDensityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case AreaDensityUnit.KilogramPerSquareMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AreaDensity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out AreaDensity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaDensityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out AreaDensityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static AreaDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) - { - result = default(AreaDensity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static AreaDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == AreaDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaDensityUnit unit) - { - unit = AreaDensityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == AreaDensityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(AreaDensityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of AreaDensity - /// - public static AreaDensity MaxValue => new AreaDensity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of AreaDensity - /// - public static AreaDensity MinValue => new AreaDensity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => AreaDensity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => AreaDensity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs deleted file mode 100644 index 0b60cdd202..0000000000 --- a/Common/GeneratedCode/Quantities/AreaMomentOfInertia.Common.g.cs +++ /dev/null @@ -1,647 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A geometric property of an area that reflects how its points are distributed with regard to an axis. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class AreaMomentOfInertia : IQuantity -#else - public partial struct AreaMomentOfInertia : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly AreaMomentOfInertiaUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public AreaMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static AreaMomentOfInertia() - { - BaseDimensions = new BaseDimensions(4, 0, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit) - { - if(unit == AreaMomentOfInertiaUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.AreaMomentOfInertia; - - /// - /// The base unit of AreaMomentOfInertia, which is MeterToTheFourth. All conversions go via this value. - /// - public static AreaMomentOfInertiaUnit BaseUnit => AreaMomentOfInertiaUnit.MeterToTheFourth; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the AreaMomentOfInertia quantity. - /// - public static AreaMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(AreaMomentOfInertiaUnit)).Cast().Except(new AreaMomentOfInertiaUnit[]{ AreaMomentOfInertiaUnit.Undefined }).ToArray(); - - /// - /// Get AreaMomentOfInertia in CentimetersToTheFourth. - /// - public double CentimetersToTheFourth => As(AreaMomentOfInertiaUnit.CentimeterToTheFourth); - - /// - /// Get AreaMomentOfInertia in DecimetersToTheFourth. - /// - public double DecimetersToTheFourth => As(AreaMomentOfInertiaUnit.DecimeterToTheFourth); - - /// - /// Get AreaMomentOfInertia in FeetToTheFourth. - /// - public double FeetToTheFourth => As(AreaMomentOfInertiaUnit.FootToTheFourth); - - /// - /// Get AreaMomentOfInertia in InchesToTheFourth. - /// - public double InchesToTheFourth => As(AreaMomentOfInertiaUnit.InchToTheFourth); - - /// - /// Get AreaMomentOfInertia in MetersToTheFourth. - /// - public double MetersToTheFourth => As(AreaMomentOfInertiaUnit.MeterToTheFourth); - - /// - /// Get AreaMomentOfInertia in MillimetersToTheFourth. - /// - public double MillimetersToTheFourth => As(AreaMomentOfInertiaUnit.MillimeterToTheFourth); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit MeterToTheFourth. - /// - public static AreaMomentOfInertia Zero => new AreaMomentOfInertia(0, BaseUnit); - - /// - /// Get AreaMomentOfInertia from CentimetersToTheFourth. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AreaMomentOfInertia FromCentimetersToTheFourth(double centimeterstothefourth) -#else - public static AreaMomentOfInertia FromCentimetersToTheFourth(QuantityValue centimeterstothefourth) -#endif - { - double value = (double) centimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.CentimeterToTheFourth); - } - - /// - /// Get AreaMomentOfInertia from DecimetersToTheFourth. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AreaMomentOfInertia FromDecimetersToTheFourth(double decimeterstothefourth) -#else - public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decimeterstothefourth) -#endif - { - double value = (double) decimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.DecimeterToTheFourth); - } - - /// - /// Get AreaMomentOfInertia from FeetToTheFourth. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AreaMomentOfInertia FromFeetToTheFourth(double feettothefourth) -#else - public static AreaMomentOfInertia FromFeetToTheFourth(QuantityValue feettothefourth) -#endif - { - double value = (double) feettothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.FootToTheFourth); - } - - /// - /// Get AreaMomentOfInertia from InchesToTheFourth. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AreaMomentOfInertia FromInchesToTheFourth(double inchestothefourth) -#else - public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestothefourth) -#endif - { - double value = (double) inchestothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.InchToTheFourth); - } - - /// - /// Get AreaMomentOfInertia from MetersToTheFourth. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AreaMomentOfInertia FromMetersToTheFourth(double meterstothefourth) -#else - public static AreaMomentOfInertia FromMetersToTheFourth(QuantityValue meterstothefourth) -#endif - { - double value = (double) meterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MeterToTheFourth); - } - - /// - /// Get AreaMomentOfInertia from MillimetersToTheFourth. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static AreaMomentOfInertia FromMillimetersToTheFourth(double millimeterstothefourth) -#else - public static AreaMomentOfInertia FromMillimetersToTheFourth(QuantityValue millimeterstothefourth) -#endif - { - double value = (double) millimeterstothefourth; - return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MillimeterToTheFourth); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AreaMomentOfInertia unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static AreaMomentOfInertia From(double value, AreaMomentOfInertiaUnit fromUnit) -#else - public static AreaMomentOfInertia From(QuantityValue value, AreaMomentOfInertiaUnit fromUnit) -#endif - { - return new AreaMomentOfInertia((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(AreaMomentOfInertiaUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); - - return CompareTo((AreaMomentOfInertia)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(AreaMomentOfInertia other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current AreaMomentOfInertia. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(AreaMomentOfInertiaUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this AreaMomentOfInertia to another AreaMomentOfInertia with the unit representation . - /// - /// A AreaMomentOfInertia with the specified unit. - public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new AreaMomentOfInertia(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return _value/1e8; - case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return _value/1e4; - case AreaMomentOfInertiaUnit.FootToTheFourth: return _value*Math.Pow(0.3048, 4); - case AreaMomentOfInertiaUnit.InchToTheFourth: return _value*Math.Pow(2.54e-2, 4); - case AreaMomentOfInertiaUnit.MeterToTheFourth: return _value; - case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return _value/1e12; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(AreaMomentOfInertiaUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return baseUnitValue*1e8; - case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return baseUnitValue*1e4; - case AreaMomentOfInertiaUnit.FootToTheFourth: return baseUnitValue/Math.Pow(0.3048, 4); - case AreaMomentOfInertiaUnit.InchToTheFourth: return baseUnitValue/Math.Pow(2.54e-2, 4); - case AreaMomentOfInertiaUnit.MeterToTheFourth: return baseUnitValue; - case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return baseUnitValue*1e12; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static AreaMomentOfInertia Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static AreaMomentOfInertiaUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out AreaMomentOfInertiaUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static AreaMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) - { - result = default(AreaMomentOfInertia); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static AreaMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == AreaMomentOfInertiaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized AreaMomentOfInertiaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out AreaMomentOfInertiaUnit unit) - { - unit = AreaMomentOfInertiaUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == AreaMomentOfInertiaUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(AreaMomentOfInertiaUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of AreaMomentOfInertia - /// - public static AreaMomentOfInertia MaxValue => new AreaMomentOfInertia(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of AreaMomentOfInertia - /// - public static AreaMomentOfInertia MinValue => new AreaMomentOfInertia(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => AreaMomentOfInertia.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => AreaMomentOfInertia.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs b/Common/GeneratedCode/Quantities/BitRate.Common.g.cs deleted file mode 100644 index 1ad1293a07..0000000000 --- a/Common/GeneratedCode/Quantities/BitRate.Common.g.cs +++ /dev/null @@ -1,1086 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In telecommunications and computing, bit rate is the number of bits that are conveyed or processed per unit of time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class BitRate : IQuantity -#else - public partial struct BitRate : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly decimal _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly BitRateUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public BitRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static BitRate() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - BitRate(decimal numericValue, BitRateUnit unit) - { - if(unit == BitRateUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = numericValue; - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.BitRate; - - /// - /// The base unit of BitRate, which is BitPerSecond. All conversions go via this value. - /// - public static BitRateUnit BaseUnit => BitRateUnit.BitPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the BitRate quantity. - /// - public static BitRateUnit[] Units { get; } = Enum.GetValues(typeof(BitRateUnit)).Cast().Except(new BitRateUnit[]{ BitRateUnit.Undefined }).ToArray(); - - /// - /// Get BitRate in BitsPerSecond. - /// - public double BitsPerSecond => As(BitRateUnit.BitPerSecond); - - /// - /// Get BitRate in BytesPerSecond. - /// - public double BytesPerSecond => As(BitRateUnit.BytePerSecond); - - /// - /// Get BitRate in ExabitsPerSecond. - /// - public double ExabitsPerSecond => As(BitRateUnit.ExabitPerSecond); - - /// - /// Get BitRate in ExabytesPerSecond. - /// - public double ExabytesPerSecond => As(BitRateUnit.ExabytePerSecond); - - /// - /// Get BitRate in ExbibitsPerSecond. - /// - public double ExbibitsPerSecond => As(BitRateUnit.ExbibitPerSecond); - - /// - /// Get BitRate in ExbibytesPerSecond. - /// - public double ExbibytesPerSecond => As(BitRateUnit.ExbibytePerSecond); - - /// - /// Get BitRate in GibibitsPerSecond. - /// - public double GibibitsPerSecond => As(BitRateUnit.GibibitPerSecond); - - /// - /// Get BitRate in GibibytesPerSecond. - /// - public double GibibytesPerSecond => As(BitRateUnit.GibibytePerSecond); - - /// - /// Get BitRate in GigabitsPerSecond. - /// - public double GigabitsPerSecond => As(BitRateUnit.GigabitPerSecond); - - /// - /// Get BitRate in GigabytesPerSecond. - /// - public double GigabytesPerSecond => As(BitRateUnit.GigabytePerSecond); - - /// - /// Get BitRate in KibibitsPerSecond. - /// - public double KibibitsPerSecond => As(BitRateUnit.KibibitPerSecond); - - /// - /// Get BitRate in KibibytesPerSecond. - /// - public double KibibytesPerSecond => As(BitRateUnit.KibibytePerSecond); - - /// - /// Get BitRate in KilobitsPerSecond. - /// - public double KilobitsPerSecond => As(BitRateUnit.KilobitPerSecond); - - /// - /// Get BitRate in KilobytesPerSecond. - /// - public double KilobytesPerSecond => As(BitRateUnit.KilobytePerSecond); - - /// - /// Get BitRate in MebibitsPerSecond. - /// - public double MebibitsPerSecond => As(BitRateUnit.MebibitPerSecond); - - /// - /// Get BitRate in MebibytesPerSecond. - /// - public double MebibytesPerSecond => As(BitRateUnit.MebibytePerSecond); - - /// - /// Get BitRate in MegabitsPerSecond. - /// - public double MegabitsPerSecond => As(BitRateUnit.MegabitPerSecond); - - /// - /// Get BitRate in MegabytesPerSecond. - /// - public double MegabytesPerSecond => As(BitRateUnit.MegabytePerSecond); - - /// - /// Get BitRate in PebibitsPerSecond. - /// - public double PebibitsPerSecond => As(BitRateUnit.PebibitPerSecond); - - /// - /// Get BitRate in PebibytesPerSecond. - /// - public double PebibytesPerSecond => As(BitRateUnit.PebibytePerSecond); - - /// - /// Get BitRate in PetabitsPerSecond. - /// - public double PetabitsPerSecond => As(BitRateUnit.PetabitPerSecond); - - /// - /// Get BitRate in PetabytesPerSecond. - /// - public double PetabytesPerSecond => As(BitRateUnit.PetabytePerSecond); - - /// - /// Get BitRate in TebibitsPerSecond. - /// - public double TebibitsPerSecond => As(BitRateUnit.TebibitPerSecond); - - /// - /// Get BitRate in TebibytesPerSecond. - /// - public double TebibytesPerSecond => As(BitRateUnit.TebibytePerSecond); - - /// - /// Get BitRate in TerabitsPerSecond. - /// - public double TerabitsPerSecond => As(BitRateUnit.TerabitPerSecond); - - /// - /// Get BitRate in TerabytesPerSecond. - /// - public double TerabytesPerSecond => As(BitRateUnit.TerabytePerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit BitPerSecond. - /// - public static BitRate Zero => new BitRate(0, BaseUnit); - - /// - /// Get BitRate from BitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromBitsPerSecond(double bitspersecond) -#else - public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) -#endif - { - decimal value = (decimal) bitspersecond; - return new BitRate(value, BitRateUnit.BitPerSecond); - } - - /// - /// Get BitRate from BytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromBytesPerSecond(double bytespersecond) -#else - public static BitRate FromBytesPerSecond(QuantityValue bytespersecond) -#endif - { - decimal value = (decimal) bytespersecond; - return new BitRate(value, BitRateUnit.BytePerSecond); - } - - /// - /// Get BitRate from ExabitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromExabitsPerSecond(double exabitspersecond) -#else - public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) -#endif - { - decimal value = (decimal) exabitspersecond; - return new BitRate(value, BitRateUnit.ExabitPerSecond); - } - - /// - /// Get BitRate from ExabytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromExabytesPerSecond(double exabytespersecond) -#else - public static BitRate FromExabytesPerSecond(QuantityValue exabytespersecond) -#endif - { - decimal value = (decimal) exabytespersecond; - return new BitRate(value, BitRateUnit.ExabytePerSecond); - } - - /// - /// Get BitRate from ExbibitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromExbibitsPerSecond(double exbibitspersecond) -#else - public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) -#endif - { - decimal value = (decimal) exbibitspersecond; - return new BitRate(value, BitRateUnit.ExbibitPerSecond); - } - - /// - /// Get BitRate from ExbibytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromExbibytesPerSecond(double exbibytespersecond) -#else - public static BitRate FromExbibytesPerSecond(QuantityValue exbibytespersecond) -#endif - { - decimal value = (decimal) exbibytespersecond; - return new BitRate(value, BitRateUnit.ExbibytePerSecond); - } - - /// - /// Get BitRate from GibibitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromGibibitsPerSecond(double gibibitspersecond) -#else - public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) -#endif - { - decimal value = (decimal) gibibitspersecond; - return new BitRate(value, BitRateUnit.GibibitPerSecond); - } - - /// - /// Get BitRate from GibibytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromGibibytesPerSecond(double gibibytespersecond) -#else - public static BitRate FromGibibytesPerSecond(QuantityValue gibibytespersecond) -#endif - { - decimal value = (decimal) gibibytespersecond; - return new BitRate(value, BitRateUnit.GibibytePerSecond); - } - - /// - /// Get BitRate from GigabitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromGigabitsPerSecond(double gigabitspersecond) -#else - public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) -#endif - { - decimal value = (decimal) gigabitspersecond; - return new BitRate(value, BitRateUnit.GigabitPerSecond); - } - - /// - /// Get BitRate from GigabytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromGigabytesPerSecond(double gigabytespersecond) -#else - public static BitRate FromGigabytesPerSecond(QuantityValue gigabytespersecond) -#endif - { - decimal value = (decimal) gigabytespersecond; - return new BitRate(value, BitRateUnit.GigabytePerSecond); - } - - /// - /// Get BitRate from KibibitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromKibibitsPerSecond(double kibibitspersecond) -#else - public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) -#endif - { - decimal value = (decimal) kibibitspersecond; - return new BitRate(value, BitRateUnit.KibibitPerSecond); - } - - /// - /// Get BitRate from KibibytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromKibibytesPerSecond(double kibibytespersecond) -#else - public static BitRate FromKibibytesPerSecond(QuantityValue kibibytespersecond) -#endif - { - decimal value = (decimal) kibibytespersecond; - return new BitRate(value, BitRateUnit.KibibytePerSecond); - } - - /// - /// Get BitRate from KilobitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromKilobitsPerSecond(double kilobitspersecond) -#else - public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) -#endif - { - decimal value = (decimal) kilobitspersecond; - return new BitRate(value, BitRateUnit.KilobitPerSecond); - } - - /// - /// Get BitRate from KilobytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromKilobytesPerSecond(double kilobytespersecond) -#else - public static BitRate FromKilobytesPerSecond(QuantityValue kilobytespersecond) -#endif - { - decimal value = (decimal) kilobytespersecond; - return new BitRate(value, BitRateUnit.KilobytePerSecond); - } - - /// - /// Get BitRate from MebibitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromMebibitsPerSecond(double mebibitspersecond) -#else - public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) -#endif - { - decimal value = (decimal) mebibitspersecond; - return new BitRate(value, BitRateUnit.MebibitPerSecond); - } - - /// - /// Get BitRate from MebibytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromMebibytesPerSecond(double mebibytespersecond) -#else - public static BitRate FromMebibytesPerSecond(QuantityValue mebibytespersecond) -#endif - { - decimal value = (decimal) mebibytespersecond; - return new BitRate(value, BitRateUnit.MebibytePerSecond); - } - - /// - /// Get BitRate from MegabitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromMegabitsPerSecond(double megabitspersecond) -#else - public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) -#endif - { - decimal value = (decimal) megabitspersecond; - return new BitRate(value, BitRateUnit.MegabitPerSecond); - } - - /// - /// Get BitRate from MegabytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromMegabytesPerSecond(double megabytespersecond) -#else - public static BitRate FromMegabytesPerSecond(QuantityValue megabytespersecond) -#endif - { - decimal value = (decimal) megabytespersecond; - return new BitRate(value, BitRateUnit.MegabytePerSecond); - } - - /// - /// Get BitRate from PebibitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromPebibitsPerSecond(double pebibitspersecond) -#else - public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) -#endif - { - decimal value = (decimal) pebibitspersecond; - return new BitRate(value, BitRateUnit.PebibitPerSecond); - } - - /// - /// Get BitRate from PebibytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromPebibytesPerSecond(double pebibytespersecond) -#else - public static BitRate FromPebibytesPerSecond(QuantityValue pebibytespersecond) -#endif - { - decimal value = (decimal) pebibytespersecond; - return new BitRate(value, BitRateUnit.PebibytePerSecond); - } - - /// - /// Get BitRate from PetabitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromPetabitsPerSecond(double petabitspersecond) -#else - public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) -#endif - { - decimal value = (decimal) petabitspersecond; - return new BitRate(value, BitRateUnit.PetabitPerSecond); - } - - /// - /// Get BitRate from PetabytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromPetabytesPerSecond(double petabytespersecond) -#else - public static BitRate FromPetabytesPerSecond(QuantityValue petabytespersecond) -#endif - { - decimal value = (decimal) petabytespersecond; - return new BitRate(value, BitRateUnit.PetabytePerSecond); - } - - /// - /// Get BitRate from TebibitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromTebibitsPerSecond(double tebibitspersecond) -#else - public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) -#endif - { - decimal value = (decimal) tebibitspersecond; - return new BitRate(value, BitRateUnit.TebibitPerSecond); - } - - /// - /// Get BitRate from TebibytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromTebibytesPerSecond(double tebibytespersecond) -#else - public static BitRate FromTebibytesPerSecond(QuantityValue tebibytespersecond) -#endif - { - decimal value = (decimal) tebibytespersecond; - return new BitRate(value, BitRateUnit.TebibytePerSecond); - } - - /// - /// Get BitRate from TerabitsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromTerabitsPerSecond(double terabitspersecond) -#else - public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) -#endif - { - decimal value = (decimal) terabitspersecond; - return new BitRate(value, BitRateUnit.TerabitPerSecond); - } - - /// - /// Get BitRate from TerabytesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BitRate FromTerabytesPerSecond(double terabytespersecond) -#else - public static BitRate FromTerabytesPerSecond(QuantityValue terabytespersecond) -#endif - { - decimal value = (decimal) terabytespersecond; - return new BitRate(value, BitRateUnit.TerabytePerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// BitRate unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static BitRate From(double value, BitRateUnit fromUnit) -#else - public static BitRate From(QuantityValue value, BitRateUnit fromUnit) -#endif - { - return new BitRate((decimal)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(BitRateUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); - - return CompareTo((BitRate)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(BitRate other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another BitRate within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current BitRate. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(BitRateUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this BitRate to another BitRate with the unit representation . - /// - /// A BitRate with the specified unit. - public BitRate ToUnit(BitRateUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new BitRate(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private decimal AsBaseUnit() - { - switch(Unit) - { - case BitRateUnit.BitPerSecond: return _value; - case BitRateUnit.BytePerSecond: return _value*8m; - case BitRateUnit.ExabitPerSecond: return (_value) * 1e18m; - case BitRateUnit.ExabytePerSecond: return (_value*8m) * 1e18m; - case BitRateUnit.ExbibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.ExbibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.GibibitPerSecond: return (_value) * (1024m * 1024 * 1024); - case BitRateUnit.GibibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024); - case BitRateUnit.GigabitPerSecond: return (_value) * 1e9m; - case BitRateUnit.GigabytePerSecond: return (_value*8m) * 1e9m; - case BitRateUnit.KibibitPerSecond: return (_value) * 1024m; - case BitRateUnit.KibibytePerSecond: return (_value*8m) * 1024m; - case BitRateUnit.KilobitPerSecond: return (_value) * 1e3m; - case BitRateUnit.KilobytePerSecond: return (_value*8m) * 1e3m; - case BitRateUnit.MebibitPerSecond: return (_value) * (1024m * 1024); - case BitRateUnit.MebibytePerSecond: return (_value*8m) * (1024m * 1024); - case BitRateUnit.MegabitPerSecond: return (_value) * 1e6m; - case BitRateUnit.MegabytePerSecond: return (_value*8m) * 1e6m; - case BitRateUnit.PebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.PebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.PetabitPerSecond: return (_value) * 1e15m; - case BitRateUnit.PetabytePerSecond: return (_value*8m) * 1e15m; - case BitRateUnit.TebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024); - case BitRateUnit.TebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024); - case BitRateUnit.TerabitPerSecond: return (_value) * 1e12m; - case BitRateUnit.TerabytePerSecond: return (_value*8m) * 1e12m; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private decimal AsBaseNumericType(BitRateUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case BitRateUnit.BitPerSecond: return baseUnitValue; - case BitRateUnit.BytePerSecond: return baseUnitValue/8m; - case BitRateUnit.ExabitPerSecond: return (baseUnitValue) / 1e18m; - case BitRateUnit.ExabytePerSecond: return (baseUnitValue/8m) / 1e18m; - case BitRateUnit.ExbibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.ExbibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.GibibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024); - case BitRateUnit.GibibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024); - case BitRateUnit.GigabitPerSecond: return (baseUnitValue) / 1e9m; - case BitRateUnit.GigabytePerSecond: return (baseUnitValue/8m) / 1e9m; - case BitRateUnit.KibibitPerSecond: return (baseUnitValue) / 1024m; - case BitRateUnit.KibibytePerSecond: return (baseUnitValue/8m) / 1024m; - case BitRateUnit.KilobitPerSecond: return (baseUnitValue) / 1e3m; - case BitRateUnit.KilobytePerSecond: return (baseUnitValue/8m) / 1e3m; - case BitRateUnit.MebibitPerSecond: return (baseUnitValue) / (1024m * 1024); - case BitRateUnit.MebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024); - case BitRateUnit.MegabitPerSecond: return (baseUnitValue) / 1e6m; - case BitRateUnit.MegabytePerSecond: return (baseUnitValue/8m) / 1e6m; - case BitRateUnit.PebibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.PebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024); - case BitRateUnit.PetabitPerSecond: return (baseUnitValue) / 1e15m; - case BitRateUnit.PetabytePerSecond: return (baseUnitValue/8m) / 1e15m; - case BitRateUnit.TebibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024); - case BitRateUnit.TebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024); - case BitRateUnit.TerabitPerSecond: return (baseUnitValue) / 1e12m; - case BitRateUnit.TerabytePerSecond: return (baseUnitValue/8m) / 1e12m; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static BitRate Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out BitRate result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BitRateUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out BitRateUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static BitRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) - { - result = default(BitRate); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static BitRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == BitRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BitRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out BitRateUnit unit) - { - unit = BitRateUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == BitRateUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(BitRateUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of BitRate - /// - public static BitRate MaxValue => new BitRate(decimal.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of BitRate - /// - public static BitRate MinValue => new BitRate(decimal.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => BitRate.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => BitRate.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs b/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs deleted file mode 100644 index 0608d7e48d..0000000000 --- a/Common/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class BrakeSpecificFuelConsumption : IQuantity -#else - public partial struct BrakeSpecificFuelConsumption : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly BrakeSpecificFuelConsumptionUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public BrakeSpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static BrakeSpecificFuelConsumption() - { - BaseDimensions = new BaseDimensions(-2, 0, 2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsumptionUnit unit) - { - if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.BrakeSpecificFuelConsumption; - - /// - /// The base unit of BrakeSpecificFuelConsumption, which is KilogramPerJoule. All conversions go via this value. - /// - public static BrakeSpecificFuelConsumptionUnit BaseUnit => BrakeSpecificFuelConsumptionUnit.KilogramPerJoule; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the BrakeSpecificFuelConsumption quantity. - /// - public static BrakeSpecificFuelConsumptionUnit[] Units { get; } = Enum.GetValues(typeof(BrakeSpecificFuelConsumptionUnit)).Cast().Except(new BrakeSpecificFuelConsumptionUnit[]{ BrakeSpecificFuelConsumptionUnit.Undefined }).ToArray(); - - /// - /// Get BrakeSpecificFuelConsumption in GramsPerKiloWattHour. - /// - public double GramsPerKiloWattHour => As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); - - /// - /// Get BrakeSpecificFuelConsumption in KilogramsPerJoule. - /// - public double KilogramsPerJoule => As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); - - /// - /// Get BrakeSpecificFuelConsumption in PoundsPerMechanicalHorsepowerHour. - /// - public double PoundsPerMechanicalHorsepowerHour => As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerJoule. - /// - public static BrakeSpecificFuelConsumption Zero => new BrakeSpecificFuelConsumption(0, BaseUnit); - - /// - /// Get BrakeSpecificFuelConsumption from GramsPerKiloWattHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(double gramsperkilowatthour) -#else - public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(QuantityValue gramsperkilowatthour) -#endif - { - double value = (double) gramsperkilowatthour; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); - } - - /// - /// Get BrakeSpecificFuelConsumption from KilogramsPerJoule. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(double kilogramsperjoule) -#else - public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue kilogramsperjoule) -#endif - { - double value = (double) kilogramsperjoule; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); - } - - /// - /// Get BrakeSpecificFuelConsumption from PoundsPerMechanicalHorsepowerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(double poundspermechanicalhorsepowerhour) -#else - public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(QuantityValue poundspermechanicalhorsepowerhour) -#endif - { - double value = (double) poundspermechanicalhorsepowerhour; - return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// BrakeSpecificFuelConsumption unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static BrakeSpecificFuelConsumption From(double value, BrakeSpecificFuelConsumptionUnit fromUnit) -#else - public static BrakeSpecificFuelConsumption From(QuantityValue value, BrakeSpecificFuelConsumptionUnit fromUnit) -#endif - { - return new BrakeSpecificFuelConsumption((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); - - return CompareTo((BrakeSpecificFuelConsumption)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(BrakeSpecificFuelConsumption other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another BrakeSpecificFuelConsumption within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current BrakeSpecificFuelConsumption. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(BrakeSpecificFuelConsumptionUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this BrakeSpecificFuelConsumption to another BrakeSpecificFuelConsumption with the unit representation . - /// - /// A BrakeSpecificFuelConsumption with the specified unit. - public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new BrakeSpecificFuelConsumption(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return _value/3.6e9; - case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return _value; - case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return _value*1.689659410672e-7; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(BrakeSpecificFuelConsumptionUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return baseUnitValue*3.6e9; - case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return baseUnitValue; - case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return baseUnitValue/1.689659410672e-7; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static BrakeSpecificFuelConsumption Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsumption result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out BrakeSpecificFuelConsumptionUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static BrakeSpecificFuelConsumption ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) - { - result = default(BrakeSpecificFuelConsumption); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static BrakeSpecificFuelConsumptionUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == BrakeSpecificFuelConsumptionUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized BrakeSpecificFuelConsumptionUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out BrakeSpecificFuelConsumptionUnit unit) - { - unit = BrakeSpecificFuelConsumptionUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(BrakeSpecificFuelConsumptionUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of BrakeSpecificFuelConsumption - /// - public static BrakeSpecificFuelConsumption MaxValue => new BrakeSpecificFuelConsumption(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of BrakeSpecificFuelConsumption - /// - public static BrakeSpecificFuelConsumption MinValue => new BrakeSpecificFuelConsumption(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => BrakeSpecificFuelConsumption.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => BrakeSpecificFuelConsumption.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs b/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs deleted file mode 100644 index 1fde587a73..0000000000 --- a/Common/GeneratedCode/Quantities/Capacitance.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Capacitance is the ability of a body to store an electric charge. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Capacitance : IQuantity -#else - public partial struct Capacitance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly CapacitanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public CapacitanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Capacitance() - { - BaseDimensions = new BaseDimensions(-2, -1, 4, 2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Capacitance(double numericValue, CapacitanceUnit unit) - { - if(unit == CapacitanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Capacitance; - - /// - /// The base unit of Capacitance, which is Farad. All conversions go via this value. - /// - public static CapacitanceUnit BaseUnit => CapacitanceUnit.Farad; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Capacitance quantity. - /// - public static CapacitanceUnit[] Units { get; } = Enum.GetValues(typeof(CapacitanceUnit)).Cast().Except(new CapacitanceUnit[]{ CapacitanceUnit.Undefined }).ToArray(); - - /// - /// Get Capacitance in Farads. - /// - public double Farads => As(CapacitanceUnit.Farad); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Farad. - /// - public static Capacitance Zero => new Capacitance(0, BaseUnit); - - /// - /// Get Capacitance from Farads. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Capacitance FromFarads(double farads) -#else - public static Capacitance FromFarads(QuantityValue farads) -#endif - { - double value = (double) farads; - return new Capacitance(value, CapacitanceUnit.Farad); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Capacitance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Capacitance From(double value, CapacitanceUnit fromUnit) -#else - public static Capacitance From(QuantityValue value, CapacitanceUnit fromUnit) -#endif - { - return new Capacitance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(CapacitanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Capacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); - - return CompareTo((Capacitance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Capacitance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Capacitance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Capacitance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(CapacitanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Capacitance to another Capacitance with the unit representation . - /// - /// A Capacitance with the specified unit. - public Capacitance ToUnit(CapacitanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Capacitance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case CapacitanceUnit.Farad: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(CapacitanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case CapacitanceUnit.Farad: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Capacitance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Capacitance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static CapacitanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out CapacitanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Capacitance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) - { - result = default(Capacitance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static CapacitanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == CapacitanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized CapacitanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out CapacitanceUnit unit) - { - unit = CapacitanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == CapacitanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(CapacitanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Capacitance - /// - public static Capacitance MaxValue => new Capacitance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Capacitance - /// - public static Capacitance MinValue => new Capacitance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Capacitance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Capacitance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Density.Common.g.cs b/Common/GeneratedCode/Quantities/Density.Common.g.cs deleted file mode 100644 index dc2aee8589..0000000000 --- a/Common/GeneratedCode/Quantities/Density.Common.g.cs +++ /dev/null @@ -1,1351 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The density, or more precisely, the volumetric mass density, of a substance is its mass per unit volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Density : IQuantity -#else - public partial struct Density : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly DensityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public DensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Density() - { - BaseDimensions = new BaseDimensions(-3, 1, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Density(double numericValue, DensityUnit unit) - { - if(unit == DensityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Density; - - /// - /// The base unit of Density, which is KilogramPerCubicMeter. All conversions go via this value. - /// - public static DensityUnit BaseUnit => DensityUnit.KilogramPerCubicMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Density quantity. - /// - public static DensityUnit[] Units { get; } = Enum.GetValues(typeof(DensityUnit)).Cast().Except(new DensityUnit[]{ DensityUnit.Undefined }).ToArray(); - - /// - /// Get Density in CentigramsPerDeciLiter. - /// - public double CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); - - /// - /// Get Density in CentigramsPerLiter. - /// - public double CentigramsPerLiter => As(DensityUnit.CentigramPerLiter); - - /// - /// Get Density in CentigramsPerMilliliter. - /// - public double CentigramsPerMilliliter => As(DensityUnit.CentigramPerMilliliter); - - /// - /// Get Density in DecigramsPerDeciLiter. - /// - public double DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); - - /// - /// Get Density in DecigramsPerLiter. - /// - public double DecigramsPerLiter => As(DensityUnit.DecigramPerLiter); - - /// - /// Get Density in DecigramsPerMilliliter. - /// - public double DecigramsPerMilliliter => As(DensityUnit.DecigramPerMilliliter); - - /// - /// Get Density in GramsPerCubicCentimeter. - /// - public double GramsPerCubicCentimeter => As(DensityUnit.GramPerCubicCentimeter); - - /// - /// Get Density in GramsPerCubicMeter. - /// - public double GramsPerCubicMeter => As(DensityUnit.GramPerCubicMeter); - - /// - /// Get Density in GramsPerCubicMillimeter. - /// - public double GramsPerCubicMillimeter => As(DensityUnit.GramPerCubicMillimeter); - - /// - /// Get Density in GramsPerDeciLiter. - /// - public double GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); - - /// - /// Get Density in GramsPerLiter. - /// - public double GramsPerLiter => As(DensityUnit.GramPerLiter); - - /// - /// Get Density in GramsPerMilliliter. - /// - public double GramsPerMilliliter => As(DensityUnit.GramPerMilliliter); - - /// - /// Get Density in KilogramsPerCubicCentimeter. - /// - public double KilogramsPerCubicCentimeter => As(DensityUnit.KilogramPerCubicCentimeter); - - /// - /// Get Density in KilogramsPerCubicMeter. - /// - public double KilogramsPerCubicMeter => As(DensityUnit.KilogramPerCubicMeter); - - /// - /// Get Density in KilogramsPerCubicMillimeter. - /// - public double KilogramsPerCubicMillimeter => As(DensityUnit.KilogramPerCubicMillimeter); - - /// - /// Get Density in KilopoundsPerCubicFoot. - /// - public double KilopoundsPerCubicFoot => As(DensityUnit.KilopoundPerCubicFoot); - - /// - /// Get Density in KilopoundsPerCubicInch. - /// - public double KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); - - /// - /// Get Density in MicrogramsPerDeciLiter. - /// - public double MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); - - /// - /// Get Density in MicrogramsPerLiter. - /// - public double MicrogramsPerLiter => As(DensityUnit.MicrogramPerLiter); - - /// - /// Get Density in MicrogramsPerMilliliter. - /// - public double MicrogramsPerMilliliter => As(DensityUnit.MicrogramPerMilliliter); - - /// - /// Get Density in MilligramsPerCubicMeter. - /// - public double MilligramsPerCubicMeter => As(DensityUnit.MilligramPerCubicMeter); - - /// - /// Get Density in MilligramsPerDeciLiter. - /// - public double MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); - - /// - /// Get Density in MilligramsPerLiter. - /// - public double MilligramsPerLiter => As(DensityUnit.MilligramPerLiter); - - /// - /// Get Density in MilligramsPerMilliliter. - /// - public double MilligramsPerMilliliter => As(DensityUnit.MilligramPerMilliliter); - - /// - /// Get Density in NanogramsPerDeciLiter. - /// - public double NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); - - /// - /// Get Density in NanogramsPerLiter. - /// - public double NanogramsPerLiter => As(DensityUnit.NanogramPerLiter); - - /// - /// Get Density in NanogramsPerMilliliter. - /// - public double NanogramsPerMilliliter => As(DensityUnit.NanogramPerMilliliter); - - /// - /// Get Density in PicogramsPerDeciLiter. - /// - public double PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); - - /// - /// Get Density in PicogramsPerLiter. - /// - public double PicogramsPerLiter => As(DensityUnit.PicogramPerLiter); - - /// - /// Get Density in PicogramsPerMilliliter. - /// - public double PicogramsPerMilliliter => As(DensityUnit.PicogramPerMilliliter); - - /// - /// Get Density in PoundsPerCubicFoot. - /// - public double PoundsPerCubicFoot => As(DensityUnit.PoundPerCubicFoot); - - /// - /// Get Density in PoundsPerCubicInch. - /// - public double PoundsPerCubicInch => As(DensityUnit.PoundPerCubicInch); - - /// - /// Get Density in PoundsPerImperialGallon. - /// - public double PoundsPerImperialGallon => As(DensityUnit.PoundPerImperialGallon); - - /// - /// Get Density in PoundsPerUSGallon. - /// - public double PoundsPerUSGallon => As(DensityUnit.PoundPerUSGallon); - - /// - /// Get Density in SlugsPerCubicFoot. - /// - public double SlugsPerCubicFoot => As(DensityUnit.SlugPerCubicFoot); - - /// - /// Get Density in TonnesPerCubicCentimeter. - /// - public double TonnesPerCubicCentimeter => As(DensityUnit.TonnePerCubicCentimeter); - - /// - /// Get Density in TonnesPerCubicMeter. - /// - public double TonnesPerCubicMeter => As(DensityUnit.TonnePerCubicMeter); - - /// - /// Get Density in TonnesPerCubicMillimeter. - /// - public double TonnesPerCubicMillimeter => As(DensityUnit.TonnePerCubicMillimeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. - /// - public static Density Zero => new Density(0, BaseUnit); - - /// - /// Get Density from CentigramsPerDeciLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromCentigramsPerDeciLiter(double centigramsperdeciliter) -#else - public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeciliter) -#endif - { - double value = (double) centigramsperdeciliter; - return new Density(value, DensityUnit.CentigramPerDeciliter); - } - - /// - /// Get Density from CentigramsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromCentigramsPerLiter(double centigramsperliter) -#else - public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) -#endif - { - double value = (double) centigramsperliter; - return new Density(value, DensityUnit.CentigramPerLiter); - } - - /// - /// Get Density from CentigramsPerMilliliter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromCentigramsPerMilliliter(double centigramspermilliliter) -#else - public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) -#endif - { - double value = (double) centigramspermilliliter; - return new Density(value, DensityUnit.CentigramPerMilliliter); - } - - /// - /// Get Density from DecigramsPerDeciLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromDecigramsPerDeciLiter(double decigramsperdeciliter) -#else - public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdeciliter) -#endif - { - double value = (double) decigramsperdeciliter; - return new Density(value, DensityUnit.DecigramPerDeciliter); - } - - /// - /// Get Density from DecigramsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromDecigramsPerLiter(double decigramsperliter) -#else - public static Density FromDecigramsPerLiter(QuantityValue decigramsperliter) -#endif - { - double value = (double) decigramsperliter; - return new Density(value, DensityUnit.DecigramPerLiter); - } - - /// - /// Get Density from DecigramsPerMilliliter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromDecigramsPerMilliliter(double decigramspermilliliter) -#else - public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) -#endif - { - double value = (double) decigramspermilliliter; - return new Density(value, DensityUnit.DecigramPerMilliliter); - } - - /// - /// Get Density from GramsPerCubicCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromGramsPerCubicCentimeter(double gramspercubiccentimeter) -#else - public static Density FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) -#endif - { - double value = (double) gramspercubiccentimeter; - return new Density(value, DensityUnit.GramPerCubicCentimeter); - } - - /// - /// Get Density from GramsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromGramsPerCubicMeter(double gramspercubicmeter) -#else - public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) -#endif - { - double value = (double) gramspercubicmeter; - return new Density(value, DensityUnit.GramPerCubicMeter); - } - - /// - /// Get Density from GramsPerCubicMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromGramsPerCubicMillimeter(double gramspercubicmillimeter) -#else - public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) -#endif - { - double value = (double) gramspercubicmillimeter; - return new Density(value, DensityUnit.GramPerCubicMillimeter); - } - - /// - /// Get Density from GramsPerDeciLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromGramsPerDeciLiter(double gramsperdeciliter) -#else - public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) -#endif - { - double value = (double) gramsperdeciliter; - return new Density(value, DensityUnit.GramPerDeciliter); - } - - /// - /// Get Density from GramsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromGramsPerLiter(double gramsperliter) -#else - public static Density FromGramsPerLiter(QuantityValue gramsperliter) -#endif - { - double value = (double) gramsperliter; - return new Density(value, DensityUnit.GramPerLiter); - } - - /// - /// Get Density from GramsPerMilliliter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromGramsPerMilliliter(double gramspermilliliter) -#else - public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) -#endif - { - double value = (double) gramspermilliliter; - return new Density(value, DensityUnit.GramPerMilliliter); - } - - /// - /// Get Density from KilogramsPerCubicCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromKilogramsPerCubicCentimeter(double kilogramspercubiccentimeter) -#else - public static Density FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) -#endif - { - double value = (double) kilogramspercubiccentimeter; - return new Density(value, DensityUnit.KilogramPerCubicCentimeter); - } - - /// - /// Get Density from KilogramsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromKilogramsPerCubicMeter(double kilogramspercubicmeter) -#else - public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) -#endif - { - double value = (double) kilogramspercubicmeter; - return new Density(value, DensityUnit.KilogramPerCubicMeter); - } - - /// - /// Get Density from KilogramsPerCubicMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromKilogramsPerCubicMillimeter(double kilogramspercubicmillimeter) -#else - public static Density FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) -#endif - { - double value = (double) kilogramspercubicmillimeter; - return new Density(value, DensityUnit.KilogramPerCubicMillimeter); - } - - /// - /// Get Density from KilopoundsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromKilopoundsPerCubicFoot(double kilopoundspercubicfoot) -#else - public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) -#endif - { - double value = (double) kilopoundspercubicfoot; - return new Density(value, DensityUnit.KilopoundPerCubicFoot); - } - - /// - /// Get Density from KilopoundsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromKilopoundsPerCubicInch(double kilopoundspercubicinch) -#else - public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) -#endif - { - double value = (double) kilopoundspercubicinch; - return new Density(value, DensityUnit.KilopoundPerCubicInch); - } - - /// - /// Get Density from MicrogramsPerDeciLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromMicrogramsPerDeciLiter(double microgramsperdeciliter) -#else - public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeciliter) -#endif - { - double value = (double) microgramsperdeciliter; - return new Density(value, DensityUnit.MicrogramPerDeciliter); - } - - /// - /// Get Density from MicrogramsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromMicrogramsPerLiter(double microgramsperliter) -#else - public static Density FromMicrogramsPerLiter(QuantityValue microgramsperliter) -#endif - { - double value = (double) microgramsperliter; - return new Density(value, DensityUnit.MicrogramPerLiter); - } - - /// - /// Get Density from MicrogramsPerMilliliter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromMicrogramsPerMilliliter(double microgramspermilliliter) -#else - public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) -#endif - { - double value = (double) microgramspermilliliter; - return new Density(value, DensityUnit.MicrogramPerMilliliter); - } - - /// - /// Get Density from MilligramsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromMilligramsPerCubicMeter(double milligramspercubicmeter) -#else - public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) -#endif - { - double value = (double) milligramspercubicmeter; - return new Density(value, DensityUnit.MilligramPerCubicMeter); - } - - /// - /// Get Density from MilligramsPerDeciLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromMilligramsPerDeciLiter(double milligramsperdeciliter) -#else - public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeciliter) -#endif - { - double value = (double) milligramsperdeciliter; - return new Density(value, DensityUnit.MilligramPerDeciliter); - } - - /// - /// Get Density from MilligramsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromMilligramsPerLiter(double milligramsperliter) -#else - public static Density FromMilligramsPerLiter(QuantityValue milligramsperliter) -#endif - { - double value = (double) milligramsperliter; - return new Density(value, DensityUnit.MilligramPerLiter); - } - - /// - /// Get Density from MilligramsPerMilliliter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromMilligramsPerMilliliter(double milligramspermilliliter) -#else - public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) -#endif - { - double value = (double) milligramspermilliliter; - return new Density(value, DensityUnit.MilligramPerMilliliter); - } - - /// - /// Get Density from NanogramsPerDeciLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromNanogramsPerDeciLiter(double nanogramsperdeciliter) -#else - public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdeciliter) -#endif - { - double value = (double) nanogramsperdeciliter; - return new Density(value, DensityUnit.NanogramPerDeciliter); - } - - /// - /// Get Density from NanogramsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromNanogramsPerLiter(double nanogramsperliter) -#else - public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) -#endif - { - double value = (double) nanogramsperliter; - return new Density(value, DensityUnit.NanogramPerLiter); - } - - /// - /// Get Density from NanogramsPerMilliliter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromNanogramsPerMilliliter(double nanogramspermilliliter) -#else - public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) -#endif - { - double value = (double) nanogramspermilliliter; - return new Density(value, DensityUnit.NanogramPerMilliliter); - } - - /// - /// Get Density from PicogramsPerDeciLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromPicogramsPerDeciLiter(double picogramsperdeciliter) -#else - public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdeciliter) -#endif - { - double value = (double) picogramsperdeciliter; - return new Density(value, DensityUnit.PicogramPerDeciliter); - } - - /// - /// Get Density from PicogramsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromPicogramsPerLiter(double picogramsperliter) -#else - public static Density FromPicogramsPerLiter(QuantityValue picogramsperliter) -#endif - { - double value = (double) picogramsperliter; - return new Density(value, DensityUnit.PicogramPerLiter); - } - - /// - /// Get Density from PicogramsPerMilliliter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromPicogramsPerMilliliter(double picogramspermilliliter) -#else - public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) -#endif - { - double value = (double) picogramspermilliliter; - return new Density(value, DensityUnit.PicogramPerMilliliter); - } - - /// - /// Get Density from PoundsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromPoundsPerCubicFoot(double poundspercubicfoot) -#else - public static Density FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) -#endif - { - double value = (double) poundspercubicfoot; - return new Density(value, DensityUnit.PoundPerCubicFoot); - } - - /// - /// Get Density from PoundsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromPoundsPerCubicInch(double poundspercubicinch) -#else - public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) -#endif - { - double value = (double) poundspercubicinch; - return new Density(value, DensityUnit.PoundPerCubicInch); - } - - /// - /// Get Density from PoundsPerImperialGallon. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromPoundsPerImperialGallon(double poundsperimperialgallon) -#else - public static Density FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) -#endif - { - double value = (double) poundsperimperialgallon; - return new Density(value, DensityUnit.PoundPerImperialGallon); - } - - /// - /// Get Density from PoundsPerUSGallon. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromPoundsPerUSGallon(double poundsperusgallon) -#else - public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) -#endif - { - double value = (double) poundsperusgallon; - return new Density(value, DensityUnit.PoundPerUSGallon); - } - - /// - /// Get Density from SlugsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromSlugsPerCubicFoot(double slugspercubicfoot) -#else - public static Density FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) -#endif - { - double value = (double) slugspercubicfoot; - return new Density(value, DensityUnit.SlugPerCubicFoot); - } - - /// - /// Get Density from TonnesPerCubicCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromTonnesPerCubicCentimeter(double tonnespercubiccentimeter) -#else - public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) -#endif - { - double value = (double) tonnespercubiccentimeter; - return new Density(value, DensityUnit.TonnePerCubicCentimeter); - } - - /// - /// Get Density from TonnesPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromTonnesPerCubicMeter(double tonnespercubicmeter) -#else - public static Density FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) -#endif - { - double value = (double) tonnespercubicmeter; - return new Density(value, DensityUnit.TonnePerCubicMeter); - } - - /// - /// Get Density from TonnesPerCubicMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimeter) -#else - public static Density FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) -#endif - { - double value = (double) tonnespercubicmillimeter; - return new Density(value, DensityUnit.TonnePerCubicMillimeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Density unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Density From(double value, DensityUnit fromUnit) -#else - public static Density From(QuantityValue value, DensityUnit fromUnit) -#endif - { - return new Density((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DensityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Density)) throw new ArgumentException("Expected type Density.", nameof(obj)); - - return CompareTo((Density)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Density other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Density within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Density other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Density. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(DensityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Density to another Density with the unit representation . - /// - /// A Density with the specified unit. - public Density ToUnit(DensityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Density(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case DensityUnit.CentigramPerDeciliter: return (_value/1e-1) * 1e-2d; - case DensityUnit.CentigramPerLiter: return (_value/1) * 1e-2d; - case DensityUnit.CentigramPerMilliliter: return (_value/1e-3) * 1e-2d; - case DensityUnit.DecigramPerDeciliter: return (_value/1e-1) * 1e-1d; - case DensityUnit.DecigramPerLiter: return (_value/1) * 1e-1d; - case DensityUnit.DecigramPerMilliliter: return (_value/1e-3) * 1e-1d; - case DensityUnit.GramPerCubicCentimeter: return _value/1e-3; - case DensityUnit.GramPerCubicMeter: return _value/1e3; - case DensityUnit.GramPerCubicMillimeter: return _value/1e-6; - case DensityUnit.GramPerDeciliter: return _value/1e-1; - case DensityUnit.GramPerLiter: return _value/1; - case DensityUnit.GramPerMilliliter: return _value/1e-3; - case DensityUnit.KilogramPerCubicCentimeter: return (_value/1e-3) * 1e3d; - case DensityUnit.KilogramPerCubicMeter: return (_value/1e3) * 1e3d; - case DensityUnit.KilogramPerCubicMillimeter: return (_value/1e-6) * 1e3d; - case DensityUnit.KilopoundPerCubicFoot: return (_value/0.062427961) * 1e3d; - case DensityUnit.KilopoundPerCubicInch: return (_value/3.6127298147753e-5) * 1e3d; - case DensityUnit.MicrogramPerDeciliter: return (_value/1e-1) * 1e-6d; - case DensityUnit.MicrogramPerLiter: return (_value/1) * 1e-6d; - case DensityUnit.MicrogramPerMilliliter: return (_value/1e-3) * 1e-6d; - case DensityUnit.MilligramPerCubicMeter: return (_value/1e3) * 1e-3d; - case DensityUnit.MilligramPerDeciliter: return (_value/1e-1) * 1e-3d; - case DensityUnit.MilligramPerLiter: return (_value/1) * 1e-3d; - case DensityUnit.MilligramPerMilliliter: return (_value/1e-3) * 1e-3d; - case DensityUnit.NanogramPerDeciliter: return (_value/1e-1) * 1e-9d; - case DensityUnit.NanogramPerLiter: return (_value/1) * 1e-9d; - case DensityUnit.NanogramPerMilliliter: return (_value/1e-3) * 1e-9d; - case DensityUnit.PicogramPerDeciliter: return (_value/1e-1) * 1e-12d; - case DensityUnit.PicogramPerLiter: return (_value/1) * 1e-12d; - case DensityUnit.PicogramPerMilliliter: return (_value/1e-3) * 1e-12d; - case DensityUnit.PoundPerCubicFoot: return _value/0.062427961; - case DensityUnit.PoundPerCubicInch: return _value/3.6127298147753e-5; - case DensityUnit.PoundPerImperialGallon: return _value*9.9776398e1; - case DensityUnit.PoundPerUSGallon: return _value*1.19826427e2; - case DensityUnit.SlugPerCubicFoot: return _value*515.378818; - case DensityUnit.TonnePerCubicCentimeter: return _value/1e-9; - case DensityUnit.TonnePerCubicMeter: return _value/0.001; - case DensityUnit.TonnePerCubicMillimeter: return _value/1e-12; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(DensityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case DensityUnit.CentigramPerDeciliter: return (baseUnitValue*1e-1) / 1e-2d; - case DensityUnit.CentigramPerLiter: return (baseUnitValue*1) / 1e-2d; - case DensityUnit.CentigramPerMilliliter: return (baseUnitValue*1e-3) / 1e-2d; - case DensityUnit.DecigramPerDeciliter: return (baseUnitValue*1e-1) / 1e-1d; - case DensityUnit.DecigramPerLiter: return (baseUnitValue*1) / 1e-1d; - case DensityUnit.DecigramPerMilliliter: return (baseUnitValue*1e-3) / 1e-1d; - case DensityUnit.GramPerCubicCentimeter: return baseUnitValue*1e-3; - case DensityUnit.GramPerCubicMeter: return baseUnitValue*1e3; - case DensityUnit.GramPerCubicMillimeter: return baseUnitValue*1e-6; - case DensityUnit.GramPerDeciliter: return baseUnitValue*1e-1; - case DensityUnit.GramPerLiter: return baseUnitValue*1; - case DensityUnit.GramPerMilliliter: return baseUnitValue*1e-3; - case DensityUnit.KilogramPerCubicCentimeter: return (baseUnitValue*1e-3) / 1e3d; - case DensityUnit.KilogramPerCubicMeter: return (baseUnitValue*1e3) / 1e3d; - case DensityUnit.KilogramPerCubicMillimeter: return (baseUnitValue*1e-6) / 1e3d; - case DensityUnit.KilopoundPerCubicFoot: return (baseUnitValue*0.062427961) / 1e3d; - case DensityUnit.KilopoundPerCubicInch: return (baseUnitValue*3.6127298147753e-5) / 1e3d; - case DensityUnit.MicrogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-6d; - case DensityUnit.MicrogramPerLiter: return (baseUnitValue*1) / 1e-6d; - case DensityUnit.MicrogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-6d; - case DensityUnit.MilligramPerCubicMeter: return (baseUnitValue*1e3) / 1e-3d; - case DensityUnit.MilligramPerDeciliter: return (baseUnitValue*1e-1) / 1e-3d; - case DensityUnit.MilligramPerLiter: return (baseUnitValue*1) / 1e-3d; - case DensityUnit.MilligramPerMilliliter: return (baseUnitValue*1e-3) / 1e-3d; - case DensityUnit.NanogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-9d; - case DensityUnit.NanogramPerLiter: return (baseUnitValue*1) / 1e-9d; - case DensityUnit.NanogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-9d; - case DensityUnit.PicogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-12d; - case DensityUnit.PicogramPerLiter: return (baseUnitValue*1) / 1e-12d; - case DensityUnit.PicogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-12d; - case DensityUnit.PoundPerCubicFoot: return baseUnitValue*0.062427961; - case DensityUnit.PoundPerCubicInch: return baseUnitValue*3.6127298147753e-5; - case DensityUnit.PoundPerImperialGallon: return baseUnitValue/9.9776398e1; - case DensityUnit.PoundPerUSGallon: return baseUnitValue/1.19826427e2; - case DensityUnit.SlugPerCubicFoot: return baseUnitValue*0.00194032033; - case DensityUnit.TonnePerCubicCentimeter: return baseUnitValue*1e-9; - case DensityUnit.TonnePerCubicMeter: return baseUnitValue*0.001; - case DensityUnit.TonnePerCubicMillimeter: return baseUnitValue*1e-12; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Density Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Density result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DensityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out DensityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Density ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) - { - result = default(Density); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static DensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == DensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out DensityUnit unit) - { - unit = DensityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == DensityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(DensityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Density - /// - public static Density MaxValue => new Density(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Density - /// - public static Density MinValue => new Density(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Density.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Density.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Duration.Common.g.cs b/Common/GeneratedCode/Quantities/Duration.Common.g.cs deleted file mode 100644 index 73439f778c..0000000000 --- a/Common/GeneratedCode/Quantities/Duration.Common.g.cs +++ /dev/null @@ -1,735 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Duration : IQuantity -#else - public partial struct Duration : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly DurationUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public DurationUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Duration() - { - BaseDimensions = new BaseDimensions(0, 0, 1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Duration(double numericValue, DurationUnit unit) - { - if(unit == DurationUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Duration; - - /// - /// The base unit of Duration, which is Second. All conversions go via this value. - /// - public static DurationUnit BaseUnit => DurationUnit.Second; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Duration quantity. - /// - public static DurationUnit[] Units { get; } = Enum.GetValues(typeof(DurationUnit)).Cast().Except(new DurationUnit[]{ DurationUnit.Undefined }).ToArray(); - - /// - /// Get Duration in Days. - /// - public double Days => As(DurationUnit.Day); - - /// - /// Get Duration in Hours. - /// - public double Hours => As(DurationUnit.Hour); - - /// - /// Get Duration in Microseconds. - /// - public double Microseconds => As(DurationUnit.Microsecond); - - /// - /// Get Duration in Milliseconds. - /// - public double Milliseconds => As(DurationUnit.Millisecond); - - /// - /// Get Duration in Minutes. - /// - public double Minutes => As(DurationUnit.Minute); - - /// - /// Get Duration in Months30. - /// - public double Months30 => As(DurationUnit.Month30); - - /// - /// Get Duration in Nanoseconds. - /// - public double Nanoseconds => As(DurationUnit.Nanosecond); - - /// - /// Get Duration in Seconds. - /// - public double Seconds => As(DurationUnit.Second); - - /// - /// Get Duration in Weeks. - /// - public double Weeks => As(DurationUnit.Week); - - /// - /// Get Duration in Years365. - /// - public double Years365 => As(DurationUnit.Year365); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Second. - /// - public static Duration Zero => new Duration(0, BaseUnit); - - /// - /// Get Duration from Days. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromDays(double days) -#else - public static Duration FromDays(QuantityValue days) -#endif - { - double value = (double) days; - return new Duration(value, DurationUnit.Day); - } - - /// - /// Get Duration from Hours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromHours(double hours) -#else - public static Duration FromHours(QuantityValue hours) -#endif - { - double value = (double) hours; - return new Duration(value, DurationUnit.Hour); - } - - /// - /// Get Duration from Microseconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromMicroseconds(double microseconds) -#else - public static Duration FromMicroseconds(QuantityValue microseconds) -#endif - { - double value = (double) microseconds; - return new Duration(value, DurationUnit.Microsecond); - } - - /// - /// Get Duration from Milliseconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromMilliseconds(double milliseconds) -#else - public static Duration FromMilliseconds(QuantityValue milliseconds) -#endif - { - double value = (double) milliseconds; - return new Duration(value, DurationUnit.Millisecond); - } - - /// - /// Get Duration from Minutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromMinutes(double minutes) -#else - public static Duration FromMinutes(QuantityValue minutes) -#endif - { - double value = (double) minutes; - return new Duration(value, DurationUnit.Minute); - } - - /// - /// Get Duration from Months30. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromMonths30(double months30) -#else - public static Duration FromMonths30(QuantityValue months30) -#endif - { - double value = (double) months30; - return new Duration(value, DurationUnit.Month30); - } - - /// - /// Get Duration from Nanoseconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromNanoseconds(double nanoseconds) -#else - public static Duration FromNanoseconds(QuantityValue nanoseconds) -#endif - { - double value = (double) nanoseconds; - return new Duration(value, DurationUnit.Nanosecond); - } - - /// - /// Get Duration from Seconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromSeconds(double seconds) -#else - public static Duration FromSeconds(QuantityValue seconds) -#endif - { - double value = (double) seconds; - return new Duration(value, DurationUnit.Second); - } - - /// - /// Get Duration from Weeks. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromWeeks(double weeks) -#else - public static Duration FromWeeks(QuantityValue weeks) -#endif - { - double value = (double) weeks; - return new Duration(value, DurationUnit.Week); - } - - /// - /// Get Duration from Years365. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Duration FromYears365(double years365) -#else - public static Duration FromYears365(QuantityValue years365) -#endif - { - double value = (double) years365; - return new Duration(value, DurationUnit.Year365); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Duration unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Duration From(double value, DurationUnit fromUnit) -#else - public static Duration From(QuantityValue value, DurationUnit fromUnit) -#endif - { - return new Duration((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DurationUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Duration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); - - return CompareTo((Duration)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Duration other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Duration within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Duration. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(DurationUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Duration to another Duration with the unit representation . - /// - /// A Duration with the specified unit. - public Duration ToUnit(DurationUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Duration(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case DurationUnit.Day: return _value*24*3600; - case DurationUnit.Hour: return _value*3600; - case DurationUnit.Microsecond: return (_value) * 1e-6d; - case DurationUnit.Millisecond: return (_value) * 1e-3d; - case DurationUnit.Minute: return _value*60; - case DurationUnit.Month30: return _value*30*24*3600; - case DurationUnit.Nanosecond: return (_value) * 1e-9d; - case DurationUnit.Second: return _value; - case DurationUnit.Week: return _value*7*24*3600; - case DurationUnit.Year365: return _value*365*24*3600; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(DurationUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case DurationUnit.Day: return baseUnitValue/(24*3600); - case DurationUnit.Hour: return baseUnitValue/3600; - case DurationUnit.Microsecond: return (baseUnitValue) / 1e-6d; - case DurationUnit.Millisecond: return (baseUnitValue) / 1e-3d; - case DurationUnit.Minute: return baseUnitValue/60; - case DurationUnit.Month30: return baseUnitValue/(30*24*3600); - case DurationUnit.Nanosecond: return (baseUnitValue) / 1e-9d; - case DurationUnit.Second: return baseUnitValue; - case DurationUnit.Week: return baseUnitValue/(7*24*3600); - case DurationUnit.Year365: return baseUnitValue/(365*24*3600); - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Duration Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Duration result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DurationUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out DurationUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Duration ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) - { - result = default(Duration); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static DurationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == DurationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DurationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out DurationUnit unit) - { - unit = DurationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == DurationUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(DurationUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Duration - /// - public static Duration MaxValue => new Duration(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Duration - /// - public static Duration MinValue => new Duration(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Duration.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Duration.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs deleted file mode 100644 index 23979f9711..0000000000 --- a/Common/GeneratedCode/Quantities/DynamicViscosity.Common.g.cs +++ /dev/null @@ -1,647 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The dynamic (shear) viscosity of a fluid expresses its resistance to shearing flows, where adjacent layers move parallel to each other with different speeds - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class DynamicViscosity : IQuantity -#else - public partial struct DynamicViscosity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly DynamicViscosityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public DynamicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static DynamicViscosity() - { - BaseDimensions = new BaseDimensions(-1, 1, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - DynamicViscosity(double numericValue, DynamicViscosityUnit unit) - { - if(unit == DynamicViscosityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.DynamicViscosity; - - /// - /// The base unit of DynamicViscosity, which is NewtonSecondPerMeterSquared. All conversions go via this value. - /// - public static DynamicViscosityUnit BaseUnit => DynamicViscosityUnit.NewtonSecondPerMeterSquared; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the DynamicViscosity quantity. - /// - public static DynamicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(DynamicViscosityUnit)).Cast().Except(new DynamicViscosityUnit[]{ DynamicViscosityUnit.Undefined }).ToArray(); - - /// - /// Get DynamicViscosity in Centipoise. - /// - public double Centipoise => As(DynamicViscosityUnit.Centipoise); - - /// - /// Get DynamicViscosity in MicropascalSeconds. - /// - public double MicropascalSeconds => As(DynamicViscosityUnit.MicropascalSecond); - - /// - /// Get DynamicViscosity in MillipascalSeconds. - /// - public double MillipascalSeconds => As(DynamicViscosityUnit.MillipascalSecond); - - /// - /// Get DynamicViscosity in NewtonSecondsPerMeterSquared. - /// - public double NewtonSecondsPerMeterSquared => As(DynamicViscosityUnit.NewtonSecondPerMeterSquared); - - /// - /// Get DynamicViscosity in PascalSeconds. - /// - public double PascalSeconds => As(DynamicViscosityUnit.PascalSecond); - - /// - /// Get DynamicViscosity in Poise. - /// - public double Poise => As(DynamicViscosityUnit.Poise); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. - /// - public static DynamicViscosity Zero => new DynamicViscosity(0, BaseUnit); - - /// - /// Get DynamicViscosity from Centipoise. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static DynamicViscosity FromCentipoise(double centipoise) -#else - public static DynamicViscosity FromCentipoise(QuantityValue centipoise) -#endif - { - double value = (double) centipoise; - return new DynamicViscosity(value, DynamicViscosityUnit.Centipoise); - } - - /// - /// Get DynamicViscosity from MicropascalSeconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static DynamicViscosity FromMicropascalSeconds(double micropascalseconds) -#else - public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascalseconds) -#endif - { - double value = (double) micropascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.MicropascalSecond); - } - - /// - /// Get DynamicViscosity from MillipascalSeconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static DynamicViscosity FromMillipascalSeconds(double millipascalseconds) -#else - public static DynamicViscosity FromMillipascalSeconds(QuantityValue millipascalseconds) -#endif - { - double value = (double) millipascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.MillipascalSecond); - } - - /// - /// Get DynamicViscosity from NewtonSecondsPerMeterSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static DynamicViscosity FromNewtonSecondsPerMeterSquared(double newtonsecondspermetersquared) -#else - public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue newtonsecondspermetersquared) -#endif - { - double value = (double) newtonsecondspermetersquared; - return new DynamicViscosity(value, DynamicViscosityUnit.NewtonSecondPerMeterSquared); - } - - /// - /// Get DynamicViscosity from PascalSeconds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static DynamicViscosity FromPascalSeconds(double pascalseconds) -#else - public static DynamicViscosity FromPascalSeconds(QuantityValue pascalseconds) -#endif - { - double value = (double) pascalseconds; - return new DynamicViscosity(value, DynamicViscosityUnit.PascalSecond); - } - - /// - /// Get DynamicViscosity from Poise. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static DynamicViscosity FromPoise(double poise) -#else - public static DynamicViscosity FromPoise(QuantityValue poise) -#endif - { - double value = (double) poise; - return new DynamicViscosity(value, DynamicViscosityUnit.Poise); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// DynamicViscosity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static DynamicViscosity From(double value, DynamicViscosityUnit fromUnit) -#else - public static DynamicViscosity From(QuantityValue value, DynamicViscosityUnit fromUnit) -#endif - { - return new DynamicViscosity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(DynamicViscosityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is DynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); - - return CompareTo((DynamicViscosity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(DynamicViscosity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another DynamicViscosity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current DynamicViscosity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(DynamicViscosityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this DynamicViscosity to another DynamicViscosity with the unit representation . - /// - /// A DynamicViscosity with the specified unit. - public DynamicViscosity ToUnit(DynamicViscosityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new DynamicViscosity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case DynamicViscosityUnit.Centipoise: return (_value/10) * 1e-2d; - case DynamicViscosityUnit.MicropascalSecond: return (_value) * 1e-6d; - case DynamicViscosityUnit.MillipascalSecond: return (_value) * 1e-3d; - case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return _value; - case DynamicViscosityUnit.PascalSecond: return _value; - case DynamicViscosityUnit.Poise: return _value/10; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(DynamicViscosityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case DynamicViscosityUnit.Centipoise: return (baseUnitValue*10) / 1e-2d; - case DynamicViscosityUnit.MicropascalSecond: return (baseUnitValue) / 1e-6d; - case DynamicViscosityUnit.MillipascalSecond: return (baseUnitValue) / 1e-3d; - case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return baseUnitValue; - case DynamicViscosityUnit.PascalSecond: return baseUnitValue; - case DynamicViscosityUnit.Poise: return baseUnitValue*10; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static DynamicViscosity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static DynamicViscosityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out DynamicViscosityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static DynamicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) - { - result = default(DynamicViscosity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static DynamicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == DynamicViscosityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized DynamicViscosityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out DynamicViscosityUnit unit) - { - unit = DynamicViscosityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == DynamicViscosityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(DynamicViscosityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of DynamicViscosity - /// - public static DynamicViscosity MaxValue => new DynamicViscosity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of DynamicViscosity - /// - public static DynamicViscosity MinValue => new DynamicViscosity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => DynamicViscosity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => DynamicViscosity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs deleted file mode 100644 index 63a672f664..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricAdmittance.Common.g.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricAdmittance : IQuantity -#else - public partial struct ElectricAdmittance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricAdmittanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricAdmittanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricAdmittance() - { - BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit) - { - if(unit == ElectricAdmittanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricAdmittance; - - /// - /// The base unit of ElectricAdmittance, which is Siemens. All conversions go via this value. - /// - public static ElectricAdmittanceUnit BaseUnit => ElectricAdmittanceUnit.Siemens; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricAdmittance quantity. - /// - public static ElectricAdmittanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricAdmittanceUnit)).Cast().Except(new ElectricAdmittanceUnit[]{ ElectricAdmittanceUnit.Undefined }).ToArray(); - - /// - /// Get ElectricAdmittance in Microsiemens. - /// - public double Microsiemens => As(ElectricAdmittanceUnit.Microsiemens); - - /// - /// Get ElectricAdmittance in Millisiemens. - /// - public double Millisiemens => As(ElectricAdmittanceUnit.Millisiemens); - - /// - /// Get ElectricAdmittance in Nanosiemens. - /// - public double Nanosiemens => As(ElectricAdmittanceUnit.Nanosiemens); - - /// - /// Get ElectricAdmittance in Siemens. - /// - public double Siemens => As(ElectricAdmittanceUnit.Siemens); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. - /// - public static ElectricAdmittance Zero => new ElectricAdmittance(0, BaseUnit); - - /// - /// Get ElectricAdmittance from Microsiemens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricAdmittance FromMicrosiemens(double microsiemens) -#else - public static ElectricAdmittance FromMicrosiemens(QuantityValue microsiemens) -#endif - { - double value = (double) microsiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Microsiemens); - } - - /// - /// Get ElectricAdmittance from Millisiemens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricAdmittance FromMillisiemens(double millisiemens) -#else - public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) -#endif - { - double value = (double) millisiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Millisiemens); - } - - /// - /// Get ElectricAdmittance from Nanosiemens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricAdmittance FromNanosiemens(double nanosiemens) -#else - public static ElectricAdmittance FromNanosiemens(QuantityValue nanosiemens) -#endif - { - double value = (double) nanosiemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Nanosiemens); - } - - /// - /// Get ElectricAdmittance from Siemens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricAdmittance FromSiemens(double siemens) -#else - public static ElectricAdmittance FromSiemens(QuantityValue siemens) -#endif - { - double value = (double) siemens; - return new ElectricAdmittance(value, ElectricAdmittanceUnit.Siemens); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricAdmittance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricAdmittance From(double value, ElectricAdmittanceUnit fromUnit) -#else - public static ElectricAdmittance From(QuantityValue value, ElectricAdmittanceUnit fromUnit) -#endif - { - return new ElectricAdmittance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricAdmittanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); - - return CompareTo((ElectricAdmittance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricAdmittance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricAdmittance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricAdmittance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricAdmittanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricAdmittance to another ElectricAdmittance with the unit representation . - /// - /// A ElectricAdmittance with the specified unit. - public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricAdmittance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricAdmittanceUnit.Microsiemens: return (_value) * 1e-6d; - case ElectricAdmittanceUnit.Millisiemens: return (_value) * 1e-3d; - case ElectricAdmittanceUnit.Nanosiemens: return (_value) * 1e-9d; - case ElectricAdmittanceUnit.Siemens: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricAdmittanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricAdmittanceUnit.Microsiemens: return (baseUnitValue) / 1e-6d; - case ElectricAdmittanceUnit.Millisiemens: return (baseUnitValue) / 1e-3d; - case ElectricAdmittanceUnit.Nanosiemens: return (baseUnitValue) / 1e-9d; - case ElectricAdmittanceUnit.Siemens: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricAdmittance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricAdmittance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricAdmittanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricAdmittanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricAdmittance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) - { - result = default(ElectricAdmittance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricAdmittanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricAdmittanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricAdmittanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricAdmittanceUnit unit) - { - unit = ElectricAdmittanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricAdmittanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricAdmittanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricAdmittance - /// - public static ElectricAdmittance MaxValue => new ElectricAdmittance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricAdmittance - /// - public static ElectricAdmittance MinValue => new ElectricAdmittance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricAdmittance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricAdmittance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs deleted file mode 100644 index 5dbfebef04..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricCharge.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electric charge is the physical property of matter that causes it to experience a force when placed in an electromagnetic field. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricCharge : IQuantity -#else - public partial struct ElectricCharge : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricChargeUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricChargeUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricCharge() - { - BaseDimensions = new BaseDimensions(0, 0, 1, 1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricCharge(double numericValue, ElectricChargeUnit unit) - { - if(unit == ElectricChargeUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricCharge; - - /// - /// The base unit of ElectricCharge, which is Coulomb. All conversions go via this value. - /// - public static ElectricChargeUnit BaseUnit => ElectricChargeUnit.Coulomb; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricCharge quantity. - /// - public static ElectricChargeUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeUnit)).Cast().Except(new ElectricChargeUnit[]{ ElectricChargeUnit.Undefined }).ToArray(); - - /// - /// Get ElectricCharge in Coulombs. - /// - public double Coulombs => As(ElectricChargeUnit.Coulomb); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Coulomb. - /// - public static ElectricCharge Zero => new ElectricCharge(0, BaseUnit); - - /// - /// Get ElectricCharge from Coulombs. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCharge FromCoulombs(double coulombs) -#else - public static ElectricCharge FromCoulombs(QuantityValue coulombs) -#endif - { - double value = (double) coulombs; - return new ElectricCharge(value, ElectricChargeUnit.Coulomb); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCharge unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricCharge From(double value, ElectricChargeUnit fromUnit) -#else - public static ElectricCharge From(QuantityValue value, ElectricChargeUnit fromUnit) -#endif - { - return new ElectricCharge((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricChargeUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); - - return CompareTo((ElectricCharge)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricCharge other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricCharge within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricCharge. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricChargeUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricCharge to another ElectricCharge with the unit representation . - /// - /// A ElectricCharge with the specified unit. - public ElectricCharge ToUnit(ElectricChargeUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricCharge(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricChargeUnit.Coulomb: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricChargeUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricChargeUnit.Coulomb: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCharge Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricCharge result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricChargeUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricCharge ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) - { - result = default(ElectricCharge); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricChargeUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricChargeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeUnit unit) - { - unit = ElectricChargeUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricChargeUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricChargeUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricCharge - /// - public static ElectricCharge MaxValue => new ElectricCharge(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricCharge - /// - public static ElectricCharge MinValue => new ElectricCharge(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricCharge.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricCharge.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs deleted file mode 100644 index 6cb2bad778..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricChargeDensity.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, charge density is a measure of the amount of electric charge per unit length, surface area, or volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricChargeDensity : IQuantity -#else - public partial struct ElectricChargeDensity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricChargeDensityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricChargeDensity() - { - BaseDimensions = new BaseDimensions(-3, 0, 1, 1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit unit) - { - if(unit == ElectricChargeDensityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricChargeDensity; - - /// - /// The base unit of ElectricChargeDensity, which is CoulombPerCubicMeter. All conversions go via this value. - /// - public static ElectricChargeDensityUnit BaseUnit => ElectricChargeDensityUnit.CoulombPerCubicMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricChargeDensity quantity. - /// - public static ElectricChargeDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeDensityUnit)).Cast().Except(new ElectricChargeDensityUnit[]{ ElectricChargeDensityUnit.Undefined }).ToArray(); - - /// - /// Get ElectricChargeDensity in CoulombsPerCubicMeter. - /// - public double CoulombsPerCubicMeter => As(ElectricChargeDensityUnit.CoulombPerCubicMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerCubicMeter. - /// - public static ElectricChargeDensity Zero => new ElectricChargeDensity(0, BaseUnit); - - /// - /// Get ElectricChargeDensity from CoulombsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricChargeDensity FromCoulombsPerCubicMeter(double coulombspercubicmeter) -#else - public static ElectricChargeDensity FromCoulombsPerCubicMeter(QuantityValue coulombspercubicmeter) -#endif - { - double value = (double) coulombspercubicmeter; - return new ElectricChargeDensity(value, ElectricChargeDensityUnit.CoulombPerCubicMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricChargeDensity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricChargeDensity From(double value, ElectricChargeDensityUnit fromUnit) -#else - public static ElectricChargeDensity From(QuantityValue value, ElectricChargeDensityUnit fromUnit) -#endif - { - return new ElectricChargeDensity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricChargeDensityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); - - return CompareTo((ElectricChargeDensity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricChargeDensity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricChargeDensity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricChargeDensity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricChargeDensityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricChargeDensity to another ElectricChargeDensity with the unit representation . - /// - /// A ElectricChargeDensity with the specified unit. - public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricChargeDensity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricChargeDensityUnit.CoulombPerCubicMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricChargeDensityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricChargeDensityUnit.CoulombPerCubicMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricChargeDensity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricChargeDensityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricChargeDensityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricChargeDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) - { - result = default(ElectricChargeDensity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricChargeDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricChargeDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricChargeDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricChargeDensityUnit unit) - { - unit = ElectricChargeDensityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricChargeDensityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricChargeDensityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricChargeDensity - /// - public static ElectricChargeDensity MaxValue => new ElectricChargeDensity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricChargeDensity - /// - public static ElectricChargeDensity MinValue => new ElectricChargeDensity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricChargeDensity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricChargeDensity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs deleted file mode 100644 index 56d39d998a..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricConductance.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The electrical conductance of an electrical conductor is a measure of the easeness to pass an electric current through that conductor. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricConductance : IQuantity -#else - public partial struct ElectricConductance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricConductanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricConductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricConductance() - { - BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricConductance(double numericValue, ElectricConductanceUnit unit) - { - if(unit == ElectricConductanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricConductance; - - /// - /// The base unit of ElectricConductance, which is Siemens. All conversions go via this value. - /// - public static ElectricConductanceUnit BaseUnit => ElectricConductanceUnit.Siemens; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricConductance quantity. - /// - public static ElectricConductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductanceUnit)).Cast().Except(new ElectricConductanceUnit[]{ ElectricConductanceUnit.Undefined }).ToArray(); - - /// - /// Get ElectricConductance in Microsiemens. - /// - public double Microsiemens => As(ElectricConductanceUnit.Microsiemens); - - /// - /// Get ElectricConductance in Millisiemens. - /// - public double Millisiemens => As(ElectricConductanceUnit.Millisiemens); - - /// - /// Get ElectricConductance in Siemens. - /// - public double Siemens => As(ElectricConductanceUnit.Siemens); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. - /// - public static ElectricConductance Zero => new ElectricConductance(0, BaseUnit); - - /// - /// Get ElectricConductance from Microsiemens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricConductance FromMicrosiemens(double microsiemens) -#else - public static ElectricConductance FromMicrosiemens(QuantityValue microsiemens) -#endif - { - double value = (double) microsiemens; - return new ElectricConductance(value, ElectricConductanceUnit.Microsiemens); - } - - /// - /// Get ElectricConductance from Millisiemens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricConductance FromMillisiemens(double millisiemens) -#else - public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) -#endif - { - double value = (double) millisiemens; - return new ElectricConductance(value, ElectricConductanceUnit.Millisiemens); - } - - /// - /// Get ElectricConductance from Siemens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricConductance FromSiemens(double siemens) -#else - public static ElectricConductance FromSiemens(QuantityValue siemens) -#endif - { - double value = (double) siemens; - return new ElectricConductance(value, ElectricConductanceUnit.Siemens); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricConductance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricConductance From(double value, ElectricConductanceUnit fromUnit) -#else - public static ElectricConductance From(QuantityValue value, ElectricConductanceUnit fromUnit) -#endif - { - return new ElectricConductance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricConductanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); - - return CompareTo((ElectricConductance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricConductance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricConductance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricConductance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricConductanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricConductance to another ElectricConductance with the unit representation . - /// - /// A ElectricConductance with the specified unit. - public ElectricConductance ToUnit(ElectricConductanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricConductance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricConductanceUnit.Microsiemens: return (_value) * 1e-6d; - case ElectricConductanceUnit.Millisiemens: return (_value) * 1e-3d; - case ElectricConductanceUnit.Siemens: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricConductanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricConductanceUnit.Microsiemens: return (baseUnitValue) / 1e-6d; - case ElectricConductanceUnit.Millisiemens: return (baseUnitValue) / 1e-3d; - case ElectricConductanceUnit.Siemens: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricConductance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricConductance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricConductanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricConductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) - { - result = default(ElectricConductance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricConductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricConductanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductanceUnit unit) - { - unit = ElectricConductanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricConductanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricConductanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricConductance - /// - public static ElectricConductance MaxValue => new ElectricConductance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricConductance - /// - public static ElectricConductance MinValue => new ElectricConductance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricConductance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricConductance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs deleted file mode 100644 index b1079413da..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricConductivity.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electrical conductivity or specific conductance is the reciprocal of electrical resistivity, and measures a material's ability to conduct an electric current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricConductivity : IQuantity -#else - public partial struct ElectricConductivity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricConductivityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricConductivity() - { - BaseDimensions = new BaseDimensions(-3, -1, 3, 2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricConductivity(double numericValue, ElectricConductivityUnit unit) - { - if(unit == ElectricConductivityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricConductivity; - - /// - /// The base unit of ElectricConductivity, which is SiemensPerMeter. All conversions go via this value. - /// - public static ElectricConductivityUnit BaseUnit => ElectricConductivityUnit.SiemensPerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricConductivity quantity. - /// - public static ElectricConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductivityUnit)).Cast().Except(new ElectricConductivityUnit[]{ ElectricConductivityUnit.Undefined }).ToArray(); - - /// - /// Get ElectricConductivity in SiemensPerMeter. - /// - public double SiemensPerMeter => As(ElectricConductivityUnit.SiemensPerMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit SiemensPerMeter. - /// - public static ElectricConductivity Zero => new ElectricConductivity(0, BaseUnit); - - /// - /// Get ElectricConductivity from SiemensPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricConductivity FromSiemensPerMeter(double siemenspermeter) -#else - public static ElectricConductivity FromSiemensPerMeter(QuantityValue siemenspermeter) -#endif - { - double value = (double) siemenspermeter; - return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricConductivity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricConductivity From(double value, ElectricConductivityUnit fromUnit) -#else - public static ElectricConductivity From(QuantityValue value, ElectricConductivityUnit fromUnit) -#endif - { - return new ElectricConductivity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricConductivityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); - - return CompareTo((ElectricConductivity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricConductivity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricConductivity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricConductivity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricConductivityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricConductivity to another ElectricConductivity with the unit representation . - /// - /// A ElectricConductivity with the specified unit. - public ElectricConductivity ToUnit(ElectricConductivityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricConductivity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricConductivityUnit.SiemensPerMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricConductivityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricConductivityUnit.SiemensPerMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricConductivity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricConductivity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricConductivityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricConductivityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) - { - result = default(ElectricConductivity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricConductivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricConductivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricConductivityUnit unit) - { - unit = ElectricConductivityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricConductivityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricConductivityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricConductivity - /// - public static ElectricConductivity MaxValue => new ElectricConductivity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricConductivity - /// - public static ElectricConductivity MinValue => new ElectricConductivity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricConductivity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricConductivity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs deleted file mode 100644 index c05dd17d91..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricCurrent.Common.g.cs +++ /dev/null @@ -1,691 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricCurrent : IQuantity -#else - public partial struct ElectricCurrent : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricCurrentUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricCurrentUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricCurrent() - { - BaseDimensions = new BaseDimensions(0, 0, 0, 1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricCurrent(double numericValue, ElectricCurrentUnit unit) - { - if(unit == ElectricCurrentUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricCurrent; - - /// - /// The base unit of ElectricCurrent, which is Ampere. All conversions go via this value. - /// - public static ElectricCurrentUnit BaseUnit => ElectricCurrentUnit.Ampere; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricCurrent quantity. - /// - public static ElectricCurrentUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentUnit)).Cast().Except(new ElectricCurrentUnit[]{ ElectricCurrentUnit.Undefined }).ToArray(); - - /// - /// Get ElectricCurrent in Amperes. - /// - public double Amperes => As(ElectricCurrentUnit.Ampere); - - /// - /// Get ElectricCurrent in Centiamperes. - /// - public double Centiamperes => As(ElectricCurrentUnit.Centiampere); - - /// - /// Get ElectricCurrent in Kiloamperes. - /// - public double Kiloamperes => As(ElectricCurrentUnit.Kiloampere); - - /// - /// Get ElectricCurrent in Megaamperes. - /// - public double Megaamperes => As(ElectricCurrentUnit.Megaampere); - - /// - /// Get ElectricCurrent in Microamperes. - /// - public double Microamperes => As(ElectricCurrentUnit.Microampere); - - /// - /// Get ElectricCurrent in Milliamperes. - /// - public double Milliamperes => As(ElectricCurrentUnit.Milliampere); - - /// - /// Get ElectricCurrent in Nanoamperes. - /// - public double Nanoamperes => As(ElectricCurrentUnit.Nanoampere); - - /// - /// Get ElectricCurrent in Picoamperes. - /// - public double Picoamperes => As(ElectricCurrentUnit.Picoampere); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Ampere. - /// - public static ElectricCurrent Zero => new ElectricCurrent(0, BaseUnit); - - /// - /// Get ElectricCurrent from Amperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromAmperes(double amperes) -#else - public static ElectricCurrent FromAmperes(QuantityValue amperes) -#endif - { - double value = (double) amperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Ampere); - } - - /// - /// Get ElectricCurrent from Centiamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromCentiamperes(double centiamperes) -#else - public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) -#endif - { - double value = (double) centiamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Centiampere); - } - - /// - /// Get ElectricCurrent from Kiloamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromKiloamperes(double kiloamperes) -#else - public static ElectricCurrent FromKiloamperes(QuantityValue kiloamperes) -#endif - { - double value = (double) kiloamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Kiloampere); - } - - /// - /// Get ElectricCurrent from Megaamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromMegaamperes(double megaamperes) -#else - public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) -#endif - { - double value = (double) megaamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Megaampere); - } - - /// - /// Get ElectricCurrent from Microamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromMicroamperes(double microamperes) -#else - public static ElectricCurrent FromMicroamperes(QuantityValue microamperes) -#endif - { - double value = (double) microamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Microampere); - } - - /// - /// Get ElectricCurrent from Milliamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromMilliamperes(double milliamperes) -#else - public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) -#endif - { - double value = (double) milliamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Milliampere); - } - - /// - /// Get ElectricCurrent from Nanoamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromNanoamperes(double nanoamperes) -#else - public static ElectricCurrent FromNanoamperes(QuantityValue nanoamperes) -#endif - { - double value = (double) nanoamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Nanoampere); - } - - /// - /// Get ElectricCurrent from Picoamperes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrent FromPicoamperes(double picoamperes) -#else - public static ElectricCurrent FromPicoamperes(QuantityValue picoamperes) -#endif - { - double value = (double) picoamperes; - return new ElectricCurrent(value, ElectricCurrentUnit.Picoampere); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCurrent unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricCurrent From(double value, ElectricCurrentUnit fromUnit) -#else - public static ElectricCurrent From(QuantityValue value, ElectricCurrentUnit fromUnit) -#endif - { - return new ElectricCurrent((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); - - return CompareTo((ElectricCurrent)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricCurrent other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricCurrent within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricCurrent. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricCurrentUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricCurrent to another ElectricCurrent with the unit representation . - /// - /// A ElectricCurrent with the specified unit. - public ElectricCurrent ToUnit(ElectricCurrentUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricCurrent(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricCurrentUnit.Ampere: return _value; - case ElectricCurrentUnit.Centiampere: return (_value) * 1e-2d; - case ElectricCurrentUnit.Kiloampere: return (_value) * 1e3d; - case ElectricCurrentUnit.Megaampere: return (_value) * 1e6d; - case ElectricCurrentUnit.Microampere: return (_value) * 1e-6d; - case ElectricCurrentUnit.Milliampere: return (_value) * 1e-3d; - case ElectricCurrentUnit.Nanoampere: return (_value) * 1e-9d; - case ElectricCurrentUnit.Picoampere: return (_value) * 1e-12d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricCurrentUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricCurrentUnit.Ampere: return baseUnitValue; - case ElectricCurrentUnit.Centiampere: return (baseUnitValue) / 1e-2d; - case ElectricCurrentUnit.Kiloampere: return (baseUnitValue) / 1e3d; - case ElectricCurrentUnit.Megaampere: return (baseUnitValue) / 1e6d; - case ElectricCurrentUnit.Microampere: return (baseUnitValue) / 1e-6d; - case ElectricCurrentUnit.Milliampere: return (baseUnitValue) / 1e-3d; - case ElectricCurrentUnit.Nanoampere: return (baseUnitValue) / 1e-9d; - case ElectricCurrentUnit.Picoampere: return (baseUnitValue) / 1e-12d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrent Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricCurrentUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricCurrent ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) - { - result = default(ElectricCurrent); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricCurrentUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricCurrentUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentUnit unit) - { - unit = ElectricCurrentUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricCurrentUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricCurrentUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricCurrent - /// - public static ElectricCurrent MaxValue => new ElectricCurrent(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricCurrent - /// - public static ElectricCurrent MinValue => new ElectricCurrent(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricCurrent.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricCurrent.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs deleted file mode 100644 index 2bb80eac60..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricCurrentDensity.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, current density is the electric current per unit area of cross section. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricCurrentDensity : IQuantity -#else - public partial struct ElectricCurrentDensity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricCurrentDensityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricCurrentDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricCurrentDensity() - { - BaseDimensions = new BaseDimensions(-2, 0, 0, 1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricCurrentDensity(double numericValue, ElectricCurrentDensityUnit unit) - { - if(unit == ElectricCurrentDensityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricCurrentDensity; - - /// - /// The base unit of ElectricCurrentDensity, which is AmperePerSquareMeter. All conversions go via this value. - /// - public static ElectricCurrentDensityUnit BaseUnit => ElectricCurrentDensityUnit.AmperePerSquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricCurrentDensity quantity. - /// - public static ElectricCurrentDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentDensityUnit)).Cast().Except(new ElectricCurrentDensityUnit[]{ ElectricCurrentDensityUnit.Undefined }).ToArray(); - - /// - /// Get ElectricCurrentDensity in AmperesPerSquareMeter. - /// - public double AmperesPerSquareMeter => As(ElectricCurrentDensityUnit.AmperePerSquareMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSquareMeter. - /// - public static ElectricCurrentDensity Zero => new ElectricCurrentDensity(0, BaseUnit); - - /// - /// Get ElectricCurrentDensity from AmperesPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrentDensity FromAmperesPerSquareMeter(double amperespersquaremeter) -#else - public static ElectricCurrentDensity FromAmperesPerSquareMeter(QuantityValue amperespersquaremeter) -#endif - { - double value = (double) amperespersquaremeter; - return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCurrentDensity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricCurrentDensity From(double value, ElectricCurrentDensityUnit fromUnit) -#else - public static ElectricCurrentDensity From(QuantityValue value, ElectricCurrentDensityUnit fromUnit) -#endif - { - return new ElectricCurrentDensity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentDensityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); - - return CompareTo((ElectricCurrentDensity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricCurrentDensity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricCurrentDensity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricCurrentDensity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricCurrentDensityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricCurrentDensity to another ElectricCurrentDensity with the unit representation . - /// - /// A ElectricCurrentDensity with the specified unit. - public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricCurrentDensity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricCurrentDensityUnit.AmperePerSquareMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricCurrentDensityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricCurrentDensityUnit.AmperePerSquareMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrentDensity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentDensityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricCurrentDensityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricCurrentDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) - { - result = default(ElectricCurrentDensity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricCurrentDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricCurrentDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentDensityUnit unit) - { - unit = ElectricCurrentDensityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricCurrentDensityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricCurrentDensityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricCurrentDensity - /// - public static ElectricCurrentDensity MaxValue => new ElectricCurrentDensity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricCurrentDensity - /// - public static ElectricCurrentDensity MinValue => new ElectricCurrentDensity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricCurrentDensity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricCurrentDensity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs deleted file mode 100644 index 625f5f3f12..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricCurrentGradient.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, the current gradient describes how the current changes in time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricCurrentGradient : IQuantity -#else - public partial struct ElectricCurrentGradient : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricCurrentGradientUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricCurrentGradientUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricCurrentGradient() - { - BaseDimensions = new BaseDimensions(0, 0, -1, 1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricCurrentGradient(double numericValue, ElectricCurrentGradientUnit unit) - { - if(unit == ElectricCurrentGradientUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricCurrentGradient; - - /// - /// The base unit of ElectricCurrentGradient, which is AmperePerSecond. All conversions go via this value. - /// - public static ElectricCurrentGradientUnit BaseUnit => ElectricCurrentGradientUnit.AmperePerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricCurrentGradient quantity. - /// - public static ElectricCurrentGradientUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentGradientUnit)).Cast().Except(new ElectricCurrentGradientUnit[]{ ElectricCurrentGradientUnit.Undefined }).ToArray(); - - /// - /// Get ElectricCurrentGradient in AmperesPerSecond. - /// - public double AmperesPerSecond => As(ElectricCurrentGradientUnit.AmperePerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSecond. - /// - public static ElectricCurrentGradient Zero => new ElectricCurrentGradient(0, BaseUnit); - - /// - /// Get ElectricCurrentGradient from AmperesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricCurrentGradient FromAmperesPerSecond(double amperespersecond) -#else - public static ElectricCurrentGradient FromAmperesPerSecond(QuantityValue amperespersecond) -#endif - { - double value = (double) amperespersecond; - return new ElectricCurrentGradient(value, ElectricCurrentGradientUnit.AmperePerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCurrentGradient unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricCurrentGradient From(double value, ElectricCurrentGradientUnit fromUnit) -#else - public static ElectricCurrentGradient From(QuantityValue value, ElectricCurrentGradientUnit fromUnit) -#endif - { - return new ElectricCurrentGradient((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricCurrentGradientUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); - - return CompareTo((ElectricCurrentGradient)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricCurrentGradient other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricCurrentGradient within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricCurrentGradient. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricCurrentGradientUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricCurrentGradient to another ElectricCurrentGradient with the unit representation . - /// - /// A ElectricCurrentGradient with the specified unit. - public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricCurrentGradient(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricCurrentGradientUnit.AmperePerSecond: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricCurrentGradientUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricCurrentGradientUnit.AmperePerSecond: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricCurrentGradient Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricCurrentGradientUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricCurrentGradientUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricCurrentGradient ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) - { - result = default(ElectricCurrentGradient); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricCurrentGradientUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricCurrentGradientUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricCurrentGradientUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricCurrentGradientUnit unit) - { - unit = ElectricCurrentGradientUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricCurrentGradientUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricCurrentGradientUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricCurrentGradient - /// - public static ElectricCurrentGradient MaxValue => new ElectricCurrentGradient(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricCurrentGradient - /// - public static ElectricCurrentGradient MinValue => new ElectricCurrentGradient(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricCurrentGradient.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricCurrentGradient.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs deleted file mode 100644 index 58e01b2c4b..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricField.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// An electric field is a force field that surrounds electric charges that attracts or repels other electric charges. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricField : IQuantity -#else - public partial struct ElectricField : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricFieldUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricField() - { - BaseDimensions = new BaseDimensions(1, 1, -3, -1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricField(double numericValue, ElectricFieldUnit unit) - { - if(unit == ElectricFieldUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricField; - - /// - /// The base unit of ElectricField, which is VoltPerMeter. All conversions go via this value. - /// - public static ElectricFieldUnit BaseUnit => ElectricFieldUnit.VoltPerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricField quantity. - /// - public static ElectricFieldUnit[] Units { get; } = Enum.GetValues(typeof(ElectricFieldUnit)).Cast().Except(new ElectricFieldUnit[]{ ElectricFieldUnit.Undefined }).ToArray(); - - /// - /// Get ElectricField in VoltsPerMeter. - /// - public double VoltsPerMeter => As(ElectricFieldUnit.VoltPerMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit VoltPerMeter. - /// - public static ElectricField Zero => new ElectricField(0, BaseUnit); - - /// - /// Get ElectricField from VoltsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricField FromVoltsPerMeter(double voltspermeter) -#else - public static ElectricField FromVoltsPerMeter(QuantityValue voltspermeter) -#endif - { - double value = (double) voltspermeter; - return new ElectricField(value, ElectricFieldUnit.VoltPerMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricField unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricField From(double value, ElectricFieldUnit fromUnit) -#else - public static ElectricField From(QuantityValue value, ElectricFieldUnit fromUnit) -#endif - { - return new ElectricField((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricFieldUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); - - return CompareTo((ElectricField)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricField other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricField within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricField. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricFieldUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricField to another ElectricField with the unit representation . - /// - /// A ElectricField with the specified unit. - public ElectricField ToUnit(ElectricFieldUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricField(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricFieldUnit.VoltPerMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricFieldUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricFieldUnit.VoltPerMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricField Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricField result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricFieldUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricFieldUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricField ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) - { - result = default(ElectricField); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricFieldUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricFieldUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricFieldUnit unit) - { - unit = ElectricFieldUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricFieldUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricFieldUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricField - /// - public static ElectricField MaxValue => new ElectricField(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricField - /// - public static ElectricField MinValue => new ElectricField(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricField.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricField.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs deleted file mode 100644 index 2e5b239d35..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricInductance.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Inductance is a property of an electrical conductor which opposes a change in current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricInductance : IQuantity -#else - public partial struct ElectricInductance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricInductanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricInductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricInductance() - { - BaseDimensions = new BaseDimensions(2, 1, -2, -2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricInductance(double numericValue, ElectricInductanceUnit unit) - { - if(unit == ElectricInductanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricInductance; - - /// - /// The base unit of ElectricInductance, which is Henry. All conversions go via this value. - /// - public static ElectricInductanceUnit BaseUnit => ElectricInductanceUnit.Henry; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricInductance quantity. - /// - public static ElectricInductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricInductanceUnit)).Cast().Except(new ElectricInductanceUnit[]{ ElectricInductanceUnit.Undefined }).ToArray(); - - /// - /// Get ElectricInductance in Henries. - /// - public double Henries => As(ElectricInductanceUnit.Henry); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Henry. - /// - public static ElectricInductance Zero => new ElectricInductance(0, BaseUnit); - - /// - /// Get ElectricInductance from Henries. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricInductance FromHenries(double henries) -#else - public static ElectricInductance FromHenries(QuantityValue henries) -#endif - { - double value = (double) henries; - return new ElectricInductance(value, ElectricInductanceUnit.Henry); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricInductance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricInductance From(double value, ElectricInductanceUnit fromUnit) -#else - public static ElectricInductance From(QuantityValue value, ElectricInductanceUnit fromUnit) -#endif - { - return new ElectricInductance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricInductanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); - - return CompareTo((ElectricInductance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricInductance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricInductance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricInductance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricInductanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricInductance to another ElectricInductance with the unit representation . - /// - /// A ElectricInductance with the specified unit. - public ElectricInductance ToUnit(ElectricInductanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricInductance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricInductanceUnit.Henry: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricInductanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricInductanceUnit.Henry: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricInductance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricInductance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricInductanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricInductanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricInductance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) - { - result = default(ElectricInductance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricInductanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricInductanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricInductanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricInductanceUnit unit) - { - unit = ElectricInductanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricInductanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricInductanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricInductance - /// - public static ElectricInductance MaxValue => new ElectricInductance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricInductance - /// - public static ElectricInductance MinValue => new ElectricInductance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricInductance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricInductance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs deleted file mode 100644 index 36d1bc9933..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricPotential.Common.g.cs +++ /dev/null @@ -1,625 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricPotential : IQuantity -#else - public partial struct ElectricPotential : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricPotentialUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricPotentialUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricPotential() - { - BaseDimensions = new BaseDimensions(2, 1, -3, -1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricPotential(double numericValue, ElectricPotentialUnit unit) - { - if(unit == ElectricPotentialUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricPotential; - - /// - /// The base unit of ElectricPotential, which is Volt. All conversions go via this value. - /// - public static ElectricPotentialUnit BaseUnit => ElectricPotentialUnit.Volt; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricPotential quantity. - /// - public static ElectricPotentialUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialUnit)).Cast().Except(new ElectricPotentialUnit[]{ ElectricPotentialUnit.Undefined }).ToArray(); - - /// - /// Get ElectricPotential in Kilovolts. - /// - public double Kilovolts => As(ElectricPotentialUnit.Kilovolt); - - /// - /// Get ElectricPotential in Megavolts. - /// - public double Megavolts => As(ElectricPotentialUnit.Megavolt); - - /// - /// Get ElectricPotential in Microvolts. - /// - public double Microvolts => As(ElectricPotentialUnit.Microvolt); - - /// - /// Get ElectricPotential in Millivolts. - /// - public double Millivolts => As(ElectricPotentialUnit.Millivolt); - - /// - /// Get ElectricPotential in Volts. - /// - public double Volts => As(ElectricPotentialUnit.Volt); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Volt. - /// - public static ElectricPotential Zero => new ElectricPotential(0, BaseUnit); - - /// - /// Get ElectricPotential from Kilovolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotential FromKilovolts(double kilovolts) -#else - public static ElectricPotential FromKilovolts(QuantityValue kilovolts) -#endif - { - double value = (double) kilovolts; - return new ElectricPotential(value, ElectricPotentialUnit.Kilovolt); - } - - /// - /// Get ElectricPotential from Megavolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotential FromMegavolts(double megavolts) -#else - public static ElectricPotential FromMegavolts(QuantityValue megavolts) -#endif - { - double value = (double) megavolts; - return new ElectricPotential(value, ElectricPotentialUnit.Megavolt); - } - - /// - /// Get ElectricPotential from Microvolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotential FromMicrovolts(double microvolts) -#else - public static ElectricPotential FromMicrovolts(QuantityValue microvolts) -#endif - { - double value = (double) microvolts; - return new ElectricPotential(value, ElectricPotentialUnit.Microvolt); - } - - /// - /// Get ElectricPotential from Millivolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotential FromMillivolts(double millivolts) -#else - public static ElectricPotential FromMillivolts(QuantityValue millivolts) -#endif - { - double value = (double) millivolts; - return new ElectricPotential(value, ElectricPotentialUnit.Millivolt); - } - - /// - /// Get ElectricPotential from Volts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotential FromVolts(double volts) -#else - public static ElectricPotential FromVolts(QuantityValue volts) -#endif - { - double value = (double) volts; - return new ElectricPotential(value, ElectricPotentialUnit.Volt); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricPotential unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricPotential From(double value, ElectricPotentialUnit fromUnit) -#else - public static ElectricPotential From(QuantityValue value, ElectricPotentialUnit fromUnit) -#endif - { - return new ElectricPotential((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); - - return CompareTo((ElectricPotential)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricPotential other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricPotential within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricPotential. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricPotentialUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricPotential to another ElectricPotential with the unit representation . - /// - /// A ElectricPotential with the specified unit. - public ElectricPotential ToUnit(ElectricPotentialUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricPotential(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricPotentialUnit.Kilovolt: return (_value) * 1e3d; - case ElectricPotentialUnit.Megavolt: return (_value) * 1e6d; - case ElectricPotentialUnit.Microvolt: return (_value) * 1e-6d; - case ElectricPotentialUnit.Millivolt: return (_value) * 1e-3d; - case ElectricPotentialUnit.Volt: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricPotentialUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricPotentialUnit.Kilovolt: return (baseUnitValue) / 1e3d; - case ElectricPotentialUnit.Megavolt: return (baseUnitValue) / 1e6d; - case ElectricPotentialUnit.Microvolt: return (baseUnitValue) / 1e-6d; - case ElectricPotentialUnit.Millivolt: return (baseUnitValue) / 1e-3d; - case ElectricPotentialUnit.Volt: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotential Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricPotential result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricPotentialUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricPotential ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) - { - result = default(ElectricPotential); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricPotentialUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricPotentialUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialUnit unit) - { - unit = ElectricPotentialUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricPotentialUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricPotentialUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricPotential - /// - public static ElectricPotential MaxValue => new ElectricPotential(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricPotential - /// - public static ElectricPotential MinValue => new ElectricPotential(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricPotential.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricPotential.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs deleted file mode 100644 index 25aece9384..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricPotentialAc.Common.g.cs +++ /dev/null @@ -1,624 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Electric Potential of a system known to use Alternating Current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricPotentialAc : IQuantity -#else - public partial struct ElectricPotentialAc : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricPotentialAcUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricPotentialAcUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricPotentialAc() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricPotentialAc(double numericValue, ElectricPotentialAcUnit unit) - { - if(unit == ElectricPotentialAcUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricPotentialAc; - - /// - /// The base unit of ElectricPotentialAc, which is VoltAc. All conversions go via this value. - /// - public static ElectricPotentialAcUnit BaseUnit => ElectricPotentialAcUnit.VoltAc; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricPotentialAc quantity. - /// - public static ElectricPotentialAcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialAcUnit)).Cast().Except(new ElectricPotentialAcUnit[]{ ElectricPotentialAcUnit.Undefined }).ToArray(); - - /// - /// Get ElectricPotentialAc in KilovoltsAc. - /// - public double KilovoltsAc => As(ElectricPotentialAcUnit.KilovoltAc); - - /// - /// Get ElectricPotentialAc in MegavoltsAc. - /// - public double MegavoltsAc => As(ElectricPotentialAcUnit.MegavoltAc); - - /// - /// Get ElectricPotentialAc in MicrovoltsAc. - /// - public double MicrovoltsAc => As(ElectricPotentialAcUnit.MicrovoltAc); - - /// - /// Get ElectricPotentialAc in MillivoltsAc. - /// - public double MillivoltsAc => As(ElectricPotentialAcUnit.MillivoltAc); - - /// - /// Get ElectricPotentialAc in VoltsAc. - /// - public double VoltsAc => As(ElectricPotentialAcUnit.VoltAc); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit VoltAc. - /// - public static ElectricPotentialAc Zero => new ElectricPotentialAc(0, BaseUnit); - - /// - /// Get ElectricPotentialAc from KilovoltsAc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialAc FromKilovoltsAc(double kilovoltsac) -#else - public static ElectricPotentialAc FromKilovoltsAc(QuantityValue kilovoltsac) -#endif - { - double value = (double) kilovoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.KilovoltAc); - } - - /// - /// Get ElectricPotentialAc from MegavoltsAc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialAc FromMegavoltsAc(double megavoltsac) -#else - public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) -#endif - { - double value = (double) megavoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MegavoltAc); - } - - /// - /// Get ElectricPotentialAc from MicrovoltsAc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialAc FromMicrovoltsAc(double microvoltsac) -#else - public static ElectricPotentialAc FromMicrovoltsAc(QuantityValue microvoltsac) -#endif - { - double value = (double) microvoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MicrovoltAc); - } - - /// - /// Get ElectricPotentialAc from MillivoltsAc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialAc FromMillivoltsAc(double millivoltsac) -#else - public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) -#endif - { - double value = (double) millivoltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MillivoltAc); - } - - /// - /// Get ElectricPotentialAc from VoltsAc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialAc FromVoltsAc(double voltsac) -#else - public static ElectricPotentialAc FromVoltsAc(QuantityValue voltsac) -#endif - { - double value = (double) voltsac; - return new ElectricPotentialAc(value, ElectricPotentialAcUnit.VoltAc); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricPotentialAc unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricPotentialAc From(double value, ElectricPotentialAcUnit fromUnit) -#else - public static ElectricPotentialAc From(QuantityValue value, ElectricPotentialAcUnit fromUnit) -#endif - { - return new ElectricPotentialAc((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialAcUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); - - return CompareTo((ElectricPotentialAc)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricPotentialAc other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricPotentialAc within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricPotentialAc. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricPotentialAcUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricPotentialAc to another ElectricPotentialAc with the unit representation . - /// - /// A ElectricPotentialAc with the specified unit. - public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricPotentialAc(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricPotentialAcUnit.KilovoltAc: return (_value) * 1e3d; - case ElectricPotentialAcUnit.MegavoltAc: return (_value) * 1e6d; - case ElectricPotentialAcUnit.MicrovoltAc: return (_value) * 1e-6d; - case ElectricPotentialAcUnit.MillivoltAc: return (_value) * 1e-3d; - case ElectricPotentialAcUnit.VoltAc: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricPotentialAcUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricPotentialAcUnit.KilovoltAc: return (baseUnitValue) / 1e3d; - case ElectricPotentialAcUnit.MegavoltAc: return (baseUnitValue) / 1e6d; - case ElectricPotentialAcUnit.MicrovoltAc: return (baseUnitValue) / 1e-6d; - case ElectricPotentialAcUnit.MillivoltAc: return (baseUnitValue) / 1e-3d; - case ElectricPotentialAcUnit.VoltAc: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotentialAc Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialAcUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricPotentialAcUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricPotentialAc ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) - { - result = default(ElectricPotentialAc); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricPotentialAcUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricPotentialAcUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialAcUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialAcUnit unit) - { - unit = ElectricPotentialAcUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricPotentialAcUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricPotentialAcUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricPotentialAc - /// - public static ElectricPotentialAc MaxValue => new ElectricPotentialAc(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricPotentialAc - /// - public static ElectricPotentialAc MinValue => new ElectricPotentialAc(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricPotentialAc.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricPotentialAc.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs deleted file mode 100644 index 1d2005ec42..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricPotentialDc.Common.g.cs +++ /dev/null @@ -1,624 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Electric Potential of a system known to use Direct Current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricPotentialDc : IQuantity -#else - public partial struct ElectricPotentialDc : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricPotentialDcUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricPotentialDcUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricPotentialDc() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricPotentialDc(double numericValue, ElectricPotentialDcUnit unit) - { - if(unit == ElectricPotentialDcUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricPotentialDc; - - /// - /// The base unit of ElectricPotentialDc, which is VoltDc. All conversions go via this value. - /// - public static ElectricPotentialDcUnit BaseUnit => ElectricPotentialDcUnit.VoltDc; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricPotentialDc quantity. - /// - public static ElectricPotentialDcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialDcUnit)).Cast().Except(new ElectricPotentialDcUnit[]{ ElectricPotentialDcUnit.Undefined }).ToArray(); - - /// - /// Get ElectricPotentialDc in KilovoltsDc. - /// - public double KilovoltsDc => As(ElectricPotentialDcUnit.KilovoltDc); - - /// - /// Get ElectricPotentialDc in MegavoltsDc. - /// - public double MegavoltsDc => As(ElectricPotentialDcUnit.MegavoltDc); - - /// - /// Get ElectricPotentialDc in MicrovoltsDc. - /// - public double MicrovoltsDc => As(ElectricPotentialDcUnit.MicrovoltDc); - - /// - /// Get ElectricPotentialDc in MillivoltsDc. - /// - public double MillivoltsDc => As(ElectricPotentialDcUnit.MillivoltDc); - - /// - /// Get ElectricPotentialDc in VoltsDc. - /// - public double VoltsDc => As(ElectricPotentialDcUnit.VoltDc); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit VoltDc. - /// - public static ElectricPotentialDc Zero => new ElectricPotentialDc(0, BaseUnit); - - /// - /// Get ElectricPotentialDc from KilovoltsDc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialDc FromKilovoltsDc(double kilovoltsdc) -#else - public static ElectricPotentialDc FromKilovoltsDc(QuantityValue kilovoltsdc) -#endif - { - double value = (double) kilovoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.KilovoltDc); - } - - /// - /// Get ElectricPotentialDc from MegavoltsDc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialDc FromMegavoltsDc(double megavoltsdc) -#else - public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) -#endif - { - double value = (double) megavoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MegavoltDc); - } - - /// - /// Get ElectricPotentialDc from MicrovoltsDc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialDc FromMicrovoltsDc(double microvoltsdc) -#else - public static ElectricPotentialDc FromMicrovoltsDc(QuantityValue microvoltsdc) -#endif - { - double value = (double) microvoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MicrovoltDc); - } - - /// - /// Get ElectricPotentialDc from MillivoltsDc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialDc FromMillivoltsDc(double millivoltsdc) -#else - public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) -#endif - { - double value = (double) millivoltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MillivoltDc); - } - - /// - /// Get ElectricPotentialDc from VoltsDc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricPotentialDc FromVoltsDc(double voltsdc) -#else - public static ElectricPotentialDc FromVoltsDc(QuantityValue voltsdc) -#endif - { - double value = (double) voltsdc; - return new ElectricPotentialDc(value, ElectricPotentialDcUnit.VoltDc); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricPotentialDc unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricPotentialDc From(double value, ElectricPotentialDcUnit fromUnit) -#else - public static ElectricPotentialDc From(QuantityValue value, ElectricPotentialDcUnit fromUnit) -#endif - { - return new ElectricPotentialDc((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricPotentialDcUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); - - return CompareTo((ElectricPotentialDc)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricPotentialDc other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricPotentialDc within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricPotentialDc. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricPotentialDcUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricPotentialDc to another ElectricPotentialDc with the unit representation . - /// - /// A ElectricPotentialDc with the specified unit. - public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricPotentialDc(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricPotentialDcUnit.KilovoltDc: return (_value) * 1e3d; - case ElectricPotentialDcUnit.MegavoltDc: return (_value) * 1e6d; - case ElectricPotentialDcUnit.MicrovoltDc: return (_value) * 1e-6d; - case ElectricPotentialDcUnit.MillivoltDc: return (_value) * 1e-3d; - case ElectricPotentialDcUnit.VoltDc: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricPotentialDcUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricPotentialDcUnit.KilovoltDc: return (baseUnitValue) / 1e3d; - case ElectricPotentialDcUnit.MegavoltDc: return (baseUnitValue) / 1e6d; - case ElectricPotentialDcUnit.MicrovoltDc: return (baseUnitValue) / 1e-6d; - case ElectricPotentialDcUnit.MillivoltDc: return (baseUnitValue) / 1e-3d; - case ElectricPotentialDcUnit.VoltDc: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricPotentialDc Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricPotentialDcUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricPotentialDcUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricPotentialDc ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) - { - result = default(ElectricPotentialDc); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricPotentialDcUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricPotentialDcUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricPotentialDcUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricPotentialDcUnit unit) - { - unit = ElectricPotentialDcUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricPotentialDcUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricPotentialDcUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricPotentialDc - /// - public static ElectricPotentialDc MaxValue => new ElectricPotentialDc(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricPotentialDc - /// - public static ElectricPotentialDc MinValue => new ElectricPotentialDc(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricPotentialDc.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricPotentialDc.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs deleted file mode 100644 index 45f27e3218..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricResistance.Common.g.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricResistance : IQuantity -#else - public partial struct ElectricResistance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricResistanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricResistance() - { - BaseDimensions = new BaseDimensions(2, 1, -3, -2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricResistance(double numericValue, ElectricResistanceUnit unit) - { - if(unit == ElectricResistanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricResistance; - - /// - /// The base unit of ElectricResistance, which is Ohm. All conversions go via this value. - /// - public static ElectricResistanceUnit BaseUnit => ElectricResistanceUnit.Ohm; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricResistance quantity. - /// - public static ElectricResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistanceUnit)).Cast().Except(new ElectricResistanceUnit[]{ ElectricResistanceUnit.Undefined }).ToArray(); - - /// - /// Get ElectricResistance in Kiloohms. - /// - public double Kiloohms => As(ElectricResistanceUnit.Kiloohm); - - /// - /// Get ElectricResistance in Megaohms. - /// - public double Megaohms => As(ElectricResistanceUnit.Megaohm); - - /// - /// Get ElectricResistance in Milliohms. - /// - public double Milliohms => As(ElectricResistanceUnit.Milliohm); - - /// - /// Get ElectricResistance in Ohms. - /// - public double Ohms => As(ElectricResistanceUnit.Ohm); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Ohm. - /// - public static ElectricResistance Zero => new ElectricResistance(0, BaseUnit); - - /// - /// Get ElectricResistance from Kiloohms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistance FromKiloohms(double kiloohms) -#else - public static ElectricResistance FromKiloohms(QuantityValue kiloohms) -#endif - { - double value = (double) kiloohms; - return new ElectricResistance(value, ElectricResistanceUnit.Kiloohm); - } - - /// - /// Get ElectricResistance from Megaohms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistance FromMegaohms(double megaohms) -#else - public static ElectricResistance FromMegaohms(QuantityValue megaohms) -#endif - { - double value = (double) megaohms; - return new ElectricResistance(value, ElectricResistanceUnit.Megaohm); - } - - /// - /// Get ElectricResistance from Milliohms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistance FromMilliohms(double milliohms) -#else - public static ElectricResistance FromMilliohms(QuantityValue milliohms) -#endif - { - double value = (double) milliohms; - return new ElectricResistance(value, ElectricResistanceUnit.Milliohm); - } - - /// - /// Get ElectricResistance from Ohms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistance FromOhms(double ohms) -#else - public static ElectricResistance FromOhms(QuantityValue ohms) -#endif - { - double value = (double) ohms; - return new ElectricResistance(value, ElectricResistanceUnit.Ohm); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricResistance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricResistance From(double value, ElectricResistanceUnit fromUnit) -#else - public static ElectricResistance From(QuantityValue value, ElectricResistanceUnit fromUnit) -#endif - { - return new ElectricResistance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricResistanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); - - return CompareTo((ElectricResistance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricResistance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricResistance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricResistance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricResistanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricResistance to another ElectricResistance with the unit representation . - /// - /// A ElectricResistance with the specified unit. - public ElectricResistance ToUnit(ElectricResistanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricResistance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricResistanceUnit.Kiloohm: return (_value) * 1e3d; - case ElectricResistanceUnit.Megaohm: return (_value) * 1e6d; - case ElectricResistanceUnit.Milliohm: return (_value) * 1e-3d; - case ElectricResistanceUnit.Ohm: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricResistanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricResistanceUnit.Kiloohm: return (baseUnitValue) / 1e3d; - case ElectricResistanceUnit.Megaohm: return (baseUnitValue) / 1e6d; - case ElectricResistanceUnit.Milliohm: return (baseUnitValue) / 1e-3d; - case ElectricResistanceUnit.Ohm: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricResistance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricResistance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricResistanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) - { - result = default(ElectricResistance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricResistanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistanceUnit unit) - { - unit = ElectricResistanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricResistanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricResistanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricResistance - /// - public static ElectricResistance MaxValue => new ElectricResistance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricResistance - /// - public static ElectricResistance MinValue => new ElectricResistance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricResistance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricResistance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs b/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs deleted file mode 100644 index bc1a12ad0c..0000000000 --- a/Common/GeneratedCode/Quantities/ElectricResistivity.Common.g.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Electrical resistivity (also known as resistivity, specific electrical resistance, or volume resistivity) is a fundamental property that quantifies how strongly a given material opposes the flow of electric current. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ElectricResistivity : IQuantity -#else - public partial struct ElectricResistivity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ElectricResistivityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ElectricResistivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ElectricResistivity() - { - BaseDimensions = new BaseDimensions(3, 1, -3, -2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ElectricResistivity(double numericValue, ElectricResistivityUnit unit) - { - if(unit == ElectricResistivityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ElectricResistivity; - - /// - /// The base unit of ElectricResistivity, which is OhmMeter. All conversions go via this value. - /// - public static ElectricResistivityUnit BaseUnit => ElectricResistivityUnit.OhmMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ElectricResistivity quantity. - /// - public static ElectricResistivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistivityUnit)).Cast().Except(new ElectricResistivityUnit[]{ ElectricResistivityUnit.Undefined }).ToArray(); - - /// - /// Get ElectricResistivity in MicroohmMeters. - /// - public double MicroohmMeters => As(ElectricResistivityUnit.MicroohmMeter); - - /// - /// Get ElectricResistivity in MilliohmMeters. - /// - public double MilliohmMeters => As(ElectricResistivityUnit.MilliohmMeter); - - /// - /// Get ElectricResistivity in NanoohmMeters. - /// - public double NanoohmMeters => As(ElectricResistivityUnit.NanoohmMeter); - - /// - /// Get ElectricResistivity in OhmMeters. - /// - public double OhmMeters => As(ElectricResistivityUnit.OhmMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit OhmMeter. - /// - public static ElectricResistivity Zero => new ElectricResistivity(0, BaseUnit); - - /// - /// Get ElectricResistivity from MicroohmMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistivity FromMicroohmMeters(double microohmmeters) -#else - public static ElectricResistivity FromMicroohmMeters(QuantityValue microohmmeters) -#endif - { - double value = (double) microohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmMeter); - } - - /// - /// Get ElectricResistivity from MilliohmMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistivity FromMilliohmMeters(double milliohmmeters) -#else - public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeters) -#endif - { - double value = (double) milliohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmMeter); - } - - /// - /// Get ElectricResistivity from NanoohmMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistivity FromNanoohmMeters(double nanoohmmeters) -#else - public static ElectricResistivity FromNanoohmMeters(QuantityValue nanoohmmeters) -#endif - { - double value = (double) nanoohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmMeter); - } - - /// - /// Get ElectricResistivity from OhmMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ElectricResistivity FromOhmMeters(double ohmmeters) -#else - public static ElectricResistivity FromOhmMeters(QuantityValue ohmmeters) -#endif - { - double value = (double) ohmmeters; - return new ElectricResistivity(value, ElectricResistivityUnit.OhmMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricResistivity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ElectricResistivity From(double value, ElectricResistivityUnit fromUnit) -#else - public static ElectricResistivity From(QuantityValue value, ElectricResistivityUnit fromUnit) -#endif - { - return new ElectricResistivity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ElectricResistivityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); - - return CompareTo((ElectricResistivity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ElectricResistivity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ElectricResistivity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ElectricResistivity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ElectricResistivityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ElectricResistivity to another ElectricResistivity with the unit representation . - /// - /// A ElectricResistivity with the specified unit. - public ElectricResistivity ToUnit(ElectricResistivityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ElectricResistivity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ElectricResistivityUnit.MicroohmMeter: return (_value) * 1e-6d; - case ElectricResistivityUnit.MilliohmMeter: return (_value) * 1e-3d; - case ElectricResistivityUnit.NanoohmMeter: return (_value) * 1e-9d; - case ElectricResistivityUnit.OhmMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ElectricResistivityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ElectricResistivityUnit.MicroohmMeter: return (baseUnitValue) / 1e-6d; - case ElectricResistivityUnit.MilliohmMeter: return (baseUnitValue) / 1e-3d; - case ElectricResistivityUnit.NanoohmMeter: return (baseUnitValue) / 1e-9d; - case ElectricResistivityUnit.OhmMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ElectricResistivity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ElectricResistivity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ElectricResistivityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ElectricResistivityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ElectricResistivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) - { - result = default(ElectricResistivity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ElectricResistivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ElectricResistivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ElectricResistivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ElectricResistivityUnit unit) - { - unit = ElectricResistivityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ElectricResistivityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ElectricResistivityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ElectricResistivity - /// - public static ElectricResistivity MaxValue => new ElectricResistivity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ElectricResistivity - /// - public static ElectricResistivity MinValue => new ElectricResistivity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ElectricResistivity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ElectricResistivity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Energy.Common.g.cs b/Common/GeneratedCode/Quantities/Energy.Common.g.cs deleted file mode 100644 index 679d4ecf0e..0000000000 --- a/Common/GeneratedCode/Quantities/Energy.Common.g.cs +++ /dev/null @@ -1,999 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Energy : IQuantity -#else - public partial struct Energy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly EnergyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public EnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Energy() - { - BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Energy(double numericValue, EnergyUnit unit) - { - if(unit == EnergyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Energy; - - /// - /// The base unit of Energy, which is Joule. All conversions go via this value. - /// - public static EnergyUnit BaseUnit => EnergyUnit.Joule; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Energy quantity. - /// - public static EnergyUnit[] Units { get; } = Enum.GetValues(typeof(EnergyUnit)).Cast().Except(new EnergyUnit[]{ EnergyUnit.Undefined }).ToArray(); - - /// - /// Get Energy in BritishThermalUnits. - /// - public double BritishThermalUnits => As(EnergyUnit.BritishThermalUnit); - - /// - /// Get Energy in Calories. - /// - public double Calories => As(EnergyUnit.Calorie); - - /// - /// Get Energy in DecathermsEc. - /// - public double DecathermsEc => As(EnergyUnit.DecathermEc); - - /// - /// Get Energy in DecathermsImperial. - /// - public double DecathermsImperial => As(EnergyUnit.DecathermImperial); - - /// - /// Get Energy in DecathermsUs. - /// - public double DecathermsUs => As(EnergyUnit.DecathermUs); - - /// - /// Get Energy in ElectronVolts. - /// - public double ElectronVolts => As(EnergyUnit.ElectronVolt); - - /// - /// Get Energy in Ergs. - /// - public double Ergs => As(EnergyUnit.Erg); - - /// - /// Get Energy in FootPounds. - /// - public double FootPounds => As(EnergyUnit.FootPound); - - /// - /// Get Energy in GigabritishThermalUnits. - /// - public double GigabritishThermalUnits => As(EnergyUnit.GigabritishThermalUnit); - - /// - /// Get Energy in GigawattHours. - /// - public double GigawattHours => As(EnergyUnit.GigawattHour); - - /// - /// Get Energy in Joules. - /// - public double Joules => As(EnergyUnit.Joule); - - /// - /// Get Energy in KilobritishThermalUnits. - /// - public double KilobritishThermalUnits => As(EnergyUnit.KilobritishThermalUnit); - - /// - /// Get Energy in Kilocalories. - /// - public double Kilocalories => As(EnergyUnit.Kilocalorie); - - /// - /// Get Energy in Kilojoules. - /// - public double Kilojoules => As(EnergyUnit.Kilojoule); - - /// - /// Get Energy in KilowattHours. - /// - public double KilowattHours => As(EnergyUnit.KilowattHour); - - /// - /// Get Energy in MegabritishThermalUnits. - /// - public double MegabritishThermalUnits => As(EnergyUnit.MegabritishThermalUnit); - - /// - /// Get Energy in Megajoules. - /// - public double Megajoules => As(EnergyUnit.Megajoule); - - /// - /// Get Energy in MegawattHours. - /// - public double MegawattHours => As(EnergyUnit.MegawattHour); - - /// - /// Get Energy in ThermsEc. - /// - public double ThermsEc => As(EnergyUnit.ThermEc); - - /// - /// Get Energy in ThermsImperial. - /// - public double ThermsImperial => As(EnergyUnit.ThermImperial); - - /// - /// Get Energy in ThermsUs. - /// - public double ThermsUs => As(EnergyUnit.ThermUs); - - /// - /// Get Energy in WattHours. - /// - public double WattHours => As(EnergyUnit.WattHour); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Joule. - /// - public static Energy Zero => new Energy(0, BaseUnit); - - /// - /// Get Energy from BritishThermalUnits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromBritishThermalUnits(double britishthermalunits) -#else - public static Energy FromBritishThermalUnits(QuantityValue britishthermalunits) -#endif - { - double value = (double) britishthermalunits; - return new Energy(value, EnergyUnit.BritishThermalUnit); - } - - /// - /// Get Energy from Calories. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromCalories(double calories) -#else - public static Energy FromCalories(QuantityValue calories) -#endif - { - double value = (double) calories; - return new Energy(value, EnergyUnit.Calorie); - } - - /// - /// Get Energy from DecathermsEc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromDecathermsEc(double decathermsec) -#else - public static Energy FromDecathermsEc(QuantityValue decathermsec) -#endif - { - double value = (double) decathermsec; - return new Energy(value, EnergyUnit.DecathermEc); - } - - /// - /// Get Energy from DecathermsImperial. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromDecathermsImperial(double decathermsimperial) -#else - public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) -#endif - { - double value = (double) decathermsimperial; - return new Energy(value, EnergyUnit.DecathermImperial); - } - - /// - /// Get Energy from DecathermsUs. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromDecathermsUs(double decathermsus) -#else - public static Energy FromDecathermsUs(QuantityValue decathermsus) -#endif - { - double value = (double) decathermsus; - return new Energy(value, EnergyUnit.DecathermUs); - } - - /// - /// Get Energy from ElectronVolts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromElectronVolts(double electronvolts) -#else - public static Energy FromElectronVolts(QuantityValue electronvolts) -#endif - { - double value = (double) electronvolts; - return new Energy(value, EnergyUnit.ElectronVolt); - } - - /// - /// Get Energy from Ergs. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromErgs(double ergs) -#else - public static Energy FromErgs(QuantityValue ergs) -#endif - { - double value = (double) ergs; - return new Energy(value, EnergyUnit.Erg); - } - - /// - /// Get Energy from FootPounds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromFootPounds(double footpounds) -#else - public static Energy FromFootPounds(QuantityValue footpounds) -#endif - { - double value = (double) footpounds; - return new Energy(value, EnergyUnit.FootPound); - } - - /// - /// Get Energy from GigabritishThermalUnits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromGigabritishThermalUnits(double gigabritishthermalunits) -#else - public static Energy FromGigabritishThermalUnits(QuantityValue gigabritishthermalunits) -#endif - { - double value = (double) gigabritishthermalunits; - return new Energy(value, EnergyUnit.GigabritishThermalUnit); - } - - /// - /// Get Energy from GigawattHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromGigawattHours(double gigawatthours) -#else - public static Energy FromGigawattHours(QuantityValue gigawatthours) -#endif - { - double value = (double) gigawatthours; - return new Energy(value, EnergyUnit.GigawattHour); - } - - /// - /// Get Energy from Joules. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromJoules(double joules) -#else - public static Energy FromJoules(QuantityValue joules) -#endif - { - double value = (double) joules; - return new Energy(value, EnergyUnit.Joule); - } - - /// - /// Get Energy from KilobritishThermalUnits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromKilobritishThermalUnits(double kilobritishthermalunits) -#else - public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishthermalunits) -#endif - { - double value = (double) kilobritishthermalunits; - return new Energy(value, EnergyUnit.KilobritishThermalUnit); - } - - /// - /// Get Energy from Kilocalories. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromKilocalories(double kilocalories) -#else - public static Energy FromKilocalories(QuantityValue kilocalories) -#endif - { - double value = (double) kilocalories; - return new Energy(value, EnergyUnit.Kilocalorie); - } - - /// - /// Get Energy from Kilojoules. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromKilojoules(double kilojoules) -#else - public static Energy FromKilojoules(QuantityValue kilojoules) -#endif - { - double value = (double) kilojoules; - return new Energy(value, EnergyUnit.Kilojoule); - } - - /// - /// Get Energy from KilowattHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromKilowattHours(double kilowatthours) -#else - public static Energy FromKilowattHours(QuantityValue kilowatthours) -#endif - { - double value = (double) kilowatthours; - return new Energy(value, EnergyUnit.KilowattHour); - } - - /// - /// Get Energy from MegabritishThermalUnits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromMegabritishThermalUnits(double megabritishthermalunits) -#else - public static Energy FromMegabritishThermalUnits(QuantityValue megabritishthermalunits) -#endif - { - double value = (double) megabritishthermalunits; - return new Energy(value, EnergyUnit.MegabritishThermalUnit); - } - - /// - /// Get Energy from Megajoules. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromMegajoules(double megajoules) -#else - public static Energy FromMegajoules(QuantityValue megajoules) -#endif - { - double value = (double) megajoules; - return new Energy(value, EnergyUnit.Megajoule); - } - - /// - /// Get Energy from MegawattHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromMegawattHours(double megawatthours) -#else - public static Energy FromMegawattHours(QuantityValue megawatthours) -#endif - { - double value = (double) megawatthours; - return new Energy(value, EnergyUnit.MegawattHour); - } - - /// - /// Get Energy from ThermsEc. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromThermsEc(double thermsec) -#else - public static Energy FromThermsEc(QuantityValue thermsec) -#endif - { - double value = (double) thermsec; - return new Energy(value, EnergyUnit.ThermEc); - } - - /// - /// Get Energy from ThermsImperial. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromThermsImperial(double thermsimperial) -#else - public static Energy FromThermsImperial(QuantityValue thermsimperial) -#endif - { - double value = (double) thermsimperial; - return new Energy(value, EnergyUnit.ThermImperial); - } - - /// - /// Get Energy from ThermsUs. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromThermsUs(double thermsus) -#else - public static Energy FromThermsUs(QuantityValue thermsus) -#endif - { - double value = (double) thermsus; - return new Energy(value, EnergyUnit.ThermUs); - } - - /// - /// Get Energy from WattHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Energy FromWattHours(double watthours) -#else - public static Energy FromWattHours(QuantityValue watthours) -#endif - { - double value = (double) watthours; - return new Energy(value, EnergyUnit.WattHour); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Energy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Energy From(double value, EnergyUnit fromUnit) -#else - public static Energy From(QuantityValue value, EnergyUnit fromUnit) -#endif - { - return new Energy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(EnergyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Energy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); - - return CompareTo((Energy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Energy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Energy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Energy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(EnergyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Energy to another Energy with the unit representation . - /// - /// A Energy with the specified unit. - public Energy ToUnit(EnergyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Energy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case EnergyUnit.BritishThermalUnit: return _value*1055.05585262; - case EnergyUnit.Calorie: return _value*4.184; - case EnergyUnit.DecathermEc: return (_value*1.05505585262e8) * 1e1d; - case EnergyUnit.DecathermImperial: return (_value*1.05505585257348e8) * 1e1d; - case EnergyUnit.DecathermUs: return (_value*1.054804e8) * 1e1d; - case EnergyUnit.ElectronVolt: return _value*1.602176565e-19; - case EnergyUnit.Erg: return _value*1e-7; - case EnergyUnit.FootPound: return _value*1.355817948; - case EnergyUnit.GigabritishThermalUnit: return (_value*1055.05585262) * 1e9d; - case EnergyUnit.GigawattHour: return (_value*3600d) * 1e9d; - case EnergyUnit.Joule: return _value; - case EnergyUnit.KilobritishThermalUnit: return (_value*1055.05585262) * 1e3d; - case EnergyUnit.Kilocalorie: return (_value*4.184) * 1e3d; - case EnergyUnit.Kilojoule: return (_value) * 1e3d; - case EnergyUnit.KilowattHour: return (_value*3600d) * 1e3d; - case EnergyUnit.MegabritishThermalUnit: return (_value*1055.05585262) * 1e6d; - case EnergyUnit.Megajoule: return (_value) * 1e6d; - case EnergyUnit.MegawattHour: return (_value*3600d) * 1e6d; - case EnergyUnit.ThermEc: return _value*1.05505585262e8; - case EnergyUnit.ThermImperial: return _value*1.05505585257348e8; - case EnergyUnit.ThermUs: return _value*1.054804e8; - case EnergyUnit.WattHour: return _value*3600d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(EnergyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case EnergyUnit.BritishThermalUnit: return baseUnitValue/1055.05585262; - case EnergyUnit.Calorie: return baseUnitValue/4.184; - case EnergyUnit.DecathermEc: return (baseUnitValue/1.05505585262e8) / 1e1d; - case EnergyUnit.DecathermImperial: return (baseUnitValue/1.05505585257348e8) / 1e1d; - case EnergyUnit.DecathermUs: return (baseUnitValue/1.054804e8) / 1e1d; - case EnergyUnit.ElectronVolt: return baseUnitValue/1.602176565e-19; - case EnergyUnit.Erg: return baseUnitValue/1e-7; - case EnergyUnit.FootPound: return baseUnitValue/1.355817948; - case EnergyUnit.GigabritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e9d; - case EnergyUnit.GigawattHour: return (baseUnitValue/3600d) / 1e9d; - case EnergyUnit.Joule: return baseUnitValue; - case EnergyUnit.KilobritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e3d; - case EnergyUnit.Kilocalorie: return (baseUnitValue/4.184) / 1e3d; - case EnergyUnit.Kilojoule: return (baseUnitValue) / 1e3d; - case EnergyUnit.KilowattHour: return (baseUnitValue/3600d) / 1e3d; - case EnergyUnit.MegabritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e6d; - case EnergyUnit.Megajoule: return (baseUnitValue) / 1e6d; - case EnergyUnit.MegawattHour: return (baseUnitValue/3600d) / 1e6d; - case EnergyUnit.ThermEc: return baseUnitValue/1.05505585262e8; - case EnergyUnit.ThermImperial: return baseUnitValue/1.05505585257348e8; - case EnergyUnit.ThermUs: return baseUnitValue/1.054804e8; - case EnergyUnit.WattHour: return baseUnitValue/3600d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Energy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Energy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EnergyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out EnergyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Energy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) - { - result = default(Energy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static EnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == EnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out EnergyUnit unit) - { - unit = EnergyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == EnergyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(EnergyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Energy - /// - public static Energy MaxValue => new Energy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Energy - /// - public static Energy MinValue => new Energy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Energy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Energy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs b/Common/GeneratedCode/Quantities/Entropy.Common.g.cs deleted file mode 100644 index d2b8047b4a..0000000000 --- a/Common/GeneratedCode/Quantities/Entropy.Common.g.cs +++ /dev/null @@ -1,669 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Entropy : IQuantity -#else - public partial struct Entropy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly EntropyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public EntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Entropy() - { - BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Entropy(double numericValue, EntropyUnit unit) - { - if(unit == EntropyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Entropy; - - /// - /// The base unit of Entropy, which is JoulePerKelvin. All conversions go via this value. - /// - public static EntropyUnit BaseUnit => EntropyUnit.JoulePerKelvin; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Entropy quantity. - /// - public static EntropyUnit[] Units { get; } = Enum.GetValues(typeof(EntropyUnit)).Cast().Except(new EntropyUnit[]{ EntropyUnit.Undefined }).ToArray(); - - /// - /// Get Entropy in CaloriesPerKelvin. - /// - public double CaloriesPerKelvin => As(EntropyUnit.CaloriePerKelvin); - - /// - /// Get Entropy in JoulesPerDegreeCelsius. - /// - public double JoulesPerDegreeCelsius => As(EntropyUnit.JoulePerDegreeCelsius); - - /// - /// Get Entropy in JoulesPerKelvin. - /// - public double JoulesPerKelvin => As(EntropyUnit.JoulePerKelvin); - - /// - /// Get Entropy in KilocaloriesPerKelvin. - /// - public double KilocaloriesPerKelvin => As(EntropyUnit.KilocaloriePerKelvin); - - /// - /// Get Entropy in KilojoulesPerDegreeCelsius. - /// - public double KilojoulesPerDegreeCelsius => As(EntropyUnit.KilojoulePerDegreeCelsius); - - /// - /// Get Entropy in KilojoulesPerKelvin. - /// - public double KilojoulesPerKelvin => As(EntropyUnit.KilojoulePerKelvin); - - /// - /// Get Entropy in MegajoulesPerKelvin. - /// - public double MegajoulesPerKelvin => As(EntropyUnit.MegajoulePerKelvin); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKelvin. - /// - public static Entropy Zero => new Entropy(0, BaseUnit); - - /// - /// Get Entropy from CaloriesPerKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Entropy FromCaloriesPerKelvin(double caloriesperkelvin) -#else - public static Entropy FromCaloriesPerKelvin(QuantityValue caloriesperkelvin) -#endif - { - double value = (double) caloriesperkelvin; - return new Entropy(value, EntropyUnit.CaloriePerKelvin); - } - - /// - /// Get Entropy from JoulesPerDegreeCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Entropy FromJoulesPerDegreeCelsius(double joulesperdegreecelsius) -#else - public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreecelsius) -#endif - { - double value = (double) joulesperdegreecelsius; - return new Entropy(value, EntropyUnit.JoulePerDegreeCelsius); - } - - /// - /// Get Entropy from JoulesPerKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Entropy FromJoulesPerKelvin(double joulesperkelvin) -#else - public static Entropy FromJoulesPerKelvin(QuantityValue joulesperkelvin) -#endif - { - double value = (double) joulesperkelvin; - return new Entropy(value, EntropyUnit.JoulePerKelvin); - } - - /// - /// Get Entropy from KilocaloriesPerKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Entropy FromKilocaloriesPerKelvin(double kilocaloriesperkelvin) -#else - public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkelvin) -#endif - { - double value = (double) kilocaloriesperkelvin; - return new Entropy(value, EntropyUnit.KilocaloriePerKelvin); - } - - /// - /// Get Entropy from KilojoulesPerDegreeCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Entropy FromKilojoulesPerDegreeCelsius(double kilojoulesperdegreecelsius) -#else - public static Entropy FromKilojoulesPerDegreeCelsius(QuantityValue kilojoulesperdegreecelsius) -#endif - { - double value = (double) kilojoulesperdegreecelsius; - return new Entropy(value, EntropyUnit.KilojoulePerDegreeCelsius); - } - - /// - /// Get Entropy from KilojoulesPerKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Entropy FromKilojoulesPerKelvin(double kilojoulesperkelvin) -#else - public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) -#endif - { - double value = (double) kilojoulesperkelvin; - return new Entropy(value, EntropyUnit.KilojoulePerKelvin); - } - - /// - /// Get Entropy from MegajoulesPerKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Entropy FromMegajoulesPerKelvin(double megajoulesperkelvin) -#else - public static Entropy FromMegajoulesPerKelvin(QuantityValue megajoulesperkelvin) -#endif - { - double value = (double) megajoulesperkelvin; - return new Entropy(value, EntropyUnit.MegajoulePerKelvin); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Entropy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Entropy From(double value, EntropyUnit fromUnit) -#else - public static Entropy From(QuantityValue value, EntropyUnit fromUnit) -#endif - { - return new Entropy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(EntropyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Entropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); - - return CompareTo((Entropy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Entropy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Entropy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Entropy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(EntropyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Entropy to another Entropy with the unit representation . - /// - /// A Entropy with the specified unit. - public Entropy ToUnit(EntropyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Entropy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case EntropyUnit.CaloriePerKelvin: return _value*4.184; - case EntropyUnit.JoulePerDegreeCelsius: return _value; - case EntropyUnit.JoulePerKelvin: return _value; - case EntropyUnit.KilocaloriePerKelvin: return (_value*4.184) * 1e3d; - case EntropyUnit.KilojoulePerDegreeCelsius: return (_value) * 1e3d; - case EntropyUnit.KilojoulePerKelvin: return (_value) * 1e3d; - case EntropyUnit.MegajoulePerKelvin: return (_value) * 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(EntropyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case EntropyUnit.CaloriePerKelvin: return baseUnitValue/4.184; - case EntropyUnit.JoulePerDegreeCelsius: return baseUnitValue; - case EntropyUnit.JoulePerKelvin: return baseUnitValue; - case EntropyUnit.KilocaloriePerKelvin: return (baseUnitValue/4.184) / 1e3d; - case EntropyUnit.KilojoulePerDegreeCelsius: return (baseUnitValue) / 1e3d; - case EntropyUnit.KilojoulePerKelvin: return (baseUnitValue) / 1e3d; - case EntropyUnit.MegajoulePerKelvin: return (baseUnitValue) / 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Entropy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Entropy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static EntropyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out EntropyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Entropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) - { - result = default(Entropy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static EntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == EntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized EntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out EntropyUnit unit) - { - unit = EntropyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == EntropyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(EntropyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Entropy - /// - public static Entropy MaxValue => new Entropy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Entropy - /// - public static Entropy MinValue => new Entropy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Entropy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Entropy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Force.Common.g.cs b/Common/GeneratedCode/Quantities/Force.Common.g.cs deleted file mode 100644 index 527bd45208..0000000000 --- a/Common/GeneratedCode/Quantities/Force.Common.g.cs +++ /dev/null @@ -1,735 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Force : IQuantity -#else - public partial struct Force : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ForceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ForceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Force() - { - BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Force(double numericValue, ForceUnit unit) - { - if(unit == ForceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Force; - - /// - /// The base unit of Force, which is Newton. All conversions go via this value. - /// - public static ForceUnit BaseUnit => ForceUnit.Newton; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Force quantity. - /// - public static ForceUnit[] Units { get; } = Enum.GetValues(typeof(ForceUnit)).Cast().Except(new ForceUnit[]{ ForceUnit.Undefined }).ToArray(); - - /// - /// Get Force in Decanewtons. - /// - public double Decanewtons => As(ForceUnit.Decanewton); - - /// - /// Get Force in Dyne. - /// - public double Dyne => As(ForceUnit.Dyn); - - /// - /// Get Force in KilogramsForce. - /// - public double KilogramsForce => As(ForceUnit.KilogramForce); - - /// - /// Get Force in Kilonewtons. - /// - public double Kilonewtons => As(ForceUnit.Kilonewton); - - /// - /// Get Force in KiloPonds. - /// - public double KiloPonds => As(ForceUnit.KiloPond); - - /// - /// Get Force in Meganewtons. - /// - public double Meganewtons => As(ForceUnit.Meganewton); - - /// - /// Get Force in Newtons. - /// - public double Newtons => As(ForceUnit.Newton); - - /// - /// Get Force in Poundals. - /// - public double Poundals => As(ForceUnit.Poundal); - - /// - /// Get Force in PoundsForce. - /// - public double PoundsForce => As(ForceUnit.PoundForce); - - /// - /// Get Force in TonnesForce. - /// - public double TonnesForce => As(ForceUnit.TonneForce); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Newton. - /// - public static Force Zero => new Force(0, BaseUnit); - - /// - /// Get Force from Decanewtons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromDecanewtons(double decanewtons) -#else - public static Force FromDecanewtons(QuantityValue decanewtons) -#endif - { - double value = (double) decanewtons; - return new Force(value, ForceUnit.Decanewton); - } - - /// - /// Get Force from Dyne. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromDyne(double dyne) -#else - public static Force FromDyne(QuantityValue dyne) -#endif - { - double value = (double) dyne; - return new Force(value, ForceUnit.Dyn); - } - - /// - /// Get Force from KilogramsForce. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromKilogramsForce(double kilogramsforce) -#else - public static Force FromKilogramsForce(QuantityValue kilogramsforce) -#endif - { - double value = (double) kilogramsforce; - return new Force(value, ForceUnit.KilogramForce); - } - - /// - /// Get Force from Kilonewtons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromKilonewtons(double kilonewtons) -#else - public static Force FromKilonewtons(QuantityValue kilonewtons) -#endif - { - double value = (double) kilonewtons; - return new Force(value, ForceUnit.Kilonewton); - } - - /// - /// Get Force from KiloPonds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromKiloPonds(double kiloponds) -#else - public static Force FromKiloPonds(QuantityValue kiloponds) -#endif - { - double value = (double) kiloponds; - return new Force(value, ForceUnit.KiloPond); - } - - /// - /// Get Force from Meganewtons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromMeganewtons(double meganewtons) -#else - public static Force FromMeganewtons(QuantityValue meganewtons) -#endif - { - double value = (double) meganewtons; - return new Force(value, ForceUnit.Meganewton); - } - - /// - /// Get Force from Newtons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromNewtons(double newtons) -#else - public static Force FromNewtons(QuantityValue newtons) -#endif - { - double value = (double) newtons; - return new Force(value, ForceUnit.Newton); - } - - /// - /// Get Force from Poundals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromPoundals(double poundals) -#else - public static Force FromPoundals(QuantityValue poundals) -#endif - { - double value = (double) poundals; - return new Force(value, ForceUnit.Poundal); - } - - /// - /// Get Force from PoundsForce. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromPoundsForce(double poundsforce) -#else - public static Force FromPoundsForce(QuantityValue poundsforce) -#endif - { - double value = (double) poundsforce; - return new Force(value, ForceUnit.PoundForce); - } - - /// - /// Get Force from TonnesForce. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Force FromTonnesForce(double tonnesforce) -#else - public static Force FromTonnesForce(QuantityValue tonnesforce) -#endif - { - double value = (double) tonnesforce; - return new Force(value, ForceUnit.TonneForce); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Force unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Force From(double value, ForceUnit fromUnit) -#else - public static Force From(QuantityValue value, ForceUnit fromUnit) -#endif - { - return new Force((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Force)) throw new ArgumentException("Expected type Force.", nameof(obj)); - - return CompareTo((Force)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Force other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Force within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Force other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Force. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ForceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Force to another Force with the unit representation . - /// - /// A Force with the specified unit. - public Force ToUnit(ForceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Force(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ForceUnit.Decanewton: return (_value) * 1e1d; - case ForceUnit.Dyn: return _value/1e5; - case ForceUnit.KilogramForce: return _value*9.80665002864; - case ForceUnit.Kilonewton: return (_value) * 1e3d; - case ForceUnit.KiloPond: return _value*9.80665002864; - case ForceUnit.Meganewton: return (_value) * 1e6d; - case ForceUnit.Newton: return _value; - case ForceUnit.Poundal: return _value*0.13825502798973041652092282466083; - case ForceUnit.PoundForce: return _value*4.4482216152605095551842641431421; - case ForceUnit.TonneForce: return _value*9.80665002864e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ForceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ForceUnit.Decanewton: return (baseUnitValue) / 1e1d; - case ForceUnit.Dyn: return baseUnitValue*1e5; - case ForceUnit.KilogramForce: return baseUnitValue/9.80665002864; - case ForceUnit.Kilonewton: return (baseUnitValue) / 1e3d; - case ForceUnit.KiloPond: return baseUnitValue/9.80665002864; - case ForceUnit.Meganewton: return (baseUnitValue) / 1e6d; - case ForceUnit.Newton: return baseUnitValue; - case ForceUnit.Poundal: return baseUnitValue/0.13825502798973041652092282466083; - case ForceUnit.PoundForce: return baseUnitValue/4.4482216152605095551842641431421; - case ForceUnit.TonneForce: return baseUnitValue/9.80665002864e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Force Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Force result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ForceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Force ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) - { - result = default(Force); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ForceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ForceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceUnit unit) - { - unit = ForceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ForceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ForceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Force - /// - public static Force MaxValue => new Force(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Force - /// - public static Force MinValue => new Force(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Force.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Force.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs deleted file mode 100644 index 9c1f7f2341..0000000000 --- a/Common/GeneratedCode/Quantities/ForceChangeRate.Common.g.cs +++ /dev/null @@ -1,757 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ForceChangeRate : IQuantity -#else - public partial struct ForceChangeRate : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ForceChangeRateUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ForceChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ForceChangeRate() - { - BaseDimensions = new BaseDimensions(1, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ForceChangeRate(double numericValue, ForceChangeRateUnit unit) - { - if(unit == ForceChangeRateUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ForceChangeRate; - - /// - /// The base unit of ForceChangeRate, which is NewtonPerSecond. All conversions go via this value. - /// - public static ForceChangeRateUnit BaseUnit => ForceChangeRateUnit.NewtonPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ForceChangeRate quantity. - /// - public static ForceChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(ForceChangeRateUnit)).Cast().Except(new ForceChangeRateUnit[]{ ForceChangeRateUnit.Undefined }).ToArray(); - - /// - /// Get ForceChangeRate in CentinewtonsPerSecond. - /// - public double CentinewtonsPerSecond => As(ForceChangeRateUnit.CentinewtonPerSecond); - - /// - /// Get ForceChangeRate in DecanewtonsPerMinute. - /// - public double DecanewtonsPerMinute => As(ForceChangeRateUnit.DecanewtonPerMinute); - - /// - /// Get ForceChangeRate in DecanewtonsPerSecond. - /// - public double DecanewtonsPerSecond => As(ForceChangeRateUnit.DecanewtonPerSecond); - - /// - /// Get ForceChangeRate in DecinewtonsPerSecond. - /// - public double DecinewtonsPerSecond => As(ForceChangeRateUnit.DecinewtonPerSecond); - - /// - /// Get ForceChangeRate in KilonewtonsPerMinute. - /// - public double KilonewtonsPerMinute => As(ForceChangeRateUnit.KilonewtonPerMinute); - - /// - /// Get ForceChangeRate in KilonewtonsPerSecond. - /// - public double KilonewtonsPerSecond => As(ForceChangeRateUnit.KilonewtonPerSecond); - - /// - /// Get ForceChangeRate in MicronewtonsPerSecond. - /// - public double MicronewtonsPerSecond => As(ForceChangeRateUnit.MicronewtonPerSecond); - - /// - /// Get ForceChangeRate in MillinewtonsPerSecond. - /// - public double MillinewtonsPerSecond => As(ForceChangeRateUnit.MillinewtonPerSecond); - - /// - /// Get ForceChangeRate in NanonewtonsPerSecond. - /// - public double NanonewtonsPerSecond => As(ForceChangeRateUnit.NanonewtonPerSecond); - - /// - /// Get ForceChangeRate in NewtonsPerMinute. - /// - public double NewtonsPerMinute => As(ForceChangeRateUnit.NewtonPerMinute); - - /// - /// Get ForceChangeRate in NewtonsPerSecond. - /// - public double NewtonsPerSecond => As(ForceChangeRateUnit.NewtonPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerSecond. - /// - public static ForceChangeRate Zero => new ForceChangeRate(0, BaseUnit); - - /// - /// Get ForceChangeRate from CentinewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromCentinewtonsPerSecond(double centinewtonspersecond) -#else - public static ForceChangeRate FromCentinewtonsPerSecond(QuantityValue centinewtonspersecond) -#endif - { - double value = (double) centinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.CentinewtonPerSecond); - } - - /// - /// Get ForceChangeRate from DecanewtonsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromDecanewtonsPerMinute(double decanewtonsperminute) -#else - public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtonsperminute) -#endif - { - double value = (double) decanewtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerMinute); - } - - /// - /// Get ForceChangeRate from DecanewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromDecanewtonsPerSecond(double decanewtonspersecond) -#else - public static ForceChangeRate FromDecanewtonsPerSecond(QuantityValue decanewtonspersecond) -#endif - { - double value = (double) decanewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerSecond); - } - - /// - /// Get ForceChangeRate from DecinewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromDecinewtonsPerSecond(double decinewtonspersecond) -#else - public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtonspersecond) -#endif - { - double value = (double) decinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.DecinewtonPerSecond); - } - - /// - /// Get ForceChangeRate from KilonewtonsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromKilonewtonsPerMinute(double kilonewtonsperminute) -#else - public static ForceChangeRate FromKilonewtonsPerMinute(QuantityValue kilonewtonsperminute) -#endif - { - double value = (double) kilonewtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerMinute); - } - - /// - /// Get ForceChangeRate from KilonewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromKilonewtonsPerSecond(double kilonewtonspersecond) -#else - public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtonspersecond) -#endif - { - double value = (double) kilonewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerSecond); - } - - /// - /// Get ForceChangeRate from MicronewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromMicronewtonsPerSecond(double micronewtonspersecond) -#else - public static ForceChangeRate FromMicronewtonsPerSecond(QuantityValue micronewtonspersecond) -#endif - { - double value = (double) micronewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.MicronewtonPerSecond); - } - - /// - /// Get ForceChangeRate from MillinewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromMillinewtonsPerSecond(double millinewtonspersecond) -#else - public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewtonspersecond) -#endif - { - double value = (double) millinewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.MillinewtonPerSecond); - } - - /// - /// Get ForceChangeRate from NanonewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromNanonewtonsPerSecond(double nanonewtonspersecond) -#else - public static ForceChangeRate FromNanonewtonsPerSecond(QuantityValue nanonewtonspersecond) -#endif - { - double value = (double) nanonewtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.NanonewtonPerSecond); - } - - /// - /// Get ForceChangeRate from NewtonsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromNewtonsPerMinute(double newtonsperminute) -#else - public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminute) -#endif - { - double value = (double) newtonsperminute; - return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerMinute); - } - - /// - /// Get ForceChangeRate from NewtonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForceChangeRate FromNewtonsPerSecond(double newtonspersecond) -#else - public static ForceChangeRate FromNewtonsPerSecond(QuantityValue newtonspersecond) -#endif - { - double value = (double) newtonspersecond; - return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ForceChangeRate unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ForceChangeRate From(double value, ForceChangeRateUnit fromUnit) -#else - public static ForceChangeRate From(QuantityValue value, ForceChangeRateUnit fromUnit) -#endif - { - return new ForceChangeRate((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForceChangeRateUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); - - return CompareTo((ForceChangeRate)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ForceChangeRate other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ForceChangeRate within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ForceChangeRate. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ForceChangeRateUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ForceChangeRate to another ForceChangeRate with the unit representation . - /// - /// A ForceChangeRate with the specified unit. - public ForceChangeRate ToUnit(ForceChangeRateUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ForceChangeRate(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ForceChangeRateUnit.CentinewtonPerSecond: return (_value) * 1e-2d; - case ForceChangeRateUnit.DecanewtonPerMinute: return (_value/60) * 1e1d; - case ForceChangeRateUnit.DecanewtonPerSecond: return (_value) * 1e1d; - case ForceChangeRateUnit.DecinewtonPerSecond: return (_value) * 1e-1d; - case ForceChangeRateUnit.KilonewtonPerMinute: return (_value/60) * 1e3d; - case ForceChangeRateUnit.KilonewtonPerSecond: return (_value) * 1e3d; - case ForceChangeRateUnit.MicronewtonPerSecond: return (_value) * 1e-6d; - case ForceChangeRateUnit.MillinewtonPerSecond: return (_value) * 1e-3d; - case ForceChangeRateUnit.NanonewtonPerSecond: return (_value) * 1e-9d; - case ForceChangeRateUnit.NewtonPerMinute: return _value/60; - case ForceChangeRateUnit.NewtonPerSecond: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ForceChangeRateUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ForceChangeRateUnit.CentinewtonPerSecond: return (baseUnitValue) / 1e-2d; - case ForceChangeRateUnit.DecanewtonPerMinute: return (baseUnitValue*60) / 1e1d; - case ForceChangeRateUnit.DecanewtonPerSecond: return (baseUnitValue) / 1e1d; - case ForceChangeRateUnit.DecinewtonPerSecond: return (baseUnitValue) / 1e-1d; - case ForceChangeRateUnit.KilonewtonPerMinute: return (baseUnitValue*60) / 1e3d; - case ForceChangeRateUnit.KilonewtonPerSecond: return (baseUnitValue) / 1e3d; - case ForceChangeRateUnit.MicronewtonPerSecond: return (baseUnitValue) / 1e-6d; - case ForceChangeRateUnit.MillinewtonPerSecond: return (baseUnitValue) / 1e-3d; - case ForceChangeRateUnit.NanonewtonPerSecond: return (baseUnitValue) / 1e-9d; - case ForceChangeRateUnit.NewtonPerMinute: return baseUnitValue*60; - case ForceChangeRateUnit.NewtonPerSecond: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ForceChangeRate Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForceChangeRateUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ForceChangeRateUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ForceChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) - { - result = default(ForceChangeRate); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ForceChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ForceChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForceChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForceChangeRateUnit unit) - { - unit = ForceChangeRateUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ForceChangeRateUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ForceChangeRateUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ForceChangeRate - /// - public static ForceChangeRate MaxValue => new ForceChangeRate(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ForceChangeRate - /// - public static ForceChangeRate MinValue => new ForceChangeRate(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ForceChangeRate.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ForceChangeRate.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs b/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs deleted file mode 100644 index a4099b4aa0..0000000000 --- a/Common/GeneratedCode/Quantities/ForcePerLength.Common.g.cs +++ /dev/null @@ -1,713 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The magnitude of force per unit length. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ForcePerLength : IQuantity -#else - public partial struct ForcePerLength : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ForcePerLengthUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ForcePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ForcePerLength() - { - BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ForcePerLength(double numericValue, ForcePerLengthUnit unit) - { - if(unit == ForcePerLengthUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ForcePerLength; - - /// - /// The base unit of ForcePerLength, which is NewtonPerMeter. All conversions go via this value. - /// - public static ForcePerLengthUnit BaseUnit => ForcePerLengthUnit.NewtonPerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ForcePerLength quantity. - /// - public static ForcePerLengthUnit[] Units { get; } = Enum.GetValues(typeof(ForcePerLengthUnit)).Cast().Except(new ForcePerLengthUnit[]{ ForcePerLengthUnit.Undefined }).ToArray(); - - /// - /// Get ForcePerLength in CentinewtonsPerMeter. - /// - public double CentinewtonsPerMeter => As(ForcePerLengthUnit.CentinewtonPerMeter); - - /// - /// Get ForcePerLength in DecinewtonsPerMeter. - /// - public double DecinewtonsPerMeter => As(ForcePerLengthUnit.DecinewtonPerMeter); - - /// - /// Get ForcePerLength in KilogramsForcePerMeter. - /// - public double KilogramsForcePerMeter => As(ForcePerLengthUnit.KilogramForcePerMeter); - - /// - /// Get ForcePerLength in KilonewtonsPerMeter. - /// - public double KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); - - /// - /// Get ForcePerLength in MeganewtonsPerMeter. - /// - public double MeganewtonsPerMeter => As(ForcePerLengthUnit.MeganewtonPerMeter); - - /// - /// Get ForcePerLength in MicronewtonsPerMeter. - /// - public double MicronewtonsPerMeter => As(ForcePerLengthUnit.MicronewtonPerMeter); - - /// - /// Get ForcePerLength in MillinewtonsPerMeter. - /// - public double MillinewtonsPerMeter => As(ForcePerLengthUnit.MillinewtonPerMeter); - - /// - /// Get ForcePerLength in NanonewtonsPerMeter. - /// - public double NanonewtonsPerMeter => As(ForcePerLengthUnit.NanonewtonPerMeter); - - /// - /// Get ForcePerLength in NewtonsPerMeter. - /// - public double NewtonsPerMeter => As(ForcePerLengthUnit.NewtonPerMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerMeter. - /// - public static ForcePerLength Zero => new ForcePerLength(0, BaseUnit); - - /// - /// Get ForcePerLength from CentinewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromCentinewtonsPerMeter(double centinewtonspermeter) -#else - public static ForcePerLength FromCentinewtonsPerMeter(QuantityValue centinewtonspermeter) -#endif - { - double value = (double) centinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.CentinewtonPerMeter); - } - - /// - /// Get ForcePerLength from DecinewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromDecinewtonsPerMeter(double decinewtonspermeter) -#else - public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspermeter) -#endif - { - double value = (double) decinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.DecinewtonPerMeter); - } - - /// - /// Get ForcePerLength from KilogramsForcePerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromKilogramsForcePerMeter(double kilogramsforcepermeter) -#else - public static ForcePerLength FromKilogramsForcePerMeter(QuantityValue kilogramsforcepermeter) -#endif - { - double value = (double) kilogramsforcepermeter; - return new ForcePerLength(value, ForcePerLengthUnit.KilogramForcePerMeter); - } - - /// - /// Get ForcePerLength from KilonewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromKilonewtonsPerMeter(double kilonewtonspermeter) -#else - public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspermeter) -#endif - { - double value = (double) kilonewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); - } - - /// - /// Get ForcePerLength from MeganewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromMeganewtonsPerMeter(double meganewtonspermeter) -#else - public static ForcePerLength FromMeganewtonsPerMeter(QuantityValue meganewtonspermeter) -#endif - { - double value = (double) meganewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MeganewtonPerMeter); - } - - /// - /// Get ForcePerLength from MicronewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromMicronewtonsPerMeter(double micronewtonspermeter) -#else - public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtonspermeter) -#endif - { - double value = (double) micronewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MicronewtonPerMeter); - } - - /// - /// Get ForcePerLength from MillinewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromMillinewtonsPerMeter(double millinewtonspermeter) -#else - public static ForcePerLength FromMillinewtonsPerMeter(QuantityValue millinewtonspermeter) -#endif - { - double value = (double) millinewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.MillinewtonPerMeter); - } - - /// - /// Get ForcePerLength from NanonewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromNanonewtonsPerMeter(double nanonewtonspermeter) -#else - public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspermeter) -#endif - { - double value = (double) nanonewtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.NanonewtonPerMeter); - } - - /// - /// Get ForcePerLength from NewtonsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ForcePerLength FromNewtonsPerMeter(double newtonspermeter) -#else - public static ForcePerLength FromNewtonsPerMeter(QuantityValue newtonspermeter) -#endif - { - double value = (double) newtonspermeter; - return new ForcePerLength(value, ForcePerLengthUnit.NewtonPerMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ForcePerLength unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ForcePerLength From(double value, ForcePerLengthUnit fromUnit) -#else - public static ForcePerLength From(QuantityValue value, ForcePerLengthUnit fromUnit) -#endif - { - return new ForcePerLength((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ForcePerLengthUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); - - return CompareTo((ForcePerLength)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ForcePerLength other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ForcePerLength within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ForcePerLength. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ForcePerLengthUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ForcePerLength to another ForcePerLength with the unit representation . - /// - /// A ForcePerLength with the specified unit. - public ForcePerLength ToUnit(ForcePerLengthUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ForcePerLength(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ForcePerLengthUnit.CentinewtonPerMeter: return (_value) * 1e-2d; - case ForcePerLengthUnit.DecinewtonPerMeter: return (_value) * 1e-1d; - case ForcePerLengthUnit.KilogramForcePerMeter: return _value*9.80665002864; - case ForcePerLengthUnit.KilonewtonPerMeter: return (_value) * 1e3d; - case ForcePerLengthUnit.MeganewtonPerMeter: return (_value) * 1e6d; - case ForcePerLengthUnit.MicronewtonPerMeter: return (_value) * 1e-6d; - case ForcePerLengthUnit.MillinewtonPerMeter: return (_value) * 1e-3d; - case ForcePerLengthUnit.NanonewtonPerMeter: return (_value) * 1e-9d; - case ForcePerLengthUnit.NewtonPerMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ForcePerLengthUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ForcePerLengthUnit.CentinewtonPerMeter: return (baseUnitValue) / 1e-2d; - case ForcePerLengthUnit.DecinewtonPerMeter: return (baseUnitValue) / 1e-1d; - case ForcePerLengthUnit.KilogramForcePerMeter: return baseUnitValue/9.80665002864; - case ForcePerLengthUnit.KilonewtonPerMeter: return (baseUnitValue) / 1e3d; - case ForcePerLengthUnit.MeganewtonPerMeter: return (baseUnitValue) / 1e6d; - case ForcePerLengthUnit.MicronewtonPerMeter: return (baseUnitValue) / 1e-6d; - case ForcePerLengthUnit.MillinewtonPerMeter: return (baseUnitValue) / 1e-3d; - case ForcePerLengthUnit.NanonewtonPerMeter: return (baseUnitValue) / 1e-9d; - case ForcePerLengthUnit.NewtonPerMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ForcePerLength Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ForcePerLength result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ForcePerLengthUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ForcePerLengthUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ForcePerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) - { - result = default(ForcePerLength); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ForcePerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ForcePerLengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ForcePerLengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ForcePerLengthUnit unit) - { - unit = ForcePerLengthUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ForcePerLengthUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ForcePerLengthUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ForcePerLength - /// - public static ForcePerLength MaxValue => new ForcePerLength(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ForcePerLength - /// - public static ForcePerLength MinValue => new ForcePerLength(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ForcePerLength.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ForcePerLength.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs b/Common/GeneratedCode/Quantities/Frequency.Common.g.cs deleted file mode 100644 index b9f4b25715..0000000000 --- a/Common/GeneratedCode/Quantities/Frequency.Common.g.cs +++ /dev/null @@ -1,691 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The number of occurrences of a repeating event per unit time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Frequency : IQuantity -#else - public partial struct Frequency : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly FrequencyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public FrequencyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Frequency() - { - BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Frequency(double numericValue, FrequencyUnit unit) - { - if(unit == FrequencyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Frequency; - - /// - /// The base unit of Frequency, which is Hertz. All conversions go via this value. - /// - public static FrequencyUnit BaseUnit => FrequencyUnit.Hertz; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Frequency quantity. - /// - public static FrequencyUnit[] Units { get; } = Enum.GetValues(typeof(FrequencyUnit)).Cast().Except(new FrequencyUnit[]{ FrequencyUnit.Undefined }).ToArray(); - - /// - /// Get Frequency in CyclesPerHour. - /// - public double CyclesPerHour => As(FrequencyUnit.CyclePerHour); - - /// - /// Get Frequency in CyclesPerMinute. - /// - public double CyclesPerMinute => As(FrequencyUnit.CyclePerMinute); - - /// - /// Get Frequency in Gigahertz. - /// - public double Gigahertz => As(FrequencyUnit.Gigahertz); - - /// - /// Get Frequency in Hertz. - /// - public double Hertz => As(FrequencyUnit.Hertz); - - /// - /// Get Frequency in Kilohertz. - /// - public double Kilohertz => As(FrequencyUnit.Kilohertz); - - /// - /// Get Frequency in Megahertz. - /// - public double Megahertz => As(FrequencyUnit.Megahertz); - - /// - /// Get Frequency in RadiansPerSecond. - /// - public double RadiansPerSecond => As(FrequencyUnit.RadianPerSecond); - - /// - /// Get Frequency in Terahertz. - /// - public double Terahertz => As(FrequencyUnit.Terahertz); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Hertz. - /// - public static Frequency Zero => new Frequency(0, BaseUnit); - - /// - /// Get Frequency from CyclesPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromCyclesPerHour(double cyclesperhour) -#else - public static Frequency FromCyclesPerHour(QuantityValue cyclesperhour) -#endif - { - double value = (double) cyclesperhour; - return new Frequency(value, FrequencyUnit.CyclePerHour); - } - - /// - /// Get Frequency from CyclesPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromCyclesPerMinute(double cyclesperminute) -#else - public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) -#endif - { - double value = (double) cyclesperminute; - return new Frequency(value, FrequencyUnit.CyclePerMinute); - } - - /// - /// Get Frequency from Gigahertz. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromGigahertz(double gigahertz) -#else - public static Frequency FromGigahertz(QuantityValue gigahertz) -#endif - { - double value = (double) gigahertz; - return new Frequency(value, FrequencyUnit.Gigahertz); - } - - /// - /// Get Frequency from Hertz. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromHertz(double hertz) -#else - public static Frequency FromHertz(QuantityValue hertz) -#endif - { - double value = (double) hertz; - return new Frequency(value, FrequencyUnit.Hertz); - } - - /// - /// Get Frequency from Kilohertz. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromKilohertz(double kilohertz) -#else - public static Frequency FromKilohertz(QuantityValue kilohertz) -#endif - { - double value = (double) kilohertz; - return new Frequency(value, FrequencyUnit.Kilohertz); - } - - /// - /// Get Frequency from Megahertz. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromMegahertz(double megahertz) -#else - public static Frequency FromMegahertz(QuantityValue megahertz) -#endif - { - double value = (double) megahertz; - return new Frequency(value, FrequencyUnit.Megahertz); - } - - /// - /// Get Frequency from RadiansPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromRadiansPerSecond(double radianspersecond) -#else - public static Frequency FromRadiansPerSecond(QuantityValue radianspersecond) -#endif - { - double value = (double) radianspersecond; - return new Frequency(value, FrequencyUnit.RadianPerSecond); - } - - /// - /// Get Frequency from Terahertz. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Frequency FromTerahertz(double terahertz) -#else - public static Frequency FromTerahertz(QuantityValue terahertz) -#endif - { - double value = (double) terahertz; - return new Frequency(value, FrequencyUnit.Terahertz); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Frequency unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Frequency From(double value, FrequencyUnit fromUnit) -#else - public static Frequency From(QuantityValue value, FrequencyUnit fromUnit) -#endif - { - return new Frequency((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(FrequencyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Frequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); - - return CompareTo((Frequency)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Frequency other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Frequency within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Frequency. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(FrequencyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Frequency to another Frequency with the unit representation . - /// - /// A Frequency with the specified unit. - public Frequency ToUnit(FrequencyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Frequency(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case FrequencyUnit.CyclePerHour: return _value/3600; - case FrequencyUnit.CyclePerMinute: return _value/60; - case FrequencyUnit.Gigahertz: return (_value) * 1e9d; - case FrequencyUnit.Hertz: return _value; - case FrequencyUnit.Kilohertz: return (_value) * 1e3d; - case FrequencyUnit.Megahertz: return (_value) * 1e6d; - case FrequencyUnit.RadianPerSecond: return _value/6.2831853072; - case FrequencyUnit.Terahertz: return (_value) * 1e12d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(FrequencyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case FrequencyUnit.CyclePerHour: return baseUnitValue*3600; - case FrequencyUnit.CyclePerMinute: return baseUnitValue*60; - case FrequencyUnit.Gigahertz: return (baseUnitValue) / 1e9d; - case FrequencyUnit.Hertz: return baseUnitValue; - case FrequencyUnit.Kilohertz: return (baseUnitValue) / 1e3d; - case FrequencyUnit.Megahertz: return (baseUnitValue) / 1e6d; - case FrequencyUnit.RadianPerSecond: return baseUnitValue*6.2831853072; - case FrequencyUnit.Terahertz: return (baseUnitValue) / 1e12d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Frequency Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Frequency result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static FrequencyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out FrequencyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Frequency ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) - { - result = default(Frequency); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static FrequencyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == FrequencyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized FrequencyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out FrequencyUnit unit) - { - unit = FrequencyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == FrequencyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(FrequencyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Frequency - /// - public static Frequency MaxValue => new Frequency(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Frequency - /// - public static Frequency MinValue => new Frequency(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Frequency.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Frequency.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs b/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs deleted file mode 100644 index 4c5dc74008..0000000000 --- a/Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs +++ /dev/null @@ -1,867 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Heat flux is the flow of energy per unit of area per unit of time - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class HeatFlux : IQuantity -#else - public partial struct HeatFlux : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly HeatFluxUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public HeatFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static HeatFlux() - { - BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - HeatFlux(double numericValue, HeatFluxUnit unit) - { - if(unit == HeatFluxUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.HeatFlux; - - /// - /// The base unit of HeatFlux, which is WattPerSquareMeter. All conversions go via this value. - /// - public static HeatFluxUnit BaseUnit => HeatFluxUnit.WattPerSquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the HeatFlux quantity. - /// - public static HeatFluxUnit[] Units { get; } = Enum.GetValues(typeof(HeatFluxUnit)).Cast().Except(new HeatFluxUnit[]{ HeatFluxUnit.Undefined }).ToArray(); - - /// - /// Get HeatFlux in BtusPerHourSquareFoot. - /// - public double BtusPerHourSquareFoot => As(HeatFluxUnit.BtuPerHourSquareFoot); - - /// - /// Get HeatFlux in BtusPerMinuteSquareFoot. - /// - public double BtusPerMinuteSquareFoot => As(HeatFluxUnit.BtuPerMinuteSquareFoot); - - /// - /// Get HeatFlux in BtusPerSecondSquareFoot. - /// - public double BtusPerSecondSquareFoot => As(HeatFluxUnit.BtuPerSecondSquareFoot); - - /// - /// Get HeatFlux in BtusPerSecondSquareInch. - /// - public double BtusPerSecondSquareInch => As(HeatFluxUnit.BtuPerSecondSquareInch); - - /// - /// Get HeatFlux in CaloriesPerSecondSquareCentimeter. - /// - public double CaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.CaloriePerSecondSquareCentimeter); - - /// - /// Get HeatFlux in CentiwattsPerSquareMeter. - /// - public double CentiwattsPerSquareMeter => As(HeatFluxUnit.CentiwattPerSquareMeter); - - /// - /// Get HeatFlux in DeciwattsPerSquareMeter. - /// - public double DeciwattsPerSquareMeter => As(HeatFluxUnit.DeciwattPerSquareMeter); - - /// - /// Get HeatFlux in KilocaloriesPerHourSquareMeter. - /// - public double KilocaloriesPerHourSquareMeter => As(HeatFluxUnit.KilocaloriePerHourSquareMeter); - - /// - /// Get HeatFlux in KilocaloriesPerSecondSquareCentimeter. - /// - public double KilocaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); - - /// - /// Get HeatFlux in KilowattsPerSquareMeter. - /// - public double KilowattsPerSquareMeter => As(HeatFluxUnit.KilowattPerSquareMeter); - - /// - /// Get HeatFlux in MicrowattsPerSquareMeter. - /// - public double MicrowattsPerSquareMeter => As(HeatFluxUnit.MicrowattPerSquareMeter); - - /// - /// Get HeatFlux in MilliwattsPerSquareMeter. - /// - public double MilliwattsPerSquareMeter => As(HeatFluxUnit.MilliwattPerSquareMeter); - - /// - /// Get HeatFlux in NanowattsPerSquareMeter. - /// - public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); - - /// - /// Get HeatFlux in WattsPerSquareFoot. - /// - public double WattsPerSquareFoot => As(HeatFluxUnit.WattPerSquareFoot); - - /// - /// Get HeatFlux in WattsPerSquareInch. - /// - public double WattsPerSquareInch => As(HeatFluxUnit.WattPerSquareInch); - - /// - /// Get HeatFlux in WattsPerSquareMeter. - /// - public double WattsPerSquareMeter => As(HeatFluxUnit.WattPerSquareMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. - /// - public static HeatFlux Zero => new HeatFlux(0, BaseUnit); - - /// - /// Get HeatFlux from BtusPerHourSquareFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromBtusPerHourSquareFoot(double btusperhoursquarefoot) -#else - public static HeatFlux FromBtusPerHourSquareFoot(QuantityValue btusperhoursquarefoot) -#endif - { - double value = (double) btusperhoursquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerHourSquareFoot); - } - - /// - /// Get HeatFlux from BtusPerMinuteSquareFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromBtusPerMinuteSquareFoot(double btusperminutesquarefoot) -#else - public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesquarefoot) -#endif - { - double value = (double) btusperminutesquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerMinuteSquareFoot); - } - - /// - /// Get HeatFlux from BtusPerSecondSquareFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromBtusPerSecondSquareFoot(double btuspersecondsquarefoot) -#else - public static HeatFlux FromBtusPerSecondSquareFoot(QuantityValue btuspersecondsquarefoot) -#endif - { - double value = (double) btuspersecondsquarefoot; - return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareFoot); - } - - /// - /// Get HeatFlux from BtusPerSecondSquareInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromBtusPerSecondSquareInch(double btuspersecondsquareinch) -#else - public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsquareinch) -#endif - { - double value = (double) btuspersecondsquareinch; - return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareInch); - } - - /// - /// Get HeatFlux from CaloriesPerSecondSquareCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromCaloriesPerSecondSquareCentimeter(double caloriespersecondsquarecentimeter) -#else - public static HeatFlux FromCaloriesPerSecondSquareCentimeter(QuantityValue caloriespersecondsquarecentimeter) -#endif - { - double value = (double) caloriespersecondsquarecentimeter; - return new HeatFlux(value, HeatFluxUnit.CaloriePerSecondSquareCentimeter); - } - - /// - /// Get HeatFlux from CentiwattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromCentiwattsPerSquareMeter(double centiwattspersquaremeter) -#else - public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspersquaremeter) -#endif - { - double value = (double) centiwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.CentiwattPerSquareMeter); - } - - /// - /// Get HeatFlux from DeciwattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromDeciwattsPerSquareMeter(double deciwattspersquaremeter) -#else - public static HeatFlux FromDeciwattsPerSquareMeter(QuantityValue deciwattspersquaremeter) -#endif - { - double value = (double) deciwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.DeciwattPerSquareMeter); - } - - /// - /// Get HeatFlux from KilocaloriesPerHourSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromKilocaloriesPerHourSquareMeter(double kilocaloriesperhoursquaremeter) -#else - public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocaloriesperhoursquaremeter) -#endif - { - double value = (double) kilocaloriesperhoursquaremeter; - return new HeatFlux(value, HeatFluxUnit.KilocaloriePerHourSquareMeter); - } - - /// - /// Get HeatFlux from KilocaloriesPerSecondSquareCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(double kilocaloriespersecondsquarecentimeter) -#else - public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(QuantityValue kilocaloriespersecondsquarecentimeter) -#endif - { - double value = (double) kilocaloriespersecondsquarecentimeter; - return new HeatFlux(value, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); - } - - /// - /// Get HeatFlux from KilowattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromKilowattsPerSquareMeter(double kilowattspersquaremeter) -#else - public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) -#endif - { - double value = (double) kilowattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.KilowattPerSquareMeter); - } - - /// - /// Get HeatFlux from MicrowattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromMicrowattsPerSquareMeter(double microwattspersquaremeter) -#else - public static HeatFlux FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) -#endif - { - double value = (double) microwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.MicrowattPerSquareMeter); - } - - /// - /// Get HeatFlux from MilliwattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromMilliwattsPerSquareMeter(double milliwattspersquaremeter) -#else - public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) -#endif - { - double value = (double) milliwattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.MilliwattPerSquareMeter); - } - - /// - /// Get HeatFlux from NanowattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromNanowattsPerSquareMeter(double nanowattspersquaremeter) -#else - public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) -#endif - { - double value = (double) nanowattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); - } - - /// - /// Get HeatFlux from WattsPerSquareFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromWattsPerSquareFoot(double wattspersquarefoot) -#else - public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) -#endif - { - double value = (double) wattspersquarefoot; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareFoot); - } - - /// - /// Get HeatFlux from WattsPerSquareInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromWattsPerSquareInch(double wattspersquareinch) -#else - public static HeatFlux FromWattsPerSquareInch(QuantityValue wattspersquareinch) -#endif - { - double value = (double) wattspersquareinch; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareInch); - } - - /// - /// Get HeatFlux from WattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatFlux FromWattsPerSquareMeter(double wattspersquaremeter) -#else - public static HeatFlux FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) -#endif - { - double value = (double) wattspersquaremeter; - return new HeatFlux(value, HeatFluxUnit.WattPerSquareMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// HeatFlux unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static HeatFlux From(double value, HeatFluxUnit fromUnit) -#else - public static HeatFlux From(QuantityValue value, HeatFluxUnit fromUnit) -#endif - { - return new HeatFlux((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(HeatFluxUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); - - return CompareTo((HeatFlux)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(HeatFlux other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another HeatFlux within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current HeatFlux. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(HeatFluxUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this HeatFlux to another HeatFlux with the unit representation . - /// - /// A HeatFlux with the specified unit. - public HeatFlux ToUnit(HeatFluxUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new HeatFlux(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case HeatFluxUnit.BtuPerHourSquareFoot: return _value*3.15459075; - case HeatFluxUnit.BtuPerMinuteSquareFoot: return _value*1.89275445e2; - case HeatFluxUnit.BtuPerSecondSquareFoot: return _value*1.13565267e4; - case HeatFluxUnit.BtuPerSecondSquareInch: return _value*1.63533984e6; - case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return _value*4.1868e4; - case HeatFluxUnit.CentiwattPerSquareMeter: return (_value) * 1e-2d; - case HeatFluxUnit.DeciwattPerSquareMeter: return (_value) * 1e-1d; - case HeatFluxUnit.KilocaloriePerHourSquareMeter: return _value*1.163; - case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (_value*4.1868e4) * 1e3d; - case HeatFluxUnit.KilowattPerSquareMeter: return (_value) * 1e3d; - case HeatFluxUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d; - case HeatFluxUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d; - case HeatFluxUnit.NanowattPerSquareMeter: return (_value) * 1e-9d; - case HeatFluxUnit.WattPerSquareFoot: return _value*1.07639e1; - case HeatFluxUnit.WattPerSquareInch: return _value*1.5500031e3; - case HeatFluxUnit.WattPerSquareMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(HeatFluxUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case HeatFluxUnit.BtuPerHourSquareFoot: return baseUnitValue/3.15459075; - case HeatFluxUnit.BtuPerMinuteSquareFoot: return baseUnitValue/1.89275445e2; - case HeatFluxUnit.BtuPerSecondSquareFoot: return baseUnitValue/1.13565267e4; - case HeatFluxUnit.BtuPerSecondSquareInch: return baseUnitValue/1.63533984e6; - case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return baseUnitValue/4.1868e4; - case HeatFluxUnit.CentiwattPerSquareMeter: return (baseUnitValue) / 1e-2d; - case HeatFluxUnit.DeciwattPerSquareMeter: return (baseUnitValue) / 1e-1d; - case HeatFluxUnit.KilocaloriePerHourSquareMeter: return baseUnitValue/1.163; - case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (baseUnitValue/4.1868e4) / 1e3d; - case HeatFluxUnit.KilowattPerSquareMeter: return (baseUnitValue) / 1e3d; - case HeatFluxUnit.MicrowattPerSquareMeter: return (baseUnitValue) / 1e-6d; - case HeatFluxUnit.MilliwattPerSquareMeter: return (baseUnitValue) / 1e-3d; - case HeatFluxUnit.NanowattPerSquareMeter: return (baseUnitValue) / 1e-9d; - case HeatFluxUnit.WattPerSquareFoot: return baseUnitValue/1.07639e1; - case HeatFluxUnit.WattPerSquareInch: return baseUnitValue/1.5500031e3; - case HeatFluxUnit.WattPerSquareMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static HeatFlux Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out HeatFlux result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatFluxUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out HeatFluxUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static HeatFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) - { - result = default(HeatFlux); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static HeatFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == HeatFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatFluxUnit unit) - { - unit = HeatFluxUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == HeatFluxUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(HeatFluxUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of HeatFlux - /// - public static HeatFlux MaxValue => new HeatFlux(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of HeatFlux - /// - public static HeatFlux MinValue => new HeatFlux(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => HeatFlux.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => HeatFlux.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs b/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs deleted file mode 100644 index c3e53a657e..0000000000 --- a/Common/GeneratedCode/Quantities/HeatTransferCoefficient.Common.g.cs +++ /dev/null @@ -1,559 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class HeatTransferCoefficient : IQuantity -#else - public partial struct HeatTransferCoefficient : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly HeatTransferCoefficientUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public HeatTransferCoefficientUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static HeatTransferCoefficient() - { - BaseDimensions = new BaseDimensions(0, 1, -3, 0, -1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - HeatTransferCoefficient(double numericValue, HeatTransferCoefficientUnit unit) - { - if(unit == HeatTransferCoefficientUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.HeatTransferCoefficient; - - /// - /// The base unit of HeatTransferCoefficient, which is WattPerSquareMeterKelvin. All conversions go via this value. - /// - public static HeatTransferCoefficientUnit BaseUnit => HeatTransferCoefficientUnit.WattPerSquareMeterKelvin; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the HeatTransferCoefficient quantity. - /// - public static HeatTransferCoefficientUnit[] Units { get; } = Enum.GetValues(typeof(HeatTransferCoefficientUnit)).Cast().Except(new HeatTransferCoefficientUnit[]{ HeatTransferCoefficientUnit.Undefined }).ToArray(); - - /// - /// Get HeatTransferCoefficient in WattsPerSquareMeterCelsius. - /// - public double WattsPerSquareMeterCelsius => As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); - - /// - /// Get HeatTransferCoefficient in WattsPerSquareMeterKelvin. - /// - public double WattsPerSquareMeterKelvin => As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. - /// - public static HeatTransferCoefficient Zero => new HeatTransferCoefficient(0, BaseUnit); - - /// - /// Get HeatTransferCoefficient from WattsPerSquareMeterCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(double wattspersquaremetercelsius) -#else - public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(QuantityValue wattspersquaremetercelsius) -#endif - { - double value = (double) wattspersquaremetercelsius; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); - } - - /// - /// Get HeatTransferCoefficient from WattsPerSquareMeterKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(double wattspersquaremeterkelvin) -#else - public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(QuantityValue wattspersquaremeterkelvin) -#endif - { - double value = (double) wattspersquaremeterkelvin; - return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// HeatTransferCoefficient unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static HeatTransferCoefficient From(double value, HeatTransferCoefficientUnit fromUnit) -#else - public static HeatTransferCoefficient From(QuantityValue value, HeatTransferCoefficientUnit fromUnit) -#endif - { - return new HeatTransferCoefficient((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(HeatTransferCoefficientUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); - - return CompareTo((HeatTransferCoefficient)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(HeatTransferCoefficient other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another HeatTransferCoefficient within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current HeatTransferCoefficient. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(HeatTransferCoefficientUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this HeatTransferCoefficient to another HeatTransferCoefficient with the unit representation . - /// - /// A HeatTransferCoefficient with the specified unit. - public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new HeatTransferCoefficient(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return _value; - case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(HeatTransferCoefficientUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return baseUnitValue; - case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static HeatTransferCoefficient Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static HeatTransferCoefficientUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out HeatTransferCoefficientUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static HeatTransferCoefficient ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) - { - result = default(HeatTransferCoefficient); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static HeatTransferCoefficientUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == HeatTransferCoefficientUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized HeatTransferCoefficientUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out HeatTransferCoefficientUnit unit) - { - unit = HeatTransferCoefficientUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == HeatTransferCoefficientUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(HeatTransferCoefficientUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of HeatTransferCoefficient - /// - public static HeatTransferCoefficient MaxValue => new HeatTransferCoefficient(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of HeatTransferCoefficient - /// - public static HeatTransferCoefficient MinValue => new HeatTransferCoefficient(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => HeatTransferCoefficient.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => HeatTransferCoefficient.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs b/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs deleted file mode 100644 index 461747c421..0000000000 --- a/Common/GeneratedCode/Quantities/Illuminance.Common.g.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, illuminance is the total luminous flux incident on a surface, per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Illuminance : IQuantity -#else - public partial struct Illuminance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly IlluminanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public IlluminanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Illuminance() - { - BaseDimensions = new BaseDimensions(-2, 0, 0, 0, 0, 0, 1); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Illuminance(double numericValue, IlluminanceUnit unit) - { - if(unit == IlluminanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Illuminance; - - /// - /// The base unit of Illuminance, which is Lux. All conversions go via this value. - /// - public static IlluminanceUnit BaseUnit => IlluminanceUnit.Lux; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Illuminance quantity. - /// - public static IlluminanceUnit[] Units { get; } = Enum.GetValues(typeof(IlluminanceUnit)).Cast().Except(new IlluminanceUnit[]{ IlluminanceUnit.Undefined }).ToArray(); - - /// - /// Get Illuminance in Kilolux. - /// - public double Kilolux => As(IlluminanceUnit.Kilolux); - - /// - /// Get Illuminance in Lux. - /// - public double Lux => As(IlluminanceUnit.Lux); - - /// - /// Get Illuminance in Megalux. - /// - public double Megalux => As(IlluminanceUnit.Megalux); - - /// - /// Get Illuminance in Millilux. - /// - public double Millilux => As(IlluminanceUnit.Millilux); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Lux. - /// - public static Illuminance Zero => new Illuminance(0, BaseUnit); - - /// - /// Get Illuminance from Kilolux. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Illuminance FromKilolux(double kilolux) -#else - public static Illuminance FromKilolux(QuantityValue kilolux) -#endif - { - double value = (double) kilolux; - return new Illuminance(value, IlluminanceUnit.Kilolux); - } - - /// - /// Get Illuminance from Lux. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Illuminance FromLux(double lux) -#else - public static Illuminance FromLux(QuantityValue lux) -#endif - { - double value = (double) lux; - return new Illuminance(value, IlluminanceUnit.Lux); - } - - /// - /// Get Illuminance from Megalux. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Illuminance FromMegalux(double megalux) -#else - public static Illuminance FromMegalux(QuantityValue megalux) -#endif - { - double value = (double) megalux; - return new Illuminance(value, IlluminanceUnit.Megalux); - } - - /// - /// Get Illuminance from Millilux. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Illuminance FromMillilux(double millilux) -#else - public static Illuminance FromMillilux(QuantityValue millilux) -#endif - { - double value = (double) millilux; - return new Illuminance(value, IlluminanceUnit.Millilux); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Illuminance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Illuminance From(double value, IlluminanceUnit fromUnit) -#else - public static Illuminance From(QuantityValue value, IlluminanceUnit fromUnit) -#endif - { - return new Illuminance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IlluminanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Illuminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); - - return CompareTo((Illuminance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Illuminance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Illuminance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Illuminance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(IlluminanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Illuminance to another Illuminance with the unit representation . - /// - /// A Illuminance with the specified unit. - public Illuminance ToUnit(IlluminanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Illuminance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case IlluminanceUnit.Kilolux: return (_value) * 1e3d; - case IlluminanceUnit.Lux: return _value; - case IlluminanceUnit.Megalux: return (_value) * 1e6d; - case IlluminanceUnit.Millilux: return (_value) * 1e-3d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(IlluminanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case IlluminanceUnit.Kilolux: return (baseUnitValue) / 1e3d; - case IlluminanceUnit.Lux: return baseUnitValue; - case IlluminanceUnit.Megalux: return (baseUnitValue) / 1e6d; - case IlluminanceUnit.Millilux: return (baseUnitValue) / 1e-3d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Illuminance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Illuminance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IlluminanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out IlluminanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Illuminance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) - { - result = default(Illuminance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static IlluminanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == IlluminanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IlluminanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out IlluminanceUnit unit) - { - unit = IlluminanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == IlluminanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(IlluminanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Illuminance - /// - public static Illuminance MaxValue => new Illuminance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Illuminance - /// - public static Illuminance MinValue => new Illuminance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Illuminance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Illuminance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Information.Common.g.cs b/Common/GeneratedCode/Quantities/Information.Common.g.cs deleted file mode 100644 index 4dc7772045..0000000000 --- a/Common/GeneratedCode/Quantities/Information.Common.g.cs +++ /dev/null @@ -1,1086 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Information : IQuantity -#else - public partial struct Information : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly decimal _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly InformationUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public InformationUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Information() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Information(decimal numericValue, InformationUnit unit) - { - if(unit == InformationUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = numericValue; - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Information; - - /// - /// The base unit of Information, which is Bit. All conversions go via this value. - /// - public static InformationUnit BaseUnit => InformationUnit.Bit; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Information quantity. - /// - public static InformationUnit[] Units { get; } = Enum.GetValues(typeof(InformationUnit)).Cast().Except(new InformationUnit[]{ InformationUnit.Undefined }).ToArray(); - - /// - /// Get Information in Bits. - /// - public double Bits => As(InformationUnit.Bit); - - /// - /// Get Information in Bytes. - /// - public double Bytes => As(InformationUnit.Byte); - - /// - /// Get Information in Exabits. - /// - public double Exabits => As(InformationUnit.Exabit); - - /// - /// Get Information in Exabytes. - /// - public double Exabytes => As(InformationUnit.Exabyte); - - /// - /// Get Information in Exbibits. - /// - public double Exbibits => As(InformationUnit.Exbibit); - - /// - /// Get Information in Exbibytes. - /// - public double Exbibytes => As(InformationUnit.Exbibyte); - - /// - /// Get Information in Gibibits. - /// - public double Gibibits => As(InformationUnit.Gibibit); - - /// - /// Get Information in Gibibytes. - /// - public double Gibibytes => As(InformationUnit.Gibibyte); - - /// - /// Get Information in Gigabits. - /// - public double Gigabits => As(InformationUnit.Gigabit); - - /// - /// Get Information in Gigabytes. - /// - public double Gigabytes => As(InformationUnit.Gigabyte); - - /// - /// Get Information in Kibibits. - /// - public double Kibibits => As(InformationUnit.Kibibit); - - /// - /// Get Information in Kibibytes. - /// - public double Kibibytes => As(InformationUnit.Kibibyte); - - /// - /// Get Information in Kilobits. - /// - public double Kilobits => As(InformationUnit.Kilobit); - - /// - /// Get Information in Kilobytes. - /// - public double Kilobytes => As(InformationUnit.Kilobyte); - - /// - /// Get Information in Mebibits. - /// - public double Mebibits => As(InformationUnit.Mebibit); - - /// - /// Get Information in Mebibytes. - /// - public double Mebibytes => As(InformationUnit.Mebibyte); - - /// - /// Get Information in Megabits. - /// - public double Megabits => As(InformationUnit.Megabit); - - /// - /// Get Information in Megabytes. - /// - public double Megabytes => As(InformationUnit.Megabyte); - - /// - /// Get Information in Pebibits. - /// - public double Pebibits => As(InformationUnit.Pebibit); - - /// - /// Get Information in Pebibytes. - /// - public double Pebibytes => As(InformationUnit.Pebibyte); - - /// - /// Get Information in Petabits. - /// - public double Petabits => As(InformationUnit.Petabit); - - /// - /// Get Information in Petabytes. - /// - public double Petabytes => As(InformationUnit.Petabyte); - - /// - /// Get Information in Tebibits. - /// - public double Tebibits => As(InformationUnit.Tebibit); - - /// - /// Get Information in Tebibytes. - /// - public double Tebibytes => As(InformationUnit.Tebibyte); - - /// - /// Get Information in Terabits. - /// - public double Terabits => As(InformationUnit.Terabit); - - /// - /// Get Information in Terabytes. - /// - public double Terabytes => As(InformationUnit.Terabyte); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Bit. - /// - public static Information Zero => new Information(0, BaseUnit); - - /// - /// Get Information from Bits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromBits(double bits) -#else - public static Information FromBits(QuantityValue bits) -#endif - { - decimal value = (decimal) bits; - return new Information(value, InformationUnit.Bit); - } - - /// - /// Get Information from Bytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromBytes(double bytes) -#else - public static Information FromBytes(QuantityValue bytes) -#endif - { - decimal value = (decimal) bytes; - return new Information(value, InformationUnit.Byte); - } - - /// - /// Get Information from Exabits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromExabits(double exabits) -#else - public static Information FromExabits(QuantityValue exabits) -#endif - { - decimal value = (decimal) exabits; - return new Information(value, InformationUnit.Exabit); - } - - /// - /// Get Information from Exabytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromExabytes(double exabytes) -#else - public static Information FromExabytes(QuantityValue exabytes) -#endif - { - decimal value = (decimal) exabytes; - return new Information(value, InformationUnit.Exabyte); - } - - /// - /// Get Information from Exbibits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromExbibits(double exbibits) -#else - public static Information FromExbibits(QuantityValue exbibits) -#endif - { - decimal value = (decimal) exbibits; - return new Information(value, InformationUnit.Exbibit); - } - - /// - /// Get Information from Exbibytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromExbibytes(double exbibytes) -#else - public static Information FromExbibytes(QuantityValue exbibytes) -#endif - { - decimal value = (decimal) exbibytes; - return new Information(value, InformationUnit.Exbibyte); - } - - /// - /// Get Information from Gibibits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromGibibits(double gibibits) -#else - public static Information FromGibibits(QuantityValue gibibits) -#endif - { - decimal value = (decimal) gibibits; - return new Information(value, InformationUnit.Gibibit); - } - - /// - /// Get Information from Gibibytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromGibibytes(double gibibytes) -#else - public static Information FromGibibytes(QuantityValue gibibytes) -#endif - { - decimal value = (decimal) gibibytes; - return new Information(value, InformationUnit.Gibibyte); - } - - /// - /// Get Information from Gigabits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromGigabits(double gigabits) -#else - public static Information FromGigabits(QuantityValue gigabits) -#endif - { - decimal value = (decimal) gigabits; - return new Information(value, InformationUnit.Gigabit); - } - - /// - /// Get Information from Gigabytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromGigabytes(double gigabytes) -#else - public static Information FromGigabytes(QuantityValue gigabytes) -#endif - { - decimal value = (decimal) gigabytes; - return new Information(value, InformationUnit.Gigabyte); - } - - /// - /// Get Information from Kibibits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromKibibits(double kibibits) -#else - public static Information FromKibibits(QuantityValue kibibits) -#endif - { - decimal value = (decimal) kibibits; - return new Information(value, InformationUnit.Kibibit); - } - - /// - /// Get Information from Kibibytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromKibibytes(double kibibytes) -#else - public static Information FromKibibytes(QuantityValue kibibytes) -#endif - { - decimal value = (decimal) kibibytes; - return new Information(value, InformationUnit.Kibibyte); - } - - /// - /// Get Information from Kilobits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromKilobits(double kilobits) -#else - public static Information FromKilobits(QuantityValue kilobits) -#endif - { - decimal value = (decimal) kilobits; - return new Information(value, InformationUnit.Kilobit); - } - - /// - /// Get Information from Kilobytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromKilobytes(double kilobytes) -#else - public static Information FromKilobytes(QuantityValue kilobytes) -#endif - { - decimal value = (decimal) kilobytes; - return new Information(value, InformationUnit.Kilobyte); - } - - /// - /// Get Information from Mebibits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromMebibits(double mebibits) -#else - public static Information FromMebibits(QuantityValue mebibits) -#endif - { - decimal value = (decimal) mebibits; - return new Information(value, InformationUnit.Mebibit); - } - - /// - /// Get Information from Mebibytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromMebibytes(double mebibytes) -#else - public static Information FromMebibytes(QuantityValue mebibytes) -#endif - { - decimal value = (decimal) mebibytes; - return new Information(value, InformationUnit.Mebibyte); - } - - /// - /// Get Information from Megabits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromMegabits(double megabits) -#else - public static Information FromMegabits(QuantityValue megabits) -#endif - { - decimal value = (decimal) megabits; - return new Information(value, InformationUnit.Megabit); - } - - /// - /// Get Information from Megabytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromMegabytes(double megabytes) -#else - public static Information FromMegabytes(QuantityValue megabytes) -#endif - { - decimal value = (decimal) megabytes; - return new Information(value, InformationUnit.Megabyte); - } - - /// - /// Get Information from Pebibits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromPebibits(double pebibits) -#else - public static Information FromPebibits(QuantityValue pebibits) -#endif - { - decimal value = (decimal) pebibits; - return new Information(value, InformationUnit.Pebibit); - } - - /// - /// Get Information from Pebibytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromPebibytes(double pebibytes) -#else - public static Information FromPebibytes(QuantityValue pebibytes) -#endif - { - decimal value = (decimal) pebibytes; - return new Information(value, InformationUnit.Pebibyte); - } - - /// - /// Get Information from Petabits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromPetabits(double petabits) -#else - public static Information FromPetabits(QuantityValue petabits) -#endif - { - decimal value = (decimal) petabits; - return new Information(value, InformationUnit.Petabit); - } - - /// - /// Get Information from Petabytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromPetabytes(double petabytes) -#else - public static Information FromPetabytes(QuantityValue petabytes) -#endif - { - decimal value = (decimal) petabytes; - return new Information(value, InformationUnit.Petabyte); - } - - /// - /// Get Information from Tebibits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromTebibits(double tebibits) -#else - public static Information FromTebibits(QuantityValue tebibits) -#endif - { - decimal value = (decimal) tebibits; - return new Information(value, InformationUnit.Tebibit); - } - - /// - /// Get Information from Tebibytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromTebibytes(double tebibytes) -#else - public static Information FromTebibytes(QuantityValue tebibytes) -#endif - { - decimal value = (decimal) tebibytes; - return new Information(value, InformationUnit.Tebibyte); - } - - /// - /// Get Information from Terabits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromTerabits(double terabits) -#else - public static Information FromTerabits(QuantityValue terabits) -#endif - { - decimal value = (decimal) terabits; - return new Information(value, InformationUnit.Terabit); - } - - /// - /// Get Information from Terabytes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Information FromTerabytes(double terabytes) -#else - public static Information FromTerabytes(QuantityValue terabytes) -#endif - { - decimal value = (decimal) terabytes; - return new Information(value, InformationUnit.Terabyte); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Information unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Information From(double value, InformationUnit fromUnit) -#else - public static Information From(QuantityValue value, InformationUnit fromUnit) -#endif - { - return new Information((decimal)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(InformationUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Information)) throw new ArgumentException("Expected type Information.", nameof(obj)); - - return CompareTo((Information)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Information other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Information within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Information other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Information. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(InformationUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Information to another Information with the unit representation . - /// - /// A Information with the specified unit. - public Information ToUnit(InformationUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Information(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private decimal AsBaseUnit() - { - switch(Unit) - { - case InformationUnit.Bit: return _value; - case InformationUnit.Byte: return _value*8m; - case InformationUnit.Exabit: return (_value) * 1e18m; - case InformationUnit.Exabyte: return (_value*8m) * 1e18m; - case InformationUnit.Exbibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Exbibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Gibibit: return (_value) * (1024m * 1024 * 1024); - case InformationUnit.Gibibyte: return (_value*8m) * (1024m * 1024 * 1024); - case InformationUnit.Gigabit: return (_value) * 1e9m; - case InformationUnit.Gigabyte: return (_value*8m) * 1e9m; - case InformationUnit.Kibibit: return (_value) * 1024m; - case InformationUnit.Kibibyte: return (_value*8m) * 1024m; - case InformationUnit.Kilobit: return (_value) * 1e3m; - case InformationUnit.Kilobyte: return (_value*8m) * 1e3m; - case InformationUnit.Mebibit: return (_value) * (1024m * 1024); - case InformationUnit.Mebibyte: return (_value*8m) * (1024m * 1024); - case InformationUnit.Megabit: return (_value) * 1e6m; - case InformationUnit.Megabyte: return (_value*8m) * 1e6m; - case InformationUnit.Pebibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Pebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Petabit: return (_value) * 1e15m; - case InformationUnit.Petabyte: return (_value*8m) * 1e15m; - case InformationUnit.Tebibit: return (_value) * (1024m * 1024 * 1024 * 1024); - case InformationUnit.Tebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024); - case InformationUnit.Terabit: return (_value) * 1e12m; - case InformationUnit.Terabyte: return (_value*8m) * 1e12m; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private decimal AsBaseNumericType(InformationUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case InformationUnit.Bit: return baseUnitValue; - case InformationUnit.Byte: return baseUnitValue/8m; - case InformationUnit.Exabit: return (baseUnitValue) / 1e18m; - case InformationUnit.Exabyte: return (baseUnitValue/8m) / 1e18m; - case InformationUnit.Exbibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Exbibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Gibibit: return (baseUnitValue) / (1024m * 1024 * 1024); - case InformationUnit.Gibibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024); - case InformationUnit.Gigabit: return (baseUnitValue) / 1e9m; - case InformationUnit.Gigabyte: return (baseUnitValue/8m) / 1e9m; - case InformationUnit.Kibibit: return (baseUnitValue) / 1024m; - case InformationUnit.Kibibyte: return (baseUnitValue/8m) / 1024m; - case InformationUnit.Kilobit: return (baseUnitValue) / 1e3m; - case InformationUnit.Kilobyte: return (baseUnitValue/8m) / 1e3m; - case InformationUnit.Mebibit: return (baseUnitValue) / (1024m * 1024); - case InformationUnit.Mebibyte: return (baseUnitValue/8m) / (1024m * 1024); - case InformationUnit.Megabit: return (baseUnitValue) / 1e6m; - case InformationUnit.Megabyte: return (baseUnitValue/8m) / 1e6m; - case InformationUnit.Pebibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Pebibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024); - case InformationUnit.Petabit: return (baseUnitValue) / 1e15m; - case InformationUnit.Petabyte: return (baseUnitValue/8m) / 1e15m; - case InformationUnit.Tebibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024); - case InformationUnit.Tebibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024); - case InformationUnit.Terabit: return (baseUnitValue) / 1e12m; - case InformationUnit.Terabyte: return (baseUnitValue/8m) / 1e12m; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Information Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Information result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static InformationUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out InformationUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) - { - result = default(Information); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == InformationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) - { - unit = InformationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == InformationUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(InformationUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Information - /// - public static Information MaxValue => new Information(decimal.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Information - /// - public static Information MinValue => new Information(decimal.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Information.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Information.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs deleted file mode 100644 index 9cf07001d2..0000000000 --- a/Common/GeneratedCode/Quantities/Irradiance.Common.g.cs +++ /dev/null @@ -1,559 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Irradiance : IQuantity -#else - public partial struct Irradiance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly IrradianceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public IrradianceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Irradiance() - { - BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Irradiance(double numericValue, IrradianceUnit unit) - { - if(unit == IrradianceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Irradiance; - - /// - /// The base unit of Irradiance, which is WattPerSquareMeter. All conversions go via this value. - /// - public static IrradianceUnit BaseUnit => IrradianceUnit.WattPerSquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Irradiance quantity. - /// - public static IrradianceUnit[] Units { get; } = Enum.GetValues(typeof(IrradianceUnit)).Cast().Except(new IrradianceUnit[]{ IrradianceUnit.Undefined }).ToArray(); - - /// - /// Get Irradiance in KilowattsPerSquareMeter. - /// - public double KilowattsPerSquareMeter => As(IrradianceUnit.KilowattPerSquareMeter); - - /// - /// Get Irradiance in WattsPerSquareMeter. - /// - public double WattsPerSquareMeter => As(IrradianceUnit.WattPerSquareMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. - /// - public static Irradiance Zero => new Irradiance(0, BaseUnit); - - /// - /// Get Irradiance from KilowattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Irradiance FromKilowattsPerSquareMeter(double kilowattspersquaremeter) -#else - public static Irradiance FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) -#endif - { - double value = (double) kilowattspersquaremeter; - return new Irradiance(value, IrradianceUnit.KilowattPerSquareMeter); - } - - /// - /// Get Irradiance from WattsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Irradiance FromWattsPerSquareMeter(double wattspersquaremeter) -#else - public static Irradiance FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) -#endif - { - double value = (double) wattspersquaremeter; - return new Irradiance(value, IrradianceUnit.WattPerSquareMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Irradiance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Irradiance From(double value, IrradianceUnit fromUnit) -#else - public static Irradiance From(QuantityValue value, IrradianceUnit fromUnit) -#endif - { - return new Irradiance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IrradianceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); - - return CompareTo((Irradiance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Irradiance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Irradiance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Irradiance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(IrradianceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Irradiance to another Irradiance with the unit representation . - /// - /// A Irradiance with the specified unit. - public Irradiance ToUnit(IrradianceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Irradiance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case IrradianceUnit.KilowattPerSquareMeter: return (_value) * 1e3d; - case IrradianceUnit.WattPerSquareMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(IrradianceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case IrradianceUnit.KilowattPerSquareMeter: return (baseUnitValue) / 1e3d; - case IrradianceUnit.WattPerSquareMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Irradiance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Irradiance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradianceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out IrradianceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Irradiance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) - { - result = default(Irradiance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static IrradianceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == IrradianceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradianceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradianceUnit unit) - { - unit = IrradianceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == IrradianceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(IrradianceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Irradiance - /// - public static Irradiance MaxValue => new Irradiance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Irradiance - /// - public static Irradiance MinValue => new Irradiance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Irradiance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Irradiance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs b/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs deleted file mode 100644 index f200105b05..0000000000 --- a/Common/GeneratedCode/Quantities/Irradiation.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Irradiation is the process by which an object is exposed to radiation. The exposure can originate from various sources, including natural sources. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Irradiation : IQuantity -#else - public partial struct Irradiation : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly IrradiationUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public IrradiationUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Irradiation() - { - BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Irradiation(double numericValue, IrradiationUnit unit) - { - if(unit == IrradiationUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Irradiation; - - /// - /// The base unit of Irradiation, which is JoulePerSquareMeter. All conversions go via this value. - /// - public static IrradiationUnit BaseUnit => IrradiationUnit.JoulePerSquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Irradiation quantity. - /// - public static IrradiationUnit[] Units { get; } = Enum.GetValues(typeof(IrradiationUnit)).Cast().Except(new IrradiationUnit[]{ IrradiationUnit.Undefined }).ToArray(); - - /// - /// Get Irradiation in JoulesPerSquareMeter. - /// - public double JoulesPerSquareMeter => As(IrradiationUnit.JoulePerSquareMeter); - - /// - /// Get Irradiation in KilowattHoursPerSquareMeter. - /// - public double KilowattHoursPerSquareMeter => As(IrradiationUnit.KilowattHourPerSquareMeter); - - /// - /// Get Irradiation in WattHoursPerSquareMeter. - /// - public double WattHoursPerSquareMeter => As(IrradiationUnit.WattHourPerSquareMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerSquareMeter. - /// - public static Irradiation Zero => new Irradiation(0, BaseUnit); - - /// - /// Get Irradiation from JoulesPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Irradiation FromJoulesPerSquareMeter(double joulespersquaremeter) -#else - public static Irradiation FromJoulesPerSquareMeter(QuantityValue joulespersquaremeter) -#endif - { - double value = (double) joulespersquaremeter; - return new Irradiation(value, IrradiationUnit.JoulePerSquareMeter); - } - - /// - /// Get Irradiation from KilowattHoursPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Irradiation FromKilowattHoursPerSquareMeter(double kilowatthourspersquaremeter) -#else - public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatthourspersquaremeter) -#endif - { - double value = (double) kilowatthourspersquaremeter; - return new Irradiation(value, IrradiationUnit.KilowattHourPerSquareMeter); - } - - /// - /// Get Irradiation from WattHoursPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Irradiation FromWattHoursPerSquareMeter(double watthourspersquaremeter) -#else - public static Irradiation FromWattHoursPerSquareMeter(QuantityValue watthourspersquaremeter) -#endif - { - double value = (double) watthourspersquaremeter; - return new Irradiation(value, IrradiationUnit.WattHourPerSquareMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Irradiation unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Irradiation From(double value, IrradiationUnit fromUnit) -#else - public static Irradiation From(QuantityValue value, IrradiationUnit fromUnit) -#endif - { - return new Irradiation((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(IrradiationUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); - - return CompareTo((Irradiation)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Irradiation other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Irradiation within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Irradiation. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(IrradiationUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Irradiation to another Irradiation with the unit representation . - /// - /// A Irradiation with the specified unit. - public Irradiation ToUnit(IrradiationUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Irradiation(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case IrradiationUnit.JoulePerSquareMeter: return _value; - case IrradiationUnit.KilowattHourPerSquareMeter: return (_value*3600d) * 1e3d; - case IrradiationUnit.WattHourPerSquareMeter: return _value*3600d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(IrradiationUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case IrradiationUnit.JoulePerSquareMeter: return baseUnitValue; - case IrradiationUnit.KilowattHourPerSquareMeter: return (baseUnitValue/3600d) / 1e3d; - case IrradiationUnit.WattHourPerSquareMeter: return baseUnitValue/3600d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Irradiation Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Irradiation result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static IrradiationUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out IrradiationUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Irradiation ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) - { - result = default(Irradiation); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static IrradiationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == IrradiationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized IrradiationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out IrradiationUnit unit) - { - unit = IrradiationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == IrradiationUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(IrradiationUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Irradiation - /// - public static Irradiation MaxValue => new Irradiation(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Irradiation - /// - public static Irradiation MinValue => new Irradiation(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Irradiation.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Irradiation.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs b/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs deleted file mode 100644 index 1c52767722..0000000000 --- a/Common/GeneratedCode/Quantities/KinematicViscosity.Common.g.cs +++ /dev/null @@ -1,691 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class KinematicViscosity : IQuantity -#else - public partial struct KinematicViscosity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly KinematicViscosityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public KinematicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static KinematicViscosity() - { - BaseDimensions = new BaseDimensions(2, 0, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - KinematicViscosity(double numericValue, KinematicViscosityUnit unit) - { - if(unit == KinematicViscosityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.KinematicViscosity; - - /// - /// The base unit of KinematicViscosity, which is SquareMeterPerSecond. All conversions go via this value. - /// - public static KinematicViscosityUnit BaseUnit => KinematicViscosityUnit.SquareMeterPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the KinematicViscosity quantity. - /// - public static KinematicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(KinematicViscosityUnit)).Cast().Except(new KinematicViscosityUnit[]{ KinematicViscosityUnit.Undefined }).ToArray(); - - /// - /// Get KinematicViscosity in Centistokes. - /// - public double Centistokes => As(KinematicViscosityUnit.Centistokes); - - /// - /// Get KinematicViscosity in Decistokes. - /// - public double Decistokes => As(KinematicViscosityUnit.Decistokes); - - /// - /// Get KinematicViscosity in Kilostokes. - /// - public double Kilostokes => As(KinematicViscosityUnit.Kilostokes); - - /// - /// Get KinematicViscosity in Microstokes. - /// - public double Microstokes => As(KinematicViscosityUnit.Microstokes); - - /// - /// Get KinematicViscosity in Millistokes. - /// - public double Millistokes => As(KinematicViscosityUnit.Millistokes); - - /// - /// Get KinematicViscosity in Nanostokes. - /// - public double Nanostokes => As(KinematicViscosityUnit.Nanostokes); - - /// - /// Get KinematicViscosity in SquareMetersPerSecond. - /// - public double SquareMetersPerSecond => As(KinematicViscosityUnit.SquareMeterPerSecond); - - /// - /// Get KinematicViscosity in Stokes. - /// - public double Stokes => As(KinematicViscosityUnit.Stokes); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterPerSecond. - /// - public static KinematicViscosity Zero => new KinematicViscosity(0, BaseUnit); - - /// - /// Get KinematicViscosity from Centistokes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromCentistokes(double centistokes) -#else - public static KinematicViscosity FromCentistokes(QuantityValue centistokes) -#endif - { - double value = (double) centistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Centistokes); - } - - /// - /// Get KinematicViscosity from Decistokes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromDecistokes(double decistokes) -#else - public static KinematicViscosity FromDecistokes(QuantityValue decistokes) -#endif - { - double value = (double) decistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Decistokes); - } - - /// - /// Get KinematicViscosity from Kilostokes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromKilostokes(double kilostokes) -#else - public static KinematicViscosity FromKilostokes(QuantityValue kilostokes) -#endif - { - double value = (double) kilostokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Kilostokes); - } - - /// - /// Get KinematicViscosity from Microstokes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromMicrostokes(double microstokes) -#else - public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) -#endif - { - double value = (double) microstokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Microstokes); - } - - /// - /// Get KinematicViscosity from Millistokes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromMillistokes(double millistokes) -#else - public static KinematicViscosity FromMillistokes(QuantityValue millistokes) -#endif - { - double value = (double) millistokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Millistokes); - } - - /// - /// Get KinematicViscosity from Nanostokes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromNanostokes(double nanostokes) -#else - public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) -#endif - { - double value = (double) nanostokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Nanostokes); - } - - /// - /// Get KinematicViscosity from SquareMetersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromSquareMetersPerSecond(double squaremeterspersecond) -#else - public static KinematicViscosity FromSquareMetersPerSecond(QuantityValue squaremeterspersecond) -#endif - { - double value = (double) squaremeterspersecond; - return new KinematicViscosity(value, KinematicViscosityUnit.SquareMeterPerSecond); - } - - /// - /// Get KinematicViscosity from Stokes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static KinematicViscosity FromStokes(double stokes) -#else - public static KinematicViscosity FromStokes(QuantityValue stokes) -#endif - { - double value = (double) stokes; - return new KinematicViscosity(value, KinematicViscosityUnit.Stokes); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// KinematicViscosity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static KinematicViscosity From(double value, KinematicViscosityUnit fromUnit) -#else - public static KinematicViscosity From(QuantityValue value, KinematicViscosityUnit fromUnit) -#endif - { - return new KinematicViscosity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(KinematicViscosityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is KinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); - - return CompareTo((KinematicViscosity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(KinematicViscosity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another KinematicViscosity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current KinematicViscosity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(KinematicViscosityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this KinematicViscosity to another KinematicViscosity with the unit representation . - /// - /// A KinematicViscosity with the specified unit. - public KinematicViscosity ToUnit(KinematicViscosityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new KinematicViscosity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case KinematicViscosityUnit.Centistokes: return (_value/1e4) * 1e-2d; - case KinematicViscosityUnit.Decistokes: return (_value/1e4) * 1e-1d; - case KinematicViscosityUnit.Kilostokes: return (_value/1e4) * 1e3d; - case KinematicViscosityUnit.Microstokes: return (_value/1e4) * 1e-6d; - case KinematicViscosityUnit.Millistokes: return (_value/1e4) * 1e-3d; - case KinematicViscosityUnit.Nanostokes: return (_value/1e4) * 1e-9d; - case KinematicViscosityUnit.SquareMeterPerSecond: return _value; - case KinematicViscosityUnit.Stokes: return _value/1e4; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(KinematicViscosityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case KinematicViscosityUnit.Centistokes: return (baseUnitValue*1e4) / 1e-2d; - case KinematicViscosityUnit.Decistokes: return (baseUnitValue*1e4) / 1e-1d; - case KinematicViscosityUnit.Kilostokes: return (baseUnitValue*1e4) / 1e3d; - case KinematicViscosityUnit.Microstokes: return (baseUnitValue*1e4) / 1e-6d; - case KinematicViscosityUnit.Millistokes: return (baseUnitValue*1e4) / 1e-3d; - case KinematicViscosityUnit.Nanostokes: return (baseUnitValue*1e4) / 1e-9d; - case KinematicViscosityUnit.SquareMeterPerSecond: return baseUnitValue; - case KinematicViscosityUnit.Stokes: return baseUnitValue*1e4; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static KinematicViscosity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out KinematicViscosity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static KinematicViscosityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out KinematicViscosityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static KinematicViscosity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) - { - result = default(KinematicViscosity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static KinematicViscosityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == KinematicViscosityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized KinematicViscosityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out KinematicViscosityUnit unit) - { - unit = KinematicViscosityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == KinematicViscosityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(KinematicViscosityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of KinematicViscosity - /// - public static KinematicViscosity MaxValue => new KinematicViscosity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of KinematicViscosity - /// - public static KinematicViscosity MinValue => new KinematicViscosity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => KinematicViscosity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => KinematicViscosity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs b/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs deleted file mode 100644 index 95ecc9ff70..0000000000 --- a/Common/GeneratedCode/Quantities/LapseRate.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class LapseRate : IQuantity -#else - public partial struct LapseRate : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LapseRateUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public LapseRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static LapseRate() - { - BaseDimensions = new BaseDimensions(-1, 0, 0, 0, 1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - LapseRate(double numericValue, LapseRateUnit unit) - { - if(unit == LapseRateUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.LapseRate; - - /// - /// The base unit of LapseRate, which is DegreeCelsiusPerKilometer. All conversions go via this value. - /// - public static LapseRateUnit BaseUnit => LapseRateUnit.DegreeCelsiusPerKilometer; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the LapseRate quantity. - /// - public static LapseRateUnit[] Units { get; } = Enum.GetValues(typeof(LapseRateUnit)).Cast().Except(new LapseRateUnit[]{ LapseRateUnit.Undefined }).ToArray(); - - /// - /// Get LapseRate in DegreesCelciusPerKilometer. - /// - public double DegreesCelciusPerKilometer => As(LapseRateUnit.DegreeCelsiusPerKilometer); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. - /// - public static LapseRate Zero => new LapseRate(0, BaseUnit); - - /// - /// Get LapseRate from DegreesCelciusPerKilometer. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static LapseRate FromDegreesCelciusPerKilometer(double degreescelciusperkilometer) -#else - public static LapseRate FromDegreesCelciusPerKilometer(QuantityValue degreescelciusperkilometer) -#endif - { - double value = (double) degreescelciusperkilometer; - return new LapseRate(value, LapseRateUnit.DegreeCelsiusPerKilometer); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LapseRate unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static LapseRate From(double value, LapseRateUnit fromUnit) -#else - public static LapseRate From(QuantityValue value, LapseRateUnit fromUnit) -#endif - { - return new LapseRate((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LapseRateUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); - - return CompareTo((LapseRate)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(LapseRate other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another LapseRate within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current LapseRate. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(LapseRateUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this LapseRate to another LapseRate with the unit representation . - /// - /// A LapseRate with the specified unit. - public LapseRate ToUnit(LapseRateUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new LapseRate(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case LapseRateUnit.DegreeCelsiusPerKilometer: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(LapseRateUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case LapseRateUnit.DegreeCelsiusPerKilometer: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LapseRate Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out LapseRate result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LapseRateUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out LapseRateUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static LapseRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) - { - result = default(LapseRate); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LapseRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == LapseRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LapseRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LapseRateUnit unit) - { - unit = LapseRateUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == LapseRateUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LapseRateUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of LapseRate - /// - public static LapseRate MaxValue => new LapseRate(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of LapseRate - /// - public static LapseRate MinValue => new LapseRate(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => LapseRate.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => LapseRate.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Length.Common.g.cs b/Common/GeneratedCode/Quantities/Length.Common.g.cs deleted file mode 100644 index 5cf0e59579..0000000000 --- a/Common/GeneratedCode/Quantities/Length.Common.g.cs +++ /dev/null @@ -1,999 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Length : IQuantity -#else - public partial struct Length : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LengthUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public LengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Length() - { - BaseDimensions = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Length(double numericValue, LengthUnit unit) - { - if(unit == LengthUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Length; - - /// - /// The base unit of Length, which is Meter. All conversions go via this value. - /// - public static LengthUnit BaseUnit => LengthUnit.Meter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Length quantity. - /// - public static LengthUnit[] Units { get; } = Enum.GetValues(typeof(LengthUnit)).Cast().Except(new LengthUnit[]{ LengthUnit.Undefined }).ToArray(); - - /// - /// Get Length in Centimeters. - /// - public double Centimeters => As(LengthUnit.Centimeter); - - /// - /// Get Length in Decimeters. - /// - public double Decimeters => As(LengthUnit.Decimeter); - - /// - /// Get Length in DtpPicas. - /// - public double DtpPicas => As(LengthUnit.DtpPica); - - /// - /// Get Length in DtpPoints. - /// - public double DtpPoints => As(LengthUnit.DtpPoint); - - /// - /// Get Length in Fathoms. - /// - public double Fathoms => As(LengthUnit.Fathom); - - /// - /// Get Length in Feet. - /// - public double Feet => As(LengthUnit.Foot); - - /// - /// Get Length in Inches. - /// - public double Inches => As(LengthUnit.Inch); - - /// - /// Get Length in Kilometers. - /// - public double Kilometers => As(LengthUnit.Kilometer); - - /// - /// Get Length in Meters. - /// - public double Meters => As(LengthUnit.Meter); - - /// - /// Get Length in Microinches. - /// - public double Microinches => As(LengthUnit.Microinch); - - /// - /// Get Length in Micrometers. - /// - public double Micrometers => As(LengthUnit.Micrometer); - - /// - /// Get Length in Mils. - /// - public double Mils => As(LengthUnit.Mil); - - /// - /// Get Length in Miles. - /// - public double Miles => As(LengthUnit.Mile); - - /// - /// Get Length in Millimeters. - /// - public double Millimeters => As(LengthUnit.Millimeter); - - /// - /// Get Length in Nanometers. - /// - public double Nanometers => As(LengthUnit.Nanometer); - - /// - /// Get Length in NauticalMiles. - /// - public double NauticalMiles => As(LengthUnit.NauticalMile); - - /// - /// Get Length in PrinterPicas. - /// - public double PrinterPicas => As(LengthUnit.PrinterPica); - - /// - /// Get Length in PrinterPoints. - /// - public double PrinterPoints => As(LengthUnit.PrinterPoint); - - /// - /// Get Length in Shackles. - /// - public double Shackles => As(LengthUnit.Shackle); - - /// - /// Get Length in Twips. - /// - public double Twips => As(LengthUnit.Twip); - - /// - /// Get Length in UsSurveyFeet. - /// - public double UsSurveyFeet => As(LengthUnit.UsSurveyFoot); - - /// - /// Get Length in Yards. - /// - public double Yards => As(LengthUnit.Yard); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Meter. - /// - public static Length Zero => new Length(0, BaseUnit); - - /// - /// Get Length from Centimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromCentimeters(double centimeters) -#else - public static Length FromCentimeters(QuantityValue centimeters) -#endif - { - double value = (double) centimeters; - return new Length(value, LengthUnit.Centimeter); - } - - /// - /// Get Length from Decimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromDecimeters(double decimeters) -#else - public static Length FromDecimeters(QuantityValue decimeters) -#endif - { - double value = (double) decimeters; - return new Length(value, LengthUnit.Decimeter); - } - - /// - /// Get Length from DtpPicas. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromDtpPicas(double dtppicas) -#else - public static Length FromDtpPicas(QuantityValue dtppicas) -#endif - { - double value = (double) dtppicas; - return new Length(value, LengthUnit.DtpPica); - } - - /// - /// Get Length from DtpPoints. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromDtpPoints(double dtppoints) -#else - public static Length FromDtpPoints(QuantityValue dtppoints) -#endif - { - double value = (double) dtppoints; - return new Length(value, LengthUnit.DtpPoint); - } - - /// - /// Get Length from Fathoms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromFathoms(double fathoms) -#else - public static Length FromFathoms(QuantityValue fathoms) -#endif - { - double value = (double) fathoms; - return new Length(value, LengthUnit.Fathom); - } - - /// - /// Get Length from Feet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromFeet(double feet) -#else - public static Length FromFeet(QuantityValue feet) -#endif - { - double value = (double) feet; - return new Length(value, LengthUnit.Foot); - } - - /// - /// Get Length from Inches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromInches(double inches) -#else - public static Length FromInches(QuantityValue inches) -#endif - { - double value = (double) inches; - return new Length(value, LengthUnit.Inch); - } - - /// - /// Get Length from Kilometers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromKilometers(double kilometers) -#else - public static Length FromKilometers(QuantityValue kilometers) -#endif - { - double value = (double) kilometers; - return new Length(value, LengthUnit.Kilometer); - } - - /// - /// Get Length from Meters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromMeters(double meters) -#else - public static Length FromMeters(QuantityValue meters) -#endif - { - double value = (double) meters; - return new Length(value, LengthUnit.Meter); - } - - /// - /// Get Length from Microinches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromMicroinches(double microinches) -#else - public static Length FromMicroinches(QuantityValue microinches) -#endif - { - double value = (double) microinches; - return new Length(value, LengthUnit.Microinch); - } - - /// - /// Get Length from Micrometers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromMicrometers(double micrometers) -#else - public static Length FromMicrometers(QuantityValue micrometers) -#endif - { - double value = (double) micrometers; - return new Length(value, LengthUnit.Micrometer); - } - - /// - /// Get Length from Mils. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromMils(double mils) -#else - public static Length FromMils(QuantityValue mils) -#endif - { - double value = (double) mils; - return new Length(value, LengthUnit.Mil); - } - - /// - /// Get Length from Miles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromMiles(double miles) -#else - public static Length FromMiles(QuantityValue miles) -#endif - { - double value = (double) miles; - return new Length(value, LengthUnit.Mile); - } - - /// - /// Get Length from Millimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromMillimeters(double millimeters) -#else - public static Length FromMillimeters(QuantityValue millimeters) -#endif - { - double value = (double) millimeters; - return new Length(value, LengthUnit.Millimeter); - } - - /// - /// Get Length from Nanometers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromNanometers(double nanometers) -#else - public static Length FromNanometers(QuantityValue nanometers) -#endif - { - double value = (double) nanometers; - return new Length(value, LengthUnit.Nanometer); - } - - /// - /// Get Length from NauticalMiles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromNauticalMiles(double nauticalmiles) -#else - public static Length FromNauticalMiles(QuantityValue nauticalmiles) -#endif - { - double value = (double) nauticalmiles; - return new Length(value, LengthUnit.NauticalMile); - } - - /// - /// Get Length from PrinterPicas. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromPrinterPicas(double printerpicas) -#else - public static Length FromPrinterPicas(QuantityValue printerpicas) -#endif - { - double value = (double) printerpicas; - return new Length(value, LengthUnit.PrinterPica); - } - - /// - /// Get Length from PrinterPoints. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromPrinterPoints(double printerpoints) -#else - public static Length FromPrinterPoints(QuantityValue printerpoints) -#endif - { - double value = (double) printerpoints; - return new Length(value, LengthUnit.PrinterPoint); - } - - /// - /// Get Length from Shackles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromShackles(double shackles) -#else - public static Length FromShackles(QuantityValue shackles) -#endif - { - double value = (double) shackles; - return new Length(value, LengthUnit.Shackle); - } - - /// - /// Get Length from Twips. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromTwips(double twips) -#else - public static Length FromTwips(QuantityValue twips) -#endif - { - double value = (double) twips; - return new Length(value, LengthUnit.Twip); - } - - /// - /// Get Length from UsSurveyFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromUsSurveyFeet(double ussurveyfeet) -#else - public static Length FromUsSurveyFeet(QuantityValue ussurveyfeet) -#endif - { - double value = (double) ussurveyfeet; - return new Length(value, LengthUnit.UsSurveyFoot); - } - - /// - /// Get Length from Yards. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Length FromYards(double yards) -#else - public static Length FromYards(QuantityValue yards) -#endif - { - double value = (double) yards; - return new Length(value, LengthUnit.Yard); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Length unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Length From(double value, LengthUnit fromUnit) -#else - public static Length From(QuantityValue value, LengthUnit fromUnit) -#endif - { - return new Length((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LengthUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Length)) throw new ArgumentException("Expected type Length.", nameof(obj)); - - return CompareTo((Length)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Length other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Length within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Length other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Length. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(LengthUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Length to another Length with the unit representation . - /// - /// A Length with the specified unit. - public Length ToUnit(LengthUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Length(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case LengthUnit.Centimeter: return (_value) * 1e-2d; - case LengthUnit.Decimeter: return (_value) * 1e-1d; - case LengthUnit.DtpPica: return _value/236.220472441; - case LengthUnit.DtpPoint: return (_value/72)*2.54e-2; - case LengthUnit.Fathom: return _value*1.8288; - case LengthUnit.Foot: return _value*0.3048; - case LengthUnit.Inch: return _value*2.54e-2; - case LengthUnit.Kilometer: return (_value) * 1e3d; - case LengthUnit.Meter: return _value; - case LengthUnit.Microinch: return _value*2.54e-8; - case LengthUnit.Micrometer: return (_value) * 1e-6d; - case LengthUnit.Mil: return _value*2.54e-5; - case LengthUnit.Mile: return _value*1609.34; - case LengthUnit.Millimeter: return (_value) * 1e-3d; - case LengthUnit.Nanometer: return (_value) * 1e-9d; - case LengthUnit.NauticalMile: return _value*1852; - case LengthUnit.PrinterPica: return _value/237.106301584; - case LengthUnit.PrinterPoint: return (_value/72.27)*2.54e-2; - case LengthUnit.Shackle: return _value*27.432; - case LengthUnit.Twip: return _value/56692.913385826; - case LengthUnit.UsSurveyFoot: return _value*1200/3937; - case LengthUnit.Yard: return _value*0.9144; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(LengthUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case LengthUnit.Centimeter: return (baseUnitValue) / 1e-2d; - case LengthUnit.Decimeter: return (baseUnitValue) / 1e-1d; - case LengthUnit.DtpPica: return baseUnitValue*236.220472441; - case LengthUnit.DtpPoint: return (baseUnitValue/2.54e-2)*72; - case LengthUnit.Fathom: return baseUnitValue/1.8288; - case LengthUnit.Foot: return baseUnitValue/0.3048; - case LengthUnit.Inch: return baseUnitValue/2.54e-2; - case LengthUnit.Kilometer: return (baseUnitValue) / 1e3d; - case LengthUnit.Meter: return baseUnitValue; - case LengthUnit.Microinch: return baseUnitValue/2.54e-8; - case LengthUnit.Micrometer: return (baseUnitValue) / 1e-6d; - case LengthUnit.Mil: return baseUnitValue/2.54e-5; - case LengthUnit.Mile: return baseUnitValue/1609.34; - case LengthUnit.Millimeter: return (baseUnitValue) / 1e-3d; - case LengthUnit.Nanometer: return (baseUnitValue) / 1e-9d; - case LengthUnit.NauticalMile: return baseUnitValue/1852; - case LengthUnit.PrinterPica: return baseUnitValue*237.106301584; - case LengthUnit.PrinterPoint: return (baseUnitValue/2.54e-2)*72.27; - case LengthUnit.Shackle: return baseUnitValue/27.432; - case LengthUnit.Twip: return baseUnitValue*56692.913385826; - case LengthUnit.UsSurveyFoot: return baseUnitValue*3937/1200; - case LengthUnit.Yard: return baseUnitValue/0.9144; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Length Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Length result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LengthUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out LengthUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) - { - result = default(Length); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == LengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) - { - unit = LengthUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == LengthUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LengthUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Length - /// - public static Length MaxValue => new Length(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Length - /// - public static Length MinValue => new Length(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Length.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Length.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Level.Common.g.cs b/Common/GeneratedCode/Quantities/Level.Common.g.cs deleted file mode 100644 index fb8bc39905..0000000000 --- a/Common/GeneratedCode/Quantities/Level.Common.g.cs +++ /dev/null @@ -1,558 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Level : IQuantity -#else - public partial struct Level : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LevelUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Level() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Level(double numericValue, LevelUnit unit) - { - if(unit == LevelUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Level; - - /// - /// The base unit of Level, which is Decibel. All conversions go via this value. - /// - public static LevelUnit BaseUnit => LevelUnit.Decibel; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Level quantity. - /// - public static LevelUnit[] Units { get; } = Enum.GetValues(typeof(LevelUnit)).Cast().Except(new LevelUnit[]{ LevelUnit.Undefined }).ToArray(); - - /// - /// Get Level in Decibels. - /// - public double Decibels => As(LevelUnit.Decibel); - - /// - /// Get Level in Nepers. - /// - public double Nepers => As(LevelUnit.Neper); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Decibel. - /// - public static Level Zero => new Level(0, BaseUnit); - - /// - /// Get Level from Decibels. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Level FromDecibels(double decibels) -#else - public static Level FromDecibels(QuantityValue decibels) -#endif - { - double value = (double) decibels; - return new Level(value, LevelUnit.Decibel); - } - - /// - /// Get Level from Nepers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Level FromNepers(double nepers) -#else - public static Level FromNepers(QuantityValue nepers) -#endif - { - double value = (double) nepers; - return new Level(value, LevelUnit.Neper); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Level unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Level From(double value, LevelUnit fromUnit) -#else - public static Level From(QuantityValue value, LevelUnit fromUnit) -#endif - { - return new Level((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LevelUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Level)) throw new ArgumentException("Expected type Level.", nameof(obj)); - - return CompareTo((Level)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Level other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Level within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Level other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Level. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(LevelUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Level to another Level with the unit representation . - /// - /// A Level with the specified unit. - public Level ToUnit(LevelUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Level(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case LevelUnit.Decibel: return _value; - case LevelUnit.Neper: return (1/0.115129254)*_value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(LevelUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case LevelUnit.Decibel: return baseUnitValue; - case LevelUnit.Neper: return 0.115129254*baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Level Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Level result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LevelUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out LevelUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) - { - result = default(Level); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == LevelUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) - { - unit = LevelUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == LevelUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LevelUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Level - /// - public static Level MaxValue => new Level(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Level - /// - public static Level MinValue => new Level(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Level.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Level.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs b/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs deleted file mode 100644 index bf93d8745a..0000000000 --- a/Common/GeneratedCode/Quantities/LinearDensity.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Linear Density, or more precisely, the linear mass density, of a substance is its mass per unit length. The term linear density is most often used when describing the characteristics of one-dimensional objects, although linear density can also be used to describe the density of a three-dimensional quantity along one particular dimension. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class LinearDensity : IQuantity -#else - public partial struct LinearDensity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LinearDensityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public LinearDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static LinearDensity() - { - BaseDimensions = new BaseDimensions(-1, 1, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - LinearDensity(double numericValue, LinearDensityUnit unit) - { - if(unit == LinearDensityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.LinearDensity; - - /// - /// The base unit of LinearDensity, which is KilogramPerMeter. All conversions go via this value. - /// - public static LinearDensityUnit BaseUnit => LinearDensityUnit.KilogramPerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the LinearDensity quantity. - /// - public static LinearDensityUnit[] Units { get; } = Enum.GetValues(typeof(LinearDensityUnit)).Cast().Except(new LinearDensityUnit[]{ LinearDensityUnit.Undefined }).ToArray(); - - /// - /// Get LinearDensity in GramsPerMeter. - /// - public double GramsPerMeter => As(LinearDensityUnit.GramPerMeter); - - /// - /// Get LinearDensity in KilogramsPerMeter. - /// - public double KilogramsPerMeter => As(LinearDensityUnit.KilogramPerMeter); - - /// - /// Get LinearDensity in PoundsPerFoot. - /// - public double PoundsPerFoot => As(LinearDensityUnit.PoundPerFoot); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMeter. - /// - public static LinearDensity Zero => new LinearDensity(0, BaseUnit); - - /// - /// Get LinearDensity from GramsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static LinearDensity FromGramsPerMeter(double gramspermeter) -#else - public static LinearDensity FromGramsPerMeter(QuantityValue gramspermeter) -#endif - { - double value = (double) gramspermeter; - return new LinearDensity(value, LinearDensityUnit.GramPerMeter); - } - - /// - /// Get LinearDensity from KilogramsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static LinearDensity FromKilogramsPerMeter(double kilogramspermeter) -#else - public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermeter) -#endif - { - double value = (double) kilogramspermeter; - return new LinearDensity(value, LinearDensityUnit.KilogramPerMeter); - } - - /// - /// Get LinearDensity from PoundsPerFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static LinearDensity FromPoundsPerFoot(double poundsperfoot) -#else - public static LinearDensity FromPoundsPerFoot(QuantityValue poundsperfoot) -#endif - { - double value = (double) poundsperfoot; - return new LinearDensity(value, LinearDensityUnit.PoundPerFoot); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LinearDensity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static LinearDensity From(double value, LinearDensityUnit fromUnit) -#else - public static LinearDensity From(QuantityValue value, LinearDensityUnit fromUnit) -#endif - { - return new LinearDensity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LinearDensityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); - - return CompareTo((LinearDensity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(LinearDensity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another LinearDensity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current LinearDensity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(LinearDensityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this LinearDensity to another LinearDensity with the unit representation . - /// - /// A LinearDensity with the specified unit. - public LinearDensity ToUnit(LinearDensityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new LinearDensity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case LinearDensityUnit.GramPerMeter: return _value*1e-3; - case LinearDensityUnit.KilogramPerMeter: return (_value*1e-3) * 1e3d; - case LinearDensityUnit.PoundPerFoot: return _value*1.48816394; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(LinearDensityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case LinearDensityUnit.GramPerMeter: return baseUnitValue/1e-3; - case LinearDensityUnit.KilogramPerMeter: return (baseUnitValue/1e-3) / 1e3d; - case LinearDensityUnit.PoundPerFoot: return baseUnitValue/1.48816394; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LinearDensity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out LinearDensity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LinearDensityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out LinearDensityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static LinearDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) - { - result = default(LinearDensity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LinearDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == LinearDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LinearDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LinearDensityUnit unit) - { - unit = LinearDensityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == LinearDensityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LinearDensityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of LinearDensity - /// - public static LinearDensity MaxValue => new LinearDensity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of LinearDensity - /// - public static LinearDensity MinValue => new LinearDensity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => LinearDensity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => LinearDensity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs deleted file mode 100644 index 1ec661ec2f..0000000000 --- a/Common/GeneratedCode/Quantities/LuminousFlux.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, luminous flux or luminous power is the measure of the perceived power of light. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class LuminousFlux : IQuantity -#else - public partial struct LuminousFlux : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LuminousFluxUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public LuminousFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static LuminousFlux() - { - BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - LuminousFlux(double numericValue, LuminousFluxUnit unit) - { - if(unit == LuminousFluxUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.LuminousFlux; - - /// - /// The base unit of LuminousFlux, which is Lumen. All conversions go via this value. - /// - public static LuminousFluxUnit BaseUnit => LuminousFluxUnit.Lumen; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the LuminousFlux quantity. - /// - public static LuminousFluxUnit[] Units { get; } = Enum.GetValues(typeof(LuminousFluxUnit)).Cast().Except(new LuminousFluxUnit[]{ LuminousFluxUnit.Undefined }).ToArray(); - - /// - /// Get LuminousFlux in Lumens. - /// - public double Lumens => As(LuminousFluxUnit.Lumen); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Lumen. - /// - public static LuminousFlux Zero => new LuminousFlux(0, BaseUnit); - - /// - /// Get LuminousFlux from Lumens. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static LuminousFlux FromLumens(double lumens) -#else - public static LuminousFlux FromLumens(QuantityValue lumens) -#endif - { - double value = (double) lumens; - return new LuminousFlux(value, LuminousFluxUnit.Lumen); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LuminousFlux unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static LuminousFlux From(double value, LuminousFluxUnit fromUnit) -#else - public static LuminousFlux From(QuantityValue value, LuminousFluxUnit fromUnit) -#endif - { - return new LuminousFlux((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LuminousFluxUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); - - return CompareTo((LuminousFlux)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(LuminousFlux other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another LuminousFlux within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current LuminousFlux. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(LuminousFluxUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this LuminousFlux to another LuminousFlux with the unit representation . - /// - /// A LuminousFlux with the specified unit. - public LuminousFlux ToUnit(LuminousFluxUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new LuminousFlux(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case LuminousFluxUnit.Lumen: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(LuminousFluxUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case LuminousFluxUnit.Lumen: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LuminousFlux Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out LuminousFlux result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousFluxUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out LuminousFluxUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static LuminousFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) - { - result = default(LuminousFlux); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LuminousFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == LuminousFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousFluxUnit unit) - { - unit = LuminousFluxUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == LuminousFluxUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LuminousFluxUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of LuminousFlux - /// - public static LuminousFlux MaxValue => new LuminousFlux(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of LuminousFlux - /// - public static LuminousFlux MinValue => new LuminousFlux(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => LuminousFlux.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => LuminousFlux.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs b/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs deleted file mode 100644 index 76d83c9d9e..0000000000 --- a/Common/GeneratedCode/Quantities/LuminousIntensity.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In photometry, luminous intensity is a measure of the wavelength-weighted power emitted by a light source in a particular direction per unit solid angle, based on the luminosity function, a standardized model of the sensitivity of the human eye. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class LuminousIntensity : IQuantity -#else - public partial struct LuminousIntensity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly LuminousIntensityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public LuminousIntensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static LuminousIntensity() - { - BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - LuminousIntensity(double numericValue, LuminousIntensityUnit unit) - { - if(unit == LuminousIntensityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.LuminousIntensity; - - /// - /// The base unit of LuminousIntensity, which is Candela. All conversions go via this value. - /// - public static LuminousIntensityUnit BaseUnit => LuminousIntensityUnit.Candela; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the LuminousIntensity quantity. - /// - public static LuminousIntensityUnit[] Units { get; } = Enum.GetValues(typeof(LuminousIntensityUnit)).Cast().Except(new LuminousIntensityUnit[]{ LuminousIntensityUnit.Undefined }).ToArray(); - - /// - /// Get LuminousIntensity in Candela. - /// - public double Candela => As(LuminousIntensityUnit.Candela); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Candela. - /// - public static LuminousIntensity Zero => new LuminousIntensity(0, BaseUnit); - - /// - /// Get LuminousIntensity from Candela. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static LuminousIntensity FromCandela(double candela) -#else - public static LuminousIntensity FromCandela(QuantityValue candela) -#endif - { - double value = (double) candela; - return new LuminousIntensity(value, LuminousIntensityUnit.Candela); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LuminousIntensity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static LuminousIntensity From(double value, LuminousIntensityUnit fromUnit) -#else - public static LuminousIntensity From(QuantityValue value, LuminousIntensityUnit fromUnit) -#endif - { - return new LuminousIntensity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(LuminousIntensityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); - - return CompareTo((LuminousIntensity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(LuminousIntensity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another LuminousIntensity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current LuminousIntensity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(LuminousIntensityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this LuminousIntensity to another LuminousIntensity with the unit representation . - /// - /// A LuminousIntensity with the specified unit. - public LuminousIntensity ToUnit(LuminousIntensityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new LuminousIntensity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case LuminousIntensityUnit.Candela: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(LuminousIntensityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case LuminousIntensityUnit.Candela: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static LuminousIntensity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out LuminousIntensity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static LuminousIntensityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out LuminousIntensityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static LuminousIntensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) - { - result = default(LuminousIntensity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LuminousIntensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == LuminousIntensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LuminousIntensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LuminousIntensityUnit unit) - { - unit = LuminousIntensityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == LuminousIntensityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LuminousIntensityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of LuminousIntensity - /// - public static LuminousIntensity MaxValue => new LuminousIntensity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of LuminousIntensity - /// - public static LuminousIntensity MinValue => new LuminousIntensity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => LuminousIntensity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => LuminousIntensity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs deleted file mode 100644 index 6d97502e59..0000000000 --- a/Common/GeneratedCode/Quantities/MagneticField.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A magnetic field is a force field that is created by moving electric charges (electric currents) and magnetic dipoles, and exerts a force on other nearby moving charges and magnetic dipoles. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MagneticField : IQuantity -#else - public partial struct MagneticField : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MagneticFieldUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MagneticFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MagneticField() - { - BaseDimensions = new BaseDimensions(0, 1, -2, -1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MagneticField(double numericValue, MagneticFieldUnit unit) - { - if(unit == MagneticFieldUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MagneticField; - - /// - /// The base unit of MagneticField, which is Tesla. All conversions go via this value. - /// - public static MagneticFieldUnit BaseUnit => MagneticFieldUnit.Tesla; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MagneticField quantity. - /// - public static MagneticFieldUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFieldUnit)).Cast().Except(new MagneticFieldUnit[]{ MagneticFieldUnit.Undefined }).ToArray(); - - /// - /// Get MagneticField in Teslas. - /// - public double Teslas => As(MagneticFieldUnit.Tesla); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Tesla. - /// - public static MagneticField Zero => new MagneticField(0, BaseUnit); - - /// - /// Get MagneticField from Teslas. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MagneticField FromTeslas(double teslas) -#else - public static MagneticField FromTeslas(QuantityValue teslas) -#endif - { - double value = (double) teslas; - return new MagneticField(value, MagneticFieldUnit.Tesla); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MagneticField unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MagneticField From(double value, MagneticFieldUnit fromUnit) -#else - public static MagneticField From(QuantityValue value, MagneticFieldUnit fromUnit) -#endif - { - return new MagneticField((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagneticFieldUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); - - return CompareTo((MagneticField)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MagneticField other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MagneticField within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MagneticField. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MagneticFieldUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MagneticField to another MagneticField with the unit representation . - /// - /// A MagneticField with the specified unit. - public MagneticField ToUnit(MagneticFieldUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MagneticField(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MagneticFieldUnit.Tesla: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MagneticFieldUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MagneticFieldUnit.Tesla: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MagneticField Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MagneticField result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFieldUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MagneticFieldUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MagneticField ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) - { - result = default(MagneticField); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MagneticFieldUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MagneticFieldUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFieldUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFieldUnit unit) - { - unit = MagneticFieldUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MagneticFieldUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MagneticFieldUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MagneticField - /// - public static MagneticField MaxValue => new MagneticField(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MagneticField - /// - public static MagneticField MinValue => new MagneticField(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MagneticField.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MagneticField.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs deleted file mode 100644 index 8fa9e01791..0000000000 --- a/Common/GeneratedCode/Quantities/MagneticFlux.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, specifically electromagnetism, the magnetic flux through a surface is the surface integral of the normal component of the magnetic field B passing through that surface. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MagneticFlux : IQuantity -#else - public partial struct MagneticFlux : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MagneticFluxUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MagneticFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MagneticFlux() - { - BaseDimensions = new BaseDimensions(2, 1, -2, -1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MagneticFlux(double numericValue, MagneticFluxUnit unit) - { - if(unit == MagneticFluxUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MagneticFlux; - - /// - /// The base unit of MagneticFlux, which is Weber. All conversions go via this value. - /// - public static MagneticFluxUnit BaseUnit => MagneticFluxUnit.Weber; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MagneticFlux quantity. - /// - public static MagneticFluxUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFluxUnit)).Cast().Except(new MagneticFluxUnit[]{ MagneticFluxUnit.Undefined }).ToArray(); - - /// - /// Get MagneticFlux in Webers. - /// - public double Webers => As(MagneticFluxUnit.Weber); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Weber. - /// - public static MagneticFlux Zero => new MagneticFlux(0, BaseUnit); - - /// - /// Get MagneticFlux from Webers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MagneticFlux FromWebers(double webers) -#else - public static MagneticFlux FromWebers(QuantityValue webers) -#endif - { - double value = (double) webers; - return new MagneticFlux(value, MagneticFluxUnit.Weber); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MagneticFlux unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MagneticFlux From(double value, MagneticFluxUnit fromUnit) -#else - public static MagneticFlux From(QuantityValue value, MagneticFluxUnit fromUnit) -#endif - { - return new MagneticFlux((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagneticFluxUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); - - return CompareTo((MagneticFlux)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MagneticFlux other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MagneticFlux within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MagneticFlux. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MagneticFluxUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MagneticFlux to another MagneticFlux with the unit representation . - /// - /// A MagneticFlux with the specified unit. - public MagneticFlux ToUnit(MagneticFluxUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MagneticFlux(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MagneticFluxUnit.Weber: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MagneticFluxUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MagneticFluxUnit.Weber: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MagneticFlux Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MagneticFlux result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagneticFluxUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MagneticFluxUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MagneticFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) - { - result = default(MagneticFlux); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MagneticFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MagneticFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagneticFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagneticFluxUnit unit) - { - unit = MagneticFluxUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MagneticFluxUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MagneticFluxUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MagneticFlux - /// - public static MagneticFlux MaxValue => new MagneticFlux(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MagneticFlux - /// - public static MagneticFlux MinValue => new MagneticFlux(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MagneticFlux.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MagneticFlux.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs b/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs deleted file mode 100644 index 4e2cf27b84..0000000000 --- a/Common/GeneratedCode/Quantities/Magnetization.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In classical electromagnetism, magnetization is the vector field that expresses the density of permanent or induced magnetic dipole moments in a magnetic material. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Magnetization : IQuantity -#else - public partial struct Magnetization : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MagnetizationUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MagnetizationUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Magnetization() - { - BaseDimensions = new BaseDimensions(-1, 0, 0, 1, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Magnetization(double numericValue, MagnetizationUnit unit) - { - if(unit == MagnetizationUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Magnetization; - - /// - /// The base unit of Magnetization, which is AmperePerMeter. All conversions go via this value. - /// - public static MagnetizationUnit BaseUnit => MagnetizationUnit.AmperePerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Magnetization quantity. - /// - public static MagnetizationUnit[] Units { get; } = Enum.GetValues(typeof(MagnetizationUnit)).Cast().Except(new MagnetizationUnit[]{ MagnetizationUnit.Undefined }).ToArray(); - - /// - /// Get Magnetization in AmperesPerMeter. - /// - public double AmperesPerMeter => As(MagnetizationUnit.AmperePerMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerMeter. - /// - public static Magnetization Zero => new Magnetization(0, BaseUnit); - - /// - /// Get Magnetization from AmperesPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Magnetization FromAmperesPerMeter(double amperespermeter) -#else - public static Magnetization FromAmperesPerMeter(QuantityValue amperespermeter) -#endif - { - double value = (double) amperespermeter; - return new Magnetization(value, MagnetizationUnit.AmperePerMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Magnetization unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Magnetization From(double value, MagnetizationUnit fromUnit) -#else - public static Magnetization From(QuantityValue value, MagnetizationUnit fromUnit) -#endif - { - return new Magnetization((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MagnetizationUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Magnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); - - return CompareTo((Magnetization)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Magnetization other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Magnetization within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Magnetization. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MagnetizationUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Magnetization to another Magnetization with the unit representation . - /// - /// A Magnetization with the specified unit. - public Magnetization ToUnit(MagnetizationUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Magnetization(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MagnetizationUnit.AmperePerMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MagnetizationUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MagnetizationUnit.AmperePerMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Magnetization Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Magnetization result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MagnetizationUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MagnetizationUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Magnetization ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) - { - result = default(Magnetization); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MagnetizationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MagnetizationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MagnetizationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MagnetizationUnit unit) - { - unit = MagnetizationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MagnetizationUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MagnetizationUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Magnetization - /// - public static Magnetization MaxValue => new Magnetization(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Magnetization - /// - public static Magnetization MinValue => new Magnetization(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Magnetization.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Magnetization.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Mass.Common.g.cs b/Common/GeneratedCode/Quantities/Mass.Common.g.cs deleted file mode 100644 index eb7891bca8..0000000000 --- a/Common/GeneratedCode/Quantities/Mass.Common.g.cs +++ /dev/null @@ -1,999 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Mass : IQuantity -#else - public partial struct Mass : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MassUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MassUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Mass() - { - BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Mass(double numericValue, MassUnit unit) - { - if(unit == MassUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Mass; - - /// - /// The base unit of Mass, which is Kilogram. All conversions go via this value. - /// - public static MassUnit BaseUnit => MassUnit.Kilogram; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Mass quantity. - /// - public static MassUnit[] Units { get; } = Enum.GetValues(typeof(MassUnit)).Cast().Except(new MassUnit[]{ MassUnit.Undefined }).ToArray(); - - /// - /// Get Mass in Centigrams. - /// - public double Centigrams => As(MassUnit.Centigram); - - /// - /// Get Mass in Decagrams. - /// - public double Decagrams => As(MassUnit.Decagram); - - /// - /// Get Mass in Decigrams. - /// - public double Decigrams => As(MassUnit.Decigram); - - /// - /// Get Mass in Grams. - /// - public double Grams => As(MassUnit.Gram); - - /// - /// Get Mass in Hectograms. - /// - public double Hectograms => As(MassUnit.Hectogram); - - /// - /// Get Mass in Kilograms. - /// - public double Kilograms => As(MassUnit.Kilogram); - - /// - /// Get Mass in Kilopounds. - /// - public double Kilopounds => As(MassUnit.Kilopound); - - /// - /// Get Mass in Kilotonnes. - /// - public double Kilotonnes => As(MassUnit.Kilotonne); - - /// - /// Get Mass in LongHundredweight. - /// - public double LongHundredweight => As(MassUnit.LongHundredweight); - - /// - /// Get Mass in LongTons. - /// - public double LongTons => As(MassUnit.LongTon); - - /// - /// Get Mass in Megapounds. - /// - public double Megapounds => As(MassUnit.Megapound); - - /// - /// Get Mass in Megatonnes. - /// - public double Megatonnes => As(MassUnit.Megatonne); - - /// - /// Get Mass in Micrograms. - /// - public double Micrograms => As(MassUnit.Microgram); - - /// - /// Get Mass in Milligrams. - /// - public double Milligrams => As(MassUnit.Milligram); - - /// - /// Get Mass in Nanograms. - /// - public double Nanograms => As(MassUnit.Nanogram); - - /// - /// Get Mass in Ounces. - /// - public double Ounces => As(MassUnit.Ounce); - - /// - /// Get Mass in Pounds. - /// - public double Pounds => As(MassUnit.Pound); - - /// - /// Get Mass in ShortHundredweight. - /// - public double ShortHundredweight => As(MassUnit.ShortHundredweight); - - /// - /// Get Mass in ShortTons. - /// - public double ShortTons => As(MassUnit.ShortTon); - - /// - /// Get Mass in Slugs. - /// - public double Slugs => As(MassUnit.Slug); - - /// - /// Get Mass in Stone. - /// - public double Stone => As(MassUnit.Stone); - - /// - /// Get Mass in Tonnes. - /// - public double Tonnes => As(MassUnit.Tonne); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Kilogram. - /// - public static Mass Zero => new Mass(0, BaseUnit); - - /// - /// Get Mass from Centigrams. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromCentigrams(double centigrams) -#else - public static Mass FromCentigrams(QuantityValue centigrams) -#endif - { - double value = (double) centigrams; - return new Mass(value, MassUnit.Centigram); - } - - /// - /// Get Mass from Decagrams. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromDecagrams(double decagrams) -#else - public static Mass FromDecagrams(QuantityValue decagrams) -#endif - { - double value = (double) decagrams; - return new Mass(value, MassUnit.Decagram); - } - - /// - /// Get Mass from Decigrams. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromDecigrams(double decigrams) -#else - public static Mass FromDecigrams(QuantityValue decigrams) -#endif - { - double value = (double) decigrams; - return new Mass(value, MassUnit.Decigram); - } - - /// - /// Get Mass from Grams. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromGrams(double grams) -#else - public static Mass FromGrams(QuantityValue grams) -#endif - { - double value = (double) grams; - return new Mass(value, MassUnit.Gram); - } - - /// - /// Get Mass from Hectograms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromHectograms(double hectograms) -#else - public static Mass FromHectograms(QuantityValue hectograms) -#endif - { - double value = (double) hectograms; - return new Mass(value, MassUnit.Hectogram); - } - - /// - /// Get Mass from Kilograms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromKilograms(double kilograms) -#else - public static Mass FromKilograms(QuantityValue kilograms) -#endif - { - double value = (double) kilograms; - return new Mass(value, MassUnit.Kilogram); - } - - /// - /// Get Mass from Kilopounds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromKilopounds(double kilopounds) -#else - public static Mass FromKilopounds(QuantityValue kilopounds) -#endif - { - double value = (double) kilopounds; - return new Mass(value, MassUnit.Kilopound); - } - - /// - /// Get Mass from Kilotonnes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromKilotonnes(double kilotonnes) -#else - public static Mass FromKilotonnes(QuantityValue kilotonnes) -#endif - { - double value = (double) kilotonnes; - return new Mass(value, MassUnit.Kilotonne); - } - - /// - /// Get Mass from LongHundredweight. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromLongHundredweight(double longhundredweight) -#else - public static Mass FromLongHundredweight(QuantityValue longhundredweight) -#endif - { - double value = (double) longhundredweight; - return new Mass(value, MassUnit.LongHundredweight); - } - - /// - /// Get Mass from LongTons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromLongTons(double longtons) -#else - public static Mass FromLongTons(QuantityValue longtons) -#endif - { - double value = (double) longtons; - return new Mass(value, MassUnit.LongTon); - } - - /// - /// Get Mass from Megapounds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromMegapounds(double megapounds) -#else - public static Mass FromMegapounds(QuantityValue megapounds) -#endif - { - double value = (double) megapounds; - return new Mass(value, MassUnit.Megapound); - } - - /// - /// Get Mass from Megatonnes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromMegatonnes(double megatonnes) -#else - public static Mass FromMegatonnes(QuantityValue megatonnes) -#endif - { - double value = (double) megatonnes; - return new Mass(value, MassUnit.Megatonne); - } - - /// - /// Get Mass from Micrograms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromMicrograms(double micrograms) -#else - public static Mass FromMicrograms(QuantityValue micrograms) -#endif - { - double value = (double) micrograms; - return new Mass(value, MassUnit.Microgram); - } - - /// - /// Get Mass from Milligrams. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromMilligrams(double milligrams) -#else - public static Mass FromMilligrams(QuantityValue milligrams) -#endif - { - double value = (double) milligrams; - return new Mass(value, MassUnit.Milligram); - } - - /// - /// Get Mass from Nanograms. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromNanograms(double nanograms) -#else - public static Mass FromNanograms(QuantityValue nanograms) -#endif - { - double value = (double) nanograms; - return new Mass(value, MassUnit.Nanogram); - } - - /// - /// Get Mass from Ounces. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromOunces(double ounces) -#else - public static Mass FromOunces(QuantityValue ounces) -#endif - { - double value = (double) ounces; - return new Mass(value, MassUnit.Ounce); - } - - /// - /// Get Mass from Pounds. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromPounds(double pounds) -#else - public static Mass FromPounds(QuantityValue pounds) -#endif - { - double value = (double) pounds; - return new Mass(value, MassUnit.Pound); - } - - /// - /// Get Mass from ShortHundredweight. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromShortHundredweight(double shorthundredweight) -#else - public static Mass FromShortHundredweight(QuantityValue shorthundredweight) -#endif - { - double value = (double) shorthundredweight; - return new Mass(value, MassUnit.ShortHundredweight); - } - - /// - /// Get Mass from ShortTons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromShortTons(double shorttons) -#else - public static Mass FromShortTons(QuantityValue shorttons) -#endif - { - double value = (double) shorttons; - return new Mass(value, MassUnit.ShortTon); - } - - /// - /// Get Mass from Slugs. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromSlugs(double slugs) -#else - public static Mass FromSlugs(QuantityValue slugs) -#endif - { - double value = (double) slugs; - return new Mass(value, MassUnit.Slug); - } - - /// - /// Get Mass from Stone. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromStone(double stone) -#else - public static Mass FromStone(QuantityValue stone) -#endif - { - double value = (double) stone; - return new Mass(value, MassUnit.Stone); - } - - /// - /// Get Mass from Tonnes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Mass FromTonnes(double tonnes) -#else - public static Mass FromTonnes(QuantityValue tonnes) -#endif - { - double value = (double) tonnes; - return new Mass(value, MassUnit.Tonne); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Mass unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Mass From(double value, MassUnit fromUnit) -#else - public static Mass From(QuantityValue value, MassUnit fromUnit) -#endif - { - return new Mass((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Mass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); - - return CompareTo((Mass)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Mass other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Mass within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Mass. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MassUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Mass to another Mass with the unit representation . - /// - /// A Mass with the specified unit. - public Mass ToUnit(MassUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Mass(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MassUnit.Centigram: return (_value/1e3) * 1e-2d; - case MassUnit.Decagram: return (_value/1e3) * 1e1d; - case MassUnit.Decigram: return (_value/1e3) * 1e-1d; - case MassUnit.Gram: return _value/1e3; - case MassUnit.Hectogram: return (_value/1e3) * 1e2d; - case MassUnit.Kilogram: return (_value/1e3) * 1e3d; - case MassUnit.Kilopound: return (_value*0.45359237) * 1e3d; - case MassUnit.Kilotonne: return (_value*1e3) * 1e3d; - case MassUnit.LongHundredweight: return _value/0.01968413055222121; - case MassUnit.LongTon: return _value*1.0160469088e3; - case MassUnit.Megapound: return (_value*0.45359237) * 1e6d; - case MassUnit.Megatonne: return (_value*1e3) * 1e6d; - case MassUnit.Microgram: return (_value/1e3) * 1e-6d; - case MassUnit.Milligram: return (_value/1e3) * 1e-3d; - case MassUnit.Nanogram: return (_value/1e3) * 1e-9d; - case MassUnit.Ounce: return _value/35.2739619; - case MassUnit.Pound: return _value*0.45359237; - case MassUnit.ShortHundredweight: return _value/0.022046226218487758; - case MassUnit.ShortTon: return _value*9.0718474e2; - case MassUnit.Slug: return _value/6.852176556196105e-2; - case MassUnit.Stone: return _value/0.1574731728702698; - case MassUnit.Tonne: return _value*1e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MassUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MassUnit.Centigram: return (baseUnitValue*1e3) / 1e-2d; - case MassUnit.Decagram: return (baseUnitValue*1e3) / 1e1d; - case MassUnit.Decigram: return (baseUnitValue*1e3) / 1e-1d; - case MassUnit.Gram: return baseUnitValue*1e3; - case MassUnit.Hectogram: return (baseUnitValue*1e3) / 1e2d; - case MassUnit.Kilogram: return (baseUnitValue*1e3) / 1e3d; - case MassUnit.Kilopound: return (baseUnitValue/0.45359237) / 1e3d; - case MassUnit.Kilotonne: return (baseUnitValue/1e3) / 1e3d; - case MassUnit.LongHundredweight: return baseUnitValue*0.01968413055222121; - case MassUnit.LongTon: return baseUnitValue/1.0160469088e3; - case MassUnit.Megapound: return (baseUnitValue/0.45359237) / 1e6d; - case MassUnit.Megatonne: return (baseUnitValue/1e3) / 1e6d; - case MassUnit.Microgram: return (baseUnitValue*1e3) / 1e-6d; - case MassUnit.Milligram: return (baseUnitValue*1e3) / 1e-3d; - case MassUnit.Nanogram: return (baseUnitValue*1e3) / 1e-9d; - case MassUnit.Ounce: return baseUnitValue*35.2739619; - case MassUnit.Pound: return baseUnitValue/0.45359237; - case MassUnit.ShortHundredweight: return baseUnitValue*0.022046226218487758; - case MassUnit.ShortTon: return baseUnitValue/9.0718474e2; - case MassUnit.Slug: return baseUnitValue*6.852176556196105e-2; - case MassUnit.Stone: return baseUnitValue*0.1574731728702698; - case MassUnit.Tonne: return baseUnitValue/1e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Mass Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Mass result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MassUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Mass ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) - { - result = default(Mass); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MassUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MassUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassUnit unit) - { - unit = MassUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MassUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MassUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Mass - /// - public static Mass MaxValue => new Mass(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Mass - /// - public static Mass MinValue => new Mass(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Mass.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Mass.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs deleted file mode 100644 index e27aa6b919..0000000000 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ /dev/null @@ -1,845 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MassFlow : IQuantity -#else - public partial struct MassFlow : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MassFlowUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MassFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MassFlow() - { - BaseDimensions = new BaseDimensions(0, 1, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MassFlow(double numericValue, MassFlowUnit unit) - { - if(unit == MassFlowUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MassFlow; - - /// - /// The base unit of MassFlow, which is GramPerSecond. All conversions go via this value. - /// - public static MassFlowUnit BaseUnit => MassFlowUnit.GramPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MassFlow quantity. - /// - public static MassFlowUnit[] Units { get; } = Enum.GetValues(typeof(MassFlowUnit)).Cast().Except(new MassFlowUnit[]{ MassFlowUnit.Undefined }).ToArray(); - - /// - /// Get MassFlow in CentigramsPerSecond. - /// - public double CentigramsPerSecond => As(MassFlowUnit.CentigramPerSecond); - - /// - /// Get MassFlow in DecagramsPerSecond. - /// - public double DecagramsPerSecond => As(MassFlowUnit.DecagramPerSecond); - - /// - /// Get MassFlow in DecigramsPerSecond. - /// - public double DecigramsPerSecond => As(MassFlowUnit.DecigramPerSecond); - - /// - /// Get MassFlow in GramsPerSecond. - /// - public double GramsPerSecond => As(MassFlowUnit.GramPerSecond); - - /// - /// Get MassFlow in HectogramsPerSecond. - /// - public double HectogramsPerSecond => As(MassFlowUnit.HectogramPerSecond); - - /// - /// Get MassFlow in KilogramsPerHour. - /// - public double KilogramsPerHour => As(MassFlowUnit.KilogramPerHour); - - /// - /// Get MassFlow in KilogramsPerSecond. - /// - public double KilogramsPerSecond => As(MassFlowUnit.KilogramPerSecond); - - /// - /// Get MassFlow in MegapoundsPerHour. - /// - public double MegapoundsPerHour => As(MassFlowUnit.MegapoundPerHour); - - /// - /// Get MassFlow in MicrogramsPerSecond. - /// - public double MicrogramsPerSecond => As(MassFlowUnit.MicrogramPerSecond); - - /// - /// Get MassFlow in MilligramsPerSecond. - /// - public double MilligramsPerSecond => As(MassFlowUnit.MilligramPerSecond); - - /// - /// Get MassFlow in NanogramsPerSecond. - /// - public double NanogramsPerSecond => As(MassFlowUnit.NanogramPerSecond); - - /// - /// Get MassFlow in PoundsPerHour. - /// - public double PoundsPerHour => As(MassFlowUnit.PoundPerHour); - - /// - /// Get MassFlow in ShortTonsPerHour. - /// - public double ShortTonsPerHour => As(MassFlowUnit.ShortTonPerHour); - - /// - /// Get MassFlow in TonnesPerDay. - /// - public double TonnesPerDay => As(MassFlowUnit.TonnePerDay); - - /// - /// Get MassFlow in TonnesPerHour. - /// - public double TonnesPerHour => As(MassFlowUnit.TonnePerHour); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit GramPerSecond. - /// - public static MassFlow Zero => new MassFlow(0, BaseUnit); - - /// - /// Get MassFlow from CentigramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromCentigramsPerSecond(double centigramspersecond) -#else - public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond) -#endif - { - double value = (double) centigramspersecond; - return new MassFlow(value, MassFlowUnit.CentigramPerSecond); - } - - /// - /// Get MassFlow from DecagramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromDecagramsPerSecond(double decagramspersecond) -#else - public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) -#endif - { - double value = (double) decagramspersecond; - return new MassFlow(value, MassFlowUnit.DecagramPerSecond); - } - - /// - /// Get MassFlow from DecigramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromDecigramsPerSecond(double decigramspersecond) -#else - public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) -#endif - { - double value = (double) decigramspersecond; - return new MassFlow(value, MassFlowUnit.DecigramPerSecond); - } - - /// - /// Get MassFlow from GramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromGramsPerSecond(double gramspersecond) -#else - public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) -#endif - { - double value = (double) gramspersecond; - return new MassFlow(value, MassFlowUnit.GramPerSecond); - } - - /// - /// Get MassFlow from HectogramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromHectogramsPerSecond(double hectogramspersecond) -#else - public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond) -#endif - { - double value = (double) hectogramspersecond; - return new MassFlow(value, MassFlowUnit.HectogramPerSecond); - } - - /// - /// Get MassFlow from KilogramsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromKilogramsPerHour(double kilogramsperhour) -#else - public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) -#endif - { - double value = (double) kilogramsperhour; - return new MassFlow(value, MassFlowUnit.KilogramPerHour); - } - - /// - /// Get MassFlow from KilogramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromKilogramsPerSecond(double kilogramspersecond) -#else - public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) -#endif - { - double value = (double) kilogramspersecond; - return new MassFlow(value, MassFlowUnit.KilogramPerSecond); - } - - /// - /// Get MassFlow from MegapoundsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromMegapoundsPerHour(double megapoundsperhour) -#else - public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) -#endif - { - double value = (double) megapoundsperhour; - return new MassFlow(value, MassFlowUnit.MegapoundPerHour); - } - - /// - /// Get MassFlow from MicrogramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromMicrogramsPerSecond(double microgramspersecond) -#else - public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond) -#endif - { - double value = (double) microgramspersecond; - return new MassFlow(value, MassFlowUnit.MicrogramPerSecond); - } - - /// - /// Get MassFlow from MilligramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromMilligramsPerSecond(double milligramspersecond) -#else - public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond) -#endif - { - double value = (double) milligramspersecond; - return new MassFlow(value, MassFlowUnit.MilligramPerSecond); - } - - /// - /// Get MassFlow from NanogramsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromNanogramsPerSecond(double nanogramspersecond) -#else - public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) -#endif - { - double value = (double) nanogramspersecond; - return new MassFlow(value, MassFlowUnit.NanogramPerSecond); - } - - /// - /// Get MassFlow from PoundsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromPoundsPerHour(double poundsperhour) -#else - public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) -#endif - { - double value = (double) poundsperhour; - return new MassFlow(value, MassFlowUnit.PoundPerHour); - } - - /// - /// Get MassFlow from ShortTonsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromShortTonsPerHour(double shorttonsperhour) -#else - public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) -#endif - { - double value = (double) shorttonsperhour; - return new MassFlow(value, MassFlowUnit.ShortTonPerHour); - } - - /// - /// Get MassFlow from TonnesPerDay. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromTonnesPerDay(double tonnesperday) -#else - public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) -#endif - { - double value = (double) tonnesperday; - return new MassFlow(value, MassFlowUnit.TonnePerDay); - } - - /// - /// Get MassFlow from TonnesPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromTonnesPerHour(double tonnesperhour) -#else - public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) -#endif - { - double value = (double) tonnesperhour; - return new MassFlow(value, MassFlowUnit.TonnePerHour); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MassFlow unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MassFlow From(double value, MassFlowUnit fromUnit) -#else - public static MassFlow From(QuantityValue value, MassFlowUnit fromUnit) -#endif - { - return new MassFlow((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassFlowUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); - - return CompareTo((MassFlow)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MassFlow other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MassFlow within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MassFlow. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MassFlowUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MassFlow to another MassFlow with the unit representation . - /// - /// A MassFlow with the specified unit. - public MassFlow ToUnit(MassFlowUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MassFlow(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MassFlowUnit.CentigramPerSecond: return (_value) * 1e-2d; - case MassFlowUnit.DecagramPerSecond: return (_value) * 1e1d; - case MassFlowUnit.DecigramPerSecond: return (_value) * 1e-1d; - case MassFlowUnit.GramPerSecond: return _value; - case MassFlowUnit.HectogramPerSecond: return (_value) * 1e2d; - case MassFlowUnit.KilogramPerHour: return _value/3.6; - case MassFlowUnit.KilogramPerSecond: return (_value) * 1e3d; - case MassFlowUnit.MegapoundPerHour: return (_value/7.93664) * 1e6d; - case MassFlowUnit.MicrogramPerSecond: return (_value) * 1e-6d; - case MassFlowUnit.MilligramPerSecond: return (_value) * 1e-3d; - case MassFlowUnit.NanogramPerSecond: return (_value) * 1e-9d; - case MassFlowUnit.PoundPerHour: return _value/7.93664; - case MassFlowUnit.ShortTonPerHour: return _value*251.9957611; - case MassFlowUnit.TonnePerDay: return _value/0.0864000; - case MassFlowUnit.TonnePerHour: return 1000*_value/3.6; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MassFlowUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MassFlowUnit.CentigramPerSecond: return (baseUnitValue) / 1e-2d; - case MassFlowUnit.DecagramPerSecond: return (baseUnitValue) / 1e1d; - case MassFlowUnit.DecigramPerSecond: return (baseUnitValue) / 1e-1d; - case MassFlowUnit.GramPerSecond: return baseUnitValue; - case MassFlowUnit.HectogramPerSecond: return (baseUnitValue) / 1e2d; - case MassFlowUnit.KilogramPerHour: return baseUnitValue*3.6; - case MassFlowUnit.KilogramPerSecond: return (baseUnitValue) / 1e3d; - case MassFlowUnit.MegapoundPerHour: return (baseUnitValue*7.93664) / 1e6d; - case MassFlowUnit.MicrogramPerSecond: return (baseUnitValue) / 1e-6d; - case MassFlowUnit.MilligramPerSecond: return (baseUnitValue) / 1e-3d; - case MassFlowUnit.NanogramPerSecond: return (baseUnitValue) / 1e-9d; - case MassFlowUnit.PoundPerHour: return baseUnitValue*7.93664; - case MassFlowUnit.ShortTonPerHour: return baseUnitValue/251.9957611; - case MassFlowUnit.TonnePerDay: return baseUnitValue*0.0864000; - case MassFlowUnit.TonnePerHour: return baseUnitValue*3.6/1000; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassFlow Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MassFlow result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFlowUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MassFlowUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MassFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) - { - result = default(MassFlow); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MassFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MassFlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFlowUnit unit) - { - unit = MassFlowUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MassFlowUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MassFlowUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MassFlow - /// - public static MassFlow MaxValue => new MassFlow(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MassFlow - /// - public static MassFlow MinValue => new MassFlow(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MassFlow.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MassFlow.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs deleted file mode 100644 index b23e5aca4b..0000000000 --- a/Common/GeneratedCode/Quantities/MassFlux.Common.g.cs +++ /dev/null @@ -1,559 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Mass flux is the mass flow rate per unit area. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MassFlux : IQuantity -#else - public partial struct MassFlux : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MassFluxUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MassFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MassFlux() - { - BaseDimensions = new BaseDimensions(-2, 1, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MassFlux(double numericValue, MassFluxUnit unit) - { - if(unit == MassFluxUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MassFlux; - - /// - /// The base unit of MassFlux, which is KilogramPerSecondPerSquareMeter. All conversions go via this value. - /// - public static MassFluxUnit BaseUnit => MassFluxUnit.KilogramPerSecondPerSquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MassFlux quantity. - /// - public static MassFluxUnit[] Units { get; } = Enum.GetValues(typeof(MassFluxUnit)).Cast().Except(new MassFluxUnit[]{ MassFluxUnit.Undefined }).ToArray(); - - /// - /// Get MassFlux in GramsPerSecondPerSquareMeter. - /// - public double GramsPerSecondPerSquareMeter => As(MassFluxUnit.GramPerSecondPerSquareMeter); - - /// - /// Get MassFlux in KilogramsPerSecondPerSquareMeter. - /// - public double KilogramsPerSecondPerSquareMeter => As(MassFluxUnit.KilogramPerSecondPerSquareMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. - /// - public static MassFlux Zero => new MassFlux(0, BaseUnit); - - /// - /// Get MassFlux from GramsPerSecondPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlux FromGramsPerSecondPerSquareMeter(double gramspersecondpersquaremeter) -#else - public static MassFlux FromGramsPerSecondPerSquareMeter(QuantityValue gramspersecondpersquaremeter) -#endif - { - double value = (double) gramspersecondpersquaremeter; - return new MassFlux(value, MassFluxUnit.GramPerSecondPerSquareMeter); - } - - /// - /// Get MassFlux from KilogramsPerSecondPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlux FromKilogramsPerSecondPerSquareMeter(double kilogramspersecondpersquaremeter) -#else - public static MassFlux FromKilogramsPerSecondPerSquareMeter(QuantityValue kilogramspersecondpersquaremeter) -#endif - { - double value = (double) kilogramspersecondpersquaremeter; - return new MassFlux(value, MassFluxUnit.KilogramPerSecondPerSquareMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MassFlux unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MassFlux From(double value, MassFluxUnit fromUnit) -#else - public static MassFlux From(QuantityValue value, MassFluxUnit fromUnit) -#endif - { - return new MassFlux((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassFluxUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); - - return CompareTo((MassFlux)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MassFlux other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MassFlux within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MassFlux. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MassFluxUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MassFlux to another MassFlux with the unit representation . - /// - /// A MassFlux with the specified unit. - public MassFlux ToUnit(MassFluxUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MassFlux(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MassFluxUnit.GramPerSecondPerSquareMeter: return _value/1e3; - case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (_value/1e3) * 1e3d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MassFluxUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MassFluxUnit.GramPerSecondPerSquareMeter: return baseUnitValue*1e3; - case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (baseUnitValue*1e3) / 1e3d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassFlux Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MassFlux result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFluxUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MassFluxUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MassFlux ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) - { - result = default(MassFlux); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MassFluxUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MassFluxUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassFluxUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassFluxUnit unit) - { - unit = MassFluxUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MassFluxUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MassFluxUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MassFlux - /// - public static MassFlux MaxValue => new MassFlux(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MassFlux - /// - public static MassFlux MinValue => new MassFlux(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MassFlux.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MassFlux.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs b/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs deleted file mode 100644 index 00650df202..0000000000 --- a/Common/GeneratedCode/Quantities/MassMomentOfInertia.Common.g.cs +++ /dev/null @@ -1,1131 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A property of body reflects how its mass is distributed with regard to an axis. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MassMomentOfInertia : IQuantity -#else - public partial struct MassMomentOfInertia : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MassMomentOfInertiaUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MassMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MassMomentOfInertia() - { - BaseDimensions = new BaseDimensions(2, 1, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MassMomentOfInertia(double numericValue, MassMomentOfInertiaUnit unit) - { - if(unit == MassMomentOfInertiaUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MassMomentOfInertia; - - /// - /// The base unit of MassMomentOfInertia, which is KilogramSquareMeter. All conversions go via this value. - /// - public static MassMomentOfInertiaUnit BaseUnit => MassMomentOfInertiaUnit.KilogramSquareMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MassMomentOfInertia quantity. - /// - public static MassMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(MassMomentOfInertiaUnit)).Cast().Except(new MassMomentOfInertiaUnit[]{ MassMomentOfInertiaUnit.Undefined }).ToArray(); - - /// - /// Get MassMomentOfInertia in GramSquareCentimeters. - /// - public double GramSquareCentimeters => As(MassMomentOfInertiaUnit.GramSquareCentimeter); - - /// - /// Get MassMomentOfInertia in GramSquareDecimeters. - /// - public double GramSquareDecimeters => As(MassMomentOfInertiaUnit.GramSquareDecimeter); - - /// - /// Get MassMomentOfInertia in GramSquareMeters. - /// - public double GramSquareMeters => As(MassMomentOfInertiaUnit.GramSquareMeter); - - /// - /// Get MassMomentOfInertia in GramSquareMillimeters. - /// - public double GramSquareMillimeters => As(MassMomentOfInertiaUnit.GramSquareMillimeter); - - /// - /// Get MassMomentOfInertia in KilogramSquareCentimeters. - /// - public double KilogramSquareCentimeters => As(MassMomentOfInertiaUnit.KilogramSquareCentimeter); - - /// - /// Get MassMomentOfInertia in KilogramSquareDecimeters. - /// - public double KilogramSquareDecimeters => As(MassMomentOfInertiaUnit.KilogramSquareDecimeter); - - /// - /// Get MassMomentOfInertia in KilogramSquareMeters. - /// - public double KilogramSquareMeters => As(MassMomentOfInertiaUnit.KilogramSquareMeter); - - /// - /// Get MassMomentOfInertia in KilogramSquareMillimeters. - /// - public double KilogramSquareMillimeters => As(MassMomentOfInertiaUnit.KilogramSquareMillimeter); - - /// - /// Get MassMomentOfInertia in KilotonneSquareCentimeters. - /// - public double KilotonneSquareCentimeters => As(MassMomentOfInertiaUnit.KilotonneSquareCentimeter); - - /// - /// Get MassMomentOfInertia in KilotonneSquareDecimeters. - /// - public double KilotonneSquareDecimeters => As(MassMomentOfInertiaUnit.KilotonneSquareDecimeter); - - /// - /// Get MassMomentOfInertia in KilotonneSquareMeters. - /// - public double KilotonneSquareMeters => As(MassMomentOfInertiaUnit.KilotonneSquareMeter); - - /// - /// Get MassMomentOfInertia in KilotonneSquareMilimeters. - /// - public double KilotonneSquareMilimeters => As(MassMomentOfInertiaUnit.KilotonneSquareMilimeter); - - /// - /// Get MassMomentOfInertia in MegatonneSquareCentimeters. - /// - public double MegatonneSquareCentimeters => As(MassMomentOfInertiaUnit.MegatonneSquareCentimeter); - - /// - /// Get MassMomentOfInertia in MegatonneSquareDecimeters. - /// - public double MegatonneSquareDecimeters => As(MassMomentOfInertiaUnit.MegatonneSquareDecimeter); - - /// - /// Get MassMomentOfInertia in MegatonneSquareMeters. - /// - public double MegatonneSquareMeters => As(MassMomentOfInertiaUnit.MegatonneSquareMeter); - - /// - /// Get MassMomentOfInertia in MegatonneSquareMilimeters. - /// - public double MegatonneSquareMilimeters => As(MassMomentOfInertiaUnit.MegatonneSquareMilimeter); - - /// - /// Get MassMomentOfInertia in MilligramSquareCentimeters. - /// - public double MilligramSquareCentimeters => As(MassMomentOfInertiaUnit.MilligramSquareCentimeter); - - /// - /// Get MassMomentOfInertia in MilligramSquareDecimeters. - /// - public double MilligramSquareDecimeters => As(MassMomentOfInertiaUnit.MilligramSquareDecimeter); - - /// - /// Get MassMomentOfInertia in MilligramSquareMeters. - /// - public double MilligramSquareMeters => As(MassMomentOfInertiaUnit.MilligramSquareMeter); - - /// - /// Get MassMomentOfInertia in MilligramSquareMillimeters. - /// - public double MilligramSquareMillimeters => As(MassMomentOfInertiaUnit.MilligramSquareMillimeter); - - /// - /// Get MassMomentOfInertia in PoundSquareFeet. - /// - public double PoundSquareFeet => As(MassMomentOfInertiaUnit.PoundSquareFoot); - - /// - /// Get MassMomentOfInertia in PoundSquareInches. - /// - public double PoundSquareInches => As(MassMomentOfInertiaUnit.PoundSquareInch); - - /// - /// Get MassMomentOfInertia in SlugSquareFeet. - /// - public double SlugSquareFeet => As(MassMomentOfInertiaUnit.SlugSquareFoot); - - /// - /// Get MassMomentOfInertia in SlugSquareInches. - /// - public double SlugSquareInches => As(MassMomentOfInertiaUnit.SlugSquareInch); - - /// - /// Get MassMomentOfInertia in TonneSquareCentimeters. - /// - public double TonneSquareCentimeters => As(MassMomentOfInertiaUnit.TonneSquareCentimeter); - - /// - /// Get MassMomentOfInertia in TonneSquareDecimeters. - /// - public double TonneSquareDecimeters => As(MassMomentOfInertiaUnit.TonneSquareDecimeter); - - /// - /// Get MassMomentOfInertia in TonneSquareMeters. - /// - public double TonneSquareMeters => As(MassMomentOfInertiaUnit.TonneSquareMeter); - - /// - /// Get MassMomentOfInertia in TonneSquareMilimeters. - /// - public double TonneSquareMilimeters => As(MassMomentOfInertiaUnit.TonneSquareMilimeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit KilogramSquareMeter. - /// - public static MassMomentOfInertia Zero => new MassMomentOfInertia(0, BaseUnit); - - /// - /// Get MassMomentOfInertia from GramSquareCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromGramSquareCentimeters(double gramsquarecentimeters) -#else - public static MassMomentOfInertia FromGramSquareCentimeters(QuantityValue gramsquarecentimeters) -#endif - { - double value = (double) gramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareCentimeter); - } - - /// - /// Get MassMomentOfInertia from GramSquareDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromGramSquareDecimeters(double gramsquaredecimeters) -#else - public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsquaredecimeters) -#endif - { - double value = (double) gramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareDecimeter); - } - - /// - /// Get MassMomentOfInertia from GramSquareMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromGramSquareMeters(double gramsquaremeters) -#else - public static MassMomentOfInertia FromGramSquareMeters(QuantityValue gramsquaremeters) -#endif - { - double value = (double) gramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMeter); - } - - /// - /// Get MassMomentOfInertia from GramSquareMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromGramSquareMillimeters(double gramsquaremillimeters) -#else - public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsquaremillimeters) -#endif - { - double value = (double) gramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMillimeter); - } - - /// - /// Get MassMomentOfInertia from KilogramSquareCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilogramSquareCentimeters(double kilogramsquarecentimeters) -#else - public static MassMomentOfInertia FromKilogramSquareCentimeters(QuantityValue kilogramsquarecentimeters) -#endif - { - double value = (double) kilogramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareCentimeter); - } - - /// - /// Get MassMomentOfInertia from KilogramSquareDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilogramSquareDecimeters(double kilogramsquaredecimeters) -#else - public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kilogramsquaredecimeters) -#endif - { - double value = (double) kilogramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareDecimeter); - } - - /// - /// Get MassMomentOfInertia from KilogramSquareMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilogramSquareMeters(double kilogramsquaremeters) -#else - public static MassMomentOfInertia FromKilogramSquareMeters(QuantityValue kilogramsquaremeters) -#endif - { - double value = (double) kilogramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMeter); - } - - /// - /// Get MassMomentOfInertia from KilogramSquareMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilogramSquareMillimeters(double kilogramsquaremillimeters) -#else - public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue kilogramsquaremillimeters) -#endif - { - double value = (double) kilogramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMillimeter); - } - - /// - /// Get MassMomentOfInertia from KilotonneSquareCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilotonneSquareCentimeters(double kilotonnesquarecentimeters) -#else - public static MassMomentOfInertia FromKilotonneSquareCentimeters(QuantityValue kilotonnesquarecentimeters) -#endif - { - double value = (double) kilotonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareCentimeter); - } - - /// - /// Get MassMomentOfInertia from KilotonneSquareDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilotonneSquareDecimeters(double kilotonnesquaredecimeters) -#else - public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue kilotonnesquaredecimeters) -#endif - { - double value = (double) kilotonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareDecimeter); - } - - /// - /// Get MassMomentOfInertia from KilotonneSquareMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilotonneSquareMeters(double kilotonnesquaremeters) -#else - public static MassMomentOfInertia FromKilotonneSquareMeters(QuantityValue kilotonnesquaremeters) -#endif - { - double value = (double) kilotonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMeter); - } - - /// - /// Get MassMomentOfInertia from KilotonneSquareMilimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromKilotonneSquareMilimeters(double kilotonnesquaremilimeters) -#else - public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue kilotonnesquaremilimeters) -#endif - { - double value = (double) kilotonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMilimeter); - } - - /// - /// Get MassMomentOfInertia from MegatonneSquareCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMegatonneSquareCentimeters(double megatonnesquarecentimeters) -#else - public static MassMomentOfInertia FromMegatonneSquareCentimeters(QuantityValue megatonnesquarecentimeters) -#endif - { - double value = (double) megatonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareCentimeter); - } - - /// - /// Get MassMomentOfInertia from MegatonneSquareDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMegatonneSquareDecimeters(double megatonnesquaredecimeters) -#else - public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue megatonnesquaredecimeters) -#endif - { - double value = (double) megatonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareDecimeter); - } - - /// - /// Get MassMomentOfInertia from MegatonneSquareMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMegatonneSquareMeters(double megatonnesquaremeters) -#else - public static MassMomentOfInertia FromMegatonneSquareMeters(QuantityValue megatonnesquaremeters) -#endif - { - double value = (double) megatonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMeter); - } - - /// - /// Get MassMomentOfInertia from MegatonneSquareMilimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMegatonneSquareMilimeters(double megatonnesquaremilimeters) -#else - public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue megatonnesquaremilimeters) -#endif - { - double value = (double) megatonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMilimeter); - } - - /// - /// Get MassMomentOfInertia from MilligramSquareCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMilligramSquareCentimeters(double milligramsquarecentimeters) -#else - public static MassMomentOfInertia FromMilligramSquareCentimeters(QuantityValue milligramsquarecentimeters) -#endif - { - double value = (double) milligramsquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareCentimeter); - } - - /// - /// Get MassMomentOfInertia from MilligramSquareDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMilligramSquareDecimeters(double milligramsquaredecimeters) -#else - public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue milligramsquaredecimeters) -#endif - { - double value = (double) milligramsquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareDecimeter); - } - - /// - /// Get MassMomentOfInertia from MilligramSquareMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMilligramSquareMeters(double milligramsquaremeters) -#else - public static MassMomentOfInertia FromMilligramSquareMeters(QuantityValue milligramsquaremeters) -#endif - { - double value = (double) milligramsquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMeter); - } - - /// - /// Get MassMomentOfInertia from MilligramSquareMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromMilligramSquareMillimeters(double milligramsquaremillimeters) -#else - public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue milligramsquaremillimeters) -#endif - { - double value = (double) milligramsquaremillimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMillimeter); - } - - /// - /// Get MassMomentOfInertia from PoundSquareFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromPoundSquareFeet(double poundsquarefeet) -#else - public static MassMomentOfInertia FromPoundSquareFeet(QuantityValue poundsquarefeet) -#endif - { - double value = (double) poundsquarefeet; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareFoot); - } - - /// - /// Get MassMomentOfInertia from PoundSquareInches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromPoundSquareInches(double poundsquareinches) -#else - public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquareinches) -#endif - { - double value = (double) poundsquareinches; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareInch); - } - - /// - /// Get MassMomentOfInertia from SlugSquareFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromSlugSquareFeet(double slugsquarefeet) -#else - public static MassMomentOfInertia FromSlugSquareFeet(QuantityValue slugsquarefeet) -#endif - { - double value = (double) slugsquarefeet; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareFoot); - } - - /// - /// Get MassMomentOfInertia from SlugSquareInches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromSlugSquareInches(double slugsquareinches) -#else - public static MassMomentOfInertia FromSlugSquareInches(QuantityValue slugsquareinches) -#endif - { - double value = (double) slugsquareinches; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareInch); - } - - /// - /// Get MassMomentOfInertia from TonneSquareCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromTonneSquareCentimeters(double tonnesquarecentimeters) -#else - public static MassMomentOfInertia FromTonneSquareCentimeters(QuantityValue tonnesquarecentimeters) -#endif - { - double value = (double) tonnesquarecentimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareCentimeter); - } - - /// - /// Get MassMomentOfInertia from TonneSquareDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromTonneSquareDecimeters(double tonnesquaredecimeters) -#else - public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnesquaredecimeters) -#endif - { - double value = (double) tonnesquaredecimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareDecimeter); - } - - /// - /// Get MassMomentOfInertia from TonneSquareMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromTonneSquareMeters(double tonnesquaremeters) -#else - public static MassMomentOfInertia FromTonneSquareMeters(QuantityValue tonnesquaremeters) -#endif - { - double value = (double) tonnesquaremeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMeter); - } - - /// - /// Get MassMomentOfInertia from TonneSquareMilimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassMomentOfInertia FromTonneSquareMilimeters(double tonnesquaremilimeters) -#else - public static MassMomentOfInertia FromTonneSquareMilimeters(QuantityValue tonnesquaremilimeters) -#endif - { - double value = (double) tonnesquaremilimeters; - return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMilimeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MassMomentOfInertia unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MassMomentOfInertia From(double value, MassMomentOfInertiaUnit fromUnit) -#else - public static MassMomentOfInertia From(QuantityValue value, MassMomentOfInertiaUnit fromUnit) -#endif - { - return new MassMomentOfInertia((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassMomentOfInertiaUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); - - return CompareTo((MassMomentOfInertia)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MassMomentOfInertia other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MassMomentOfInertia within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MassMomentOfInertia. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MassMomentOfInertiaUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MassMomentOfInertia to another MassMomentOfInertia with the unit representation . - /// - /// A MassMomentOfInertia with the specified unit. - public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MassMomentOfInertia(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MassMomentOfInertiaUnit.GramSquareCentimeter: return _value/1e7; - case MassMomentOfInertiaUnit.GramSquareDecimeter: return _value/1e5; - case MassMomentOfInertiaUnit.GramSquareMeter: return _value/1e3; - case MassMomentOfInertiaUnit.GramSquareMillimeter: return _value/1e9; - case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (_value/1e7) * 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (_value/1e5) * 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareMeter: return (_value/1e3) * 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (_value/1e9) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (_value/1e1) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (_value/1e-1) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (_value/1e-3) * 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (_value/1e3) * 1e3d; - case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (_value/1e1) * 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (_value/1e-1) * 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (_value/1e-3) * 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (_value/1e3) * 1e6d; - case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (_value/1e7) * 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (_value/1e5) * 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareMeter: return (_value/1e3) * 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (_value/1e9) * 1e-3d; - case MassMomentOfInertiaUnit.PoundSquareFoot: return _value*4.21401101e-2; - case MassMomentOfInertiaUnit.PoundSquareInch: return _value*2.9263965e-4; - case MassMomentOfInertiaUnit.SlugSquareFoot: return _value*1.3558179619; - case MassMomentOfInertiaUnit.SlugSquareInch: return _value*9.41540242e-3; - case MassMomentOfInertiaUnit.TonneSquareCentimeter: return _value/1e1; - case MassMomentOfInertiaUnit.TonneSquareDecimeter: return _value/1e-1; - case MassMomentOfInertiaUnit.TonneSquareMeter: return _value/1e-3; - case MassMomentOfInertiaUnit.TonneSquareMilimeter: return _value/1e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MassMomentOfInertiaUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MassMomentOfInertiaUnit.GramSquareCentimeter: return baseUnitValue*1e7; - case MassMomentOfInertiaUnit.GramSquareDecimeter: return baseUnitValue*1e5; - case MassMomentOfInertiaUnit.GramSquareMeter: return baseUnitValue*1e3; - case MassMomentOfInertiaUnit.GramSquareMillimeter: return baseUnitValue*1e9; - case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (baseUnitValue*1e7) / 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (baseUnitValue*1e5) / 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareMeter: return (baseUnitValue*1e3) / 1e3d; - case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (baseUnitValue*1e9) / 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (baseUnitValue*1e1) / 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (baseUnitValue*1e-1) / 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (baseUnitValue*1e-3) / 1e3d; - case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (baseUnitValue*1e3) / 1e3d; - case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (baseUnitValue*1e1) / 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (baseUnitValue*1e-1) / 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (baseUnitValue*1e-3) / 1e6d; - case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (baseUnitValue*1e3) / 1e6d; - case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (baseUnitValue*1e7) / 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (baseUnitValue*1e5) / 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareMeter: return (baseUnitValue*1e3) / 1e-3d; - case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (baseUnitValue*1e9) / 1e-3d; - case MassMomentOfInertiaUnit.PoundSquareFoot: return baseUnitValue/4.21401101e-2; - case MassMomentOfInertiaUnit.PoundSquareInch: return baseUnitValue/2.9263965e-4; - case MassMomentOfInertiaUnit.SlugSquareFoot: return baseUnitValue/1.3558179619; - case MassMomentOfInertiaUnit.SlugSquareInch: return baseUnitValue/9.41540242e-3; - case MassMomentOfInertiaUnit.TonneSquareCentimeter: return baseUnitValue*1e1; - case MassMomentOfInertiaUnit.TonneSquareDecimeter: return baseUnitValue*1e-1; - case MassMomentOfInertiaUnit.TonneSquareMeter: return baseUnitValue*1e-3; - case MassMomentOfInertiaUnit.TonneSquareMilimeter: return baseUnitValue*1e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassMomentOfInertia Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassMomentOfInertiaUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MassMomentOfInertiaUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MassMomentOfInertia ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) - { - result = default(MassMomentOfInertia); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MassMomentOfInertiaUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MassMomentOfInertiaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MassMomentOfInertiaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MassMomentOfInertiaUnit unit) - { - unit = MassMomentOfInertiaUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MassMomentOfInertiaUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MassMomentOfInertiaUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MassMomentOfInertia - /// - public static MassMomentOfInertia MaxValue => new MassMomentOfInertia(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MassMomentOfInertia - /// - public static MassMomentOfInertia MinValue => new MassMomentOfInertia(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MassMomentOfInertia.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MassMomentOfInertia.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs deleted file mode 100644 index c7976e833c..0000000000 --- a/Common/GeneratedCode/Quantities/MolarEnergy.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar energy is the amount of energy stored in 1 mole of a substance. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MolarEnergy : IQuantity -#else - public partial struct MolarEnergy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MolarEnergyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MolarEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MolarEnergy() - { - BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, -1, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MolarEnergy(double numericValue, MolarEnergyUnit unit) - { - if(unit == MolarEnergyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MolarEnergy; - - /// - /// The base unit of MolarEnergy, which is JoulePerMole. All conversions go via this value. - /// - public static MolarEnergyUnit BaseUnit => MolarEnergyUnit.JoulePerMole; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MolarEnergy quantity. - /// - public static MolarEnergyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEnergyUnit)).Cast().Except(new MolarEnergyUnit[]{ MolarEnergyUnit.Undefined }).ToArray(); - - /// - /// Get MolarEnergy in JoulesPerMole. - /// - public double JoulesPerMole => As(MolarEnergyUnit.JoulePerMole); - - /// - /// Get MolarEnergy in KilojoulesPerMole. - /// - public double KilojoulesPerMole => As(MolarEnergyUnit.KilojoulePerMole); - - /// - /// Get MolarEnergy in MegajoulesPerMole. - /// - public double MegajoulesPerMole => As(MolarEnergyUnit.MegajoulePerMole); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMole. - /// - public static MolarEnergy Zero => new MolarEnergy(0, BaseUnit); - - /// - /// Get MolarEnergy from JoulesPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarEnergy FromJoulesPerMole(double joulespermole) -#else - public static MolarEnergy FromJoulesPerMole(QuantityValue joulespermole) -#endif - { - double value = (double) joulespermole; - return new MolarEnergy(value, MolarEnergyUnit.JoulePerMole); - } - - /// - /// Get MolarEnergy from KilojoulesPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarEnergy FromKilojoulesPerMole(double kilojoulespermole) -#else - public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) -#endif - { - double value = (double) kilojoulespermole; - return new MolarEnergy(value, MolarEnergyUnit.KilojoulePerMole); - } - - /// - /// Get MolarEnergy from MegajoulesPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarEnergy FromMegajoulesPerMole(double megajoulespermole) -#else - public static MolarEnergy FromMegajoulesPerMole(QuantityValue megajoulespermole) -#endif - { - double value = (double) megajoulespermole; - return new MolarEnergy(value, MolarEnergyUnit.MegajoulePerMole); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MolarEnergy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MolarEnergy From(double value, MolarEnergyUnit fromUnit) -#else - public static MolarEnergy From(QuantityValue value, MolarEnergyUnit fromUnit) -#endif - { - return new MolarEnergy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarEnergyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); - - return CompareTo((MolarEnergy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MolarEnergy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MolarEnergy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MolarEnergy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MolarEnergyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MolarEnergy to another MolarEnergy with the unit representation . - /// - /// A MolarEnergy with the specified unit. - public MolarEnergy ToUnit(MolarEnergyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MolarEnergy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MolarEnergyUnit.JoulePerMole: return _value; - case MolarEnergyUnit.KilojoulePerMole: return (_value) * 1e3d; - case MolarEnergyUnit.MegajoulePerMole: return (_value) * 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MolarEnergyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MolarEnergyUnit.JoulePerMole: return baseUnitValue; - case MolarEnergyUnit.KilojoulePerMole: return (baseUnitValue) / 1e3d; - case MolarEnergyUnit.MegajoulePerMole: return (baseUnitValue) / 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarEnergy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MolarEnergy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEnergyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MolarEnergyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MolarEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) - { - result = default(MolarEnergy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MolarEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MolarEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEnergyUnit unit) - { - unit = MolarEnergyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MolarEnergyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MolarEnergyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MolarEnergy - /// - public static MolarEnergy MaxValue => new MolarEnergy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MolarEnergy - /// - public static MolarEnergy MinValue => new MolarEnergy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MolarEnergy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MolarEnergy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs deleted file mode 100644 index dfc6fdcff9..0000000000 --- a/Common/GeneratedCode/Quantities/MolarEntropy.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MolarEntropy : IQuantity -#else - public partial struct MolarEntropy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MolarEntropyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MolarEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MolarEntropy() - { - BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, -1, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MolarEntropy(double numericValue, MolarEntropyUnit unit) - { - if(unit == MolarEntropyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MolarEntropy; - - /// - /// The base unit of MolarEntropy, which is JoulePerMoleKelvin. All conversions go via this value. - /// - public static MolarEntropyUnit BaseUnit => MolarEntropyUnit.JoulePerMoleKelvin; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MolarEntropy quantity. - /// - public static MolarEntropyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEntropyUnit)).Cast().Except(new MolarEntropyUnit[]{ MolarEntropyUnit.Undefined }).ToArray(); - - /// - /// Get MolarEntropy in JoulesPerMoleKelvin. - /// - public double JoulesPerMoleKelvin => As(MolarEntropyUnit.JoulePerMoleKelvin); - - /// - /// Get MolarEntropy in KilojoulesPerMoleKelvin. - /// - public double KilojoulesPerMoleKelvin => As(MolarEntropyUnit.KilojoulePerMoleKelvin); - - /// - /// Get MolarEntropy in MegajoulesPerMoleKelvin. - /// - public double MegajoulesPerMoleKelvin => As(MolarEntropyUnit.MegajoulePerMoleKelvin); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMoleKelvin. - /// - public static MolarEntropy Zero => new MolarEntropy(0, BaseUnit); - - /// - /// Get MolarEntropy from JoulesPerMoleKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarEntropy FromJoulesPerMoleKelvin(double joulespermolekelvin) -#else - public static MolarEntropy FromJoulesPerMoleKelvin(QuantityValue joulespermolekelvin) -#endif - { - double value = (double) joulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.JoulePerMoleKelvin); - } - - /// - /// Get MolarEntropy from KilojoulesPerMoleKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarEntropy FromKilojoulesPerMoleKelvin(double kilojoulespermolekelvin) -#else - public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulespermolekelvin) -#endif - { - double value = (double) kilojoulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.KilojoulePerMoleKelvin); - } - - /// - /// Get MolarEntropy from MegajoulesPerMoleKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarEntropy FromMegajoulesPerMoleKelvin(double megajoulespermolekelvin) -#else - public static MolarEntropy FromMegajoulesPerMoleKelvin(QuantityValue megajoulespermolekelvin) -#endif - { - double value = (double) megajoulespermolekelvin; - return new MolarEntropy(value, MolarEntropyUnit.MegajoulePerMoleKelvin); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MolarEntropy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MolarEntropy From(double value, MolarEntropyUnit fromUnit) -#else - public static MolarEntropy From(QuantityValue value, MolarEntropyUnit fromUnit) -#endif - { - return new MolarEntropy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarEntropyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); - - return CompareTo((MolarEntropy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MolarEntropy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MolarEntropy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MolarEntropy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MolarEntropyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MolarEntropy to another MolarEntropy with the unit representation . - /// - /// A MolarEntropy with the specified unit. - public MolarEntropy ToUnit(MolarEntropyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MolarEntropy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MolarEntropyUnit.JoulePerMoleKelvin: return _value; - case MolarEntropyUnit.KilojoulePerMoleKelvin: return (_value) * 1e3d; - case MolarEntropyUnit.MegajoulePerMoleKelvin: return (_value) * 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MolarEntropyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MolarEntropyUnit.JoulePerMoleKelvin: return baseUnitValue; - case MolarEntropyUnit.KilojoulePerMoleKelvin: return (baseUnitValue) / 1e3d; - case MolarEntropyUnit.MegajoulePerMoleKelvin: return (baseUnitValue) / 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarEntropy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MolarEntropy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarEntropyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MolarEntropyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MolarEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) - { - result = default(MolarEntropy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MolarEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MolarEntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarEntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarEntropyUnit unit) - { - unit = MolarEntropyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MolarEntropyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MolarEntropyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MolarEntropy - /// - public static MolarEntropy MaxValue => new MolarEntropy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MolarEntropy - /// - public static MolarEntropy MinValue => new MolarEntropy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MolarEntropy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MolarEntropy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs b/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs deleted file mode 100644 index b4522ad436..0000000000 --- a/Common/GeneratedCode/Quantities/MolarMass.Common.g.cs +++ /dev/null @@ -1,779 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MolarMass : IQuantity -#else - public partial struct MolarMass : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MolarMassUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MolarMassUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MolarMass() - { - BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, -1, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - MolarMass(double numericValue, MolarMassUnit unit) - { - if(unit == MolarMassUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MolarMass; - - /// - /// The base unit of MolarMass, which is KilogramPerMole. All conversions go via this value. - /// - public static MolarMassUnit BaseUnit => MolarMassUnit.KilogramPerMole; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MolarMass quantity. - /// - public static MolarMassUnit[] Units { get; } = Enum.GetValues(typeof(MolarMassUnit)).Cast().Except(new MolarMassUnit[]{ MolarMassUnit.Undefined }).ToArray(); - - /// - /// Get MolarMass in CentigramsPerMole. - /// - public double CentigramsPerMole => As(MolarMassUnit.CentigramPerMole); - - /// - /// Get MolarMass in DecagramsPerMole. - /// - public double DecagramsPerMole => As(MolarMassUnit.DecagramPerMole); - - /// - /// Get MolarMass in DecigramsPerMole. - /// - public double DecigramsPerMole => As(MolarMassUnit.DecigramPerMole); - - /// - /// Get MolarMass in GramsPerMole. - /// - public double GramsPerMole => As(MolarMassUnit.GramPerMole); - - /// - /// Get MolarMass in HectogramsPerMole. - /// - public double HectogramsPerMole => As(MolarMassUnit.HectogramPerMole); - - /// - /// Get MolarMass in KilogramsPerMole. - /// - public double KilogramsPerMole => As(MolarMassUnit.KilogramPerMole); - - /// - /// Get MolarMass in KilopoundsPerMole. - /// - public double KilopoundsPerMole => As(MolarMassUnit.KilopoundPerMole); - - /// - /// Get MolarMass in MegapoundsPerMole. - /// - public double MegapoundsPerMole => As(MolarMassUnit.MegapoundPerMole); - - /// - /// Get MolarMass in MicrogramsPerMole. - /// - public double MicrogramsPerMole => As(MolarMassUnit.MicrogramPerMole); - - /// - /// Get MolarMass in MilligramsPerMole. - /// - public double MilligramsPerMole => As(MolarMassUnit.MilligramPerMole); - - /// - /// Get MolarMass in NanogramsPerMole. - /// - public double NanogramsPerMole => As(MolarMassUnit.NanogramPerMole); - - /// - /// Get MolarMass in PoundsPerMole. - /// - public double PoundsPerMole => As(MolarMassUnit.PoundPerMole); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMole. - /// - public static MolarMass Zero => new MolarMass(0, BaseUnit); - - /// - /// Get MolarMass from CentigramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromCentigramsPerMole(double centigramspermole) -#else - public static MolarMass FromCentigramsPerMole(QuantityValue centigramspermole) -#endif - { - double value = (double) centigramspermole; - return new MolarMass(value, MolarMassUnit.CentigramPerMole); - } - - /// - /// Get MolarMass from DecagramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromDecagramsPerMole(double decagramspermole) -#else - public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) -#endif - { - double value = (double) decagramspermole; - return new MolarMass(value, MolarMassUnit.DecagramPerMole); - } - - /// - /// Get MolarMass from DecigramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromDecigramsPerMole(double decigramspermole) -#else - public static MolarMass FromDecigramsPerMole(QuantityValue decigramspermole) -#endif - { - double value = (double) decigramspermole; - return new MolarMass(value, MolarMassUnit.DecigramPerMole); - } - - /// - /// Get MolarMass from GramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromGramsPerMole(double gramspermole) -#else - public static MolarMass FromGramsPerMole(QuantityValue gramspermole) -#endif - { - double value = (double) gramspermole; - return new MolarMass(value, MolarMassUnit.GramPerMole); - } - - /// - /// Get MolarMass from HectogramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromHectogramsPerMole(double hectogramspermole) -#else - public static MolarMass FromHectogramsPerMole(QuantityValue hectogramspermole) -#endif - { - double value = (double) hectogramspermole; - return new MolarMass(value, MolarMassUnit.HectogramPerMole); - } - - /// - /// Get MolarMass from KilogramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromKilogramsPerMole(double kilogramspermole) -#else - public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) -#endif - { - double value = (double) kilogramspermole; - return new MolarMass(value, MolarMassUnit.KilogramPerMole); - } - - /// - /// Get MolarMass from KilopoundsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromKilopoundsPerMole(double kilopoundspermole) -#else - public static MolarMass FromKilopoundsPerMole(QuantityValue kilopoundspermole) -#endif - { - double value = (double) kilopoundspermole; - return new MolarMass(value, MolarMassUnit.KilopoundPerMole); - } - - /// - /// Get MolarMass from MegapoundsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromMegapoundsPerMole(double megapoundspermole) -#else - public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) -#endif - { - double value = (double) megapoundspermole; - return new MolarMass(value, MolarMassUnit.MegapoundPerMole); - } - - /// - /// Get MolarMass from MicrogramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromMicrogramsPerMole(double microgramspermole) -#else - public static MolarMass FromMicrogramsPerMole(QuantityValue microgramspermole) -#endif - { - double value = (double) microgramspermole; - return new MolarMass(value, MolarMassUnit.MicrogramPerMole); - } - - /// - /// Get MolarMass from MilligramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromMilligramsPerMole(double milligramspermole) -#else - public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) -#endif - { - double value = (double) milligramspermole; - return new MolarMass(value, MolarMassUnit.MilligramPerMole); - } - - /// - /// Get MolarMass from NanogramsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromNanogramsPerMole(double nanogramspermole) -#else - public static MolarMass FromNanogramsPerMole(QuantityValue nanogramspermole) -#endif - { - double value = (double) nanogramspermole; - return new MolarMass(value, MolarMassUnit.NanogramPerMole); - } - - /// - /// Get MolarMass from PoundsPerMole. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MolarMass FromPoundsPerMole(double poundspermole) -#else - public static MolarMass FromPoundsPerMole(QuantityValue poundspermole) -#endif - { - double value = (double) poundspermole; - return new MolarMass(value, MolarMassUnit.PoundPerMole); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MolarMass unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MolarMass From(double value, MolarMassUnit fromUnit) -#else - public static MolarMass From(QuantityValue value, MolarMassUnit fromUnit) -#endif - { - return new MolarMass((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarMassUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); - - return CompareTo((MolarMass)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MolarMass other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MolarMass within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MolarMass. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MolarMassUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MolarMass to another MolarMass with the unit representation . - /// - /// A MolarMass with the specified unit. - public MolarMass ToUnit(MolarMassUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MolarMass(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MolarMassUnit.CentigramPerMole: return (_value/1e3) * 1e-2d; - case MolarMassUnit.DecagramPerMole: return (_value/1e3) * 1e1d; - case MolarMassUnit.DecigramPerMole: return (_value/1e3) * 1e-1d; - case MolarMassUnit.GramPerMole: return _value/1e3; - case MolarMassUnit.HectogramPerMole: return (_value/1e3) * 1e2d; - case MolarMassUnit.KilogramPerMole: return (_value/1e3) * 1e3d; - case MolarMassUnit.KilopoundPerMole: return (_value*0.45359237) * 1e3d; - case MolarMassUnit.MegapoundPerMole: return (_value*0.45359237) * 1e6d; - case MolarMassUnit.MicrogramPerMole: return (_value/1e3) * 1e-6d; - case MolarMassUnit.MilligramPerMole: return (_value/1e3) * 1e-3d; - case MolarMassUnit.NanogramPerMole: return (_value/1e3) * 1e-9d; - case MolarMassUnit.PoundPerMole: return _value*0.45359237; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MolarMassUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MolarMassUnit.CentigramPerMole: return (baseUnitValue*1e3) / 1e-2d; - case MolarMassUnit.DecagramPerMole: return (baseUnitValue*1e3) / 1e1d; - case MolarMassUnit.DecigramPerMole: return (baseUnitValue*1e3) / 1e-1d; - case MolarMassUnit.GramPerMole: return baseUnitValue*1e3; - case MolarMassUnit.HectogramPerMole: return (baseUnitValue*1e3) / 1e2d; - case MolarMassUnit.KilogramPerMole: return (baseUnitValue*1e3) / 1e3d; - case MolarMassUnit.KilopoundPerMole: return (baseUnitValue/0.45359237) / 1e3d; - case MolarMassUnit.MegapoundPerMole: return (baseUnitValue/0.45359237) / 1e6d; - case MolarMassUnit.MicrogramPerMole: return (baseUnitValue*1e3) / 1e-6d; - case MolarMassUnit.MilligramPerMole: return (baseUnitValue*1e3) / 1e-3d; - case MolarMassUnit.NanogramPerMole: return (baseUnitValue*1e3) / 1e-9d; - case MolarMassUnit.PoundPerMole: return baseUnitValue/0.45359237; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MolarMass Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MolarMass result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarMassUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MolarMassUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static MolarMass ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) - { - result = default(MolarMass); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MolarMassUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MolarMassUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarMassUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarMassUnit unit) - { - unit = MolarMassUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MolarMassUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MolarMassUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MolarMass - /// - public static MolarMass MaxValue => new MolarMass(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MolarMass - /// - public static MolarMass MinValue => new MolarMass(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MolarMass.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MolarMass.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs b/Common/GeneratedCode/Quantities/Molarity.Common.g.cs deleted file mode 100644 index a433111a73..0000000000 --- a/Common/GeneratedCode/Quantities/Molarity.Common.g.cs +++ /dev/null @@ -1,691 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Molar concentration, also called molarity, amount concentration or substance concentration, is a measure of the concentration of a solute in a solution, or of any chemical species, in terms of amount of substance in a given volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Molarity : IQuantity -#else - public partial struct Molarity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MolarityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MolarityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Molarity() - { - BaseDimensions = new BaseDimensions(-3, 0, 0, 0, 0, 1, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Molarity(double numericValue, MolarityUnit unit) - { - if(unit == MolarityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Molarity; - - /// - /// The base unit of Molarity, which is MolesPerCubicMeter. All conversions go via this value. - /// - public static MolarityUnit BaseUnit => MolarityUnit.MolesPerCubicMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Molarity quantity. - /// - public static MolarityUnit[] Units { get; } = Enum.GetValues(typeof(MolarityUnit)).Cast().Except(new MolarityUnit[]{ MolarityUnit.Undefined }).ToArray(); - - /// - /// Get Molarity in CentimolesPerLiter. - /// - public double CentimolesPerLiter => As(MolarityUnit.CentimolesPerLiter); - - /// - /// Get Molarity in DecimolesPerLiter. - /// - public double DecimolesPerLiter => As(MolarityUnit.DecimolesPerLiter); - - /// - /// Get Molarity in MicromolesPerLiter. - /// - public double MicromolesPerLiter => As(MolarityUnit.MicromolesPerLiter); - - /// - /// Get Molarity in MillimolesPerLiter. - /// - public double MillimolesPerLiter => As(MolarityUnit.MillimolesPerLiter); - - /// - /// Get Molarity in MolesPerCubicMeter. - /// - public double MolesPerCubicMeter => As(MolarityUnit.MolesPerCubicMeter); - - /// - /// Get Molarity in MolesPerLiter. - /// - public double MolesPerLiter => As(MolarityUnit.MolesPerLiter); - - /// - /// Get Molarity in NanomolesPerLiter. - /// - public double NanomolesPerLiter => As(MolarityUnit.NanomolesPerLiter); - - /// - /// Get Molarity in PicomolesPerLiter. - /// - public double PicomolesPerLiter => As(MolarityUnit.PicomolesPerLiter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit MolesPerCubicMeter. - /// - public static Molarity Zero => new Molarity(0, BaseUnit); - - /// - /// Get Molarity from CentimolesPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromCentimolesPerLiter(double centimolesperliter) -#else - public static Molarity FromCentimolesPerLiter(QuantityValue centimolesperliter) -#endif - { - double value = (double) centimolesperliter; - return new Molarity(value, MolarityUnit.CentimolesPerLiter); - } - - /// - /// Get Molarity from DecimolesPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromDecimolesPerLiter(double decimolesperliter) -#else - public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) -#endif - { - double value = (double) decimolesperliter; - return new Molarity(value, MolarityUnit.DecimolesPerLiter); - } - - /// - /// Get Molarity from MicromolesPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromMicromolesPerLiter(double micromolesperliter) -#else - public static Molarity FromMicromolesPerLiter(QuantityValue micromolesperliter) -#endif - { - double value = (double) micromolesperliter; - return new Molarity(value, MolarityUnit.MicromolesPerLiter); - } - - /// - /// Get Molarity from MillimolesPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromMillimolesPerLiter(double millimolesperliter) -#else - public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) -#endif - { - double value = (double) millimolesperliter; - return new Molarity(value, MolarityUnit.MillimolesPerLiter); - } - - /// - /// Get Molarity from MolesPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromMolesPerCubicMeter(double molespercubicmeter) -#else - public static Molarity FromMolesPerCubicMeter(QuantityValue molespercubicmeter) -#endif - { - double value = (double) molespercubicmeter; - return new Molarity(value, MolarityUnit.MolesPerCubicMeter); - } - - /// - /// Get Molarity from MolesPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromMolesPerLiter(double molesperliter) -#else - public static Molarity FromMolesPerLiter(QuantityValue molesperliter) -#endif - { - double value = (double) molesperliter; - return new Molarity(value, MolarityUnit.MolesPerLiter); - } - - /// - /// Get Molarity from NanomolesPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromNanomolesPerLiter(double nanomolesperliter) -#else - public static Molarity FromNanomolesPerLiter(QuantityValue nanomolesperliter) -#endif - { - double value = (double) nanomolesperliter; - return new Molarity(value, MolarityUnit.NanomolesPerLiter); - } - - /// - /// Get Molarity from PicomolesPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Molarity FromPicomolesPerLiter(double picomolesperliter) -#else - public static Molarity FromPicomolesPerLiter(QuantityValue picomolesperliter) -#endif - { - double value = (double) picomolesperliter; - return new Molarity(value, MolarityUnit.PicomolesPerLiter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Molarity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Molarity From(double value, MolarityUnit fromUnit) -#else - public static Molarity From(QuantityValue value, MolarityUnit fromUnit) -#endif - { - return new Molarity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MolarityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Molarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); - - return CompareTo((Molarity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Molarity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Molarity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Molarity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MolarityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Molarity to another Molarity with the unit representation . - /// - /// A Molarity with the specified unit. - public Molarity ToUnit(MolarityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Molarity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MolarityUnit.CentimolesPerLiter: return (_value/1e-3) * 1e-2d; - case MolarityUnit.DecimolesPerLiter: return (_value/1e-3) * 1e-1d; - case MolarityUnit.MicromolesPerLiter: return (_value/1e-3) * 1e-6d; - case MolarityUnit.MillimolesPerLiter: return (_value/1e-3) * 1e-3d; - case MolarityUnit.MolesPerCubicMeter: return _value; - case MolarityUnit.MolesPerLiter: return _value/1e-3; - case MolarityUnit.NanomolesPerLiter: return (_value/1e-3) * 1e-9d; - case MolarityUnit.PicomolesPerLiter: return (_value/1e-3) * 1e-12d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MolarityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MolarityUnit.CentimolesPerLiter: return (baseUnitValue*1e-3) / 1e-2d; - case MolarityUnit.DecimolesPerLiter: return (baseUnitValue*1e-3) / 1e-1d; - case MolarityUnit.MicromolesPerLiter: return (baseUnitValue*1e-3) / 1e-6d; - case MolarityUnit.MillimolesPerLiter: return (baseUnitValue*1e-3) / 1e-3d; - case MolarityUnit.MolesPerCubicMeter: return baseUnitValue; - case MolarityUnit.MolesPerLiter: return baseUnitValue*1e-3; - case MolarityUnit.NanomolesPerLiter: return (baseUnitValue*1e-3) / 1e-9d; - case MolarityUnit.PicomolesPerLiter: return (baseUnitValue*1e-3) / 1e-12d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Molarity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Molarity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MolarityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out MolarityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Molarity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) - { - result = default(Molarity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static MolarityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == MolarityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized MolarityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out MolarityUnit unit) - { - unit = MolarityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == MolarityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MolarityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Molarity - /// - public static Molarity MaxValue => new Molarity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Molarity - /// - public static Molarity MinValue => new Molarity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Molarity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Molarity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs b/Common/GeneratedCode/Quantities/Permeability.Common.g.cs deleted file mode 100644 index b04f222029..0000000000 --- a/Common/GeneratedCode/Quantities/Permeability.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, permeability is the measure of the ability of a material to support the formation of a magnetic field within itself. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Permeability : IQuantity -#else - public partial struct Permeability : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly PermeabilityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public PermeabilityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Permeability() - { - BaseDimensions = new BaseDimensions(1, 1, -2, -2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Permeability(double numericValue, PermeabilityUnit unit) - { - if(unit == PermeabilityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Permeability; - - /// - /// The base unit of Permeability, which is HenryPerMeter. All conversions go via this value. - /// - public static PermeabilityUnit BaseUnit => PermeabilityUnit.HenryPerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Permeability quantity. - /// - public static PermeabilityUnit[] Units { get; } = Enum.GetValues(typeof(PermeabilityUnit)).Cast().Except(new PermeabilityUnit[]{ PermeabilityUnit.Undefined }).ToArray(); - - /// - /// Get Permeability in HenriesPerMeter. - /// - public double HenriesPerMeter => As(PermeabilityUnit.HenryPerMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit HenryPerMeter. - /// - public static Permeability Zero => new Permeability(0, BaseUnit); - - /// - /// Get Permeability from HenriesPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Permeability FromHenriesPerMeter(double henriespermeter) -#else - public static Permeability FromHenriesPerMeter(QuantityValue henriespermeter) -#endif - { - double value = (double) henriespermeter; - return new Permeability(value, PermeabilityUnit.HenryPerMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Permeability unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Permeability From(double value, PermeabilityUnit fromUnit) -#else - public static Permeability From(QuantityValue value, PermeabilityUnit fromUnit) -#endif - { - return new Permeability((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PermeabilityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); - - return CompareTo((Permeability)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Permeability other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Permeability within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Permeability. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(PermeabilityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Permeability to another Permeability with the unit representation . - /// - /// A Permeability with the specified unit. - public Permeability ToUnit(PermeabilityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Permeability(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case PermeabilityUnit.HenryPerMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(PermeabilityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case PermeabilityUnit.HenryPerMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Permeability Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Permeability result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermeabilityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out PermeabilityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Permeability ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) - { - result = default(Permeability); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static PermeabilityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == PermeabilityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermeabilityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermeabilityUnit unit) - { - unit = PermeabilityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == PermeabilityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(PermeabilityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Permeability - /// - public static Permeability MaxValue => new Permeability(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Permeability - /// - public static Permeability MinValue => new Permeability(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Permeability.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Permeability.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs b/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs deleted file mode 100644 index 3fb2bd490f..0000000000 --- a/Common/GeneratedCode/Quantities/Permittivity.Common.g.cs +++ /dev/null @@ -1,537 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In electromagnetism, permittivity is the measure of resistance that is encountered when forming an electric field in a particular medium. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Permittivity : IQuantity -#else - public partial struct Permittivity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly PermittivityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public PermittivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Permittivity() - { - BaseDimensions = new BaseDimensions(-3, -1, 4, 2, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Permittivity(double numericValue, PermittivityUnit unit) - { - if(unit == PermittivityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Permittivity; - - /// - /// The base unit of Permittivity, which is FaradPerMeter. All conversions go via this value. - /// - public static PermittivityUnit BaseUnit => PermittivityUnit.FaradPerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Permittivity quantity. - /// - public static PermittivityUnit[] Units { get; } = Enum.GetValues(typeof(PermittivityUnit)).Cast().Except(new PermittivityUnit[]{ PermittivityUnit.Undefined }).ToArray(); - - /// - /// Get Permittivity in FaradsPerMeter. - /// - public double FaradsPerMeter => As(PermittivityUnit.FaradPerMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit FaradPerMeter. - /// - public static Permittivity Zero => new Permittivity(0, BaseUnit); - - /// - /// Get Permittivity from FaradsPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Permittivity FromFaradsPerMeter(double faradspermeter) -#else - public static Permittivity FromFaradsPerMeter(QuantityValue faradspermeter) -#endif - { - double value = (double) faradspermeter; - return new Permittivity(value, PermittivityUnit.FaradPerMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Permittivity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Permittivity From(double value, PermittivityUnit fromUnit) -#else - public static Permittivity From(QuantityValue value, PermittivityUnit fromUnit) -#endif - { - return new Permittivity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PermittivityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); - - return CompareTo((Permittivity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Permittivity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Permittivity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Permittivity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(PermittivityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Permittivity to another Permittivity with the unit representation . - /// - /// A Permittivity with the specified unit. - public Permittivity ToUnit(PermittivityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Permittivity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case PermittivityUnit.FaradPerMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(PermittivityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case PermittivityUnit.FaradPerMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Permittivity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Permittivity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PermittivityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out PermittivityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Permittivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) - { - result = default(Permittivity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static PermittivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == PermittivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PermittivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PermittivityUnit unit) - { - unit = PermittivityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == PermittivityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(PermittivityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Permittivity - /// - public static Permittivity MaxValue => new Permittivity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Permittivity - /// - public static Permittivity MinValue => new Permittivity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Permittivity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Permittivity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Power.Common.g.cs b/Common/GeneratedCode/Quantities/Power.Common.g.cs deleted file mode 100644 index 03c8a5e79e..0000000000 --- a/Common/GeneratedCode/Quantities/Power.Common.g.cs +++ /dev/null @@ -1,955 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Power : IQuantity -#else - public partial struct Power : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly decimal _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly PowerUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public PowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Power() - { - BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Power(decimal numericValue, PowerUnit unit) - { - if(unit == PowerUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = numericValue; - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Power; - - /// - /// The base unit of Power, which is Watt. All conversions go via this value. - /// - public static PowerUnit BaseUnit => PowerUnit.Watt; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Power quantity. - /// - public static PowerUnit[] Units { get; } = Enum.GetValues(typeof(PowerUnit)).Cast().Except(new PowerUnit[]{ PowerUnit.Undefined }).ToArray(); - - /// - /// Get Power in BoilerHorsepower. - /// - public double BoilerHorsepower => As(PowerUnit.BoilerHorsepower); - - /// - /// Get Power in BritishThermalUnitsPerHour. - /// - public double BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour); - - /// - /// Get Power in Decawatts. - /// - public double Decawatts => As(PowerUnit.Decawatt); - - /// - /// Get Power in Deciwatts. - /// - public double Deciwatts => As(PowerUnit.Deciwatt); - - /// - /// Get Power in ElectricalHorsepower. - /// - public double ElectricalHorsepower => As(PowerUnit.ElectricalHorsepower); - - /// - /// Get Power in Femtowatts. - /// - public double Femtowatts => As(PowerUnit.Femtowatt); - - /// - /// Get Power in Gigawatts. - /// - public double Gigawatts => As(PowerUnit.Gigawatt); - - /// - /// Get Power in HydraulicHorsepower. - /// - public double HydraulicHorsepower => As(PowerUnit.HydraulicHorsepower); - - /// - /// Get Power in KilobritishThermalUnitsPerHour. - /// - public double KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour); - - /// - /// Get Power in Kilowatts. - /// - public double Kilowatts => As(PowerUnit.Kilowatt); - - /// - /// Get Power in MechanicalHorsepower. - /// - public double MechanicalHorsepower => As(PowerUnit.MechanicalHorsepower); - - /// - /// Get Power in Megawatts. - /// - public double Megawatts => As(PowerUnit.Megawatt); - - /// - /// Get Power in MetricHorsepower. - /// - public double MetricHorsepower => As(PowerUnit.MetricHorsepower); - - /// - /// Get Power in Microwatts. - /// - public double Microwatts => As(PowerUnit.Microwatt); - - /// - /// Get Power in Milliwatts. - /// - public double Milliwatts => As(PowerUnit.Milliwatt); - - /// - /// Get Power in Nanowatts. - /// - public double Nanowatts => As(PowerUnit.Nanowatt); - - /// - /// Get Power in Petawatts. - /// - public double Petawatts => As(PowerUnit.Petawatt); - - /// - /// Get Power in Picowatts. - /// - public double Picowatts => As(PowerUnit.Picowatt); - - /// - /// Get Power in Terawatts. - /// - public double Terawatts => As(PowerUnit.Terawatt); - - /// - /// Get Power in Watts. - /// - public double Watts => As(PowerUnit.Watt); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Watt. - /// - public static Power Zero => new Power(0, BaseUnit); - - /// - /// Get Power from BoilerHorsepower. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromBoilerHorsepower(double boilerhorsepower) -#else - public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) -#endif - { - decimal value = (decimal) boilerhorsepower; - return new Power(value, PowerUnit.BoilerHorsepower); - } - - /// - /// Get Power from BritishThermalUnitsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromBritishThermalUnitsPerHour(double britishthermalunitsperhour) -#else - public static Power FromBritishThermalUnitsPerHour(QuantityValue britishthermalunitsperhour) -#endif - { - decimal value = (decimal) britishthermalunitsperhour; - return new Power(value, PowerUnit.BritishThermalUnitPerHour); - } - - /// - /// Get Power from Decawatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromDecawatts(double decawatts) -#else - public static Power FromDecawatts(QuantityValue decawatts) -#endif - { - decimal value = (decimal) decawatts; - return new Power(value, PowerUnit.Decawatt); - } - - /// - /// Get Power from Deciwatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromDeciwatts(double deciwatts) -#else - public static Power FromDeciwatts(QuantityValue deciwatts) -#endif - { - decimal value = (decimal) deciwatts; - return new Power(value, PowerUnit.Deciwatt); - } - - /// - /// Get Power from ElectricalHorsepower. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromElectricalHorsepower(double electricalhorsepower) -#else - public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) -#endif - { - decimal value = (decimal) electricalhorsepower; - return new Power(value, PowerUnit.ElectricalHorsepower); - } - - /// - /// Get Power from Femtowatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromFemtowatts(double femtowatts) -#else - public static Power FromFemtowatts(QuantityValue femtowatts) -#endif - { - decimal value = (decimal) femtowatts; - return new Power(value, PowerUnit.Femtowatt); - } - - /// - /// Get Power from Gigawatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromGigawatts(double gigawatts) -#else - public static Power FromGigawatts(QuantityValue gigawatts) -#endif - { - decimal value = (decimal) gigawatts; - return new Power(value, PowerUnit.Gigawatt); - } - - /// - /// Get Power from HydraulicHorsepower. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromHydraulicHorsepower(double hydraulichorsepower) -#else - public static Power FromHydraulicHorsepower(QuantityValue hydraulichorsepower) -#endif - { - decimal value = (decimal) hydraulichorsepower; - return new Power(value, PowerUnit.HydraulicHorsepower); - } - - /// - /// Get Power from KilobritishThermalUnitsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromKilobritishThermalUnitsPerHour(double kilobritishthermalunitsperhour) -#else - public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritishthermalunitsperhour) -#endif - { - decimal value = (decimal) kilobritishthermalunitsperhour; - return new Power(value, PowerUnit.KilobritishThermalUnitPerHour); - } - - /// - /// Get Power from Kilowatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromKilowatts(double kilowatts) -#else - public static Power FromKilowatts(QuantityValue kilowatts) -#endif - { - decimal value = (decimal) kilowatts; - return new Power(value, PowerUnit.Kilowatt); - } - - /// - /// Get Power from MechanicalHorsepower. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromMechanicalHorsepower(double mechanicalhorsepower) -#else - public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) -#endif - { - decimal value = (decimal) mechanicalhorsepower; - return new Power(value, PowerUnit.MechanicalHorsepower); - } - - /// - /// Get Power from Megawatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromMegawatts(double megawatts) -#else - public static Power FromMegawatts(QuantityValue megawatts) -#endif - { - decimal value = (decimal) megawatts; - return new Power(value, PowerUnit.Megawatt); - } - - /// - /// Get Power from MetricHorsepower. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromMetricHorsepower(double metrichorsepower) -#else - public static Power FromMetricHorsepower(QuantityValue metrichorsepower) -#endif - { - decimal value = (decimal) metrichorsepower; - return new Power(value, PowerUnit.MetricHorsepower); - } - - /// - /// Get Power from Microwatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromMicrowatts(double microwatts) -#else - public static Power FromMicrowatts(QuantityValue microwatts) -#endif - { - decimal value = (decimal) microwatts; - return new Power(value, PowerUnit.Microwatt); - } - - /// - /// Get Power from Milliwatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromMilliwatts(double milliwatts) -#else - public static Power FromMilliwatts(QuantityValue milliwatts) -#endif - { - decimal value = (decimal) milliwatts; - return new Power(value, PowerUnit.Milliwatt); - } - - /// - /// Get Power from Nanowatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromNanowatts(double nanowatts) -#else - public static Power FromNanowatts(QuantityValue nanowatts) -#endif - { - decimal value = (decimal) nanowatts; - return new Power(value, PowerUnit.Nanowatt); - } - - /// - /// Get Power from Petawatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromPetawatts(double petawatts) -#else - public static Power FromPetawatts(QuantityValue petawatts) -#endif - { - decimal value = (decimal) petawatts; - return new Power(value, PowerUnit.Petawatt); - } - - /// - /// Get Power from Picowatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromPicowatts(double picowatts) -#else - public static Power FromPicowatts(QuantityValue picowatts) -#endif - { - decimal value = (decimal) picowatts; - return new Power(value, PowerUnit.Picowatt); - } - - /// - /// Get Power from Terawatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromTerawatts(double terawatts) -#else - public static Power FromTerawatts(QuantityValue terawatts) -#endif - { - decimal value = (decimal) terawatts; - return new Power(value, PowerUnit.Terawatt); - } - - /// - /// Get Power from Watts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Power FromWatts(double watts) -#else - public static Power FromWatts(QuantityValue watts) -#endif - { - decimal value = (decimal) watts; - return new Power(value, PowerUnit.Watt); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Power unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Power From(double value, PowerUnit fromUnit) -#else - public static Power From(QuantityValue value, PowerUnit fromUnit) -#endif - { - return new Power((decimal)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Power)) throw new ArgumentException("Expected type Power.", nameof(obj)); - - return CompareTo((Power)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Power other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Power within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Power other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Power. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(PowerUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Power to another Power with the unit representation . - /// - /// A Power with the specified unit. - public Power ToUnit(PowerUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Power(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private decimal AsBaseUnit() - { - switch(Unit) - { - case PowerUnit.BoilerHorsepower: return _value*9812.5m; - case PowerUnit.BritishThermalUnitPerHour: return _value*0.293071m; - case PowerUnit.Decawatt: return (_value) * 1e1m; - case PowerUnit.Deciwatt: return (_value) * 1e-1m; - case PowerUnit.ElectricalHorsepower: return _value*746m; - case PowerUnit.Femtowatt: return (_value) * 1e-15m; - case PowerUnit.Gigawatt: return (_value) * 1e9m; - case PowerUnit.HydraulicHorsepower: return _value*745.69988145m; - case PowerUnit.KilobritishThermalUnitPerHour: return (_value*0.293071m) * 1e3m; - case PowerUnit.Kilowatt: return (_value) * 1e3m; - case PowerUnit.MechanicalHorsepower: return _value*745.69m; - case PowerUnit.Megawatt: return (_value) * 1e6m; - case PowerUnit.MetricHorsepower: return _value*735.49875m; - case PowerUnit.Microwatt: return (_value) * 1e-6m; - case PowerUnit.Milliwatt: return (_value) * 1e-3m; - case PowerUnit.Nanowatt: return (_value) * 1e-9m; - case PowerUnit.Petawatt: return (_value) * 1e15m; - case PowerUnit.Picowatt: return (_value) * 1e-12m; - case PowerUnit.Terawatt: return (_value) * 1e12m; - case PowerUnit.Watt: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private decimal AsBaseNumericType(PowerUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case PowerUnit.BoilerHorsepower: return baseUnitValue/9812.5m; - case PowerUnit.BritishThermalUnitPerHour: return baseUnitValue/0.293071m; - case PowerUnit.Decawatt: return (baseUnitValue) / 1e1m; - case PowerUnit.Deciwatt: return (baseUnitValue) / 1e-1m; - case PowerUnit.ElectricalHorsepower: return baseUnitValue/746m; - case PowerUnit.Femtowatt: return (baseUnitValue) / 1e-15m; - case PowerUnit.Gigawatt: return (baseUnitValue) / 1e9m; - case PowerUnit.HydraulicHorsepower: return baseUnitValue/745.69988145m; - case PowerUnit.KilobritishThermalUnitPerHour: return (baseUnitValue/0.293071m) / 1e3m; - case PowerUnit.Kilowatt: return (baseUnitValue) / 1e3m; - case PowerUnit.MechanicalHorsepower: return baseUnitValue/745.69m; - case PowerUnit.Megawatt: return (baseUnitValue) / 1e6m; - case PowerUnit.MetricHorsepower: return baseUnitValue/735.49875m; - case PowerUnit.Microwatt: return (baseUnitValue) / 1e-6m; - case PowerUnit.Milliwatt: return (baseUnitValue) / 1e-3m; - case PowerUnit.Nanowatt: return (baseUnitValue) / 1e-9m; - case PowerUnit.Petawatt: return (baseUnitValue) / 1e15m; - case PowerUnit.Picowatt: return (baseUnitValue) / 1e-12m; - case PowerUnit.Terawatt: return (baseUnitValue) / 1e12m; - case PowerUnit.Watt: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Power Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Power result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out PowerUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Power ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) - { - result = default(Power); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static PowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == PowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerUnit unit) - { - unit = PowerUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == PowerUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(PowerUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Power - /// - public static Power MaxValue => new Power(decimal.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Power - /// - public static Power MinValue => new Power(decimal.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Power.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Power.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs b/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs deleted file mode 100644 index 8ec46a9658..0000000000 --- a/Common/GeneratedCode/Quantities/PowerDensity.Common.g.cs +++ /dev/null @@ -1,1483 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The amount of power in a volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class PowerDensity : IQuantity -#else - public partial struct PowerDensity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly PowerDensityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public PowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static PowerDensity() - { - BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - PowerDensity(double numericValue, PowerDensityUnit unit) - { - if(unit == PowerDensityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.PowerDensity; - - /// - /// The base unit of PowerDensity, which is WattPerCubicMeter. All conversions go via this value. - /// - public static PowerDensityUnit BaseUnit => PowerDensityUnit.WattPerCubicMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the PowerDensity quantity. - /// - public static PowerDensityUnit[] Units { get; } = Enum.GetValues(typeof(PowerDensityUnit)).Cast().Except(new PowerDensityUnit[]{ PowerDensityUnit.Undefined }).ToArray(); - - /// - /// Get PowerDensity in DecawattsPerCubicFoot. - /// - public double DecawattsPerCubicFoot => As(PowerDensityUnit.DecawattPerCubicFoot); - - /// - /// Get PowerDensity in DecawattsPerCubicInch. - /// - public double DecawattsPerCubicInch => As(PowerDensityUnit.DecawattPerCubicInch); - - /// - /// Get PowerDensity in DecawattsPerCubicMeter. - /// - public double DecawattsPerCubicMeter => As(PowerDensityUnit.DecawattPerCubicMeter); - - /// - /// Get PowerDensity in DecawattsPerLiter. - /// - public double DecawattsPerLiter => As(PowerDensityUnit.DecawattPerLiter); - - /// - /// Get PowerDensity in DeciwattsPerCubicFoot. - /// - public double DeciwattsPerCubicFoot => As(PowerDensityUnit.DeciwattPerCubicFoot); - - /// - /// Get PowerDensity in DeciwattsPerCubicInch. - /// - public double DeciwattsPerCubicInch => As(PowerDensityUnit.DeciwattPerCubicInch); - - /// - /// Get PowerDensity in DeciwattsPerCubicMeter. - /// - public double DeciwattsPerCubicMeter => As(PowerDensityUnit.DeciwattPerCubicMeter); - - /// - /// Get PowerDensity in DeciwattsPerLiter. - /// - public double DeciwattsPerLiter => As(PowerDensityUnit.DeciwattPerLiter); - - /// - /// Get PowerDensity in GigawattsPerCubicFoot. - /// - public double GigawattsPerCubicFoot => As(PowerDensityUnit.GigawattPerCubicFoot); - - /// - /// Get PowerDensity in GigawattsPerCubicInch. - /// - public double GigawattsPerCubicInch => As(PowerDensityUnit.GigawattPerCubicInch); - - /// - /// Get PowerDensity in GigawattsPerCubicMeter. - /// - public double GigawattsPerCubicMeter => As(PowerDensityUnit.GigawattPerCubicMeter); - - /// - /// Get PowerDensity in GigawattsPerLiter. - /// - public double GigawattsPerLiter => As(PowerDensityUnit.GigawattPerLiter); - - /// - /// Get PowerDensity in KilowattsPerCubicFoot. - /// - public double KilowattsPerCubicFoot => As(PowerDensityUnit.KilowattPerCubicFoot); - - /// - /// Get PowerDensity in KilowattsPerCubicInch. - /// - public double KilowattsPerCubicInch => As(PowerDensityUnit.KilowattPerCubicInch); - - /// - /// Get PowerDensity in KilowattsPerCubicMeter. - /// - public double KilowattsPerCubicMeter => As(PowerDensityUnit.KilowattPerCubicMeter); - - /// - /// Get PowerDensity in KilowattsPerLiter. - /// - public double KilowattsPerLiter => As(PowerDensityUnit.KilowattPerLiter); - - /// - /// Get PowerDensity in MegawattsPerCubicFoot. - /// - public double MegawattsPerCubicFoot => As(PowerDensityUnit.MegawattPerCubicFoot); - - /// - /// Get PowerDensity in MegawattsPerCubicInch. - /// - public double MegawattsPerCubicInch => As(PowerDensityUnit.MegawattPerCubicInch); - - /// - /// Get PowerDensity in MegawattsPerCubicMeter. - /// - public double MegawattsPerCubicMeter => As(PowerDensityUnit.MegawattPerCubicMeter); - - /// - /// Get PowerDensity in MegawattsPerLiter. - /// - public double MegawattsPerLiter => As(PowerDensityUnit.MegawattPerLiter); - - /// - /// Get PowerDensity in MicrowattsPerCubicFoot. - /// - public double MicrowattsPerCubicFoot => As(PowerDensityUnit.MicrowattPerCubicFoot); - - /// - /// Get PowerDensity in MicrowattsPerCubicInch. - /// - public double MicrowattsPerCubicInch => As(PowerDensityUnit.MicrowattPerCubicInch); - - /// - /// Get PowerDensity in MicrowattsPerCubicMeter. - /// - public double MicrowattsPerCubicMeter => As(PowerDensityUnit.MicrowattPerCubicMeter); - - /// - /// Get PowerDensity in MicrowattsPerLiter. - /// - public double MicrowattsPerLiter => As(PowerDensityUnit.MicrowattPerLiter); - - /// - /// Get PowerDensity in MilliwattsPerCubicFoot. - /// - public double MilliwattsPerCubicFoot => As(PowerDensityUnit.MilliwattPerCubicFoot); - - /// - /// Get PowerDensity in MilliwattsPerCubicInch. - /// - public double MilliwattsPerCubicInch => As(PowerDensityUnit.MilliwattPerCubicInch); - - /// - /// Get PowerDensity in MilliwattsPerCubicMeter. - /// - public double MilliwattsPerCubicMeter => As(PowerDensityUnit.MilliwattPerCubicMeter); - - /// - /// Get PowerDensity in MilliwattsPerLiter. - /// - public double MilliwattsPerLiter => As(PowerDensityUnit.MilliwattPerLiter); - - /// - /// Get PowerDensity in NanowattsPerCubicFoot. - /// - public double NanowattsPerCubicFoot => As(PowerDensityUnit.NanowattPerCubicFoot); - - /// - /// Get PowerDensity in NanowattsPerCubicInch. - /// - public double NanowattsPerCubicInch => As(PowerDensityUnit.NanowattPerCubicInch); - - /// - /// Get PowerDensity in NanowattsPerCubicMeter. - /// - public double NanowattsPerCubicMeter => As(PowerDensityUnit.NanowattPerCubicMeter); - - /// - /// Get PowerDensity in NanowattsPerLiter. - /// - public double NanowattsPerLiter => As(PowerDensityUnit.NanowattPerLiter); - - /// - /// Get PowerDensity in PicowattsPerCubicFoot. - /// - public double PicowattsPerCubicFoot => As(PowerDensityUnit.PicowattPerCubicFoot); - - /// - /// Get PowerDensity in PicowattsPerCubicInch. - /// - public double PicowattsPerCubicInch => As(PowerDensityUnit.PicowattPerCubicInch); - - /// - /// Get PowerDensity in PicowattsPerCubicMeter. - /// - public double PicowattsPerCubicMeter => As(PowerDensityUnit.PicowattPerCubicMeter); - - /// - /// Get PowerDensity in PicowattsPerLiter. - /// - public double PicowattsPerLiter => As(PowerDensityUnit.PicowattPerLiter); - - /// - /// Get PowerDensity in TerawattsPerCubicFoot. - /// - public double TerawattsPerCubicFoot => As(PowerDensityUnit.TerawattPerCubicFoot); - - /// - /// Get PowerDensity in TerawattsPerCubicInch. - /// - public double TerawattsPerCubicInch => As(PowerDensityUnit.TerawattPerCubicInch); - - /// - /// Get PowerDensity in TerawattsPerCubicMeter. - /// - public double TerawattsPerCubicMeter => As(PowerDensityUnit.TerawattPerCubicMeter); - - /// - /// Get PowerDensity in TerawattsPerLiter. - /// - public double TerawattsPerLiter => As(PowerDensityUnit.TerawattPerLiter); - - /// - /// Get PowerDensity in WattsPerCubicFoot. - /// - public double WattsPerCubicFoot => As(PowerDensityUnit.WattPerCubicFoot); - - /// - /// Get PowerDensity in WattsPerCubicInch. - /// - public double WattsPerCubicInch => As(PowerDensityUnit.WattPerCubicInch); - - /// - /// Get PowerDensity in WattsPerCubicMeter. - /// - public double WattsPerCubicMeter => As(PowerDensityUnit.WattPerCubicMeter); - - /// - /// Get PowerDensity in WattsPerLiter. - /// - public double WattsPerLiter => As(PowerDensityUnit.WattPerLiter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit WattPerCubicMeter. - /// - public static PowerDensity Zero => new PowerDensity(0, BaseUnit); - - /// - /// Get PowerDensity from DecawattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDecawattsPerCubicFoot(double decawattspercubicfoot) -#else - public static PowerDensity FromDecawattsPerCubicFoot(QuantityValue decawattspercubicfoot) -#endif - { - double value = (double) decawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicFoot); - } - - /// - /// Get PowerDensity from DecawattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDecawattsPerCubicInch(double decawattspercubicinch) -#else - public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattspercubicinch) -#endif - { - double value = (double) decawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicInch); - } - - /// - /// Get PowerDensity from DecawattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDecawattsPerCubicMeter(double decawattspercubicmeter) -#else - public static PowerDensity FromDecawattsPerCubicMeter(QuantityValue decawattspercubicmeter) -#endif - { - double value = (double) decawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicMeter); - } - - /// - /// Get PowerDensity from DecawattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDecawattsPerLiter(double decawattsperliter) -#else - public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter) -#endif - { - double value = (double) decawattsperliter; - return new PowerDensity(value, PowerDensityUnit.DecawattPerLiter); - } - - /// - /// Get PowerDensity from DeciwattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDeciwattsPerCubicFoot(double deciwattspercubicfoot) -#else - public static PowerDensity FromDeciwattsPerCubicFoot(QuantityValue deciwattspercubicfoot) -#endif - { - double value = (double) deciwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicFoot); - } - - /// - /// Get PowerDensity from DeciwattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDeciwattsPerCubicInch(double deciwattspercubicinch) -#else - public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattspercubicinch) -#endif - { - double value = (double) deciwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicInch); - } - - /// - /// Get PowerDensity from DeciwattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDeciwattsPerCubicMeter(double deciwattspercubicmeter) -#else - public static PowerDensity FromDeciwattsPerCubicMeter(QuantityValue deciwattspercubicmeter) -#endif - { - double value = (double) deciwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicMeter); - } - - /// - /// Get PowerDensity from DeciwattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromDeciwattsPerLiter(double deciwattsperliter) -#else - public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter) -#endif - { - double value = (double) deciwattsperliter; - return new PowerDensity(value, PowerDensityUnit.DeciwattPerLiter); - } - - /// - /// Get PowerDensity from GigawattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromGigawattsPerCubicFoot(double gigawattspercubicfoot) -#else - public static PowerDensity FromGigawattsPerCubicFoot(QuantityValue gigawattspercubicfoot) -#endif - { - double value = (double) gigawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicFoot); - } - - /// - /// Get PowerDensity from GigawattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromGigawattsPerCubicInch(double gigawattspercubicinch) -#else - public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattspercubicinch) -#endif - { - double value = (double) gigawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicInch); - } - - /// - /// Get PowerDensity from GigawattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromGigawattsPerCubicMeter(double gigawattspercubicmeter) -#else - public static PowerDensity FromGigawattsPerCubicMeter(QuantityValue gigawattspercubicmeter) -#endif - { - double value = (double) gigawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicMeter); - } - - /// - /// Get PowerDensity from GigawattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromGigawattsPerLiter(double gigawattsperliter) -#else - public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter) -#endif - { - double value = (double) gigawattsperliter; - return new PowerDensity(value, PowerDensityUnit.GigawattPerLiter); - } - - /// - /// Get PowerDensity from KilowattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromKilowattsPerCubicFoot(double kilowattspercubicfoot) -#else - public static PowerDensity FromKilowattsPerCubicFoot(QuantityValue kilowattspercubicfoot) -#endif - { - double value = (double) kilowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicFoot); - } - - /// - /// Get PowerDensity from KilowattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromKilowattsPerCubicInch(double kilowattspercubicinch) -#else - public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattspercubicinch) -#endif - { - double value = (double) kilowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicInch); - } - - /// - /// Get PowerDensity from KilowattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromKilowattsPerCubicMeter(double kilowattspercubicmeter) -#else - public static PowerDensity FromKilowattsPerCubicMeter(QuantityValue kilowattspercubicmeter) -#endif - { - double value = (double) kilowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicMeter); - } - - /// - /// Get PowerDensity from KilowattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromKilowattsPerLiter(double kilowattsperliter) -#else - public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter) -#endif - { - double value = (double) kilowattsperliter; - return new PowerDensity(value, PowerDensityUnit.KilowattPerLiter); - } - - /// - /// Get PowerDensity from MegawattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMegawattsPerCubicFoot(double megawattspercubicfoot) -#else - public static PowerDensity FromMegawattsPerCubicFoot(QuantityValue megawattspercubicfoot) -#endif - { - double value = (double) megawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicFoot); - } - - /// - /// Get PowerDensity from MegawattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMegawattsPerCubicInch(double megawattspercubicinch) -#else - public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattspercubicinch) -#endif - { - double value = (double) megawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicInch); - } - - /// - /// Get PowerDensity from MegawattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMegawattsPerCubicMeter(double megawattspercubicmeter) -#else - public static PowerDensity FromMegawattsPerCubicMeter(QuantityValue megawattspercubicmeter) -#endif - { - double value = (double) megawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicMeter); - } - - /// - /// Get PowerDensity from MegawattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMegawattsPerLiter(double megawattsperliter) -#else - public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter) -#endif - { - double value = (double) megawattsperliter; - return new PowerDensity(value, PowerDensityUnit.MegawattPerLiter); - } - - /// - /// Get PowerDensity from MicrowattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMicrowattsPerCubicFoot(double microwattspercubicfoot) -#else - public static PowerDensity FromMicrowattsPerCubicFoot(QuantityValue microwattspercubicfoot) -#endif - { - double value = (double) microwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicFoot); - } - - /// - /// Get PowerDensity from MicrowattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMicrowattsPerCubicInch(double microwattspercubicinch) -#else - public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspercubicinch) -#endif - { - double value = (double) microwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicInch); - } - - /// - /// Get PowerDensity from MicrowattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMicrowattsPerCubicMeter(double microwattspercubicmeter) -#else - public static PowerDensity FromMicrowattsPerCubicMeter(QuantityValue microwattspercubicmeter) -#endif - { - double value = (double) microwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicMeter); - } - - /// - /// Get PowerDensity from MicrowattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMicrowattsPerLiter(double microwattsperliter) -#else - public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperliter) -#endif - { - double value = (double) microwattsperliter; - return new PowerDensity(value, PowerDensityUnit.MicrowattPerLiter); - } - - /// - /// Get PowerDensity from MilliwattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMilliwattsPerCubicFoot(double milliwattspercubicfoot) -#else - public static PowerDensity FromMilliwattsPerCubicFoot(QuantityValue milliwattspercubicfoot) -#endif - { - double value = (double) milliwattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicFoot); - } - - /// - /// Get PowerDensity from MilliwattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMilliwattsPerCubicInch(double milliwattspercubicinch) -#else - public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspercubicinch) -#endif - { - double value = (double) milliwattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicInch); - } - - /// - /// Get PowerDensity from MilliwattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMilliwattsPerCubicMeter(double milliwattspercubicmeter) -#else - public static PowerDensity FromMilliwattsPerCubicMeter(QuantityValue milliwattspercubicmeter) -#endif - { - double value = (double) milliwattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicMeter); - } - - /// - /// Get PowerDensity from MilliwattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromMilliwattsPerLiter(double milliwattsperliter) -#else - public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperliter) -#endif - { - double value = (double) milliwattsperliter; - return new PowerDensity(value, PowerDensityUnit.MilliwattPerLiter); - } - - /// - /// Get PowerDensity from NanowattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromNanowattsPerCubicFoot(double nanowattspercubicfoot) -#else - public static PowerDensity FromNanowattsPerCubicFoot(QuantityValue nanowattspercubicfoot) -#endif - { - double value = (double) nanowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicFoot); - } - - /// - /// Get PowerDensity from NanowattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromNanowattsPerCubicInch(double nanowattspercubicinch) -#else - public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattspercubicinch) -#endif - { - double value = (double) nanowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicInch); - } - - /// - /// Get PowerDensity from NanowattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromNanowattsPerCubicMeter(double nanowattspercubicmeter) -#else - public static PowerDensity FromNanowattsPerCubicMeter(QuantityValue nanowattspercubicmeter) -#endif - { - double value = (double) nanowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicMeter); - } - - /// - /// Get PowerDensity from NanowattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromNanowattsPerLiter(double nanowattsperliter) -#else - public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter) -#endif - { - double value = (double) nanowattsperliter; - return new PowerDensity(value, PowerDensityUnit.NanowattPerLiter); - } - - /// - /// Get PowerDensity from PicowattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromPicowattsPerCubicFoot(double picowattspercubicfoot) -#else - public static PowerDensity FromPicowattsPerCubicFoot(QuantityValue picowattspercubicfoot) -#endif - { - double value = (double) picowattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicFoot); - } - - /// - /// Get PowerDensity from PicowattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromPicowattsPerCubicInch(double picowattspercubicinch) -#else - public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattspercubicinch) -#endif - { - double value = (double) picowattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicInch); - } - - /// - /// Get PowerDensity from PicowattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromPicowattsPerCubicMeter(double picowattspercubicmeter) -#else - public static PowerDensity FromPicowattsPerCubicMeter(QuantityValue picowattspercubicmeter) -#endif - { - double value = (double) picowattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicMeter); - } - - /// - /// Get PowerDensity from PicowattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromPicowattsPerLiter(double picowattsperliter) -#else - public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter) -#endif - { - double value = (double) picowattsperliter; - return new PowerDensity(value, PowerDensityUnit.PicowattPerLiter); - } - - /// - /// Get PowerDensity from TerawattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromTerawattsPerCubicFoot(double terawattspercubicfoot) -#else - public static PowerDensity FromTerawattsPerCubicFoot(QuantityValue terawattspercubicfoot) -#endif - { - double value = (double) terawattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicFoot); - } - - /// - /// Get PowerDensity from TerawattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromTerawattsPerCubicInch(double terawattspercubicinch) -#else - public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattspercubicinch) -#endif - { - double value = (double) terawattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicInch); - } - - /// - /// Get PowerDensity from TerawattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromTerawattsPerCubicMeter(double terawattspercubicmeter) -#else - public static PowerDensity FromTerawattsPerCubicMeter(QuantityValue terawattspercubicmeter) -#endif - { - double value = (double) terawattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicMeter); - } - - /// - /// Get PowerDensity from TerawattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromTerawattsPerLiter(double terawattsperliter) -#else - public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter) -#endif - { - double value = (double) terawattsperliter; - return new PowerDensity(value, PowerDensityUnit.TerawattPerLiter); - } - - /// - /// Get PowerDensity from WattsPerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromWattsPerCubicFoot(double wattspercubicfoot) -#else - public static PowerDensity FromWattsPerCubicFoot(QuantityValue wattspercubicfoot) -#endif - { - double value = (double) wattspercubicfoot; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicFoot); - } - - /// - /// Get PowerDensity from WattsPerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromWattsPerCubicInch(double wattspercubicinch) -#else - public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch) -#endif - { - double value = (double) wattspercubicinch; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicInch); - } - - /// - /// Get PowerDensity from WattsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromWattsPerCubicMeter(double wattspercubicmeter) -#else - public static PowerDensity FromWattsPerCubicMeter(QuantityValue wattspercubicmeter) -#endif - { - double value = (double) wattspercubicmeter; - return new PowerDensity(value, PowerDensityUnit.WattPerCubicMeter); - } - - /// - /// Get PowerDensity from WattsPerLiter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerDensity FromWattsPerLiter(double wattsperliter) -#else - public static PowerDensity FromWattsPerLiter(QuantityValue wattsperliter) -#endif - { - double value = (double) wattsperliter; - return new PowerDensity(value, PowerDensityUnit.WattPerLiter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// PowerDensity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static PowerDensity From(double value, PowerDensityUnit fromUnit) -#else - public static PowerDensity From(QuantityValue value, PowerDensityUnit fromUnit) -#endif - { - return new PowerDensity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerDensityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); - - return CompareTo((PowerDensity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(PowerDensity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another PowerDensity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current PowerDensity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(PowerDensityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this PowerDensity to another PowerDensity with the unit representation . - /// - /// A PowerDensity with the specified unit. - public PowerDensity ToUnit(PowerDensityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new PowerDensity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case PowerDensityUnit.DecawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e1d; - case PowerDensityUnit.DecawattPerCubicInch: return (_value*6.102374409473228e4) * 1e1d; - case PowerDensityUnit.DecawattPerCubicMeter: return (_value) * 1e1d; - case PowerDensityUnit.DecawattPerLiter: return (_value*1.0e3) * 1e1d; - case PowerDensityUnit.DeciwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-1d; - case PowerDensityUnit.DeciwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-1d; - case PowerDensityUnit.DeciwattPerCubicMeter: return (_value) * 1e-1d; - case PowerDensityUnit.DeciwattPerLiter: return (_value*1.0e3) * 1e-1d; - case PowerDensityUnit.GigawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e9d; - case PowerDensityUnit.GigawattPerCubicInch: return (_value*6.102374409473228e4) * 1e9d; - case PowerDensityUnit.GigawattPerCubicMeter: return (_value) * 1e9d; - case PowerDensityUnit.GigawattPerLiter: return (_value*1.0e3) * 1e9d; - case PowerDensityUnit.KilowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e3d; - case PowerDensityUnit.KilowattPerCubicInch: return (_value*6.102374409473228e4) * 1e3d; - case PowerDensityUnit.KilowattPerCubicMeter: return (_value) * 1e3d; - case PowerDensityUnit.KilowattPerLiter: return (_value*1.0e3) * 1e3d; - case PowerDensityUnit.MegawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e6d; - case PowerDensityUnit.MegawattPerCubicInch: return (_value*6.102374409473228e4) * 1e6d; - case PowerDensityUnit.MegawattPerCubicMeter: return (_value) * 1e6d; - case PowerDensityUnit.MegawattPerLiter: return (_value*1.0e3) * 1e6d; - case PowerDensityUnit.MicrowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-6d; - case PowerDensityUnit.MicrowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-6d; - case PowerDensityUnit.MicrowattPerCubicMeter: return (_value) * 1e-6d; - case PowerDensityUnit.MicrowattPerLiter: return (_value*1.0e3) * 1e-6d; - case PowerDensityUnit.MilliwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-3d; - case PowerDensityUnit.MilliwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-3d; - case PowerDensityUnit.MilliwattPerCubicMeter: return (_value) * 1e-3d; - case PowerDensityUnit.MilliwattPerLiter: return (_value*1.0e3) * 1e-3d; - case PowerDensityUnit.NanowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-9d; - case PowerDensityUnit.NanowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-9d; - case PowerDensityUnit.NanowattPerCubicMeter: return (_value) * 1e-9d; - case PowerDensityUnit.NanowattPerLiter: return (_value*1.0e3) * 1e-9d; - case PowerDensityUnit.PicowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-12d; - case PowerDensityUnit.PicowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-12d; - case PowerDensityUnit.PicowattPerCubicMeter: return (_value) * 1e-12d; - case PowerDensityUnit.PicowattPerLiter: return (_value*1.0e3) * 1e-12d; - case PowerDensityUnit.TerawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e12d; - case PowerDensityUnit.TerawattPerCubicInch: return (_value*6.102374409473228e4) * 1e12d; - case PowerDensityUnit.TerawattPerCubicMeter: return (_value) * 1e12d; - case PowerDensityUnit.TerawattPerLiter: return (_value*1.0e3) * 1e12d; - case PowerDensityUnit.WattPerCubicFoot: return _value*3.531466672148859e1; - case PowerDensityUnit.WattPerCubicInch: return _value*6.102374409473228e4; - case PowerDensityUnit.WattPerCubicMeter: return _value; - case PowerDensityUnit.WattPerLiter: return _value*1.0e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(PowerDensityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case PowerDensityUnit.DecawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e1d; - case PowerDensityUnit.DecawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e1d; - case PowerDensityUnit.DecawattPerCubicMeter: return (baseUnitValue) / 1e1d; - case PowerDensityUnit.DecawattPerLiter: return (baseUnitValue/1.0e3) / 1e1d; - case PowerDensityUnit.DeciwattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-1d; - case PowerDensityUnit.DeciwattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-1d; - case PowerDensityUnit.DeciwattPerCubicMeter: return (baseUnitValue) / 1e-1d; - case PowerDensityUnit.DeciwattPerLiter: return (baseUnitValue/1.0e3) / 1e-1d; - case PowerDensityUnit.GigawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e9d; - case PowerDensityUnit.GigawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e9d; - case PowerDensityUnit.GigawattPerCubicMeter: return (baseUnitValue) / 1e9d; - case PowerDensityUnit.GigawattPerLiter: return (baseUnitValue/1.0e3) / 1e9d; - case PowerDensityUnit.KilowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e3d; - case PowerDensityUnit.KilowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e3d; - case PowerDensityUnit.KilowattPerCubicMeter: return (baseUnitValue) / 1e3d; - case PowerDensityUnit.KilowattPerLiter: return (baseUnitValue/1.0e3) / 1e3d; - case PowerDensityUnit.MegawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e6d; - case PowerDensityUnit.MegawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e6d; - case PowerDensityUnit.MegawattPerCubicMeter: return (baseUnitValue) / 1e6d; - case PowerDensityUnit.MegawattPerLiter: return (baseUnitValue/1.0e3) / 1e6d; - case PowerDensityUnit.MicrowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-6d; - case PowerDensityUnit.MicrowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-6d; - case PowerDensityUnit.MicrowattPerCubicMeter: return (baseUnitValue) / 1e-6d; - case PowerDensityUnit.MicrowattPerLiter: return (baseUnitValue/1.0e3) / 1e-6d; - case PowerDensityUnit.MilliwattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-3d; - case PowerDensityUnit.MilliwattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-3d; - case PowerDensityUnit.MilliwattPerCubicMeter: return (baseUnitValue) / 1e-3d; - case PowerDensityUnit.MilliwattPerLiter: return (baseUnitValue/1.0e3) / 1e-3d; - case PowerDensityUnit.NanowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-9d; - case PowerDensityUnit.NanowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-9d; - case PowerDensityUnit.NanowattPerCubicMeter: return (baseUnitValue) / 1e-9d; - case PowerDensityUnit.NanowattPerLiter: return (baseUnitValue/1.0e3) / 1e-9d; - case PowerDensityUnit.PicowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-12d; - case PowerDensityUnit.PicowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-12d; - case PowerDensityUnit.PicowattPerCubicMeter: return (baseUnitValue) / 1e-12d; - case PowerDensityUnit.PicowattPerLiter: return (baseUnitValue/1.0e3) / 1e-12d; - case PowerDensityUnit.TerawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e12d; - case PowerDensityUnit.TerawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e12d; - case PowerDensityUnit.TerawattPerCubicMeter: return (baseUnitValue) / 1e12d; - case PowerDensityUnit.TerawattPerLiter: return (baseUnitValue/1.0e3) / 1e12d; - case PowerDensityUnit.WattPerCubicFoot: return baseUnitValue/3.531466672148859e1; - case PowerDensityUnit.WattPerCubicInch: return baseUnitValue/6.102374409473228e4; - case PowerDensityUnit.WattPerCubicMeter: return baseUnitValue; - case PowerDensityUnit.WattPerLiter: return baseUnitValue/1.0e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PowerDensity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out PowerDensity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerDensityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out PowerDensityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static PowerDensity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) - { - result = default(PowerDensity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static PowerDensityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == PowerDensityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerDensityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerDensityUnit unit) - { - unit = PowerDensityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == PowerDensityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(PowerDensityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of PowerDensity - /// - public static PowerDensity MaxValue => new PowerDensity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of PowerDensity - /// - public static PowerDensity MinValue => new PowerDensity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => PowerDensity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => PowerDensity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs b/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs deleted file mode 100644 index 66d9f5d959..0000000000 --- a/Common/GeneratedCode/Quantities/PowerRatio.Common.g.cs +++ /dev/null @@ -1,558 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The strength of a signal expressed in decibels (dB) relative to one watt. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class PowerRatio : IQuantity -#else - public partial struct PowerRatio : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly PowerRatioUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public PowerRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static PowerRatio() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - PowerRatio(double numericValue, PowerRatioUnit unit) - { - if(unit == PowerRatioUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.PowerRatio; - - /// - /// The base unit of PowerRatio, which is DecibelWatt. All conversions go via this value. - /// - public static PowerRatioUnit BaseUnit => PowerRatioUnit.DecibelWatt; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the PowerRatio quantity. - /// - public static PowerRatioUnit[] Units { get; } = Enum.GetValues(typeof(PowerRatioUnit)).Cast().Except(new PowerRatioUnit[]{ PowerRatioUnit.Undefined }).ToArray(); - - /// - /// Get PowerRatio in DecibelMilliwatts. - /// - public double DecibelMilliwatts => As(PowerRatioUnit.DecibelMilliwatt); - - /// - /// Get PowerRatio in DecibelWatts. - /// - public double DecibelWatts => As(PowerRatioUnit.DecibelWatt); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit DecibelWatt. - /// - public static PowerRatio Zero => new PowerRatio(0, BaseUnit); - - /// - /// Get PowerRatio from DecibelMilliwatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerRatio FromDecibelMilliwatts(double decibelmilliwatts) -#else - public static PowerRatio FromDecibelMilliwatts(QuantityValue decibelmilliwatts) -#endif - { - double value = (double) decibelmilliwatts; - return new PowerRatio(value, PowerRatioUnit.DecibelMilliwatt); - } - - /// - /// Get PowerRatio from DecibelWatts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PowerRatio FromDecibelWatts(double decibelwatts) -#else - public static PowerRatio FromDecibelWatts(QuantityValue decibelwatts) -#endif - { - double value = (double) decibelwatts; - return new PowerRatio(value, PowerRatioUnit.DecibelWatt); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// PowerRatio unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static PowerRatio From(double value, PowerRatioUnit fromUnit) -#else - public static PowerRatio From(QuantityValue value, PowerRatioUnit fromUnit) -#endif - { - return new PowerRatio((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PowerRatioUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); - - return CompareTo((PowerRatio)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(PowerRatio other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another PowerRatio within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current PowerRatio. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(PowerRatioUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this PowerRatio to another PowerRatio with the unit representation . - /// - /// A PowerRatio with the specified unit. - public PowerRatio ToUnit(PowerRatioUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new PowerRatio(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case PowerRatioUnit.DecibelMilliwatt: return _value - 30; - case PowerRatioUnit.DecibelWatt: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(PowerRatioUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case PowerRatioUnit.DecibelMilliwatt: return baseUnitValue + 30; - case PowerRatioUnit.DecibelWatt: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PowerRatio Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out PowerRatio result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PowerRatioUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out PowerRatioUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static PowerRatio ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) - { - result = default(PowerRatio); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static PowerRatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == PowerRatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PowerRatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PowerRatioUnit unit) - { - unit = PowerRatioUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == PowerRatioUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(PowerRatioUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of PowerRatio - /// - public static PowerRatio MaxValue => new PowerRatio(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of PowerRatio - /// - public static PowerRatio MinValue => new PowerRatio(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => PowerRatio.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => PowerRatio.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs b/Common/GeneratedCode/Quantities/Pressure.Common.g.cs deleted file mode 100644 index baadedff81..0000000000 --- a/Common/GeneratedCode/Quantities/Pressure.Common.g.cs +++ /dev/null @@ -1,1329 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Pressure : IQuantity -#else - public partial struct Pressure : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly PressureUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public PressureUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Pressure() - { - BaseDimensions = new BaseDimensions(-1, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Pressure(double numericValue, PressureUnit unit) - { - if(unit == PressureUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Pressure; - - /// - /// The base unit of Pressure, which is Pascal. All conversions go via this value. - /// - public static PressureUnit BaseUnit => PressureUnit.Pascal; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Pressure quantity. - /// - public static PressureUnit[] Units { get; } = Enum.GetValues(typeof(PressureUnit)).Cast().Except(new PressureUnit[]{ PressureUnit.Undefined }).ToArray(); - - /// - /// Get Pressure in Atmospheres. - /// - public double Atmospheres => As(PressureUnit.Atmosphere); - - /// - /// Get Pressure in Bars. - /// - public double Bars => As(PressureUnit.Bar); - - /// - /// Get Pressure in Centibars. - /// - public double Centibars => As(PressureUnit.Centibar); - - /// - /// Get Pressure in Decapascals. - /// - public double Decapascals => As(PressureUnit.Decapascal); - - /// - /// Get Pressure in Decibars. - /// - public double Decibars => As(PressureUnit.Decibar); - - /// - /// Get Pressure in FeetOfHead. - /// - public double FeetOfHead => As(PressureUnit.FootOfHead); - - /// - /// Get Pressure in Gigapascals. - /// - public double Gigapascals => As(PressureUnit.Gigapascal); - - /// - /// Get Pressure in Hectopascals. - /// - public double Hectopascals => As(PressureUnit.Hectopascal); - - /// - /// Get Pressure in InchesOfMercury. - /// - public double InchesOfMercury => As(PressureUnit.InchOfMercury); - - /// - /// Get Pressure in Kilobars. - /// - public double Kilobars => As(PressureUnit.Kilobar); - - /// - /// Get Pressure in KilogramsForcePerSquareCentimeter. - /// - public double KilogramsForcePerSquareCentimeter => As(PressureUnit.KilogramForcePerSquareCentimeter); - - /// - /// Get Pressure in KilogramsForcePerSquareMeter. - /// - public double KilogramsForcePerSquareMeter => As(PressureUnit.KilogramForcePerSquareMeter); - - /// - /// Get Pressure in KilogramsForcePerSquareMillimeter. - /// - public double KilogramsForcePerSquareMillimeter => As(PressureUnit.KilogramForcePerSquareMillimeter); - - /// - /// Get Pressure in KilonewtonsPerSquareCentimeter. - /// - public double KilonewtonsPerSquareCentimeter => As(PressureUnit.KilonewtonPerSquareCentimeter); - - /// - /// Get Pressure in KilonewtonsPerSquareMeter. - /// - public double KilonewtonsPerSquareMeter => As(PressureUnit.KilonewtonPerSquareMeter); - - /// - /// Get Pressure in KilonewtonsPerSquareMillimeter. - /// - public double KilonewtonsPerSquareMillimeter => As(PressureUnit.KilonewtonPerSquareMillimeter); - - /// - /// Get Pressure in Kilopascals. - /// - public double Kilopascals => As(PressureUnit.Kilopascal); - - /// - /// Get Pressure in KilopoundsForcePerSquareFoot. - /// - public double KilopoundsForcePerSquareFoot => As(PressureUnit.KilopoundForcePerSquareFoot); - - /// - /// Get Pressure in KilopoundsForcePerSquareInch. - /// - public double KilopoundsForcePerSquareInch => As(PressureUnit.KilopoundForcePerSquareInch); - - /// - /// Get Pressure in Megabars. - /// - public double Megabars => As(PressureUnit.Megabar); - - /// - /// Get Pressure in MeganewtonsPerSquareMeter. - /// - public double MeganewtonsPerSquareMeter => As(PressureUnit.MeganewtonPerSquareMeter); - - /// - /// Get Pressure in Megapascals. - /// - public double Megapascals => As(PressureUnit.Megapascal); - - /// - /// Get Pressure in MetersOfHead. - /// - public double MetersOfHead => As(PressureUnit.MeterOfHead); - - /// - /// Get Pressure in Micropascals. - /// - public double Micropascals => As(PressureUnit.Micropascal); - - /// - /// Get Pressure in Millibars. - /// - public double Millibars => As(PressureUnit.Millibar); - - /// - /// Get Pressure in MillimetersOfMercury. - /// - public double MillimetersOfMercury => As(PressureUnit.MillimeterOfMercury); - - /// - /// Get Pressure in NewtonsPerSquareCentimeter. - /// - public double NewtonsPerSquareCentimeter => As(PressureUnit.NewtonPerSquareCentimeter); - - /// - /// Get Pressure in NewtonsPerSquareMeter. - /// - public double NewtonsPerSquareMeter => As(PressureUnit.NewtonPerSquareMeter); - - /// - /// Get Pressure in NewtonsPerSquareMillimeter. - /// - public double NewtonsPerSquareMillimeter => As(PressureUnit.NewtonPerSquareMillimeter); - - /// - /// Get Pressure in Pascals. - /// - public double Pascals => As(PressureUnit.Pascal); - - /// - /// Get Pressure in PoundsForcePerSquareFoot. - /// - public double PoundsForcePerSquareFoot => As(PressureUnit.PoundForcePerSquareFoot); - - /// - /// Get Pressure in PoundsForcePerSquareInch. - /// - public double PoundsForcePerSquareInch => As(PressureUnit.PoundForcePerSquareInch); - - /// - /// Get Pressure in TechnicalAtmospheres. - /// - public double TechnicalAtmospheres => As(PressureUnit.TechnicalAtmosphere); - - /// - /// Get Pressure in TonnesForcePerSquareCentimeter. - /// - public double TonnesForcePerSquareCentimeter => As(PressureUnit.TonneForcePerSquareCentimeter); - - /// - /// Get Pressure in TonnesForcePerSquareMeter. - /// - public double TonnesForcePerSquareMeter => As(PressureUnit.TonneForcePerSquareMeter); - - /// - /// Get Pressure in TonnesForcePerSquareMillimeter. - /// - public double TonnesForcePerSquareMillimeter => As(PressureUnit.TonneForcePerSquareMillimeter); - - /// - /// Get Pressure in Torrs. - /// - public double Torrs => As(PressureUnit.Torr); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Pascal. - /// - public static Pressure Zero => new Pressure(0, BaseUnit); - - /// - /// Get Pressure from Atmospheres. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromAtmospheres(double atmospheres) -#else - public static Pressure FromAtmospheres(QuantityValue atmospheres) -#endif - { - double value = (double) atmospheres; - return new Pressure(value, PressureUnit.Atmosphere); - } - - /// - /// Get Pressure from Bars. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromBars(double bars) -#else - public static Pressure FromBars(QuantityValue bars) -#endif - { - double value = (double) bars; - return new Pressure(value, PressureUnit.Bar); - } - - /// - /// Get Pressure from Centibars. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromCentibars(double centibars) -#else - public static Pressure FromCentibars(QuantityValue centibars) -#endif - { - double value = (double) centibars; - return new Pressure(value, PressureUnit.Centibar); - } - - /// - /// Get Pressure from Decapascals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromDecapascals(double decapascals) -#else - public static Pressure FromDecapascals(QuantityValue decapascals) -#endif - { - double value = (double) decapascals; - return new Pressure(value, PressureUnit.Decapascal); - } - - /// - /// Get Pressure from Decibars. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromDecibars(double decibars) -#else - public static Pressure FromDecibars(QuantityValue decibars) -#endif - { - double value = (double) decibars; - return new Pressure(value, PressureUnit.Decibar); - } - - /// - /// Get Pressure from FeetOfHead. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromFeetOfHead(double feetofhead) -#else - public static Pressure FromFeetOfHead(QuantityValue feetofhead) -#endif - { - double value = (double) feetofhead; - return new Pressure(value, PressureUnit.FootOfHead); - } - - /// - /// Get Pressure from Gigapascals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromGigapascals(double gigapascals) -#else - public static Pressure FromGigapascals(QuantityValue gigapascals) -#endif - { - double value = (double) gigapascals; - return new Pressure(value, PressureUnit.Gigapascal); - } - - /// - /// Get Pressure from Hectopascals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromHectopascals(double hectopascals) -#else - public static Pressure FromHectopascals(QuantityValue hectopascals) -#endif - { - double value = (double) hectopascals; - return new Pressure(value, PressureUnit.Hectopascal); - } - - /// - /// Get Pressure from InchesOfMercury. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromInchesOfMercury(double inchesofmercury) -#else - public static Pressure FromInchesOfMercury(QuantityValue inchesofmercury) -#endif - { - double value = (double) inchesofmercury; - return new Pressure(value, PressureUnit.InchOfMercury); - } - - /// - /// Get Pressure from Kilobars. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilobars(double kilobars) -#else - public static Pressure FromKilobars(QuantityValue kilobars) -#endif - { - double value = (double) kilobars; - return new Pressure(value, PressureUnit.Kilobar); - } - - /// - /// Get Pressure from KilogramsForcePerSquareCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilogramsForcePerSquareCentimeter(double kilogramsforcepersquarecentimeter) -#else - public static Pressure FromKilogramsForcePerSquareCentimeter(QuantityValue kilogramsforcepersquarecentimeter) -#endif - { - double value = (double) kilogramsforcepersquarecentimeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareCentimeter); - } - - /// - /// Get Pressure from KilogramsForcePerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilogramsForcePerSquareMeter(double kilogramsforcepersquaremeter) -#else - public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsforcepersquaremeter) -#endif - { - double value = (double) kilogramsforcepersquaremeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareMeter); - } - - /// - /// Get Pressure from KilogramsForcePerSquareMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilogramsForcePerSquareMillimeter(double kilogramsforcepersquaremillimeter) -#else - public static Pressure FromKilogramsForcePerSquareMillimeter(QuantityValue kilogramsforcepersquaremillimeter) -#endif - { - double value = (double) kilogramsforcepersquaremillimeter; - return new Pressure(value, PressureUnit.KilogramForcePerSquareMillimeter); - } - - /// - /// Get Pressure from KilonewtonsPerSquareCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilonewtonsPerSquareCentimeter(double kilonewtonspersquarecentimeter) -#else - public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewtonspersquarecentimeter) -#endif - { - double value = (double) kilonewtonspersquarecentimeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareCentimeter); - } - - /// - /// Get Pressure from KilonewtonsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilonewtonsPerSquareMeter(double kilonewtonspersquaremeter) -#else - public static Pressure FromKilonewtonsPerSquareMeter(QuantityValue kilonewtonspersquaremeter) -#endif - { - double value = (double) kilonewtonspersquaremeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareMeter); - } - - /// - /// Get Pressure from KilonewtonsPerSquareMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilonewtonsPerSquareMillimeter(double kilonewtonspersquaremillimeter) -#else - public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewtonspersquaremillimeter) -#endif - { - double value = (double) kilonewtonspersquaremillimeter; - return new Pressure(value, PressureUnit.KilonewtonPerSquareMillimeter); - } - - /// - /// Get Pressure from Kilopascals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilopascals(double kilopascals) -#else - public static Pressure FromKilopascals(QuantityValue kilopascals) -#endif - { - double value = (double) kilopascals; - return new Pressure(value, PressureUnit.Kilopascal); - } - - /// - /// Get Pressure from KilopoundsForcePerSquareFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilopoundsForcePerSquareFoot(double kilopoundsforcepersquarefoot) -#else - public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopoundsforcepersquarefoot) -#endif - { - double value = (double) kilopoundsforcepersquarefoot; - return new Pressure(value, PressureUnit.KilopoundForcePerSquareFoot); - } - - /// - /// Get Pressure from KilopoundsForcePerSquareInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromKilopoundsForcePerSquareInch(double kilopoundsforcepersquareinch) -#else - public static Pressure FromKilopoundsForcePerSquareInch(QuantityValue kilopoundsforcepersquareinch) -#endif - { - double value = (double) kilopoundsforcepersquareinch; - return new Pressure(value, PressureUnit.KilopoundForcePerSquareInch); - } - - /// - /// Get Pressure from Megabars. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromMegabars(double megabars) -#else - public static Pressure FromMegabars(QuantityValue megabars) -#endif - { - double value = (double) megabars; - return new Pressure(value, PressureUnit.Megabar); - } - - /// - /// Get Pressure from MeganewtonsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromMeganewtonsPerSquareMeter(double meganewtonspersquaremeter) -#else - public static Pressure FromMeganewtonsPerSquareMeter(QuantityValue meganewtonspersquaremeter) -#endif - { - double value = (double) meganewtonspersquaremeter; - return new Pressure(value, PressureUnit.MeganewtonPerSquareMeter); - } - - /// - /// Get Pressure from Megapascals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromMegapascals(double megapascals) -#else - public static Pressure FromMegapascals(QuantityValue megapascals) -#endif - { - double value = (double) megapascals; - return new Pressure(value, PressureUnit.Megapascal); - } - - /// - /// Get Pressure from MetersOfHead. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromMetersOfHead(double metersofhead) -#else - public static Pressure FromMetersOfHead(QuantityValue metersofhead) -#endif - { - double value = (double) metersofhead; - return new Pressure(value, PressureUnit.MeterOfHead); - } - - /// - /// Get Pressure from Micropascals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromMicropascals(double micropascals) -#else - public static Pressure FromMicropascals(QuantityValue micropascals) -#endif - { - double value = (double) micropascals; - return new Pressure(value, PressureUnit.Micropascal); - } - - /// - /// Get Pressure from Millibars. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromMillibars(double millibars) -#else - public static Pressure FromMillibars(QuantityValue millibars) -#endif - { - double value = (double) millibars; - return new Pressure(value, PressureUnit.Millibar); - } - - /// - /// Get Pressure from MillimetersOfMercury. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromMillimetersOfMercury(double millimetersofmercury) -#else - public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercury) -#endif - { - double value = (double) millimetersofmercury; - return new Pressure(value, PressureUnit.MillimeterOfMercury); - } - - /// - /// Get Pressure from NewtonsPerSquareCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromNewtonsPerSquareCentimeter(double newtonspersquarecentimeter) -#else - public static Pressure FromNewtonsPerSquareCentimeter(QuantityValue newtonspersquarecentimeter) -#endif - { - double value = (double) newtonspersquarecentimeter; - return new Pressure(value, PressureUnit.NewtonPerSquareCentimeter); - } - - /// - /// Get Pressure from NewtonsPerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromNewtonsPerSquareMeter(double newtonspersquaremeter) -#else - public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquaremeter) -#endif - { - double value = (double) newtonspersquaremeter; - return new Pressure(value, PressureUnit.NewtonPerSquareMeter); - } - - /// - /// Get Pressure from NewtonsPerSquareMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromNewtonsPerSquareMillimeter(double newtonspersquaremillimeter) -#else - public static Pressure FromNewtonsPerSquareMillimeter(QuantityValue newtonspersquaremillimeter) -#endif - { - double value = (double) newtonspersquaremillimeter; - return new Pressure(value, PressureUnit.NewtonPerSquareMillimeter); - } - - /// - /// Get Pressure from Pascals. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromPascals(double pascals) -#else - public static Pressure FromPascals(QuantityValue pascals) -#endif - { - double value = (double) pascals; - return new Pressure(value, PressureUnit.Pascal); - } - - /// - /// Get Pressure from PoundsForcePerSquareFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromPoundsForcePerSquareFoot(double poundsforcepersquarefoot) -#else - public static Pressure FromPoundsForcePerSquareFoot(QuantityValue poundsforcepersquarefoot) -#endif - { - double value = (double) poundsforcepersquarefoot; - return new Pressure(value, PressureUnit.PoundForcePerSquareFoot); - } - - /// - /// Get Pressure from PoundsForcePerSquareInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromPoundsForcePerSquareInch(double poundsforcepersquareinch) -#else - public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforcepersquareinch) -#endif - { - double value = (double) poundsforcepersquareinch; - return new Pressure(value, PressureUnit.PoundForcePerSquareInch); - } - - /// - /// Get Pressure from TechnicalAtmospheres. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromTechnicalAtmospheres(double technicalatmospheres) -#else - public static Pressure FromTechnicalAtmospheres(QuantityValue technicalatmospheres) -#endif - { - double value = (double) technicalatmospheres; - return new Pressure(value, PressureUnit.TechnicalAtmosphere); - } - - /// - /// Get Pressure from TonnesForcePerSquareCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromTonnesForcePerSquareCentimeter(double tonnesforcepersquarecentimeter) -#else - public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesforcepersquarecentimeter) -#endif - { - double value = (double) tonnesforcepersquarecentimeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareCentimeter); - } - - /// - /// Get Pressure from TonnesForcePerSquareMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromTonnesForcePerSquareMeter(double tonnesforcepersquaremeter) -#else - public static Pressure FromTonnesForcePerSquareMeter(QuantityValue tonnesforcepersquaremeter) -#endif - { - double value = (double) tonnesforcepersquaremeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareMeter); - } - - /// - /// Get Pressure from TonnesForcePerSquareMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromTonnesForcePerSquareMillimeter(double tonnesforcepersquaremillimeter) -#else - public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesforcepersquaremillimeter) -#endif - { - double value = (double) tonnesforcepersquaremillimeter; - return new Pressure(value, PressureUnit.TonneForcePerSquareMillimeter); - } - - /// - /// Get Pressure from Torrs. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Pressure FromTorrs(double torrs) -#else - public static Pressure FromTorrs(QuantityValue torrs) -#endif - { - double value = (double) torrs; - return new Pressure(value, PressureUnit.Torr); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Pressure unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Pressure From(double value, PressureUnit fromUnit) -#else - public static Pressure From(QuantityValue value, PressureUnit fromUnit) -#endif - { - return new Pressure((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PressureUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Pressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); - - return CompareTo((Pressure)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Pressure other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Pressure within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Pressure. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(PressureUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Pressure to another Pressure with the unit representation . - /// - /// A Pressure with the specified unit. - public Pressure ToUnit(PressureUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Pressure(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case PressureUnit.Atmosphere: return _value*1.01325*1e5; - case PressureUnit.Bar: return _value*1e5; - case PressureUnit.Centibar: return (_value*1e5) * 1e-2d; - case PressureUnit.Decapascal: return (_value) * 1e1d; - case PressureUnit.Decibar: return (_value*1e5) * 1e-1d; - case PressureUnit.FootOfHead: return _value*2989.0669; - case PressureUnit.Gigapascal: return (_value) * 1e9d; - case PressureUnit.Hectopascal: return (_value) * 1e2d; - case PressureUnit.InchOfMercury: return _value/2.95299830714159e-4; - case PressureUnit.Kilobar: return (_value*1e5) * 1e3d; - case PressureUnit.KilogramForcePerSquareCentimeter: return _value*9.80665e4; - case PressureUnit.KilogramForcePerSquareMeter: return _value*9.80665019960652; - case PressureUnit.KilogramForcePerSquareMillimeter: return _value*9.80665e6; - case PressureUnit.KilonewtonPerSquareCentimeter: return (_value*1e4) * 1e3d; - case PressureUnit.KilonewtonPerSquareMeter: return (_value) * 1e3d; - case PressureUnit.KilonewtonPerSquareMillimeter: return (_value*1e6) * 1e3d; - case PressureUnit.Kilopascal: return (_value) * 1e3d; - case PressureUnit.KilopoundForcePerSquareFoot: return (_value*4.788025898033584e1) * 1e3d; - case PressureUnit.KilopoundForcePerSquareInch: return (_value*6.894757293168361e3) * 1e3d; - case PressureUnit.Megabar: return (_value*1e5) * 1e6d; - case PressureUnit.MeganewtonPerSquareMeter: return (_value) * 1e6d; - case PressureUnit.Megapascal: return (_value) * 1e6d; - case PressureUnit.MeterOfHead: return _value*9804.139432; - case PressureUnit.Micropascal: return (_value) * 1e-6d; - case PressureUnit.Millibar: return (_value*1e5) * 1e-3d; - case PressureUnit.MillimeterOfMercury: return _value/7.50061561302643e-3; - case PressureUnit.NewtonPerSquareCentimeter: return _value*1e4; - case PressureUnit.NewtonPerSquareMeter: return _value; - case PressureUnit.NewtonPerSquareMillimeter: return _value*1e6; - case PressureUnit.Pascal: return _value; - case PressureUnit.PoundForcePerSquareFoot: return _value*4.788025898033584e1; - case PressureUnit.PoundForcePerSquareInch: return _value*6.894757293168361e3; - case PressureUnit.TechnicalAtmosphere: return _value*9.80680592331*1e4; - case PressureUnit.TonneForcePerSquareCentimeter: return _value*9.80665e7; - case PressureUnit.TonneForcePerSquareMeter: return _value*9.80665e3; - case PressureUnit.TonneForcePerSquareMillimeter: return _value*9.80665e9; - case PressureUnit.Torr: return _value*1.3332266752*1e2; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(PressureUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case PressureUnit.Atmosphere: return baseUnitValue/(1.01325*1e5); - case PressureUnit.Bar: return baseUnitValue/1e5; - case PressureUnit.Centibar: return (baseUnitValue/1e5) / 1e-2d; - case PressureUnit.Decapascal: return (baseUnitValue) / 1e1d; - case PressureUnit.Decibar: return (baseUnitValue/1e5) / 1e-1d; - case PressureUnit.FootOfHead: return baseUnitValue*0.000334552565551; - case PressureUnit.Gigapascal: return (baseUnitValue) / 1e9d; - case PressureUnit.Hectopascal: return (baseUnitValue) / 1e2d; - case PressureUnit.InchOfMercury: return baseUnitValue*2.95299830714159e-4; - case PressureUnit.Kilobar: return (baseUnitValue/1e5) / 1e3d; - case PressureUnit.KilogramForcePerSquareCentimeter: return baseUnitValue/9.80665e4; - case PressureUnit.KilogramForcePerSquareMeter: return baseUnitValue*0.101971619222242; - case PressureUnit.KilogramForcePerSquareMillimeter: return baseUnitValue/9.80665e6; - case PressureUnit.KilonewtonPerSquareCentimeter: return (baseUnitValue/1e4) / 1e3d; - case PressureUnit.KilonewtonPerSquareMeter: return (baseUnitValue) / 1e3d; - case PressureUnit.KilonewtonPerSquareMillimeter: return (baseUnitValue/1e6) / 1e3d; - case PressureUnit.Kilopascal: return (baseUnitValue) / 1e3d; - case PressureUnit.KilopoundForcePerSquareFoot: return (baseUnitValue/4.788025898033584e1) / 1e3d; - case PressureUnit.KilopoundForcePerSquareInch: return (baseUnitValue/6.894757293168361e3) / 1e3d; - case PressureUnit.Megabar: return (baseUnitValue/1e5) / 1e6d; - case PressureUnit.MeganewtonPerSquareMeter: return (baseUnitValue) / 1e6d; - case PressureUnit.Megapascal: return (baseUnitValue) / 1e6d; - case PressureUnit.MeterOfHead: return baseUnitValue*0.0001019977334; - case PressureUnit.Micropascal: return (baseUnitValue) / 1e-6d; - case PressureUnit.Millibar: return (baseUnitValue/1e5) / 1e-3d; - case PressureUnit.MillimeterOfMercury: return baseUnitValue*7.50061561302643e-3; - case PressureUnit.NewtonPerSquareCentimeter: return baseUnitValue/1e4; - case PressureUnit.NewtonPerSquareMeter: return baseUnitValue; - case PressureUnit.NewtonPerSquareMillimeter: return baseUnitValue/1e6; - case PressureUnit.Pascal: return baseUnitValue; - case PressureUnit.PoundForcePerSquareFoot: return baseUnitValue/4.788025898033584e1; - case PressureUnit.PoundForcePerSquareInch: return baseUnitValue/6.894757293168361e3; - case PressureUnit.TechnicalAtmosphere: return baseUnitValue/(9.80680592331*1e4); - case PressureUnit.TonneForcePerSquareCentimeter: return baseUnitValue/9.80665e7; - case PressureUnit.TonneForcePerSquareMeter: return baseUnitValue/9.80665e3; - case PressureUnit.TonneForcePerSquareMillimeter: return baseUnitValue/9.80665e9; - case PressureUnit.Torr: return baseUnitValue/(1.3332266752*1e2); - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Pressure Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Pressure result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out PressureUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Pressure ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) - { - result = default(Pressure); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static PressureUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == PressureUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureUnit unit) - { - unit = PressureUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == PressureUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(PressureUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Pressure - /// - public static Pressure MaxValue => new Pressure(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Pressure - /// - public static Pressure MinValue => new Pressure(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Pressure.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Pressure.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs deleted file mode 100644 index db9a9d9670..0000000000 --- a/Common/GeneratedCode/Quantities/PressureChangeRate.Common.g.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class PressureChangeRate : IQuantity -#else - public partial struct PressureChangeRate : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly PressureChangeRateUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public PressureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static PressureChangeRate() - { - BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - PressureChangeRate(double numericValue, PressureChangeRateUnit unit) - { - if(unit == PressureChangeRateUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.PressureChangeRate; - - /// - /// The base unit of PressureChangeRate, which is PascalPerSecond. All conversions go via this value. - /// - public static PressureChangeRateUnit BaseUnit => PressureChangeRateUnit.PascalPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the PressureChangeRate quantity. - /// - public static PressureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(PressureChangeRateUnit)).Cast().Except(new PressureChangeRateUnit[]{ PressureChangeRateUnit.Undefined }).ToArray(); - - /// - /// Get PressureChangeRate in AtmospheresPerSecond. - /// - public double AtmospheresPerSecond => As(PressureChangeRateUnit.AtmospherePerSecond); - - /// - /// Get PressureChangeRate in KilopascalsPerSecond. - /// - public double KilopascalsPerSecond => As(PressureChangeRateUnit.KilopascalPerSecond); - - /// - /// Get PressureChangeRate in MegapascalsPerSecond. - /// - public double MegapascalsPerSecond => As(PressureChangeRateUnit.MegapascalPerSecond); - - /// - /// Get PressureChangeRate in PascalsPerSecond. - /// - public double PascalsPerSecond => As(PressureChangeRateUnit.PascalPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit PascalPerSecond. - /// - public static PressureChangeRate Zero => new PressureChangeRate(0, BaseUnit); - - /// - /// Get PressureChangeRate from AtmospheresPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PressureChangeRate FromAtmospheresPerSecond(double atmospherespersecond) -#else - public static PressureChangeRate FromAtmospheresPerSecond(QuantityValue atmospherespersecond) -#endif - { - double value = (double) atmospherespersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.AtmospherePerSecond); - } - - /// - /// Get PressureChangeRate from KilopascalsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PressureChangeRate FromKilopascalsPerSecond(double kilopascalspersecond) -#else - public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopascalspersecond) -#endif - { - double value = (double) kilopascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerSecond); - } - - /// - /// Get PressureChangeRate from MegapascalsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PressureChangeRate FromMegapascalsPerSecond(double megapascalspersecond) -#else - public static PressureChangeRate FromMegapascalsPerSecond(QuantityValue megapascalspersecond) -#endif - { - double value = (double) megapascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerSecond); - } - - /// - /// Get PressureChangeRate from PascalsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static PressureChangeRate FromPascalsPerSecond(double pascalspersecond) -#else - public static PressureChangeRate FromPascalsPerSecond(QuantityValue pascalspersecond) -#endif - { - double value = (double) pascalspersecond; - return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// PressureChangeRate unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static PressureChangeRate From(double value, PressureChangeRateUnit fromUnit) -#else - public static PressureChangeRate From(QuantityValue value, PressureChangeRateUnit fromUnit) -#endif - { - return new PressureChangeRate((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(PressureChangeRateUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); - - return CompareTo((PressureChangeRate)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(PressureChangeRate other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another PressureChangeRate within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current PressureChangeRate. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(PressureChangeRateUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this PressureChangeRate to another PressureChangeRate with the unit representation . - /// - /// A PressureChangeRate with the specified unit. - public PressureChangeRate ToUnit(PressureChangeRateUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new PressureChangeRate(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case PressureChangeRateUnit.AtmospherePerSecond: return _value * 1.01325*1e5; - case PressureChangeRateUnit.KilopascalPerSecond: return (_value) * 1e3d; - case PressureChangeRateUnit.MegapascalPerSecond: return (_value) * 1e6d; - case PressureChangeRateUnit.PascalPerSecond: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(PressureChangeRateUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case PressureChangeRateUnit.AtmospherePerSecond: return baseUnitValue / (1.01325*1e5); - case PressureChangeRateUnit.KilopascalPerSecond: return (baseUnitValue) / 1e3d; - case PressureChangeRateUnit.MegapascalPerSecond: return (baseUnitValue) / 1e6d; - case PressureChangeRateUnit.PascalPerSecond: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static PressureChangeRate Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out PressureChangeRate result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static PressureChangeRateUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out PressureChangeRateUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static PressureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) - { - result = default(PressureChangeRate); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static PressureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == PressureChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized PressureChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out PressureChangeRateUnit unit) - { - unit = PressureChangeRateUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == PressureChangeRateUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(PressureChangeRateUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of PressureChangeRate - /// - public static PressureChangeRate MaxValue => new PressureChangeRate(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of PressureChangeRate - /// - public static PressureChangeRate MinValue => new PressureChangeRate(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => PressureChangeRate.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => PressureChangeRate.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs b/Common/GeneratedCode/Quantities/Ratio.Common.g.cs deleted file mode 100644 index 2f15162ea9..0000000000 --- a/Common/GeneratedCode/Quantities/Ratio.Common.g.cs +++ /dev/null @@ -1,646 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Ratio : IQuantity -#else - public partial struct Ratio : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly RatioUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public RatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Ratio() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Ratio(double numericValue, RatioUnit unit) - { - if(unit == RatioUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Ratio; - - /// - /// The base unit of Ratio, which is DecimalFraction. All conversions go via this value. - /// - public static RatioUnit BaseUnit => RatioUnit.DecimalFraction; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Ratio quantity. - /// - public static RatioUnit[] Units { get; } = Enum.GetValues(typeof(RatioUnit)).Cast().Except(new RatioUnit[]{ RatioUnit.Undefined }).ToArray(); - - /// - /// Get Ratio in DecimalFractions. - /// - public double DecimalFractions => As(RatioUnit.DecimalFraction); - - /// - /// Get Ratio in PartsPerBillion. - /// - public double PartsPerBillion => As(RatioUnit.PartPerBillion); - - /// - /// Get Ratio in PartsPerMillion. - /// - public double PartsPerMillion => As(RatioUnit.PartPerMillion); - - /// - /// Get Ratio in PartsPerThousand. - /// - public double PartsPerThousand => As(RatioUnit.PartPerThousand); - - /// - /// Get Ratio in PartsPerTrillion. - /// - public double PartsPerTrillion => As(RatioUnit.PartPerTrillion); - - /// - /// Get Ratio in Percent. - /// - public double Percent => As(RatioUnit.Percent); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. - /// - public static Ratio Zero => new Ratio(0, BaseUnit); - - /// - /// Get Ratio from DecimalFractions. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Ratio FromDecimalFractions(double decimalfractions) -#else - public static Ratio FromDecimalFractions(QuantityValue decimalfractions) -#endif - { - double value = (double) decimalfractions; - return new Ratio(value, RatioUnit.DecimalFraction); - } - - /// - /// Get Ratio from PartsPerBillion. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Ratio FromPartsPerBillion(double partsperbillion) -#else - public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) -#endif - { - double value = (double) partsperbillion; - return new Ratio(value, RatioUnit.PartPerBillion); - } - - /// - /// Get Ratio from PartsPerMillion. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Ratio FromPartsPerMillion(double partspermillion) -#else - public static Ratio FromPartsPerMillion(QuantityValue partspermillion) -#endif - { - double value = (double) partspermillion; - return new Ratio(value, RatioUnit.PartPerMillion); - } - - /// - /// Get Ratio from PartsPerThousand. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Ratio FromPartsPerThousand(double partsperthousand) -#else - public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) -#endif - { - double value = (double) partsperthousand; - return new Ratio(value, RatioUnit.PartPerThousand); - } - - /// - /// Get Ratio from PartsPerTrillion. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Ratio FromPartsPerTrillion(double partspertrillion) -#else - public static Ratio FromPartsPerTrillion(QuantityValue partspertrillion) -#endif - { - double value = (double) partspertrillion; - return new Ratio(value, RatioUnit.PartPerTrillion); - } - - /// - /// Get Ratio from Percent. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Ratio FromPercent(double percent) -#else - public static Ratio FromPercent(QuantityValue percent) -#endif - { - double value = (double) percent; - return new Ratio(value, RatioUnit.Percent); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Ratio unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Ratio From(double value, RatioUnit fromUnit) -#else - public static Ratio From(QuantityValue value, RatioUnit fromUnit) -#endif - { - return new Ratio((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RatioUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Ratio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); - - return CompareTo((Ratio)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Ratio other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Ratio within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Ratio. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(RatioUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Ratio to another Ratio with the unit representation . - /// - /// A Ratio with the specified unit. - public Ratio ToUnit(RatioUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Ratio(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case RatioUnit.DecimalFraction: return _value; - case RatioUnit.PartPerBillion: return _value/1e9; - case RatioUnit.PartPerMillion: return _value/1e6; - case RatioUnit.PartPerThousand: return _value/1e3; - case RatioUnit.PartPerTrillion: return _value/1e12; - case RatioUnit.Percent: return _value/1e2; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(RatioUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case RatioUnit.DecimalFraction: return baseUnitValue; - case RatioUnit.PartPerBillion: return baseUnitValue*1e9; - case RatioUnit.PartPerMillion: return baseUnitValue*1e6; - case RatioUnit.PartPerThousand: return baseUnitValue*1e3; - case RatioUnit.PartPerTrillion: return baseUnitValue*1e12; - case RatioUnit.Percent: return baseUnitValue*1e2; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Ratio Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Ratio result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RatioUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out RatioUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Ratio ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) - { - result = default(Ratio); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static RatioUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == RatioUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RatioUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RatioUnit unit) - { - unit = RatioUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == RatioUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(RatioUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Ratio - /// - public static Ratio MaxValue => new Ratio(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Ratio - /// - public static Ratio MinValue => new Ratio(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Ratio.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Ratio.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs deleted file mode 100644 index b6e38f715b..0000000000 --- a/Common/GeneratedCode/Quantities/ReactiveEnergy.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ReactiveEnergy : IQuantity -#else - public partial struct ReactiveEnergy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ReactiveEnergyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ReactiveEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ReactiveEnergy() - { - BaseDimensions = new BaseDimensions(2, 1, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ReactiveEnergy(double numericValue, ReactiveEnergyUnit unit) - { - if(unit == ReactiveEnergyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ReactiveEnergy; - - /// - /// The base unit of ReactiveEnergy, which is VoltampereReactiveHour. All conversions go via this value. - /// - public static ReactiveEnergyUnit BaseUnit => ReactiveEnergyUnit.VoltampereReactiveHour; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ReactiveEnergy quantity. - /// - public static ReactiveEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ReactiveEnergyUnit)).Cast().Except(new ReactiveEnergyUnit[]{ ReactiveEnergyUnit.Undefined }).ToArray(); - - /// - /// Get ReactiveEnergy in KilovoltampereReactiveHours. - /// - public double KilovoltampereReactiveHours => As(ReactiveEnergyUnit.KilovoltampereReactiveHour); - - /// - /// Get ReactiveEnergy in MegavoltampereReactiveHours. - /// - public double MegavoltampereReactiveHours => As(ReactiveEnergyUnit.MegavoltampereReactiveHour); - - /// - /// Get ReactiveEnergy in VoltampereReactiveHours. - /// - public double VoltampereReactiveHours => As(ReactiveEnergyUnit.VoltampereReactiveHour); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactiveHour. - /// - public static ReactiveEnergy Zero => new ReactiveEnergy(0, BaseUnit); - - /// - /// Get ReactiveEnergy from KilovoltampereReactiveHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ReactiveEnergy FromKilovoltampereReactiveHours(double kilovoltamperereactivehours) -#else - public static ReactiveEnergy FromKilovoltampereReactiveHours(QuantityValue kilovoltamperereactivehours) -#endif - { - double value = (double) kilovoltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.KilovoltampereReactiveHour); - } - - /// - /// Get ReactiveEnergy from MegavoltampereReactiveHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ReactiveEnergy FromMegavoltampereReactiveHours(double megavoltamperereactivehours) -#else - public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megavoltamperereactivehours) -#endif - { - double value = (double) megavoltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.MegavoltampereReactiveHour); - } - - /// - /// Get ReactiveEnergy from VoltampereReactiveHours. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ReactiveEnergy FromVoltampereReactiveHours(double voltamperereactivehours) -#else - public static ReactiveEnergy FromVoltampereReactiveHours(QuantityValue voltamperereactivehours) -#endif - { - double value = (double) voltamperereactivehours; - return new ReactiveEnergy(value, ReactiveEnergyUnit.VoltampereReactiveHour); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ReactiveEnergy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ReactiveEnergy From(double value, ReactiveEnergyUnit fromUnit) -#else - public static ReactiveEnergy From(QuantityValue value, ReactiveEnergyUnit fromUnit) -#endif - { - return new ReactiveEnergy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ReactiveEnergyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); - - return CompareTo((ReactiveEnergy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ReactiveEnergy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ReactiveEnergy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ReactiveEnergy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ReactiveEnergyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ReactiveEnergy to another ReactiveEnergy with the unit representation . - /// - /// A ReactiveEnergy with the specified unit. - public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ReactiveEnergy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (_value) * 1e3d; - case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (_value) * 1e6d; - case ReactiveEnergyUnit.VoltampereReactiveHour: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ReactiveEnergyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (baseUnitValue) / 1e3d; - case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (baseUnitValue) / 1e6d; - case ReactiveEnergyUnit.VoltampereReactiveHour: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ReactiveEnergy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactiveEnergyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ReactiveEnergyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ReactiveEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) - { - result = default(ReactiveEnergy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ReactiveEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ReactiveEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactiveEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactiveEnergyUnit unit) - { - unit = ReactiveEnergyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ReactiveEnergyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ReactiveEnergyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ReactiveEnergy - /// - public static ReactiveEnergy MaxValue => new ReactiveEnergy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ReactiveEnergy - /// - public static ReactiveEnergy MinValue => new ReactiveEnergy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ReactiveEnergy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ReactiveEnergy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs b/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs deleted file mode 100644 index e97faed80e..0000000000 --- a/Common/GeneratedCode/Quantities/ReactivePower.Common.g.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ReactivePower : IQuantity -#else - public partial struct ReactivePower : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ReactivePowerUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ReactivePowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ReactivePower() - { - BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ReactivePower(double numericValue, ReactivePowerUnit unit) - { - if(unit == ReactivePowerUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ReactivePower; - - /// - /// The base unit of ReactivePower, which is VoltampereReactive. All conversions go via this value. - /// - public static ReactivePowerUnit BaseUnit => ReactivePowerUnit.VoltampereReactive; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ReactivePower quantity. - /// - public static ReactivePowerUnit[] Units { get; } = Enum.GetValues(typeof(ReactivePowerUnit)).Cast().Except(new ReactivePowerUnit[]{ ReactivePowerUnit.Undefined }).ToArray(); - - /// - /// Get ReactivePower in GigavoltamperesReactive. - /// - public double GigavoltamperesReactive => As(ReactivePowerUnit.GigavoltampereReactive); - - /// - /// Get ReactivePower in KilovoltamperesReactive. - /// - public double KilovoltamperesReactive => As(ReactivePowerUnit.KilovoltampereReactive); - - /// - /// Get ReactivePower in MegavoltamperesReactive. - /// - public double MegavoltamperesReactive => As(ReactivePowerUnit.MegavoltampereReactive); - - /// - /// Get ReactivePower in VoltamperesReactive. - /// - public double VoltamperesReactive => As(ReactivePowerUnit.VoltampereReactive); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactive. - /// - public static ReactivePower Zero => new ReactivePower(0, BaseUnit); - - /// - /// Get ReactivePower from GigavoltamperesReactive. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ReactivePower FromGigavoltamperesReactive(double gigavoltamperesreactive) -#else - public static ReactivePower FromGigavoltamperesReactive(QuantityValue gigavoltamperesreactive) -#endif - { - double value = (double) gigavoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.GigavoltampereReactive); - } - - /// - /// Get ReactivePower from KilovoltamperesReactive. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ReactivePower FromKilovoltamperesReactive(double kilovoltamperesreactive) -#else - public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltamperesreactive) -#endif - { - double value = (double) kilovoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.KilovoltampereReactive); - } - - /// - /// Get ReactivePower from MegavoltamperesReactive. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ReactivePower FromMegavoltamperesReactive(double megavoltamperesreactive) -#else - public static ReactivePower FromMegavoltamperesReactive(QuantityValue megavoltamperesreactive) -#endif - { - double value = (double) megavoltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.MegavoltampereReactive); - } - - /// - /// Get ReactivePower from VoltamperesReactive. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ReactivePower FromVoltamperesReactive(double voltamperesreactive) -#else - public static ReactivePower FromVoltamperesReactive(QuantityValue voltamperesreactive) -#endif - { - double value = (double) voltamperesreactive; - return new ReactivePower(value, ReactivePowerUnit.VoltampereReactive); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ReactivePower unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ReactivePower From(double value, ReactivePowerUnit fromUnit) -#else - public static ReactivePower From(QuantityValue value, ReactivePowerUnit fromUnit) -#endif - { - return new ReactivePower((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ReactivePowerUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); - - return CompareTo((ReactivePower)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ReactivePower other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ReactivePower within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ReactivePower. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ReactivePowerUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ReactivePower to another ReactivePower with the unit representation . - /// - /// A ReactivePower with the specified unit. - public ReactivePower ToUnit(ReactivePowerUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ReactivePower(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ReactivePowerUnit.GigavoltampereReactive: return (_value) * 1e9d; - case ReactivePowerUnit.KilovoltampereReactive: return (_value) * 1e3d; - case ReactivePowerUnit.MegavoltampereReactive: return (_value) * 1e6d; - case ReactivePowerUnit.VoltampereReactive: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ReactivePowerUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ReactivePowerUnit.GigavoltampereReactive: return (baseUnitValue) / 1e9d; - case ReactivePowerUnit.KilovoltampereReactive: return (baseUnitValue) / 1e3d; - case ReactivePowerUnit.MegavoltampereReactive: return (baseUnitValue) / 1e6d; - case ReactivePowerUnit.VoltampereReactive: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ReactivePower Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ReactivePower result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ReactivePowerUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ReactivePowerUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ReactivePower ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) - { - result = default(ReactivePower); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ReactivePowerUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ReactivePowerUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ReactivePowerUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ReactivePowerUnit unit) - { - unit = ReactivePowerUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ReactivePowerUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ReactivePowerUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ReactivePower - /// - public static ReactivePower MaxValue => new ReactivePower(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ReactivePower - /// - public static ReactivePower MinValue => new ReactivePower(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ReactivePower.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ReactivePower.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs deleted file mode 100644 index 54863e9bca..0000000000 --- a/Common/GeneratedCode/Quantities/RotationalAcceleration.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Angular acceleration is the rate of change of rotational speed. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class RotationalAcceleration : IQuantity -#else - public partial struct RotationalAcceleration : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly RotationalAccelerationUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public RotationalAccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static RotationalAcceleration() - { - BaseDimensions = new BaseDimensions(0, 0, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - RotationalAcceleration(double numericValue, RotationalAccelerationUnit unit) - { - if(unit == RotationalAccelerationUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.RotationalAcceleration; - - /// - /// The base unit of RotationalAcceleration, which is RadianPerSecondSquared. All conversions go via this value. - /// - public static RotationalAccelerationUnit BaseUnit => RotationalAccelerationUnit.RadianPerSecondSquared; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the RotationalAcceleration quantity. - /// - public static RotationalAccelerationUnit[] Units { get; } = Enum.GetValues(typeof(RotationalAccelerationUnit)).Cast().Except(new RotationalAccelerationUnit[]{ RotationalAccelerationUnit.Undefined }).ToArray(); - - /// - /// Get RotationalAcceleration in DegreesPerSecondSquared. - /// - public double DegreesPerSecondSquared => As(RotationalAccelerationUnit.DegreePerSecondSquared); - - /// - /// Get RotationalAcceleration in RadiansPerSecondSquared. - /// - public double RadiansPerSecondSquared => As(RotationalAccelerationUnit.RadianPerSecondSquared); - - /// - /// Get RotationalAcceleration in RevolutionsPerMinutePerSecond. - /// - public double RevolutionsPerMinutePerSecond => As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecondSquared. - /// - public static RotationalAcceleration Zero => new RotationalAcceleration(0, BaseUnit); - - /// - /// Get RotationalAcceleration from DegreesPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalAcceleration FromDegreesPerSecondSquared(double degreespersecondsquared) -#else - public static RotationalAcceleration FromDegreesPerSecondSquared(QuantityValue degreespersecondsquared) -#endif - { - double value = (double) degreespersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.DegreePerSecondSquared); - } - - /// - /// Get RotationalAcceleration from RadiansPerSecondSquared. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalAcceleration FromRadiansPerSecondSquared(double radianspersecondsquared) -#else - public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue radianspersecondsquared) -#endif - { - double value = (double) radianspersecondsquared; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RadianPerSecondSquared); - } - - /// - /// Get RotationalAcceleration from RevolutionsPerMinutePerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(double revolutionsperminutepersecond) -#else - public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(QuantityValue revolutionsperminutepersecond) -#endif - { - double value = (double) revolutionsperminutepersecond; - return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalAcceleration unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static RotationalAcceleration From(double value, RotationalAccelerationUnit fromUnit) -#else - public static RotationalAcceleration From(QuantityValue value, RotationalAccelerationUnit fromUnit) -#endif - { - return new RotationalAcceleration((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalAccelerationUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); - - return CompareTo((RotationalAcceleration)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(RotationalAcceleration other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another RotationalAcceleration within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current RotationalAcceleration. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(RotationalAccelerationUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this RotationalAcceleration to another RotationalAcceleration with the unit representation . - /// - /// A RotationalAcceleration with the specified unit. - public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new RotationalAcceleration(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case RotationalAccelerationUnit.DegreePerSecondSquared: return (Math.PI/180)*_value; - case RotationalAccelerationUnit.RadianPerSecondSquared: return _value; - case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return ((2*Math.PI)/60)*_value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(RotationalAccelerationUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case RotationalAccelerationUnit.DegreePerSecondSquared: return (180/Math.PI)*baseUnitValue; - case RotationalAccelerationUnit.RadianPerSecondSquared: return baseUnitValue; - case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return (60/(2*Math.PI))*baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalAcceleration Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out RotationalAcceleration result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalAccelerationUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out RotationalAccelerationUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static RotationalAcceleration ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) - { - result = default(RotationalAcceleration); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static RotationalAccelerationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == RotationalAccelerationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalAccelerationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalAccelerationUnit unit) - { - unit = RotationalAccelerationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == RotationalAccelerationUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(RotationalAccelerationUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of RotationalAcceleration - /// - public static RotationalAcceleration MaxValue => new RotationalAcceleration(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of RotationalAcceleration - /// - public static RotationalAcceleration MinValue => new RotationalAcceleration(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => RotationalAcceleration.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => RotationalAcceleration.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs deleted file mode 100644 index c03e2d0da3..0000000000 --- a/Common/GeneratedCode/Quantities/RotationalSpeed.Common.g.cs +++ /dev/null @@ -1,801 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class RotationalSpeed : IQuantity -#else - public partial struct RotationalSpeed : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly RotationalSpeedUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public RotationalSpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static RotationalSpeed() - { - BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - RotationalSpeed(double numericValue, RotationalSpeedUnit unit) - { - if(unit == RotationalSpeedUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.RotationalSpeed; - - /// - /// The base unit of RotationalSpeed, which is RadianPerSecond. All conversions go via this value. - /// - public static RotationalSpeedUnit BaseUnit => RotationalSpeedUnit.RadianPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the RotationalSpeed quantity. - /// - public static RotationalSpeedUnit[] Units { get; } = Enum.GetValues(typeof(RotationalSpeedUnit)).Cast().Except(new RotationalSpeedUnit[]{ RotationalSpeedUnit.Undefined }).ToArray(); - - /// - /// Get RotationalSpeed in CentiradiansPerSecond. - /// - public double CentiradiansPerSecond => As(RotationalSpeedUnit.CentiradianPerSecond); - - /// - /// Get RotationalSpeed in DeciradiansPerSecond. - /// - public double DeciradiansPerSecond => As(RotationalSpeedUnit.DeciradianPerSecond); - - /// - /// Get RotationalSpeed in DegreesPerMinute. - /// - public double DegreesPerMinute => As(RotationalSpeedUnit.DegreePerMinute); - - /// - /// Get RotationalSpeed in DegreesPerSecond. - /// - public double DegreesPerSecond => As(RotationalSpeedUnit.DegreePerSecond); - - /// - /// Get RotationalSpeed in MicrodegreesPerSecond. - /// - public double MicrodegreesPerSecond => As(RotationalSpeedUnit.MicrodegreePerSecond); - - /// - /// Get RotationalSpeed in MicroradiansPerSecond. - /// - public double MicroradiansPerSecond => As(RotationalSpeedUnit.MicroradianPerSecond); - - /// - /// Get RotationalSpeed in MillidegreesPerSecond. - /// - public double MillidegreesPerSecond => As(RotationalSpeedUnit.MillidegreePerSecond); - - /// - /// Get RotationalSpeed in MilliradiansPerSecond. - /// - public double MilliradiansPerSecond => As(RotationalSpeedUnit.MilliradianPerSecond); - - /// - /// Get RotationalSpeed in NanodegreesPerSecond. - /// - public double NanodegreesPerSecond => As(RotationalSpeedUnit.NanodegreePerSecond); - - /// - /// Get RotationalSpeed in NanoradiansPerSecond. - /// - public double NanoradiansPerSecond => As(RotationalSpeedUnit.NanoradianPerSecond); - - /// - /// Get RotationalSpeed in RadiansPerSecond. - /// - public double RadiansPerSecond => As(RotationalSpeedUnit.RadianPerSecond); - - /// - /// Get RotationalSpeed in RevolutionsPerMinute. - /// - public double RevolutionsPerMinute => As(RotationalSpeedUnit.RevolutionPerMinute); - - /// - /// Get RotationalSpeed in RevolutionsPerSecond. - /// - public double RevolutionsPerSecond => As(RotationalSpeedUnit.RevolutionPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecond. - /// - public static RotationalSpeed Zero => new RotationalSpeed(0, BaseUnit); - - /// - /// Get RotationalSpeed from CentiradiansPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromCentiradiansPerSecond(double centiradianspersecond) -#else - public static RotationalSpeed FromCentiradiansPerSecond(QuantityValue centiradianspersecond) -#endif - { - double value = (double) centiradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.CentiradianPerSecond); - } - - /// - /// Get RotationalSpeed from DeciradiansPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromDeciradiansPerSecond(double deciradianspersecond) -#else - public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradianspersecond) -#endif - { - double value = (double) deciradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.DeciradianPerSecond); - } - - /// - /// Get RotationalSpeed from DegreesPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromDegreesPerMinute(double degreesperminute) -#else - public static RotationalSpeed FromDegreesPerMinute(QuantityValue degreesperminute) -#endif - { - double value = (double) degreesperminute; - return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerMinute); - } - - /// - /// Get RotationalSpeed from DegreesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromDegreesPerSecond(double degreespersecond) -#else - public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecond) -#endif - { - double value = (double) degreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerSecond); - } - - /// - /// Get RotationalSpeed from MicrodegreesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromMicrodegreesPerSecond(double microdegreespersecond) -#else - public static RotationalSpeed FromMicrodegreesPerSecond(QuantityValue microdegreespersecond) -#endif - { - double value = (double) microdegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MicrodegreePerSecond); - } - - /// - /// Get RotationalSpeed from MicroradiansPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromMicroradiansPerSecond(double microradianspersecond) -#else - public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradianspersecond) -#endif - { - double value = (double) microradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MicroradianPerSecond); - } - - /// - /// Get RotationalSpeed from MillidegreesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromMillidegreesPerSecond(double millidegreespersecond) -#else - public static RotationalSpeed FromMillidegreesPerSecond(QuantityValue millidegreespersecond) -#endif - { - double value = (double) millidegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MillidegreePerSecond); - } - - /// - /// Get RotationalSpeed from MilliradiansPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromMilliradiansPerSecond(double milliradianspersecond) -#else - public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradianspersecond) -#endif - { - double value = (double) milliradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.MilliradianPerSecond); - } - - /// - /// Get RotationalSpeed from NanodegreesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromNanodegreesPerSecond(double nanodegreespersecond) -#else - public static RotationalSpeed FromNanodegreesPerSecond(QuantityValue nanodegreespersecond) -#endif - { - double value = (double) nanodegreespersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.NanodegreePerSecond); - } - - /// - /// Get RotationalSpeed from NanoradiansPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromNanoradiansPerSecond(double nanoradianspersecond) -#else - public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradianspersecond) -#endif - { - double value = (double) nanoradianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.NanoradianPerSecond); - } - - /// - /// Get RotationalSpeed from RadiansPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromRadiansPerSecond(double radianspersecond) -#else - public static RotationalSpeed FromRadiansPerSecond(QuantityValue radianspersecond) -#endif - { - double value = (double) radianspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.RadianPerSecond); - } - - /// - /// Get RotationalSpeed from RevolutionsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromRevolutionsPerMinute(double revolutionsperminute) -#else - public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutionsperminute) -#endif - { - double value = (double) revolutionsperminute; - return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerMinute); - } - - /// - /// Get RotationalSpeed from RevolutionsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalSpeed FromRevolutionsPerSecond(double revolutionspersecond) -#else - public static RotationalSpeed FromRevolutionsPerSecond(QuantityValue revolutionspersecond) -#endif - { - double value = (double) revolutionspersecond; - return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalSpeed unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static RotationalSpeed From(double value, RotationalSpeedUnit fromUnit) -#else - public static RotationalSpeed From(QuantityValue value, RotationalSpeedUnit fromUnit) -#endif - { - return new RotationalSpeed((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalSpeedUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); - - return CompareTo((RotationalSpeed)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(RotationalSpeed other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another RotationalSpeed within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current RotationalSpeed. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(RotationalSpeedUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this RotationalSpeed to another RotationalSpeed with the unit representation . - /// - /// A RotationalSpeed with the specified unit. - public RotationalSpeed ToUnit(RotationalSpeedUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new RotationalSpeed(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case RotationalSpeedUnit.CentiradianPerSecond: return (_value) * 1e-2d; - case RotationalSpeedUnit.DeciradianPerSecond: return (_value) * 1e-1d; - case RotationalSpeedUnit.DegreePerMinute: return (Math.PI/(180*60))*_value; - case RotationalSpeedUnit.DegreePerSecond: return (Math.PI/180)*_value; - case RotationalSpeedUnit.MicrodegreePerSecond: return ((Math.PI/180)*_value) * 1e-6d; - case RotationalSpeedUnit.MicroradianPerSecond: return (_value) * 1e-6d; - case RotationalSpeedUnit.MillidegreePerSecond: return ((Math.PI/180)*_value) * 1e-3d; - case RotationalSpeedUnit.MilliradianPerSecond: return (_value) * 1e-3d; - case RotationalSpeedUnit.NanodegreePerSecond: return ((Math.PI/180)*_value) * 1e-9d; - case RotationalSpeedUnit.NanoradianPerSecond: return (_value) * 1e-9d; - case RotationalSpeedUnit.RadianPerSecond: return _value; - case RotationalSpeedUnit.RevolutionPerMinute: return (_value*6.2831853072)/60; - case RotationalSpeedUnit.RevolutionPerSecond: return _value*6.2831853072; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(RotationalSpeedUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case RotationalSpeedUnit.CentiradianPerSecond: return (baseUnitValue) / 1e-2d; - case RotationalSpeedUnit.DeciradianPerSecond: return (baseUnitValue) / 1e-1d; - case RotationalSpeedUnit.DegreePerMinute: return (180*60/Math.PI)*baseUnitValue; - case RotationalSpeedUnit.DegreePerSecond: return (180/Math.PI)*baseUnitValue; - case RotationalSpeedUnit.MicrodegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-6d; - case RotationalSpeedUnit.MicroradianPerSecond: return (baseUnitValue) / 1e-6d; - case RotationalSpeedUnit.MillidegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-3d; - case RotationalSpeedUnit.MilliradianPerSecond: return (baseUnitValue) / 1e-3d; - case RotationalSpeedUnit.NanodegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-9d; - case RotationalSpeedUnit.NanoradianPerSecond: return (baseUnitValue) / 1e-9d; - case RotationalSpeedUnit.RadianPerSecond: return baseUnitValue; - case RotationalSpeedUnit.RevolutionPerMinute: return (baseUnitValue/6.2831853072)*60; - case RotationalSpeedUnit.RevolutionPerSecond: return baseUnitValue/6.2831853072; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalSpeed Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalSpeedUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out RotationalSpeedUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static RotationalSpeed ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) - { - result = default(RotationalSpeed); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static RotationalSpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == RotationalSpeedUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalSpeedUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalSpeedUnit unit) - { - unit = RotationalSpeedUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == RotationalSpeedUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(RotationalSpeedUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of RotationalSpeed - /// - public static RotationalSpeed MaxValue => new RotationalSpeed(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of RotationalSpeed - /// - public static RotationalSpeed MinValue => new RotationalSpeed(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => RotationalSpeed.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => RotationalSpeed.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs deleted file mode 100644 index f3a2d2b280..0000000000 --- a/Common/GeneratedCode/Quantities/RotationalStiffness.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class RotationalStiffness : IQuantity -#else - public partial struct RotationalStiffness : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly RotationalStiffnessUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public RotationalStiffnessUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static RotationalStiffness() - { - BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - RotationalStiffness(double numericValue, RotationalStiffnessUnit unit) - { - if(unit == RotationalStiffnessUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.RotationalStiffness; - - /// - /// The base unit of RotationalStiffness, which is NewtonMeterPerRadian. All conversions go via this value. - /// - public static RotationalStiffnessUnit BaseUnit => RotationalStiffnessUnit.NewtonMeterPerRadian; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the RotationalStiffness quantity. - /// - public static RotationalStiffnessUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessUnit)).Cast().Except(new RotationalStiffnessUnit[]{ RotationalStiffnessUnit.Undefined }).ToArray(); - - /// - /// Get RotationalStiffness in KilonewtonMetersPerRadian. - /// - public double KilonewtonMetersPerRadian => As(RotationalStiffnessUnit.KilonewtonMeterPerRadian); - - /// - /// Get RotationalStiffness in MeganewtonMetersPerRadian. - /// - public double MeganewtonMetersPerRadian => As(RotationalStiffnessUnit.MeganewtonMeterPerRadian); - - /// - /// Get RotationalStiffness in NewtonMetersPerRadian. - /// - public double NewtonMetersPerRadian => As(RotationalStiffnessUnit.NewtonMeterPerRadian); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadian. - /// - public static RotationalStiffness Zero => new RotationalStiffness(0, BaseUnit); - - /// - /// Get RotationalStiffness from KilonewtonMetersPerRadian. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalStiffness FromKilonewtonMetersPerRadian(double kilonewtonmetersperradian) -#else - public static RotationalStiffness FromKilonewtonMetersPerRadian(QuantityValue kilonewtonmetersperradian) -#endif - { - double value = (double) kilonewtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.KilonewtonMeterPerRadian); - } - - /// - /// Get RotationalStiffness from MeganewtonMetersPerRadian. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalStiffness FromMeganewtonMetersPerRadian(double meganewtonmetersperradian) -#else - public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue meganewtonmetersperradian) -#endif - { - double value = (double) meganewtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.MeganewtonMeterPerRadian); - } - - /// - /// Get RotationalStiffness from NewtonMetersPerRadian. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalStiffness FromNewtonMetersPerRadian(double newtonmetersperradian) -#else - public static RotationalStiffness FromNewtonMetersPerRadian(QuantityValue newtonmetersperradian) -#endif - { - double value = (double) newtonmetersperradian; - return new RotationalStiffness(value, RotationalStiffnessUnit.NewtonMeterPerRadian); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalStiffness unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static RotationalStiffness From(double value, RotationalStiffnessUnit fromUnit) -#else - public static RotationalStiffness From(QuantityValue value, RotationalStiffnessUnit fromUnit) -#endif - { - return new RotationalStiffness((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalStiffnessUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); - - return CompareTo((RotationalStiffness)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(RotationalStiffness other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another RotationalStiffness within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current RotationalStiffness. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(RotationalStiffnessUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this RotationalStiffness to another RotationalStiffness with the unit representation . - /// - /// A RotationalStiffness with the specified unit. - public RotationalStiffness ToUnit(RotationalStiffnessUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new RotationalStiffness(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (_value) * 1e3d; - case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (_value) * 1e6d; - case RotationalStiffnessUnit.NewtonMeterPerRadian: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(RotationalStiffnessUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (baseUnitValue) / 1e3d; - case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (baseUnitValue) / 1e6d; - case RotationalStiffnessUnit.NewtonMeterPerRadian: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalStiffness Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out RotationalStiffness result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out RotationalStiffnessUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static RotationalStiffness ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) - { - result = default(RotationalStiffness); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static RotationalStiffnessUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == RotationalStiffnessUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessUnit unit) - { - unit = RotationalStiffnessUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == RotationalStiffnessUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(RotationalStiffnessUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of RotationalStiffness - /// - public static RotationalStiffness MaxValue => new RotationalStiffness(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of RotationalStiffness - /// - public static RotationalStiffness MinValue => new RotationalStiffness(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => RotationalStiffness.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => RotationalStiffness.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs b/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs deleted file mode 100644 index d8b10b8930..0000000000 --- a/Common/GeneratedCode/Quantities/RotationalStiffnessPerLength.Common.g.cs +++ /dev/null @@ -1,581 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class RotationalStiffnessPerLength : IQuantity -#else - public partial struct RotationalStiffnessPerLength : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly RotationalStiffnessPerLengthUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public RotationalStiffnessPerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static RotationalStiffnessPerLength() - { - BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPerLengthUnit unit) - { - if(unit == RotationalStiffnessPerLengthUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.RotationalStiffnessPerLength; - - /// - /// The base unit of RotationalStiffnessPerLength, which is NewtonMeterPerRadianPerMeter. All conversions go via this value. - /// - public static RotationalStiffnessPerLengthUnit BaseUnit => RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the RotationalStiffnessPerLength quantity. - /// - public static RotationalStiffnessPerLengthUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast().Except(new RotationalStiffnessPerLengthUnit[]{ RotationalStiffnessPerLengthUnit.Undefined }).ToArray(); - - /// - /// Get RotationalStiffnessPerLength in KilonewtonMetersPerRadianPerMeter. - /// - public double KilonewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); - - /// - /// Get RotationalStiffnessPerLength in MeganewtonMetersPerRadianPerMeter. - /// - public double MeganewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); - - /// - /// Get RotationalStiffnessPerLength in NewtonMetersPerRadianPerMeter. - /// - public double NewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. - /// - public static RotationalStiffnessPerLength Zero => new RotationalStiffnessPerLength(0, BaseUnit); - - /// - /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(double kilonewtonmetersperradianpermeter) -#else - public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(QuantityValue kilonewtonmetersperradianpermeter) -#endif - { - double value = (double) kilonewtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); - } - - /// - /// Get RotationalStiffnessPerLength from MeganewtonMetersPerRadianPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(double meganewtonmetersperradianpermeter) -#else - public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(QuantityValue meganewtonmetersperradianpermeter) -#endif - { - double value = (double) meganewtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); - } - - /// - /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(double newtonmetersperradianpermeter) -#else - public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(QuantityValue newtonmetersperradianpermeter) -#endif - { - double value = (double) newtonmetersperradianpermeter; - return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalStiffnessPerLength unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static RotationalStiffnessPerLength From(double value, RotationalStiffnessPerLengthUnit fromUnit) -#else - public static RotationalStiffnessPerLength From(QuantityValue value, RotationalStiffnessPerLengthUnit fromUnit) -#endif - { - return new RotationalStiffnessPerLength((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); - - return CompareTo((RotationalStiffnessPerLength)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(RotationalStiffnessPerLength other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another RotationalStiffnessPerLength within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current RotationalStiffnessPerLength. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(RotationalStiffnessPerLengthUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this RotationalStiffnessPerLength to another RotationalStiffnessPerLength with the unit representation . - /// - /// A RotationalStiffnessPerLength with the specified unit. - public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new RotationalStiffnessPerLength(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (_value) * 1e3d; - case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (_value) * 1e6d; - case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(RotationalStiffnessPerLengthUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e3d; - case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e6d; - case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static RotationalStiffnessPerLength Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLength result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static RotationalStiffnessPerLengthUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out RotationalStiffnessPerLengthUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static RotationalStiffnessPerLength ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) - { - result = default(RotationalStiffnessPerLength); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static RotationalStiffnessPerLengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == RotationalStiffnessPerLengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized RotationalStiffnessPerLengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out RotationalStiffnessPerLengthUnit unit) - { - unit = RotationalStiffnessPerLengthUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == RotationalStiffnessPerLengthUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(RotationalStiffnessPerLengthUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of RotationalStiffnessPerLength - /// - public static RotationalStiffnessPerLength MaxValue => new RotationalStiffnessPerLength(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of RotationalStiffnessPerLength - /// - public static RotationalStiffnessPerLength MinValue => new RotationalStiffnessPerLength(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => RotationalStiffnessPerLength.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => RotationalStiffnessPerLength.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs b/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs deleted file mode 100644 index 344b7d5050..0000000000 --- a/Common/GeneratedCode/Quantities/SolidAngle.Common.g.cs +++ /dev/null @@ -1,536 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In geometry, a solid angle is the two-dimensional angle in three-dimensional space that an object subtends at a point. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class SolidAngle : IQuantity -#else - public partial struct SolidAngle : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly SolidAngleUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public SolidAngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static SolidAngle() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - SolidAngle(double numericValue, SolidAngleUnit unit) - { - if(unit == SolidAngleUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.SolidAngle; - - /// - /// The base unit of SolidAngle, which is Steradian. All conversions go via this value. - /// - public static SolidAngleUnit BaseUnit => SolidAngleUnit.Steradian; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the SolidAngle quantity. - /// - public static SolidAngleUnit[] Units { get; } = Enum.GetValues(typeof(SolidAngleUnit)).Cast().Except(new SolidAngleUnit[]{ SolidAngleUnit.Undefined }).ToArray(); - - /// - /// Get SolidAngle in Steradians. - /// - public double Steradians => As(SolidAngleUnit.Steradian); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Steradian. - /// - public static SolidAngle Zero => new SolidAngle(0, BaseUnit); - - /// - /// Get SolidAngle from Steradians. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SolidAngle FromSteradians(double steradians) -#else - public static SolidAngle FromSteradians(QuantityValue steradians) -#endif - { - double value = (double) steradians; - return new SolidAngle(value, SolidAngleUnit.Steradian); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SolidAngle unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static SolidAngle From(double value, SolidAngleUnit fromUnit) -#else - public static SolidAngle From(QuantityValue value, SolidAngleUnit fromUnit) -#endif - { - return new SolidAngle((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SolidAngleUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); - - return CompareTo((SolidAngle)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(SolidAngle other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another SolidAngle within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current SolidAngle. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(SolidAngleUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this SolidAngle to another SolidAngle with the unit representation . - /// - /// A SolidAngle with the specified unit. - public SolidAngle ToUnit(SolidAngleUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new SolidAngle(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case SolidAngleUnit.Steradian: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(SolidAngleUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case SolidAngleUnit.Steradian: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SolidAngle Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out SolidAngle result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SolidAngleUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out SolidAngleUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static SolidAngle ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) - { - result = default(SolidAngle); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static SolidAngleUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == SolidAngleUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SolidAngleUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SolidAngleUnit unit) - { - unit = SolidAngleUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == SolidAngleUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(SolidAngleUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of SolidAngle - /// - public static SolidAngle MaxValue => new SolidAngle(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of SolidAngle - /// - public static SolidAngle MinValue => new SolidAngle(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => SolidAngle.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => SolidAngle.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs deleted file mode 100644 index e93fce1dab..0000000000 --- a/Common/GeneratedCode/Quantities/SpecificEnergy.Common.g.cs +++ /dev/null @@ -1,691 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The SpecificEnergy - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class SpecificEnergy : IQuantity -#else - public partial struct SpecificEnergy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly SpecificEnergyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public SpecificEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static SpecificEnergy() - { - BaseDimensions = new BaseDimensions(2, 0, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - SpecificEnergy(double numericValue, SpecificEnergyUnit unit) - { - if(unit == SpecificEnergyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.SpecificEnergy; - - /// - /// The base unit of SpecificEnergy, which is JoulePerKilogram. All conversions go via this value. - /// - public static SpecificEnergyUnit BaseUnit => SpecificEnergyUnit.JoulePerKilogram; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the SpecificEnergy quantity. - /// - public static SpecificEnergyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEnergyUnit)).Cast().Except(new SpecificEnergyUnit[]{ SpecificEnergyUnit.Undefined }).ToArray(); - - /// - /// Get SpecificEnergy in CaloriesPerGram. - /// - public double CaloriesPerGram => As(SpecificEnergyUnit.CaloriePerGram); - - /// - /// Get SpecificEnergy in JoulesPerKilogram. - /// - public double JoulesPerKilogram => As(SpecificEnergyUnit.JoulePerKilogram); - - /// - /// Get SpecificEnergy in KilocaloriesPerGram. - /// - public double KilocaloriesPerGram => As(SpecificEnergyUnit.KilocaloriePerGram); - - /// - /// Get SpecificEnergy in KilojoulesPerKilogram. - /// - public double KilojoulesPerKilogram => As(SpecificEnergyUnit.KilojoulePerKilogram); - - /// - /// Get SpecificEnergy in KilowattHoursPerKilogram. - /// - public double KilowattHoursPerKilogram => As(SpecificEnergyUnit.KilowattHourPerKilogram); - - /// - /// Get SpecificEnergy in MegajoulesPerKilogram. - /// - public double MegajoulesPerKilogram => As(SpecificEnergyUnit.MegajoulePerKilogram); - - /// - /// Get SpecificEnergy in MegawattHoursPerKilogram. - /// - public double MegawattHoursPerKilogram => As(SpecificEnergyUnit.MegawattHourPerKilogram); - - /// - /// Get SpecificEnergy in WattHoursPerKilogram. - /// - public double WattHoursPerKilogram => As(SpecificEnergyUnit.WattHourPerKilogram); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogram. - /// - public static SpecificEnergy Zero => new SpecificEnergy(0, BaseUnit); - - /// - /// Get SpecificEnergy from CaloriesPerGram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromCaloriesPerGram(double caloriespergram) -#else - public static SpecificEnergy FromCaloriesPerGram(QuantityValue caloriespergram) -#endif - { - double value = (double) caloriespergram; - return new SpecificEnergy(value, SpecificEnergyUnit.CaloriePerGram); - } - - /// - /// Get SpecificEnergy from JoulesPerKilogram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromJoulesPerKilogram(double joulesperkilogram) -#else - public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogram) -#endif - { - double value = (double) joulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.JoulePerKilogram); - } - - /// - /// Get SpecificEnergy from KilocaloriesPerGram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromKilocaloriesPerGram(double kilocaloriespergram) -#else - public static SpecificEnergy FromKilocaloriesPerGram(QuantityValue kilocaloriespergram) -#endif - { - double value = (double) kilocaloriespergram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilocaloriePerGram); - } - - /// - /// Get SpecificEnergy from KilojoulesPerKilogram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromKilojoulesPerKilogram(double kilojoulesperkilogram) -#else - public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesperkilogram) -#endif - { - double value = (double) kilojoulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilojoulePerKilogram); - } - - /// - /// Get SpecificEnergy from KilowattHoursPerKilogram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromKilowattHoursPerKilogram(double kilowatthoursperkilogram) -#else - public static SpecificEnergy FromKilowattHoursPerKilogram(QuantityValue kilowatthoursperkilogram) -#endif - { - double value = (double) kilowatthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.KilowattHourPerKilogram); - } - - /// - /// Get SpecificEnergy from MegajoulesPerKilogram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromMegajoulesPerKilogram(double megajoulesperkilogram) -#else - public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesperkilogram) -#endif - { - double value = (double) megajoulesperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.MegajoulePerKilogram); - } - - /// - /// Get SpecificEnergy from MegawattHoursPerKilogram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromMegawattHoursPerKilogram(double megawatthoursperkilogram) -#else - public static SpecificEnergy FromMegawattHoursPerKilogram(QuantityValue megawatthoursperkilogram) -#endif - { - double value = (double) megawatthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.MegawattHourPerKilogram); - } - - /// - /// Get SpecificEnergy from WattHoursPerKilogram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEnergy FromWattHoursPerKilogram(double watthoursperkilogram) -#else - public static SpecificEnergy FromWattHoursPerKilogram(QuantityValue watthoursperkilogram) -#endif - { - double value = (double) watthoursperkilogram; - return new SpecificEnergy(value, SpecificEnergyUnit.WattHourPerKilogram); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificEnergy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static SpecificEnergy From(double value, SpecificEnergyUnit fromUnit) -#else - public static SpecificEnergy From(QuantityValue value, SpecificEnergyUnit fromUnit) -#endif - { - return new SpecificEnergy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificEnergyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); - - return CompareTo((SpecificEnergy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(SpecificEnergy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another SpecificEnergy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current SpecificEnergy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(SpecificEnergyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this SpecificEnergy to another SpecificEnergy with the unit representation . - /// - /// A SpecificEnergy with the specified unit. - public SpecificEnergy ToUnit(SpecificEnergyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new SpecificEnergy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case SpecificEnergyUnit.CaloriePerGram: return _value*4.184e3; - case SpecificEnergyUnit.JoulePerKilogram: return _value; - case SpecificEnergyUnit.KilocaloriePerGram: return (_value*4.184e3) * 1e3d; - case SpecificEnergyUnit.KilojoulePerKilogram: return (_value) * 1e3d; - case SpecificEnergyUnit.KilowattHourPerKilogram: return (_value*3.6e3) * 1e3d; - case SpecificEnergyUnit.MegajoulePerKilogram: return (_value) * 1e6d; - case SpecificEnergyUnit.MegawattHourPerKilogram: return (_value*3.6e3) * 1e6d; - case SpecificEnergyUnit.WattHourPerKilogram: return _value*3.6e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(SpecificEnergyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case SpecificEnergyUnit.CaloriePerGram: return baseUnitValue/4.184e3; - case SpecificEnergyUnit.JoulePerKilogram: return baseUnitValue; - case SpecificEnergyUnit.KilocaloriePerGram: return (baseUnitValue/4.184e3) / 1e3d; - case SpecificEnergyUnit.KilojoulePerKilogram: return (baseUnitValue) / 1e3d; - case SpecificEnergyUnit.KilowattHourPerKilogram: return (baseUnitValue/3.6e3) / 1e3d; - case SpecificEnergyUnit.MegajoulePerKilogram: return (baseUnitValue) / 1e6d; - case SpecificEnergyUnit.MegawattHourPerKilogram: return (baseUnitValue/3.6e3) / 1e6d; - case SpecificEnergyUnit.WattHourPerKilogram: return baseUnitValue/3.6e3; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificEnergy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEnergyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out SpecificEnergyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static SpecificEnergy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) - { - result = default(SpecificEnergy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static SpecificEnergyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == SpecificEnergyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEnergyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEnergyUnit unit) - { - unit = SpecificEnergyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == SpecificEnergyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(SpecificEnergyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of SpecificEnergy - /// - public static SpecificEnergy MaxValue => new SpecificEnergy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of SpecificEnergy - /// - public static SpecificEnergy MinValue => new SpecificEnergy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => SpecificEnergy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => SpecificEnergy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs deleted file mode 100644 index b94fb65d1d..0000000000 --- a/Common/GeneratedCode/Quantities/SpecificEntropy.Common.g.cs +++ /dev/null @@ -1,691 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class SpecificEntropy : IQuantity -#else - public partial struct SpecificEntropy : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly SpecificEntropyUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public SpecificEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static SpecificEntropy() - { - BaseDimensions = new BaseDimensions(2, 0, -2, 0, -1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - SpecificEntropy(double numericValue, SpecificEntropyUnit unit) - { - if(unit == SpecificEntropyUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.SpecificEntropy; - - /// - /// The base unit of SpecificEntropy, which is JoulePerKilogramKelvin. All conversions go via this value. - /// - public static SpecificEntropyUnit BaseUnit => SpecificEntropyUnit.JoulePerKilogramKelvin; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the SpecificEntropy quantity. - /// - public static SpecificEntropyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEntropyUnit)).Cast().Except(new SpecificEntropyUnit[]{ SpecificEntropyUnit.Undefined }).ToArray(); - - /// - /// Get SpecificEntropy in CaloriesPerGramKelvin. - /// - public double CaloriesPerGramKelvin => As(SpecificEntropyUnit.CaloriePerGramKelvin); - - /// - /// Get SpecificEntropy in JoulesPerKilogramDegreeCelsius. - /// - public double JoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); - - /// - /// Get SpecificEntropy in JoulesPerKilogramKelvin. - /// - public double JoulesPerKilogramKelvin => As(SpecificEntropyUnit.JoulePerKilogramKelvin); - - /// - /// Get SpecificEntropy in KilocaloriesPerGramKelvin. - /// - public double KilocaloriesPerGramKelvin => As(SpecificEntropyUnit.KilocaloriePerGramKelvin); - - /// - /// Get SpecificEntropy in KilojoulesPerKilogramDegreeCelsius. - /// - public double KilojoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); - - /// - /// Get SpecificEntropy in KilojoulesPerKilogramKelvin. - /// - public double KilojoulesPerKilogramKelvin => As(SpecificEntropyUnit.KilojoulePerKilogramKelvin); - - /// - /// Get SpecificEntropy in MegajoulesPerKilogramDegreeCelsius. - /// - public double MegajoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); - - /// - /// Get SpecificEntropy in MegajoulesPerKilogramKelvin. - /// - public double MegajoulesPerKilogramKelvin => As(SpecificEntropyUnit.MegajoulePerKilogramKelvin); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogramKelvin. - /// - public static SpecificEntropy Zero => new SpecificEntropy(0, BaseUnit); - - /// - /// Get SpecificEntropy from CaloriesPerGramKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromCaloriesPerGramKelvin(double caloriespergramkelvin) -#else - public static SpecificEntropy FromCaloriesPerGramKelvin(QuantityValue caloriespergramkelvin) -#endif - { - double value = (double) caloriespergramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.CaloriePerGramKelvin); - } - - /// - /// Get SpecificEntropy from JoulesPerKilogramDegreeCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(double joulesperkilogramdegreecelsius) -#else - public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue joulesperkilogramdegreecelsius) -#endif - { - double value = (double) joulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); - } - - /// - /// Get SpecificEntropy from JoulesPerKilogramKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromJoulesPerKilogramKelvin(double joulesperkilogramkelvin) -#else - public static SpecificEntropy FromJoulesPerKilogramKelvin(QuantityValue joulesperkilogramkelvin) -#endif - { - double value = (double) joulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramKelvin); - } - - /// - /// Get SpecificEntropy from KilocaloriesPerGramKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromKilocaloriesPerGramKelvin(double kilocaloriespergramkelvin) -#else - public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kilocaloriespergramkelvin) -#endif - { - double value = (double) kilocaloriespergramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.KilocaloriePerGramKelvin); - } - - /// - /// Get SpecificEntropy from KilojoulesPerKilogramDegreeCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(double kilojoulesperkilogramdegreecelsius) -#else - public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(QuantityValue kilojoulesperkilogramdegreecelsius) -#endif - { - double value = (double) kilojoulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); - } - - /// - /// Get SpecificEntropy from KilojoulesPerKilogramKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromKilojoulesPerKilogramKelvin(double kilojoulesperkilogramkelvin) -#else - public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilojoulesperkilogramkelvin) -#endif - { - double value = (double) kilojoulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramKelvin); - } - - /// - /// Get SpecificEntropy from MegajoulesPerKilogramDegreeCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(double megajoulesperkilogramdegreecelsius) -#else - public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(QuantityValue megajoulesperkilogramdegreecelsius) -#endif - { - double value = (double) megajoulesperkilogramdegreecelsius; - return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); - } - - /// - /// Get SpecificEntropy from MegajoulesPerKilogramKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificEntropy FromMegajoulesPerKilogramKelvin(double megajoulesperkilogramkelvin) -#else - public static SpecificEntropy FromMegajoulesPerKilogramKelvin(QuantityValue megajoulesperkilogramkelvin) -#endif - { - double value = (double) megajoulesperkilogramkelvin; - return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramKelvin); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificEntropy unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static SpecificEntropy From(double value, SpecificEntropyUnit fromUnit) -#else - public static SpecificEntropy From(QuantityValue value, SpecificEntropyUnit fromUnit) -#endif - { - return new SpecificEntropy((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificEntropyUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); - - return CompareTo((SpecificEntropy)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(SpecificEntropy other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another SpecificEntropy within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current SpecificEntropy. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(SpecificEntropyUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this SpecificEntropy to another SpecificEntropy with the unit representation . - /// - /// A SpecificEntropy with the specified unit. - public SpecificEntropy ToUnit(SpecificEntropyUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new SpecificEntropy(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case SpecificEntropyUnit.CaloriePerGramKelvin: return _value*4.184e3; - case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return _value; - case SpecificEntropyUnit.JoulePerKilogramKelvin: return _value; - case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (_value*4.184e3) * 1e3d; - case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (_value) * 1e3d; - case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (_value) * 1e3d; - case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (_value) * 1e6d; - case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (_value) * 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(SpecificEntropyUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case SpecificEntropyUnit.CaloriePerGramKelvin: return baseUnitValue/4.184e3; - case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return baseUnitValue; - case SpecificEntropyUnit.JoulePerKilogramKelvin: return baseUnitValue; - case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (baseUnitValue/4.184e3) / 1e3d; - case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (baseUnitValue) / 1e3d; - case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (baseUnitValue) / 1e3d; - case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (baseUnitValue) / 1e6d; - case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (baseUnitValue) / 1e6d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificEntropy Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificEntropyUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out SpecificEntropyUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static SpecificEntropy ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) - { - result = default(SpecificEntropy); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static SpecificEntropyUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == SpecificEntropyUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificEntropyUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificEntropyUnit unit) - { - unit = SpecificEntropyUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == SpecificEntropyUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(SpecificEntropyUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of SpecificEntropy - /// - public static SpecificEntropy MaxValue => new SpecificEntropy(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of SpecificEntropy - /// - public static SpecificEntropy MinValue => new SpecificEntropy(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => SpecificEntropy.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => SpecificEntropy.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs deleted file mode 100644 index f56d086df0..0000000000 --- a/Common/GeneratedCode/Quantities/SpecificVolume.Common.g.cs +++ /dev/null @@ -1,559 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class SpecificVolume : IQuantity -#else - public partial struct SpecificVolume : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly SpecificVolumeUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public SpecificVolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static SpecificVolume() - { - BaseDimensions = new BaseDimensions(3, -1, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - SpecificVolume(double numericValue, SpecificVolumeUnit unit) - { - if(unit == SpecificVolumeUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.SpecificVolume; - - /// - /// The base unit of SpecificVolume, which is CubicMeterPerKilogram. All conversions go via this value. - /// - public static SpecificVolumeUnit BaseUnit => SpecificVolumeUnit.CubicMeterPerKilogram; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the SpecificVolume quantity. - /// - public static SpecificVolumeUnit[] Units { get; } = Enum.GetValues(typeof(SpecificVolumeUnit)).Cast().Except(new SpecificVolumeUnit[]{ SpecificVolumeUnit.Undefined }).ToArray(); - - /// - /// Get SpecificVolume in CubicFeetPerPound. - /// - public double CubicFeetPerPound => As(SpecificVolumeUnit.CubicFootPerPound); - - /// - /// Get SpecificVolume in CubicMetersPerKilogram. - /// - public double CubicMetersPerKilogram => As(SpecificVolumeUnit.CubicMeterPerKilogram); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerKilogram. - /// - public static SpecificVolume Zero => new SpecificVolume(0, BaseUnit); - - /// - /// Get SpecificVolume from CubicFeetPerPound. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificVolume FromCubicFeetPerPound(double cubicfeetperpound) -#else - public static SpecificVolume FromCubicFeetPerPound(QuantityValue cubicfeetperpound) -#endif - { - double value = (double) cubicfeetperpound; - return new SpecificVolume(value, SpecificVolumeUnit.CubicFootPerPound); - } - - /// - /// Get SpecificVolume from CubicMetersPerKilogram. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificVolume FromCubicMetersPerKilogram(double cubicmetersperkilogram) -#else - public static SpecificVolume FromCubicMetersPerKilogram(QuantityValue cubicmetersperkilogram) -#endif - { - double value = (double) cubicmetersperkilogram; - return new SpecificVolume(value, SpecificVolumeUnit.CubicMeterPerKilogram); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificVolume unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static SpecificVolume From(double value, SpecificVolumeUnit fromUnit) -#else - public static SpecificVolume From(QuantityValue value, SpecificVolumeUnit fromUnit) -#endif - { - return new SpecificVolume((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificVolumeUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); - - return CompareTo((SpecificVolume)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(SpecificVolume other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another SpecificVolume within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current SpecificVolume. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(SpecificVolumeUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this SpecificVolume to another SpecificVolume with the unit representation . - /// - /// A SpecificVolume with the specified unit. - public SpecificVolume ToUnit(SpecificVolumeUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new SpecificVolume(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case SpecificVolumeUnit.CubicFootPerPound: return _value/16.01846353; - case SpecificVolumeUnit.CubicMeterPerKilogram: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(SpecificVolumeUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case SpecificVolumeUnit.CubicFootPerPound: return baseUnitValue*16.01846353; - case SpecificVolumeUnit.CubicMeterPerKilogram: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificVolume Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out SpecificVolume result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificVolumeUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out SpecificVolumeUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static SpecificVolume ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) - { - result = default(SpecificVolume); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static SpecificVolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == SpecificVolumeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificVolumeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificVolumeUnit unit) - { - unit = SpecificVolumeUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == SpecificVolumeUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(SpecificVolumeUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of SpecificVolume - /// - public static SpecificVolume MaxValue => new SpecificVolume(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of SpecificVolume - /// - public static SpecificVolume MinValue => new SpecificVolume(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => SpecificVolume.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => SpecificVolume.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs b/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs deleted file mode 100644 index 6ecacc9fec..0000000000 --- a/Common/GeneratedCode/Quantities/SpecificWeight.Common.g.cs +++ /dev/null @@ -1,889 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// The SpecificWeight, or more precisely, the volumetric weight density, of a substance is its weight per unit volume. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class SpecificWeight : IQuantity -#else - public partial struct SpecificWeight : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly SpecificWeightUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public SpecificWeightUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static SpecificWeight() - { - BaseDimensions = new BaseDimensions(-2, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - SpecificWeight(double numericValue, SpecificWeightUnit unit) - { - if(unit == SpecificWeightUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.SpecificWeight; - - /// - /// The base unit of SpecificWeight, which is NewtonPerCubicMeter. All conversions go via this value. - /// - public static SpecificWeightUnit BaseUnit => SpecificWeightUnit.NewtonPerCubicMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the SpecificWeight quantity. - /// - public static SpecificWeightUnit[] Units { get; } = Enum.GetValues(typeof(SpecificWeightUnit)).Cast().Except(new SpecificWeightUnit[]{ SpecificWeightUnit.Undefined }).ToArray(); - - /// - /// Get SpecificWeight in KilogramsForcePerCubicCentimeter. - /// - public double KilogramsForcePerCubicCentimeter => As(SpecificWeightUnit.KilogramForcePerCubicCentimeter); - - /// - /// Get SpecificWeight in KilogramsForcePerCubicMeter. - /// - public double KilogramsForcePerCubicMeter => As(SpecificWeightUnit.KilogramForcePerCubicMeter); - - /// - /// Get SpecificWeight in KilogramsForcePerCubicMillimeter. - /// - public double KilogramsForcePerCubicMillimeter => As(SpecificWeightUnit.KilogramForcePerCubicMillimeter); - - /// - /// Get SpecificWeight in KilonewtonsPerCubicCentimeter. - /// - public double KilonewtonsPerCubicCentimeter => As(SpecificWeightUnit.KilonewtonPerCubicCentimeter); - - /// - /// Get SpecificWeight in KilonewtonsPerCubicMeter. - /// - public double KilonewtonsPerCubicMeter => As(SpecificWeightUnit.KilonewtonPerCubicMeter); - - /// - /// Get SpecificWeight in KilonewtonsPerCubicMillimeter. - /// - public double KilonewtonsPerCubicMillimeter => As(SpecificWeightUnit.KilonewtonPerCubicMillimeter); - - /// - /// Get SpecificWeight in KilopoundsForcePerCubicFoot. - /// - public double KilopoundsForcePerCubicFoot => As(SpecificWeightUnit.KilopoundForcePerCubicFoot); - - /// - /// Get SpecificWeight in KilopoundsForcePerCubicInch. - /// - public double KilopoundsForcePerCubicInch => As(SpecificWeightUnit.KilopoundForcePerCubicInch); - - /// - /// Get SpecificWeight in MeganewtonsPerCubicMeter. - /// - public double MeganewtonsPerCubicMeter => As(SpecificWeightUnit.MeganewtonPerCubicMeter); - - /// - /// Get SpecificWeight in NewtonsPerCubicCentimeter. - /// - public double NewtonsPerCubicCentimeter => As(SpecificWeightUnit.NewtonPerCubicCentimeter); - - /// - /// Get SpecificWeight in NewtonsPerCubicMeter. - /// - public double NewtonsPerCubicMeter => As(SpecificWeightUnit.NewtonPerCubicMeter); - - /// - /// Get SpecificWeight in NewtonsPerCubicMillimeter. - /// - public double NewtonsPerCubicMillimeter => As(SpecificWeightUnit.NewtonPerCubicMillimeter); - - /// - /// Get SpecificWeight in PoundsForcePerCubicFoot. - /// - public double PoundsForcePerCubicFoot => As(SpecificWeightUnit.PoundForcePerCubicFoot); - - /// - /// Get SpecificWeight in PoundsForcePerCubicInch. - /// - public double PoundsForcePerCubicInch => As(SpecificWeightUnit.PoundForcePerCubicInch); - - /// - /// Get SpecificWeight in TonnesForcePerCubicCentimeter. - /// - public double TonnesForcePerCubicCentimeter => As(SpecificWeightUnit.TonneForcePerCubicCentimeter); - - /// - /// Get SpecificWeight in TonnesForcePerCubicMeter. - /// - public double TonnesForcePerCubicMeter => As(SpecificWeightUnit.TonneForcePerCubicMeter); - - /// - /// Get SpecificWeight in TonnesForcePerCubicMillimeter. - /// - public double TonnesForcePerCubicMillimeter => As(SpecificWeightUnit.TonneForcePerCubicMillimeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerCubicMeter. - /// - public static SpecificWeight Zero => new SpecificWeight(0, BaseUnit); - - /// - /// Get SpecificWeight from KilogramsForcePerCubicCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilogramsForcePerCubicCentimeter(double kilogramsforcepercubiccentimeter) -#else - public static SpecificWeight FromKilogramsForcePerCubicCentimeter(QuantityValue kilogramsforcepercubiccentimeter) -#endif - { - double value = (double) kilogramsforcepercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicCentimeter); - } - - /// - /// Get SpecificWeight from KilogramsForcePerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilogramsForcePerCubicMeter(double kilogramsforcepercubicmeter) -#else - public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilogramsforcepercubicmeter) -#endif - { - double value = (double) kilogramsforcepercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMeter); - } - - /// - /// Get SpecificWeight from KilogramsForcePerCubicMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilogramsForcePerCubicMillimeter(double kilogramsforcepercubicmillimeter) -#else - public static SpecificWeight FromKilogramsForcePerCubicMillimeter(QuantityValue kilogramsforcepercubicmillimeter) -#endif - { - double value = (double) kilogramsforcepercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMillimeter); - } - - /// - /// Get SpecificWeight from KilonewtonsPerCubicCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilonewtonsPerCubicCentimeter(double kilonewtonspercubiccentimeter) -#else - public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kilonewtonspercubiccentimeter) -#endif - { - double value = (double) kilonewtonspercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicCentimeter); - } - - /// - /// Get SpecificWeight from KilonewtonsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilonewtonsPerCubicMeter(double kilonewtonspercubicmeter) -#else - public static SpecificWeight FromKilonewtonsPerCubicMeter(QuantityValue kilonewtonspercubicmeter) -#endif - { - double value = (double) kilonewtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMeter); - } - - /// - /// Get SpecificWeight from KilonewtonsPerCubicMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilonewtonsPerCubicMillimeter(double kilonewtonspercubicmillimeter) -#else - public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kilonewtonspercubicmillimeter) -#endif - { - double value = (double) kilonewtonspercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMillimeter); - } - - /// - /// Get SpecificWeight from KilopoundsForcePerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilopoundsForcePerCubicFoot(double kilopoundsforcepercubicfoot) -#else - public static SpecificWeight FromKilopoundsForcePerCubicFoot(QuantityValue kilopoundsforcepercubicfoot) -#endif - { - double value = (double) kilopoundsforcepercubicfoot; - return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicFoot); - } - - /// - /// Get SpecificWeight from KilopoundsForcePerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromKilopoundsForcePerCubicInch(double kilopoundsforcepercubicinch) -#else - public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilopoundsforcepercubicinch) -#endif - { - double value = (double) kilopoundsforcepercubicinch; - return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicInch); - } - - /// - /// Get SpecificWeight from MeganewtonsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromMeganewtonsPerCubicMeter(double meganewtonspercubicmeter) -#else - public static SpecificWeight FromMeganewtonsPerCubicMeter(QuantityValue meganewtonspercubicmeter) -#endif - { - double value = (double) meganewtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.MeganewtonPerCubicMeter); - } - - /// - /// Get SpecificWeight from NewtonsPerCubicCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromNewtonsPerCubicCentimeter(double newtonspercubiccentimeter) -#else - public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtonspercubiccentimeter) -#endif - { - double value = (double) newtonspercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicCentimeter); - } - - /// - /// Get SpecificWeight from NewtonsPerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromNewtonsPerCubicMeter(double newtonspercubicmeter) -#else - public static SpecificWeight FromNewtonsPerCubicMeter(QuantityValue newtonspercubicmeter) -#endif - { - double value = (double) newtonspercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMeter); - } - - /// - /// Get SpecificWeight from NewtonsPerCubicMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromNewtonsPerCubicMillimeter(double newtonspercubicmillimeter) -#else - public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtonspercubicmillimeter) -#endif - { - double value = (double) newtonspercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMillimeter); - } - - /// - /// Get SpecificWeight from PoundsForcePerCubicFoot. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromPoundsForcePerCubicFoot(double poundsforcepercubicfoot) -#else - public static SpecificWeight FromPoundsForcePerCubicFoot(QuantityValue poundsforcepercubicfoot) -#endif - { - double value = (double) poundsforcepercubicfoot; - return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicFoot); - } - - /// - /// Get SpecificWeight from PoundsForcePerCubicInch. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromPoundsForcePerCubicInch(double poundsforcepercubicinch) -#else - public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsforcepercubicinch) -#endif - { - double value = (double) poundsforcepercubicinch; - return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicInch); - } - - /// - /// Get SpecificWeight from TonnesForcePerCubicCentimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromTonnesForcePerCubicCentimeter(double tonnesforcepercubiccentimeter) -#else - public static SpecificWeight FromTonnesForcePerCubicCentimeter(QuantityValue tonnesforcepercubiccentimeter) -#endif - { - double value = (double) tonnesforcepercubiccentimeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicCentimeter); - } - - /// - /// Get SpecificWeight from TonnesForcePerCubicMeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromTonnesForcePerCubicMeter(double tonnesforcepercubicmeter) -#else - public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesforcepercubicmeter) -#endif - { - double value = (double) tonnesforcepercubicmeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMeter); - } - - /// - /// Get SpecificWeight from TonnesForcePerCubicMillimeter. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static SpecificWeight FromTonnesForcePerCubicMillimeter(double tonnesforcepercubicmillimeter) -#else - public static SpecificWeight FromTonnesForcePerCubicMillimeter(QuantityValue tonnesforcepercubicmillimeter) -#endif - { - double value = (double) tonnesforcepercubicmillimeter; - return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMillimeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificWeight unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static SpecificWeight From(double value, SpecificWeightUnit fromUnit) -#else - public static SpecificWeight From(QuantityValue value, SpecificWeightUnit fromUnit) -#endif - { - return new SpecificWeight((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpecificWeightUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); - - return CompareTo((SpecificWeight)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(SpecificWeight other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another SpecificWeight within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current SpecificWeight. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(SpecificWeightUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this SpecificWeight to another SpecificWeight with the unit representation . - /// - /// A SpecificWeight with the specified unit. - public SpecificWeight ToUnit(SpecificWeightUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new SpecificWeight(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return _value*9.80665e6; - case SpecificWeightUnit.KilogramForcePerCubicMeter: return _value*9.80665; - case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return _value*9.80665e9; - case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (_value*1000000) * 1e3d; - case SpecificWeightUnit.KilonewtonPerCubicMeter: return (_value) * 1e3d; - case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (_value*1000000000) * 1e3d; - case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (_value*1.570874638462462e2) * 1e3d; - case SpecificWeightUnit.KilopoundForcePerCubicInch: return (_value*2.714471375263134e5) * 1e3d; - case SpecificWeightUnit.MeganewtonPerCubicMeter: return (_value) * 1e6d; - case SpecificWeightUnit.NewtonPerCubicCentimeter: return _value*1000000; - case SpecificWeightUnit.NewtonPerCubicMeter: return _value; - case SpecificWeightUnit.NewtonPerCubicMillimeter: return _value*1000000000; - case SpecificWeightUnit.PoundForcePerCubicFoot: return _value*1.570874638462462e2; - case SpecificWeightUnit.PoundForcePerCubicInch: return _value*2.714471375263134e5; - case SpecificWeightUnit.TonneForcePerCubicCentimeter: return _value*9.80665e9; - case SpecificWeightUnit.TonneForcePerCubicMeter: return _value*9.80665e3; - case SpecificWeightUnit.TonneForcePerCubicMillimeter: return _value*9.80665e12; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(SpecificWeightUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return baseUnitValue/9.80665e6; - case SpecificWeightUnit.KilogramForcePerCubicMeter: return baseUnitValue/9.80665; - case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return baseUnitValue/9.80665e9; - case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (baseUnitValue*0.000001) / 1e3d; - case SpecificWeightUnit.KilonewtonPerCubicMeter: return (baseUnitValue) / 1e3d; - case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (baseUnitValue*0.000000001) / 1e3d; - case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (baseUnitValue/1.570874638462462e2) / 1e3d; - case SpecificWeightUnit.KilopoundForcePerCubicInch: return (baseUnitValue/2.714471375263134e5) / 1e3d; - case SpecificWeightUnit.MeganewtonPerCubicMeter: return (baseUnitValue) / 1e6d; - case SpecificWeightUnit.NewtonPerCubicCentimeter: return baseUnitValue*0.000001; - case SpecificWeightUnit.NewtonPerCubicMeter: return baseUnitValue; - case SpecificWeightUnit.NewtonPerCubicMillimeter: return baseUnitValue*0.000000001; - case SpecificWeightUnit.PoundForcePerCubicFoot: return baseUnitValue/1.570874638462462e2; - case SpecificWeightUnit.PoundForcePerCubicInch: return baseUnitValue/2.714471375263134e5; - case SpecificWeightUnit.TonneForcePerCubicCentimeter: return baseUnitValue/9.80665e9; - case SpecificWeightUnit.TonneForcePerCubicMeter: return baseUnitValue/9.80665e3; - case SpecificWeightUnit.TonneForcePerCubicMillimeter: return baseUnitValue/9.80665e12; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static SpecificWeight Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out SpecificWeight result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpecificWeightUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out SpecificWeightUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static SpecificWeight ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) - { - result = default(SpecificWeight); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static SpecificWeightUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == SpecificWeightUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpecificWeightUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpecificWeightUnit unit) - { - unit = SpecificWeightUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == SpecificWeightUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(SpecificWeightUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of SpecificWeight - /// - public static SpecificWeight MaxValue => new SpecificWeight(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of SpecificWeight - /// - public static SpecificWeight MinValue => new SpecificWeight(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => SpecificWeight.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => SpecificWeight.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Speed.Common.g.cs b/Common/GeneratedCode/Quantities/Speed.Common.g.cs deleted file mode 100644 index 630d1f1ff3..0000000000 --- a/Common/GeneratedCode/Quantities/Speed.Common.g.cs +++ /dev/null @@ -1,1219 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Speed : IQuantity -#else - public partial struct Speed : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly SpeedUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public SpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Speed() - { - BaseDimensions = new BaseDimensions(1, 0, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Speed(double numericValue, SpeedUnit unit) - { - if(unit == SpeedUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Speed; - - /// - /// The base unit of Speed, which is MeterPerSecond. All conversions go via this value. - /// - public static SpeedUnit BaseUnit => SpeedUnit.MeterPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Speed quantity. - /// - public static SpeedUnit[] Units { get; } = Enum.GetValues(typeof(SpeedUnit)).Cast().Except(new SpeedUnit[]{ SpeedUnit.Undefined }).ToArray(); - - /// - /// Get Speed in CentimetersPerHour. - /// - public double CentimetersPerHour => As(SpeedUnit.CentimeterPerHour); - - /// - /// Get Speed in CentimetersPerMinutes. - /// - public double CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); - - /// - /// Get Speed in CentimetersPerSecond. - /// - public double CentimetersPerSecond => As(SpeedUnit.CentimeterPerSecond); - - /// - /// Get Speed in DecimetersPerMinutes. - /// - public double DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); - - /// - /// Get Speed in DecimetersPerSecond. - /// - public double DecimetersPerSecond => As(SpeedUnit.DecimeterPerSecond); - - /// - /// Get Speed in FeetPerHour. - /// - public double FeetPerHour => As(SpeedUnit.FootPerHour); - - /// - /// Get Speed in FeetPerMinute. - /// - public double FeetPerMinute => As(SpeedUnit.FootPerMinute); - - /// - /// Get Speed in FeetPerSecond. - /// - public double FeetPerSecond => As(SpeedUnit.FootPerSecond); - - /// - /// Get Speed in InchesPerHour. - /// - public double InchesPerHour => As(SpeedUnit.InchPerHour); - - /// - /// Get Speed in InchesPerMinute. - /// - public double InchesPerMinute => As(SpeedUnit.InchPerMinute); - - /// - /// Get Speed in InchesPerSecond. - /// - public double InchesPerSecond => As(SpeedUnit.InchPerSecond); - - /// - /// Get Speed in KilometersPerHour. - /// - public double KilometersPerHour => As(SpeedUnit.KilometerPerHour); - - /// - /// Get Speed in KilometersPerMinutes. - /// - public double KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); - - /// - /// Get Speed in KilometersPerSecond. - /// - public double KilometersPerSecond => As(SpeedUnit.KilometerPerSecond); - - /// - /// Get Speed in Knots. - /// - public double Knots => As(SpeedUnit.Knot); - - /// - /// Get Speed in MetersPerHour. - /// - public double MetersPerHour => As(SpeedUnit.MeterPerHour); - - /// - /// Get Speed in MetersPerMinutes. - /// - public double MetersPerMinutes => As(SpeedUnit.MeterPerMinute); - - /// - /// Get Speed in MetersPerSecond. - /// - public double MetersPerSecond => As(SpeedUnit.MeterPerSecond); - - /// - /// Get Speed in MicrometersPerMinutes. - /// - public double MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); - - /// - /// Get Speed in MicrometersPerSecond. - /// - public double MicrometersPerSecond => As(SpeedUnit.MicrometerPerSecond); - - /// - /// Get Speed in MilesPerHour. - /// - public double MilesPerHour => As(SpeedUnit.MilePerHour); - - /// - /// Get Speed in MillimetersPerHour. - /// - public double MillimetersPerHour => As(SpeedUnit.MillimeterPerHour); - - /// - /// Get Speed in MillimetersPerMinutes. - /// - public double MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); - - /// - /// Get Speed in MillimetersPerSecond. - /// - public double MillimetersPerSecond => As(SpeedUnit.MillimeterPerSecond); - - /// - /// Get Speed in NanometersPerMinutes. - /// - public double NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); - - /// - /// Get Speed in NanometersPerSecond. - /// - public double NanometersPerSecond => As(SpeedUnit.NanometerPerSecond); - - /// - /// Get Speed in UsSurveyFeetPerHour. - /// - public double UsSurveyFeetPerHour => As(SpeedUnit.UsSurveyFootPerHour); - - /// - /// Get Speed in UsSurveyFeetPerMinute. - /// - public double UsSurveyFeetPerMinute => As(SpeedUnit.UsSurveyFootPerMinute); - - /// - /// Get Speed in UsSurveyFeetPerSecond. - /// - public double UsSurveyFeetPerSecond => As(SpeedUnit.UsSurveyFootPerSecond); - - /// - /// Get Speed in YardsPerHour. - /// - public double YardsPerHour => As(SpeedUnit.YardPerHour); - - /// - /// Get Speed in YardsPerMinute. - /// - public double YardsPerMinute => As(SpeedUnit.YardPerMinute); - - /// - /// Get Speed in YardsPerSecond. - /// - public double YardsPerSecond => As(SpeedUnit.YardPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecond. - /// - public static Speed Zero => new Speed(0, BaseUnit); - - /// - /// Get Speed from CentimetersPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromCentimetersPerHour(double centimetersperhour) -#else - public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) -#endif - { - double value = (double) centimetersperhour; - return new Speed(value, SpeedUnit.CentimeterPerHour); - } - - /// - /// Get Speed from CentimetersPerMinutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromCentimetersPerMinutes(double centimetersperminutes) -#else - public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminutes) -#endif - { - double value = (double) centimetersperminutes; - return new Speed(value, SpeedUnit.CentimeterPerMinute); - } - - /// - /// Get Speed from CentimetersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromCentimetersPerSecond(double centimeterspersecond) -#else - public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) -#endif - { - double value = (double) centimeterspersecond; - return new Speed(value, SpeedUnit.CentimeterPerSecond); - } - - /// - /// Get Speed from DecimetersPerMinutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromDecimetersPerMinutes(double decimetersperminutes) -#else - public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) -#endif - { - double value = (double) decimetersperminutes; - return new Speed(value, SpeedUnit.DecimeterPerMinute); - } - - /// - /// Get Speed from DecimetersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromDecimetersPerSecond(double decimeterspersecond) -#else - public static Speed FromDecimetersPerSecond(QuantityValue decimeterspersecond) -#endif - { - double value = (double) decimeterspersecond; - return new Speed(value, SpeedUnit.DecimeterPerSecond); - } - - /// - /// Get Speed from FeetPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromFeetPerHour(double feetperhour) -#else - public static Speed FromFeetPerHour(QuantityValue feetperhour) -#endif - { - double value = (double) feetperhour; - return new Speed(value, SpeedUnit.FootPerHour); - } - - /// - /// Get Speed from FeetPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromFeetPerMinute(double feetperminute) -#else - public static Speed FromFeetPerMinute(QuantityValue feetperminute) -#endif - { - double value = (double) feetperminute; - return new Speed(value, SpeedUnit.FootPerMinute); - } - - /// - /// Get Speed from FeetPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromFeetPerSecond(double feetpersecond) -#else - public static Speed FromFeetPerSecond(QuantityValue feetpersecond) -#endif - { - double value = (double) feetpersecond; - return new Speed(value, SpeedUnit.FootPerSecond); - } - - /// - /// Get Speed from InchesPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromInchesPerHour(double inchesperhour) -#else - public static Speed FromInchesPerHour(QuantityValue inchesperhour) -#endif - { - double value = (double) inchesperhour; - return new Speed(value, SpeedUnit.InchPerHour); - } - - /// - /// Get Speed from InchesPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromInchesPerMinute(double inchesperminute) -#else - public static Speed FromInchesPerMinute(QuantityValue inchesperminute) -#endif - { - double value = (double) inchesperminute; - return new Speed(value, SpeedUnit.InchPerMinute); - } - - /// - /// Get Speed from InchesPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromInchesPerSecond(double inchespersecond) -#else - public static Speed FromInchesPerSecond(QuantityValue inchespersecond) -#endif - { - double value = (double) inchespersecond; - return new Speed(value, SpeedUnit.InchPerSecond); - } - - /// - /// Get Speed from KilometersPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromKilometersPerHour(double kilometersperhour) -#else - public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) -#endif - { - double value = (double) kilometersperhour; - return new Speed(value, SpeedUnit.KilometerPerHour); - } - - /// - /// Get Speed from KilometersPerMinutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromKilometersPerMinutes(double kilometersperminutes) -#else - public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) -#endif - { - double value = (double) kilometersperminutes; - return new Speed(value, SpeedUnit.KilometerPerMinute); - } - - /// - /// Get Speed from KilometersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromKilometersPerSecond(double kilometerspersecond) -#else - public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) -#endif - { - double value = (double) kilometerspersecond; - return new Speed(value, SpeedUnit.KilometerPerSecond); - } - - /// - /// Get Speed from Knots. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromKnots(double knots) -#else - public static Speed FromKnots(QuantityValue knots) -#endif - { - double value = (double) knots; - return new Speed(value, SpeedUnit.Knot); - } - - /// - /// Get Speed from MetersPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMetersPerHour(double metersperhour) -#else - public static Speed FromMetersPerHour(QuantityValue metersperhour) -#endif - { - double value = (double) metersperhour; - return new Speed(value, SpeedUnit.MeterPerHour); - } - - /// - /// Get Speed from MetersPerMinutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMetersPerMinutes(double metersperminutes) -#else - public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) -#endif - { - double value = (double) metersperminutes; - return new Speed(value, SpeedUnit.MeterPerMinute); - } - - /// - /// Get Speed from MetersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMetersPerSecond(double meterspersecond) -#else - public static Speed FromMetersPerSecond(QuantityValue meterspersecond) -#endif - { - double value = (double) meterspersecond; - return new Speed(value, SpeedUnit.MeterPerSecond); - } - - /// - /// Get Speed from MicrometersPerMinutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMicrometersPerMinutes(double micrometersperminutes) -#else - public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminutes) -#endif - { - double value = (double) micrometersperminutes; - return new Speed(value, SpeedUnit.MicrometerPerMinute); - } - - /// - /// Get Speed from MicrometersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMicrometersPerSecond(double micrometerspersecond) -#else - public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) -#endif - { - double value = (double) micrometerspersecond; - return new Speed(value, SpeedUnit.MicrometerPerSecond); - } - - /// - /// Get Speed from MilesPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMilesPerHour(double milesperhour) -#else - public static Speed FromMilesPerHour(QuantityValue milesperhour) -#endif - { - double value = (double) milesperhour; - return new Speed(value, SpeedUnit.MilePerHour); - } - - /// - /// Get Speed from MillimetersPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMillimetersPerHour(double millimetersperhour) -#else - public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) -#endif - { - double value = (double) millimetersperhour; - return new Speed(value, SpeedUnit.MillimeterPerHour); - } - - /// - /// Get Speed from MillimetersPerMinutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMillimetersPerMinutes(double millimetersperminutes) -#else - public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminutes) -#endif - { - double value = (double) millimetersperminutes; - return new Speed(value, SpeedUnit.MillimeterPerMinute); - } - - /// - /// Get Speed from MillimetersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromMillimetersPerSecond(double millimeterspersecond) -#else - public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) -#endif - { - double value = (double) millimeterspersecond; - return new Speed(value, SpeedUnit.MillimeterPerSecond); - } - - /// - /// Get Speed from NanometersPerMinutes. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromNanometersPerMinutes(double nanometersperminutes) -#else - public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) -#endif - { - double value = (double) nanometersperminutes; - return new Speed(value, SpeedUnit.NanometerPerMinute); - } - - /// - /// Get Speed from NanometersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromNanometersPerSecond(double nanometerspersecond) -#else - public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) -#endif - { - double value = (double) nanometerspersecond; - return new Speed(value, SpeedUnit.NanometerPerSecond); - } - - /// - /// Get Speed from UsSurveyFeetPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromUsSurveyFeetPerHour(double ussurveyfeetperhour) -#else - public static Speed FromUsSurveyFeetPerHour(QuantityValue ussurveyfeetperhour) -#endif - { - double value = (double) ussurveyfeetperhour; - return new Speed(value, SpeedUnit.UsSurveyFootPerHour); - } - - /// - /// Get Speed from UsSurveyFeetPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromUsSurveyFeetPerMinute(double ussurveyfeetperminute) -#else - public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminute) -#endif - { - double value = (double) ussurveyfeetperminute; - return new Speed(value, SpeedUnit.UsSurveyFootPerMinute); - } - - /// - /// Get Speed from UsSurveyFeetPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromUsSurveyFeetPerSecond(double ussurveyfeetpersecond) -#else - public static Speed FromUsSurveyFeetPerSecond(QuantityValue ussurveyfeetpersecond) -#endif - { - double value = (double) ussurveyfeetpersecond; - return new Speed(value, SpeedUnit.UsSurveyFootPerSecond); - } - - /// - /// Get Speed from YardsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromYardsPerHour(double yardsperhour) -#else - public static Speed FromYardsPerHour(QuantityValue yardsperhour) -#endif - { - double value = (double) yardsperhour; - return new Speed(value, SpeedUnit.YardPerHour); - } - - /// - /// Get Speed from YardsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromYardsPerMinute(double yardsperminute) -#else - public static Speed FromYardsPerMinute(QuantityValue yardsperminute) -#endif - { - double value = (double) yardsperminute; - return new Speed(value, SpeedUnit.YardPerMinute); - } - - /// - /// Get Speed from YardsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Speed FromYardsPerSecond(double yardspersecond) -#else - public static Speed FromYardsPerSecond(QuantityValue yardspersecond) -#endif - { - double value = (double) yardspersecond; - return new Speed(value, SpeedUnit.YardPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Speed unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Speed From(double value, SpeedUnit fromUnit) -#else - public static Speed From(QuantityValue value, SpeedUnit fromUnit) -#endif - { - return new Speed((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(SpeedUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Speed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); - - return CompareTo((Speed)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Speed other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Speed within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Speed. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(SpeedUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Speed to another Speed with the unit representation . - /// - /// A Speed with the specified unit. - public Speed ToUnit(SpeedUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Speed(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case SpeedUnit.CentimeterPerHour: return (_value/3600) * 1e-2d; - case SpeedUnit.CentimeterPerMinute: return (_value/60) * 1e-2d; - case SpeedUnit.CentimeterPerSecond: return (_value) * 1e-2d; - case SpeedUnit.DecimeterPerMinute: return (_value/60) * 1e-1d; - case SpeedUnit.DecimeterPerSecond: return (_value) * 1e-1d; - case SpeedUnit.FootPerHour: return _value*0.3048/3600; - case SpeedUnit.FootPerMinute: return _value*0.3048/60; - case SpeedUnit.FootPerSecond: return _value*0.3048; - case SpeedUnit.InchPerHour: return (_value/3600)*2.54e-2; - case SpeedUnit.InchPerMinute: return (_value/60)*2.54e-2; - case SpeedUnit.InchPerSecond: return _value*2.54e-2; - case SpeedUnit.KilometerPerHour: return (_value/3600) * 1e3d; - case SpeedUnit.KilometerPerMinute: return (_value/60) * 1e3d; - case SpeedUnit.KilometerPerSecond: return (_value) * 1e3d; - case SpeedUnit.Knot: return _value*0.514444; - case SpeedUnit.MeterPerHour: return _value/3600; - case SpeedUnit.MeterPerMinute: return _value/60; - case SpeedUnit.MeterPerSecond: return _value; - case SpeedUnit.MicrometerPerMinute: return (_value/60) * 1e-6d; - case SpeedUnit.MicrometerPerSecond: return (_value) * 1e-6d; - case SpeedUnit.MilePerHour: return _value*0.44704; - case SpeedUnit.MillimeterPerHour: return (_value/3600) * 1e-3d; - case SpeedUnit.MillimeterPerMinute: return (_value/60) * 1e-3d; - case SpeedUnit.MillimeterPerSecond: return (_value) * 1e-3d; - case SpeedUnit.NanometerPerMinute: return (_value/60) * 1e-9d; - case SpeedUnit.NanometerPerSecond: return (_value) * 1e-9d; - case SpeedUnit.UsSurveyFootPerHour: return (_value*1200/3937)/3600; - case SpeedUnit.UsSurveyFootPerMinute: return (_value*1200/3937)/60; - case SpeedUnit.UsSurveyFootPerSecond: return _value*1200/3937; - case SpeedUnit.YardPerHour: return _value*0.9144/3600; - case SpeedUnit.YardPerMinute: return _value*0.9144/60; - case SpeedUnit.YardPerSecond: return _value*0.9144; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(SpeedUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case SpeedUnit.CentimeterPerHour: return (baseUnitValue*3600) / 1e-2d; - case SpeedUnit.CentimeterPerMinute: return (baseUnitValue*60) / 1e-2d; - case SpeedUnit.CentimeterPerSecond: return (baseUnitValue) / 1e-2d; - case SpeedUnit.DecimeterPerMinute: return (baseUnitValue*60) / 1e-1d; - case SpeedUnit.DecimeterPerSecond: return (baseUnitValue) / 1e-1d; - case SpeedUnit.FootPerHour: return baseUnitValue/0.3048*3600; - case SpeedUnit.FootPerMinute: return baseUnitValue/0.3048*60; - case SpeedUnit.FootPerSecond: return baseUnitValue/0.3048; - case SpeedUnit.InchPerHour: return (baseUnitValue/2.54e-2)*3600; - case SpeedUnit.InchPerMinute: return (baseUnitValue/2.54e-2)*60; - case SpeedUnit.InchPerSecond: return baseUnitValue/2.54e-2; - case SpeedUnit.KilometerPerHour: return (baseUnitValue*3600) / 1e3d; - case SpeedUnit.KilometerPerMinute: return (baseUnitValue*60) / 1e3d; - case SpeedUnit.KilometerPerSecond: return (baseUnitValue) / 1e3d; - case SpeedUnit.Knot: return baseUnitValue/0.514444; - case SpeedUnit.MeterPerHour: return baseUnitValue*3600; - case SpeedUnit.MeterPerMinute: return baseUnitValue*60; - case SpeedUnit.MeterPerSecond: return baseUnitValue; - case SpeedUnit.MicrometerPerMinute: return (baseUnitValue*60) / 1e-6d; - case SpeedUnit.MicrometerPerSecond: return (baseUnitValue) / 1e-6d; - case SpeedUnit.MilePerHour: return baseUnitValue/0.44704; - case SpeedUnit.MillimeterPerHour: return (baseUnitValue*3600) / 1e-3d; - case SpeedUnit.MillimeterPerMinute: return (baseUnitValue*60) / 1e-3d; - case SpeedUnit.MillimeterPerSecond: return (baseUnitValue) / 1e-3d; - case SpeedUnit.NanometerPerMinute: return (baseUnitValue*60) / 1e-9d; - case SpeedUnit.NanometerPerSecond: return (baseUnitValue) / 1e-9d; - case SpeedUnit.UsSurveyFootPerHour: return (baseUnitValue*3937/1200)*3600; - case SpeedUnit.UsSurveyFootPerMinute: return (baseUnitValue*3937/1200)*60; - case SpeedUnit.UsSurveyFootPerSecond: return baseUnitValue*3937/1200; - case SpeedUnit.YardPerHour: return baseUnitValue/0.9144*3600; - case SpeedUnit.YardPerMinute: return baseUnitValue/0.9144*60; - case SpeedUnit.YardPerSecond: return baseUnitValue/0.9144; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Speed Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Speed result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static SpeedUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out SpeedUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Speed ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) - { - result = default(Speed); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static SpeedUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == SpeedUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized SpeedUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out SpeedUnit unit) - { - unit = SpeedUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == SpeedUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(SpeedUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Speed - /// - public static Speed MaxValue => new Speed(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Speed - /// - public static Speed MinValue => new Speed(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Speed.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Speed.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs b/Common/GeneratedCode/Quantities/Temperature.Common.g.cs deleted file mode 100644 index 5d4c748cb7..0000000000 --- a/Common/GeneratedCode/Quantities/Temperature.Common.g.cs +++ /dev/null @@ -1,691 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Temperature : IQuantity -#else - public partial struct Temperature : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly TemperatureUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public TemperatureUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Temperature() - { - BaseDimensions = new BaseDimensions(0, 0, 0, 0, 1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Temperature(double numericValue, TemperatureUnit unit) - { - if(unit == TemperatureUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Temperature; - - /// - /// The base unit of Temperature, which is Kelvin. All conversions go via this value. - /// - public static TemperatureUnit BaseUnit => TemperatureUnit.Kelvin; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Temperature quantity. - /// - public static TemperatureUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureUnit)).Cast().Except(new TemperatureUnit[]{ TemperatureUnit.Undefined }).ToArray(); - - /// - /// Get Temperature in DegreesCelsius. - /// - public double DegreesCelsius => As(TemperatureUnit.DegreeCelsius); - - /// - /// Get Temperature in DegreesDelisle. - /// - public double DegreesDelisle => As(TemperatureUnit.DegreeDelisle); - - /// - /// Get Temperature in DegreesFahrenheit. - /// - public double DegreesFahrenheit => As(TemperatureUnit.DegreeFahrenheit); - - /// - /// Get Temperature in DegreesNewton. - /// - public double DegreesNewton => As(TemperatureUnit.DegreeNewton); - - /// - /// Get Temperature in DegreesRankine. - /// - public double DegreesRankine => As(TemperatureUnit.DegreeRankine); - - /// - /// Get Temperature in DegreesReaumur. - /// - public double DegreesReaumur => As(TemperatureUnit.DegreeReaumur); - - /// - /// Get Temperature in DegreesRoemer. - /// - public double DegreesRoemer => As(TemperatureUnit.DegreeRoemer); - - /// - /// Get Temperature in Kelvins. - /// - public double Kelvins => As(TemperatureUnit.Kelvin); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. - /// - public static Temperature Zero => new Temperature(0, BaseUnit); - - /// - /// Get Temperature from DegreesCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromDegreesCelsius(double degreescelsius) -#else - public static Temperature FromDegreesCelsius(QuantityValue degreescelsius) -#endif - { - double value = (double) degreescelsius; - return new Temperature(value, TemperatureUnit.DegreeCelsius); - } - - /// - /// Get Temperature from DegreesDelisle. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromDegreesDelisle(double degreesdelisle) -#else - public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) -#endif - { - double value = (double) degreesdelisle; - return new Temperature(value, TemperatureUnit.DegreeDelisle); - } - - /// - /// Get Temperature from DegreesFahrenheit. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromDegreesFahrenheit(double degreesfahrenheit) -#else - public static Temperature FromDegreesFahrenheit(QuantityValue degreesfahrenheit) -#endif - { - double value = (double) degreesfahrenheit; - return new Temperature(value, TemperatureUnit.DegreeFahrenheit); - } - - /// - /// Get Temperature from DegreesNewton. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromDegreesNewton(double degreesnewton) -#else - public static Temperature FromDegreesNewton(QuantityValue degreesnewton) -#endif - { - double value = (double) degreesnewton; - return new Temperature(value, TemperatureUnit.DegreeNewton); - } - - /// - /// Get Temperature from DegreesRankine. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromDegreesRankine(double degreesrankine) -#else - public static Temperature FromDegreesRankine(QuantityValue degreesrankine) -#endif - { - double value = (double) degreesrankine; - return new Temperature(value, TemperatureUnit.DegreeRankine); - } - - /// - /// Get Temperature from DegreesReaumur. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromDegreesReaumur(double degreesreaumur) -#else - public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) -#endif - { - double value = (double) degreesreaumur; - return new Temperature(value, TemperatureUnit.DegreeReaumur); - } - - /// - /// Get Temperature from DegreesRoemer. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromDegreesRoemer(double degreesroemer) -#else - public static Temperature FromDegreesRoemer(QuantityValue degreesroemer) -#endif - { - double value = (double) degreesroemer; - return new Temperature(value, TemperatureUnit.DegreeRoemer); - } - - /// - /// Get Temperature from Kelvins. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Temperature FromKelvins(double kelvins) -#else - public static Temperature FromKelvins(QuantityValue kelvins) -#endif - { - double value = (double) kelvins; - return new Temperature(value, TemperatureUnit.Kelvin); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Temperature unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Temperature From(double value, TemperatureUnit fromUnit) -#else - public static Temperature From(QuantityValue value, TemperatureUnit fromUnit) -#endif - { - return new Temperature((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Temperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); - - return CompareTo((Temperature)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Temperature other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Temperature within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Temperature. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(TemperatureUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Temperature to another Temperature with the unit representation . - /// - /// A Temperature with the specified unit. - public Temperature ToUnit(TemperatureUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Temperature(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case TemperatureUnit.DegreeCelsius: return _value + 273.15; - case TemperatureUnit.DegreeDelisle: return _value*-2/3 + 373.15; - case TemperatureUnit.DegreeFahrenheit: return _value*5/9 + 459.67*5/9; - case TemperatureUnit.DegreeNewton: return _value*100/33 + 273.15; - case TemperatureUnit.DegreeRankine: return _value*5/9; - case TemperatureUnit.DegreeReaumur: return _value*5/4 + 273.15; - case TemperatureUnit.DegreeRoemer: return _value*40/21 + 273.15 - 7.5*40d/21; - case TemperatureUnit.Kelvin: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(TemperatureUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case TemperatureUnit.DegreeCelsius: return baseUnitValue - 273.15; - case TemperatureUnit.DegreeDelisle: return (baseUnitValue - 373.15)*-3/2; - case TemperatureUnit.DegreeFahrenheit: return (baseUnitValue - 459.67*5/9)*9/5; - case TemperatureUnit.DegreeNewton: return (baseUnitValue - 273.15)*33/100; - case TemperatureUnit.DegreeRankine: return baseUnitValue*9/5; - case TemperatureUnit.DegreeReaumur: return (baseUnitValue - 273.15)*4/5; - case TemperatureUnit.DegreeRoemer: return (baseUnitValue - (273.15 - 7.5*40d/21))*21/40; - case TemperatureUnit.Kelvin: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Temperature Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Temperature result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out TemperatureUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Temperature ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) - { - result = default(Temperature); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static TemperatureUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == TemperatureUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureUnit unit) - { - unit = TemperatureUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == TemperatureUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(TemperatureUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Temperature - /// - public static Temperature MaxValue => new Temperature(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Temperature - /// - public static Temperature MinValue => new Temperature(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Temperature.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Temperature.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs deleted file mode 100644 index 7fd42725ee..0000000000 --- a/Common/GeneratedCode/Quantities/TemperatureChangeRate.Common.g.cs +++ /dev/null @@ -1,735 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class TemperatureChangeRate : IQuantity -#else - public partial struct TemperatureChangeRate : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly TemperatureChangeRateUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public TemperatureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static TemperatureChangeRate() - { - BaseDimensions = new BaseDimensions(0, 0, -1, 0, 1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - TemperatureChangeRate(double numericValue, TemperatureChangeRateUnit unit) - { - if(unit == TemperatureChangeRateUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.TemperatureChangeRate; - - /// - /// The base unit of TemperatureChangeRate, which is DegreeCelsiusPerSecond. All conversions go via this value. - /// - public static TemperatureChangeRateUnit BaseUnit => TemperatureChangeRateUnit.DegreeCelsiusPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the TemperatureChangeRate quantity. - /// - public static TemperatureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureChangeRateUnit)).Cast().Except(new TemperatureChangeRateUnit[]{ TemperatureChangeRateUnit.Undefined }).ToArray(); - - /// - /// Get TemperatureChangeRate in CentidegreesCelsiusPerSecond. - /// - public double CentidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in DecadegreesCelsiusPerSecond. - /// - public double DecadegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in DecidegreesCelsiusPerSecond. - /// - public double DecidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in DegreesCelsiusPerMinute. - /// - public double DegreesCelsiusPerMinute => As(TemperatureChangeRateUnit.DegreeCelsiusPerMinute); - - /// - /// Get TemperatureChangeRate in DegreesCelsiusPerSecond. - /// - public double DegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in HectodegreesCelsiusPerSecond. - /// - public double HectodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in KilodegreesCelsiusPerSecond. - /// - public double KilodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in MicrodegreesCelsiusPerSecond. - /// - public double MicrodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in MillidegreesCelsiusPerSecond. - /// - public double MillidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); - - /// - /// Get TemperatureChangeRate in NanodegreesCelsiusPerSecond. - /// - public double NanodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. - /// - public static TemperatureChangeRate Zero => new TemperatureChangeRate(0, BaseUnit); - - /// - /// Get TemperatureChangeRate from CentidegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(double centidegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(QuantityValue centidegreescelsiuspersecond) -#endif - { - double value = (double) centidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from DecadegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(double decadegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValue decadegreescelsiuspersecond) -#endif - { - double value = (double) decadegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from DecidegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(double decidegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(QuantityValue decidegreescelsiuspersecond) -#endif - { - double value = (double) decidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from DegreesCelsiusPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromDegreesCelsiusPerMinute(double degreescelsiusperminute) -#else - public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue degreescelsiusperminute) -#endif - { - double value = (double) degreescelsiusperminute; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerMinute); - } - - /// - /// Get TemperatureChangeRate from DegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromDegreesCelsiusPerSecond(double degreescelsiuspersecond) -#else - public static TemperatureChangeRate FromDegreesCelsiusPerSecond(QuantityValue degreescelsiuspersecond) -#endif - { - double value = (double) degreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from HectodegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(double hectodegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityValue hectodegreescelsiuspersecond) -#endif - { - double value = (double) hectodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from KilodegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(double kilodegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(QuantityValue kilodegreescelsiuspersecond) -#endif - { - double value = (double) kilodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from MicrodegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(double microdegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityValue microdegreescelsiuspersecond) -#endif - { - double value = (double) microdegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from MillidegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(double millidegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(QuantityValue millidegreescelsiuspersecond) -#endif - { - double value = (double) millidegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); - } - - /// - /// Get TemperatureChangeRate from NanodegreesCelsiusPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(double nanodegreescelsiuspersecond) -#else - public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(QuantityValue nanodegreescelsiuspersecond) -#endif - { - double value = (double) nanodegreescelsiuspersecond; - return new TemperatureChangeRate(value, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// TemperatureChangeRate unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static TemperatureChangeRate From(double value, TemperatureChangeRateUnit fromUnit) -#else - public static TemperatureChangeRate From(QuantityValue value, TemperatureChangeRateUnit fromUnit) -#endif - { - return new TemperatureChangeRate((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureChangeRateUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); - - return CompareTo((TemperatureChangeRate)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(TemperatureChangeRate other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another TemperatureChangeRate within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current TemperatureChangeRate. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(TemperatureChangeRateUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this TemperatureChangeRate to another TemperatureChangeRate with the unit representation . - /// - /// A TemperatureChangeRate with the specified unit. - public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new TemperatureChangeRate(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (_value) * 1e-2d; - case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (_value) * 1e1d; - case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (_value) * 1e-1d; - case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return _value/60; - case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return _value; - case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (_value) * 1e2d; - case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (_value) * 1e3d; - case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (_value) * 1e-6d; - case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (_value) * 1e-3d; - case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (_value) * 1e-9d; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(TemperatureChangeRateUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-2d; - case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (baseUnitValue) / 1e1d; - case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-1d; - case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return baseUnitValue*60; - case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return baseUnitValue; - case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (baseUnitValue) / 1e2d; - case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (baseUnitValue) / 1e3d; - case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (baseUnitValue) / 1e-6d; - case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-3d; - case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (baseUnitValue) / 1e-9d; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static TemperatureChangeRate Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureChangeRateUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out TemperatureChangeRateUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static TemperatureChangeRate ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) - { - result = default(TemperatureChangeRate); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static TemperatureChangeRateUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == TemperatureChangeRateUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureChangeRateUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureChangeRateUnit unit) - { - unit = TemperatureChangeRateUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == TemperatureChangeRateUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(TemperatureChangeRateUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of TemperatureChangeRate - /// - public static TemperatureChangeRate MaxValue => new TemperatureChangeRate(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of TemperatureChangeRate - /// - public static TemperatureChangeRate MinValue => new TemperatureChangeRate(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => TemperatureChangeRate.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => TemperatureChangeRate.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs b/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs deleted file mode 100644 index 0cd1a49739..0000000000 --- a/Common/GeneratedCode/Quantities/TemperatureDelta.Common.g.cs +++ /dev/null @@ -1,690 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Difference between two temperatures. The conversions are different than for Temperature. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class TemperatureDelta : IQuantity -#else - public partial struct TemperatureDelta : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly TemperatureDeltaUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public TemperatureDeltaUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static TemperatureDelta() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - TemperatureDelta(double numericValue, TemperatureDeltaUnit unit) - { - if(unit == TemperatureDeltaUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.TemperatureDelta; - - /// - /// The base unit of TemperatureDelta, which is Kelvin. All conversions go via this value. - /// - public static TemperatureDeltaUnit BaseUnit => TemperatureDeltaUnit.Kelvin; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the TemperatureDelta quantity. - /// - public static TemperatureDeltaUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureDeltaUnit)).Cast().Except(new TemperatureDeltaUnit[]{ TemperatureDeltaUnit.Undefined }).ToArray(); - - /// - /// Get TemperatureDelta in DegreesCelsius. - /// - public double DegreesCelsius => As(TemperatureDeltaUnit.DegreeCelsius); - - /// - /// Get TemperatureDelta in DegreesDelisle. - /// - public double DegreesDelisle => As(TemperatureDeltaUnit.DegreeDelisle); - - /// - /// Get TemperatureDelta in DegreesFahrenheit. - /// - public double DegreesFahrenheit => As(TemperatureDeltaUnit.DegreeFahrenheit); - - /// - /// Get TemperatureDelta in DegreesNewton. - /// - public double DegreesNewton => As(TemperatureDeltaUnit.DegreeNewton); - - /// - /// Get TemperatureDelta in DegreesRankine. - /// - public double DegreesRankine => As(TemperatureDeltaUnit.DegreeRankine); - - /// - /// Get TemperatureDelta in DegreesReaumur. - /// - public double DegreesReaumur => As(TemperatureDeltaUnit.DegreeReaumur); - - /// - /// Get TemperatureDelta in DegreesRoemer. - /// - public double DegreesRoemer => As(TemperatureDeltaUnit.DegreeRoemer); - - /// - /// Get TemperatureDelta in Kelvins. - /// - public double Kelvins => As(TemperatureDeltaUnit.Kelvin); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. - /// - public static TemperatureDelta Zero => new TemperatureDelta(0, BaseUnit); - - /// - /// Get TemperatureDelta from DegreesCelsius. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesCelsius(double degreescelsius) -#else - public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) -#endif - { - double value = (double) degreescelsius; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsius); - } - - /// - /// Get TemperatureDelta from DegreesDelisle. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesDelisle(double degreesdelisle) -#else - public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) -#endif - { - double value = (double) degreesdelisle; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisle); - } - - /// - /// Get TemperatureDelta from DegreesFahrenheit. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesFahrenheit(double degreesfahrenheit) -#else - public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahrenheit) -#endif - { - double value = (double) degreesfahrenheit; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheit); - } - - /// - /// Get TemperatureDelta from DegreesNewton. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesNewton(double degreesnewton) -#else - public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) -#endif - { - double value = (double) degreesnewton; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewton); - } - - /// - /// Get TemperatureDelta from DegreesRankine. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesRankine(double degreesrankine) -#else - public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) -#endif - { - double value = (double) degreesrankine; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankine); - } - - /// - /// Get TemperatureDelta from DegreesReaumur. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesReaumur(double degreesreaumur) -#else - public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) -#endif - { - double value = (double) degreesreaumur; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumur); - } - - /// - /// Get TemperatureDelta from DegreesRoemer. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromDegreesRoemer(double degreesroemer) -#else - public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) -#endif - { - double value = (double) degreesroemer; - return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemer); - } - - /// - /// Get TemperatureDelta from Kelvins. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static TemperatureDelta FromKelvins(double kelvins) -#else - public static TemperatureDelta FromKelvins(QuantityValue kelvins) -#endif - { - double value = (double) kelvins; - return new TemperatureDelta(value, TemperatureDeltaUnit.Kelvin); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// TemperatureDelta unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static TemperatureDelta From(double value, TemperatureDeltaUnit fromUnit) -#else - public static TemperatureDelta From(QuantityValue value, TemperatureDeltaUnit fromUnit) -#endif - { - return new TemperatureDelta((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TemperatureDeltaUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); - - return CompareTo((TemperatureDelta)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(TemperatureDelta other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another TemperatureDelta within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current TemperatureDelta. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(TemperatureDeltaUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this TemperatureDelta to another TemperatureDelta with the unit representation . - /// - /// A TemperatureDelta with the specified unit. - public TemperatureDelta ToUnit(TemperatureDeltaUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new TemperatureDelta(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case TemperatureDeltaUnit.DegreeCelsius: return _value; - case TemperatureDeltaUnit.DegreeDelisle: return _value*-2/3; - case TemperatureDeltaUnit.DegreeFahrenheit: return _value*5/9; - case TemperatureDeltaUnit.DegreeNewton: return _value*100/33; - case TemperatureDeltaUnit.DegreeRankine: return _value*5/9; - case TemperatureDeltaUnit.DegreeReaumur: return _value*5/4; - case TemperatureDeltaUnit.DegreeRoemer: return _value*40/21; - case TemperatureDeltaUnit.Kelvin: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(TemperatureDeltaUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case TemperatureDeltaUnit.DegreeCelsius: return baseUnitValue; - case TemperatureDeltaUnit.DegreeDelisle: return baseUnitValue*-3/2; - case TemperatureDeltaUnit.DegreeFahrenheit: return baseUnitValue*9/5; - case TemperatureDeltaUnit.DegreeNewton: return baseUnitValue*33/100; - case TemperatureDeltaUnit.DegreeRankine: return baseUnitValue*9/5; - case TemperatureDeltaUnit.DegreeReaumur: return baseUnitValue*4/5; - case TemperatureDeltaUnit.DegreeRoemer: return baseUnitValue*21/40; - case TemperatureDeltaUnit.Kelvin: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static TemperatureDelta Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TemperatureDeltaUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out TemperatureDeltaUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static TemperatureDelta ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) - { - result = default(TemperatureDelta); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static TemperatureDeltaUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == TemperatureDeltaUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TemperatureDeltaUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TemperatureDeltaUnit unit) - { - unit = TemperatureDeltaUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == TemperatureDeltaUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(TemperatureDeltaUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of TemperatureDelta - /// - public static TemperatureDelta MaxValue => new TemperatureDelta(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of TemperatureDelta - /// - public static TemperatureDelta MinValue => new TemperatureDelta(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => TemperatureDelta.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => TemperatureDelta.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs deleted file mode 100644 index 1c23b158ee..0000000000 --- a/Common/GeneratedCode/Quantities/ThermalConductivity.Common.g.cs +++ /dev/null @@ -1,559 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Thermal conductivity is the property of a material to conduct heat. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ThermalConductivity : IQuantity -#else - public partial struct ThermalConductivity : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ThermalConductivityUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ThermalConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ThermalConductivity() - { - BaseDimensions = new BaseDimensions(1, 1, -3, 0, -1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ThermalConductivity(double numericValue, ThermalConductivityUnit unit) - { - if(unit == ThermalConductivityUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ThermalConductivity; - - /// - /// The base unit of ThermalConductivity, which is WattPerMeterKelvin. All conversions go via this value. - /// - public static ThermalConductivityUnit BaseUnit => ThermalConductivityUnit.WattPerMeterKelvin; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ThermalConductivity quantity. - /// - public static ThermalConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast().Except(new ThermalConductivityUnit[]{ ThermalConductivityUnit.Undefined }).ToArray(); - - /// - /// Get ThermalConductivity in BtusPerHourFootFahrenheit. - /// - public double BtusPerHourFootFahrenheit => As(ThermalConductivityUnit.BtuPerHourFootFahrenheit); - - /// - /// Get ThermalConductivity in WattsPerMeterKelvin. - /// - public double WattsPerMeterKelvin => As(ThermalConductivityUnit.WattPerMeterKelvin); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit WattPerMeterKelvin. - /// - public static ThermalConductivity Zero => new ThermalConductivity(0, BaseUnit); - - /// - /// Get ThermalConductivity from BtusPerHourFootFahrenheit. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ThermalConductivity FromBtusPerHourFootFahrenheit(double btusperhourfootfahrenheit) -#else - public static ThermalConductivity FromBtusPerHourFootFahrenheit(QuantityValue btusperhourfootfahrenheit) -#endif - { - double value = (double) btusperhourfootfahrenheit; - return new ThermalConductivity(value, ThermalConductivityUnit.BtuPerHourFootFahrenheit); - } - - /// - /// Get ThermalConductivity from WattsPerMeterKelvin. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ThermalConductivity FromWattsPerMeterKelvin(double wattspermeterkelvin) -#else - public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue wattspermeterkelvin) -#endif - { - double value = (double) wattspermeterkelvin; - return new ThermalConductivity(value, ThermalConductivityUnit.WattPerMeterKelvin); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ThermalConductivity unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ThermalConductivity From(double value, ThermalConductivityUnit fromUnit) -#else - public static ThermalConductivity From(QuantityValue value, ThermalConductivityUnit fromUnit) -#endif - { - return new ThermalConductivity((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ThermalConductivityUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); - - return CompareTo((ThermalConductivity)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ThermalConductivity other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ThermalConductivity within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ThermalConductivity. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ThermalConductivityUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ThermalConductivity to another ThermalConductivity with the unit representation . - /// - /// A ThermalConductivity with the specified unit. - public ThermalConductivity ToUnit(ThermalConductivityUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ThermalConductivity(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return _value*1.73073467; - case ThermalConductivityUnit.WattPerMeterKelvin: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ThermalConductivityUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return baseUnitValue/1.73073467; - case ThermalConductivityUnit.WattPerMeterKelvin: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ThermalConductivity Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ThermalConductivity result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalConductivityUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ThermalConductivityUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ThermalConductivity ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) - { - result = default(ThermalConductivity); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ThermalConductivityUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ThermalConductivityUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalConductivityUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalConductivityUnit unit) - { - unit = ThermalConductivityUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ThermalConductivityUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ThermalConductivityUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ThermalConductivity - /// - public static ThermalConductivity MaxValue => new ThermalConductivity(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ThermalConductivity - /// - public static ThermalConductivity MinValue => new ThermalConductivity(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ThermalConductivity.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ThermalConductivity.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs b/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs deleted file mode 100644 index a50ef603b4..0000000000 --- a/Common/GeneratedCode/Quantities/ThermalResistance.Common.g.cs +++ /dev/null @@ -1,625 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class ThermalResistance : IQuantity -#else - public partial struct ThermalResistance : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly ThermalResistanceUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public ThermalResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static ThermalResistance() - { - BaseDimensions = new BaseDimensions(0, -1, 3, 0, 1, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - ThermalResistance(double numericValue, ThermalResistanceUnit unit) - { - if(unit == ThermalResistanceUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.ThermalResistance; - - /// - /// The base unit of ThermalResistance, which is SquareMeterKelvinPerKilowatt. All conversions go via this value. - /// - public static ThermalResistanceUnit BaseUnit => ThermalResistanceUnit.SquareMeterKelvinPerKilowatt; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the ThermalResistance quantity. - /// - public static ThermalResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ThermalResistanceUnit)).Cast().Except(new ThermalResistanceUnit[]{ ThermalResistanceUnit.Undefined }).ToArray(); - - /// - /// Get ThermalResistance in HourSquareFeetDegreesFahrenheitPerBtu. - /// - public double HourSquareFeetDegreesFahrenheitPerBtu => As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); - - /// - /// Get ThermalResistance in SquareCentimeterHourDegreesCelsiusPerKilocalorie. - /// - public double SquareCentimeterHourDegreesCelsiusPerKilocalorie => As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); - - /// - /// Get ThermalResistance in SquareCentimeterKelvinsPerWatt. - /// - public double SquareCentimeterKelvinsPerWatt => As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); - - /// - /// Get ThermalResistance in SquareMeterDegreesCelsiusPerWatt. - /// - public double SquareMeterDegreesCelsiusPerWatt => As(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); - - /// - /// Get ThermalResistance in SquareMeterKelvinsPerKilowatt. - /// - public double SquareMeterKelvinsPerKilowatt => As(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. - /// - public static ThermalResistance Zero => new ThermalResistance(0, BaseUnit); - - /// - /// Get ThermalResistance from HourSquareFeetDegreesFahrenheitPerBtu. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(double hoursquarefeetdegreesfahrenheitperbtu) -#else - public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue hoursquarefeetdegreesfahrenheitperbtu) -#endif - { - double value = (double) hoursquarefeetdegreesfahrenheitperbtu; - return new ThermalResistance(value, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); - } - - /// - /// Get ThermalResistance from SquareCentimeterHourDegreesCelsiusPerKilocalorie. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(double squarecentimeterhourdegreescelsiusperkilocalorie) -#else - public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue squarecentimeterhourdegreescelsiusperkilocalorie) -#endif - { - double value = (double) squarecentimeterhourdegreescelsiusperkilocalorie; - return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); - } - - /// - /// Get ThermalResistance from SquareCentimeterKelvinsPerWatt. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(double squarecentimeterkelvinsperwatt) -#else - public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(QuantityValue squarecentimeterkelvinsperwatt) -#endif - { - double value = (double) squarecentimeterkelvinsperwatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); - } - - /// - /// Get ThermalResistance from SquareMeterDegreesCelsiusPerWatt. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(double squaremeterdegreescelsiusperwatt) -#else - public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityValue squaremeterdegreescelsiusperwatt) -#endif - { - double value = (double) squaremeterdegreescelsiusperwatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); - } - - /// - /// Get ThermalResistance from SquareMeterKelvinsPerKilowatt. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(double squaremeterkelvinsperkilowatt) -#else - public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(QuantityValue squaremeterkelvinsperkilowatt) -#endif - { - double value = (double) squaremeterkelvinsperkilowatt; - return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ThermalResistance unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static ThermalResistance From(double value, ThermalResistanceUnit fromUnit) -#else - public static ThermalResistance From(QuantityValue value, ThermalResistanceUnit fromUnit) -#endif - { - return new ThermalResistance((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(ThermalResistanceUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); - - return CompareTo((ThermalResistance)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(ThermalResistance other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another ThermalResistance within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current ThermalResistance. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(ThermalResistanceUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this ThermalResistance to another ThermalResistance with the unit representation . - /// - /// A ThermalResistance with the specified unit. - public ThermalResistance ToUnit(ThermalResistanceUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new ThermalResistance(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return _value*176.1121482159839; - case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return _value*0.0859779507590433; - case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return _value*0.0999964777570357; - case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return _value*1000.088056074108; - case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(ThermalResistanceUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return baseUnitValue/176.1121482159839; - case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return baseUnitValue/0.0859779507590433; - case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return baseUnitValue/0.0999964777570357; - case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return baseUnitValue/1000.088056074108; - case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static ThermalResistance Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out ThermalResistance result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static ThermalResistanceUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out ThermalResistanceUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static ThermalResistance ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) - { - result = default(ThermalResistance); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static ThermalResistanceUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == ThermalResistanceUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized ThermalResistanceUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out ThermalResistanceUnit unit) - { - unit = ThermalResistanceUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == ThermalResistanceUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(ThermalResistanceUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of ThermalResistance - /// - public static ThermalResistance MaxValue => new ThermalResistance(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of ThermalResistance - /// - public static ThermalResistance MinValue => new ThermalResistance(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => ThermalResistance.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => ThermalResistance.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Torque.Common.g.cs b/Common/GeneratedCode/Quantities/Torque.Common.g.cs deleted file mode 100644 index fd91c3cca3..0000000000 --- a/Common/GeneratedCode/Quantities/Torque.Common.g.cs +++ /dev/null @@ -1,977 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Torque : IQuantity -#else - public partial struct Torque : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly TorqueUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public TorqueUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Torque() - { - BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Torque(double numericValue, TorqueUnit unit) - { - if(unit == TorqueUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Torque; - - /// - /// The base unit of Torque, which is NewtonMeter. All conversions go via this value. - /// - public static TorqueUnit BaseUnit => TorqueUnit.NewtonMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Torque quantity. - /// - public static TorqueUnit[] Units { get; } = Enum.GetValues(typeof(TorqueUnit)).Cast().Except(new TorqueUnit[]{ TorqueUnit.Undefined }).ToArray(); - - /// - /// Get Torque in KilogramForceCentimeters. - /// - public double KilogramForceCentimeters => As(TorqueUnit.KilogramForceCentimeter); - - /// - /// Get Torque in KilogramForceMeters. - /// - public double KilogramForceMeters => As(TorqueUnit.KilogramForceMeter); - - /// - /// Get Torque in KilogramForceMillimeters. - /// - public double KilogramForceMillimeters => As(TorqueUnit.KilogramForceMillimeter); - - /// - /// Get Torque in KilonewtonCentimeters. - /// - public double KilonewtonCentimeters => As(TorqueUnit.KilonewtonCentimeter); - - /// - /// Get Torque in KilonewtonMeters. - /// - public double KilonewtonMeters => As(TorqueUnit.KilonewtonMeter); - - /// - /// Get Torque in KilonewtonMillimeters. - /// - public double KilonewtonMillimeters => As(TorqueUnit.KilonewtonMillimeter); - - /// - /// Get Torque in KilopoundForceFeet. - /// - public double KilopoundForceFeet => As(TorqueUnit.KilopoundForceFoot); - - /// - /// Get Torque in KilopoundForceInches. - /// - public double KilopoundForceInches => As(TorqueUnit.KilopoundForceInch); - - /// - /// Get Torque in MeganewtonCentimeters. - /// - public double MeganewtonCentimeters => As(TorqueUnit.MeganewtonCentimeter); - - /// - /// Get Torque in MeganewtonMeters. - /// - public double MeganewtonMeters => As(TorqueUnit.MeganewtonMeter); - - /// - /// Get Torque in MeganewtonMillimeters. - /// - public double MeganewtonMillimeters => As(TorqueUnit.MeganewtonMillimeter); - - /// - /// Get Torque in MegapoundForceFeet. - /// - public double MegapoundForceFeet => As(TorqueUnit.MegapoundForceFoot); - - /// - /// Get Torque in MegapoundForceInches. - /// - public double MegapoundForceInches => As(TorqueUnit.MegapoundForceInch); - - /// - /// Get Torque in NewtonCentimeters. - /// - public double NewtonCentimeters => As(TorqueUnit.NewtonCentimeter); - - /// - /// Get Torque in NewtonMeters. - /// - public double NewtonMeters => As(TorqueUnit.NewtonMeter); - - /// - /// Get Torque in NewtonMillimeters. - /// - public double NewtonMillimeters => As(TorqueUnit.NewtonMillimeter); - - /// - /// Get Torque in PoundForceFeet. - /// - public double PoundForceFeet => As(TorqueUnit.PoundForceFoot); - - /// - /// Get Torque in PoundForceInches. - /// - public double PoundForceInches => As(TorqueUnit.PoundForceInch); - - /// - /// Get Torque in TonneForceCentimeters. - /// - public double TonneForceCentimeters => As(TorqueUnit.TonneForceCentimeter); - - /// - /// Get Torque in TonneForceMeters. - /// - public double TonneForceMeters => As(TorqueUnit.TonneForceMeter); - - /// - /// Get Torque in TonneForceMillimeters. - /// - public double TonneForceMillimeters => As(TorqueUnit.TonneForceMillimeter); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeter. - /// - public static Torque Zero => new Torque(0, BaseUnit); - - /// - /// Get Torque from KilogramForceCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilogramForceCentimeters(double kilogramforcecentimeters) -#else - public static Torque FromKilogramForceCentimeters(QuantityValue kilogramforcecentimeters) -#endif - { - double value = (double) kilogramforcecentimeters; - return new Torque(value, TorqueUnit.KilogramForceCentimeter); - } - - /// - /// Get Torque from KilogramForceMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilogramForceMeters(double kilogramforcemeters) -#else - public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) -#endif - { - double value = (double) kilogramforcemeters; - return new Torque(value, TorqueUnit.KilogramForceMeter); - } - - /// - /// Get Torque from KilogramForceMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilogramForceMillimeters(double kilogramforcemillimeters) -#else - public static Torque FromKilogramForceMillimeters(QuantityValue kilogramforcemillimeters) -#endif - { - double value = (double) kilogramforcemillimeters; - return new Torque(value, TorqueUnit.KilogramForceMillimeter); - } - - /// - /// Get Torque from KilonewtonCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilonewtonCentimeters(double kilonewtoncentimeters) -#else - public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimeters) -#endif - { - double value = (double) kilonewtoncentimeters; - return new Torque(value, TorqueUnit.KilonewtonCentimeter); - } - - /// - /// Get Torque from KilonewtonMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilonewtonMeters(double kilonewtonmeters) -#else - public static Torque FromKilonewtonMeters(QuantityValue kilonewtonmeters) -#endif - { - double value = (double) kilonewtonmeters; - return new Torque(value, TorqueUnit.KilonewtonMeter); - } - - /// - /// Get Torque from KilonewtonMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilonewtonMillimeters(double kilonewtonmillimeters) -#else - public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimeters) -#endif - { - double value = (double) kilonewtonmillimeters; - return new Torque(value, TorqueUnit.KilonewtonMillimeter); - } - - /// - /// Get Torque from KilopoundForceFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilopoundForceFeet(double kilopoundforcefeet) -#else - public static Torque FromKilopoundForceFeet(QuantityValue kilopoundforcefeet) -#endif - { - double value = (double) kilopoundforcefeet; - return new Torque(value, TorqueUnit.KilopoundForceFoot); - } - - /// - /// Get Torque from KilopoundForceInches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromKilopoundForceInches(double kilopoundforceinches) -#else - public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches) -#endif - { - double value = (double) kilopoundforceinches; - return new Torque(value, TorqueUnit.KilopoundForceInch); - } - - /// - /// Get Torque from MeganewtonCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromMeganewtonCentimeters(double meganewtoncentimeters) -#else - public static Torque FromMeganewtonCentimeters(QuantityValue meganewtoncentimeters) -#endif - { - double value = (double) meganewtoncentimeters; - return new Torque(value, TorqueUnit.MeganewtonCentimeter); - } - - /// - /// Get Torque from MeganewtonMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromMeganewtonMeters(double meganewtonmeters) -#else - public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) -#endif - { - double value = (double) meganewtonmeters; - return new Torque(value, TorqueUnit.MeganewtonMeter); - } - - /// - /// Get Torque from MeganewtonMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromMeganewtonMillimeters(double meganewtonmillimeters) -#else - public static Torque FromMeganewtonMillimeters(QuantityValue meganewtonmillimeters) -#endif - { - double value = (double) meganewtonmillimeters; - return new Torque(value, TorqueUnit.MeganewtonMillimeter); - } - - /// - /// Get Torque from MegapoundForceFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromMegapoundForceFeet(double megapoundforcefeet) -#else - public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) -#endif - { - double value = (double) megapoundforcefeet; - return new Torque(value, TorqueUnit.MegapoundForceFoot); - } - - /// - /// Get Torque from MegapoundForceInches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromMegapoundForceInches(double megapoundforceinches) -#else - public static Torque FromMegapoundForceInches(QuantityValue megapoundforceinches) -#endif - { - double value = (double) megapoundforceinches; - return new Torque(value, TorqueUnit.MegapoundForceInch); - } - - /// - /// Get Torque from NewtonCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromNewtonCentimeters(double newtoncentimeters) -#else - public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) -#endif - { - double value = (double) newtoncentimeters; - return new Torque(value, TorqueUnit.NewtonCentimeter); - } - - /// - /// Get Torque from NewtonMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromNewtonMeters(double newtonmeters) -#else - public static Torque FromNewtonMeters(QuantityValue newtonmeters) -#endif - { - double value = (double) newtonmeters; - return new Torque(value, TorqueUnit.NewtonMeter); - } - - /// - /// Get Torque from NewtonMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromNewtonMillimeters(double newtonmillimeters) -#else - public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) -#endif - { - double value = (double) newtonmillimeters; - return new Torque(value, TorqueUnit.NewtonMillimeter); - } - - /// - /// Get Torque from PoundForceFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromPoundForceFeet(double poundforcefeet) -#else - public static Torque FromPoundForceFeet(QuantityValue poundforcefeet) -#endif - { - double value = (double) poundforcefeet; - return new Torque(value, TorqueUnit.PoundForceFoot); - } - - /// - /// Get Torque from PoundForceInches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromPoundForceInches(double poundforceinches) -#else - public static Torque FromPoundForceInches(QuantityValue poundforceinches) -#endif - { - double value = (double) poundforceinches; - return new Torque(value, TorqueUnit.PoundForceInch); - } - - /// - /// Get Torque from TonneForceCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromTonneForceCentimeters(double tonneforcecentimeters) -#else - public static Torque FromTonneForceCentimeters(QuantityValue tonneforcecentimeters) -#endif - { - double value = (double) tonneforcecentimeters; - return new Torque(value, TorqueUnit.TonneForceCentimeter); - } - - /// - /// Get Torque from TonneForceMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromTonneForceMeters(double tonneforcemeters) -#else - public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) -#endif - { - double value = (double) tonneforcemeters; - return new Torque(value, TorqueUnit.TonneForceMeter); - } - - /// - /// Get Torque from TonneForceMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Torque FromTonneForceMillimeters(double tonneforcemillimeters) -#else - public static Torque FromTonneForceMillimeters(QuantityValue tonneforcemillimeters) -#endif - { - double value = (double) tonneforcemillimeters; - return new Torque(value, TorqueUnit.TonneForceMillimeter); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Torque unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Torque From(double value, TorqueUnit fromUnit) -#else - public static Torque From(QuantityValue value, TorqueUnit fromUnit) -#endif - { - return new Torque((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(TorqueUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Torque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); - - return CompareTo((Torque)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Torque other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Torque within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Torque. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(TorqueUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Torque to another Torque with the unit representation . - /// - /// A Torque with the specified unit. - public Torque ToUnit(TorqueUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Torque(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case TorqueUnit.KilogramForceCentimeter: return _value*0.0980665019960652; - case TorqueUnit.KilogramForceMeter: return _value*9.80665019960652; - case TorqueUnit.KilogramForceMillimeter: return _value*0.00980665019960652; - case TorqueUnit.KilonewtonCentimeter: return (_value*0.01) * 1e3d; - case TorqueUnit.KilonewtonMeter: return (_value) * 1e3d; - case TorqueUnit.KilonewtonMillimeter: return (_value*0.001) * 1e3d; - case TorqueUnit.KilopoundForceFoot: return (_value*1.3558179483314) * 1e3d; - case TorqueUnit.KilopoundForceInch: return (_value*1.129848290276167e-1) * 1e3d; - case TorqueUnit.MeganewtonCentimeter: return (_value*0.01) * 1e6d; - case TorqueUnit.MeganewtonMeter: return (_value) * 1e6d; - case TorqueUnit.MeganewtonMillimeter: return (_value*0.001) * 1e6d; - case TorqueUnit.MegapoundForceFoot: return (_value*1.3558179483314) * 1e6d; - case TorqueUnit.MegapoundForceInch: return (_value*1.129848290276167e-1) * 1e6d; - case TorqueUnit.NewtonCentimeter: return _value*0.01; - case TorqueUnit.NewtonMeter: return _value; - case TorqueUnit.NewtonMillimeter: return _value*0.001; - case TorqueUnit.PoundForceFoot: return _value*1.3558179483314; - case TorqueUnit.PoundForceInch: return _value*1.129848290276167e-1; - case TorqueUnit.TonneForceCentimeter: return _value*98.0665019960652; - case TorqueUnit.TonneForceMeter: return _value*9806.65019960653; - case TorqueUnit.TonneForceMillimeter: return _value*9.80665019960652; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(TorqueUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case TorqueUnit.KilogramForceCentimeter: return baseUnitValue*10.1971619222242; - case TorqueUnit.KilogramForceMeter: return baseUnitValue*0.101971619222242; - case TorqueUnit.KilogramForceMillimeter: return baseUnitValue*101.971619222242; - case TorqueUnit.KilonewtonCentimeter: return (baseUnitValue*100) / 1e3d; - case TorqueUnit.KilonewtonMeter: return (baseUnitValue) / 1e3d; - case TorqueUnit.KilonewtonMillimeter: return (baseUnitValue*1000) / 1e3d; - case TorqueUnit.KilopoundForceFoot: return (baseUnitValue/1.3558179483314) / 1e3d; - case TorqueUnit.KilopoundForceInch: return (baseUnitValue/1.129848290276167e-1) / 1e3d; - case TorqueUnit.MeganewtonCentimeter: return (baseUnitValue*100) / 1e6d; - case TorqueUnit.MeganewtonMeter: return (baseUnitValue) / 1e6d; - case TorqueUnit.MeganewtonMillimeter: return (baseUnitValue*1000) / 1e6d; - case TorqueUnit.MegapoundForceFoot: return (baseUnitValue/1.3558179483314) / 1e6d; - case TorqueUnit.MegapoundForceInch: return (baseUnitValue/1.129848290276167e-1) / 1e6d; - case TorqueUnit.NewtonCentimeter: return baseUnitValue*100; - case TorqueUnit.NewtonMeter: return baseUnitValue; - case TorqueUnit.NewtonMillimeter: return baseUnitValue*1000; - case TorqueUnit.PoundForceFoot: return baseUnitValue/1.3558179483314; - case TorqueUnit.PoundForceInch: return baseUnitValue/1.129848290276167e-1; - case TorqueUnit.TonneForceCentimeter: return baseUnitValue*0.0101971619222242; - case TorqueUnit.TonneForceMeter: return baseUnitValue*0.000101971619222242; - case TorqueUnit.TonneForceMillimeter: return baseUnitValue*0.101971619222242; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Torque Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Torque result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static TorqueUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out TorqueUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Torque ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) - { - result = default(Torque); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static TorqueUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == TorqueUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized TorqueUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out TorqueUnit unit) - { - unit = TorqueUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == TorqueUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(TorqueUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Torque - /// - public static Torque MaxValue => new Torque(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Torque - /// - public static Torque MinValue => new Torque(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Torque.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Torque.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs b/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs deleted file mode 100644 index cbf92fdf97..0000000000 --- a/Common/GeneratedCode/Quantities/VitaminA.Common.g.cs +++ /dev/null @@ -1,536 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class VitaminA : IQuantity -#else - public partial struct VitaminA : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly VitaminAUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public VitaminAUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static VitaminA() - { - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - VitaminA(double numericValue, VitaminAUnit unit) - { - if(unit == VitaminAUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.VitaminA; - - /// - /// The base unit of VitaminA, which is InternationalUnit. All conversions go via this value. - /// - public static VitaminAUnit BaseUnit => VitaminAUnit.InternationalUnit; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the VitaminA quantity. - /// - public static VitaminAUnit[] Units { get; } = Enum.GetValues(typeof(VitaminAUnit)).Cast().Except(new VitaminAUnit[]{ VitaminAUnit.Undefined }).ToArray(); - - /// - /// Get VitaminA in InternationalUnits. - /// - public double InternationalUnits => As(VitaminAUnit.InternationalUnit); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit InternationalUnit. - /// - public static VitaminA Zero => new VitaminA(0, BaseUnit); - - /// - /// Get VitaminA from InternationalUnits. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VitaminA FromInternationalUnits(double internationalunits) -#else - public static VitaminA FromInternationalUnits(QuantityValue internationalunits) -#endif - { - double value = (double) internationalunits; - return new VitaminA(value, VitaminAUnit.InternationalUnit); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// VitaminA unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static VitaminA From(double value, VitaminAUnit fromUnit) -#else - public static VitaminA From(QuantityValue value, VitaminAUnit fromUnit) -#endif - { - return new VitaminA((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VitaminAUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); - - return CompareTo((VitaminA)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(VitaminA other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another VitaminA within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current VitaminA. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(VitaminAUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this VitaminA to another VitaminA with the unit representation . - /// - /// A VitaminA with the specified unit. - public VitaminA ToUnit(VitaminAUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new VitaminA(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case VitaminAUnit.InternationalUnit: return _value; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(VitaminAUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case VitaminAUnit.InternationalUnit: return baseUnitValue; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static VitaminA Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out VitaminA result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VitaminAUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out VitaminAUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static VitaminA ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) - { - result = default(VitaminA); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static VitaminAUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == VitaminAUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VitaminAUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out VitaminAUnit unit) - { - unit = VitaminAUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == VitaminAUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(VitaminAUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of VitaminA - /// - public static VitaminA MaxValue => new VitaminA(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of VitaminA - /// - public static VitaminA MinValue => new VitaminA(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => VitaminA.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => VitaminA.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/Volume.Common.g.cs b/Common/GeneratedCode/Quantities/Volume.Common.g.cs deleted file mode 100644 index be78c8f41e..0000000000 --- a/Common/GeneratedCode/Quantities/Volume.Common.g.cs +++ /dev/null @@ -1,1439 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class Volume : IQuantity -#else - public partial struct Volume : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly VolumeUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public VolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static Volume() - { - BaseDimensions = new BaseDimensions(3, 0, 0, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - Volume(double numericValue, VolumeUnit unit) - { - if(unit == VolumeUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.Volume; - - /// - /// The base unit of Volume, which is CubicMeter. All conversions go via this value. - /// - public static VolumeUnit BaseUnit => VolumeUnit.CubicMeter; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the Volume quantity. - /// - public static VolumeUnit[] Units { get; } = Enum.GetValues(typeof(VolumeUnit)).Cast().Except(new VolumeUnit[]{ VolumeUnit.Undefined }).ToArray(); - - /// - /// Get Volume in AuTablespoons. - /// - public double AuTablespoons => As(VolumeUnit.AuTablespoon); - - /// - /// Get Volume in Centiliters. - /// - public double Centiliters => As(VolumeUnit.Centiliter); - - /// - /// Get Volume in CubicCentimeters. - /// - public double CubicCentimeters => As(VolumeUnit.CubicCentimeter); - - /// - /// Get Volume in CubicDecimeters. - /// - public double CubicDecimeters => As(VolumeUnit.CubicDecimeter); - - /// - /// Get Volume in CubicFeet. - /// - public double CubicFeet => As(VolumeUnit.CubicFoot); - - /// - /// Get Volume in CubicInches. - /// - public double CubicInches => As(VolumeUnit.CubicInch); - - /// - /// Get Volume in CubicKilometers. - /// - public double CubicKilometers => As(VolumeUnit.CubicKilometer); - - /// - /// Get Volume in CubicMeters. - /// - public double CubicMeters => As(VolumeUnit.CubicMeter); - - /// - /// Get Volume in CubicMicrometers. - /// - public double CubicMicrometers => As(VolumeUnit.CubicMicrometer); - - /// - /// Get Volume in CubicMiles. - /// - public double CubicMiles => As(VolumeUnit.CubicMile); - - /// - /// Get Volume in CubicMillimeters. - /// - public double CubicMillimeters => As(VolumeUnit.CubicMillimeter); - - /// - /// Get Volume in CubicYards. - /// - public double CubicYards => As(VolumeUnit.CubicYard); - - /// - /// Get Volume in Deciliters. - /// - public double Deciliters => As(VolumeUnit.Deciliter); - - /// - /// Get Volume in HectocubicFeet. - /// - public double HectocubicFeet => As(VolumeUnit.HectocubicFoot); - - /// - /// Get Volume in HectocubicMeters. - /// - public double HectocubicMeters => As(VolumeUnit.HectocubicMeter); - - /// - /// Get Volume in Hectoliters. - /// - public double Hectoliters => As(VolumeUnit.Hectoliter); - - /// - /// Get Volume in ImperialBeerBarrels. - /// - public double ImperialBeerBarrels => As(VolumeUnit.ImperialBeerBarrel); - - /// - /// Get Volume in ImperialGallons. - /// - public double ImperialGallons => As(VolumeUnit.ImperialGallon); - - /// - /// Get Volume in ImperialOunces. - /// - public double ImperialOunces => As(VolumeUnit.ImperialOunce); - - /// - /// Get Volume in KilocubicFeet. - /// - public double KilocubicFeet => As(VolumeUnit.KilocubicFoot); - - /// - /// Get Volume in KilocubicMeters. - /// - public double KilocubicMeters => As(VolumeUnit.KilocubicMeter); - - /// - /// Get Volume in KiloimperialGallons. - /// - public double KiloimperialGallons => As(VolumeUnit.KiloimperialGallon); - - /// - /// Get Volume in KilousGallons. - /// - public double KilousGallons => As(VolumeUnit.KilousGallon); - - /// - /// Get Volume in Liters. - /// - public double Liters => As(VolumeUnit.Liter); - - /// - /// Get Volume in MegacubicFeet. - /// - public double MegacubicFeet => As(VolumeUnit.MegacubicFoot); - - /// - /// Get Volume in MegaimperialGallons. - /// - public double MegaimperialGallons => As(VolumeUnit.MegaimperialGallon); - - /// - /// Get Volume in MegausGallons. - /// - public double MegausGallons => As(VolumeUnit.MegausGallon); - - /// - /// Get Volume in MetricCups. - /// - public double MetricCups => As(VolumeUnit.MetricCup); - - /// - /// Get Volume in MetricTeaspoons. - /// - public double MetricTeaspoons => As(VolumeUnit.MetricTeaspoon); - - /// - /// Get Volume in Microliters. - /// - public double Microliters => As(VolumeUnit.Microliter); - - /// - /// Get Volume in Milliliters. - /// - public double Milliliters => As(VolumeUnit.Milliliter); - - /// - /// Get Volume in OilBarrels. - /// - public double OilBarrels => As(VolumeUnit.OilBarrel); - - /// - /// Get Volume in UkTablespoons. - /// - public double UkTablespoons => As(VolumeUnit.UkTablespoon); - - /// - /// Get Volume in UsBeerBarrels. - /// - public double UsBeerBarrels => As(VolumeUnit.UsBeerBarrel); - - /// - /// Get Volume in UsCustomaryCups. - /// - public double UsCustomaryCups => As(VolumeUnit.UsCustomaryCup); - - /// - /// Get Volume in UsGallons. - /// - public double UsGallons => As(VolumeUnit.UsGallon); - - /// - /// Get Volume in UsLegalCups. - /// - public double UsLegalCups => As(VolumeUnit.UsLegalCup); - - /// - /// Get Volume in UsOunces. - /// - public double UsOunces => As(VolumeUnit.UsOunce); - - /// - /// Get Volume in UsPints. - /// - public double UsPints => As(VolumeUnit.UsPint); - - /// - /// Get Volume in UsQuarts. - /// - public double UsQuarts => As(VolumeUnit.UsQuart); - - /// - /// Get Volume in UsTablespoons. - /// - public double UsTablespoons => As(VolumeUnit.UsTablespoon); - - /// - /// Get Volume in UsTeaspoons. - /// - public double UsTeaspoons => As(VolumeUnit.UsTeaspoon); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeter. - /// - public static Volume Zero => new Volume(0, BaseUnit); - - /// - /// Get Volume from AuTablespoons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromAuTablespoons(double autablespoons) -#else - public static Volume FromAuTablespoons(QuantityValue autablespoons) -#endif - { - double value = (double) autablespoons; - return new Volume(value, VolumeUnit.AuTablespoon); - } - - /// - /// Get Volume from Centiliters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCentiliters(double centiliters) -#else - public static Volume FromCentiliters(QuantityValue centiliters) -#endif - { - double value = (double) centiliters; - return new Volume(value, VolumeUnit.Centiliter); - } - - /// - /// Get Volume from CubicCentimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicCentimeters(double cubiccentimeters) -#else - public static Volume FromCubicCentimeters(QuantityValue cubiccentimeters) -#endif - { - double value = (double) cubiccentimeters; - return new Volume(value, VolumeUnit.CubicCentimeter); - } - - /// - /// Get Volume from CubicDecimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicDecimeters(double cubicdecimeters) -#else - public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) -#endif - { - double value = (double) cubicdecimeters; - return new Volume(value, VolumeUnit.CubicDecimeter); - } - - /// - /// Get Volume from CubicFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicFeet(double cubicfeet) -#else - public static Volume FromCubicFeet(QuantityValue cubicfeet) -#endif - { - double value = (double) cubicfeet; - return new Volume(value, VolumeUnit.CubicFoot); - } - - /// - /// Get Volume from CubicInches. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicInches(double cubicinches) -#else - public static Volume FromCubicInches(QuantityValue cubicinches) -#endif - { - double value = (double) cubicinches; - return new Volume(value, VolumeUnit.CubicInch); - } - - /// - /// Get Volume from CubicKilometers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicKilometers(double cubickilometers) -#else - public static Volume FromCubicKilometers(QuantityValue cubickilometers) -#endif - { - double value = (double) cubickilometers; - return new Volume(value, VolumeUnit.CubicKilometer); - } - - /// - /// Get Volume from CubicMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicMeters(double cubicmeters) -#else - public static Volume FromCubicMeters(QuantityValue cubicmeters) -#endif - { - double value = (double) cubicmeters; - return new Volume(value, VolumeUnit.CubicMeter); - } - - /// - /// Get Volume from CubicMicrometers. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicMicrometers(double cubicmicrometers) -#else - public static Volume FromCubicMicrometers(QuantityValue cubicmicrometers) -#endif - { - double value = (double) cubicmicrometers; - return new Volume(value, VolumeUnit.CubicMicrometer); - } - - /// - /// Get Volume from CubicMiles. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicMiles(double cubicmiles) -#else - public static Volume FromCubicMiles(QuantityValue cubicmiles) -#endif - { - double value = (double) cubicmiles; - return new Volume(value, VolumeUnit.CubicMile); - } - - /// - /// Get Volume from CubicMillimeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicMillimeters(double cubicmillimeters) -#else - public static Volume FromCubicMillimeters(QuantityValue cubicmillimeters) -#endif - { - double value = (double) cubicmillimeters; - return new Volume(value, VolumeUnit.CubicMillimeter); - } - - /// - /// Get Volume from CubicYards. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromCubicYards(double cubicyards) -#else - public static Volume FromCubicYards(QuantityValue cubicyards) -#endif - { - double value = (double) cubicyards; - return new Volume(value, VolumeUnit.CubicYard); - } - - /// - /// Get Volume from Deciliters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromDeciliters(double deciliters) -#else - public static Volume FromDeciliters(QuantityValue deciliters) -#endif - { - double value = (double) deciliters; - return new Volume(value, VolumeUnit.Deciliter); - } - - /// - /// Get Volume from HectocubicFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromHectocubicFeet(double hectocubicfeet) -#else - public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) -#endif - { - double value = (double) hectocubicfeet; - return new Volume(value, VolumeUnit.HectocubicFoot); - } - - /// - /// Get Volume from HectocubicMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromHectocubicMeters(double hectocubicmeters) -#else - public static Volume FromHectocubicMeters(QuantityValue hectocubicmeters) -#endif - { - double value = (double) hectocubicmeters; - return new Volume(value, VolumeUnit.HectocubicMeter); - } - - /// - /// Get Volume from Hectoliters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromHectoliters(double hectoliters) -#else - public static Volume FromHectoliters(QuantityValue hectoliters) -#endif - { - double value = (double) hectoliters; - return new Volume(value, VolumeUnit.Hectoliter); - } - - /// - /// Get Volume from ImperialBeerBarrels. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromImperialBeerBarrels(double imperialbeerbarrels) -#else - public static Volume FromImperialBeerBarrels(QuantityValue imperialbeerbarrels) -#endif - { - double value = (double) imperialbeerbarrels; - return new Volume(value, VolumeUnit.ImperialBeerBarrel); - } - - /// - /// Get Volume from ImperialGallons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromImperialGallons(double imperialgallons) -#else - public static Volume FromImperialGallons(QuantityValue imperialgallons) -#endif - { - double value = (double) imperialgallons; - return new Volume(value, VolumeUnit.ImperialGallon); - } - - /// - /// Get Volume from ImperialOunces. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromImperialOunces(double imperialounces) -#else - public static Volume FromImperialOunces(QuantityValue imperialounces) -#endif - { - double value = (double) imperialounces; - return new Volume(value, VolumeUnit.ImperialOunce); - } - - /// - /// Get Volume from KilocubicFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromKilocubicFeet(double kilocubicfeet) -#else - public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) -#endif - { - double value = (double) kilocubicfeet; - return new Volume(value, VolumeUnit.KilocubicFoot); - } - - /// - /// Get Volume from KilocubicMeters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromKilocubicMeters(double kilocubicmeters) -#else - public static Volume FromKilocubicMeters(QuantityValue kilocubicmeters) -#endif - { - double value = (double) kilocubicmeters; - return new Volume(value, VolumeUnit.KilocubicMeter); - } - - /// - /// Get Volume from KiloimperialGallons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromKiloimperialGallons(double kiloimperialgallons) -#else - public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) -#endif - { - double value = (double) kiloimperialgallons; - return new Volume(value, VolumeUnit.KiloimperialGallon); - } - - /// - /// Get Volume from KilousGallons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromKilousGallons(double kilousgallons) -#else - public static Volume FromKilousGallons(QuantityValue kilousgallons) -#endif - { - double value = (double) kilousgallons; - return new Volume(value, VolumeUnit.KilousGallon); - } - - /// - /// Get Volume from Liters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromLiters(double liters) -#else - public static Volume FromLiters(QuantityValue liters) -#endif - { - double value = (double) liters; - return new Volume(value, VolumeUnit.Liter); - } - - /// - /// Get Volume from MegacubicFeet. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromMegacubicFeet(double megacubicfeet) -#else - public static Volume FromMegacubicFeet(QuantityValue megacubicfeet) -#endif - { - double value = (double) megacubicfeet; - return new Volume(value, VolumeUnit.MegacubicFoot); - } - - /// - /// Get Volume from MegaimperialGallons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromMegaimperialGallons(double megaimperialgallons) -#else - public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) -#endif - { - double value = (double) megaimperialgallons; - return new Volume(value, VolumeUnit.MegaimperialGallon); - } - - /// - /// Get Volume from MegausGallons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromMegausGallons(double megausgallons) -#else - public static Volume FromMegausGallons(QuantityValue megausgallons) -#endif - { - double value = (double) megausgallons; - return new Volume(value, VolumeUnit.MegausGallon); - } - - /// - /// Get Volume from MetricCups. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromMetricCups(double metriccups) -#else - public static Volume FromMetricCups(QuantityValue metriccups) -#endif - { - double value = (double) metriccups; - return new Volume(value, VolumeUnit.MetricCup); - } - - /// - /// Get Volume from MetricTeaspoons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromMetricTeaspoons(double metricteaspoons) -#else - public static Volume FromMetricTeaspoons(QuantityValue metricteaspoons) -#endif - { - double value = (double) metricteaspoons; - return new Volume(value, VolumeUnit.MetricTeaspoon); - } - - /// - /// Get Volume from Microliters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromMicroliters(double microliters) -#else - public static Volume FromMicroliters(QuantityValue microliters) -#endif - { - double value = (double) microliters; - return new Volume(value, VolumeUnit.Microliter); - } - - /// - /// Get Volume from Milliliters. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromMilliliters(double milliliters) -#else - public static Volume FromMilliliters(QuantityValue milliliters) -#endif - { - double value = (double) milliliters; - return new Volume(value, VolumeUnit.Milliliter); - } - - /// - /// Get Volume from OilBarrels. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromOilBarrels(double oilbarrels) -#else - public static Volume FromOilBarrels(QuantityValue oilbarrels) -#endif - { - double value = (double) oilbarrels; - return new Volume(value, VolumeUnit.OilBarrel); - } - - /// - /// Get Volume from UkTablespoons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUkTablespoons(double uktablespoons) -#else - public static Volume FromUkTablespoons(QuantityValue uktablespoons) -#endif - { - double value = (double) uktablespoons; - return new Volume(value, VolumeUnit.UkTablespoon); - } - - /// - /// Get Volume from UsBeerBarrels. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsBeerBarrels(double usbeerbarrels) -#else - public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) -#endif - { - double value = (double) usbeerbarrels; - return new Volume(value, VolumeUnit.UsBeerBarrel); - } - - /// - /// Get Volume from UsCustomaryCups. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsCustomaryCups(double uscustomarycups) -#else - public static Volume FromUsCustomaryCups(QuantityValue uscustomarycups) -#endif - { - double value = (double) uscustomarycups; - return new Volume(value, VolumeUnit.UsCustomaryCup); - } - - /// - /// Get Volume from UsGallons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsGallons(double usgallons) -#else - public static Volume FromUsGallons(QuantityValue usgallons) -#endif - { - double value = (double) usgallons; - return new Volume(value, VolumeUnit.UsGallon); - } - - /// - /// Get Volume from UsLegalCups. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsLegalCups(double uslegalcups) -#else - public static Volume FromUsLegalCups(QuantityValue uslegalcups) -#endif - { - double value = (double) uslegalcups; - return new Volume(value, VolumeUnit.UsLegalCup); - } - - /// - /// Get Volume from UsOunces. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsOunces(double usounces) -#else - public static Volume FromUsOunces(QuantityValue usounces) -#endif - { - double value = (double) usounces; - return new Volume(value, VolumeUnit.UsOunce); - } - - /// - /// Get Volume from UsPints. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsPints(double uspints) -#else - public static Volume FromUsPints(QuantityValue uspints) -#endif - { - double value = (double) uspints; - return new Volume(value, VolumeUnit.UsPint); - } - - /// - /// Get Volume from UsQuarts. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsQuarts(double usquarts) -#else - public static Volume FromUsQuarts(QuantityValue usquarts) -#endif - { - double value = (double) usquarts; - return new Volume(value, VolumeUnit.UsQuart); - } - - /// - /// Get Volume from UsTablespoons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsTablespoons(double ustablespoons) -#else - public static Volume FromUsTablespoons(QuantityValue ustablespoons) -#endif - { - double value = (double) ustablespoons; - return new Volume(value, VolumeUnit.UsTablespoon); - } - - /// - /// Get Volume from UsTeaspoons. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static Volume FromUsTeaspoons(double usteaspoons) -#else - public static Volume FromUsTeaspoons(QuantityValue usteaspoons) -#endif - { - double value = (double) usteaspoons; - return new Volume(value, VolumeUnit.UsTeaspoon); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Volume unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static Volume From(double value, VolumeUnit fromUnit) -#else - public static Volume From(QuantityValue value, VolumeUnit fromUnit) -#endif - { - return new Volume((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VolumeUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Volume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); - - return CompareTo((Volume)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(Volume other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another Volume within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current Volume. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(VolumeUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this Volume to another Volume with the unit representation . - /// - /// A Volume with the specified unit. - public Volume ToUnit(VolumeUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new Volume(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case VolumeUnit.AuTablespoon: return _value*2e-5; - case VolumeUnit.Centiliter: return (_value/1e3) * 1e-2d; - case VolumeUnit.CubicCentimeter: return _value/1e6; - case VolumeUnit.CubicDecimeter: return _value/1e3; - case VolumeUnit.CubicFoot: return _value*0.0283168; - case VolumeUnit.CubicInch: return _value*1.6387*1e-5; - case VolumeUnit.CubicKilometer: return _value*1e9; - case VolumeUnit.CubicMeter: return _value; - case VolumeUnit.CubicMicrometer: return _value/1e18; - case VolumeUnit.CubicMile: return _value*4.16818182544058e9; - case VolumeUnit.CubicMillimeter: return _value/1e9; - case VolumeUnit.CubicYard: return _value*0.764554858; - case VolumeUnit.Deciliter: return (_value/1e3) * 1e-1d; - case VolumeUnit.HectocubicFoot: return (_value*0.0283168) * 1e2d; - case VolumeUnit.HectocubicMeter: return (_value) * 1e2d; - case VolumeUnit.Hectoliter: return (_value/1e3) * 1e2d; - case VolumeUnit.ImperialBeerBarrel: return _value*0.16365924; - case VolumeUnit.ImperialGallon: return _value*0.00454609000000181429905810072407; - case VolumeUnit.ImperialOunce: return _value*2.8413062499962901241875439064617e-5; - case VolumeUnit.KilocubicFoot: return (_value*0.0283168) * 1e3d; - case VolumeUnit.KilocubicMeter: return (_value) * 1e3d; - case VolumeUnit.KiloimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e3d; - case VolumeUnit.KilousGallon: return (_value*0.00378541) * 1e3d; - case VolumeUnit.Liter: return _value/1e3; - case VolumeUnit.MegacubicFoot: return (_value*0.0283168) * 1e6d; - case VolumeUnit.MegaimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e6d; - case VolumeUnit.MegausGallon: return (_value*0.00378541) * 1e6d; - case VolumeUnit.MetricCup: return _value*0.00025; - case VolumeUnit.MetricTeaspoon: return _value*0.5e-5; - case VolumeUnit.Microliter: return (_value/1e3) * 1e-6d; - case VolumeUnit.Milliliter: return (_value/1e3) * 1e-3d; - case VolumeUnit.OilBarrel: return _value*0.158987294928; - case VolumeUnit.UkTablespoon: return _value*1.5e-5; - case VolumeUnit.UsBeerBarrel: return _value*0.1173477658; - case VolumeUnit.UsCustomaryCup: return _value*0.0002365882365; - case VolumeUnit.UsGallon: return _value*0.00378541; - case VolumeUnit.UsLegalCup: return _value*0.00024; - case VolumeUnit.UsOunce: return _value*2.957352956253760505068307980135e-5; - case VolumeUnit.UsPint: return _value*4.73176473e-4; - case VolumeUnit.UsQuart: return _value*9.46352946e-4; - case VolumeUnit.UsTablespoon: return _value*1.478676478125e-5; - case VolumeUnit.UsTeaspoon: return _value*4.92892159375e-6; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(VolumeUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case VolumeUnit.AuTablespoon: return baseUnitValue/2e-5; - case VolumeUnit.Centiliter: return (baseUnitValue*1e3) / 1e-2d; - case VolumeUnit.CubicCentimeter: return baseUnitValue*1e6; - case VolumeUnit.CubicDecimeter: return baseUnitValue*1e3; - case VolumeUnit.CubicFoot: return baseUnitValue/0.0283168; - case VolumeUnit.CubicInch: return baseUnitValue/(1.6387*1e-5); - case VolumeUnit.CubicKilometer: return baseUnitValue/1e9; - case VolumeUnit.CubicMeter: return baseUnitValue; - case VolumeUnit.CubicMicrometer: return baseUnitValue*1e18; - case VolumeUnit.CubicMile: return baseUnitValue/4.16818182544058e9; - case VolumeUnit.CubicMillimeter: return baseUnitValue*1e9; - case VolumeUnit.CubicYard: return baseUnitValue/0.764554858; - case VolumeUnit.Deciliter: return (baseUnitValue*1e3) / 1e-1d; - case VolumeUnit.HectocubicFoot: return (baseUnitValue/0.0283168) / 1e2d; - case VolumeUnit.HectocubicMeter: return (baseUnitValue) / 1e2d; - case VolumeUnit.Hectoliter: return (baseUnitValue*1e3) / 1e2d; - case VolumeUnit.ImperialBeerBarrel: return baseUnitValue/0.16365924; - case VolumeUnit.ImperialGallon: return baseUnitValue/0.00454609000000181429905810072407; - case VolumeUnit.ImperialOunce: return baseUnitValue/2.8413062499962901241875439064617e-5; - case VolumeUnit.KilocubicFoot: return (baseUnitValue/0.0283168) / 1e3d; - case VolumeUnit.KilocubicMeter: return (baseUnitValue) / 1e3d; - case VolumeUnit.KiloimperialGallon: return (baseUnitValue/0.00454609000000181429905810072407) / 1e3d; - case VolumeUnit.KilousGallon: return (baseUnitValue/0.00378541) / 1e3d; - case VolumeUnit.Liter: return baseUnitValue*1e3; - case VolumeUnit.MegacubicFoot: return (baseUnitValue/0.0283168) / 1e6d; - case VolumeUnit.MegaimperialGallon: return (baseUnitValue/0.00454609000000181429905810072407) / 1e6d; - case VolumeUnit.MegausGallon: return (baseUnitValue/0.00378541) / 1e6d; - case VolumeUnit.MetricCup: return baseUnitValue/0.00025; - case VolumeUnit.MetricTeaspoon: return baseUnitValue/0.5e-5; - case VolumeUnit.Microliter: return (baseUnitValue*1e3) / 1e-6d; - case VolumeUnit.Milliliter: return (baseUnitValue*1e3) / 1e-3d; - case VolumeUnit.OilBarrel: return baseUnitValue/0.158987294928; - case VolumeUnit.UkTablespoon: return baseUnitValue/1.5e-5; - case VolumeUnit.UsBeerBarrel: return baseUnitValue/0.1173477658; - case VolumeUnit.UsCustomaryCup: return baseUnitValue/0.0002365882365; - case VolumeUnit.UsGallon: return baseUnitValue/0.00378541; - case VolumeUnit.UsLegalCup: return baseUnitValue/0.00024; - case VolumeUnit.UsOunce: return baseUnitValue/2.957352956253760505068307980135e-5; - case VolumeUnit.UsPint: return baseUnitValue/4.73176473e-4; - case VolumeUnit.UsQuart: return baseUnitValue/9.46352946e-4; - case VolumeUnit.UsTablespoon: return baseUnitValue/1.478676478125e-5; - case VolumeUnit.UsTeaspoon: return baseUnitValue/4.92892159375e-6; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Volume Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out Volume result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out VolumeUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Volume ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) - { - result = default(Volume); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static VolumeUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == VolumeUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeUnit unit) - { - unit = VolumeUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == VolumeUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(VolumeUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of Volume - /// - public static Volume MaxValue => new Volume(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of Volume - /// - public static Volume MinValue => new Volume(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => Volume.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => Volume.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs deleted file mode 100644 index 1965904664..0000000000 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ /dev/null @@ -1,1087 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class VolumeFlow : IQuantity -#else - public partial struct VolumeFlow : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly VolumeFlowUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public VolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static VolumeFlow() - { - BaseDimensions = new BaseDimensions(3, 0, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - VolumeFlow(double numericValue, VolumeFlowUnit unit) - { - if(unit == VolumeFlowUnit.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.VolumeFlow; - - /// - /// The base unit of VolumeFlow, which is CubicMeterPerSecond. All conversions go via this value. - /// - public static VolumeFlowUnit BaseUnit => VolumeFlowUnit.CubicMeterPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the VolumeFlow quantity. - /// - public static VolumeFlowUnit[] Units { get; } = Enum.GetValues(typeof(VolumeFlowUnit)).Cast().Except(new VolumeFlowUnit[]{ VolumeFlowUnit.Undefined }).ToArray(); - - /// - /// Get VolumeFlow in CentilitersPerMinute. - /// - public double CentilitersPerMinute => As(VolumeFlowUnit.CentiliterPerMinute); - - /// - /// Get VolumeFlow in CubicDecimetersPerMinute. - /// - public double CubicDecimetersPerMinute => As(VolumeFlowUnit.CubicDecimeterPerMinute); - - /// - /// Get VolumeFlow in CubicFeetPerHour. - /// - public double CubicFeetPerHour => As(VolumeFlowUnit.CubicFootPerHour); - - /// - /// Get VolumeFlow in CubicFeetPerMinute. - /// - public double CubicFeetPerMinute => As(VolumeFlowUnit.CubicFootPerMinute); - - /// - /// Get VolumeFlow in CubicFeetPerSecond. - /// - public double CubicFeetPerSecond => As(VolumeFlowUnit.CubicFootPerSecond); - - /// - /// Get VolumeFlow in CubicMetersPerHour. - /// - public double CubicMetersPerHour => As(VolumeFlowUnit.CubicMeterPerHour); - - /// - /// Get VolumeFlow in CubicMetersPerMinute. - /// - public double CubicMetersPerMinute => As(VolumeFlowUnit.CubicMeterPerMinute); - - /// - /// Get VolumeFlow in CubicMetersPerSecond. - /// - public double CubicMetersPerSecond => As(VolumeFlowUnit.CubicMeterPerSecond); - - /// - /// Get VolumeFlow in CubicYardsPerHour. - /// - public double CubicYardsPerHour => As(VolumeFlowUnit.CubicYardPerHour); - - /// - /// Get VolumeFlow in CubicYardsPerMinute. - /// - public double CubicYardsPerMinute => As(VolumeFlowUnit.CubicYardPerMinute); - - /// - /// Get VolumeFlow in CubicYardsPerSecond. - /// - public double CubicYardsPerSecond => As(VolumeFlowUnit.CubicYardPerSecond); - - /// - /// Get VolumeFlow in DecilitersPerMinute. - /// - public double DecilitersPerMinute => As(VolumeFlowUnit.DeciliterPerMinute); - - /// - /// Get VolumeFlow in KilolitersPerMinute. - /// - public double KilolitersPerMinute => As(VolumeFlowUnit.KiloliterPerMinute); - - /// - /// Get VolumeFlow in LitersPerHour. - /// - public double LitersPerHour => As(VolumeFlowUnit.LiterPerHour); - - /// - /// Get VolumeFlow in LitersPerMinute. - /// - public double LitersPerMinute => As(VolumeFlowUnit.LiterPerMinute); - - /// - /// Get VolumeFlow in LitersPerSecond. - /// - public double LitersPerSecond => As(VolumeFlowUnit.LiterPerSecond); - - /// - /// Get VolumeFlow in MicrolitersPerMinute. - /// - public double MicrolitersPerMinute => As(VolumeFlowUnit.MicroliterPerMinute); - - /// - /// Get VolumeFlow in MillilitersPerMinute. - /// - public double MillilitersPerMinute => As(VolumeFlowUnit.MilliliterPerMinute); - - /// - /// Get VolumeFlow in MillionUsGallonsPerDay. - /// - public double MillionUsGallonsPerDay => As(VolumeFlowUnit.MillionUsGallonsPerDay); - - /// - /// Get VolumeFlow in NanolitersPerMinute. - /// - public double NanolitersPerMinute => As(VolumeFlowUnit.NanoliterPerMinute); - - /// - /// Get VolumeFlow in OilBarrelsPerDay. - /// - public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelPerDay); - - /// - /// Get VolumeFlow in OilBarrelsPerHour. - /// - public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelPerHour); - - /// - /// Get VolumeFlow in OilBarrelsPerMinute. - /// - public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelPerMinute); - - /// - /// Get VolumeFlow in UsGallonsPerHour. - /// - public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonPerHour); - - /// - /// Get VolumeFlow in UsGallonsPerMinute. - /// - public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonPerMinute); - - /// - /// Get VolumeFlow in UsGallonsPerSecond. - /// - public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. - /// - public static VolumeFlow Zero => new VolumeFlow(0, BaseUnit); - - /// - /// Get VolumeFlow from CentilitersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCentilitersPerMinute(double centilitersperminute) -#else - public static VolumeFlow FromCentilitersPerMinute(QuantityValue centilitersperminute) -#endif - { - double value = (double) centilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerMinute); - } - - /// - /// Get VolumeFlow from CubicDecimetersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) -#else - public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimetersperminute) -#endif - { - double value = (double) cubicdecimetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicDecimeterPerMinute); - } - - /// - /// Get VolumeFlow from CubicFeetPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicFeetPerHour(double cubicfeetperhour) -#else - public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) -#endif - { - double value = (double) cubicfeetperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerHour); - } - - /// - /// Get VolumeFlow from CubicFeetPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicFeetPerMinute(double cubicfeetperminute) -#else - public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute) -#endif - { - double value = (double) cubicfeetperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerMinute); - } - - /// - /// Get VolumeFlow from CubicFeetPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicFeetPerSecond(double cubicfeetpersecond) -#else - public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond) -#endif - { - double value = (double) cubicfeetpersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerSecond); - } - - /// - /// Get VolumeFlow from CubicMetersPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicMetersPerHour(double cubicmetersperhour) -#else - public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour) -#endif - { - double value = (double) cubicmetersperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerHour); - } - - /// - /// Get VolumeFlow from CubicMetersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicMetersPerMinute(double cubicmetersperminute) -#else - public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmetersperminute) -#endif - { - double value = (double) cubicmetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerMinute); - } - - /// - /// Get VolumeFlow from CubicMetersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicMetersPerSecond(double cubicmeterspersecond) -#else - public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmeterspersecond) -#endif - { - double value = (double) cubicmeterspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerSecond); - } - - /// - /// Get VolumeFlow from CubicYardsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicYardsPerHour(double cubicyardsperhour) -#else - public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) -#endif - { - double value = (double) cubicyardsperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerHour); - } - - /// - /// Get VolumeFlow from CubicYardsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicYardsPerMinute(double cubicyardsperminute) -#else - public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminute) -#endif - { - double value = (double) cubicyardsperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerMinute); - } - - /// - /// Get VolumeFlow from CubicYardsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicYardsPerSecond(double cubicyardspersecond) -#else - public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardspersecond) -#endif - { - double value = (double) cubicyardspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerSecond); - } - - /// - /// Get VolumeFlow from DecilitersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromDecilitersPerMinute(double decilitersperminute) -#else - public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminute) -#endif - { - double value = (double) decilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerMinute); - } - - /// - /// Get VolumeFlow from KilolitersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromKilolitersPerMinute(double kilolitersperminute) -#else - public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminute) -#endif - { - double value = (double) kilolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerMinute); - } - - /// - /// Get VolumeFlow from LitersPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromLitersPerHour(double litersperhour) -#else - public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) -#endif - { - double value = (double) litersperhour; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerHour); - } - - /// - /// Get VolumeFlow from LitersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromLitersPerMinute(double litersperminute) -#else - public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) -#endif - { - double value = (double) litersperminute; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerMinute); - } - - /// - /// Get VolumeFlow from LitersPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromLitersPerSecond(double literspersecond) -#else - public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) -#endif - { - double value = (double) literspersecond; - return new VolumeFlow(value, VolumeFlowUnit.LiterPerSecond); - } - - /// - /// Get VolumeFlow from MicrolitersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromMicrolitersPerMinute(double microlitersperminute) -#else - public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microlitersperminute) -#endif - { - double value = (double) microlitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerMinute); - } - - /// - /// Get VolumeFlow from MillilitersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromMillilitersPerMinute(double millilitersperminute) -#else - public static VolumeFlow FromMillilitersPerMinute(QuantityValue millilitersperminute) -#endif - { - double value = (double) millilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerMinute); - } - - /// - /// Get VolumeFlow from MillionUsGallonsPerDay. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromMillionUsGallonsPerDay(double millionusgallonsperday) -#else - public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallonsperday) -#endif - { - double value = (double) millionusgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.MillionUsGallonsPerDay); - } - - /// - /// Get VolumeFlow from NanolitersPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromNanolitersPerMinute(double nanolitersperminute) -#else - public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminute) -#endif - { - double value = (double) nanolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerMinute); - } - - /// - /// Get VolumeFlow from OilBarrelsPerDay. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromOilBarrelsPerDay(double oilbarrelsperday) -#else - public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) -#endif - { - double value = (double) oilbarrelsperday; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerDay); - } - - /// - /// Get VolumeFlow from OilBarrelsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromOilBarrelsPerHour(double oilbarrelsperhour) -#else - public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) -#endif - { - double value = (double) oilbarrelsperhour; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerHour); - } - - /// - /// Get VolumeFlow from OilBarrelsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromOilBarrelsPerMinute(double oilbarrelsperminute) -#else - public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminute) -#endif - { - double value = (double) oilbarrelsperminute; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerMinute); - } - - /// - /// Get VolumeFlow from UsGallonsPerHour. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromUsGallonsPerHour(double usgallonsperhour) -#else - public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) -#endif - { - double value = (double) usgallonsperhour; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerHour); - } - - /// - /// Get VolumeFlow from UsGallonsPerMinute. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromUsGallonsPerMinute(double usgallonsperminute) -#else - public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute) -#endif - { - double value = (double) usgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerMinute); - } - - /// - /// Get VolumeFlow from UsGallonsPerSecond. - /// - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromUsGallonsPerSecond(double usgallonspersecond) -#else - public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) -#endif - { - double value = (double) usgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// VolumeFlow unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static VolumeFlow From(double value, VolumeFlowUnit fromUnit) -#else - public static VolumeFlow From(QuantityValue value, VolumeFlowUnit fromUnit) -#endif - { - return new VolumeFlow((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VolumeFlowUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); - - return CompareTo((VolumeFlow)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(VolumeFlow other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current VolumeFlow. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(VolumeFlowUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this VolumeFlow to another VolumeFlow with the unit representation . - /// - /// A VolumeFlow with the specified unit. - public VolumeFlow ToUnit(VolumeFlowUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new VolumeFlow(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case VolumeFlowUnit.CentiliterPerMinute: return (_value/60000.00000) * 1e-2d; - case VolumeFlowUnit.CubicDecimeterPerMinute: return _value/60000.00000; - case VolumeFlowUnit.CubicFootPerHour: return _value*7.8657907199999087346816086183876e-6; - case VolumeFlowUnit.CubicFootPerMinute: return _value/2118.88000326; - case VolumeFlowUnit.CubicFootPerSecond: return _value/35.314666721; - case VolumeFlowUnit.CubicMeterPerHour: return _value/3600; - case VolumeFlowUnit.CubicMeterPerMinute: return _value/60; - case VolumeFlowUnit.CubicMeterPerSecond: return _value; - case VolumeFlowUnit.CubicYardPerHour: return _value*2.1237634944E-4; - case VolumeFlowUnit.CubicYardPerMinute: return _value*0.0127425809664; - case VolumeFlowUnit.CubicYardPerSecond: return _value*0.764554857984; - case VolumeFlowUnit.DeciliterPerMinute: return (_value/60000.00000) * 1e-1d; - case VolumeFlowUnit.KiloliterPerMinute: return (_value/60000.00000) * 1e3d; - case VolumeFlowUnit.LiterPerHour: return _value/3600000.000; - case VolumeFlowUnit.LiterPerMinute: return _value/60000.00000; - case VolumeFlowUnit.LiterPerSecond: return _value/1000; - case VolumeFlowUnit.MicroliterPerMinute: return (_value/60000.00000) * 1e-6d; - case VolumeFlowUnit.MilliliterPerMinute: return (_value/60000.00000) * 1e-3d; - case VolumeFlowUnit.MillionUsGallonsPerDay: return _value/22.824465227; - case VolumeFlowUnit.NanoliterPerMinute: return (_value/60000.00000) * 1e-9d; - case VolumeFlowUnit.OilBarrelPerDay: return _value*1.8401307283333333333333333333333e-6; - case VolumeFlowUnit.OilBarrelPerHour: return _value*4.41631375e-5; - case VolumeFlowUnit.OilBarrelPerMinute: return _value*2.64978825e-3; - case VolumeFlowUnit.UsGallonPerHour: return _value/951019.38848933424; - case VolumeFlowUnit.UsGallonPerMinute: return _value/15850.323141489; - case VolumeFlowUnit.UsGallonPerSecond: return _value/264.1720523581484; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(VolumeFlowUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case VolumeFlowUnit.CentiliterPerMinute: return (baseUnitValue*60000.00000) / 1e-2d; - case VolumeFlowUnit.CubicDecimeterPerMinute: return baseUnitValue*60000.00000; - case VolumeFlowUnit.CubicFootPerHour: return baseUnitValue/7.8657907199999087346816086183876e-6; - case VolumeFlowUnit.CubicFootPerMinute: return baseUnitValue*2118.88000326; - case VolumeFlowUnit.CubicFootPerSecond: return baseUnitValue*35.314666721; - case VolumeFlowUnit.CubicMeterPerHour: return baseUnitValue*3600; - case VolumeFlowUnit.CubicMeterPerMinute: return baseUnitValue*60; - case VolumeFlowUnit.CubicMeterPerSecond: return baseUnitValue; - case VolumeFlowUnit.CubicYardPerHour: return baseUnitValue/2.1237634944E-4; - case VolumeFlowUnit.CubicYardPerMinute: return baseUnitValue/0.0127425809664; - case VolumeFlowUnit.CubicYardPerSecond: return baseUnitValue/0.764554857984; - case VolumeFlowUnit.DeciliterPerMinute: return (baseUnitValue*60000.00000) / 1e-1d; - case VolumeFlowUnit.KiloliterPerMinute: return (baseUnitValue*60000.00000) / 1e3d; - case VolumeFlowUnit.LiterPerHour: return baseUnitValue*3600000.000; - case VolumeFlowUnit.LiterPerMinute: return baseUnitValue*60000.00000; - case VolumeFlowUnit.LiterPerSecond: return baseUnitValue*1000; - case VolumeFlowUnit.MicroliterPerMinute: return (baseUnitValue*60000.00000) / 1e-6d; - case VolumeFlowUnit.MilliliterPerMinute: return (baseUnitValue*60000.00000) / 1e-3d; - case VolumeFlowUnit.MillionUsGallonsPerDay: return baseUnitValue*22.824465227; - case VolumeFlowUnit.NanoliterPerMinute: return (baseUnitValue*60000.00000) / 1e-9d; - case VolumeFlowUnit.OilBarrelPerDay: return baseUnitValue/1.8401307283333333333333333333333e-6; - case VolumeFlowUnit.OilBarrelPerHour: return baseUnitValue/4.41631375e-5; - case VolumeFlowUnit.OilBarrelPerMinute: return baseUnitValue/2.64978825e-3; - case VolumeFlowUnit.UsGallonPerHour: return baseUnitValue*951019.38848933424; - case VolumeFlowUnit.UsGallonPerMinute: return baseUnitValue*15850.323141489; - case VolumeFlowUnit.UsGallonPerSecond: return baseUnitValue*264.1720523581484; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static VolumeFlow Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out VolumeFlow result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeFlowUnit ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out VolumeFlowUnit unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static VolumeFlow ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) - { - result = default(VolumeFlow); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static VolumeFlowUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str, provider); - - if (unit == VolumeFlowUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized VolumeFlowUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out VolumeFlowUnit unit) - { - unit = VolumeFlowUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str, provider, out unit)) - return false; - - if(unit == VolumeFlowUnit.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(VolumeFlowUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of VolumeFlow - /// - public static VolumeFlow MaxValue => new VolumeFlow(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of VolumeFlow - /// - public static VolumeFlow MinValue => new VolumeFlow(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => VolumeFlow.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; - } -} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index e79efac2f0..d7d30a6586 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -37,8 +37,10 @@ using System; using System.Globalization; +using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; +using UnitsNet.InternalHelpers; // ReSharper disable once CheckNamespace @@ -47,18 +49,25 @@ namespace UnitsNet /// /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// - // ReSharper disable once PartialTypeWithSinglePart - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components // Public structures can't have any members other than public fields, and those fields must be value types or strings. // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Information + public sealed partial class Information : IQuantity { /// /// The numeric value this quantity was constructed with. /// - public double Value => Convert.ToDouble(_value); + private readonly decimal _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly InformationUnit? _unit; + static Information() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); + } /// /// Creates the quantity with a value of 0 in the base unit Bit. /// @@ -71,28 +80,529 @@ public Information() _unit = BaseUnit; } + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Information(decimal numericValue, InformationUnit unit) + { + if(unit == InformationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = numericValue; + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Information, which is Bit. All conversions go via this value. + /// + public static InformationUnit BaseUnit => InformationUnit.Bit; + + /// + /// Represents the largest possible value of Information + /// + public static Information MaxValue => new Information(decimal.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Information + /// + public static Information MinValue => new Information(decimal.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Information; + + /// + /// All units of measurement for the Information quantity. + /// + public static InformationUnit[] Units { get; } = Enum.GetValues(typeof(InformationUnit)).Cast().Except(new InformationUnit[]{ InformationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Bit. + /// + public static Information Zero => new Information(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public InformationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Information.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Information.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Information in Bits. + /// + public double Bits => As(InformationUnit.Bit); + + /// + /// Get Information in Bytes. + /// + public double Bytes => As(InformationUnit.Byte); + + /// + /// Get Information in Exabits. + /// + public double Exabits => As(InformationUnit.Exabit); + + /// + /// Get Information in Exabytes. + /// + public double Exabytes => As(InformationUnit.Exabyte); + + /// + /// Get Information in Exbibits. + /// + public double Exbibits => As(InformationUnit.Exbibit); + + /// + /// Get Information in Exbibytes. + /// + public double Exbibytes => As(InformationUnit.Exbibyte); + + /// + /// Get Information in Gibibits. + /// + public double Gibibits => As(InformationUnit.Gibibit); + + /// + /// Get Information in Gibibytes. + /// + public double Gibibytes => As(InformationUnit.Gibibyte); + + /// + /// Get Information in Gigabits. + /// + public double Gigabits => As(InformationUnit.Gigabit); + + /// + /// Get Information in Gigabytes. + /// + public double Gigabytes => As(InformationUnit.Gigabyte); + + /// + /// Get Information in Kibibits. + /// + public double Kibibits => As(InformationUnit.Kibibit); + + /// + /// Get Information in Kibibytes. + /// + public double Kibibytes => As(InformationUnit.Kibibyte); + + /// + /// Get Information in Kilobits. + /// + public double Kilobits => As(InformationUnit.Kilobit); + + /// + /// Get Information in Kilobytes. + /// + public double Kilobytes => As(InformationUnit.Kilobyte); + + /// + /// Get Information in Mebibits. + /// + public double Mebibits => As(InformationUnit.Mebibit); + + /// + /// Get Information in Mebibytes. + /// + public double Mebibytes => As(InformationUnit.Mebibyte); + + /// + /// Get Information in Megabits. + /// + public double Megabits => As(InformationUnit.Megabit); + + /// + /// Get Information in Megabytes. + /// + public double Megabytes => As(InformationUnit.Megabyte); + + /// + /// Get Information in Pebibits. + /// + public double Pebibits => As(InformationUnit.Pebibit); + + /// + /// Get Information in Pebibytes. + /// + public double Pebibytes => As(InformationUnit.Pebibyte); + + /// + /// Get Information in Petabits. + /// + public double Petabits => As(InformationUnit.Petabit); + + /// + /// Get Information in Petabytes. + /// + public double Petabytes => As(InformationUnit.Petabyte); + + /// + /// Get Information in Tebibits. + /// + public double Tebibits => As(InformationUnit.Tebibit); + + /// + /// Get Information in Tebibytes. + /// + public double Tebibytes => As(InformationUnit.Tebibyte); + + /// + /// Get Information in Terabits. + /// + public double Terabits => As(InformationUnit.Terabit); + + /// + /// Get Information in Terabytes. + /// + public double Terabytes => As(InformationUnit.Terabyte); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(InformationUnit unit) + { + return GetAbbreviation(unit, null); + } + /// /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. public static string GetAbbreviation(InformationUnit unit, [CanBeNull] string cultureName) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } - #region Parsing + #endregion + + #region Static Factory Methods + + /// + /// Get Information from Bits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromBits(double bits) + { + decimal value = (decimal) bits; + return new Information(value, InformationUnit.Bit); + } + /// + /// Get Information from Bytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromBytes(double bytes) + { + decimal value = (decimal) bytes; + return new Information(value, InformationUnit.Byte); + } + /// + /// Get Information from Exabits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromExabits(double exabits) + { + decimal value = (decimal) exabits; + return new Information(value, InformationUnit.Exabit); + } + /// + /// Get Information from Exabytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromExabytes(double exabytes) + { + decimal value = (decimal) exabytes; + return new Information(value, InformationUnit.Exabyte); + } + /// + /// Get Information from Exbibits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromExbibits(double exbibits) + { + decimal value = (decimal) exbibits; + return new Information(value, InformationUnit.Exbibit); + } + /// + /// Get Information from Exbibytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromExbibytes(double exbibytes) + { + decimal value = (decimal) exbibytes; + return new Information(value, InformationUnit.Exbibyte); + } + /// + /// Get Information from Gibibits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromGibibits(double gibibits) + { + decimal value = (decimal) gibibits; + return new Information(value, InformationUnit.Gibibit); + } + /// + /// Get Information from Gibibytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromGibibytes(double gibibytes) + { + decimal value = (decimal) gibibytes; + return new Information(value, InformationUnit.Gibibyte); + } + /// + /// Get Information from Gigabits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromGigabits(double gigabits) + { + decimal value = (decimal) gigabits; + return new Information(value, InformationUnit.Gigabit); + } + /// + /// Get Information from Gigabytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromGigabytes(double gigabytes) + { + decimal value = (decimal) gigabytes; + return new Information(value, InformationUnit.Gigabyte); + } + /// + /// Get Information from Kibibits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromKibibits(double kibibits) + { + decimal value = (decimal) kibibits; + return new Information(value, InformationUnit.Kibibit); + } + /// + /// Get Information from Kibibytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromKibibytes(double kibibytes) + { + decimal value = (decimal) kibibytes; + return new Information(value, InformationUnit.Kibibyte); + } + /// + /// Get Information from Kilobits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromKilobits(double kilobits) + { + decimal value = (decimal) kilobits; + return new Information(value, InformationUnit.Kilobit); + } + /// + /// Get Information from Kilobytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromKilobytes(double kilobytes) + { + decimal value = (decimal) kilobytes; + return new Information(value, InformationUnit.Kilobyte); + } + /// + /// Get Information from Mebibits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromMebibits(double mebibits) + { + decimal value = (decimal) mebibits; + return new Information(value, InformationUnit.Mebibit); + } + /// + /// Get Information from Mebibytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromMebibytes(double mebibytes) + { + decimal value = (decimal) mebibytes; + return new Information(value, InformationUnit.Mebibyte); + } + /// + /// Get Information from Megabits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromMegabits(double megabits) + { + decimal value = (decimal) megabits; + return new Information(value, InformationUnit.Megabit); + } + /// + /// Get Information from Megabytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromMegabytes(double megabytes) + { + decimal value = (decimal) megabytes; + return new Information(value, InformationUnit.Megabyte); + } + /// + /// Get Information from Pebibits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromPebibits(double pebibits) + { + decimal value = (decimal) pebibits; + return new Information(value, InformationUnit.Pebibit); + } + /// + /// Get Information from Pebibytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromPebibytes(double pebibytes) + { + decimal value = (decimal) pebibytes; + return new Information(value, InformationUnit.Pebibyte); + } + /// + /// Get Information from Petabits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromPetabits(double petabits) + { + decimal value = (decimal) petabits; + return new Information(value, InformationUnit.Petabit); + } + /// + /// Get Information from Petabytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromPetabytes(double petabytes) + { + decimal value = (decimal) petabytes; + return new Information(value, InformationUnit.Petabyte); + } + /// + /// Get Information from Tebibits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromTebibits(double tebibits) + { + decimal value = (decimal) tebibits; + return new Information(value, InformationUnit.Tebibit); + } + /// + /// Get Information from Tebibytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromTebibytes(double tebibytes) + { + decimal value = (decimal) tebibytes; + return new Information(value, InformationUnit.Tebibyte); + } + /// + /// Get Information from Terabits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromTerabits(double terabits) + { + decimal value = (decimal) terabits; + return new Information(value, InformationUnit.Terabit); + } + /// + /// Get Information from Terabytes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Information FromTerabytes(double terabytes) + { + decimal value = (decimal) terabytes; + return new Information(value, InformationUnit.Terabyte); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Information unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Information From(double value, InformationUnit fromUnit) + { + return new Information((decimal)value, fromUnit); + } + + #endregion + + #region Static Parse Methods /// /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -111,13 +621,37 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] string cu /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Information Parse(string str, [CanBeNull] string cultureName) + public static Information Parse(string str) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return ParseInternal(str, null); + } + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Information Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return ParseInternal(str, provider); } @@ -125,16 +659,28 @@ public static Information Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Information result) + public static bool TryParse([CanBeNull] string str, out Information result) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return TryParseInternal(str, null, out result); + } + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Information result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return TryParseInternal(str, provider, out result); } @@ -142,84 +688,410 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static InformationUnit ParseUnit(string str) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return ParseUnitInternal(str, null); + } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return ParseUnitInternal(str, provider); } + public static bool TryParseUnit(string str, out InformationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + /// - /// Try to parse a unit string. + /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out InformationUnit unit) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return TryParseUnitInternal(str, provider, out unit); } + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) + { + result = default; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + private static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unit = UnitParser.Default.Parse(str.Trim(), provider); + + if (unit == InformationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) + { + unit = InformationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + return false; + + if(unit == InformationUnit.Undefined) + return false; + + return true; + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Information)) throw new ArgumentException("Expected type Information.", nameof(obj)); + + return CompareTo((Information)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Information other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Information within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Information other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Information. + public override int GetHashCode() + { + return new { Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(InformationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Information to another Information with the unit representation . + /// + /// A Information with the specified unit. + public Information ToUnit(InformationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Information(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private decimal AsBaseUnit() + { + switch(Unit) + { + case InformationUnit.Bit: return _value; + case InformationUnit.Byte: return _value*8m; + case InformationUnit.Exabit: return (_value) * 1e18m; + case InformationUnit.Exabyte: return (_value*8m) * 1e18m; + case InformationUnit.Exbibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Exbibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Gibibit: return (_value) * (1024m * 1024 * 1024); + case InformationUnit.Gibibyte: return (_value*8m) * (1024m * 1024 * 1024); + case InformationUnit.Gigabit: return (_value) * 1e9m; + case InformationUnit.Gigabyte: return (_value*8m) * 1e9m; + case InformationUnit.Kibibit: return (_value) * 1024m; + case InformationUnit.Kibibyte: return (_value*8m) * 1024m; + case InformationUnit.Kilobit: return (_value) * 1e3m; + case InformationUnit.Kilobyte: return (_value*8m) * 1e3m; + case InformationUnit.Mebibit: return (_value) * (1024m * 1024); + case InformationUnit.Mebibyte: return (_value*8m) * (1024m * 1024); + case InformationUnit.Megabit: return (_value) * 1e6m; + case InformationUnit.Megabyte: return (_value*8m) * 1e6m; + case InformationUnit.Pebibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Pebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Petabit: return (_value) * 1e15m; + case InformationUnit.Petabyte: return (_value*8m) * 1e15m; + case InformationUnit.Tebibit: return (_value) * (1024m * 1024 * 1024 * 1024); + case InformationUnit.Tebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024); + case InformationUnit.Terabit: return (_value) * 1e12m; + case InformationUnit.Terabyte: return (_value*8m) * 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private decimal AsBaseNumericType(InformationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case InformationUnit.Bit: return baseUnitValue; + case InformationUnit.Byte: return baseUnitValue/8m; + case InformationUnit.Exabit: return (baseUnitValue) / 1e18m; + case InformationUnit.Exabyte: return (baseUnitValue/8m) / 1e18m; + case InformationUnit.Exbibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Exbibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Gibibit: return (baseUnitValue) / (1024m * 1024 * 1024); + case InformationUnit.Gibibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024); + case InformationUnit.Gigabit: return (baseUnitValue) / 1e9m; + case InformationUnit.Gigabyte: return (baseUnitValue/8m) / 1e9m; + case InformationUnit.Kibibit: return (baseUnitValue) / 1024m; + case InformationUnit.Kibibyte: return (baseUnitValue/8m) / 1024m; + case InformationUnit.Kilobit: return (baseUnitValue) / 1e3m; + case InformationUnit.Kilobyte: return (baseUnitValue/8m) / 1e3m; + case InformationUnit.Mebibit: return (baseUnitValue) / (1024m * 1024); + case InformationUnit.Mebibyte: return (baseUnitValue/8m) / (1024m * 1024); + case InformationUnit.Megabit: return (baseUnitValue) / 1e6m; + case InformationUnit.Megabyte: return (baseUnitValue/8m) / 1e6m; + case InformationUnit.Pebibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Pebibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Petabit: return (baseUnitValue) / 1e15m; + case InformationUnit.Petabyte: return (baseUnitValue/8m) / 1e15m; + case InformationUnit.Tebibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024); + case InformationUnit.Tebibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024); + case InformationUnit.Terabit: return (baseUnitValue) / 1e12m; + case InformationUnit.Terabyte: return (baseUnitValue/8m) / 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + #endregion #region ToString Methods + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(Unit); + } + + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + public string ToString(InformationUnit unit) + { + return ToString(unit, null, 2); + } + /// /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(InformationUnit unit, [CanBeNull] string cultureName) { - return ToString(unit, cultureName, 2); + var provider = cultureName; + return ToString(unit, provider, 2); } /// /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(InformationUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) { + var provider = cultureName; double value = As(unit); string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); + return ToString(unit, provider, format); } /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(InformationUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); @@ -227,5 +1099,10 @@ public string ToString(InformationUnit unit, [CanBeNull] string cultureName, [No } #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index c4cfae8972..6b72f87fee 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -37,8 +37,10 @@ using System; using System.Globalization; +using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; +using UnitsNet.InternalHelpers; // ReSharper disable once CheckNamespace @@ -47,18 +49,25 @@ namespace UnitsNet /// /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// - // ReSharper disable once PartialTypeWithSinglePart - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components // Public structures can't have any members other than public fields, and those fields must be value types or strings. // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Length + public sealed partial class Length : IQuantity { /// /// The numeric value this quantity was constructed with. /// - public double Value => Convert.ToDouble(_value); + private readonly double _value; + /// + /// The unit this quantity was constructed with. + /// + private readonly LengthUnit? _unit; + + static Length() + { + BaseDimensions = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); + } /// /// Creates the quantity with a value of 0 in the base unit Meter. /// @@ -71,28 +80,469 @@ public Length() _unit = BaseUnit; } + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Length(double numericValue, LengthUnit unit) + { + if(unit == LengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Length, which is Meter. All conversions go via this value. + /// + public static LengthUnit BaseUnit => LengthUnit.Meter; + + /// + /// Represents the largest possible value of Length + /// + public static Length MaxValue => new Length(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Length + /// + public static Length MinValue => new Length(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Length; + + /// + /// All units of measurement for the Length quantity. + /// + public static LengthUnit[] Units { get; } = Enum.GetValues(typeof(LengthUnit)).Cast().Except(new LengthUnit[]{ LengthUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Meter. + /// + public static Length Zero => new Length(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Length.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Length.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Length in Centimeters. + /// + public double Centimeters => As(LengthUnit.Centimeter); + + /// + /// Get Length in Decimeters. + /// + public double Decimeters => As(LengthUnit.Decimeter); + + /// + /// Get Length in DtpPicas. + /// + public double DtpPicas => As(LengthUnit.DtpPica); + + /// + /// Get Length in DtpPoints. + /// + public double DtpPoints => As(LengthUnit.DtpPoint); + + /// + /// Get Length in Fathoms. + /// + public double Fathoms => As(LengthUnit.Fathom); + + /// + /// Get Length in Feet. + /// + public double Feet => As(LengthUnit.Foot); + + /// + /// Get Length in Inches. + /// + public double Inches => As(LengthUnit.Inch); + + /// + /// Get Length in Kilometers. + /// + public double Kilometers => As(LengthUnit.Kilometer); + + /// + /// Get Length in Meters. + /// + public double Meters => As(LengthUnit.Meter); + + /// + /// Get Length in Microinches. + /// + public double Microinches => As(LengthUnit.Microinch); + + /// + /// Get Length in Micrometers. + /// + public double Micrometers => As(LengthUnit.Micrometer); + + /// + /// Get Length in Mils. + /// + public double Mils => As(LengthUnit.Mil); + + /// + /// Get Length in Miles. + /// + public double Miles => As(LengthUnit.Mile); + + /// + /// Get Length in Millimeters. + /// + public double Millimeters => As(LengthUnit.Millimeter); + + /// + /// Get Length in Nanometers. + /// + public double Nanometers => As(LengthUnit.Nanometer); + + /// + /// Get Length in NauticalMiles. + /// + public double NauticalMiles => As(LengthUnit.NauticalMile); + + /// + /// Get Length in PrinterPicas. + /// + public double PrinterPicas => As(LengthUnit.PrinterPica); + + /// + /// Get Length in PrinterPoints. + /// + public double PrinterPoints => As(LengthUnit.PrinterPoint); + + /// + /// Get Length in Shackles. + /// + public double Shackles => As(LengthUnit.Shackle); + + /// + /// Get Length in Twips. + /// + public double Twips => As(LengthUnit.Twip); + + /// + /// Get Length in UsSurveyFeet. + /// + public double UsSurveyFeet => As(LengthUnit.UsSurveyFoot); + + /// + /// Get Length in Yards. + /// + public double Yards => As(LengthUnit.Yard); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LengthUnit unit) + { + return GetAbbreviation(unit, null); + } + /// /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. public static string GetAbbreviation(LengthUnit unit, [CanBeNull] string cultureName) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } - #region Parsing + #endregion + + #region Static Factory Methods + + /// + /// Get Length from Centimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromCentimeters(double centimeters) + { + double value = (double) centimeters; + return new Length(value, LengthUnit.Centimeter); + } + /// + /// Get Length from Decimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromDecimeters(double decimeters) + { + double value = (double) decimeters; + return new Length(value, LengthUnit.Decimeter); + } + /// + /// Get Length from DtpPicas. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromDtpPicas(double dtppicas) + { + double value = (double) dtppicas; + return new Length(value, LengthUnit.DtpPica); + } + /// + /// Get Length from DtpPoints. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromDtpPoints(double dtppoints) + { + double value = (double) dtppoints; + return new Length(value, LengthUnit.DtpPoint); + } + /// + /// Get Length from Fathoms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromFathoms(double fathoms) + { + double value = (double) fathoms; + return new Length(value, LengthUnit.Fathom); + } + /// + /// Get Length from Feet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromFeet(double feet) + { + double value = (double) feet; + return new Length(value, LengthUnit.Foot); + } + /// + /// Get Length from Inches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromInches(double inches) + { + double value = (double) inches; + return new Length(value, LengthUnit.Inch); + } + /// + /// Get Length from Kilometers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromKilometers(double kilometers) + { + double value = (double) kilometers; + return new Length(value, LengthUnit.Kilometer); + } + /// + /// Get Length from Meters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromMeters(double meters) + { + double value = (double) meters; + return new Length(value, LengthUnit.Meter); + } + /// + /// Get Length from Microinches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromMicroinches(double microinches) + { + double value = (double) microinches; + return new Length(value, LengthUnit.Microinch); + } + /// + /// Get Length from Micrometers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromMicrometers(double micrometers) + { + double value = (double) micrometers; + return new Length(value, LengthUnit.Micrometer); + } + /// + /// Get Length from Mils. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromMils(double mils) + { + double value = (double) mils; + return new Length(value, LengthUnit.Mil); + } + /// + /// Get Length from Miles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromMiles(double miles) + { + double value = (double) miles; + return new Length(value, LengthUnit.Mile); + } + /// + /// Get Length from Millimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromMillimeters(double millimeters) + { + double value = (double) millimeters; + return new Length(value, LengthUnit.Millimeter); + } + /// + /// Get Length from Nanometers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromNanometers(double nanometers) + { + double value = (double) nanometers; + return new Length(value, LengthUnit.Nanometer); + } + /// + /// Get Length from NauticalMiles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromNauticalMiles(double nauticalmiles) + { + double value = (double) nauticalmiles; + return new Length(value, LengthUnit.NauticalMile); + } + /// + /// Get Length from PrinterPicas. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromPrinterPicas(double printerpicas) + { + double value = (double) printerpicas; + return new Length(value, LengthUnit.PrinterPica); + } + /// + /// Get Length from PrinterPoints. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromPrinterPoints(double printerpoints) + { + double value = (double) printerpoints; + return new Length(value, LengthUnit.PrinterPoint); + } + /// + /// Get Length from Shackles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromShackles(double shackles) + { + double value = (double) shackles; + return new Length(value, LengthUnit.Shackle); + } + /// + /// Get Length from Twips. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromTwips(double twips) + { + double value = (double) twips; + return new Length(value, LengthUnit.Twip); + } + /// + /// Get Length from UsSurveyFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromUsSurveyFeet(double ussurveyfeet) + { + double value = (double) ussurveyfeet; + return new Length(value, LengthUnit.UsSurveyFoot); + } + /// + /// Get Length from Yards. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Length FromYards(double yards) + { + double value = (double) yards; + return new Length(value, LengthUnit.Yard); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Length unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Length From(double value, LengthUnit fromUnit) + { + return new Length((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods /// /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -111,13 +561,37 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] string culture /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Length Parse(string str, [CanBeNull] string cultureName) + public static Length Parse(string str) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return ParseInternal(str, null); + } + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Length Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return ParseInternal(str, provider); } @@ -125,16 +599,28 @@ public static Length Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Length result) + public static bool TryParse([CanBeNull] string str, out Length result) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return TryParseInternal(str, null, out result); + } + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Length result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return TryParseInternal(str, provider, out result); } @@ -142,84 +628,402 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LengthUnit ParseUnit(string str) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return ParseUnitInternal(str, null); + } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return ParseUnitInternal(str, provider); } + public static bool TryParseUnit(string str, out LengthUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + /// - /// Try to parse a unit string. + /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LengthUnit unit) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return TryParseUnitInternal(str, provider, out unit); } + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + private static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) + { + result = default; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unit = UnitParser.Default.Parse(str.Trim(), provider); + + if (unit == LengthUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) + { + unit = LengthUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + return false; + + if(unit == LengthUnit.Undefined) + return false; + + return true; + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Length)) throw new ArgumentException("Expected type Length.", nameof(obj)); + + return CompareTo((Length)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Length other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Length within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Length other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Length. + public override int GetHashCode() + { + return new { Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LengthUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Length to another Length with the unit representation . + /// + /// A Length with the specified unit. + public Length ToUnit(LengthUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Length(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LengthUnit.Centimeter: return (_value) * 1e-2d; + case LengthUnit.Decimeter: return (_value) * 1e-1d; + case LengthUnit.DtpPica: return _value/236.220472441; + case LengthUnit.DtpPoint: return (_value/72)*2.54e-2; + case LengthUnit.Fathom: return _value*1.8288; + case LengthUnit.Foot: return _value*0.3048; + case LengthUnit.Inch: return _value*2.54e-2; + case LengthUnit.Kilometer: return (_value) * 1e3d; + case LengthUnit.Meter: return _value; + case LengthUnit.Microinch: return _value*2.54e-8; + case LengthUnit.Micrometer: return (_value) * 1e-6d; + case LengthUnit.Mil: return _value*2.54e-5; + case LengthUnit.Mile: return _value*1609.34; + case LengthUnit.Millimeter: return (_value) * 1e-3d; + case LengthUnit.Nanometer: return (_value) * 1e-9d; + case LengthUnit.NauticalMile: return _value*1852; + case LengthUnit.PrinterPica: return _value/237.106301584; + case LengthUnit.PrinterPoint: return (_value/72.27)*2.54e-2; + case LengthUnit.Shackle: return _value*27.432; + case LengthUnit.Twip: return _value/56692.913385826; + case LengthUnit.UsSurveyFoot: return _value*1200/3937; + case LengthUnit.Yard: return _value*0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LengthUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LengthUnit.Centimeter: return (baseUnitValue) / 1e-2d; + case LengthUnit.Decimeter: return (baseUnitValue) / 1e-1d; + case LengthUnit.DtpPica: return baseUnitValue*236.220472441; + case LengthUnit.DtpPoint: return (baseUnitValue/2.54e-2)*72; + case LengthUnit.Fathom: return baseUnitValue/1.8288; + case LengthUnit.Foot: return baseUnitValue/0.3048; + case LengthUnit.Inch: return baseUnitValue/2.54e-2; + case LengthUnit.Kilometer: return (baseUnitValue) / 1e3d; + case LengthUnit.Meter: return baseUnitValue; + case LengthUnit.Microinch: return baseUnitValue/2.54e-8; + case LengthUnit.Micrometer: return (baseUnitValue) / 1e-6d; + case LengthUnit.Mil: return baseUnitValue/2.54e-5; + case LengthUnit.Mile: return baseUnitValue/1609.34; + case LengthUnit.Millimeter: return (baseUnitValue) / 1e-3d; + case LengthUnit.Nanometer: return (baseUnitValue) / 1e-9d; + case LengthUnit.NauticalMile: return baseUnitValue/1852; + case LengthUnit.PrinterPica: return baseUnitValue*237.106301584; + case LengthUnit.PrinterPoint: return (baseUnitValue/2.54e-2)*72.27; + case LengthUnit.Shackle: return baseUnitValue/27.432; + case LengthUnit.Twip: return baseUnitValue*56692.913385826; + case LengthUnit.UsSurveyFoot: return baseUnitValue*3937/1200; + case LengthUnit.Yard: return baseUnitValue/0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + #endregion #region ToString Methods + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(Unit); + } + + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + public string ToString(LengthUnit unit) + { + return ToString(unit, null, 2); + } + /// /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(LengthUnit unit, [CanBeNull] string cultureName) { - return ToString(unit, cultureName, 2); + var provider = cultureName; + return ToString(unit, provider, 2); } /// /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(LengthUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) { + var provider = cultureName; double value = As(unit); string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); + return ToString(unit, provider, format); } /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(LengthUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); @@ -227,5 +1031,10 @@ public string ToString(LengthUnit unit, [CanBeNull] string cultureName, [NotNull } #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 5f81235665..5149db52ad 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -37,8 +37,10 @@ using System; using System.Globalization; +using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; +using UnitsNet.InternalHelpers; // ReSharper disable once CheckNamespace @@ -47,18 +49,25 @@ namespace UnitsNet /// /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// - // ReSharper disable once PartialTypeWithSinglePart - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components // Public structures can't have any members other than public fields, and those fields must be value types or strings. // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class Level + public sealed partial class Level : IQuantity { /// /// The numeric value this quantity was constructed with. /// - public double Value => Convert.ToDouble(_value); + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LevelUnit? _unit; + static Level() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); + } /// /// Creates the quantity with a value of 0 in the base unit Decibel. /// @@ -71,28 +80,169 @@ public Level() _unit = BaseUnit; } + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Level(double numericValue, LevelUnit unit) + { + if(unit == LevelUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Level, which is Decibel. All conversions go via this value. + /// + public static LevelUnit BaseUnit => LevelUnit.Decibel; + + /// + /// Represents the largest possible value of Level + /// + public static Level MaxValue => new Level(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Level + /// + public static Level MinValue => new Level(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Level; + + /// + /// All units of measurement for the Level quantity. + /// + public static LevelUnit[] Units { get; } = Enum.GetValues(typeof(LevelUnit)).Cast().Except(new LevelUnit[]{ LevelUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Decibel. + /// + public static Level Zero => new Level(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Level.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Level.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Level in Decibels. + /// + public double Decibels => As(LevelUnit.Decibel); + + /// + /// Get Level in Nepers. + /// + public double Nepers => As(LevelUnit.Neper); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LevelUnit unit) + { + return GetAbbreviation(unit, null); + } + /// /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. /// Unit abbreviation string. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. public static string GetAbbreviation(LevelUnit unit, [CanBeNull] string cultureName) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } - #region Parsing + #endregion + + #region Static Factory Methods + + /// + /// Get Level from Decibels. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Level FromDecibels(double decibels) + { + double value = (double) decibels; + return new Level(value, LevelUnit.Decibel); + } + /// + /// Get Level from Nepers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Level FromNepers(double nepers) + { + double value = (double) nepers; + return new Level(value, LevelUnit.Neper); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Level unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Level From(double value, LevelUnit fromUnit) + { + return new Level((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods /// /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -111,13 +261,37 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] string cultureN /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Level Parse(string str, [CanBeNull] string cultureName) + public static Level Parse(string str) { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return ParseInternal(str, null); + } + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Level Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return ParseInternal(str, provider); } @@ -125,16 +299,28 @@ public static Level Parse(string str, [CanBeNull] string cultureName) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// Resulting unit quantity if successful. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Level result) + public static bool TryParse([CanBeNull] string str, out Level result) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return TryParseInternal(str, null, out result); + } + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Level result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return TryParseInternal(str, provider, out result); } @@ -142,84 +328,362 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) + public static LevelUnit ParseUnit(string str) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + return ParseUnitInternal(str, null); + } + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return ParseUnitInternal(str, provider); } + public static bool TryParseUnit(string str, out LevelUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + /// - /// Try to parse a unit string. + /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LevelUnit unit) { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); return TryParseUnitInternal(str, provider, out unit); } + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) + { + result = default; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unit = UnitParser.Default.Parse(str.Trim(), provider); + + if (unit == LevelUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) + { + unit = LevelUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + return false; + + if(unit == LevelUnit.Undefined) + return false; + + return true; + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Level)) throw new ArgumentException("Expected type Level.", nameof(obj)); + + return CompareTo((Level)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Level other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Level within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Level other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Level. + public override int GetHashCode() + { + return new { Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LevelUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Level to another Level with the unit representation . + /// + /// A Level with the specified unit. + public Level ToUnit(LevelUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Level(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LevelUnit.Decibel: return _value; + case LevelUnit.Neper: return (1/0.115129254)*_value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LevelUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LevelUnit.Decibel: return baseUnitValue; + case LevelUnit.Neper: return 0.115129254*baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + #endregion #region ToString Methods + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(Unit); + } + + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + public string ToString(LevelUnit unit) + { + return ToString(unit, null, 2); + } + /// /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(LevelUnit unit, [CanBeNull] string cultureName) { - return ToString(unit, cultureName, 2); + var provider = cultureName; + return ToString(unit, provider, 2); } /// /// Get string representation of value and unit. /// /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(LevelUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) { + var provider = cultureName; double value = As(unit); string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); + return ToString(unit, provider, format); } /// /// Get string representation of value and unit. /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. - [UsedImplicitly] + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. public string ToString(LevelUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); + provider = provider ?? GlobalConfiguration.DefaultCulture; double value = As(unit); object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); @@ -227,5 +691,10 @@ public string ToString(LevelUnit unit, [CanBeNull] string cultureName, [NotNull] } #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } } } diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj index 0162ca3fff..f54db87c4c 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj @@ -98,7 +98,95 @@ PackageReference - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs index 1e89b9b6ea..d4f20f0030 100644 --- a/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Acceleration.extra.cs @@ -20,6 +20,10 @@ // THE SOFTWARE. // ReSharper disable once CheckNamespace + +using System; +using UnitsNet.Units; + namespace UnitsNet { // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index bce1c207a8..c304c11ff8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -36,8 +36,11 @@ // THE SOFTWARE. using System; +using System.Globalization; +using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; +using UnitsNet.InternalHelpers; // ReSharper disable once CheckNamespace @@ -46,27 +49,754 @@ namespace UnitsNet /// /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// - // ReSharper disable once PartialTypeWithSinglePart + public partial struct Information : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly decimal _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly InformationUnit? _unit; + + static Information() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Information(decimal numericValue, InformationUnit unit) + { + if(unit == InformationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = numericValue; + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Information, which is Bit. All conversions go via this value. + /// + public static InformationUnit BaseUnit => InformationUnit.Bit; + + /// + /// Represents the largest possible value of Information + /// + public static Information MaxValue => new Information(decimal.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Information + /// + public static Information MinValue => new Information(decimal.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Information; + + /// + /// All units of measurement for the Information quantity. + /// + public static InformationUnit[] Units { get; } = Enum.GetValues(typeof(InformationUnit)).Cast().Except(new InformationUnit[]{ InformationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Bit. + /// + public static Information Zero => new Information(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public decimal Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public InformationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Information.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Information.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Information in Bits. + /// + public double Bits => As(InformationUnit.Bit); + + /// + /// Get Information in Bytes. + /// + public double Bytes => As(InformationUnit.Byte); + + /// + /// Get Information in Exabits. + /// + public double Exabits => As(InformationUnit.Exabit); + + /// + /// Get Information in Exabytes. + /// + public double Exabytes => As(InformationUnit.Exabyte); + + /// + /// Get Information in Exbibits. + /// + public double Exbibits => As(InformationUnit.Exbibit); + + /// + /// Get Information in Exbibytes. + /// + public double Exbibytes => As(InformationUnit.Exbibyte); + + /// + /// Get Information in Gibibits. + /// + public double Gibibits => As(InformationUnit.Gibibit); + + /// + /// Get Information in Gibibytes. + /// + public double Gibibytes => As(InformationUnit.Gibibyte); + + /// + /// Get Information in Gigabits. + /// + public double Gigabits => As(InformationUnit.Gigabit); + + /// + /// Get Information in Gigabytes. + /// + public double Gigabytes => As(InformationUnit.Gigabyte); + + /// + /// Get Information in Kibibits. + /// + public double Kibibits => As(InformationUnit.Kibibit); + + /// + /// Get Information in Kibibytes. + /// + public double Kibibytes => As(InformationUnit.Kibibyte); + + /// + /// Get Information in Kilobits. + /// + public double Kilobits => As(InformationUnit.Kilobit); + + /// + /// Get Information in Kilobytes. + /// + public double Kilobytes => As(InformationUnit.Kilobyte); + + /// + /// Get Information in Mebibits. + /// + public double Mebibits => As(InformationUnit.Mebibit); + + /// + /// Get Information in Mebibytes. + /// + public double Mebibytes => As(InformationUnit.Mebibyte); + + /// + /// Get Information in Megabits. + /// + public double Megabits => As(InformationUnit.Megabit); + + /// + /// Get Information in Megabytes. + /// + public double Megabytes => As(InformationUnit.Megabyte); + + /// + /// Get Information in Pebibits. + /// + public double Pebibits => As(InformationUnit.Pebibit); + + /// + /// Get Information in Pebibytes. + /// + public double Pebibytes => As(InformationUnit.Pebibyte); + + /// + /// Get Information in Petabits. + /// + public double Petabits => As(InformationUnit.Petabit); + + /// + /// Get Information in Petabytes. + /// + public double Petabytes => As(InformationUnit.Petabyte); + + /// + /// Get Information in Tebibits. + /// + public double Tebibits => As(InformationUnit.Tebibit); + + /// + /// Get Information in Tebibytes. + /// + public double Tebibytes => As(InformationUnit.Tebibyte); + + /// + /// Get Information in Terabits. + /// + public double Terabits => As(InformationUnit.Terabit); + + /// + /// Get Information in Terabytes. + /// + public double Terabytes => As(InformationUnit.Terabyte); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(InformationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Information from Bits. + /// + /// If value is NaN or Infinity. + public static Information FromBits(QuantityValue bits) + { + decimal value = (decimal) bits; + return new Information(value, InformationUnit.Bit); + } + /// + /// Get Information from Bytes. + /// + /// If value is NaN or Infinity. + public static Information FromBytes(QuantityValue bytes) + { + decimal value = (decimal) bytes; + return new Information(value, InformationUnit.Byte); + } + /// + /// Get Information from Exabits. + /// + /// If value is NaN or Infinity. + public static Information FromExabits(QuantityValue exabits) + { + decimal value = (decimal) exabits; + return new Information(value, InformationUnit.Exabit); + } + /// + /// Get Information from Exabytes. + /// + /// If value is NaN or Infinity. + public static Information FromExabytes(QuantityValue exabytes) + { + decimal value = (decimal) exabytes; + return new Information(value, InformationUnit.Exabyte); + } + /// + /// Get Information from Exbibits. + /// + /// If value is NaN or Infinity. + public static Information FromExbibits(QuantityValue exbibits) + { + decimal value = (decimal) exbibits; + return new Information(value, InformationUnit.Exbibit); + } + /// + /// Get Information from Exbibytes. + /// + /// If value is NaN or Infinity. + public static Information FromExbibytes(QuantityValue exbibytes) + { + decimal value = (decimal) exbibytes; + return new Information(value, InformationUnit.Exbibyte); + } + /// + /// Get Information from Gibibits. + /// + /// If value is NaN or Infinity. + public static Information FromGibibits(QuantityValue gibibits) + { + decimal value = (decimal) gibibits; + return new Information(value, InformationUnit.Gibibit); + } + /// + /// Get Information from Gibibytes. + /// + /// If value is NaN or Infinity. + public static Information FromGibibytes(QuantityValue gibibytes) + { + decimal value = (decimal) gibibytes; + return new Information(value, InformationUnit.Gibibyte); + } + /// + /// Get Information from Gigabits. + /// + /// If value is NaN or Infinity. + public static Information FromGigabits(QuantityValue gigabits) + { + decimal value = (decimal) gigabits; + return new Information(value, InformationUnit.Gigabit); + } + /// + /// Get Information from Gigabytes. + /// + /// If value is NaN or Infinity. + public static Information FromGigabytes(QuantityValue gigabytes) + { + decimal value = (decimal) gigabytes; + return new Information(value, InformationUnit.Gigabyte); + } + /// + /// Get Information from Kibibits. + /// + /// If value is NaN or Infinity. + public static Information FromKibibits(QuantityValue kibibits) + { + decimal value = (decimal) kibibits; + return new Information(value, InformationUnit.Kibibit); + } + /// + /// Get Information from Kibibytes. + /// + /// If value is NaN or Infinity. + public static Information FromKibibytes(QuantityValue kibibytes) + { + decimal value = (decimal) kibibytes; + return new Information(value, InformationUnit.Kibibyte); + } + /// + /// Get Information from Kilobits. + /// + /// If value is NaN or Infinity. + public static Information FromKilobits(QuantityValue kilobits) + { + decimal value = (decimal) kilobits; + return new Information(value, InformationUnit.Kilobit); + } + /// + /// Get Information from Kilobytes. + /// + /// If value is NaN or Infinity. + public static Information FromKilobytes(QuantityValue kilobytes) + { + decimal value = (decimal) kilobytes; + return new Information(value, InformationUnit.Kilobyte); + } + /// + /// Get Information from Mebibits. + /// + /// If value is NaN or Infinity. + public static Information FromMebibits(QuantityValue mebibits) + { + decimal value = (decimal) mebibits; + return new Information(value, InformationUnit.Mebibit); + } + /// + /// Get Information from Mebibytes. + /// + /// If value is NaN or Infinity. + public static Information FromMebibytes(QuantityValue mebibytes) + { + decimal value = (decimal) mebibytes; + return new Information(value, InformationUnit.Mebibyte); + } + /// + /// Get Information from Megabits. + /// + /// If value is NaN or Infinity. + public static Information FromMegabits(QuantityValue megabits) + { + decimal value = (decimal) megabits; + return new Information(value, InformationUnit.Megabit); + } + /// + /// Get Information from Megabytes. + /// + /// If value is NaN or Infinity. + public static Information FromMegabytes(QuantityValue megabytes) + { + decimal value = (decimal) megabytes; + return new Information(value, InformationUnit.Megabyte); + } + /// + /// Get Information from Pebibits. + /// + /// If value is NaN or Infinity. + public static Information FromPebibits(QuantityValue pebibits) + { + decimal value = (decimal) pebibits; + return new Information(value, InformationUnit.Pebibit); + } + /// + /// Get Information from Pebibytes. + /// + /// If value is NaN or Infinity. + public static Information FromPebibytes(QuantityValue pebibytes) + { + decimal value = (decimal) pebibytes; + return new Information(value, InformationUnit.Pebibyte); + } + /// + /// Get Information from Petabits. + /// + /// If value is NaN or Infinity. + public static Information FromPetabits(QuantityValue petabits) + { + decimal value = (decimal) petabits; + return new Information(value, InformationUnit.Petabit); + } + /// + /// Get Information from Petabytes. + /// + /// If value is NaN or Infinity. + public static Information FromPetabytes(QuantityValue petabytes) + { + decimal value = (decimal) petabytes; + return new Information(value, InformationUnit.Petabyte); + } + /// + /// Get Information from Tebibits. + /// + /// If value is NaN or Infinity. + public static Information FromTebibits(QuantityValue tebibits) + { + decimal value = (decimal) tebibits; + return new Information(value, InformationUnit.Tebibit); + } + /// + /// Get Information from Tebibytes. + /// + /// If value is NaN or Infinity. + public static Information FromTebibytes(QuantityValue tebibytes) + { + decimal value = (decimal) tebibytes; + return new Information(value, InformationUnit.Tebibyte); + } + /// + /// Get Information from Terabits. + /// + /// If value is NaN or Infinity. + public static Information FromTerabits(QuantityValue terabits) + { + decimal value = (decimal) terabits; + return new Information(value, InformationUnit.Terabit); + } + /// + /// Get Information from Terabytes. + /// + /// If value is NaN or Infinity. + public static Information FromTerabytes(QuantityValue terabytes) + { + decimal value = (decimal) terabytes; + return new Information(value, InformationUnit.Terabyte); + } + + /// + /// 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 new Information((decimal)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Information Parse(string str) + { + return ParseInternal(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Information Parse(string str, [CanBeNull] IFormatProvider provider) + { + return ParseInternal(str, provider); + } - public partial struct Information : IQuantity, IComparable, IComparable - { /// - /// The numeric value this quantity was constructed with. + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// - public decimal Value => _value; + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Information result) + { + return TryParseInternal(str, null, out result); + } /// - /// Get unit abbreviation string. + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatProvider provider) + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + return TryParseInternal(str, provider, out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static InformationUnit ParseUnit(string str) + { + return ParseUnitInternal(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static InformationUnit ParseUnit(string str, IFormatProvider provider = null) + { + return ParseUnitInternal(str, provider); + } + + public static bool TryParseUnit(string str, out InformationUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out InformationUnit unit) + { + return TryParseUnitInternal(str, provider, out unit); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) + { + result = default; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + private static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unit = UnitParser.Default.Parse(str.Trim(), provider); + + if (unit == InformationUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) + { + unit = InformationUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + return false; + + if(unit == InformationUnit.Undefined) + return false; + + return true; } + #endregion + #region Arithmetic Operators public static Information operator -(Information right) @@ -106,6 +836,8 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr #endregion + #region Equality / IComparable + public static bool operator <=(Information left, Information right) { return left.Value <= right.AsBaseNumericType(left.Unit); @@ -126,91 +858,216 @@ public static string GetAbbreviation(InformationUnit unit, [CanBeNull] IFormatPr return left.Value > right.AsBaseNumericType(left.Unit); } - #region Parsing + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Information)) throw new ArgumentException("Expected type Information.", nameof(obj)); + + return CompareTo((Information)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Information other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// Compare equality to another Information within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static Information Parse(string str, [CanBeNull] IFormatProvider provider) + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Information other, double tolerance, ComparisonType comparisonType) { - return ParseInternal(str, provider); + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); } /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// Returns the hash code for this instance. /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) + /// A hash code for the current Information. + public override int GetHashCode() { - return TryParseInternal(str, provider, out result); + return new { Value, Unit }.GetHashCode(); } + #endregion + + #region Conversion Methods + /// - /// Parse a unit string. + /// Convert to the unit representation . /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static InformationUnit ParseUnit(string str, IFormatProvider provider = null) + /// Value converted to the specified unit. + public double As(InformationUnit unit) { - return ParseUnitInternal(str, provider); + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); } /// - /// Parse a unit string. + /// Converts this Information to another Information with the unit representation . /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, IFormatProvider provider, out InformationUnit unit) + /// A Information with the specified unit. + public Information ToUnit(InformationUnit unit) { - return TryParseUnitInternal(str, provider, out unit); + var convertedValue = AsBaseNumericType(unit); + return new Information(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private decimal AsBaseUnit() + { + switch(Unit) + { + case InformationUnit.Bit: return _value; + case InformationUnit.Byte: return _value*8m; + case InformationUnit.Exabit: return (_value) * 1e18m; + case InformationUnit.Exabyte: return (_value*8m) * 1e18m; + case InformationUnit.Exbibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Exbibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Gibibit: return (_value) * (1024m * 1024 * 1024); + case InformationUnit.Gibibyte: return (_value*8m) * (1024m * 1024 * 1024); + case InformationUnit.Gigabit: return (_value) * 1e9m; + case InformationUnit.Gigabyte: return (_value*8m) * 1e9m; + case InformationUnit.Kibibit: return (_value) * 1024m; + case InformationUnit.Kibibyte: return (_value*8m) * 1024m; + case InformationUnit.Kilobit: return (_value) * 1e3m; + case InformationUnit.Kilobyte: return (_value*8m) * 1e3m; + case InformationUnit.Mebibit: return (_value) * (1024m * 1024); + case InformationUnit.Mebibyte: return (_value*8m) * (1024m * 1024); + case InformationUnit.Megabit: return (_value) * 1e6m; + case InformationUnit.Megabyte: return (_value*8m) * 1e6m; + case InformationUnit.Pebibit: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Pebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Petabit: return (_value) * 1e15m; + case InformationUnit.Petabyte: return (_value*8m) * 1e15m; + case InformationUnit.Tebibit: return (_value) * (1024m * 1024 * 1024 * 1024); + case InformationUnit.Tebibyte: return (_value*8m) * (1024m * 1024 * 1024 * 1024); + case InformationUnit.Terabit: return (_value) * 1e12m; + case InformationUnit.Terabyte: return (_value*8m) * 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private decimal AsBaseNumericType(InformationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case InformationUnit.Bit: return baseUnitValue; + case InformationUnit.Byte: return baseUnitValue/8m; + case InformationUnit.Exabit: return (baseUnitValue) / 1e18m; + case InformationUnit.Exabyte: return (baseUnitValue/8m) / 1e18m; + case InformationUnit.Exbibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Exbibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Gibibit: return (baseUnitValue) / (1024m * 1024 * 1024); + case InformationUnit.Gibibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024); + case InformationUnit.Gigabit: return (baseUnitValue) / 1e9m; + case InformationUnit.Gigabyte: return (baseUnitValue/8m) / 1e9m; + case InformationUnit.Kibibit: return (baseUnitValue) / 1024m; + case InformationUnit.Kibibyte: return (baseUnitValue/8m) / 1024m; + case InformationUnit.Kilobit: return (baseUnitValue) / 1e3m; + case InformationUnit.Kilobyte: return (baseUnitValue/8m) / 1e3m; + case InformationUnit.Mebibit: return (baseUnitValue) / (1024m * 1024); + case InformationUnit.Mebibyte: return (baseUnitValue/8m) / (1024m * 1024); + case InformationUnit.Megabit: return (baseUnitValue) / 1e6m; + case InformationUnit.Megabyte: return (baseUnitValue/8m) / 1e6m; + case InformationUnit.Pebibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Pebibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024); + case InformationUnit.Petabit: return (baseUnitValue) / 1e15m; + case InformationUnit.Petabyte: return (baseUnitValue/8m) / 1e15m; + case InformationUnit.Tebibit: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024); + case InformationUnit.Tebibyte: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024); + case InformationUnit.Terabit: return (baseUnitValue) / 1e12m; + case InformationUnit.Terabyte: return (baseUnitValue/8m) / 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } } #endregion #region ToString Methods + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(Unit); + } + + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + public string ToString(InformationUnit unit) + { + return ToString(unit, null, 2); + } + /// /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider) { return ToString(unit, provider, 2); @@ -220,10 +1077,9 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. - [UsedImplicitly] + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) { double value = As(unit); @@ -234,12 +1090,11 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. - [UsedImplicitly] + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) { if (format == null) throw new ArgumentNullException(nameof(format)); @@ -253,5 +1108,6 @@ public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provide } #endregion + } } diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 02136fc7f6..1dc73d885a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -36,8 +36,11 @@ // THE SOFTWARE. using System; +using System.Globalization; +using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; +using UnitsNet.InternalHelpers; // ReSharper disable once CheckNamespace @@ -46,93 +49,488 @@ namespace UnitsNet /// /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// - // ReSharper disable once PartialTypeWithSinglePart - public partial struct Length : IQuantity, IComparable, IComparable { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LengthUnit? _unit; + + static Length() + { + BaseDimensions = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Length(double numericValue, LengthUnit unit) + { + if(unit == LengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Length, which is Meter. All conversions go via this value. + /// + public static LengthUnit BaseUnit => LengthUnit.Meter; + + /// + /// Represents the largest possible value of Length + /// + public static Length MaxValue => new Length(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Length + /// + public static Length MinValue => new Length(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Length; + + /// + /// All units of measurement for the Length quantity. + /// + public static LengthUnit[] Units { get; } = Enum.GetValues(typeof(LengthUnit)).Cast().Except(new LengthUnit[]{ LengthUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Meter. + /// + public static Length Zero => new Length(0, BaseUnit); + + #endregion + + #region Properties + /// /// The numeric value this quantity was constructed with. /// public double Value => _value; + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Length.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Length.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Length in Centimeters. + /// + public double Centimeters => As(LengthUnit.Centimeter); + + /// + /// Get Length in Decimeters. + /// + public double Decimeters => As(LengthUnit.Decimeter); + + /// + /// Get Length in DtpPicas. + /// + public double DtpPicas => As(LengthUnit.DtpPica); + + /// + /// Get Length in DtpPoints. + /// + public double DtpPoints => As(LengthUnit.DtpPoint); + + /// + /// Get Length in Fathoms. + /// + public double Fathoms => As(LengthUnit.Fathom); + + /// + /// Get Length in Feet. + /// + public double Feet => As(LengthUnit.Foot); + + /// + /// Get Length in Inches. + /// + public double Inches => As(LengthUnit.Inch); + + /// + /// Get Length in Kilometers. + /// + public double Kilometers => As(LengthUnit.Kilometer); + + /// + /// Get Length in Meters. + /// + public double Meters => As(LengthUnit.Meter); + + /// + /// Get Length in Microinches. + /// + public double Microinches => As(LengthUnit.Microinch); + + /// + /// Get Length in Micrometers. + /// + public double Micrometers => As(LengthUnit.Micrometer); + + /// + /// Get Length in Mils. + /// + public double Mils => As(LengthUnit.Mil); + + /// + /// Get Length in Miles. + /// + public double Miles => As(LengthUnit.Mile); + + /// + /// Get Length in Millimeters. + /// + public double Millimeters => As(LengthUnit.Millimeter); + + /// + /// Get Length in Nanometers. + /// + public double Nanometers => As(LengthUnit.Nanometer); + + /// + /// Get Length in NauticalMiles. + /// + public double NauticalMiles => As(LengthUnit.NauticalMile); + + /// + /// Get Length in PrinterPicas. + /// + public double PrinterPicas => As(LengthUnit.PrinterPica); + + /// + /// Get Length in PrinterPoints. + /// + public double PrinterPoints => As(LengthUnit.PrinterPoint); + + /// + /// Get Length in Shackles. + /// + public double Shackles => As(LengthUnit.Shackle); + + /// + /// Get Length in Twips. + /// + public double Twips => As(LengthUnit.Twip); + + /// + /// Get Length in UsSurveyFeet. + /// + public double UsSurveyFeet => As(LengthUnit.UsSurveyFoot); + + /// + /// Get Length in Yards. + /// + public double Yards => As(LengthUnit.Yard); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LengthUnit unit) + { + return GetAbbreviation(unit, null); + } + /// /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. - [UsedImplicitly] + /// Format to use for localization. Defaults to if null. public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvider provider) { return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } - #region Arithmetic Operators + #endregion - public static Length operator -(Length right) + #region Static Factory Methods + + /// + /// Get Length from Centimeters. + /// + /// If value is NaN or Infinity. + public static Length FromCentimeters(QuantityValue centimeters) { - return new Length(-right.Value, right.Unit); + double value = (double) centimeters; + return new Length(value, LengthUnit.Centimeter); } - - public static Length operator +(Length left, Length right) + /// + /// Get Length from Decimeters. + /// + /// If value is NaN or Infinity. + public static Length FromDecimeters(QuantityValue decimeters) { - return new Length(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + double value = (double) decimeters; + return new Length(value, LengthUnit.Decimeter); } - - public static Length operator -(Length left, Length right) + /// + /// Get Length from DtpPicas. + /// + /// If value is NaN or Infinity. + public static Length FromDtpPicas(QuantityValue dtppicas) { - return new Length(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + double value = (double) dtppicas; + return new Length(value, LengthUnit.DtpPica); } - - public static Length operator *(double left, Length right) + /// + /// Get Length from DtpPoints. + /// + /// If value is NaN or Infinity. + public static Length FromDtpPoints(QuantityValue dtppoints) { - return new Length(left * right.Value, right.Unit); + double value = (double) dtppoints; + return new Length(value, LengthUnit.DtpPoint); } - - public static Length operator *(Length left, double right) + /// + /// Get Length from Fathoms. + /// + /// If value is NaN or Infinity. + public static Length FromFathoms(QuantityValue fathoms) { - return new Length(left.Value * right, left.Unit); + double value = (double) fathoms; + return new Length(value, LengthUnit.Fathom); } - - public static Length operator /(Length left, double right) + /// + /// Get Length from Feet. + /// + /// If value is NaN or Infinity. + public static Length FromFeet(QuantityValue feet) { - return new Length(left.Value / right, left.Unit); + double value = (double) feet; + return new Length(value, LengthUnit.Foot); } - - public static double operator /(Length left, Length right) + /// + /// Get Length from Inches. + /// + /// If value is NaN or Infinity. + public static Length FromInches(QuantityValue inches) { - return left.Meters / right.Meters; + double value = (double) inches; + return new Length(value, LengthUnit.Inch); } - - #endregion - - public static bool operator <=(Length left, Length right) + /// + /// Get Length from Kilometers. + /// + /// If value is NaN or Infinity. + public static Length FromKilometers(QuantityValue kilometers) { - return left.Value <= right.AsBaseNumericType(left.Unit); + double value = (double) kilometers; + return new Length(value, LengthUnit.Kilometer); } - - public static bool operator >=(Length left, Length right) + /// + /// Get Length from Meters. + /// + /// If value is NaN or Infinity. + public static Length FromMeters(QuantityValue meters) { - return left.Value >= right.AsBaseNumericType(left.Unit); + double value = (double) meters; + return new Length(value, LengthUnit.Meter); } - - public static bool operator <(Length left, Length right) + /// + /// Get Length from Microinches. + /// + /// If value is NaN or Infinity. + public static Length FromMicroinches(QuantityValue microinches) { - return left.Value < right.AsBaseNumericType(left.Unit); + double value = (double) microinches; + return new Length(value, LengthUnit.Microinch); + } + /// + /// Get Length from Micrometers. + /// + /// If value is NaN or Infinity. + public static Length FromMicrometers(QuantityValue micrometers) + { + double value = (double) micrometers; + return new Length(value, LengthUnit.Micrometer); + } + /// + /// Get Length from Mils. + /// + /// If value is NaN or Infinity. + public static Length FromMils(QuantityValue mils) + { + double value = (double) mils; + return new Length(value, LengthUnit.Mil); + } + /// + /// Get Length from Miles. + /// + /// If value is NaN or Infinity. + public static Length FromMiles(QuantityValue miles) + { + double value = (double) miles; + return new Length(value, LengthUnit.Mile); + } + /// + /// Get Length from Millimeters. + /// + /// If value is NaN or Infinity. + public static Length FromMillimeters(QuantityValue millimeters) + { + double value = (double) millimeters; + return new Length(value, LengthUnit.Millimeter); + } + /// + /// Get Length from Nanometers. + /// + /// If value is NaN or Infinity. + public static Length FromNanometers(QuantityValue nanometers) + { + double value = (double) nanometers; + return new Length(value, LengthUnit.Nanometer); + } + /// + /// Get Length from NauticalMiles. + /// + /// If value is NaN or Infinity. + public static Length FromNauticalMiles(QuantityValue nauticalmiles) + { + double value = (double) nauticalmiles; + return new Length(value, LengthUnit.NauticalMile); + } + /// + /// Get Length from PrinterPicas. + /// + /// If value is NaN or Infinity. + public static Length FromPrinterPicas(QuantityValue printerpicas) + { + double value = (double) printerpicas; + return new Length(value, LengthUnit.PrinterPica); + } + /// + /// Get Length from PrinterPoints. + /// + /// If value is NaN or Infinity. + public static Length FromPrinterPoints(QuantityValue printerpoints) + { + double value = (double) printerpoints; + return new Length(value, LengthUnit.PrinterPoint); + } + /// + /// Get Length from Shackles. + /// + /// If value is NaN or Infinity. + public static Length FromShackles(QuantityValue shackles) + { + double value = (double) shackles; + return new Length(value, LengthUnit.Shackle); + } + /// + /// Get Length from Twips. + /// + /// If value is NaN or Infinity. + public static Length FromTwips(QuantityValue twips) + { + double value = (double) twips; + return new Length(value, LengthUnit.Twip); + } + /// + /// Get Length from UsSurveyFeet. + /// + /// If value is NaN or Infinity. + public static Length FromUsSurveyFeet(QuantityValue ussurveyfeet) + { + double value = (double) ussurveyfeet; + return new Length(value, LengthUnit.UsSurveyFoot); + } + /// + /// Get Length from Yards. + /// + /// If value is NaN or Infinity. + public static Length FromYards(QuantityValue yards) + { + double value = (double) yards; + return new Length(value, LengthUnit.Yard); } - public static bool operator >(Length left, Length right) + /// + /// 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 left.Value > right.AsBaseNumericType(left.Unit); + return new Length((double)value, fromUnit); } - #region Parsing + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Length Parse(string str) + { + return ParseInternal(str, null); + } /// /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -151,6 +549,7 @@ public static string GetAbbreviation(LengthUnit unit, [CanBeNull] IFormatProvide /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// + /// Format to use when parsing number and unit. Defaults to if null. public static Length Parse(string str, [CanBeNull] IFormatProvider provider) { return ParseInternal(str, provider); @@ -160,12 +559,25 @@ public static Length Parse(string str, [CanBeNull] IFormatProvider provider) /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Length result) + { + return TryParseInternal(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// + /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) { return TryParseInternal(str, provider, out result); @@ -175,42 +587,423 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. + public static LengthUnit ParseUnit(string str) + { + return ParseUnitInternal(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. public static LengthUnit ParseUnit(string str, IFormatProvider provider = null) { return ParseUnitInternal(str, provider); } + public static bool TryParseUnit(string str, out LengthUnit unit) + { + return TryParseUnitInternal(str, null, out unit); + } + /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. /// The parsed unit if successful. /// True if successful, otherwise false. /// /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// + /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, IFormatProvider provider, out LengthUnit unit) { return TryParseUnitInternal(str, provider, out unit); } + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + private static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) + { + result = default; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) + { + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unit = UnitParser.Default.Parse(str.Trim(), provider); + + if (unit == LengthUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) + { + unit = LengthUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + return false; + + if(unit == LengthUnit.Undefined) + return false; + + return true; + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Length)) throw new ArgumentException("Expected type Length.", nameof(obj)); + + return CompareTo((Length)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Length other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Length within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Length other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Length. + public override int GetHashCode() + { + return new { Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LengthUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Length to another Length with the unit representation . + /// + /// A Length with the specified unit. + public Length ToUnit(LengthUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Length(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LengthUnit.Centimeter: return (_value) * 1e-2d; + case LengthUnit.Decimeter: return (_value) * 1e-1d; + case LengthUnit.DtpPica: return _value/236.220472441; + case LengthUnit.DtpPoint: return (_value/72)*2.54e-2; + case LengthUnit.Fathom: return _value*1.8288; + case LengthUnit.Foot: return _value*0.3048; + case LengthUnit.Inch: return _value*2.54e-2; + case LengthUnit.Kilometer: return (_value) * 1e3d; + case LengthUnit.Meter: return _value; + case LengthUnit.Microinch: return _value*2.54e-8; + case LengthUnit.Micrometer: return (_value) * 1e-6d; + case LengthUnit.Mil: return _value*2.54e-5; + case LengthUnit.Mile: return _value*1609.34; + case LengthUnit.Millimeter: return (_value) * 1e-3d; + case LengthUnit.Nanometer: return (_value) * 1e-9d; + case LengthUnit.NauticalMile: return _value*1852; + case LengthUnit.PrinterPica: return _value/237.106301584; + case LengthUnit.PrinterPoint: return (_value/72.27)*2.54e-2; + case LengthUnit.Shackle: return _value*27.432; + case LengthUnit.Twip: return _value/56692.913385826; + case LengthUnit.UsSurveyFoot: return _value*1200/3937; + case LengthUnit.Yard: return _value*0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LengthUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LengthUnit.Centimeter: return (baseUnitValue) / 1e-2d; + case LengthUnit.Decimeter: return (baseUnitValue) / 1e-1d; + case LengthUnit.DtpPica: return baseUnitValue*236.220472441; + case LengthUnit.DtpPoint: return (baseUnitValue/2.54e-2)*72; + case LengthUnit.Fathom: return baseUnitValue/1.8288; + case LengthUnit.Foot: return baseUnitValue/0.3048; + case LengthUnit.Inch: return baseUnitValue/2.54e-2; + case LengthUnit.Kilometer: return (baseUnitValue) / 1e3d; + case LengthUnit.Meter: return baseUnitValue; + case LengthUnit.Microinch: return baseUnitValue/2.54e-8; + case LengthUnit.Micrometer: return (baseUnitValue) / 1e-6d; + case LengthUnit.Mil: return baseUnitValue/2.54e-5; + case LengthUnit.Mile: return baseUnitValue/1609.34; + case LengthUnit.Millimeter: return (baseUnitValue) / 1e-3d; + case LengthUnit.Nanometer: return (baseUnitValue) / 1e-9d; + case LengthUnit.NauticalMile: return baseUnitValue/1852; + case LengthUnit.PrinterPica: return baseUnitValue*237.106301584; + case LengthUnit.PrinterPoint: return (baseUnitValue/2.54e-2)*72.27; + case LengthUnit.Shackle: return baseUnitValue/27.432; + case LengthUnit.Twip: return baseUnitValue*56692.913385826; + case LengthUnit.UsSurveyFoot: return baseUnitValue*3937/1200; + case LengthUnit.Yard: return baseUnitValue/0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + #endregion #region ToString Methods + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(Unit); + } + + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + public string ToString(LengthUnit unit) + { + return ToString(unit, null, 2); + } + /// /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider) { return ToString(unit, provider, 2); @@ -220,10 +1013,9 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. - [UsedImplicitly] + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) { double value = As(unit); @@ -234,12 +1026,11 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, in /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. - [UsedImplicitly] + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) { if (format == null) throw new ArgumentNullException(nameof(format)); @@ -253,5 +1044,6 @@ public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, [N } #endregion + } } diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 92fb22feab..0029fb65aa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -36,8 +36,11 @@ // THE SOFTWARE. using System; +using System.Globalization; +using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; +using UnitsNet.InternalHelpers; // ReSharper disable once CheckNamespace @@ -46,101 +49,314 @@ namespace UnitsNet /// /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// - // ReSharper disable once PartialTypeWithSinglePart - public partial struct Level : IQuantity, IComparable, IComparable { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LevelUnit? _unit; + + static Level() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Level(double numericValue, LevelUnit unit) + { + if(unit == LevelUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Level, which is Decibel. All conversions go via this value. + /// + public static LevelUnit BaseUnit => LevelUnit.Decibel; + + /// + /// Represents the largest possible value of Level + /// + public static Level MaxValue => new Level(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Level + /// + public static Level MinValue => new Level(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Level; + + /// + /// All units of measurement for the Level quantity. + /// + public static LevelUnit[] Units { get; } = Enum.GetValues(typeof(LevelUnit)).Cast().Except(new LevelUnit[]{ LevelUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Decibel. + /// + public static Level Zero => new Level(0, BaseUnit); + + #endregion + + #region Properties + /// /// The numeric value this quantity was constructed with. /// public double Value => _value; + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Level.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Level.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Level in Decibels. + /// + public double Decibels => As(LevelUnit.Decibel); + + /// + /// Get Level in Nepers. + /// + public double Nepers => As(LevelUnit.Neper); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LevelUnit unit) + { + return GetAbbreviation(unit, null); + } + /// /// Get unit abbreviation string. /// /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. /// Unit abbreviation string. - [UsedImplicitly] + /// Format to use for localization. Defaults to if null. public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider provider) { return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } - #region Logarithmic Arithmetic Operators + #endregion - public static Level operator -(Level right) + #region Static Factory Methods + + /// + /// Get Level from Decibels. + /// + /// If value is NaN or Infinity. + public static Level FromDecibels(QuantityValue decibels) { - return new Level(-right.Value, right.Unit); + double value = (double) decibels; + return new Level(value, LevelUnit.Decibel); } - - public static Level operator +(Level left, Level right) + /// + /// Get Level from Nepers. + /// + /// If value is NaN or Infinity. + public static Level FromNepers(QuantityValue nepers) { - // 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); + double value = (double) nepers; + return new Level(value, LevelUnit.Neper); } - public static Level operator -(Level left, Level right) + /// + /// 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) { - // 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); + return new Level((double)value, fromUnit); } - public static Level operator *(double left, Level right) + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Level Parse(string str) { - // Logarithmic multiplication = addition - return new Level(left + right.Value, right.Unit); + return ParseInternal(str, null); } - public static Level operator *(Level left, double right) + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Level Parse(string str, [CanBeNull] IFormatProvider provider) { - // Logarithmic multiplication = addition - return new Level(left.Value + (double)right, left.Unit); + return ParseInternal(str, provider); } - public static Level operator /(Level left, double right) + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Level result) { - // Logarithmic division = subtraction - return new Level(left.Value - (double)right, left.Unit); + return TryParseInternal(str, null, out result); } - public static double operator /(Level left, Level right) + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) { - // Logarithmic division = subtraction - return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); + return TryParseInternal(str, provider, out result); } - #endregion - - public static bool operator <=(Level left, Level right) + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LevelUnit ParseUnit(string str) { - return left.Value <= right.AsBaseNumericType(left.Unit); + return ParseUnitInternal(str, null); } - public static bool operator >=(Level left, Level right) + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static LevelUnit ParseUnit(string str, IFormatProvider provider = null) { - return left.Value >= right.AsBaseNumericType(left.Unit); + return ParseUnitInternal(str, provider); } - public static bool operator <(Level left, Level right) + public static bool TryParseUnit(string str, out LevelUnit unit) { - return left.Value < right.AsBaseNumericType(left.Unit); + return TryParseUnitInternal(str, null, out unit); } - public static bool operator >(Level left, Level right) + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out LevelUnit unit) { - return left.Value > right.AsBaseNumericType(left.Unit); + return TryParseUnitInternal(str, provider, out unit); } - #region Parsing - /// /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -159,66 +375,323 @@ public static string GetAbbreviation(LevelUnit unit, [CanBeNull] IFormatProvider /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static Level Parse(string str, [CanBeNull] IFormatProvider provider) + private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) { - return ParseInternal(str, provider); + if (str == null) throw new ArgumentNullException(nameof(str)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); } /// /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. + /// Format to use when parsing number and unit. Defaults to . /// Resulting unit quantity if successful. /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) { - return TryParseInternal(str, provider, out result); + result = default; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. + /// Format to use when parsing number and unit. Defaults to . /// /// Length.ParseUnit("m", new CultureInfo("en-US")); /// /// The value of 'str' cannot be null. /// Error parsing string. - public static LevelUnit ParseUnit(string str, IFormatProvider provider = null) + private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) { - return ParseUnitInternal(str, provider); + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unit = UnitParser.Default.Parse(str.Trim(), provider); + + if (unit == LevelUnit.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; } /// /// Parse a unit string. /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. + /// Format to use when parsing number and unit. Defaults to . /// The parsed unit if successful. /// True if successful, otherwise false. /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// Length.ParseUnit("m", new CultureInfo("en-US")); /// - public static bool TryParseUnit(string str, IFormatProvider provider, out LevelUnit unit) + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) { - return TryParseUnitInternal(str, provider, out unit); + unit = LevelUnit.Undefined; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) + return false; + + if(unit == LevelUnit.Undefined) + return false; + + return true; + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Level)) throw new ArgumentException("Expected type Level.", nameof(obj)); + + return CompareTo((Level)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Level other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Level within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Level other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Level. + public override int GetHashCode() + { + return new { Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LevelUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Level to another Level with the unit representation . + /// + /// A Level with the specified unit. + public Level ToUnit(LevelUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Level(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LevelUnit.Decibel: return _value; + case LevelUnit.Neper: return (1/0.115129254)*_value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LevelUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LevelUnit.Decibel: return baseUnitValue; + case LevelUnit.Neper: return 0.115129254*baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } } #endregion #region ToString Methods + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(Unit); + } + + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + public string ToString(LevelUnit unit) + { + return ToString(unit, null, 2); + } + /// /// Get string representation of value and unit. Using two significant digits after radix. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider) { return ToString(unit, provider, 2); @@ -228,10 +701,9 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider) /// Get string representation of value and unit. /// /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. /// The number of significant digits after the radix point. /// String representation. - [UsedImplicitly] + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) { double value = As(unit); @@ -242,12 +714,11 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, int /// /// Get string representation of value and unit. /// - /// Format to use for localization and number formatting. Defaults to if null. /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. - [UsedImplicitly] + /// Format to use for localization and number formatting. Defaults to if null. public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) { if (format == null) throw new ArgumentNullException(nameof(format)); @@ -261,5 +732,6 @@ public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, [No } #endregion + } } diff --git a/UnitsNet/Scripts/GenerateUnits.ps1 b/UnitsNet/Scripts/GenerateUnits.ps1 index 4a8b0736db..e6750b5669 100644 --- a/UnitsNet/Scripts/GenerateUnits.ps1 +++ b/UnitsNet/Scripts/GenerateUnits.ps1 @@ -1,4 +1,8 @@ -# Set Write-Output used by Include- files to UTF8 encoding to fix copyright character +using module ".\Types.psm1" + +#Requires -Version 5.1 + +# Set Write-Output used by Include- files to UTF8 encoding to fix copyright character [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8 $OutputEncoding = [Text.UTF8Encoding]::UTF8 @@ -8,32 +12,24 @@ function ToCamelCase($str) return $str.Substring(0,1).ToLowerInvariant() + $str.Substring(1) } +function ValueOrDefault($value, $defaultValue){ + if ($value -ne $null) { $value } else { $defaultValue } +} -function GenerateQuantity($quantity, $outDir) +function GenerateQuantity([Quantity]$quantity, $outDir) { - $outFileName = "$outDir/../../../Common/GeneratedCode/Quantities/$($quantity.Name).Common.g.cs" - GenerateQuantitySourceCodeCommon $quantity | Out-File -Encoding "UTF8" $outFileName | Out-Null - if (!$?) { - exit 1 - } - Write-Host -NoNewline "quantity common(OK) " - $outFileName = "$outDir/$($quantity.Name).NetFramework.g.cs" - GenerateQuantitySourceCodeNetFramework $quantity | Out-File -Encoding "UTF8" $outFileName | Out-Null - if (!$?) { - exit 1 - } + GenerateQuantitySourceCodeNetFramework $quantity "NetFramework" | Out-File -Encoding "UTF8" $outFileName | Out-Null + if (!$?) { exit 1 } Write-Host -NoNewline "quantity .NET(OK) " $outFileName = "$outDir/../../../UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/$($quantity.Name).WindowsRuntimeComponent.g.cs" - GenerateQuantitySourceCodeWindowsRuntimeComponent $quantity | Out-File -Encoding "UTF8" $outFileName | Out-Null - if (!$?) { - exit 1 - } + GenerateQuantitySourceCodeNetFramework $quantity "WindowsRuntimeComponent" | Out-File -Encoding "UTF8" $outFileName | Out-Null + if (!$?) { exit 1 } Write-Host -NoNewline "quantity WRC(OK) " } -function GenerateUnitTestBaseClass($quantity, $outDir) +function GenerateUnitTestBaseClass([Quantity]$quantity, $outDir) { $outFileName = "$outDir/$($quantity.Name)TestsBase.g.cs" GenerateUnitTestBaseClassSourceCode $quantity | Out-File -Encoding "UTF8" $outFileName | Out-Null @@ -43,7 +39,7 @@ function GenerateUnitTestBaseClass($quantity, $outDir) Write-Host -NoNewline "test base(OK) " } -function GenerateUnitTestClassIfNotExists($quantity, $outDir) +function GenerateUnitTestClassIfNotExists([Quantity]$quantity, $outDir) { Write-Host -NoNewline "test stub" $outFileName = "$outDir/$($quantity.Name)Tests.cs" @@ -62,7 +58,7 @@ function GenerateUnitTestClassIfNotExists($quantity, $outDir) } } -function GenerateUnitType($quantity, $outDir) +function GenerateUnitType([Quantity]$quantity, $outDir) { $outFileName = "$outDir/$($quantity.Name)Unit.g.cs" @@ -106,26 +102,6 @@ function EnsureDirExists([String] $dirPath) { } } -function Set-DefaultValues { - param ([Parameter(Mandatory = $true, ValueFromPipeline=$true)] $quantity) - PROCESS { - if (!$quantity.BaseType) { - $quantity | Add-Member BaseType "double" - } - if ($quantity.GenerateArithmetic -eq $null) { - $quantity | Add-Member GenerateArithmetic $true - } - # 'Logarithmic' is optional in the .json file and assumed to be false if not specified - if (!$quantity.Logarithmic) { - $quantity | Add-Member Logarithmic $false - } - elseif (!$quantity.LogarithmicScalingFactor) { - $quantity | Add-Member LogarithmicScalingFactor 1 - } - return $quantity - } -} - function Set-ConversionFunctions { param ([Parameter(Mandatory = $true, ValueFromPipeline=$true)] $quantity) @@ -230,7 +206,7 @@ function Set-UnitsOrderedByName { } } -function Add-InheritedUnits($quantity, $quantities) { +function Add-InheritedUnits([Quantity]$quantity, $quantities) { foreach ($inheritFromQuantityName in $quantity.InheritUnitsFrom) { $inheritFromQuantity = $quantities | Where { $_.Name -eq $inheritFromQuantityName } | Select -First 1 @@ -242,12 +218,9 @@ function Add-InheritedUnits($quantity, $quantities) { # Load external generator functions with same name as file . "$PSScriptRoot/Include-GenerateTemplates.ps1" -. "$PSScriptRoot/Include-GenerateLogarithmicCode.ps1" . "$PSScriptRoot/Include-GenerateUnitSystemDefaultSourceCode.ps1" . "$PSScriptRoot/Include-GenerateQuantityTypeSourceCode.ps1" -. "$PSScriptRoot/Include-GenerateQuantitySourceCodeCommon.ps1" . "$PSScriptRoot/Include-GenerateQuantitySourceCodeNetFramework.ps1" -. "$PSScriptRoot/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1" . "$PSScriptRoot/Include-GenerateUnitTypeSourceCode.ps1" . "$PSScriptRoot/Include-GenerateUnitTestBaseClassSourceCode.ps1" . "$PSScriptRoot/Include-GenerateUnitTestPlaceholderSourceCode.ps1" @@ -261,11 +234,54 @@ EnsureDirExists ($testsCustomCodeDir = "$PSScriptRoot/../../UnitsNet.Tests/Custo $templatesDir = "$PSScriptRoot/../../Common/UnitDefinitions" $pad = 25 -# Parse unit definitions from .json files and populate properties +# Parse unit definitions from .json files +# TODO Find a way to automap from JSON into Quantity type $quantities = Get-ChildItem -Path $templatesDir -filter "*.json" ` | %{(Get-Content $_.FullName -Encoding "UTF8" | Out-String)} ` | ConvertFrom-Json ` - | Set-DefaultValues ` + | %{ + # $_ | fl | out-string | write-host -foreground blue + # New-Object -TypeName Quantity -Verbose -Property @{ + [Quantity]@{ + Name = $_.Name + XmlDocSummary = $_.XmlDoc + XmlDocRemarks = $_.XmlDocRemarks + BaseUnit = $_.BaseUnit + BaseType = ValueOrDefault $_.BaseType "double" + BaseDimensions = @{ + Length = ValueOrDefault $_.BaseDimensions.L 0 + Mass = ValueOrDefault $_.BaseDimensions.M 0 + Time = ValueOrDefault $_.BaseDimensions.T 0 + ElectricCurrent = ValueOrDefault $_.BaseDimensions.I 0 + Temperature = ValueOrDefault $_.BaseDimensions.Θ 0 + AmountOfSubstance = ValueOrDefault $_.BaseDimensions.N 0 + LuminousIntensity = ValueOrDefault $_.BaseDimensions.J 0 + } + GenerateArithmetic = ValueOrDefault $_.GenerateArithmetic $true + Logarithmic = ValueOrDefault $_.Logarithmic $false + LogarithmicScalingFactor = ValueOrDefault $_.LogarithmicScalingFactor 1 + Units = $_.Units | %{ + # $_ | fl | out-string | Write-Host -ForegroundColor blue + [Unit]@{ + SingularName = $_.SingularName + PluralName = $_.PluralName + XmlDocSummary = $_.XmlDocSummary + XmlDocRemarks = $_.XmlDocRemarks + FromUnitToBaseFunc = $_.FromUnitToBaseFunc + FromBaseToUnitFunc = $_.FromBaseToUnitFunc + Prefixes = [string[]](ValueOrDefault $_.Prefixes @()) + Localization = $_.Localization | %{ + # $_ | fl | out-string | Write-Host -ForegroundColor blue + [Localization]@{ + Culture = $_.Culture + Abbreviations = $_.Abbreviations + AbbreviationsWithPrefixes = $_.AbbreviationsWithPrefixes + } + } + } + } + } + } ` | Add-PrefixUnits ` | Set-ConversionFunctions ` | Set-UnitsOrderedByName diff --git a/UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 b/UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 deleted file mode 100644 index ba7a62c49f..0000000000 --- a/UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 +++ /dev/null @@ -1,72 +0,0 @@ -<# -.SYNOPSIS -Generates the C# source code for logarithmic arithmetic operators. - -.PARAMETER quantityName -The name of the unit. - -.PARAMETER baseUnitFieldName -The name of the backing field used to store the unit's value. - -.PARAMETER baseType -The data type of the backing field used to store the unit's value. - -.PARAMETER scalingFactor -The scaling factor used in logarithmic calculations. In most cases this is equal to 1. -#> -function GenerateLogarithmicArithmeticOperators([string]$quantityName, [string]$baseUnitFieldName, [string]$baseType, [int]$scalingFactor) -{ - # Most logarithmic operators need a simple scaling factor of 10. However, certain units such as voltage ratio need to - # use 20 instead of 10. - $x = 10 * $scalingFactor; - -@" - - #region Logarithmic Arithmetic Operators - - public static $quantityName operator -($quantityName right) - { - return new $quantityName(-right.Value, right.Unit); - } - - public static $quantityName operator +($quantityName left, $quantityName right) - { - // Logarithmic addition - // Formula: $x*log10(10^(x/$x) + 10^(y/$x)) - return new $quantityName($x*Math.Log10(Math.Pow(10, left.Value/$x) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/$x)), left.Unit); - } - - public static $quantityName operator -($quantityName left, $quantityName right) - { - // Logarithmic subtraction - // Formula: $x*log10(10^(x/$x) - 10^(y/$x)) - return new $quantityName($x*Math.Log10(Math.Pow(10, left.Value/$x) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/$x)), left.Unit); - } - - public static $quantityName operator *($baseType left, $quantityName right) - { - // Logarithmic multiplication = addition - return new $quantityName(left + right.Value, right.Unit); - } - - public static $quantityName operator *($quantityName left, double right) - { - // Logarithmic multiplication = addition - return new $quantityName(left.Value + ($baseType)right, left.Unit); - } - - public static $quantityName operator /($quantityName left, double right) - { - // Logarithmic division = subtraction - return new $quantityName(left.Value - ($baseType)right, left.Unit); - } - - public static double operator /($quantityName left, $quantityName right) - { - // Logarithmic division = subtraction - return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); - } - - #endregion -"@; -} diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 deleted file mode 100644 index 1ac1d02089..0000000000 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ /dev/null @@ -1,603 +0,0 @@ -function GenerateQuantitySourceCodeCommon($quantity) -{ - $quantityName = $quantity.Name; - $units = $quantity.Units; - $baseType = $quantity.BaseType; - $baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } - $baseUnitSingularName = $baseUnit.SingularName - $baseUnitPluralName = $baseUnit.PluralName - $unitEnumName = "$quantityName" + "Unit" - - # Base dimensions - $baseDimensions = $quantity.BaseDimensions; - $baseDimensionLength = if($baseDimensions.L){$baseDimensions.L} else{0}; - $baseDimensionMass = if($baseDimensions.M){$baseDimensions.M} else{0}; - $baseDimensionTime = if($baseDimensions.T){$baseDimensions.T} else{0}; - $baseDimensionElectricCurrent = if($baseDimensions.I){$baseDimensions.I} else{0}; - $baseDimensionTemperature = if($baseDimensions.Θ){$baseDimensions.Θ} else{0}; - $baseDimensionAmountOfSubstance = if($baseDimensions.N){$baseDimensions.N} else{0}; - $baseDimensionLuminousIntensity = if($baseDimensions.J){$baseDimensions.J} else{0}; - -@" -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.InternalHelpers; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ -"@; -$obsoleteAttribute = GetObsoleteAttribute($quantity); -if ($obsoleteAttribute) -{ - $obsoleteAttribute = "`r`n " + $obsoleteAttribute; # apply padding to conformance with code format in this section -} -@" - /// - /// $($quantity.XmlDoc) - /// - // ReSharper disable once PartialTypeWithSinglePart$($obsoleteAttribute) - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class $quantityName : IQuantity -#else - public partial struct $quantityName : IQuantity, IComparable, IComparable<$quantityName> -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly $baseType _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly $($unitEnumName)? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public $unitEnumName Unit => _unit.GetValueOrDefault(BaseUnit); - - static $quantityName() - { -"@; - if($baseDimensions) - { -@" - BaseDimensions = new BaseDimensions($baseDimensionLength, $baseDimensionMass, $baseDimensionTime, $baseDimensionElectricCurrent, $baseDimensionTemperature, $baseDimensionAmountOfSubstance, $baseDimensionLuminousIntensity); -"@; - } -@" - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// The numeric value to contruct this quantity with. - /// The unit representation to contruct this quantity with. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. - /// If value is NaN or Infinity. -#if WINDOWS_UWP - private -#else - public -#endif - $quantityName($baseType numericValue, $unitEnumName unit) - { - if(unit == $unitEnumName.Undefined) - throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); - -"@; if ($quantity.BaseType -eq "double") {@" - _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); -"@; } else {@" - _value = numericValue; -"@; }@" - _unit = unit; - } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.$quantityName; - - /// - /// The base unit of $quantityName, which is $baseUnitSingularName. All conversions go via this value. - /// - public static $unitEnumName BaseUnit => $unitEnumName.$baseUnitSingularName; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the $quantityName quantity. - /// - public static $unitEnumName[] Units { get; } = Enum.GetValues(typeof($unitEnumName)).Cast<$unitEnumName>().Except(new $unitEnumName[]{ $unitEnumName.Undefined }).ToArray(); -"@; - foreach ($unit in $units) { - $propertyName = $unit.PluralName; - $obsoleteAttribute = GetObsoleteAttribute($unit); - if ($obsoleteAttribute) - { - $obsoleteAttribute = "`r`n " + $obsoleteAttribute; # apply padding to conformance with code format in this page - } -@" - - /// - /// Get $quantityName in $propertyName. - /// $($obsoleteAttribute) - public double $propertyName => As($unitEnumName.$($unit.SingularName)); -"@; }@" - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit $baseUnitSingularName. - /// - public static $quantityName Zero => new $quantityName(0, BaseUnit); - -"@; foreach ($unit in $units) { - $valueParamName = $unit.PluralName.ToLowerInvariant(); - $obsoleteAttribute = GetObsoleteAttribute($unit); - if ($obsoleteAttribute) - { - $obsoleteAttribute = "`r`n " + $obsoleteAttribute; # apply padding to conformance with code format in this page - } -@" - /// - /// Get $quantityName from $($unit.PluralName). - /// $($obsoleteAttribute) - /// If value is NaN or Infinity. -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static $quantityName From$($unit.PluralName)(double $valueParamName) -#else - public static $quantityName From$($unit.PluralName)(QuantityValue $valueParamName) -#endif - { - $baseType value = ($baseType) $valueParamName; - return new $quantityName(value, $unitEnumName.$($unit.SingularName)); - } - -"@; }@" - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// $quantityName unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static $quantityName From(double value, $unitEnumName fromUnit) -#else - public static $quantityName From(QuantityValue value, $unitEnumName fromUnit) -#endif - { - return new $quantityName(($baseType)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation($unitEnumName unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is $quantityName)) throw new ArgumentException("Expected type $quantityName.", nameof(obj)); - - return CompareTo(($quantityName)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo($quantityName other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another $quantityName within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals($quantityName other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current $quantityName. - public override int GetHashCode() - { - return new { Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As($unitEnumName unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this $quantityName to another $quantityName with the unit representation . - /// - /// A $quantityName with the specified unit. - public $quantityName ToUnit($unitEnumName unit) - { - var convertedValue = AsBaseNumericType(unit); - return new $quantityName(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private $baseType AsBaseUnit() - { - switch(Unit) - { -"@; foreach ($unit in $units) { - $func = $unit.FromUnitToBaseFunc.Replace("x", "_value");@" - case $unitEnumName.$($unit.SingularName): return $func; -"@; }@" - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private $baseType AsBaseNumericType($unitEnumName unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { -"@; foreach ($unit in $units) { - $func = $unit.FromBaseToUnitFunc.Replace("x", "baseUnitValue");@" - case $unitEnumName.$($unit.SingularName): return $func; -"@; }@" - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static $quantityName Parse(string str) - { - return ParseInternal(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out $quantityName result) - { - return TryParseInternal(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static $unitEnumName ParseUnit(string str) - { - return ParseUnitInternal(str, null); - } - - public static bool TryParseUnit(string str, out $unitEnumName unit) - { - return TryParseUnitInternal(str, null, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static $quantityName ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) - { - result = default($quantityName); - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static $unitEnumName ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse<$unitEnumName>(str, provider); - - if (unit == $unitEnumName.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized $unitEnumName."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out $unitEnumName unit) - { - unit = $unitEnumName.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse<$unitEnumName>(str, provider, out unit)) - return false; - - if(unit == $unitEnumName.Undefined) - return false; - - return true; - } - - #endregion - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString($unitEnumName unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of $quantityName - /// - public static $quantityName MaxValue => new $quantityName($baseType.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of $quantityName - /// - public static $quantityName MinValue => new $quantityName($baseType.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => $quantityName.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => $quantityName.BaseDimensions; - } -} -"@; -} diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 050d62b676..a2e693f463 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -1,14 +1,33 @@ -function GenerateQuantitySourceCodeNetFramework($quantity) +using module ".\Types.psm1" + +class GeneratorArgs +{ + [Quantity]$Quantity + [Unit]$BaseUnit + [string]$UnitEnumName + [boolean]$TargetIsWindowsRuntimeComponent +} + +function GenerateQuantitySourceCodeNetFramework([Quantity]$quantity, [string]$target) { $quantityName = $quantity.Name; $units = $quantity.Units; - $baseType = $quantity.BaseType; - $baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } + $valueType = $quantity.BaseType; + [Unit]$baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } | Select-Object -First 1 $baseUnitSingularName = $baseUnit.SingularName $baseUnitPluralName = $baseUnit.PluralName - $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() $unitEnumName = "$quantityName" + "Unit" + $wrc = $target -eq "WindowsRuntimeComponent" + $privateAccessModifierIfWrc = if ($wrc) { "private" } else { "public" } + $baseDimensions = $quantity.BaseDimensions; + [GeneratorArgs]$genArgs = New-Object GeneratorArgs -Property @{ + Quantity = $quantity; + BaseUnit = $baseUnit; + UnitEnumName = $unitEnumName; + TargetIsWindowsRuntimeComponent = $wrc; + } + # $genArgs | fl | out-string | write-host -foreground yellow @" //------------------------------------------------------------------------------ // @@ -48,110 +67,440 @@ // THE SOFTWARE. using System; +using System.Globalization; +using System.Linq; using JetBrains.Annotations; using UnitsNet.Units; +using UnitsNet.InternalHelpers; // ReSharper disable once CheckNamespace namespace UnitsNet { +"@; +$obsoleteAttribute = GetObsoleteAttribute($quantity); +if ($obsoleteAttribute) +{ + $obsoleteAttribute = "`r`n " + $obsoleteAttribute; # apply padding to conformance with code format in this section +}@" /// - /// $($quantity.XmlDoc) + /// $($quantity.XmlDocSummary) /// - // ReSharper disable once PartialTypeWithSinglePart - +"@; if ($quantity.XmlDocRemarks) {@" + /// + /// $($quantity.XmlDocRemarks) + /// +"@; } + if($wrc) {@" + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class $quantityName : IQuantity +"@; } else {@" public partial struct $quantityName : IQuantity<$unitEnumName>, IComparable, IComparable<$quantityName> +"@; }@" { /// /// The numeric value this quantity was constructed with. /// - public $baseType Value => _value; + private readonly $valueType _value; /// - /// Get unit abbreviation string. + /// The unit this quantity was constructed with. /// - /// Unit to get abbreviation for. - /// Format to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation($unitEnumName unit, [CanBeNull] IFormatProvider provider) + private readonly $($unitEnumName)? _unit; + + static $quantityName() { - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); +"@; if($baseDimensions) + {@" + BaseDimensions = new BaseDimensions($($baseDimensions.Length), $($baseDimensions.Mass), $($baseDimensions.Time), $($baseDimensions.ElectricCurrent), $($baseDimensions.Temperature), $($baseDimensions.AmountOfSubstance), $($baseDimensions.LuminousIntensity)); +"@; }@" } -"@; - 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) +"@; # Windows Runtime Component requires a default constructor + if ($wrc) {@" + /// + /// Creates the quantity with a value of 0 in the base unit $baseUnitSingularName. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public $quantityName() { - return new $quantityName(-right.Value, right.Unit); + _value = 0; + _unit = BaseUnit; } +"@; } @" - public static $quantityName operator +($quantityName left, $quantityName right) + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + $privateAccessModifierIfWrc $quantityName($valueType numericValue, $unitEnumName unit) { - return new $quantityName(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + if(unit == $unitEnumName.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + +"@; if ($quantity.BaseType -eq "double") {@" + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); +"@; } else {@" + _value = numericValue; +"@; }@" + _unit = unit; } +"@; + GenerateStaticProperties $genArgs + GenerateProperties $genArgs + GenerateConversionProperties $genArgs + GenerateStaticMethods $genArgs + GenerateStaticFactoryMethods $genArgs + GenerateStaticParseMethods $genArgs + GenerateArithmeticOperators $genArgs + GenerateEqualityAndComparison $genArgs + GenerateConversionMethods $genArgs +@" - public static $quantityName operator -($quantityName left, $quantityName right) + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() { - return new $quantityName(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + return ToString(Unit); } - public static $quantityName operator *($baseType left, $quantityName right) + /// + /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + public string ToString($unitEnumName unit) { - return new $quantityName(left * right.Value, right.Unit); + return ToString(unit, null, 2); } - public static $quantityName operator *($quantityName left, $baseType right) + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. +"@; # Windows Runtime Component does not support IFormatProvider type + if ($wrc) {@" + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString($unitEnumName unit, [CanBeNull] string cultureName) { - return new $quantityName(left.Value * right, left.Unit); + var provider = cultureName; +"@; } else {@" + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider) + { +"@; }@" + return ToString(unit, provider, 2); } - public static $quantityName operator /($quantityName left, $baseType right) + /// + /// Get string representation of value and unit. + /// + /// Unit representation to use. + /// The number of significant digits after the radix point. + /// String representation. +"@; # Windows Runtime Component does not support IFormatProvider type + if ($wrc) {@" + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString($unitEnumName unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) { - return new $quantityName(left.Value / right, left.Unit); + var provider = cultureName; +"@; } else {@" + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { +"@; }@" + double value = As(unit); + string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(unit, provider, format); } - public static double operator /($quantityName left, $quantityName right) + /// + /// Get string representation of value and unit. + /// + /// Unit representation to use. + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. +"@; # Windows Runtime Component does not support IFormatProvider type + if ($wrc) {@" + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString($unitEnumName unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { - return left.$baseUnitPluralName / right.$baseUnitPluralName; + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); +"@; } else {@" + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { +"@; }@" + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + double value = As(unit); + object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + return string.Format(provider, format, formatArgs); } #endregion +"@; if ($wrc) {@" + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } +"@; } else {@" "@; }@" + } +} +"@; +} - public static bool operator <=($quantityName left, $quantityName right) +function GenerateStaticProperties([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $unitEnumName = $genArgs.UnitEnumName + $baseUnitSingularName = $genArgs.BaseUnit.SingularName + $valueType = $genArgs.Quantity.BaseType +@" + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of $quantityName, which is $baseUnitSingularName. All conversions go via this value. + /// + public static $unitEnumName BaseUnit => $unitEnumName.$baseUnitSingularName; + + /// + /// Represents the largest possible value of $quantityName + /// + public static $quantityName MaxValue => new $quantityName($valueType.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of $quantityName + /// + public static $quantityName MinValue => new $quantityName($valueType.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.$quantityName; + + /// + /// All units of measurement for the $quantityName quantity. + /// + public static $unitEnumName[] Units { get; } = Enum.GetValues(typeof($unitEnumName)).Cast<$unitEnumName>().Except(new $unitEnumName[]{ $unitEnumName.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit $baseUnitSingularName. + /// + public static $quantityName Zero => new $quantityName(0, BaseUnit); + + #endregion +"@; +} + +function GenerateProperties([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $unitEnumName = $genArgs.UnitEnumName + $baseUnitSingularName = $genArgs.BaseUnit.SingularName + $valueType = $genArgs.Quantity.BaseType + $wrc = $genArgs.TargetIsWindowsRuntimeComponent +@" + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// +"@; # Windows Runtime Component does not support decimal + if ($wrc) {@" + public double Value => Convert.ToDouble(_value); +"@; } else {@" + public $valueType Value => _value; +"@; } +@" + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public $unitEnumName Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => $quantityName.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => $quantityName.BaseDimensions; + + #endregion +"@; +} + +function GenerateConversionProperties([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $unitEnumName = $genArgs.UnitEnumName + $units = $genArgs.Quantity.Units +@" + + #region Conversion Properties +"@; + foreach ($unit in $units) { + $propertyName = $unit.PluralName; + $obsoleteAttribute = GetObsoleteAttribute($unit); + if ($obsoleteAttribute) + { + $obsoleteAttribute = "`r`n " + $obsoleteAttribute; # apply padding to conformance with code format in this page + } +@" + + /// + /// Get $quantityName in $propertyName. + /// $($obsoleteAttribute) + public double $propertyName => As($unitEnumName.$($unit.SingularName)); +"@; } +@" + + #endregion +"@; +} + +function GenerateStaticMethods([GeneratorArgs]$genArgs) +{ + $unitEnumName = $genArgs.UnitEnumName +@" + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation($unitEnumName unit) { - return left.Value <= right.AsBaseNumericType(left.Unit); + return GetAbbreviation(unit, null); } - public static bool operator >=($quantityName left, $quantityName right) + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. +"@; # Windows Runtime Component does not support IFormatProvider type +if ($wrc) {@" + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation($unitEnumName unit, [CanBeNull] string cultureName) { - return left.Value >= right.AsBaseNumericType(left.Unit); + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); +"@; } else {@" + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation($unitEnumName unit, [CanBeNull] IFormatProvider provider) + { +"@; }@" + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); } - public static bool operator <($quantityName left, $quantityName right) + #endregion +"@; +} + +function GenerateStaticFactoryMethods([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $unitEnumName = $genArgs.UnitEnumName + $units = $genArgs.Quantity.Units + $valueType = $genArgs.Quantity.BaseType + $wrc = $genArgs.TargetIsWindowsRuntimeComponent +@" + + #region Static Factory Methods + +"@; foreach ($unit in $units) { + $valueParamName = $unit.PluralName.ToLowerInvariant(); + $obsoleteAttribute = GetObsoleteAttribute($unit); + if ($obsoleteAttribute) + { + $obsoleteAttribute = "`r`n " + $obsoleteAttribute; # apply padding to conformance with code format in this page + } + @" + /// + /// Get $quantityName from $($unit.PluralName). + /// $($obsoleteAttribute) + /// If value is NaN or Infinity. +"@; # Windows Runtime Component does not support overloads with same number of parameters + if ($wrc) {@" + [Windows.Foundation.Metadata.DefaultOverload] + public static $quantityName From$($unit.PluralName)(double $valueParamName) +"@; } else {@" + public static $quantityName From$($unit.PluralName)(QuantityValue $valueParamName) +"@; }@" { - return left.Value < right.AsBaseNumericType(left.Unit); + $valueType value = ($valueType) $valueParamName; + return new $quantityName(value, $unitEnumName.$($unit.SingularName)); } +"@; }@" - public static bool operator >($quantityName left, $quantityName right) + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// $quantityName unit value. +"@; # Windows Runtime Component does not support parameters named 'value' +if ($wrc) {@" + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static $quantityName From(double value, $unitEnumName fromUnit) +"@; } else {@" + public static $quantityName From(QuantityValue value, $unitEnumName fromUnit) +"@; }@" { - return left.Value > right.AsBaseNumericType(left.Unit); + return new $quantityName(($valueType)value, fromUnit); } - #region Parsing + #endregion +"@; + +} + +function GenerateStaticParseMethods([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $unitEnumName = $genArgs.UnitEnumName + $baseUnitPluralName = $genArgs.BaseUnit.PluralName + $units = $genArgs.Quantity.Units + $valueType = $genArgs.Quantity.BaseType + $wrc = $genArgs.TargetIsWindowsRuntimeComponent +@" + + #region Static Parse Methods /// /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// @@ -170,109 +519,554 @@ namespace UnitsNet /// We wrap exceptions in to allow you to distinguish /// Units.NET exceptions from other exceptions. /// - public static $quantityName Parse(string str, [CanBeNull] IFormatProvider provider) + public static $quantityName Parse(string str) { - return ParseInternal(str, provider); + return ParseInternal(str, null); } /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// Parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. /// /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// +"@; # Windows Runtime Component does not support IFormatProvider type +if ($wrc) {@" + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static $quantityName Parse(string str, [CanBeNull] string cultureName) { - return TryParseInternal(str, provider, out result); + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); +"@; } else {@" + /// Format to use when parsing number and unit. Defaults to if null. + public static $quantityName Parse(string str, [CanBeNull] IFormatProvider provider) + { +"@; }@" + return ParseInternal(str, provider); } /// - /// Parse a unit string. + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. + /// Resulting unit quantity if successful. /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// Length.Parse("5.5 m", new CultureInfo("en-US")); /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static $unitEnumName ParseUnit(string str, IFormatProvider provider = null) + public static bool TryParse([CanBeNull] string str, out $quantityName result) { - return ParseUnitInternal(str, provider); + return TryParseInternal(str, null, out result); } /// - /// Parse a unit string. + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// +"@; # Windows Runtime Component does not support IFormatProvider type +if ($wrc) {@" + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out $quantityName result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); +"@; } else {@" + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) + { +"@; }@" + return TryParseInternal(str, provider, out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static $unitEnumName ParseUnit(string str) + { + return ParseUnitInternal(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. +"@; # Windows Runtime Component does not support IFormatProvider type +if ($wrc) {@" + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); +"@; } else {@" + /// Format to use when parsing number and unit. Defaults to if null. + public static $unitEnumName ParseUnit(string str, IFormatProvider provider = null) + { +"@; }@" + return ParseUnitInternal(str, provider); + } + + public static bool TryParseUnit(string str, out $unitEnumName unit) + { + return TryParseUnitInternal(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. /// True if successful, otherwise false. /// /// Length.TryParseUnit("m", new CultureInfo("en-US")); /// +"@; # Windows Runtime Component does not support IFormatProvider type +if ($wrc) {@" + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out $unitEnumName unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); +"@; } else {@" + /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, IFormatProvider provider, out $unitEnumName unit) { +"@; }@" return TryParseUnitInternal(str, provider, out unit); } - #endregion + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + private static $quantityName ParseInternal(string str, [CanBeNull] IFormatProvider provider) + { + if (str == null) throw new ArgumentNullException(nameof(str)); - #region ToString Methods + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From); + } /// - /// Get string representation of value and unit. Using two significant digits after radix. + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider) + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) { - return ToString(unit, provider, 2); + result = default; + + if(string.IsNullOrWhiteSpace(str)) + return false; + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + return QuantityParser.Default.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, out result); } /// - /// Get string representation of value and unit. + /// Parse a unit string. /// - /// Unit representation to use. - /// Format to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + private static $unitEnumName ParseUnitInternal(string str, IFormatProvider provider = null) { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + if (str == null) throw new ArgumentNullException(nameof(str)); + + var unit = UnitParser.Default.Parse<$unitEnumName>(str.Trim(), provider); + + if (unit == $unitEnumName.Undefined) + { + var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized $unitEnumName."); + newEx.Data["input"] = str; + newEx.Data["provider"] = provider?.ToString() ?? "(null)"; + throw newEx; + } + + return unit; } /// - /// Get string representation of value and unit. + /// Parse a unit string. /// - /// Format to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to . + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + private static bool TryParseUnitInternal(string str, IFormatProvider provider, out $unitEnumName unit) { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); + unit = $unitEnumName.Undefined; - provider = provider ?? GlobalConfiguration.DefaultCulture; + if(string.IsNullOrWhiteSpace(str)) + return false; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); + if(!UnitParser.Default.TryParse<$unitEnumName>(str.Trim(), provider, out unit)) + return false; + + if(unit == $unitEnumName.Undefined) + return false; + + return true; } #endregion - } +"@; } + +function GenerateLogarithmicArithmeticOperators([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $valueType = $genArgs.Quantity.BaseType + $wrc = $genArgs.TargetIsWindowsRuntimeComponent + $scalingFactor = $genArgs.Quantity.LogarithmicScalingFactor + # Most logarithmic operators need a simple scaling factor of 10. However, certain units such as voltage ratio need to use 20 instead. + $x = 10 * $scalingFactor; + @" + + #region Logarithmic Arithmetic Operators + + public static $quantityName operator -($quantityName right) + { + return new $quantityName(-right.Value, right.Unit); + } + + public static $quantityName operator +($quantityName left, $quantityName right) + { + // Logarithmic addition + // Formula: $x*log10(10^(x/$x) + 10^(y/$x)) + return new $quantityName($x*Math.Log10(Math.Pow(10, left.Value/$x) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/$x)), left.Unit); + } + + public static $quantityName operator -($quantityName left, $quantityName right) + { + // Logarithmic subtraction + // Formula: $x*log10(10^(x/$x) - 10^(y/$x)) + return new $quantityName($x*Math.Log10(Math.Pow(10, left.Value/$x) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/$x)), left.Unit); + } + + public static $quantityName operator *($valueType left, $quantityName right) + { + // Logarithmic multiplication = addition + return new $quantityName(left + right.Value, right.Unit); + } + + public static $quantityName operator *($quantityName left, double right) + { + // Logarithmic multiplication = addition + return new $quantityName(left.Value + ($valueType)right, left.Unit); + } + + public static $quantityName operator /($quantityName left, double right) + { + // Logarithmic division = subtraction + return new $quantityName(left.Value - ($valueType)right, left.Unit); + } + + public static double operator /($quantityName left, $quantityName right) + { + // Logarithmic division = subtraction + return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); + } + + #endregion +"@; +} + +function GenerateArithmeticOperators([GeneratorArgs]$genArgs) +{ + # Windows Runtime Component does not support operator overloads + if ($wrc -or (-not $quantity.GenerateArithmetic)) { return } + + # Logarithmic units required different arithmetic + if ($quantity.Logarithmic) { + GenerateLogarithmicArithmeticOperators $genArgs + return + } + + $quantityName = $genArgs.Quantity.Name + $baseUnitPluralName = $genArgs.BaseUnit.PluralName + $valueType = $genArgs.Quantity.BaseType + @" + + #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 *($valueType left, $quantityName right) + { + return new $quantityName(left * right.Value, right.Unit); + } + + public static $quantityName operator *($quantityName left, $valueType right) + { + return new $quantityName(left.Value * right, left.Unit); + } + + public static $quantityName operator /($quantityName left, $valueType right) + { + return new $quantityName(left.Value / right, left.Unit); + } + + public static double operator /($quantityName left, $quantityName right) + { + return left.$baseUnitPluralName / right.$baseUnitPluralName; + } + + #endregion +"@; +} + +function GenerateEqualityAndComparison([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $wrc = $genArgs.TargetIsWindowsRuntimeComponent +@" + + #region Equality / IComparable + +"@; # Windows Runtime Component does not support operator overloads + if (-not $wrc) {@" + 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); + } + +"@; }@" + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is $quantityName)) throw new ArgumentException("Expected type $quantityName.", nameof(obj)); + + return CompareTo(($quantityName)obj); + } + +"@; # Windows Runtime Component does not support overloads with same number of parameters +$accessModifier = if ($wrc) { "internal" } else { "public" } @" + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + $accessModifier int CompareTo($quantityName other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another $quantityName within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals($quantityName other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current $quantityName. + public override int GetHashCode() + { + return new { Value, Unit }.GetHashCode(); + } + + #endregion +"@; +} + +function GenerateConversionMethods([GeneratorArgs]$genArgs) +{ + $quantityName = $genArgs.Quantity.Name + $unitEnumName = $genArgs.UnitEnumName + $valueType = $genArgs.Quantity.BaseType +@" + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As($unitEnumName unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this $quantityName to another $quantityName with the unit representation . + /// + /// A $quantityName with the specified unit. + public $quantityName ToUnit($unitEnumName unit) + { + var convertedValue = AsBaseNumericType(unit); + return new $quantityName(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private $valueType AsBaseUnit() + { + switch(Unit) + { +"@; foreach ($unit in $units) { + $func = $unit.FromUnitToBaseFunc.Replace("x", "_value");@" + case $unitEnumName.$($unit.SingularName): return $func; +"@; }@" + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private $valueType AsBaseNumericType($unitEnumName unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { +"@; foreach ($unit in $units) { + $func = $unit.FromBaseToUnitFunc.Replace("x", "baseUnitValue");@" + case $unitEnumName.$($unit.SingularName): return $func; +"@; }@" + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion "@; } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 deleted file mode 100644 index b7e7d54fb5..0000000000 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeWindowsRuntimeComponent.ps1 +++ /dev/null @@ -1,245 +0,0 @@ -function GenerateQuantitySourceCodeWindowsRuntimeComponent($quantity) -{ - $quantityName = $quantity.Name; - $units = $quantity.Units; - $baseType = $quantity.BaseType; - $baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } - $baseUnitSingularName = $baseUnit.SingularName - $baseUnitPluralName = $baseUnit.PluralName - $baseUnitPluralNameLower = $baseUnitPluralName.ToLowerInvariant() - $unitEnumName = "$quantityName" + "Unit" - -@" -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Globalization; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// $($quantity.XmlDoc) - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. - public sealed partial class $quantityName - { - /// - /// The numeric value this quantity was constructed with. - /// - public double Value => Convert.ToDouble(_value); - - /// - /// Creates the quantity with a value of 0 in the base unit $baseUnitSingularName. - /// - /// - /// Windows Runtime Component requires a default constructor. - /// - public $quantityName() - { - _value = 0; - _unit = BaseUnit; - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Name of culture (ex: "en-US") to use for localization. Defaults to if null. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation($unitEnumName unit, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); - } - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static $quantityName Parse(string str, [CanBeNull] string cultureName) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseInternal(str, provider); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out $quantityName result) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseInternal(str, provider, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static $unitEnumName ParseUnit(string str, [CanBeNull] string cultureName) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return ParseUnitInternal(str, provider); - } - - /// - /// Try to parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.TryParseUnit("m", new CultureInfo("en-US")); - /// - public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out $unitEnumName unit) - { - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - return TryParseUnitInternal(str, provider, out unit); - } - - #endregion - - #region ToString Methods - - /// - /// Get string representation of value and unit. Using two significant digits after radix. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// String representation. - public string ToString($unitEnumName unit, [CanBeNull] string cultureName) - { - return ToString(unit, cultureName, 2); - } - - /// - /// Get string representation of value and unit. - /// - /// Unit representation to use. - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// The number of significant digits after the radix point. - /// String representation. - [UsedImplicitly] - public string ToString($unitEnumName unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) - { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, cultureName, format); - } - - /// - /// Get string representation of value and unit. - /// - /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - /// Unit representation to use. - /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." - /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. - /// String representation. - [UsedImplicitly] - public string ToString($unitEnumName unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) - { - if (format == null) throw new ArgumentNullException(nameof(format)); - if (args == null) throw new ArgumentNullException(nameof(args)); - - // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx - IFormatProvider provider = cultureName == null ? GlobalConfiguration.DefaultCulture : new CultureInfo(cultureName); - - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); - return string.Format(provider, format, formatArgs); - } - - #endregion - } -} -"@; -} diff --git a/UnitsNet/Scripts/Include-GenerateTemplates.ps1 b/UnitsNet/Scripts/Include-GenerateTemplates.ps1 index 915c6b2ebb..f6b2d15ce7 100644 --- a/UnitsNet/Scripts/Include-GenerateTemplates.ps1 +++ b/UnitsNet/Scripts/Include-GenerateTemplates.ps1 @@ -3,11 +3,11 @@ Returns the Obsolete attribute if ObsoleteText has been defined on the JSON input - otherwise returns empty string It is up to the consumer to wrap any padding/new lines in order to keep to correct indentation formats #> -function GetObsoleteAttribute($quantity) +function GetObsoleteAttribute($quantityOrUnit) { - if ($quantity.ObsoleteText) + if ($quantityOrUnit.ObsoleteText) { - return "[System.Obsolete(""$($quantity.ObsoleteText)"")]"; + return "[System.Obsolete(""$($quantityOrUnit.ObsoleteText)"")]"; } return ""; -} \ No newline at end of file +} diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index d93612a493..6248119c7a 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -1,12 +1,14 @@ -function GenerateUnitTestBaseClassSourceCode($quantity) +using module ".\Types.psm1" +function GenerateUnitTestBaseClassSourceCode([Quantity]$quantity) { - $quantityName = $quantity.Name; - $baseType = $quantity.BaseType; - $units = $quantity.Units; - $baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } + $quantityName = $quantity.Name + $units = $quantity.Units + $valueType = $quantity.BaseType + [Unit]$baseUnit = $units | where { $_.SingularName -eq $quantity.BaseUnit } | Select-Object -First 1 + $baseUnitSingularName = $baseUnit.SingularName $baseUnitPluralName = $baseUnit.PluralName - $baseUnitVariableName = $baseUnit.SingularName.ToLowerInvariant(); - $unitEnumName = "$($quantityName)Unit"; + $baseUnitVariableName = $baseUnitSingularName.ToLowerInvariant() + $unitEnumName = "$quantityName" + "Unit" @" //------------------------------------------------------------------------------ @@ -76,7 +78,7 @@ namespace UnitsNet.Tests [Fact] public void Ctor_WithUndefinedUnit_ThrowsArgumentException() { - Assert.Throws(() => new $quantityName(($baseType)0.0, $unitEnumName.Undefined)); + Assert.Throws(() => new $quantityName(($valueType)0.0, $unitEnumName.Undefined)); } "@; if ($quantity.BaseType -eq "double") {@" diff --git a/UnitsNet/Scripts/Types.psm1 b/UnitsNet/Scripts/Types.psm1 new file mode 100644 index 0000000000..11151b0bd2 --- /dev/null +++ b/UnitsNet/Scripts/Types.psm1 @@ -0,0 +1,43 @@ +class Quantity +{ + [string]$Name + [string]$XmlDocSummary + [string]$XmlDocRemarks + [string]$BaseUnit + [string]$BaseType # TODO Rename me to ValueType + [BaseDimensions]$BaseDimensions = [BaseDimensions]::new() + [boolean]$GenerateArithmetic = $true + [boolean]$Logarithmic = $false + [int]$LogarithmicScalingFactor = 1 + [Unit[]]$Units = @() +} + +class Unit +{ + [string]$SingularName + [string]$PluralName + [string]$XmlDocSummary + [string]$XmlDocRemarks + [string]$FromUnitToBaseFunc + [string]$FromBaseToUnitFunc + [string[]]$Prefixes = @() + [Localization[]]$Localization = @() +} + +class Localization +{ + [string]$Culture + [string[]]$Abbreviations = @() + [string[]]$AbbreviationsWithPrefixes = @() +} + +class BaseDimensions +{ + [int]$Length = 0 + [int]$Mass = 0 + [int]$Time = 0 + [int]$ElectricCurrent = 0 + [int]$Temperature = 0 + [int]$AmountOfSubstance = 0 + [int]$LuminousIntensity = 0 +} diff --git a/generate-code.bat b/generate-code.bat index b005b957fe..27672eeda9 100644 --- a/generate-code.bat +++ b/generate-code.bat @@ -1,3 +1,5 @@ @echo off SET scriptdir=%~dp0 -powershell -ExecutionPolicy Bypass -NoProfile -File "%scriptdir%UnitsNet\Scripts\GenerateUnits.ps1" +pushd "%scriptdir%UnitsNet\Scripts\ +powershell -ExecutionPolicy Bypass -NoProfile -File ".\GenerateUnits.ps1" +popd From 17acea8f0867d523516253833e80fd38184f4df2 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 15 Oct 2018 15:03:37 -0400 Subject: [PATCH 069/131] Replace GetHashCode implementation to match library. Fixing exceptions with null in methods/operators. Adding tests to validate. --- UnitsNet.Tests/BaseDimensionsTests.cs | 92 ++++++++++++++++++++++++++- UnitsNet/BaseDimensions.cs | 56 +++++++++------- 2 files changed, 122 insertions(+), 26 deletions(-) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 0f6f00e675..75cfb95318 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -1,17 +1,83 @@ -using Xunit; +using System; +using System.Collections.Generic; +using Xunit; namespace UnitsNet.Tests { public class BaseDimensionsTests { [Fact] - public void EqualityWorksAsExpected() + public void EqualsWorksAsExpected() { var baseDimensions1 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); var baseDimensions2 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); Assert.True(baseDimensions1.Equals(baseDimensions2)); Assert.True(baseDimensions2.Equals(baseDimensions1)); + + Assert.False(baseDimensions1.Equals(null)); + } + + [Fact] + public void EqualityOperatorsWorkAsExpected() + { + var baseDimensions1 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + var baseDimensions2 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + + Assert.True(baseDimensions1 == baseDimensions2); + Assert.True(baseDimensions2 == baseDimensions1); + + Assert.False(baseDimensions1 == null); + Assert.False(null == baseDimensions1); + + Assert.False(baseDimensions2 == null); + Assert.False(null == baseDimensions2); + } + + [Fact] + public void InequalityOperatorsWorkAsExpected() + { + var baseDimensions1 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + var baseDimensions2 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + + Assert.False(baseDimensions1 != baseDimensions2); + Assert.False(baseDimensions2 != baseDimensions1); + + Assert.True(baseDimensions1 != null); + Assert.True(null != baseDimensions1); + + Assert.True(baseDimensions2 != null); + Assert.True(null != baseDimensions2); + } + + [Fact] + public void MultiplyThrowsExceptionIfPassedNull() + { + var baseDimensions1 = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); + Assert.Throws(() => baseDimensions1.Multiply(null)); + } + + [Fact] + public void DivideThrowsExceptionIfPassedNull() + { + var baseDimensions1 = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); + Assert.Throws(() => baseDimensions1.Divide(null)); + } + + [Fact] + public void MultiplyOperatorThrowsExceptionWithNull() + { + var baseDimensions1 = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); + Assert.Throws(() => baseDimensions1 / null); + Assert.Throws(() => null / baseDimensions1); + } + + [Fact] + public void DivideOperatorThrowsExceptionWithNull() + { + var baseDimensions1 = new BaseDimensions(1, 0, 0, 0, 0, 0, 0); + Assert.Throws(() => baseDimensions1 * null); + Assert.Throws(() => null * baseDimensions1); } [Fact] @@ -575,5 +641,27 @@ public void CheckToStringUsingMolarEntropy() { Assert.Equal("[Length]^2[Mass][Time]^-2[Temperature][Amount]", MolarEntropy.BaseDimensions.ToString()); } + + [Fact] + public void GetHashCodeWorksProperly() + { + var baseDimensions1 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + var baseDimensions2 = new BaseDimensions(7, 6, 5, 4, 3, 2, 1); + var baseDimensions3 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + + var hashSet = new HashSet(); + + hashSet.Add(baseDimensions1); + Assert.True(hashSet.Contains(baseDimensions1)); + + hashSet.Add(baseDimensions2); + Assert.True(hashSet.Contains(baseDimensions2)); + + // Should be the same as baseDimensions1 + Assert.True(hashSet.Contains(baseDimensions3)); + + Assert.True(baseDimensions1.GetHashCode() != baseDimensions2.GetHashCode()); + Assert.True(baseDimensions1.GetHashCode() == baseDimensions3.GetHashCode()); + } } } diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 7eb558b83d..8f1f0ea7d2 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -47,29 +47,21 @@ public override bool Equals(object obj) if(obj is null || !(obj is BaseDimensions)) return false; - var baseDimensionsObj = (BaseDimensions)obj; - - return Length == baseDimensionsObj.Length && - Mass == baseDimensionsObj.Mass && - Time == baseDimensionsObj.Time && - Current == baseDimensionsObj.Current && - Temperature == baseDimensionsObj.Temperature && - Amount == baseDimensionsObj.Amount && - LuminousIntensity == baseDimensionsObj.LuminousIntensity; + var other = (BaseDimensions)obj; + + return Length == other.Length && + Mass == other.Mass && + Time == other.Time && + Current == other.Current && + Temperature == other.Temperature && + Amount == other.Amount && + LuminousIntensity == other.LuminousIntensity; } /// public override int GetHashCode() { - int hash = 17; - hash = hash * 23 + Length; - hash = hash * 23 + Mass; - hash = hash * 23 + Time; - hash = hash * 23 + Current; - hash = hash * 23 + Temperature; - hash = hash * 23 + Amount; - hash = hash * 23 + LuminousIntensity; - return hash; + return new {Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}.GetHashCode(); } /// @@ -79,6 +71,9 @@ public override int GetHashCode() /// Resulting dimensions. public BaseDimensions Multiply(BaseDimensions right) { + if(right is null) + throw new ArgumentNullException(nameof(right)); + return new BaseDimensions( Length + right.Length, Mass + right.Mass, @@ -96,6 +91,9 @@ public BaseDimensions Multiply(BaseDimensions right) /// Resulting dimensions. public BaseDimensions Divide(BaseDimensions right) { + if(right is null) + throw new ArgumentNullException(nameof(right)); + return new BaseDimensions( Length - right.Length, Mass - right.Mass, @@ -137,6 +135,11 @@ public BaseDimensions Divide(BaseDimensions right) /// Resulting dimensions. public static BaseDimensions operator *(BaseDimensions left, BaseDimensions right) { + if(left is null) + throw new ArgumentNullException(nameof(left)); + else if(right is null) + throw new ArgumentNullException(nameof(right)); + return left.Multiply(right); } @@ -148,6 +151,11 @@ public BaseDimensions Divide(BaseDimensions right) /// Resulting dimensions. public static BaseDimensions operator /(BaseDimensions left, BaseDimensions right) { + if(left is null) + throw new ArgumentNullException(nameof(left)); + else if(right is null) + throw new ArgumentNullException(nameof(right)); + return left.Divide(right); } #endif @@ -168,16 +176,16 @@ public override string ToString() return sb.ToString(); } - private static void AppendDimensionString( StringBuilder sb, string name, int value ) + private static void AppendDimensionString(StringBuilder sb, string name, int value) { - var absoluteValue = Math.Abs( value ); + var absoluteValue = Math.Abs(value); - if( absoluteValue > 0 ) + if(absoluteValue > 0) { - sb.AppendFormat( "[{0}]", name ); + sb.AppendFormat("[{0}]", name); - if( absoluteValue > 1 ) - sb.AppendFormat( "^{0}", value ); + if(absoluteValue > 1) + sb.AppendFormat("^{0}", value); } } From 283c6b6c4558dd089d7a9f594fb2c3651ec4185e Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 15 Oct 2018 15:08:15 -0400 Subject: [PATCH 070/131] Prefer non-equal objects for this test :) --- UnitsNet.Tests/BaseDimensionsTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 75cfb95318..7ea943e63e 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -38,10 +38,10 @@ public void EqualityOperatorsWorkAsExpected() public void InequalityOperatorsWorkAsExpected() { var baseDimensions1 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); - var baseDimensions2 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + var baseDimensions2 = new BaseDimensions(7, 6, 5, 4, 3, 2, 1); - Assert.False(baseDimensions1 != baseDimensions2); - Assert.False(baseDimensions2 != baseDimensions1); + Assert.True(baseDimensions1 != baseDimensions2); + Assert.True(baseDimensions2 != baseDimensions1); Assert.True(baseDimensions1 != null); Assert.True(null != baseDimensions1); From a110555b04e4528bef749c6c169238aaf982bd75 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 15 Oct 2018 15:39:35 -0400 Subject: [PATCH 071/131] Adding BaseUnits class. Adding SI unit system. --- UnitsNet.Tests/BaseUnitsTests.cs | 44 ++++++++ UnitsNet.Tests/UnitSystemTests.cs | 55 ++++++++++ UnitsNet/BaseDimensions.cs | 2 + UnitsNet/BaseUnits.cs | 161 ++++++++++++++++++++++++++++++ UnitsNet/UnitSystem.cs | 45 +++++++++ 5 files changed, 307 insertions(+) create mode 100644 UnitsNet.Tests/BaseUnitsTests.cs create mode 100644 UnitsNet.Tests/UnitSystemTests.cs create mode 100644 UnitsNet/BaseUnits.cs create mode 100644 UnitsNet/UnitSystem.cs diff --git a/UnitsNet.Tests/BaseUnitsTests.cs b/UnitsNet.Tests/BaseUnitsTests.cs new file mode 100644 index 0000000000..8562c66ee4 --- /dev/null +++ b/UnitsNet.Tests/BaseUnitsTests.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using UnitsNet.Units; +using Xunit; + +namespace UnitsNet.Tests +{ + public class BaseUnitsTests + { + [Fact] + public void Constructor() + { + var baseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.Equal(LengthUnit.Meter, baseUnits.Length); + Assert.Equal(MassUnit.Kilogram, baseUnits.Mass); + Assert.Equal(DurationUnit.Second, baseUnits.Time); + Assert.Equal(ElectricCurrentUnit.Ampere, baseUnits.Current); + Assert.Equal(TemperatureUnit.Kelvin, baseUnits.Temperature); + Assert.Equal(AmountOfSubstanceUnit.Mole, baseUnits.Amount); + Assert.Equal(LuminousIntensityUnit.Candela, baseUnits.LuminousIntensity); + } + } +} diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs new file mode 100644 index 0000000000..7405451997 --- /dev/null +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -0,0 +1,55 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using UnitsNet.Units; +using Xunit; + +namespace UnitsNet.Tests +{ + public class UnitSystemTests + { + [Fact] + public void Constructor() + { + var siBaseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + var unitSystem = new UnitSystem(siBaseUnits); + + Assert.Equal(unitSystem.BaseUnits, siBaseUnits); + } + + [Fact] + public void SIUnitSystemHasCorrectBaseUnits() + { + var siBaseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.Equal(LengthUnit.Meter, UnitSystem.SI.BaseUnits.Length); + Assert.Equal(MassUnit.Kilogram, UnitSystem.SI.BaseUnits.Mass); + Assert.Equal(DurationUnit.Second, UnitSystem.SI.BaseUnits.Time); + Assert.Equal(ElectricCurrentUnit.Ampere, UnitSystem.SI.BaseUnits.Current); + Assert.Equal(TemperatureUnit.Kelvin, UnitSystem.SI.BaseUnits.Temperature); + Assert.Equal(AmountOfSubstanceUnit.Mole, UnitSystem.SI.BaseUnits.Amount); + Assert.Equal(LuminousIntensityUnit.Candela, UnitSystem.SI.BaseUnits.LuminousIntensity); + } + } +} diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 7eb558b83d..6e62123e0f 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -107,6 +107,7 @@ public BaseDimensions Divide(BaseDimensions right) } #if !WINDOWS_UWP + /// /// Check if two dimensions are equal. /// @@ -150,6 +151,7 @@ public BaseDimensions Divide(BaseDimensions right) { return left.Divide(right); } + #endif /// diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs new file mode 100644 index 0000000000..df2f63f092 --- /dev/null +++ b/UnitsNet/BaseUnits.cs @@ -0,0 +1,161 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Text; +using UnitsNet.Units; + +namespace UnitsNet +{ + /// + /// Represents the base units for a quantity or + /// + public sealed class BaseUnits + { + /// + public BaseUnits(LengthUnit length, MassUnit mass, DurationUnit time, ElectricCurrentUnit current, + TemperatureUnit temperature, AmountOfSubstanceUnit amount, LuminousIntensityUnit luminousIntensity) + { + if(length == LengthUnit.Undefined) + throw new ArgumentException("The given length unit is undefined.", nameof(length)); + else if(mass == MassUnit.Undefined) + throw new ArgumentException("The given mass unit is undefined.", nameof(mass)); + else if(time == DurationUnit.Undefined) + throw new ArgumentException("The given time unit is undefined.", nameof(time)); + else if(current == ElectricCurrentUnit.Undefined) + throw new ArgumentException("The given electric current unit is undefined.", nameof(current)); + else if(temperature == TemperatureUnit.Undefined) + throw new ArgumentException("The given temperature unit is undefined.", nameof(temperature)); + else if(amount == AmountOfSubstanceUnit.Undefined) + throw new ArgumentException("The given amount of substance unit is undefined.", nameof(amount)); + else if(luminousIntensity == LuminousIntensityUnit.Undefined) + throw new ArgumentException("The given luminous intensity unit is undefined.", nameof(luminousIntensity)); + + Length = length; + Mass = mass; + Time = time; + Current = current; + Temperature = temperature; + Amount = amount; + LuminousIntensity = luminousIntensity; + } + + /// + public override bool Equals(object obj) + { + if(obj is null || !(obj is BaseUnits)) + return false; + + var other = (BaseUnits)obj; + + return Length == other.Length && + Mass == other.Mass && + Time == other.Time && + Current == other.Current && + Temperature == other.Temperature && + Amount == other.Amount && + LuminousIntensity == other.LuminousIntensity; + } + + /// + public override int GetHashCode() + { + return new {Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}.GetHashCode(); + } + +#if !WINDOWS_UWP + + /// + /// Check if two dimensions are equal. + /// + /// Left. + /// Right. + /// True if equal. + public static bool operator ==(BaseUnits left, BaseUnits right) + { + return left?.Equals(right) == true; + } + + /// + /// Check if two dimensions are unequal. + /// + /// Left. + /// Right. + /// True if not equal. + public static bool operator !=(BaseUnits left, BaseUnits right) + { + return !(left == right); + } + +#endif + + /// + public override string ToString() + { + var sb = new StringBuilder(); + + sb.AppendFormat("[Length]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Length)); + sb.AppendFormat("[Mass]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Mass)); + sb.AppendFormat("[Time]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Time)); + sb.AppendFormat("[Current]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Current)); + sb.AppendFormat("[Temperature]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Temperature)); + sb.AppendFormat("[Amount]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Amount)); + sb.AppendFormat("[LuminousIntensity]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(LuminousIntensity)); + + return sb.ToString(); + } + + /// + /// Gets the length unit (L). + /// + public LengthUnit Length { get; } + + /// + /// Gets the mass unit (M). + /// + public MassUnit Mass{ get; } + + /// + /// Gets the time unit (T). + /// + public DurationUnit Time{ get; } + + /// + /// Gets the electric current unit (I). + /// + public ElectricCurrentUnit Current{ get; } + + /// + /// Gets the temperature unit (Θ). + /// + public TemperatureUnit Temperature{ get; } + + /// + /// Gets the amount of substance unit (N). + /// + public AmountOfSubstanceUnit Amount{ get; } + + /// + /// Gets the luminous intensity unit (J). + /// + public LuminousIntensityUnit LuminousIntensity{ get; } + } +} diff --git a/UnitsNet/UnitSystem.cs b/UnitsNet/UnitSystem.cs new file mode 100644 index 0000000000..9047fab101 --- /dev/null +++ b/UnitsNet/UnitSystem.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Text; +using UnitsNet.Units; + +namespace UnitsNet +{ + public class UnitSystem + { + public UnitSystem(BaseUnits baseUnits) + { + BaseUnits = baseUnits; + } + + public BaseUnits BaseUnits { get; } + + private static readonly BaseUnits SIBaseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + /// + /// Gets the SI unit system. + /// + public static UnitSystem SI { get; } = new UnitSystem(SIBaseUnits); + } +} From 7cfca078d142a2dfdf47b874f21500ea839f2876 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 15 Oct 2018 21:42:06 +0200 Subject: [PATCH 072/131] Remove internal parse methods (#521) * Remove redundant internal parse methods ParseInternal and TryParseInternal methods are redundant since the same logic is already in QuantityParser. * Remove internal ParseUnit methods Same as for Parse methods. DRY it up. * QuantityParser: Parse using given abbreviations cache Replace delegates for external unit parsing code with UnitParser. * Add null checking and make Trim() more explicit Trimming inline deep in the code is not easy to spot. Make it explicit, just after null checking. Fixes test that assumed ArgNullException. --- .../Information.WindowsRuntimeComponent.g.cs | 130 ++---------------- .../Length.WindowsRuntimeComponent.g.cs | 130 ++---------------- .../Level.WindowsRuntimeComponent.g.cs | 130 ++---------------- .../CustomCode/Quantities/Length.extra.cs | 21 ++- UnitsNet/CustomCode/QuantityParser.cs | 29 ++-- UnitsNet/CustomCode/UnitParser.cs | 16 ++- .../Quantities/Information.NetFramework.g.cs | 130 ++---------------- .../Quantities/Length.NetFramework.g.cs | 130 ++---------------- .../Quantities/Level.NetFramework.g.cs | 130 ++---------------- ...GenerateQuantitySourceCodeNetFramework.ps1 | 130 ++---------------- 10 files changed, 146 insertions(+), 830 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index d7d30a6586..a2fd03bcc8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -623,7 +623,7 @@ public static Information From(double value, InformationUnit fromUnit) /// public static Information Parse(string str) { - return ParseInternal(str, null); + return Parse(str, null); } /// @@ -652,7 +652,10 @@ public static Information Parse(string str) public static Information Parse(string str, [CanBeNull] string cultureName) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return ParseInternal(str, provider); + return QuantityParser.Default.Parse( + str, + provider, + From); } /// @@ -665,7 +668,7 @@ public static Information Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, out Information result) { - return TryParseInternal(str, null, out result); + return TryParse(str, null, out result); } /// @@ -681,7 +684,11 @@ public static bool TryParse([CanBeNull] string str, out Information result) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Information result) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return TryParseInternal(str, provider, out result); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); } /// @@ -695,7 +702,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static InformationUnit ParseUnit(string str) { - return ParseUnitInternal(str, null); + return ParseUnit(str, null); } /// @@ -711,12 +718,12 @@ public static InformationUnit ParseUnit(string str) public static InformationUnit ParseUnit(string str, [CanBeNull] string cultureName) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return ParseUnitInternal(str, provider); + return UnitParser.Default.Parse(str, provider); } public static bool TryParseUnit(string str, out InformationUnit unit) { - return TryParseUnitInternal(str, null, out unit); + return TryParseUnit(str, null, out unit); } /// @@ -732,114 +739,7 @@ public static bool TryParseUnit(string str, out InformationUnit unit) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out InformationUnit unit) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return TryParseUnitInternal(str, provider, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) - { - result = default; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str.Trim(), provider); - - if (unit == InformationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) - { - unit = InformationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) - return false; - - if(unit == InformationUnit.Undefined) - return false; - - return true; + return UnitParser.Default.TryParse(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 6b72f87fee..0fdbf139cc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -563,7 +563,7 @@ public static Length From(double value, LengthUnit fromUnit) /// public static Length Parse(string str) { - return ParseInternal(str, null); + return Parse(str, null); } /// @@ -592,7 +592,10 @@ public static Length Parse(string str) public static Length Parse(string str, [CanBeNull] string cultureName) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return ParseInternal(str, provider); + return QuantityParser.Default.Parse( + str, + provider, + From); } /// @@ -605,7 +608,7 @@ public static Length Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, out Length result) { - return TryParseInternal(str, null, out result); + return TryParse(str, null, out result); } /// @@ -621,7 +624,11 @@ public static bool TryParse([CanBeNull] string str, out Length result) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Length result) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return TryParseInternal(str, provider, out result); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); } /// @@ -635,7 +642,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LengthUnit ParseUnit(string str) { - return ParseUnitInternal(str, null); + return ParseUnit(str, null); } /// @@ -651,12 +658,12 @@ public static LengthUnit ParseUnit(string str) public static LengthUnit ParseUnit(string str, [CanBeNull] string cultureName) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return ParseUnitInternal(str, provider); + return UnitParser.Default.Parse(str, provider); } public static bool TryParseUnit(string str, out LengthUnit unit) { - return TryParseUnitInternal(str, null, out unit); + return TryParseUnit(str, null, out unit); } /// @@ -672,114 +679,7 @@ public static bool TryParseUnit(string str, out LengthUnit unit) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LengthUnit unit) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return TryParseUnitInternal(str, provider, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) - { - result = default; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str.Trim(), provider); - - if (unit == LengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) - { - unit = LengthUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) - return false; - - if(unit == LengthUnit.Undefined) - return false; - - return true; + return UnitParser.Default.TryParse(str, provider, out unit); } #endregion diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 5149db52ad..a8d924885c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -263,7 +263,7 @@ public static Level From(double value, LevelUnit fromUnit) /// public static Level Parse(string str) { - return ParseInternal(str, null); + return Parse(str, null); } /// @@ -292,7 +292,10 @@ public static Level Parse(string str) public static Level Parse(string str, [CanBeNull] string cultureName) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return ParseInternal(str, provider); + return QuantityParser.Default.Parse( + str, + provider, + From); } /// @@ -305,7 +308,7 @@ public static Level Parse(string str, [CanBeNull] string cultureName) /// public static bool TryParse([CanBeNull] string str, out Level result) { - return TryParseInternal(str, null, out result); + return TryParse(str, null, out result); } /// @@ -321,7 +324,11 @@ public static bool TryParse([CanBeNull] string str, out Level result) public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Level result) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return TryParseInternal(str, provider, out result); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); } /// @@ -335,7 +342,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureNa /// Error parsing string. public static LevelUnit ParseUnit(string str) { - return ParseUnitInternal(str, null); + return ParseUnit(str, null); } /// @@ -351,12 +358,12 @@ public static LevelUnit ParseUnit(string str) public static LevelUnit ParseUnit(string str, [CanBeNull] string cultureName) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return ParseUnitInternal(str, provider); + return UnitParser.Default.Parse(str, provider); } public static bool TryParseUnit(string str, out LevelUnit unit) { - return TryParseUnitInternal(str, null, out unit); + return TryParseUnit(str, null, out unit); } /// @@ -372,114 +379,7 @@ public static bool TryParseUnit(string str, out LevelUnit unit) public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LevelUnit unit) { IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); - return TryParseUnitInternal(str, provider, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) - { - result = default; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str.Trim(), provider); - - if (unit == LevelUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) - { - unit = LevelUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) - return false; - - if(unit == LevelUnit.Undefined) - return false; - - return true; + return UnitParser.Default.TryParse(str, provider, out unit); } #endregion diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index 20bc2af780..8978af0364 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -80,8 +80,9 @@ public static Length FromFeetInches(double feet, double inches) /// /// Optionally specify the culture format numbers and localize unit abbreviations. Defaults to thread's culture. /// Parsed length. - public static Length ParseFeetInches(string str, IFormatProvider formatProvider = null) + public static Length ParseFeetInches([NotNull] string str, IFormatProvider formatProvider = null) { + if (str == null) throw new ArgumentNullException(nameof(str)); if (!TryParseFeetInches(str, out Length result, formatProvider)) { // A bit lazy, but I didn't want to duplicate this edge case implementation just to get more narrow exception descriptions. @@ -101,10 +102,18 @@ public static Length ParseFeetInches(string str, IFormatProvider formatProvider /// /// Parsed length. /// Optionally specify the culture format numbers and localize unit abbreviations. Defaults to thread's culture. - public static bool TryParseFeetInches(string str, out Length result, IFormatProvider formatProvider = null) + public static bool TryParseFeetInches([CanBeNull] string str, out Length result, IFormatProvider formatProvider = null) { + if (str == null) + { + result = default; + return false; + } + + str = str.Trim(); + // This succeeds if only feet or inches are given, not both - if (TryParseInternal(str, formatProvider, out result)) + if (TryParse(str, formatProvider, out result)) return true; var quantityParser = QuantityParser.Default; @@ -114,13 +123,13 @@ public static bool TryParseFeetInches(string str, out Length result, IFormatProv // Match entire string exactly string pattern = $@"^(?{footRegex})\s?(?{inchRegex})$"; - var match = new Regex(pattern, RegexOptions.Singleline).Match(str.Trim()); + var match = new Regex(pattern, RegexOptions.Singleline).Match(str); if (!match.Success) return false; var feetGroup = match.Groups["feet"]; var inchesGroup = match.Groups["inches"]; - if (TryParseInternal(feetGroup.Value, formatProvider, out Length feet) && - TryParseInternal(inchesGroup.Value, formatProvider, out Length inches)) + if (TryParse(feetGroup.Value, formatProvider, out Length feet) && + TryParse(inchesGroup.Value, formatProvider, out Length inches)) { result = feet + inches; return true; diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs index 41c02aecd7..d6bedd5c92 100644 --- a/UnitsNet/CustomCode/QuantityParser.cs +++ b/UnitsNet/CustomCode/QuantityParser.cs @@ -30,8 +30,6 @@ // ReSharper disable once CheckNamespace namespace UnitsNet { - internal delegate TUnitType ParseUnitDelegate(string unitString, IFormatProvider formatProvider) where TUnitType : Enum; - internal delegate bool TryParseUnitDelegate(string unitString, IFormatProvider formatProvider, out TUnitType unit) where TUnitType : Enum; #if !WINDOWS_UWP internal delegate TQuantity QuantityFromDelegate(QuantityValue value, TUnitType fromUnit) @@ -51,12 +49,14 @@ internal class QuantityParser private const NumberStyles ParseNumberStyles = NumberStyles.Number | NumberStyles.Float | NumberStyles.AllowExponent; private readonly UnitAbbreviationsCache _unitAbbreviationsCache; + private UnitParser _unitParser; public static QuantityParser Default { get; } public QuantityParser(UnitAbbreviationsCache unitAbbreviationsCache) { _unitAbbreviationsCache = unitAbbreviationsCache ?? UnitAbbreviationsCache.Default; + _unitParser = new UnitParser(_unitAbbreviationsCache); } static QuantityParser() @@ -67,13 +67,12 @@ static QuantityParser() [SuppressMessage("ReSharper", "UseStringInterpolation")] internal TQuantity Parse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, - [NotNull] ParseUnitDelegate parseUnit, [NotNull] QuantityFromDelegate fromDelegate) where TQuantity : IQuantity where TUnitType : Enum { if (str == null) throw new ArgumentNullException(nameof(str)); - if (parseUnit == null) throw new ArgumentNullException(nameof(parseUnit)); + str = str.Trim(); var numFormat = formatProvider != null ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) @@ -91,13 +90,12 @@ internal TQuantity Parse([NotNull] string str, throw ex; } - return ParseWithRegex(valueString, unitString, parseUnit, fromDelegate, formatProvider); + return ParseWithRegex(valueString, unitString, fromDelegate, formatProvider); } [SuppressMessage("ReSharper", "UseStringInterpolation")] internal bool TryParse([NotNull] string str, [CanBeNull] IFormatProvider formatProvider, - [NotNull] TryParseUnitDelegate parseUnit, [NotNull] QuantityFromDelegate fromDelegate, out TQuantity result) where TQuantity : IQuantity @@ -106,6 +104,7 @@ internal bool TryParse([NotNull] string str, result = default; if(string.IsNullOrWhiteSpace(str)) return false; + str = str.Trim(); var numFormat = formatProvider != null ? (NumberFormatInfo) formatProvider.GetFormat(typeof(NumberFormatInfo)) @@ -119,7 +118,7 @@ internal bool TryParse([NotNull] string str, if (!ExtractValueAndUnit(regex, str, out var valueString, out var unitString)) return false; - return TryParseWithRegex(valueString, unitString, parseUnit, fromDelegate, formatProvider, out result); + return TryParseWithRegex(valueString, unitString, fromDelegate, formatProvider, out result); } internal string CreateRegexPatternForUnit( @@ -148,16 +147,15 @@ private static string GetRegexPatternForUnitAbbreviations(IEnumerable ab /// Parse a string given a particular regular expression. /// /// Error parsing string. - private static TQuantity ParseWithRegex(string valueString, + private TQuantity ParseWithRegex(string valueString, string unitString, - ParseUnitDelegate parseUnit, QuantityFromDelegate fromDelegate, IFormatProvider formatProvider) where TQuantity : IQuantity where TUnitType : Enum { var value = double.Parse(valueString, ParseNumberStyles, formatProvider); - var parsedUnit = parseUnit(unitString, formatProvider); + var parsedUnit = _unitParser.Parse(unitString, formatProvider); return fromDelegate(value, parsedUnit); } @@ -165,9 +163,8 @@ private static TQuantity ParseWithRegex(string valueString /// Parse a string given a particular regular expression. /// /// Error parsing string. - private static bool TryParseWithRegex(string valueString, + private bool TryParseWithRegex(string valueString, string unitString, - TryParseUnitDelegate tryParseUnit, QuantityFromDelegate fromDelegate, IFormatProvider formatProvider, out TQuantity result) @@ -177,10 +174,10 @@ private static bool TryParseWithRegex(string valueString, result = default; if (!double.TryParse(valueString, ParseNumberStyles, formatProvider, out var value)) - return false; + return false; - if (!tryParseUnit(unitString, formatProvider, out var parsedUnit)) - return false; + if (!_unitParser.TryParse(unitString, formatProvider, out var parsedUnit)) + return false; result = fromDelegate(value, parsedUnit); return true; @@ -188,7 +185,7 @@ private static bool TryParseWithRegex(string valueString, private static bool ExtractValueAndUnit(Regex regex, string str, out string valueString, out string unitString) { - var match = regex.Match(str.Trim()); + var match = regex.Match(str); var groups = match.Groups; var valueGroup = groups["value"]; diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index cc265b585c..97d4bffda4 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -82,12 +82,15 @@ TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider #else public #endif - object Parse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null) + object Parse([NotNull] string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null) { + if (unitAbbreviation == null) throw new ArgumentNullException(nameof(unitAbbreviation)); + unitAbbreviation = unitAbbreviation.Trim(); + if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) throw new UnitNotFoundException($"No abbreviations defined for unit type [{unitType}] for culture [{formatProvider}]."); - var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation.Trim()); + var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); switch (unitIntValues.Count) { @@ -176,12 +179,19 @@ public bool TryParse(string unitAbbreviation, Type unitType, out object unit) #endif bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider, out object unit) { + if (unitAbbreviation == null) + { + unit = default; + return false; + } + + unitAbbreviation = unitAbbreviation.Trim(); unit = GetDefault(unitType); if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations)) return false; - var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation.Trim()); + var unitIntValues = abbreviations.GetUnitsForAbbreviation(unitAbbreviation); if(unitIntValues.Count != 1) return false; diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index c304c11ff8..f700290d38 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -580,7 +580,7 @@ public static Information From(QuantityValue value, InformationUnit fromUnit) /// public static Information Parse(string str) { - return ParseInternal(str, null); + return Parse(str, null); } /// @@ -608,7 +608,10 @@ public static Information Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Information Parse(string str, [CanBeNull] IFormatProvider provider) { - return ParseInternal(str, provider); + return QuantityParser.Default.Parse( + str, + provider, + From); } /// @@ -621,7 +624,7 @@ public static Information Parse(string str, [CanBeNull] IFormatProvider provider /// public static bool TryParse([CanBeNull] string str, out Information result) { - return TryParseInternal(str, null, out result); + return TryParse(str, null, out result); } /// @@ -636,7 +639,11 @@ public static bool TryParse([CanBeNull] string str, out Information result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) { - return TryParseInternal(str, provider, out result); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); } /// @@ -650,7 +657,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Error parsing string. public static InformationUnit ParseUnit(string str) { - return ParseUnitInternal(str, null); + return ParseUnit(str, null); } /// @@ -665,12 +672,12 @@ public static InformationUnit ParseUnit(string str) /// Format to use when parsing number and unit. Defaults to if null. public static InformationUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnitInternal(str, provider); + return UnitParser.Default.Parse(str, provider); } public static bool TryParseUnit(string str, out InformationUnit unit) { - return TryParseUnitInternal(str, null, out unit); + return TryParseUnit(str, null, out unit); } /// @@ -685,114 +692,7 @@ public static bool TryParseUnit(string str, out InformationUnit unit) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, IFormatProvider provider, out InformationUnit unit) { - return TryParseUnitInternal(str, provider, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Information ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Information result) - { - result = default; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static InformationUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str.Trim(), provider); - - if (unit == InformationUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized InformationUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out InformationUnit unit) - { - unit = InformationUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) - return false; - - if(unit == InformationUnit.Undefined) - return false; - - return true; + return UnitParser.Default.TryParse(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 1dc73d885a..9aa0ce14f8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -524,7 +524,7 @@ public static Length From(QuantityValue value, LengthUnit fromUnit) /// public static Length Parse(string str) { - return ParseInternal(str, null); + return Parse(str, null); } /// @@ -552,7 +552,10 @@ public static Length Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Length Parse(string str, [CanBeNull] IFormatProvider provider) { - return ParseInternal(str, provider); + return QuantityParser.Default.Parse( + str, + provider, + From); } /// @@ -565,7 +568,7 @@ public static Length Parse(string str, [CanBeNull] IFormatProvider provider) /// public static bool TryParse([CanBeNull] string str, out Length result) { - return TryParseInternal(str, null, out result); + return TryParse(str, null, out result); } /// @@ -580,7 +583,11 @@ public static bool TryParse([CanBeNull] string str, out Length result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) { - return TryParseInternal(str, provider, out result); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); } /// @@ -594,7 +601,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Error parsing string. public static LengthUnit ParseUnit(string str) { - return ParseUnitInternal(str, null); + return ParseUnit(str, null); } /// @@ -609,12 +616,12 @@ public static LengthUnit ParseUnit(string str) /// Format to use when parsing number and unit. Defaults to if null. public static LengthUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnitInternal(str, provider); + return UnitParser.Default.Parse(str, provider); } public static bool TryParseUnit(string str, out LengthUnit unit) { - return TryParseUnitInternal(str, null, out unit); + return TryParseUnit(str, null, out unit); } /// @@ -629,114 +636,7 @@ public static bool TryParseUnit(string str, out LengthUnit unit) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, IFormatProvider provider, out LengthUnit unit) { - return TryParseUnitInternal(str, provider, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Length ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Length result) - { - result = default; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LengthUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str.Trim(), provider); - - if (unit == LengthUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LengthUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LengthUnit unit) - { - unit = LengthUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) - return false; - - if(unit == LengthUnit.Undefined) - return false; - - return true; + return UnitParser.Default.TryParse(str, provider, out unit); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 0029fb65aa..2eb3c5b031 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -244,7 +244,7 @@ public static Level From(QuantityValue value, LevelUnit fromUnit) /// public static Level Parse(string str) { - return ParseInternal(str, null); + return Parse(str, null); } /// @@ -272,7 +272,10 @@ public static Level Parse(string str) /// Format to use when parsing number and unit. Defaults to if null. public static Level Parse(string str, [CanBeNull] IFormatProvider provider) { - return ParseInternal(str, provider); + return QuantityParser.Default.Parse( + str, + provider, + From); } /// @@ -285,7 +288,7 @@ public static Level Parse(string str, [CanBeNull] IFormatProvider provider) /// public static bool TryParse([CanBeNull] string str, out Level result) { - return TryParseInternal(str, null, out result); + return TryParse(str, null, out result); } /// @@ -300,7 +303,11 @@ public static bool TryParse([CanBeNull] string str, out Level result) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) { - return TryParseInternal(str, provider, out result); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); } /// @@ -314,7 +321,7 @@ public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider /// Error parsing string. public static LevelUnit ParseUnit(string str) { - return ParseUnitInternal(str, null); + return ParseUnit(str, null); } /// @@ -329,12 +336,12 @@ public static LevelUnit ParseUnit(string str) /// Format to use when parsing number and unit. Defaults to if null. public static LevelUnit ParseUnit(string str, IFormatProvider provider = null) { - return ParseUnitInternal(str, provider); + return UnitParser.Default.Parse(str, provider); } public static bool TryParseUnit(string str, out LevelUnit unit) { - return TryParseUnitInternal(str, null, out unit); + return TryParseUnit(str, null, out unit); } /// @@ -349,114 +356,7 @@ public static bool TryParseUnit(string str, out LevelUnit unit) /// Format to use when parsing number and unit. Defaults to if null. public static bool TryParseUnit(string str, IFormatProvider provider, out LevelUnit unit) { - return TryParseUnitInternal(str, provider, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static Level ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Level result) - { - result = default; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static LevelUnit ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse(str.Trim(), provider); - - if (unit == LevelUnit.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized LevelUnit."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out LevelUnit unit) - { - unit = LevelUnit.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse(str.Trim(), provider, out unit)) - return false; - - if(unit == LevelUnit.Undefined) - return false; - - return true; + return UnitParser.Default.TryParse(str, provider, out unit); } #endregion diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index a2e693f463..6eff130e3a 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -521,7 +521,7 @@ function GenerateStaticParseMethods([GeneratorArgs]$genArgs) /// public static $quantityName Parse(string str) { - return ParseInternal(str, null); + return Parse(str, null); } /// @@ -557,7 +557,10 @@ if ($wrc) {@" public static $quantityName Parse(string str, [CanBeNull] IFormatProvider provider) { "@; }@" - return ParseInternal(str, provider); + return QuantityParser.Default.Parse<$quantityName, $unitEnumName>( + str, + provider, + From); } /// @@ -570,7 +573,7 @@ if ($wrc) {@" /// public static bool TryParse([CanBeNull] string str, out $quantityName result) { - return TryParseInternal(str, null, out result); + return TryParse(str, null, out result); } /// @@ -593,7 +596,11 @@ if ($wrc) {@" public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) { "@; }@" - return TryParseInternal(str, provider, out result); + return QuantityParser.Default.TryParse<$quantityName, $unitEnumName>( + str, + provider, + From, + out result); } /// @@ -607,7 +614,7 @@ if ($wrc) {@" /// Error parsing string. public static $unitEnumName ParseUnit(string str) { - return ParseUnitInternal(str, null); + return ParseUnit(str, null); } /// @@ -630,12 +637,12 @@ if ($wrc) {@" public static $unitEnumName ParseUnit(string str, IFormatProvider provider = null) { "@; }@" - return ParseUnitInternal(str, provider); + return UnitParser.Default.Parse<$unitEnumName>(str, provider); } public static bool TryParseUnit(string str, out $unitEnumName unit) { - return TryParseUnitInternal(str, null, out unit); + return TryParseUnit(str, null, out unit); } /// @@ -658,114 +665,7 @@ if ($wrc) {@" public static bool TryParseUnit(string str, IFormatProvider provider, out $unitEnumName unit) { "@; }@" - return TryParseUnitInternal(str, provider, out unit); - } - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - private static $quantityName ParseInternal(string str, [CanBeNull] IFormatProvider provider) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.Parse<$quantityName, $unitEnumName>(str, provider, ParseUnitInternal, From); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// Resulting unit quantity if successful. - /// True if successful, otherwise false. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - private static bool TryParseInternal([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out $quantityName result) - { - result = default; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - provider = provider ?? GlobalConfiguration.DefaultCulture; - - return QuantityParser.Default.TryParse<$quantityName, $unitEnumName>(str, provider, TryParseUnitInternal, From, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - private static $unitEnumName ParseUnitInternal(string str, IFormatProvider provider = null) - { - if (str == null) throw new ArgumentNullException(nameof(str)); - - var unit = UnitParser.Default.Parse<$unitEnumName>(str.Trim(), provider); - - if (unit == $unitEnumName.Undefined) - { - var newEx = new UnitsNetException("Error parsing string. The unit is not a recognized $unitEnumName."); - newEx.Data["input"] = str; - newEx.Data["provider"] = provider?.ToString() ?? "(null)"; - throw newEx; - } - - return unit; - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// Format to use when parsing number and unit. Defaults to . - /// The parsed unit if successful. - /// True if successful, otherwise false. - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - private static bool TryParseUnitInternal(string str, IFormatProvider provider, out $unitEnumName unit) - { - unit = $unitEnumName.Undefined; - - if(string.IsNullOrWhiteSpace(str)) - return false; - - if(!UnitParser.Default.TryParse<$unitEnumName>(str.Trim(), provider, out unit)) - return false; - - if(unit == $unitEnumName.Undefined) - return false; - - return true; + return UnitParser.Default.TryParse<$unitEnumName>(str, provider, out unit); } #endregion From f3c90ed915ac3dea672248bacbf8e0f9fea316ae Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 10:49:18 -0400 Subject: [PATCH 073/131] Implementing IEquatable on BaseUnits, and adding some tests for BaseUnits. Adding some doc too. --- UnitsNet.Tests/BaseUnitsTests.cs | 85 +++++++++++++++++++++++++++++++- UnitsNet/BaseUnits.cs | 75 ++++++++++++++++++---------- 2 files changed, 134 insertions(+), 26 deletions(-) diff --git a/UnitsNet.Tests/BaseUnitsTests.cs b/UnitsNet.Tests/BaseUnitsTests.cs index 8562c66ee4..f8464b8767 100644 --- a/UnitsNet.Tests/BaseUnitsTests.cs +++ b/UnitsNet.Tests/BaseUnitsTests.cs @@ -19,6 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; using UnitsNet.Units; using Xunit; @@ -27,7 +28,7 @@ namespace UnitsNet.Tests public class BaseUnitsTests { [Fact] - public void Constructor() + public void ConstructorSetsUnitsProperly() { var baseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); @@ -40,5 +41,87 @@ public void Constructor() Assert.Equal(AmountOfSubstanceUnit.Mole, baseUnits.Amount); Assert.Equal(LuminousIntensityUnit.Candela, baseUnits.LuminousIntensity); } + + [Theory] + [InlineData(LengthUnit.Undefined, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Undefined, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Undefined, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Undefined, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Undefined, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Undefined, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Undefined)] + public void ConstructorThrowsExceptionWithUndefinedUnits(LengthUnit length, MassUnit mass, DurationUnit time, ElectricCurrentUnit current, + TemperatureUnit temperature, AmountOfSubstanceUnit amount, LuminousIntensityUnit luminousIntensity) + { + var baseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.Throws(() => new BaseUnits(length, mass, time, current, temperature, amount, luminousIntensity)); + } + + [Fact] + public void EqualsObjectIsImplementedCorrectly() + { + var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.True(baseUnits1.Equals((object)baseUnits2)); + Assert.False(baseUnits1.Equals("Some object.")); + Assert.False(baseUnits1.Equals((IFormatProvider)null)); + } + + [Fact] + public void EqualsBaseUnitsIsImplementedCorrectly() + { + var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.True(baseUnits1.Equals(baseUnits2)); + Assert.True(baseUnits2.Equals(baseUnits1)); + Assert.False(baseUnits1.Equals(null)); + } + + [Fact] + public void EqualityOperatorIsImplementedCorrectly() + { + var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.True(baseUnits1 == baseUnits2); + Assert.False(baseUnits1 == null); + Assert.False(null == baseUnits1); + } + + [Fact] + public void InequalityOperatorIsImplementedCorrectly() + { + var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + var baseUnits2 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.True(baseUnits1 != baseUnits2); + Assert.True(baseUnits1 != null); + Assert.True(null != baseUnits1); + } + + [Fact] + public void ToStringGivesExpectedResult() + { + var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + Assert.Equal("[Length]: m, [Mass]: kg, [Time]: s, [Current]: A, [Temperature]: K, [Amount]: mol, [LuminousIntensity]: cd", baseUnits1.ToString()); + } } } diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs index df2f63f092..5d85178348 100644 --- a/UnitsNet/BaseUnits.cs +++ b/UnitsNet/BaseUnits.cs @@ -26,27 +26,39 @@ namespace UnitsNet { /// - /// Represents the base units for a quantity or + /// Represents the base units for a quantity. All quantities, both base and derived, can be + /// represented by a combination of these seven base units. /// - public sealed class BaseUnits + public sealed class BaseUnits : IEquatable { - /// + /// + /// Creates an instance of if the base units class that represents the base units for a quantity. + /// All quantities, both base and derived, can be represented by a combination of these seven base units. + /// + /// The length unit (L). + /// The mass unit (M). + /// The time unit (T). + /// The electric current unit (I). + /// The temperature unit (Θ). + /// The amount of substance unit (N). + /// The luminous intensity unit (J). + /// Throws an ArgumentException if any of the units are undefined. public BaseUnits(LengthUnit length, MassUnit mass, DurationUnit time, ElectricCurrentUnit current, TemperatureUnit temperature, AmountOfSubstanceUnit amount, LuminousIntensityUnit luminousIntensity) { if(length == LengthUnit.Undefined) throw new ArgumentException("The given length unit is undefined.", nameof(length)); - else if(mass == MassUnit.Undefined) + if(mass == MassUnit.Undefined) throw new ArgumentException("The given mass unit is undefined.", nameof(mass)); - else if(time == DurationUnit.Undefined) + if(time == DurationUnit.Undefined) throw new ArgumentException("The given time unit is undefined.", nameof(time)); - else if(current == ElectricCurrentUnit.Undefined) + if(current == ElectricCurrentUnit.Undefined) throw new ArgumentException("The given electric current unit is undefined.", nameof(current)); - else if(temperature == TemperatureUnit.Undefined) + if(temperature == TemperatureUnit.Undefined) throw new ArgumentException("The given temperature unit is undefined.", nameof(temperature)); - else if(amount == AmountOfSubstanceUnit.Undefined) + if(amount == AmountOfSubstanceUnit.Undefined) throw new ArgumentException("The given amount of substance unit is undefined.", nameof(amount)); - else if(luminousIntensity == LuminousIntensityUnit.Undefined) + if(luminousIntensity == LuminousIntensityUnit.Undefined) throw new ArgumentException("The given luminous intensity unit is undefined.", nameof(luminousIntensity)); Length = length; @@ -64,7 +76,18 @@ public override bool Equals(object obj) if(obj is null || !(obj is BaseUnits)) return false; - var other = (BaseUnits)obj; + return Equals((BaseUnits)obj); + } + + /// + /// Checks if all of the base units are equal to another instance's. + /// + /// The other instance to check if equal to. + /// True if equal, otherwise false. + public bool Equals(BaseUnits other) + { + if(other is null) + return false; return Length == other.Length && Mass == other.Mass && @@ -84,22 +107,24 @@ public override int GetHashCode() #if !WINDOWS_UWP /// - /// Check if two dimensions are equal. + /// Checks if this instance is equal to another. /// - /// Left. - /// Right. - /// True if equal. + /// The left instance. + /// The right instance. + /// True if equal, otherwise false. + /// public static bool operator ==(BaseUnits left, BaseUnits right) { return left?.Equals(right) == true; } /// - /// Check if two dimensions are unequal. + /// Checks if this instance is not equal to another. /// - /// Left. - /// Right. - /// True if not equal. + /// The left instance. + /// The right instance. + /// True if not equal, otherwise false. + /// public static bool operator !=(BaseUnits left, BaseUnits right) { return !(left == right); @@ -112,13 +137,13 @@ public override string ToString() { var sb = new StringBuilder(); - sb.AppendFormat("[Length]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Length)); - sb.AppendFormat("[Mass]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Mass)); - sb.AppendFormat("[Time]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Time)); - sb.AppendFormat("[Current]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Current)); - sb.AppendFormat("[Temperature]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Temperature)); - sb.AppendFormat("[Amount]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Amount)); - sb.AppendFormat("[LuminousIntensity]: {0} ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(LuminousIntensity)); + sb.AppendFormat("[Length]: {0}, ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Length)); + sb.AppendFormat("[Mass]: {0}, ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Mass)); + sb.AppendFormat("[Time]: {0}, ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Time)); + sb.AppendFormat("[Current]: {0}, ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Current)); + sb.AppendFormat("[Temperature]: {0}, ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Temperature)); + sb.AppendFormat("[Amount]: {0}, ", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(Amount)); + sb.AppendFormat("[LuminousIntensity]: {0}", UnitAbbreviationsCache.Default.GetDefaultAbbreviation(LuminousIntensity)); return sb.ToString(); } From 21d8459194b54275a8df29acc420a473d5e190e0 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 12:55:50 -0400 Subject: [PATCH 074/131] Fixing BaseUnits to not throw exception for undefined units. The Length quantity for example has a BaseUnits where only Length would be set. Only a UnitSystem needs it all. Moving logic there. Expanding UnitSystem tests and logic. Fixing WRC. --- UnitsNet.Tests/BaseUnitsTests.cs | 49 ++++++++----- UnitsNet.Tests/UnitSystemTests.cs | 114 ++++++++++++++++++++++++++++-- UnitsNet/BaseUnits.cs | 25 +++---- UnitsNet/UnitSystem.cs | 86 +++++++++++++++++++++- 4 files changed, 231 insertions(+), 43 deletions(-) diff --git a/UnitsNet.Tests/BaseUnitsTests.cs b/UnitsNet.Tests/BaseUnitsTests.cs index f8464b8767..7bcf7229ae 100644 --- a/UnitsNet.Tests/BaseUnitsTests.cs +++ b/UnitsNet.Tests/BaseUnitsTests.cs @@ -42,23 +42,6 @@ public void ConstructorSetsUnitsProperly() Assert.Equal(LuminousIntensityUnit.Candela, baseUnits.LuminousIntensity); } - [Theory] - [InlineData(LengthUnit.Undefined, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] - [InlineData(LengthUnit.Meter, MassUnit.Undefined, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] - [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Undefined, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] - [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Undefined, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] - [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Undefined, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] - [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Undefined, LuminousIntensityUnit.Candela)] - [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Undefined)] - public void ConstructorThrowsExceptionWithUndefinedUnits(LengthUnit length, MassUnit mass, DurationUnit time, ElectricCurrentUnit current, - TemperatureUnit temperature, AmountOfSubstanceUnit amount, LuminousIntensityUnit luminousIntensity) - { - var baseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - Assert.Throws(() => new BaseUnits(length, mass, time, current, temperature, amount, luminousIntensity)); - } - [Fact] public void EqualsObjectIsImplementedCorrectly() { @@ -68,7 +51,12 @@ public void EqualsObjectIsImplementedCorrectly() var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + Assert.True(baseUnits1.Equals((object)baseUnits2)); + Assert.False(baseUnits1.Equals((object)baseUnits3)); + Assert.False(baseUnits1.Equals("Some object.")); Assert.False(baseUnits1.Equals((IFormatProvider)null)); } @@ -82,8 +70,15 @@ public void EqualsBaseUnitsIsImplementedCorrectly() var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + Assert.True(baseUnits1.Equals(baseUnits2)); Assert.True(baseUnits2.Equals(baseUnits1)); + + Assert.False(baseUnits1.Equals(baseUnits3)); + Assert.False(baseUnits3.Equals(baseUnits1)); + Assert.False(baseUnits1.Equals(null)); } @@ -96,7 +91,15 @@ public void EqualityOperatorIsImplementedCorrectly() var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + Assert.True(baseUnits1 == baseUnits2); + Assert.True(baseUnits2 == baseUnits1); + + Assert.False(baseUnits1 == baseUnits3); + Assert.False(baseUnits3 == baseUnits1); + Assert.False(baseUnits1 == null); Assert.False(null == baseUnits1); } @@ -107,10 +110,18 @@ public void InequalityOperatorIsImplementedCorrectly() var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - var baseUnits2 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - Assert.True(baseUnits1 != baseUnits2); + Assert.False(baseUnits1 != baseUnits2); + Assert.False(baseUnits2 != baseUnits1); + + Assert.True(baseUnits1 != baseUnits3); + Assert.True(baseUnits3 != baseUnits1); + Assert.True(baseUnits1 != null); Assert.True(null != baseUnits1); } diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index 7405451997..6ffd6a6190 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -19,6 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; using UnitsNet.Units; using Xunit; @@ -27,14 +28,119 @@ namespace UnitsNet.Tests public class UnitSystemTests { [Fact] - public void Constructor() + public void ConstructorImplementedProperly() { - var siBaseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + var baseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - var unitSystem = new UnitSystem(siBaseUnits); + var unitSystem = new UnitSystem(baseUnits); + + Assert.Equal(unitSystem.BaseUnits, baseUnits); + } + + [Fact] + public void ConstructorThrowsArgumentNullExceptionForNullBaseUnits() + { + Assert.Throws(() => new UnitSystem(null)); + } + + [Theory] + [InlineData(LengthUnit.Undefined, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Undefined, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Undefined, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Undefined, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Undefined, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Undefined, LuminousIntensityUnit.Candela)] + [InlineData(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Undefined)] + public void ConstructorThrowsArgumentExceptionWithUndefinedUnits(LengthUnit length, MassUnit mass, DurationUnit time, ElectricCurrentUnit current, + TemperatureUnit temperature, AmountOfSubstanceUnit amount, LuminousIntensityUnit luminousIntensity) + { + var baseUnits = new BaseUnits(length, mass, time, current, temperature, amount, luminousIntensity); + Assert.Throws(() => new UnitSystem(baseUnits)); + } + + [Fact] + public void EqualsObjectIsImplementedCorrectly() + { + var unitSystem1 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem2 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem3 = new UnitSystem(new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + Assert.True(unitSystem1.Equals((object)unitSystem2)); + Assert.False(unitSystem1.Equals((object)unitSystem3)); + + Assert.False(unitSystem1.Equals("Some object.")); + Assert.False(unitSystem1.Equals((IFormatProvider)null)); + } + + [Fact] + public void EqualsUnitSystemIsImplementedCorrectly() + { + var unitSystem1 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem2 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem3 = new UnitSystem(new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + Assert.True(unitSystem1.Equals(unitSystem2)); + Assert.True(unitSystem2.Equals(unitSystem1)); + + Assert.False(unitSystem1.Equals(unitSystem3)); + Assert.False(unitSystem3.Equals(unitSystem1)); + + Assert.False(unitSystem1.Equals(null)); + } + + [Fact] + public void EqualityOperatorIsImplementedCorrectly() + { + var unitSystem1 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem2 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem3 = new UnitSystem(new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + Assert.True(unitSystem1 == unitSystem2); + Assert.True(unitSystem2 == unitSystem1); + + Assert.False(unitSystem1 == unitSystem3); + Assert.False(unitSystem3 == unitSystem1); + + Assert.False(unitSystem1 == null); + Assert.False(null == unitSystem1); + } + + [Fact] + public void InequalityOperatorIsImplementedCorrectly() + { + var unitSystem1 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem2 = new UnitSystem(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + var unitSystem3 = new UnitSystem(new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela)); + + Assert.False(unitSystem1 != unitSystem2); + Assert.False(unitSystem2 != unitSystem1); + + Assert.True(unitSystem1 != unitSystem3); + Assert.True(unitSystem3 != unitSystem1); - Assert.Equal(unitSystem.BaseUnits, siBaseUnits); + Assert.True(unitSystem1 != null); + Assert.True(null != unitSystem1); } [Fact] diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs index 5d85178348..196b400430 100644 --- a/UnitsNet/BaseUnits.cs +++ b/UnitsNet/BaseUnits.cs @@ -25,11 +25,15 @@ namespace UnitsNet { +#if !WINDOWS_UWP + public sealed partial class BaseUnits : IEquatable { } +#endif + /// /// Represents the base units for a quantity. All quantities, both base and derived, can be /// represented by a combination of these seven base units. /// - public sealed class BaseUnits : IEquatable + public sealed partial class BaseUnits { /// /// Creates an instance of if the base units class that represents the base units for a quantity. @@ -42,25 +46,9 @@ public sealed class BaseUnits : IEquatable /// The temperature unit (Θ). /// The amount of substance unit (N). /// The luminous intensity unit (J). - /// Throws an ArgumentException if any of the units are undefined. public BaseUnits(LengthUnit length, MassUnit mass, DurationUnit time, ElectricCurrentUnit current, TemperatureUnit temperature, AmountOfSubstanceUnit amount, LuminousIntensityUnit luminousIntensity) { - if(length == LengthUnit.Undefined) - throw new ArgumentException("The given length unit is undefined.", nameof(length)); - if(mass == MassUnit.Undefined) - throw new ArgumentException("The given mass unit is undefined.", nameof(mass)); - if(time == DurationUnit.Undefined) - throw new ArgumentException("The given time unit is undefined.", nameof(time)); - if(current == ElectricCurrentUnit.Undefined) - throw new ArgumentException("The given electric current unit is undefined.", nameof(current)); - if(temperature == TemperatureUnit.Undefined) - throw new ArgumentException("The given temperature unit is undefined.", nameof(temperature)); - if(amount == AmountOfSubstanceUnit.Undefined) - throw new ArgumentException("The given amount of substance unit is undefined.", nameof(amount)); - if(luminousIntensity == LuminousIntensityUnit.Undefined) - throw new ArgumentException("The given luminous intensity unit is undefined.", nameof(luminousIntensity)); - Length = length; Mass = mass; Time = time; @@ -84,6 +72,9 @@ public override bool Equals(object obj) /// /// The other instance to check if equal to. /// True if equal, otherwise false. +#if WINDOWS_UWP + [Windows.Foundation.Metadata.DefaultOverload] +#endif public bool Equals(BaseUnits other) { if(other is null) diff --git a/UnitsNet/UnitSystem.cs b/UnitsNet/UnitSystem.cs index 9047fab101..7a1c8be10c 100644 --- a/UnitsNet/UnitSystem.cs +++ b/UnitsNet/UnitSystem.cs @@ -25,14 +25,94 @@ namespace UnitsNet { - public class UnitSystem +#if !WINDOWS_UWP + public sealed partial class UnitSystem : IEquatable { } +#endif + + public sealed partial class UnitSystem { + /// + /// Creates an instance of a unit system with the specified base units. + /// + /// The base units for the unit system. public UnitSystem(BaseUnits baseUnits) { + if(baseUnits is null) + throw new ArgumentNullException(nameof(baseUnits)); + + if(baseUnits.Length == LengthUnit.Undefined) + throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); + if(baseUnits.Mass == MassUnit.Undefined) + throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); + if(baseUnits.Time == DurationUnit.Undefined) + throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); + if(baseUnits.Current == ElectricCurrentUnit.Undefined) + throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); + if(baseUnits.Temperature == TemperatureUnit.Undefined) + throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); + if(baseUnits.Amount == AmountOfSubstanceUnit.Undefined) + throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); + if(baseUnits.LuminousIntensity == LuminousIntensityUnit.Undefined) + throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); + BaseUnits = baseUnits; } - public BaseUnits BaseUnits { get; } + /// + public override bool Equals(object obj) + { + if(obj is null || !(obj is UnitSystem)) + return false; + + return Equals((UnitSystem)obj); + } + +#if WINDOWS_UWP + [Windows.Foundation.Metadata.DefaultOverload] +#endif + public bool Equals(UnitSystem other) + { + if(other is null) + return false; + + return BaseUnits.Equals(other.BaseUnits); + } + +#if !WINDOWS_UWP + + /// + /// Checks if this instance is equal to another. + /// + /// The left instance. + /// The right instance. + /// True if equal, otherwise false. + /// + public static bool operator ==(UnitSystem left, UnitSystem right) + { + return left?.Equals(right) == true; + } + + /// + /// Checks if this instance is equal to another. + /// + /// The left instance. + /// The right instance. + /// True if equal, otherwise false. + /// + public static bool operator !=(UnitSystem left, UnitSystem right) + { + return !(left == right); + } + +#endif + + /// + public override int GetHashCode() + { + return new {BaseUnits}.GetHashCode(); + } + + public BaseUnits BaseUnits{ get; } private static readonly BaseUnits SIBaseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); @@ -40,6 +120,6 @@ public UnitSystem(BaseUnits baseUnits) /// /// Gets the SI unit system. /// - public static UnitSystem SI { get; } = new UnitSystem(SIBaseUnits); + public static UnitSystem SI{ get; } = new UnitSystem(SIBaseUnits); } } From 083070639bc02463bebe6a24d6050644f455f597 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 13:33:08 -0400 Subject: [PATCH 075/131] Adding base/derived check to BaseDimensions --- UnitsNet.Tests/BaseDimensionsTests.cs | 50 ++++++++++++++++++++++++++- UnitsNet/BaseDimensions.cs | 13 +++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 0f6f00e675..d5185ce2f6 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -5,7 +5,55 @@ namespace UnitsNet.Tests public class BaseDimensionsTests { [Fact] - public void EqualityWorksAsExpected() + public void ConstructorImplementedCorrectly() + { + var baseDimensions = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + + Assert.True(baseDimensions.Length == 1); + Assert.True(baseDimensions.Mass == 2); + Assert.True(baseDimensions.Time == 3); + Assert.True(baseDimensions.Current == 4); + Assert.True(baseDimensions.Temperature == 5); + Assert.True(baseDimensions.Amount == 6); + Assert.True(baseDimensions.LuminousIntensity == 7); + } + + [Theory] + [InlineData(1, 0, 0, 0, 0, 0, 0)] + [InlineData(0, 1, 0, 0, 0, 0, 0)] + [InlineData(0, 0, 1, 0, 0, 0, 0)] + [InlineData(0, 0, 0, 1, 0, 0, 0)] + [InlineData(0, 0, 0, 0, 1, 0, 0)] + [InlineData(0, 0, 0, 0, 0, 1, 0)] + [InlineData(0, 0, 0, 0, 0, 0, 1)] + public void IsBaseImplementedSuccessfully(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) + { + var baseDimensions = new BaseDimensions(length, mass, time, current, temperature, amount, luminousIntensity); + var derivedDimensions = new BaseDimensions(length * 2, mass * 2, time * 2, current * 2, temperature * 2, amount * 2, luminousIntensity * 2); + + Assert.True(baseDimensions.IsBase()); + Assert.False(derivedDimensions.IsBase()); + } + + [Theory] + [InlineData(2, 0, 0, 0, 0, 0, 0)] + [InlineData(0, 2, 0, 0, 0, 0, 0)] + [InlineData(0, 0, 2, 0, 0, 0, 0)] + [InlineData(0, 0, 0, 2, 0, 0, 0)] + [InlineData(0, 0, 0, 0, 2, 0, 0)] + [InlineData(0, 0, 0, 0, 0, 2, 0)] + [InlineData(0, 0, 0, 0, 0, 0, 2)] + public void IsDerivedImplementedSuccessfully(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) + { + var baseDimensions = new BaseDimensions(length / 2, mass / 2, time / 2, current / 2, temperature / 2, amount / 2, luminousIntensity / 2); + var derivedDimensions = new BaseDimensions(length, mass, time, current, temperature, amount, luminousIntensity); + + Assert.False(baseDimensions.IsDerived()); + Assert.True(derivedDimensions.IsDerived()); + } + + [Fact] + public void EqualsWorksAsExpected() { var baseDimensions1 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); var baseDimensions2 = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 6e62123e0f..2c23847bfc 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -21,6 +21,7 @@ using System; using System.Text; +using System.Linq; namespace UnitsNet { @@ -41,6 +42,18 @@ public BaseDimensions(int length, int mass, int time, int current, int temperatu LuminousIntensity = luminousIntensity; } + public bool IsBase() + { + var dimensionsArray = new int[]{Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}; + bool onlyOneEqualsOne = dimensionsArray.Where(dimension => dimension == 1).Take(2).Count() == 1; + return onlyOneEqualsOne; + } + + public bool IsDerived() + { + return !IsBase(); + } + /// public override bool Equals(object obj) { From 812dcfb017f6833aa3d28a810c2c1d2c56873d40 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 13:54:35 -0400 Subject: [PATCH 076/131] Fix for equality operator when both left and right are null --- UnitsNet.Tests/BaseDimensionsTests.cs | 5 +++++ UnitsNet.Tests/BaseUnitsTests.cs | 5 +++++ UnitsNet.Tests/UnitSystemTests.cs | 5 +++++ UnitsNet/BaseDimensions.cs | 2 +- UnitsNet/BaseUnits.cs | 2 +- UnitsNet/UnitSystem.cs | 2 +- 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 33321a7bda..2dc4c95ce8 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -80,6 +80,11 @@ public void EqualityOperatorsWorkAsExpected() Assert.False(baseDimensions2 == null); Assert.False(null == baseDimensions2); + + BaseDimensions nullBaseDimensions1 = null; + BaseDimensions nullBaseDimensions2 = null; + + Assert.True(nullBaseDimensions1 == nullBaseDimensions2); } [Fact] diff --git a/UnitsNet.Tests/BaseUnitsTests.cs b/UnitsNet.Tests/BaseUnitsTests.cs index 7bcf7229ae..6617f85f88 100644 --- a/UnitsNet.Tests/BaseUnitsTests.cs +++ b/UnitsNet.Tests/BaseUnitsTests.cs @@ -102,6 +102,11 @@ public void EqualityOperatorIsImplementedCorrectly() Assert.False(baseUnits1 == null); Assert.False(null == baseUnits1); + + BaseUnits nullBaseUnits1 = null; + BaseUnits nullBaseUnits2 = null; + + Assert.True(nullBaseUnits1 == nullBaseUnits2); } [Fact] diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index 6ffd6a6190..c6970c00e6 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -119,6 +119,11 @@ public void EqualityOperatorIsImplementedCorrectly() Assert.False(unitSystem1 == null); Assert.False(null == unitSystem1); + + UnitSystem nullUnitSystem1 = null; + UnitSystem nullUnitSystem2 = null; + + Assert.True(nullUnitSystem1 == nullUnitSystem2); } [Fact] diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index d5c8a3e002..4da59f07df 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -127,7 +127,7 @@ public BaseDimensions Divide(BaseDimensions right) /// True if equal. public static bool operator ==(BaseDimensions left, BaseDimensions right) { - return left?.Equals(right) == true; + return left is null ? right is null : left.Equals(right); } /// diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs index 196b400430..16949c0ff6 100644 --- a/UnitsNet/BaseUnits.cs +++ b/UnitsNet/BaseUnits.cs @@ -106,7 +106,7 @@ public override int GetHashCode() /// public static bool operator ==(BaseUnits left, BaseUnits right) { - return left?.Equals(right) == true; + return left is null ? right is null : left.Equals(right); } /// diff --git a/UnitsNet/UnitSystem.cs b/UnitsNet/UnitSystem.cs index 7a1c8be10c..695626b763 100644 --- a/UnitsNet/UnitSystem.cs +++ b/UnitsNet/UnitSystem.cs @@ -89,7 +89,7 @@ public bool Equals(UnitSystem other) /// public static bool operator ==(UnitSystem left, UnitSystem right) { - return left?.Equals(right) == true; + return left is null ? right is null : left.Equals(right); } /// From 53aafef774123a351b429e3d01662d65ac11c025 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 13:56:55 -0400 Subject: [PATCH 077/131] Better add test for != too, in case someone changes the != implementation --- UnitsNet.Tests/BaseDimensionsTests.cs | 5 +++++ UnitsNet.Tests/BaseUnitsTests.cs | 5 +++++ UnitsNet.Tests/UnitSystemTests.cs | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 2dc4c95ce8..26a81fad36 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -101,6 +101,11 @@ public void InequalityOperatorsWorkAsExpected() Assert.True(baseDimensions2 != null); Assert.True(null != baseDimensions2); + + BaseDimensions nullBaseDimensions1 = null; + BaseDimensions nullBaseDimensions2 = null; + + Assert.False(nullBaseDimensions1 != nullBaseDimensions2); } [Fact] diff --git a/UnitsNet.Tests/BaseUnitsTests.cs b/UnitsNet.Tests/BaseUnitsTests.cs index 6617f85f88..16dacb1630 100644 --- a/UnitsNet.Tests/BaseUnitsTests.cs +++ b/UnitsNet.Tests/BaseUnitsTests.cs @@ -129,6 +129,11 @@ public void InequalityOperatorIsImplementedCorrectly() Assert.True(baseUnits1 != null); Assert.True(null != baseUnits1); + + BaseUnits nullBaseUnits1 = null; + BaseUnits nullBaseUnits2 = null; + + Assert.False(nullBaseUnits1 != nullBaseUnits2); } [Fact] diff --git a/UnitsNet.Tests/UnitSystemTests.cs b/UnitsNet.Tests/UnitSystemTests.cs index c6970c00e6..2a52e693c5 100644 --- a/UnitsNet.Tests/UnitSystemTests.cs +++ b/UnitsNet.Tests/UnitSystemTests.cs @@ -146,6 +146,11 @@ public void InequalityOperatorIsImplementedCorrectly() Assert.True(unitSystem1 != null); Assert.True(null != unitSystem1); + + UnitSystem nullUnitSystem1 = null; + UnitSystem nullUnitSystem2 = null; + + Assert.False(nullUnitSystem1 != nullUnitSystem2); } [Fact] From 423ec39e360c399e9c21444da17153cbe37dc99d Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 14:56:26 -0400 Subject: [PATCH 078/131] Pruning generated tests --- UnitsNet.Tests/GeneratedCode/.gitignore | 4 + .../GeneratedCode/AccelerationTestsBase.g.cs | 344 --------- .../AmountOfSubstanceTestsBase.g.cs | 354 ---------- .../AmplitudeRatioTestsBase.g.cs | 259 ------- .../GeneratedCode/AngleTestsBase.g.cs | 354 ---------- .../ApparentEnergyTestsBase.g.cs | 244 ------- .../GeneratedCode/ApparentPowerTestsBase.g.cs | 254 ------- .../GeneratedCode/AreaDensityTestsBase.g.cs | 224 ------ .../AreaMomentOfInertiaTestsBase.g.cs | 274 -------- .../GeneratedCode/AreaTestsBase.g.cs | 344 --------- .../GeneratedCode/BitRateTestsBase.g.cs | 450 ------------ ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 244 ------- .../GeneratedCode/CapacitanceTestsBase.g.cs | 224 ------ .../GeneratedCode/DensityTestsBase.g.cs | 594 ---------------- .../GeneratedCode/DurationTestsBase.g.cs | 314 --------- .../DynamicViscosityTestsBase.g.cs | 274 -------- .../ElectricAdmittanceTestsBase.g.cs | 254 ------- .../ElectricChargeDensityTestsBase.g.cs | 224 ------ .../ElectricChargeTestsBase.g.cs | 224 ------ .../ElectricConductanceTestsBase.g.cs | 244 ------- .../ElectricConductivityTestsBase.g.cs | 224 ------ .../ElectricCurrentDensityTestsBase.g.cs | 224 ------ .../ElectricCurrentGradientTestsBase.g.cs | 224 ------ .../ElectricCurrentTestsBase.g.cs | 294 -------- .../GeneratedCode/ElectricFieldTestsBase.g.cs | 224 ------ .../ElectricInductanceTestsBase.g.cs | 224 ------ .../ElectricPotentialAcTestsBase.g.cs | 264 ------- .../ElectricPotentialDcTestsBase.g.cs | 264 ------- .../ElectricPotentialTestsBase.g.cs | 264 ------- .../ElectricResistanceTestsBase.g.cs | 254 ------- .../ElectricResistivityTestsBase.g.cs | 254 ------- .../GeneratedCode/EnergyTestsBase.g.cs | 434 ------------ .../GeneratedCode/EntropyTestsBase.g.cs | 284 -------- .../ForceChangeRateTestsBase.g.cs | 324 --------- .../ForcePerLengthTestsBase.g.cs | 304 -------- .../GeneratedCode/ForceTestsBase.g.cs | 314 --------- .../GeneratedCode/FrequencyTestsBase.g.cs | 294 -------- .../GeneratedCode/HeatFluxTestsBase.g.cs | 374 ---------- .../HeatTransferCoefficientTestsBase.g.cs | 234 ------- .../GeneratedCode/IlluminanceTestsBase.g.cs | 254 ------- .../GeneratedCode/IrradianceTestsBase.g.cs | 234 ------- .../GeneratedCode/IrradiationTestsBase.g.cs | 244 ------- .../KinematicViscosityTestsBase.g.cs | 294 -------- .../GeneratedCode/LapseRateTestsBase.g.cs | 224 ------ .../GeneratedCode/LinearDensityTestsBase.g.cs | 244 ------- .../GeneratedCode/LuminousFluxTestsBase.g.cs | 224 ------ .../LuminousIntensityTestsBase.g.cs | 224 ------ .../GeneratedCode/MagneticFieldTestsBase.g.cs | 224 ------ .../GeneratedCode/MagneticFluxTestsBase.g.cs | 224 ------ .../GeneratedCode/MagnetizationTestsBase.g.cs | 224 ------ .../GeneratedCode/MassFlowTestsBase.g.cs | 364 ---------- .../GeneratedCode/MassFluxTestsBase.g.cs | 234 ------- .../MassMomentOfInertiaTestsBase.g.cs | 494 ------------- .../GeneratedCode/MassTestsBase.g.cs | 434 ------------ .../GeneratedCode/MolarEnergyTestsBase.g.cs | 244 ------- .../GeneratedCode/MolarEntropyTestsBase.g.cs | 244 ------- .../GeneratedCode/MolarMassTestsBase.g.cs | 334 --------- .../GeneratedCode/MolarityTestsBase.g.cs | 294 -------- .../GeneratedCode/PermeabilityTestsBase.g.cs | 224 ------ .../GeneratedCode/PermittivityTestsBase.g.cs | 224 ------ .../GeneratedCode/PowerDensityTestsBase.g.cs | 654 ------------------ .../GeneratedCode/PowerRatioTestsBase.g.cs | 239 ------- .../GeneratedCode/PowerTestsBase.g.cs | 390 ----------- .../PressureChangeRateTestsBase.g.cs | 254 ------- .../GeneratedCode/PressureTestsBase.g.cs | 584 ---------------- .../GeneratedCode/RatioTestsBase.g.cs | 274 -------- .../ReactiveEnergyTestsBase.g.cs | 244 ------- .../GeneratedCode/ReactivePowerTestsBase.g.cs | 254 ------- .../RotationalAccelerationTestsBase.g.cs | 244 ------- .../RotationalSpeedTestsBase.g.cs | 344 --------- ...RotationalStiffnessPerLengthTestsBase.g.cs | 244 ------- .../RotationalStiffnessTestsBase.g.cs | 244 ------- .../GeneratedCode/SolidAngleTestsBase.g.cs | 224 ------ .../SpecificEnergyTestsBase.g.cs | 294 -------- .../SpecificEntropyTestsBase.g.cs | 294 -------- .../SpecificVolumeTestsBase.g.cs | 234 ------- .../SpecificWeightTestsBase.g.cs | 384 ---------- .../GeneratedCode/SpeedTestsBase.g.cs | 534 -------------- .../TemperatureChangeRateTestsBase.g.cs | 314 --------- .../TemperatureDeltaTestsBase.g.cs | 294 -------- .../GeneratedCode/TemperatureTestsBase.g.cs | 282 -------- .../ThermalConductivityTestsBase.g.cs | 234 ------- .../ThermalResistanceTestsBase.g.cs | 264 ------- .../GeneratedCode/TorqueTestsBase.g.cs | 424 ------------ .../GeneratedCode/VitaminATestsBase.g.cs | 224 ------ .../GeneratedCode/VolumeFlowTestsBase.g.cs | 474 ------------- .../GeneratedCode/VolumeTestsBase.g.cs | 634 ----------------- 87 files changed, 4 insertions(+), 25754 deletions(-) create mode 100644 UnitsNet.Tests/GeneratedCode/.gitignore delete mode 100644 UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs delete mode 100644 UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs diff --git a/UnitsNet.Tests/GeneratedCode/.gitignore b/UnitsNet.Tests/GeneratedCode/.gitignore new file mode 100644 index 0000000000..6dd350f428 --- /dev/null +++ b/UnitsNet.Tests/GeneratedCode/.gitignore @@ -0,0 +1,4 @@ +*.g.cs +!InformationTestsBase.g.cs +!LengthTestsBase.g.cs +!LevelTestsBase.g.cs diff --git a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs deleted file mode 100644 index a2265bb678..0000000000 --- a/UnitsNet.Tests/GeneratedCode/AccelerationTestsBase.g.cs +++ /dev/null @@ -1,344 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Acceleration. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class AccelerationTestsBase - { - protected abstract double CentimetersPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double DecimetersPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double FeetPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double InchesPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double KilometersPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double KnotsPerHourInOneMeterPerSecondSquared { get; } - protected abstract double KnotsPerMinuteInOneMeterPerSecondSquared { get; } - protected abstract double KnotsPerSecondInOneMeterPerSecondSquared { get; } - protected abstract double MetersPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double MicrometersPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double MillimetersPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double NanometersPerSecondSquaredInOneMeterPerSecondSquared { get; } - protected abstract double StandardGravityInOneMeterPerSecondSquared { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentimetersPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double DecimetersPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double FeetPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double InchesPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double KilometersPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double KnotsPerHourTolerance { get { return 1e-5; } } - protected virtual double KnotsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double KnotsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MetersPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double MicrometersPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double MillimetersPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double NanometersPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double StandardGravityTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Acceleration((double)0.0, AccelerationUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Acceleration(double.PositiveInfinity, AccelerationUnit.MeterPerSecondSquared)); - Assert.Throws(() => new Acceleration(double.NegativeInfinity, AccelerationUnit.MeterPerSecondSquared)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Acceleration(double.NaN, AccelerationUnit.MeterPerSecondSquared)); - } - - [Fact] - public void MeterPerSecondSquaredToAccelerationUnits() - { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - AssertEx.EqualTolerance(CentimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.CentimetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(DecimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.DecimetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(FeetPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.FeetPerSecondSquared, FeetPerSecondSquaredTolerance); - AssertEx.EqualTolerance(InchesPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.InchesPerSecondSquared, InchesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(KilometersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.KilometersPerSecondSquared, KilometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(KnotsPerHourInOneMeterPerSecondSquared, meterpersecondsquared.KnotsPerHour, KnotsPerHourTolerance); - AssertEx.EqualTolerance(KnotsPerMinuteInOneMeterPerSecondSquared, meterpersecondsquared.KnotsPerMinute, KnotsPerMinuteTolerance); - AssertEx.EqualTolerance(KnotsPerSecondInOneMeterPerSecondSquared, meterpersecondsquared.KnotsPerSecond, KnotsPerSecondTolerance); - AssertEx.EqualTolerance(MetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(MicrometersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.MicrometersPerSecondSquared, MicrometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(MillimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.MillimetersPerSecondSquared, MillimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(NanometersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.NanometersPerSecondSquared, NanometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(StandardGravityInOneMeterPerSecondSquared, meterpersecondsquared.StandardGravity, StandardGravityTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.CentimeterPerSecondSquared).CentimetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.DecimeterPerSecondSquared).DecimetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.FootPerSecondSquared).FeetPerSecondSquared, FeetPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.InchPerSecondSquared).InchesPerSecondSquared, InchesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KilometerPerSecondSquared).KilometersPerSecondSquared, KilometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerHour).KnotsPerHour, KnotsPerHourTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerMinute).KnotsPerMinute, KnotsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.KnotPerSecond).KnotsPerSecond, KnotsPerSecondTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MeterPerSecondSquared).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MicrometerPerSecondSquared).MicrometersPerSecondSquared, MicrometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.MillimeterPerSecondSquared).MillimetersPerSecondSquared, MillimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.NanometerPerSecondSquared).NanometersPerSecondSquared, NanometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.From(1, AccelerationUnit.StandardGravity).StandardGravity, StandardGravityTolerance); - } - - [Fact] - public void FromMetersPerSecondSquared_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.PositiveInfinity)); - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NegativeInfinity)); - } - - [Fact] - public void FromMetersPerSecondSquared_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Acceleration.FromMetersPerSecondSquared(double.NaN)); - } - - [Fact] - public void As() - { - var meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - AssertEx.EqualTolerance(CentimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.CentimeterPerSecondSquared), CentimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(DecimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.DecimeterPerSecondSquared), DecimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(FeetPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.FootPerSecondSquared), FeetPerSecondSquaredTolerance); - AssertEx.EqualTolerance(InchesPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.InchPerSecondSquared), InchesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(KilometersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.KilometerPerSecondSquared), KilometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(KnotsPerHourInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.KnotPerHour), KnotsPerHourTolerance); - AssertEx.EqualTolerance(KnotsPerMinuteInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.KnotPerMinute), KnotsPerMinuteTolerance); - AssertEx.EqualTolerance(KnotsPerSecondInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.KnotPerSecond), KnotsPerSecondTolerance); - AssertEx.EqualTolerance(MetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.MeterPerSecondSquared), MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(MicrometersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.MicrometerPerSecondSquared), MicrometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(MillimetersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.MillimeterPerSecondSquared), MillimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(NanometersPerSecondSquaredInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.NanometerPerSecondSquared), NanometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(StandardGravityInOneMeterPerSecondSquared, meterpersecondsquared.As(AccelerationUnit.StandardGravity), StandardGravityTolerance); - } - - [Fact] - public void ToUnit() - { - var meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - - var centimeterpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.CentimeterPerSecondSquared); - AssertEx.EqualTolerance(CentimetersPerSecondSquaredInOneMeterPerSecondSquared, (double)centimeterpersecondsquaredQuantity.Value, CentimetersPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.CentimeterPerSecondSquared, centimeterpersecondsquaredQuantity.Unit); - - var decimeterpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.DecimeterPerSecondSquared); - AssertEx.EqualTolerance(DecimetersPerSecondSquaredInOneMeterPerSecondSquared, (double)decimeterpersecondsquaredQuantity.Value, DecimetersPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.DecimeterPerSecondSquared, decimeterpersecondsquaredQuantity.Unit); - - var footpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.FootPerSecondSquared); - AssertEx.EqualTolerance(FeetPerSecondSquaredInOneMeterPerSecondSquared, (double)footpersecondsquaredQuantity.Value, FeetPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.FootPerSecondSquared, footpersecondsquaredQuantity.Unit); - - var inchpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.InchPerSecondSquared); - AssertEx.EqualTolerance(InchesPerSecondSquaredInOneMeterPerSecondSquared, (double)inchpersecondsquaredQuantity.Value, InchesPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.InchPerSecondSquared, inchpersecondsquaredQuantity.Unit); - - var kilometerpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.KilometerPerSecondSquared); - AssertEx.EqualTolerance(KilometersPerSecondSquaredInOneMeterPerSecondSquared, (double)kilometerpersecondsquaredQuantity.Value, KilometersPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.KilometerPerSecondSquared, kilometerpersecondsquaredQuantity.Unit); - - var knotperhourQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.KnotPerHour); - AssertEx.EqualTolerance(KnotsPerHourInOneMeterPerSecondSquared, (double)knotperhourQuantity.Value, KnotsPerHourTolerance); - Assert.Equal(AccelerationUnit.KnotPerHour, knotperhourQuantity.Unit); - - var knotperminuteQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.KnotPerMinute); - AssertEx.EqualTolerance(KnotsPerMinuteInOneMeterPerSecondSquared, (double)knotperminuteQuantity.Value, KnotsPerMinuteTolerance); - Assert.Equal(AccelerationUnit.KnotPerMinute, knotperminuteQuantity.Unit); - - var knotpersecondQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.KnotPerSecond); - AssertEx.EqualTolerance(KnotsPerSecondInOneMeterPerSecondSquared, (double)knotpersecondQuantity.Value, KnotsPerSecondTolerance); - Assert.Equal(AccelerationUnit.KnotPerSecond, knotpersecondQuantity.Unit); - - var meterpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.MeterPerSecondSquared); - AssertEx.EqualTolerance(MetersPerSecondSquaredInOneMeterPerSecondSquared, (double)meterpersecondsquaredQuantity.Value, MetersPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.MeterPerSecondSquared, meterpersecondsquaredQuantity.Unit); - - var micrometerpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.MicrometerPerSecondSquared); - AssertEx.EqualTolerance(MicrometersPerSecondSquaredInOneMeterPerSecondSquared, (double)micrometerpersecondsquaredQuantity.Value, MicrometersPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.MicrometerPerSecondSquared, micrometerpersecondsquaredQuantity.Unit); - - var millimeterpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.MillimeterPerSecondSquared); - AssertEx.EqualTolerance(MillimetersPerSecondSquaredInOneMeterPerSecondSquared, (double)millimeterpersecondsquaredQuantity.Value, MillimetersPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.MillimeterPerSecondSquared, millimeterpersecondsquaredQuantity.Unit); - - var nanometerpersecondsquaredQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.NanometerPerSecondSquared); - AssertEx.EqualTolerance(NanometersPerSecondSquaredInOneMeterPerSecondSquared, (double)nanometerpersecondsquaredQuantity.Value, NanometersPerSecondSquaredTolerance); - Assert.Equal(AccelerationUnit.NanometerPerSecondSquared, nanometerpersecondsquaredQuantity.Unit); - - var standardgravityQuantity = meterpersecondsquared.ToUnit(AccelerationUnit.StandardGravity); - AssertEx.EqualTolerance(StandardGravityInOneMeterPerSecondSquared, (double)standardgravityQuantity.Value, StandardGravityTolerance); - Assert.Equal(AccelerationUnit.StandardGravity, standardgravityQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - AssertEx.EqualTolerance(1, Acceleration.FromCentimetersPerSecondSquared(meterpersecondsquared.CentimetersPerSecondSquared).MetersPerSecondSquared, CentimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromDecimetersPerSecondSquared(meterpersecondsquared.DecimetersPerSecondSquared).MetersPerSecondSquared, DecimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromFeetPerSecondSquared(meterpersecondsquared.FeetPerSecondSquared).MetersPerSecondSquared, FeetPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromInchesPerSecondSquared(meterpersecondsquared.InchesPerSecondSquared).MetersPerSecondSquared, InchesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKilometersPerSecondSquared(meterpersecondsquared.KilometersPerSecondSquared).MetersPerSecondSquared, KilometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerHour(meterpersecondsquared.KnotsPerHour).MetersPerSecondSquared, KnotsPerHourTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerMinute(meterpersecondsquared.KnotsPerMinute).MetersPerSecondSquared, KnotsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromKnotsPerSecond(meterpersecondsquared.KnotsPerSecond).MetersPerSecondSquared, KnotsPerSecondTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromMetersPerSecondSquared(meterpersecondsquared.MetersPerSecondSquared).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromMicrometersPerSecondSquared(meterpersecondsquared.MicrometersPerSecondSquared).MetersPerSecondSquared, MicrometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromMillimetersPerSecondSquared(meterpersecondsquared.MillimetersPerSecondSquared).MetersPerSecondSquared, MillimetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromNanometersPerSecondSquared(meterpersecondsquared.NanometersPerSecondSquared).MetersPerSecondSquared, NanometersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, Acceleration.FromStandardGravity(meterpersecondsquared.StandardGravity).MetersPerSecondSquared, StandardGravityTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Acceleration v = Acceleration.FromMetersPerSecondSquared(1); - AssertEx.EqualTolerance(-1, -v.MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (Acceleration.FromMetersPerSecondSquared(3)-v).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (v + v).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(10, (v*10).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(10, (10*v).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (Acceleration.FromMetersPerSecondSquared(10)/5).MetersPerSecondSquared, MetersPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, Acceleration.FromMetersPerSecondSquared(10)/Acceleration.FromMetersPerSecondSquared(5), MetersPerSecondSquaredTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Acceleration oneMeterPerSecondSquared = Acceleration.FromMetersPerSecondSquared(1); - Acceleration twoMetersPerSecondSquared = Acceleration.FromMetersPerSecondSquared(2); - - Assert.True(oneMeterPerSecondSquared < twoMetersPerSecondSquared); - Assert.True(oneMeterPerSecondSquared <= twoMetersPerSecondSquared); - Assert.True(twoMetersPerSecondSquared > oneMeterPerSecondSquared); - Assert.True(twoMetersPerSecondSquared >= oneMeterPerSecondSquared); - - Assert.False(oneMeterPerSecondSquared > twoMetersPerSecondSquared); - Assert.False(oneMeterPerSecondSquared >= twoMetersPerSecondSquared); - Assert.False(twoMetersPerSecondSquared < oneMeterPerSecondSquared); - Assert.False(twoMetersPerSecondSquared <= oneMeterPerSecondSquared); - } - - [Fact] - public void CompareToIsImplemented() - { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - Assert.Equal(0, meterpersecondsquared.CompareTo(meterpersecondsquared)); - Assert.True(meterpersecondsquared.CompareTo(Acceleration.Zero) > 0); - Assert.True(Acceleration.Zero.CompareTo(meterpersecondsquared) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - Assert.Throws(() => meterpersecondsquared.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - Assert.Throws(() => meterpersecondsquared.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Acceleration v = Acceleration.FromMetersPerSecondSquared(1); - Assert.True(v.Equals(Acceleration.FromMetersPerSecondSquared(1), MetersPerSecondSquaredTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Acceleration.Zero, MetersPerSecondSquaredTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - Assert.False(meterpersecondsquared.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Acceleration meterpersecondsquared = Acceleration.FromMetersPerSecondSquared(1); - Assert.False(meterpersecondsquared.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(AccelerationUnit.Undefined, Acceleration.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(AccelerationUnit)).Cast(); - foreach(var unit in units) - { - if(unit == AccelerationUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs deleted file mode 100644 index e72fb73a08..0000000000 --- a/UnitsNet.Tests/GeneratedCode/AmountOfSubstanceTestsBase.g.cs +++ /dev/null @@ -1,354 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of AmountOfSubstance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class AmountOfSubstanceTestsBase - { - protected abstract double CentimolesInOneMole { get; } - protected abstract double CentipoundMolesInOneMole { get; } - protected abstract double DecimolesInOneMole { get; } - protected abstract double DecipoundMolesInOneMole { get; } - protected abstract double KilomolesInOneMole { get; } - protected abstract double KilopoundMolesInOneMole { get; } - protected abstract double MicromolesInOneMole { get; } - protected abstract double MicropoundMolesInOneMole { get; } - protected abstract double MillimolesInOneMole { get; } - protected abstract double MillipoundMolesInOneMole { get; } - protected abstract double MolesInOneMole { get; } - protected abstract double NanomolesInOneMole { get; } - protected abstract double NanopoundMolesInOneMole { get; } - protected abstract double PoundMolesInOneMole { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentimolesTolerance { get { return 1e-5; } } - protected virtual double CentipoundMolesTolerance { get { return 1e-5; } } - protected virtual double DecimolesTolerance { get { return 1e-5; } } - protected virtual double DecipoundMolesTolerance { get { return 1e-5; } } - protected virtual double KilomolesTolerance { get { return 1e-5; } } - protected virtual double KilopoundMolesTolerance { get { return 1e-5; } } - protected virtual double MicromolesTolerance { get { return 1e-5; } } - protected virtual double MicropoundMolesTolerance { get { return 1e-5; } } - protected virtual double MillimolesTolerance { get { return 1e-5; } } - protected virtual double MillipoundMolesTolerance { get { return 1e-5; } } - protected virtual double MolesTolerance { get { return 1e-5; } } - protected virtual double NanomolesTolerance { get { return 1e-5; } } - protected virtual double NanopoundMolesTolerance { get { return 1e-5; } } - protected virtual double PoundMolesTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new AmountOfSubstance((double)0.0, AmountOfSubstanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new AmountOfSubstance(double.PositiveInfinity, AmountOfSubstanceUnit.Mole)); - Assert.Throws(() => new AmountOfSubstance(double.NegativeInfinity, AmountOfSubstanceUnit.Mole)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new AmountOfSubstance(double.NaN, AmountOfSubstanceUnit.Mole)); - } - - [Fact] - public void MoleToAmountOfSubstanceUnits() - { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - AssertEx.EqualTolerance(CentimolesInOneMole, mole.Centimoles, CentimolesTolerance); - AssertEx.EqualTolerance(CentipoundMolesInOneMole, mole.CentipoundMoles, CentipoundMolesTolerance); - AssertEx.EqualTolerance(DecimolesInOneMole, mole.Decimoles, DecimolesTolerance); - AssertEx.EqualTolerance(DecipoundMolesInOneMole, mole.DecipoundMoles, DecipoundMolesTolerance); - AssertEx.EqualTolerance(KilomolesInOneMole, mole.Kilomoles, KilomolesTolerance); - AssertEx.EqualTolerance(KilopoundMolesInOneMole, mole.KilopoundMoles, KilopoundMolesTolerance); - AssertEx.EqualTolerance(MicromolesInOneMole, mole.Micromoles, MicromolesTolerance); - AssertEx.EqualTolerance(MicropoundMolesInOneMole, mole.MicropoundMoles, MicropoundMolesTolerance); - AssertEx.EqualTolerance(MillimolesInOneMole, mole.Millimoles, MillimolesTolerance); - AssertEx.EqualTolerance(MillipoundMolesInOneMole, mole.MillipoundMoles, MillipoundMolesTolerance); - AssertEx.EqualTolerance(MolesInOneMole, mole.Moles, MolesTolerance); - AssertEx.EqualTolerance(NanomolesInOneMole, mole.Nanomoles, NanomolesTolerance); - AssertEx.EqualTolerance(NanopoundMolesInOneMole, mole.NanopoundMoles, NanopoundMolesTolerance); - AssertEx.EqualTolerance(PoundMolesInOneMole, mole.PoundMoles, PoundMolesTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Centimole).Centimoles, CentimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.CentipoundMole).CentipoundMoles, CentipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Decimole).Decimoles, DecimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.DecipoundMole).DecipoundMoles, DecipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Kilomole).Kilomoles, KilomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.KilopoundMole).KilopoundMoles, KilopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Micromole).Micromoles, MicromolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.MicropoundMole).MicropoundMoles, MicropoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Millimole).Millimoles, MillimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.MillipoundMole).MillipoundMoles, MillipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Mole).Moles, MolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.Nanomole).Nanomoles, NanomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.NanopoundMole).NanopoundMoles, NanopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.From(1, AmountOfSubstanceUnit.PoundMole).PoundMoles, PoundMolesTolerance); - } - - [Fact] - public void FromMoles_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => AmountOfSubstance.FromMoles(double.PositiveInfinity)); - Assert.Throws(() => AmountOfSubstance.FromMoles(double.NegativeInfinity)); - } - - [Fact] - public void FromMoles_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => AmountOfSubstance.FromMoles(double.NaN)); - } - - [Fact] - public void As() - { - var mole = AmountOfSubstance.FromMoles(1); - AssertEx.EqualTolerance(CentimolesInOneMole, mole.As(AmountOfSubstanceUnit.Centimole), CentimolesTolerance); - AssertEx.EqualTolerance(CentipoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.CentipoundMole), CentipoundMolesTolerance); - AssertEx.EqualTolerance(DecimolesInOneMole, mole.As(AmountOfSubstanceUnit.Decimole), DecimolesTolerance); - AssertEx.EqualTolerance(DecipoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.DecipoundMole), DecipoundMolesTolerance); - AssertEx.EqualTolerance(KilomolesInOneMole, mole.As(AmountOfSubstanceUnit.Kilomole), KilomolesTolerance); - AssertEx.EqualTolerance(KilopoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.KilopoundMole), KilopoundMolesTolerance); - AssertEx.EqualTolerance(MicromolesInOneMole, mole.As(AmountOfSubstanceUnit.Micromole), MicromolesTolerance); - AssertEx.EqualTolerance(MicropoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.MicropoundMole), MicropoundMolesTolerance); - AssertEx.EqualTolerance(MillimolesInOneMole, mole.As(AmountOfSubstanceUnit.Millimole), MillimolesTolerance); - AssertEx.EqualTolerance(MillipoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.MillipoundMole), MillipoundMolesTolerance); - AssertEx.EqualTolerance(MolesInOneMole, mole.As(AmountOfSubstanceUnit.Mole), MolesTolerance); - AssertEx.EqualTolerance(NanomolesInOneMole, mole.As(AmountOfSubstanceUnit.Nanomole), NanomolesTolerance); - AssertEx.EqualTolerance(NanopoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.NanopoundMole), NanopoundMolesTolerance); - AssertEx.EqualTolerance(PoundMolesInOneMole, mole.As(AmountOfSubstanceUnit.PoundMole), PoundMolesTolerance); - } - - [Fact] - public void ToUnit() - { - var mole = AmountOfSubstance.FromMoles(1); - - var centimoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Centimole); - AssertEx.EqualTolerance(CentimolesInOneMole, (double)centimoleQuantity.Value, CentimolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.Centimole, centimoleQuantity.Unit); - - var centipoundmoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.CentipoundMole); - AssertEx.EqualTolerance(CentipoundMolesInOneMole, (double)centipoundmoleQuantity.Value, CentipoundMolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.CentipoundMole, centipoundmoleQuantity.Unit); - - var decimoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Decimole); - AssertEx.EqualTolerance(DecimolesInOneMole, (double)decimoleQuantity.Value, DecimolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.Decimole, decimoleQuantity.Unit); - - var decipoundmoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.DecipoundMole); - AssertEx.EqualTolerance(DecipoundMolesInOneMole, (double)decipoundmoleQuantity.Value, DecipoundMolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.DecipoundMole, decipoundmoleQuantity.Unit); - - var kilomoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Kilomole); - AssertEx.EqualTolerance(KilomolesInOneMole, (double)kilomoleQuantity.Value, KilomolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.Kilomole, kilomoleQuantity.Unit); - - var kilopoundmoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.KilopoundMole); - AssertEx.EqualTolerance(KilopoundMolesInOneMole, (double)kilopoundmoleQuantity.Value, KilopoundMolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.KilopoundMole, kilopoundmoleQuantity.Unit); - - var micromoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Micromole); - AssertEx.EqualTolerance(MicromolesInOneMole, (double)micromoleQuantity.Value, MicromolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.Micromole, micromoleQuantity.Unit); - - var micropoundmoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.MicropoundMole); - AssertEx.EqualTolerance(MicropoundMolesInOneMole, (double)micropoundmoleQuantity.Value, MicropoundMolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.MicropoundMole, micropoundmoleQuantity.Unit); - - var millimoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Millimole); - AssertEx.EqualTolerance(MillimolesInOneMole, (double)millimoleQuantity.Value, MillimolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.Millimole, millimoleQuantity.Unit); - - var millipoundmoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.MillipoundMole); - AssertEx.EqualTolerance(MillipoundMolesInOneMole, (double)millipoundmoleQuantity.Value, MillipoundMolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.MillipoundMole, millipoundmoleQuantity.Unit); - - var moleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Mole); - AssertEx.EqualTolerance(MolesInOneMole, (double)moleQuantity.Value, MolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.Mole, moleQuantity.Unit); - - var nanomoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.Nanomole); - AssertEx.EqualTolerance(NanomolesInOneMole, (double)nanomoleQuantity.Value, NanomolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.Nanomole, nanomoleQuantity.Unit); - - var nanopoundmoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.NanopoundMole); - AssertEx.EqualTolerance(NanopoundMolesInOneMole, (double)nanopoundmoleQuantity.Value, NanopoundMolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.NanopoundMole, nanopoundmoleQuantity.Unit); - - var poundmoleQuantity = mole.ToUnit(AmountOfSubstanceUnit.PoundMole); - AssertEx.EqualTolerance(PoundMolesInOneMole, (double)poundmoleQuantity.Value, PoundMolesTolerance); - Assert.Equal(AmountOfSubstanceUnit.PoundMole, poundmoleQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromCentimoles(mole.Centimoles).Moles, CentimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromCentipoundMoles(mole.CentipoundMoles).Moles, CentipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromDecimoles(mole.Decimoles).Moles, DecimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromDecipoundMoles(mole.DecipoundMoles).Moles, DecipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromKilomoles(mole.Kilomoles).Moles, KilomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromKilopoundMoles(mole.KilopoundMoles).Moles, KilopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMicromoles(mole.Micromoles).Moles, MicromolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMicropoundMoles(mole.MicropoundMoles).Moles, MicropoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMillimoles(mole.Millimoles).Moles, MillimolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMillipoundMoles(mole.MillipoundMoles).Moles, MillipoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromMoles(mole.Moles).Moles, MolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromNanomoles(mole.Nanomoles).Moles, NanomolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromNanopoundMoles(mole.NanopoundMoles).Moles, NanopoundMolesTolerance); - AssertEx.EqualTolerance(1, AmountOfSubstance.FromPoundMoles(mole.PoundMoles).Moles, PoundMolesTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - AmountOfSubstance v = AmountOfSubstance.FromMoles(1); - AssertEx.EqualTolerance(-1, -v.Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (AmountOfSubstance.FromMoles(3)-v).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (v + v).Moles, MolesTolerance); - AssertEx.EqualTolerance(10, (v*10).Moles, MolesTolerance); - AssertEx.EqualTolerance(10, (10*v).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, (AmountOfSubstance.FromMoles(10)/5).Moles, MolesTolerance); - AssertEx.EqualTolerance(2, AmountOfSubstance.FromMoles(10)/AmountOfSubstance.FromMoles(5), MolesTolerance); - } - - [Fact] - public void ComparisonOperators() - { - AmountOfSubstance oneMole = AmountOfSubstance.FromMoles(1); - AmountOfSubstance twoMoles = AmountOfSubstance.FromMoles(2); - - Assert.True(oneMole < twoMoles); - Assert.True(oneMole <= twoMoles); - Assert.True(twoMoles > oneMole); - Assert.True(twoMoles >= oneMole); - - Assert.False(oneMole > twoMoles); - Assert.False(oneMole >= twoMoles); - Assert.False(twoMoles < oneMole); - Assert.False(twoMoles <= oneMole); - } - - [Fact] - public void CompareToIsImplemented() - { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - Assert.Equal(0, mole.CompareTo(mole)); - Assert.True(mole.CompareTo(AmountOfSubstance.Zero) > 0); - Assert.True(AmountOfSubstance.Zero.CompareTo(mole) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - Assert.Throws(() => mole.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - Assert.Throws(() => mole.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - AmountOfSubstance v = AmountOfSubstance.FromMoles(1); - Assert.True(v.Equals(AmountOfSubstance.FromMoles(1), MolesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AmountOfSubstance.Zero, MolesTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - Assert.False(mole.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - AmountOfSubstance mole = AmountOfSubstance.FromMoles(1); - Assert.False(mole.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(AmountOfSubstanceUnit.Undefined, AmountOfSubstance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(AmountOfSubstanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == AmountOfSubstanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs deleted file mode 100644 index cfdaee8eca..0000000000 --- a/UnitsNet.Tests/GeneratedCode/AmplitudeRatioTestsBase.g.cs +++ /dev/null @@ -1,259 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of AmplitudeRatio. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class AmplitudeRatioTestsBase - { - protected abstract double DecibelMicrovoltsInOneDecibelVolt { get; } - protected abstract double DecibelMillivoltsInOneDecibelVolt { get; } - protected abstract double DecibelsUnloadedInOneDecibelVolt { get; } - protected abstract double DecibelVoltsInOneDecibelVolt { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DecibelMicrovoltsTolerance { get { return 1e-5; } } - protected virtual double DecibelMillivoltsTolerance { get { return 1e-5; } } - protected virtual double DecibelsUnloadedTolerance { get { return 1e-5; } } - protected virtual double DecibelVoltsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new AmplitudeRatio((double)0.0, AmplitudeRatioUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new AmplitudeRatio(double.PositiveInfinity, AmplitudeRatioUnit.DecibelVolt)); - Assert.Throws(() => new AmplitudeRatio(double.NegativeInfinity, AmplitudeRatioUnit.DecibelVolt)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new AmplitudeRatio(double.NaN, AmplitudeRatioUnit.DecibelVolt)); - } - - [Fact] - public void DecibelVoltToAmplitudeRatioUnits() - { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - AssertEx.EqualTolerance(DecibelMicrovoltsInOneDecibelVolt, decibelvolt.DecibelMicrovolts, DecibelMicrovoltsTolerance); - AssertEx.EqualTolerance(DecibelMillivoltsInOneDecibelVolt, decibelvolt.DecibelMillivolts, DecibelMillivoltsTolerance); - AssertEx.EqualTolerance(DecibelsUnloadedInOneDecibelVolt, decibelvolt.DecibelsUnloaded, DecibelsUnloadedTolerance); - AssertEx.EqualTolerance(DecibelVoltsInOneDecibelVolt, decibelvolt.DecibelVolts, DecibelVoltsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelMicrovolt).DecibelMicrovolts, DecibelMicrovoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelMillivolt).DecibelMillivolts, DecibelMillivoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelUnloaded).DecibelsUnloaded, DecibelsUnloadedTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.From(1, AmplitudeRatioUnit.DecibelVolt).DecibelVolts, DecibelVoltsTolerance); - } - - [Fact] - public void FromDecibelVolts_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.PositiveInfinity)); - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NegativeInfinity)); - } - - [Fact] - public void FromDecibelVolts_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => AmplitudeRatio.FromDecibelVolts(double.NaN)); - } - - [Fact] - public void As() - { - var decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - AssertEx.EqualTolerance(DecibelMicrovoltsInOneDecibelVolt, decibelvolt.As(AmplitudeRatioUnit.DecibelMicrovolt), DecibelMicrovoltsTolerance); - AssertEx.EqualTolerance(DecibelMillivoltsInOneDecibelVolt, decibelvolt.As(AmplitudeRatioUnit.DecibelMillivolt), DecibelMillivoltsTolerance); - AssertEx.EqualTolerance(DecibelsUnloadedInOneDecibelVolt, decibelvolt.As(AmplitudeRatioUnit.DecibelUnloaded), DecibelsUnloadedTolerance); - AssertEx.EqualTolerance(DecibelVoltsInOneDecibelVolt, decibelvolt.As(AmplitudeRatioUnit.DecibelVolt), DecibelVoltsTolerance); - } - - [Fact] - public void ToUnit() - { - var decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - - var decibelmicrovoltQuantity = decibelvolt.ToUnit(AmplitudeRatioUnit.DecibelMicrovolt); - AssertEx.EqualTolerance(DecibelMicrovoltsInOneDecibelVolt, (double)decibelmicrovoltQuantity.Value, DecibelMicrovoltsTolerance); - Assert.Equal(AmplitudeRatioUnit.DecibelMicrovolt, decibelmicrovoltQuantity.Unit); - - var decibelmillivoltQuantity = decibelvolt.ToUnit(AmplitudeRatioUnit.DecibelMillivolt); - AssertEx.EqualTolerance(DecibelMillivoltsInOneDecibelVolt, (double)decibelmillivoltQuantity.Value, DecibelMillivoltsTolerance); - Assert.Equal(AmplitudeRatioUnit.DecibelMillivolt, decibelmillivoltQuantity.Unit); - - var decibelunloadedQuantity = decibelvolt.ToUnit(AmplitudeRatioUnit.DecibelUnloaded); - AssertEx.EqualTolerance(DecibelsUnloadedInOneDecibelVolt, (double)decibelunloadedQuantity.Value, DecibelsUnloadedTolerance); - Assert.Equal(AmplitudeRatioUnit.DecibelUnloaded, decibelunloadedQuantity.Unit); - - var decibelvoltQuantity = decibelvolt.ToUnit(AmplitudeRatioUnit.DecibelVolt); - AssertEx.EqualTolerance(DecibelVoltsInOneDecibelVolt, (double)decibelvoltQuantity.Value, DecibelVoltsTolerance); - Assert.Equal(AmplitudeRatioUnit.DecibelVolt, decibelvoltQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMicrovolts(decibelvolt.DecibelMicrovolts).DecibelVolts, DecibelMicrovoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMillivolts(decibelvolt.DecibelMillivolts).DecibelVolts, DecibelMillivoltsTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelsUnloaded(decibelvolt.DecibelsUnloaded).DecibelVolts, DecibelsUnloadedTolerance); - AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelVolts(decibelvolt.DecibelVolts).DecibelVolts, DecibelVoltsTolerance); - } - - [Fact] - public void LogarithmicArithmeticOperators() - { - AmplitudeRatio v = AmplitudeRatio.FromDecibelVolts(40); - AssertEx.EqualTolerance(-40, -v.DecibelVolts, DecibelVoltsTolerance); - AssertLogarithmicAddition(); - AssertLogarithmicSubtraction(); - AssertEx.EqualTolerance(50, (v*10).DecibelVolts, DecibelVoltsTolerance); - AssertEx.EqualTolerance(50, (10*v).DecibelVolts, DecibelVoltsTolerance); - AssertEx.EqualTolerance(35, (v/5).DecibelVolts, DecibelVoltsTolerance); - AssertEx.EqualTolerance(35, v/AmplitudeRatio.FromDecibelVolts(5), DecibelVoltsTolerance); - } - - protected abstract void AssertLogarithmicAddition(); - - protected abstract void AssertLogarithmicSubtraction(); - - - [Fact] - public void ComparisonOperators() - { - AmplitudeRatio oneDecibelVolt = AmplitudeRatio.FromDecibelVolts(1); - AmplitudeRatio twoDecibelVolts = AmplitudeRatio.FromDecibelVolts(2); - - Assert.True(oneDecibelVolt < twoDecibelVolts); - Assert.True(oneDecibelVolt <= twoDecibelVolts); - Assert.True(twoDecibelVolts > oneDecibelVolt); - Assert.True(twoDecibelVolts >= oneDecibelVolt); - - Assert.False(oneDecibelVolt > twoDecibelVolts); - Assert.False(oneDecibelVolt >= twoDecibelVolts); - Assert.False(twoDecibelVolts < oneDecibelVolt); - Assert.False(twoDecibelVolts <= oneDecibelVolt); - } - - [Fact] - public void CompareToIsImplemented() - { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - Assert.Equal(0, decibelvolt.CompareTo(decibelvolt)); - Assert.True(decibelvolt.CompareTo(AmplitudeRatio.Zero) > 0); - Assert.True(AmplitudeRatio.Zero.CompareTo(decibelvolt) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - Assert.Throws(() => decibelvolt.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - Assert.Throws(() => decibelvolt.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - AmplitudeRatio v = AmplitudeRatio.FromDecibelVolts(1); - Assert.True(v.Equals(AmplitudeRatio.FromDecibelVolts(1), DecibelVoltsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AmplitudeRatio.Zero, DecibelVoltsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - Assert.False(decibelvolt.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); - Assert.False(decibelvolt.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(AmplitudeRatioUnit.Undefined, AmplitudeRatio.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(AmplitudeRatioUnit)).Cast(); - foreach(var unit in units) - { - if(unit == AmplitudeRatioUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs deleted file mode 100644 index 8ef19e88cc..0000000000 --- a/UnitsNet.Tests/GeneratedCode/AngleTestsBase.g.cs +++ /dev/null @@ -1,354 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Angle. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class AngleTestsBase - { - protected abstract double ArcminutesInOneDegree { get; } - protected abstract double ArcsecondsInOneDegree { get; } - protected abstract double CentiradiansInOneDegree { get; } - protected abstract double DeciradiansInOneDegree { get; } - protected abstract double DegreesInOneDegree { get; } - protected abstract double GradiansInOneDegree { get; } - protected abstract double MicrodegreesInOneDegree { get; } - protected abstract double MicroradiansInOneDegree { get; } - protected abstract double MillidegreesInOneDegree { get; } - protected abstract double MilliradiansInOneDegree { get; } - protected abstract double NanodegreesInOneDegree { get; } - protected abstract double NanoradiansInOneDegree { get; } - protected abstract double RadiansInOneDegree { get; } - protected abstract double RevolutionsInOneDegree { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double ArcminutesTolerance { get { return 1e-5; } } - protected virtual double ArcsecondsTolerance { get { return 1e-5; } } - protected virtual double CentiradiansTolerance { get { return 1e-5; } } - protected virtual double DeciradiansTolerance { get { return 1e-5; } } - protected virtual double DegreesTolerance { get { return 1e-5; } } - protected virtual double GradiansTolerance { get { return 1e-5; } } - protected virtual double MicrodegreesTolerance { get { return 1e-5; } } - protected virtual double MicroradiansTolerance { get { return 1e-5; } } - protected virtual double MillidegreesTolerance { get { return 1e-5; } } - protected virtual double MilliradiansTolerance { get { return 1e-5; } } - protected virtual double NanodegreesTolerance { get { return 1e-5; } } - protected virtual double NanoradiansTolerance { get { return 1e-5; } } - protected virtual double RadiansTolerance { get { return 1e-5; } } - protected virtual double RevolutionsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Angle((double)0.0, AngleUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Angle(double.PositiveInfinity, AngleUnit.Degree)); - Assert.Throws(() => new Angle(double.NegativeInfinity, AngleUnit.Degree)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Angle(double.NaN, AngleUnit.Degree)); - } - - [Fact] - public void DegreeToAngleUnits() - { - Angle degree = Angle.FromDegrees(1); - AssertEx.EqualTolerance(ArcminutesInOneDegree, degree.Arcminutes, ArcminutesTolerance); - AssertEx.EqualTolerance(ArcsecondsInOneDegree, degree.Arcseconds, ArcsecondsTolerance); - AssertEx.EqualTolerance(CentiradiansInOneDegree, degree.Centiradians, CentiradiansTolerance); - AssertEx.EqualTolerance(DeciradiansInOneDegree, degree.Deciradians, DeciradiansTolerance); - AssertEx.EqualTolerance(DegreesInOneDegree, degree.Degrees, DegreesTolerance); - AssertEx.EqualTolerance(GradiansInOneDegree, degree.Gradians, GradiansTolerance); - AssertEx.EqualTolerance(MicrodegreesInOneDegree, degree.Microdegrees, MicrodegreesTolerance); - AssertEx.EqualTolerance(MicroradiansInOneDegree, degree.Microradians, MicroradiansTolerance); - AssertEx.EqualTolerance(MillidegreesInOneDegree, degree.Millidegrees, MillidegreesTolerance); - AssertEx.EqualTolerance(MilliradiansInOneDegree, degree.Milliradians, MilliradiansTolerance); - AssertEx.EqualTolerance(NanodegreesInOneDegree, degree.Nanodegrees, NanodegreesTolerance); - AssertEx.EqualTolerance(NanoradiansInOneDegree, degree.Nanoradians, NanoradiansTolerance); - AssertEx.EqualTolerance(RadiansInOneDegree, degree.Radians, RadiansTolerance); - AssertEx.EqualTolerance(RevolutionsInOneDegree, degree.Revolutions, RevolutionsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Arcminute).Arcminutes, ArcminutesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Arcsecond).Arcseconds, ArcsecondsTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Centiradian).Centiradians, CentiradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Deciradian).Deciradians, DeciradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Degree).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Gradian).Gradians, GradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Microdegree).Microdegrees, MicrodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Microradian).Microradians, MicroradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Millidegree).Millidegrees, MillidegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Milliradian).Milliradians, MilliradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Nanodegree).Nanodegrees, NanodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Nanoradian).Nanoradians, NanoradiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Radian).Radians, RadiansTolerance); - AssertEx.EqualTolerance(1, Angle.From(1, AngleUnit.Revolution).Revolutions, RevolutionsTolerance); - } - - [Fact] - public void FromDegrees_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Angle.FromDegrees(double.PositiveInfinity)); - Assert.Throws(() => Angle.FromDegrees(double.NegativeInfinity)); - } - - [Fact] - public void FromDegrees_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Angle.FromDegrees(double.NaN)); - } - - [Fact] - public void As() - { - var degree = Angle.FromDegrees(1); - AssertEx.EqualTolerance(ArcminutesInOneDegree, degree.As(AngleUnit.Arcminute), ArcminutesTolerance); - AssertEx.EqualTolerance(ArcsecondsInOneDegree, degree.As(AngleUnit.Arcsecond), ArcsecondsTolerance); - AssertEx.EqualTolerance(CentiradiansInOneDegree, degree.As(AngleUnit.Centiradian), CentiradiansTolerance); - AssertEx.EqualTolerance(DeciradiansInOneDegree, degree.As(AngleUnit.Deciradian), DeciradiansTolerance); - AssertEx.EqualTolerance(DegreesInOneDegree, degree.As(AngleUnit.Degree), DegreesTolerance); - AssertEx.EqualTolerance(GradiansInOneDegree, degree.As(AngleUnit.Gradian), GradiansTolerance); - AssertEx.EqualTolerance(MicrodegreesInOneDegree, degree.As(AngleUnit.Microdegree), MicrodegreesTolerance); - AssertEx.EqualTolerance(MicroradiansInOneDegree, degree.As(AngleUnit.Microradian), MicroradiansTolerance); - AssertEx.EqualTolerance(MillidegreesInOneDegree, degree.As(AngleUnit.Millidegree), MillidegreesTolerance); - AssertEx.EqualTolerance(MilliradiansInOneDegree, degree.As(AngleUnit.Milliradian), MilliradiansTolerance); - AssertEx.EqualTolerance(NanodegreesInOneDegree, degree.As(AngleUnit.Nanodegree), NanodegreesTolerance); - AssertEx.EqualTolerance(NanoradiansInOneDegree, degree.As(AngleUnit.Nanoradian), NanoradiansTolerance); - AssertEx.EqualTolerance(RadiansInOneDegree, degree.As(AngleUnit.Radian), RadiansTolerance); - AssertEx.EqualTolerance(RevolutionsInOneDegree, degree.As(AngleUnit.Revolution), RevolutionsTolerance); - } - - [Fact] - public void ToUnit() - { - var degree = Angle.FromDegrees(1); - - var arcminuteQuantity = degree.ToUnit(AngleUnit.Arcminute); - AssertEx.EqualTolerance(ArcminutesInOneDegree, (double)arcminuteQuantity.Value, ArcminutesTolerance); - Assert.Equal(AngleUnit.Arcminute, arcminuteQuantity.Unit); - - var arcsecondQuantity = degree.ToUnit(AngleUnit.Arcsecond); - AssertEx.EqualTolerance(ArcsecondsInOneDegree, (double)arcsecondQuantity.Value, ArcsecondsTolerance); - Assert.Equal(AngleUnit.Arcsecond, arcsecondQuantity.Unit); - - var centiradianQuantity = degree.ToUnit(AngleUnit.Centiradian); - AssertEx.EqualTolerance(CentiradiansInOneDegree, (double)centiradianQuantity.Value, CentiradiansTolerance); - Assert.Equal(AngleUnit.Centiradian, centiradianQuantity.Unit); - - var deciradianQuantity = degree.ToUnit(AngleUnit.Deciradian); - AssertEx.EqualTolerance(DeciradiansInOneDegree, (double)deciradianQuantity.Value, DeciradiansTolerance); - Assert.Equal(AngleUnit.Deciradian, deciradianQuantity.Unit); - - var degreeQuantity = degree.ToUnit(AngleUnit.Degree); - AssertEx.EqualTolerance(DegreesInOneDegree, (double)degreeQuantity.Value, DegreesTolerance); - Assert.Equal(AngleUnit.Degree, degreeQuantity.Unit); - - var gradianQuantity = degree.ToUnit(AngleUnit.Gradian); - AssertEx.EqualTolerance(GradiansInOneDegree, (double)gradianQuantity.Value, GradiansTolerance); - Assert.Equal(AngleUnit.Gradian, gradianQuantity.Unit); - - var microdegreeQuantity = degree.ToUnit(AngleUnit.Microdegree); - AssertEx.EqualTolerance(MicrodegreesInOneDegree, (double)microdegreeQuantity.Value, MicrodegreesTolerance); - Assert.Equal(AngleUnit.Microdegree, microdegreeQuantity.Unit); - - var microradianQuantity = degree.ToUnit(AngleUnit.Microradian); - AssertEx.EqualTolerance(MicroradiansInOneDegree, (double)microradianQuantity.Value, MicroradiansTolerance); - Assert.Equal(AngleUnit.Microradian, microradianQuantity.Unit); - - var millidegreeQuantity = degree.ToUnit(AngleUnit.Millidegree); - AssertEx.EqualTolerance(MillidegreesInOneDegree, (double)millidegreeQuantity.Value, MillidegreesTolerance); - Assert.Equal(AngleUnit.Millidegree, millidegreeQuantity.Unit); - - var milliradianQuantity = degree.ToUnit(AngleUnit.Milliradian); - AssertEx.EqualTolerance(MilliradiansInOneDegree, (double)milliradianQuantity.Value, MilliradiansTolerance); - Assert.Equal(AngleUnit.Milliradian, milliradianQuantity.Unit); - - var nanodegreeQuantity = degree.ToUnit(AngleUnit.Nanodegree); - AssertEx.EqualTolerance(NanodegreesInOneDegree, (double)nanodegreeQuantity.Value, NanodegreesTolerance); - Assert.Equal(AngleUnit.Nanodegree, nanodegreeQuantity.Unit); - - var nanoradianQuantity = degree.ToUnit(AngleUnit.Nanoradian); - AssertEx.EqualTolerance(NanoradiansInOneDegree, (double)nanoradianQuantity.Value, NanoradiansTolerance); - Assert.Equal(AngleUnit.Nanoradian, nanoradianQuantity.Unit); - - var radianQuantity = degree.ToUnit(AngleUnit.Radian); - AssertEx.EqualTolerance(RadiansInOneDegree, (double)radianQuantity.Value, RadiansTolerance); - Assert.Equal(AngleUnit.Radian, radianQuantity.Unit); - - var revolutionQuantity = degree.ToUnit(AngleUnit.Revolution); - AssertEx.EqualTolerance(RevolutionsInOneDegree, (double)revolutionQuantity.Value, RevolutionsTolerance); - Assert.Equal(AngleUnit.Revolution, revolutionQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Angle degree = Angle.FromDegrees(1); - AssertEx.EqualTolerance(1, Angle.FromArcminutes(degree.Arcminutes).Degrees, ArcminutesTolerance); - AssertEx.EqualTolerance(1, Angle.FromArcseconds(degree.Arcseconds).Degrees, ArcsecondsTolerance); - AssertEx.EqualTolerance(1, Angle.FromCentiradians(degree.Centiradians).Degrees, CentiradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromDeciradians(degree.Deciradians).Degrees, DeciradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromDegrees(degree.Degrees).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromGradians(degree.Gradians).Degrees, GradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromMicrodegrees(degree.Microdegrees).Degrees, MicrodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromMicroradians(degree.Microradians).Degrees, MicroradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromMillidegrees(degree.Millidegrees).Degrees, MillidegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromMilliradians(degree.Milliradians).Degrees, MilliradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromNanodegrees(degree.Nanodegrees).Degrees, NanodegreesTolerance); - AssertEx.EqualTolerance(1, Angle.FromNanoradians(degree.Nanoradians).Degrees, NanoradiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromRadians(degree.Radians).Degrees, RadiansTolerance); - AssertEx.EqualTolerance(1, Angle.FromRevolutions(degree.Revolutions).Degrees, RevolutionsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Angle v = Angle.FromDegrees(1); - AssertEx.EqualTolerance(-1, -v.Degrees, DegreesTolerance); - AssertEx.EqualTolerance(2, (Angle.FromDegrees(3)-v).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(2, (v + v).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(10, (v*10).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(10, (10*v).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(2, (Angle.FromDegrees(10)/5).Degrees, DegreesTolerance); - AssertEx.EqualTolerance(2, Angle.FromDegrees(10)/Angle.FromDegrees(5), DegreesTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Angle oneDegree = Angle.FromDegrees(1); - Angle twoDegrees = Angle.FromDegrees(2); - - Assert.True(oneDegree < twoDegrees); - Assert.True(oneDegree <= twoDegrees); - Assert.True(twoDegrees > oneDegree); - Assert.True(twoDegrees >= oneDegree); - - Assert.False(oneDegree > twoDegrees); - Assert.False(oneDegree >= twoDegrees); - Assert.False(twoDegrees < oneDegree); - Assert.False(twoDegrees <= oneDegree); - } - - [Fact] - public void CompareToIsImplemented() - { - Angle degree = Angle.FromDegrees(1); - Assert.Equal(0, degree.CompareTo(degree)); - Assert.True(degree.CompareTo(Angle.Zero) > 0); - Assert.True(Angle.Zero.CompareTo(degree) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Angle degree = Angle.FromDegrees(1); - Assert.Throws(() => degree.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Angle degree = Angle.FromDegrees(1); - Assert.Throws(() => degree.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Angle v = Angle.FromDegrees(1); - Assert.True(v.Equals(Angle.FromDegrees(1), DegreesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Angle.Zero, DegreesTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Angle degree = Angle.FromDegrees(1); - Assert.False(degree.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Angle degree = Angle.FromDegrees(1); - Assert.False(degree.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(AngleUnit.Undefined, Angle.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(AngleUnit)).Cast(); - foreach(var unit in units) - { - if(unit == AngleUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs deleted file mode 100644 index fa4c403cd7..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ApparentEnergyTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ApparentEnergy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ApparentEnergyTestsBase - { - protected abstract double KilovoltampereHoursInOneVoltampereHour { get; } - protected abstract double MegavoltampereHoursInOneVoltampereHour { get; } - protected abstract double VoltampereHoursInOneVoltampereHour { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilovoltampereHoursTolerance { get { return 1e-5; } } - protected virtual double MegavoltampereHoursTolerance { get { return 1e-5; } } - protected virtual double VoltampereHoursTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ApparentEnergy((double)0.0, ApparentEnergyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ApparentEnergy(double.PositiveInfinity, ApparentEnergyUnit.VoltampereHour)); - Assert.Throws(() => new ApparentEnergy(double.NegativeInfinity, ApparentEnergyUnit.VoltampereHour)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ApparentEnergy(double.NaN, ApparentEnergyUnit.VoltampereHour)); - } - - [Fact] - public void VoltampereHourToApparentEnergyUnits() - { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - AssertEx.EqualTolerance(KilovoltampereHoursInOneVoltampereHour, voltamperehour.KilovoltampereHours, KilovoltampereHoursTolerance); - AssertEx.EqualTolerance(MegavoltampereHoursInOneVoltampereHour, voltamperehour.MegavoltampereHours, MegavoltampereHoursTolerance); - AssertEx.EqualTolerance(VoltampereHoursInOneVoltampereHour, voltamperehour.VoltampereHours, VoltampereHoursTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.KilovoltampereHour).KilovoltampereHours, KilovoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.MegavoltampereHour).MegavoltampereHours, MegavoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.From(1, ApparentEnergyUnit.VoltampereHour).VoltampereHours, VoltampereHoursTolerance); - } - - [Fact] - public void FromVoltampereHours_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.PositiveInfinity)); - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NegativeInfinity)); - } - - [Fact] - public void FromVoltampereHours_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ApparentEnergy.FromVoltampereHours(double.NaN)); - } - - [Fact] - public void As() - { - var voltamperehour = ApparentEnergy.FromVoltampereHours(1); - AssertEx.EqualTolerance(KilovoltampereHoursInOneVoltampereHour, voltamperehour.As(ApparentEnergyUnit.KilovoltampereHour), KilovoltampereHoursTolerance); - AssertEx.EqualTolerance(MegavoltampereHoursInOneVoltampereHour, voltamperehour.As(ApparentEnergyUnit.MegavoltampereHour), MegavoltampereHoursTolerance); - AssertEx.EqualTolerance(VoltampereHoursInOneVoltampereHour, voltamperehour.As(ApparentEnergyUnit.VoltampereHour), VoltampereHoursTolerance); - } - - [Fact] - public void ToUnit() - { - var voltamperehour = ApparentEnergy.FromVoltampereHours(1); - - var kilovoltamperehourQuantity = voltamperehour.ToUnit(ApparentEnergyUnit.KilovoltampereHour); - AssertEx.EqualTolerance(KilovoltampereHoursInOneVoltampereHour, (double)kilovoltamperehourQuantity.Value, KilovoltampereHoursTolerance); - Assert.Equal(ApparentEnergyUnit.KilovoltampereHour, kilovoltamperehourQuantity.Unit); - - var megavoltamperehourQuantity = voltamperehour.ToUnit(ApparentEnergyUnit.MegavoltampereHour); - AssertEx.EqualTolerance(MegavoltampereHoursInOneVoltampereHour, (double)megavoltamperehourQuantity.Value, MegavoltampereHoursTolerance); - Assert.Equal(ApparentEnergyUnit.MegavoltampereHour, megavoltamperehourQuantity.Unit); - - var voltamperehourQuantity = voltamperehour.ToUnit(ApparentEnergyUnit.VoltampereHour); - AssertEx.EqualTolerance(VoltampereHoursInOneVoltampereHour, (double)voltamperehourQuantity.Value, VoltampereHoursTolerance); - Assert.Equal(ApparentEnergyUnit.VoltampereHour, voltamperehourQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - AssertEx.EqualTolerance(1, ApparentEnergy.FromKilovoltampereHours(voltamperehour.KilovoltampereHours).VoltampereHours, KilovoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.FromMegavoltampereHours(voltamperehour.MegavoltampereHours).VoltampereHours, MegavoltampereHoursTolerance); - AssertEx.EqualTolerance(1, ApparentEnergy.FromVoltampereHours(voltamperehour.VoltampereHours).VoltampereHours, VoltampereHoursTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ApparentEnergy v = ApparentEnergy.FromVoltampereHours(1); - AssertEx.EqualTolerance(-1, -v.VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(2, (ApparentEnergy.FromVoltampereHours(3)-v).VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(2, (v + v).VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(10, (v*10).VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(10, (10*v).VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(2, (ApparentEnergy.FromVoltampereHours(10)/5).VoltampereHours, VoltampereHoursTolerance); - AssertEx.EqualTolerance(2, ApparentEnergy.FromVoltampereHours(10)/ApparentEnergy.FromVoltampereHours(5), VoltampereHoursTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ApparentEnergy oneVoltampereHour = ApparentEnergy.FromVoltampereHours(1); - ApparentEnergy twoVoltampereHours = ApparentEnergy.FromVoltampereHours(2); - - Assert.True(oneVoltampereHour < twoVoltampereHours); - Assert.True(oneVoltampereHour <= twoVoltampereHours); - Assert.True(twoVoltampereHours > oneVoltampereHour); - Assert.True(twoVoltampereHours >= oneVoltampereHour); - - Assert.False(oneVoltampereHour > twoVoltampereHours); - Assert.False(oneVoltampereHour >= twoVoltampereHours); - Assert.False(twoVoltampereHours < oneVoltampereHour); - Assert.False(twoVoltampereHours <= oneVoltampereHour); - } - - [Fact] - public void CompareToIsImplemented() - { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - Assert.Equal(0, voltamperehour.CompareTo(voltamperehour)); - Assert.True(voltamperehour.CompareTo(ApparentEnergy.Zero) > 0); - Assert.True(ApparentEnergy.Zero.CompareTo(voltamperehour) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - Assert.Throws(() => voltamperehour.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - Assert.Throws(() => voltamperehour.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ApparentEnergy v = ApparentEnergy.FromVoltampereHours(1); - Assert.True(v.Equals(ApparentEnergy.FromVoltampereHours(1), VoltampereHoursTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ApparentEnergy.Zero, VoltampereHoursTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - Assert.False(voltamperehour.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ApparentEnergy voltamperehour = ApparentEnergy.FromVoltampereHours(1); - Assert.False(voltamperehour.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ApparentEnergyUnit.Undefined, ApparentEnergy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ApparentEnergyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ApparentEnergyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs deleted file mode 100644 index 061fbb9aae..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ApparentPowerTestsBase.g.cs +++ /dev/null @@ -1,254 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ApparentPower. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ApparentPowerTestsBase - { - protected abstract double GigavoltamperesInOneVoltampere { get; } - protected abstract double KilovoltamperesInOneVoltampere { get; } - protected abstract double MegavoltamperesInOneVoltampere { get; } - protected abstract double VoltamperesInOneVoltampere { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double GigavoltamperesTolerance { get { return 1e-5; } } - protected virtual double KilovoltamperesTolerance { get { return 1e-5; } } - protected virtual double MegavoltamperesTolerance { get { return 1e-5; } } - protected virtual double VoltamperesTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ApparentPower((double)0.0, ApparentPowerUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ApparentPower(double.PositiveInfinity, ApparentPowerUnit.Voltampere)); - Assert.Throws(() => new ApparentPower(double.NegativeInfinity, ApparentPowerUnit.Voltampere)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ApparentPower(double.NaN, ApparentPowerUnit.Voltampere)); - } - - [Fact] - public void VoltampereToApparentPowerUnits() - { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - AssertEx.EqualTolerance(GigavoltamperesInOneVoltampere, voltampere.Gigavoltamperes, GigavoltamperesTolerance); - AssertEx.EqualTolerance(KilovoltamperesInOneVoltampere, voltampere.Kilovoltamperes, KilovoltamperesTolerance); - AssertEx.EqualTolerance(MegavoltamperesInOneVoltampere, voltampere.Megavoltamperes, MegavoltamperesTolerance); - AssertEx.EqualTolerance(VoltamperesInOneVoltampere, voltampere.Voltamperes, VoltamperesTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Gigavoltampere).Gigavoltamperes, GigavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Kilovoltampere).Kilovoltamperes, KilovoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Megavoltampere).Megavoltamperes, MegavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.From(1, ApparentPowerUnit.Voltampere).Voltamperes, VoltamperesTolerance); - } - - [Fact] - public void FromVoltamperes_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ApparentPower.FromVoltamperes(double.PositiveInfinity)); - Assert.Throws(() => ApparentPower.FromVoltamperes(double.NegativeInfinity)); - } - - [Fact] - public void FromVoltamperes_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ApparentPower.FromVoltamperes(double.NaN)); - } - - [Fact] - public void As() - { - var voltampere = ApparentPower.FromVoltamperes(1); - AssertEx.EqualTolerance(GigavoltamperesInOneVoltampere, voltampere.As(ApparentPowerUnit.Gigavoltampere), GigavoltamperesTolerance); - AssertEx.EqualTolerance(KilovoltamperesInOneVoltampere, voltampere.As(ApparentPowerUnit.Kilovoltampere), KilovoltamperesTolerance); - AssertEx.EqualTolerance(MegavoltamperesInOneVoltampere, voltampere.As(ApparentPowerUnit.Megavoltampere), MegavoltamperesTolerance); - AssertEx.EqualTolerance(VoltamperesInOneVoltampere, voltampere.As(ApparentPowerUnit.Voltampere), VoltamperesTolerance); - } - - [Fact] - public void ToUnit() - { - var voltampere = ApparentPower.FromVoltamperes(1); - - var gigavoltampereQuantity = voltampere.ToUnit(ApparentPowerUnit.Gigavoltampere); - AssertEx.EqualTolerance(GigavoltamperesInOneVoltampere, (double)gigavoltampereQuantity.Value, GigavoltamperesTolerance); - Assert.Equal(ApparentPowerUnit.Gigavoltampere, gigavoltampereQuantity.Unit); - - var kilovoltampereQuantity = voltampere.ToUnit(ApparentPowerUnit.Kilovoltampere); - AssertEx.EqualTolerance(KilovoltamperesInOneVoltampere, (double)kilovoltampereQuantity.Value, KilovoltamperesTolerance); - Assert.Equal(ApparentPowerUnit.Kilovoltampere, kilovoltampereQuantity.Unit); - - var megavoltampereQuantity = voltampere.ToUnit(ApparentPowerUnit.Megavoltampere); - AssertEx.EqualTolerance(MegavoltamperesInOneVoltampere, (double)megavoltampereQuantity.Value, MegavoltamperesTolerance); - Assert.Equal(ApparentPowerUnit.Megavoltampere, megavoltampereQuantity.Unit); - - var voltampereQuantity = voltampere.ToUnit(ApparentPowerUnit.Voltampere); - AssertEx.EqualTolerance(VoltamperesInOneVoltampere, (double)voltampereQuantity.Value, VoltamperesTolerance); - Assert.Equal(ApparentPowerUnit.Voltampere, voltampereQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - AssertEx.EqualTolerance(1, ApparentPower.FromGigavoltamperes(voltampere.Gigavoltamperes).Voltamperes, GigavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.FromKilovoltamperes(voltampere.Kilovoltamperes).Voltamperes, KilovoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.FromMegavoltamperes(voltampere.Megavoltamperes).Voltamperes, MegavoltamperesTolerance); - AssertEx.EqualTolerance(1, ApparentPower.FromVoltamperes(voltampere.Voltamperes).Voltamperes, VoltamperesTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ApparentPower v = ApparentPower.FromVoltamperes(1); - AssertEx.EqualTolerance(-1, -v.Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(2, (ApparentPower.FromVoltamperes(3)-v).Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(2, (v + v).Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(10, (v*10).Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(10, (10*v).Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(2, (ApparentPower.FromVoltamperes(10)/5).Voltamperes, VoltamperesTolerance); - AssertEx.EqualTolerance(2, ApparentPower.FromVoltamperes(10)/ApparentPower.FromVoltamperes(5), VoltamperesTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ApparentPower oneVoltampere = ApparentPower.FromVoltamperes(1); - ApparentPower twoVoltamperes = ApparentPower.FromVoltamperes(2); - - Assert.True(oneVoltampere < twoVoltamperes); - Assert.True(oneVoltampere <= twoVoltamperes); - Assert.True(twoVoltamperes > oneVoltampere); - Assert.True(twoVoltamperes >= oneVoltampere); - - Assert.False(oneVoltampere > twoVoltamperes); - Assert.False(oneVoltampere >= twoVoltamperes); - Assert.False(twoVoltamperes < oneVoltampere); - Assert.False(twoVoltamperes <= oneVoltampere); - } - - [Fact] - public void CompareToIsImplemented() - { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - Assert.Equal(0, voltampere.CompareTo(voltampere)); - Assert.True(voltampere.CompareTo(ApparentPower.Zero) > 0); - Assert.True(ApparentPower.Zero.CompareTo(voltampere) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - Assert.Throws(() => voltampere.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - Assert.Throws(() => voltampere.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ApparentPower v = ApparentPower.FromVoltamperes(1); - Assert.True(v.Equals(ApparentPower.FromVoltamperes(1), VoltamperesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ApparentPower.Zero, VoltamperesTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - Assert.False(voltampere.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ApparentPower voltampere = ApparentPower.FromVoltamperes(1); - Assert.False(voltampere.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ApparentPowerUnit.Undefined, ApparentPower.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ApparentPowerUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ApparentPowerUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs deleted file mode 100644 index b6120fd28a..0000000000 --- a/UnitsNet.Tests/GeneratedCode/AreaDensityTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of AreaDensity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class AreaDensityTestsBase - { - protected abstract double KilogramsPerSquareMeterInOneKilogramPerSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilogramsPerSquareMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new AreaDensity((double)0.0, AreaDensityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new AreaDensity(double.PositiveInfinity, AreaDensityUnit.KilogramPerSquareMeter)); - Assert.Throws(() => new AreaDensity(double.NegativeInfinity, AreaDensityUnit.KilogramPerSquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new AreaDensity(double.NaN, AreaDensityUnit.KilogramPerSquareMeter)); - } - - [Fact] - public void KilogramPerSquareMeterToAreaDensityUnits() - { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - AssertEx.EqualTolerance(KilogramsPerSquareMeterInOneKilogramPerSquareMeter, kilogrampersquaremeter.KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, AreaDensity.From(1, AreaDensityUnit.KilogramPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - } - - [Fact] - public void FromKilogramsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromKilogramsPerSquareMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => AreaDensity.FromKilogramsPerSquareMeter(double.NaN)); - } - - [Fact] - public void As() - { - var kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - AssertEx.EqualTolerance(KilogramsPerSquareMeterInOneKilogramPerSquareMeter, kilogrampersquaremeter.As(AreaDensityUnit.KilogramPerSquareMeter), KilogramsPerSquareMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - - var kilogrampersquaremeterQuantity = kilogrampersquaremeter.ToUnit(AreaDensityUnit.KilogramPerSquareMeter); - AssertEx.EqualTolerance(KilogramsPerSquareMeterInOneKilogramPerSquareMeter, (double)kilogrampersquaremeterQuantity.Value, KilogramsPerSquareMeterTolerance); - Assert.Equal(AreaDensityUnit.KilogramPerSquareMeter, kilogrampersquaremeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - AssertEx.EqualTolerance(1, AreaDensity.FromKilogramsPerSquareMeter(kilogrampersquaremeter.KilogramsPerSquareMeter).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - AreaDensity v = AreaDensity.FromKilogramsPerSquareMeter(1); - AssertEx.EqualTolerance(-1, -v.KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (AreaDensity.FromKilogramsPerSquareMeter(3)-v).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (AreaDensity.FromKilogramsPerSquareMeter(10)/5).KilogramsPerSquareMeter, KilogramsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, AreaDensity.FromKilogramsPerSquareMeter(10)/AreaDensity.FromKilogramsPerSquareMeter(5), KilogramsPerSquareMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - AreaDensity oneKilogramPerSquareMeter = AreaDensity.FromKilogramsPerSquareMeter(1); - AreaDensity twoKilogramsPerSquareMeter = AreaDensity.FromKilogramsPerSquareMeter(2); - - Assert.True(oneKilogramPerSquareMeter < twoKilogramsPerSquareMeter); - Assert.True(oneKilogramPerSquareMeter <= twoKilogramsPerSquareMeter); - Assert.True(twoKilogramsPerSquareMeter > oneKilogramPerSquareMeter); - Assert.True(twoKilogramsPerSquareMeter >= oneKilogramPerSquareMeter); - - Assert.False(oneKilogramPerSquareMeter > twoKilogramsPerSquareMeter); - Assert.False(oneKilogramPerSquareMeter >= twoKilogramsPerSquareMeter); - Assert.False(twoKilogramsPerSquareMeter < oneKilogramPerSquareMeter); - Assert.False(twoKilogramsPerSquareMeter <= oneKilogramPerSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.Equal(0, kilogrampersquaremeter.CompareTo(kilogrampersquaremeter)); - Assert.True(kilogrampersquaremeter.CompareTo(AreaDensity.Zero) > 0); - Assert.True(AreaDensity.Zero.CompareTo(kilogrampersquaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.Throws(() => kilogrampersquaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.Throws(() => kilogrampersquaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - AreaDensity v = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.True(v.Equals(AreaDensity.FromKilogramsPerSquareMeter(1), KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AreaDensity.Zero, KilogramsPerSquareMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.False(kilogrampersquaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - AreaDensity kilogrampersquaremeter = AreaDensity.FromKilogramsPerSquareMeter(1); - Assert.False(kilogrampersquaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(AreaDensityUnit.Undefined, AreaDensity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(AreaDensityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == AreaDensityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs deleted file mode 100644 index 10207a9f29..0000000000 --- a/UnitsNet.Tests/GeneratedCode/AreaMomentOfInertiaTestsBase.g.cs +++ /dev/null @@ -1,274 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of AreaMomentOfInertia. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class AreaMomentOfInertiaTestsBase - { - protected abstract double CentimetersToTheFourthInOneMeterToTheFourth { get; } - protected abstract double DecimetersToTheFourthInOneMeterToTheFourth { get; } - protected abstract double FeetToTheFourthInOneMeterToTheFourth { get; } - protected abstract double InchesToTheFourthInOneMeterToTheFourth { get; } - protected abstract double MetersToTheFourthInOneMeterToTheFourth { get; } - protected abstract double MillimetersToTheFourthInOneMeterToTheFourth { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentimetersToTheFourthTolerance { get { return 1e-5; } } - protected virtual double DecimetersToTheFourthTolerance { get { return 1e-5; } } - protected virtual double FeetToTheFourthTolerance { get { return 1e-5; } } - protected virtual double InchesToTheFourthTolerance { get { return 1e-5; } } - protected virtual double MetersToTheFourthTolerance { get { return 1e-5; } } - protected virtual double MillimetersToTheFourthTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new AreaMomentOfInertia((double)0.0, AreaMomentOfInertiaUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new AreaMomentOfInertia(double.PositiveInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); - Assert.Throws(() => new AreaMomentOfInertia(double.NegativeInfinity, AreaMomentOfInertiaUnit.MeterToTheFourth)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new AreaMomentOfInertia(double.NaN, AreaMomentOfInertiaUnit.MeterToTheFourth)); - } - - [Fact] - public void MeterToTheFourthToAreaMomentOfInertiaUnits() - { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - AssertEx.EqualTolerance(CentimetersToTheFourthInOneMeterToTheFourth, metertothefourth.CentimetersToTheFourth, CentimetersToTheFourthTolerance); - AssertEx.EqualTolerance(DecimetersToTheFourthInOneMeterToTheFourth, metertothefourth.DecimetersToTheFourth, DecimetersToTheFourthTolerance); - AssertEx.EqualTolerance(FeetToTheFourthInOneMeterToTheFourth, metertothefourth.FeetToTheFourth, FeetToTheFourthTolerance); - AssertEx.EqualTolerance(InchesToTheFourthInOneMeterToTheFourth, metertothefourth.InchesToTheFourth, InchesToTheFourthTolerance); - AssertEx.EqualTolerance(MetersToTheFourthInOneMeterToTheFourth, metertothefourth.MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(MillimetersToTheFourthInOneMeterToTheFourth, metertothefourth.MillimetersToTheFourth, MillimetersToTheFourthTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.CentimeterToTheFourth).CentimetersToTheFourth, CentimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.DecimeterToTheFourth).DecimetersToTheFourth, DecimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.FootToTheFourth).FeetToTheFourth, FeetToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.InchToTheFourth).InchesToTheFourth, InchesToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MeterToTheFourth).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.From(1, AreaMomentOfInertiaUnit.MillimeterToTheFourth).MillimetersToTheFourth, MillimetersToTheFourthTolerance); - } - - [Fact] - public void FromMetersToTheFourth_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.PositiveInfinity)); - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NegativeInfinity)); - } - - [Fact] - public void FromMetersToTheFourth_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => AreaMomentOfInertia.FromMetersToTheFourth(double.NaN)); - } - - [Fact] - public void As() - { - var metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - AssertEx.EqualTolerance(CentimetersToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.CentimeterToTheFourth), CentimetersToTheFourthTolerance); - AssertEx.EqualTolerance(DecimetersToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.DecimeterToTheFourth), DecimetersToTheFourthTolerance); - AssertEx.EqualTolerance(FeetToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.FootToTheFourth), FeetToTheFourthTolerance); - AssertEx.EqualTolerance(InchesToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.InchToTheFourth), InchesToTheFourthTolerance); - AssertEx.EqualTolerance(MetersToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.MeterToTheFourth), MetersToTheFourthTolerance); - AssertEx.EqualTolerance(MillimetersToTheFourthInOneMeterToTheFourth, metertothefourth.As(AreaMomentOfInertiaUnit.MillimeterToTheFourth), MillimetersToTheFourthTolerance); - } - - [Fact] - public void ToUnit() - { - var metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - - var centimetertothefourthQuantity = metertothefourth.ToUnit(AreaMomentOfInertiaUnit.CentimeterToTheFourth); - AssertEx.EqualTolerance(CentimetersToTheFourthInOneMeterToTheFourth, (double)centimetertothefourthQuantity.Value, CentimetersToTheFourthTolerance); - Assert.Equal(AreaMomentOfInertiaUnit.CentimeterToTheFourth, centimetertothefourthQuantity.Unit); - - var decimetertothefourthQuantity = metertothefourth.ToUnit(AreaMomentOfInertiaUnit.DecimeterToTheFourth); - AssertEx.EqualTolerance(DecimetersToTheFourthInOneMeterToTheFourth, (double)decimetertothefourthQuantity.Value, DecimetersToTheFourthTolerance); - Assert.Equal(AreaMomentOfInertiaUnit.DecimeterToTheFourth, decimetertothefourthQuantity.Unit); - - var foottothefourthQuantity = metertothefourth.ToUnit(AreaMomentOfInertiaUnit.FootToTheFourth); - AssertEx.EqualTolerance(FeetToTheFourthInOneMeterToTheFourth, (double)foottothefourthQuantity.Value, FeetToTheFourthTolerance); - Assert.Equal(AreaMomentOfInertiaUnit.FootToTheFourth, foottothefourthQuantity.Unit); - - var inchtothefourthQuantity = metertothefourth.ToUnit(AreaMomentOfInertiaUnit.InchToTheFourth); - AssertEx.EqualTolerance(InchesToTheFourthInOneMeterToTheFourth, (double)inchtothefourthQuantity.Value, InchesToTheFourthTolerance); - Assert.Equal(AreaMomentOfInertiaUnit.InchToTheFourth, inchtothefourthQuantity.Unit); - - var metertothefourthQuantity = metertothefourth.ToUnit(AreaMomentOfInertiaUnit.MeterToTheFourth); - AssertEx.EqualTolerance(MetersToTheFourthInOneMeterToTheFourth, (double)metertothefourthQuantity.Value, MetersToTheFourthTolerance); - Assert.Equal(AreaMomentOfInertiaUnit.MeterToTheFourth, metertothefourthQuantity.Unit); - - var millimetertothefourthQuantity = metertothefourth.ToUnit(AreaMomentOfInertiaUnit.MillimeterToTheFourth); - AssertEx.EqualTolerance(MillimetersToTheFourthInOneMeterToTheFourth, (double)millimetertothefourthQuantity.Value, MillimetersToTheFourthTolerance); - Assert.Equal(AreaMomentOfInertiaUnit.MillimeterToTheFourth, millimetertothefourthQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromCentimetersToTheFourth(metertothefourth.CentimetersToTheFourth).MetersToTheFourth, CentimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromDecimetersToTheFourth(metertothefourth.DecimetersToTheFourth).MetersToTheFourth, DecimetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromFeetToTheFourth(metertothefourth.FeetToTheFourth).MetersToTheFourth, FeetToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromInchesToTheFourth(metertothefourth.InchesToTheFourth).MetersToTheFourth, InchesToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromMetersToTheFourth(metertothefourth.MetersToTheFourth).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(1, AreaMomentOfInertia.FromMillimetersToTheFourth(metertothefourth.MillimetersToTheFourth).MetersToTheFourth, MillimetersToTheFourthTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - AreaMomentOfInertia v = AreaMomentOfInertia.FromMetersToTheFourth(1); - AssertEx.EqualTolerance(-1, -v.MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(3)-v).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(2, (v + v).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(10, (v*10).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(10, (10*v).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(10)/5).MetersToTheFourth, MetersToTheFourthTolerance); - AssertEx.EqualTolerance(2, AreaMomentOfInertia.FromMetersToTheFourth(10)/AreaMomentOfInertia.FromMetersToTheFourth(5), MetersToTheFourthTolerance); - } - - [Fact] - public void ComparisonOperators() - { - AreaMomentOfInertia oneMeterToTheFourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - AreaMomentOfInertia twoMetersToTheFourth = AreaMomentOfInertia.FromMetersToTheFourth(2); - - Assert.True(oneMeterToTheFourth < twoMetersToTheFourth); - Assert.True(oneMeterToTheFourth <= twoMetersToTheFourth); - Assert.True(twoMetersToTheFourth > oneMeterToTheFourth); - Assert.True(twoMetersToTheFourth >= oneMeterToTheFourth); - - Assert.False(oneMeterToTheFourth > twoMetersToTheFourth); - Assert.False(oneMeterToTheFourth >= twoMetersToTheFourth); - Assert.False(twoMetersToTheFourth < oneMeterToTheFourth); - Assert.False(twoMetersToTheFourth <= oneMeterToTheFourth); - } - - [Fact] - public void CompareToIsImplemented() - { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.Equal(0, metertothefourth.CompareTo(metertothefourth)); - Assert.True(metertothefourth.CompareTo(AreaMomentOfInertia.Zero) > 0); - Assert.True(AreaMomentOfInertia.Zero.CompareTo(metertothefourth) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.Throws(() => metertothefourth.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.Throws(() => metertothefourth.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - AreaMomentOfInertia v = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.True(v.Equals(AreaMomentOfInertia.FromMetersToTheFourth(1), MetersToTheFourthTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(AreaMomentOfInertia.Zero, MetersToTheFourthTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.False(metertothefourth.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1); - Assert.False(metertothefourth.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(AreaMomentOfInertiaUnit.Undefined, AreaMomentOfInertia.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(AreaMomentOfInertiaUnit)).Cast(); - foreach(var unit in units) - { - if(unit == AreaMomentOfInertiaUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs deleted file mode 100644 index 205d6d77df..0000000000 --- a/UnitsNet.Tests/GeneratedCode/AreaTestsBase.g.cs +++ /dev/null @@ -1,344 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Area. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class AreaTestsBase - { - protected abstract double AcresInOneSquareMeter { get; } - protected abstract double HectaresInOneSquareMeter { get; } - protected abstract double SquareCentimetersInOneSquareMeter { get; } - protected abstract double SquareDecimetersInOneSquareMeter { get; } - protected abstract double SquareFeetInOneSquareMeter { get; } - protected abstract double SquareInchesInOneSquareMeter { get; } - protected abstract double SquareKilometersInOneSquareMeter { get; } - protected abstract double SquareMetersInOneSquareMeter { get; } - protected abstract double SquareMicrometersInOneSquareMeter { get; } - protected abstract double SquareMilesInOneSquareMeter { get; } - protected abstract double SquareMillimetersInOneSquareMeter { get; } - protected abstract double SquareYardsInOneSquareMeter { get; } - protected abstract double UsSurveySquareFeetInOneSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AcresTolerance { get { return 1e-5; } } - protected virtual double HectaresTolerance { get { return 1e-5; } } - protected virtual double SquareCentimetersTolerance { get { return 1e-5; } } - protected virtual double SquareDecimetersTolerance { get { return 1e-5; } } - protected virtual double SquareFeetTolerance { get { return 1e-5; } } - protected virtual double SquareInchesTolerance { get { return 1e-5; } } - protected virtual double SquareKilometersTolerance { get { return 1e-5; } } - protected virtual double SquareMetersTolerance { get { return 1e-5; } } - protected virtual double SquareMicrometersTolerance { get { return 1e-5; } } - protected virtual double SquareMilesTolerance { get { return 1e-5; } } - protected virtual double SquareMillimetersTolerance { get { return 1e-5; } } - protected virtual double SquareYardsTolerance { get { return 1e-5; } } - protected virtual double UsSurveySquareFeetTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Area((double)0.0, AreaUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Area(double.PositiveInfinity, AreaUnit.SquareMeter)); - Assert.Throws(() => new Area(double.NegativeInfinity, AreaUnit.SquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Area(double.NaN, AreaUnit.SquareMeter)); - } - - [Fact] - public void SquareMeterToAreaUnits() - { - Area squaremeter = Area.FromSquareMeters(1); - AssertEx.EqualTolerance(AcresInOneSquareMeter, squaremeter.Acres, AcresTolerance); - AssertEx.EqualTolerance(HectaresInOneSquareMeter, squaremeter.Hectares, HectaresTolerance); - AssertEx.EqualTolerance(SquareCentimetersInOneSquareMeter, squaremeter.SquareCentimeters, SquareCentimetersTolerance); - AssertEx.EqualTolerance(SquareDecimetersInOneSquareMeter, squaremeter.SquareDecimeters, SquareDecimetersTolerance); - AssertEx.EqualTolerance(SquareFeetInOneSquareMeter, squaremeter.SquareFeet, SquareFeetTolerance); - AssertEx.EqualTolerance(SquareInchesInOneSquareMeter, squaremeter.SquareInches, SquareInchesTolerance); - AssertEx.EqualTolerance(SquareKilometersInOneSquareMeter, squaremeter.SquareKilometers, SquareKilometersTolerance); - AssertEx.EqualTolerance(SquareMetersInOneSquareMeter, squaremeter.SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(SquareMicrometersInOneSquareMeter, squaremeter.SquareMicrometers, SquareMicrometersTolerance); - AssertEx.EqualTolerance(SquareMilesInOneSquareMeter, squaremeter.SquareMiles, SquareMilesTolerance); - AssertEx.EqualTolerance(SquareMillimetersInOneSquareMeter, squaremeter.SquareMillimeters, SquareMillimetersTolerance); - AssertEx.EqualTolerance(SquareYardsInOneSquareMeter, squaremeter.SquareYards, SquareYardsTolerance); - AssertEx.EqualTolerance(UsSurveySquareFeetInOneSquareMeter, squaremeter.UsSurveySquareFeet, UsSurveySquareFeetTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.Acre).Acres, AcresTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.Hectare).Hectares, HectaresTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareCentimeter).SquareCentimeters, SquareCentimetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareDecimeter).SquareDecimeters, SquareDecimetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareFoot).SquareFeet, SquareFeetTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareInch).SquareInches, SquareInchesTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareKilometer).SquareKilometers, SquareKilometersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMeter).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMicrometer).SquareMicrometers, SquareMicrometersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMile).SquareMiles, SquareMilesTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareMillimeter).SquareMillimeters, SquareMillimetersTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.SquareYard).SquareYards, SquareYardsTolerance); - AssertEx.EqualTolerance(1, Area.From(1, AreaUnit.UsSurveySquareFoot).UsSurveySquareFeet, UsSurveySquareFeetTolerance); - } - - [Fact] - public void FromSquareMeters_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Area.FromSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => Area.FromSquareMeters(double.NegativeInfinity)); - } - - [Fact] - public void FromSquareMeters_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Area.FromSquareMeters(double.NaN)); - } - - [Fact] - public void As() - { - var squaremeter = Area.FromSquareMeters(1); - AssertEx.EqualTolerance(AcresInOneSquareMeter, squaremeter.As(AreaUnit.Acre), AcresTolerance); - AssertEx.EqualTolerance(HectaresInOneSquareMeter, squaremeter.As(AreaUnit.Hectare), HectaresTolerance); - AssertEx.EqualTolerance(SquareCentimetersInOneSquareMeter, squaremeter.As(AreaUnit.SquareCentimeter), SquareCentimetersTolerance); - AssertEx.EqualTolerance(SquareDecimetersInOneSquareMeter, squaremeter.As(AreaUnit.SquareDecimeter), SquareDecimetersTolerance); - AssertEx.EqualTolerance(SquareFeetInOneSquareMeter, squaremeter.As(AreaUnit.SquareFoot), SquareFeetTolerance); - AssertEx.EqualTolerance(SquareInchesInOneSquareMeter, squaremeter.As(AreaUnit.SquareInch), SquareInchesTolerance); - AssertEx.EqualTolerance(SquareKilometersInOneSquareMeter, squaremeter.As(AreaUnit.SquareKilometer), SquareKilometersTolerance); - AssertEx.EqualTolerance(SquareMetersInOneSquareMeter, squaremeter.As(AreaUnit.SquareMeter), SquareMetersTolerance); - AssertEx.EqualTolerance(SquareMicrometersInOneSquareMeter, squaremeter.As(AreaUnit.SquareMicrometer), SquareMicrometersTolerance); - AssertEx.EqualTolerance(SquareMilesInOneSquareMeter, squaremeter.As(AreaUnit.SquareMile), SquareMilesTolerance); - AssertEx.EqualTolerance(SquareMillimetersInOneSquareMeter, squaremeter.As(AreaUnit.SquareMillimeter), SquareMillimetersTolerance); - AssertEx.EqualTolerance(SquareYardsInOneSquareMeter, squaremeter.As(AreaUnit.SquareYard), SquareYardsTolerance); - AssertEx.EqualTolerance(UsSurveySquareFeetInOneSquareMeter, squaremeter.As(AreaUnit.UsSurveySquareFoot), UsSurveySquareFeetTolerance); - } - - [Fact] - public void ToUnit() - { - var squaremeter = Area.FromSquareMeters(1); - - var acreQuantity = squaremeter.ToUnit(AreaUnit.Acre); - AssertEx.EqualTolerance(AcresInOneSquareMeter, (double)acreQuantity.Value, AcresTolerance); - Assert.Equal(AreaUnit.Acre, acreQuantity.Unit); - - var hectareQuantity = squaremeter.ToUnit(AreaUnit.Hectare); - AssertEx.EqualTolerance(HectaresInOneSquareMeter, (double)hectareQuantity.Value, HectaresTolerance); - Assert.Equal(AreaUnit.Hectare, hectareQuantity.Unit); - - var squarecentimeterQuantity = squaremeter.ToUnit(AreaUnit.SquareCentimeter); - AssertEx.EqualTolerance(SquareCentimetersInOneSquareMeter, (double)squarecentimeterQuantity.Value, SquareCentimetersTolerance); - Assert.Equal(AreaUnit.SquareCentimeter, squarecentimeterQuantity.Unit); - - var squaredecimeterQuantity = squaremeter.ToUnit(AreaUnit.SquareDecimeter); - AssertEx.EqualTolerance(SquareDecimetersInOneSquareMeter, (double)squaredecimeterQuantity.Value, SquareDecimetersTolerance); - Assert.Equal(AreaUnit.SquareDecimeter, squaredecimeterQuantity.Unit); - - var squarefootQuantity = squaremeter.ToUnit(AreaUnit.SquareFoot); - AssertEx.EqualTolerance(SquareFeetInOneSquareMeter, (double)squarefootQuantity.Value, SquareFeetTolerance); - Assert.Equal(AreaUnit.SquareFoot, squarefootQuantity.Unit); - - var squareinchQuantity = squaremeter.ToUnit(AreaUnit.SquareInch); - AssertEx.EqualTolerance(SquareInchesInOneSquareMeter, (double)squareinchQuantity.Value, SquareInchesTolerance); - Assert.Equal(AreaUnit.SquareInch, squareinchQuantity.Unit); - - var squarekilometerQuantity = squaremeter.ToUnit(AreaUnit.SquareKilometer); - AssertEx.EqualTolerance(SquareKilometersInOneSquareMeter, (double)squarekilometerQuantity.Value, SquareKilometersTolerance); - Assert.Equal(AreaUnit.SquareKilometer, squarekilometerQuantity.Unit); - - var squaremeterQuantity = squaremeter.ToUnit(AreaUnit.SquareMeter); - AssertEx.EqualTolerance(SquareMetersInOneSquareMeter, (double)squaremeterQuantity.Value, SquareMetersTolerance); - Assert.Equal(AreaUnit.SquareMeter, squaremeterQuantity.Unit); - - var squaremicrometerQuantity = squaremeter.ToUnit(AreaUnit.SquareMicrometer); - AssertEx.EqualTolerance(SquareMicrometersInOneSquareMeter, (double)squaremicrometerQuantity.Value, SquareMicrometersTolerance); - Assert.Equal(AreaUnit.SquareMicrometer, squaremicrometerQuantity.Unit); - - var squaremileQuantity = squaremeter.ToUnit(AreaUnit.SquareMile); - AssertEx.EqualTolerance(SquareMilesInOneSquareMeter, (double)squaremileQuantity.Value, SquareMilesTolerance); - Assert.Equal(AreaUnit.SquareMile, squaremileQuantity.Unit); - - var squaremillimeterQuantity = squaremeter.ToUnit(AreaUnit.SquareMillimeter); - AssertEx.EqualTolerance(SquareMillimetersInOneSquareMeter, (double)squaremillimeterQuantity.Value, SquareMillimetersTolerance); - Assert.Equal(AreaUnit.SquareMillimeter, squaremillimeterQuantity.Unit); - - var squareyardQuantity = squaremeter.ToUnit(AreaUnit.SquareYard); - AssertEx.EqualTolerance(SquareYardsInOneSquareMeter, (double)squareyardQuantity.Value, SquareYardsTolerance); - Assert.Equal(AreaUnit.SquareYard, squareyardQuantity.Unit); - - var ussurveysquarefootQuantity = squaremeter.ToUnit(AreaUnit.UsSurveySquareFoot); - AssertEx.EqualTolerance(UsSurveySquareFeetInOneSquareMeter, (double)ussurveysquarefootQuantity.Value, UsSurveySquareFeetTolerance); - Assert.Equal(AreaUnit.UsSurveySquareFoot, ussurveysquarefootQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Area squaremeter = Area.FromSquareMeters(1); - AssertEx.EqualTolerance(1, Area.FromAcres(squaremeter.Acres).SquareMeters, AcresTolerance); - AssertEx.EqualTolerance(1, Area.FromHectares(squaremeter.Hectares).SquareMeters, HectaresTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareCentimeters(squaremeter.SquareCentimeters).SquareMeters, SquareCentimetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareDecimeters(squaremeter.SquareDecimeters).SquareMeters, SquareDecimetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareFeet(squaremeter.SquareFeet).SquareMeters, SquareFeetTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareInches(squaremeter.SquareInches).SquareMeters, SquareInchesTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareKilometers(squaremeter.SquareKilometers).SquareMeters, SquareKilometersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMeters(squaremeter.SquareMeters).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMicrometers(squaremeter.SquareMicrometers).SquareMeters, SquareMicrometersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMiles(squaremeter.SquareMiles).SquareMeters, SquareMilesTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareMillimeters(squaremeter.SquareMillimeters).SquareMeters, SquareMillimetersTolerance); - AssertEx.EqualTolerance(1, Area.FromSquareYards(squaremeter.SquareYards).SquareMeters, SquareYardsTolerance); - AssertEx.EqualTolerance(1, Area.FromUsSurveySquareFeet(squaremeter.UsSurveySquareFeet).SquareMeters, UsSurveySquareFeetTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Area v = Area.FromSquareMeters(1); - AssertEx.EqualTolerance(-1, -v.SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(2, (Area.FromSquareMeters(3)-v).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(2, (v + v).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(10, (v*10).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(10, (10*v).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(2, (Area.FromSquareMeters(10)/5).SquareMeters, SquareMetersTolerance); - AssertEx.EqualTolerance(2, Area.FromSquareMeters(10)/Area.FromSquareMeters(5), SquareMetersTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Area oneSquareMeter = Area.FromSquareMeters(1); - Area twoSquareMeters = Area.FromSquareMeters(2); - - Assert.True(oneSquareMeter < twoSquareMeters); - Assert.True(oneSquareMeter <= twoSquareMeters); - Assert.True(twoSquareMeters > oneSquareMeter); - Assert.True(twoSquareMeters >= oneSquareMeter); - - Assert.False(oneSquareMeter > twoSquareMeters); - Assert.False(oneSquareMeter >= twoSquareMeters); - Assert.False(twoSquareMeters < oneSquareMeter); - Assert.False(twoSquareMeters <= oneSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Area squaremeter = Area.FromSquareMeters(1); - Assert.Equal(0, squaremeter.CompareTo(squaremeter)); - Assert.True(squaremeter.CompareTo(Area.Zero) > 0); - Assert.True(Area.Zero.CompareTo(squaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Area squaremeter = Area.FromSquareMeters(1); - Assert.Throws(() => squaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Area squaremeter = Area.FromSquareMeters(1); - Assert.Throws(() => squaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Area v = Area.FromSquareMeters(1); - Assert.True(v.Equals(Area.FromSquareMeters(1), SquareMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Area.Zero, SquareMetersTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Area squaremeter = Area.FromSquareMeters(1); - Assert.False(squaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Area squaremeter = Area.FromSquareMeters(1); - Assert.False(squaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(AreaUnit.Undefined, Area.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(AreaUnit)).Cast(); - foreach(var unit in units) - { - if(unit == AreaUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs deleted file mode 100644 index 3050aa4ad4..0000000000 --- a/UnitsNet.Tests/GeneratedCode/BitRateTestsBase.g.cs +++ /dev/null @@ -1,450 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of BitRate. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class BitRateTestsBase - { - protected abstract double BitsPerSecondInOneBitPerSecond { get; } - protected abstract double BytesPerSecondInOneBitPerSecond { get; } - protected abstract double ExabitsPerSecondInOneBitPerSecond { get; } - protected abstract double ExabytesPerSecondInOneBitPerSecond { get; } - protected abstract double ExbibitsPerSecondInOneBitPerSecond { get; } - protected abstract double ExbibytesPerSecondInOneBitPerSecond { get; } - protected abstract double GibibitsPerSecondInOneBitPerSecond { get; } - protected abstract double GibibytesPerSecondInOneBitPerSecond { get; } - protected abstract double GigabitsPerSecondInOneBitPerSecond { get; } - protected abstract double GigabytesPerSecondInOneBitPerSecond { get; } - protected abstract double KibibitsPerSecondInOneBitPerSecond { get; } - protected abstract double KibibytesPerSecondInOneBitPerSecond { get; } - protected abstract double KilobitsPerSecondInOneBitPerSecond { get; } - protected abstract double KilobytesPerSecondInOneBitPerSecond { get; } - protected abstract double MebibitsPerSecondInOneBitPerSecond { get; } - protected abstract double MebibytesPerSecondInOneBitPerSecond { get; } - protected abstract double MegabitsPerSecondInOneBitPerSecond { get; } - protected abstract double MegabytesPerSecondInOneBitPerSecond { get; } - protected abstract double PebibitsPerSecondInOneBitPerSecond { get; } - protected abstract double PebibytesPerSecondInOneBitPerSecond { get; } - protected abstract double PetabitsPerSecondInOneBitPerSecond { get; } - protected abstract double PetabytesPerSecondInOneBitPerSecond { get; } - protected abstract double TebibitsPerSecondInOneBitPerSecond { get; } - protected abstract double TebibytesPerSecondInOneBitPerSecond { get; } - protected abstract double TerabitsPerSecondInOneBitPerSecond { get; } - protected abstract double TerabytesPerSecondInOneBitPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double BitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double BytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double ExabitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double ExabytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double ExbibitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double ExbibytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double GibibitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double GibibytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double GigabitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double GigabytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double KibibitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double KibibytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double KilobitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double KilobytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double MebibitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MebibytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double MegabitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MegabytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double PebibitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double PebibytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double PetabitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double PetabytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double TebibitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double TebibytesPerSecondTolerance { get { return 1e-5; } } - protected virtual double TerabitsPerSecondTolerance { get { return 1e-5; } } - protected virtual double TerabytesPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new BitRate((decimal)0.0, BitRateUnit.Undefined)); - } - - - [Fact] - public void BitPerSecondToBitRateUnits() - { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - AssertEx.EqualTolerance(BitsPerSecondInOneBitPerSecond, bitpersecond.BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(BytesPerSecondInOneBitPerSecond, bitpersecond.BytesPerSecond, BytesPerSecondTolerance); - AssertEx.EqualTolerance(ExabitsPerSecondInOneBitPerSecond, bitpersecond.ExabitsPerSecond, ExabitsPerSecondTolerance); - AssertEx.EqualTolerance(ExabytesPerSecondInOneBitPerSecond, bitpersecond.ExabytesPerSecond, ExabytesPerSecondTolerance); - AssertEx.EqualTolerance(ExbibitsPerSecondInOneBitPerSecond, bitpersecond.ExbibitsPerSecond, ExbibitsPerSecondTolerance); - AssertEx.EqualTolerance(ExbibytesPerSecondInOneBitPerSecond, bitpersecond.ExbibytesPerSecond, ExbibytesPerSecondTolerance); - AssertEx.EqualTolerance(GibibitsPerSecondInOneBitPerSecond, bitpersecond.GibibitsPerSecond, GibibitsPerSecondTolerance); - AssertEx.EqualTolerance(GibibytesPerSecondInOneBitPerSecond, bitpersecond.GibibytesPerSecond, GibibytesPerSecondTolerance); - AssertEx.EqualTolerance(GigabitsPerSecondInOneBitPerSecond, bitpersecond.GigabitsPerSecond, GigabitsPerSecondTolerance); - AssertEx.EqualTolerance(GigabytesPerSecondInOneBitPerSecond, bitpersecond.GigabytesPerSecond, GigabytesPerSecondTolerance); - AssertEx.EqualTolerance(KibibitsPerSecondInOneBitPerSecond, bitpersecond.KibibitsPerSecond, KibibitsPerSecondTolerance); - AssertEx.EqualTolerance(KibibytesPerSecondInOneBitPerSecond, bitpersecond.KibibytesPerSecond, KibibytesPerSecondTolerance); - AssertEx.EqualTolerance(KilobitsPerSecondInOneBitPerSecond, bitpersecond.KilobitsPerSecond, KilobitsPerSecondTolerance); - AssertEx.EqualTolerance(KilobytesPerSecondInOneBitPerSecond, bitpersecond.KilobytesPerSecond, KilobytesPerSecondTolerance); - AssertEx.EqualTolerance(MebibitsPerSecondInOneBitPerSecond, bitpersecond.MebibitsPerSecond, MebibitsPerSecondTolerance); - AssertEx.EqualTolerance(MebibytesPerSecondInOneBitPerSecond, bitpersecond.MebibytesPerSecond, MebibytesPerSecondTolerance); - AssertEx.EqualTolerance(MegabitsPerSecondInOneBitPerSecond, bitpersecond.MegabitsPerSecond, MegabitsPerSecondTolerance); - AssertEx.EqualTolerance(MegabytesPerSecondInOneBitPerSecond, bitpersecond.MegabytesPerSecond, MegabytesPerSecondTolerance); - AssertEx.EqualTolerance(PebibitsPerSecondInOneBitPerSecond, bitpersecond.PebibitsPerSecond, PebibitsPerSecondTolerance); - AssertEx.EqualTolerance(PebibytesPerSecondInOneBitPerSecond, bitpersecond.PebibytesPerSecond, PebibytesPerSecondTolerance); - AssertEx.EqualTolerance(PetabitsPerSecondInOneBitPerSecond, bitpersecond.PetabitsPerSecond, PetabitsPerSecondTolerance); - AssertEx.EqualTolerance(PetabytesPerSecondInOneBitPerSecond, bitpersecond.PetabytesPerSecond, PetabytesPerSecondTolerance); - AssertEx.EqualTolerance(TebibitsPerSecondInOneBitPerSecond, bitpersecond.TebibitsPerSecond, TebibitsPerSecondTolerance); - AssertEx.EqualTolerance(TebibytesPerSecondInOneBitPerSecond, bitpersecond.TebibytesPerSecond, TebibytesPerSecondTolerance); - AssertEx.EqualTolerance(TerabitsPerSecondInOneBitPerSecond, bitpersecond.TerabitsPerSecond, TerabitsPerSecondTolerance); - AssertEx.EqualTolerance(TerabytesPerSecondInOneBitPerSecond, bitpersecond.TerabytesPerSecond, TerabytesPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BitPerSecond).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.BytePerSecond).BytesPerSecond, BytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabitPerSecond).ExabitsPerSecond, ExabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExabytePerSecond).ExabytesPerSecond, ExabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibitPerSecond).ExbibitsPerSecond, ExbibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.ExbibytePerSecond).ExbibytesPerSecond, ExbibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibitPerSecond).GibibitsPerSecond, GibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GibibytePerSecond).GibibytesPerSecond, GibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabitPerSecond).GigabitsPerSecond, GigabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.GigabytePerSecond).GigabytesPerSecond, GigabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibitPerSecond).KibibitsPerSecond, KibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KibibytePerSecond).KibibytesPerSecond, KibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobitPerSecond).KilobitsPerSecond, KilobitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.KilobytePerSecond).KilobytesPerSecond, KilobytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibitPerSecond).MebibitsPerSecond, MebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MebibytePerSecond).MebibytesPerSecond, MebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabitPerSecond).MegabitsPerSecond, MegabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.MegabytePerSecond).MegabytesPerSecond, MegabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibitPerSecond).PebibitsPerSecond, PebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PebibytePerSecond).PebibytesPerSecond, PebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabitPerSecond).PetabitsPerSecond, PetabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.PetabytePerSecond).PetabytesPerSecond, PetabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibitPerSecond).TebibitsPerSecond, TebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TebibytePerSecond).TebibytesPerSecond, TebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabitPerSecond).TerabitsPerSecond, TerabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.From(1, BitRateUnit.TerabytePerSecond).TerabytesPerSecond, TerabytesPerSecondTolerance); - } - - - [Fact] - public void As() - { - var bitpersecond = BitRate.FromBitsPerSecond(1); - AssertEx.EqualTolerance(BitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.BitPerSecond), BitsPerSecondTolerance); - AssertEx.EqualTolerance(BytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.BytePerSecond), BytesPerSecondTolerance); - AssertEx.EqualTolerance(ExabitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.ExabitPerSecond), ExabitsPerSecondTolerance); - AssertEx.EqualTolerance(ExabytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.ExabytePerSecond), ExabytesPerSecondTolerance); - AssertEx.EqualTolerance(ExbibitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.ExbibitPerSecond), ExbibitsPerSecondTolerance); - AssertEx.EqualTolerance(ExbibytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.ExbibytePerSecond), ExbibytesPerSecondTolerance); - AssertEx.EqualTolerance(GibibitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.GibibitPerSecond), GibibitsPerSecondTolerance); - AssertEx.EqualTolerance(GibibytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.GibibytePerSecond), GibibytesPerSecondTolerance); - AssertEx.EqualTolerance(GigabitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.GigabitPerSecond), GigabitsPerSecondTolerance); - AssertEx.EqualTolerance(GigabytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.GigabytePerSecond), GigabytesPerSecondTolerance); - AssertEx.EqualTolerance(KibibitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.KibibitPerSecond), KibibitsPerSecondTolerance); - AssertEx.EqualTolerance(KibibytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.KibibytePerSecond), KibibytesPerSecondTolerance); - AssertEx.EqualTolerance(KilobitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.KilobitPerSecond), KilobitsPerSecondTolerance); - AssertEx.EqualTolerance(KilobytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.KilobytePerSecond), KilobytesPerSecondTolerance); - AssertEx.EqualTolerance(MebibitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.MebibitPerSecond), MebibitsPerSecondTolerance); - AssertEx.EqualTolerance(MebibytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.MebibytePerSecond), MebibytesPerSecondTolerance); - AssertEx.EqualTolerance(MegabitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.MegabitPerSecond), MegabitsPerSecondTolerance); - AssertEx.EqualTolerance(MegabytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.MegabytePerSecond), MegabytesPerSecondTolerance); - AssertEx.EqualTolerance(PebibitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.PebibitPerSecond), PebibitsPerSecondTolerance); - AssertEx.EqualTolerance(PebibytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.PebibytePerSecond), PebibytesPerSecondTolerance); - AssertEx.EqualTolerance(PetabitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.PetabitPerSecond), PetabitsPerSecondTolerance); - AssertEx.EqualTolerance(PetabytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.PetabytePerSecond), PetabytesPerSecondTolerance); - AssertEx.EqualTolerance(TebibitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.TebibitPerSecond), TebibitsPerSecondTolerance); - AssertEx.EqualTolerance(TebibytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.TebibytePerSecond), TebibytesPerSecondTolerance); - AssertEx.EqualTolerance(TerabitsPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.TerabitPerSecond), TerabitsPerSecondTolerance); - AssertEx.EqualTolerance(TerabytesPerSecondInOneBitPerSecond, bitpersecond.As(BitRateUnit.TerabytePerSecond), TerabytesPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var bitpersecond = BitRate.FromBitsPerSecond(1); - - var bitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.BitPerSecond); - AssertEx.EqualTolerance(BitsPerSecondInOneBitPerSecond, (double)bitpersecondQuantity.Value, BitsPerSecondTolerance); - Assert.Equal(BitRateUnit.BitPerSecond, bitpersecondQuantity.Unit); - - var bytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.BytePerSecond); - AssertEx.EqualTolerance(BytesPerSecondInOneBitPerSecond, (double)bytepersecondQuantity.Value, BytesPerSecondTolerance); - Assert.Equal(BitRateUnit.BytePerSecond, bytepersecondQuantity.Unit); - - var exabitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.ExabitPerSecond); - AssertEx.EqualTolerance(ExabitsPerSecondInOneBitPerSecond, (double)exabitpersecondQuantity.Value, ExabitsPerSecondTolerance); - Assert.Equal(BitRateUnit.ExabitPerSecond, exabitpersecondQuantity.Unit); - - var exabytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.ExabytePerSecond); - AssertEx.EqualTolerance(ExabytesPerSecondInOneBitPerSecond, (double)exabytepersecondQuantity.Value, ExabytesPerSecondTolerance); - Assert.Equal(BitRateUnit.ExabytePerSecond, exabytepersecondQuantity.Unit); - - var exbibitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.ExbibitPerSecond); - AssertEx.EqualTolerance(ExbibitsPerSecondInOneBitPerSecond, (double)exbibitpersecondQuantity.Value, ExbibitsPerSecondTolerance); - Assert.Equal(BitRateUnit.ExbibitPerSecond, exbibitpersecondQuantity.Unit); - - var exbibytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.ExbibytePerSecond); - AssertEx.EqualTolerance(ExbibytesPerSecondInOneBitPerSecond, (double)exbibytepersecondQuantity.Value, ExbibytesPerSecondTolerance); - Assert.Equal(BitRateUnit.ExbibytePerSecond, exbibytepersecondQuantity.Unit); - - var gibibitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.GibibitPerSecond); - AssertEx.EqualTolerance(GibibitsPerSecondInOneBitPerSecond, (double)gibibitpersecondQuantity.Value, GibibitsPerSecondTolerance); - Assert.Equal(BitRateUnit.GibibitPerSecond, gibibitpersecondQuantity.Unit); - - var gibibytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.GibibytePerSecond); - AssertEx.EqualTolerance(GibibytesPerSecondInOneBitPerSecond, (double)gibibytepersecondQuantity.Value, GibibytesPerSecondTolerance); - Assert.Equal(BitRateUnit.GibibytePerSecond, gibibytepersecondQuantity.Unit); - - var gigabitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.GigabitPerSecond); - AssertEx.EqualTolerance(GigabitsPerSecondInOneBitPerSecond, (double)gigabitpersecondQuantity.Value, GigabitsPerSecondTolerance); - Assert.Equal(BitRateUnit.GigabitPerSecond, gigabitpersecondQuantity.Unit); - - var gigabytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.GigabytePerSecond); - AssertEx.EqualTolerance(GigabytesPerSecondInOneBitPerSecond, (double)gigabytepersecondQuantity.Value, GigabytesPerSecondTolerance); - Assert.Equal(BitRateUnit.GigabytePerSecond, gigabytepersecondQuantity.Unit); - - var kibibitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.KibibitPerSecond); - AssertEx.EqualTolerance(KibibitsPerSecondInOneBitPerSecond, (double)kibibitpersecondQuantity.Value, KibibitsPerSecondTolerance); - Assert.Equal(BitRateUnit.KibibitPerSecond, kibibitpersecondQuantity.Unit); - - var kibibytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.KibibytePerSecond); - AssertEx.EqualTolerance(KibibytesPerSecondInOneBitPerSecond, (double)kibibytepersecondQuantity.Value, KibibytesPerSecondTolerance); - Assert.Equal(BitRateUnit.KibibytePerSecond, kibibytepersecondQuantity.Unit); - - var kilobitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.KilobitPerSecond); - AssertEx.EqualTolerance(KilobitsPerSecondInOneBitPerSecond, (double)kilobitpersecondQuantity.Value, KilobitsPerSecondTolerance); - Assert.Equal(BitRateUnit.KilobitPerSecond, kilobitpersecondQuantity.Unit); - - var kilobytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.KilobytePerSecond); - AssertEx.EqualTolerance(KilobytesPerSecondInOneBitPerSecond, (double)kilobytepersecondQuantity.Value, KilobytesPerSecondTolerance); - Assert.Equal(BitRateUnit.KilobytePerSecond, kilobytepersecondQuantity.Unit); - - var mebibitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.MebibitPerSecond); - AssertEx.EqualTolerance(MebibitsPerSecondInOneBitPerSecond, (double)mebibitpersecondQuantity.Value, MebibitsPerSecondTolerance); - Assert.Equal(BitRateUnit.MebibitPerSecond, mebibitpersecondQuantity.Unit); - - var mebibytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.MebibytePerSecond); - AssertEx.EqualTolerance(MebibytesPerSecondInOneBitPerSecond, (double)mebibytepersecondQuantity.Value, MebibytesPerSecondTolerance); - Assert.Equal(BitRateUnit.MebibytePerSecond, mebibytepersecondQuantity.Unit); - - var megabitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.MegabitPerSecond); - AssertEx.EqualTolerance(MegabitsPerSecondInOneBitPerSecond, (double)megabitpersecondQuantity.Value, MegabitsPerSecondTolerance); - Assert.Equal(BitRateUnit.MegabitPerSecond, megabitpersecondQuantity.Unit); - - var megabytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.MegabytePerSecond); - AssertEx.EqualTolerance(MegabytesPerSecondInOneBitPerSecond, (double)megabytepersecondQuantity.Value, MegabytesPerSecondTolerance); - Assert.Equal(BitRateUnit.MegabytePerSecond, megabytepersecondQuantity.Unit); - - var pebibitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.PebibitPerSecond); - AssertEx.EqualTolerance(PebibitsPerSecondInOneBitPerSecond, (double)pebibitpersecondQuantity.Value, PebibitsPerSecondTolerance); - Assert.Equal(BitRateUnit.PebibitPerSecond, pebibitpersecondQuantity.Unit); - - var pebibytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.PebibytePerSecond); - AssertEx.EqualTolerance(PebibytesPerSecondInOneBitPerSecond, (double)pebibytepersecondQuantity.Value, PebibytesPerSecondTolerance); - Assert.Equal(BitRateUnit.PebibytePerSecond, pebibytepersecondQuantity.Unit); - - var petabitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.PetabitPerSecond); - AssertEx.EqualTolerance(PetabitsPerSecondInOneBitPerSecond, (double)petabitpersecondQuantity.Value, PetabitsPerSecondTolerance); - Assert.Equal(BitRateUnit.PetabitPerSecond, petabitpersecondQuantity.Unit); - - var petabytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.PetabytePerSecond); - AssertEx.EqualTolerance(PetabytesPerSecondInOneBitPerSecond, (double)petabytepersecondQuantity.Value, PetabytesPerSecondTolerance); - Assert.Equal(BitRateUnit.PetabytePerSecond, petabytepersecondQuantity.Unit); - - var tebibitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.TebibitPerSecond); - AssertEx.EqualTolerance(TebibitsPerSecondInOneBitPerSecond, (double)tebibitpersecondQuantity.Value, TebibitsPerSecondTolerance); - Assert.Equal(BitRateUnit.TebibitPerSecond, tebibitpersecondQuantity.Unit); - - var tebibytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.TebibytePerSecond); - AssertEx.EqualTolerance(TebibytesPerSecondInOneBitPerSecond, (double)tebibytepersecondQuantity.Value, TebibytesPerSecondTolerance); - Assert.Equal(BitRateUnit.TebibytePerSecond, tebibytepersecondQuantity.Unit); - - var terabitpersecondQuantity = bitpersecond.ToUnit(BitRateUnit.TerabitPerSecond); - AssertEx.EqualTolerance(TerabitsPerSecondInOneBitPerSecond, (double)terabitpersecondQuantity.Value, TerabitsPerSecondTolerance); - Assert.Equal(BitRateUnit.TerabitPerSecond, terabitpersecondQuantity.Unit); - - var terabytepersecondQuantity = bitpersecond.ToUnit(BitRateUnit.TerabytePerSecond); - AssertEx.EqualTolerance(TerabytesPerSecondInOneBitPerSecond, (double)terabytepersecondQuantity.Value, TerabytesPerSecondTolerance); - Assert.Equal(BitRateUnit.TerabytePerSecond, terabytepersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - AssertEx.EqualTolerance(1, BitRate.FromBitsPerSecond(bitpersecond.BitsPerSecond).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromBytesPerSecond(bitpersecond.BytesPerSecond).BitsPerSecond, BytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExabitsPerSecond(bitpersecond.ExabitsPerSecond).BitsPerSecond, ExabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExabytesPerSecond(bitpersecond.ExabytesPerSecond).BitsPerSecond, ExabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExbibitsPerSecond(bitpersecond.ExbibitsPerSecond).BitsPerSecond, ExbibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromExbibytesPerSecond(bitpersecond.ExbibytesPerSecond).BitsPerSecond, ExbibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGibibitsPerSecond(bitpersecond.GibibitsPerSecond).BitsPerSecond, GibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGibibytesPerSecond(bitpersecond.GibibytesPerSecond).BitsPerSecond, GibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGigabitsPerSecond(bitpersecond.GigabitsPerSecond).BitsPerSecond, GigabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromGigabytesPerSecond(bitpersecond.GigabytesPerSecond).BitsPerSecond, GigabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKibibitsPerSecond(bitpersecond.KibibitsPerSecond).BitsPerSecond, KibibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKibibytesPerSecond(bitpersecond.KibibytesPerSecond).BitsPerSecond, KibibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKilobitsPerSecond(bitpersecond.KilobitsPerSecond).BitsPerSecond, KilobitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromKilobytesPerSecond(bitpersecond.KilobytesPerSecond).BitsPerSecond, KilobytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMebibitsPerSecond(bitpersecond.MebibitsPerSecond).BitsPerSecond, MebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMebibytesPerSecond(bitpersecond.MebibytesPerSecond).BitsPerSecond, MebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMegabitsPerSecond(bitpersecond.MegabitsPerSecond).BitsPerSecond, MegabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromMegabytesPerSecond(bitpersecond.MegabytesPerSecond).BitsPerSecond, MegabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPebibitsPerSecond(bitpersecond.PebibitsPerSecond).BitsPerSecond, PebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPebibytesPerSecond(bitpersecond.PebibytesPerSecond).BitsPerSecond, PebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPetabitsPerSecond(bitpersecond.PetabitsPerSecond).BitsPerSecond, PetabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromPetabytesPerSecond(bitpersecond.PetabytesPerSecond).BitsPerSecond, PetabytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTebibitsPerSecond(bitpersecond.TebibitsPerSecond).BitsPerSecond, TebibitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTebibytesPerSecond(bitpersecond.TebibytesPerSecond).BitsPerSecond, TebibytesPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTerabitsPerSecond(bitpersecond.TerabitsPerSecond).BitsPerSecond, TerabitsPerSecondTolerance); - AssertEx.EqualTolerance(1, BitRate.FromTerabytesPerSecond(bitpersecond.TerabytesPerSecond).BitsPerSecond, TerabytesPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - BitRate v = BitRate.FromBitsPerSecond(1); - AssertEx.EqualTolerance(-1, -v.BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(2, (BitRate.FromBitsPerSecond(3)-v).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(2, (BitRate.FromBitsPerSecond(10)/5).BitsPerSecond, BitsPerSecondTolerance); - AssertEx.EqualTolerance(2, BitRate.FromBitsPerSecond(10)/BitRate.FromBitsPerSecond(5), BitsPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - BitRate oneBitPerSecond = BitRate.FromBitsPerSecond(1); - BitRate twoBitsPerSecond = BitRate.FromBitsPerSecond(2); - - Assert.True(oneBitPerSecond < twoBitsPerSecond); - Assert.True(oneBitPerSecond <= twoBitsPerSecond); - Assert.True(twoBitsPerSecond > oneBitPerSecond); - Assert.True(twoBitsPerSecond >= oneBitPerSecond); - - Assert.False(oneBitPerSecond > twoBitsPerSecond); - Assert.False(oneBitPerSecond >= twoBitsPerSecond); - Assert.False(twoBitsPerSecond < oneBitPerSecond); - Assert.False(twoBitsPerSecond <= oneBitPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - Assert.Equal(0, bitpersecond.CompareTo(bitpersecond)); - Assert.True(bitpersecond.CompareTo(BitRate.Zero) > 0); - Assert.True(BitRate.Zero.CompareTo(bitpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - Assert.Throws(() => bitpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - Assert.Throws(() => bitpersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - BitRate v = BitRate.FromBitsPerSecond(1); - Assert.True(v.Equals(BitRate.FromBitsPerSecond(1), BitsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(BitRate.Zero, BitsPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - Assert.False(bitpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - BitRate bitpersecond = BitRate.FromBitsPerSecond(1); - Assert.False(bitpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(BitRateUnit.Undefined, BitRate.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(BitRateUnit)).Cast(); - foreach(var unit in units) - { - if(unit == BitRateUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs deleted file mode 100644 index c424b3e7fb..0000000000 --- a/UnitsNet.Tests/GeneratedCode/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of BrakeSpecificFuelConsumption. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class BrakeSpecificFuelConsumptionTestsBase - { - protected abstract double GramsPerKiloWattHourInOneKilogramPerJoule { get; } - protected abstract double KilogramsPerJouleInOneKilogramPerJoule { get; } - protected abstract double PoundsPerMechanicalHorsepowerHourInOneKilogramPerJoule { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double GramsPerKiloWattHourTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerJouleTolerance { get { return 1e-5; } } - protected virtual double PoundsPerMechanicalHorsepowerHourTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new BrakeSpecificFuelConsumption((double)0.0, BrakeSpecificFuelConsumptionUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.PositiveInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NegativeInfinity, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new BrakeSpecificFuelConsumption(double.NaN, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule)); - } - - [Fact] - public void KilogramPerJouleToBrakeSpecificFuelConsumptionUnits() - { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - AssertEx.EqualTolerance(GramsPerKiloWattHourInOneKilogramPerJoule, kilogramperjoule.GramsPerKiloWattHour, GramsPerKiloWattHourTolerance); - AssertEx.EqualTolerance(KilogramsPerJouleInOneKilogramPerJoule, kilogramperjoule.KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(PoundsPerMechanicalHorsepowerHourInOneKilogramPerJoule, kilogramperjoule.PoundsPerMechanicalHorsepowerHour, PoundsPerMechanicalHorsepowerHourTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour).GramsPerKiloWattHour, GramsPerKiloWattHourTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.From(1, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour).PoundsPerMechanicalHorsepowerHour, PoundsPerMechanicalHorsepowerHourTolerance); - } - - [Fact] - public void FromKilogramsPerJoule_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); - } - - [Fact] - public void FromKilogramsPerJoule_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); - } - - [Fact] - public void As() - { - var kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - AssertEx.EqualTolerance(GramsPerKiloWattHourInOneKilogramPerJoule, kilogramperjoule.As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour), GramsPerKiloWattHourTolerance); - AssertEx.EqualTolerance(KilogramsPerJouleInOneKilogramPerJoule, kilogramperjoule.As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule), KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(PoundsPerMechanicalHorsepowerHourInOneKilogramPerJoule, kilogramperjoule.As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour), PoundsPerMechanicalHorsepowerHourTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - - var gramperkilowatthourQuantity = kilogramperjoule.ToUnit(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); - AssertEx.EqualTolerance(GramsPerKiloWattHourInOneKilogramPerJoule, (double)gramperkilowatthourQuantity.Value, GramsPerKiloWattHourTolerance); - Assert.Equal(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, gramperkilowatthourQuantity.Unit); - - var kilogramperjouleQuantity = kilogramperjoule.ToUnit(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); - AssertEx.EqualTolerance(KilogramsPerJouleInOneKilogramPerJoule, (double)kilogramperjouleQuantity.Value, KilogramsPerJouleTolerance); - Assert.Equal(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, kilogramperjouleQuantity.Unit); - - var poundpermechanicalhorsepowerhourQuantity = kilogramperjoule.ToUnit(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); - AssertEx.EqualTolerance(PoundsPerMechanicalHorsepowerHourInOneKilogramPerJoule, (double)poundpermechanicalhorsepowerhourQuantity.Value, PoundsPerMechanicalHorsepowerHourTolerance); - Assert.Equal(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, poundpermechanicalhorsepowerhourQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(kilogramperjoule.GramsPerKiloWattHour).KilogramsPerJoule, GramsPerKiloWattHourTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(kilogramperjoule.KilogramsPerJoule).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(1, BrakeSpecificFuelConsumption.FromPoundsPerMechanicalHorsepowerHour(kilogramperjoule.PoundsPerMechanicalHorsepowerHour).KilogramsPerJoule, PoundsPerMechanicalHorsepowerHourTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - BrakeSpecificFuelConsumption v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - AssertEx.EqualTolerance(-1, -v.KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(3)-v).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(2, (v + v).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(10, (v*10).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(10, (10*v).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10)/5).KilogramsPerJoule, KilogramsPerJouleTolerance); - AssertEx.EqualTolerance(2, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10)/BrakeSpecificFuelConsumption.FromKilogramsPerJoule(5), KilogramsPerJouleTolerance); - } - - [Fact] - public void ComparisonOperators() - { - BrakeSpecificFuelConsumption oneKilogramPerJoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - BrakeSpecificFuelConsumption twoKilogramsPerJoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(2); - - Assert.True(oneKilogramPerJoule < twoKilogramsPerJoule); - Assert.True(oneKilogramPerJoule <= twoKilogramsPerJoule); - Assert.True(twoKilogramsPerJoule > oneKilogramPerJoule); - Assert.True(twoKilogramsPerJoule >= oneKilogramPerJoule); - - Assert.False(oneKilogramPerJoule > twoKilogramsPerJoule); - Assert.False(oneKilogramPerJoule >= twoKilogramsPerJoule); - Assert.False(twoKilogramsPerJoule < oneKilogramPerJoule); - Assert.False(twoKilogramsPerJoule <= oneKilogramPerJoule); - } - - [Fact] - public void CompareToIsImplemented() - { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.Equal(0, kilogramperjoule.CompareTo(kilogramperjoule)); - Assert.True(kilogramperjoule.CompareTo(BrakeSpecificFuelConsumption.Zero) > 0); - Assert.True(BrakeSpecificFuelConsumption.Zero.CompareTo(kilogramperjoule) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.Throws(() => kilogramperjoule.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.Throws(() => kilogramperjoule.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - BrakeSpecificFuelConsumption v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.True(v.Equals(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1), KilogramsPerJouleTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(BrakeSpecificFuelConsumption.Zero, KilogramsPerJouleTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.False(kilogramperjoule.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); - Assert.False(kilogramperjoule.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(BrakeSpecificFuelConsumptionUnit.Undefined, BrakeSpecificFuelConsumption.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(BrakeSpecificFuelConsumptionUnit)).Cast(); - foreach(var unit in units) - { - if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs deleted file mode 100644 index 08850f7618..0000000000 --- a/UnitsNet.Tests/GeneratedCode/CapacitanceTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Capacitance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class CapacitanceTestsBase - { - protected abstract double FaradsInOneFarad { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double FaradsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Capacitance((double)0.0, CapacitanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Capacitance(double.PositiveInfinity, CapacitanceUnit.Farad)); - Assert.Throws(() => new Capacitance(double.NegativeInfinity, CapacitanceUnit.Farad)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Capacitance(double.NaN, CapacitanceUnit.Farad)); - } - - [Fact] - public void FaradToCapacitanceUnits() - { - Capacitance farad = Capacitance.FromFarads(1); - AssertEx.EqualTolerance(FaradsInOneFarad, farad.Farads, FaradsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Capacitance.From(1, CapacitanceUnit.Farad).Farads, FaradsTolerance); - } - - [Fact] - public void FromFarads_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Capacitance.FromFarads(double.PositiveInfinity)); - Assert.Throws(() => Capacitance.FromFarads(double.NegativeInfinity)); - } - - [Fact] - public void FromFarads_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Capacitance.FromFarads(double.NaN)); - } - - [Fact] - public void As() - { - var farad = Capacitance.FromFarads(1); - AssertEx.EqualTolerance(FaradsInOneFarad, farad.As(CapacitanceUnit.Farad), FaradsTolerance); - } - - [Fact] - public void ToUnit() - { - var farad = Capacitance.FromFarads(1); - - var faradQuantity = farad.ToUnit(CapacitanceUnit.Farad); - AssertEx.EqualTolerance(FaradsInOneFarad, (double)faradQuantity.Value, FaradsTolerance); - Assert.Equal(CapacitanceUnit.Farad, faradQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Capacitance farad = Capacitance.FromFarads(1); - AssertEx.EqualTolerance(1, Capacitance.FromFarads(farad.Farads).Farads, FaradsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Capacitance v = Capacitance.FromFarads(1); - AssertEx.EqualTolerance(-1, -v.Farads, FaradsTolerance); - AssertEx.EqualTolerance(2, (Capacitance.FromFarads(3)-v).Farads, FaradsTolerance); - AssertEx.EqualTolerance(2, (v + v).Farads, FaradsTolerance); - AssertEx.EqualTolerance(10, (v*10).Farads, FaradsTolerance); - AssertEx.EqualTolerance(10, (10*v).Farads, FaradsTolerance); - AssertEx.EqualTolerance(2, (Capacitance.FromFarads(10)/5).Farads, FaradsTolerance); - AssertEx.EqualTolerance(2, Capacitance.FromFarads(10)/Capacitance.FromFarads(5), FaradsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Capacitance oneFarad = Capacitance.FromFarads(1); - Capacitance twoFarads = Capacitance.FromFarads(2); - - Assert.True(oneFarad < twoFarads); - Assert.True(oneFarad <= twoFarads); - Assert.True(twoFarads > oneFarad); - Assert.True(twoFarads >= oneFarad); - - Assert.False(oneFarad > twoFarads); - Assert.False(oneFarad >= twoFarads); - Assert.False(twoFarads < oneFarad); - Assert.False(twoFarads <= oneFarad); - } - - [Fact] - public void CompareToIsImplemented() - { - Capacitance farad = Capacitance.FromFarads(1); - Assert.Equal(0, farad.CompareTo(farad)); - Assert.True(farad.CompareTo(Capacitance.Zero) > 0); - Assert.True(Capacitance.Zero.CompareTo(farad) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Capacitance farad = Capacitance.FromFarads(1); - Assert.Throws(() => farad.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Capacitance farad = Capacitance.FromFarads(1); - Assert.Throws(() => farad.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Capacitance v = Capacitance.FromFarads(1); - Assert.True(v.Equals(Capacitance.FromFarads(1), FaradsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Capacitance.Zero, FaradsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Capacitance farad = Capacitance.FromFarads(1); - Assert.False(farad.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Capacitance farad = Capacitance.FromFarads(1); - Assert.False(farad.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(CapacitanceUnit.Undefined, Capacitance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(CapacitanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == CapacitanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs deleted file mode 100644 index 7c9cfc75cb..0000000000 --- a/UnitsNet.Tests/GeneratedCode/DensityTestsBase.g.cs +++ /dev/null @@ -1,594 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Density. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class DensityTestsBase - { - protected abstract double CentigramsPerDeciLiterInOneKilogramPerCubicMeter { get; } - protected abstract double CentigramsPerLiterInOneKilogramPerCubicMeter { get; } - protected abstract double CentigramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double DecigramsPerDeciLiterInOneKilogramPerCubicMeter { get; } - protected abstract double DecigramsPerLiterInOneKilogramPerCubicMeter { get; } - protected abstract double DecigramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double GramsPerCubicCentimeterInOneKilogramPerCubicMeter { get; } - protected abstract double GramsPerCubicMeterInOneKilogramPerCubicMeter { get; } - protected abstract double GramsPerCubicMillimeterInOneKilogramPerCubicMeter { get; } - protected abstract double GramsPerDeciLiterInOneKilogramPerCubicMeter { get; } - protected abstract double GramsPerLiterInOneKilogramPerCubicMeter { get; } - protected abstract double GramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter { get; } - protected abstract double KilogramsPerCubicMeterInOneKilogramPerCubicMeter { get; } - protected abstract double KilogramsPerCubicMillimeterInOneKilogramPerCubicMeter { get; } - protected abstract double KilopoundsPerCubicFootInOneKilogramPerCubicMeter { get; } - protected abstract double KilopoundsPerCubicInchInOneKilogramPerCubicMeter { get; } - protected abstract double MicrogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } - protected abstract double MicrogramsPerLiterInOneKilogramPerCubicMeter { get; } - protected abstract double MicrogramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double MilligramsPerCubicMeterInOneKilogramPerCubicMeter { get; } - protected abstract double MilligramsPerDeciLiterInOneKilogramPerCubicMeter { get; } - protected abstract double MilligramsPerLiterInOneKilogramPerCubicMeter { get; } - protected abstract double MilligramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double NanogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } - protected abstract double NanogramsPerLiterInOneKilogramPerCubicMeter { get; } - protected abstract double NanogramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double PicogramsPerDeciLiterInOneKilogramPerCubicMeter { get; } - protected abstract double PicogramsPerLiterInOneKilogramPerCubicMeter { get; } - protected abstract double PicogramsPerMilliliterInOneKilogramPerCubicMeter { get; } - protected abstract double PoundsPerCubicFootInOneKilogramPerCubicMeter { get; } - protected abstract double PoundsPerCubicInchInOneKilogramPerCubicMeter { get; } - protected abstract double PoundsPerImperialGallonInOneKilogramPerCubicMeter { get; } - protected abstract double PoundsPerUSGallonInOneKilogramPerCubicMeter { get; } - protected abstract double SlugsPerCubicFootInOneKilogramPerCubicMeter { get; } - protected abstract double TonnesPerCubicCentimeterInOneKilogramPerCubicMeter { get; } - protected abstract double TonnesPerCubicMeterInOneKilogramPerCubicMeter { get; } - protected abstract double TonnesPerCubicMillimeterInOneKilogramPerCubicMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentigramsPerDeciLiterTolerance { get { return 1e-5; } } - protected virtual double CentigramsPerLiterTolerance { get { return 1e-5; } } - protected virtual double CentigramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double DecigramsPerDeciLiterTolerance { get { return 1e-5; } } - protected virtual double DecigramsPerLiterTolerance { get { return 1e-5; } } - protected virtual double DecigramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double GramsPerCubicCentimeterTolerance { get { return 1e-5; } } - protected virtual double GramsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double GramsPerCubicMillimeterTolerance { get { return 1e-5; } } - protected virtual double GramsPerDeciLiterTolerance { get { return 1e-5; } } - protected virtual double GramsPerLiterTolerance { get { return 1e-5; } } - protected virtual double GramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerCubicCentimeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerCubicMillimeterTolerance { get { return 1e-5; } } - protected virtual double KilopoundsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double KilopoundsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double MicrogramsPerDeciLiterTolerance { get { return 1e-5; } } - protected virtual double MicrogramsPerLiterTolerance { get { return 1e-5; } } - protected virtual double MicrogramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double MilligramsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double MilligramsPerDeciLiterTolerance { get { return 1e-5; } } - protected virtual double MilligramsPerLiterTolerance { get { return 1e-5; } } - protected virtual double MilligramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double NanogramsPerDeciLiterTolerance { get { return 1e-5; } } - protected virtual double NanogramsPerLiterTolerance { get { return 1e-5; } } - protected virtual double NanogramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double PicogramsPerDeciLiterTolerance { get { return 1e-5; } } - protected virtual double PicogramsPerLiterTolerance { get { return 1e-5; } } - protected virtual double PicogramsPerMilliliterTolerance { get { return 1e-5; } } - protected virtual double PoundsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double PoundsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double PoundsPerImperialGallonTolerance { get { return 1e-5; } } - protected virtual double PoundsPerUSGallonTolerance { get { return 1e-5; } } - protected virtual double SlugsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double TonnesPerCubicCentimeterTolerance { get { return 1e-5; } } - protected virtual double TonnesPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double TonnesPerCubicMillimeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Density((double)0.0, DensityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Density(double.PositiveInfinity, DensityUnit.KilogramPerCubicMeter)); - Assert.Throws(() => new Density(double.NegativeInfinity, DensityUnit.KilogramPerCubicMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Density(double.NaN, DensityUnit.KilogramPerCubicMeter)); - } - - [Fact] - public void KilogramPerCubicMeterToDensityUnits() - { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerLiter, CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(DecigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(DecigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.DecigramsPerLiter, DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(DecigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(GramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerCubicCentimeter, GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(GramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerCubicMeter, GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(GramsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerCubicMillimeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(GramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerDeciLiter, GramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(GramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerLiter, GramsPerLiterTolerance); - AssertEx.EqualTolerance(GramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.GramsPerMilliliter, GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilogramsPerCubicCentimeter, KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(KilogramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(KilogramsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilogramsPerCubicMillimeter, KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(KilopoundsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilopoundsPerCubicFoot, KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(KilopoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(MicrogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerLiter, MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(MicrogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(MilligramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MilligramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(MilligramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerLiter, MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(MilligramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(NanogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(NanogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.NanogramsPerLiter, NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(NanogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(PicogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(PicogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PicogramsPerLiter, PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(PicogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(PoundsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerCubicFoot, PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(PoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerCubicInch, PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(PoundsPerImperialGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(PoundsPerUSGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.PoundsPerUSGallon, PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(SlugsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.SlugsPerCubicFoot, SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(TonnesPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(TonnesPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(TonnesPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerDeciliter).CentigramsPerDeciLiter, CentigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerLiter).CentigramsPerLiter, CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.CentigramPerMilliliter).CentigramsPerMilliliter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerDeciliter).DecigramsPerDeciLiter, DecigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerLiter).DecigramsPerLiter, DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.DecigramPerMilliliter).DecigramsPerMilliliter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicCentimeter).GramsPerCubicCentimeter, GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicMeter).GramsPerCubicMeter, GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerCubicMillimeter).GramsPerCubicMillimeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerDeciliter).GramsPerDeciLiter, GramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerLiter).GramsPerLiter, GramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.GramPerMilliliter).GramsPerMilliliter, GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicCentimeter).KilogramsPerCubicCentimeter, KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilogramPerCubicMillimeter).KilogramsPerCubicMillimeter, KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilopoundPerCubicFoot).KilopoundsPerCubicFoot, KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.KilopoundPerCubicInch).KilopoundsPerCubicInch, KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerDeciliter).MicrogramsPerDeciLiter, MicrogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerLiter).MicrogramsPerLiter, MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MicrogramPerMilliliter).MicrogramsPerMilliliter, MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerCubicMeter).MilligramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerDeciliter).MilligramsPerDeciLiter, MilligramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerLiter).MilligramsPerLiter, MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.MilligramPerMilliliter).MilligramsPerMilliliter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerDeciliter).NanogramsPerDeciLiter, NanogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerLiter).NanogramsPerLiter, NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.NanogramPerMilliliter).NanogramsPerMilliliter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerDeciliter).PicogramsPerDeciLiter, PicogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerLiter).PicogramsPerLiter, PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PicogramPerMilliliter).PicogramsPerMilliliter, PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerCubicFoot).PoundsPerCubicFoot, PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerCubicInch).PoundsPerCubicInch, PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerImperialGallon).PoundsPerImperialGallon, PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.PoundPerUSGallon).PoundsPerUSGallon, PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.SlugPerCubicFoot).SlugsPerCubicFoot, SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicCentimeter).TonnesPerCubicCentimeter, TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMeter).TonnesPerCubicMeter, TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.From(1, DensityUnit.TonnePerCubicMillimeter).TonnesPerCubicMillimeter, TonnesPerCubicMillimeterTolerance); - } - - [Fact] - public void FromKilogramsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromKilogramsPerCubicMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Density.FromKilogramsPerCubicMeter(double.NaN)); - } - - [Fact] - public void As() - { - var kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerDeciliter), CentigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerLiter), CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.CentigramPerMilliliter), CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(DecigramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.DecigramPerDeciliter), DecigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(DecigramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.DecigramPerLiter), DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(DecigramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.DecigramPerMilliliter), DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(GramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerCubicCentimeter), GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(GramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerCubicMeter), GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(GramsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerCubicMillimeter), GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(GramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerDeciliter), GramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(GramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerLiter), GramsPerLiterTolerance); - AssertEx.EqualTolerance(GramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.GramPerMilliliter), GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilogramPerCubicCentimeter), KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(KilogramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilogramPerCubicMeter), KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(KilogramsPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilogramPerCubicMillimeter), KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(KilopoundsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilopoundPerCubicFoot), KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(KilopoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.KilopoundPerCubicInch), KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerDeciliter), MicrogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(MicrogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerLiter), MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(MicrogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MicrogramPerMilliliter), MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(MilligramsPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerCubicMeter), MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MilligramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerDeciliter), MilligramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(MilligramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerLiter), MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(MilligramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.MilligramPerMilliliter), MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(NanogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.NanogramPerDeciliter), NanogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(NanogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.NanogramPerLiter), NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(NanogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.NanogramPerMilliliter), NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(PicogramsPerDeciLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PicogramPerDeciliter), PicogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(PicogramsPerLiterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PicogramPerLiter), PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(PicogramsPerMilliliterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PicogramPerMilliliter), PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(PoundsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerCubicFoot), PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(PoundsPerCubicInchInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerCubicInch), PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(PoundsPerImperialGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerImperialGallon), PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(PoundsPerUSGallonInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.PoundPerUSGallon), PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(SlugsPerCubicFootInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.SlugPerCubicFoot), SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(TonnesPerCubicCentimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.TonnePerCubicCentimeter), TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(TonnesPerCubicMeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.TonnePerCubicMeter), TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(TonnesPerCubicMillimeterInOneKilogramPerCubicMeter, kilogrampercubicmeter.As(DensityUnit.TonnePerCubicMillimeter), TonnesPerCubicMillimeterTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - - var centigramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.CentigramPerDeciliter); - AssertEx.EqualTolerance(CentigramsPerDeciLiterInOneKilogramPerCubicMeter, (double)centigramperdeciliterQuantity.Value, CentigramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.CentigramPerDeciliter, centigramperdeciliterQuantity.Unit); - - var centigramperliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.CentigramPerLiter); - AssertEx.EqualTolerance(CentigramsPerLiterInOneKilogramPerCubicMeter, (double)centigramperliterQuantity.Value, CentigramsPerLiterTolerance); - Assert.Equal(DensityUnit.CentigramPerLiter, centigramperliterQuantity.Unit); - - var centigrampermilliliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.CentigramPerMilliliter); - AssertEx.EqualTolerance(CentigramsPerMilliliterInOneKilogramPerCubicMeter, (double)centigrampermilliliterQuantity.Value, CentigramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.CentigramPerMilliliter, centigrampermilliliterQuantity.Unit); - - var decigramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.DecigramPerDeciliter); - AssertEx.EqualTolerance(DecigramsPerDeciLiterInOneKilogramPerCubicMeter, (double)decigramperdeciliterQuantity.Value, DecigramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.DecigramPerDeciliter, decigramperdeciliterQuantity.Unit); - - var decigramperliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.DecigramPerLiter); - AssertEx.EqualTolerance(DecigramsPerLiterInOneKilogramPerCubicMeter, (double)decigramperliterQuantity.Value, DecigramsPerLiterTolerance); - Assert.Equal(DensityUnit.DecigramPerLiter, decigramperliterQuantity.Unit); - - var decigrampermilliliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.DecigramPerMilliliter); - AssertEx.EqualTolerance(DecigramsPerMilliliterInOneKilogramPerCubicMeter, (double)decigrampermilliliterQuantity.Value, DecigramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.DecigramPerMilliliter, decigrampermilliliterQuantity.Unit); - - var grampercubiccentimeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.GramPerCubicCentimeter); - AssertEx.EqualTolerance(GramsPerCubicCentimeterInOneKilogramPerCubicMeter, (double)grampercubiccentimeterQuantity.Value, GramsPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.GramPerCubicCentimeter, grampercubiccentimeterQuantity.Unit); - - var grampercubicmeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.GramPerCubicMeter); - AssertEx.EqualTolerance(GramsPerCubicMeterInOneKilogramPerCubicMeter, (double)grampercubicmeterQuantity.Value, GramsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.GramPerCubicMeter, grampercubicmeterQuantity.Unit); - - var grampercubicmillimeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.GramPerCubicMillimeter); - AssertEx.EqualTolerance(GramsPerCubicMillimeterInOneKilogramPerCubicMeter, (double)grampercubicmillimeterQuantity.Value, GramsPerCubicMillimeterTolerance); - Assert.Equal(DensityUnit.GramPerCubicMillimeter, grampercubicmillimeterQuantity.Unit); - - var gramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.GramPerDeciliter); - AssertEx.EqualTolerance(GramsPerDeciLiterInOneKilogramPerCubicMeter, (double)gramperdeciliterQuantity.Value, GramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.GramPerDeciliter, gramperdeciliterQuantity.Unit); - - var gramperliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.GramPerLiter); - AssertEx.EqualTolerance(GramsPerLiterInOneKilogramPerCubicMeter, (double)gramperliterQuantity.Value, GramsPerLiterTolerance); - Assert.Equal(DensityUnit.GramPerLiter, gramperliterQuantity.Unit); - - var grampermilliliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.GramPerMilliliter); - AssertEx.EqualTolerance(GramsPerMilliliterInOneKilogramPerCubicMeter, (double)grampermilliliterQuantity.Value, GramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.GramPerMilliliter, grampermilliliterQuantity.Unit); - - var kilogrampercubiccentimeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.KilogramPerCubicCentimeter); - AssertEx.EqualTolerance(KilogramsPerCubicCentimeterInOneKilogramPerCubicMeter, (double)kilogrampercubiccentimeterQuantity.Value, KilogramsPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.KilogramPerCubicCentimeter, kilogrampercubiccentimeterQuantity.Unit); - - var kilogrampercubicmeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.KilogramPerCubicMeter); - AssertEx.EqualTolerance(KilogramsPerCubicMeterInOneKilogramPerCubicMeter, (double)kilogrampercubicmeterQuantity.Value, KilogramsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.KilogramPerCubicMeter, kilogrampercubicmeterQuantity.Unit); - - var kilogrampercubicmillimeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.KilogramPerCubicMillimeter); - AssertEx.EqualTolerance(KilogramsPerCubicMillimeterInOneKilogramPerCubicMeter, (double)kilogrampercubicmillimeterQuantity.Value, KilogramsPerCubicMillimeterTolerance); - Assert.Equal(DensityUnit.KilogramPerCubicMillimeter, kilogrampercubicmillimeterQuantity.Unit); - - var kilopoundpercubicfootQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.KilopoundPerCubicFoot); - AssertEx.EqualTolerance(KilopoundsPerCubicFootInOneKilogramPerCubicMeter, (double)kilopoundpercubicfootQuantity.Value, KilopoundsPerCubicFootTolerance); - Assert.Equal(DensityUnit.KilopoundPerCubicFoot, kilopoundpercubicfootQuantity.Unit); - - var kilopoundpercubicinchQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.KilopoundPerCubicInch); - AssertEx.EqualTolerance(KilopoundsPerCubicInchInOneKilogramPerCubicMeter, (double)kilopoundpercubicinchQuantity.Value, KilopoundsPerCubicInchTolerance); - Assert.Equal(DensityUnit.KilopoundPerCubicInch, kilopoundpercubicinchQuantity.Unit); - - var microgramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.MicrogramPerDeciliter); - AssertEx.EqualTolerance(MicrogramsPerDeciLiterInOneKilogramPerCubicMeter, (double)microgramperdeciliterQuantity.Value, MicrogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.MicrogramPerDeciliter, microgramperdeciliterQuantity.Unit); - - var microgramperliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.MicrogramPerLiter); - AssertEx.EqualTolerance(MicrogramsPerLiterInOneKilogramPerCubicMeter, (double)microgramperliterQuantity.Value, MicrogramsPerLiterTolerance); - Assert.Equal(DensityUnit.MicrogramPerLiter, microgramperliterQuantity.Unit); - - var microgrampermilliliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.MicrogramPerMilliliter); - AssertEx.EqualTolerance(MicrogramsPerMilliliterInOneKilogramPerCubicMeter, (double)microgrampermilliliterQuantity.Value, MicrogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.MicrogramPerMilliliter, microgrampermilliliterQuantity.Unit); - - var milligrampercubicmeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.MilligramPerCubicMeter); - AssertEx.EqualTolerance(MilligramsPerCubicMeterInOneKilogramPerCubicMeter, (double)milligrampercubicmeterQuantity.Value, MilligramsPerCubicMeterTolerance); - Assert.Equal(DensityUnit.MilligramPerCubicMeter, milligrampercubicmeterQuantity.Unit); - - var milligramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.MilligramPerDeciliter); - AssertEx.EqualTolerance(MilligramsPerDeciLiterInOneKilogramPerCubicMeter, (double)milligramperdeciliterQuantity.Value, MilligramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.MilligramPerDeciliter, milligramperdeciliterQuantity.Unit); - - var milligramperliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.MilligramPerLiter); - AssertEx.EqualTolerance(MilligramsPerLiterInOneKilogramPerCubicMeter, (double)milligramperliterQuantity.Value, MilligramsPerLiterTolerance); - Assert.Equal(DensityUnit.MilligramPerLiter, milligramperliterQuantity.Unit); - - var milligrampermilliliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.MilligramPerMilliliter); - AssertEx.EqualTolerance(MilligramsPerMilliliterInOneKilogramPerCubicMeter, (double)milligrampermilliliterQuantity.Value, MilligramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.MilligramPerMilliliter, milligrampermilliliterQuantity.Unit); - - var nanogramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.NanogramPerDeciliter); - AssertEx.EqualTolerance(NanogramsPerDeciLiterInOneKilogramPerCubicMeter, (double)nanogramperdeciliterQuantity.Value, NanogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.NanogramPerDeciliter, nanogramperdeciliterQuantity.Unit); - - var nanogramperliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.NanogramPerLiter); - AssertEx.EqualTolerance(NanogramsPerLiterInOneKilogramPerCubicMeter, (double)nanogramperliterQuantity.Value, NanogramsPerLiterTolerance); - Assert.Equal(DensityUnit.NanogramPerLiter, nanogramperliterQuantity.Unit); - - var nanogrampermilliliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.NanogramPerMilliliter); - AssertEx.EqualTolerance(NanogramsPerMilliliterInOneKilogramPerCubicMeter, (double)nanogrampermilliliterQuantity.Value, NanogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.NanogramPerMilliliter, nanogrampermilliliterQuantity.Unit); - - var picogramperdeciliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.PicogramPerDeciliter); - AssertEx.EqualTolerance(PicogramsPerDeciLiterInOneKilogramPerCubicMeter, (double)picogramperdeciliterQuantity.Value, PicogramsPerDeciLiterTolerance); - Assert.Equal(DensityUnit.PicogramPerDeciliter, picogramperdeciliterQuantity.Unit); - - var picogramperliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.PicogramPerLiter); - AssertEx.EqualTolerance(PicogramsPerLiterInOneKilogramPerCubicMeter, (double)picogramperliterQuantity.Value, PicogramsPerLiterTolerance); - Assert.Equal(DensityUnit.PicogramPerLiter, picogramperliterQuantity.Unit); - - var picogrampermilliliterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.PicogramPerMilliliter); - AssertEx.EqualTolerance(PicogramsPerMilliliterInOneKilogramPerCubicMeter, (double)picogrampermilliliterQuantity.Value, PicogramsPerMilliliterTolerance); - Assert.Equal(DensityUnit.PicogramPerMilliliter, picogrampermilliliterQuantity.Unit); - - var poundpercubicfootQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.PoundPerCubicFoot); - AssertEx.EqualTolerance(PoundsPerCubicFootInOneKilogramPerCubicMeter, (double)poundpercubicfootQuantity.Value, PoundsPerCubicFootTolerance); - Assert.Equal(DensityUnit.PoundPerCubicFoot, poundpercubicfootQuantity.Unit); - - var poundpercubicinchQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.PoundPerCubicInch); - AssertEx.EqualTolerance(PoundsPerCubicInchInOneKilogramPerCubicMeter, (double)poundpercubicinchQuantity.Value, PoundsPerCubicInchTolerance); - Assert.Equal(DensityUnit.PoundPerCubicInch, poundpercubicinchQuantity.Unit); - - var poundperimperialgallonQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.PoundPerImperialGallon); - AssertEx.EqualTolerance(PoundsPerImperialGallonInOneKilogramPerCubicMeter, (double)poundperimperialgallonQuantity.Value, PoundsPerImperialGallonTolerance); - Assert.Equal(DensityUnit.PoundPerImperialGallon, poundperimperialgallonQuantity.Unit); - - var poundperusgallonQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.PoundPerUSGallon); - AssertEx.EqualTolerance(PoundsPerUSGallonInOneKilogramPerCubicMeter, (double)poundperusgallonQuantity.Value, PoundsPerUSGallonTolerance); - Assert.Equal(DensityUnit.PoundPerUSGallon, poundperusgallonQuantity.Unit); - - var slugpercubicfootQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.SlugPerCubicFoot); - AssertEx.EqualTolerance(SlugsPerCubicFootInOneKilogramPerCubicMeter, (double)slugpercubicfootQuantity.Value, SlugsPerCubicFootTolerance); - Assert.Equal(DensityUnit.SlugPerCubicFoot, slugpercubicfootQuantity.Unit); - - var tonnepercubiccentimeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.TonnePerCubicCentimeter); - AssertEx.EqualTolerance(TonnesPerCubicCentimeterInOneKilogramPerCubicMeter, (double)tonnepercubiccentimeterQuantity.Value, TonnesPerCubicCentimeterTolerance); - Assert.Equal(DensityUnit.TonnePerCubicCentimeter, tonnepercubiccentimeterQuantity.Unit); - - var tonnepercubicmeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.TonnePerCubicMeter); - AssertEx.EqualTolerance(TonnesPerCubicMeterInOneKilogramPerCubicMeter, (double)tonnepercubicmeterQuantity.Value, TonnesPerCubicMeterTolerance); - Assert.Equal(DensityUnit.TonnePerCubicMeter, tonnepercubicmeterQuantity.Unit); - - var tonnepercubicmillimeterQuantity = kilogrampercubicmeter.ToUnit(DensityUnit.TonnePerCubicMillimeter); - AssertEx.EqualTolerance(TonnesPerCubicMillimeterInOneKilogramPerCubicMeter, (double)tonnepercubicmillimeterQuantity.Value, TonnesPerCubicMillimeterTolerance); - Assert.Equal(DensityUnit.TonnePerCubicMillimeter, tonnepercubicmillimeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(1, Density.FromCentigramsPerDeciLiter(kilogrampercubicmeter.CentigramsPerDeciLiter).KilogramsPerCubicMeter, CentigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromCentigramsPerLiter(kilogrampercubicmeter.CentigramsPerLiter).KilogramsPerCubicMeter, CentigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromCentigramsPerMilliliter(kilogrampercubicmeter.CentigramsPerMilliliter).KilogramsPerCubicMeter, CentigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromDecigramsPerDeciLiter(kilogrampercubicmeter.DecigramsPerDeciLiter).KilogramsPerCubicMeter, DecigramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromDecigramsPerLiter(kilogrampercubicmeter.DecigramsPerLiter).KilogramsPerCubicMeter, DecigramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromDecigramsPerMilliliter(kilogrampercubicmeter.DecigramsPerMilliliter).KilogramsPerCubicMeter, DecigramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerCubicCentimeter(kilogrampercubicmeter.GramsPerCubicCentimeter).KilogramsPerCubicMeter, GramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMeter(kilogrampercubicmeter.GramsPerCubicMeter).KilogramsPerCubicMeter, GramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerCubicMillimeter(kilogrampercubicmeter.GramsPerCubicMillimeter).KilogramsPerCubicMeter, GramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerDeciLiter(kilogrampercubicmeter.GramsPerDeciLiter).KilogramsPerCubicMeter, GramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerLiter(kilogrampercubicmeter.GramsPerLiter).KilogramsPerCubicMeter, GramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromGramsPerMilliliter(kilogrampercubicmeter.GramsPerMilliliter).KilogramsPerCubicMeter, GramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicCentimeter(kilogrampercubicmeter.KilogramsPerCubicCentimeter).KilogramsPerCubicMeter, KilogramsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicMeter(kilogrampercubicmeter.KilogramsPerCubicMeter).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilogramsPerCubicMillimeter(kilogrampercubicmeter.KilogramsPerCubicMillimeter).KilogramsPerCubicMeter, KilogramsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicFoot(kilogrampercubicmeter.KilopoundsPerCubicFoot).KilogramsPerCubicMeter, KilopoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.FromKilopoundsPerCubicInch(kilogrampercubicmeter.KilopoundsPerCubicInch).KilogramsPerCubicMeter, KilopoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerDeciLiter(kilogrampercubicmeter.MicrogramsPerDeciLiter).KilogramsPerCubicMeter, MicrogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerLiter(kilogrampercubicmeter.MicrogramsPerLiter).KilogramsPerCubicMeter, MicrogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMicrogramsPerMilliliter(kilogrampercubicmeter.MicrogramsPerMilliliter).KilogramsPerCubicMeter, MicrogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerCubicMeter(kilogrampercubicmeter.MilligramsPerCubicMeter).KilogramsPerCubicMeter, MilligramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerDeciLiter(kilogrampercubicmeter.MilligramsPerDeciLiter).KilogramsPerCubicMeter, MilligramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerLiter(kilogrampercubicmeter.MilligramsPerLiter).KilogramsPerCubicMeter, MilligramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromMilligramsPerMilliliter(kilogrampercubicmeter.MilligramsPerMilliliter).KilogramsPerCubicMeter, MilligramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromNanogramsPerDeciLiter(kilogrampercubicmeter.NanogramsPerDeciLiter).KilogramsPerCubicMeter, NanogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromNanogramsPerLiter(kilogrampercubicmeter.NanogramsPerLiter).KilogramsPerCubicMeter, NanogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromNanogramsPerMilliliter(kilogrampercubicmeter.NanogramsPerMilliliter).KilogramsPerCubicMeter, NanogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromPicogramsPerDeciLiter(kilogrampercubicmeter.PicogramsPerDeciLiter).KilogramsPerCubicMeter, PicogramsPerDeciLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromPicogramsPerLiter(kilogrampercubicmeter.PicogramsPerLiter).KilogramsPerCubicMeter, PicogramsPerLiterTolerance); - AssertEx.EqualTolerance(1, Density.FromPicogramsPerMilliliter(kilogrampercubicmeter.PicogramsPerMilliliter).KilogramsPerCubicMeter, PicogramsPerMilliliterTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicFoot(kilogrampercubicmeter.PoundsPerCubicFoot).KilogramsPerCubicMeter, PoundsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerCubicInch(kilogrampercubicmeter.PoundsPerCubicInch).KilogramsPerCubicMeter, PoundsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerImperialGallon(kilogrampercubicmeter.PoundsPerImperialGallon).KilogramsPerCubicMeter, PoundsPerImperialGallonTolerance); - AssertEx.EqualTolerance(1, Density.FromPoundsPerUSGallon(kilogrampercubicmeter.PoundsPerUSGallon).KilogramsPerCubicMeter, PoundsPerUSGallonTolerance); - AssertEx.EqualTolerance(1, Density.FromSlugsPerCubicFoot(kilogrampercubicmeter.SlugsPerCubicFoot).KilogramsPerCubicMeter, SlugsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicCentimeter(kilogrampercubicmeter.TonnesPerCubicCentimeter).KilogramsPerCubicMeter, TonnesPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicMeter(kilogrampercubicmeter.TonnesPerCubicMeter).KilogramsPerCubicMeter, TonnesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Density.FromTonnesPerCubicMillimeter(kilogrampercubicmeter.TonnesPerCubicMillimeter).KilogramsPerCubicMeter, TonnesPerCubicMillimeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Density v = Density.FromKilogramsPerCubicMeter(1); - AssertEx.EqualTolerance(-1, -v.KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Density.FromKilogramsPerCubicMeter(3)-v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Density.FromKilogramsPerCubicMeter(10)/5).KilogramsPerCubicMeter, KilogramsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, Density.FromKilogramsPerCubicMeter(10)/Density.FromKilogramsPerCubicMeter(5), KilogramsPerCubicMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Density oneKilogramPerCubicMeter = Density.FromKilogramsPerCubicMeter(1); - Density twoKilogramsPerCubicMeter = Density.FromKilogramsPerCubicMeter(2); - - Assert.True(oneKilogramPerCubicMeter < twoKilogramsPerCubicMeter); - Assert.True(oneKilogramPerCubicMeter <= twoKilogramsPerCubicMeter); - Assert.True(twoKilogramsPerCubicMeter > oneKilogramPerCubicMeter); - Assert.True(twoKilogramsPerCubicMeter >= oneKilogramPerCubicMeter); - - Assert.False(oneKilogramPerCubicMeter > twoKilogramsPerCubicMeter); - Assert.False(oneKilogramPerCubicMeter >= twoKilogramsPerCubicMeter); - Assert.False(twoKilogramsPerCubicMeter < oneKilogramPerCubicMeter); - Assert.False(twoKilogramsPerCubicMeter <= oneKilogramPerCubicMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - Assert.Equal(0, kilogrampercubicmeter.CompareTo(kilogrampercubicmeter)); - Assert.True(kilogrampercubicmeter.CompareTo(Density.Zero) > 0); - Assert.True(Density.Zero.CompareTo(kilogrampercubicmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - Assert.Throws(() => kilogrampercubicmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - Assert.Throws(() => kilogrampercubicmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Density v = Density.FromKilogramsPerCubicMeter(1); - Assert.True(v.Equals(Density.FromKilogramsPerCubicMeter(1), KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Density.Zero, KilogramsPerCubicMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - Assert.False(kilogrampercubicmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Density kilogrampercubicmeter = Density.FromKilogramsPerCubicMeter(1); - Assert.False(kilogrampercubicmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(DensityUnit.Undefined, Density.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(DensityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == DensityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs deleted file mode 100644 index 72f080eb89..0000000000 --- a/UnitsNet.Tests/GeneratedCode/DurationTestsBase.g.cs +++ /dev/null @@ -1,314 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Duration. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class DurationTestsBase - { - protected abstract double DaysInOneSecond { get; } - protected abstract double HoursInOneSecond { get; } - protected abstract double MicrosecondsInOneSecond { get; } - protected abstract double MillisecondsInOneSecond { get; } - protected abstract double MinutesInOneSecond { get; } - protected abstract double Months30InOneSecond { get; } - protected abstract double NanosecondsInOneSecond { get; } - protected abstract double SecondsInOneSecond { get; } - protected abstract double WeeksInOneSecond { get; } - protected abstract double Years365InOneSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DaysTolerance { get { return 1e-5; } } - protected virtual double HoursTolerance { get { return 1e-5; } } - protected virtual double MicrosecondsTolerance { get { return 1e-5; } } - protected virtual double MillisecondsTolerance { get { return 1e-5; } } - protected virtual double MinutesTolerance { get { return 1e-5; } } - protected virtual double Months30Tolerance { get { return 1e-5; } } - protected virtual double NanosecondsTolerance { get { return 1e-5; } } - protected virtual double SecondsTolerance { get { return 1e-5; } } - protected virtual double WeeksTolerance { get { return 1e-5; } } - protected virtual double Years365Tolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Duration((double)0.0, DurationUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Duration(double.PositiveInfinity, DurationUnit.Second)); - Assert.Throws(() => new Duration(double.NegativeInfinity, DurationUnit.Second)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Duration(double.NaN, DurationUnit.Second)); - } - - [Fact] - public void SecondToDurationUnits() - { - Duration second = Duration.FromSeconds(1); - AssertEx.EqualTolerance(DaysInOneSecond, second.Days, DaysTolerance); - AssertEx.EqualTolerance(HoursInOneSecond, second.Hours, HoursTolerance); - AssertEx.EqualTolerance(MicrosecondsInOneSecond, second.Microseconds, MicrosecondsTolerance); - AssertEx.EqualTolerance(MillisecondsInOneSecond, second.Milliseconds, MillisecondsTolerance); - AssertEx.EqualTolerance(MinutesInOneSecond, second.Minutes, MinutesTolerance); - AssertEx.EqualTolerance(Months30InOneSecond, second.Months30, Months30Tolerance); - AssertEx.EqualTolerance(NanosecondsInOneSecond, second.Nanoseconds, NanosecondsTolerance); - AssertEx.EqualTolerance(SecondsInOneSecond, second.Seconds, SecondsTolerance); - AssertEx.EqualTolerance(WeeksInOneSecond, second.Weeks, WeeksTolerance); - AssertEx.EqualTolerance(Years365InOneSecond, second.Years365, Years365Tolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Day).Days, DaysTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Hour).Hours, HoursTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Microsecond).Microseconds, MicrosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Millisecond).Milliseconds, MillisecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Minute).Minutes, MinutesTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Month30).Months30, Months30Tolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Nanosecond).Nanoseconds, NanosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Second).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Week).Weeks, WeeksTolerance); - AssertEx.EqualTolerance(1, Duration.From(1, DurationUnit.Year365).Years365, Years365Tolerance); - } - - [Fact] - public void FromSeconds_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Duration.FromSeconds(double.PositiveInfinity)); - Assert.Throws(() => Duration.FromSeconds(double.NegativeInfinity)); - } - - [Fact] - public void FromSeconds_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Duration.FromSeconds(double.NaN)); - } - - [Fact] - public void As() - { - var second = Duration.FromSeconds(1); - AssertEx.EqualTolerance(DaysInOneSecond, second.As(DurationUnit.Day), DaysTolerance); - AssertEx.EqualTolerance(HoursInOneSecond, second.As(DurationUnit.Hour), HoursTolerance); - AssertEx.EqualTolerance(MicrosecondsInOneSecond, second.As(DurationUnit.Microsecond), MicrosecondsTolerance); - AssertEx.EqualTolerance(MillisecondsInOneSecond, second.As(DurationUnit.Millisecond), MillisecondsTolerance); - AssertEx.EqualTolerance(MinutesInOneSecond, second.As(DurationUnit.Minute), MinutesTolerance); - AssertEx.EqualTolerance(Months30InOneSecond, second.As(DurationUnit.Month30), Months30Tolerance); - AssertEx.EqualTolerance(NanosecondsInOneSecond, second.As(DurationUnit.Nanosecond), NanosecondsTolerance); - AssertEx.EqualTolerance(SecondsInOneSecond, second.As(DurationUnit.Second), SecondsTolerance); - AssertEx.EqualTolerance(WeeksInOneSecond, second.As(DurationUnit.Week), WeeksTolerance); - AssertEx.EqualTolerance(Years365InOneSecond, second.As(DurationUnit.Year365), Years365Tolerance); - } - - [Fact] - public void ToUnit() - { - var second = Duration.FromSeconds(1); - - var dayQuantity = second.ToUnit(DurationUnit.Day); - AssertEx.EqualTolerance(DaysInOneSecond, (double)dayQuantity.Value, DaysTolerance); - Assert.Equal(DurationUnit.Day, dayQuantity.Unit); - - var hourQuantity = second.ToUnit(DurationUnit.Hour); - AssertEx.EqualTolerance(HoursInOneSecond, (double)hourQuantity.Value, HoursTolerance); - Assert.Equal(DurationUnit.Hour, hourQuantity.Unit); - - var microsecondQuantity = second.ToUnit(DurationUnit.Microsecond); - AssertEx.EqualTolerance(MicrosecondsInOneSecond, (double)microsecondQuantity.Value, MicrosecondsTolerance); - Assert.Equal(DurationUnit.Microsecond, microsecondQuantity.Unit); - - var millisecondQuantity = second.ToUnit(DurationUnit.Millisecond); - AssertEx.EqualTolerance(MillisecondsInOneSecond, (double)millisecondQuantity.Value, MillisecondsTolerance); - Assert.Equal(DurationUnit.Millisecond, millisecondQuantity.Unit); - - var minuteQuantity = second.ToUnit(DurationUnit.Minute); - AssertEx.EqualTolerance(MinutesInOneSecond, (double)minuteQuantity.Value, MinutesTolerance); - Assert.Equal(DurationUnit.Minute, minuteQuantity.Unit); - - var month30Quantity = second.ToUnit(DurationUnit.Month30); - AssertEx.EqualTolerance(Months30InOneSecond, (double)month30Quantity.Value, Months30Tolerance); - Assert.Equal(DurationUnit.Month30, month30Quantity.Unit); - - var nanosecondQuantity = second.ToUnit(DurationUnit.Nanosecond); - AssertEx.EqualTolerance(NanosecondsInOneSecond, (double)nanosecondQuantity.Value, NanosecondsTolerance); - Assert.Equal(DurationUnit.Nanosecond, nanosecondQuantity.Unit); - - var secondQuantity = second.ToUnit(DurationUnit.Second); - AssertEx.EqualTolerance(SecondsInOneSecond, (double)secondQuantity.Value, SecondsTolerance); - Assert.Equal(DurationUnit.Second, secondQuantity.Unit); - - var weekQuantity = second.ToUnit(DurationUnit.Week); - AssertEx.EqualTolerance(WeeksInOneSecond, (double)weekQuantity.Value, WeeksTolerance); - Assert.Equal(DurationUnit.Week, weekQuantity.Unit); - - var year365Quantity = second.ToUnit(DurationUnit.Year365); - AssertEx.EqualTolerance(Years365InOneSecond, (double)year365Quantity.Value, Years365Tolerance); - Assert.Equal(DurationUnit.Year365, year365Quantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Duration second = Duration.FromSeconds(1); - AssertEx.EqualTolerance(1, Duration.FromDays(second.Days).Seconds, DaysTolerance); - AssertEx.EqualTolerance(1, Duration.FromHours(second.Hours).Seconds, HoursTolerance); - AssertEx.EqualTolerance(1, Duration.FromMicroseconds(second.Microseconds).Seconds, MicrosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromMilliseconds(second.Milliseconds).Seconds, MillisecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromMinutes(second.Minutes).Seconds, MinutesTolerance); - AssertEx.EqualTolerance(1, Duration.FromMonths30(second.Months30).Seconds, Months30Tolerance); - AssertEx.EqualTolerance(1, Duration.FromNanoseconds(second.Nanoseconds).Seconds, NanosecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromSeconds(second.Seconds).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(1, Duration.FromWeeks(second.Weeks).Seconds, WeeksTolerance); - AssertEx.EqualTolerance(1, Duration.FromYears365(second.Years365).Seconds, Years365Tolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Duration v = Duration.FromSeconds(1); - AssertEx.EqualTolerance(-1, -v.Seconds, SecondsTolerance); - AssertEx.EqualTolerance(2, (Duration.FromSeconds(3)-v).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(2, (v + v).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(10, (v*10).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(10, (10*v).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(2, (Duration.FromSeconds(10)/5).Seconds, SecondsTolerance); - AssertEx.EqualTolerance(2, Duration.FromSeconds(10)/Duration.FromSeconds(5), SecondsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Duration oneSecond = Duration.FromSeconds(1); - Duration twoSeconds = Duration.FromSeconds(2); - - Assert.True(oneSecond < twoSeconds); - Assert.True(oneSecond <= twoSeconds); - Assert.True(twoSeconds > oneSecond); - Assert.True(twoSeconds >= oneSecond); - - Assert.False(oneSecond > twoSeconds); - Assert.False(oneSecond >= twoSeconds); - Assert.False(twoSeconds < oneSecond); - Assert.False(twoSeconds <= oneSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - Duration second = Duration.FromSeconds(1); - Assert.Equal(0, second.CompareTo(second)); - Assert.True(second.CompareTo(Duration.Zero) > 0); - Assert.True(Duration.Zero.CompareTo(second) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Duration second = Duration.FromSeconds(1); - Assert.Throws(() => second.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Duration second = Duration.FromSeconds(1); - Assert.Throws(() => second.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Duration v = Duration.FromSeconds(1); - Assert.True(v.Equals(Duration.FromSeconds(1), SecondsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Duration.Zero, SecondsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Duration second = Duration.FromSeconds(1); - Assert.False(second.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Duration second = Duration.FromSeconds(1); - Assert.False(second.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(DurationUnit.Undefined, Duration.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(DurationUnit)).Cast(); - foreach(var unit in units) - { - if(unit == DurationUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs deleted file mode 100644 index 7bfb997f2b..0000000000 --- a/UnitsNet.Tests/GeneratedCode/DynamicViscosityTestsBase.g.cs +++ /dev/null @@ -1,274 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of DynamicViscosity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class DynamicViscosityTestsBase - { - protected abstract double CentipoiseInOneNewtonSecondPerMeterSquared { get; } - protected abstract double MicropascalSecondsInOneNewtonSecondPerMeterSquared { get; } - protected abstract double MillipascalSecondsInOneNewtonSecondPerMeterSquared { get; } - protected abstract double NewtonSecondsPerMeterSquaredInOneNewtonSecondPerMeterSquared { get; } - protected abstract double PascalSecondsInOneNewtonSecondPerMeterSquared { get; } - protected abstract double PoiseInOneNewtonSecondPerMeterSquared { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentipoiseTolerance { get { return 1e-5; } } - protected virtual double MicropascalSecondsTolerance { get { return 1e-5; } } - protected virtual double MillipascalSecondsTolerance { get { return 1e-5; } } - protected virtual double NewtonSecondsPerMeterSquaredTolerance { get { return 1e-5; } } - protected virtual double PascalSecondsTolerance { get { return 1e-5; } } - protected virtual double PoiseTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new DynamicViscosity((double)0.0, DynamicViscosityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new DynamicViscosity(double.PositiveInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); - Assert.Throws(() => new DynamicViscosity(double.NegativeInfinity, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new DynamicViscosity(double.NaN, DynamicViscosityUnit.NewtonSecondPerMeterSquared)); - } - - [Fact] - public void NewtonSecondPerMeterSquaredToDynamicViscosityUnits() - { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - AssertEx.EqualTolerance(CentipoiseInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.Centipoise, CentipoiseTolerance); - AssertEx.EqualTolerance(MicropascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.MicropascalSeconds, MicropascalSecondsTolerance); - AssertEx.EqualTolerance(MillipascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.MillipascalSeconds, MillipascalSecondsTolerance); - AssertEx.EqualTolerance(NewtonSecondsPerMeterSquaredInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(PascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.PascalSeconds, PascalSecondsTolerance); - AssertEx.EqualTolerance(PoiseInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.Poise, PoiseTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Centipoise).Centipoise, CentipoiseTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.MicropascalSecond).MicropascalSeconds, MicropascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.MillipascalSecond).MillipascalSeconds, MillipascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.NewtonSecondPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.PascalSecond).PascalSeconds, PascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.From(1, DynamicViscosityUnit.Poise).Poise, PoiseTolerance); - } - - [Fact] - public void FromNewtonSecondsPerMeterSquared_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.PositiveInfinity)); - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtonSecondsPerMeterSquared_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => DynamicViscosity.FromNewtonSecondsPerMeterSquared(double.NaN)); - } - - [Fact] - public void As() - { - var newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - AssertEx.EqualTolerance(CentipoiseInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.Centipoise), CentipoiseTolerance); - AssertEx.EqualTolerance(MicropascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.MicropascalSecond), MicropascalSecondsTolerance); - AssertEx.EqualTolerance(MillipascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.MillipascalSecond), MillipascalSecondsTolerance); - AssertEx.EqualTolerance(NewtonSecondsPerMeterSquaredInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.NewtonSecondPerMeterSquared), NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(PascalSecondsInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.PascalSecond), PascalSecondsTolerance); - AssertEx.EqualTolerance(PoiseInOneNewtonSecondPerMeterSquared, newtonsecondpermetersquared.As(DynamicViscosityUnit.Poise), PoiseTolerance); - } - - [Fact] - public void ToUnit() - { - var newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - - var centipoiseQuantity = newtonsecondpermetersquared.ToUnit(DynamicViscosityUnit.Centipoise); - AssertEx.EqualTolerance(CentipoiseInOneNewtonSecondPerMeterSquared, (double)centipoiseQuantity.Value, CentipoiseTolerance); - Assert.Equal(DynamicViscosityUnit.Centipoise, centipoiseQuantity.Unit); - - var micropascalsecondQuantity = newtonsecondpermetersquared.ToUnit(DynamicViscosityUnit.MicropascalSecond); - AssertEx.EqualTolerance(MicropascalSecondsInOneNewtonSecondPerMeterSquared, (double)micropascalsecondQuantity.Value, MicropascalSecondsTolerance); - Assert.Equal(DynamicViscosityUnit.MicropascalSecond, micropascalsecondQuantity.Unit); - - var millipascalsecondQuantity = newtonsecondpermetersquared.ToUnit(DynamicViscosityUnit.MillipascalSecond); - AssertEx.EqualTolerance(MillipascalSecondsInOneNewtonSecondPerMeterSquared, (double)millipascalsecondQuantity.Value, MillipascalSecondsTolerance); - Assert.Equal(DynamicViscosityUnit.MillipascalSecond, millipascalsecondQuantity.Unit); - - var newtonsecondpermetersquaredQuantity = newtonsecondpermetersquared.ToUnit(DynamicViscosityUnit.NewtonSecondPerMeterSquared); - AssertEx.EqualTolerance(NewtonSecondsPerMeterSquaredInOneNewtonSecondPerMeterSquared, (double)newtonsecondpermetersquaredQuantity.Value, NewtonSecondsPerMeterSquaredTolerance); - Assert.Equal(DynamicViscosityUnit.NewtonSecondPerMeterSquared, newtonsecondpermetersquaredQuantity.Unit); - - var pascalsecondQuantity = newtonsecondpermetersquared.ToUnit(DynamicViscosityUnit.PascalSecond); - AssertEx.EqualTolerance(PascalSecondsInOneNewtonSecondPerMeterSquared, (double)pascalsecondQuantity.Value, PascalSecondsTolerance); - Assert.Equal(DynamicViscosityUnit.PascalSecond, pascalsecondQuantity.Unit); - - var poiseQuantity = newtonsecondpermetersquared.ToUnit(DynamicViscosityUnit.Poise); - AssertEx.EqualTolerance(PoiseInOneNewtonSecondPerMeterSquared, (double)poiseQuantity.Value, PoiseTolerance); - Assert.Equal(DynamicViscosityUnit.Poise, poiseQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - AssertEx.EqualTolerance(1, DynamicViscosity.FromCentipoise(newtonsecondpermetersquared.Centipoise).NewtonSecondsPerMeterSquared, CentipoiseTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromMicropascalSeconds(newtonsecondpermetersquared.MicropascalSeconds).NewtonSecondsPerMeterSquared, MicropascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromMillipascalSeconds(newtonsecondpermetersquared.MillipascalSeconds).NewtonSecondsPerMeterSquared, MillipascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromNewtonSecondsPerMeterSquared(newtonsecondpermetersquared.NewtonSecondsPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromPascalSeconds(newtonsecondpermetersquared.PascalSeconds).NewtonSecondsPerMeterSquared, PascalSecondsTolerance); - AssertEx.EqualTolerance(1, DynamicViscosity.FromPoise(newtonsecondpermetersquared.Poise).NewtonSecondsPerMeterSquared, PoiseTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - DynamicViscosity v = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - AssertEx.EqualTolerance(-1, -v.NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(2, (DynamicViscosity.FromNewtonSecondsPerMeterSquared(3)-v).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(2, (v + v).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(10, (v*10).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(10, (10*v).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(2, (DynamicViscosity.FromNewtonSecondsPerMeterSquared(10)/5).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance); - AssertEx.EqualTolerance(2, DynamicViscosity.FromNewtonSecondsPerMeterSquared(10)/DynamicViscosity.FromNewtonSecondsPerMeterSquared(5), NewtonSecondsPerMeterSquaredTolerance); - } - - [Fact] - public void ComparisonOperators() - { - DynamicViscosity oneNewtonSecondPerMeterSquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - DynamicViscosity twoNewtonSecondsPerMeterSquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(2); - - Assert.True(oneNewtonSecondPerMeterSquared < twoNewtonSecondsPerMeterSquared); - Assert.True(oneNewtonSecondPerMeterSquared <= twoNewtonSecondsPerMeterSquared); - Assert.True(twoNewtonSecondsPerMeterSquared > oneNewtonSecondPerMeterSquared); - Assert.True(twoNewtonSecondsPerMeterSquared >= oneNewtonSecondPerMeterSquared); - - Assert.False(oneNewtonSecondPerMeterSquared > twoNewtonSecondsPerMeterSquared); - Assert.False(oneNewtonSecondPerMeterSquared >= twoNewtonSecondsPerMeterSquared); - Assert.False(twoNewtonSecondsPerMeterSquared < oneNewtonSecondPerMeterSquared); - Assert.False(twoNewtonSecondsPerMeterSquared <= oneNewtonSecondPerMeterSquared); - } - - [Fact] - public void CompareToIsImplemented() - { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.Equal(0, newtonsecondpermetersquared.CompareTo(newtonsecondpermetersquared)); - Assert.True(newtonsecondpermetersquared.CompareTo(DynamicViscosity.Zero) > 0); - Assert.True(DynamicViscosity.Zero.CompareTo(newtonsecondpermetersquared) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.Throws(() => newtonsecondpermetersquared.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.Throws(() => newtonsecondpermetersquared.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - DynamicViscosity v = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.True(v.Equals(DynamicViscosity.FromNewtonSecondsPerMeterSquared(1), NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(DynamicViscosity.Zero, NewtonSecondsPerMeterSquaredTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.False(newtonsecondpermetersquared.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1); - Assert.False(newtonsecondpermetersquared.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(DynamicViscosityUnit.Undefined, DynamicViscosity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(DynamicViscosityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == DynamicViscosityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs deleted file mode 100644 index 38917b9776..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricAdmittanceTestsBase.g.cs +++ /dev/null @@ -1,254 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricAdmittance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricAdmittanceTestsBase - { - protected abstract double MicrosiemensInOneSiemens { get; } - protected abstract double MillisiemensInOneSiemens { get; } - protected abstract double NanosiemensInOneSiemens { get; } - protected abstract double SiemensInOneSiemens { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double MicrosiemensTolerance { get { return 1e-5; } } - protected virtual double MillisiemensTolerance { get { return 1e-5; } } - protected virtual double NanosiemensTolerance { get { return 1e-5; } } - protected virtual double SiemensTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricAdmittance((double)0.0, ElectricAdmittanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricAdmittance(double.PositiveInfinity, ElectricAdmittanceUnit.Siemens)); - Assert.Throws(() => new ElectricAdmittance(double.NegativeInfinity, ElectricAdmittanceUnit.Siemens)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricAdmittance(double.NaN, ElectricAdmittanceUnit.Siemens)); - } - - [Fact] - public void SiemensToElectricAdmittanceUnits() - { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.Microsiemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.Millisiemens, MillisiemensTolerance); - AssertEx.EqualTolerance(NanosiemensInOneSiemens, siemens.Nanosiemens, NanosiemensTolerance); - AssertEx.EqualTolerance(SiemensInOneSiemens, siemens.Siemens, SiemensTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Microsiemens).Microsiemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Millisiemens).Millisiemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Nanosiemens).Nanosiemens, NanosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.From(1, ElectricAdmittanceUnit.Siemens).Siemens, SiemensTolerance); - } - - [Fact] - public void FromSiemens_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.PositiveInfinity)); - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NegativeInfinity)); - } - - [Fact] - public void FromSiemens_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricAdmittance.FromSiemens(double.NaN)); - } - - [Fact] - public void As() - { - var siemens = ElectricAdmittance.FromSiemens(1); - AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.As(ElectricAdmittanceUnit.Microsiemens), MicrosiemensTolerance); - AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.As(ElectricAdmittanceUnit.Millisiemens), MillisiemensTolerance); - AssertEx.EqualTolerance(NanosiemensInOneSiemens, siemens.As(ElectricAdmittanceUnit.Nanosiemens), NanosiemensTolerance); - AssertEx.EqualTolerance(SiemensInOneSiemens, siemens.As(ElectricAdmittanceUnit.Siemens), SiemensTolerance); - } - - [Fact] - public void ToUnit() - { - var siemens = ElectricAdmittance.FromSiemens(1); - - var microsiemensQuantity = siemens.ToUnit(ElectricAdmittanceUnit.Microsiemens); - AssertEx.EqualTolerance(MicrosiemensInOneSiemens, (double)microsiemensQuantity.Value, MicrosiemensTolerance); - Assert.Equal(ElectricAdmittanceUnit.Microsiemens, microsiemensQuantity.Unit); - - var millisiemensQuantity = siemens.ToUnit(ElectricAdmittanceUnit.Millisiemens); - AssertEx.EqualTolerance(MillisiemensInOneSiemens, (double)millisiemensQuantity.Value, MillisiemensTolerance); - Assert.Equal(ElectricAdmittanceUnit.Millisiemens, millisiemensQuantity.Unit); - - var nanosiemensQuantity = siemens.ToUnit(ElectricAdmittanceUnit.Nanosiemens); - AssertEx.EqualTolerance(NanosiemensInOneSiemens, (double)nanosiemensQuantity.Value, NanosiemensTolerance); - Assert.Equal(ElectricAdmittanceUnit.Nanosiemens, nanosiemensQuantity.Unit); - - var siemensQuantity = siemens.ToUnit(ElectricAdmittanceUnit.Siemens); - AssertEx.EqualTolerance(SiemensInOneSiemens, (double)siemensQuantity.Value, SiemensTolerance); - Assert.Equal(ElectricAdmittanceUnit.Siemens, siemensQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromMicrosiemens(siemens.Microsiemens).Siemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromMillisiemens(siemens.Millisiemens).Siemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromNanosiemens(siemens.Nanosiemens).Siemens, NanosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricAdmittance.FromSiemens(siemens.Siemens).Siemens, SiemensTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricAdmittance v = ElectricAdmittance.FromSiemens(1); - AssertEx.EqualTolerance(-1, -v.Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricAdmittance.FromSiemens(3)-v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (v + v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(10, (v*10).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(10, (10*v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricAdmittance.FromSiemens(10)/5).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, ElectricAdmittance.FromSiemens(10)/ElectricAdmittance.FromSiemens(5), SiemensTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricAdmittance oneSiemens = ElectricAdmittance.FromSiemens(1); - ElectricAdmittance twoSiemens = ElectricAdmittance.FromSiemens(2); - - Assert.True(oneSiemens < twoSiemens); - Assert.True(oneSiemens <= twoSiemens); - Assert.True(twoSiemens > oneSiemens); - Assert.True(twoSiemens >= oneSiemens); - - Assert.False(oneSiemens > twoSiemens); - Assert.False(oneSiemens >= twoSiemens); - Assert.False(twoSiemens < oneSiemens); - Assert.False(twoSiemens <= oneSiemens); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - Assert.Equal(0, siemens.CompareTo(siemens)); - Assert.True(siemens.CompareTo(ElectricAdmittance.Zero) > 0); - Assert.True(ElectricAdmittance.Zero.CompareTo(siemens) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - Assert.Throws(() => siemens.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - Assert.Throws(() => siemens.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricAdmittance v = ElectricAdmittance.FromSiemens(1); - Assert.True(v.Equals(ElectricAdmittance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricAdmittance.Zero, SiemensTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - Assert.False(siemens.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricAdmittance siemens = ElectricAdmittance.FromSiemens(1); - Assert.False(siemens.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricAdmittanceUnit.Undefined, ElectricAdmittance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricAdmittanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricAdmittanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs deleted file mode 100644 index 9e9f244019..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeDensityTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricChargeDensity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricChargeDensityTestsBase - { - protected abstract double CoulombsPerCubicMeterInOneCoulombPerCubicMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CoulombsPerCubicMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricChargeDensity((double)0.0, ElectricChargeDensityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricChargeDensity(double.PositiveInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); - Assert.Throws(() => new ElectricChargeDensity(double.NegativeInfinity, ElectricChargeDensityUnit.CoulombPerCubicMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricChargeDensity(double.NaN, ElectricChargeDensityUnit.CoulombPerCubicMeter)); - } - - [Fact] - public void CoulombPerCubicMeterToElectricChargeDensityUnits() - { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - AssertEx.EqualTolerance(CoulombsPerCubicMeterInOneCoulombPerCubicMeter, coulombpercubicmeter.CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricChargeDensity.From(1, ElectricChargeDensityUnit.CoulombPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - } - - [Fact] - public void FromCoulombsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromCoulombsPerCubicMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricChargeDensity.FromCoulombsPerCubicMeter(double.NaN)); - } - - [Fact] - public void As() - { - var coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - AssertEx.EqualTolerance(CoulombsPerCubicMeterInOneCoulombPerCubicMeter, coulombpercubicmeter.As(ElectricChargeDensityUnit.CoulombPerCubicMeter), CoulombsPerCubicMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - - var coulombpercubicmeterQuantity = coulombpercubicmeter.ToUnit(ElectricChargeDensityUnit.CoulombPerCubicMeter); - AssertEx.EqualTolerance(CoulombsPerCubicMeterInOneCoulombPerCubicMeter, (double)coulombpercubicmeterQuantity.Value, CoulombsPerCubicMeterTolerance); - Assert.Equal(ElectricChargeDensityUnit.CoulombPerCubicMeter, coulombpercubicmeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - AssertEx.EqualTolerance(1, ElectricChargeDensity.FromCoulombsPerCubicMeter(coulombpercubicmeter.CoulombsPerCubicMeter).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricChargeDensity v = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - AssertEx.EqualTolerance(-1, -v.CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricChargeDensity.FromCoulombsPerCubicMeter(3)-v).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricChargeDensity.FromCoulombsPerCubicMeter(10)/5).CoulombsPerCubicMeter, CoulombsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, ElectricChargeDensity.FromCoulombsPerCubicMeter(10)/ElectricChargeDensity.FromCoulombsPerCubicMeter(5), CoulombsPerCubicMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricChargeDensity oneCoulombPerCubicMeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - ElectricChargeDensity twoCoulombsPerCubicMeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(2); - - Assert.True(oneCoulombPerCubicMeter < twoCoulombsPerCubicMeter); - Assert.True(oneCoulombPerCubicMeter <= twoCoulombsPerCubicMeter); - Assert.True(twoCoulombsPerCubicMeter > oneCoulombPerCubicMeter); - Assert.True(twoCoulombsPerCubicMeter >= oneCoulombPerCubicMeter); - - Assert.False(oneCoulombPerCubicMeter > twoCoulombsPerCubicMeter); - Assert.False(oneCoulombPerCubicMeter >= twoCoulombsPerCubicMeter); - Assert.False(twoCoulombsPerCubicMeter < oneCoulombPerCubicMeter); - Assert.False(twoCoulombsPerCubicMeter <= oneCoulombPerCubicMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.Equal(0, coulombpercubicmeter.CompareTo(coulombpercubicmeter)); - Assert.True(coulombpercubicmeter.CompareTo(ElectricChargeDensity.Zero) > 0); - Assert.True(ElectricChargeDensity.Zero.CompareTo(coulombpercubicmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.Throws(() => coulombpercubicmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.Throws(() => coulombpercubicmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricChargeDensity v = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.True(v.Equals(ElectricChargeDensity.FromCoulombsPerCubicMeter(1), CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricChargeDensity.Zero, CoulombsPerCubicMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.False(coulombpercubicmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricChargeDensity coulombpercubicmeter = ElectricChargeDensity.FromCoulombsPerCubicMeter(1); - Assert.False(coulombpercubicmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricChargeDensityUnit.Undefined, ElectricChargeDensity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricChargeDensityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricChargeDensityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs deleted file mode 100644 index eda26be3cb..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricChargeTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricCharge. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricChargeTestsBase - { - protected abstract double CoulombsInOneCoulomb { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CoulombsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCharge((double)0.0, ElectricChargeUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCharge(double.PositiveInfinity, ElectricChargeUnit.Coulomb)); - Assert.Throws(() => new ElectricCharge(double.NegativeInfinity, ElectricChargeUnit.Coulomb)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCharge(double.NaN, ElectricChargeUnit.Coulomb)); - } - - [Fact] - public void CoulombToElectricChargeUnits() - { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - AssertEx.EqualTolerance(CoulombsInOneCoulomb, coulomb.Coulombs, CoulombsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricCharge.From(1, ElectricChargeUnit.Coulomb).Coulombs, CoulombsTolerance); - } - - [Fact] - public void FromCoulombs_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCharge.FromCoulombs(double.PositiveInfinity)); - Assert.Throws(() => ElectricCharge.FromCoulombs(double.NegativeInfinity)); - } - - [Fact] - public void FromCoulombs_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCharge.FromCoulombs(double.NaN)); - } - - [Fact] - public void As() - { - var coulomb = ElectricCharge.FromCoulombs(1); - AssertEx.EqualTolerance(CoulombsInOneCoulomb, coulomb.As(ElectricChargeUnit.Coulomb), CoulombsTolerance); - } - - [Fact] - public void ToUnit() - { - var coulomb = ElectricCharge.FromCoulombs(1); - - var coulombQuantity = coulomb.ToUnit(ElectricChargeUnit.Coulomb); - AssertEx.EqualTolerance(CoulombsInOneCoulomb, (double)coulombQuantity.Value, CoulombsTolerance); - Assert.Equal(ElectricChargeUnit.Coulomb, coulombQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - AssertEx.EqualTolerance(1, ElectricCharge.FromCoulombs(coulomb.Coulombs).Coulombs, CoulombsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricCharge v = ElectricCharge.FromCoulombs(1); - AssertEx.EqualTolerance(-1, -v.Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(2, (ElectricCharge.FromCoulombs(3)-v).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(2, (v + v).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(10, (v*10).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(10, (10*v).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(2, (ElectricCharge.FromCoulombs(10)/5).Coulombs, CoulombsTolerance); - AssertEx.EqualTolerance(2, ElectricCharge.FromCoulombs(10)/ElectricCharge.FromCoulombs(5), CoulombsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricCharge oneCoulomb = ElectricCharge.FromCoulombs(1); - ElectricCharge twoCoulombs = ElectricCharge.FromCoulombs(2); - - Assert.True(oneCoulomb < twoCoulombs); - Assert.True(oneCoulomb <= twoCoulombs); - Assert.True(twoCoulombs > oneCoulomb); - Assert.True(twoCoulombs >= oneCoulomb); - - Assert.False(oneCoulomb > twoCoulombs); - Assert.False(oneCoulomb >= twoCoulombs); - Assert.False(twoCoulombs < oneCoulomb); - Assert.False(twoCoulombs <= oneCoulomb); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - Assert.Equal(0, coulomb.CompareTo(coulomb)); - Assert.True(coulomb.CompareTo(ElectricCharge.Zero) > 0); - Assert.True(ElectricCharge.Zero.CompareTo(coulomb) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - Assert.Throws(() => coulomb.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - Assert.Throws(() => coulomb.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricCharge v = ElectricCharge.FromCoulombs(1); - Assert.True(v.Equals(ElectricCharge.FromCoulombs(1), CoulombsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCharge.Zero, CoulombsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - Assert.False(coulomb.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricCharge coulomb = ElectricCharge.FromCoulombs(1); - Assert.False(coulomb.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricChargeUnit.Undefined, ElectricCharge.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricChargeUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricChargeUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs deleted file mode 100644 index 9ed876aeed..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductanceTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricConductance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricConductanceTestsBase - { - protected abstract double MicrosiemensInOneSiemens { get; } - protected abstract double MillisiemensInOneSiemens { get; } - protected abstract double SiemensInOneSiemens { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double MicrosiemensTolerance { get { return 1e-5; } } - protected virtual double MillisiemensTolerance { get { return 1e-5; } } - protected virtual double SiemensTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricConductance((double)0.0, ElectricConductanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricConductance(double.PositiveInfinity, ElectricConductanceUnit.Siemens)); - Assert.Throws(() => new ElectricConductance(double.NegativeInfinity, ElectricConductanceUnit.Siemens)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricConductance(double.NaN, ElectricConductanceUnit.Siemens)); - } - - [Fact] - public void SiemensToElectricConductanceUnits() - { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.Microsiemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.Millisiemens, MillisiemensTolerance); - AssertEx.EqualTolerance(SiemensInOneSiemens, siemens.Siemens, SiemensTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Microsiemens).Microsiemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Millisiemens).Millisiemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.From(1, ElectricConductanceUnit.Siemens).Siemens, SiemensTolerance); - } - - [Fact] - public void FromSiemens_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricConductance.FromSiemens(double.PositiveInfinity)); - Assert.Throws(() => ElectricConductance.FromSiemens(double.NegativeInfinity)); - } - - [Fact] - public void FromSiemens_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricConductance.FromSiemens(double.NaN)); - } - - [Fact] - public void As() - { - var siemens = ElectricConductance.FromSiemens(1); - AssertEx.EqualTolerance(MicrosiemensInOneSiemens, siemens.As(ElectricConductanceUnit.Microsiemens), MicrosiemensTolerance); - AssertEx.EqualTolerance(MillisiemensInOneSiemens, siemens.As(ElectricConductanceUnit.Millisiemens), MillisiemensTolerance); - AssertEx.EqualTolerance(SiemensInOneSiemens, siemens.As(ElectricConductanceUnit.Siemens), SiemensTolerance); - } - - [Fact] - public void ToUnit() - { - var siemens = ElectricConductance.FromSiemens(1); - - var microsiemensQuantity = siemens.ToUnit(ElectricConductanceUnit.Microsiemens); - AssertEx.EqualTolerance(MicrosiemensInOneSiemens, (double)microsiemensQuantity.Value, MicrosiemensTolerance); - Assert.Equal(ElectricConductanceUnit.Microsiemens, microsiemensQuantity.Unit); - - var millisiemensQuantity = siemens.ToUnit(ElectricConductanceUnit.Millisiemens); - AssertEx.EqualTolerance(MillisiemensInOneSiemens, (double)millisiemensQuantity.Value, MillisiemensTolerance); - Assert.Equal(ElectricConductanceUnit.Millisiemens, millisiemensQuantity.Unit); - - var siemensQuantity = siemens.ToUnit(ElectricConductanceUnit.Siemens); - AssertEx.EqualTolerance(SiemensInOneSiemens, (double)siemensQuantity.Value, SiemensTolerance); - Assert.Equal(ElectricConductanceUnit.Siemens, siemensQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - AssertEx.EqualTolerance(1, ElectricConductance.FromMicrosiemens(siemens.Microsiemens).Siemens, MicrosiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.FromMillisiemens(siemens.Millisiemens).Siemens, MillisiemensTolerance); - AssertEx.EqualTolerance(1, ElectricConductance.FromSiemens(siemens.Siemens).Siemens, SiemensTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricConductance v = ElectricConductance.FromSiemens(1); - AssertEx.EqualTolerance(-1, -v.Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricConductance.FromSiemens(3)-v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (v + v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(10, (v*10).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(10, (10*v).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, (ElectricConductance.FromSiemens(10)/5).Siemens, SiemensTolerance); - AssertEx.EqualTolerance(2, ElectricConductance.FromSiemens(10)/ElectricConductance.FromSiemens(5), SiemensTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricConductance oneSiemens = ElectricConductance.FromSiemens(1); - ElectricConductance twoSiemens = ElectricConductance.FromSiemens(2); - - Assert.True(oneSiemens < twoSiemens); - Assert.True(oneSiemens <= twoSiemens); - Assert.True(twoSiemens > oneSiemens); - Assert.True(twoSiemens >= oneSiemens); - - Assert.False(oneSiemens > twoSiemens); - Assert.False(oneSiemens >= twoSiemens); - Assert.False(twoSiemens < oneSiemens); - Assert.False(twoSiemens <= oneSiemens); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - Assert.Equal(0, siemens.CompareTo(siemens)); - Assert.True(siemens.CompareTo(ElectricConductance.Zero) > 0); - Assert.True(ElectricConductance.Zero.CompareTo(siemens) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - Assert.Throws(() => siemens.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - Assert.Throws(() => siemens.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricConductance v = ElectricConductance.FromSiemens(1); - Assert.True(v.Equals(ElectricConductance.FromSiemens(1), SiemensTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricConductance.Zero, SiemensTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - Assert.False(siemens.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricConductance siemens = ElectricConductance.FromSiemens(1); - Assert.False(siemens.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricConductanceUnit.Undefined, ElectricConductance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricConductanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricConductanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs deleted file mode 100644 index ea049f0f48..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricConductivityTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricConductivity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricConductivityTestsBase - { - protected abstract double SiemensPerMeterInOneSiemensPerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double SiemensPerMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricConductivity((double)0.0, ElectricConductivityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricConductivity(double.PositiveInfinity, ElectricConductivityUnit.SiemensPerMeter)); - Assert.Throws(() => new ElectricConductivity(double.NegativeInfinity, ElectricConductivityUnit.SiemensPerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricConductivity(double.NaN, ElectricConductivityUnit.SiemensPerMeter)); - } - - [Fact] - public void SiemensPerMeterToElectricConductivityUnits() - { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - AssertEx.EqualTolerance(SiemensPerMeterInOneSiemensPerMeter, siemenspermeter.SiemensPerMeter, SiemensPerMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricConductivity.From(1, ElectricConductivityUnit.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); - } - - [Fact] - public void FromSiemensPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromSiemensPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricConductivity.FromSiemensPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - AssertEx.EqualTolerance(SiemensPerMeterInOneSiemensPerMeter, siemenspermeter.As(ElectricConductivityUnit.SiemensPerMeter), SiemensPerMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - - var siemenspermeterQuantity = siemenspermeter.ToUnit(ElectricConductivityUnit.SiemensPerMeter); - AssertEx.EqualTolerance(SiemensPerMeterInOneSiemensPerMeter, (double)siemenspermeterQuantity.Value, SiemensPerMeterTolerance); - Assert.Equal(ElectricConductivityUnit.SiemensPerMeter, siemenspermeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - AssertEx.EqualTolerance(1, ElectricConductivity.FromSiemensPerMeter(siemenspermeter.SiemensPerMeter).SiemensPerMeter, SiemensPerMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricConductivity v = ElectricConductivity.FromSiemensPerMeter(1); - AssertEx.EqualTolerance(-1, -v.SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricConductivity.FromSiemensPerMeter(3)-v).SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricConductivity.FromSiemensPerMeter(10)/5).SiemensPerMeter, SiemensPerMeterTolerance); - AssertEx.EqualTolerance(2, ElectricConductivity.FromSiemensPerMeter(10)/ElectricConductivity.FromSiemensPerMeter(5), SiemensPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricConductivity oneSiemensPerMeter = ElectricConductivity.FromSiemensPerMeter(1); - ElectricConductivity twoSiemensPerMeter = ElectricConductivity.FromSiemensPerMeter(2); - - Assert.True(oneSiemensPerMeter < twoSiemensPerMeter); - Assert.True(oneSiemensPerMeter <= twoSiemensPerMeter); - Assert.True(twoSiemensPerMeter > oneSiemensPerMeter); - Assert.True(twoSiemensPerMeter >= oneSiemensPerMeter); - - Assert.False(oneSiemensPerMeter > twoSiemensPerMeter); - Assert.False(oneSiemensPerMeter >= twoSiemensPerMeter); - Assert.False(twoSiemensPerMeter < oneSiemensPerMeter); - Assert.False(twoSiemensPerMeter <= oneSiemensPerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - Assert.Equal(0, siemenspermeter.CompareTo(siemenspermeter)); - Assert.True(siemenspermeter.CompareTo(ElectricConductivity.Zero) > 0); - Assert.True(ElectricConductivity.Zero.CompareTo(siemenspermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - Assert.Throws(() => siemenspermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - Assert.Throws(() => siemenspermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricConductivity v = ElectricConductivity.FromSiemensPerMeter(1); - Assert.True(v.Equals(ElectricConductivity.FromSiemensPerMeter(1), SiemensPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricConductivity.Zero, SiemensPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - Assert.False(siemenspermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricConductivity siemenspermeter = ElectricConductivity.FromSiemensPerMeter(1); - Assert.False(siemenspermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricConductivityUnit.Undefined, ElectricConductivity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricConductivityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricConductivityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs deleted file mode 100644 index dd5e6399ba..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentDensityTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricCurrentDensity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricCurrentDensityTestsBase - { - protected abstract double AmperesPerSquareMeterInOneAmperePerSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AmperesPerSquareMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrentDensity((double)0.0, ElectricCurrentDensityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrentDensity(double.PositiveInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); - Assert.Throws(() => new ElectricCurrentDensity(double.NegativeInfinity, ElectricCurrentDensityUnit.AmperePerSquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrentDensity(double.NaN, ElectricCurrentDensityUnit.AmperePerSquareMeter)); - } - - [Fact] - public void AmperePerSquareMeterToElectricCurrentDensityUnits() - { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - AssertEx.EqualTolerance(AmperesPerSquareMeterInOneAmperePerSquareMeter, amperepersquaremeter.AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricCurrentDensity.From(1, ElectricCurrentDensityUnit.AmperePerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - } - - [Fact] - public void FromAmperesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromAmperesPerSquareMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCurrentDensity.FromAmperesPerSquareMeter(double.NaN)); - } - - [Fact] - public void As() - { - var amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - AssertEx.EqualTolerance(AmperesPerSquareMeterInOneAmperePerSquareMeter, amperepersquaremeter.As(ElectricCurrentDensityUnit.AmperePerSquareMeter), AmperesPerSquareMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - - var amperepersquaremeterQuantity = amperepersquaremeter.ToUnit(ElectricCurrentDensityUnit.AmperePerSquareMeter); - AssertEx.EqualTolerance(AmperesPerSquareMeterInOneAmperePerSquareMeter, (double)amperepersquaremeterQuantity.Value, AmperesPerSquareMeterTolerance); - Assert.Equal(ElectricCurrentDensityUnit.AmperePerSquareMeter, amperepersquaremeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - AssertEx.EqualTolerance(1, ElectricCurrentDensity.FromAmperesPerSquareMeter(amperepersquaremeter.AmperesPerSquareMeter).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricCurrentDensity v = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - AssertEx.EqualTolerance(-1, -v.AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentDensity.FromAmperesPerSquareMeter(3)-v).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentDensity.FromAmperesPerSquareMeter(10)/5).AmperesPerSquareMeter, AmperesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, ElectricCurrentDensity.FromAmperesPerSquareMeter(10)/ElectricCurrentDensity.FromAmperesPerSquareMeter(5), AmperesPerSquareMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricCurrentDensity oneAmperePerSquareMeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - ElectricCurrentDensity twoAmperesPerSquareMeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(2); - - Assert.True(oneAmperePerSquareMeter < twoAmperesPerSquareMeter); - Assert.True(oneAmperePerSquareMeter <= twoAmperesPerSquareMeter); - Assert.True(twoAmperesPerSquareMeter > oneAmperePerSquareMeter); - Assert.True(twoAmperesPerSquareMeter >= oneAmperePerSquareMeter); - - Assert.False(oneAmperePerSquareMeter > twoAmperesPerSquareMeter); - Assert.False(oneAmperePerSquareMeter >= twoAmperesPerSquareMeter); - Assert.False(twoAmperesPerSquareMeter < oneAmperePerSquareMeter); - Assert.False(twoAmperesPerSquareMeter <= oneAmperePerSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.Equal(0, amperepersquaremeter.CompareTo(amperepersquaremeter)); - Assert.True(amperepersquaremeter.CompareTo(ElectricCurrentDensity.Zero) > 0); - Assert.True(ElectricCurrentDensity.Zero.CompareTo(amperepersquaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.Throws(() => amperepersquaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.Throws(() => amperepersquaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricCurrentDensity v = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.True(v.Equals(ElectricCurrentDensity.FromAmperesPerSquareMeter(1), AmperesPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCurrentDensity.Zero, AmperesPerSquareMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.False(amperepersquaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricCurrentDensity amperepersquaremeter = ElectricCurrentDensity.FromAmperesPerSquareMeter(1); - Assert.False(amperepersquaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricCurrentDensityUnit.Undefined, ElectricCurrentDensity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricCurrentDensityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricCurrentDensityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs deleted file mode 100644 index fe5682a5fe..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentGradientTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricCurrentGradient. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricCurrentGradientTestsBase - { - protected abstract double AmperesPerSecondInOneAmperePerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AmperesPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrentGradient((double)0.0, ElectricCurrentGradientUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrentGradient(double.PositiveInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); - Assert.Throws(() => new ElectricCurrentGradient(double.NegativeInfinity, ElectricCurrentGradientUnit.AmperePerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrentGradient(double.NaN, ElectricCurrentGradientUnit.AmperePerSecond)); - } - - [Fact] - public void AmperePerSecondToElectricCurrentGradientUnits() - { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - AssertEx.EqualTolerance(AmperesPerSecondInOneAmperePerSecond, amperepersecond.AmperesPerSecond, AmperesPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricCurrentGradient.From(1, ElectricCurrentGradientUnit.AmperePerSecond).AmperesPerSecond, AmperesPerSecondTolerance); - } - - [Fact] - public void FromAmperesPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromAmperesPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCurrentGradient.FromAmperesPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - AssertEx.EqualTolerance(AmperesPerSecondInOneAmperePerSecond, amperepersecond.As(ElectricCurrentGradientUnit.AmperePerSecond), AmperesPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - - var amperepersecondQuantity = amperepersecond.ToUnit(ElectricCurrentGradientUnit.AmperePerSecond); - AssertEx.EqualTolerance(AmperesPerSecondInOneAmperePerSecond, (double)amperepersecondQuantity.Value, AmperesPerSecondTolerance); - Assert.Equal(ElectricCurrentGradientUnit.AmperePerSecond, amperepersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - AssertEx.EqualTolerance(1, ElectricCurrentGradient.FromAmperesPerSecond(amperepersecond.AmperesPerSecond).AmperesPerSecond, AmperesPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricCurrentGradient v = ElectricCurrentGradient.FromAmperesPerSecond(1); - AssertEx.EqualTolerance(-1, -v.AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentGradient.FromAmperesPerSecond(3)-v).AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrentGradient.FromAmperesPerSecond(10)/5).AmperesPerSecond, AmperesPerSecondTolerance); - AssertEx.EqualTolerance(2, ElectricCurrentGradient.FromAmperesPerSecond(10)/ElectricCurrentGradient.FromAmperesPerSecond(5), AmperesPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricCurrentGradient oneAmperePerSecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - ElectricCurrentGradient twoAmperesPerSecond = ElectricCurrentGradient.FromAmperesPerSecond(2); - - Assert.True(oneAmperePerSecond < twoAmperesPerSecond); - Assert.True(oneAmperePerSecond <= twoAmperesPerSecond); - Assert.True(twoAmperesPerSecond > oneAmperePerSecond); - Assert.True(twoAmperesPerSecond >= oneAmperePerSecond); - - Assert.False(oneAmperePerSecond > twoAmperesPerSecond); - Assert.False(oneAmperePerSecond >= twoAmperesPerSecond); - Assert.False(twoAmperesPerSecond < oneAmperePerSecond); - Assert.False(twoAmperesPerSecond <= oneAmperePerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.Equal(0, amperepersecond.CompareTo(amperepersecond)); - Assert.True(amperepersecond.CompareTo(ElectricCurrentGradient.Zero) > 0); - Assert.True(ElectricCurrentGradient.Zero.CompareTo(amperepersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.Throws(() => amperepersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.Throws(() => amperepersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricCurrentGradient v = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.True(v.Equals(ElectricCurrentGradient.FromAmperesPerSecond(1), AmperesPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCurrentGradient.Zero, AmperesPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.False(amperepersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricCurrentGradient amperepersecond = ElectricCurrentGradient.FromAmperesPerSecond(1); - Assert.False(amperepersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricCurrentGradientUnit.Undefined, ElectricCurrentGradient.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricCurrentGradientUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricCurrentGradientUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs deleted file mode 100644 index 3fd63c38a0..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricCurrentTestsBase.g.cs +++ /dev/null @@ -1,294 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricCurrent. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricCurrentTestsBase - { - protected abstract double AmperesInOneAmpere { get; } - protected abstract double CentiamperesInOneAmpere { get; } - protected abstract double KiloamperesInOneAmpere { get; } - protected abstract double MegaamperesInOneAmpere { get; } - protected abstract double MicroamperesInOneAmpere { get; } - protected abstract double MilliamperesInOneAmpere { get; } - protected abstract double NanoamperesInOneAmpere { get; } - protected abstract double PicoamperesInOneAmpere { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AmperesTolerance { get { return 1e-5; } } - protected virtual double CentiamperesTolerance { get { return 1e-5; } } - protected virtual double KiloamperesTolerance { get { return 1e-5; } } - protected virtual double MegaamperesTolerance { get { return 1e-5; } } - protected virtual double MicroamperesTolerance { get { return 1e-5; } } - protected virtual double MilliamperesTolerance { get { return 1e-5; } } - protected virtual double NanoamperesTolerance { get { return 1e-5; } } - protected virtual double PicoamperesTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrent((double)0.0, ElectricCurrentUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrent(double.PositiveInfinity, ElectricCurrentUnit.Ampere)); - Assert.Throws(() => new ElectricCurrent(double.NegativeInfinity, ElectricCurrentUnit.Ampere)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricCurrent(double.NaN, ElectricCurrentUnit.Ampere)); - } - - [Fact] - public void AmpereToElectricCurrentUnits() - { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - AssertEx.EqualTolerance(AmperesInOneAmpere, ampere.Amperes, AmperesTolerance); - AssertEx.EqualTolerance(CentiamperesInOneAmpere, ampere.Centiamperes, CentiamperesTolerance); - AssertEx.EqualTolerance(KiloamperesInOneAmpere, ampere.Kiloamperes, KiloamperesTolerance); - AssertEx.EqualTolerance(MegaamperesInOneAmpere, ampere.Megaamperes, MegaamperesTolerance); - AssertEx.EqualTolerance(MicroamperesInOneAmpere, ampere.Microamperes, MicroamperesTolerance); - AssertEx.EqualTolerance(MilliamperesInOneAmpere, ampere.Milliamperes, MilliamperesTolerance); - AssertEx.EqualTolerance(NanoamperesInOneAmpere, ampere.Nanoamperes, NanoamperesTolerance); - AssertEx.EqualTolerance(PicoamperesInOneAmpere, ampere.Picoamperes, PicoamperesTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Ampere).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Centiampere).Centiamperes, CentiamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Kiloampere).Kiloamperes, KiloamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Megaampere).Megaamperes, MegaamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Microampere).Microamperes, MicroamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Milliampere).Milliamperes, MilliamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Nanoampere).Nanoamperes, NanoamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.From(1, ElectricCurrentUnit.Picoampere).Picoamperes, PicoamperesTolerance); - } - - [Fact] - public void FromAmperes_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCurrent.FromAmperes(double.PositiveInfinity)); - Assert.Throws(() => ElectricCurrent.FromAmperes(double.NegativeInfinity)); - } - - [Fact] - public void FromAmperes_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricCurrent.FromAmperes(double.NaN)); - } - - [Fact] - public void As() - { - var ampere = ElectricCurrent.FromAmperes(1); - AssertEx.EqualTolerance(AmperesInOneAmpere, ampere.As(ElectricCurrentUnit.Ampere), AmperesTolerance); - AssertEx.EqualTolerance(CentiamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Centiampere), CentiamperesTolerance); - AssertEx.EqualTolerance(KiloamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Kiloampere), KiloamperesTolerance); - AssertEx.EqualTolerance(MegaamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Megaampere), MegaamperesTolerance); - AssertEx.EqualTolerance(MicroamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Microampere), MicroamperesTolerance); - AssertEx.EqualTolerance(MilliamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Milliampere), MilliamperesTolerance); - AssertEx.EqualTolerance(NanoamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Nanoampere), NanoamperesTolerance); - AssertEx.EqualTolerance(PicoamperesInOneAmpere, ampere.As(ElectricCurrentUnit.Picoampere), PicoamperesTolerance); - } - - [Fact] - public void ToUnit() - { - var ampere = ElectricCurrent.FromAmperes(1); - - var ampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Ampere); - AssertEx.EqualTolerance(AmperesInOneAmpere, (double)ampereQuantity.Value, AmperesTolerance); - Assert.Equal(ElectricCurrentUnit.Ampere, ampereQuantity.Unit); - - var centiampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Centiampere); - AssertEx.EqualTolerance(CentiamperesInOneAmpere, (double)centiampereQuantity.Value, CentiamperesTolerance); - Assert.Equal(ElectricCurrentUnit.Centiampere, centiampereQuantity.Unit); - - var kiloampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Kiloampere); - AssertEx.EqualTolerance(KiloamperesInOneAmpere, (double)kiloampereQuantity.Value, KiloamperesTolerance); - Assert.Equal(ElectricCurrentUnit.Kiloampere, kiloampereQuantity.Unit); - - var megaampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Megaampere); - AssertEx.EqualTolerance(MegaamperesInOneAmpere, (double)megaampereQuantity.Value, MegaamperesTolerance); - Assert.Equal(ElectricCurrentUnit.Megaampere, megaampereQuantity.Unit); - - var microampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Microampere); - AssertEx.EqualTolerance(MicroamperesInOneAmpere, (double)microampereQuantity.Value, MicroamperesTolerance); - Assert.Equal(ElectricCurrentUnit.Microampere, microampereQuantity.Unit); - - var milliampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Milliampere); - AssertEx.EqualTolerance(MilliamperesInOneAmpere, (double)milliampereQuantity.Value, MilliamperesTolerance); - Assert.Equal(ElectricCurrentUnit.Milliampere, milliampereQuantity.Unit); - - var nanoampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Nanoampere); - AssertEx.EqualTolerance(NanoamperesInOneAmpere, (double)nanoampereQuantity.Value, NanoamperesTolerance); - Assert.Equal(ElectricCurrentUnit.Nanoampere, nanoampereQuantity.Unit); - - var picoampereQuantity = ampere.ToUnit(ElectricCurrentUnit.Picoampere); - AssertEx.EqualTolerance(PicoamperesInOneAmpere, (double)picoampereQuantity.Value, PicoamperesTolerance); - Assert.Equal(ElectricCurrentUnit.Picoampere, picoampereQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - AssertEx.EqualTolerance(1, ElectricCurrent.FromAmperes(ampere.Amperes).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromCentiamperes(ampere.Centiamperes).Amperes, CentiamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromKiloamperes(ampere.Kiloamperes).Amperes, KiloamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromMegaamperes(ampere.Megaamperes).Amperes, MegaamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromMicroamperes(ampere.Microamperes).Amperes, MicroamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromMilliamperes(ampere.Milliamperes).Amperes, MilliamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromNanoamperes(ampere.Nanoamperes).Amperes, NanoamperesTolerance); - AssertEx.EqualTolerance(1, ElectricCurrent.FromPicoamperes(ampere.Picoamperes).Amperes, PicoamperesTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricCurrent v = ElectricCurrent.FromAmperes(1); - AssertEx.EqualTolerance(-1, -v.Amperes, AmperesTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrent.FromAmperes(3)-v).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(2, (v + v).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(10, (v*10).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(10, (10*v).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(2, (ElectricCurrent.FromAmperes(10)/5).Amperes, AmperesTolerance); - AssertEx.EqualTolerance(2, ElectricCurrent.FromAmperes(10)/ElectricCurrent.FromAmperes(5), AmperesTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricCurrent oneAmpere = ElectricCurrent.FromAmperes(1); - ElectricCurrent twoAmperes = ElectricCurrent.FromAmperes(2); - - Assert.True(oneAmpere < twoAmperes); - Assert.True(oneAmpere <= twoAmperes); - Assert.True(twoAmperes > oneAmpere); - Assert.True(twoAmperes >= oneAmpere); - - Assert.False(oneAmpere > twoAmperes); - Assert.False(oneAmpere >= twoAmperes); - Assert.False(twoAmperes < oneAmpere); - Assert.False(twoAmperes <= oneAmpere); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - Assert.Equal(0, ampere.CompareTo(ampere)); - Assert.True(ampere.CompareTo(ElectricCurrent.Zero) > 0); - Assert.True(ElectricCurrent.Zero.CompareTo(ampere) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - Assert.Throws(() => ampere.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - Assert.Throws(() => ampere.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricCurrent v = ElectricCurrent.FromAmperes(1); - Assert.True(v.Equals(ElectricCurrent.FromAmperes(1), AmperesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricCurrent.Zero, AmperesTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - Assert.False(ampere.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricCurrent ampere = ElectricCurrent.FromAmperes(1); - Assert.False(ampere.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricCurrentUnit.Undefined, ElectricCurrent.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricCurrentUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricCurrentUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs deleted file mode 100644 index 3d74928898..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricFieldTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricField. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricFieldTestsBase - { - protected abstract double VoltsPerMeterInOneVoltPerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double VoltsPerMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricField((double)0.0, ElectricFieldUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricField(double.PositiveInfinity, ElectricFieldUnit.VoltPerMeter)); - Assert.Throws(() => new ElectricField(double.NegativeInfinity, ElectricFieldUnit.VoltPerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricField(double.NaN, ElectricFieldUnit.VoltPerMeter)); - } - - [Fact] - public void VoltPerMeterToElectricFieldUnits() - { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, voltpermeter.VoltsPerMeter, VoltsPerMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricField.From(1, ElectricFieldUnit.VoltPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); - } - - [Fact] - public void FromVoltsPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromVoltsPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricField.FromVoltsPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var voltpermeter = ElectricField.FromVoltsPerMeter(1); - AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, voltpermeter.As(ElectricFieldUnit.VoltPerMeter), VoltsPerMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var voltpermeter = ElectricField.FromVoltsPerMeter(1); - - var voltpermeterQuantity = voltpermeter.ToUnit(ElectricFieldUnit.VoltPerMeter); - AssertEx.EqualTolerance(VoltsPerMeterInOneVoltPerMeter, (double)voltpermeterQuantity.Value, VoltsPerMeterTolerance); - Assert.Equal(ElectricFieldUnit.VoltPerMeter, voltpermeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - AssertEx.EqualTolerance(1, ElectricField.FromVoltsPerMeter(voltpermeter.VoltsPerMeter).VoltsPerMeter, VoltsPerMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricField v = ElectricField.FromVoltsPerMeter(1); - AssertEx.EqualTolerance(-1, -v.VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricField.FromVoltsPerMeter(3)-v).VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ElectricField.FromVoltsPerMeter(10)/5).VoltsPerMeter, VoltsPerMeterTolerance); - AssertEx.EqualTolerance(2, ElectricField.FromVoltsPerMeter(10)/ElectricField.FromVoltsPerMeter(5), VoltsPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricField oneVoltPerMeter = ElectricField.FromVoltsPerMeter(1); - ElectricField twoVoltsPerMeter = ElectricField.FromVoltsPerMeter(2); - - Assert.True(oneVoltPerMeter < twoVoltsPerMeter); - Assert.True(oneVoltPerMeter <= twoVoltsPerMeter); - Assert.True(twoVoltsPerMeter > oneVoltPerMeter); - Assert.True(twoVoltsPerMeter >= oneVoltPerMeter); - - Assert.False(oneVoltPerMeter > twoVoltsPerMeter); - Assert.False(oneVoltPerMeter >= twoVoltsPerMeter); - Assert.False(twoVoltsPerMeter < oneVoltPerMeter); - Assert.False(twoVoltsPerMeter <= oneVoltPerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - Assert.Equal(0, voltpermeter.CompareTo(voltpermeter)); - Assert.True(voltpermeter.CompareTo(ElectricField.Zero) > 0); - Assert.True(ElectricField.Zero.CompareTo(voltpermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - Assert.Throws(() => voltpermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - Assert.Throws(() => voltpermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricField v = ElectricField.FromVoltsPerMeter(1); - Assert.True(v.Equals(ElectricField.FromVoltsPerMeter(1), VoltsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricField.Zero, VoltsPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - Assert.False(voltpermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricField voltpermeter = ElectricField.FromVoltsPerMeter(1); - Assert.False(voltpermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricFieldUnit.Undefined, ElectricField.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricFieldUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricFieldUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs deleted file mode 100644 index 0200aec8be..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricInductanceTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricInductance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricInductanceTestsBase - { - protected abstract double HenriesInOneHenry { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double HenriesTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricInductance((double)0.0, ElectricInductanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricInductance(double.PositiveInfinity, ElectricInductanceUnit.Henry)); - Assert.Throws(() => new ElectricInductance(double.NegativeInfinity, ElectricInductanceUnit.Henry)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricInductance(double.NaN, ElectricInductanceUnit.Henry)); - } - - [Fact] - public void HenryToElectricInductanceUnits() - { - ElectricInductance henry = ElectricInductance.FromHenries(1); - AssertEx.EqualTolerance(HenriesInOneHenry, henry.Henries, HenriesTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricInductance.From(1, ElectricInductanceUnit.Henry).Henries, HenriesTolerance); - } - - [Fact] - public void FromHenries_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricInductance.FromHenries(double.PositiveInfinity)); - Assert.Throws(() => ElectricInductance.FromHenries(double.NegativeInfinity)); - } - - [Fact] - public void FromHenries_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricInductance.FromHenries(double.NaN)); - } - - [Fact] - public void As() - { - var henry = ElectricInductance.FromHenries(1); - AssertEx.EqualTolerance(HenriesInOneHenry, henry.As(ElectricInductanceUnit.Henry), HenriesTolerance); - } - - [Fact] - public void ToUnit() - { - var henry = ElectricInductance.FromHenries(1); - - var henryQuantity = henry.ToUnit(ElectricInductanceUnit.Henry); - AssertEx.EqualTolerance(HenriesInOneHenry, (double)henryQuantity.Value, HenriesTolerance); - Assert.Equal(ElectricInductanceUnit.Henry, henryQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricInductance henry = ElectricInductance.FromHenries(1); - AssertEx.EqualTolerance(1, ElectricInductance.FromHenries(henry.Henries).Henries, HenriesTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricInductance v = ElectricInductance.FromHenries(1); - AssertEx.EqualTolerance(-1, -v.Henries, HenriesTolerance); - AssertEx.EqualTolerance(2, (ElectricInductance.FromHenries(3)-v).Henries, HenriesTolerance); - AssertEx.EqualTolerance(2, (v + v).Henries, HenriesTolerance); - AssertEx.EqualTolerance(10, (v*10).Henries, HenriesTolerance); - AssertEx.EqualTolerance(10, (10*v).Henries, HenriesTolerance); - AssertEx.EqualTolerance(2, (ElectricInductance.FromHenries(10)/5).Henries, HenriesTolerance); - AssertEx.EqualTolerance(2, ElectricInductance.FromHenries(10)/ElectricInductance.FromHenries(5), HenriesTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricInductance oneHenry = ElectricInductance.FromHenries(1); - ElectricInductance twoHenries = ElectricInductance.FromHenries(2); - - Assert.True(oneHenry < twoHenries); - Assert.True(oneHenry <= twoHenries); - Assert.True(twoHenries > oneHenry); - Assert.True(twoHenries >= oneHenry); - - Assert.False(oneHenry > twoHenries); - Assert.False(oneHenry >= twoHenries); - Assert.False(twoHenries < oneHenry); - Assert.False(twoHenries <= oneHenry); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricInductance henry = ElectricInductance.FromHenries(1); - Assert.Equal(0, henry.CompareTo(henry)); - Assert.True(henry.CompareTo(ElectricInductance.Zero) > 0); - Assert.True(ElectricInductance.Zero.CompareTo(henry) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricInductance henry = ElectricInductance.FromHenries(1); - Assert.Throws(() => henry.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricInductance henry = ElectricInductance.FromHenries(1); - Assert.Throws(() => henry.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricInductance v = ElectricInductance.FromHenries(1); - Assert.True(v.Equals(ElectricInductance.FromHenries(1), HenriesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricInductance.Zero, HenriesTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricInductance henry = ElectricInductance.FromHenries(1); - Assert.False(henry.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricInductance henry = ElectricInductance.FromHenries(1); - Assert.False(henry.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricInductanceUnit.Undefined, ElectricInductance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricInductanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricInductanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs deleted file mode 100644 index 7b4d02bbcb..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialAcTestsBase.g.cs +++ /dev/null @@ -1,264 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricPotentialAc. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricPotentialAcTestsBase - { - protected abstract double KilovoltsAcInOneVoltAc { get; } - protected abstract double MegavoltsAcInOneVoltAc { get; } - protected abstract double MicrovoltsAcInOneVoltAc { get; } - protected abstract double MillivoltsAcInOneVoltAc { get; } - protected abstract double VoltsAcInOneVoltAc { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilovoltsAcTolerance { get { return 1e-5; } } - protected virtual double MegavoltsAcTolerance { get { return 1e-5; } } - protected virtual double MicrovoltsAcTolerance { get { return 1e-5; } } - protected virtual double MillivoltsAcTolerance { get { return 1e-5; } } - protected virtual double VoltsAcTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotentialAc((double)0.0, ElectricPotentialAcUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotentialAc(double.PositiveInfinity, ElectricPotentialAcUnit.VoltAc)); - Assert.Throws(() => new ElectricPotentialAc(double.NegativeInfinity, ElectricPotentialAcUnit.VoltAc)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotentialAc(double.NaN, ElectricPotentialAcUnit.VoltAc)); - } - - [Fact] - public void VoltAcToElectricPotentialAcUnits() - { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - AssertEx.EqualTolerance(KilovoltsAcInOneVoltAc, voltac.KilovoltsAc, KilovoltsAcTolerance); - AssertEx.EqualTolerance(MegavoltsAcInOneVoltAc, voltac.MegavoltsAc, MegavoltsAcTolerance); - AssertEx.EqualTolerance(MicrovoltsAcInOneVoltAc, voltac.MicrovoltsAc, MicrovoltsAcTolerance); - AssertEx.EqualTolerance(MillivoltsAcInOneVoltAc, voltac.MillivoltsAc, MillivoltsAcTolerance); - AssertEx.EqualTolerance(VoltsAcInOneVoltAc, voltac.VoltsAc, VoltsAcTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.KilovoltAc).KilovoltsAc, KilovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MegavoltAc).MegavoltsAc, MegavoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MicrovoltAc).MicrovoltsAc, MicrovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.MillivoltAc).MillivoltsAc, MillivoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.From(1, ElectricPotentialAcUnit.VoltAc).VoltsAc, VoltsAcTolerance); - } - - [Fact] - public void FromVoltsAc_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NegativeInfinity)); - } - - [Fact] - public void FromVoltsAc_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricPotentialAc.FromVoltsAc(double.NaN)); - } - - [Fact] - public void As() - { - var voltac = ElectricPotentialAc.FromVoltsAc(1); - AssertEx.EqualTolerance(KilovoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.KilovoltAc), KilovoltsAcTolerance); - AssertEx.EqualTolerance(MegavoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.MegavoltAc), MegavoltsAcTolerance); - AssertEx.EqualTolerance(MicrovoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.MicrovoltAc), MicrovoltsAcTolerance); - AssertEx.EqualTolerance(MillivoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.MillivoltAc), MillivoltsAcTolerance); - AssertEx.EqualTolerance(VoltsAcInOneVoltAc, voltac.As(ElectricPotentialAcUnit.VoltAc), VoltsAcTolerance); - } - - [Fact] - public void ToUnit() - { - var voltac = ElectricPotentialAc.FromVoltsAc(1); - - var kilovoltacQuantity = voltac.ToUnit(ElectricPotentialAcUnit.KilovoltAc); - AssertEx.EqualTolerance(KilovoltsAcInOneVoltAc, (double)kilovoltacQuantity.Value, KilovoltsAcTolerance); - Assert.Equal(ElectricPotentialAcUnit.KilovoltAc, kilovoltacQuantity.Unit); - - var megavoltacQuantity = voltac.ToUnit(ElectricPotentialAcUnit.MegavoltAc); - AssertEx.EqualTolerance(MegavoltsAcInOneVoltAc, (double)megavoltacQuantity.Value, MegavoltsAcTolerance); - Assert.Equal(ElectricPotentialAcUnit.MegavoltAc, megavoltacQuantity.Unit); - - var microvoltacQuantity = voltac.ToUnit(ElectricPotentialAcUnit.MicrovoltAc); - AssertEx.EqualTolerance(MicrovoltsAcInOneVoltAc, (double)microvoltacQuantity.Value, MicrovoltsAcTolerance); - Assert.Equal(ElectricPotentialAcUnit.MicrovoltAc, microvoltacQuantity.Unit); - - var millivoltacQuantity = voltac.ToUnit(ElectricPotentialAcUnit.MillivoltAc); - AssertEx.EqualTolerance(MillivoltsAcInOneVoltAc, (double)millivoltacQuantity.Value, MillivoltsAcTolerance); - Assert.Equal(ElectricPotentialAcUnit.MillivoltAc, millivoltacQuantity.Unit); - - var voltacQuantity = voltac.ToUnit(ElectricPotentialAcUnit.VoltAc); - AssertEx.EqualTolerance(VoltsAcInOneVoltAc, (double)voltacQuantity.Value, VoltsAcTolerance); - Assert.Equal(ElectricPotentialAcUnit.VoltAc, voltacQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromKilovoltsAc(voltac.KilovoltsAc).VoltsAc, KilovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMegavoltsAc(voltac.MegavoltsAc).VoltsAc, MegavoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMicrovoltsAc(voltac.MicrovoltsAc).VoltsAc, MicrovoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromMillivoltsAc(voltac.MillivoltsAc).VoltsAc, MillivoltsAcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialAc.FromVoltsAc(voltac.VoltsAc).VoltsAc, VoltsAcTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricPotentialAc v = ElectricPotentialAc.FromVoltsAc(1); - AssertEx.EqualTolerance(-1, -v.VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialAc.FromVoltsAc(3)-v).VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(2, (v + v).VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(10, (v*10).VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(10, (10*v).VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialAc.FromVoltsAc(10)/5).VoltsAc, VoltsAcTolerance); - AssertEx.EqualTolerance(2, ElectricPotentialAc.FromVoltsAc(10)/ElectricPotentialAc.FromVoltsAc(5), VoltsAcTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricPotentialAc oneVoltAc = ElectricPotentialAc.FromVoltsAc(1); - ElectricPotentialAc twoVoltsAc = ElectricPotentialAc.FromVoltsAc(2); - - Assert.True(oneVoltAc < twoVoltsAc); - Assert.True(oneVoltAc <= twoVoltsAc); - Assert.True(twoVoltsAc > oneVoltAc); - Assert.True(twoVoltsAc >= oneVoltAc); - - Assert.False(oneVoltAc > twoVoltsAc); - Assert.False(oneVoltAc >= twoVoltsAc); - Assert.False(twoVoltsAc < oneVoltAc); - Assert.False(twoVoltsAc <= oneVoltAc); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - Assert.Equal(0, voltac.CompareTo(voltac)); - Assert.True(voltac.CompareTo(ElectricPotentialAc.Zero) > 0); - Assert.True(ElectricPotentialAc.Zero.CompareTo(voltac) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - Assert.Throws(() => voltac.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - Assert.Throws(() => voltac.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricPotentialAc v = ElectricPotentialAc.FromVoltsAc(1); - Assert.True(v.Equals(ElectricPotentialAc.FromVoltsAc(1), VoltsAcTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricPotentialAc.Zero, VoltsAcTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - Assert.False(voltac.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricPotentialAc voltac = ElectricPotentialAc.FromVoltsAc(1); - Assert.False(voltac.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricPotentialAcUnit.Undefined, ElectricPotentialAc.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricPotentialAcUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricPotentialAcUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs deleted file mode 100644 index 35bfbf279b..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialDcTestsBase.g.cs +++ /dev/null @@ -1,264 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricPotentialDc. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricPotentialDcTestsBase - { - protected abstract double KilovoltsDcInOneVoltDc { get; } - protected abstract double MegavoltsDcInOneVoltDc { get; } - protected abstract double MicrovoltsDcInOneVoltDc { get; } - protected abstract double MillivoltsDcInOneVoltDc { get; } - protected abstract double VoltsDcInOneVoltDc { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilovoltsDcTolerance { get { return 1e-5; } } - protected virtual double MegavoltsDcTolerance { get { return 1e-5; } } - protected virtual double MicrovoltsDcTolerance { get { return 1e-5; } } - protected virtual double MillivoltsDcTolerance { get { return 1e-5; } } - protected virtual double VoltsDcTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotentialDc((double)0.0, ElectricPotentialDcUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotentialDc(double.PositiveInfinity, ElectricPotentialDcUnit.VoltDc)); - Assert.Throws(() => new ElectricPotentialDc(double.NegativeInfinity, ElectricPotentialDcUnit.VoltDc)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotentialDc(double.NaN, ElectricPotentialDcUnit.VoltDc)); - } - - [Fact] - public void VoltDcToElectricPotentialDcUnits() - { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - AssertEx.EqualTolerance(KilovoltsDcInOneVoltDc, voltdc.KilovoltsDc, KilovoltsDcTolerance); - AssertEx.EqualTolerance(MegavoltsDcInOneVoltDc, voltdc.MegavoltsDc, MegavoltsDcTolerance); - AssertEx.EqualTolerance(MicrovoltsDcInOneVoltDc, voltdc.MicrovoltsDc, MicrovoltsDcTolerance); - AssertEx.EqualTolerance(MillivoltsDcInOneVoltDc, voltdc.MillivoltsDc, MillivoltsDcTolerance); - AssertEx.EqualTolerance(VoltsDcInOneVoltDc, voltdc.VoltsDc, VoltsDcTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.KilovoltDc).KilovoltsDc, KilovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MegavoltDc).MegavoltsDc, MegavoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MicrovoltDc).MicrovoltsDc, MicrovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.MillivoltDc).MillivoltsDc, MillivoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.From(1, ElectricPotentialDcUnit.VoltDc).VoltsDc, VoltsDcTolerance); - } - - [Fact] - public void FromVoltsDc_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NegativeInfinity)); - } - - [Fact] - public void FromVoltsDc_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricPotentialDc.FromVoltsDc(double.NaN)); - } - - [Fact] - public void As() - { - var voltdc = ElectricPotentialDc.FromVoltsDc(1); - AssertEx.EqualTolerance(KilovoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.KilovoltDc), KilovoltsDcTolerance); - AssertEx.EqualTolerance(MegavoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.MegavoltDc), MegavoltsDcTolerance); - AssertEx.EqualTolerance(MicrovoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.MicrovoltDc), MicrovoltsDcTolerance); - AssertEx.EqualTolerance(MillivoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.MillivoltDc), MillivoltsDcTolerance); - AssertEx.EqualTolerance(VoltsDcInOneVoltDc, voltdc.As(ElectricPotentialDcUnit.VoltDc), VoltsDcTolerance); - } - - [Fact] - public void ToUnit() - { - var voltdc = ElectricPotentialDc.FromVoltsDc(1); - - var kilovoltdcQuantity = voltdc.ToUnit(ElectricPotentialDcUnit.KilovoltDc); - AssertEx.EqualTolerance(KilovoltsDcInOneVoltDc, (double)kilovoltdcQuantity.Value, KilovoltsDcTolerance); - Assert.Equal(ElectricPotentialDcUnit.KilovoltDc, kilovoltdcQuantity.Unit); - - var megavoltdcQuantity = voltdc.ToUnit(ElectricPotentialDcUnit.MegavoltDc); - AssertEx.EqualTolerance(MegavoltsDcInOneVoltDc, (double)megavoltdcQuantity.Value, MegavoltsDcTolerance); - Assert.Equal(ElectricPotentialDcUnit.MegavoltDc, megavoltdcQuantity.Unit); - - var microvoltdcQuantity = voltdc.ToUnit(ElectricPotentialDcUnit.MicrovoltDc); - AssertEx.EqualTolerance(MicrovoltsDcInOneVoltDc, (double)microvoltdcQuantity.Value, MicrovoltsDcTolerance); - Assert.Equal(ElectricPotentialDcUnit.MicrovoltDc, microvoltdcQuantity.Unit); - - var millivoltdcQuantity = voltdc.ToUnit(ElectricPotentialDcUnit.MillivoltDc); - AssertEx.EqualTolerance(MillivoltsDcInOneVoltDc, (double)millivoltdcQuantity.Value, MillivoltsDcTolerance); - Assert.Equal(ElectricPotentialDcUnit.MillivoltDc, millivoltdcQuantity.Unit); - - var voltdcQuantity = voltdc.ToUnit(ElectricPotentialDcUnit.VoltDc); - AssertEx.EqualTolerance(VoltsDcInOneVoltDc, (double)voltdcQuantity.Value, VoltsDcTolerance); - Assert.Equal(ElectricPotentialDcUnit.VoltDc, voltdcQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromKilovoltsDc(voltdc.KilovoltsDc).VoltsDc, KilovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMegavoltsDc(voltdc.MegavoltsDc).VoltsDc, MegavoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMicrovoltsDc(voltdc.MicrovoltsDc).VoltsDc, MicrovoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromMillivoltsDc(voltdc.MillivoltsDc).VoltsDc, MillivoltsDcTolerance); - AssertEx.EqualTolerance(1, ElectricPotentialDc.FromVoltsDc(voltdc.VoltsDc).VoltsDc, VoltsDcTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricPotentialDc v = ElectricPotentialDc.FromVoltsDc(1); - AssertEx.EqualTolerance(-1, -v.VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialDc.FromVoltsDc(3)-v).VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(2, (v + v).VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(10, (v*10).VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(10, (10*v).VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(2, (ElectricPotentialDc.FromVoltsDc(10)/5).VoltsDc, VoltsDcTolerance); - AssertEx.EqualTolerance(2, ElectricPotentialDc.FromVoltsDc(10)/ElectricPotentialDc.FromVoltsDc(5), VoltsDcTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricPotentialDc oneVoltDc = ElectricPotentialDc.FromVoltsDc(1); - ElectricPotentialDc twoVoltsDc = ElectricPotentialDc.FromVoltsDc(2); - - Assert.True(oneVoltDc < twoVoltsDc); - Assert.True(oneVoltDc <= twoVoltsDc); - Assert.True(twoVoltsDc > oneVoltDc); - Assert.True(twoVoltsDc >= oneVoltDc); - - Assert.False(oneVoltDc > twoVoltsDc); - Assert.False(oneVoltDc >= twoVoltsDc); - Assert.False(twoVoltsDc < oneVoltDc); - Assert.False(twoVoltsDc <= oneVoltDc); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - Assert.Equal(0, voltdc.CompareTo(voltdc)); - Assert.True(voltdc.CompareTo(ElectricPotentialDc.Zero) > 0); - Assert.True(ElectricPotentialDc.Zero.CompareTo(voltdc) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - Assert.Throws(() => voltdc.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - Assert.Throws(() => voltdc.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricPotentialDc v = ElectricPotentialDc.FromVoltsDc(1); - Assert.True(v.Equals(ElectricPotentialDc.FromVoltsDc(1), VoltsDcTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricPotentialDc.Zero, VoltsDcTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - Assert.False(voltdc.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricPotentialDc voltdc = ElectricPotentialDc.FromVoltsDc(1); - Assert.False(voltdc.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricPotentialDcUnit.Undefined, ElectricPotentialDc.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricPotentialDcUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricPotentialDcUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs deleted file mode 100644 index c1572878e3..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricPotentialTestsBase.g.cs +++ /dev/null @@ -1,264 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricPotential. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricPotentialTestsBase - { - protected abstract double KilovoltsInOneVolt { get; } - protected abstract double MegavoltsInOneVolt { get; } - protected abstract double MicrovoltsInOneVolt { get; } - protected abstract double MillivoltsInOneVolt { get; } - protected abstract double VoltsInOneVolt { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilovoltsTolerance { get { return 1e-5; } } - protected virtual double MegavoltsTolerance { get { return 1e-5; } } - protected virtual double MicrovoltsTolerance { get { return 1e-5; } } - protected virtual double MillivoltsTolerance { get { return 1e-5; } } - protected virtual double VoltsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotential((double)0.0, ElectricPotentialUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotential(double.PositiveInfinity, ElectricPotentialUnit.Volt)); - Assert.Throws(() => new ElectricPotential(double.NegativeInfinity, ElectricPotentialUnit.Volt)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricPotential(double.NaN, ElectricPotentialUnit.Volt)); - } - - [Fact] - public void VoltToElectricPotentialUnits() - { - ElectricPotential volt = ElectricPotential.FromVolts(1); - AssertEx.EqualTolerance(KilovoltsInOneVolt, volt.Kilovolts, KilovoltsTolerance); - AssertEx.EqualTolerance(MegavoltsInOneVolt, volt.Megavolts, MegavoltsTolerance); - AssertEx.EqualTolerance(MicrovoltsInOneVolt, volt.Microvolts, MicrovoltsTolerance); - AssertEx.EqualTolerance(MillivoltsInOneVolt, volt.Millivolts, MillivoltsTolerance); - AssertEx.EqualTolerance(VoltsInOneVolt, volt.Volts, VoltsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Kilovolt).Kilovolts, KilovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Megavolt).Megavolts, MegavoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Microvolt).Microvolts, MicrovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Millivolt).Millivolts, MillivoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.From(1, ElectricPotentialUnit.Volt).Volts, VoltsTolerance); - } - - [Fact] - public void FromVolts_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricPotential.FromVolts(double.PositiveInfinity)); - Assert.Throws(() => ElectricPotential.FromVolts(double.NegativeInfinity)); - } - - [Fact] - public void FromVolts_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricPotential.FromVolts(double.NaN)); - } - - [Fact] - public void As() - { - var volt = ElectricPotential.FromVolts(1); - AssertEx.EqualTolerance(KilovoltsInOneVolt, volt.As(ElectricPotentialUnit.Kilovolt), KilovoltsTolerance); - AssertEx.EqualTolerance(MegavoltsInOneVolt, volt.As(ElectricPotentialUnit.Megavolt), MegavoltsTolerance); - AssertEx.EqualTolerance(MicrovoltsInOneVolt, volt.As(ElectricPotentialUnit.Microvolt), MicrovoltsTolerance); - AssertEx.EqualTolerance(MillivoltsInOneVolt, volt.As(ElectricPotentialUnit.Millivolt), MillivoltsTolerance); - AssertEx.EqualTolerance(VoltsInOneVolt, volt.As(ElectricPotentialUnit.Volt), VoltsTolerance); - } - - [Fact] - public void ToUnit() - { - var volt = ElectricPotential.FromVolts(1); - - var kilovoltQuantity = volt.ToUnit(ElectricPotentialUnit.Kilovolt); - AssertEx.EqualTolerance(KilovoltsInOneVolt, (double)kilovoltQuantity.Value, KilovoltsTolerance); - Assert.Equal(ElectricPotentialUnit.Kilovolt, kilovoltQuantity.Unit); - - var megavoltQuantity = volt.ToUnit(ElectricPotentialUnit.Megavolt); - AssertEx.EqualTolerance(MegavoltsInOneVolt, (double)megavoltQuantity.Value, MegavoltsTolerance); - Assert.Equal(ElectricPotentialUnit.Megavolt, megavoltQuantity.Unit); - - var microvoltQuantity = volt.ToUnit(ElectricPotentialUnit.Microvolt); - AssertEx.EqualTolerance(MicrovoltsInOneVolt, (double)microvoltQuantity.Value, MicrovoltsTolerance); - Assert.Equal(ElectricPotentialUnit.Microvolt, microvoltQuantity.Unit); - - var millivoltQuantity = volt.ToUnit(ElectricPotentialUnit.Millivolt); - AssertEx.EqualTolerance(MillivoltsInOneVolt, (double)millivoltQuantity.Value, MillivoltsTolerance); - Assert.Equal(ElectricPotentialUnit.Millivolt, millivoltQuantity.Unit); - - var voltQuantity = volt.ToUnit(ElectricPotentialUnit.Volt); - AssertEx.EqualTolerance(VoltsInOneVolt, (double)voltQuantity.Value, VoltsTolerance); - Assert.Equal(ElectricPotentialUnit.Volt, voltQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricPotential volt = ElectricPotential.FromVolts(1); - AssertEx.EqualTolerance(1, ElectricPotential.FromKilovolts(volt.Kilovolts).Volts, KilovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromMegavolts(volt.Megavolts).Volts, MegavoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromMicrovolts(volt.Microvolts).Volts, MicrovoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromMillivolts(volt.Millivolts).Volts, MillivoltsTolerance); - AssertEx.EqualTolerance(1, ElectricPotential.FromVolts(volt.Volts).Volts, VoltsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricPotential v = ElectricPotential.FromVolts(1); - AssertEx.EqualTolerance(-1, -v.Volts, VoltsTolerance); - AssertEx.EqualTolerance(2, (ElectricPotential.FromVolts(3)-v).Volts, VoltsTolerance); - AssertEx.EqualTolerance(2, (v + v).Volts, VoltsTolerance); - AssertEx.EqualTolerance(10, (v*10).Volts, VoltsTolerance); - AssertEx.EqualTolerance(10, (10*v).Volts, VoltsTolerance); - AssertEx.EqualTolerance(2, (ElectricPotential.FromVolts(10)/5).Volts, VoltsTolerance); - AssertEx.EqualTolerance(2, ElectricPotential.FromVolts(10)/ElectricPotential.FromVolts(5), VoltsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricPotential oneVolt = ElectricPotential.FromVolts(1); - ElectricPotential twoVolts = ElectricPotential.FromVolts(2); - - Assert.True(oneVolt < twoVolts); - Assert.True(oneVolt <= twoVolts); - Assert.True(twoVolts > oneVolt); - Assert.True(twoVolts >= oneVolt); - - Assert.False(oneVolt > twoVolts); - Assert.False(oneVolt >= twoVolts); - Assert.False(twoVolts < oneVolt); - Assert.False(twoVolts <= oneVolt); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricPotential volt = ElectricPotential.FromVolts(1); - Assert.Equal(0, volt.CompareTo(volt)); - Assert.True(volt.CompareTo(ElectricPotential.Zero) > 0); - Assert.True(ElectricPotential.Zero.CompareTo(volt) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricPotential volt = ElectricPotential.FromVolts(1); - Assert.Throws(() => volt.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricPotential volt = ElectricPotential.FromVolts(1); - Assert.Throws(() => volt.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricPotential v = ElectricPotential.FromVolts(1); - Assert.True(v.Equals(ElectricPotential.FromVolts(1), VoltsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricPotential.Zero, VoltsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricPotential volt = ElectricPotential.FromVolts(1); - Assert.False(volt.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricPotential volt = ElectricPotential.FromVolts(1); - Assert.False(volt.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricPotentialUnit.Undefined, ElectricPotential.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricPotentialUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricPotentialUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs deleted file mode 100644 index 4fc90f533c..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistanceTestsBase.g.cs +++ /dev/null @@ -1,254 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricResistance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricResistanceTestsBase - { - protected abstract double KiloohmsInOneOhm { get; } - protected abstract double MegaohmsInOneOhm { get; } - protected abstract double MilliohmsInOneOhm { get; } - protected abstract double OhmsInOneOhm { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KiloohmsTolerance { get { return 1e-5; } } - protected virtual double MegaohmsTolerance { get { return 1e-5; } } - protected virtual double MilliohmsTolerance { get { return 1e-5; } } - protected virtual double OhmsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricResistance((double)0.0, ElectricResistanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricResistance(double.PositiveInfinity, ElectricResistanceUnit.Ohm)); - Assert.Throws(() => new ElectricResistance(double.NegativeInfinity, ElectricResistanceUnit.Ohm)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricResistance(double.NaN, ElectricResistanceUnit.Ohm)); - } - - [Fact] - public void OhmToElectricResistanceUnits() - { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - AssertEx.EqualTolerance(KiloohmsInOneOhm, ohm.Kiloohms, KiloohmsTolerance); - AssertEx.EqualTolerance(MegaohmsInOneOhm, ohm.Megaohms, MegaohmsTolerance); - AssertEx.EqualTolerance(MilliohmsInOneOhm, ohm.Milliohms, MilliohmsTolerance); - AssertEx.EqualTolerance(OhmsInOneOhm, ohm.Ohms, OhmsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Kiloohm).Kiloohms, KiloohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Megaohm).Megaohms, MegaohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Milliohm).Milliohms, MilliohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.From(1, ElectricResistanceUnit.Ohm).Ohms, OhmsTolerance); - } - - [Fact] - public void FromOhms_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricResistance.FromOhms(double.PositiveInfinity)); - Assert.Throws(() => ElectricResistance.FromOhms(double.NegativeInfinity)); - } - - [Fact] - public void FromOhms_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricResistance.FromOhms(double.NaN)); - } - - [Fact] - public void As() - { - var ohm = ElectricResistance.FromOhms(1); - AssertEx.EqualTolerance(KiloohmsInOneOhm, ohm.As(ElectricResistanceUnit.Kiloohm), KiloohmsTolerance); - AssertEx.EqualTolerance(MegaohmsInOneOhm, ohm.As(ElectricResistanceUnit.Megaohm), MegaohmsTolerance); - AssertEx.EqualTolerance(MilliohmsInOneOhm, ohm.As(ElectricResistanceUnit.Milliohm), MilliohmsTolerance); - AssertEx.EqualTolerance(OhmsInOneOhm, ohm.As(ElectricResistanceUnit.Ohm), OhmsTolerance); - } - - [Fact] - public void ToUnit() - { - var ohm = ElectricResistance.FromOhms(1); - - var kiloohmQuantity = ohm.ToUnit(ElectricResistanceUnit.Kiloohm); - AssertEx.EqualTolerance(KiloohmsInOneOhm, (double)kiloohmQuantity.Value, KiloohmsTolerance); - Assert.Equal(ElectricResistanceUnit.Kiloohm, kiloohmQuantity.Unit); - - var megaohmQuantity = ohm.ToUnit(ElectricResistanceUnit.Megaohm); - AssertEx.EqualTolerance(MegaohmsInOneOhm, (double)megaohmQuantity.Value, MegaohmsTolerance); - Assert.Equal(ElectricResistanceUnit.Megaohm, megaohmQuantity.Unit); - - var milliohmQuantity = ohm.ToUnit(ElectricResistanceUnit.Milliohm); - AssertEx.EqualTolerance(MilliohmsInOneOhm, (double)milliohmQuantity.Value, MilliohmsTolerance); - Assert.Equal(ElectricResistanceUnit.Milliohm, milliohmQuantity.Unit); - - var ohmQuantity = ohm.ToUnit(ElectricResistanceUnit.Ohm); - AssertEx.EqualTolerance(OhmsInOneOhm, (double)ohmQuantity.Value, OhmsTolerance); - Assert.Equal(ElectricResistanceUnit.Ohm, ohmQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - AssertEx.EqualTolerance(1, ElectricResistance.FromKiloohms(ohm.Kiloohms).Ohms, KiloohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.FromMegaohms(ohm.Megaohms).Ohms, MegaohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.FromMilliohms(ohm.Milliohms).Ohms, MilliohmsTolerance); - AssertEx.EqualTolerance(1, ElectricResistance.FromOhms(ohm.Ohms).Ohms, OhmsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricResistance v = ElectricResistance.FromOhms(1); - AssertEx.EqualTolerance(-1, -v.Ohms, OhmsTolerance); - AssertEx.EqualTolerance(2, (ElectricResistance.FromOhms(3)-v).Ohms, OhmsTolerance); - AssertEx.EqualTolerance(2, (v + v).Ohms, OhmsTolerance); - AssertEx.EqualTolerance(10, (v*10).Ohms, OhmsTolerance); - AssertEx.EqualTolerance(10, (10*v).Ohms, OhmsTolerance); - AssertEx.EqualTolerance(2, (ElectricResistance.FromOhms(10)/5).Ohms, OhmsTolerance); - AssertEx.EqualTolerance(2, ElectricResistance.FromOhms(10)/ElectricResistance.FromOhms(5), OhmsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricResistance oneOhm = ElectricResistance.FromOhms(1); - ElectricResistance twoOhms = ElectricResistance.FromOhms(2); - - Assert.True(oneOhm < twoOhms); - Assert.True(oneOhm <= twoOhms); - Assert.True(twoOhms > oneOhm); - Assert.True(twoOhms >= oneOhm); - - Assert.False(oneOhm > twoOhms); - Assert.False(oneOhm >= twoOhms); - Assert.False(twoOhms < oneOhm); - Assert.False(twoOhms <= oneOhm); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - Assert.Equal(0, ohm.CompareTo(ohm)); - Assert.True(ohm.CompareTo(ElectricResistance.Zero) > 0); - Assert.True(ElectricResistance.Zero.CompareTo(ohm) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - Assert.Throws(() => ohm.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - Assert.Throws(() => ohm.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricResistance v = ElectricResistance.FromOhms(1); - Assert.True(v.Equals(ElectricResistance.FromOhms(1), OhmsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricResistance.Zero, OhmsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - Assert.False(ohm.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricResistance ohm = ElectricResistance.FromOhms(1); - Assert.False(ohm.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricResistanceUnit.Undefined, ElectricResistance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricResistanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricResistanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs deleted file mode 100644 index d04adb92ba..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ElectricResistivityTestsBase.g.cs +++ /dev/null @@ -1,254 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ElectricResistivity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ElectricResistivityTestsBase - { - protected abstract double MicroohmMetersInOneOhmMeter { get; } - protected abstract double MilliohmMetersInOneOhmMeter { get; } - protected abstract double NanoohmMetersInOneOhmMeter { get; } - protected abstract double OhmMetersInOneOhmMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double MicroohmMetersTolerance { get { return 1e-5; } } - protected virtual double MilliohmMetersTolerance { get { return 1e-5; } } - protected virtual double NanoohmMetersTolerance { get { return 1e-5; } } - protected virtual double OhmMetersTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricResistivity((double)0.0, ElectricResistivityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricResistivity(double.PositiveInfinity, ElectricResistivityUnit.OhmMeter)); - Assert.Throws(() => new ElectricResistivity(double.NegativeInfinity, ElectricResistivityUnit.OhmMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ElectricResistivity(double.NaN, ElectricResistivityUnit.OhmMeter)); - } - - [Fact] - public void OhmMeterToElectricResistivityUnits() - { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - AssertEx.EqualTolerance(MicroohmMetersInOneOhmMeter, ohmmeter.MicroohmMeters, MicroohmMetersTolerance); - AssertEx.EqualTolerance(MilliohmMetersInOneOhmMeter, ohmmeter.MilliohmMeters, MilliohmMetersTolerance); - AssertEx.EqualTolerance(NanoohmMetersInOneOhmMeter, ohmmeter.NanoohmMeters, NanoohmMetersTolerance); - AssertEx.EqualTolerance(OhmMetersInOneOhmMeter, ohmmeter.OhmMeters, OhmMetersTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MicroohmMeter).MicroohmMeters, MicroohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.MilliohmMeter).MilliohmMeters, MilliohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.NanoohmMeter).NanoohmMeters, NanoohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.From(1, ElectricResistivityUnit.OhmMeter).OhmMeters, OhmMetersTolerance); - } - - [Fact] - public void FromOhmMeters_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.PositiveInfinity)); - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NegativeInfinity)); - } - - [Fact] - public void FromOhmMeters_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ElectricResistivity.FromOhmMeters(double.NaN)); - } - - [Fact] - public void As() - { - var ohmmeter = ElectricResistivity.FromOhmMeters(1); - AssertEx.EqualTolerance(MicroohmMetersInOneOhmMeter, ohmmeter.As(ElectricResistivityUnit.MicroohmMeter), MicroohmMetersTolerance); - AssertEx.EqualTolerance(MilliohmMetersInOneOhmMeter, ohmmeter.As(ElectricResistivityUnit.MilliohmMeter), MilliohmMetersTolerance); - AssertEx.EqualTolerance(NanoohmMetersInOneOhmMeter, ohmmeter.As(ElectricResistivityUnit.NanoohmMeter), NanoohmMetersTolerance); - AssertEx.EqualTolerance(OhmMetersInOneOhmMeter, ohmmeter.As(ElectricResistivityUnit.OhmMeter), OhmMetersTolerance); - } - - [Fact] - public void ToUnit() - { - var ohmmeter = ElectricResistivity.FromOhmMeters(1); - - var microohmmeterQuantity = ohmmeter.ToUnit(ElectricResistivityUnit.MicroohmMeter); - AssertEx.EqualTolerance(MicroohmMetersInOneOhmMeter, (double)microohmmeterQuantity.Value, MicroohmMetersTolerance); - Assert.Equal(ElectricResistivityUnit.MicroohmMeter, microohmmeterQuantity.Unit); - - var milliohmmeterQuantity = ohmmeter.ToUnit(ElectricResistivityUnit.MilliohmMeter); - AssertEx.EqualTolerance(MilliohmMetersInOneOhmMeter, (double)milliohmmeterQuantity.Value, MilliohmMetersTolerance); - Assert.Equal(ElectricResistivityUnit.MilliohmMeter, milliohmmeterQuantity.Unit); - - var nanoohmmeterQuantity = ohmmeter.ToUnit(ElectricResistivityUnit.NanoohmMeter); - AssertEx.EqualTolerance(NanoohmMetersInOneOhmMeter, (double)nanoohmmeterQuantity.Value, NanoohmMetersTolerance); - Assert.Equal(ElectricResistivityUnit.NanoohmMeter, nanoohmmeterQuantity.Unit); - - var ohmmeterQuantity = ohmmeter.ToUnit(ElectricResistivityUnit.OhmMeter); - AssertEx.EqualTolerance(OhmMetersInOneOhmMeter, (double)ohmmeterQuantity.Value, OhmMetersTolerance); - Assert.Equal(ElectricResistivityUnit.OhmMeter, ohmmeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMicroohmMeters(ohmmeter.MicroohmMeters).OhmMeters, MicroohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromMilliohmMeters(ohmmeter.MilliohmMeters).OhmMeters, MilliohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromNanoohmMeters(ohmmeter.NanoohmMeters).OhmMeters, NanoohmMetersTolerance); - AssertEx.EqualTolerance(1, ElectricResistivity.FromOhmMeters(ohmmeter.OhmMeters).OhmMeters, OhmMetersTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ElectricResistivity v = ElectricResistivity.FromOhmMeters(1); - AssertEx.EqualTolerance(-1, -v.OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(2, (ElectricResistivity.FromOhmMeters(3)-v).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(2, (v + v).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(10, (v*10).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(10, (10*v).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(2, (ElectricResistivity.FromOhmMeters(10)/5).OhmMeters, OhmMetersTolerance); - AssertEx.EqualTolerance(2, ElectricResistivity.FromOhmMeters(10)/ElectricResistivity.FromOhmMeters(5), OhmMetersTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ElectricResistivity oneOhmMeter = ElectricResistivity.FromOhmMeters(1); - ElectricResistivity twoOhmMeters = ElectricResistivity.FromOhmMeters(2); - - Assert.True(oneOhmMeter < twoOhmMeters); - Assert.True(oneOhmMeter <= twoOhmMeters); - Assert.True(twoOhmMeters > oneOhmMeter); - Assert.True(twoOhmMeters >= oneOhmMeter); - - Assert.False(oneOhmMeter > twoOhmMeters); - Assert.False(oneOhmMeter >= twoOhmMeters); - Assert.False(twoOhmMeters < oneOhmMeter); - Assert.False(twoOhmMeters <= oneOhmMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - Assert.Equal(0, ohmmeter.CompareTo(ohmmeter)); - Assert.True(ohmmeter.CompareTo(ElectricResistivity.Zero) > 0); - Assert.True(ElectricResistivity.Zero.CompareTo(ohmmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - Assert.Throws(() => ohmmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - Assert.Throws(() => ohmmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ElectricResistivity v = ElectricResistivity.FromOhmMeters(1); - Assert.True(v.Equals(ElectricResistivity.FromOhmMeters(1), OhmMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ElectricResistivity.Zero, OhmMetersTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - Assert.False(ohmmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ElectricResistivity ohmmeter = ElectricResistivity.FromOhmMeters(1); - Assert.False(ohmmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ElectricResistivityUnit.Undefined, ElectricResistivity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ElectricResistivityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ElectricResistivityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs deleted file mode 100644 index 697884b711..0000000000 --- a/UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs +++ /dev/null @@ -1,434 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Energy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class EnergyTestsBase - { - protected abstract double BritishThermalUnitsInOneJoule { get; } - protected abstract double CaloriesInOneJoule { get; } - protected abstract double DecathermsEcInOneJoule { get; } - protected abstract double DecathermsImperialInOneJoule { get; } - protected abstract double DecathermsUsInOneJoule { get; } - protected abstract double ElectronVoltsInOneJoule { get; } - protected abstract double ErgsInOneJoule { get; } - protected abstract double FootPoundsInOneJoule { get; } - protected abstract double GigabritishThermalUnitsInOneJoule { get; } - protected abstract double GigawattHoursInOneJoule { get; } - protected abstract double JoulesInOneJoule { get; } - protected abstract double KilobritishThermalUnitsInOneJoule { get; } - protected abstract double KilocaloriesInOneJoule { get; } - protected abstract double KilojoulesInOneJoule { get; } - protected abstract double KilowattHoursInOneJoule { get; } - protected abstract double MegabritishThermalUnitsInOneJoule { get; } - protected abstract double MegajoulesInOneJoule { get; } - protected abstract double MegawattHoursInOneJoule { get; } - protected abstract double ThermsEcInOneJoule { get; } - protected abstract double ThermsImperialInOneJoule { get; } - protected abstract double ThermsUsInOneJoule { get; } - protected abstract double WattHoursInOneJoule { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double BritishThermalUnitsTolerance { get { return 1e-5; } } - protected virtual double CaloriesTolerance { get { return 1e-5; } } - protected virtual double DecathermsEcTolerance { get { return 1e-5; } } - protected virtual double DecathermsImperialTolerance { get { return 1e-5; } } - protected virtual double DecathermsUsTolerance { get { return 1e-5; } } - protected virtual double ElectronVoltsTolerance { get { return 1e-5; } } - protected virtual double ErgsTolerance { get { return 1e-5; } } - protected virtual double FootPoundsTolerance { get { return 1e-5; } } - protected virtual double GigabritishThermalUnitsTolerance { get { return 1e-5; } } - protected virtual double GigawattHoursTolerance { get { return 1e-5; } } - protected virtual double JoulesTolerance { get { return 1e-5; } } - protected virtual double KilobritishThermalUnitsTolerance { get { return 1e-5; } } - protected virtual double KilocaloriesTolerance { get { return 1e-5; } } - protected virtual double KilojoulesTolerance { get { return 1e-5; } } - protected virtual double KilowattHoursTolerance { get { return 1e-5; } } - protected virtual double MegabritishThermalUnitsTolerance { get { return 1e-5; } } - protected virtual double MegajoulesTolerance { get { return 1e-5; } } - protected virtual double MegawattHoursTolerance { get { return 1e-5; } } - protected virtual double ThermsEcTolerance { get { return 1e-5; } } - protected virtual double ThermsImperialTolerance { get { return 1e-5; } } - protected virtual double ThermsUsTolerance { get { return 1e-5; } } - protected virtual double WattHoursTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Energy((double)0.0, EnergyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Energy(double.PositiveInfinity, EnergyUnit.Joule)); - Assert.Throws(() => new Energy(double.NegativeInfinity, EnergyUnit.Joule)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Energy(double.NaN, EnergyUnit.Joule)); - } - - [Fact] - public void JouleToEnergyUnits() - { - Energy joule = Energy.FromJoules(1); - AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.BritishThermalUnits, BritishThermalUnitsTolerance); - AssertEx.EqualTolerance(CaloriesInOneJoule, joule.Calories, CaloriesTolerance); - AssertEx.EqualTolerance(DecathermsEcInOneJoule, joule.DecathermsEc, DecathermsEcTolerance); - AssertEx.EqualTolerance(DecathermsImperialInOneJoule, joule.DecathermsImperial, DecathermsImperialTolerance); - AssertEx.EqualTolerance(DecathermsUsInOneJoule, joule.DecathermsUs, DecathermsUsTolerance); - AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.ElectronVolts, ElectronVoltsTolerance); - AssertEx.EqualTolerance(ErgsInOneJoule, joule.Ergs, ErgsTolerance); - AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.FootPounds, FootPoundsTolerance); - AssertEx.EqualTolerance(GigabritishThermalUnitsInOneJoule, joule.GigabritishThermalUnits, GigabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.GigawattHours, GigawattHoursTolerance); - AssertEx.EqualTolerance(JoulesInOneJoule, joule.Joules, JoulesTolerance); - AssertEx.EqualTolerance(KilobritishThermalUnitsInOneJoule, joule.KilobritishThermalUnits, KilobritishThermalUnitsTolerance); - AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.Kilocalories, KilocaloriesTolerance); - AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.Kilojoules, KilojoulesTolerance); - AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.KilowattHours, KilowattHoursTolerance); - AssertEx.EqualTolerance(MegabritishThermalUnitsInOneJoule, joule.MegabritishThermalUnits, MegabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.Megajoules, MegajoulesTolerance); - AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.MegawattHours, MegawattHoursTolerance); - AssertEx.EqualTolerance(ThermsEcInOneJoule, joule.ThermsEc, ThermsEcTolerance); - AssertEx.EqualTolerance(ThermsImperialInOneJoule, joule.ThermsImperial, ThermsImperialTolerance); - AssertEx.EqualTolerance(ThermsUsInOneJoule, joule.ThermsUs, ThermsUsTolerance); - AssertEx.EqualTolerance(WattHoursInOneJoule, joule.WattHours, WattHoursTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.BritishThermalUnit).BritishThermalUnits, BritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Calorie).Calories, CaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermEc).DecathermsEc, DecathermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermImperial).DecathermsImperial, DecathermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.DecathermUs).DecathermsUs, DecathermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ElectronVolt).ElectronVolts, ElectronVoltsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Erg).Ergs, ErgsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.FootPound).FootPounds, FootPoundsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigabritishThermalUnit).GigabritishThermalUnits, GigabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.GigawattHour).GigawattHours, GigawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Joule).Joules, JoulesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilobritishThermalUnit).KilobritishThermalUnits, KilobritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilocalorie).Kilocalories, KilocaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Kilojoule).Kilojoules, KilojoulesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.KilowattHour).KilowattHours, KilowattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegabritishThermalUnit).MegabritishThermalUnits, MegabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.Megajoule).Megajoules, MegajoulesTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.MegawattHour).MegawattHours, MegawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermEc).ThermsEc, ThermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermImperial).ThermsImperial, ThermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.ThermUs).ThermsUs, ThermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.From(1, EnergyUnit.WattHour).WattHours, WattHoursTolerance); - } - - [Fact] - public void FromJoules_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Energy.FromJoules(double.PositiveInfinity)); - Assert.Throws(() => Energy.FromJoules(double.NegativeInfinity)); - } - - [Fact] - public void FromJoules_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Energy.FromJoules(double.NaN)); - } - - [Fact] - public void As() - { - var joule = Energy.FromJoules(1); - AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, joule.As(EnergyUnit.BritishThermalUnit), BritishThermalUnitsTolerance); - AssertEx.EqualTolerance(CaloriesInOneJoule, joule.As(EnergyUnit.Calorie), CaloriesTolerance); - AssertEx.EqualTolerance(DecathermsEcInOneJoule, joule.As(EnergyUnit.DecathermEc), DecathermsEcTolerance); - AssertEx.EqualTolerance(DecathermsImperialInOneJoule, joule.As(EnergyUnit.DecathermImperial), DecathermsImperialTolerance); - AssertEx.EqualTolerance(DecathermsUsInOneJoule, joule.As(EnergyUnit.DecathermUs), DecathermsUsTolerance); - AssertEx.EqualTolerance(ElectronVoltsInOneJoule, joule.As(EnergyUnit.ElectronVolt), ElectronVoltsTolerance); - AssertEx.EqualTolerance(ErgsInOneJoule, joule.As(EnergyUnit.Erg), ErgsTolerance); - AssertEx.EqualTolerance(FootPoundsInOneJoule, joule.As(EnergyUnit.FootPound), FootPoundsTolerance); - AssertEx.EqualTolerance(GigabritishThermalUnitsInOneJoule, joule.As(EnergyUnit.GigabritishThermalUnit), GigabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(GigawattHoursInOneJoule, joule.As(EnergyUnit.GigawattHour), GigawattHoursTolerance); - AssertEx.EqualTolerance(JoulesInOneJoule, joule.As(EnergyUnit.Joule), JoulesTolerance); - AssertEx.EqualTolerance(KilobritishThermalUnitsInOneJoule, joule.As(EnergyUnit.KilobritishThermalUnit), KilobritishThermalUnitsTolerance); - AssertEx.EqualTolerance(KilocaloriesInOneJoule, joule.As(EnergyUnit.Kilocalorie), KilocaloriesTolerance); - AssertEx.EqualTolerance(KilojoulesInOneJoule, joule.As(EnergyUnit.Kilojoule), KilojoulesTolerance); - AssertEx.EqualTolerance(KilowattHoursInOneJoule, joule.As(EnergyUnit.KilowattHour), KilowattHoursTolerance); - AssertEx.EqualTolerance(MegabritishThermalUnitsInOneJoule, joule.As(EnergyUnit.MegabritishThermalUnit), MegabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(MegajoulesInOneJoule, joule.As(EnergyUnit.Megajoule), MegajoulesTolerance); - AssertEx.EqualTolerance(MegawattHoursInOneJoule, joule.As(EnergyUnit.MegawattHour), MegawattHoursTolerance); - AssertEx.EqualTolerance(ThermsEcInOneJoule, joule.As(EnergyUnit.ThermEc), ThermsEcTolerance); - AssertEx.EqualTolerance(ThermsImperialInOneJoule, joule.As(EnergyUnit.ThermImperial), ThermsImperialTolerance); - AssertEx.EqualTolerance(ThermsUsInOneJoule, joule.As(EnergyUnit.ThermUs), ThermsUsTolerance); - AssertEx.EqualTolerance(WattHoursInOneJoule, joule.As(EnergyUnit.WattHour), WattHoursTolerance); - } - - [Fact] - public void ToUnit() - { - var joule = Energy.FromJoules(1); - - var britishthermalunitQuantity = joule.ToUnit(EnergyUnit.BritishThermalUnit); - AssertEx.EqualTolerance(BritishThermalUnitsInOneJoule, (double)britishthermalunitQuantity.Value, BritishThermalUnitsTolerance); - Assert.Equal(EnergyUnit.BritishThermalUnit, britishthermalunitQuantity.Unit); - - var calorieQuantity = joule.ToUnit(EnergyUnit.Calorie); - AssertEx.EqualTolerance(CaloriesInOneJoule, (double)calorieQuantity.Value, CaloriesTolerance); - Assert.Equal(EnergyUnit.Calorie, calorieQuantity.Unit); - - var decathermecQuantity = joule.ToUnit(EnergyUnit.DecathermEc); - AssertEx.EqualTolerance(DecathermsEcInOneJoule, (double)decathermecQuantity.Value, DecathermsEcTolerance); - Assert.Equal(EnergyUnit.DecathermEc, decathermecQuantity.Unit); - - var decathermimperialQuantity = joule.ToUnit(EnergyUnit.DecathermImperial); - AssertEx.EqualTolerance(DecathermsImperialInOneJoule, (double)decathermimperialQuantity.Value, DecathermsImperialTolerance); - Assert.Equal(EnergyUnit.DecathermImperial, decathermimperialQuantity.Unit); - - var decathermusQuantity = joule.ToUnit(EnergyUnit.DecathermUs); - AssertEx.EqualTolerance(DecathermsUsInOneJoule, (double)decathermusQuantity.Value, DecathermsUsTolerance); - Assert.Equal(EnergyUnit.DecathermUs, decathermusQuantity.Unit); - - var electronvoltQuantity = joule.ToUnit(EnergyUnit.ElectronVolt); - AssertEx.EqualTolerance(ElectronVoltsInOneJoule, (double)electronvoltQuantity.Value, ElectronVoltsTolerance); - Assert.Equal(EnergyUnit.ElectronVolt, electronvoltQuantity.Unit); - - var ergQuantity = joule.ToUnit(EnergyUnit.Erg); - AssertEx.EqualTolerance(ErgsInOneJoule, (double)ergQuantity.Value, ErgsTolerance); - Assert.Equal(EnergyUnit.Erg, ergQuantity.Unit); - - var footpoundQuantity = joule.ToUnit(EnergyUnit.FootPound); - AssertEx.EqualTolerance(FootPoundsInOneJoule, (double)footpoundQuantity.Value, FootPoundsTolerance); - Assert.Equal(EnergyUnit.FootPound, footpoundQuantity.Unit); - - var gigabritishthermalunitQuantity = joule.ToUnit(EnergyUnit.GigabritishThermalUnit); - AssertEx.EqualTolerance(GigabritishThermalUnitsInOneJoule, (double)gigabritishthermalunitQuantity.Value, GigabritishThermalUnitsTolerance); - Assert.Equal(EnergyUnit.GigabritishThermalUnit, gigabritishthermalunitQuantity.Unit); - - var gigawatthourQuantity = joule.ToUnit(EnergyUnit.GigawattHour); - AssertEx.EqualTolerance(GigawattHoursInOneJoule, (double)gigawatthourQuantity.Value, GigawattHoursTolerance); - Assert.Equal(EnergyUnit.GigawattHour, gigawatthourQuantity.Unit); - - var jouleQuantity = joule.ToUnit(EnergyUnit.Joule); - AssertEx.EqualTolerance(JoulesInOneJoule, (double)jouleQuantity.Value, JoulesTolerance); - Assert.Equal(EnergyUnit.Joule, jouleQuantity.Unit); - - var kilobritishthermalunitQuantity = joule.ToUnit(EnergyUnit.KilobritishThermalUnit); - AssertEx.EqualTolerance(KilobritishThermalUnitsInOneJoule, (double)kilobritishthermalunitQuantity.Value, KilobritishThermalUnitsTolerance); - Assert.Equal(EnergyUnit.KilobritishThermalUnit, kilobritishthermalunitQuantity.Unit); - - var kilocalorieQuantity = joule.ToUnit(EnergyUnit.Kilocalorie); - AssertEx.EqualTolerance(KilocaloriesInOneJoule, (double)kilocalorieQuantity.Value, KilocaloriesTolerance); - Assert.Equal(EnergyUnit.Kilocalorie, kilocalorieQuantity.Unit); - - var kilojouleQuantity = joule.ToUnit(EnergyUnit.Kilojoule); - AssertEx.EqualTolerance(KilojoulesInOneJoule, (double)kilojouleQuantity.Value, KilojoulesTolerance); - Assert.Equal(EnergyUnit.Kilojoule, kilojouleQuantity.Unit); - - var kilowatthourQuantity = joule.ToUnit(EnergyUnit.KilowattHour); - AssertEx.EqualTolerance(KilowattHoursInOneJoule, (double)kilowatthourQuantity.Value, KilowattHoursTolerance); - Assert.Equal(EnergyUnit.KilowattHour, kilowatthourQuantity.Unit); - - var megabritishthermalunitQuantity = joule.ToUnit(EnergyUnit.MegabritishThermalUnit); - AssertEx.EqualTolerance(MegabritishThermalUnitsInOneJoule, (double)megabritishthermalunitQuantity.Value, MegabritishThermalUnitsTolerance); - Assert.Equal(EnergyUnit.MegabritishThermalUnit, megabritishthermalunitQuantity.Unit); - - var megajouleQuantity = joule.ToUnit(EnergyUnit.Megajoule); - AssertEx.EqualTolerance(MegajoulesInOneJoule, (double)megajouleQuantity.Value, MegajoulesTolerance); - Assert.Equal(EnergyUnit.Megajoule, megajouleQuantity.Unit); - - var megawatthourQuantity = joule.ToUnit(EnergyUnit.MegawattHour); - AssertEx.EqualTolerance(MegawattHoursInOneJoule, (double)megawatthourQuantity.Value, MegawattHoursTolerance); - Assert.Equal(EnergyUnit.MegawattHour, megawatthourQuantity.Unit); - - var thermecQuantity = joule.ToUnit(EnergyUnit.ThermEc); - AssertEx.EqualTolerance(ThermsEcInOneJoule, (double)thermecQuantity.Value, ThermsEcTolerance); - Assert.Equal(EnergyUnit.ThermEc, thermecQuantity.Unit); - - var thermimperialQuantity = joule.ToUnit(EnergyUnit.ThermImperial); - AssertEx.EqualTolerance(ThermsImperialInOneJoule, (double)thermimperialQuantity.Value, ThermsImperialTolerance); - Assert.Equal(EnergyUnit.ThermImperial, thermimperialQuantity.Unit); - - var thermusQuantity = joule.ToUnit(EnergyUnit.ThermUs); - AssertEx.EqualTolerance(ThermsUsInOneJoule, (double)thermusQuantity.Value, ThermsUsTolerance); - Assert.Equal(EnergyUnit.ThermUs, thermusQuantity.Unit); - - var watthourQuantity = joule.ToUnit(EnergyUnit.WattHour); - AssertEx.EqualTolerance(WattHoursInOneJoule, (double)watthourQuantity.Value, WattHoursTolerance); - Assert.Equal(EnergyUnit.WattHour, watthourQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Energy joule = Energy.FromJoules(1); - AssertEx.EqualTolerance(1, Energy.FromBritishThermalUnits(joule.BritishThermalUnits).Joules, BritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromCalories(joule.Calories).Joules, CaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecathermsEc(joule.DecathermsEc).Joules, DecathermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecathermsImperial(joule.DecathermsImperial).Joules, DecathermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.FromDecathermsUs(joule.DecathermsUs).Joules, DecathermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.FromElectronVolts(joule.ElectronVolts).Joules, ElectronVoltsTolerance); - AssertEx.EqualTolerance(1, Energy.FromErgs(joule.Ergs).Joules, ErgsTolerance); - AssertEx.EqualTolerance(1, Energy.FromFootPounds(joule.FootPounds).Joules, FootPoundsTolerance); - AssertEx.EqualTolerance(1, Energy.FromGigabritishThermalUnits(joule.GigabritishThermalUnits).Joules, GigabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromGigawattHours(joule.GigawattHours).Joules, GigawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromJoules(joule.Joules).Joules, JoulesTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilobritishThermalUnits(joule.KilobritishThermalUnits).Joules, KilobritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilocalories(joule.Kilocalories).Joules, KilocaloriesTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilojoules(joule.Kilojoules).Joules, KilojoulesTolerance); - AssertEx.EqualTolerance(1, Energy.FromKilowattHours(joule.KilowattHours).Joules, KilowattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromMegabritishThermalUnits(joule.MegabritishThermalUnits).Joules, MegabritishThermalUnitsTolerance); - AssertEx.EqualTolerance(1, Energy.FromMegajoules(joule.Megajoules).Joules, MegajoulesTolerance); - AssertEx.EqualTolerance(1, Energy.FromMegawattHours(joule.MegawattHours).Joules, MegawattHoursTolerance); - AssertEx.EqualTolerance(1, Energy.FromThermsEc(joule.ThermsEc).Joules, ThermsEcTolerance); - AssertEx.EqualTolerance(1, Energy.FromThermsImperial(joule.ThermsImperial).Joules, ThermsImperialTolerance); - AssertEx.EqualTolerance(1, Energy.FromThermsUs(joule.ThermsUs).Joules, ThermsUsTolerance); - AssertEx.EqualTolerance(1, Energy.FromWattHours(joule.WattHours).Joules, WattHoursTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Energy v = Energy.FromJoules(1); - AssertEx.EqualTolerance(-1, -v.Joules, JoulesTolerance); - AssertEx.EqualTolerance(2, (Energy.FromJoules(3)-v).Joules, JoulesTolerance); - AssertEx.EqualTolerance(2, (v + v).Joules, JoulesTolerance); - AssertEx.EqualTolerance(10, (v*10).Joules, JoulesTolerance); - AssertEx.EqualTolerance(10, (10*v).Joules, JoulesTolerance); - AssertEx.EqualTolerance(2, (Energy.FromJoules(10)/5).Joules, JoulesTolerance); - AssertEx.EqualTolerance(2, Energy.FromJoules(10)/Energy.FromJoules(5), JoulesTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Energy oneJoule = Energy.FromJoules(1); - Energy twoJoules = Energy.FromJoules(2); - - Assert.True(oneJoule < twoJoules); - Assert.True(oneJoule <= twoJoules); - Assert.True(twoJoules > oneJoule); - Assert.True(twoJoules >= oneJoule); - - Assert.False(oneJoule > twoJoules); - Assert.False(oneJoule >= twoJoules); - Assert.False(twoJoules < oneJoule); - Assert.False(twoJoules <= oneJoule); - } - - [Fact] - public void CompareToIsImplemented() - { - Energy joule = Energy.FromJoules(1); - Assert.Equal(0, joule.CompareTo(joule)); - Assert.True(joule.CompareTo(Energy.Zero) > 0); - Assert.True(Energy.Zero.CompareTo(joule) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Energy joule = Energy.FromJoules(1); - Assert.Throws(() => joule.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Energy joule = Energy.FromJoules(1); - Assert.Throws(() => joule.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Energy v = Energy.FromJoules(1); - Assert.True(v.Equals(Energy.FromJoules(1), JoulesTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Energy.Zero, JoulesTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Energy joule = Energy.FromJoules(1); - Assert.False(joule.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Energy joule = Energy.FromJoules(1); - Assert.False(joule.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(EnergyUnit.Undefined, Energy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(EnergyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == EnergyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs deleted file mode 100644 index 98cd982765..0000000000 --- a/UnitsNet.Tests/GeneratedCode/EntropyTestsBase.g.cs +++ /dev/null @@ -1,284 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Entropy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class EntropyTestsBase - { - protected abstract double CaloriesPerKelvinInOneJoulePerKelvin { get; } - protected abstract double JoulesPerDegreeCelsiusInOneJoulePerKelvin { get; } - protected abstract double JoulesPerKelvinInOneJoulePerKelvin { get; } - protected abstract double KilocaloriesPerKelvinInOneJoulePerKelvin { get; } - protected abstract double KilojoulesPerDegreeCelsiusInOneJoulePerKelvin { get; } - protected abstract double KilojoulesPerKelvinInOneJoulePerKelvin { get; } - protected abstract double MegajoulesPerKelvinInOneJoulePerKelvin { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CaloriesPerKelvinTolerance { get { return 1e-5; } } - protected virtual double JoulesPerDegreeCelsiusTolerance { get { return 1e-5; } } - protected virtual double JoulesPerKelvinTolerance { get { return 1e-5; } } - protected virtual double KilocaloriesPerKelvinTolerance { get { return 1e-5; } } - protected virtual double KilojoulesPerDegreeCelsiusTolerance { get { return 1e-5; } } - protected virtual double KilojoulesPerKelvinTolerance { get { return 1e-5; } } - protected virtual double MegajoulesPerKelvinTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Entropy((double)0.0, EntropyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Entropy(double.PositiveInfinity, EntropyUnit.JoulePerKelvin)); - Assert.Throws(() => new Entropy(double.NegativeInfinity, EntropyUnit.JoulePerKelvin)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Entropy(double.NaN, EntropyUnit.JoulePerKelvin)); - } - - [Fact] - public void JoulePerKelvinToEntropyUnits() - { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - AssertEx.EqualTolerance(CaloriesPerKelvinInOneJoulePerKelvin, jouleperkelvin.CaloriesPerKelvin, CaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(JoulesPerDegreeCelsiusInOneJoulePerKelvin, jouleperkelvin.JoulesPerDegreeCelsius, JoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(JoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(KilocaloriesPerKelvinInOneJoulePerKelvin, jouleperkelvin.KilocaloriesPerKelvin, KilocaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(KilojoulesPerDegreeCelsiusInOneJoulePerKelvin, jouleperkelvin.KilojoulesPerDegreeCelsius, KilojoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(KilojoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.KilojoulesPerKelvin, KilojoulesPerKelvinTolerance); - AssertEx.EqualTolerance(MegajoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.MegajoulesPerKelvin, MegajoulesPerKelvinTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.CaloriePerKelvin).CaloriesPerKelvin, CaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.JoulePerDegreeCelsius).JoulesPerDegreeCelsius, JoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.JoulePerKelvin).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilocaloriePerKelvin).KilocaloriesPerKelvin, KilocaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilojoulePerDegreeCelsius).KilojoulesPerDegreeCelsius, KilojoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.KilojoulePerKelvin).KilojoulesPerKelvin, KilojoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.From(1, EntropyUnit.MegajoulePerKelvin).MegajoulesPerKelvin, MegajoulesPerKelvinTolerance); - } - - [Fact] - public void FromJoulesPerKelvin_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.PositiveInfinity)); - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NegativeInfinity)); - } - - [Fact] - public void FromJoulesPerKelvin_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Entropy.FromJoulesPerKelvin(double.NaN)); - } - - [Fact] - public void As() - { - var jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - AssertEx.EqualTolerance(CaloriesPerKelvinInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.CaloriePerKelvin), CaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(JoulesPerDegreeCelsiusInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.JoulePerDegreeCelsius), JoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(JoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.JoulePerKelvin), JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(KilocaloriesPerKelvinInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.KilocaloriePerKelvin), KilocaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(KilojoulesPerDegreeCelsiusInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.KilojoulePerDegreeCelsius), KilojoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(KilojoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.KilojoulePerKelvin), KilojoulesPerKelvinTolerance); - AssertEx.EqualTolerance(MegajoulesPerKelvinInOneJoulePerKelvin, jouleperkelvin.As(EntropyUnit.MegajoulePerKelvin), MegajoulesPerKelvinTolerance); - } - - [Fact] - public void ToUnit() - { - var jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - - var calorieperkelvinQuantity = jouleperkelvin.ToUnit(EntropyUnit.CaloriePerKelvin); - AssertEx.EqualTolerance(CaloriesPerKelvinInOneJoulePerKelvin, (double)calorieperkelvinQuantity.Value, CaloriesPerKelvinTolerance); - Assert.Equal(EntropyUnit.CaloriePerKelvin, calorieperkelvinQuantity.Unit); - - var jouleperdegreecelsiusQuantity = jouleperkelvin.ToUnit(EntropyUnit.JoulePerDegreeCelsius); - AssertEx.EqualTolerance(JoulesPerDegreeCelsiusInOneJoulePerKelvin, (double)jouleperdegreecelsiusQuantity.Value, JoulesPerDegreeCelsiusTolerance); - Assert.Equal(EntropyUnit.JoulePerDegreeCelsius, jouleperdegreecelsiusQuantity.Unit); - - var jouleperkelvinQuantity = jouleperkelvin.ToUnit(EntropyUnit.JoulePerKelvin); - AssertEx.EqualTolerance(JoulesPerKelvinInOneJoulePerKelvin, (double)jouleperkelvinQuantity.Value, JoulesPerKelvinTolerance); - Assert.Equal(EntropyUnit.JoulePerKelvin, jouleperkelvinQuantity.Unit); - - var kilocalorieperkelvinQuantity = jouleperkelvin.ToUnit(EntropyUnit.KilocaloriePerKelvin); - AssertEx.EqualTolerance(KilocaloriesPerKelvinInOneJoulePerKelvin, (double)kilocalorieperkelvinQuantity.Value, KilocaloriesPerKelvinTolerance); - Assert.Equal(EntropyUnit.KilocaloriePerKelvin, kilocalorieperkelvinQuantity.Unit); - - var kilojouleperdegreecelsiusQuantity = jouleperkelvin.ToUnit(EntropyUnit.KilojoulePerDegreeCelsius); - AssertEx.EqualTolerance(KilojoulesPerDegreeCelsiusInOneJoulePerKelvin, (double)kilojouleperdegreecelsiusQuantity.Value, KilojoulesPerDegreeCelsiusTolerance); - Assert.Equal(EntropyUnit.KilojoulePerDegreeCelsius, kilojouleperdegreecelsiusQuantity.Unit); - - var kilojouleperkelvinQuantity = jouleperkelvin.ToUnit(EntropyUnit.KilojoulePerKelvin); - AssertEx.EqualTolerance(KilojoulesPerKelvinInOneJoulePerKelvin, (double)kilojouleperkelvinQuantity.Value, KilojoulesPerKelvinTolerance); - Assert.Equal(EntropyUnit.KilojoulePerKelvin, kilojouleperkelvinQuantity.Unit); - - var megajouleperkelvinQuantity = jouleperkelvin.ToUnit(EntropyUnit.MegajoulePerKelvin); - AssertEx.EqualTolerance(MegajoulesPerKelvinInOneJoulePerKelvin, (double)megajouleperkelvinQuantity.Value, MegajoulesPerKelvinTolerance); - Assert.Equal(EntropyUnit.MegajoulePerKelvin, megajouleperkelvinQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - AssertEx.EqualTolerance(1, Entropy.FromCaloriesPerKelvin(jouleperkelvin.CaloriesPerKelvin).JoulesPerKelvin, CaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromJoulesPerDegreeCelsius(jouleperkelvin.JoulesPerDegreeCelsius).JoulesPerKelvin, JoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.FromJoulesPerKelvin(jouleperkelvin.JoulesPerKelvin).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromKilocaloriesPerKelvin(jouleperkelvin.KilocaloriesPerKelvin).JoulesPerKelvin, KilocaloriesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromKilojoulesPerDegreeCelsius(jouleperkelvin.KilojoulesPerDegreeCelsius).JoulesPerKelvin, KilojoulesPerDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, Entropy.FromKilojoulesPerKelvin(jouleperkelvin.KilojoulesPerKelvin).JoulesPerKelvin, KilojoulesPerKelvinTolerance); - AssertEx.EqualTolerance(1, Entropy.FromMegajoulesPerKelvin(jouleperkelvin.MegajoulesPerKelvin).JoulesPerKelvin, MegajoulesPerKelvinTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Entropy v = Entropy.FromJoulesPerKelvin(1); - AssertEx.EqualTolerance(-1, -v.JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(2, (Entropy.FromJoulesPerKelvin(3)-v).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(2, (v + v).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(10, (v*10).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(10, (10*v).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(2, (Entropy.FromJoulesPerKelvin(10)/5).JoulesPerKelvin, JoulesPerKelvinTolerance); - AssertEx.EqualTolerance(2, Entropy.FromJoulesPerKelvin(10)/Entropy.FromJoulesPerKelvin(5), JoulesPerKelvinTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Entropy oneJoulePerKelvin = Entropy.FromJoulesPerKelvin(1); - Entropy twoJoulesPerKelvin = Entropy.FromJoulesPerKelvin(2); - - Assert.True(oneJoulePerKelvin < twoJoulesPerKelvin); - Assert.True(oneJoulePerKelvin <= twoJoulesPerKelvin); - Assert.True(twoJoulesPerKelvin > oneJoulePerKelvin); - Assert.True(twoJoulesPerKelvin >= oneJoulePerKelvin); - - Assert.False(oneJoulePerKelvin > twoJoulesPerKelvin); - Assert.False(oneJoulePerKelvin >= twoJoulesPerKelvin); - Assert.False(twoJoulesPerKelvin < oneJoulePerKelvin); - Assert.False(twoJoulesPerKelvin <= oneJoulePerKelvin); - } - - [Fact] - public void CompareToIsImplemented() - { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - Assert.Equal(0, jouleperkelvin.CompareTo(jouleperkelvin)); - Assert.True(jouleperkelvin.CompareTo(Entropy.Zero) > 0); - Assert.True(Entropy.Zero.CompareTo(jouleperkelvin) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - Assert.Throws(() => jouleperkelvin.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - Assert.Throws(() => jouleperkelvin.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Entropy v = Entropy.FromJoulesPerKelvin(1); - Assert.True(v.Equals(Entropy.FromJoulesPerKelvin(1), JoulesPerKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Entropy.Zero, JoulesPerKelvinTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - Assert.False(jouleperkelvin.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Entropy jouleperkelvin = Entropy.FromJoulesPerKelvin(1); - Assert.False(jouleperkelvin.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(EntropyUnit.Undefined, Entropy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(EntropyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == EntropyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs deleted file mode 100644 index 3aa6fd1817..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ForceChangeRateTestsBase.g.cs +++ /dev/null @@ -1,324 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ForceChangeRate. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ForceChangeRateTestsBase - { - protected abstract double CentinewtonsPerSecondInOneNewtonPerSecond { get; } - protected abstract double DecanewtonsPerMinuteInOneNewtonPerSecond { get; } - protected abstract double DecanewtonsPerSecondInOneNewtonPerSecond { get; } - protected abstract double DecinewtonsPerSecondInOneNewtonPerSecond { get; } - protected abstract double KilonewtonsPerMinuteInOneNewtonPerSecond { get; } - protected abstract double KilonewtonsPerSecondInOneNewtonPerSecond { get; } - protected abstract double MicronewtonsPerSecondInOneNewtonPerSecond { get; } - protected abstract double MillinewtonsPerSecondInOneNewtonPerSecond { get; } - protected abstract double NanonewtonsPerSecondInOneNewtonPerSecond { get; } - protected abstract double NewtonsPerMinuteInOneNewtonPerSecond { get; } - protected abstract double NewtonsPerSecondInOneNewtonPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentinewtonsPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecanewtonsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double DecanewtonsPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecinewtonsPerSecondTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicronewtonsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MillinewtonsPerSecondTolerance { get { return 1e-5; } } - protected virtual double NanonewtonsPerSecondTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ForceChangeRate((double)0.0, ForceChangeRateUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ForceChangeRate(double.PositiveInfinity, ForceChangeRateUnit.NewtonPerSecond)); - Assert.Throws(() => new ForceChangeRate(double.NegativeInfinity, ForceChangeRateUnit.NewtonPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ForceChangeRate(double.NaN, ForceChangeRateUnit.NewtonPerSecond)); - } - - [Fact] - public void NewtonPerSecondToForceChangeRateUnits() - { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - AssertEx.EqualTolerance(CentinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.CentinewtonsPerSecond, CentinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(DecanewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.DecanewtonsPerMinute, DecanewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(DecanewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.DecanewtonsPerSecond, DecanewtonsPerSecondTolerance); - AssertEx.EqualTolerance(DecinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.DecinewtonsPerSecond, DecinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(KilonewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.KilonewtonsPerMinute, KilonewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.KilonewtonsPerSecond, KilonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(MicronewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.MicronewtonsPerSecond, MicronewtonsPerSecondTolerance); - AssertEx.EqualTolerance(MillinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.MillinewtonsPerSecond, MillinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(NanonewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.NanonewtonsPerSecond, NanonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(NewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.NewtonsPerMinute, NewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(NewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.NewtonsPerSecond, NewtonsPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.CentinewtonPerSecond).CentinewtonsPerSecond, CentinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecanewtonPerMinute).DecanewtonsPerMinute, DecanewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecanewtonPerSecond).DecanewtonsPerSecond, DecanewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.DecinewtonPerSecond).DecinewtonsPerSecond, DecinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.KilonewtonPerMinute).KilonewtonsPerMinute, KilonewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.KilonewtonPerSecond).KilonewtonsPerSecond, KilonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.MicronewtonPerSecond).MicronewtonsPerSecond, MicronewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.MillinewtonPerSecond).MillinewtonsPerSecond, MillinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NanonewtonPerSecond).NanonewtonsPerSecond, NanonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerMinute).NewtonsPerMinute, NewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.From(1, ForceChangeRateUnit.NewtonPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); - } - - [Fact] - public void FromNewtonsPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtonsPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ForceChangeRate.FromNewtonsPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - AssertEx.EqualTolerance(CentinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.CentinewtonPerSecond), CentinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(DecanewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.DecanewtonPerMinute), DecanewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(DecanewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.DecanewtonPerSecond), DecanewtonsPerSecondTolerance); - AssertEx.EqualTolerance(DecinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.DecinewtonPerSecond), DecinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(KilonewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.KilonewtonPerMinute), KilonewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.KilonewtonPerSecond), KilonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(MicronewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.MicronewtonPerSecond), MicronewtonsPerSecondTolerance); - AssertEx.EqualTolerance(MillinewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.MillinewtonPerSecond), MillinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(NanonewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.NanonewtonPerSecond), NanonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(NewtonsPerMinuteInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.NewtonPerMinute), NewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(NewtonsPerSecondInOneNewtonPerSecond, newtonpersecond.As(ForceChangeRateUnit.NewtonPerSecond), NewtonsPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - - var centinewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.CentinewtonPerSecond); - AssertEx.EqualTolerance(CentinewtonsPerSecondInOneNewtonPerSecond, (double)centinewtonpersecondQuantity.Value, CentinewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.CentinewtonPerSecond, centinewtonpersecondQuantity.Unit); - - var decanewtonperminuteQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.DecanewtonPerMinute); - AssertEx.EqualTolerance(DecanewtonsPerMinuteInOneNewtonPerSecond, (double)decanewtonperminuteQuantity.Value, DecanewtonsPerMinuteTolerance); - Assert.Equal(ForceChangeRateUnit.DecanewtonPerMinute, decanewtonperminuteQuantity.Unit); - - var decanewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.DecanewtonPerSecond); - AssertEx.EqualTolerance(DecanewtonsPerSecondInOneNewtonPerSecond, (double)decanewtonpersecondQuantity.Value, DecanewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.DecanewtonPerSecond, decanewtonpersecondQuantity.Unit); - - var decinewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.DecinewtonPerSecond); - AssertEx.EqualTolerance(DecinewtonsPerSecondInOneNewtonPerSecond, (double)decinewtonpersecondQuantity.Value, DecinewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.DecinewtonPerSecond, decinewtonpersecondQuantity.Unit); - - var kilonewtonperminuteQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.KilonewtonPerMinute); - AssertEx.EqualTolerance(KilonewtonsPerMinuteInOneNewtonPerSecond, (double)kilonewtonperminuteQuantity.Value, KilonewtonsPerMinuteTolerance); - Assert.Equal(ForceChangeRateUnit.KilonewtonPerMinute, kilonewtonperminuteQuantity.Unit); - - var kilonewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.KilonewtonPerSecond); - AssertEx.EqualTolerance(KilonewtonsPerSecondInOneNewtonPerSecond, (double)kilonewtonpersecondQuantity.Value, KilonewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.KilonewtonPerSecond, kilonewtonpersecondQuantity.Unit); - - var micronewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.MicronewtonPerSecond); - AssertEx.EqualTolerance(MicronewtonsPerSecondInOneNewtonPerSecond, (double)micronewtonpersecondQuantity.Value, MicronewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.MicronewtonPerSecond, micronewtonpersecondQuantity.Unit); - - var millinewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.MillinewtonPerSecond); - AssertEx.EqualTolerance(MillinewtonsPerSecondInOneNewtonPerSecond, (double)millinewtonpersecondQuantity.Value, MillinewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.MillinewtonPerSecond, millinewtonpersecondQuantity.Unit); - - var nanonewtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.NanonewtonPerSecond); - AssertEx.EqualTolerance(NanonewtonsPerSecondInOneNewtonPerSecond, (double)nanonewtonpersecondQuantity.Value, NanonewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.NanonewtonPerSecond, nanonewtonpersecondQuantity.Unit); - - var newtonperminuteQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.NewtonPerMinute); - AssertEx.EqualTolerance(NewtonsPerMinuteInOneNewtonPerSecond, (double)newtonperminuteQuantity.Value, NewtonsPerMinuteTolerance); - Assert.Equal(ForceChangeRateUnit.NewtonPerMinute, newtonperminuteQuantity.Unit); - - var newtonpersecondQuantity = newtonpersecond.ToUnit(ForceChangeRateUnit.NewtonPerSecond); - AssertEx.EqualTolerance(NewtonsPerSecondInOneNewtonPerSecond, (double)newtonpersecondQuantity.Value, NewtonsPerSecondTolerance); - Assert.Equal(ForceChangeRateUnit.NewtonPerSecond, newtonpersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - AssertEx.EqualTolerance(1, ForceChangeRate.FromCentinewtonsPerSecond(newtonpersecond.CentinewtonsPerSecond).NewtonsPerSecond, CentinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromDecanewtonsPerMinute(newtonpersecond.DecanewtonsPerMinute).NewtonsPerSecond, DecanewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromDecanewtonsPerSecond(newtonpersecond.DecanewtonsPerSecond).NewtonsPerSecond, DecanewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromDecinewtonsPerSecond(newtonpersecond.DecinewtonsPerSecond).NewtonsPerSecond, DecinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromKilonewtonsPerMinute(newtonpersecond.KilonewtonsPerMinute).NewtonsPerSecond, KilonewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromKilonewtonsPerSecond(newtonpersecond.KilonewtonsPerSecond).NewtonsPerSecond, KilonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromMicronewtonsPerSecond(newtonpersecond.MicronewtonsPerSecond).NewtonsPerSecond, MicronewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromMillinewtonsPerSecond(newtonpersecond.MillinewtonsPerSecond).NewtonsPerSecond, MillinewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromNanonewtonsPerSecond(newtonpersecond.NanonewtonsPerSecond).NewtonsPerSecond, NanonewtonsPerSecondTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromNewtonsPerMinute(newtonpersecond.NewtonsPerMinute).NewtonsPerSecond, NewtonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, ForceChangeRate.FromNewtonsPerSecond(newtonpersecond.NewtonsPerSecond).NewtonsPerSecond, NewtonsPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ForceChangeRate v = ForceChangeRate.FromNewtonsPerSecond(1); - AssertEx.EqualTolerance(-1, -v.NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(2, (ForceChangeRate.FromNewtonsPerSecond(3)-v).NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(2, (ForceChangeRate.FromNewtonsPerSecond(10)/5).NewtonsPerSecond, NewtonsPerSecondTolerance); - AssertEx.EqualTolerance(2, ForceChangeRate.FromNewtonsPerSecond(10)/ForceChangeRate.FromNewtonsPerSecond(5), NewtonsPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ForceChangeRate oneNewtonPerSecond = ForceChangeRate.FromNewtonsPerSecond(1); - ForceChangeRate twoNewtonsPerSecond = ForceChangeRate.FromNewtonsPerSecond(2); - - Assert.True(oneNewtonPerSecond < twoNewtonsPerSecond); - Assert.True(oneNewtonPerSecond <= twoNewtonsPerSecond); - Assert.True(twoNewtonsPerSecond > oneNewtonPerSecond); - Assert.True(twoNewtonsPerSecond >= oneNewtonPerSecond); - - Assert.False(oneNewtonPerSecond > twoNewtonsPerSecond); - Assert.False(oneNewtonPerSecond >= twoNewtonsPerSecond); - Assert.False(twoNewtonsPerSecond < oneNewtonPerSecond); - Assert.False(twoNewtonsPerSecond <= oneNewtonPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.Equal(0, newtonpersecond.CompareTo(newtonpersecond)); - Assert.True(newtonpersecond.CompareTo(ForceChangeRate.Zero) > 0); - Assert.True(ForceChangeRate.Zero.CompareTo(newtonpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.Throws(() => newtonpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.Throws(() => newtonpersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ForceChangeRate v = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.True(v.Equals(ForceChangeRate.FromNewtonsPerSecond(1), NewtonsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ForceChangeRate.Zero, NewtonsPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.False(newtonpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ForceChangeRate newtonpersecond = ForceChangeRate.FromNewtonsPerSecond(1); - Assert.False(newtonpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ForceChangeRateUnit.Undefined, ForceChangeRate.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ForceChangeRateUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ForceChangeRateUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs deleted file mode 100644 index 3d38fe444d..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ForcePerLengthTestsBase.g.cs +++ /dev/null @@ -1,304 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ForcePerLength. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ForcePerLengthTestsBase - { - protected abstract double CentinewtonsPerMeterInOneNewtonPerMeter { get; } - protected abstract double DecinewtonsPerMeterInOneNewtonPerMeter { get; } - protected abstract double KilogramsForcePerMeterInOneNewtonPerMeter { get; } - protected abstract double KilonewtonsPerMeterInOneNewtonPerMeter { get; } - protected abstract double MeganewtonsPerMeterInOneNewtonPerMeter { get; } - protected abstract double MicronewtonsPerMeterInOneNewtonPerMeter { get; } - protected abstract double MillinewtonsPerMeterInOneNewtonPerMeter { get; } - protected abstract double NanonewtonsPerMeterInOneNewtonPerMeter { get; } - protected abstract double NewtonsPerMeterInOneNewtonPerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentinewtonsPerMeterTolerance { get { return 1e-5; } } - protected virtual double DecinewtonsPerMeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsForcePerMeterTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerMeterTolerance { get { return 1e-5; } } - protected virtual double MeganewtonsPerMeterTolerance { get { return 1e-5; } } - protected virtual double MicronewtonsPerMeterTolerance { get { return 1e-5; } } - protected virtual double MillinewtonsPerMeterTolerance { get { return 1e-5; } } - protected virtual double NanonewtonsPerMeterTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ForcePerLength((double)0.0, ForcePerLengthUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ForcePerLength(double.PositiveInfinity, ForcePerLengthUnit.NewtonPerMeter)); - Assert.Throws(() => new ForcePerLength(double.NegativeInfinity, ForcePerLengthUnit.NewtonPerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ForcePerLength(double.NaN, ForcePerLengthUnit.NewtonPerMeter)); - } - - [Fact] - public void NewtonPerMeterToForcePerLengthUnits() - { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - AssertEx.EqualTolerance(CentinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.CentinewtonsPerMeter, CentinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(DecinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.DecinewtonsPerMeter, DecinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerMeterInOneNewtonPerMeter, newtonpermeter.KilogramsForcePerMeter, KilogramsForcePerMeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.KilonewtonsPerMeter, KilonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(MeganewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.MeganewtonsPerMeter, MeganewtonsPerMeterTolerance); - AssertEx.EqualTolerance(MicronewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.MicronewtonsPerMeter, MicronewtonsPerMeterTolerance); - AssertEx.EqualTolerance(MillinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.MillinewtonsPerMeter, MillinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(NanonewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.NanonewtonsPerMeter, NanonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.NewtonsPerMeter, NewtonsPerMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.CentinewtonPerMeter).CentinewtonsPerMeter, CentinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.DecinewtonPerMeter).DecinewtonsPerMeter, DecinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.KilogramForcePerMeter).KilogramsForcePerMeter, KilogramsForcePerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.KilonewtonPerMeter).KilonewtonsPerMeter, KilonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MeganewtonPerMeter).MeganewtonsPerMeter, MeganewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MicronewtonPerMeter).MicronewtonsPerMeter, MicronewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.MillinewtonPerMeter).MillinewtonsPerMeter, MillinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NanonewtonPerMeter).NanonewtonsPerMeter, NanonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.From(1, ForcePerLengthUnit.NewtonPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); - } - - [Fact] - public void FromNewtonsPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtonsPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ForcePerLength.FromNewtonsPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - AssertEx.EqualTolerance(CentinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.CentinewtonPerMeter), CentinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(DecinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.DecinewtonPerMeter), DecinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.KilogramForcePerMeter), KilogramsForcePerMeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.KilonewtonPerMeter), KilonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(MeganewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.MeganewtonPerMeter), MeganewtonsPerMeterTolerance); - AssertEx.EqualTolerance(MicronewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.MicronewtonPerMeter), MicronewtonsPerMeterTolerance); - AssertEx.EqualTolerance(MillinewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.MillinewtonPerMeter), MillinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(NanonewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.NanonewtonPerMeter), NanonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerMeterInOneNewtonPerMeter, newtonpermeter.As(ForcePerLengthUnit.NewtonPerMeter), NewtonsPerMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - - var centinewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.CentinewtonPerMeter); - AssertEx.EqualTolerance(CentinewtonsPerMeterInOneNewtonPerMeter, (double)centinewtonpermeterQuantity.Value, CentinewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.CentinewtonPerMeter, centinewtonpermeterQuantity.Unit); - - var decinewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.DecinewtonPerMeter); - AssertEx.EqualTolerance(DecinewtonsPerMeterInOneNewtonPerMeter, (double)decinewtonpermeterQuantity.Value, DecinewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.DecinewtonPerMeter, decinewtonpermeterQuantity.Unit); - - var kilogramforcepermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.KilogramForcePerMeter); - AssertEx.EqualTolerance(KilogramsForcePerMeterInOneNewtonPerMeter, (double)kilogramforcepermeterQuantity.Value, KilogramsForcePerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.KilogramForcePerMeter, kilogramforcepermeterQuantity.Unit); - - var kilonewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.KilonewtonPerMeter); - AssertEx.EqualTolerance(KilonewtonsPerMeterInOneNewtonPerMeter, (double)kilonewtonpermeterQuantity.Value, KilonewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.KilonewtonPerMeter, kilonewtonpermeterQuantity.Unit); - - var meganewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.MeganewtonPerMeter); - AssertEx.EqualTolerance(MeganewtonsPerMeterInOneNewtonPerMeter, (double)meganewtonpermeterQuantity.Value, MeganewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.MeganewtonPerMeter, meganewtonpermeterQuantity.Unit); - - var micronewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.MicronewtonPerMeter); - AssertEx.EqualTolerance(MicronewtonsPerMeterInOneNewtonPerMeter, (double)micronewtonpermeterQuantity.Value, MicronewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.MicronewtonPerMeter, micronewtonpermeterQuantity.Unit); - - var millinewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.MillinewtonPerMeter); - AssertEx.EqualTolerance(MillinewtonsPerMeterInOneNewtonPerMeter, (double)millinewtonpermeterQuantity.Value, MillinewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.MillinewtonPerMeter, millinewtonpermeterQuantity.Unit); - - var nanonewtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.NanonewtonPerMeter); - AssertEx.EqualTolerance(NanonewtonsPerMeterInOneNewtonPerMeter, (double)nanonewtonpermeterQuantity.Value, NanonewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.NanonewtonPerMeter, nanonewtonpermeterQuantity.Unit); - - var newtonpermeterQuantity = newtonpermeter.ToUnit(ForcePerLengthUnit.NewtonPerMeter); - AssertEx.EqualTolerance(NewtonsPerMeterInOneNewtonPerMeter, (double)newtonpermeterQuantity.Value, NewtonsPerMeterTolerance); - Assert.Equal(ForcePerLengthUnit.NewtonPerMeter, newtonpermeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - AssertEx.EqualTolerance(1, ForcePerLength.FromCentinewtonsPerMeter(newtonpermeter.CentinewtonsPerMeter).NewtonsPerMeter, CentinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromDecinewtonsPerMeter(newtonpermeter.DecinewtonsPerMeter).NewtonsPerMeter, DecinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromKilogramsForcePerMeter(newtonpermeter.KilogramsForcePerMeter).NewtonsPerMeter, KilogramsForcePerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromKilonewtonsPerMeter(newtonpermeter.KilonewtonsPerMeter).NewtonsPerMeter, KilonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromMeganewtonsPerMeter(newtonpermeter.MeganewtonsPerMeter).NewtonsPerMeter, MeganewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromMicronewtonsPerMeter(newtonpermeter.MicronewtonsPerMeter).NewtonsPerMeter, MicronewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromMillinewtonsPerMeter(newtonpermeter.MillinewtonsPerMeter).NewtonsPerMeter, MillinewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromNanonewtonsPerMeter(newtonpermeter.NanonewtonsPerMeter).NewtonsPerMeter, NanonewtonsPerMeterTolerance); - AssertEx.EqualTolerance(1, ForcePerLength.FromNewtonsPerMeter(newtonpermeter.NewtonsPerMeter).NewtonsPerMeter, NewtonsPerMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ForcePerLength v = ForcePerLength.FromNewtonsPerMeter(1); - AssertEx.EqualTolerance(-1, -v.NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ForcePerLength.FromNewtonsPerMeter(3)-v).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(2, (ForcePerLength.FromNewtonsPerMeter(10)/5).NewtonsPerMeter, NewtonsPerMeterTolerance); - AssertEx.EqualTolerance(2, ForcePerLength.FromNewtonsPerMeter(10)/ForcePerLength.FromNewtonsPerMeter(5), NewtonsPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ForcePerLength oneNewtonPerMeter = ForcePerLength.FromNewtonsPerMeter(1); - ForcePerLength twoNewtonsPerMeter = ForcePerLength.FromNewtonsPerMeter(2); - - Assert.True(oneNewtonPerMeter < twoNewtonsPerMeter); - Assert.True(oneNewtonPerMeter <= twoNewtonsPerMeter); - Assert.True(twoNewtonsPerMeter > oneNewtonPerMeter); - Assert.True(twoNewtonsPerMeter >= oneNewtonPerMeter); - - Assert.False(oneNewtonPerMeter > twoNewtonsPerMeter); - Assert.False(oneNewtonPerMeter >= twoNewtonsPerMeter); - Assert.False(twoNewtonsPerMeter < oneNewtonPerMeter); - Assert.False(twoNewtonsPerMeter <= oneNewtonPerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - Assert.Equal(0, newtonpermeter.CompareTo(newtonpermeter)); - Assert.True(newtonpermeter.CompareTo(ForcePerLength.Zero) > 0); - Assert.True(ForcePerLength.Zero.CompareTo(newtonpermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - Assert.Throws(() => newtonpermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - Assert.Throws(() => newtonpermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ForcePerLength v = ForcePerLength.FromNewtonsPerMeter(1); - Assert.True(v.Equals(ForcePerLength.FromNewtonsPerMeter(1), NewtonsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ForcePerLength.Zero, NewtonsPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - Assert.False(newtonpermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ForcePerLength newtonpermeter = ForcePerLength.FromNewtonsPerMeter(1); - Assert.False(newtonpermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ForcePerLengthUnit.Undefined, ForcePerLength.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ForcePerLengthUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ForcePerLengthUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs deleted file mode 100644 index 1e1e29d3a6..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ForceTestsBase.g.cs +++ /dev/null @@ -1,314 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Force. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ForceTestsBase - { - protected abstract double DecanewtonsInOneNewton { get; } - protected abstract double DyneInOneNewton { get; } - protected abstract double KilogramsForceInOneNewton { get; } - protected abstract double KilonewtonsInOneNewton { get; } - protected abstract double KiloPondsInOneNewton { get; } - protected abstract double MeganewtonsInOneNewton { get; } - protected abstract double NewtonsInOneNewton { get; } - protected abstract double PoundalsInOneNewton { get; } - protected abstract double PoundsForceInOneNewton { get; } - protected abstract double TonnesForceInOneNewton { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DecanewtonsTolerance { get { return 1e-5; } } - protected virtual double DyneTolerance { get { return 1e-5; } } - protected virtual double KilogramsForceTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsTolerance { get { return 1e-5; } } - protected virtual double KiloPondsTolerance { get { return 1e-5; } } - protected virtual double MeganewtonsTolerance { get { return 1e-5; } } - protected virtual double NewtonsTolerance { get { return 1e-5; } } - protected virtual double PoundalsTolerance { get { return 1e-5; } } - protected virtual double PoundsForceTolerance { get { return 1e-5; } } - protected virtual double TonnesForceTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Force((double)0.0, ForceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Force(double.PositiveInfinity, ForceUnit.Newton)); - Assert.Throws(() => new Force(double.NegativeInfinity, ForceUnit.Newton)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Force(double.NaN, ForceUnit.Newton)); - } - - [Fact] - public void NewtonToForceUnits() - { - Force newton = Force.FromNewtons(1); - AssertEx.EqualTolerance(DecanewtonsInOneNewton, newton.Decanewtons, DecanewtonsTolerance); - AssertEx.EqualTolerance(DyneInOneNewton, newton.Dyne, DyneTolerance); - AssertEx.EqualTolerance(KilogramsForceInOneNewton, newton.KilogramsForce, KilogramsForceTolerance); - AssertEx.EqualTolerance(KilonewtonsInOneNewton, newton.Kilonewtons, KilonewtonsTolerance); - AssertEx.EqualTolerance(KiloPondsInOneNewton, newton.KiloPonds, KiloPondsTolerance); - AssertEx.EqualTolerance(MeganewtonsInOneNewton, newton.Meganewtons, MeganewtonsTolerance); - AssertEx.EqualTolerance(NewtonsInOneNewton, newton.Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(PoundalsInOneNewton, newton.Poundals, PoundalsTolerance); - AssertEx.EqualTolerance(PoundsForceInOneNewton, newton.PoundsForce, PoundsForceTolerance); - AssertEx.EqualTolerance(TonnesForceInOneNewton, newton.TonnesForce, TonnesForceTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Decanewton).Decanewtons, DecanewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Dyn).Dyne, DyneTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.KilogramForce).KilogramsForce, KilogramsForceTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Kilonewton).Kilonewtons, KilonewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.KiloPond).KiloPonds, KiloPondsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Meganewton).Meganewtons, MeganewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Newton).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.Poundal).Poundals, PoundalsTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.PoundForce).PoundsForce, PoundsForceTolerance); - AssertEx.EqualTolerance(1, Force.From(1, ForceUnit.TonneForce).TonnesForce, TonnesForceTolerance); - } - - [Fact] - public void FromNewtons_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Force.FromNewtons(double.PositiveInfinity)); - Assert.Throws(() => Force.FromNewtons(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtons_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Force.FromNewtons(double.NaN)); - } - - [Fact] - public void As() - { - var newton = Force.FromNewtons(1); - AssertEx.EqualTolerance(DecanewtonsInOneNewton, newton.As(ForceUnit.Decanewton), DecanewtonsTolerance); - AssertEx.EqualTolerance(DyneInOneNewton, newton.As(ForceUnit.Dyn), DyneTolerance); - AssertEx.EqualTolerance(KilogramsForceInOneNewton, newton.As(ForceUnit.KilogramForce), KilogramsForceTolerance); - AssertEx.EqualTolerance(KilonewtonsInOneNewton, newton.As(ForceUnit.Kilonewton), KilonewtonsTolerance); - AssertEx.EqualTolerance(KiloPondsInOneNewton, newton.As(ForceUnit.KiloPond), KiloPondsTolerance); - AssertEx.EqualTolerance(MeganewtonsInOneNewton, newton.As(ForceUnit.Meganewton), MeganewtonsTolerance); - AssertEx.EqualTolerance(NewtonsInOneNewton, newton.As(ForceUnit.Newton), NewtonsTolerance); - AssertEx.EqualTolerance(PoundalsInOneNewton, newton.As(ForceUnit.Poundal), PoundalsTolerance); - AssertEx.EqualTolerance(PoundsForceInOneNewton, newton.As(ForceUnit.PoundForce), PoundsForceTolerance); - AssertEx.EqualTolerance(TonnesForceInOneNewton, newton.As(ForceUnit.TonneForce), TonnesForceTolerance); - } - - [Fact] - public void ToUnit() - { - var newton = Force.FromNewtons(1); - - var decanewtonQuantity = newton.ToUnit(ForceUnit.Decanewton); - AssertEx.EqualTolerance(DecanewtonsInOneNewton, (double)decanewtonQuantity.Value, DecanewtonsTolerance); - Assert.Equal(ForceUnit.Decanewton, decanewtonQuantity.Unit); - - var dynQuantity = newton.ToUnit(ForceUnit.Dyn); - AssertEx.EqualTolerance(DyneInOneNewton, (double)dynQuantity.Value, DyneTolerance); - Assert.Equal(ForceUnit.Dyn, dynQuantity.Unit); - - var kilogramforceQuantity = newton.ToUnit(ForceUnit.KilogramForce); - AssertEx.EqualTolerance(KilogramsForceInOneNewton, (double)kilogramforceQuantity.Value, KilogramsForceTolerance); - Assert.Equal(ForceUnit.KilogramForce, kilogramforceQuantity.Unit); - - var kilonewtonQuantity = newton.ToUnit(ForceUnit.Kilonewton); - AssertEx.EqualTolerance(KilonewtonsInOneNewton, (double)kilonewtonQuantity.Value, KilonewtonsTolerance); - Assert.Equal(ForceUnit.Kilonewton, kilonewtonQuantity.Unit); - - var kilopondQuantity = newton.ToUnit(ForceUnit.KiloPond); - AssertEx.EqualTolerance(KiloPondsInOneNewton, (double)kilopondQuantity.Value, KiloPondsTolerance); - Assert.Equal(ForceUnit.KiloPond, kilopondQuantity.Unit); - - var meganewtonQuantity = newton.ToUnit(ForceUnit.Meganewton); - AssertEx.EqualTolerance(MeganewtonsInOneNewton, (double)meganewtonQuantity.Value, MeganewtonsTolerance); - Assert.Equal(ForceUnit.Meganewton, meganewtonQuantity.Unit); - - var newtonQuantity = newton.ToUnit(ForceUnit.Newton); - AssertEx.EqualTolerance(NewtonsInOneNewton, (double)newtonQuantity.Value, NewtonsTolerance); - Assert.Equal(ForceUnit.Newton, newtonQuantity.Unit); - - var poundalQuantity = newton.ToUnit(ForceUnit.Poundal); - AssertEx.EqualTolerance(PoundalsInOneNewton, (double)poundalQuantity.Value, PoundalsTolerance); - Assert.Equal(ForceUnit.Poundal, poundalQuantity.Unit); - - var poundforceQuantity = newton.ToUnit(ForceUnit.PoundForce); - AssertEx.EqualTolerance(PoundsForceInOneNewton, (double)poundforceQuantity.Value, PoundsForceTolerance); - Assert.Equal(ForceUnit.PoundForce, poundforceQuantity.Unit); - - var tonneforceQuantity = newton.ToUnit(ForceUnit.TonneForce); - AssertEx.EqualTolerance(TonnesForceInOneNewton, (double)tonneforceQuantity.Value, TonnesForceTolerance); - Assert.Equal(ForceUnit.TonneForce, tonneforceQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Force newton = Force.FromNewtons(1); - AssertEx.EqualTolerance(1, Force.FromDecanewtons(newton.Decanewtons).Newtons, DecanewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromDyne(newton.Dyne).Newtons, DyneTolerance); - AssertEx.EqualTolerance(1, Force.FromKilogramsForce(newton.KilogramsForce).Newtons, KilogramsForceTolerance); - AssertEx.EqualTolerance(1, Force.FromKilonewtons(newton.Kilonewtons).Newtons, KilonewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromKiloPonds(newton.KiloPonds).Newtons, KiloPondsTolerance); - AssertEx.EqualTolerance(1, Force.FromMeganewtons(newton.Meganewtons).Newtons, MeganewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromNewtons(newton.Newtons).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(1, Force.FromPoundals(newton.Poundals).Newtons, PoundalsTolerance); - AssertEx.EqualTolerance(1, Force.FromPoundsForce(newton.PoundsForce).Newtons, PoundsForceTolerance); - AssertEx.EqualTolerance(1, Force.FromTonnesForce(newton.TonnesForce).Newtons, TonnesForceTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Force v = Force.FromNewtons(1); - AssertEx.EqualTolerance(-1, -v.Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(2, (Force.FromNewtons(3)-v).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(2, (v + v).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(10, (v*10).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(10, (10*v).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(2, (Force.FromNewtons(10)/5).Newtons, NewtonsTolerance); - AssertEx.EqualTolerance(2, Force.FromNewtons(10)/Force.FromNewtons(5), NewtonsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Force oneNewton = Force.FromNewtons(1); - Force twoNewtons = Force.FromNewtons(2); - - Assert.True(oneNewton < twoNewtons); - Assert.True(oneNewton <= twoNewtons); - Assert.True(twoNewtons > oneNewton); - Assert.True(twoNewtons >= oneNewton); - - Assert.False(oneNewton > twoNewtons); - Assert.False(oneNewton >= twoNewtons); - Assert.False(twoNewtons < oneNewton); - Assert.False(twoNewtons <= oneNewton); - } - - [Fact] - public void CompareToIsImplemented() - { - Force newton = Force.FromNewtons(1); - Assert.Equal(0, newton.CompareTo(newton)); - Assert.True(newton.CompareTo(Force.Zero) > 0); - Assert.True(Force.Zero.CompareTo(newton) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Force newton = Force.FromNewtons(1); - Assert.Throws(() => newton.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Force newton = Force.FromNewtons(1); - Assert.Throws(() => newton.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Force v = Force.FromNewtons(1); - Assert.True(v.Equals(Force.FromNewtons(1), NewtonsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Force.Zero, NewtonsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Force newton = Force.FromNewtons(1); - Assert.False(newton.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Force newton = Force.FromNewtons(1); - Assert.False(newton.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ForceUnit.Undefined, Force.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ForceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ForceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs deleted file mode 100644 index ab9735e592..0000000000 --- a/UnitsNet.Tests/GeneratedCode/FrequencyTestsBase.g.cs +++ /dev/null @@ -1,294 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Frequency. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class FrequencyTestsBase - { - protected abstract double CyclesPerHourInOneHertz { get; } - protected abstract double CyclesPerMinuteInOneHertz { get; } - protected abstract double GigahertzInOneHertz { get; } - protected abstract double HertzInOneHertz { get; } - protected abstract double KilohertzInOneHertz { get; } - protected abstract double MegahertzInOneHertz { get; } - protected abstract double RadiansPerSecondInOneHertz { get; } - protected abstract double TerahertzInOneHertz { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CyclesPerHourTolerance { get { return 1e-5; } } - protected virtual double CyclesPerMinuteTolerance { get { return 1e-5; } } - protected virtual double GigahertzTolerance { get { return 1e-5; } } - protected virtual double HertzTolerance { get { return 1e-5; } } - protected virtual double KilohertzTolerance { get { return 1e-5; } } - protected virtual double MegahertzTolerance { get { return 1e-5; } } - protected virtual double RadiansPerSecondTolerance { get { return 1e-5; } } - protected virtual double TerahertzTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Frequency((double)0.0, FrequencyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Frequency(double.PositiveInfinity, FrequencyUnit.Hertz)); - Assert.Throws(() => new Frequency(double.NegativeInfinity, FrequencyUnit.Hertz)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Frequency(double.NaN, FrequencyUnit.Hertz)); - } - - [Fact] - public void HertzToFrequencyUnits() - { - Frequency hertz = Frequency.FromHertz(1); - AssertEx.EqualTolerance(CyclesPerHourInOneHertz, hertz.CyclesPerHour, CyclesPerHourTolerance); - AssertEx.EqualTolerance(CyclesPerMinuteInOneHertz, hertz.CyclesPerMinute, CyclesPerMinuteTolerance); - AssertEx.EqualTolerance(GigahertzInOneHertz, hertz.Gigahertz, GigahertzTolerance); - AssertEx.EqualTolerance(HertzInOneHertz, hertz.Hertz, HertzTolerance); - AssertEx.EqualTolerance(KilohertzInOneHertz, hertz.Kilohertz, KilohertzTolerance); - AssertEx.EqualTolerance(MegahertzInOneHertz, hertz.Megahertz, MegahertzTolerance); - AssertEx.EqualTolerance(RadiansPerSecondInOneHertz, hertz.RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(TerahertzInOneHertz, hertz.Terahertz, TerahertzTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.CyclePerHour).CyclesPerHour, CyclesPerHourTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.CyclePerMinute).CyclesPerMinute, CyclesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Gigahertz).Gigahertz, GigahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Hertz).Hertz, HertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Kilohertz).Kilohertz, KilohertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Megahertz).Megahertz, MegahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.RadianPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, Frequency.From(1, FrequencyUnit.Terahertz).Terahertz, TerahertzTolerance); - } - - [Fact] - public void FromHertz_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Frequency.FromHertz(double.PositiveInfinity)); - Assert.Throws(() => Frequency.FromHertz(double.NegativeInfinity)); - } - - [Fact] - public void FromHertz_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Frequency.FromHertz(double.NaN)); - } - - [Fact] - public void As() - { - var hertz = Frequency.FromHertz(1); - AssertEx.EqualTolerance(CyclesPerHourInOneHertz, hertz.As(FrequencyUnit.CyclePerHour), CyclesPerHourTolerance); - AssertEx.EqualTolerance(CyclesPerMinuteInOneHertz, hertz.As(FrequencyUnit.CyclePerMinute), CyclesPerMinuteTolerance); - AssertEx.EqualTolerance(GigahertzInOneHertz, hertz.As(FrequencyUnit.Gigahertz), GigahertzTolerance); - AssertEx.EqualTolerance(HertzInOneHertz, hertz.As(FrequencyUnit.Hertz), HertzTolerance); - AssertEx.EqualTolerance(KilohertzInOneHertz, hertz.As(FrequencyUnit.Kilohertz), KilohertzTolerance); - AssertEx.EqualTolerance(MegahertzInOneHertz, hertz.As(FrequencyUnit.Megahertz), MegahertzTolerance); - AssertEx.EqualTolerance(RadiansPerSecondInOneHertz, hertz.As(FrequencyUnit.RadianPerSecond), RadiansPerSecondTolerance); - AssertEx.EqualTolerance(TerahertzInOneHertz, hertz.As(FrequencyUnit.Terahertz), TerahertzTolerance); - } - - [Fact] - public void ToUnit() - { - var hertz = Frequency.FromHertz(1); - - var cycleperhourQuantity = hertz.ToUnit(FrequencyUnit.CyclePerHour); - AssertEx.EqualTolerance(CyclesPerHourInOneHertz, (double)cycleperhourQuantity.Value, CyclesPerHourTolerance); - Assert.Equal(FrequencyUnit.CyclePerHour, cycleperhourQuantity.Unit); - - var cycleperminuteQuantity = hertz.ToUnit(FrequencyUnit.CyclePerMinute); - AssertEx.EqualTolerance(CyclesPerMinuteInOneHertz, (double)cycleperminuteQuantity.Value, CyclesPerMinuteTolerance); - Assert.Equal(FrequencyUnit.CyclePerMinute, cycleperminuteQuantity.Unit); - - var gigahertzQuantity = hertz.ToUnit(FrequencyUnit.Gigahertz); - AssertEx.EqualTolerance(GigahertzInOneHertz, (double)gigahertzQuantity.Value, GigahertzTolerance); - Assert.Equal(FrequencyUnit.Gigahertz, gigahertzQuantity.Unit); - - var hertzQuantity = hertz.ToUnit(FrequencyUnit.Hertz); - AssertEx.EqualTolerance(HertzInOneHertz, (double)hertzQuantity.Value, HertzTolerance); - Assert.Equal(FrequencyUnit.Hertz, hertzQuantity.Unit); - - var kilohertzQuantity = hertz.ToUnit(FrequencyUnit.Kilohertz); - AssertEx.EqualTolerance(KilohertzInOneHertz, (double)kilohertzQuantity.Value, KilohertzTolerance); - Assert.Equal(FrequencyUnit.Kilohertz, kilohertzQuantity.Unit); - - var megahertzQuantity = hertz.ToUnit(FrequencyUnit.Megahertz); - AssertEx.EqualTolerance(MegahertzInOneHertz, (double)megahertzQuantity.Value, MegahertzTolerance); - Assert.Equal(FrequencyUnit.Megahertz, megahertzQuantity.Unit); - - var radianpersecondQuantity = hertz.ToUnit(FrequencyUnit.RadianPerSecond); - AssertEx.EqualTolerance(RadiansPerSecondInOneHertz, (double)radianpersecondQuantity.Value, RadiansPerSecondTolerance); - Assert.Equal(FrequencyUnit.RadianPerSecond, radianpersecondQuantity.Unit); - - var terahertzQuantity = hertz.ToUnit(FrequencyUnit.Terahertz); - AssertEx.EqualTolerance(TerahertzInOneHertz, (double)terahertzQuantity.Value, TerahertzTolerance); - Assert.Equal(FrequencyUnit.Terahertz, terahertzQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Frequency hertz = Frequency.FromHertz(1); - AssertEx.EqualTolerance(1, Frequency.FromCyclesPerHour(hertz.CyclesPerHour).Hertz, CyclesPerHourTolerance); - AssertEx.EqualTolerance(1, Frequency.FromCyclesPerMinute(hertz.CyclesPerMinute).Hertz, CyclesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Frequency.FromGigahertz(hertz.Gigahertz).Hertz, GigahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromHertz(hertz.Hertz).Hertz, HertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromKilohertz(hertz.Kilohertz).Hertz, KilohertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromMegahertz(hertz.Megahertz).Hertz, MegahertzTolerance); - AssertEx.EqualTolerance(1, Frequency.FromRadiansPerSecond(hertz.RadiansPerSecond).Hertz, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, Frequency.FromTerahertz(hertz.Terahertz).Hertz, TerahertzTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Frequency v = Frequency.FromHertz(1); - AssertEx.EqualTolerance(-1, -v.Hertz, HertzTolerance); - AssertEx.EqualTolerance(2, (Frequency.FromHertz(3)-v).Hertz, HertzTolerance); - AssertEx.EqualTolerance(2, (v + v).Hertz, HertzTolerance); - AssertEx.EqualTolerance(10, (v*10).Hertz, HertzTolerance); - AssertEx.EqualTolerance(10, (10*v).Hertz, HertzTolerance); - AssertEx.EqualTolerance(2, (Frequency.FromHertz(10)/5).Hertz, HertzTolerance); - AssertEx.EqualTolerance(2, Frequency.FromHertz(10)/Frequency.FromHertz(5), HertzTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Frequency oneHertz = Frequency.FromHertz(1); - Frequency twoHertz = Frequency.FromHertz(2); - - Assert.True(oneHertz < twoHertz); - Assert.True(oneHertz <= twoHertz); - Assert.True(twoHertz > oneHertz); - Assert.True(twoHertz >= oneHertz); - - Assert.False(oneHertz > twoHertz); - Assert.False(oneHertz >= twoHertz); - Assert.False(twoHertz < oneHertz); - Assert.False(twoHertz <= oneHertz); - } - - [Fact] - public void CompareToIsImplemented() - { - Frequency hertz = Frequency.FromHertz(1); - Assert.Equal(0, hertz.CompareTo(hertz)); - Assert.True(hertz.CompareTo(Frequency.Zero) > 0); - Assert.True(Frequency.Zero.CompareTo(hertz) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Frequency hertz = Frequency.FromHertz(1); - Assert.Throws(() => hertz.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Frequency hertz = Frequency.FromHertz(1); - Assert.Throws(() => hertz.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Frequency v = Frequency.FromHertz(1); - Assert.True(v.Equals(Frequency.FromHertz(1), HertzTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Frequency.Zero, HertzTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Frequency hertz = Frequency.FromHertz(1); - Assert.False(hertz.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Frequency hertz = Frequency.FromHertz(1); - Assert.False(hertz.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(FrequencyUnit.Undefined, Frequency.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(FrequencyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == FrequencyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs deleted file mode 100644 index 08ad882829..0000000000 --- a/UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs +++ /dev/null @@ -1,374 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of HeatFlux. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class HeatFluxTestsBase - { - protected abstract double BtusPerHourSquareFootInOneWattPerSquareMeter { get; } - protected abstract double BtusPerMinuteSquareFootInOneWattPerSquareMeter { get; } - protected abstract double BtusPerSecondSquareFootInOneWattPerSquareMeter { get; } - protected abstract double BtusPerSecondSquareInchInOneWattPerSquareMeter { get; } - protected abstract double CaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter { get; } - protected abstract double CentiwattsPerSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double DeciwattsPerSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double KilocaloriesPerHourSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double KilocaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter { get; } - protected abstract double KilowattsPerSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double MicrowattsPerSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double MilliwattsPerSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double NanowattsPerSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double WattsPerSquareFootInOneWattPerSquareMeter { get; } - protected abstract double WattsPerSquareInchInOneWattPerSquareMeter { get; } - protected abstract double WattsPerSquareMeterInOneWattPerSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double BtusPerHourSquareFootTolerance { get { return 1e-5; } } - protected virtual double BtusPerMinuteSquareFootTolerance { get { return 1e-5; } } - protected virtual double BtusPerSecondSquareFootTolerance { get { return 1e-5; } } - protected virtual double BtusPerSecondSquareInchTolerance { get { return 1e-5; } } - protected virtual double CaloriesPerSecondSquareCentimeterTolerance { get { return 1e-5; } } - protected virtual double CentiwattsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double DeciwattsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double KilocaloriesPerHourSquareMeterTolerance { get { return 1e-5; } } - protected virtual double KilocaloriesPerSecondSquareCentimeterTolerance { get { return 1e-5; } } - protected virtual double KilowattsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double MicrowattsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double MilliwattsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double NanowattsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double WattsPerSquareFootTolerance { get { return 1e-5; } } - protected virtual double WattsPerSquareInchTolerance { get { return 1e-5; } } - protected virtual double WattsPerSquareMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new HeatFlux((double)0.0, HeatFluxUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new HeatFlux(double.PositiveInfinity, HeatFluxUnit.WattPerSquareMeter)); - Assert.Throws(() => new HeatFlux(double.NegativeInfinity, HeatFluxUnit.WattPerSquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new HeatFlux(double.NaN, HeatFluxUnit.WattPerSquareMeter)); - } - - [Fact] - public void WattPerSquareMeterToHeatFluxUnits() - { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(BtusPerHourSquareFootInOneWattPerSquareMeter, wattpersquaremeter.BtusPerHourSquareFoot, BtusPerHourSquareFootTolerance); - AssertEx.EqualTolerance(BtusPerMinuteSquareFootInOneWattPerSquareMeter, wattpersquaremeter.BtusPerMinuteSquareFoot, BtusPerMinuteSquareFootTolerance); - AssertEx.EqualTolerance(BtusPerSecondSquareFootInOneWattPerSquareMeter, wattpersquaremeter.BtusPerSecondSquareFoot, BtusPerSecondSquareFootTolerance); - AssertEx.EqualTolerance(BtusPerSecondSquareInchInOneWattPerSquareMeter, wattpersquaremeter.BtusPerSecondSquareInch, BtusPerSecondSquareInchTolerance); - AssertEx.EqualTolerance(CaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.CaloriesPerSecondSquareCentimeter, CaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(CentiwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.CentiwattsPerSquareMeter, CentiwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(DeciwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.DeciwattsPerSquareMeter, DeciwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilocaloriesPerHourSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.KilocaloriesPerHourSquareMeter, KilocaloriesPerHourSquareMeterTolerance); - AssertEx.EqualTolerance(KilocaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.KilocaloriesPerSecondSquareCentimeter, KilocaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(MicrowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(MilliwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(NanowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(WattsPerSquareFootInOneWattPerSquareMeter, wattpersquaremeter.WattsPerSquareFoot, WattsPerSquareFootTolerance); - AssertEx.EqualTolerance(WattsPerSquareInchInOneWattPerSquareMeter, wattpersquaremeter.WattsPerSquareInch, WattsPerSquareInchTolerance); - AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.WattsPerSquareMeter, WattsPerSquareMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerHourSquareFoot).BtusPerHourSquareFoot, BtusPerHourSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerMinuteSquareFoot).BtusPerMinuteSquareFoot, BtusPerMinuteSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerSecondSquareFoot).BtusPerSecondSquareFoot, BtusPerSecondSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.BtuPerSecondSquareInch).BtusPerSecondSquareInch, BtusPerSecondSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.CaloriePerSecondSquareCentimeter).CaloriesPerSecondSquareCentimeter, CaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.CentiwattPerSquareMeter).CentiwattsPerSquareMeter, CentiwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.DeciwattPerSquareMeter).DeciwattsPerSquareMeter, DeciwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilocaloriePerHourSquareMeter).KilocaloriesPerHourSquareMeter, KilocaloriesPerHourSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter).KilocaloriesPerSecondSquareCentimeter, KilocaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.KilowattPerSquareMeter).KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MicrowattPerSquareMeter).MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MilliwattPerSquareMeter).MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.NanowattPerSquareMeter).NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareFoot).WattsPerSquareFoot, WattsPerSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareInch).WattsPerSquareInch, WattsPerSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - } - - [Fact] - public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => HeatFlux.FromWattsPerSquareMeter(double.NaN)); - } - - [Fact] - public void As() - { - var wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(BtusPerHourSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.BtuPerHourSquareFoot), BtusPerHourSquareFootTolerance); - AssertEx.EqualTolerance(BtusPerMinuteSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.BtuPerMinuteSquareFoot), BtusPerMinuteSquareFootTolerance); - AssertEx.EqualTolerance(BtusPerSecondSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.BtuPerSecondSquareFoot), BtusPerSecondSquareFootTolerance); - AssertEx.EqualTolerance(BtusPerSecondSquareInchInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.BtuPerSecondSquareInch), BtusPerSecondSquareInchTolerance); - AssertEx.EqualTolerance(CaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.CaloriePerSecondSquareCentimeter), CaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(CentiwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.CentiwattPerSquareMeter), CentiwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(DeciwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.DeciwattPerSquareMeter), DeciwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilocaloriesPerHourSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.KilocaloriePerHourSquareMeter), KilocaloriesPerHourSquareMeterTolerance); - AssertEx.EqualTolerance(KilocaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter), KilocaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.KilowattPerSquareMeter), KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(MicrowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.MicrowattPerSquareMeter), MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(MilliwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.MilliwattPerSquareMeter), MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(NanowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.NanowattPerSquareMeter), NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(WattsPerSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.WattPerSquareFoot), WattsPerSquareFootTolerance); - AssertEx.EqualTolerance(WattsPerSquareInchInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.WattPerSquareInch), WattsPerSquareInchTolerance); - AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.WattPerSquareMeter), WattsPerSquareMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - - var btuperhoursquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerHourSquareFoot); - AssertEx.EqualTolerance(BtusPerHourSquareFootInOneWattPerSquareMeter, (double)btuperhoursquarefootQuantity.Value, BtusPerHourSquareFootTolerance); - Assert.Equal(HeatFluxUnit.BtuPerHourSquareFoot, btuperhoursquarefootQuantity.Unit); - - var btuperminutesquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerMinuteSquareFoot); - AssertEx.EqualTolerance(BtusPerMinuteSquareFootInOneWattPerSquareMeter, (double)btuperminutesquarefootQuantity.Value, BtusPerMinuteSquareFootTolerance); - Assert.Equal(HeatFluxUnit.BtuPerMinuteSquareFoot, btuperminutesquarefootQuantity.Unit); - - var btupersecondsquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerSecondSquareFoot); - AssertEx.EqualTolerance(BtusPerSecondSquareFootInOneWattPerSquareMeter, (double)btupersecondsquarefootQuantity.Value, BtusPerSecondSquareFootTolerance); - Assert.Equal(HeatFluxUnit.BtuPerSecondSquareFoot, btupersecondsquarefootQuantity.Unit); - - var btupersecondsquareinchQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.BtuPerSecondSquareInch); - AssertEx.EqualTolerance(BtusPerSecondSquareInchInOneWattPerSquareMeter, (double)btupersecondsquareinchQuantity.Value, BtusPerSecondSquareInchTolerance); - Assert.Equal(HeatFluxUnit.BtuPerSecondSquareInch, btupersecondsquareinchQuantity.Unit); - - var caloriepersecondsquarecentimeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.CaloriePerSecondSquareCentimeter); - AssertEx.EqualTolerance(CaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, (double)caloriepersecondsquarecentimeterQuantity.Value, CaloriesPerSecondSquareCentimeterTolerance); - Assert.Equal(HeatFluxUnit.CaloriePerSecondSquareCentimeter, caloriepersecondsquarecentimeterQuantity.Unit); - - var centiwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.CentiwattPerSquareMeter); - AssertEx.EqualTolerance(CentiwattsPerSquareMeterInOneWattPerSquareMeter, (double)centiwattpersquaremeterQuantity.Value, CentiwattsPerSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.CentiwattPerSquareMeter, centiwattpersquaremeterQuantity.Unit); - - var deciwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.DeciwattPerSquareMeter); - AssertEx.EqualTolerance(DeciwattsPerSquareMeterInOneWattPerSquareMeter, (double)deciwattpersquaremeterQuantity.Value, DeciwattsPerSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.DeciwattPerSquareMeter, deciwattpersquaremeterQuantity.Unit); - - var kilocalorieperhoursquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.KilocaloriePerHourSquareMeter); - AssertEx.EqualTolerance(KilocaloriesPerHourSquareMeterInOneWattPerSquareMeter, (double)kilocalorieperhoursquaremeterQuantity.Value, KilocaloriesPerHourSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.KilocaloriePerHourSquareMeter, kilocalorieperhoursquaremeterQuantity.Unit); - - var kilocaloriepersecondsquarecentimeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); - AssertEx.EqualTolerance(KilocaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter, (double)kilocaloriepersecondsquarecentimeterQuantity.Value, KilocaloriesPerSecondSquareCentimeterTolerance); - Assert.Equal(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, kilocaloriepersecondsquarecentimeterQuantity.Unit); - - var kilowattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.KilowattPerSquareMeter); - AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, (double)kilowattpersquaremeterQuantity.Value, KilowattsPerSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.KilowattPerSquareMeter, kilowattpersquaremeterQuantity.Unit); - - var microwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.MicrowattPerSquareMeter); - AssertEx.EqualTolerance(MicrowattsPerSquareMeterInOneWattPerSquareMeter, (double)microwattpersquaremeterQuantity.Value, MicrowattsPerSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.MicrowattPerSquareMeter, microwattpersquaremeterQuantity.Unit); - - var milliwattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.MilliwattPerSquareMeter); - AssertEx.EqualTolerance(MilliwattsPerSquareMeterInOneWattPerSquareMeter, (double)milliwattpersquaremeterQuantity.Value, MilliwattsPerSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.MilliwattPerSquareMeter, milliwattpersquaremeterQuantity.Unit); - - var nanowattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.NanowattPerSquareMeter); - AssertEx.EqualTolerance(NanowattsPerSquareMeterInOneWattPerSquareMeter, (double)nanowattpersquaremeterQuantity.Value, NanowattsPerSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.NanowattPerSquareMeter, nanowattpersquaremeterQuantity.Unit); - - var wattpersquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.WattPerSquareFoot); - AssertEx.EqualTolerance(WattsPerSquareFootInOneWattPerSquareMeter, (double)wattpersquarefootQuantity.Value, WattsPerSquareFootTolerance); - Assert.Equal(HeatFluxUnit.WattPerSquareFoot, wattpersquarefootQuantity.Unit); - - var wattpersquareinchQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.WattPerSquareInch); - AssertEx.EqualTolerance(WattsPerSquareInchInOneWattPerSquareMeter, (double)wattpersquareinchQuantity.Value, WattsPerSquareInchTolerance); - Assert.Equal(HeatFluxUnit.WattPerSquareInch, wattpersquareinchQuantity.Unit); - - var wattpersquaremeterQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.WattPerSquareMeter); - AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, (double)wattpersquaremeterQuantity.Value, WattsPerSquareMeterTolerance); - Assert.Equal(HeatFluxUnit.WattPerSquareMeter, wattpersquaremeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerHourSquareFoot(wattpersquaremeter.BtusPerHourSquareFoot).WattsPerSquareMeter, BtusPerHourSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerMinuteSquareFoot(wattpersquaremeter.BtusPerMinuteSquareFoot).WattsPerSquareMeter, BtusPerMinuteSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerSecondSquareFoot(wattpersquaremeter.BtusPerSecondSquareFoot).WattsPerSquareMeter, BtusPerSecondSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromBtusPerSecondSquareInch(wattpersquaremeter.BtusPerSecondSquareInch).WattsPerSquareMeter, BtusPerSecondSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromCaloriesPerSecondSquareCentimeter(wattpersquaremeter.CaloriesPerSecondSquareCentimeter).WattsPerSquareMeter, CaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromCentiwattsPerSquareMeter(wattpersquaremeter.CentiwattsPerSquareMeter).WattsPerSquareMeter, CentiwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromDeciwattsPerSquareMeter(wattpersquaremeter.DeciwattsPerSquareMeter).WattsPerSquareMeter, DeciwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromKilocaloriesPerHourSquareMeter(wattpersquaremeter.KilocaloriesPerHourSquareMeter).WattsPerSquareMeter, KilocaloriesPerHourSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromKilocaloriesPerSecondSquareCentimeter(wattpersquaremeter.KilocaloriesPerSecondSquareCentimeter).WattsPerSquareMeter, KilocaloriesPerSecondSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromKilowattsPerSquareMeter(wattpersquaremeter.KilowattsPerSquareMeter).WattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromMicrowattsPerSquareMeter(wattpersquaremeter.MicrowattsPerSquareMeter).WattsPerSquareMeter, MicrowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromMilliwattsPerSquareMeter(wattpersquaremeter.MilliwattsPerSquareMeter).WattsPerSquareMeter, MilliwattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromNanowattsPerSquareMeter(wattpersquaremeter.NanowattsPerSquareMeter).WattsPerSquareMeter, NanowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareFoot(wattpersquaremeter.WattsPerSquareFoot).WattsPerSquareMeter, WattsPerSquareFootTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareInch(wattpersquaremeter.WattsPerSquareInch).WattsPerSquareMeter, WattsPerSquareInchTolerance); - AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareMeter(wattpersquaremeter.WattsPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - HeatFlux v = HeatFlux.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(-1, -v.WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (HeatFlux.FromWattsPerSquareMeter(3)-v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (HeatFlux.FromWattsPerSquareMeter(10)/5).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, HeatFlux.FromWattsPerSquareMeter(10)/HeatFlux.FromWattsPerSquareMeter(5), WattsPerSquareMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - HeatFlux oneWattPerSquareMeter = HeatFlux.FromWattsPerSquareMeter(1); - HeatFlux twoWattsPerSquareMeter = HeatFlux.FromWattsPerSquareMeter(2); - - Assert.True(oneWattPerSquareMeter < twoWattsPerSquareMeter); - Assert.True(oneWattPerSquareMeter <= twoWattsPerSquareMeter); - Assert.True(twoWattsPerSquareMeter > oneWattPerSquareMeter); - Assert.True(twoWattsPerSquareMeter >= oneWattPerSquareMeter); - - Assert.False(oneWattPerSquareMeter > twoWattsPerSquareMeter); - Assert.False(oneWattPerSquareMeter >= twoWattsPerSquareMeter); - Assert.False(twoWattsPerSquareMeter < oneWattPerSquareMeter); - Assert.False(twoWattsPerSquareMeter <= oneWattPerSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - Assert.Equal(0, wattpersquaremeter.CompareTo(wattpersquaremeter)); - Assert.True(wattpersquaremeter.CompareTo(HeatFlux.Zero) > 0); - Assert.True(HeatFlux.Zero.CompareTo(wattpersquaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - Assert.Throws(() => wattpersquaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - Assert.Throws(() => wattpersquaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - HeatFlux v = HeatFlux.FromWattsPerSquareMeter(1); - Assert.True(v.Equals(HeatFlux.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(HeatFlux.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - Assert.False(wattpersquaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - HeatFlux wattpersquaremeter = HeatFlux.FromWattsPerSquareMeter(1); - Assert.False(wattpersquaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(HeatFluxUnit.Undefined, HeatFlux.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(HeatFluxUnit)).Cast(); - foreach(var unit in units) - { - if(unit == HeatFluxUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs deleted file mode 100644 index a4d21f5b50..0000000000 --- a/UnitsNet.Tests/GeneratedCode/HeatTransferCoefficientTestsBase.g.cs +++ /dev/null @@ -1,234 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of HeatTransferCoefficient. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class HeatTransferCoefficientTestsBase - { - protected abstract double WattsPerSquareMeterCelsiusInOneWattPerSquareMeterKelvin { get; } - protected abstract double WattsPerSquareMeterKelvinInOneWattPerSquareMeterKelvin { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double WattsPerSquareMeterCelsiusTolerance { get { return 1e-5; } } - protected virtual double WattsPerSquareMeterKelvinTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new HeatTransferCoefficient((double)0.0, HeatTransferCoefficientUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new HeatTransferCoefficient(double.PositiveInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); - Assert.Throws(() => new HeatTransferCoefficient(double.NegativeInfinity, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new HeatTransferCoefficient(double.NaN, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin)); - } - - [Fact] - public void WattPerSquareMeterKelvinToHeatTransferCoefficientUnits() - { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - AssertEx.EqualTolerance(WattsPerSquareMeterCelsiusInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.WattsPerSquareMeterCelsius, WattsPerSquareMeterCelsiusTolerance); - AssertEx.EqualTolerance(WattsPerSquareMeterKelvinInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius).WattsPerSquareMeterCelsius, WattsPerSquareMeterCelsiusTolerance); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.From(1, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - } - - [Fact] - public void FromWattsPerSquareMeterKelvin_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.PositiveInfinity)); - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NegativeInfinity)); - } - - [Fact] - public void FromWattsPerSquareMeterKelvin_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(double.NaN)); - } - - [Fact] - public void As() - { - var wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - AssertEx.EqualTolerance(WattsPerSquareMeterCelsiusInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius), WattsPerSquareMeterCelsiusTolerance); - AssertEx.EqualTolerance(WattsPerSquareMeterKelvinInOneWattPerSquareMeterKelvin, wattpersquaremeterkelvin.As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin), WattsPerSquareMeterKelvinTolerance); - } - - [Fact] - public void ToUnit() - { - var wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - - var wattpersquaremetercelsiusQuantity = wattpersquaremeterkelvin.ToUnit(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); - AssertEx.EqualTolerance(WattsPerSquareMeterCelsiusInOneWattPerSquareMeterKelvin, (double)wattpersquaremetercelsiusQuantity.Value, WattsPerSquareMeterCelsiusTolerance); - Assert.Equal(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, wattpersquaremetercelsiusQuantity.Unit); - - var wattpersquaremeterkelvinQuantity = wattpersquaremeterkelvin.ToUnit(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); - AssertEx.EqualTolerance(WattsPerSquareMeterKelvinInOneWattPerSquareMeterKelvin, (double)wattpersquaremeterkelvinQuantity.Value, WattsPerSquareMeterKelvinTolerance); - Assert.Equal(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, wattpersquaremeterkelvinQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromWattsPerSquareMeterCelsius(wattpersquaremeterkelvin.WattsPerSquareMeterCelsius).WattsPerSquareMeterKelvin, WattsPerSquareMeterCelsiusTolerance); - AssertEx.EqualTolerance(1, HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(wattpersquaremeterkelvin.WattsPerSquareMeterKelvin).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - HeatTransferCoefficient v = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - AssertEx.EqualTolerance(-1, -v.WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(3)-v).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (v + v).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(10, (v*10).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(10, (10*v).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(10)/5).WattsPerSquareMeterKelvin, WattsPerSquareMeterKelvinTolerance); - AssertEx.EqualTolerance(2, HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(10)/HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(5), WattsPerSquareMeterKelvinTolerance); - } - - [Fact] - public void ComparisonOperators() - { - HeatTransferCoefficient oneWattPerSquareMeterKelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - HeatTransferCoefficient twoWattsPerSquareMeterKelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(2); - - Assert.True(oneWattPerSquareMeterKelvin < twoWattsPerSquareMeterKelvin); - Assert.True(oneWattPerSquareMeterKelvin <= twoWattsPerSquareMeterKelvin); - Assert.True(twoWattsPerSquareMeterKelvin > oneWattPerSquareMeterKelvin); - Assert.True(twoWattsPerSquareMeterKelvin >= oneWattPerSquareMeterKelvin); - - Assert.False(oneWattPerSquareMeterKelvin > twoWattsPerSquareMeterKelvin); - Assert.False(oneWattPerSquareMeterKelvin >= twoWattsPerSquareMeterKelvin); - Assert.False(twoWattsPerSquareMeterKelvin < oneWattPerSquareMeterKelvin); - Assert.False(twoWattsPerSquareMeterKelvin <= oneWattPerSquareMeterKelvin); - } - - [Fact] - public void CompareToIsImplemented() - { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.Equal(0, wattpersquaremeterkelvin.CompareTo(wattpersquaremeterkelvin)); - Assert.True(wattpersquaremeterkelvin.CompareTo(HeatTransferCoefficient.Zero) > 0); - Assert.True(HeatTransferCoefficient.Zero.CompareTo(wattpersquaremeterkelvin) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.Throws(() => wattpersquaremeterkelvin.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.Throws(() => wattpersquaremeterkelvin.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - HeatTransferCoefficient v = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.True(v.Equals(HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1), WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(HeatTransferCoefficient.Zero, WattsPerSquareMeterKelvinTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.False(wattpersquaremeterkelvin.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - HeatTransferCoefficient wattpersquaremeterkelvin = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1); - Assert.False(wattpersquaremeterkelvin.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(HeatTransferCoefficientUnit.Undefined, HeatTransferCoefficient.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(HeatTransferCoefficientUnit)).Cast(); - foreach(var unit in units) - { - if(unit == HeatTransferCoefficientUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs deleted file mode 100644 index 25c2b1a2cf..0000000000 --- a/UnitsNet.Tests/GeneratedCode/IlluminanceTestsBase.g.cs +++ /dev/null @@ -1,254 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Illuminance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class IlluminanceTestsBase - { - protected abstract double KiloluxInOneLux { get; } - protected abstract double LuxInOneLux { get; } - protected abstract double MegaluxInOneLux { get; } - protected abstract double MilliluxInOneLux { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KiloluxTolerance { get { return 1e-5; } } - protected virtual double LuxTolerance { get { return 1e-5; } } - protected virtual double MegaluxTolerance { get { return 1e-5; } } - protected virtual double MilliluxTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Illuminance((double)0.0, IlluminanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Illuminance(double.PositiveInfinity, IlluminanceUnit.Lux)); - Assert.Throws(() => new Illuminance(double.NegativeInfinity, IlluminanceUnit.Lux)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Illuminance(double.NaN, IlluminanceUnit.Lux)); - } - - [Fact] - public void LuxToIlluminanceUnits() - { - Illuminance lux = Illuminance.FromLux(1); - AssertEx.EqualTolerance(KiloluxInOneLux, lux.Kilolux, KiloluxTolerance); - AssertEx.EqualTolerance(LuxInOneLux, lux.Lux, LuxTolerance); - AssertEx.EqualTolerance(MegaluxInOneLux, lux.Megalux, MegaluxTolerance); - AssertEx.EqualTolerance(MilliluxInOneLux, lux.Millilux, MilliluxTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Kilolux).Kilolux, KiloluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Lux).Lux, LuxTolerance); - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Megalux).Megalux, MegaluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.From(1, IlluminanceUnit.Millilux).Millilux, MilliluxTolerance); - } - - [Fact] - public void FromLux_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Illuminance.FromLux(double.PositiveInfinity)); - Assert.Throws(() => Illuminance.FromLux(double.NegativeInfinity)); - } - - [Fact] - public void FromLux_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Illuminance.FromLux(double.NaN)); - } - - [Fact] - public void As() - { - var lux = Illuminance.FromLux(1); - AssertEx.EqualTolerance(KiloluxInOneLux, lux.As(IlluminanceUnit.Kilolux), KiloluxTolerance); - AssertEx.EqualTolerance(LuxInOneLux, lux.As(IlluminanceUnit.Lux), LuxTolerance); - AssertEx.EqualTolerance(MegaluxInOneLux, lux.As(IlluminanceUnit.Megalux), MegaluxTolerance); - AssertEx.EqualTolerance(MilliluxInOneLux, lux.As(IlluminanceUnit.Millilux), MilliluxTolerance); - } - - [Fact] - public void ToUnit() - { - var lux = Illuminance.FromLux(1); - - var kiloluxQuantity = lux.ToUnit(IlluminanceUnit.Kilolux); - AssertEx.EqualTolerance(KiloluxInOneLux, (double)kiloluxQuantity.Value, KiloluxTolerance); - Assert.Equal(IlluminanceUnit.Kilolux, kiloluxQuantity.Unit); - - var luxQuantity = lux.ToUnit(IlluminanceUnit.Lux); - AssertEx.EqualTolerance(LuxInOneLux, (double)luxQuantity.Value, LuxTolerance); - Assert.Equal(IlluminanceUnit.Lux, luxQuantity.Unit); - - var megaluxQuantity = lux.ToUnit(IlluminanceUnit.Megalux); - AssertEx.EqualTolerance(MegaluxInOneLux, (double)megaluxQuantity.Value, MegaluxTolerance); - Assert.Equal(IlluminanceUnit.Megalux, megaluxQuantity.Unit); - - var milliluxQuantity = lux.ToUnit(IlluminanceUnit.Millilux); - AssertEx.EqualTolerance(MilliluxInOneLux, (double)milliluxQuantity.Value, MilliluxTolerance); - Assert.Equal(IlluminanceUnit.Millilux, milliluxQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Illuminance lux = Illuminance.FromLux(1); - AssertEx.EqualTolerance(1, Illuminance.FromKilolux(lux.Kilolux).Lux, KiloluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.FromLux(lux.Lux).Lux, LuxTolerance); - AssertEx.EqualTolerance(1, Illuminance.FromMegalux(lux.Megalux).Lux, MegaluxTolerance); - AssertEx.EqualTolerance(1, Illuminance.FromMillilux(lux.Millilux).Lux, MilliluxTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Illuminance v = Illuminance.FromLux(1); - AssertEx.EqualTolerance(-1, -v.Lux, LuxTolerance); - AssertEx.EqualTolerance(2, (Illuminance.FromLux(3)-v).Lux, LuxTolerance); - AssertEx.EqualTolerance(2, (v + v).Lux, LuxTolerance); - AssertEx.EqualTolerance(10, (v*10).Lux, LuxTolerance); - AssertEx.EqualTolerance(10, (10*v).Lux, LuxTolerance); - AssertEx.EqualTolerance(2, (Illuminance.FromLux(10)/5).Lux, LuxTolerance); - AssertEx.EqualTolerance(2, Illuminance.FromLux(10)/Illuminance.FromLux(5), LuxTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Illuminance oneLux = Illuminance.FromLux(1); - Illuminance twoLux = Illuminance.FromLux(2); - - Assert.True(oneLux < twoLux); - Assert.True(oneLux <= twoLux); - Assert.True(twoLux > oneLux); - Assert.True(twoLux >= oneLux); - - Assert.False(oneLux > twoLux); - Assert.False(oneLux >= twoLux); - Assert.False(twoLux < oneLux); - Assert.False(twoLux <= oneLux); - } - - [Fact] - public void CompareToIsImplemented() - { - Illuminance lux = Illuminance.FromLux(1); - Assert.Equal(0, lux.CompareTo(lux)); - Assert.True(lux.CompareTo(Illuminance.Zero) > 0); - Assert.True(Illuminance.Zero.CompareTo(lux) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Illuminance lux = Illuminance.FromLux(1); - Assert.Throws(() => lux.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Illuminance lux = Illuminance.FromLux(1); - Assert.Throws(() => lux.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Illuminance v = Illuminance.FromLux(1); - Assert.True(v.Equals(Illuminance.FromLux(1), LuxTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Illuminance.Zero, LuxTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Illuminance lux = Illuminance.FromLux(1); - Assert.False(lux.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Illuminance lux = Illuminance.FromLux(1); - Assert.False(lux.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(IlluminanceUnit.Undefined, Illuminance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(IlluminanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == IlluminanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs deleted file mode 100644 index 2268311347..0000000000 --- a/UnitsNet.Tests/GeneratedCode/IrradianceTestsBase.g.cs +++ /dev/null @@ -1,234 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Irradiance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class IrradianceTestsBase - { - protected abstract double KilowattsPerSquareMeterInOneWattPerSquareMeter { get; } - protected abstract double WattsPerSquareMeterInOneWattPerSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilowattsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double WattsPerSquareMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Irradiance((double)0.0, IrradianceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Irradiance(double.PositiveInfinity, IrradianceUnit.WattPerSquareMeter)); - Assert.Throws(() => new Irradiance(double.NegativeInfinity, IrradianceUnit.WattPerSquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Irradiance(double.NaN, IrradianceUnit.WattPerSquareMeter)); - } - - [Fact] - public void WattPerSquareMeterToIrradianceUnits() - { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.WattsPerSquareMeter, WattsPerSquareMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.KilowattPerSquareMeter).KilowattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.From(1, IrradianceUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - } - - [Fact] - public void FromWattsPerSquareMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromWattsPerSquareMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Irradiance.FromWattsPerSquareMeter(double.NaN)); - } - - [Fact] - public void As() - { - var wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(IrradianceUnit.KilowattPerSquareMeter), KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(IrradianceUnit.WattPerSquareMeter), WattsPerSquareMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - - var kilowattpersquaremeterQuantity = wattpersquaremeter.ToUnit(IrradianceUnit.KilowattPerSquareMeter); - AssertEx.EqualTolerance(KilowattsPerSquareMeterInOneWattPerSquareMeter, (double)kilowattpersquaremeterQuantity.Value, KilowattsPerSquareMeterTolerance); - Assert.Equal(IrradianceUnit.KilowattPerSquareMeter, kilowattpersquaremeterQuantity.Unit); - - var wattpersquaremeterQuantity = wattpersquaremeter.ToUnit(IrradianceUnit.WattPerSquareMeter); - AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, (double)wattpersquaremeterQuantity.Value, WattsPerSquareMeterTolerance); - Assert.Equal(IrradianceUnit.WattPerSquareMeter, wattpersquaremeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(1, Irradiance.FromKilowattsPerSquareMeter(wattpersquaremeter.KilowattsPerSquareMeter).WattsPerSquareMeter, KilowattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiance.FromWattsPerSquareMeter(wattpersquaremeter.WattsPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Irradiance v = Irradiance.FromWattsPerSquareMeter(1); - AssertEx.EqualTolerance(-1, -v.WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiance.FromWattsPerSquareMeter(3)-v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiance.FromWattsPerSquareMeter(10)/5).WattsPerSquareMeter, WattsPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, Irradiance.FromWattsPerSquareMeter(10)/Irradiance.FromWattsPerSquareMeter(5), WattsPerSquareMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Irradiance oneWattPerSquareMeter = Irradiance.FromWattsPerSquareMeter(1); - Irradiance twoWattsPerSquareMeter = Irradiance.FromWattsPerSquareMeter(2); - - Assert.True(oneWattPerSquareMeter < twoWattsPerSquareMeter); - Assert.True(oneWattPerSquareMeter <= twoWattsPerSquareMeter); - Assert.True(twoWattsPerSquareMeter > oneWattPerSquareMeter); - Assert.True(twoWattsPerSquareMeter >= oneWattPerSquareMeter); - - Assert.False(oneWattPerSquareMeter > twoWattsPerSquareMeter); - Assert.False(oneWattPerSquareMeter >= twoWattsPerSquareMeter); - Assert.False(twoWattsPerSquareMeter < oneWattPerSquareMeter); - Assert.False(twoWattsPerSquareMeter <= oneWattPerSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - Assert.Equal(0, wattpersquaremeter.CompareTo(wattpersquaremeter)); - Assert.True(wattpersquaremeter.CompareTo(Irradiance.Zero) > 0); - Assert.True(Irradiance.Zero.CompareTo(wattpersquaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - Assert.Throws(() => wattpersquaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - Assert.Throws(() => wattpersquaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Irradiance v = Irradiance.FromWattsPerSquareMeter(1); - Assert.True(v.Equals(Irradiance.FromWattsPerSquareMeter(1), WattsPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Irradiance.Zero, WattsPerSquareMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - Assert.False(wattpersquaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Irradiance wattpersquaremeter = Irradiance.FromWattsPerSquareMeter(1); - Assert.False(wattpersquaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(IrradianceUnit.Undefined, Irradiance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(IrradianceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == IrradianceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs deleted file mode 100644 index 43d552bb87..0000000000 --- a/UnitsNet.Tests/GeneratedCode/IrradiationTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Irradiation. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class IrradiationTestsBase - { - protected abstract double JoulesPerSquareMeterInOneJoulePerSquareMeter { get; } - protected abstract double KilowattHoursPerSquareMeterInOneJoulePerSquareMeter { get; } - protected abstract double WattHoursPerSquareMeterInOneJoulePerSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double JoulesPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double KilowattHoursPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double WattHoursPerSquareMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Irradiation((double)0.0, IrradiationUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Irradiation(double.PositiveInfinity, IrradiationUnit.JoulePerSquareMeter)); - Assert.Throws(() => new Irradiation(double.NegativeInfinity, IrradiationUnit.JoulePerSquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Irradiation(double.NaN, IrradiationUnit.JoulePerSquareMeter)); - } - - [Fact] - public void JoulePerSquareMeterToIrradiationUnits() - { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - AssertEx.EqualTolerance(JoulesPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilowattHoursPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.KilowattHoursPerSquareMeter, KilowattHoursPerSquareMeterTolerance); - AssertEx.EqualTolerance(WattHoursPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.WattHoursPerSquareMeter, WattHoursPerSquareMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.JoulePerSquareMeter).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.KilowattHourPerSquareMeter).KilowattHoursPerSquareMeter, KilowattHoursPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.From(1, IrradiationUnit.WattHourPerSquareMeter).WattHoursPerSquareMeter, WattHoursPerSquareMeterTolerance); - } - - [Fact] - public void FromJoulesPerSquareMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromJoulesPerSquareMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Irradiation.FromJoulesPerSquareMeter(double.NaN)); - } - - [Fact] - public void As() - { - var joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - AssertEx.EqualTolerance(JoulesPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.As(IrradiationUnit.JoulePerSquareMeter), JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilowattHoursPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.As(IrradiationUnit.KilowattHourPerSquareMeter), KilowattHoursPerSquareMeterTolerance); - AssertEx.EqualTolerance(WattHoursPerSquareMeterInOneJoulePerSquareMeter, joulepersquaremeter.As(IrradiationUnit.WattHourPerSquareMeter), WattHoursPerSquareMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - - var joulepersquaremeterQuantity = joulepersquaremeter.ToUnit(IrradiationUnit.JoulePerSquareMeter); - AssertEx.EqualTolerance(JoulesPerSquareMeterInOneJoulePerSquareMeter, (double)joulepersquaremeterQuantity.Value, JoulesPerSquareMeterTolerance); - Assert.Equal(IrradiationUnit.JoulePerSquareMeter, joulepersquaremeterQuantity.Unit); - - var kilowatthourpersquaremeterQuantity = joulepersquaremeter.ToUnit(IrradiationUnit.KilowattHourPerSquareMeter); - AssertEx.EqualTolerance(KilowattHoursPerSquareMeterInOneJoulePerSquareMeter, (double)kilowatthourpersquaremeterQuantity.Value, KilowattHoursPerSquareMeterTolerance); - Assert.Equal(IrradiationUnit.KilowattHourPerSquareMeter, kilowatthourpersquaremeterQuantity.Unit); - - var watthourpersquaremeterQuantity = joulepersquaremeter.ToUnit(IrradiationUnit.WattHourPerSquareMeter); - AssertEx.EqualTolerance(WattHoursPerSquareMeterInOneJoulePerSquareMeter, (double)watthourpersquaremeterQuantity.Value, WattHoursPerSquareMeterTolerance); - Assert.Equal(IrradiationUnit.WattHourPerSquareMeter, watthourpersquaremeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - AssertEx.EqualTolerance(1, Irradiation.FromJoulesPerSquareMeter(joulepersquaremeter.JoulesPerSquareMeter).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromKilowattHoursPerSquareMeter(joulepersquaremeter.KilowattHoursPerSquareMeter).JoulesPerSquareMeter, KilowattHoursPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Irradiation.FromWattHoursPerSquareMeter(joulepersquaremeter.WattHoursPerSquareMeter).JoulesPerSquareMeter, WattHoursPerSquareMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Irradiation v = Irradiation.FromJoulesPerSquareMeter(1); - AssertEx.EqualTolerance(-1, -v.JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiation.FromJoulesPerSquareMeter(3)-v).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (Irradiation.FromJoulesPerSquareMeter(10)/5).JoulesPerSquareMeter, JoulesPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, Irradiation.FromJoulesPerSquareMeter(10)/Irradiation.FromJoulesPerSquareMeter(5), JoulesPerSquareMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Irradiation oneJoulePerSquareMeter = Irradiation.FromJoulesPerSquareMeter(1); - Irradiation twoJoulesPerSquareMeter = Irradiation.FromJoulesPerSquareMeter(2); - - Assert.True(oneJoulePerSquareMeter < twoJoulesPerSquareMeter); - Assert.True(oneJoulePerSquareMeter <= twoJoulesPerSquareMeter); - Assert.True(twoJoulesPerSquareMeter > oneJoulePerSquareMeter); - Assert.True(twoJoulesPerSquareMeter >= oneJoulePerSquareMeter); - - Assert.False(oneJoulePerSquareMeter > twoJoulesPerSquareMeter); - Assert.False(oneJoulePerSquareMeter >= twoJoulesPerSquareMeter); - Assert.False(twoJoulesPerSquareMeter < oneJoulePerSquareMeter); - Assert.False(twoJoulesPerSquareMeter <= oneJoulePerSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - Assert.Equal(0, joulepersquaremeter.CompareTo(joulepersquaremeter)); - Assert.True(joulepersquaremeter.CompareTo(Irradiation.Zero) > 0); - Assert.True(Irradiation.Zero.CompareTo(joulepersquaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - Assert.Throws(() => joulepersquaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - Assert.Throws(() => joulepersquaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Irradiation v = Irradiation.FromJoulesPerSquareMeter(1); - Assert.True(v.Equals(Irradiation.FromJoulesPerSquareMeter(1), JoulesPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Irradiation.Zero, JoulesPerSquareMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - Assert.False(joulepersquaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Irradiation joulepersquaremeter = Irradiation.FromJoulesPerSquareMeter(1); - Assert.False(joulepersquaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(IrradiationUnit.Undefined, Irradiation.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(IrradiationUnit)).Cast(); - foreach(var unit in units) - { - if(unit == IrradiationUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs deleted file mode 100644 index d33d786534..0000000000 --- a/UnitsNet.Tests/GeneratedCode/KinematicViscosityTestsBase.g.cs +++ /dev/null @@ -1,294 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of KinematicViscosity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class KinematicViscosityTestsBase - { - protected abstract double CentistokesInOneSquareMeterPerSecond { get; } - protected abstract double DecistokesInOneSquareMeterPerSecond { get; } - protected abstract double KilostokesInOneSquareMeterPerSecond { get; } - protected abstract double MicrostokesInOneSquareMeterPerSecond { get; } - protected abstract double MillistokesInOneSquareMeterPerSecond { get; } - protected abstract double NanostokesInOneSquareMeterPerSecond { get; } - protected abstract double SquareMetersPerSecondInOneSquareMeterPerSecond { get; } - protected abstract double StokesInOneSquareMeterPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentistokesTolerance { get { return 1e-5; } } - protected virtual double DecistokesTolerance { get { return 1e-5; } } - protected virtual double KilostokesTolerance { get { return 1e-5; } } - protected virtual double MicrostokesTolerance { get { return 1e-5; } } - protected virtual double MillistokesTolerance { get { return 1e-5; } } - protected virtual double NanostokesTolerance { get { return 1e-5; } } - protected virtual double SquareMetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double StokesTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new KinematicViscosity((double)0.0, KinematicViscosityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new KinematicViscosity(double.PositiveInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); - Assert.Throws(() => new KinematicViscosity(double.NegativeInfinity, KinematicViscosityUnit.SquareMeterPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new KinematicViscosity(double.NaN, KinematicViscosityUnit.SquareMeterPerSecond)); - } - - [Fact] - public void SquareMeterPerSecondToKinematicViscosityUnits() - { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - AssertEx.EqualTolerance(CentistokesInOneSquareMeterPerSecond, squaremeterpersecond.Centistokes, CentistokesTolerance); - AssertEx.EqualTolerance(DecistokesInOneSquareMeterPerSecond, squaremeterpersecond.Decistokes, DecistokesTolerance); - AssertEx.EqualTolerance(KilostokesInOneSquareMeterPerSecond, squaremeterpersecond.Kilostokes, KilostokesTolerance); - AssertEx.EqualTolerance(MicrostokesInOneSquareMeterPerSecond, squaremeterpersecond.Microstokes, MicrostokesTolerance); - AssertEx.EqualTolerance(MillistokesInOneSquareMeterPerSecond, squaremeterpersecond.Millistokes, MillistokesTolerance); - AssertEx.EqualTolerance(NanostokesInOneSquareMeterPerSecond, squaremeterpersecond.Nanostokes, NanostokesTolerance); - AssertEx.EqualTolerance(SquareMetersPerSecondInOneSquareMeterPerSecond, squaremeterpersecond.SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(StokesInOneSquareMeterPerSecond, squaremeterpersecond.Stokes, StokesTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Centistokes).Centistokes, CentistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Decistokes).Decistokes, DecistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Kilostokes).Kilostokes, KilostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Microstokes).Microstokes, MicrostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Millistokes).Millistokes, MillistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Nanostokes).Nanostokes, NanostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.SquareMeterPerSecond).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.From(1, KinematicViscosityUnit.Stokes).Stokes, StokesTolerance); - } - - [Fact] - public void FromSquareMetersPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromSquareMetersPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => KinematicViscosity.FromSquareMetersPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - AssertEx.EqualTolerance(CentistokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Centistokes), CentistokesTolerance); - AssertEx.EqualTolerance(DecistokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Decistokes), DecistokesTolerance); - AssertEx.EqualTolerance(KilostokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Kilostokes), KilostokesTolerance); - AssertEx.EqualTolerance(MicrostokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Microstokes), MicrostokesTolerance); - AssertEx.EqualTolerance(MillistokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Millistokes), MillistokesTolerance); - AssertEx.EqualTolerance(NanostokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Nanostokes), NanostokesTolerance); - AssertEx.EqualTolerance(SquareMetersPerSecondInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.SquareMeterPerSecond), SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(StokesInOneSquareMeterPerSecond, squaremeterpersecond.As(KinematicViscosityUnit.Stokes), StokesTolerance); - } - - [Fact] - public void ToUnit() - { - var squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - - var centistokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Centistokes); - AssertEx.EqualTolerance(CentistokesInOneSquareMeterPerSecond, (double)centistokesQuantity.Value, CentistokesTolerance); - Assert.Equal(KinematicViscosityUnit.Centistokes, centistokesQuantity.Unit); - - var decistokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Decistokes); - AssertEx.EqualTolerance(DecistokesInOneSquareMeterPerSecond, (double)decistokesQuantity.Value, DecistokesTolerance); - Assert.Equal(KinematicViscosityUnit.Decistokes, decistokesQuantity.Unit); - - var kilostokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Kilostokes); - AssertEx.EqualTolerance(KilostokesInOneSquareMeterPerSecond, (double)kilostokesQuantity.Value, KilostokesTolerance); - Assert.Equal(KinematicViscosityUnit.Kilostokes, kilostokesQuantity.Unit); - - var microstokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Microstokes); - AssertEx.EqualTolerance(MicrostokesInOneSquareMeterPerSecond, (double)microstokesQuantity.Value, MicrostokesTolerance); - Assert.Equal(KinematicViscosityUnit.Microstokes, microstokesQuantity.Unit); - - var millistokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Millistokes); - AssertEx.EqualTolerance(MillistokesInOneSquareMeterPerSecond, (double)millistokesQuantity.Value, MillistokesTolerance); - Assert.Equal(KinematicViscosityUnit.Millistokes, millistokesQuantity.Unit); - - var nanostokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Nanostokes); - AssertEx.EqualTolerance(NanostokesInOneSquareMeterPerSecond, (double)nanostokesQuantity.Value, NanostokesTolerance); - Assert.Equal(KinematicViscosityUnit.Nanostokes, nanostokesQuantity.Unit); - - var squaremeterpersecondQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.SquareMeterPerSecond); - AssertEx.EqualTolerance(SquareMetersPerSecondInOneSquareMeterPerSecond, (double)squaremeterpersecondQuantity.Value, SquareMetersPerSecondTolerance); - Assert.Equal(KinematicViscosityUnit.SquareMeterPerSecond, squaremeterpersecondQuantity.Unit); - - var stokesQuantity = squaremeterpersecond.ToUnit(KinematicViscosityUnit.Stokes); - AssertEx.EqualTolerance(StokesInOneSquareMeterPerSecond, (double)stokesQuantity.Value, StokesTolerance); - Assert.Equal(KinematicViscosityUnit.Stokes, stokesQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - AssertEx.EqualTolerance(1, KinematicViscosity.FromCentistokes(squaremeterpersecond.Centistokes).SquareMetersPerSecond, CentistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromDecistokes(squaremeterpersecond.Decistokes).SquareMetersPerSecond, DecistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromKilostokes(squaremeterpersecond.Kilostokes).SquareMetersPerSecond, KilostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromMicrostokes(squaremeterpersecond.Microstokes).SquareMetersPerSecond, MicrostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromMillistokes(squaremeterpersecond.Millistokes).SquareMetersPerSecond, MillistokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromNanostokes(squaremeterpersecond.Nanostokes).SquareMetersPerSecond, NanostokesTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromSquareMetersPerSecond(squaremeterpersecond.SquareMetersPerSecond).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, KinematicViscosity.FromStokes(squaremeterpersecond.Stokes).SquareMetersPerSecond, StokesTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - KinematicViscosity v = KinematicViscosity.FromSquareMetersPerSecond(1); - AssertEx.EqualTolerance(-1, -v.SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (KinematicViscosity.FromSquareMetersPerSecond(3)-v).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (KinematicViscosity.FromSquareMetersPerSecond(10)/5).SquareMetersPerSecond, SquareMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, KinematicViscosity.FromSquareMetersPerSecond(10)/KinematicViscosity.FromSquareMetersPerSecond(5), SquareMetersPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - KinematicViscosity oneSquareMeterPerSecond = KinematicViscosity.FromSquareMetersPerSecond(1); - KinematicViscosity twoSquareMetersPerSecond = KinematicViscosity.FromSquareMetersPerSecond(2); - - Assert.True(oneSquareMeterPerSecond < twoSquareMetersPerSecond); - Assert.True(oneSquareMeterPerSecond <= twoSquareMetersPerSecond); - Assert.True(twoSquareMetersPerSecond > oneSquareMeterPerSecond); - Assert.True(twoSquareMetersPerSecond >= oneSquareMeterPerSecond); - - Assert.False(oneSquareMeterPerSecond > twoSquareMetersPerSecond); - Assert.False(oneSquareMeterPerSecond >= twoSquareMetersPerSecond); - Assert.False(twoSquareMetersPerSecond < oneSquareMeterPerSecond); - Assert.False(twoSquareMetersPerSecond <= oneSquareMeterPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.Equal(0, squaremeterpersecond.CompareTo(squaremeterpersecond)); - Assert.True(squaremeterpersecond.CompareTo(KinematicViscosity.Zero) > 0); - Assert.True(KinematicViscosity.Zero.CompareTo(squaremeterpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.Throws(() => squaremeterpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.Throws(() => squaremeterpersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - KinematicViscosity v = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.True(v.Equals(KinematicViscosity.FromSquareMetersPerSecond(1), SquareMetersPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(KinematicViscosity.Zero, SquareMetersPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.False(squaremeterpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - KinematicViscosity squaremeterpersecond = KinematicViscosity.FromSquareMetersPerSecond(1); - Assert.False(squaremeterpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(KinematicViscosityUnit.Undefined, KinematicViscosity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(KinematicViscosityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == KinematicViscosityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs deleted file mode 100644 index 58b372765f..0000000000 --- a/UnitsNet.Tests/GeneratedCode/LapseRateTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of LapseRate. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class LapseRateTestsBase - { - protected abstract double DegreesCelciusPerKilometerInOneDegreeCelsiusPerKilometer { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DegreesCelciusPerKilometerTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new LapseRate((double)0.0, LapseRateUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new LapseRate(double.PositiveInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); - Assert.Throws(() => new LapseRate(double.NegativeInfinity, LapseRateUnit.DegreeCelsiusPerKilometer)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new LapseRate(double.NaN, LapseRateUnit.DegreeCelsiusPerKilometer)); - } - - [Fact] - public void DegreeCelsiusPerKilometerToLapseRateUnits() - { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneDegreeCelsiusPerKilometer, degreecelsiusperkilometer.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, LapseRate.From(1, LapseRateUnit.DegreeCelsiusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - } - - [Fact] - public void FromDegreesCelciusPerKilometer_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.PositiveInfinity)); - Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NegativeInfinity)); - } - - [Fact] - public void FromDegreesCelciusPerKilometer_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => LapseRate.FromDegreesCelciusPerKilometer(double.NaN)); - } - - [Fact] - public void As() - { - var degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneDegreeCelsiusPerKilometer, degreecelsiusperkilometer.As(LapseRateUnit.DegreeCelsiusPerKilometer), DegreesCelciusPerKilometerTolerance); - } - - [Fact] - public void ToUnit() - { - var degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - - var degreecelsiusperkilometerQuantity = degreecelsiusperkilometer.ToUnit(LapseRateUnit.DegreeCelsiusPerKilometer); - AssertEx.EqualTolerance(DegreesCelciusPerKilometerInOneDegreeCelsiusPerKilometer, (double)degreecelsiusperkilometerQuantity.Value, DegreesCelciusPerKilometerTolerance); - Assert.Equal(LapseRateUnit.DegreeCelsiusPerKilometer, degreecelsiusperkilometerQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - AssertEx.EqualTolerance(1, LapseRate.FromDegreesCelciusPerKilometer(degreecelsiusperkilometer.DegreesCelciusPerKilometer).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - LapseRate v = LapseRate.FromDegreesCelciusPerKilometer(1); - AssertEx.EqualTolerance(-1, -v.DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(2, (LapseRate.FromDegreesCelciusPerKilometer(3)-v).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(2, (v + v).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(10, (v*10).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(10, (10*v).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(2, (LapseRate.FromDegreesCelciusPerKilometer(10)/5).DegreesCelciusPerKilometer, DegreesCelciusPerKilometerTolerance); - AssertEx.EqualTolerance(2, LapseRate.FromDegreesCelciusPerKilometer(10)/LapseRate.FromDegreesCelciusPerKilometer(5), DegreesCelciusPerKilometerTolerance); - } - - [Fact] - public void ComparisonOperators() - { - LapseRate oneDegreeCelsiusPerKilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - LapseRate twoDegreesCelciusPerKilometer = LapseRate.FromDegreesCelciusPerKilometer(2); - - Assert.True(oneDegreeCelsiusPerKilometer < twoDegreesCelciusPerKilometer); - Assert.True(oneDegreeCelsiusPerKilometer <= twoDegreesCelciusPerKilometer); - Assert.True(twoDegreesCelciusPerKilometer > oneDegreeCelsiusPerKilometer); - Assert.True(twoDegreesCelciusPerKilometer >= oneDegreeCelsiusPerKilometer); - - Assert.False(oneDegreeCelsiusPerKilometer > twoDegreesCelciusPerKilometer); - Assert.False(oneDegreeCelsiusPerKilometer >= twoDegreesCelciusPerKilometer); - Assert.False(twoDegreesCelciusPerKilometer < oneDegreeCelsiusPerKilometer); - Assert.False(twoDegreesCelciusPerKilometer <= oneDegreeCelsiusPerKilometer); - } - - [Fact] - public void CompareToIsImplemented() - { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.Equal(0, degreecelsiusperkilometer.CompareTo(degreecelsiusperkilometer)); - Assert.True(degreecelsiusperkilometer.CompareTo(LapseRate.Zero) > 0); - Assert.True(LapseRate.Zero.CompareTo(degreecelsiusperkilometer) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.Throws(() => degreecelsiusperkilometer.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.Throws(() => degreecelsiusperkilometer.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - LapseRate v = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.True(v.Equals(LapseRate.FromDegreesCelciusPerKilometer(1), DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LapseRate.Zero, DegreesCelciusPerKilometerTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.False(degreecelsiusperkilometer.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - LapseRate degreecelsiusperkilometer = LapseRate.FromDegreesCelciusPerKilometer(1); - Assert.False(degreecelsiusperkilometer.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(LapseRateUnit.Undefined, LapseRate.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(LapseRateUnit)).Cast(); - foreach(var unit in units) - { - if(unit == LapseRateUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs deleted file mode 100644 index dc840ffffa..0000000000 --- a/UnitsNet.Tests/GeneratedCode/LinearDensityTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of LinearDensity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class LinearDensityTestsBase - { - protected abstract double GramsPerMeterInOneKilogramPerMeter { get; } - protected abstract double KilogramsPerMeterInOneKilogramPerMeter { get; } - protected abstract double PoundsPerFootInOneKilogramPerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double GramsPerMeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerMeterTolerance { get { return 1e-5; } } - protected virtual double PoundsPerFootTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new LinearDensity((double)0.0, LinearDensityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new LinearDensity(double.PositiveInfinity, LinearDensityUnit.KilogramPerMeter)); - Assert.Throws(() => new LinearDensity(double.NegativeInfinity, LinearDensityUnit.KilogramPerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new LinearDensity(double.NaN, LinearDensityUnit.KilogramPerMeter)); - } - - [Fact] - public void KilogramPerMeterToLinearDensityUnits() - { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - AssertEx.EqualTolerance(GramsPerMeterInOneKilogramPerMeter, kilogrampermeter.GramsPerMeter, GramsPerMeterTolerance); - AssertEx.EqualTolerance(KilogramsPerMeterInOneKilogramPerMeter, kilogrampermeter.KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(PoundsPerFootInOneKilogramPerMeter, kilogrampermeter.PoundsPerFoot, PoundsPerFootTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.GramPerMeter).GramsPerMeter, GramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.KilogramPerMeter).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.From(1, LinearDensityUnit.PoundPerFoot).PoundsPerFoot, PoundsPerFootTolerance); - } - - [Fact] - public void FromKilogramsPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromKilogramsPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => LinearDensity.FromKilogramsPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - AssertEx.EqualTolerance(GramsPerMeterInOneKilogramPerMeter, kilogrampermeter.As(LinearDensityUnit.GramPerMeter), GramsPerMeterTolerance); - AssertEx.EqualTolerance(KilogramsPerMeterInOneKilogramPerMeter, kilogrampermeter.As(LinearDensityUnit.KilogramPerMeter), KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(PoundsPerFootInOneKilogramPerMeter, kilogrampermeter.As(LinearDensityUnit.PoundPerFoot), PoundsPerFootTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - - var grampermeterQuantity = kilogrampermeter.ToUnit(LinearDensityUnit.GramPerMeter); - AssertEx.EqualTolerance(GramsPerMeterInOneKilogramPerMeter, (double)grampermeterQuantity.Value, GramsPerMeterTolerance); - Assert.Equal(LinearDensityUnit.GramPerMeter, grampermeterQuantity.Unit); - - var kilogrampermeterQuantity = kilogrampermeter.ToUnit(LinearDensityUnit.KilogramPerMeter); - AssertEx.EqualTolerance(KilogramsPerMeterInOneKilogramPerMeter, (double)kilogrampermeterQuantity.Value, KilogramsPerMeterTolerance); - Assert.Equal(LinearDensityUnit.KilogramPerMeter, kilogrampermeterQuantity.Unit); - - var poundperfootQuantity = kilogrampermeter.ToUnit(LinearDensityUnit.PoundPerFoot); - AssertEx.EqualTolerance(PoundsPerFootInOneKilogramPerMeter, (double)poundperfootQuantity.Value, PoundsPerFootTolerance); - Assert.Equal(LinearDensityUnit.PoundPerFoot, poundperfootQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - AssertEx.EqualTolerance(1, LinearDensity.FromGramsPerMeter(kilogrampermeter.GramsPerMeter).KilogramsPerMeter, GramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.FromKilogramsPerMeter(kilogrampermeter.KilogramsPerMeter).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(1, LinearDensity.FromPoundsPerFoot(kilogrampermeter.PoundsPerFoot).KilogramsPerMeter, PoundsPerFootTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - LinearDensity v = LinearDensity.FromKilogramsPerMeter(1); - AssertEx.EqualTolerance(-1, -v.KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(2, (LinearDensity.FromKilogramsPerMeter(3)-v).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(2, (LinearDensity.FromKilogramsPerMeter(10)/5).KilogramsPerMeter, KilogramsPerMeterTolerance); - AssertEx.EqualTolerance(2, LinearDensity.FromKilogramsPerMeter(10)/LinearDensity.FromKilogramsPerMeter(5), KilogramsPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - LinearDensity oneKilogramPerMeter = LinearDensity.FromKilogramsPerMeter(1); - LinearDensity twoKilogramsPerMeter = LinearDensity.FromKilogramsPerMeter(2); - - Assert.True(oneKilogramPerMeter < twoKilogramsPerMeter); - Assert.True(oneKilogramPerMeter <= twoKilogramsPerMeter); - Assert.True(twoKilogramsPerMeter > oneKilogramPerMeter); - Assert.True(twoKilogramsPerMeter >= oneKilogramPerMeter); - - Assert.False(oneKilogramPerMeter > twoKilogramsPerMeter); - Assert.False(oneKilogramPerMeter >= twoKilogramsPerMeter); - Assert.False(twoKilogramsPerMeter < oneKilogramPerMeter); - Assert.False(twoKilogramsPerMeter <= oneKilogramPerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - Assert.Equal(0, kilogrampermeter.CompareTo(kilogrampermeter)); - Assert.True(kilogrampermeter.CompareTo(LinearDensity.Zero) > 0); - Assert.True(LinearDensity.Zero.CompareTo(kilogrampermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - Assert.Throws(() => kilogrampermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - Assert.Throws(() => kilogrampermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - LinearDensity v = LinearDensity.FromKilogramsPerMeter(1); - Assert.True(v.Equals(LinearDensity.FromKilogramsPerMeter(1), KilogramsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LinearDensity.Zero, KilogramsPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - Assert.False(kilogrampermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - LinearDensity kilogrampermeter = LinearDensity.FromKilogramsPerMeter(1); - Assert.False(kilogrampermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(LinearDensityUnit.Undefined, LinearDensity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(LinearDensityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == LinearDensityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs deleted file mode 100644 index dbda252867..0000000000 --- a/UnitsNet.Tests/GeneratedCode/LuminousFluxTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of LuminousFlux. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class LuminousFluxTestsBase - { - protected abstract double LumensInOneLumen { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double LumensTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new LuminousFlux((double)0.0, LuminousFluxUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new LuminousFlux(double.PositiveInfinity, LuminousFluxUnit.Lumen)); - Assert.Throws(() => new LuminousFlux(double.NegativeInfinity, LuminousFluxUnit.Lumen)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new LuminousFlux(double.NaN, LuminousFluxUnit.Lumen)); - } - - [Fact] - public void LumenToLuminousFluxUnits() - { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - AssertEx.EqualTolerance(LumensInOneLumen, lumen.Lumens, LumensTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, LuminousFlux.From(1, LuminousFluxUnit.Lumen).Lumens, LumensTolerance); - } - - [Fact] - public void FromLumens_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => LuminousFlux.FromLumens(double.PositiveInfinity)); - Assert.Throws(() => LuminousFlux.FromLumens(double.NegativeInfinity)); - } - - [Fact] - public void FromLumens_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => LuminousFlux.FromLumens(double.NaN)); - } - - [Fact] - public void As() - { - var lumen = LuminousFlux.FromLumens(1); - AssertEx.EqualTolerance(LumensInOneLumen, lumen.As(LuminousFluxUnit.Lumen), LumensTolerance); - } - - [Fact] - public void ToUnit() - { - var lumen = LuminousFlux.FromLumens(1); - - var lumenQuantity = lumen.ToUnit(LuminousFluxUnit.Lumen); - AssertEx.EqualTolerance(LumensInOneLumen, (double)lumenQuantity.Value, LumensTolerance); - Assert.Equal(LuminousFluxUnit.Lumen, lumenQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - AssertEx.EqualTolerance(1, LuminousFlux.FromLumens(lumen.Lumens).Lumens, LumensTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - LuminousFlux v = LuminousFlux.FromLumens(1); - AssertEx.EqualTolerance(-1, -v.Lumens, LumensTolerance); - AssertEx.EqualTolerance(2, (LuminousFlux.FromLumens(3)-v).Lumens, LumensTolerance); - AssertEx.EqualTolerance(2, (v + v).Lumens, LumensTolerance); - AssertEx.EqualTolerance(10, (v*10).Lumens, LumensTolerance); - AssertEx.EqualTolerance(10, (10*v).Lumens, LumensTolerance); - AssertEx.EqualTolerance(2, (LuminousFlux.FromLumens(10)/5).Lumens, LumensTolerance); - AssertEx.EqualTolerance(2, LuminousFlux.FromLumens(10)/LuminousFlux.FromLumens(5), LumensTolerance); - } - - [Fact] - public void ComparisonOperators() - { - LuminousFlux oneLumen = LuminousFlux.FromLumens(1); - LuminousFlux twoLumens = LuminousFlux.FromLumens(2); - - Assert.True(oneLumen < twoLumens); - Assert.True(oneLumen <= twoLumens); - Assert.True(twoLumens > oneLumen); - Assert.True(twoLumens >= oneLumen); - - Assert.False(oneLumen > twoLumens); - Assert.False(oneLumen >= twoLumens); - Assert.False(twoLumens < oneLumen); - Assert.False(twoLumens <= oneLumen); - } - - [Fact] - public void CompareToIsImplemented() - { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - Assert.Equal(0, lumen.CompareTo(lumen)); - Assert.True(lumen.CompareTo(LuminousFlux.Zero) > 0); - Assert.True(LuminousFlux.Zero.CompareTo(lumen) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - Assert.Throws(() => lumen.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - Assert.Throws(() => lumen.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - LuminousFlux v = LuminousFlux.FromLumens(1); - Assert.True(v.Equals(LuminousFlux.FromLumens(1), LumensTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LuminousFlux.Zero, LumensTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - Assert.False(lumen.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - LuminousFlux lumen = LuminousFlux.FromLumens(1); - Assert.False(lumen.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(LuminousFluxUnit.Undefined, LuminousFlux.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(LuminousFluxUnit)).Cast(); - foreach(var unit in units) - { - if(unit == LuminousFluxUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs deleted file mode 100644 index c2148222b4..0000000000 --- a/UnitsNet.Tests/GeneratedCode/LuminousIntensityTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of LuminousIntensity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class LuminousIntensityTestsBase - { - protected abstract double CandelaInOneCandela { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CandelaTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new LuminousIntensity((double)0.0, LuminousIntensityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new LuminousIntensity(double.PositiveInfinity, LuminousIntensityUnit.Candela)); - Assert.Throws(() => new LuminousIntensity(double.NegativeInfinity, LuminousIntensityUnit.Candela)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new LuminousIntensity(double.NaN, LuminousIntensityUnit.Candela)); - } - - [Fact] - public void CandelaToLuminousIntensityUnits() - { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - AssertEx.EqualTolerance(CandelaInOneCandela, candela.Candela, CandelaTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, LuminousIntensity.From(1, LuminousIntensityUnit.Candela).Candela, CandelaTolerance); - } - - [Fact] - public void FromCandela_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => LuminousIntensity.FromCandela(double.PositiveInfinity)); - Assert.Throws(() => LuminousIntensity.FromCandela(double.NegativeInfinity)); - } - - [Fact] - public void FromCandela_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => LuminousIntensity.FromCandela(double.NaN)); - } - - [Fact] - public void As() - { - var candela = LuminousIntensity.FromCandela(1); - AssertEx.EqualTolerance(CandelaInOneCandela, candela.As(LuminousIntensityUnit.Candela), CandelaTolerance); - } - - [Fact] - public void ToUnit() - { - var candela = LuminousIntensity.FromCandela(1); - - var candelaQuantity = candela.ToUnit(LuminousIntensityUnit.Candela); - AssertEx.EqualTolerance(CandelaInOneCandela, (double)candelaQuantity.Value, CandelaTolerance); - Assert.Equal(LuminousIntensityUnit.Candela, candelaQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - AssertEx.EqualTolerance(1, LuminousIntensity.FromCandela(candela.Candela).Candela, CandelaTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - LuminousIntensity v = LuminousIntensity.FromCandela(1); - AssertEx.EqualTolerance(-1, -v.Candela, CandelaTolerance); - AssertEx.EqualTolerance(2, (LuminousIntensity.FromCandela(3)-v).Candela, CandelaTolerance); - AssertEx.EqualTolerance(2, (v + v).Candela, CandelaTolerance); - AssertEx.EqualTolerance(10, (v*10).Candela, CandelaTolerance); - AssertEx.EqualTolerance(10, (10*v).Candela, CandelaTolerance); - AssertEx.EqualTolerance(2, (LuminousIntensity.FromCandela(10)/5).Candela, CandelaTolerance); - AssertEx.EqualTolerance(2, LuminousIntensity.FromCandela(10)/LuminousIntensity.FromCandela(5), CandelaTolerance); - } - - [Fact] - public void ComparisonOperators() - { - LuminousIntensity oneCandela = LuminousIntensity.FromCandela(1); - LuminousIntensity twoCandela = LuminousIntensity.FromCandela(2); - - Assert.True(oneCandela < twoCandela); - Assert.True(oneCandela <= twoCandela); - Assert.True(twoCandela > oneCandela); - Assert.True(twoCandela >= oneCandela); - - Assert.False(oneCandela > twoCandela); - Assert.False(oneCandela >= twoCandela); - Assert.False(twoCandela < oneCandela); - Assert.False(twoCandela <= oneCandela); - } - - [Fact] - public void CompareToIsImplemented() - { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - Assert.Equal(0, candela.CompareTo(candela)); - Assert.True(candela.CompareTo(LuminousIntensity.Zero) > 0); - Assert.True(LuminousIntensity.Zero.CompareTo(candela) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - Assert.Throws(() => candela.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - Assert.Throws(() => candela.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - LuminousIntensity v = LuminousIntensity.FromCandela(1); - Assert.True(v.Equals(LuminousIntensity.FromCandela(1), CandelaTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(LuminousIntensity.Zero, CandelaTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - Assert.False(candela.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - LuminousIntensity candela = LuminousIntensity.FromCandela(1); - Assert.False(candela.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(LuminousIntensityUnit.Undefined, LuminousIntensity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(LuminousIntensityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == LuminousIntensityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs deleted file mode 100644 index 583899910f..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MagneticFieldTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MagneticField. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MagneticFieldTestsBase - { - protected abstract double TeslasInOneTesla { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double TeslasTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MagneticField((double)0.0, MagneticFieldUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MagneticField(double.PositiveInfinity, MagneticFieldUnit.Tesla)); - Assert.Throws(() => new MagneticField(double.NegativeInfinity, MagneticFieldUnit.Tesla)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MagneticField(double.NaN, MagneticFieldUnit.Tesla)); - } - - [Fact] - public void TeslaToMagneticFieldUnits() - { - MagneticField tesla = MagneticField.FromTeslas(1); - AssertEx.EqualTolerance(TeslasInOneTesla, tesla.Teslas, TeslasTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MagneticField.From(1, MagneticFieldUnit.Tesla).Teslas, TeslasTolerance); - } - - [Fact] - public void FromTeslas_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MagneticField.FromTeslas(double.PositiveInfinity)); - Assert.Throws(() => MagneticField.FromTeslas(double.NegativeInfinity)); - } - - [Fact] - public void FromTeslas_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MagneticField.FromTeslas(double.NaN)); - } - - [Fact] - public void As() - { - var tesla = MagneticField.FromTeslas(1); - AssertEx.EqualTolerance(TeslasInOneTesla, tesla.As(MagneticFieldUnit.Tesla), TeslasTolerance); - } - - [Fact] - public void ToUnit() - { - var tesla = MagneticField.FromTeslas(1); - - var teslaQuantity = tesla.ToUnit(MagneticFieldUnit.Tesla); - AssertEx.EqualTolerance(TeslasInOneTesla, (double)teslaQuantity.Value, TeslasTolerance); - Assert.Equal(MagneticFieldUnit.Tesla, teslaQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MagneticField tesla = MagneticField.FromTeslas(1); - AssertEx.EqualTolerance(1, MagneticField.FromTeslas(tesla.Teslas).Teslas, TeslasTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MagneticField v = MagneticField.FromTeslas(1); - AssertEx.EqualTolerance(-1, -v.Teslas, TeslasTolerance); - AssertEx.EqualTolerance(2, (MagneticField.FromTeslas(3)-v).Teslas, TeslasTolerance); - AssertEx.EqualTolerance(2, (v + v).Teslas, TeslasTolerance); - AssertEx.EqualTolerance(10, (v*10).Teslas, TeslasTolerance); - AssertEx.EqualTolerance(10, (10*v).Teslas, TeslasTolerance); - AssertEx.EqualTolerance(2, (MagneticField.FromTeslas(10)/5).Teslas, TeslasTolerance); - AssertEx.EqualTolerance(2, MagneticField.FromTeslas(10)/MagneticField.FromTeslas(5), TeslasTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MagneticField oneTesla = MagneticField.FromTeslas(1); - MagneticField twoTeslas = MagneticField.FromTeslas(2); - - Assert.True(oneTesla < twoTeslas); - Assert.True(oneTesla <= twoTeslas); - Assert.True(twoTeslas > oneTesla); - Assert.True(twoTeslas >= oneTesla); - - Assert.False(oneTesla > twoTeslas); - Assert.False(oneTesla >= twoTeslas); - Assert.False(twoTeslas < oneTesla); - Assert.False(twoTeslas <= oneTesla); - } - - [Fact] - public void CompareToIsImplemented() - { - MagneticField tesla = MagneticField.FromTeslas(1); - Assert.Equal(0, tesla.CompareTo(tesla)); - Assert.True(tesla.CompareTo(MagneticField.Zero) > 0); - Assert.True(MagneticField.Zero.CompareTo(tesla) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MagneticField tesla = MagneticField.FromTeslas(1); - Assert.Throws(() => tesla.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MagneticField tesla = MagneticField.FromTeslas(1); - Assert.Throws(() => tesla.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MagneticField v = MagneticField.FromTeslas(1); - Assert.True(v.Equals(MagneticField.FromTeslas(1), TeslasTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MagneticField.Zero, TeslasTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MagneticField tesla = MagneticField.FromTeslas(1); - Assert.False(tesla.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MagneticField tesla = MagneticField.FromTeslas(1); - Assert.False(tesla.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MagneticFieldUnit.Undefined, MagneticField.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MagneticFieldUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MagneticFieldUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs deleted file mode 100644 index ccdfe5ce08..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MagneticFluxTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MagneticFlux. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MagneticFluxTestsBase - { - protected abstract double WebersInOneWeber { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double WebersTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MagneticFlux((double)0.0, MagneticFluxUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MagneticFlux(double.PositiveInfinity, MagneticFluxUnit.Weber)); - Assert.Throws(() => new MagneticFlux(double.NegativeInfinity, MagneticFluxUnit.Weber)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MagneticFlux(double.NaN, MagneticFluxUnit.Weber)); - } - - [Fact] - public void WeberToMagneticFluxUnits() - { - MagneticFlux weber = MagneticFlux.FromWebers(1); - AssertEx.EqualTolerance(WebersInOneWeber, weber.Webers, WebersTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MagneticFlux.From(1, MagneticFluxUnit.Weber).Webers, WebersTolerance); - } - - [Fact] - public void FromWebers_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MagneticFlux.FromWebers(double.PositiveInfinity)); - Assert.Throws(() => MagneticFlux.FromWebers(double.NegativeInfinity)); - } - - [Fact] - public void FromWebers_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MagneticFlux.FromWebers(double.NaN)); - } - - [Fact] - public void As() - { - var weber = MagneticFlux.FromWebers(1); - AssertEx.EqualTolerance(WebersInOneWeber, weber.As(MagneticFluxUnit.Weber), WebersTolerance); - } - - [Fact] - public void ToUnit() - { - var weber = MagneticFlux.FromWebers(1); - - var weberQuantity = weber.ToUnit(MagneticFluxUnit.Weber); - AssertEx.EqualTolerance(WebersInOneWeber, (double)weberQuantity.Value, WebersTolerance); - Assert.Equal(MagneticFluxUnit.Weber, weberQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MagneticFlux weber = MagneticFlux.FromWebers(1); - AssertEx.EqualTolerance(1, MagneticFlux.FromWebers(weber.Webers).Webers, WebersTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MagneticFlux v = MagneticFlux.FromWebers(1); - AssertEx.EqualTolerance(-1, -v.Webers, WebersTolerance); - AssertEx.EqualTolerance(2, (MagneticFlux.FromWebers(3)-v).Webers, WebersTolerance); - AssertEx.EqualTolerance(2, (v + v).Webers, WebersTolerance); - AssertEx.EqualTolerance(10, (v*10).Webers, WebersTolerance); - AssertEx.EqualTolerance(10, (10*v).Webers, WebersTolerance); - AssertEx.EqualTolerance(2, (MagneticFlux.FromWebers(10)/5).Webers, WebersTolerance); - AssertEx.EqualTolerance(2, MagneticFlux.FromWebers(10)/MagneticFlux.FromWebers(5), WebersTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MagneticFlux oneWeber = MagneticFlux.FromWebers(1); - MagneticFlux twoWebers = MagneticFlux.FromWebers(2); - - Assert.True(oneWeber < twoWebers); - Assert.True(oneWeber <= twoWebers); - Assert.True(twoWebers > oneWeber); - Assert.True(twoWebers >= oneWeber); - - Assert.False(oneWeber > twoWebers); - Assert.False(oneWeber >= twoWebers); - Assert.False(twoWebers < oneWeber); - Assert.False(twoWebers <= oneWeber); - } - - [Fact] - public void CompareToIsImplemented() - { - MagneticFlux weber = MagneticFlux.FromWebers(1); - Assert.Equal(0, weber.CompareTo(weber)); - Assert.True(weber.CompareTo(MagneticFlux.Zero) > 0); - Assert.True(MagneticFlux.Zero.CompareTo(weber) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MagneticFlux weber = MagneticFlux.FromWebers(1); - Assert.Throws(() => weber.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MagneticFlux weber = MagneticFlux.FromWebers(1); - Assert.Throws(() => weber.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MagneticFlux v = MagneticFlux.FromWebers(1); - Assert.True(v.Equals(MagneticFlux.FromWebers(1), WebersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MagneticFlux.Zero, WebersTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MagneticFlux weber = MagneticFlux.FromWebers(1); - Assert.False(weber.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MagneticFlux weber = MagneticFlux.FromWebers(1); - Assert.False(weber.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MagneticFluxUnit.Undefined, MagneticFlux.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MagneticFluxUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MagneticFluxUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs deleted file mode 100644 index f6c59a23fd..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MagnetizationTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Magnetization. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MagnetizationTestsBase - { - protected abstract double AmperesPerMeterInOneAmperePerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AmperesPerMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Magnetization((double)0.0, MagnetizationUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Magnetization(double.PositiveInfinity, MagnetizationUnit.AmperePerMeter)); - Assert.Throws(() => new Magnetization(double.NegativeInfinity, MagnetizationUnit.AmperePerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Magnetization(double.NaN, MagnetizationUnit.AmperePerMeter)); - } - - [Fact] - public void AmperePerMeterToMagnetizationUnits() - { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - AssertEx.EqualTolerance(AmperesPerMeterInOneAmperePerMeter, amperepermeter.AmperesPerMeter, AmperesPerMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Magnetization.From(1, MagnetizationUnit.AmperePerMeter).AmperesPerMeter, AmperesPerMeterTolerance); - } - - [Fact] - public void FromAmperesPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromAmperesPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Magnetization.FromAmperesPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var amperepermeter = Magnetization.FromAmperesPerMeter(1); - AssertEx.EqualTolerance(AmperesPerMeterInOneAmperePerMeter, amperepermeter.As(MagnetizationUnit.AmperePerMeter), AmperesPerMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var amperepermeter = Magnetization.FromAmperesPerMeter(1); - - var amperepermeterQuantity = amperepermeter.ToUnit(MagnetizationUnit.AmperePerMeter); - AssertEx.EqualTolerance(AmperesPerMeterInOneAmperePerMeter, (double)amperepermeterQuantity.Value, AmperesPerMeterTolerance); - Assert.Equal(MagnetizationUnit.AmperePerMeter, amperepermeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - AssertEx.EqualTolerance(1, Magnetization.FromAmperesPerMeter(amperepermeter.AmperesPerMeter).AmperesPerMeter, AmperesPerMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Magnetization v = Magnetization.FromAmperesPerMeter(1); - AssertEx.EqualTolerance(-1, -v.AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Magnetization.FromAmperesPerMeter(3)-v).AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Magnetization.FromAmperesPerMeter(10)/5).AmperesPerMeter, AmperesPerMeterTolerance); - AssertEx.EqualTolerance(2, Magnetization.FromAmperesPerMeter(10)/Magnetization.FromAmperesPerMeter(5), AmperesPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Magnetization oneAmperePerMeter = Magnetization.FromAmperesPerMeter(1); - Magnetization twoAmperesPerMeter = Magnetization.FromAmperesPerMeter(2); - - Assert.True(oneAmperePerMeter < twoAmperesPerMeter); - Assert.True(oneAmperePerMeter <= twoAmperesPerMeter); - Assert.True(twoAmperesPerMeter > oneAmperePerMeter); - Assert.True(twoAmperesPerMeter >= oneAmperePerMeter); - - Assert.False(oneAmperePerMeter > twoAmperesPerMeter); - Assert.False(oneAmperePerMeter >= twoAmperesPerMeter); - Assert.False(twoAmperesPerMeter < oneAmperePerMeter); - Assert.False(twoAmperesPerMeter <= oneAmperePerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - Assert.Equal(0, amperepermeter.CompareTo(amperepermeter)); - Assert.True(amperepermeter.CompareTo(Magnetization.Zero) > 0); - Assert.True(Magnetization.Zero.CompareTo(amperepermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - Assert.Throws(() => amperepermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - Assert.Throws(() => amperepermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Magnetization v = Magnetization.FromAmperesPerMeter(1); - Assert.True(v.Equals(Magnetization.FromAmperesPerMeter(1), AmperesPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Magnetization.Zero, AmperesPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - Assert.False(amperepermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Magnetization amperepermeter = Magnetization.FromAmperesPerMeter(1); - Assert.False(amperepermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MagnetizationUnit.Undefined, Magnetization.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MagnetizationUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MagnetizationUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs deleted file mode 100644 index 5cc46b5239..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MassFlowTestsBase.g.cs +++ /dev/null @@ -1,364 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MassFlow. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MassFlowTestsBase - { - protected abstract double CentigramsPerSecondInOneGramPerSecond { get; } - protected abstract double DecagramsPerSecondInOneGramPerSecond { get; } - protected abstract double DecigramsPerSecondInOneGramPerSecond { get; } - protected abstract double GramsPerSecondInOneGramPerSecond { get; } - protected abstract double HectogramsPerSecondInOneGramPerSecond { get; } - protected abstract double KilogramsPerHourInOneGramPerSecond { get; } - protected abstract double KilogramsPerSecondInOneGramPerSecond { get; } - protected abstract double MegapoundsPerHourInOneGramPerSecond { get; } - protected abstract double MicrogramsPerSecondInOneGramPerSecond { get; } - protected abstract double MilligramsPerSecondInOneGramPerSecond { get; } - protected abstract double NanogramsPerSecondInOneGramPerSecond { get; } - protected abstract double PoundsPerHourInOneGramPerSecond { get; } - protected abstract double ShortTonsPerHourInOneGramPerSecond { get; } - protected abstract double TonnesPerDayInOneGramPerSecond { get; } - protected abstract double TonnesPerHourInOneGramPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentigramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecagramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecigramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double GramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double HectogramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerHourTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MegapoundsPerHourTolerance { get { return 1e-5; } } - protected virtual double MicrogramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MilligramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double NanogramsPerSecondTolerance { get { return 1e-5; } } - protected virtual double PoundsPerHourTolerance { get { return 1e-5; } } - protected virtual double ShortTonsPerHourTolerance { get { return 1e-5; } } - protected virtual double TonnesPerDayTolerance { get { return 1e-5; } } - protected virtual double TonnesPerHourTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MassFlow((double)0.0, MassFlowUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MassFlow(double.PositiveInfinity, MassFlowUnit.GramPerSecond)); - Assert.Throws(() => new MassFlow(double.NegativeInfinity, MassFlowUnit.GramPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MassFlow(double.NaN, MassFlowUnit.GramPerSecond)); - } - - [Fact] - public void GramPerSecondToMassFlowUnits() - { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - AssertEx.EqualTolerance(CentigramsPerSecondInOneGramPerSecond, grampersecond.CentigramsPerSecond, CentigramsPerSecondTolerance); - AssertEx.EqualTolerance(DecagramsPerSecondInOneGramPerSecond, grampersecond.DecagramsPerSecond, DecagramsPerSecondTolerance); - AssertEx.EqualTolerance(DecigramsPerSecondInOneGramPerSecond, grampersecond.DecigramsPerSecond, DecigramsPerSecondTolerance); - AssertEx.EqualTolerance(GramsPerSecondInOneGramPerSecond, grampersecond.GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(HectogramsPerSecondInOneGramPerSecond, grampersecond.HectogramsPerSecond, HectogramsPerSecondTolerance); - AssertEx.EqualTolerance(KilogramsPerHourInOneGramPerSecond, grampersecond.KilogramsPerHour, KilogramsPerHourTolerance); - AssertEx.EqualTolerance(KilogramsPerSecondInOneGramPerSecond, grampersecond.KilogramsPerSecond, KilogramsPerSecondTolerance); - AssertEx.EqualTolerance(MegapoundsPerHourInOneGramPerSecond, grampersecond.MegapoundsPerHour, MegapoundsPerHourTolerance); - AssertEx.EqualTolerance(MicrogramsPerSecondInOneGramPerSecond, grampersecond.MicrogramsPerSecond, MicrogramsPerSecondTolerance); - AssertEx.EqualTolerance(MilligramsPerSecondInOneGramPerSecond, grampersecond.MilligramsPerSecond, MilligramsPerSecondTolerance); - AssertEx.EqualTolerance(NanogramsPerSecondInOneGramPerSecond, grampersecond.NanogramsPerSecond, NanogramsPerSecondTolerance); - AssertEx.EqualTolerance(PoundsPerHourInOneGramPerSecond, grampersecond.PoundsPerHour, PoundsPerHourTolerance); - AssertEx.EqualTolerance(ShortTonsPerHourInOneGramPerSecond, grampersecond.ShortTonsPerHour, ShortTonsPerHourTolerance); - AssertEx.EqualTolerance(TonnesPerDayInOneGramPerSecond, grampersecond.TonnesPerDay, TonnesPerDayTolerance); - AssertEx.EqualTolerance(TonnesPerHourInOneGramPerSecond, grampersecond.TonnesPerHour, TonnesPerHourTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.CentigramPerSecond).CentigramsPerSecond, CentigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecagramPerSecond).DecagramsPerSecond, DecagramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.DecigramPerSecond).DecigramsPerSecond, DecigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.GramPerSecond).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.HectogramPerSecond).HectogramsPerSecond, HectogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerHour).KilogramsPerHour, KilogramsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.KilogramPerSecond).KilogramsPerSecond, KilogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MegapoundPerHour).MegapoundsPerHour, MegapoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MicrogramPerSecond).MicrogramsPerSecond, MicrogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.MilligramPerSecond).MilligramsPerSecond, MilligramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.NanogramPerSecond).NanogramsPerSecond, NanogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.PoundPerHour).PoundsPerHour, PoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.ShortTonPerHour).ShortTonsPerHour, ShortTonsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerDay).TonnesPerDay, TonnesPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.From(1, MassFlowUnit.TonnePerHour).TonnesPerHour, TonnesPerHourTolerance); - } - - [Fact] - public void FromGramsPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromGramsPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MassFlow.FromGramsPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var grampersecond = MassFlow.FromGramsPerSecond(1); - AssertEx.EqualTolerance(CentigramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.CentigramPerSecond), CentigramsPerSecondTolerance); - AssertEx.EqualTolerance(DecagramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.DecagramPerSecond), DecagramsPerSecondTolerance); - AssertEx.EqualTolerance(DecigramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.DecigramPerSecond), DecigramsPerSecondTolerance); - AssertEx.EqualTolerance(GramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.GramPerSecond), GramsPerSecondTolerance); - AssertEx.EqualTolerance(HectogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.HectogramPerSecond), HectogramsPerSecondTolerance); - AssertEx.EqualTolerance(KilogramsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerHour), KilogramsPerHourTolerance); - AssertEx.EqualTolerance(KilogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.KilogramPerSecond), KilogramsPerSecondTolerance); - AssertEx.EqualTolerance(MegapoundsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.MegapoundPerHour), MegapoundsPerHourTolerance); - AssertEx.EqualTolerance(MicrogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MicrogramPerSecond), MicrogramsPerSecondTolerance); - AssertEx.EqualTolerance(MilligramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.MilligramPerSecond), MilligramsPerSecondTolerance); - AssertEx.EqualTolerance(NanogramsPerSecondInOneGramPerSecond, grampersecond.As(MassFlowUnit.NanogramPerSecond), NanogramsPerSecondTolerance); - AssertEx.EqualTolerance(PoundsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.PoundPerHour), PoundsPerHourTolerance); - AssertEx.EqualTolerance(ShortTonsPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.ShortTonPerHour), ShortTonsPerHourTolerance); - AssertEx.EqualTolerance(TonnesPerDayInOneGramPerSecond, grampersecond.As(MassFlowUnit.TonnePerDay), TonnesPerDayTolerance); - AssertEx.EqualTolerance(TonnesPerHourInOneGramPerSecond, grampersecond.As(MassFlowUnit.TonnePerHour), TonnesPerHourTolerance); - } - - [Fact] - public void ToUnit() - { - var grampersecond = MassFlow.FromGramsPerSecond(1); - - var centigrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.CentigramPerSecond); - AssertEx.EqualTolerance(CentigramsPerSecondInOneGramPerSecond, (double)centigrampersecondQuantity.Value, CentigramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.CentigramPerSecond, centigrampersecondQuantity.Unit); - - var decagrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.DecagramPerSecond); - AssertEx.EqualTolerance(DecagramsPerSecondInOneGramPerSecond, (double)decagrampersecondQuantity.Value, DecagramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.DecagramPerSecond, decagrampersecondQuantity.Unit); - - var decigrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.DecigramPerSecond); - AssertEx.EqualTolerance(DecigramsPerSecondInOneGramPerSecond, (double)decigrampersecondQuantity.Value, DecigramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.DecigramPerSecond, decigrampersecondQuantity.Unit); - - var grampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.GramPerSecond); - AssertEx.EqualTolerance(GramsPerSecondInOneGramPerSecond, (double)grampersecondQuantity.Value, GramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.GramPerSecond, grampersecondQuantity.Unit); - - var hectogrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.HectogramPerSecond); - AssertEx.EqualTolerance(HectogramsPerSecondInOneGramPerSecond, (double)hectogrampersecondQuantity.Value, HectogramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.HectogramPerSecond, hectogrampersecondQuantity.Unit); - - var kilogramperhourQuantity = grampersecond.ToUnit(MassFlowUnit.KilogramPerHour); - AssertEx.EqualTolerance(KilogramsPerHourInOneGramPerSecond, (double)kilogramperhourQuantity.Value, KilogramsPerHourTolerance); - Assert.Equal(MassFlowUnit.KilogramPerHour, kilogramperhourQuantity.Unit); - - var kilogrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.KilogramPerSecond); - AssertEx.EqualTolerance(KilogramsPerSecondInOneGramPerSecond, (double)kilogrampersecondQuantity.Value, KilogramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.KilogramPerSecond, kilogrampersecondQuantity.Unit); - - var megapoundperhourQuantity = grampersecond.ToUnit(MassFlowUnit.MegapoundPerHour); - AssertEx.EqualTolerance(MegapoundsPerHourInOneGramPerSecond, (double)megapoundperhourQuantity.Value, MegapoundsPerHourTolerance); - Assert.Equal(MassFlowUnit.MegapoundPerHour, megapoundperhourQuantity.Unit); - - var microgrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.MicrogramPerSecond); - AssertEx.EqualTolerance(MicrogramsPerSecondInOneGramPerSecond, (double)microgrampersecondQuantity.Value, MicrogramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.MicrogramPerSecond, microgrampersecondQuantity.Unit); - - var milligrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.MilligramPerSecond); - AssertEx.EqualTolerance(MilligramsPerSecondInOneGramPerSecond, (double)milligrampersecondQuantity.Value, MilligramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.MilligramPerSecond, milligrampersecondQuantity.Unit); - - var nanogrampersecondQuantity = grampersecond.ToUnit(MassFlowUnit.NanogramPerSecond); - AssertEx.EqualTolerance(NanogramsPerSecondInOneGramPerSecond, (double)nanogrampersecondQuantity.Value, NanogramsPerSecondTolerance); - Assert.Equal(MassFlowUnit.NanogramPerSecond, nanogrampersecondQuantity.Unit); - - var poundperhourQuantity = grampersecond.ToUnit(MassFlowUnit.PoundPerHour); - AssertEx.EqualTolerance(PoundsPerHourInOneGramPerSecond, (double)poundperhourQuantity.Value, PoundsPerHourTolerance); - Assert.Equal(MassFlowUnit.PoundPerHour, poundperhourQuantity.Unit); - - var shorttonperhourQuantity = grampersecond.ToUnit(MassFlowUnit.ShortTonPerHour); - AssertEx.EqualTolerance(ShortTonsPerHourInOneGramPerSecond, (double)shorttonperhourQuantity.Value, ShortTonsPerHourTolerance); - Assert.Equal(MassFlowUnit.ShortTonPerHour, shorttonperhourQuantity.Unit); - - var tonneperdayQuantity = grampersecond.ToUnit(MassFlowUnit.TonnePerDay); - AssertEx.EqualTolerance(TonnesPerDayInOneGramPerSecond, (double)tonneperdayQuantity.Value, TonnesPerDayTolerance); - Assert.Equal(MassFlowUnit.TonnePerDay, tonneperdayQuantity.Unit); - - var tonneperhourQuantity = grampersecond.ToUnit(MassFlowUnit.TonnePerHour); - AssertEx.EqualTolerance(TonnesPerHourInOneGramPerSecond, (double)tonneperhourQuantity.Value, TonnesPerHourTolerance); - Assert.Equal(MassFlowUnit.TonnePerHour, tonneperhourQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - AssertEx.EqualTolerance(1, MassFlow.FromCentigramsPerSecond(grampersecond.CentigramsPerSecond).GramsPerSecond, CentigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromDecagramsPerSecond(grampersecond.DecagramsPerSecond).GramsPerSecond, DecagramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromDecigramsPerSecond(grampersecond.DecigramsPerSecond).GramsPerSecond, DecigramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromGramsPerSecond(grampersecond.GramsPerSecond).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromHectogramsPerSecond(grampersecond.HectogramsPerSecond).GramsPerSecond, HectogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerHour(grampersecond.KilogramsPerHour).GramsPerSecond, KilogramsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromKilogramsPerSecond(grampersecond.KilogramsPerSecond).GramsPerSecond, KilogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMegapoundsPerHour(grampersecond.MegapoundsPerHour).GramsPerSecond, MegapoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMicrogramsPerSecond(grampersecond.MicrogramsPerSecond).GramsPerSecond, MicrogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromMilligramsPerSecond(grampersecond.MilligramsPerSecond).GramsPerSecond, MilligramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromNanogramsPerSecond(grampersecond.NanogramsPerSecond).GramsPerSecond, NanogramsPerSecondTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromPoundsPerHour(grampersecond.PoundsPerHour).GramsPerSecond, PoundsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromShortTonsPerHour(grampersecond.ShortTonsPerHour).GramsPerSecond, ShortTonsPerHourTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromTonnesPerDay(grampersecond.TonnesPerDay).GramsPerSecond, TonnesPerDayTolerance); - AssertEx.EqualTolerance(1, MassFlow.FromTonnesPerHour(grampersecond.TonnesPerHour).GramsPerSecond, TonnesPerHourTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MassFlow v = MassFlow.FromGramsPerSecond(1); - AssertEx.EqualTolerance(-1, -v.GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(2, (MassFlow.FromGramsPerSecond(3)-v).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(2, (MassFlow.FromGramsPerSecond(10)/5).GramsPerSecond, GramsPerSecondTolerance); - AssertEx.EqualTolerance(2, MassFlow.FromGramsPerSecond(10)/MassFlow.FromGramsPerSecond(5), GramsPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MassFlow oneGramPerSecond = MassFlow.FromGramsPerSecond(1); - MassFlow twoGramsPerSecond = MassFlow.FromGramsPerSecond(2); - - Assert.True(oneGramPerSecond < twoGramsPerSecond); - Assert.True(oneGramPerSecond <= twoGramsPerSecond); - Assert.True(twoGramsPerSecond > oneGramPerSecond); - Assert.True(twoGramsPerSecond >= oneGramPerSecond); - - Assert.False(oneGramPerSecond > twoGramsPerSecond); - Assert.False(oneGramPerSecond >= twoGramsPerSecond); - Assert.False(twoGramsPerSecond < oneGramPerSecond); - Assert.False(twoGramsPerSecond <= oneGramPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - Assert.Equal(0, grampersecond.CompareTo(grampersecond)); - Assert.True(grampersecond.CompareTo(MassFlow.Zero) > 0); - Assert.True(MassFlow.Zero.CompareTo(grampersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - Assert.Throws(() => grampersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - Assert.Throws(() => grampersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MassFlow v = MassFlow.FromGramsPerSecond(1); - Assert.True(v.Equals(MassFlow.FromGramsPerSecond(1), GramsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassFlow.Zero, GramsPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - Assert.False(grampersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MassFlow grampersecond = MassFlow.FromGramsPerSecond(1); - Assert.False(grampersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MassFlowUnit.Undefined, MassFlow.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MassFlowUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MassFlowUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs deleted file mode 100644 index c115b35589..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MassFluxTestsBase.g.cs +++ /dev/null @@ -1,234 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MassFlux. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MassFluxTestsBase - { - protected abstract double GramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter { get; } - protected abstract double KilogramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double GramsPerSecondPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerSecondPerSquareMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MassFlux((double)0.0, MassFluxUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MassFlux(double.PositiveInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); - Assert.Throws(() => new MassFlux(double.NegativeInfinity, MassFluxUnit.KilogramPerSecondPerSquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MassFlux(double.NaN, MassFluxUnit.KilogramPerSecondPerSquareMeter)); - } - - [Fact] - public void KilogramPerSecondPerSquareMeterToMassFluxUnits() - { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - AssertEx.EqualTolerance(GramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.GramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilogramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.GramPerSecondPerSquareMeter).GramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, MassFlux.From(1, MassFluxUnit.KilogramPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - } - - [Fact] - public void FromKilogramsPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.PositiveInfinity)); - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromKilogramsPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MassFlux.FromKilogramsPerSecondPerSquareMeter(double.NaN)); - } - - [Fact] - public void As() - { - var kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - AssertEx.EqualTolerance(GramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.As(MassFluxUnit.GramPerSecondPerSquareMeter), GramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilogramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeter.As(MassFluxUnit.KilogramPerSecondPerSquareMeter), KilogramsPerSecondPerSquareMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - - var grampersecondpersquaremeterQuantity = kilogrampersecondpersquaremeter.ToUnit(MassFluxUnit.GramPerSecondPerSquareMeter); - AssertEx.EqualTolerance(GramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, (double)grampersecondpersquaremeterQuantity.Value, GramsPerSecondPerSquareMeterTolerance); - Assert.Equal(MassFluxUnit.GramPerSecondPerSquareMeter, grampersecondpersquaremeterQuantity.Unit); - - var kilogrampersecondpersquaremeterQuantity = kilogrampersecondpersquaremeter.ToUnit(MassFluxUnit.KilogramPerSecondPerSquareMeter); - AssertEx.EqualTolerance(KilogramsPerSecondPerSquareMeterInOneKilogramPerSecondPerSquareMeter, (double)kilogrampersecondpersquaremeterQuantity.Value, KilogramsPerSecondPerSquareMeterTolerance); - Assert.Equal(MassFluxUnit.KilogramPerSecondPerSquareMeter, kilogrampersecondpersquaremeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - AssertEx.EqualTolerance(1, MassFlux.FromGramsPerSecondPerSquareMeter(kilogrampersecondpersquaremeter.GramsPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, GramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, MassFlux.FromKilogramsPerSecondPerSquareMeter(kilogrampersecondpersquaremeter.KilogramsPerSecondPerSquareMeter).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MassFlux v = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - AssertEx.EqualTolerance(-1, -v.KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (MassFlux.FromKilogramsPerSecondPerSquareMeter(3)-v).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, (MassFlux.FromKilogramsPerSecondPerSquareMeter(10)/5).KilogramsPerSecondPerSquareMeter, KilogramsPerSecondPerSquareMeterTolerance); - AssertEx.EqualTolerance(2, MassFlux.FromKilogramsPerSecondPerSquareMeter(10)/MassFlux.FromKilogramsPerSecondPerSquareMeter(5), KilogramsPerSecondPerSquareMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MassFlux oneKilogramPerSecondPerSquareMeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - MassFlux twoKilogramsPerSecondPerSquareMeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(2); - - Assert.True(oneKilogramPerSecondPerSquareMeter < twoKilogramsPerSecondPerSquareMeter); - Assert.True(oneKilogramPerSecondPerSquareMeter <= twoKilogramsPerSecondPerSquareMeter); - Assert.True(twoKilogramsPerSecondPerSquareMeter > oneKilogramPerSecondPerSquareMeter); - Assert.True(twoKilogramsPerSecondPerSquareMeter >= oneKilogramPerSecondPerSquareMeter); - - Assert.False(oneKilogramPerSecondPerSquareMeter > twoKilogramsPerSecondPerSquareMeter); - Assert.False(oneKilogramPerSecondPerSquareMeter >= twoKilogramsPerSecondPerSquareMeter); - Assert.False(twoKilogramsPerSecondPerSquareMeter < oneKilogramPerSecondPerSquareMeter); - Assert.False(twoKilogramsPerSecondPerSquareMeter <= oneKilogramPerSecondPerSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.Equal(0, kilogrampersecondpersquaremeter.CompareTo(kilogrampersecondpersquaremeter)); - Assert.True(kilogrampersecondpersquaremeter.CompareTo(MassFlux.Zero) > 0); - Assert.True(MassFlux.Zero.CompareTo(kilogrampersecondpersquaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.Throws(() => kilogrampersecondpersquaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.Throws(() => kilogrampersecondpersquaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MassFlux v = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.True(v.Equals(MassFlux.FromKilogramsPerSecondPerSquareMeter(1), KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassFlux.Zero, KilogramsPerSecondPerSquareMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.False(kilogrampersecondpersquaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MassFlux kilogrampersecondpersquaremeter = MassFlux.FromKilogramsPerSecondPerSquareMeter(1); - Assert.False(kilogrampersecondpersquaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MassFluxUnit.Undefined, MassFlux.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MassFluxUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MassFluxUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs deleted file mode 100644 index 72152d393a..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MassMomentOfInertiaTestsBase.g.cs +++ /dev/null @@ -1,494 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MassMomentOfInertia. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MassMomentOfInertiaTestsBase - { - protected abstract double GramSquareCentimetersInOneKilogramSquareMeter { get; } - protected abstract double GramSquareDecimetersInOneKilogramSquareMeter { get; } - protected abstract double GramSquareMetersInOneKilogramSquareMeter { get; } - protected abstract double GramSquareMillimetersInOneKilogramSquareMeter { get; } - protected abstract double KilogramSquareCentimetersInOneKilogramSquareMeter { get; } - protected abstract double KilogramSquareDecimetersInOneKilogramSquareMeter { get; } - protected abstract double KilogramSquareMetersInOneKilogramSquareMeter { get; } - protected abstract double KilogramSquareMillimetersInOneKilogramSquareMeter { get; } - protected abstract double KilotonneSquareCentimetersInOneKilogramSquareMeter { get; } - protected abstract double KilotonneSquareDecimetersInOneKilogramSquareMeter { get; } - protected abstract double KilotonneSquareMetersInOneKilogramSquareMeter { get; } - protected abstract double KilotonneSquareMilimetersInOneKilogramSquareMeter { get; } - protected abstract double MegatonneSquareCentimetersInOneKilogramSquareMeter { get; } - protected abstract double MegatonneSquareDecimetersInOneKilogramSquareMeter { get; } - protected abstract double MegatonneSquareMetersInOneKilogramSquareMeter { get; } - protected abstract double MegatonneSquareMilimetersInOneKilogramSquareMeter { get; } - protected abstract double MilligramSquareCentimetersInOneKilogramSquareMeter { get; } - protected abstract double MilligramSquareDecimetersInOneKilogramSquareMeter { get; } - protected abstract double MilligramSquareMetersInOneKilogramSquareMeter { get; } - protected abstract double MilligramSquareMillimetersInOneKilogramSquareMeter { get; } - protected abstract double PoundSquareFeetInOneKilogramSquareMeter { get; } - protected abstract double PoundSquareInchesInOneKilogramSquareMeter { get; } - protected abstract double SlugSquareFeetInOneKilogramSquareMeter { get; } - protected abstract double SlugSquareInchesInOneKilogramSquareMeter { get; } - protected abstract double TonneSquareCentimetersInOneKilogramSquareMeter { get; } - protected abstract double TonneSquareDecimetersInOneKilogramSquareMeter { get; } - protected abstract double TonneSquareMetersInOneKilogramSquareMeter { get; } - protected abstract double TonneSquareMilimetersInOneKilogramSquareMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double GramSquareCentimetersTolerance { get { return 1e-5; } } - protected virtual double GramSquareDecimetersTolerance { get { return 1e-5; } } - protected virtual double GramSquareMetersTolerance { get { return 1e-5; } } - protected virtual double GramSquareMillimetersTolerance { get { return 1e-5; } } - protected virtual double KilogramSquareCentimetersTolerance { get { return 1e-5; } } - protected virtual double KilogramSquareDecimetersTolerance { get { return 1e-5; } } - protected virtual double KilogramSquareMetersTolerance { get { return 1e-5; } } - protected virtual double KilogramSquareMillimetersTolerance { get { return 1e-5; } } - protected virtual double KilotonneSquareCentimetersTolerance { get { return 1e-5; } } - protected virtual double KilotonneSquareDecimetersTolerance { get { return 1e-5; } } - protected virtual double KilotonneSquareMetersTolerance { get { return 1e-5; } } - protected virtual double KilotonneSquareMilimetersTolerance { get { return 1e-5; } } - protected virtual double MegatonneSquareCentimetersTolerance { get { return 1e-5; } } - protected virtual double MegatonneSquareDecimetersTolerance { get { return 1e-5; } } - protected virtual double MegatonneSquareMetersTolerance { get { return 1e-5; } } - protected virtual double MegatonneSquareMilimetersTolerance { get { return 1e-5; } } - protected virtual double MilligramSquareCentimetersTolerance { get { return 1e-5; } } - protected virtual double MilligramSquareDecimetersTolerance { get { return 1e-5; } } - protected virtual double MilligramSquareMetersTolerance { get { return 1e-5; } } - protected virtual double MilligramSquareMillimetersTolerance { get { return 1e-5; } } - protected virtual double PoundSquareFeetTolerance { get { return 1e-5; } } - protected virtual double PoundSquareInchesTolerance { get { return 1e-5; } } - protected virtual double SlugSquareFeetTolerance { get { return 1e-5; } } - protected virtual double SlugSquareInchesTolerance { get { return 1e-5; } } - protected virtual double TonneSquareCentimetersTolerance { get { return 1e-5; } } - protected virtual double TonneSquareDecimetersTolerance { get { return 1e-5; } } - protected virtual double TonneSquareMetersTolerance { get { return 1e-5; } } - protected virtual double TonneSquareMilimetersTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MassMomentOfInertia((double)0.0, MassMomentOfInertiaUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MassMomentOfInertia(double.PositiveInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); - Assert.Throws(() => new MassMomentOfInertia(double.NegativeInfinity, MassMomentOfInertiaUnit.KilogramSquareMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MassMomentOfInertia(double.NaN, MassMomentOfInertiaUnit.KilogramSquareMeter)); - } - - [Fact] - public void KilogramSquareMeterToMassMomentOfInertiaUnits() - { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - AssertEx.EqualTolerance(GramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.GramSquareCentimeters, GramSquareCentimetersTolerance); - AssertEx.EqualTolerance(GramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.GramSquareDecimeters, GramSquareDecimetersTolerance); - AssertEx.EqualTolerance(GramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.GramSquareMeters, GramSquareMetersTolerance); - AssertEx.EqualTolerance(GramSquareMillimetersInOneKilogramSquareMeter, kilogramsquaremeter.GramSquareMillimeters, GramSquareMillimetersTolerance); - AssertEx.EqualTolerance(KilogramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.KilogramSquareCentimeters, KilogramSquareCentimetersTolerance); - AssertEx.EqualTolerance(KilogramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.KilogramSquareDecimeters, KilogramSquareDecimetersTolerance); - AssertEx.EqualTolerance(KilogramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(KilogramSquareMillimetersInOneKilogramSquareMeter, kilogramsquaremeter.KilogramSquareMillimeters, KilogramSquareMillimetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.KilotonneSquareCentimeters, KilotonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.KilotonneSquareDecimeters, KilotonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.KilotonneSquareMeters, KilotonneSquareMetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareMilimetersInOneKilogramSquareMeter, kilogramsquaremeter.KilotonneSquareMilimeters, KilotonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.MegatonneSquareCentimeters, MegatonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.MegatonneSquareDecimeters, MegatonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.MegatonneSquareMeters, MegatonneSquareMetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareMilimetersInOneKilogramSquareMeter, kilogramsquaremeter.MegatonneSquareMilimeters, MegatonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(MilligramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.MilligramSquareCentimeters, MilligramSquareCentimetersTolerance); - AssertEx.EqualTolerance(MilligramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.MilligramSquareDecimeters, MilligramSquareDecimetersTolerance); - AssertEx.EqualTolerance(MilligramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.MilligramSquareMeters, MilligramSquareMetersTolerance); - AssertEx.EqualTolerance(MilligramSquareMillimetersInOneKilogramSquareMeter, kilogramsquaremeter.MilligramSquareMillimeters, MilligramSquareMillimetersTolerance); - AssertEx.EqualTolerance(PoundSquareFeetInOneKilogramSquareMeter, kilogramsquaremeter.PoundSquareFeet, PoundSquareFeetTolerance); - AssertEx.EqualTolerance(PoundSquareInchesInOneKilogramSquareMeter, kilogramsquaremeter.PoundSquareInches, PoundSquareInchesTolerance); - AssertEx.EqualTolerance(SlugSquareFeetInOneKilogramSquareMeter, kilogramsquaremeter.SlugSquareFeet, SlugSquareFeetTolerance); - AssertEx.EqualTolerance(SlugSquareInchesInOneKilogramSquareMeter, kilogramsquaremeter.SlugSquareInches, SlugSquareInchesTolerance); - AssertEx.EqualTolerance(TonneSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.TonneSquareCentimeters, TonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(TonneSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.TonneSquareDecimeters, TonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(TonneSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.TonneSquareMeters, TonneSquareMetersTolerance); - AssertEx.EqualTolerance(TonneSquareMilimetersInOneKilogramSquareMeter, kilogramsquaremeter.TonneSquareMilimeters, TonneSquareMilimetersTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareCentimeter).GramSquareCentimeters, GramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareDecimeter).GramSquareDecimeters, GramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareMeter).GramSquareMeters, GramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.GramSquareMillimeter).GramSquareMillimeters, GramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareCentimeter).KilogramSquareCentimeters, KilogramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareDecimeter).KilogramSquareDecimeters, KilogramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareMeter).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilogramSquareMillimeter).KilogramSquareMillimeters, KilogramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareCentimeter).KilotonneSquareCentimeters, KilotonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareDecimeter).KilotonneSquareDecimeters, KilotonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareMeter).KilotonneSquareMeters, KilotonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.KilotonneSquareMilimeter).KilotonneSquareMilimeters, KilotonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareCentimeter).MegatonneSquareCentimeters, MegatonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareDecimeter).MegatonneSquareDecimeters, MegatonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareMeter).MegatonneSquareMeters, MegatonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MegatonneSquareMilimeter).MegatonneSquareMilimeters, MegatonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareCentimeter).MilligramSquareCentimeters, MilligramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareDecimeter).MilligramSquareDecimeters, MilligramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareMeter).MilligramSquareMeters, MilligramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.MilligramSquareMillimeter).MilligramSquareMillimeters, MilligramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.PoundSquareFoot).PoundSquareFeet, PoundSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.PoundSquareInch).PoundSquareInches, PoundSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.SlugSquareFoot).SlugSquareFeet, SlugSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.SlugSquareInch).SlugSquareInches, SlugSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareCentimeter).TonneSquareCentimeters, TonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareDecimeter).TonneSquareDecimeters, TonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMeter).TonneSquareMeters, TonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.From(1, MassMomentOfInertiaUnit.TonneSquareMilimeter).TonneSquareMilimeters, TonneSquareMilimetersTolerance); - } - - [Fact] - public void FromKilogramSquareMeters_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.PositiveInfinity)); - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NegativeInfinity)); - } - - [Fact] - public void FromKilogramSquareMeters_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MassMomentOfInertia.FromKilogramSquareMeters(double.NaN)); - } - - [Fact] - public void As() - { - var kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - AssertEx.EqualTolerance(GramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.GramSquareCentimeter), GramSquareCentimetersTolerance); - AssertEx.EqualTolerance(GramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.GramSquareDecimeter), GramSquareDecimetersTolerance); - AssertEx.EqualTolerance(GramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.GramSquareMeter), GramSquareMetersTolerance); - AssertEx.EqualTolerance(GramSquareMillimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.GramSquareMillimeter), GramSquareMillimetersTolerance); - AssertEx.EqualTolerance(KilogramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilogramSquareCentimeter), KilogramSquareCentimetersTolerance); - AssertEx.EqualTolerance(KilogramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilogramSquareDecimeter), KilogramSquareDecimetersTolerance); - AssertEx.EqualTolerance(KilogramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilogramSquareMeter), KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(KilogramSquareMillimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilogramSquareMillimeter), KilogramSquareMillimetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilotonneSquareCentimeter), KilotonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilotonneSquareDecimeter), KilotonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilotonneSquareMeter), KilotonneSquareMetersTolerance); - AssertEx.EqualTolerance(KilotonneSquareMilimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.KilotonneSquareMilimeter), KilotonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MegatonneSquareCentimeter), MegatonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MegatonneSquareDecimeter), MegatonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MegatonneSquareMeter), MegatonneSquareMetersTolerance); - AssertEx.EqualTolerance(MegatonneSquareMilimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MegatonneSquareMilimeter), MegatonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(MilligramSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MilligramSquareCentimeter), MilligramSquareCentimetersTolerance); - AssertEx.EqualTolerance(MilligramSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MilligramSquareDecimeter), MilligramSquareDecimetersTolerance); - AssertEx.EqualTolerance(MilligramSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MilligramSquareMeter), MilligramSquareMetersTolerance); - AssertEx.EqualTolerance(MilligramSquareMillimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.MilligramSquareMillimeter), MilligramSquareMillimetersTolerance); - AssertEx.EqualTolerance(PoundSquareFeetInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.PoundSquareFoot), PoundSquareFeetTolerance); - AssertEx.EqualTolerance(PoundSquareInchesInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.PoundSquareInch), PoundSquareInchesTolerance); - AssertEx.EqualTolerance(SlugSquareFeetInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.SlugSquareFoot), SlugSquareFeetTolerance); - AssertEx.EqualTolerance(SlugSquareInchesInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.SlugSquareInch), SlugSquareInchesTolerance); - AssertEx.EqualTolerance(TonneSquareCentimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.TonneSquareCentimeter), TonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(TonneSquareDecimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.TonneSquareDecimeter), TonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(TonneSquareMetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.TonneSquareMeter), TonneSquareMetersTolerance); - AssertEx.EqualTolerance(TonneSquareMilimetersInOneKilogramSquareMeter, kilogramsquaremeter.As(MassMomentOfInertiaUnit.TonneSquareMilimeter), TonneSquareMilimetersTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - - var gramsquarecentimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.GramSquareCentimeter); - AssertEx.EqualTolerance(GramSquareCentimetersInOneKilogramSquareMeter, (double)gramsquarecentimeterQuantity.Value, GramSquareCentimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.GramSquareCentimeter, gramsquarecentimeterQuantity.Unit); - - var gramsquaredecimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.GramSquareDecimeter); - AssertEx.EqualTolerance(GramSquareDecimetersInOneKilogramSquareMeter, (double)gramsquaredecimeterQuantity.Value, GramSquareDecimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.GramSquareDecimeter, gramsquaredecimeterQuantity.Unit); - - var gramsquaremeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.GramSquareMeter); - AssertEx.EqualTolerance(GramSquareMetersInOneKilogramSquareMeter, (double)gramsquaremeterQuantity.Value, GramSquareMetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.GramSquareMeter, gramsquaremeterQuantity.Unit); - - var gramsquaremillimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.GramSquareMillimeter); - AssertEx.EqualTolerance(GramSquareMillimetersInOneKilogramSquareMeter, (double)gramsquaremillimeterQuantity.Value, GramSquareMillimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.GramSquareMillimeter, gramsquaremillimeterQuantity.Unit); - - var kilogramsquarecentimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilogramSquareCentimeter); - AssertEx.EqualTolerance(KilogramSquareCentimetersInOneKilogramSquareMeter, (double)kilogramsquarecentimeterQuantity.Value, KilogramSquareCentimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilogramSquareCentimeter, kilogramsquarecentimeterQuantity.Unit); - - var kilogramsquaredecimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilogramSquareDecimeter); - AssertEx.EqualTolerance(KilogramSquareDecimetersInOneKilogramSquareMeter, (double)kilogramsquaredecimeterQuantity.Value, KilogramSquareDecimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilogramSquareDecimeter, kilogramsquaredecimeterQuantity.Unit); - - var kilogramsquaremeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilogramSquareMeter); - AssertEx.EqualTolerance(KilogramSquareMetersInOneKilogramSquareMeter, (double)kilogramsquaremeterQuantity.Value, KilogramSquareMetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilogramSquareMeter, kilogramsquaremeterQuantity.Unit); - - var kilogramsquaremillimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilogramSquareMillimeter); - AssertEx.EqualTolerance(KilogramSquareMillimetersInOneKilogramSquareMeter, (double)kilogramsquaremillimeterQuantity.Value, KilogramSquareMillimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilogramSquareMillimeter, kilogramsquaremillimeterQuantity.Unit); - - var kilotonnesquarecentimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareCentimeter); - AssertEx.EqualTolerance(KilotonneSquareCentimetersInOneKilogramSquareMeter, (double)kilotonnesquarecentimeterQuantity.Value, KilotonneSquareCentimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilotonneSquareCentimeter, kilotonnesquarecentimeterQuantity.Unit); - - var kilotonnesquaredecimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareDecimeter); - AssertEx.EqualTolerance(KilotonneSquareDecimetersInOneKilogramSquareMeter, (double)kilotonnesquaredecimeterQuantity.Value, KilotonneSquareDecimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilotonneSquareDecimeter, kilotonnesquaredecimeterQuantity.Unit); - - var kilotonnesquaremeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareMeter); - AssertEx.EqualTolerance(KilotonneSquareMetersInOneKilogramSquareMeter, (double)kilotonnesquaremeterQuantity.Value, KilotonneSquareMetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilotonneSquareMeter, kilotonnesquaremeterQuantity.Unit); - - var kilotonnesquaremilimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.KilotonneSquareMilimeter); - AssertEx.EqualTolerance(KilotonneSquareMilimetersInOneKilogramSquareMeter, (double)kilotonnesquaremilimeterQuantity.Value, KilotonneSquareMilimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.KilotonneSquareMilimeter, kilotonnesquaremilimeterQuantity.Unit); - - var megatonnesquarecentimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareCentimeter); - AssertEx.EqualTolerance(MegatonneSquareCentimetersInOneKilogramSquareMeter, (double)megatonnesquarecentimeterQuantity.Value, MegatonneSquareCentimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MegatonneSquareCentimeter, megatonnesquarecentimeterQuantity.Unit); - - var megatonnesquaredecimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareDecimeter); - AssertEx.EqualTolerance(MegatonneSquareDecimetersInOneKilogramSquareMeter, (double)megatonnesquaredecimeterQuantity.Value, MegatonneSquareDecimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MegatonneSquareDecimeter, megatonnesquaredecimeterQuantity.Unit); - - var megatonnesquaremeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareMeter); - AssertEx.EqualTolerance(MegatonneSquareMetersInOneKilogramSquareMeter, (double)megatonnesquaremeterQuantity.Value, MegatonneSquareMetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MegatonneSquareMeter, megatonnesquaremeterQuantity.Unit); - - var megatonnesquaremilimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MegatonneSquareMilimeter); - AssertEx.EqualTolerance(MegatonneSquareMilimetersInOneKilogramSquareMeter, (double)megatonnesquaremilimeterQuantity.Value, MegatonneSquareMilimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MegatonneSquareMilimeter, megatonnesquaremilimeterQuantity.Unit); - - var milligramsquarecentimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MilligramSquareCentimeter); - AssertEx.EqualTolerance(MilligramSquareCentimetersInOneKilogramSquareMeter, (double)milligramsquarecentimeterQuantity.Value, MilligramSquareCentimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MilligramSquareCentimeter, milligramsquarecentimeterQuantity.Unit); - - var milligramsquaredecimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MilligramSquareDecimeter); - AssertEx.EqualTolerance(MilligramSquareDecimetersInOneKilogramSquareMeter, (double)milligramsquaredecimeterQuantity.Value, MilligramSquareDecimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MilligramSquareDecimeter, milligramsquaredecimeterQuantity.Unit); - - var milligramsquaremeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MilligramSquareMeter); - AssertEx.EqualTolerance(MilligramSquareMetersInOneKilogramSquareMeter, (double)milligramsquaremeterQuantity.Value, MilligramSquareMetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MilligramSquareMeter, milligramsquaremeterQuantity.Unit); - - var milligramsquaremillimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.MilligramSquareMillimeter); - AssertEx.EqualTolerance(MilligramSquareMillimetersInOneKilogramSquareMeter, (double)milligramsquaremillimeterQuantity.Value, MilligramSquareMillimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.MilligramSquareMillimeter, milligramsquaremillimeterQuantity.Unit); - - var poundsquarefootQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.PoundSquareFoot); - AssertEx.EqualTolerance(PoundSquareFeetInOneKilogramSquareMeter, (double)poundsquarefootQuantity.Value, PoundSquareFeetTolerance); - Assert.Equal(MassMomentOfInertiaUnit.PoundSquareFoot, poundsquarefootQuantity.Unit); - - var poundsquareinchQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.PoundSquareInch); - AssertEx.EqualTolerance(PoundSquareInchesInOneKilogramSquareMeter, (double)poundsquareinchQuantity.Value, PoundSquareInchesTolerance); - Assert.Equal(MassMomentOfInertiaUnit.PoundSquareInch, poundsquareinchQuantity.Unit); - - var slugsquarefootQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.SlugSquareFoot); - AssertEx.EqualTolerance(SlugSquareFeetInOneKilogramSquareMeter, (double)slugsquarefootQuantity.Value, SlugSquareFeetTolerance); - Assert.Equal(MassMomentOfInertiaUnit.SlugSquareFoot, slugsquarefootQuantity.Unit); - - var slugsquareinchQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.SlugSquareInch); - AssertEx.EqualTolerance(SlugSquareInchesInOneKilogramSquareMeter, (double)slugsquareinchQuantity.Value, SlugSquareInchesTolerance); - Assert.Equal(MassMomentOfInertiaUnit.SlugSquareInch, slugsquareinchQuantity.Unit); - - var tonnesquarecentimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.TonneSquareCentimeter); - AssertEx.EqualTolerance(TonneSquareCentimetersInOneKilogramSquareMeter, (double)tonnesquarecentimeterQuantity.Value, TonneSquareCentimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.TonneSquareCentimeter, tonnesquarecentimeterQuantity.Unit); - - var tonnesquaredecimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.TonneSquareDecimeter); - AssertEx.EqualTolerance(TonneSquareDecimetersInOneKilogramSquareMeter, (double)tonnesquaredecimeterQuantity.Value, TonneSquareDecimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.TonneSquareDecimeter, tonnesquaredecimeterQuantity.Unit); - - var tonnesquaremeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.TonneSquareMeter); - AssertEx.EqualTolerance(TonneSquareMetersInOneKilogramSquareMeter, (double)tonnesquaremeterQuantity.Value, TonneSquareMetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.TonneSquareMeter, tonnesquaremeterQuantity.Unit); - - var tonnesquaremilimeterQuantity = kilogramsquaremeter.ToUnit(MassMomentOfInertiaUnit.TonneSquareMilimeter); - AssertEx.EqualTolerance(TonneSquareMilimetersInOneKilogramSquareMeter, (double)tonnesquaremilimeterQuantity.Value, TonneSquareMilimetersTolerance); - Assert.Equal(MassMomentOfInertiaUnit.TonneSquareMilimeter, tonnesquaremilimeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareCentimeters(kilogramsquaremeter.GramSquareCentimeters).KilogramSquareMeters, GramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareDecimeters(kilogramsquaremeter.GramSquareDecimeters).KilogramSquareMeters, GramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareMeters(kilogramsquaremeter.GramSquareMeters).KilogramSquareMeters, GramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromGramSquareMillimeters(kilogramsquaremeter.GramSquareMillimeters).KilogramSquareMeters, GramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareCentimeters(kilogramsquaremeter.KilogramSquareCentimeters).KilogramSquareMeters, KilogramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareDecimeters(kilogramsquaremeter.KilogramSquareDecimeters).KilogramSquareMeters, KilogramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareMeters(kilogramsquaremeter.KilogramSquareMeters).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilogramSquareMillimeters(kilogramsquaremeter.KilogramSquareMillimeters).KilogramSquareMeters, KilogramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareCentimeters(kilogramsquaremeter.KilotonneSquareCentimeters).KilogramSquareMeters, KilotonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareDecimeters(kilogramsquaremeter.KilotonneSquareDecimeters).KilogramSquareMeters, KilotonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareMeters(kilogramsquaremeter.KilotonneSquareMeters).KilogramSquareMeters, KilotonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromKilotonneSquareMilimeters(kilogramsquaremeter.KilotonneSquareMilimeters).KilogramSquareMeters, KilotonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareCentimeters(kilogramsquaremeter.MegatonneSquareCentimeters).KilogramSquareMeters, MegatonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareDecimeters(kilogramsquaremeter.MegatonneSquareDecimeters).KilogramSquareMeters, MegatonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareMeters(kilogramsquaremeter.MegatonneSquareMeters).KilogramSquareMeters, MegatonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMegatonneSquareMilimeters(kilogramsquaremeter.MegatonneSquareMilimeters).KilogramSquareMeters, MegatonneSquareMilimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareCentimeters(kilogramsquaremeter.MilligramSquareCentimeters).KilogramSquareMeters, MilligramSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareDecimeters(kilogramsquaremeter.MilligramSquareDecimeters).KilogramSquareMeters, MilligramSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareMeters(kilogramsquaremeter.MilligramSquareMeters).KilogramSquareMeters, MilligramSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromMilligramSquareMillimeters(kilogramsquaremeter.MilligramSquareMillimeters).KilogramSquareMeters, MilligramSquareMillimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromPoundSquareFeet(kilogramsquaremeter.PoundSquareFeet).KilogramSquareMeters, PoundSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromPoundSquareInches(kilogramsquaremeter.PoundSquareInches).KilogramSquareMeters, PoundSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromSlugSquareFeet(kilogramsquaremeter.SlugSquareFeet).KilogramSquareMeters, SlugSquareFeetTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromSlugSquareInches(kilogramsquaremeter.SlugSquareInches).KilogramSquareMeters, SlugSquareInchesTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareCentimeters(kilogramsquaremeter.TonneSquareCentimeters).KilogramSquareMeters, TonneSquareCentimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareDecimeters(kilogramsquaremeter.TonneSquareDecimeters).KilogramSquareMeters, TonneSquareDecimetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareMeters(kilogramsquaremeter.TonneSquareMeters).KilogramSquareMeters, TonneSquareMetersTolerance); - AssertEx.EqualTolerance(1, MassMomentOfInertia.FromTonneSquareMilimeters(kilogramsquaremeter.TonneSquareMilimeters).KilogramSquareMeters, TonneSquareMilimetersTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MassMomentOfInertia v = MassMomentOfInertia.FromKilogramSquareMeters(1); - AssertEx.EqualTolerance(-1, -v.KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(2, (MassMomentOfInertia.FromKilogramSquareMeters(3)-v).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(2, (v + v).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(10, (v*10).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(10, (10*v).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(2, (MassMomentOfInertia.FromKilogramSquareMeters(10)/5).KilogramSquareMeters, KilogramSquareMetersTolerance); - AssertEx.EqualTolerance(2, MassMomentOfInertia.FromKilogramSquareMeters(10)/MassMomentOfInertia.FromKilogramSquareMeters(5), KilogramSquareMetersTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MassMomentOfInertia oneKilogramSquareMeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - MassMomentOfInertia twoKilogramSquareMeters = MassMomentOfInertia.FromKilogramSquareMeters(2); - - Assert.True(oneKilogramSquareMeter < twoKilogramSquareMeters); - Assert.True(oneKilogramSquareMeter <= twoKilogramSquareMeters); - Assert.True(twoKilogramSquareMeters > oneKilogramSquareMeter); - Assert.True(twoKilogramSquareMeters >= oneKilogramSquareMeter); - - Assert.False(oneKilogramSquareMeter > twoKilogramSquareMeters); - Assert.False(oneKilogramSquareMeter >= twoKilogramSquareMeters); - Assert.False(twoKilogramSquareMeters < oneKilogramSquareMeter); - Assert.False(twoKilogramSquareMeters <= oneKilogramSquareMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.Equal(0, kilogramsquaremeter.CompareTo(kilogramsquaremeter)); - Assert.True(kilogramsquaremeter.CompareTo(MassMomentOfInertia.Zero) > 0); - Assert.True(MassMomentOfInertia.Zero.CompareTo(kilogramsquaremeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.Throws(() => kilogramsquaremeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.Throws(() => kilogramsquaremeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MassMomentOfInertia v = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.True(v.Equals(MassMomentOfInertia.FromKilogramSquareMeters(1), KilogramSquareMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MassMomentOfInertia.Zero, KilogramSquareMetersTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.False(kilogramsquaremeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MassMomentOfInertia kilogramsquaremeter = MassMomentOfInertia.FromKilogramSquareMeters(1); - Assert.False(kilogramsquaremeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MassMomentOfInertiaUnit.Undefined, MassMomentOfInertia.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MassMomentOfInertiaUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MassMomentOfInertiaUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs deleted file mode 100644 index 0f604d58fc..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MassTestsBase.g.cs +++ /dev/null @@ -1,434 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Mass. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MassTestsBase - { - protected abstract double CentigramsInOneKilogram { get; } - protected abstract double DecagramsInOneKilogram { get; } - protected abstract double DecigramsInOneKilogram { get; } - protected abstract double GramsInOneKilogram { get; } - protected abstract double HectogramsInOneKilogram { get; } - protected abstract double KilogramsInOneKilogram { get; } - protected abstract double KilopoundsInOneKilogram { get; } - protected abstract double KilotonnesInOneKilogram { get; } - protected abstract double LongHundredweightInOneKilogram { get; } - protected abstract double LongTonsInOneKilogram { get; } - protected abstract double MegapoundsInOneKilogram { get; } - protected abstract double MegatonnesInOneKilogram { get; } - protected abstract double MicrogramsInOneKilogram { get; } - protected abstract double MilligramsInOneKilogram { get; } - protected abstract double NanogramsInOneKilogram { get; } - protected abstract double OuncesInOneKilogram { get; } - protected abstract double PoundsInOneKilogram { get; } - protected abstract double ShortHundredweightInOneKilogram { get; } - protected abstract double ShortTonsInOneKilogram { get; } - protected abstract double SlugsInOneKilogram { get; } - protected abstract double StoneInOneKilogram { get; } - protected abstract double TonnesInOneKilogram { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentigramsTolerance { get { return 1e-5; } } - protected virtual double DecagramsTolerance { get { return 1e-5; } } - protected virtual double DecigramsTolerance { get { return 1e-5; } } - protected virtual double GramsTolerance { get { return 1e-5; } } - protected virtual double HectogramsTolerance { get { return 1e-5; } } - protected virtual double KilogramsTolerance { get { return 1e-5; } } - protected virtual double KilopoundsTolerance { get { return 1e-5; } } - protected virtual double KilotonnesTolerance { get { return 1e-5; } } - protected virtual double LongHundredweightTolerance { get { return 1e-5; } } - protected virtual double LongTonsTolerance { get { return 1e-5; } } - protected virtual double MegapoundsTolerance { get { return 1e-5; } } - protected virtual double MegatonnesTolerance { get { return 1e-5; } } - protected virtual double MicrogramsTolerance { get { return 1e-5; } } - protected virtual double MilligramsTolerance { get { return 1e-5; } } - protected virtual double NanogramsTolerance { get { return 1e-5; } } - protected virtual double OuncesTolerance { get { return 1e-5; } } - protected virtual double PoundsTolerance { get { return 1e-5; } } - protected virtual double ShortHundredweightTolerance { get { return 1e-5; } } - protected virtual double ShortTonsTolerance { get { return 1e-5; } } - protected virtual double SlugsTolerance { get { return 1e-5; } } - protected virtual double StoneTolerance { get { return 1e-5; } } - protected virtual double TonnesTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Mass((double)0.0, MassUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Mass(double.PositiveInfinity, MassUnit.Kilogram)); - Assert.Throws(() => new Mass(double.NegativeInfinity, MassUnit.Kilogram)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Mass(double.NaN, MassUnit.Kilogram)); - } - - [Fact] - public void KilogramToMassUnits() - { - Mass kilogram = Mass.FromKilograms(1); - AssertEx.EqualTolerance(CentigramsInOneKilogram, kilogram.Centigrams, CentigramsTolerance); - AssertEx.EqualTolerance(DecagramsInOneKilogram, kilogram.Decagrams, DecagramsTolerance); - AssertEx.EqualTolerance(DecigramsInOneKilogram, kilogram.Decigrams, DecigramsTolerance); - AssertEx.EqualTolerance(GramsInOneKilogram, kilogram.Grams, GramsTolerance); - AssertEx.EqualTolerance(HectogramsInOneKilogram, kilogram.Hectograms, HectogramsTolerance); - AssertEx.EqualTolerance(KilogramsInOneKilogram, kilogram.Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(KilopoundsInOneKilogram, kilogram.Kilopounds, KilopoundsTolerance); - AssertEx.EqualTolerance(KilotonnesInOneKilogram, kilogram.Kilotonnes, KilotonnesTolerance); - AssertEx.EqualTolerance(LongHundredweightInOneKilogram, kilogram.LongHundredweight, LongHundredweightTolerance); - AssertEx.EqualTolerance(LongTonsInOneKilogram, kilogram.LongTons, LongTonsTolerance); - AssertEx.EqualTolerance(MegapoundsInOneKilogram, kilogram.Megapounds, MegapoundsTolerance); - AssertEx.EqualTolerance(MegatonnesInOneKilogram, kilogram.Megatonnes, MegatonnesTolerance); - AssertEx.EqualTolerance(MicrogramsInOneKilogram, kilogram.Micrograms, MicrogramsTolerance); - AssertEx.EqualTolerance(MilligramsInOneKilogram, kilogram.Milligrams, MilligramsTolerance); - AssertEx.EqualTolerance(NanogramsInOneKilogram, kilogram.Nanograms, NanogramsTolerance); - AssertEx.EqualTolerance(OuncesInOneKilogram, kilogram.Ounces, OuncesTolerance); - AssertEx.EqualTolerance(PoundsInOneKilogram, kilogram.Pounds, PoundsTolerance); - AssertEx.EqualTolerance(ShortHundredweightInOneKilogram, kilogram.ShortHundredweight, ShortHundredweightTolerance); - AssertEx.EqualTolerance(ShortTonsInOneKilogram, kilogram.ShortTons, ShortTonsTolerance); - AssertEx.EqualTolerance(SlugsInOneKilogram, kilogram.Slugs, SlugsTolerance); - AssertEx.EqualTolerance(StoneInOneKilogram, kilogram.Stone, StoneTolerance); - AssertEx.EqualTolerance(TonnesInOneKilogram, kilogram.Tonnes, TonnesTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Centigram).Centigrams, CentigramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Decagram).Decagrams, DecagramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Decigram).Decigrams, DecigramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Gram).Grams, GramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Hectogram).Hectograms, HectogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilogram).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilopound).Kilopounds, KilopoundsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Kilotonne).Kilotonnes, KilotonnesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongHundredweight).LongHundredweight, LongHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.LongTon).LongTons, LongTonsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megapound).Megapounds, MegapoundsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Megatonne).Megatonnes, MegatonnesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Microgram).Micrograms, MicrogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Milligram).Milligrams, MilligramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Nanogram).Nanograms, NanogramsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Ounce).Ounces, OuncesTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Pound).Pounds, PoundsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.ShortHundredweight).ShortHundredweight, ShortHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.ShortTon).ShortTons, ShortTonsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Slug).Slugs, SlugsTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Stone).Stone, StoneTolerance); - AssertEx.EqualTolerance(1, Mass.From(1, MassUnit.Tonne).Tonnes, TonnesTolerance); - } - - [Fact] - public void FromKilograms_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Mass.FromKilograms(double.PositiveInfinity)); - Assert.Throws(() => Mass.FromKilograms(double.NegativeInfinity)); - } - - [Fact] - public void FromKilograms_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Mass.FromKilograms(double.NaN)); - } - - [Fact] - public void As() - { - var kilogram = Mass.FromKilograms(1); - AssertEx.EqualTolerance(CentigramsInOneKilogram, kilogram.As(MassUnit.Centigram), CentigramsTolerance); - AssertEx.EqualTolerance(DecagramsInOneKilogram, kilogram.As(MassUnit.Decagram), DecagramsTolerance); - AssertEx.EqualTolerance(DecigramsInOneKilogram, kilogram.As(MassUnit.Decigram), DecigramsTolerance); - AssertEx.EqualTolerance(GramsInOneKilogram, kilogram.As(MassUnit.Gram), GramsTolerance); - AssertEx.EqualTolerance(HectogramsInOneKilogram, kilogram.As(MassUnit.Hectogram), HectogramsTolerance); - AssertEx.EqualTolerance(KilogramsInOneKilogram, kilogram.As(MassUnit.Kilogram), KilogramsTolerance); - AssertEx.EqualTolerance(KilopoundsInOneKilogram, kilogram.As(MassUnit.Kilopound), KilopoundsTolerance); - AssertEx.EqualTolerance(KilotonnesInOneKilogram, kilogram.As(MassUnit.Kilotonne), KilotonnesTolerance); - AssertEx.EqualTolerance(LongHundredweightInOneKilogram, kilogram.As(MassUnit.LongHundredweight), LongHundredweightTolerance); - AssertEx.EqualTolerance(LongTonsInOneKilogram, kilogram.As(MassUnit.LongTon), LongTonsTolerance); - AssertEx.EqualTolerance(MegapoundsInOneKilogram, kilogram.As(MassUnit.Megapound), MegapoundsTolerance); - AssertEx.EqualTolerance(MegatonnesInOneKilogram, kilogram.As(MassUnit.Megatonne), MegatonnesTolerance); - AssertEx.EqualTolerance(MicrogramsInOneKilogram, kilogram.As(MassUnit.Microgram), MicrogramsTolerance); - AssertEx.EqualTolerance(MilligramsInOneKilogram, kilogram.As(MassUnit.Milligram), MilligramsTolerance); - AssertEx.EqualTolerance(NanogramsInOneKilogram, kilogram.As(MassUnit.Nanogram), NanogramsTolerance); - AssertEx.EqualTolerance(OuncesInOneKilogram, kilogram.As(MassUnit.Ounce), OuncesTolerance); - AssertEx.EqualTolerance(PoundsInOneKilogram, kilogram.As(MassUnit.Pound), PoundsTolerance); - AssertEx.EqualTolerance(ShortHundredweightInOneKilogram, kilogram.As(MassUnit.ShortHundredweight), ShortHundredweightTolerance); - AssertEx.EqualTolerance(ShortTonsInOneKilogram, kilogram.As(MassUnit.ShortTon), ShortTonsTolerance); - AssertEx.EqualTolerance(SlugsInOneKilogram, kilogram.As(MassUnit.Slug), SlugsTolerance); - AssertEx.EqualTolerance(StoneInOneKilogram, kilogram.As(MassUnit.Stone), StoneTolerance); - AssertEx.EqualTolerance(TonnesInOneKilogram, kilogram.As(MassUnit.Tonne), TonnesTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogram = Mass.FromKilograms(1); - - var centigramQuantity = kilogram.ToUnit(MassUnit.Centigram); - AssertEx.EqualTolerance(CentigramsInOneKilogram, (double)centigramQuantity.Value, CentigramsTolerance); - Assert.Equal(MassUnit.Centigram, centigramQuantity.Unit); - - var decagramQuantity = kilogram.ToUnit(MassUnit.Decagram); - AssertEx.EqualTolerance(DecagramsInOneKilogram, (double)decagramQuantity.Value, DecagramsTolerance); - Assert.Equal(MassUnit.Decagram, decagramQuantity.Unit); - - var decigramQuantity = kilogram.ToUnit(MassUnit.Decigram); - AssertEx.EqualTolerance(DecigramsInOneKilogram, (double)decigramQuantity.Value, DecigramsTolerance); - Assert.Equal(MassUnit.Decigram, decigramQuantity.Unit); - - var gramQuantity = kilogram.ToUnit(MassUnit.Gram); - AssertEx.EqualTolerance(GramsInOneKilogram, (double)gramQuantity.Value, GramsTolerance); - Assert.Equal(MassUnit.Gram, gramQuantity.Unit); - - var hectogramQuantity = kilogram.ToUnit(MassUnit.Hectogram); - AssertEx.EqualTolerance(HectogramsInOneKilogram, (double)hectogramQuantity.Value, HectogramsTolerance); - Assert.Equal(MassUnit.Hectogram, hectogramQuantity.Unit); - - var kilogramQuantity = kilogram.ToUnit(MassUnit.Kilogram); - AssertEx.EqualTolerance(KilogramsInOneKilogram, (double)kilogramQuantity.Value, KilogramsTolerance); - Assert.Equal(MassUnit.Kilogram, kilogramQuantity.Unit); - - var kilopoundQuantity = kilogram.ToUnit(MassUnit.Kilopound); - AssertEx.EqualTolerance(KilopoundsInOneKilogram, (double)kilopoundQuantity.Value, KilopoundsTolerance); - Assert.Equal(MassUnit.Kilopound, kilopoundQuantity.Unit); - - var kilotonneQuantity = kilogram.ToUnit(MassUnit.Kilotonne); - AssertEx.EqualTolerance(KilotonnesInOneKilogram, (double)kilotonneQuantity.Value, KilotonnesTolerance); - Assert.Equal(MassUnit.Kilotonne, kilotonneQuantity.Unit); - - var longhundredweightQuantity = kilogram.ToUnit(MassUnit.LongHundredweight); - AssertEx.EqualTolerance(LongHundredweightInOneKilogram, (double)longhundredweightQuantity.Value, LongHundredweightTolerance); - Assert.Equal(MassUnit.LongHundredweight, longhundredweightQuantity.Unit); - - var longtonQuantity = kilogram.ToUnit(MassUnit.LongTon); - AssertEx.EqualTolerance(LongTonsInOneKilogram, (double)longtonQuantity.Value, LongTonsTolerance); - Assert.Equal(MassUnit.LongTon, longtonQuantity.Unit); - - var megapoundQuantity = kilogram.ToUnit(MassUnit.Megapound); - AssertEx.EqualTolerance(MegapoundsInOneKilogram, (double)megapoundQuantity.Value, MegapoundsTolerance); - Assert.Equal(MassUnit.Megapound, megapoundQuantity.Unit); - - var megatonneQuantity = kilogram.ToUnit(MassUnit.Megatonne); - AssertEx.EqualTolerance(MegatonnesInOneKilogram, (double)megatonneQuantity.Value, MegatonnesTolerance); - Assert.Equal(MassUnit.Megatonne, megatonneQuantity.Unit); - - var microgramQuantity = kilogram.ToUnit(MassUnit.Microgram); - AssertEx.EqualTolerance(MicrogramsInOneKilogram, (double)microgramQuantity.Value, MicrogramsTolerance); - Assert.Equal(MassUnit.Microgram, microgramQuantity.Unit); - - var milligramQuantity = kilogram.ToUnit(MassUnit.Milligram); - AssertEx.EqualTolerance(MilligramsInOneKilogram, (double)milligramQuantity.Value, MilligramsTolerance); - Assert.Equal(MassUnit.Milligram, milligramQuantity.Unit); - - var nanogramQuantity = kilogram.ToUnit(MassUnit.Nanogram); - AssertEx.EqualTolerance(NanogramsInOneKilogram, (double)nanogramQuantity.Value, NanogramsTolerance); - Assert.Equal(MassUnit.Nanogram, nanogramQuantity.Unit); - - var ounceQuantity = kilogram.ToUnit(MassUnit.Ounce); - AssertEx.EqualTolerance(OuncesInOneKilogram, (double)ounceQuantity.Value, OuncesTolerance); - Assert.Equal(MassUnit.Ounce, ounceQuantity.Unit); - - var poundQuantity = kilogram.ToUnit(MassUnit.Pound); - AssertEx.EqualTolerance(PoundsInOneKilogram, (double)poundQuantity.Value, PoundsTolerance); - Assert.Equal(MassUnit.Pound, poundQuantity.Unit); - - var shorthundredweightQuantity = kilogram.ToUnit(MassUnit.ShortHundredweight); - AssertEx.EqualTolerance(ShortHundredweightInOneKilogram, (double)shorthundredweightQuantity.Value, ShortHundredweightTolerance); - Assert.Equal(MassUnit.ShortHundredweight, shorthundredweightQuantity.Unit); - - var shorttonQuantity = kilogram.ToUnit(MassUnit.ShortTon); - AssertEx.EqualTolerance(ShortTonsInOneKilogram, (double)shorttonQuantity.Value, ShortTonsTolerance); - Assert.Equal(MassUnit.ShortTon, shorttonQuantity.Unit); - - var slugQuantity = kilogram.ToUnit(MassUnit.Slug); - AssertEx.EqualTolerance(SlugsInOneKilogram, (double)slugQuantity.Value, SlugsTolerance); - Assert.Equal(MassUnit.Slug, slugQuantity.Unit); - - var stoneQuantity = kilogram.ToUnit(MassUnit.Stone); - AssertEx.EqualTolerance(StoneInOneKilogram, (double)stoneQuantity.Value, StoneTolerance); - Assert.Equal(MassUnit.Stone, stoneQuantity.Unit); - - var tonneQuantity = kilogram.ToUnit(MassUnit.Tonne); - AssertEx.EqualTolerance(TonnesInOneKilogram, (double)tonneQuantity.Value, TonnesTolerance); - Assert.Equal(MassUnit.Tonne, tonneQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Mass kilogram = Mass.FromKilograms(1); - AssertEx.EqualTolerance(1, Mass.FromCentigrams(kilogram.Centigrams).Kilograms, CentigramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromDecagrams(kilogram.Decagrams).Kilograms, DecagramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromDecigrams(kilogram.Decigrams).Kilograms, DecigramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromGrams(kilogram.Grams).Kilograms, GramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromHectograms(kilogram.Hectograms).Kilograms, HectogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromKilograms(kilogram.Kilograms).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromKilopounds(kilogram.Kilopounds).Kilograms, KilopoundsTolerance); - AssertEx.EqualTolerance(1, Mass.FromKilotonnes(kilogram.Kilotonnes).Kilograms, KilotonnesTolerance); - AssertEx.EqualTolerance(1, Mass.FromLongHundredweight(kilogram.LongHundredweight).Kilograms, LongHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.FromLongTons(kilogram.LongTons).Kilograms, LongTonsTolerance); - AssertEx.EqualTolerance(1, Mass.FromMegapounds(kilogram.Megapounds).Kilograms, MegapoundsTolerance); - AssertEx.EqualTolerance(1, Mass.FromMegatonnes(kilogram.Megatonnes).Kilograms, MegatonnesTolerance); - AssertEx.EqualTolerance(1, Mass.FromMicrograms(kilogram.Micrograms).Kilograms, MicrogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromMilligrams(kilogram.Milligrams).Kilograms, MilligramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromNanograms(kilogram.Nanograms).Kilograms, NanogramsTolerance); - AssertEx.EqualTolerance(1, Mass.FromOunces(kilogram.Ounces).Kilograms, OuncesTolerance); - AssertEx.EqualTolerance(1, Mass.FromPounds(kilogram.Pounds).Kilograms, PoundsTolerance); - AssertEx.EqualTolerance(1, Mass.FromShortHundredweight(kilogram.ShortHundredweight).Kilograms, ShortHundredweightTolerance); - AssertEx.EqualTolerance(1, Mass.FromShortTons(kilogram.ShortTons).Kilograms, ShortTonsTolerance); - AssertEx.EqualTolerance(1, Mass.FromSlugs(kilogram.Slugs).Kilograms, SlugsTolerance); - AssertEx.EqualTolerance(1, Mass.FromStone(kilogram.Stone).Kilograms, StoneTolerance); - AssertEx.EqualTolerance(1, Mass.FromTonnes(kilogram.Tonnes).Kilograms, TonnesTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Mass v = Mass.FromKilograms(1); - AssertEx.EqualTolerance(-1, -v.Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(2, (Mass.FromKilograms(3)-v).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(2, (v + v).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(10, (v*10).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(10, (10*v).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(2, (Mass.FromKilograms(10)/5).Kilograms, KilogramsTolerance); - AssertEx.EqualTolerance(2, Mass.FromKilograms(10)/Mass.FromKilograms(5), KilogramsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Mass oneKilogram = Mass.FromKilograms(1); - Mass twoKilograms = Mass.FromKilograms(2); - - Assert.True(oneKilogram < twoKilograms); - Assert.True(oneKilogram <= twoKilograms); - Assert.True(twoKilograms > oneKilogram); - Assert.True(twoKilograms >= oneKilogram); - - Assert.False(oneKilogram > twoKilograms); - Assert.False(oneKilogram >= twoKilograms); - Assert.False(twoKilograms < oneKilogram); - Assert.False(twoKilograms <= oneKilogram); - } - - [Fact] - public void CompareToIsImplemented() - { - Mass kilogram = Mass.FromKilograms(1); - Assert.Equal(0, kilogram.CompareTo(kilogram)); - Assert.True(kilogram.CompareTo(Mass.Zero) > 0); - Assert.True(Mass.Zero.CompareTo(kilogram) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Mass kilogram = Mass.FromKilograms(1); - Assert.Throws(() => kilogram.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Mass kilogram = Mass.FromKilograms(1); - Assert.Throws(() => kilogram.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Mass v = Mass.FromKilograms(1); - Assert.True(v.Equals(Mass.FromKilograms(1), KilogramsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Mass.Zero, KilogramsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Mass kilogram = Mass.FromKilograms(1); - Assert.False(kilogram.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Mass kilogram = Mass.FromKilograms(1); - Assert.False(kilogram.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MassUnit.Undefined, Mass.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MassUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MassUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs deleted file mode 100644 index 96940b97aa..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MolarEnergyTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MolarEnergy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MolarEnergyTestsBase - { - protected abstract double JoulesPerMoleInOneJoulePerMole { get; } - protected abstract double KilojoulesPerMoleInOneJoulePerMole { get; } - protected abstract double MegajoulesPerMoleInOneJoulePerMole { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double JoulesPerMoleTolerance { get { return 1e-5; } } - protected virtual double KilojoulesPerMoleTolerance { get { return 1e-5; } } - protected virtual double MegajoulesPerMoleTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MolarEnergy((double)0.0, MolarEnergyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MolarEnergy(double.PositiveInfinity, MolarEnergyUnit.JoulePerMole)); - Assert.Throws(() => new MolarEnergy(double.NegativeInfinity, MolarEnergyUnit.JoulePerMole)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MolarEnergy(double.NaN, MolarEnergyUnit.JoulePerMole)); - } - - [Fact] - public void JoulePerMoleToMolarEnergyUnits() - { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - AssertEx.EqualTolerance(JoulesPerMoleInOneJoulePerMole, joulepermole.JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(KilojoulesPerMoleInOneJoulePerMole, joulepermole.KilojoulesPerMole, KilojoulesPerMoleTolerance); - AssertEx.EqualTolerance(MegajoulesPerMoleInOneJoulePerMole, joulepermole.MegajoulesPerMole, MegajoulesPerMoleTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.JoulePerMole).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.KilojoulePerMole).KilojoulesPerMole, KilojoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.From(1, MolarEnergyUnit.MegajoulePerMole).MegajoulesPerMole, MegajoulesPerMoleTolerance); - } - - [Fact] - public void FromJoulesPerMole_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity)); - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity)); - } - - [Fact] - public void FromJoulesPerMole_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MolarEnergy.FromJoulesPerMole(double.NaN)); - } - - [Fact] - public void As() - { - var joulepermole = MolarEnergy.FromJoulesPerMole(1); - AssertEx.EqualTolerance(JoulesPerMoleInOneJoulePerMole, joulepermole.As(MolarEnergyUnit.JoulePerMole), JoulesPerMoleTolerance); - AssertEx.EqualTolerance(KilojoulesPerMoleInOneJoulePerMole, joulepermole.As(MolarEnergyUnit.KilojoulePerMole), KilojoulesPerMoleTolerance); - AssertEx.EqualTolerance(MegajoulesPerMoleInOneJoulePerMole, joulepermole.As(MolarEnergyUnit.MegajoulePerMole), MegajoulesPerMoleTolerance); - } - - [Fact] - public void ToUnit() - { - var joulepermole = MolarEnergy.FromJoulesPerMole(1); - - var joulepermoleQuantity = joulepermole.ToUnit(MolarEnergyUnit.JoulePerMole); - AssertEx.EqualTolerance(JoulesPerMoleInOneJoulePerMole, (double)joulepermoleQuantity.Value, JoulesPerMoleTolerance); - Assert.Equal(MolarEnergyUnit.JoulePerMole, joulepermoleQuantity.Unit); - - var kilojoulepermoleQuantity = joulepermole.ToUnit(MolarEnergyUnit.KilojoulePerMole); - AssertEx.EqualTolerance(KilojoulesPerMoleInOneJoulePerMole, (double)kilojoulepermoleQuantity.Value, KilojoulesPerMoleTolerance); - Assert.Equal(MolarEnergyUnit.KilojoulePerMole, kilojoulepermoleQuantity.Unit); - - var megajoulepermoleQuantity = joulepermole.ToUnit(MolarEnergyUnit.MegajoulePerMole); - AssertEx.EqualTolerance(MegajoulesPerMoleInOneJoulePerMole, (double)megajoulepermoleQuantity.Value, MegajoulesPerMoleTolerance); - Assert.Equal(MolarEnergyUnit.MegajoulePerMole, megajoulepermoleQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - AssertEx.EqualTolerance(1, MolarEnergy.FromJoulesPerMole(joulepermole.JoulesPerMole).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.FromKilojoulesPerMole(joulepermole.KilojoulesPerMole).JoulesPerMole, KilojoulesPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarEnergy.FromMegajoulesPerMole(joulepermole.MegajoulesPerMole).JoulesPerMole, MegajoulesPerMoleTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MolarEnergy v = MolarEnergy.FromJoulesPerMole(1); - AssertEx.EqualTolerance(-1, -v.JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarEnergy.FromJoulesPerMole(3)-v).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(2, (v + v).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(10, (v*10).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(10, (10*v).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarEnergy.FromJoulesPerMole(10)/5).JoulesPerMole, JoulesPerMoleTolerance); - AssertEx.EqualTolerance(2, MolarEnergy.FromJoulesPerMole(10)/MolarEnergy.FromJoulesPerMole(5), JoulesPerMoleTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MolarEnergy oneJoulePerMole = MolarEnergy.FromJoulesPerMole(1); - MolarEnergy twoJoulesPerMole = MolarEnergy.FromJoulesPerMole(2); - - Assert.True(oneJoulePerMole < twoJoulesPerMole); - Assert.True(oneJoulePerMole <= twoJoulesPerMole); - Assert.True(twoJoulesPerMole > oneJoulePerMole); - Assert.True(twoJoulesPerMole >= oneJoulePerMole); - - Assert.False(oneJoulePerMole > twoJoulesPerMole); - Assert.False(oneJoulePerMole >= twoJoulesPerMole); - Assert.False(twoJoulesPerMole < oneJoulePerMole); - Assert.False(twoJoulesPerMole <= oneJoulePerMole); - } - - [Fact] - public void CompareToIsImplemented() - { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - Assert.Equal(0, joulepermole.CompareTo(joulepermole)); - Assert.True(joulepermole.CompareTo(MolarEnergy.Zero) > 0); - Assert.True(MolarEnergy.Zero.CompareTo(joulepermole) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - Assert.Throws(() => joulepermole.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - Assert.Throws(() => joulepermole.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MolarEnergy v = MolarEnergy.FromJoulesPerMole(1); - Assert.True(v.Equals(MolarEnergy.FromJoulesPerMole(1), JoulesPerMoleTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MolarEnergy.Zero, JoulesPerMoleTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - Assert.False(joulepermole.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1); - Assert.False(joulepermole.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MolarEnergyUnit.Undefined, MolarEnergy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MolarEnergyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MolarEnergyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs deleted file mode 100644 index c7ad28d7cd..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MolarEntropyTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MolarEntropy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MolarEntropyTestsBase - { - protected abstract double JoulesPerMoleKelvinInOneJoulePerMoleKelvin { get; } - protected abstract double KilojoulesPerMoleKelvinInOneJoulePerMoleKelvin { get; } - protected abstract double MegajoulesPerMoleKelvinInOneJoulePerMoleKelvin { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double JoulesPerMoleKelvinTolerance { get { return 1e-5; } } - protected virtual double KilojoulesPerMoleKelvinTolerance { get { return 1e-5; } } - protected virtual double MegajoulesPerMoleKelvinTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MolarEntropy((double)0.0, MolarEntropyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MolarEntropy(double.PositiveInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); - Assert.Throws(() => new MolarEntropy(double.NegativeInfinity, MolarEntropyUnit.JoulePerMoleKelvin)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin)); - } - - [Fact] - public void JoulePerMoleKelvinToMolarEntropyUnits() - { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - AssertEx.EqualTolerance(JoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(KilojoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.KilojoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(MegajoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.JoulePerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.KilojoulePerMoleKelvin).KilojoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.MegajoulePerMoleKelvin).MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); - } - - [Fact] - public void FromJoulesPerMoleKelvin_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity)); - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity)); - } - - [Fact] - public void FromJoulesPerMoleKelvin_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN)); - } - - [Fact] - public void As() - { - var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - AssertEx.EqualTolerance(JoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.As(MolarEntropyUnit.JoulePerMoleKelvin), JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(KilojoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.As(MolarEntropyUnit.KilojoulePerMoleKelvin), KilojoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(MegajoulesPerMoleKelvinInOneJoulePerMoleKelvin, joulepermolekelvin.As(MolarEntropyUnit.MegajoulePerMoleKelvin), MegajoulesPerMoleKelvinTolerance); - } - - [Fact] - public void ToUnit() - { - var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - - var joulepermolekelvinQuantity = joulepermolekelvin.ToUnit(MolarEntropyUnit.JoulePerMoleKelvin); - AssertEx.EqualTolerance(JoulesPerMoleKelvinInOneJoulePerMoleKelvin, (double)joulepermolekelvinQuantity.Value, JoulesPerMoleKelvinTolerance); - Assert.Equal(MolarEntropyUnit.JoulePerMoleKelvin, joulepermolekelvinQuantity.Unit); - - var kilojoulepermolekelvinQuantity = joulepermolekelvin.ToUnit(MolarEntropyUnit.KilojoulePerMoleKelvin); - AssertEx.EqualTolerance(KilojoulesPerMoleKelvinInOneJoulePerMoleKelvin, (double)kilojoulepermolekelvinQuantity.Value, KilojoulesPerMoleKelvinTolerance); - Assert.Equal(MolarEntropyUnit.KilojoulePerMoleKelvin, kilojoulepermolekelvinQuantity.Unit); - - var megajoulepermolekelvinQuantity = joulepermolekelvin.ToUnit(MolarEntropyUnit.MegajoulePerMoleKelvin); - AssertEx.EqualTolerance(MegajoulesPerMoleKelvinInOneJoulePerMoleKelvin, (double)megajoulepermolekelvinQuantity.Value, MegajoulesPerMoleKelvinTolerance); - Assert.Equal(MolarEntropyUnit.MegajoulePerMoleKelvin, megajoulepermolekelvinQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - AssertEx.EqualTolerance(1, MolarEntropy.FromJoulesPerMoleKelvin(joulepermolekelvin.JoulesPerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.FromKilojoulesPerMoleKelvin(joulepermolekelvin.KilojoulesPerMoleKelvin).JoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(1, MolarEntropy.FromMegajoulesPerMoleKelvin(joulepermolekelvin.MegajoulesPerMoleKelvin).JoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MolarEntropy v = MolarEntropy.FromJoulesPerMoleKelvin(1); - AssertEx.EqualTolerance(-1, -v.JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(2, (MolarEntropy.FromJoulesPerMoleKelvin(3)-v).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(2, (v + v).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(10, (v*10).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(10, (10*v).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(2, (MolarEntropy.FromJoulesPerMoleKelvin(10)/5).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance); - AssertEx.EqualTolerance(2, MolarEntropy.FromJoulesPerMoleKelvin(10)/MolarEntropy.FromJoulesPerMoleKelvin(5), JoulesPerMoleKelvinTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MolarEntropy oneJoulePerMoleKelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - MolarEntropy twoJoulesPerMoleKelvin = MolarEntropy.FromJoulesPerMoleKelvin(2); - - Assert.True(oneJoulePerMoleKelvin < twoJoulesPerMoleKelvin); - Assert.True(oneJoulePerMoleKelvin <= twoJoulesPerMoleKelvin); - Assert.True(twoJoulesPerMoleKelvin > oneJoulePerMoleKelvin); - Assert.True(twoJoulesPerMoleKelvin >= oneJoulePerMoleKelvin); - - Assert.False(oneJoulePerMoleKelvin > twoJoulesPerMoleKelvin); - Assert.False(oneJoulePerMoleKelvin >= twoJoulesPerMoleKelvin); - Assert.False(twoJoulesPerMoleKelvin < oneJoulePerMoleKelvin); - Assert.False(twoJoulesPerMoleKelvin <= oneJoulePerMoleKelvin); - } - - [Fact] - public void CompareToIsImplemented() - { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.Equal(0, joulepermolekelvin.CompareTo(joulepermolekelvin)); - Assert.True(joulepermolekelvin.CompareTo(MolarEntropy.Zero) > 0); - Assert.True(MolarEntropy.Zero.CompareTo(joulepermolekelvin) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.Throws(() => joulepermolekelvin.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.Throws(() => joulepermolekelvin.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MolarEntropy v = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.True(v.Equals(MolarEntropy.FromJoulesPerMoleKelvin(1), JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MolarEntropy.Zero, JoulesPerMoleKelvinTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.False(joulepermolekelvin.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1); - Assert.False(joulepermolekelvin.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MolarEntropyUnit.Undefined, MolarEntropy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MolarEntropyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MolarEntropyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs deleted file mode 100644 index b52831982c..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MolarMassTestsBase.g.cs +++ /dev/null @@ -1,334 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of MolarMass. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MolarMassTestsBase - { - protected abstract double CentigramsPerMoleInOneKilogramPerMole { get; } - protected abstract double DecagramsPerMoleInOneKilogramPerMole { get; } - protected abstract double DecigramsPerMoleInOneKilogramPerMole { get; } - protected abstract double GramsPerMoleInOneKilogramPerMole { get; } - protected abstract double HectogramsPerMoleInOneKilogramPerMole { get; } - protected abstract double KilogramsPerMoleInOneKilogramPerMole { get; } - protected abstract double KilopoundsPerMoleInOneKilogramPerMole { get; } - protected abstract double MegapoundsPerMoleInOneKilogramPerMole { get; } - protected abstract double MicrogramsPerMoleInOneKilogramPerMole { get; } - protected abstract double MilligramsPerMoleInOneKilogramPerMole { get; } - protected abstract double NanogramsPerMoleInOneKilogramPerMole { get; } - protected abstract double PoundsPerMoleInOneKilogramPerMole { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentigramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double DecagramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double DecigramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double GramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double HectogramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double KilogramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double KilopoundsPerMoleTolerance { get { return 1e-5; } } - protected virtual double MegapoundsPerMoleTolerance { get { return 1e-5; } } - protected virtual double MicrogramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double MilligramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double NanogramsPerMoleTolerance { get { return 1e-5; } } - protected virtual double PoundsPerMoleTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new MolarMass((double)0.0, MolarMassUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new MolarMass(double.PositiveInfinity, MolarMassUnit.KilogramPerMole)); - Assert.Throws(() => new MolarMass(double.NegativeInfinity, MolarMassUnit.KilogramPerMole)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new MolarMass(double.NaN, MolarMassUnit.KilogramPerMole)); - } - - [Fact] - public void KilogramPerMoleToMolarMassUnits() - { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - AssertEx.EqualTolerance(CentigramsPerMoleInOneKilogramPerMole, kilogrampermole.CentigramsPerMole, CentigramsPerMoleTolerance); - AssertEx.EqualTolerance(DecagramsPerMoleInOneKilogramPerMole, kilogrampermole.DecagramsPerMole, DecagramsPerMoleTolerance); - AssertEx.EqualTolerance(DecigramsPerMoleInOneKilogramPerMole, kilogrampermole.DecigramsPerMole, DecigramsPerMoleTolerance); - AssertEx.EqualTolerance(GramsPerMoleInOneKilogramPerMole, kilogrampermole.GramsPerMole, GramsPerMoleTolerance); - AssertEx.EqualTolerance(HectogramsPerMoleInOneKilogramPerMole, kilogrampermole.HectogramsPerMole, HectogramsPerMoleTolerance); - AssertEx.EqualTolerance(KilogramsPerMoleInOneKilogramPerMole, kilogrampermole.KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(KilopoundsPerMoleInOneKilogramPerMole, kilogrampermole.KilopoundsPerMole, KilopoundsPerMoleTolerance); - AssertEx.EqualTolerance(MegapoundsPerMoleInOneKilogramPerMole, kilogrampermole.MegapoundsPerMole, MegapoundsPerMoleTolerance); - AssertEx.EqualTolerance(MicrogramsPerMoleInOneKilogramPerMole, kilogrampermole.MicrogramsPerMole, MicrogramsPerMoleTolerance); - AssertEx.EqualTolerance(MilligramsPerMoleInOneKilogramPerMole, kilogrampermole.MilligramsPerMole, MilligramsPerMoleTolerance); - AssertEx.EqualTolerance(NanogramsPerMoleInOneKilogramPerMole, kilogrampermole.NanogramsPerMole, NanogramsPerMoleTolerance); - AssertEx.EqualTolerance(PoundsPerMoleInOneKilogramPerMole, kilogrampermole.PoundsPerMole, PoundsPerMoleTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.CentigramPerMole).CentigramsPerMole, CentigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecagramPerMole).DecagramsPerMole, DecagramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecigramPerMole).DecigramsPerMole, DecigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.GramPerMole).GramsPerMole, GramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.HectogramPerMole).HectogramsPerMole, HectogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilogramPerMole).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilopoundPerMole).KilopoundsPerMole, KilopoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MegapoundPerMole).MegapoundsPerMole, MegapoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MicrogramPerMole).MicrogramsPerMole, MicrogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MilligramPerMole).MilligramsPerMole, MilligramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.NanogramPerMole).NanogramsPerMole, NanogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.PoundPerMole).PoundsPerMole, PoundsPerMoleTolerance); - } - - [Fact] - public void FromKilogramsPerMole_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.PositiveInfinity)); - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NegativeInfinity)); - } - - [Fact] - public void FromKilogramsPerMole_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => MolarMass.FromKilogramsPerMole(double.NaN)); - } - - [Fact] - public void As() - { - var kilogrampermole = MolarMass.FromKilogramsPerMole(1); - AssertEx.EqualTolerance(CentigramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.CentigramPerMole), CentigramsPerMoleTolerance); - AssertEx.EqualTolerance(DecagramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.DecagramPerMole), DecagramsPerMoleTolerance); - AssertEx.EqualTolerance(DecigramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.DecigramPerMole), DecigramsPerMoleTolerance); - AssertEx.EqualTolerance(GramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.GramPerMole), GramsPerMoleTolerance); - AssertEx.EqualTolerance(HectogramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.HectogramPerMole), HectogramsPerMoleTolerance); - AssertEx.EqualTolerance(KilogramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.KilogramPerMole), KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(KilopoundsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.KilopoundPerMole), KilopoundsPerMoleTolerance); - AssertEx.EqualTolerance(MegapoundsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.MegapoundPerMole), MegapoundsPerMoleTolerance); - AssertEx.EqualTolerance(MicrogramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.MicrogramPerMole), MicrogramsPerMoleTolerance); - AssertEx.EqualTolerance(MilligramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.MilligramPerMole), MilligramsPerMoleTolerance); - AssertEx.EqualTolerance(NanogramsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.NanogramPerMole), NanogramsPerMoleTolerance); - AssertEx.EqualTolerance(PoundsPerMoleInOneKilogramPerMole, kilogrampermole.As(MolarMassUnit.PoundPerMole), PoundsPerMoleTolerance); - } - - [Fact] - public void ToUnit() - { - var kilogrampermole = MolarMass.FromKilogramsPerMole(1); - - var centigrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.CentigramPerMole); - AssertEx.EqualTolerance(CentigramsPerMoleInOneKilogramPerMole, (double)centigrampermoleQuantity.Value, CentigramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.CentigramPerMole, centigrampermoleQuantity.Unit); - - var decagrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.DecagramPerMole); - AssertEx.EqualTolerance(DecagramsPerMoleInOneKilogramPerMole, (double)decagrampermoleQuantity.Value, DecagramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.DecagramPerMole, decagrampermoleQuantity.Unit); - - var decigrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.DecigramPerMole); - AssertEx.EqualTolerance(DecigramsPerMoleInOneKilogramPerMole, (double)decigrampermoleQuantity.Value, DecigramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.DecigramPerMole, decigrampermoleQuantity.Unit); - - var grampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.GramPerMole); - AssertEx.EqualTolerance(GramsPerMoleInOneKilogramPerMole, (double)grampermoleQuantity.Value, GramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.GramPerMole, grampermoleQuantity.Unit); - - var hectogrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.HectogramPerMole); - AssertEx.EqualTolerance(HectogramsPerMoleInOneKilogramPerMole, (double)hectogrampermoleQuantity.Value, HectogramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.HectogramPerMole, hectogrampermoleQuantity.Unit); - - var kilogrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.KilogramPerMole); - AssertEx.EqualTolerance(KilogramsPerMoleInOneKilogramPerMole, (double)kilogrampermoleQuantity.Value, KilogramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.KilogramPerMole, kilogrampermoleQuantity.Unit); - - var kilopoundpermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.KilopoundPerMole); - AssertEx.EqualTolerance(KilopoundsPerMoleInOneKilogramPerMole, (double)kilopoundpermoleQuantity.Value, KilopoundsPerMoleTolerance); - Assert.Equal(MolarMassUnit.KilopoundPerMole, kilopoundpermoleQuantity.Unit); - - var megapoundpermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.MegapoundPerMole); - AssertEx.EqualTolerance(MegapoundsPerMoleInOneKilogramPerMole, (double)megapoundpermoleQuantity.Value, MegapoundsPerMoleTolerance); - Assert.Equal(MolarMassUnit.MegapoundPerMole, megapoundpermoleQuantity.Unit); - - var microgrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.MicrogramPerMole); - AssertEx.EqualTolerance(MicrogramsPerMoleInOneKilogramPerMole, (double)microgrampermoleQuantity.Value, MicrogramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.MicrogramPerMole, microgrampermoleQuantity.Unit); - - var milligrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.MilligramPerMole); - AssertEx.EqualTolerance(MilligramsPerMoleInOneKilogramPerMole, (double)milligrampermoleQuantity.Value, MilligramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.MilligramPerMole, milligrampermoleQuantity.Unit); - - var nanogrampermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.NanogramPerMole); - AssertEx.EqualTolerance(NanogramsPerMoleInOneKilogramPerMole, (double)nanogrampermoleQuantity.Value, NanogramsPerMoleTolerance); - Assert.Equal(MolarMassUnit.NanogramPerMole, nanogrampermoleQuantity.Unit); - - var poundpermoleQuantity = kilogrampermole.ToUnit(MolarMassUnit.PoundPerMole); - AssertEx.EqualTolerance(PoundsPerMoleInOneKilogramPerMole, (double)poundpermoleQuantity.Value, PoundsPerMoleTolerance); - Assert.Equal(MolarMassUnit.PoundPerMole, poundpermoleQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - AssertEx.EqualTolerance(1, MolarMass.FromCentigramsPerMole(kilogrampermole.CentigramsPerMole).KilogramsPerMole, CentigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromDecagramsPerMole(kilogrampermole.DecagramsPerMole).KilogramsPerMole, DecagramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromDecigramsPerMole(kilogrampermole.DecigramsPerMole).KilogramsPerMole, DecigramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromGramsPerMole(kilogrampermole.GramsPerMole).KilogramsPerMole, GramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromHectogramsPerMole(kilogrampermole.HectogramsPerMole).KilogramsPerMole, HectogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromKilogramsPerMole(kilogrampermole.KilogramsPerMole).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromKilopoundsPerMole(kilogrampermole.KilopoundsPerMole).KilogramsPerMole, KilopoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromMegapoundsPerMole(kilogrampermole.MegapoundsPerMole).KilogramsPerMole, MegapoundsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromMicrogramsPerMole(kilogrampermole.MicrogramsPerMole).KilogramsPerMole, MicrogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromMilligramsPerMole(kilogrampermole.MilligramsPerMole).KilogramsPerMole, MilligramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromNanogramsPerMole(kilogrampermole.NanogramsPerMole).KilogramsPerMole, NanogramsPerMoleTolerance); - AssertEx.EqualTolerance(1, MolarMass.FromPoundsPerMole(kilogrampermole.PoundsPerMole).KilogramsPerMole, PoundsPerMoleTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - MolarMass v = MolarMass.FromKilogramsPerMole(1); - AssertEx.EqualTolerance(-1, -v.KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarMass.FromKilogramsPerMole(3)-v).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(2, (v + v).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(10, (v*10).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(10, (10*v).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(2, (MolarMass.FromKilogramsPerMole(10)/5).KilogramsPerMole, KilogramsPerMoleTolerance); - AssertEx.EqualTolerance(2, MolarMass.FromKilogramsPerMole(10)/MolarMass.FromKilogramsPerMole(5), KilogramsPerMoleTolerance); - } - - [Fact] - public void ComparisonOperators() - { - MolarMass oneKilogramPerMole = MolarMass.FromKilogramsPerMole(1); - MolarMass twoKilogramsPerMole = MolarMass.FromKilogramsPerMole(2); - - Assert.True(oneKilogramPerMole < twoKilogramsPerMole); - Assert.True(oneKilogramPerMole <= twoKilogramsPerMole); - Assert.True(twoKilogramsPerMole > oneKilogramPerMole); - Assert.True(twoKilogramsPerMole >= oneKilogramPerMole); - - Assert.False(oneKilogramPerMole > twoKilogramsPerMole); - Assert.False(oneKilogramPerMole >= twoKilogramsPerMole); - Assert.False(twoKilogramsPerMole < oneKilogramPerMole); - Assert.False(twoKilogramsPerMole <= oneKilogramPerMole); - } - - [Fact] - public void CompareToIsImplemented() - { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - Assert.Equal(0, kilogrampermole.CompareTo(kilogrampermole)); - Assert.True(kilogrampermole.CompareTo(MolarMass.Zero) > 0); - Assert.True(MolarMass.Zero.CompareTo(kilogrampermole) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - Assert.Throws(() => kilogrampermole.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - Assert.Throws(() => kilogrampermole.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - MolarMass v = MolarMass.FromKilogramsPerMole(1); - Assert.True(v.Equals(MolarMass.FromKilogramsPerMole(1), KilogramsPerMoleTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(MolarMass.Zero, KilogramsPerMoleTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - Assert.False(kilogrampermole.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1); - Assert.False(kilogrampermole.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MolarMassUnit.Undefined, MolarMass.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MolarMassUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MolarMassUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs deleted file mode 100644 index a8fe1eed37..0000000000 --- a/UnitsNet.Tests/GeneratedCode/MolarityTestsBase.g.cs +++ /dev/null @@ -1,294 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Molarity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class MolarityTestsBase - { - protected abstract double CentimolesPerLiterInOneMolesPerCubicMeter { get; } - protected abstract double DecimolesPerLiterInOneMolesPerCubicMeter { get; } - protected abstract double MicromolesPerLiterInOneMolesPerCubicMeter { get; } - protected abstract double MillimolesPerLiterInOneMolesPerCubicMeter { get; } - protected abstract double MolesPerCubicMeterInOneMolesPerCubicMeter { get; } - protected abstract double MolesPerLiterInOneMolesPerCubicMeter { get; } - protected abstract double NanomolesPerLiterInOneMolesPerCubicMeter { get; } - protected abstract double PicomolesPerLiterInOneMolesPerCubicMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentimolesPerLiterTolerance { get { return 1e-5; } } - protected virtual double DecimolesPerLiterTolerance { get { return 1e-5; } } - protected virtual double MicromolesPerLiterTolerance { get { return 1e-5; } } - protected virtual double MillimolesPerLiterTolerance { get { return 1e-5; } } - protected virtual double MolesPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double MolesPerLiterTolerance { get { return 1e-5; } } - protected virtual double NanomolesPerLiterTolerance { get { return 1e-5; } } - protected virtual double PicomolesPerLiterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Molarity((double)0.0, MolarityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Molarity(double.PositiveInfinity, MolarityUnit.MolesPerCubicMeter)); - Assert.Throws(() => new Molarity(double.NegativeInfinity, MolarityUnit.MolesPerCubicMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Molarity(double.NaN, MolarityUnit.MolesPerCubicMeter)); - } - - [Fact] - public void MolesPerCubicMeterToMolarityUnits() - { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - AssertEx.EqualTolerance(CentimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.CentimolesPerLiter, CentimolesPerLiterTolerance); - AssertEx.EqualTolerance(DecimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.DecimolesPerLiter, DecimolesPerLiterTolerance); - AssertEx.EqualTolerance(MicromolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.MicromolesPerLiter, MicromolesPerLiterTolerance); - AssertEx.EqualTolerance(MillimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.MillimolesPerLiter, MillimolesPerLiterTolerance); - AssertEx.EqualTolerance(MolesPerCubicMeterInOneMolesPerCubicMeter, molespercubicmeter.MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(MolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.MolesPerLiter, MolesPerLiterTolerance); - AssertEx.EqualTolerance(NanomolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.NanomolesPerLiter, NanomolesPerLiterTolerance); - AssertEx.EqualTolerance(PicomolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.PicomolesPerLiter, PicomolesPerLiterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.CentimolesPerLiter).CentimolesPerLiter, CentimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.DecimolesPerLiter).DecimolesPerLiter, DecimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MicromolesPerLiter).MicromolesPerLiter, MicromolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MillimolesPerLiter).MillimolesPerLiter, MillimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MolesPerCubicMeter).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.MolesPerLiter).MolesPerLiter, MolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.NanomolesPerLiter).NanomolesPerLiter, NanomolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.From(1, MolarityUnit.PicomolesPerLiter).PicomolesPerLiter, PicomolesPerLiterTolerance); - } - - [Fact] - public void FromMolesPerCubicMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromMolesPerCubicMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Molarity.FromMolesPerCubicMeter(double.NaN)); - } - - [Fact] - public void As() - { - var molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - AssertEx.EqualTolerance(CentimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.CentimolesPerLiter), CentimolesPerLiterTolerance); - AssertEx.EqualTolerance(DecimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.DecimolesPerLiter), DecimolesPerLiterTolerance); - AssertEx.EqualTolerance(MicromolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.MicromolesPerLiter), MicromolesPerLiterTolerance); - AssertEx.EqualTolerance(MillimolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.MillimolesPerLiter), MillimolesPerLiterTolerance); - AssertEx.EqualTolerance(MolesPerCubicMeterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.MolesPerCubicMeter), MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(MolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.MolesPerLiter), MolesPerLiterTolerance); - AssertEx.EqualTolerance(NanomolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.NanomolesPerLiter), NanomolesPerLiterTolerance); - AssertEx.EqualTolerance(PicomolesPerLiterInOneMolesPerCubicMeter, molespercubicmeter.As(MolarityUnit.PicomolesPerLiter), PicomolesPerLiterTolerance); - } - - [Fact] - public void ToUnit() - { - var molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - - var centimolesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.CentimolesPerLiter); - AssertEx.EqualTolerance(CentimolesPerLiterInOneMolesPerCubicMeter, (double)centimolesperliterQuantity.Value, CentimolesPerLiterTolerance); - Assert.Equal(MolarityUnit.CentimolesPerLiter, centimolesperliterQuantity.Unit); - - var decimolesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.DecimolesPerLiter); - AssertEx.EqualTolerance(DecimolesPerLiterInOneMolesPerCubicMeter, (double)decimolesperliterQuantity.Value, DecimolesPerLiterTolerance); - Assert.Equal(MolarityUnit.DecimolesPerLiter, decimolesperliterQuantity.Unit); - - var micromolesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.MicromolesPerLiter); - AssertEx.EqualTolerance(MicromolesPerLiterInOneMolesPerCubicMeter, (double)micromolesperliterQuantity.Value, MicromolesPerLiterTolerance); - Assert.Equal(MolarityUnit.MicromolesPerLiter, micromolesperliterQuantity.Unit); - - var millimolesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.MillimolesPerLiter); - AssertEx.EqualTolerance(MillimolesPerLiterInOneMolesPerCubicMeter, (double)millimolesperliterQuantity.Value, MillimolesPerLiterTolerance); - Assert.Equal(MolarityUnit.MillimolesPerLiter, millimolesperliterQuantity.Unit); - - var molespercubicmeterQuantity = molespercubicmeter.ToUnit(MolarityUnit.MolesPerCubicMeter); - AssertEx.EqualTolerance(MolesPerCubicMeterInOneMolesPerCubicMeter, (double)molespercubicmeterQuantity.Value, MolesPerCubicMeterTolerance); - Assert.Equal(MolarityUnit.MolesPerCubicMeter, molespercubicmeterQuantity.Unit); - - var molesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.MolesPerLiter); - AssertEx.EqualTolerance(MolesPerLiterInOneMolesPerCubicMeter, (double)molesperliterQuantity.Value, MolesPerLiterTolerance); - Assert.Equal(MolarityUnit.MolesPerLiter, molesperliterQuantity.Unit); - - var nanomolesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.NanomolesPerLiter); - AssertEx.EqualTolerance(NanomolesPerLiterInOneMolesPerCubicMeter, (double)nanomolesperliterQuantity.Value, NanomolesPerLiterTolerance); - Assert.Equal(MolarityUnit.NanomolesPerLiter, nanomolesperliterQuantity.Unit); - - var picomolesperliterQuantity = molespercubicmeter.ToUnit(MolarityUnit.PicomolesPerLiter); - AssertEx.EqualTolerance(PicomolesPerLiterInOneMolesPerCubicMeter, (double)picomolesperliterQuantity.Value, PicomolesPerLiterTolerance); - Assert.Equal(MolarityUnit.PicomolesPerLiter, picomolesperliterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - AssertEx.EqualTolerance(1, Molarity.FromCentimolesPerLiter(molespercubicmeter.CentimolesPerLiter).MolesPerCubicMeter, CentimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromDecimolesPerLiter(molespercubicmeter.DecimolesPerLiter).MolesPerCubicMeter, DecimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMicromolesPerLiter(molespercubicmeter.MicromolesPerLiter).MolesPerCubicMeter, MicromolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMillimolesPerLiter(molespercubicmeter.MillimolesPerLiter).MolesPerCubicMeter, MillimolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMolesPerCubicMeter(molespercubicmeter.MolesPerCubicMeter).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromMolesPerLiter(molespercubicmeter.MolesPerLiter).MolesPerCubicMeter, MolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromNanomolesPerLiter(molespercubicmeter.NanomolesPerLiter).MolesPerCubicMeter, NanomolesPerLiterTolerance); - AssertEx.EqualTolerance(1, Molarity.FromPicomolesPerLiter(molespercubicmeter.PicomolesPerLiter).MolesPerCubicMeter, PicomolesPerLiterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Molarity v = Molarity.FromMolesPerCubicMeter(1); - AssertEx.EqualTolerance(-1, -v.MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Molarity.FromMolesPerCubicMeter(3)-v).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (Molarity.FromMolesPerCubicMeter(10)/5).MolesPerCubicMeter, MolesPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, Molarity.FromMolesPerCubicMeter(10)/Molarity.FromMolesPerCubicMeter(5), MolesPerCubicMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Molarity oneMolesPerCubicMeter = Molarity.FromMolesPerCubicMeter(1); - Molarity twoMolesPerCubicMeter = Molarity.FromMolesPerCubicMeter(2); - - Assert.True(oneMolesPerCubicMeter < twoMolesPerCubicMeter); - Assert.True(oneMolesPerCubicMeter <= twoMolesPerCubicMeter); - Assert.True(twoMolesPerCubicMeter > oneMolesPerCubicMeter); - Assert.True(twoMolesPerCubicMeter >= oneMolesPerCubicMeter); - - Assert.False(oneMolesPerCubicMeter > twoMolesPerCubicMeter); - Assert.False(oneMolesPerCubicMeter >= twoMolesPerCubicMeter); - Assert.False(twoMolesPerCubicMeter < oneMolesPerCubicMeter); - Assert.False(twoMolesPerCubicMeter <= oneMolesPerCubicMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - Assert.Equal(0, molespercubicmeter.CompareTo(molespercubicmeter)); - Assert.True(molespercubicmeter.CompareTo(Molarity.Zero) > 0); - Assert.True(Molarity.Zero.CompareTo(molespercubicmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - Assert.Throws(() => molespercubicmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - Assert.Throws(() => molespercubicmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Molarity v = Molarity.FromMolesPerCubicMeter(1); - Assert.True(v.Equals(Molarity.FromMolesPerCubicMeter(1), MolesPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Molarity.Zero, MolesPerCubicMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - Assert.False(molespercubicmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Molarity molespercubicmeter = Molarity.FromMolesPerCubicMeter(1); - Assert.False(molespercubicmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(MolarityUnit.Undefined, Molarity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(MolarityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == MolarityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs deleted file mode 100644 index 69aae1e7c0..0000000000 --- a/UnitsNet.Tests/GeneratedCode/PermeabilityTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Permeability. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class PermeabilityTestsBase - { - protected abstract double HenriesPerMeterInOneHenryPerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double HenriesPerMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Permeability((double)0.0, PermeabilityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Permeability(double.PositiveInfinity, PermeabilityUnit.HenryPerMeter)); - Assert.Throws(() => new Permeability(double.NegativeInfinity, PermeabilityUnit.HenryPerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Permeability(double.NaN, PermeabilityUnit.HenryPerMeter)); - } - - [Fact] - public void HenryPerMeterToPermeabilityUnits() - { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.HenriesPerMeter, HenriesPerMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Permeability.From(1, PermeabilityUnit.HenryPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); - } - - [Fact] - public void FromHenriesPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromHenriesPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Permeability.FromHenriesPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var henrypermeter = Permeability.FromHenriesPerMeter(1); - AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.As(PermeabilityUnit.HenryPerMeter), HenriesPerMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var henrypermeter = Permeability.FromHenriesPerMeter(1); - - var henrypermeterQuantity = henrypermeter.ToUnit(PermeabilityUnit.HenryPerMeter); - AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, (double)henrypermeterQuantity.Value, HenriesPerMeterTolerance); - Assert.Equal(PermeabilityUnit.HenryPerMeter, henrypermeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - AssertEx.EqualTolerance(1, Permeability.FromHenriesPerMeter(henrypermeter.HenriesPerMeter).HenriesPerMeter, HenriesPerMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Permeability v = Permeability.FromHenriesPerMeter(1); - AssertEx.EqualTolerance(-1, -v.HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permeability.FromHenriesPerMeter(3)-v).HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permeability.FromHenriesPerMeter(10)/5).HenriesPerMeter, HenriesPerMeterTolerance); - AssertEx.EqualTolerance(2, Permeability.FromHenriesPerMeter(10)/Permeability.FromHenriesPerMeter(5), HenriesPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Permeability oneHenryPerMeter = Permeability.FromHenriesPerMeter(1); - Permeability twoHenriesPerMeter = Permeability.FromHenriesPerMeter(2); - - Assert.True(oneHenryPerMeter < twoHenriesPerMeter); - Assert.True(oneHenryPerMeter <= twoHenriesPerMeter); - Assert.True(twoHenriesPerMeter > oneHenryPerMeter); - Assert.True(twoHenriesPerMeter >= oneHenryPerMeter); - - Assert.False(oneHenryPerMeter > twoHenriesPerMeter); - Assert.False(oneHenryPerMeter >= twoHenriesPerMeter); - Assert.False(twoHenriesPerMeter < oneHenryPerMeter); - Assert.False(twoHenriesPerMeter <= oneHenryPerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - Assert.Equal(0, henrypermeter.CompareTo(henrypermeter)); - Assert.True(henrypermeter.CompareTo(Permeability.Zero) > 0); - Assert.True(Permeability.Zero.CompareTo(henrypermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - Assert.Throws(() => henrypermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - Assert.Throws(() => henrypermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Permeability v = Permeability.FromHenriesPerMeter(1); - Assert.True(v.Equals(Permeability.FromHenriesPerMeter(1), HenriesPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Permeability.Zero, HenriesPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - Assert.False(henrypermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Permeability henrypermeter = Permeability.FromHenriesPerMeter(1); - Assert.False(henrypermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(PermeabilityUnit.Undefined, Permeability.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(PermeabilityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == PermeabilityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs deleted file mode 100644 index 8c183d36af..0000000000 --- a/UnitsNet.Tests/GeneratedCode/PermittivityTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Permittivity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class PermittivityTestsBase - { - protected abstract double FaradsPerMeterInOneFaradPerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double FaradsPerMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Permittivity((double)0.0, PermittivityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Permittivity(double.PositiveInfinity, PermittivityUnit.FaradPerMeter)); - Assert.Throws(() => new Permittivity(double.NegativeInfinity, PermittivityUnit.FaradPerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Permittivity(double.NaN, PermittivityUnit.FaradPerMeter)); - } - - [Fact] - public void FaradPerMeterToPermittivityUnits() - { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - AssertEx.EqualTolerance(FaradsPerMeterInOneFaradPerMeter, faradpermeter.FaradsPerMeter, FaradsPerMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Permittivity.From(1, PermittivityUnit.FaradPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); - } - - [Fact] - public void FromFaradsPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.PositiveInfinity)); - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromFaradsPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Permittivity.FromFaradsPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var faradpermeter = Permittivity.FromFaradsPerMeter(1); - AssertEx.EqualTolerance(FaradsPerMeterInOneFaradPerMeter, faradpermeter.As(PermittivityUnit.FaradPerMeter), FaradsPerMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var faradpermeter = Permittivity.FromFaradsPerMeter(1); - - var faradpermeterQuantity = faradpermeter.ToUnit(PermittivityUnit.FaradPerMeter); - AssertEx.EqualTolerance(FaradsPerMeterInOneFaradPerMeter, (double)faradpermeterQuantity.Value, FaradsPerMeterTolerance); - Assert.Equal(PermittivityUnit.FaradPerMeter, faradpermeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - AssertEx.EqualTolerance(1, Permittivity.FromFaradsPerMeter(faradpermeter.FaradsPerMeter).FaradsPerMeter, FaradsPerMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Permittivity v = Permittivity.FromFaradsPerMeter(1); - AssertEx.EqualTolerance(-1, -v.FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permittivity.FromFaradsPerMeter(3)-v).FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(2, (Permittivity.FromFaradsPerMeter(10)/5).FaradsPerMeter, FaradsPerMeterTolerance); - AssertEx.EqualTolerance(2, Permittivity.FromFaradsPerMeter(10)/Permittivity.FromFaradsPerMeter(5), FaradsPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Permittivity oneFaradPerMeter = Permittivity.FromFaradsPerMeter(1); - Permittivity twoFaradsPerMeter = Permittivity.FromFaradsPerMeter(2); - - Assert.True(oneFaradPerMeter < twoFaradsPerMeter); - Assert.True(oneFaradPerMeter <= twoFaradsPerMeter); - Assert.True(twoFaradsPerMeter > oneFaradPerMeter); - Assert.True(twoFaradsPerMeter >= oneFaradPerMeter); - - Assert.False(oneFaradPerMeter > twoFaradsPerMeter); - Assert.False(oneFaradPerMeter >= twoFaradsPerMeter); - Assert.False(twoFaradsPerMeter < oneFaradPerMeter); - Assert.False(twoFaradsPerMeter <= oneFaradPerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - Assert.Equal(0, faradpermeter.CompareTo(faradpermeter)); - Assert.True(faradpermeter.CompareTo(Permittivity.Zero) > 0); - Assert.True(Permittivity.Zero.CompareTo(faradpermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - Assert.Throws(() => faradpermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - Assert.Throws(() => faradpermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Permittivity v = Permittivity.FromFaradsPerMeter(1); - Assert.True(v.Equals(Permittivity.FromFaradsPerMeter(1), FaradsPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Permittivity.Zero, FaradsPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - Assert.False(faradpermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Permittivity faradpermeter = Permittivity.FromFaradsPerMeter(1); - Assert.False(faradpermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(PermittivityUnit.Undefined, Permittivity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(PermittivityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == PermittivityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs deleted file mode 100644 index f904dec7e3..0000000000 --- a/UnitsNet.Tests/GeneratedCode/PowerDensityTestsBase.g.cs +++ /dev/null @@ -1,654 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of PowerDensity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class PowerDensityTestsBase - { - protected abstract double DecawattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double DecawattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double DecawattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double DecawattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double DeciwattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double DeciwattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double DeciwattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double DeciwattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double GigawattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double GigawattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double GigawattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double GigawattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double KilowattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double KilowattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double KilowattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double KilowattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double MegawattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double MegawattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double MegawattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double MegawattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double MicrowattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double MicrowattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double MicrowattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double MicrowattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double MilliwattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double MilliwattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double MilliwattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double MilliwattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double NanowattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double NanowattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double NanowattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double NanowattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double PicowattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double PicowattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double PicowattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double PicowattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double TerawattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double TerawattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double TerawattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double TerawattsPerLiterInOneWattPerCubicMeter { get; } - protected abstract double WattsPerCubicFootInOneWattPerCubicMeter { get; } - protected abstract double WattsPerCubicInchInOneWattPerCubicMeter { get; } - protected abstract double WattsPerCubicMeterInOneWattPerCubicMeter { get; } - protected abstract double WattsPerLiterInOneWattPerCubicMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DecawattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double DecawattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double DecawattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double DecawattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double DeciwattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double DeciwattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double DeciwattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double DeciwattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double GigawattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double GigawattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double GigawattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double GigawattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double KilowattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double KilowattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double KilowattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double KilowattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double MegawattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double MegawattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double MegawattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double MegawattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double MicrowattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double MicrowattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double MicrowattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double MicrowattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double MilliwattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double MilliwattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double MilliwattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double MilliwattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double NanowattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double NanowattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double NanowattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double NanowattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double PicowattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double PicowattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double PicowattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double PicowattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double TerawattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double TerawattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double TerawattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double TerawattsPerLiterTolerance { get { return 1e-5; } } - protected virtual double WattsPerCubicFootTolerance { get { return 1e-5; } } - protected virtual double WattsPerCubicInchTolerance { get { return 1e-5; } } - protected virtual double WattsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double WattsPerLiterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new PowerDensity((double)0.0, PowerDensityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new PowerDensity(double.PositiveInfinity, PowerDensityUnit.WattPerCubicMeter)); - Assert.Throws(() => new PowerDensity(double.NegativeInfinity, PowerDensityUnit.WattPerCubicMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new PowerDensity(double.NaN, PowerDensityUnit.WattPerCubicMeter)); - } - - [Fact] - public void WattPerCubicMeterToPowerDensityUnits() - { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - AssertEx.EqualTolerance(DecawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.DecawattsPerCubicFoot, DecawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(DecawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.DecawattsPerCubicInch, DecawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(DecawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.DecawattsPerCubicMeter, DecawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(DecawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.DecawattsPerLiter, DecawattsPerLiterTolerance); - AssertEx.EqualTolerance(DeciwattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.DeciwattsPerCubicFoot, DeciwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(DeciwattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.DeciwattsPerCubicInch, DeciwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(DeciwattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.DeciwattsPerCubicMeter, DeciwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(DeciwattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.DeciwattsPerLiter, DeciwattsPerLiterTolerance); - AssertEx.EqualTolerance(GigawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.GigawattsPerCubicFoot, GigawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(GigawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.GigawattsPerCubicInch, GigawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(GigawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.GigawattsPerCubicMeter, GigawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(GigawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.GigawattsPerLiter, GigawattsPerLiterTolerance); - AssertEx.EqualTolerance(KilowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.KilowattsPerCubicFoot, KilowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(KilowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.KilowattsPerCubicInch, KilowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(KilowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.KilowattsPerCubicMeter, KilowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(KilowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.KilowattsPerLiter, KilowattsPerLiterTolerance); - AssertEx.EqualTolerance(MegawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.MegawattsPerCubicFoot, MegawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(MegawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.MegawattsPerCubicInch, MegawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(MegawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.MegawattsPerCubicMeter, MegawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MegawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.MegawattsPerLiter, MegawattsPerLiterTolerance); - AssertEx.EqualTolerance(MicrowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.MicrowattsPerCubicFoot, MicrowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(MicrowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.MicrowattsPerCubicInch, MicrowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(MicrowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.MicrowattsPerCubicMeter, MicrowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MicrowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.MicrowattsPerLiter, MicrowattsPerLiterTolerance); - AssertEx.EqualTolerance(MilliwattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.MilliwattsPerCubicFoot, MilliwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(MilliwattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.MilliwattsPerCubicInch, MilliwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(MilliwattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.MilliwattsPerCubicMeter, MilliwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MilliwattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.MilliwattsPerLiter, MilliwattsPerLiterTolerance); - AssertEx.EqualTolerance(NanowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.NanowattsPerCubicFoot, NanowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(NanowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.NanowattsPerCubicInch, NanowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(NanowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.NanowattsPerCubicMeter, NanowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(NanowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.NanowattsPerLiter, NanowattsPerLiterTolerance); - AssertEx.EqualTolerance(PicowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.PicowattsPerCubicFoot, PicowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(PicowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.PicowattsPerCubicInch, PicowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(PicowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.PicowattsPerCubicMeter, PicowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(PicowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.PicowattsPerLiter, PicowattsPerLiterTolerance); - AssertEx.EqualTolerance(TerawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.TerawattsPerCubicFoot, TerawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(TerawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.TerawattsPerCubicInch, TerawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(TerawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.TerawattsPerCubicMeter, TerawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(TerawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.TerawattsPerLiter, TerawattsPerLiterTolerance); - AssertEx.EqualTolerance(WattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.WattsPerCubicFoot, WattsPerCubicFootTolerance); - AssertEx.EqualTolerance(WattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.WattsPerCubicInch, WattsPerCubicInchTolerance); - AssertEx.EqualTolerance(WattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(WattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.WattsPerLiter, WattsPerLiterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicFoot).DecawattsPerCubicFoot, DecawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicInch).DecawattsPerCubicInch, DecawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerCubicMeter).DecawattsPerCubicMeter, DecawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DecawattPerLiter).DecawattsPerLiter, DecawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicFoot).DeciwattsPerCubicFoot, DeciwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicInch).DeciwattsPerCubicInch, DeciwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerCubicMeter).DeciwattsPerCubicMeter, DeciwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.DeciwattPerLiter).DeciwattsPerLiter, DeciwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicFoot).GigawattsPerCubicFoot, GigawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicInch).GigawattsPerCubicInch, GigawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerCubicMeter).GigawattsPerCubicMeter, GigawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.GigawattPerLiter).GigawattsPerLiter, GigawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicFoot).KilowattsPerCubicFoot, KilowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicInch).KilowattsPerCubicInch, KilowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerCubicMeter).KilowattsPerCubicMeter, KilowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.KilowattPerLiter).KilowattsPerLiter, KilowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicFoot).MegawattsPerCubicFoot, MegawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicInch).MegawattsPerCubicInch, MegawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerCubicMeter).MegawattsPerCubicMeter, MegawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MegawattPerLiter).MegawattsPerLiter, MegawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicFoot).MicrowattsPerCubicFoot, MicrowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicInch).MicrowattsPerCubicInch, MicrowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerCubicMeter).MicrowattsPerCubicMeter, MicrowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MicrowattPerLiter).MicrowattsPerLiter, MicrowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicFoot).MilliwattsPerCubicFoot, MilliwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicInch).MilliwattsPerCubicInch, MilliwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerCubicMeter).MilliwattsPerCubicMeter, MilliwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.MilliwattPerLiter).MilliwattsPerLiter, MilliwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicFoot).NanowattsPerCubicFoot, NanowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicInch).NanowattsPerCubicInch, NanowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerCubicMeter).NanowattsPerCubicMeter, NanowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.NanowattPerLiter).NanowattsPerLiter, NanowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicFoot).PicowattsPerCubicFoot, PicowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicInch).PicowattsPerCubicInch, PicowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerCubicMeter).PicowattsPerCubicMeter, PicowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.PicowattPerLiter).PicowattsPerLiter, PicowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicFoot).TerawattsPerCubicFoot, TerawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicInch).TerawattsPerCubicInch, TerawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerCubicMeter).TerawattsPerCubicMeter, TerawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.TerawattPerLiter).TerawattsPerLiter, TerawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicFoot).WattsPerCubicFoot, WattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicInch).WattsPerCubicInch, WattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerCubicMeter).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.From(1, PowerDensityUnit.WattPerLiter).WattsPerLiter, WattsPerLiterTolerance); - } - - [Fact] - public void FromWattsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromWattsPerCubicMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => PowerDensity.FromWattsPerCubicMeter(double.NaN)); - } - - [Fact] - public void As() - { - var wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - AssertEx.EqualTolerance(DecawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DecawattPerCubicFoot), DecawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(DecawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DecawattPerCubicInch), DecawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(DecawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DecawattPerCubicMeter), DecawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(DecawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DecawattPerLiter), DecawattsPerLiterTolerance); - AssertEx.EqualTolerance(DeciwattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DeciwattPerCubicFoot), DeciwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(DeciwattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DeciwattPerCubicInch), DeciwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(DeciwattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DeciwattPerCubicMeter), DeciwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(DeciwattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.DeciwattPerLiter), DeciwattsPerLiterTolerance); - AssertEx.EqualTolerance(GigawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.GigawattPerCubicFoot), GigawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(GigawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.GigawattPerCubicInch), GigawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(GigawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.GigawattPerCubicMeter), GigawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(GigawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.GigawattPerLiter), GigawattsPerLiterTolerance); - AssertEx.EqualTolerance(KilowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.KilowattPerCubicFoot), KilowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(KilowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.KilowattPerCubicInch), KilowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(KilowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.KilowattPerCubicMeter), KilowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(KilowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.KilowattPerLiter), KilowattsPerLiterTolerance); - AssertEx.EqualTolerance(MegawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MegawattPerCubicFoot), MegawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(MegawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MegawattPerCubicInch), MegawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(MegawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MegawattPerCubicMeter), MegawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MegawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MegawattPerLiter), MegawattsPerLiterTolerance); - AssertEx.EqualTolerance(MicrowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MicrowattPerCubicFoot), MicrowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(MicrowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MicrowattPerCubicInch), MicrowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(MicrowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MicrowattPerCubicMeter), MicrowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MicrowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MicrowattPerLiter), MicrowattsPerLiterTolerance); - AssertEx.EqualTolerance(MilliwattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MilliwattPerCubicFoot), MilliwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(MilliwattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MilliwattPerCubicInch), MilliwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(MilliwattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MilliwattPerCubicMeter), MilliwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(MilliwattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.MilliwattPerLiter), MilliwattsPerLiterTolerance); - AssertEx.EqualTolerance(NanowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.NanowattPerCubicFoot), NanowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(NanowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.NanowattPerCubicInch), NanowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(NanowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.NanowattPerCubicMeter), NanowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(NanowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.NanowattPerLiter), NanowattsPerLiterTolerance); - AssertEx.EqualTolerance(PicowattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.PicowattPerCubicFoot), PicowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(PicowattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.PicowattPerCubicInch), PicowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(PicowattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.PicowattPerCubicMeter), PicowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(PicowattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.PicowattPerLiter), PicowattsPerLiterTolerance); - AssertEx.EqualTolerance(TerawattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.TerawattPerCubicFoot), TerawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(TerawattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.TerawattPerCubicInch), TerawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(TerawattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.TerawattPerCubicMeter), TerawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(TerawattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.TerawattPerLiter), TerawattsPerLiterTolerance); - AssertEx.EqualTolerance(WattsPerCubicFootInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.WattPerCubicFoot), WattsPerCubicFootTolerance); - AssertEx.EqualTolerance(WattsPerCubicInchInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.WattPerCubicInch), WattsPerCubicInchTolerance); - AssertEx.EqualTolerance(WattsPerCubicMeterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.WattPerCubicMeter), WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(WattsPerLiterInOneWattPerCubicMeter, wattpercubicmeter.As(PowerDensityUnit.WattPerLiter), WattsPerLiterTolerance); - } - - [Fact] - public void ToUnit() - { - var wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - - var decawattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DecawattPerCubicFoot); - AssertEx.EqualTolerance(DecawattsPerCubicFootInOneWattPerCubicMeter, (double)decawattpercubicfootQuantity.Value, DecawattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.DecawattPerCubicFoot, decawattpercubicfootQuantity.Unit); - - var decawattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DecawattPerCubicInch); - AssertEx.EqualTolerance(DecawattsPerCubicInchInOneWattPerCubicMeter, (double)decawattpercubicinchQuantity.Value, DecawattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.DecawattPerCubicInch, decawattpercubicinchQuantity.Unit); - - var decawattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DecawattPerCubicMeter); - AssertEx.EqualTolerance(DecawattsPerCubicMeterInOneWattPerCubicMeter, (double)decawattpercubicmeterQuantity.Value, DecawattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.DecawattPerCubicMeter, decawattpercubicmeterQuantity.Unit); - - var decawattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DecawattPerLiter); - AssertEx.EqualTolerance(DecawattsPerLiterInOneWattPerCubicMeter, (double)decawattperliterQuantity.Value, DecawattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.DecawattPerLiter, decawattperliterQuantity.Unit); - - var deciwattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DeciwattPerCubicFoot); - AssertEx.EqualTolerance(DeciwattsPerCubicFootInOneWattPerCubicMeter, (double)deciwattpercubicfootQuantity.Value, DeciwattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.DeciwattPerCubicFoot, deciwattpercubicfootQuantity.Unit); - - var deciwattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DeciwattPerCubicInch); - AssertEx.EqualTolerance(DeciwattsPerCubicInchInOneWattPerCubicMeter, (double)deciwattpercubicinchQuantity.Value, DeciwattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.DeciwattPerCubicInch, deciwattpercubicinchQuantity.Unit); - - var deciwattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DeciwattPerCubicMeter); - AssertEx.EqualTolerance(DeciwattsPerCubicMeterInOneWattPerCubicMeter, (double)deciwattpercubicmeterQuantity.Value, DeciwattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.DeciwattPerCubicMeter, deciwattpercubicmeterQuantity.Unit); - - var deciwattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.DeciwattPerLiter); - AssertEx.EqualTolerance(DeciwattsPerLiterInOneWattPerCubicMeter, (double)deciwattperliterQuantity.Value, DeciwattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.DeciwattPerLiter, deciwattperliterQuantity.Unit); - - var gigawattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.GigawattPerCubicFoot); - AssertEx.EqualTolerance(GigawattsPerCubicFootInOneWattPerCubicMeter, (double)gigawattpercubicfootQuantity.Value, GigawattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.GigawattPerCubicFoot, gigawattpercubicfootQuantity.Unit); - - var gigawattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.GigawattPerCubicInch); - AssertEx.EqualTolerance(GigawattsPerCubicInchInOneWattPerCubicMeter, (double)gigawattpercubicinchQuantity.Value, GigawattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.GigawattPerCubicInch, gigawattpercubicinchQuantity.Unit); - - var gigawattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.GigawattPerCubicMeter); - AssertEx.EqualTolerance(GigawattsPerCubicMeterInOneWattPerCubicMeter, (double)gigawattpercubicmeterQuantity.Value, GigawattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.GigawattPerCubicMeter, gigawattpercubicmeterQuantity.Unit); - - var gigawattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.GigawattPerLiter); - AssertEx.EqualTolerance(GigawattsPerLiterInOneWattPerCubicMeter, (double)gigawattperliterQuantity.Value, GigawattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.GigawattPerLiter, gigawattperliterQuantity.Unit); - - var kilowattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.KilowattPerCubicFoot); - AssertEx.EqualTolerance(KilowattsPerCubicFootInOneWattPerCubicMeter, (double)kilowattpercubicfootQuantity.Value, KilowattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.KilowattPerCubicFoot, kilowattpercubicfootQuantity.Unit); - - var kilowattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.KilowattPerCubicInch); - AssertEx.EqualTolerance(KilowattsPerCubicInchInOneWattPerCubicMeter, (double)kilowattpercubicinchQuantity.Value, KilowattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.KilowattPerCubicInch, kilowattpercubicinchQuantity.Unit); - - var kilowattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.KilowattPerCubicMeter); - AssertEx.EqualTolerance(KilowattsPerCubicMeterInOneWattPerCubicMeter, (double)kilowattpercubicmeterQuantity.Value, KilowattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.KilowattPerCubicMeter, kilowattpercubicmeterQuantity.Unit); - - var kilowattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.KilowattPerLiter); - AssertEx.EqualTolerance(KilowattsPerLiterInOneWattPerCubicMeter, (double)kilowattperliterQuantity.Value, KilowattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.KilowattPerLiter, kilowattperliterQuantity.Unit); - - var megawattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MegawattPerCubicFoot); - AssertEx.EqualTolerance(MegawattsPerCubicFootInOneWattPerCubicMeter, (double)megawattpercubicfootQuantity.Value, MegawattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.MegawattPerCubicFoot, megawattpercubicfootQuantity.Unit); - - var megawattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MegawattPerCubicInch); - AssertEx.EqualTolerance(MegawattsPerCubicInchInOneWattPerCubicMeter, (double)megawattpercubicinchQuantity.Value, MegawattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.MegawattPerCubicInch, megawattpercubicinchQuantity.Unit); - - var megawattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MegawattPerCubicMeter); - AssertEx.EqualTolerance(MegawattsPerCubicMeterInOneWattPerCubicMeter, (double)megawattpercubicmeterQuantity.Value, MegawattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.MegawattPerCubicMeter, megawattpercubicmeterQuantity.Unit); - - var megawattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MegawattPerLiter); - AssertEx.EqualTolerance(MegawattsPerLiterInOneWattPerCubicMeter, (double)megawattperliterQuantity.Value, MegawattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.MegawattPerLiter, megawattperliterQuantity.Unit); - - var microwattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MicrowattPerCubicFoot); - AssertEx.EqualTolerance(MicrowattsPerCubicFootInOneWattPerCubicMeter, (double)microwattpercubicfootQuantity.Value, MicrowattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.MicrowattPerCubicFoot, microwattpercubicfootQuantity.Unit); - - var microwattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MicrowattPerCubicInch); - AssertEx.EqualTolerance(MicrowattsPerCubicInchInOneWattPerCubicMeter, (double)microwattpercubicinchQuantity.Value, MicrowattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.MicrowattPerCubicInch, microwattpercubicinchQuantity.Unit); - - var microwattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MicrowattPerCubicMeter); - AssertEx.EqualTolerance(MicrowattsPerCubicMeterInOneWattPerCubicMeter, (double)microwattpercubicmeterQuantity.Value, MicrowattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.MicrowattPerCubicMeter, microwattpercubicmeterQuantity.Unit); - - var microwattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MicrowattPerLiter); - AssertEx.EqualTolerance(MicrowattsPerLiterInOneWattPerCubicMeter, (double)microwattperliterQuantity.Value, MicrowattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.MicrowattPerLiter, microwattperliterQuantity.Unit); - - var milliwattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MilliwattPerCubicFoot); - AssertEx.EqualTolerance(MilliwattsPerCubicFootInOneWattPerCubicMeter, (double)milliwattpercubicfootQuantity.Value, MilliwattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.MilliwattPerCubicFoot, milliwattpercubicfootQuantity.Unit); - - var milliwattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MilliwattPerCubicInch); - AssertEx.EqualTolerance(MilliwattsPerCubicInchInOneWattPerCubicMeter, (double)milliwattpercubicinchQuantity.Value, MilliwattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.MilliwattPerCubicInch, milliwattpercubicinchQuantity.Unit); - - var milliwattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MilliwattPerCubicMeter); - AssertEx.EqualTolerance(MilliwattsPerCubicMeterInOneWattPerCubicMeter, (double)milliwattpercubicmeterQuantity.Value, MilliwattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.MilliwattPerCubicMeter, milliwattpercubicmeterQuantity.Unit); - - var milliwattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.MilliwattPerLiter); - AssertEx.EqualTolerance(MilliwattsPerLiterInOneWattPerCubicMeter, (double)milliwattperliterQuantity.Value, MilliwattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.MilliwattPerLiter, milliwattperliterQuantity.Unit); - - var nanowattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.NanowattPerCubicFoot); - AssertEx.EqualTolerance(NanowattsPerCubicFootInOneWattPerCubicMeter, (double)nanowattpercubicfootQuantity.Value, NanowattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.NanowattPerCubicFoot, nanowattpercubicfootQuantity.Unit); - - var nanowattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.NanowattPerCubicInch); - AssertEx.EqualTolerance(NanowattsPerCubicInchInOneWattPerCubicMeter, (double)nanowattpercubicinchQuantity.Value, NanowattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.NanowattPerCubicInch, nanowattpercubicinchQuantity.Unit); - - var nanowattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.NanowattPerCubicMeter); - AssertEx.EqualTolerance(NanowattsPerCubicMeterInOneWattPerCubicMeter, (double)nanowattpercubicmeterQuantity.Value, NanowattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.NanowattPerCubicMeter, nanowattpercubicmeterQuantity.Unit); - - var nanowattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.NanowattPerLiter); - AssertEx.EqualTolerance(NanowattsPerLiterInOneWattPerCubicMeter, (double)nanowattperliterQuantity.Value, NanowattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.NanowattPerLiter, nanowattperliterQuantity.Unit); - - var picowattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.PicowattPerCubicFoot); - AssertEx.EqualTolerance(PicowattsPerCubicFootInOneWattPerCubicMeter, (double)picowattpercubicfootQuantity.Value, PicowattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.PicowattPerCubicFoot, picowattpercubicfootQuantity.Unit); - - var picowattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.PicowattPerCubicInch); - AssertEx.EqualTolerance(PicowattsPerCubicInchInOneWattPerCubicMeter, (double)picowattpercubicinchQuantity.Value, PicowattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.PicowattPerCubicInch, picowattpercubicinchQuantity.Unit); - - var picowattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.PicowattPerCubicMeter); - AssertEx.EqualTolerance(PicowattsPerCubicMeterInOneWattPerCubicMeter, (double)picowattpercubicmeterQuantity.Value, PicowattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.PicowattPerCubicMeter, picowattpercubicmeterQuantity.Unit); - - var picowattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.PicowattPerLiter); - AssertEx.EqualTolerance(PicowattsPerLiterInOneWattPerCubicMeter, (double)picowattperliterQuantity.Value, PicowattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.PicowattPerLiter, picowattperliterQuantity.Unit); - - var terawattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.TerawattPerCubicFoot); - AssertEx.EqualTolerance(TerawattsPerCubicFootInOneWattPerCubicMeter, (double)terawattpercubicfootQuantity.Value, TerawattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.TerawattPerCubicFoot, terawattpercubicfootQuantity.Unit); - - var terawattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.TerawattPerCubicInch); - AssertEx.EqualTolerance(TerawattsPerCubicInchInOneWattPerCubicMeter, (double)terawattpercubicinchQuantity.Value, TerawattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.TerawattPerCubicInch, terawattpercubicinchQuantity.Unit); - - var terawattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.TerawattPerCubicMeter); - AssertEx.EqualTolerance(TerawattsPerCubicMeterInOneWattPerCubicMeter, (double)terawattpercubicmeterQuantity.Value, TerawattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.TerawattPerCubicMeter, terawattpercubicmeterQuantity.Unit); - - var terawattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.TerawattPerLiter); - AssertEx.EqualTolerance(TerawattsPerLiterInOneWattPerCubicMeter, (double)terawattperliterQuantity.Value, TerawattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.TerawattPerLiter, terawattperliterQuantity.Unit); - - var wattpercubicfootQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.WattPerCubicFoot); - AssertEx.EqualTolerance(WattsPerCubicFootInOneWattPerCubicMeter, (double)wattpercubicfootQuantity.Value, WattsPerCubicFootTolerance); - Assert.Equal(PowerDensityUnit.WattPerCubicFoot, wattpercubicfootQuantity.Unit); - - var wattpercubicinchQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.WattPerCubicInch); - AssertEx.EqualTolerance(WattsPerCubicInchInOneWattPerCubicMeter, (double)wattpercubicinchQuantity.Value, WattsPerCubicInchTolerance); - Assert.Equal(PowerDensityUnit.WattPerCubicInch, wattpercubicinchQuantity.Unit); - - var wattpercubicmeterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.WattPerCubicMeter); - AssertEx.EqualTolerance(WattsPerCubicMeterInOneWattPerCubicMeter, (double)wattpercubicmeterQuantity.Value, WattsPerCubicMeterTolerance); - Assert.Equal(PowerDensityUnit.WattPerCubicMeter, wattpercubicmeterQuantity.Unit); - - var wattperliterQuantity = wattpercubicmeter.ToUnit(PowerDensityUnit.WattPerLiter); - AssertEx.EqualTolerance(WattsPerLiterInOneWattPerCubicMeter, (double)wattperliterQuantity.Value, WattsPerLiterTolerance); - Assert.Equal(PowerDensityUnit.WattPerLiter, wattperliterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicFoot(wattpercubicmeter.DecawattsPerCubicFoot).WattsPerCubicMeter, DecawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicInch(wattpercubicmeter.DecawattsPerCubicInch).WattsPerCubicMeter, DecawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerCubicMeter(wattpercubicmeter.DecawattsPerCubicMeter).WattsPerCubicMeter, DecawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDecawattsPerLiter(wattpercubicmeter.DecawattsPerLiter).WattsPerCubicMeter, DecawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicFoot(wattpercubicmeter.DeciwattsPerCubicFoot).WattsPerCubicMeter, DeciwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicInch(wattpercubicmeter.DeciwattsPerCubicInch).WattsPerCubicMeter, DeciwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerCubicMeter(wattpercubicmeter.DeciwattsPerCubicMeter).WattsPerCubicMeter, DeciwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromDeciwattsPerLiter(wattpercubicmeter.DeciwattsPerLiter).WattsPerCubicMeter, DeciwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicFoot(wattpercubicmeter.GigawattsPerCubicFoot).WattsPerCubicMeter, GigawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicInch(wattpercubicmeter.GigawattsPerCubicInch).WattsPerCubicMeter, GigawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerCubicMeter(wattpercubicmeter.GigawattsPerCubicMeter).WattsPerCubicMeter, GigawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromGigawattsPerLiter(wattpercubicmeter.GigawattsPerLiter).WattsPerCubicMeter, GigawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicFoot(wattpercubicmeter.KilowattsPerCubicFoot).WattsPerCubicMeter, KilowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicInch(wattpercubicmeter.KilowattsPerCubicInch).WattsPerCubicMeter, KilowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerCubicMeter(wattpercubicmeter.KilowattsPerCubicMeter).WattsPerCubicMeter, KilowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromKilowattsPerLiter(wattpercubicmeter.KilowattsPerLiter).WattsPerCubicMeter, KilowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicFoot(wattpercubicmeter.MegawattsPerCubicFoot).WattsPerCubicMeter, MegawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicInch(wattpercubicmeter.MegawattsPerCubicInch).WattsPerCubicMeter, MegawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerCubicMeter(wattpercubicmeter.MegawattsPerCubicMeter).WattsPerCubicMeter, MegawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMegawattsPerLiter(wattpercubicmeter.MegawattsPerLiter).WattsPerCubicMeter, MegawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicFoot(wattpercubicmeter.MicrowattsPerCubicFoot).WattsPerCubicMeter, MicrowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicInch(wattpercubicmeter.MicrowattsPerCubicInch).WattsPerCubicMeter, MicrowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerCubicMeter(wattpercubicmeter.MicrowattsPerCubicMeter).WattsPerCubicMeter, MicrowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMicrowattsPerLiter(wattpercubicmeter.MicrowattsPerLiter).WattsPerCubicMeter, MicrowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicFoot(wattpercubicmeter.MilliwattsPerCubicFoot).WattsPerCubicMeter, MilliwattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicInch(wattpercubicmeter.MilliwattsPerCubicInch).WattsPerCubicMeter, MilliwattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerCubicMeter(wattpercubicmeter.MilliwattsPerCubicMeter).WattsPerCubicMeter, MilliwattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromMilliwattsPerLiter(wattpercubicmeter.MilliwattsPerLiter).WattsPerCubicMeter, MilliwattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicFoot(wattpercubicmeter.NanowattsPerCubicFoot).WattsPerCubicMeter, NanowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicInch(wattpercubicmeter.NanowattsPerCubicInch).WattsPerCubicMeter, NanowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerCubicMeter(wattpercubicmeter.NanowattsPerCubicMeter).WattsPerCubicMeter, NanowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromNanowattsPerLiter(wattpercubicmeter.NanowattsPerLiter).WattsPerCubicMeter, NanowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicFoot(wattpercubicmeter.PicowattsPerCubicFoot).WattsPerCubicMeter, PicowattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicInch(wattpercubicmeter.PicowattsPerCubicInch).WattsPerCubicMeter, PicowattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerCubicMeter(wattpercubicmeter.PicowattsPerCubicMeter).WattsPerCubicMeter, PicowattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromPicowattsPerLiter(wattpercubicmeter.PicowattsPerLiter).WattsPerCubicMeter, PicowattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicFoot(wattpercubicmeter.TerawattsPerCubicFoot).WattsPerCubicMeter, TerawattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicInch(wattpercubicmeter.TerawattsPerCubicInch).WattsPerCubicMeter, TerawattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerCubicMeter(wattpercubicmeter.TerawattsPerCubicMeter).WattsPerCubicMeter, TerawattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromTerawattsPerLiter(wattpercubicmeter.TerawattsPerLiter).WattsPerCubicMeter, TerawattsPerLiterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicFoot(wattpercubicmeter.WattsPerCubicFoot).WattsPerCubicMeter, WattsPerCubicFootTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicInch(wattpercubicmeter.WattsPerCubicInch).WattsPerCubicMeter, WattsPerCubicInchTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerCubicMeter(wattpercubicmeter.WattsPerCubicMeter).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, PowerDensity.FromWattsPerLiter(wattpercubicmeter.WattsPerLiter).WattsPerCubicMeter, WattsPerLiterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - PowerDensity v = PowerDensity.FromWattsPerCubicMeter(1); - AssertEx.EqualTolerance(-1, -v.WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (PowerDensity.FromWattsPerCubicMeter(3)-v).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (PowerDensity.FromWattsPerCubicMeter(10)/5).WattsPerCubicMeter, WattsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, PowerDensity.FromWattsPerCubicMeter(10)/PowerDensity.FromWattsPerCubicMeter(5), WattsPerCubicMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - PowerDensity oneWattPerCubicMeter = PowerDensity.FromWattsPerCubicMeter(1); - PowerDensity twoWattsPerCubicMeter = PowerDensity.FromWattsPerCubicMeter(2); - - Assert.True(oneWattPerCubicMeter < twoWattsPerCubicMeter); - Assert.True(oneWattPerCubicMeter <= twoWattsPerCubicMeter); - Assert.True(twoWattsPerCubicMeter > oneWattPerCubicMeter); - Assert.True(twoWattsPerCubicMeter >= oneWattPerCubicMeter); - - Assert.False(oneWattPerCubicMeter > twoWattsPerCubicMeter); - Assert.False(oneWattPerCubicMeter >= twoWattsPerCubicMeter); - Assert.False(twoWattsPerCubicMeter < oneWattPerCubicMeter); - Assert.False(twoWattsPerCubicMeter <= oneWattPerCubicMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - Assert.Equal(0, wattpercubicmeter.CompareTo(wattpercubicmeter)); - Assert.True(wattpercubicmeter.CompareTo(PowerDensity.Zero) > 0); - Assert.True(PowerDensity.Zero.CompareTo(wattpercubicmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - Assert.Throws(() => wattpercubicmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - Assert.Throws(() => wattpercubicmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - PowerDensity v = PowerDensity.FromWattsPerCubicMeter(1); - Assert.True(v.Equals(PowerDensity.FromWattsPerCubicMeter(1), WattsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(PowerDensity.Zero, WattsPerCubicMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - Assert.False(wattpercubicmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - PowerDensity wattpercubicmeter = PowerDensity.FromWattsPerCubicMeter(1); - Assert.False(wattpercubicmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(PowerDensityUnit.Undefined, PowerDensity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(PowerDensityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == PowerDensityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs deleted file mode 100644 index 6b544593f8..0000000000 --- a/UnitsNet.Tests/GeneratedCode/PowerRatioTestsBase.g.cs +++ /dev/null @@ -1,239 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of PowerRatio. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class PowerRatioTestsBase - { - protected abstract double DecibelMilliwattsInOneDecibelWatt { get; } - protected abstract double DecibelWattsInOneDecibelWatt { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DecibelMilliwattsTolerance { get { return 1e-5; } } - protected virtual double DecibelWattsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new PowerRatio((double)0.0, PowerRatioUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new PowerRatio(double.PositiveInfinity, PowerRatioUnit.DecibelWatt)); - Assert.Throws(() => new PowerRatio(double.NegativeInfinity, PowerRatioUnit.DecibelWatt)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new PowerRatio(double.NaN, PowerRatioUnit.DecibelWatt)); - } - - [Fact] - public void DecibelWattToPowerRatioUnits() - { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - AssertEx.EqualTolerance(DecibelMilliwattsInOneDecibelWatt, decibelwatt.DecibelMilliwatts, DecibelMilliwattsTolerance); - AssertEx.EqualTolerance(DecibelWattsInOneDecibelWatt, decibelwatt.DecibelWatts, DecibelWattsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelMilliwatt).DecibelMilliwatts, DecibelMilliwattsTolerance); - AssertEx.EqualTolerance(1, PowerRatio.From(1, PowerRatioUnit.DecibelWatt).DecibelWatts, DecibelWattsTolerance); - } - - [Fact] - public void FromDecibelWatts_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.PositiveInfinity)); - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NegativeInfinity)); - } - - [Fact] - public void FromDecibelWatts_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => PowerRatio.FromDecibelWatts(double.NaN)); - } - - [Fact] - public void As() - { - var decibelwatt = PowerRatio.FromDecibelWatts(1); - AssertEx.EqualTolerance(DecibelMilliwattsInOneDecibelWatt, decibelwatt.As(PowerRatioUnit.DecibelMilliwatt), DecibelMilliwattsTolerance); - AssertEx.EqualTolerance(DecibelWattsInOneDecibelWatt, decibelwatt.As(PowerRatioUnit.DecibelWatt), DecibelWattsTolerance); - } - - [Fact] - public void ToUnit() - { - var decibelwatt = PowerRatio.FromDecibelWatts(1); - - var decibelmilliwattQuantity = decibelwatt.ToUnit(PowerRatioUnit.DecibelMilliwatt); - AssertEx.EqualTolerance(DecibelMilliwattsInOneDecibelWatt, (double)decibelmilliwattQuantity.Value, DecibelMilliwattsTolerance); - Assert.Equal(PowerRatioUnit.DecibelMilliwatt, decibelmilliwattQuantity.Unit); - - var decibelwattQuantity = decibelwatt.ToUnit(PowerRatioUnit.DecibelWatt); - AssertEx.EqualTolerance(DecibelWattsInOneDecibelWatt, (double)decibelwattQuantity.Value, DecibelWattsTolerance); - Assert.Equal(PowerRatioUnit.DecibelWatt, decibelwattQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - AssertEx.EqualTolerance(1, PowerRatio.FromDecibelMilliwatts(decibelwatt.DecibelMilliwatts).DecibelWatts, DecibelMilliwattsTolerance); - AssertEx.EqualTolerance(1, PowerRatio.FromDecibelWatts(decibelwatt.DecibelWatts).DecibelWatts, DecibelWattsTolerance); - } - - [Fact] - public void LogarithmicArithmeticOperators() - { - PowerRatio v = PowerRatio.FromDecibelWatts(40); - AssertEx.EqualTolerance(-40, -v.DecibelWatts, DecibelWattsTolerance); - AssertLogarithmicAddition(); - AssertLogarithmicSubtraction(); - AssertEx.EqualTolerance(50, (v*10).DecibelWatts, DecibelWattsTolerance); - AssertEx.EqualTolerance(50, (10*v).DecibelWatts, DecibelWattsTolerance); - AssertEx.EqualTolerance(35, (v/5).DecibelWatts, DecibelWattsTolerance); - AssertEx.EqualTolerance(35, v/PowerRatio.FromDecibelWatts(5), DecibelWattsTolerance); - } - - protected abstract void AssertLogarithmicAddition(); - - protected abstract void AssertLogarithmicSubtraction(); - - - [Fact] - public void ComparisonOperators() - { - PowerRatio oneDecibelWatt = PowerRatio.FromDecibelWatts(1); - PowerRatio twoDecibelWatts = PowerRatio.FromDecibelWatts(2); - - Assert.True(oneDecibelWatt < twoDecibelWatts); - Assert.True(oneDecibelWatt <= twoDecibelWatts); - Assert.True(twoDecibelWatts > oneDecibelWatt); - Assert.True(twoDecibelWatts >= oneDecibelWatt); - - Assert.False(oneDecibelWatt > twoDecibelWatts); - Assert.False(oneDecibelWatt >= twoDecibelWatts); - Assert.False(twoDecibelWatts < oneDecibelWatt); - Assert.False(twoDecibelWatts <= oneDecibelWatt); - } - - [Fact] - public void CompareToIsImplemented() - { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - Assert.Equal(0, decibelwatt.CompareTo(decibelwatt)); - Assert.True(decibelwatt.CompareTo(PowerRatio.Zero) > 0); - Assert.True(PowerRatio.Zero.CompareTo(decibelwatt) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - Assert.Throws(() => decibelwatt.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - Assert.Throws(() => decibelwatt.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - PowerRatio v = PowerRatio.FromDecibelWatts(1); - Assert.True(v.Equals(PowerRatio.FromDecibelWatts(1), DecibelWattsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(PowerRatio.Zero, DecibelWattsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - Assert.False(decibelwatt.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - PowerRatio decibelwatt = PowerRatio.FromDecibelWatts(1); - Assert.False(decibelwatt.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(PowerRatioUnit.Undefined, PowerRatio.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(PowerRatioUnit)).Cast(); - foreach(var unit in units) - { - if(unit == PowerRatioUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs deleted file mode 100644 index efb6e9a3c0..0000000000 --- a/UnitsNet.Tests/GeneratedCode/PowerTestsBase.g.cs +++ /dev/null @@ -1,390 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Power. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class PowerTestsBase - { - protected abstract double BoilerHorsepowerInOneWatt { get; } - protected abstract double BritishThermalUnitsPerHourInOneWatt { get; } - protected abstract double DecawattsInOneWatt { get; } - protected abstract double DeciwattsInOneWatt { get; } - protected abstract double ElectricalHorsepowerInOneWatt { get; } - protected abstract double FemtowattsInOneWatt { get; } - protected abstract double GigawattsInOneWatt { get; } - protected abstract double HydraulicHorsepowerInOneWatt { get; } - protected abstract double KilobritishThermalUnitsPerHourInOneWatt { get; } - protected abstract double KilowattsInOneWatt { get; } - protected abstract double MechanicalHorsepowerInOneWatt { get; } - protected abstract double MegawattsInOneWatt { get; } - protected abstract double MetricHorsepowerInOneWatt { get; } - protected abstract double MicrowattsInOneWatt { get; } - protected abstract double MilliwattsInOneWatt { get; } - protected abstract double NanowattsInOneWatt { get; } - protected abstract double PetawattsInOneWatt { get; } - protected abstract double PicowattsInOneWatt { get; } - protected abstract double TerawattsInOneWatt { get; } - protected abstract double WattsInOneWatt { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double BoilerHorsepowerTolerance { get { return 1e-5; } } - protected virtual double BritishThermalUnitsPerHourTolerance { get { return 1e-5; } } - protected virtual double DecawattsTolerance { get { return 1e-5; } } - protected virtual double DeciwattsTolerance { get { return 1e-5; } } - protected virtual double ElectricalHorsepowerTolerance { get { return 1e-5; } } - protected virtual double FemtowattsTolerance { get { return 1e-5; } } - protected virtual double GigawattsTolerance { get { return 1e-5; } } - protected virtual double HydraulicHorsepowerTolerance { get { return 1e-5; } } - protected virtual double KilobritishThermalUnitsPerHourTolerance { get { return 1e-5; } } - protected virtual double KilowattsTolerance { get { return 1e-5; } } - protected virtual double MechanicalHorsepowerTolerance { get { return 1e-5; } } - protected virtual double MegawattsTolerance { get { return 1e-5; } } - protected virtual double MetricHorsepowerTolerance { get { return 1e-5; } } - protected virtual double MicrowattsTolerance { get { return 1e-5; } } - protected virtual double MilliwattsTolerance { get { return 1e-5; } } - protected virtual double NanowattsTolerance { get { return 1e-5; } } - protected virtual double PetawattsTolerance { get { return 1e-5; } } - protected virtual double PicowattsTolerance { get { return 1e-5; } } - protected virtual double TerawattsTolerance { get { return 1e-5; } } - protected virtual double WattsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Power((decimal)0.0, PowerUnit.Undefined)); - } - - - [Fact] - public void WattToPowerUnits() - { - Power watt = Power.FromWatts(1); - AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.BoilerHorsepower, BoilerHorsepowerTolerance); - AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(DecawattsInOneWatt, watt.Decawatts, DecawattsTolerance); - AssertEx.EqualTolerance(DeciwattsInOneWatt, watt.Deciwatts, DeciwattsTolerance); - AssertEx.EqualTolerance(ElectricalHorsepowerInOneWatt, watt.ElectricalHorsepower, ElectricalHorsepowerTolerance); - AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.Femtowatts, FemtowattsTolerance); - AssertEx.EqualTolerance(GigawattsInOneWatt, watt.Gigawatts, GigawattsTolerance); - AssertEx.EqualTolerance(HydraulicHorsepowerInOneWatt, watt.HydraulicHorsepower, HydraulicHorsepowerTolerance); - AssertEx.EqualTolerance(KilobritishThermalUnitsPerHourInOneWatt, watt.KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(KilowattsInOneWatt, watt.Kilowatts, KilowattsTolerance); - AssertEx.EqualTolerance(MechanicalHorsepowerInOneWatt, watt.MechanicalHorsepower, MechanicalHorsepowerTolerance); - AssertEx.EqualTolerance(MegawattsInOneWatt, watt.Megawatts, MegawattsTolerance); - AssertEx.EqualTolerance(MetricHorsepowerInOneWatt, watt.MetricHorsepower, MetricHorsepowerTolerance); - AssertEx.EqualTolerance(MicrowattsInOneWatt, watt.Microwatts, MicrowattsTolerance); - AssertEx.EqualTolerance(MilliwattsInOneWatt, watt.Milliwatts, MilliwattsTolerance); - AssertEx.EqualTolerance(NanowattsInOneWatt, watt.Nanowatts, NanowattsTolerance); - AssertEx.EqualTolerance(PetawattsInOneWatt, watt.Petawatts, PetawattsTolerance); - AssertEx.EqualTolerance(PicowattsInOneWatt, watt.Picowatts, PicowattsTolerance); - AssertEx.EqualTolerance(TerawattsInOneWatt, watt.Terawatts, TerawattsTolerance); - AssertEx.EqualTolerance(WattsInOneWatt, watt.Watts, WattsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BoilerHorsepower).BoilerHorsepower, BoilerHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.BritishThermalUnitPerHour).BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Decawatt).Decawatts, DecawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Deciwatt).Deciwatts, DeciwattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.ElectricalHorsepower).ElectricalHorsepower, ElectricalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Femtowatt).Femtowatts, FemtowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Gigawatt).Gigawatts, GigawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.HydraulicHorsepower).HydraulicHorsepower, HydraulicHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.KilobritishThermalUnitPerHour).KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Kilowatt).Kilowatts, KilowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.MechanicalHorsepower).MechanicalHorsepower, MechanicalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Megawatt).Megawatts, MegawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.MetricHorsepower).MetricHorsepower, MetricHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Microwatt).Microwatts, MicrowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Milliwatt).Milliwatts, MilliwattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Nanowatt).Nanowatts, NanowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Petawatt).Petawatts, PetawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Picowatt).Picowatts, PicowattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Terawatt).Terawatts, TerawattsTolerance); - AssertEx.EqualTolerance(1, Power.From(1, PowerUnit.Watt).Watts, WattsTolerance); - } - - - [Fact] - public void As() - { - var watt = Power.FromWatts(1); - AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.As(PowerUnit.BoilerHorsepower), BoilerHorsepowerTolerance); - AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.BritishThermalUnitPerHour), BritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(DecawattsInOneWatt, watt.As(PowerUnit.Decawatt), DecawattsTolerance); - AssertEx.EqualTolerance(DeciwattsInOneWatt, watt.As(PowerUnit.Deciwatt), DeciwattsTolerance); - AssertEx.EqualTolerance(ElectricalHorsepowerInOneWatt, watt.As(PowerUnit.ElectricalHorsepower), ElectricalHorsepowerTolerance); - AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.As(PowerUnit.Femtowatt), FemtowattsTolerance); - AssertEx.EqualTolerance(GigawattsInOneWatt, watt.As(PowerUnit.Gigawatt), GigawattsTolerance); - AssertEx.EqualTolerance(HydraulicHorsepowerInOneWatt, watt.As(PowerUnit.HydraulicHorsepower), HydraulicHorsepowerTolerance); - AssertEx.EqualTolerance(KilobritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.KilobritishThermalUnitPerHour), KilobritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(KilowattsInOneWatt, watt.As(PowerUnit.Kilowatt), KilowattsTolerance); - AssertEx.EqualTolerance(MechanicalHorsepowerInOneWatt, watt.As(PowerUnit.MechanicalHorsepower), MechanicalHorsepowerTolerance); - AssertEx.EqualTolerance(MegawattsInOneWatt, watt.As(PowerUnit.Megawatt), MegawattsTolerance); - AssertEx.EqualTolerance(MetricHorsepowerInOneWatt, watt.As(PowerUnit.MetricHorsepower), MetricHorsepowerTolerance); - AssertEx.EqualTolerance(MicrowattsInOneWatt, watt.As(PowerUnit.Microwatt), MicrowattsTolerance); - AssertEx.EqualTolerance(MilliwattsInOneWatt, watt.As(PowerUnit.Milliwatt), MilliwattsTolerance); - AssertEx.EqualTolerance(NanowattsInOneWatt, watt.As(PowerUnit.Nanowatt), NanowattsTolerance); - AssertEx.EqualTolerance(PetawattsInOneWatt, watt.As(PowerUnit.Petawatt), PetawattsTolerance); - AssertEx.EqualTolerance(PicowattsInOneWatt, watt.As(PowerUnit.Picowatt), PicowattsTolerance); - AssertEx.EqualTolerance(TerawattsInOneWatt, watt.As(PowerUnit.Terawatt), TerawattsTolerance); - AssertEx.EqualTolerance(WattsInOneWatt, watt.As(PowerUnit.Watt), WattsTolerance); - } - - [Fact] - public void ToUnit() - { - var watt = Power.FromWatts(1); - - var boilerhorsepowerQuantity = watt.ToUnit(PowerUnit.BoilerHorsepower); - AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, (double)boilerhorsepowerQuantity.Value, BoilerHorsepowerTolerance); - Assert.Equal(PowerUnit.BoilerHorsepower, boilerhorsepowerQuantity.Unit); - - var britishthermalunitperhourQuantity = watt.ToUnit(PowerUnit.BritishThermalUnitPerHour); - AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, (double)britishthermalunitperhourQuantity.Value, BritishThermalUnitsPerHourTolerance); - Assert.Equal(PowerUnit.BritishThermalUnitPerHour, britishthermalunitperhourQuantity.Unit); - - var decawattQuantity = watt.ToUnit(PowerUnit.Decawatt); - AssertEx.EqualTolerance(DecawattsInOneWatt, (double)decawattQuantity.Value, DecawattsTolerance); - Assert.Equal(PowerUnit.Decawatt, decawattQuantity.Unit); - - var deciwattQuantity = watt.ToUnit(PowerUnit.Deciwatt); - AssertEx.EqualTolerance(DeciwattsInOneWatt, (double)deciwattQuantity.Value, DeciwattsTolerance); - Assert.Equal(PowerUnit.Deciwatt, deciwattQuantity.Unit); - - var electricalhorsepowerQuantity = watt.ToUnit(PowerUnit.ElectricalHorsepower); - AssertEx.EqualTolerance(ElectricalHorsepowerInOneWatt, (double)electricalhorsepowerQuantity.Value, ElectricalHorsepowerTolerance); - Assert.Equal(PowerUnit.ElectricalHorsepower, electricalhorsepowerQuantity.Unit); - - var femtowattQuantity = watt.ToUnit(PowerUnit.Femtowatt); - AssertEx.EqualTolerance(FemtowattsInOneWatt, (double)femtowattQuantity.Value, FemtowattsTolerance); - Assert.Equal(PowerUnit.Femtowatt, femtowattQuantity.Unit); - - var gigawattQuantity = watt.ToUnit(PowerUnit.Gigawatt); - AssertEx.EqualTolerance(GigawattsInOneWatt, (double)gigawattQuantity.Value, GigawattsTolerance); - Assert.Equal(PowerUnit.Gigawatt, gigawattQuantity.Unit); - - var hydraulichorsepowerQuantity = watt.ToUnit(PowerUnit.HydraulicHorsepower); - AssertEx.EqualTolerance(HydraulicHorsepowerInOneWatt, (double)hydraulichorsepowerQuantity.Value, HydraulicHorsepowerTolerance); - Assert.Equal(PowerUnit.HydraulicHorsepower, hydraulichorsepowerQuantity.Unit); - - var kilobritishthermalunitperhourQuantity = watt.ToUnit(PowerUnit.KilobritishThermalUnitPerHour); - AssertEx.EqualTolerance(KilobritishThermalUnitsPerHourInOneWatt, (double)kilobritishthermalunitperhourQuantity.Value, KilobritishThermalUnitsPerHourTolerance); - Assert.Equal(PowerUnit.KilobritishThermalUnitPerHour, kilobritishthermalunitperhourQuantity.Unit); - - var kilowattQuantity = watt.ToUnit(PowerUnit.Kilowatt); - AssertEx.EqualTolerance(KilowattsInOneWatt, (double)kilowattQuantity.Value, KilowattsTolerance); - Assert.Equal(PowerUnit.Kilowatt, kilowattQuantity.Unit); - - var mechanicalhorsepowerQuantity = watt.ToUnit(PowerUnit.MechanicalHorsepower); - AssertEx.EqualTolerance(MechanicalHorsepowerInOneWatt, (double)mechanicalhorsepowerQuantity.Value, MechanicalHorsepowerTolerance); - Assert.Equal(PowerUnit.MechanicalHorsepower, mechanicalhorsepowerQuantity.Unit); - - var megawattQuantity = watt.ToUnit(PowerUnit.Megawatt); - AssertEx.EqualTolerance(MegawattsInOneWatt, (double)megawattQuantity.Value, MegawattsTolerance); - Assert.Equal(PowerUnit.Megawatt, megawattQuantity.Unit); - - var metrichorsepowerQuantity = watt.ToUnit(PowerUnit.MetricHorsepower); - AssertEx.EqualTolerance(MetricHorsepowerInOneWatt, (double)metrichorsepowerQuantity.Value, MetricHorsepowerTolerance); - Assert.Equal(PowerUnit.MetricHorsepower, metrichorsepowerQuantity.Unit); - - var microwattQuantity = watt.ToUnit(PowerUnit.Microwatt); - AssertEx.EqualTolerance(MicrowattsInOneWatt, (double)microwattQuantity.Value, MicrowattsTolerance); - Assert.Equal(PowerUnit.Microwatt, microwattQuantity.Unit); - - var milliwattQuantity = watt.ToUnit(PowerUnit.Milliwatt); - AssertEx.EqualTolerance(MilliwattsInOneWatt, (double)milliwattQuantity.Value, MilliwattsTolerance); - Assert.Equal(PowerUnit.Milliwatt, milliwattQuantity.Unit); - - var nanowattQuantity = watt.ToUnit(PowerUnit.Nanowatt); - AssertEx.EqualTolerance(NanowattsInOneWatt, (double)nanowattQuantity.Value, NanowattsTolerance); - Assert.Equal(PowerUnit.Nanowatt, nanowattQuantity.Unit); - - var petawattQuantity = watt.ToUnit(PowerUnit.Petawatt); - AssertEx.EqualTolerance(PetawattsInOneWatt, (double)petawattQuantity.Value, PetawattsTolerance); - Assert.Equal(PowerUnit.Petawatt, petawattQuantity.Unit); - - var picowattQuantity = watt.ToUnit(PowerUnit.Picowatt); - AssertEx.EqualTolerance(PicowattsInOneWatt, (double)picowattQuantity.Value, PicowattsTolerance); - Assert.Equal(PowerUnit.Picowatt, picowattQuantity.Unit); - - var terawattQuantity = watt.ToUnit(PowerUnit.Terawatt); - AssertEx.EqualTolerance(TerawattsInOneWatt, (double)terawattQuantity.Value, TerawattsTolerance); - Assert.Equal(PowerUnit.Terawatt, terawattQuantity.Unit); - - var wattQuantity = watt.ToUnit(PowerUnit.Watt); - AssertEx.EqualTolerance(WattsInOneWatt, (double)wattQuantity.Value, WattsTolerance); - Assert.Equal(PowerUnit.Watt, wattQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Power watt = Power.FromWatts(1); - AssertEx.EqualTolerance(1, Power.FromBoilerHorsepower(watt.BoilerHorsepower).Watts, BoilerHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromBritishThermalUnitsPerHour(watt.BritishThermalUnitsPerHour).Watts, BritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.FromDecawatts(watt.Decawatts).Watts, DecawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromDeciwatts(watt.Deciwatts).Watts, DeciwattsTolerance); - AssertEx.EqualTolerance(1, Power.FromElectricalHorsepower(watt.ElectricalHorsepower).Watts, ElectricalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromFemtowatts(watt.Femtowatts).Watts, FemtowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromGigawatts(watt.Gigawatts).Watts, GigawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromHydraulicHorsepower(watt.HydraulicHorsepower).Watts, HydraulicHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromKilobritishThermalUnitsPerHour(watt.KilobritishThermalUnitsPerHour).Watts, KilobritishThermalUnitsPerHourTolerance); - AssertEx.EqualTolerance(1, Power.FromKilowatts(watt.Kilowatts).Watts, KilowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromMechanicalHorsepower(watt.MechanicalHorsepower).Watts, MechanicalHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromMegawatts(watt.Megawatts).Watts, MegawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromMetricHorsepower(watt.MetricHorsepower).Watts, MetricHorsepowerTolerance); - AssertEx.EqualTolerance(1, Power.FromMicrowatts(watt.Microwatts).Watts, MicrowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromMilliwatts(watt.Milliwatts).Watts, MilliwattsTolerance); - AssertEx.EqualTolerance(1, Power.FromNanowatts(watt.Nanowatts).Watts, NanowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromPetawatts(watt.Petawatts).Watts, PetawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromPicowatts(watt.Picowatts).Watts, PicowattsTolerance); - AssertEx.EqualTolerance(1, Power.FromTerawatts(watt.Terawatts).Watts, TerawattsTolerance); - AssertEx.EqualTolerance(1, Power.FromWatts(watt.Watts).Watts, WattsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Power v = Power.FromWatts(1); - AssertEx.EqualTolerance(-1, -v.Watts, WattsTolerance); - AssertEx.EqualTolerance(2, (Power.FromWatts(3)-v).Watts, WattsTolerance); - AssertEx.EqualTolerance(2, (v + v).Watts, WattsTolerance); - AssertEx.EqualTolerance(10, (v*10).Watts, WattsTolerance); - AssertEx.EqualTolerance(10, (10*v).Watts, WattsTolerance); - AssertEx.EqualTolerance(2, (Power.FromWatts(10)/5).Watts, WattsTolerance); - AssertEx.EqualTolerance(2, Power.FromWatts(10)/Power.FromWatts(5), WattsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Power oneWatt = Power.FromWatts(1); - Power twoWatts = Power.FromWatts(2); - - Assert.True(oneWatt < twoWatts); - Assert.True(oneWatt <= twoWatts); - Assert.True(twoWatts > oneWatt); - Assert.True(twoWatts >= oneWatt); - - Assert.False(oneWatt > twoWatts); - Assert.False(oneWatt >= twoWatts); - Assert.False(twoWatts < oneWatt); - Assert.False(twoWatts <= oneWatt); - } - - [Fact] - public void CompareToIsImplemented() - { - Power watt = Power.FromWatts(1); - Assert.Equal(0, watt.CompareTo(watt)); - Assert.True(watt.CompareTo(Power.Zero) > 0); - Assert.True(Power.Zero.CompareTo(watt) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Power watt = Power.FromWatts(1); - Assert.Throws(() => watt.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Power watt = Power.FromWatts(1); - Assert.Throws(() => watt.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Power v = Power.FromWatts(1); - Assert.True(v.Equals(Power.FromWatts(1), WattsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Power.Zero, WattsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Power watt = Power.FromWatts(1); - Assert.False(watt.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Power watt = Power.FromWatts(1); - Assert.False(watt.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(PowerUnit.Undefined, Power.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(PowerUnit)).Cast(); - foreach(var unit in units) - { - if(unit == PowerUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs deleted file mode 100644 index 44e37ef45e..0000000000 --- a/UnitsNet.Tests/GeneratedCode/PressureChangeRateTestsBase.g.cs +++ /dev/null @@ -1,254 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of PressureChangeRate. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class PressureChangeRateTestsBase - { - protected abstract double AtmospheresPerSecondInOnePascalPerSecond { get; } - protected abstract double KilopascalsPerSecondInOnePascalPerSecond { get; } - protected abstract double MegapascalsPerSecondInOnePascalPerSecond { get; } - protected abstract double PascalsPerSecondInOnePascalPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AtmospheresPerSecondTolerance { get { return 1e-5; } } - protected virtual double KilopascalsPerSecondTolerance { get { return 1e-5; } } - protected virtual double MegapascalsPerSecondTolerance { get { return 1e-5; } } - protected virtual double PascalsPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new PressureChangeRate((double)0.0, PressureChangeRateUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new PressureChangeRate(double.PositiveInfinity, PressureChangeRateUnit.PascalPerSecond)); - Assert.Throws(() => new PressureChangeRate(double.NegativeInfinity, PressureChangeRateUnit.PascalPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new PressureChangeRate(double.NaN, PressureChangeRateUnit.PascalPerSecond)); - } - - [Fact] - public void PascalPerSecondToPressureChangeRateUnits() - { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - AssertEx.EqualTolerance(AtmospheresPerSecondInOnePascalPerSecond, pascalpersecond.AtmospheresPerSecond, AtmospheresPerSecondTolerance); - AssertEx.EqualTolerance(KilopascalsPerSecondInOnePascalPerSecond, pascalpersecond.KilopascalsPerSecond, KilopascalsPerSecondTolerance); - AssertEx.EqualTolerance(MegapascalsPerSecondInOnePascalPerSecond, pascalpersecond.MegapascalsPerSecond, MegapascalsPerSecondTolerance); - AssertEx.EqualTolerance(PascalsPerSecondInOnePascalPerSecond, pascalpersecond.PascalsPerSecond, PascalsPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.AtmospherePerSecond).AtmospheresPerSecond, AtmospheresPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.KilopascalPerSecond).KilopascalsPerSecond, KilopascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.MegapascalPerSecond).MegapascalsPerSecond, MegapascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.From(1, PressureChangeRateUnit.PascalPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); - } - - [Fact] - public void FromPascalsPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.PositiveInfinity)); - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromPascalsPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => PressureChangeRate.FromPascalsPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - AssertEx.EqualTolerance(AtmospheresPerSecondInOnePascalPerSecond, pascalpersecond.As(PressureChangeRateUnit.AtmospherePerSecond), AtmospheresPerSecondTolerance); - AssertEx.EqualTolerance(KilopascalsPerSecondInOnePascalPerSecond, pascalpersecond.As(PressureChangeRateUnit.KilopascalPerSecond), KilopascalsPerSecondTolerance); - AssertEx.EqualTolerance(MegapascalsPerSecondInOnePascalPerSecond, pascalpersecond.As(PressureChangeRateUnit.MegapascalPerSecond), MegapascalsPerSecondTolerance); - AssertEx.EqualTolerance(PascalsPerSecondInOnePascalPerSecond, pascalpersecond.As(PressureChangeRateUnit.PascalPerSecond), PascalsPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - - var atmospherepersecondQuantity = pascalpersecond.ToUnit(PressureChangeRateUnit.AtmospherePerSecond); - AssertEx.EqualTolerance(AtmospheresPerSecondInOnePascalPerSecond, (double)atmospherepersecondQuantity.Value, AtmospheresPerSecondTolerance); - Assert.Equal(PressureChangeRateUnit.AtmospherePerSecond, atmospherepersecondQuantity.Unit); - - var kilopascalpersecondQuantity = pascalpersecond.ToUnit(PressureChangeRateUnit.KilopascalPerSecond); - AssertEx.EqualTolerance(KilopascalsPerSecondInOnePascalPerSecond, (double)kilopascalpersecondQuantity.Value, KilopascalsPerSecondTolerance); - Assert.Equal(PressureChangeRateUnit.KilopascalPerSecond, kilopascalpersecondQuantity.Unit); - - var megapascalpersecondQuantity = pascalpersecond.ToUnit(PressureChangeRateUnit.MegapascalPerSecond); - AssertEx.EqualTolerance(MegapascalsPerSecondInOnePascalPerSecond, (double)megapascalpersecondQuantity.Value, MegapascalsPerSecondTolerance); - Assert.Equal(PressureChangeRateUnit.MegapascalPerSecond, megapascalpersecondQuantity.Unit); - - var pascalpersecondQuantity = pascalpersecond.ToUnit(PressureChangeRateUnit.PascalPerSecond); - AssertEx.EqualTolerance(PascalsPerSecondInOnePascalPerSecond, (double)pascalpersecondQuantity.Value, PascalsPerSecondTolerance); - Assert.Equal(PressureChangeRateUnit.PascalPerSecond, pascalpersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - AssertEx.EqualTolerance(1, PressureChangeRate.FromAtmospheresPerSecond(pascalpersecond.AtmospheresPerSecond).PascalsPerSecond, AtmospheresPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromKilopascalsPerSecond(pascalpersecond.KilopascalsPerSecond).PascalsPerSecond, KilopascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromMegapascalsPerSecond(pascalpersecond.MegapascalsPerSecond).PascalsPerSecond, MegapascalsPerSecondTolerance); - AssertEx.EqualTolerance(1, PressureChangeRate.FromPascalsPerSecond(pascalpersecond.PascalsPerSecond).PascalsPerSecond, PascalsPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - PressureChangeRate v = PressureChangeRate.FromPascalsPerSecond(1); - AssertEx.EqualTolerance(-1, -v.PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(2, (PressureChangeRate.FromPascalsPerSecond(3)-v).PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(2, (PressureChangeRate.FromPascalsPerSecond(10)/5).PascalsPerSecond, PascalsPerSecondTolerance); - AssertEx.EqualTolerance(2, PressureChangeRate.FromPascalsPerSecond(10)/PressureChangeRate.FromPascalsPerSecond(5), PascalsPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - PressureChangeRate onePascalPerSecond = PressureChangeRate.FromPascalsPerSecond(1); - PressureChangeRate twoPascalsPerSecond = PressureChangeRate.FromPascalsPerSecond(2); - - Assert.True(onePascalPerSecond < twoPascalsPerSecond); - Assert.True(onePascalPerSecond <= twoPascalsPerSecond); - Assert.True(twoPascalsPerSecond > onePascalPerSecond); - Assert.True(twoPascalsPerSecond >= onePascalPerSecond); - - Assert.False(onePascalPerSecond > twoPascalsPerSecond); - Assert.False(onePascalPerSecond >= twoPascalsPerSecond); - Assert.False(twoPascalsPerSecond < onePascalPerSecond); - Assert.False(twoPascalsPerSecond <= onePascalPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - Assert.Equal(0, pascalpersecond.CompareTo(pascalpersecond)); - Assert.True(pascalpersecond.CompareTo(PressureChangeRate.Zero) > 0); - Assert.True(PressureChangeRate.Zero.CompareTo(pascalpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - Assert.Throws(() => pascalpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - Assert.Throws(() => pascalpersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - PressureChangeRate v = PressureChangeRate.FromPascalsPerSecond(1); - Assert.True(v.Equals(PressureChangeRate.FromPascalsPerSecond(1), PascalsPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(PressureChangeRate.Zero, PascalsPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - Assert.False(pascalpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1); - Assert.False(pascalpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(PressureChangeRateUnit.Undefined, PressureChangeRate.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(PressureChangeRateUnit)).Cast(); - foreach(var unit in units) - { - if(unit == PressureChangeRateUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs deleted file mode 100644 index 2204eb0ee3..0000000000 --- a/UnitsNet.Tests/GeneratedCode/PressureTestsBase.g.cs +++ /dev/null @@ -1,584 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Pressure. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class PressureTestsBase - { - protected abstract double AtmospheresInOnePascal { get; } - protected abstract double BarsInOnePascal { get; } - protected abstract double CentibarsInOnePascal { get; } - protected abstract double DecapascalsInOnePascal { get; } - protected abstract double DecibarsInOnePascal { get; } - protected abstract double FeetOfHeadInOnePascal { get; } - protected abstract double GigapascalsInOnePascal { get; } - protected abstract double HectopascalsInOnePascal { get; } - protected abstract double InchesOfMercuryInOnePascal { get; } - protected abstract double KilobarsInOnePascal { get; } - protected abstract double KilogramsForcePerSquareCentimeterInOnePascal { get; } - protected abstract double KilogramsForcePerSquareMeterInOnePascal { get; } - protected abstract double KilogramsForcePerSquareMillimeterInOnePascal { get; } - protected abstract double KilonewtonsPerSquareCentimeterInOnePascal { get; } - protected abstract double KilonewtonsPerSquareMeterInOnePascal { get; } - protected abstract double KilonewtonsPerSquareMillimeterInOnePascal { get; } - protected abstract double KilopascalsInOnePascal { get; } - protected abstract double KilopoundsForcePerSquareFootInOnePascal { get; } - protected abstract double KilopoundsForcePerSquareInchInOnePascal { get; } - protected abstract double MegabarsInOnePascal { get; } - protected abstract double MeganewtonsPerSquareMeterInOnePascal { get; } - protected abstract double MegapascalsInOnePascal { get; } - protected abstract double MetersOfHeadInOnePascal { get; } - protected abstract double MicropascalsInOnePascal { get; } - protected abstract double MillibarsInOnePascal { get; } - protected abstract double MillimetersOfMercuryInOnePascal { get; } - protected abstract double NewtonsPerSquareCentimeterInOnePascal { get; } - protected abstract double NewtonsPerSquareMeterInOnePascal { get; } - protected abstract double NewtonsPerSquareMillimeterInOnePascal { get; } - protected abstract double PascalsInOnePascal { get; } - protected abstract double PoundsForcePerSquareFootInOnePascal { get; } - protected abstract double PoundsForcePerSquareInchInOnePascal { get; } - protected abstract double TechnicalAtmospheresInOnePascal { get; } - protected abstract double TonnesForcePerSquareCentimeterInOnePascal { get; } - protected abstract double TonnesForcePerSquareMeterInOnePascal { get; } - protected abstract double TonnesForcePerSquareMillimeterInOnePascal { get; } - protected abstract double TorrsInOnePascal { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AtmospheresTolerance { get { return 1e-5; } } - protected virtual double BarsTolerance { get { return 1e-5; } } - protected virtual double CentibarsTolerance { get { return 1e-5; } } - protected virtual double DecapascalsTolerance { get { return 1e-5; } } - protected virtual double DecibarsTolerance { get { return 1e-5; } } - protected virtual double FeetOfHeadTolerance { get { return 1e-5; } } - protected virtual double GigapascalsTolerance { get { return 1e-5; } } - protected virtual double HectopascalsTolerance { get { return 1e-5; } } - protected virtual double InchesOfMercuryTolerance { get { return 1e-5; } } - protected virtual double KilobarsTolerance { get { return 1e-5; } } - protected virtual double KilogramsForcePerSquareCentimeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsForcePerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsForcePerSquareMillimeterTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerSquareCentimeterTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerSquareMillimeterTolerance { get { return 1e-5; } } - protected virtual double KilopascalsTolerance { get { return 1e-5; } } - protected virtual double KilopoundsForcePerSquareFootTolerance { get { return 1e-5; } } - protected virtual double KilopoundsForcePerSquareInchTolerance { get { return 1e-5; } } - protected virtual double MegabarsTolerance { get { return 1e-5; } } - protected virtual double MeganewtonsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double MegapascalsTolerance { get { return 1e-5; } } - protected virtual double MetersOfHeadTolerance { get { return 1e-5; } } - protected virtual double MicropascalsTolerance { get { return 1e-5; } } - protected virtual double MillibarsTolerance { get { return 1e-5; } } - protected virtual double MillimetersOfMercuryTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerSquareCentimeterTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerSquareMillimeterTolerance { get { return 1e-5; } } - protected virtual double PascalsTolerance { get { return 1e-5; } } - protected virtual double PoundsForcePerSquareFootTolerance { get { return 1e-5; } } - protected virtual double PoundsForcePerSquareInchTolerance { get { return 1e-5; } } - protected virtual double TechnicalAtmospheresTolerance { get { return 1e-5; } } - protected virtual double TonnesForcePerSquareCentimeterTolerance { get { return 1e-5; } } - protected virtual double TonnesForcePerSquareMeterTolerance { get { return 1e-5; } } - protected virtual double TonnesForcePerSquareMillimeterTolerance { get { return 1e-5; } } - protected virtual double TorrsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Pressure((double)0.0, PressureUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Pressure(double.PositiveInfinity, PressureUnit.Pascal)); - Assert.Throws(() => new Pressure(double.NegativeInfinity, PressureUnit.Pascal)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Pressure(double.NaN, PressureUnit.Pascal)); - } - - [Fact] - public void PascalToPressureUnits() - { - Pressure pascal = Pressure.FromPascals(1); - AssertEx.EqualTolerance(AtmospheresInOnePascal, pascal.Atmospheres, AtmospheresTolerance); - AssertEx.EqualTolerance(BarsInOnePascal, pascal.Bars, BarsTolerance); - AssertEx.EqualTolerance(CentibarsInOnePascal, pascal.Centibars, CentibarsTolerance); - AssertEx.EqualTolerance(DecapascalsInOnePascal, pascal.Decapascals, DecapascalsTolerance); - AssertEx.EqualTolerance(DecibarsInOnePascal, pascal.Decibars, DecibarsTolerance); - AssertEx.EqualTolerance(FeetOfHeadInOnePascal, pascal.FeetOfHead, FeetOfHeadTolerance); - AssertEx.EqualTolerance(GigapascalsInOnePascal, pascal.Gigapascals, GigapascalsTolerance); - AssertEx.EqualTolerance(HectopascalsInOnePascal, pascal.Hectopascals, HectopascalsTolerance); - AssertEx.EqualTolerance(InchesOfMercuryInOnePascal, pascal.InchesOfMercury, InchesOfMercuryTolerance); - AssertEx.EqualTolerance(KilobarsInOnePascal, pascal.Kilobars, KilobarsTolerance); - AssertEx.EqualTolerance(KilogramsForcePerSquareCentimeterInOnePascal, pascal.KilogramsForcePerSquareCentimeter, KilogramsForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerSquareMeterInOnePascal, pascal.KilogramsForcePerSquareMeter, KilogramsForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerSquareMillimeterInOnePascal, pascal.KilogramsForcePerSquareMillimeter, KilogramsForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSquareCentimeterInOnePascal, pascal.KilonewtonsPerSquareCentimeter, KilonewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSquareMeterInOnePascal, pascal.KilonewtonsPerSquareMeter, KilonewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSquareMillimeterInOnePascal, pascal.KilonewtonsPerSquareMillimeter, KilonewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(KilopascalsInOnePascal, pascal.Kilopascals, KilopascalsTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerSquareFootInOnePascal, pascal.KilopoundsForcePerSquareFoot, KilopoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerSquareInchInOnePascal, pascal.KilopoundsForcePerSquareInch, KilopoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(MegabarsInOnePascal, pascal.Megabars, MegabarsTolerance); - AssertEx.EqualTolerance(MeganewtonsPerSquareMeterInOnePascal, pascal.MeganewtonsPerSquareMeter, MeganewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(MegapascalsInOnePascal, pascal.Megapascals, MegapascalsTolerance); - AssertEx.EqualTolerance(MetersOfHeadInOnePascal, pascal.MetersOfHead, MetersOfHeadTolerance); - AssertEx.EqualTolerance(MicropascalsInOnePascal, pascal.Micropascals, MicropascalsTolerance); - AssertEx.EqualTolerance(MillibarsInOnePascal, pascal.Millibars, MillibarsTolerance); - AssertEx.EqualTolerance(MillimetersOfMercuryInOnePascal, pascal.MillimetersOfMercury, MillimetersOfMercuryTolerance); - AssertEx.EqualTolerance(NewtonsPerSquareCentimeterInOnePascal, pascal.NewtonsPerSquareCentimeter, NewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(NewtonsPerSquareMeterInOnePascal, pascal.NewtonsPerSquareMeter, NewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerSquareMillimeterInOnePascal, pascal.NewtonsPerSquareMillimeter, NewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(PascalsInOnePascal, pascal.Pascals, PascalsTolerance); - AssertEx.EqualTolerance(PoundsForcePerSquareFootInOnePascal, pascal.PoundsForcePerSquareFoot, PoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(PoundsForcePerSquareInchInOnePascal, pascal.PoundsForcePerSquareInch, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(TechnicalAtmospheresInOnePascal, pascal.TechnicalAtmospheres, TechnicalAtmospheresTolerance); - AssertEx.EqualTolerance(TonnesForcePerSquareCentimeterInOnePascal, pascal.TonnesForcePerSquareCentimeter, TonnesForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerSquareMeterInOnePascal, pascal.TonnesForcePerSquareMeter, TonnesForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerSquareMillimeterInOnePascal, pascal.TonnesForcePerSquareMillimeter, TonnesForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(TorrsInOnePascal, pascal.Torrs, TorrsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Atmosphere).Atmospheres, AtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Bar).Bars, BarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Centibar).Centibars, CentibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Decapascal).Decapascals, DecapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Decibar).Decibars, DecibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.FootOfHead).FeetOfHead, FeetOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Gigapascal).Gigapascals, GigapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Hectopascal).Hectopascals, HectopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.InchOfMercury).InchesOfMercury, InchesOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Kilobar).Kilobars, KilobarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareCentimeter).KilogramsForcePerSquareCentimeter, KilogramsForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareMeter).KilogramsForcePerSquareMeter, KilogramsForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilogramForcePerSquareMillimeter).KilogramsForcePerSquareMillimeter, KilogramsForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareCentimeter).KilonewtonsPerSquareCentimeter, KilonewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareMeter).KilonewtonsPerSquareMeter, KilonewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilonewtonPerSquareMillimeter).KilonewtonsPerSquareMillimeter, KilonewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Kilopascal).Kilopascals, KilopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilopoundForcePerSquareFoot).KilopoundsForcePerSquareFoot, KilopoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.KilopoundForcePerSquareInch).KilopoundsForcePerSquareInch, KilopoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Megabar).Megabars, MegabarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MeganewtonPerSquareMeter).MeganewtonsPerSquareMeter, MeganewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Megapascal).Megapascals, MegapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MeterOfHead).MetersOfHead, MetersOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Micropascal).Micropascals, MicropascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Millibar).Millibars, MillibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.MillimeterOfMercury).MillimetersOfMercury, MillimetersOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareCentimeter).NewtonsPerSquareCentimeter, NewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareMeter).NewtonsPerSquareMeter, NewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.NewtonPerSquareMillimeter).NewtonsPerSquareMillimeter, NewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Pascal).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareFoot).PoundsForcePerSquareFoot, PoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.PoundForcePerSquareInch).PoundsForcePerSquareInch, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TechnicalAtmosphere).TechnicalAtmospheres, TechnicalAtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareCentimeter).TonnesForcePerSquareCentimeter, TonnesForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareMeter).TonnesForcePerSquareMeter, TonnesForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.TonneForcePerSquareMillimeter).TonnesForcePerSquareMillimeter, TonnesForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.From(1, PressureUnit.Torr).Torrs, TorrsTolerance); - } - - [Fact] - public void FromPascals_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Pressure.FromPascals(double.PositiveInfinity)); - Assert.Throws(() => Pressure.FromPascals(double.NegativeInfinity)); - } - - [Fact] - public void FromPascals_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Pressure.FromPascals(double.NaN)); - } - - [Fact] - public void As() - { - var pascal = Pressure.FromPascals(1); - AssertEx.EqualTolerance(AtmospheresInOnePascal, pascal.As(PressureUnit.Atmosphere), AtmospheresTolerance); - AssertEx.EqualTolerance(BarsInOnePascal, pascal.As(PressureUnit.Bar), BarsTolerance); - AssertEx.EqualTolerance(CentibarsInOnePascal, pascal.As(PressureUnit.Centibar), CentibarsTolerance); - AssertEx.EqualTolerance(DecapascalsInOnePascal, pascal.As(PressureUnit.Decapascal), DecapascalsTolerance); - AssertEx.EqualTolerance(DecibarsInOnePascal, pascal.As(PressureUnit.Decibar), DecibarsTolerance); - AssertEx.EqualTolerance(FeetOfHeadInOnePascal, pascal.As(PressureUnit.FootOfHead), FeetOfHeadTolerance); - AssertEx.EqualTolerance(GigapascalsInOnePascal, pascal.As(PressureUnit.Gigapascal), GigapascalsTolerance); - AssertEx.EqualTolerance(HectopascalsInOnePascal, pascal.As(PressureUnit.Hectopascal), HectopascalsTolerance); - AssertEx.EqualTolerance(InchesOfMercuryInOnePascal, pascal.As(PressureUnit.InchOfMercury), InchesOfMercuryTolerance); - AssertEx.EqualTolerance(KilobarsInOnePascal, pascal.As(PressureUnit.Kilobar), KilobarsTolerance); - AssertEx.EqualTolerance(KilogramsForcePerSquareCentimeterInOnePascal, pascal.As(PressureUnit.KilogramForcePerSquareCentimeter), KilogramsForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerSquareMeterInOnePascal, pascal.As(PressureUnit.KilogramForcePerSquareMeter), KilogramsForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerSquareMillimeterInOnePascal, pascal.As(PressureUnit.KilogramForcePerSquareMillimeter), KilogramsForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSquareCentimeterInOnePascal, pascal.As(PressureUnit.KilonewtonPerSquareCentimeter), KilonewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSquareMeterInOnePascal, pascal.As(PressureUnit.KilonewtonPerSquareMeter), KilonewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerSquareMillimeterInOnePascal, pascal.As(PressureUnit.KilonewtonPerSquareMillimeter), KilonewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(KilopascalsInOnePascal, pascal.As(PressureUnit.Kilopascal), KilopascalsTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerSquareFootInOnePascal, pascal.As(PressureUnit.KilopoundForcePerSquareFoot), KilopoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerSquareInchInOnePascal, pascal.As(PressureUnit.KilopoundForcePerSquareInch), KilopoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(MegabarsInOnePascal, pascal.As(PressureUnit.Megabar), MegabarsTolerance); - AssertEx.EqualTolerance(MeganewtonsPerSquareMeterInOnePascal, pascal.As(PressureUnit.MeganewtonPerSquareMeter), MeganewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(MegapascalsInOnePascal, pascal.As(PressureUnit.Megapascal), MegapascalsTolerance); - AssertEx.EqualTolerance(MetersOfHeadInOnePascal, pascal.As(PressureUnit.MeterOfHead), MetersOfHeadTolerance); - AssertEx.EqualTolerance(MicropascalsInOnePascal, pascal.As(PressureUnit.Micropascal), MicropascalsTolerance); - AssertEx.EqualTolerance(MillibarsInOnePascal, pascal.As(PressureUnit.Millibar), MillibarsTolerance); - AssertEx.EqualTolerance(MillimetersOfMercuryInOnePascal, pascal.As(PressureUnit.MillimeterOfMercury), MillimetersOfMercuryTolerance); - AssertEx.EqualTolerance(NewtonsPerSquareCentimeterInOnePascal, pascal.As(PressureUnit.NewtonPerSquareCentimeter), NewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(NewtonsPerSquareMeterInOnePascal, pascal.As(PressureUnit.NewtonPerSquareMeter), NewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerSquareMillimeterInOnePascal, pascal.As(PressureUnit.NewtonPerSquareMillimeter), NewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(PascalsInOnePascal, pascal.As(PressureUnit.Pascal), PascalsTolerance); - AssertEx.EqualTolerance(PoundsForcePerSquareFootInOnePascal, pascal.As(PressureUnit.PoundForcePerSquareFoot), PoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(PoundsForcePerSquareInchInOnePascal, pascal.As(PressureUnit.PoundForcePerSquareInch), PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(TechnicalAtmospheresInOnePascal, pascal.As(PressureUnit.TechnicalAtmosphere), TechnicalAtmospheresTolerance); - AssertEx.EqualTolerance(TonnesForcePerSquareCentimeterInOnePascal, pascal.As(PressureUnit.TonneForcePerSquareCentimeter), TonnesForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerSquareMeterInOnePascal, pascal.As(PressureUnit.TonneForcePerSquareMeter), TonnesForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerSquareMillimeterInOnePascal, pascal.As(PressureUnit.TonneForcePerSquareMillimeter), TonnesForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(TorrsInOnePascal, pascal.As(PressureUnit.Torr), TorrsTolerance); - } - - [Fact] - public void ToUnit() - { - var pascal = Pressure.FromPascals(1); - - var atmosphereQuantity = pascal.ToUnit(PressureUnit.Atmosphere); - AssertEx.EqualTolerance(AtmospheresInOnePascal, (double)atmosphereQuantity.Value, AtmospheresTolerance); - Assert.Equal(PressureUnit.Atmosphere, atmosphereQuantity.Unit); - - var barQuantity = pascal.ToUnit(PressureUnit.Bar); - AssertEx.EqualTolerance(BarsInOnePascal, (double)barQuantity.Value, BarsTolerance); - Assert.Equal(PressureUnit.Bar, barQuantity.Unit); - - var centibarQuantity = pascal.ToUnit(PressureUnit.Centibar); - AssertEx.EqualTolerance(CentibarsInOnePascal, (double)centibarQuantity.Value, CentibarsTolerance); - Assert.Equal(PressureUnit.Centibar, centibarQuantity.Unit); - - var decapascalQuantity = pascal.ToUnit(PressureUnit.Decapascal); - AssertEx.EqualTolerance(DecapascalsInOnePascal, (double)decapascalQuantity.Value, DecapascalsTolerance); - Assert.Equal(PressureUnit.Decapascal, decapascalQuantity.Unit); - - var decibarQuantity = pascal.ToUnit(PressureUnit.Decibar); - AssertEx.EqualTolerance(DecibarsInOnePascal, (double)decibarQuantity.Value, DecibarsTolerance); - Assert.Equal(PressureUnit.Decibar, decibarQuantity.Unit); - - var footofheadQuantity = pascal.ToUnit(PressureUnit.FootOfHead); - AssertEx.EqualTolerance(FeetOfHeadInOnePascal, (double)footofheadQuantity.Value, FeetOfHeadTolerance); - Assert.Equal(PressureUnit.FootOfHead, footofheadQuantity.Unit); - - var gigapascalQuantity = pascal.ToUnit(PressureUnit.Gigapascal); - AssertEx.EqualTolerance(GigapascalsInOnePascal, (double)gigapascalQuantity.Value, GigapascalsTolerance); - Assert.Equal(PressureUnit.Gigapascal, gigapascalQuantity.Unit); - - var hectopascalQuantity = pascal.ToUnit(PressureUnit.Hectopascal); - AssertEx.EqualTolerance(HectopascalsInOnePascal, (double)hectopascalQuantity.Value, HectopascalsTolerance); - Assert.Equal(PressureUnit.Hectopascal, hectopascalQuantity.Unit); - - var inchofmercuryQuantity = pascal.ToUnit(PressureUnit.InchOfMercury); - AssertEx.EqualTolerance(InchesOfMercuryInOnePascal, (double)inchofmercuryQuantity.Value, InchesOfMercuryTolerance); - Assert.Equal(PressureUnit.InchOfMercury, inchofmercuryQuantity.Unit); - - var kilobarQuantity = pascal.ToUnit(PressureUnit.Kilobar); - AssertEx.EqualTolerance(KilobarsInOnePascal, (double)kilobarQuantity.Value, KilobarsTolerance); - Assert.Equal(PressureUnit.Kilobar, kilobarQuantity.Unit); - - var kilogramforcepersquarecentimeterQuantity = pascal.ToUnit(PressureUnit.KilogramForcePerSquareCentimeter); - AssertEx.EqualTolerance(KilogramsForcePerSquareCentimeterInOnePascal, (double)kilogramforcepersquarecentimeterQuantity.Value, KilogramsForcePerSquareCentimeterTolerance); - Assert.Equal(PressureUnit.KilogramForcePerSquareCentimeter, kilogramforcepersquarecentimeterQuantity.Unit); - - var kilogramforcepersquaremeterQuantity = pascal.ToUnit(PressureUnit.KilogramForcePerSquareMeter); - AssertEx.EqualTolerance(KilogramsForcePerSquareMeterInOnePascal, (double)kilogramforcepersquaremeterQuantity.Value, KilogramsForcePerSquareMeterTolerance); - Assert.Equal(PressureUnit.KilogramForcePerSquareMeter, kilogramforcepersquaremeterQuantity.Unit); - - var kilogramforcepersquaremillimeterQuantity = pascal.ToUnit(PressureUnit.KilogramForcePerSquareMillimeter); - AssertEx.EqualTolerance(KilogramsForcePerSquareMillimeterInOnePascal, (double)kilogramforcepersquaremillimeterQuantity.Value, KilogramsForcePerSquareMillimeterTolerance); - Assert.Equal(PressureUnit.KilogramForcePerSquareMillimeter, kilogramforcepersquaremillimeterQuantity.Unit); - - var kilonewtonpersquarecentimeterQuantity = pascal.ToUnit(PressureUnit.KilonewtonPerSquareCentimeter); - AssertEx.EqualTolerance(KilonewtonsPerSquareCentimeterInOnePascal, (double)kilonewtonpersquarecentimeterQuantity.Value, KilonewtonsPerSquareCentimeterTolerance); - Assert.Equal(PressureUnit.KilonewtonPerSquareCentimeter, kilonewtonpersquarecentimeterQuantity.Unit); - - var kilonewtonpersquaremeterQuantity = pascal.ToUnit(PressureUnit.KilonewtonPerSquareMeter); - AssertEx.EqualTolerance(KilonewtonsPerSquareMeterInOnePascal, (double)kilonewtonpersquaremeterQuantity.Value, KilonewtonsPerSquareMeterTolerance); - Assert.Equal(PressureUnit.KilonewtonPerSquareMeter, kilonewtonpersquaremeterQuantity.Unit); - - var kilonewtonpersquaremillimeterQuantity = pascal.ToUnit(PressureUnit.KilonewtonPerSquareMillimeter); - AssertEx.EqualTolerance(KilonewtonsPerSquareMillimeterInOnePascal, (double)kilonewtonpersquaremillimeterQuantity.Value, KilonewtonsPerSquareMillimeterTolerance); - Assert.Equal(PressureUnit.KilonewtonPerSquareMillimeter, kilonewtonpersquaremillimeterQuantity.Unit); - - var kilopascalQuantity = pascal.ToUnit(PressureUnit.Kilopascal); - AssertEx.EqualTolerance(KilopascalsInOnePascal, (double)kilopascalQuantity.Value, KilopascalsTolerance); - Assert.Equal(PressureUnit.Kilopascal, kilopascalQuantity.Unit); - - var kilopoundforcepersquarefootQuantity = pascal.ToUnit(PressureUnit.KilopoundForcePerSquareFoot); - AssertEx.EqualTolerance(KilopoundsForcePerSquareFootInOnePascal, (double)kilopoundforcepersquarefootQuantity.Value, KilopoundsForcePerSquareFootTolerance); - Assert.Equal(PressureUnit.KilopoundForcePerSquareFoot, kilopoundforcepersquarefootQuantity.Unit); - - var kilopoundforcepersquareinchQuantity = pascal.ToUnit(PressureUnit.KilopoundForcePerSquareInch); - AssertEx.EqualTolerance(KilopoundsForcePerSquareInchInOnePascal, (double)kilopoundforcepersquareinchQuantity.Value, KilopoundsForcePerSquareInchTolerance); - Assert.Equal(PressureUnit.KilopoundForcePerSquareInch, kilopoundforcepersquareinchQuantity.Unit); - - var megabarQuantity = pascal.ToUnit(PressureUnit.Megabar); - AssertEx.EqualTolerance(MegabarsInOnePascal, (double)megabarQuantity.Value, MegabarsTolerance); - Assert.Equal(PressureUnit.Megabar, megabarQuantity.Unit); - - var meganewtonpersquaremeterQuantity = pascal.ToUnit(PressureUnit.MeganewtonPerSquareMeter); - AssertEx.EqualTolerance(MeganewtonsPerSquareMeterInOnePascal, (double)meganewtonpersquaremeterQuantity.Value, MeganewtonsPerSquareMeterTolerance); - Assert.Equal(PressureUnit.MeganewtonPerSquareMeter, meganewtonpersquaremeterQuantity.Unit); - - var megapascalQuantity = pascal.ToUnit(PressureUnit.Megapascal); - AssertEx.EqualTolerance(MegapascalsInOnePascal, (double)megapascalQuantity.Value, MegapascalsTolerance); - Assert.Equal(PressureUnit.Megapascal, megapascalQuantity.Unit); - - var meterofheadQuantity = pascal.ToUnit(PressureUnit.MeterOfHead); - AssertEx.EqualTolerance(MetersOfHeadInOnePascal, (double)meterofheadQuantity.Value, MetersOfHeadTolerance); - Assert.Equal(PressureUnit.MeterOfHead, meterofheadQuantity.Unit); - - var micropascalQuantity = pascal.ToUnit(PressureUnit.Micropascal); - AssertEx.EqualTolerance(MicropascalsInOnePascal, (double)micropascalQuantity.Value, MicropascalsTolerance); - Assert.Equal(PressureUnit.Micropascal, micropascalQuantity.Unit); - - var millibarQuantity = pascal.ToUnit(PressureUnit.Millibar); - AssertEx.EqualTolerance(MillibarsInOnePascal, (double)millibarQuantity.Value, MillibarsTolerance); - Assert.Equal(PressureUnit.Millibar, millibarQuantity.Unit); - - var millimeterofmercuryQuantity = pascal.ToUnit(PressureUnit.MillimeterOfMercury); - AssertEx.EqualTolerance(MillimetersOfMercuryInOnePascal, (double)millimeterofmercuryQuantity.Value, MillimetersOfMercuryTolerance); - Assert.Equal(PressureUnit.MillimeterOfMercury, millimeterofmercuryQuantity.Unit); - - var newtonpersquarecentimeterQuantity = pascal.ToUnit(PressureUnit.NewtonPerSquareCentimeter); - AssertEx.EqualTolerance(NewtonsPerSquareCentimeterInOnePascal, (double)newtonpersquarecentimeterQuantity.Value, NewtonsPerSquareCentimeterTolerance); - Assert.Equal(PressureUnit.NewtonPerSquareCentimeter, newtonpersquarecentimeterQuantity.Unit); - - var newtonpersquaremeterQuantity = pascal.ToUnit(PressureUnit.NewtonPerSquareMeter); - AssertEx.EqualTolerance(NewtonsPerSquareMeterInOnePascal, (double)newtonpersquaremeterQuantity.Value, NewtonsPerSquareMeterTolerance); - Assert.Equal(PressureUnit.NewtonPerSquareMeter, newtonpersquaremeterQuantity.Unit); - - var newtonpersquaremillimeterQuantity = pascal.ToUnit(PressureUnit.NewtonPerSquareMillimeter); - AssertEx.EqualTolerance(NewtonsPerSquareMillimeterInOnePascal, (double)newtonpersquaremillimeterQuantity.Value, NewtonsPerSquareMillimeterTolerance); - Assert.Equal(PressureUnit.NewtonPerSquareMillimeter, newtonpersquaremillimeterQuantity.Unit); - - var pascalQuantity = pascal.ToUnit(PressureUnit.Pascal); - AssertEx.EqualTolerance(PascalsInOnePascal, (double)pascalQuantity.Value, PascalsTolerance); - Assert.Equal(PressureUnit.Pascal, pascalQuantity.Unit); - - var poundforcepersquarefootQuantity = pascal.ToUnit(PressureUnit.PoundForcePerSquareFoot); - AssertEx.EqualTolerance(PoundsForcePerSquareFootInOnePascal, (double)poundforcepersquarefootQuantity.Value, PoundsForcePerSquareFootTolerance); - Assert.Equal(PressureUnit.PoundForcePerSquareFoot, poundforcepersquarefootQuantity.Unit); - - var poundforcepersquareinchQuantity = pascal.ToUnit(PressureUnit.PoundForcePerSquareInch); - AssertEx.EqualTolerance(PoundsForcePerSquareInchInOnePascal, (double)poundforcepersquareinchQuantity.Value, PoundsForcePerSquareInchTolerance); - Assert.Equal(PressureUnit.PoundForcePerSquareInch, poundforcepersquareinchQuantity.Unit); - - var technicalatmosphereQuantity = pascal.ToUnit(PressureUnit.TechnicalAtmosphere); - AssertEx.EqualTolerance(TechnicalAtmospheresInOnePascal, (double)technicalatmosphereQuantity.Value, TechnicalAtmospheresTolerance); - Assert.Equal(PressureUnit.TechnicalAtmosphere, technicalatmosphereQuantity.Unit); - - var tonneforcepersquarecentimeterQuantity = pascal.ToUnit(PressureUnit.TonneForcePerSquareCentimeter); - AssertEx.EqualTolerance(TonnesForcePerSquareCentimeterInOnePascal, (double)tonneforcepersquarecentimeterQuantity.Value, TonnesForcePerSquareCentimeterTolerance); - Assert.Equal(PressureUnit.TonneForcePerSquareCentimeter, tonneforcepersquarecentimeterQuantity.Unit); - - var tonneforcepersquaremeterQuantity = pascal.ToUnit(PressureUnit.TonneForcePerSquareMeter); - AssertEx.EqualTolerance(TonnesForcePerSquareMeterInOnePascal, (double)tonneforcepersquaremeterQuantity.Value, TonnesForcePerSquareMeterTolerance); - Assert.Equal(PressureUnit.TonneForcePerSquareMeter, tonneforcepersquaremeterQuantity.Unit); - - var tonneforcepersquaremillimeterQuantity = pascal.ToUnit(PressureUnit.TonneForcePerSquareMillimeter); - AssertEx.EqualTolerance(TonnesForcePerSquareMillimeterInOnePascal, (double)tonneforcepersquaremillimeterQuantity.Value, TonnesForcePerSquareMillimeterTolerance); - Assert.Equal(PressureUnit.TonneForcePerSquareMillimeter, tonneforcepersquaremillimeterQuantity.Unit); - - var torrQuantity = pascal.ToUnit(PressureUnit.Torr); - AssertEx.EqualTolerance(TorrsInOnePascal, (double)torrQuantity.Value, TorrsTolerance); - Assert.Equal(PressureUnit.Torr, torrQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Pressure pascal = Pressure.FromPascals(1); - AssertEx.EqualTolerance(1, Pressure.FromAtmospheres(pascal.Atmospheres).Pascals, AtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.FromBars(pascal.Bars).Pascals, BarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromCentibars(pascal.Centibars).Pascals, CentibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromDecapascals(pascal.Decapascals).Pascals, DecapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromDecibars(pascal.Decibars).Pascals, DecibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromFeetOfHead(pascal.FeetOfHead).Pascals, FeetOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.FromGigapascals(pascal.Gigapascals).Pascals, GigapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromHectopascals(pascal.Hectopascals).Pascals, HectopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromInchesOfMercury(pascal.InchesOfMercury).Pascals, InchesOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilobars(pascal.Kilobars).Pascals, KilobarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareCentimeter(pascal.KilogramsForcePerSquareCentimeter).Pascals, KilogramsForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareMeter(pascal.KilogramsForcePerSquareMeter).Pascals, KilogramsForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilogramsForcePerSquareMillimeter(pascal.KilogramsForcePerSquareMillimeter).Pascals, KilogramsForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareCentimeter(pascal.KilonewtonsPerSquareCentimeter).Pascals, KilonewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareMeter(pascal.KilonewtonsPerSquareMeter).Pascals, KilonewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilonewtonsPerSquareMillimeter(pascal.KilonewtonsPerSquareMillimeter).Pascals, KilonewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilopascals(pascal.Kilopascals).Pascals, KilopascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilopoundsForcePerSquareFoot(pascal.KilopoundsForcePerSquareFoot).Pascals, KilopoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.FromKilopoundsForcePerSquareInch(pascal.KilopoundsForcePerSquareInch).Pascals, KilopoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMegabars(pascal.Megabars).Pascals, MegabarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMeganewtonsPerSquareMeter(pascal.MeganewtonsPerSquareMeter).Pascals, MeganewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMegapascals(pascal.Megapascals).Pascals, MegapascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMetersOfHead(pascal.MetersOfHead).Pascals, MetersOfHeadTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMicropascals(pascal.Micropascals).Pascals, MicropascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMillibars(pascal.Millibars).Pascals, MillibarsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromMillimetersOfMercury(pascal.MillimetersOfMercury).Pascals, MillimetersOfMercuryTolerance); - AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareCentimeter(pascal.NewtonsPerSquareCentimeter).Pascals, NewtonsPerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareMeter(pascal.NewtonsPerSquareMeter).Pascals, NewtonsPerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromNewtonsPerSquareMillimeter(pascal.NewtonsPerSquareMillimeter).Pascals, NewtonsPerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPascals(pascal.Pascals).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareFoot(pascal.PoundsForcePerSquareFoot).Pascals, PoundsForcePerSquareFootTolerance); - AssertEx.EqualTolerance(1, Pressure.FromPoundsForcePerSquareInch(pascal.PoundsForcePerSquareInch).Pascals, PoundsForcePerSquareInchTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTechnicalAtmospheres(pascal.TechnicalAtmospheres).Pascals, TechnicalAtmospheresTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareCentimeter(pascal.TonnesForcePerSquareCentimeter).Pascals, TonnesForcePerSquareCentimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareMeter(pascal.TonnesForcePerSquareMeter).Pascals, TonnesForcePerSquareMeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTonnesForcePerSquareMillimeter(pascal.TonnesForcePerSquareMillimeter).Pascals, TonnesForcePerSquareMillimeterTolerance); - AssertEx.EqualTolerance(1, Pressure.FromTorrs(pascal.Torrs).Pascals, TorrsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Pressure v = Pressure.FromPascals(1); - AssertEx.EqualTolerance(-1, -v.Pascals, PascalsTolerance); - AssertEx.EqualTolerance(2, (Pressure.FromPascals(3)-v).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(2, (v + v).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(10, (v*10).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(10, (10*v).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(2, (Pressure.FromPascals(10)/5).Pascals, PascalsTolerance); - AssertEx.EqualTolerance(2, Pressure.FromPascals(10)/Pressure.FromPascals(5), PascalsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Pressure onePascal = Pressure.FromPascals(1); - Pressure twoPascals = Pressure.FromPascals(2); - - Assert.True(onePascal < twoPascals); - Assert.True(onePascal <= twoPascals); - Assert.True(twoPascals > onePascal); - Assert.True(twoPascals >= onePascal); - - Assert.False(onePascal > twoPascals); - Assert.False(onePascal >= twoPascals); - Assert.False(twoPascals < onePascal); - Assert.False(twoPascals <= onePascal); - } - - [Fact] - public void CompareToIsImplemented() - { - Pressure pascal = Pressure.FromPascals(1); - Assert.Equal(0, pascal.CompareTo(pascal)); - Assert.True(pascal.CompareTo(Pressure.Zero) > 0); - Assert.True(Pressure.Zero.CompareTo(pascal) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Pressure pascal = Pressure.FromPascals(1); - Assert.Throws(() => pascal.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Pressure pascal = Pressure.FromPascals(1); - Assert.Throws(() => pascal.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Pressure v = Pressure.FromPascals(1); - Assert.True(v.Equals(Pressure.FromPascals(1), PascalsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Pressure.Zero, PascalsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Pressure pascal = Pressure.FromPascals(1); - Assert.False(pascal.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Pressure pascal = Pressure.FromPascals(1); - Assert.False(pascal.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(PressureUnit.Undefined, Pressure.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(PressureUnit)).Cast(); - foreach(var unit in units) - { - if(unit == PressureUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs deleted file mode 100644 index d3829553fb..0000000000 --- a/UnitsNet.Tests/GeneratedCode/RatioTestsBase.g.cs +++ /dev/null @@ -1,274 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Ratio. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class RatioTestsBase - { - protected abstract double DecimalFractionsInOneDecimalFraction { get; } - protected abstract double PartsPerBillionInOneDecimalFraction { get; } - protected abstract double PartsPerMillionInOneDecimalFraction { get; } - protected abstract double PartsPerThousandInOneDecimalFraction { get; } - protected abstract double PartsPerTrillionInOneDecimalFraction { get; } - protected abstract double PercentInOneDecimalFraction { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DecimalFractionsTolerance { get { return 1e-5; } } - protected virtual double PartsPerBillionTolerance { get { return 1e-5; } } - protected virtual double PartsPerMillionTolerance { get { return 1e-5; } } - protected virtual double PartsPerThousandTolerance { get { return 1e-5; } } - protected virtual double PartsPerTrillionTolerance { get { return 1e-5; } } - protected virtual double PercentTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Ratio((double)0.0, RatioUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Ratio(double.PositiveInfinity, RatioUnit.DecimalFraction)); - Assert.Throws(() => new Ratio(double.NegativeInfinity, RatioUnit.DecimalFraction)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Ratio(double.NaN, RatioUnit.DecimalFraction)); - } - - [Fact] - public void DecimalFractionToRatioUnits() - { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - AssertEx.EqualTolerance(DecimalFractionsInOneDecimalFraction, decimalfraction.DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(PartsPerBillionInOneDecimalFraction, decimalfraction.PartsPerBillion, PartsPerBillionTolerance); - AssertEx.EqualTolerance(PartsPerMillionInOneDecimalFraction, decimalfraction.PartsPerMillion, PartsPerMillionTolerance); - AssertEx.EqualTolerance(PartsPerThousandInOneDecimalFraction, decimalfraction.PartsPerThousand, PartsPerThousandTolerance); - AssertEx.EqualTolerance(PartsPerTrillionInOneDecimalFraction, decimalfraction.PartsPerTrillion, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(PercentInOneDecimalFraction, decimalfraction.Percent, PercentTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.DecimalFraction).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerBillion).PartsPerBillion, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerMillion).PartsPerMillion, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerThousand).PartsPerThousand, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.PartPerTrillion).PartsPerTrillion, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, Ratio.From(1, RatioUnit.Percent).Percent, PercentTolerance); - } - - [Fact] - public void FromDecimalFractions_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Ratio.FromDecimalFractions(double.PositiveInfinity)); - Assert.Throws(() => Ratio.FromDecimalFractions(double.NegativeInfinity)); - } - - [Fact] - public void FromDecimalFractions_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Ratio.FromDecimalFractions(double.NaN)); - } - - [Fact] - public void As() - { - var decimalfraction = Ratio.FromDecimalFractions(1); - AssertEx.EqualTolerance(DecimalFractionsInOneDecimalFraction, decimalfraction.As(RatioUnit.DecimalFraction), DecimalFractionsTolerance); - AssertEx.EqualTolerance(PartsPerBillionInOneDecimalFraction, decimalfraction.As(RatioUnit.PartPerBillion), PartsPerBillionTolerance); - AssertEx.EqualTolerance(PartsPerMillionInOneDecimalFraction, decimalfraction.As(RatioUnit.PartPerMillion), PartsPerMillionTolerance); - AssertEx.EqualTolerance(PartsPerThousandInOneDecimalFraction, decimalfraction.As(RatioUnit.PartPerThousand), PartsPerThousandTolerance); - AssertEx.EqualTolerance(PartsPerTrillionInOneDecimalFraction, decimalfraction.As(RatioUnit.PartPerTrillion), PartsPerTrillionTolerance); - AssertEx.EqualTolerance(PercentInOneDecimalFraction, decimalfraction.As(RatioUnit.Percent), PercentTolerance); - } - - [Fact] - public void ToUnit() - { - var decimalfraction = Ratio.FromDecimalFractions(1); - - var decimalfractionQuantity = decimalfraction.ToUnit(RatioUnit.DecimalFraction); - AssertEx.EqualTolerance(DecimalFractionsInOneDecimalFraction, (double)decimalfractionQuantity.Value, DecimalFractionsTolerance); - Assert.Equal(RatioUnit.DecimalFraction, decimalfractionQuantity.Unit); - - var partperbillionQuantity = decimalfraction.ToUnit(RatioUnit.PartPerBillion); - AssertEx.EqualTolerance(PartsPerBillionInOneDecimalFraction, (double)partperbillionQuantity.Value, PartsPerBillionTolerance); - Assert.Equal(RatioUnit.PartPerBillion, partperbillionQuantity.Unit); - - var partpermillionQuantity = decimalfraction.ToUnit(RatioUnit.PartPerMillion); - AssertEx.EqualTolerance(PartsPerMillionInOneDecimalFraction, (double)partpermillionQuantity.Value, PartsPerMillionTolerance); - Assert.Equal(RatioUnit.PartPerMillion, partpermillionQuantity.Unit); - - var partperthousandQuantity = decimalfraction.ToUnit(RatioUnit.PartPerThousand); - AssertEx.EqualTolerance(PartsPerThousandInOneDecimalFraction, (double)partperthousandQuantity.Value, PartsPerThousandTolerance); - Assert.Equal(RatioUnit.PartPerThousand, partperthousandQuantity.Unit); - - var partpertrillionQuantity = decimalfraction.ToUnit(RatioUnit.PartPerTrillion); - AssertEx.EqualTolerance(PartsPerTrillionInOneDecimalFraction, (double)partpertrillionQuantity.Value, PartsPerTrillionTolerance); - Assert.Equal(RatioUnit.PartPerTrillion, partpertrillionQuantity.Unit); - - var percentQuantity = decimalfraction.ToUnit(RatioUnit.Percent); - AssertEx.EqualTolerance(PercentInOneDecimalFraction, (double)percentQuantity.Value, PercentTolerance); - Assert.Equal(RatioUnit.Percent, percentQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - AssertEx.EqualTolerance(1, Ratio.FromDecimalFractions(decimalfraction.DecimalFractions).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerBillion(decimalfraction.PartsPerBillion).DecimalFractions, PartsPerBillionTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerMillion(decimalfraction.PartsPerMillion).DecimalFractions, PartsPerMillionTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerThousand(decimalfraction.PartsPerThousand).DecimalFractions, PartsPerThousandTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPartsPerTrillion(decimalfraction.PartsPerTrillion).DecimalFractions, PartsPerTrillionTolerance); - AssertEx.EqualTolerance(1, Ratio.FromPercent(decimalfraction.Percent).DecimalFractions, PercentTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Ratio v = Ratio.FromDecimalFractions(1); - AssertEx.EqualTolerance(-1, -v.DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (Ratio.FromDecimalFractions(3)-v).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (v + v).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(10, (v*10).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(10, (10*v).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, (Ratio.FromDecimalFractions(10)/5).DecimalFractions, DecimalFractionsTolerance); - AssertEx.EqualTolerance(2, Ratio.FromDecimalFractions(10)/Ratio.FromDecimalFractions(5), DecimalFractionsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Ratio oneDecimalFraction = Ratio.FromDecimalFractions(1); - Ratio twoDecimalFractions = Ratio.FromDecimalFractions(2); - - Assert.True(oneDecimalFraction < twoDecimalFractions); - Assert.True(oneDecimalFraction <= twoDecimalFractions); - Assert.True(twoDecimalFractions > oneDecimalFraction); - Assert.True(twoDecimalFractions >= oneDecimalFraction); - - Assert.False(oneDecimalFraction > twoDecimalFractions); - Assert.False(oneDecimalFraction >= twoDecimalFractions); - Assert.False(twoDecimalFractions < oneDecimalFraction); - Assert.False(twoDecimalFractions <= oneDecimalFraction); - } - - [Fact] - public void CompareToIsImplemented() - { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - Assert.Equal(0, decimalfraction.CompareTo(decimalfraction)); - Assert.True(decimalfraction.CompareTo(Ratio.Zero) > 0); - Assert.True(Ratio.Zero.CompareTo(decimalfraction) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - Assert.Throws(() => decimalfraction.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - Assert.Throws(() => decimalfraction.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Ratio v = Ratio.FromDecimalFractions(1); - Assert.True(v.Equals(Ratio.FromDecimalFractions(1), DecimalFractionsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Ratio.Zero, DecimalFractionsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - Assert.False(decimalfraction.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Ratio decimalfraction = Ratio.FromDecimalFractions(1); - Assert.False(decimalfraction.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(RatioUnit.Undefined, Ratio.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(RatioUnit)).Cast(); - foreach(var unit in units) - { - if(unit == RatioUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs deleted file mode 100644 index 587e16695c..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ReactiveEnergyTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ReactiveEnergy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ReactiveEnergyTestsBase - { - protected abstract double KilovoltampereReactiveHoursInOneVoltampereReactiveHour { get; } - protected abstract double MegavoltampereReactiveHoursInOneVoltampereReactiveHour { get; } - protected abstract double VoltampereReactiveHoursInOneVoltampereReactiveHour { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilovoltampereReactiveHoursTolerance { get { return 1e-5; } } - protected virtual double MegavoltampereReactiveHoursTolerance { get { return 1e-5; } } - protected virtual double VoltampereReactiveHoursTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ReactiveEnergy((double)0.0, ReactiveEnergyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ReactiveEnergy(double.PositiveInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); - Assert.Throws(() => new ReactiveEnergy(double.NegativeInfinity, ReactiveEnergyUnit.VoltampereReactiveHour)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ReactiveEnergy(double.NaN, ReactiveEnergyUnit.VoltampereReactiveHour)); - } - - [Fact] - public void VoltampereReactiveHourToReactiveEnergyUnits() - { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - AssertEx.EqualTolerance(KilovoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.KilovoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(MegavoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.MegavoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(VoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.KilovoltampereReactiveHour).KilovoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.MegavoltampereReactiveHour).MegavoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.From(1, ReactiveEnergyUnit.VoltampereReactiveHour).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - } - - [Fact] - public void FromVoltampereReactiveHours_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.PositiveInfinity)); - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NegativeInfinity)); - } - - [Fact] - public void FromVoltampereReactiveHours_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ReactiveEnergy.FromVoltampereReactiveHours(double.NaN)); - } - - [Fact] - public void As() - { - var voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - AssertEx.EqualTolerance(KilovoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.As(ReactiveEnergyUnit.KilovoltampereReactiveHour), KilovoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(MegavoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.As(ReactiveEnergyUnit.MegavoltampereReactiveHour), MegavoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(VoltampereReactiveHoursInOneVoltampereReactiveHour, voltamperereactivehour.As(ReactiveEnergyUnit.VoltampereReactiveHour), VoltampereReactiveHoursTolerance); - } - - [Fact] - public void ToUnit() - { - var voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - - var kilovoltamperereactivehourQuantity = voltamperereactivehour.ToUnit(ReactiveEnergyUnit.KilovoltampereReactiveHour); - AssertEx.EqualTolerance(KilovoltampereReactiveHoursInOneVoltampereReactiveHour, (double)kilovoltamperereactivehourQuantity.Value, KilovoltampereReactiveHoursTolerance); - Assert.Equal(ReactiveEnergyUnit.KilovoltampereReactiveHour, kilovoltamperereactivehourQuantity.Unit); - - var megavoltamperereactivehourQuantity = voltamperereactivehour.ToUnit(ReactiveEnergyUnit.MegavoltampereReactiveHour); - AssertEx.EqualTolerance(MegavoltampereReactiveHoursInOneVoltampereReactiveHour, (double)megavoltamperereactivehourQuantity.Value, MegavoltampereReactiveHoursTolerance); - Assert.Equal(ReactiveEnergyUnit.MegavoltampereReactiveHour, megavoltamperereactivehourQuantity.Unit); - - var voltamperereactivehourQuantity = voltamperereactivehour.ToUnit(ReactiveEnergyUnit.VoltampereReactiveHour); - AssertEx.EqualTolerance(VoltampereReactiveHoursInOneVoltampereReactiveHour, (double)voltamperereactivehourQuantity.Value, VoltampereReactiveHoursTolerance); - Assert.Equal(ReactiveEnergyUnit.VoltampereReactiveHour, voltamperereactivehourQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - AssertEx.EqualTolerance(1, ReactiveEnergy.FromKilovoltampereReactiveHours(voltamperereactivehour.KilovoltampereReactiveHours).VoltampereReactiveHours, KilovoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.FromMegavoltampereReactiveHours(voltamperereactivehour.MegavoltampereReactiveHours).VoltampereReactiveHours, MegavoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(1, ReactiveEnergy.FromVoltampereReactiveHours(voltamperereactivehour.VoltampereReactiveHours).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ReactiveEnergy v = ReactiveEnergy.FromVoltampereReactiveHours(1); - AssertEx.EqualTolerance(-1, -v.VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(2, (ReactiveEnergy.FromVoltampereReactiveHours(3)-v).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(2, (v + v).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(10, (v*10).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(10, (10*v).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(2, (ReactiveEnergy.FromVoltampereReactiveHours(10)/5).VoltampereReactiveHours, VoltampereReactiveHoursTolerance); - AssertEx.EqualTolerance(2, ReactiveEnergy.FromVoltampereReactiveHours(10)/ReactiveEnergy.FromVoltampereReactiveHours(5), VoltampereReactiveHoursTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ReactiveEnergy oneVoltampereReactiveHour = ReactiveEnergy.FromVoltampereReactiveHours(1); - ReactiveEnergy twoVoltampereReactiveHours = ReactiveEnergy.FromVoltampereReactiveHours(2); - - Assert.True(oneVoltampereReactiveHour < twoVoltampereReactiveHours); - Assert.True(oneVoltampereReactiveHour <= twoVoltampereReactiveHours); - Assert.True(twoVoltampereReactiveHours > oneVoltampereReactiveHour); - Assert.True(twoVoltampereReactiveHours >= oneVoltampereReactiveHour); - - Assert.False(oneVoltampereReactiveHour > twoVoltampereReactiveHours); - Assert.False(oneVoltampereReactiveHour >= twoVoltampereReactiveHours); - Assert.False(twoVoltampereReactiveHours < oneVoltampereReactiveHour); - Assert.False(twoVoltampereReactiveHours <= oneVoltampereReactiveHour); - } - - [Fact] - public void CompareToIsImplemented() - { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.Equal(0, voltamperereactivehour.CompareTo(voltamperereactivehour)); - Assert.True(voltamperereactivehour.CompareTo(ReactiveEnergy.Zero) > 0); - Assert.True(ReactiveEnergy.Zero.CompareTo(voltamperereactivehour) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.Throws(() => voltamperereactivehour.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.Throws(() => voltamperereactivehour.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ReactiveEnergy v = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.True(v.Equals(ReactiveEnergy.FromVoltampereReactiveHours(1), VoltampereReactiveHoursTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ReactiveEnergy.Zero, VoltampereReactiveHoursTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.False(voltamperereactivehour.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ReactiveEnergy voltamperereactivehour = ReactiveEnergy.FromVoltampereReactiveHours(1); - Assert.False(voltamperereactivehour.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ReactiveEnergyUnit.Undefined, ReactiveEnergy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ReactiveEnergyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ReactiveEnergyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs deleted file mode 100644 index 4c99d361b4..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ReactivePowerTestsBase.g.cs +++ /dev/null @@ -1,254 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ReactivePower. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ReactivePowerTestsBase - { - protected abstract double GigavoltamperesReactiveInOneVoltampereReactive { get; } - protected abstract double KilovoltamperesReactiveInOneVoltampereReactive { get; } - protected abstract double MegavoltamperesReactiveInOneVoltampereReactive { get; } - protected abstract double VoltamperesReactiveInOneVoltampereReactive { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double GigavoltamperesReactiveTolerance { get { return 1e-5; } } - protected virtual double KilovoltamperesReactiveTolerance { get { return 1e-5; } } - protected virtual double MegavoltamperesReactiveTolerance { get { return 1e-5; } } - protected virtual double VoltamperesReactiveTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ReactivePower((double)0.0, ReactivePowerUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ReactivePower(double.PositiveInfinity, ReactivePowerUnit.VoltampereReactive)); - Assert.Throws(() => new ReactivePower(double.NegativeInfinity, ReactivePowerUnit.VoltampereReactive)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ReactivePower(double.NaN, ReactivePowerUnit.VoltampereReactive)); - } - - [Fact] - public void VoltampereReactiveToReactivePowerUnits() - { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - AssertEx.EqualTolerance(GigavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.GigavoltamperesReactive, GigavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(KilovoltamperesReactiveInOneVoltampereReactive, voltamperereactive.KilovoltamperesReactive, KilovoltamperesReactiveTolerance); - AssertEx.EqualTolerance(MegavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.MegavoltamperesReactive, MegavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(VoltamperesReactiveInOneVoltampereReactive, voltamperereactive.VoltamperesReactive, VoltamperesReactiveTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.GigavoltampereReactive).GigavoltamperesReactive, GigavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.KilovoltampereReactive).KilovoltamperesReactive, KilovoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.MegavoltampereReactive).MegavoltamperesReactive, MegavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.From(1, ReactivePowerUnit.VoltampereReactive).VoltamperesReactive, VoltamperesReactiveTolerance); - } - - [Fact] - public void FromVoltamperesReactive_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity)); - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity)); - } - - [Fact] - public void FromVoltamperesReactive_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ReactivePower.FromVoltamperesReactive(double.NaN)); - } - - [Fact] - public void As() - { - var voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - AssertEx.EqualTolerance(GigavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.As(ReactivePowerUnit.GigavoltampereReactive), GigavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(KilovoltamperesReactiveInOneVoltampereReactive, voltamperereactive.As(ReactivePowerUnit.KilovoltampereReactive), KilovoltamperesReactiveTolerance); - AssertEx.EqualTolerance(MegavoltamperesReactiveInOneVoltampereReactive, voltamperereactive.As(ReactivePowerUnit.MegavoltampereReactive), MegavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(VoltamperesReactiveInOneVoltampereReactive, voltamperereactive.As(ReactivePowerUnit.VoltampereReactive), VoltamperesReactiveTolerance); - } - - [Fact] - public void ToUnit() - { - var voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - - var gigavoltamperereactiveQuantity = voltamperereactive.ToUnit(ReactivePowerUnit.GigavoltampereReactive); - AssertEx.EqualTolerance(GigavoltamperesReactiveInOneVoltampereReactive, (double)gigavoltamperereactiveQuantity.Value, GigavoltamperesReactiveTolerance); - Assert.Equal(ReactivePowerUnit.GigavoltampereReactive, gigavoltamperereactiveQuantity.Unit); - - var kilovoltamperereactiveQuantity = voltamperereactive.ToUnit(ReactivePowerUnit.KilovoltampereReactive); - AssertEx.EqualTolerance(KilovoltamperesReactiveInOneVoltampereReactive, (double)kilovoltamperereactiveQuantity.Value, KilovoltamperesReactiveTolerance); - Assert.Equal(ReactivePowerUnit.KilovoltampereReactive, kilovoltamperereactiveQuantity.Unit); - - var megavoltamperereactiveQuantity = voltamperereactive.ToUnit(ReactivePowerUnit.MegavoltampereReactive); - AssertEx.EqualTolerance(MegavoltamperesReactiveInOneVoltampereReactive, (double)megavoltamperereactiveQuantity.Value, MegavoltamperesReactiveTolerance); - Assert.Equal(ReactivePowerUnit.MegavoltampereReactive, megavoltamperereactiveQuantity.Unit); - - var voltamperereactiveQuantity = voltamperereactive.ToUnit(ReactivePowerUnit.VoltampereReactive); - AssertEx.EqualTolerance(VoltamperesReactiveInOneVoltampereReactive, (double)voltamperereactiveQuantity.Value, VoltamperesReactiveTolerance); - Assert.Equal(ReactivePowerUnit.VoltampereReactive, voltamperereactiveQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - AssertEx.EqualTolerance(1, ReactivePower.FromGigavoltamperesReactive(voltamperereactive.GigavoltamperesReactive).VoltamperesReactive, GigavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.FromKilovoltamperesReactive(voltamperereactive.KilovoltamperesReactive).VoltamperesReactive, KilovoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.FromMegavoltamperesReactive(voltamperereactive.MegavoltamperesReactive).VoltamperesReactive, MegavoltamperesReactiveTolerance); - AssertEx.EqualTolerance(1, ReactivePower.FromVoltamperesReactive(voltamperereactive.VoltamperesReactive).VoltamperesReactive, VoltamperesReactiveTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ReactivePower v = ReactivePower.FromVoltamperesReactive(1); - AssertEx.EqualTolerance(-1, -v.VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(2, (ReactivePower.FromVoltamperesReactive(3)-v).VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(2, (v + v).VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(10, (v*10).VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(10, (10*v).VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(2, (ReactivePower.FromVoltamperesReactive(10)/5).VoltamperesReactive, VoltamperesReactiveTolerance); - AssertEx.EqualTolerance(2, ReactivePower.FromVoltamperesReactive(10)/ReactivePower.FromVoltamperesReactive(5), VoltamperesReactiveTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ReactivePower oneVoltampereReactive = ReactivePower.FromVoltamperesReactive(1); - ReactivePower twoVoltamperesReactive = ReactivePower.FromVoltamperesReactive(2); - - Assert.True(oneVoltampereReactive < twoVoltamperesReactive); - Assert.True(oneVoltampereReactive <= twoVoltamperesReactive); - Assert.True(twoVoltamperesReactive > oneVoltampereReactive); - Assert.True(twoVoltamperesReactive >= oneVoltampereReactive); - - Assert.False(oneVoltampereReactive > twoVoltamperesReactive); - Assert.False(oneVoltampereReactive >= twoVoltamperesReactive); - Assert.False(twoVoltamperesReactive < oneVoltampereReactive); - Assert.False(twoVoltamperesReactive <= oneVoltampereReactive); - } - - [Fact] - public void CompareToIsImplemented() - { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - Assert.Equal(0, voltamperereactive.CompareTo(voltamperereactive)); - Assert.True(voltamperereactive.CompareTo(ReactivePower.Zero) > 0); - Assert.True(ReactivePower.Zero.CompareTo(voltamperereactive) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - Assert.Throws(() => voltamperereactive.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - Assert.Throws(() => voltamperereactive.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ReactivePower v = ReactivePower.FromVoltamperesReactive(1); - Assert.True(v.Equals(ReactivePower.FromVoltamperesReactive(1), VoltamperesReactiveTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ReactivePower.Zero, VoltamperesReactiveTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - Assert.False(voltamperereactive.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1); - Assert.False(voltamperereactive.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ReactivePowerUnit.Undefined, ReactivePower.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ReactivePowerUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ReactivePowerUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs deleted file mode 100644 index 8312e239ce..0000000000 --- a/UnitsNet.Tests/GeneratedCode/RotationalAccelerationTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of RotationalAcceleration. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class RotationalAccelerationTestsBase - { - protected abstract double DegreesPerSecondSquaredInOneRadianPerSecondSquared { get; } - protected abstract double RadiansPerSecondSquaredInOneRadianPerSecondSquared { get; } - protected abstract double RevolutionsPerMinutePerSecondInOneRadianPerSecondSquared { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DegreesPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double RadiansPerSecondSquaredTolerance { get { return 1e-5; } } - protected virtual double RevolutionsPerMinutePerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalAcceleration((double)0.0, RotationalAccelerationUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalAcceleration(double.PositiveInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); - Assert.Throws(() => new RotationalAcceleration(double.NegativeInfinity, RotationalAccelerationUnit.RadianPerSecondSquared)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalAcceleration(double.NaN, RotationalAccelerationUnit.RadianPerSecondSquared)); - } - - [Fact] - public void RadianPerSecondSquaredToRotationalAccelerationUnits() - { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - AssertEx.EqualTolerance(DegreesPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.DegreesPerSecondSquared, DegreesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(RadiansPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(RevolutionsPerMinutePerSecondInOneRadianPerSecondSquared, radianpersecondsquared.RevolutionsPerMinutePerSecond, RevolutionsPerMinutePerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.DegreePerSecondSquared).DegreesPerSecondSquared, DegreesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RadianPerSecondSquared).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.From(1, RotationalAccelerationUnit.RevolutionPerMinutePerSecond).RevolutionsPerMinutePerSecond, RevolutionsPerMinutePerSecondTolerance); - } - - [Fact] - public void FromRadiansPerSecondSquared_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.PositiveInfinity)); - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NegativeInfinity)); - } - - [Fact] - public void FromRadiansPerSecondSquared_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalAcceleration.FromRadiansPerSecondSquared(double.NaN)); - } - - [Fact] - public void As() - { - var radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - AssertEx.EqualTolerance(DegreesPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.As(RotationalAccelerationUnit.DegreePerSecondSquared), DegreesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(RadiansPerSecondSquaredInOneRadianPerSecondSquared, radianpersecondsquared.As(RotationalAccelerationUnit.RadianPerSecondSquared), RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(RevolutionsPerMinutePerSecondInOneRadianPerSecondSquared, radianpersecondsquared.As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond), RevolutionsPerMinutePerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - - var degreepersecondsquaredQuantity = radianpersecondsquared.ToUnit(RotationalAccelerationUnit.DegreePerSecondSquared); - AssertEx.EqualTolerance(DegreesPerSecondSquaredInOneRadianPerSecondSquared, (double)degreepersecondsquaredQuantity.Value, DegreesPerSecondSquaredTolerance); - Assert.Equal(RotationalAccelerationUnit.DegreePerSecondSquared, degreepersecondsquaredQuantity.Unit); - - var radianpersecondsquaredQuantity = radianpersecondsquared.ToUnit(RotationalAccelerationUnit.RadianPerSecondSquared); - AssertEx.EqualTolerance(RadiansPerSecondSquaredInOneRadianPerSecondSquared, (double)radianpersecondsquaredQuantity.Value, RadiansPerSecondSquaredTolerance); - Assert.Equal(RotationalAccelerationUnit.RadianPerSecondSquared, radianpersecondsquaredQuantity.Unit); - - var revolutionperminutepersecondQuantity = radianpersecondsquared.ToUnit(RotationalAccelerationUnit.RevolutionPerMinutePerSecond); - AssertEx.EqualTolerance(RevolutionsPerMinutePerSecondInOneRadianPerSecondSquared, (double)revolutionperminutepersecondQuantity.Value, RevolutionsPerMinutePerSecondTolerance); - Assert.Equal(RotationalAccelerationUnit.RevolutionPerMinutePerSecond, revolutionperminutepersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - AssertEx.EqualTolerance(1, RotationalAcceleration.FromDegreesPerSecondSquared(radianpersecondsquared.DegreesPerSecondSquared).RadiansPerSecondSquared, DegreesPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.FromRadiansPerSecondSquared(radianpersecondsquared.RadiansPerSecondSquared).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(1, RotationalAcceleration.FromRevolutionsPerMinutePerSecond(radianpersecondsquared.RevolutionsPerMinutePerSecond).RadiansPerSecondSquared, RevolutionsPerMinutePerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - RotationalAcceleration v = RotationalAcceleration.FromRadiansPerSecondSquared(1); - AssertEx.EqualTolerance(-1, -v.RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(3)-v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (v + v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(10, (v*10).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(10, (10*v).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, (RotationalAcceleration.FromRadiansPerSecondSquared(10)/5).RadiansPerSecondSquared, RadiansPerSecondSquaredTolerance); - AssertEx.EqualTolerance(2, RotationalAcceleration.FromRadiansPerSecondSquared(10)/RotationalAcceleration.FromRadiansPerSecondSquared(5), RadiansPerSecondSquaredTolerance); - } - - [Fact] - public void ComparisonOperators() - { - RotationalAcceleration oneRadianPerSecondSquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - RotationalAcceleration twoRadiansPerSecondSquared = RotationalAcceleration.FromRadiansPerSecondSquared(2); - - Assert.True(oneRadianPerSecondSquared < twoRadiansPerSecondSquared); - Assert.True(oneRadianPerSecondSquared <= twoRadiansPerSecondSquared); - Assert.True(twoRadiansPerSecondSquared > oneRadianPerSecondSquared); - Assert.True(twoRadiansPerSecondSquared >= oneRadianPerSecondSquared); - - Assert.False(oneRadianPerSecondSquared > twoRadiansPerSecondSquared); - Assert.False(oneRadianPerSecondSquared >= twoRadiansPerSecondSquared); - Assert.False(twoRadiansPerSecondSquared < oneRadianPerSecondSquared); - Assert.False(twoRadiansPerSecondSquared <= oneRadianPerSecondSquared); - } - - [Fact] - public void CompareToIsImplemented() - { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.Equal(0, radianpersecondsquared.CompareTo(radianpersecondsquared)); - Assert.True(radianpersecondsquared.CompareTo(RotationalAcceleration.Zero) > 0); - Assert.True(RotationalAcceleration.Zero.CompareTo(radianpersecondsquared) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.Throws(() => radianpersecondsquared.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.Throws(() => radianpersecondsquared.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - RotationalAcceleration v = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.True(v.Equals(RotationalAcceleration.FromRadiansPerSecondSquared(1), RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalAcceleration.Zero, RadiansPerSecondSquaredTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.False(radianpersecondsquared.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - RotationalAcceleration radianpersecondsquared = RotationalAcceleration.FromRadiansPerSecondSquared(1); - Assert.False(radianpersecondsquared.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(RotationalAccelerationUnit.Undefined, RotationalAcceleration.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(RotationalAccelerationUnit)).Cast(); - foreach(var unit in units) - { - if(unit == RotationalAccelerationUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs deleted file mode 100644 index 8f109fd011..0000000000 --- a/UnitsNet.Tests/GeneratedCode/RotationalSpeedTestsBase.g.cs +++ /dev/null @@ -1,344 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of RotationalSpeed. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class RotationalSpeedTestsBase - { - protected abstract double CentiradiansPerSecondInOneRadianPerSecond { get; } - protected abstract double DeciradiansPerSecondInOneRadianPerSecond { get; } - protected abstract double DegreesPerMinuteInOneRadianPerSecond { get; } - protected abstract double DegreesPerSecondInOneRadianPerSecond { get; } - protected abstract double MicrodegreesPerSecondInOneRadianPerSecond { get; } - protected abstract double MicroradiansPerSecondInOneRadianPerSecond { get; } - protected abstract double MillidegreesPerSecondInOneRadianPerSecond { get; } - protected abstract double MilliradiansPerSecondInOneRadianPerSecond { get; } - protected abstract double NanodegreesPerSecondInOneRadianPerSecond { get; } - protected abstract double NanoradiansPerSecondInOneRadianPerSecond { get; } - protected abstract double RadiansPerSecondInOneRadianPerSecond { get; } - protected abstract double RevolutionsPerMinuteInOneRadianPerSecond { get; } - protected abstract double RevolutionsPerSecondInOneRadianPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentiradiansPerSecondTolerance { get { return 1e-5; } } - protected virtual double DeciradiansPerSecondTolerance { get { return 1e-5; } } - protected virtual double DegreesPerMinuteTolerance { get { return 1e-5; } } - protected virtual double DegreesPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicrodegreesPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicroradiansPerSecondTolerance { get { return 1e-5; } } - protected virtual double MillidegreesPerSecondTolerance { get { return 1e-5; } } - protected virtual double MilliradiansPerSecondTolerance { get { return 1e-5; } } - protected virtual double NanodegreesPerSecondTolerance { get { return 1e-5; } } - protected virtual double NanoradiansPerSecondTolerance { get { return 1e-5; } } - protected virtual double RadiansPerSecondTolerance { get { return 1e-5; } } - protected virtual double RevolutionsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double RevolutionsPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalSpeed((double)0.0, RotationalSpeedUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalSpeed(double.PositiveInfinity, RotationalSpeedUnit.RadianPerSecond)); - Assert.Throws(() => new RotationalSpeed(double.NegativeInfinity, RotationalSpeedUnit.RadianPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalSpeed(double.NaN, RotationalSpeedUnit.RadianPerSecond)); - } - - [Fact] - public void RadianPerSecondToRotationalSpeedUnits() - { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - AssertEx.EqualTolerance(CentiradiansPerSecondInOneRadianPerSecond, radianpersecond.CentiradiansPerSecond, CentiradiansPerSecondTolerance); - AssertEx.EqualTolerance(DeciradiansPerSecondInOneRadianPerSecond, radianpersecond.DeciradiansPerSecond, DeciradiansPerSecondTolerance); - AssertEx.EqualTolerance(DegreesPerMinuteInOneRadianPerSecond, radianpersecond.DegreesPerMinute, DegreesPerMinuteTolerance); - AssertEx.EqualTolerance(DegreesPerSecondInOneRadianPerSecond, radianpersecond.DegreesPerSecond, DegreesPerSecondTolerance); - AssertEx.EqualTolerance(MicrodegreesPerSecondInOneRadianPerSecond, radianpersecond.MicrodegreesPerSecond, MicrodegreesPerSecondTolerance); - AssertEx.EqualTolerance(MicroradiansPerSecondInOneRadianPerSecond, radianpersecond.MicroradiansPerSecond, MicroradiansPerSecondTolerance); - AssertEx.EqualTolerance(MillidegreesPerSecondInOneRadianPerSecond, radianpersecond.MillidegreesPerSecond, MillidegreesPerSecondTolerance); - AssertEx.EqualTolerance(MilliradiansPerSecondInOneRadianPerSecond, radianpersecond.MilliradiansPerSecond, MilliradiansPerSecondTolerance); - AssertEx.EqualTolerance(NanodegreesPerSecondInOneRadianPerSecond, radianpersecond.NanodegreesPerSecond, NanodegreesPerSecondTolerance); - AssertEx.EqualTolerance(NanoradiansPerSecondInOneRadianPerSecond, radianpersecond.NanoradiansPerSecond, NanoradiansPerSecondTolerance); - AssertEx.EqualTolerance(RadiansPerSecondInOneRadianPerSecond, radianpersecond.RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(RevolutionsPerMinuteInOneRadianPerSecond, radianpersecond.RevolutionsPerMinute, RevolutionsPerMinuteTolerance); - AssertEx.EqualTolerance(RevolutionsPerSecondInOneRadianPerSecond, radianpersecond.RevolutionsPerSecond, RevolutionsPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.CentiradianPerSecond).CentiradiansPerSecond, CentiradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DeciradianPerSecond).DeciradiansPerSecond, DeciradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DegreePerMinute).DegreesPerMinute, DegreesPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.DegreePerSecond).DegreesPerSecond, DegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MicrodegreePerSecond).MicrodegreesPerSecond, MicrodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MicroradianPerSecond).MicroradiansPerSecond, MicroradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MillidegreePerSecond).MillidegreesPerSecond, MillidegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.MilliradianPerSecond).MilliradiansPerSecond, MilliradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.NanodegreePerSecond).NanodegreesPerSecond, NanodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.NanoradianPerSecond).NanoradiansPerSecond, NanoradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RadianPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerMinute).RevolutionsPerMinute, RevolutionsPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.From(1, RotationalSpeedUnit.RevolutionPerSecond).RevolutionsPerSecond, RevolutionsPerSecondTolerance); - } - - [Fact] - public void FromRadiansPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.PositiveInfinity)); - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromRadiansPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalSpeed.FromRadiansPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - AssertEx.EqualTolerance(CentiradiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.CentiradianPerSecond), CentiradiansPerSecondTolerance); - AssertEx.EqualTolerance(DeciradiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.DeciradianPerSecond), DeciradiansPerSecondTolerance); - AssertEx.EqualTolerance(DegreesPerMinuteInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.DegreePerMinute), DegreesPerMinuteTolerance); - AssertEx.EqualTolerance(DegreesPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.DegreePerSecond), DegreesPerSecondTolerance); - AssertEx.EqualTolerance(MicrodegreesPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.MicrodegreePerSecond), MicrodegreesPerSecondTolerance); - AssertEx.EqualTolerance(MicroradiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.MicroradianPerSecond), MicroradiansPerSecondTolerance); - AssertEx.EqualTolerance(MillidegreesPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.MillidegreePerSecond), MillidegreesPerSecondTolerance); - AssertEx.EqualTolerance(MilliradiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.MilliradianPerSecond), MilliradiansPerSecondTolerance); - AssertEx.EqualTolerance(NanodegreesPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.NanodegreePerSecond), NanodegreesPerSecondTolerance); - AssertEx.EqualTolerance(NanoradiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.NanoradianPerSecond), NanoradiansPerSecondTolerance); - AssertEx.EqualTolerance(RadiansPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.RadianPerSecond), RadiansPerSecondTolerance); - AssertEx.EqualTolerance(RevolutionsPerMinuteInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.RevolutionPerMinute), RevolutionsPerMinuteTolerance); - AssertEx.EqualTolerance(RevolutionsPerSecondInOneRadianPerSecond, radianpersecond.As(RotationalSpeedUnit.RevolutionPerSecond), RevolutionsPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - - var centiradianpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.CentiradianPerSecond); - AssertEx.EqualTolerance(CentiradiansPerSecondInOneRadianPerSecond, (double)centiradianpersecondQuantity.Value, CentiradiansPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.CentiradianPerSecond, centiradianpersecondQuantity.Unit); - - var deciradianpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.DeciradianPerSecond); - AssertEx.EqualTolerance(DeciradiansPerSecondInOneRadianPerSecond, (double)deciradianpersecondQuantity.Value, DeciradiansPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.DeciradianPerSecond, deciradianpersecondQuantity.Unit); - - var degreeperminuteQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.DegreePerMinute); - AssertEx.EqualTolerance(DegreesPerMinuteInOneRadianPerSecond, (double)degreeperminuteQuantity.Value, DegreesPerMinuteTolerance); - Assert.Equal(RotationalSpeedUnit.DegreePerMinute, degreeperminuteQuantity.Unit); - - var degreepersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.DegreePerSecond); - AssertEx.EqualTolerance(DegreesPerSecondInOneRadianPerSecond, (double)degreepersecondQuantity.Value, DegreesPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.DegreePerSecond, degreepersecondQuantity.Unit); - - var microdegreepersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.MicrodegreePerSecond); - AssertEx.EqualTolerance(MicrodegreesPerSecondInOneRadianPerSecond, (double)microdegreepersecondQuantity.Value, MicrodegreesPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.MicrodegreePerSecond, microdegreepersecondQuantity.Unit); - - var microradianpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.MicroradianPerSecond); - AssertEx.EqualTolerance(MicroradiansPerSecondInOneRadianPerSecond, (double)microradianpersecondQuantity.Value, MicroradiansPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.MicroradianPerSecond, microradianpersecondQuantity.Unit); - - var millidegreepersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.MillidegreePerSecond); - AssertEx.EqualTolerance(MillidegreesPerSecondInOneRadianPerSecond, (double)millidegreepersecondQuantity.Value, MillidegreesPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.MillidegreePerSecond, millidegreepersecondQuantity.Unit); - - var milliradianpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.MilliradianPerSecond); - AssertEx.EqualTolerance(MilliradiansPerSecondInOneRadianPerSecond, (double)milliradianpersecondQuantity.Value, MilliradiansPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.MilliradianPerSecond, milliradianpersecondQuantity.Unit); - - var nanodegreepersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.NanodegreePerSecond); - AssertEx.EqualTolerance(NanodegreesPerSecondInOneRadianPerSecond, (double)nanodegreepersecondQuantity.Value, NanodegreesPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.NanodegreePerSecond, nanodegreepersecondQuantity.Unit); - - var nanoradianpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.NanoradianPerSecond); - AssertEx.EqualTolerance(NanoradiansPerSecondInOneRadianPerSecond, (double)nanoradianpersecondQuantity.Value, NanoradiansPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.NanoradianPerSecond, nanoradianpersecondQuantity.Unit); - - var radianpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.RadianPerSecond); - AssertEx.EqualTolerance(RadiansPerSecondInOneRadianPerSecond, (double)radianpersecondQuantity.Value, RadiansPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.RadianPerSecond, radianpersecondQuantity.Unit); - - var revolutionperminuteQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.RevolutionPerMinute); - AssertEx.EqualTolerance(RevolutionsPerMinuteInOneRadianPerSecond, (double)revolutionperminuteQuantity.Value, RevolutionsPerMinuteTolerance); - Assert.Equal(RotationalSpeedUnit.RevolutionPerMinute, revolutionperminuteQuantity.Unit); - - var revolutionpersecondQuantity = radianpersecond.ToUnit(RotationalSpeedUnit.RevolutionPerSecond); - AssertEx.EqualTolerance(RevolutionsPerSecondInOneRadianPerSecond, (double)revolutionpersecondQuantity.Value, RevolutionsPerSecondTolerance); - Assert.Equal(RotationalSpeedUnit.RevolutionPerSecond, revolutionpersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - AssertEx.EqualTolerance(1, RotationalSpeed.FromCentiradiansPerSecond(radianpersecond.CentiradiansPerSecond).RadiansPerSecond, CentiradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromDeciradiansPerSecond(radianpersecond.DeciradiansPerSecond).RadiansPerSecond, DeciradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromDegreesPerMinute(radianpersecond.DegreesPerMinute).RadiansPerSecond, DegreesPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromDegreesPerSecond(radianpersecond.DegreesPerSecond).RadiansPerSecond, DegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMicrodegreesPerSecond(radianpersecond.MicrodegreesPerSecond).RadiansPerSecond, MicrodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMicroradiansPerSecond(radianpersecond.MicroradiansPerSecond).RadiansPerSecond, MicroradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMillidegreesPerSecond(radianpersecond.MillidegreesPerSecond).RadiansPerSecond, MillidegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromMilliradiansPerSecond(radianpersecond.MilliradiansPerSecond).RadiansPerSecond, MilliradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromNanodegreesPerSecond(radianpersecond.NanodegreesPerSecond).RadiansPerSecond, NanodegreesPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromNanoradiansPerSecond(radianpersecond.NanoradiansPerSecond).RadiansPerSecond, NanoradiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromRadiansPerSecond(radianpersecond.RadiansPerSecond).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromRevolutionsPerMinute(radianpersecond.RevolutionsPerMinute).RadiansPerSecond, RevolutionsPerMinuteTolerance); - AssertEx.EqualTolerance(1, RotationalSpeed.FromRevolutionsPerSecond(radianpersecond.RevolutionsPerSecond).RadiansPerSecond, RevolutionsPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - RotationalSpeed v = RotationalSpeed.FromRadiansPerSecond(1); - AssertEx.EqualTolerance(-1, -v.RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(2, (RotationalSpeed.FromRadiansPerSecond(3)-v).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(2, (RotationalSpeed.FromRadiansPerSecond(10)/5).RadiansPerSecond, RadiansPerSecondTolerance); - AssertEx.EqualTolerance(2, RotationalSpeed.FromRadiansPerSecond(10)/RotationalSpeed.FromRadiansPerSecond(5), RadiansPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - RotationalSpeed oneRadianPerSecond = RotationalSpeed.FromRadiansPerSecond(1); - RotationalSpeed twoRadiansPerSecond = RotationalSpeed.FromRadiansPerSecond(2); - - Assert.True(oneRadianPerSecond < twoRadiansPerSecond); - Assert.True(oneRadianPerSecond <= twoRadiansPerSecond); - Assert.True(twoRadiansPerSecond > oneRadianPerSecond); - Assert.True(twoRadiansPerSecond >= oneRadianPerSecond); - - Assert.False(oneRadianPerSecond > twoRadiansPerSecond); - Assert.False(oneRadianPerSecond >= twoRadiansPerSecond); - Assert.False(twoRadiansPerSecond < oneRadianPerSecond); - Assert.False(twoRadiansPerSecond <= oneRadianPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - Assert.Equal(0, radianpersecond.CompareTo(radianpersecond)); - Assert.True(radianpersecond.CompareTo(RotationalSpeed.Zero) > 0); - Assert.True(RotationalSpeed.Zero.CompareTo(radianpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - Assert.Throws(() => radianpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - Assert.Throws(() => radianpersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - RotationalSpeed v = RotationalSpeed.FromRadiansPerSecond(1); - Assert.True(v.Equals(RotationalSpeed.FromRadiansPerSecond(1), RadiansPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalSpeed.Zero, RadiansPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - Assert.False(radianpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - RotationalSpeed radianpersecond = RotationalSpeed.FromRadiansPerSecond(1); - Assert.False(radianpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(RotationalSpeedUnit.Undefined, RotationalSpeed.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(RotationalSpeedUnit)).Cast(); - foreach(var unit in units) - { - if(unit == RotationalSpeedUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs deleted file mode 100644 index 9ab73ea579..0000000000 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessPerLengthTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of RotationalStiffnessPerLength. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class RotationalStiffnessPerLengthTestsBase - { - protected abstract double KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter { get; } - protected abstract double MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter { get; } - protected abstract double NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilonewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } } - protected virtual double MeganewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } } - protected virtual double NewtonMetersPerRadianPerMeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalStiffnessPerLength((double)0.0, RotationalStiffnessPerLengthUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalStiffnessPerLength(double.PositiveInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); - Assert.Throws(() => new RotationalStiffnessPerLength(double.NegativeInfinity, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalStiffnessPerLength(double.NaN, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter)); - } - - [Fact] - public void NewtonMeterPerRadianPerMeterToRotationalStiffnessPerLengthUnits() - { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - AssertEx.EqualTolerance(KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.KilonewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.MeganewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter).KilonewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter).MeganewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.From(1, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - } - - [Fact] - public void FromNewtonMetersPerRadianPerMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.PositiveInfinity)); - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtonMetersPerRadianPerMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(double.NaN)); - } - - [Fact] - public void As() - { - var newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - AssertEx.EqualTolerance(KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter), KilonewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter), MeganewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, newtonmeterperradianpermeter.As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter), NewtonMetersPerRadianPerMeterTolerance); - } - - [Fact] - public void ToUnit() - { - var newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - - var kilonewtonmeterperradianpermeterQuantity = newtonmeterperradianpermeter.ToUnit(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); - AssertEx.EqualTolerance(KilonewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, (double)kilonewtonmeterperradianpermeterQuantity.Value, KilonewtonMetersPerRadianPerMeterTolerance); - Assert.Equal(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, kilonewtonmeterperradianpermeterQuantity.Unit); - - var meganewtonmeterperradianpermeterQuantity = newtonmeterperradianpermeter.ToUnit(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); - AssertEx.EqualTolerance(MeganewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, (double)meganewtonmeterperradianpermeterQuantity.Value, MeganewtonMetersPerRadianPerMeterTolerance); - Assert.Equal(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, meganewtonmeterperradianpermeterQuantity.Unit); - - var newtonmeterperradianpermeterQuantity = newtonmeterperradianpermeter.ToUnit(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); - AssertEx.EqualTolerance(NewtonMetersPerRadianPerMeterInOneNewtonMeterPerRadianPerMeter, (double)newtonmeterperradianpermeterQuantity.Value, NewtonMetersPerRadianPerMeterTolerance); - Assert.Equal(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, newtonmeterperradianpermeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.FromKilonewtonMetersPerRadianPerMeter(newtonmeterperradianpermeter.KilonewtonMetersPerRadianPerMeter).NewtonMetersPerRadianPerMeter, KilonewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.FromMeganewtonMetersPerRadianPerMeter(newtonmeterperradianpermeter.MeganewtonMetersPerRadianPerMeter).NewtonMetersPerRadianPerMeter, MeganewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(1, RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(newtonmeterperradianpermeter.NewtonMetersPerRadianPerMeter).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - RotationalStiffnessPerLength v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - AssertEx.EqualTolerance(-1, -v.NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(2, (RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(3)-v).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(2, (RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(10)/5).NewtonMetersPerRadianPerMeter, NewtonMetersPerRadianPerMeterTolerance); - AssertEx.EqualTolerance(2, RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(10)/RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(5), NewtonMetersPerRadianPerMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - RotationalStiffnessPerLength oneNewtonMeterPerRadianPerMeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - RotationalStiffnessPerLength twoNewtonMetersPerRadianPerMeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(2); - - Assert.True(oneNewtonMeterPerRadianPerMeter < twoNewtonMetersPerRadianPerMeter); - Assert.True(oneNewtonMeterPerRadianPerMeter <= twoNewtonMetersPerRadianPerMeter); - Assert.True(twoNewtonMetersPerRadianPerMeter > oneNewtonMeterPerRadianPerMeter); - Assert.True(twoNewtonMetersPerRadianPerMeter >= oneNewtonMeterPerRadianPerMeter); - - Assert.False(oneNewtonMeterPerRadianPerMeter > twoNewtonMetersPerRadianPerMeter); - Assert.False(oneNewtonMeterPerRadianPerMeter >= twoNewtonMetersPerRadianPerMeter); - Assert.False(twoNewtonMetersPerRadianPerMeter < oneNewtonMeterPerRadianPerMeter); - Assert.False(twoNewtonMetersPerRadianPerMeter <= oneNewtonMeterPerRadianPerMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.Equal(0, newtonmeterperradianpermeter.CompareTo(newtonmeterperradianpermeter)); - Assert.True(newtonmeterperradianpermeter.CompareTo(RotationalStiffnessPerLength.Zero) > 0); - Assert.True(RotationalStiffnessPerLength.Zero.CompareTo(newtonmeterperradianpermeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.Throws(() => newtonmeterperradianpermeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.Throws(() => newtonmeterperradianpermeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - RotationalStiffnessPerLength v = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.True(v.Equals(RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1), NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalStiffnessPerLength.Zero, NewtonMetersPerRadianPerMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.False(newtonmeterperradianpermeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - RotationalStiffnessPerLength newtonmeterperradianpermeter = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1); - Assert.False(newtonmeterperradianpermeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(RotationalStiffnessPerLengthUnit.Undefined, RotationalStiffnessPerLength.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast(); - foreach(var unit in units) - { - if(unit == RotationalStiffnessPerLengthUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs deleted file mode 100644 index 8813ed8ae6..0000000000 --- a/UnitsNet.Tests/GeneratedCode/RotationalStiffnessTestsBase.g.cs +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of RotationalStiffness. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class RotationalStiffnessTestsBase - { - protected abstract double KilonewtonMetersPerRadianInOneNewtonMeterPerRadian { get; } - protected abstract double MeganewtonMetersPerRadianInOneNewtonMeterPerRadian { get; } - protected abstract double NewtonMetersPerRadianInOneNewtonMeterPerRadian { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilonewtonMetersPerRadianTolerance { get { return 1e-5; } } - protected virtual double MeganewtonMetersPerRadianTolerance { get { return 1e-5; } } - protected virtual double NewtonMetersPerRadianTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalStiffness((double)0.0, RotationalStiffnessUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalStiffness(double.PositiveInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); - Assert.Throws(() => new RotationalStiffness(double.NegativeInfinity, RotationalStiffnessUnit.NewtonMeterPerRadian)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new RotationalStiffness(double.NaN, RotationalStiffnessUnit.NewtonMeterPerRadian)); - } - - [Fact] - public void NewtonMeterPerRadianToRotationalStiffnessUnits() - { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - AssertEx.EqualTolerance(KilonewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.KilonewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(MeganewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.MeganewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(NewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.KilonewtonMeterPerRadian).KilonewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.MeganewtonMeterPerRadian).MeganewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.From(1, RotationalStiffnessUnit.NewtonMeterPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - } - - [Fact] - public void FromNewtonMetersPerRadian_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.PositiveInfinity)); - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtonMetersPerRadian_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => RotationalStiffness.FromNewtonMetersPerRadian(double.NaN)); - } - - [Fact] - public void As() - { - var newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - AssertEx.EqualTolerance(KilonewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.As(RotationalStiffnessUnit.KilonewtonMeterPerRadian), KilonewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(MeganewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.As(RotationalStiffnessUnit.MeganewtonMeterPerRadian), MeganewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(NewtonMetersPerRadianInOneNewtonMeterPerRadian, newtonmeterperradian.As(RotationalStiffnessUnit.NewtonMeterPerRadian), NewtonMetersPerRadianTolerance); - } - - [Fact] - public void ToUnit() - { - var newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - - var kilonewtonmeterperradianQuantity = newtonmeterperradian.ToUnit(RotationalStiffnessUnit.KilonewtonMeterPerRadian); - AssertEx.EqualTolerance(KilonewtonMetersPerRadianInOneNewtonMeterPerRadian, (double)kilonewtonmeterperradianQuantity.Value, KilonewtonMetersPerRadianTolerance); - Assert.Equal(RotationalStiffnessUnit.KilonewtonMeterPerRadian, kilonewtonmeterperradianQuantity.Unit); - - var meganewtonmeterperradianQuantity = newtonmeterperradian.ToUnit(RotationalStiffnessUnit.MeganewtonMeterPerRadian); - AssertEx.EqualTolerance(MeganewtonMetersPerRadianInOneNewtonMeterPerRadian, (double)meganewtonmeterperradianQuantity.Value, MeganewtonMetersPerRadianTolerance); - Assert.Equal(RotationalStiffnessUnit.MeganewtonMeterPerRadian, meganewtonmeterperradianQuantity.Unit); - - var newtonmeterperradianQuantity = newtonmeterperradian.ToUnit(RotationalStiffnessUnit.NewtonMeterPerRadian); - AssertEx.EqualTolerance(NewtonMetersPerRadianInOneNewtonMeterPerRadian, (double)newtonmeterperradianQuantity.Value, NewtonMetersPerRadianTolerance); - Assert.Equal(RotationalStiffnessUnit.NewtonMeterPerRadian, newtonmeterperradianQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - AssertEx.EqualTolerance(1, RotationalStiffness.FromKilonewtonMetersPerRadian(newtonmeterperradian.KilonewtonMetersPerRadian).NewtonMetersPerRadian, KilonewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.FromMeganewtonMetersPerRadian(newtonmeterperradian.MeganewtonMetersPerRadian).NewtonMetersPerRadian, MeganewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(1, RotationalStiffness.FromNewtonMetersPerRadian(newtonmeterperradian.NewtonMetersPerRadian).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - RotationalStiffness v = RotationalStiffness.FromNewtonMetersPerRadian(1); - AssertEx.EqualTolerance(-1, -v.NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(2, (RotationalStiffness.FromNewtonMetersPerRadian(3)-v).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(2, (v + v).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(10, (v*10).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(10, (10*v).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(2, (RotationalStiffness.FromNewtonMetersPerRadian(10)/5).NewtonMetersPerRadian, NewtonMetersPerRadianTolerance); - AssertEx.EqualTolerance(2, RotationalStiffness.FromNewtonMetersPerRadian(10)/RotationalStiffness.FromNewtonMetersPerRadian(5), NewtonMetersPerRadianTolerance); - } - - [Fact] - public void ComparisonOperators() - { - RotationalStiffness oneNewtonMeterPerRadian = RotationalStiffness.FromNewtonMetersPerRadian(1); - RotationalStiffness twoNewtonMetersPerRadian = RotationalStiffness.FromNewtonMetersPerRadian(2); - - Assert.True(oneNewtonMeterPerRadian < twoNewtonMetersPerRadian); - Assert.True(oneNewtonMeterPerRadian <= twoNewtonMetersPerRadian); - Assert.True(twoNewtonMetersPerRadian > oneNewtonMeterPerRadian); - Assert.True(twoNewtonMetersPerRadian >= oneNewtonMeterPerRadian); - - Assert.False(oneNewtonMeterPerRadian > twoNewtonMetersPerRadian); - Assert.False(oneNewtonMeterPerRadian >= twoNewtonMetersPerRadian); - Assert.False(twoNewtonMetersPerRadian < oneNewtonMeterPerRadian); - Assert.False(twoNewtonMetersPerRadian <= oneNewtonMeterPerRadian); - } - - [Fact] - public void CompareToIsImplemented() - { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.Equal(0, newtonmeterperradian.CompareTo(newtonmeterperradian)); - Assert.True(newtonmeterperradian.CompareTo(RotationalStiffness.Zero) > 0); - Assert.True(RotationalStiffness.Zero.CompareTo(newtonmeterperradian) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.Throws(() => newtonmeterperradian.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.Throws(() => newtonmeterperradian.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - RotationalStiffness v = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.True(v.Equals(RotationalStiffness.FromNewtonMetersPerRadian(1), NewtonMetersPerRadianTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(RotationalStiffness.Zero, NewtonMetersPerRadianTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.False(newtonmeterperradian.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - RotationalStiffness newtonmeterperradian = RotationalStiffness.FromNewtonMetersPerRadian(1); - Assert.False(newtonmeterperradian.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(RotationalStiffnessUnit.Undefined, RotationalStiffness.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(RotationalStiffnessUnit)).Cast(); - foreach(var unit in units) - { - if(unit == RotationalStiffnessUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs deleted file mode 100644 index ffef4404df..0000000000 --- a/UnitsNet.Tests/GeneratedCode/SolidAngleTestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of SolidAngle. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class SolidAngleTestsBase - { - protected abstract double SteradiansInOneSteradian { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double SteradiansTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new SolidAngle((double)0.0, SolidAngleUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new SolidAngle(double.PositiveInfinity, SolidAngleUnit.Steradian)); - Assert.Throws(() => new SolidAngle(double.NegativeInfinity, SolidAngleUnit.Steradian)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new SolidAngle(double.NaN, SolidAngleUnit.Steradian)); - } - - [Fact] - public void SteradianToSolidAngleUnits() - { - SolidAngle steradian = SolidAngle.FromSteradians(1); - AssertEx.EqualTolerance(SteradiansInOneSteradian, steradian.Steradians, SteradiansTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, SolidAngle.From(1, SolidAngleUnit.Steradian).Steradians, SteradiansTolerance); - } - - [Fact] - public void FromSteradians_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => SolidAngle.FromSteradians(double.PositiveInfinity)); - Assert.Throws(() => SolidAngle.FromSteradians(double.NegativeInfinity)); - } - - [Fact] - public void FromSteradians_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => SolidAngle.FromSteradians(double.NaN)); - } - - [Fact] - public void As() - { - var steradian = SolidAngle.FromSteradians(1); - AssertEx.EqualTolerance(SteradiansInOneSteradian, steradian.As(SolidAngleUnit.Steradian), SteradiansTolerance); - } - - [Fact] - public void ToUnit() - { - var steradian = SolidAngle.FromSteradians(1); - - var steradianQuantity = steradian.ToUnit(SolidAngleUnit.Steradian); - AssertEx.EqualTolerance(SteradiansInOneSteradian, (double)steradianQuantity.Value, SteradiansTolerance); - Assert.Equal(SolidAngleUnit.Steradian, steradianQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - SolidAngle steradian = SolidAngle.FromSteradians(1); - AssertEx.EqualTolerance(1, SolidAngle.FromSteradians(steradian.Steradians).Steradians, SteradiansTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - SolidAngle v = SolidAngle.FromSteradians(1); - AssertEx.EqualTolerance(-1, -v.Steradians, SteradiansTolerance); - AssertEx.EqualTolerance(2, (SolidAngle.FromSteradians(3)-v).Steradians, SteradiansTolerance); - AssertEx.EqualTolerance(2, (v + v).Steradians, SteradiansTolerance); - AssertEx.EqualTolerance(10, (v*10).Steradians, SteradiansTolerance); - AssertEx.EqualTolerance(10, (10*v).Steradians, SteradiansTolerance); - AssertEx.EqualTolerance(2, (SolidAngle.FromSteradians(10)/5).Steradians, SteradiansTolerance); - AssertEx.EqualTolerance(2, SolidAngle.FromSteradians(10)/SolidAngle.FromSteradians(5), SteradiansTolerance); - } - - [Fact] - public void ComparisonOperators() - { - SolidAngle oneSteradian = SolidAngle.FromSteradians(1); - SolidAngle twoSteradians = SolidAngle.FromSteradians(2); - - Assert.True(oneSteradian < twoSteradians); - Assert.True(oneSteradian <= twoSteradians); - Assert.True(twoSteradians > oneSteradian); - Assert.True(twoSteradians >= oneSteradian); - - Assert.False(oneSteradian > twoSteradians); - Assert.False(oneSteradian >= twoSteradians); - Assert.False(twoSteradians < oneSteradian); - Assert.False(twoSteradians <= oneSteradian); - } - - [Fact] - public void CompareToIsImplemented() - { - SolidAngle steradian = SolidAngle.FromSteradians(1); - Assert.Equal(0, steradian.CompareTo(steradian)); - Assert.True(steradian.CompareTo(SolidAngle.Zero) > 0); - Assert.True(SolidAngle.Zero.CompareTo(steradian) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - SolidAngle steradian = SolidAngle.FromSteradians(1); - Assert.Throws(() => steradian.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - SolidAngle steradian = SolidAngle.FromSteradians(1); - Assert.Throws(() => steradian.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - SolidAngle v = SolidAngle.FromSteradians(1); - Assert.True(v.Equals(SolidAngle.FromSteradians(1), SteradiansTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SolidAngle.Zero, SteradiansTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - SolidAngle steradian = SolidAngle.FromSteradians(1); - Assert.False(steradian.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - SolidAngle steradian = SolidAngle.FromSteradians(1); - Assert.False(steradian.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(SolidAngleUnit.Undefined, SolidAngle.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(SolidAngleUnit)).Cast(); - foreach(var unit in units) - { - if(unit == SolidAngleUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs deleted file mode 100644 index 1335fdae20..0000000000 --- a/UnitsNet.Tests/GeneratedCode/SpecificEnergyTestsBase.g.cs +++ /dev/null @@ -1,294 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of SpecificEnergy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class SpecificEnergyTestsBase - { - protected abstract double CaloriesPerGramInOneJoulePerKilogram { get; } - protected abstract double JoulesPerKilogramInOneJoulePerKilogram { get; } - protected abstract double KilocaloriesPerGramInOneJoulePerKilogram { get; } - protected abstract double KilojoulesPerKilogramInOneJoulePerKilogram { get; } - protected abstract double KilowattHoursPerKilogramInOneJoulePerKilogram { get; } - protected abstract double MegajoulesPerKilogramInOneJoulePerKilogram { get; } - protected abstract double MegawattHoursPerKilogramInOneJoulePerKilogram { get; } - protected abstract double WattHoursPerKilogramInOneJoulePerKilogram { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CaloriesPerGramTolerance { get { return 1e-5; } } - protected virtual double JoulesPerKilogramTolerance { get { return 1e-5; } } - protected virtual double KilocaloriesPerGramTolerance { get { return 1e-5; } } - protected virtual double KilojoulesPerKilogramTolerance { get { return 1e-5; } } - protected virtual double KilowattHoursPerKilogramTolerance { get { return 1e-5; } } - protected virtual double MegajoulesPerKilogramTolerance { get { return 1e-5; } } - protected virtual double MegawattHoursPerKilogramTolerance { get { return 1e-5; } } - protected virtual double WattHoursPerKilogramTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificEnergy((double)0.0, SpecificEnergyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificEnergy(double.PositiveInfinity, SpecificEnergyUnit.JoulePerKilogram)); - Assert.Throws(() => new SpecificEnergy(double.NegativeInfinity, SpecificEnergyUnit.JoulePerKilogram)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificEnergy(double.NaN, SpecificEnergyUnit.JoulePerKilogram)); - } - - [Fact] - public void JoulePerKilogramToSpecificEnergyUnits() - { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - AssertEx.EqualTolerance(CaloriesPerGramInOneJoulePerKilogram, jouleperkilogram.CaloriesPerGram, CaloriesPerGramTolerance); - AssertEx.EqualTolerance(JoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(KilocaloriesPerGramInOneJoulePerKilogram, jouleperkilogram.KilocaloriesPerGram, KilocaloriesPerGramTolerance); - AssertEx.EqualTolerance(KilojoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.KilojoulesPerKilogram, KilojoulesPerKilogramTolerance); - AssertEx.EqualTolerance(KilowattHoursPerKilogramInOneJoulePerKilogram, jouleperkilogram.KilowattHoursPerKilogram, KilowattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(MegajoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.MegajoulesPerKilogram, MegajoulesPerKilogramTolerance); - AssertEx.EqualTolerance(MegawattHoursPerKilogramInOneJoulePerKilogram, jouleperkilogram.MegawattHoursPerKilogram, MegawattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(WattHoursPerKilogramInOneJoulePerKilogram, jouleperkilogram.WattHoursPerKilogram, WattHoursPerKilogramTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.CaloriePerGram).CaloriesPerGram, CaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.JoulePerKilogram).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilocaloriePerGram).KilocaloriesPerGram, KilocaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilojoulePerKilogram).KilojoulesPerKilogram, KilojoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.KilowattHourPerKilogram).KilowattHoursPerKilogram, KilowattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.MegajoulePerKilogram).MegajoulesPerKilogram, MegajoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.MegawattHourPerKilogram).MegawattHoursPerKilogram, MegawattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.From(1, SpecificEnergyUnit.WattHourPerKilogram).WattHoursPerKilogram, WattHoursPerKilogramTolerance); - } - - [Fact] - public void FromJoulesPerKilogram_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NegativeInfinity)); - } - - [Fact] - public void FromJoulesPerKilogram_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificEnergy.FromJoulesPerKilogram(double.NaN)); - } - - [Fact] - public void As() - { - var jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - AssertEx.EqualTolerance(CaloriesPerGramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.CaloriePerGram), CaloriesPerGramTolerance); - AssertEx.EqualTolerance(JoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.JoulePerKilogram), JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(KilocaloriesPerGramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.KilocaloriePerGram), KilocaloriesPerGramTolerance); - AssertEx.EqualTolerance(KilojoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.KilojoulePerKilogram), KilojoulesPerKilogramTolerance); - AssertEx.EqualTolerance(KilowattHoursPerKilogramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.KilowattHourPerKilogram), KilowattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(MegajoulesPerKilogramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.MegajoulePerKilogram), MegajoulesPerKilogramTolerance); - AssertEx.EqualTolerance(MegawattHoursPerKilogramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.MegawattHourPerKilogram), MegawattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(WattHoursPerKilogramInOneJoulePerKilogram, jouleperkilogram.As(SpecificEnergyUnit.WattHourPerKilogram), WattHoursPerKilogramTolerance); - } - - [Fact] - public void ToUnit() - { - var jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - - var caloriepergramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.CaloriePerGram); - AssertEx.EqualTolerance(CaloriesPerGramInOneJoulePerKilogram, (double)caloriepergramQuantity.Value, CaloriesPerGramTolerance); - Assert.Equal(SpecificEnergyUnit.CaloriePerGram, caloriepergramQuantity.Unit); - - var jouleperkilogramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.JoulePerKilogram); - AssertEx.EqualTolerance(JoulesPerKilogramInOneJoulePerKilogram, (double)jouleperkilogramQuantity.Value, JoulesPerKilogramTolerance); - Assert.Equal(SpecificEnergyUnit.JoulePerKilogram, jouleperkilogramQuantity.Unit); - - var kilocaloriepergramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.KilocaloriePerGram); - AssertEx.EqualTolerance(KilocaloriesPerGramInOneJoulePerKilogram, (double)kilocaloriepergramQuantity.Value, KilocaloriesPerGramTolerance); - Assert.Equal(SpecificEnergyUnit.KilocaloriePerGram, kilocaloriepergramQuantity.Unit); - - var kilojouleperkilogramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.KilojoulePerKilogram); - AssertEx.EqualTolerance(KilojoulesPerKilogramInOneJoulePerKilogram, (double)kilojouleperkilogramQuantity.Value, KilojoulesPerKilogramTolerance); - Assert.Equal(SpecificEnergyUnit.KilojoulePerKilogram, kilojouleperkilogramQuantity.Unit); - - var kilowatthourperkilogramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.KilowattHourPerKilogram); - AssertEx.EqualTolerance(KilowattHoursPerKilogramInOneJoulePerKilogram, (double)kilowatthourperkilogramQuantity.Value, KilowattHoursPerKilogramTolerance); - Assert.Equal(SpecificEnergyUnit.KilowattHourPerKilogram, kilowatthourperkilogramQuantity.Unit); - - var megajouleperkilogramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.MegajoulePerKilogram); - AssertEx.EqualTolerance(MegajoulesPerKilogramInOneJoulePerKilogram, (double)megajouleperkilogramQuantity.Value, MegajoulesPerKilogramTolerance); - Assert.Equal(SpecificEnergyUnit.MegajoulePerKilogram, megajouleperkilogramQuantity.Unit); - - var megawatthourperkilogramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.MegawattHourPerKilogram); - AssertEx.EqualTolerance(MegawattHoursPerKilogramInOneJoulePerKilogram, (double)megawatthourperkilogramQuantity.Value, MegawattHoursPerKilogramTolerance); - Assert.Equal(SpecificEnergyUnit.MegawattHourPerKilogram, megawatthourperkilogramQuantity.Unit); - - var watthourperkilogramQuantity = jouleperkilogram.ToUnit(SpecificEnergyUnit.WattHourPerKilogram); - AssertEx.EqualTolerance(WattHoursPerKilogramInOneJoulePerKilogram, (double)watthourperkilogramQuantity.Value, WattHoursPerKilogramTolerance); - Assert.Equal(SpecificEnergyUnit.WattHourPerKilogram, watthourperkilogramQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - AssertEx.EqualTolerance(1, SpecificEnergy.FromCaloriesPerGram(jouleperkilogram.CaloriesPerGram).JoulesPerKilogram, CaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromJoulesPerKilogram(jouleperkilogram.JoulesPerKilogram).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromKilocaloriesPerGram(jouleperkilogram.KilocaloriesPerGram).JoulesPerKilogram, KilocaloriesPerGramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromKilojoulesPerKilogram(jouleperkilogram.KilojoulesPerKilogram).JoulesPerKilogram, KilojoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromKilowattHoursPerKilogram(jouleperkilogram.KilowattHoursPerKilogram).JoulesPerKilogram, KilowattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromMegajoulesPerKilogram(jouleperkilogram.MegajoulesPerKilogram).JoulesPerKilogram, MegajoulesPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromMegawattHoursPerKilogram(jouleperkilogram.MegawattHoursPerKilogram).JoulesPerKilogram, MegawattHoursPerKilogramTolerance); - AssertEx.EqualTolerance(1, SpecificEnergy.FromWattHoursPerKilogram(jouleperkilogram.WattHoursPerKilogram).JoulesPerKilogram, WattHoursPerKilogramTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - SpecificEnergy v = SpecificEnergy.FromJoulesPerKilogram(1); - AssertEx.EqualTolerance(-1, -v.JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificEnergy.FromJoulesPerKilogram(3)-v).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(2, (v + v).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(10, (v*10).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(10, (10*v).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificEnergy.FromJoulesPerKilogram(10)/5).JoulesPerKilogram, JoulesPerKilogramTolerance); - AssertEx.EqualTolerance(2, SpecificEnergy.FromJoulesPerKilogram(10)/SpecificEnergy.FromJoulesPerKilogram(5), JoulesPerKilogramTolerance); - } - - [Fact] - public void ComparisonOperators() - { - SpecificEnergy oneJoulePerKilogram = SpecificEnergy.FromJoulesPerKilogram(1); - SpecificEnergy twoJoulesPerKilogram = SpecificEnergy.FromJoulesPerKilogram(2); - - Assert.True(oneJoulePerKilogram < twoJoulesPerKilogram); - Assert.True(oneJoulePerKilogram <= twoJoulesPerKilogram); - Assert.True(twoJoulesPerKilogram > oneJoulePerKilogram); - Assert.True(twoJoulesPerKilogram >= oneJoulePerKilogram); - - Assert.False(oneJoulePerKilogram > twoJoulesPerKilogram); - Assert.False(oneJoulePerKilogram >= twoJoulesPerKilogram); - Assert.False(twoJoulesPerKilogram < oneJoulePerKilogram); - Assert.False(twoJoulesPerKilogram <= oneJoulePerKilogram); - } - - [Fact] - public void CompareToIsImplemented() - { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.Equal(0, jouleperkilogram.CompareTo(jouleperkilogram)); - Assert.True(jouleperkilogram.CompareTo(SpecificEnergy.Zero) > 0); - Assert.True(SpecificEnergy.Zero.CompareTo(jouleperkilogram) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.Throws(() => jouleperkilogram.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.Throws(() => jouleperkilogram.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - SpecificEnergy v = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.True(v.Equals(SpecificEnergy.FromJoulesPerKilogram(1), JoulesPerKilogramTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificEnergy.Zero, JoulesPerKilogramTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.False(jouleperkilogram.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - SpecificEnergy jouleperkilogram = SpecificEnergy.FromJoulesPerKilogram(1); - Assert.False(jouleperkilogram.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(SpecificEnergyUnit.Undefined, SpecificEnergy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(SpecificEnergyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == SpecificEnergyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs deleted file mode 100644 index 7e26f65596..0000000000 --- a/UnitsNet.Tests/GeneratedCode/SpecificEntropyTestsBase.g.cs +++ /dev/null @@ -1,294 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of SpecificEntropy. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class SpecificEntropyTestsBase - { - protected abstract double CaloriesPerGramKelvinInOneJoulePerKilogramKelvin { get; } - protected abstract double JoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin { get; } - protected abstract double JoulesPerKilogramKelvinInOneJoulePerKilogramKelvin { get; } - protected abstract double KilocaloriesPerGramKelvinInOneJoulePerKilogramKelvin { get; } - protected abstract double KilojoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin { get; } - protected abstract double KilojoulesPerKilogramKelvinInOneJoulePerKilogramKelvin { get; } - protected abstract double MegajoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin { get; } - protected abstract double MegajoulesPerKilogramKelvinInOneJoulePerKilogramKelvin { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CaloriesPerGramKelvinTolerance { get { return 1e-5; } } - protected virtual double JoulesPerKilogramDegreeCelsiusTolerance { get { return 1e-5; } } - protected virtual double JoulesPerKilogramKelvinTolerance { get { return 1e-5; } } - protected virtual double KilocaloriesPerGramKelvinTolerance { get { return 1e-5; } } - protected virtual double KilojoulesPerKilogramDegreeCelsiusTolerance { get { return 1e-5; } } - protected virtual double KilojoulesPerKilogramKelvinTolerance { get { return 1e-5; } } - protected virtual double MegajoulesPerKilogramDegreeCelsiusTolerance { get { return 1e-5; } } - protected virtual double MegajoulesPerKilogramKelvinTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificEntropy((double)0.0, SpecificEntropyUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificEntropy(double.PositiveInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); - Assert.Throws(() => new SpecificEntropy(double.NegativeInfinity, SpecificEntropyUnit.JoulePerKilogramKelvin)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificEntropy(double.NaN, SpecificEntropyUnit.JoulePerKilogramKelvin)); - } - - [Fact] - public void JoulePerKilogramKelvinToSpecificEntropyUnits() - { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - AssertEx.EqualTolerance(CaloriesPerGramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.CaloriesPerGramKelvin, CaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(JoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.JoulesPerKilogramDegreeCelsius, JoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(JoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(KilocaloriesPerGramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.KilocaloriesPerGramKelvin, KilocaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(KilojoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.KilojoulesPerKilogramDegreeCelsius, KilojoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(KilojoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.KilojoulesPerKilogramKelvin, KilojoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(MegajoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.MegajoulesPerKilogramDegreeCelsius, MegajoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(MegajoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.MegajoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.CaloriePerGramKelvin).CaloriesPerGramKelvin, CaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius).JoulesPerKilogramDegreeCelsius, JoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.JoulePerKilogramKelvin).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilocaloriePerGramKelvin).KilocaloriesPerGramKelvin, KilocaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius).KilojoulesPerKilogramDegreeCelsius, KilojoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.KilojoulePerKilogramKelvin).KilojoulesPerKilogramKelvin, KilojoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius).MegajoulesPerKilogramDegreeCelsius, MegajoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.From(1, SpecificEntropyUnit.MegajoulePerKilogramKelvin).MegajoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); - } - - [Fact] - public void FromJoulesPerKilogramKelvin_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.PositiveInfinity)); - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NegativeInfinity)); - } - - [Fact] - public void FromJoulesPerKilogramKelvin_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificEntropy.FromJoulesPerKilogramKelvin(double.NaN)); - } - - [Fact] - public void As() - { - var jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - AssertEx.EqualTolerance(CaloriesPerGramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.CaloriePerGramKelvin), CaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(JoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius), JoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(JoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.JoulePerKilogramKelvin), JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(KilocaloriesPerGramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.KilocaloriePerGramKelvin), KilocaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(KilojoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius), KilojoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(KilojoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.KilojoulePerKilogramKelvin), KilojoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(MegajoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius), MegajoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(MegajoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, jouleperkilogramkelvin.As(SpecificEntropyUnit.MegajoulePerKilogramKelvin), MegajoulesPerKilogramKelvinTolerance); - } - - [Fact] - public void ToUnit() - { - var jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - - var caloriepergramkelvinQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.CaloriePerGramKelvin); - AssertEx.EqualTolerance(CaloriesPerGramKelvinInOneJoulePerKilogramKelvin, (double)caloriepergramkelvinQuantity.Value, CaloriesPerGramKelvinTolerance); - Assert.Equal(SpecificEntropyUnit.CaloriePerGramKelvin, caloriepergramkelvinQuantity.Unit); - - var jouleperkilogramdegreecelsiusQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); - AssertEx.EqualTolerance(JoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, (double)jouleperkilogramdegreecelsiusQuantity.Value, JoulesPerKilogramDegreeCelsiusTolerance); - Assert.Equal(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, jouleperkilogramdegreecelsiusQuantity.Unit); - - var jouleperkilogramkelvinQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.JoulePerKilogramKelvin); - AssertEx.EqualTolerance(JoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, (double)jouleperkilogramkelvinQuantity.Value, JoulesPerKilogramKelvinTolerance); - Assert.Equal(SpecificEntropyUnit.JoulePerKilogramKelvin, jouleperkilogramkelvinQuantity.Unit); - - var kilocaloriepergramkelvinQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.KilocaloriePerGramKelvin); - AssertEx.EqualTolerance(KilocaloriesPerGramKelvinInOneJoulePerKilogramKelvin, (double)kilocaloriepergramkelvinQuantity.Value, KilocaloriesPerGramKelvinTolerance); - Assert.Equal(SpecificEntropyUnit.KilocaloriePerGramKelvin, kilocaloriepergramkelvinQuantity.Unit); - - var kilojouleperkilogramdegreecelsiusQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); - AssertEx.EqualTolerance(KilojoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, (double)kilojouleperkilogramdegreecelsiusQuantity.Value, KilojoulesPerKilogramDegreeCelsiusTolerance); - Assert.Equal(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, kilojouleperkilogramdegreecelsiusQuantity.Unit); - - var kilojouleperkilogramkelvinQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.KilojoulePerKilogramKelvin); - AssertEx.EqualTolerance(KilojoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, (double)kilojouleperkilogramkelvinQuantity.Value, KilojoulesPerKilogramKelvinTolerance); - Assert.Equal(SpecificEntropyUnit.KilojoulePerKilogramKelvin, kilojouleperkilogramkelvinQuantity.Unit); - - var megajouleperkilogramdegreecelsiusQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); - AssertEx.EqualTolerance(MegajoulesPerKilogramDegreeCelsiusInOneJoulePerKilogramKelvin, (double)megajouleperkilogramdegreecelsiusQuantity.Value, MegajoulesPerKilogramDegreeCelsiusTolerance); - Assert.Equal(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, megajouleperkilogramdegreecelsiusQuantity.Unit); - - var megajouleperkilogramkelvinQuantity = jouleperkilogramkelvin.ToUnit(SpecificEntropyUnit.MegajoulePerKilogramKelvin); - AssertEx.EqualTolerance(MegajoulesPerKilogramKelvinInOneJoulePerKilogramKelvin, (double)megajouleperkilogramkelvinQuantity.Value, MegajoulesPerKilogramKelvinTolerance); - Assert.Equal(SpecificEntropyUnit.MegajoulePerKilogramKelvin, megajouleperkilogramkelvinQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - AssertEx.EqualTolerance(1, SpecificEntropy.FromCaloriesPerGramKelvin(jouleperkilogramkelvin.CaloriesPerGramKelvin).JoulesPerKilogramKelvin, CaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromJoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.JoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, JoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromJoulesPerKilogramKelvin(jouleperkilogramkelvin.JoulesPerKilogramKelvin).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromKilocaloriesPerGramKelvin(jouleperkilogramkelvin.KilocaloriesPerGramKelvin).JoulesPerKilogramKelvin, KilocaloriesPerGramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromKilojoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.KilojoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, KilojoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromKilojoulesPerKilogramKelvin(jouleperkilogramkelvin.KilojoulesPerKilogramKelvin).JoulesPerKilogramKelvin, KilojoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromMegajoulesPerKilogramDegreeCelsius(jouleperkilogramkelvin.MegajoulesPerKilogramDegreeCelsius).JoulesPerKilogramKelvin, MegajoulesPerKilogramDegreeCelsiusTolerance); - AssertEx.EqualTolerance(1, SpecificEntropy.FromMegajoulesPerKilogramKelvin(jouleperkilogramkelvin.MegajoulesPerKilogramKelvin).JoulesPerKilogramKelvin, MegajoulesPerKilogramKelvinTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - SpecificEntropy v = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - AssertEx.EqualTolerance(-1, -v.JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(2, (SpecificEntropy.FromJoulesPerKilogramKelvin(3)-v).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(2, (v + v).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(10, (v*10).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(10, (10*v).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(2, (SpecificEntropy.FromJoulesPerKilogramKelvin(10)/5).JoulesPerKilogramKelvin, JoulesPerKilogramKelvinTolerance); - AssertEx.EqualTolerance(2, SpecificEntropy.FromJoulesPerKilogramKelvin(10)/SpecificEntropy.FromJoulesPerKilogramKelvin(5), JoulesPerKilogramKelvinTolerance); - } - - [Fact] - public void ComparisonOperators() - { - SpecificEntropy oneJoulePerKilogramKelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - SpecificEntropy twoJoulesPerKilogramKelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(2); - - Assert.True(oneJoulePerKilogramKelvin < twoJoulesPerKilogramKelvin); - Assert.True(oneJoulePerKilogramKelvin <= twoJoulesPerKilogramKelvin); - Assert.True(twoJoulesPerKilogramKelvin > oneJoulePerKilogramKelvin); - Assert.True(twoJoulesPerKilogramKelvin >= oneJoulePerKilogramKelvin); - - Assert.False(oneJoulePerKilogramKelvin > twoJoulesPerKilogramKelvin); - Assert.False(oneJoulePerKilogramKelvin >= twoJoulesPerKilogramKelvin); - Assert.False(twoJoulesPerKilogramKelvin < oneJoulePerKilogramKelvin); - Assert.False(twoJoulesPerKilogramKelvin <= oneJoulePerKilogramKelvin); - } - - [Fact] - public void CompareToIsImplemented() - { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.Equal(0, jouleperkilogramkelvin.CompareTo(jouleperkilogramkelvin)); - Assert.True(jouleperkilogramkelvin.CompareTo(SpecificEntropy.Zero) > 0); - Assert.True(SpecificEntropy.Zero.CompareTo(jouleperkilogramkelvin) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.Throws(() => jouleperkilogramkelvin.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.Throws(() => jouleperkilogramkelvin.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - SpecificEntropy v = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.True(v.Equals(SpecificEntropy.FromJoulesPerKilogramKelvin(1), JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificEntropy.Zero, JoulesPerKilogramKelvinTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.False(jouleperkilogramkelvin.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - SpecificEntropy jouleperkilogramkelvin = SpecificEntropy.FromJoulesPerKilogramKelvin(1); - Assert.False(jouleperkilogramkelvin.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(SpecificEntropyUnit.Undefined, SpecificEntropy.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(SpecificEntropyUnit)).Cast(); - foreach(var unit in units) - { - if(unit == SpecificEntropyUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs deleted file mode 100644 index dd4e38f4fe..0000000000 --- a/UnitsNet.Tests/GeneratedCode/SpecificVolumeTestsBase.g.cs +++ /dev/null @@ -1,234 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of SpecificVolume. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class SpecificVolumeTestsBase - { - protected abstract double CubicFeetPerPoundInOneCubicMeterPerKilogram { get; } - protected abstract double CubicMetersPerKilogramInOneCubicMeterPerKilogram { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CubicFeetPerPoundTolerance { get { return 1e-5; } } - protected virtual double CubicMetersPerKilogramTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificVolume((double)0.0, SpecificVolumeUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificVolume(double.PositiveInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); - Assert.Throws(() => new SpecificVolume(double.NegativeInfinity, SpecificVolumeUnit.CubicMeterPerKilogram)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificVolume(double.NaN, SpecificVolumeUnit.CubicMeterPerKilogram)); - } - - [Fact] - public void CubicMeterPerKilogramToSpecificVolumeUnits() - { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - AssertEx.EqualTolerance(CubicFeetPerPoundInOneCubicMeterPerKilogram, cubicmeterperkilogram.CubicFeetPerPound, CubicFeetPerPoundTolerance); - AssertEx.EqualTolerance(CubicMetersPerKilogramInOneCubicMeterPerKilogram, cubicmeterperkilogram.CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicFootPerPound).CubicFeetPerPound, CubicFeetPerPoundTolerance); - AssertEx.EqualTolerance(1, SpecificVolume.From(1, SpecificVolumeUnit.CubicMeterPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - } - - [Fact] - public void FromCubicMetersPerKilogram_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.PositiveInfinity)); - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NegativeInfinity)); - } - - [Fact] - public void FromCubicMetersPerKilogram_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificVolume.FromCubicMetersPerKilogram(double.NaN)); - } - - [Fact] - public void As() - { - var cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - AssertEx.EqualTolerance(CubicFeetPerPoundInOneCubicMeterPerKilogram, cubicmeterperkilogram.As(SpecificVolumeUnit.CubicFootPerPound), CubicFeetPerPoundTolerance); - AssertEx.EqualTolerance(CubicMetersPerKilogramInOneCubicMeterPerKilogram, cubicmeterperkilogram.As(SpecificVolumeUnit.CubicMeterPerKilogram), CubicMetersPerKilogramTolerance); - } - - [Fact] - public void ToUnit() - { - var cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - - var cubicfootperpoundQuantity = cubicmeterperkilogram.ToUnit(SpecificVolumeUnit.CubicFootPerPound); - AssertEx.EqualTolerance(CubicFeetPerPoundInOneCubicMeterPerKilogram, (double)cubicfootperpoundQuantity.Value, CubicFeetPerPoundTolerance); - Assert.Equal(SpecificVolumeUnit.CubicFootPerPound, cubicfootperpoundQuantity.Unit); - - var cubicmeterperkilogramQuantity = cubicmeterperkilogram.ToUnit(SpecificVolumeUnit.CubicMeterPerKilogram); - AssertEx.EqualTolerance(CubicMetersPerKilogramInOneCubicMeterPerKilogram, (double)cubicmeterperkilogramQuantity.Value, CubicMetersPerKilogramTolerance); - Assert.Equal(SpecificVolumeUnit.CubicMeterPerKilogram, cubicmeterperkilogramQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - AssertEx.EqualTolerance(1, SpecificVolume.FromCubicFeetPerPound(cubicmeterperkilogram.CubicFeetPerPound).CubicMetersPerKilogram, CubicFeetPerPoundTolerance); - AssertEx.EqualTolerance(1, SpecificVolume.FromCubicMetersPerKilogram(cubicmeterperkilogram.CubicMetersPerKilogram).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - SpecificVolume v = SpecificVolume.FromCubicMetersPerKilogram(1); - AssertEx.EqualTolerance(-1, -v.CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificVolume.FromCubicMetersPerKilogram(3)-v).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(2, (v + v).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(10, (v*10).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(10, (10*v).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(2, (SpecificVolume.FromCubicMetersPerKilogram(10)/5).CubicMetersPerKilogram, CubicMetersPerKilogramTolerance); - AssertEx.EqualTolerance(2, SpecificVolume.FromCubicMetersPerKilogram(10)/SpecificVolume.FromCubicMetersPerKilogram(5), CubicMetersPerKilogramTolerance); - } - - [Fact] - public void ComparisonOperators() - { - SpecificVolume oneCubicMeterPerKilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - SpecificVolume twoCubicMetersPerKilogram = SpecificVolume.FromCubicMetersPerKilogram(2); - - Assert.True(oneCubicMeterPerKilogram < twoCubicMetersPerKilogram); - Assert.True(oneCubicMeterPerKilogram <= twoCubicMetersPerKilogram); - Assert.True(twoCubicMetersPerKilogram > oneCubicMeterPerKilogram); - Assert.True(twoCubicMetersPerKilogram >= oneCubicMeterPerKilogram); - - Assert.False(oneCubicMeterPerKilogram > twoCubicMetersPerKilogram); - Assert.False(oneCubicMeterPerKilogram >= twoCubicMetersPerKilogram); - Assert.False(twoCubicMetersPerKilogram < oneCubicMeterPerKilogram); - Assert.False(twoCubicMetersPerKilogram <= oneCubicMeterPerKilogram); - } - - [Fact] - public void CompareToIsImplemented() - { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.Equal(0, cubicmeterperkilogram.CompareTo(cubicmeterperkilogram)); - Assert.True(cubicmeterperkilogram.CompareTo(SpecificVolume.Zero) > 0); - Assert.True(SpecificVolume.Zero.CompareTo(cubicmeterperkilogram) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.Throws(() => cubicmeterperkilogram.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.Throws(() => cubicmeterperkilogram.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - SpecificVolume v = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.True(v.Equals(SpecificVolume.FromCubicMetersPerKilogram(1), CubicMetersPerKilogramTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificVolume.Zero, CubicMetersPerKilogramTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.False(cubicmeterperkilogram.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - SpecificVolume cubicmeterperkilogram = SpecificVolume.FromCubicMetersPerKilogram(1); - Assert.False(cubicmeterperkilogram.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(SpecificVolumeUnit.Undefined, SpecificVolume.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(SpecificVolumeUnit)).Cast(); - foreach(var unit in units) - { - if(unit == SpecificVolumeUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs deleted file mode 100644 index c2191684bf..0000000000 --- a/UnitsNet.Tests/GeneratedCode/SpecificWeightTestsBase.g.cs +++ /dev/null @@ -1,384 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of SpecificWeight. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class SpecificWeightTestsBase - { - protected abstract double KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter { get; } - protected abstract double KilogramsForcePerCubicMeterInOneNewtonPerCubicMeter { get; } - protected abstract double KilogramsForcePerCubicMillimeterInOneNewtonPerCubicMeter { get; } - protected abstract double KilonewtonsPerCubicCentimeterInOneNewtonPerCubicMeter { get; } - protected abstract double KilonewtonsPerCubicMeterInOneNewtonPerCubicMeter { get; } - protected abstract double KilonewtonsPerCubicMillimeterInOneNewtonPerCubicMeter { get; } - protected abstract double KilopoundsForcePerCubicFootInOneNewtonPerCubicMeter { get; } - protected abstract double KilopoundsForcePerCubicInchInOneNewtonPerCubicMeter { get; } - protected abstract double MeganewtonsPerCubicMeterInOneNewtonPerCubicMeter { get; } - protected abstract double NewtonsPerCubicCentimeterInOneNewtonPerCubicMeter { get; } - protected abstract double NewtonsPerCubicMeterInOneNewtonPerCubicMeter { get; } - protected abstract double NewtonsPerCubicMillimeterInOneNewtonPerCubicMeter { get; } - protected abstract double PoundsForcePerCubicFootInOneNewtonPerCubicMeter { get; } - protected abstract double PoundsForcePerCubicInchInOneNewtonPerCubicMeter { get; } - protected abstract double TonnesForcePerCubicCentimeterInOneNewtonPerCubicMeter { get; } - protected abstract double TonnesForcePerCubicMeterInOneNewtonPerCubicMeter { get; } - protected abstract double TonnesForcePerCubicMillimeterInOneNewtonPerCubicMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilogramsForcePerCubicCentimeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsForcePerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double KilogramsForcePerCubicMillimeterTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerCubicCentimeterTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double KilonewtonsPerCubicMillimeterTolerance { get { return 1e-5; } } - protected virtual double KilopoundsForcePerCubicFootTolerance { get { return 1e-5; } } - protected virtual double KilopoundsForcePerCubicInchTolerance { get { return 1e-5; } } - protected virtual double MeganewtonsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerCubicCentimeterTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double NewtonsPerCubicMillimeterTolerance { get { return 1e-5; } } - protected virtual double PoundsForcePerCubicFootTolerance { get { return 1e-5; } } - protected virtual double PoundsForcePerCubicInchTolerance { get { return 1e-5; } } - protected virtual double TonnesForcePerCubicCentimeterTolerance { get { return 1e-5; } } - protected virtual double TonnesForcePerCubicMeterTolerance { get { return 1e-5; } } - protected virtual double TonnesForcePerCubicMillimeterTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificWeight((double)0.0, SpecificWeightUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificWeight(double.PositiveInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); - Assert.Throws(() => new SpecificWeight(double.NegativeInfinity, SpecificWeightUnit.NewtonPerCubicMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new SpecificWeight(double.NaN, SpecificWeightUnit.NewtonPerCubicMeter)); - } - - [Fact] - public void NewtonPerCubicMeterToSpecificWeightUnits() - { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - AssertEx.EqualTolerance(KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilogramsForcePerCubicCentimeter, KilogramsForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilogramsForcePerCubicMeter, KilogramsForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilogramsForcePerCubicMillimeter, KilogramsForcePerCubicMillimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilonewtonsPerCubicCentimeter, KilonewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilonewtonsPerCubicMeter, KilonewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.KilonewtonsPerCubicMillimeter, KilonewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerCubicFootInOneNewtonPerCubicMeter, newtonpercubicmeter.KilopoundsForcePerCubicFoot, KilopoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerCubicInchInOneNewtonPerCubicMeter, newtonpercubicmeter.KilopoundsForcePerCubicInch, KilopoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(MeganewtonsPerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.MeganewtonsPerCubicMeter, MeganewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.NewtonsPerCubicCentimeter, NewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(NewtonsPerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.NewtonsPerCubicMillimeter, NewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(PoundsForcePerCubicFootInOneNewtonPerCubicMeter, newtonpercubicmeter.PoundsForcePerCubicFoot, PoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(PoundsForcePerCubicInchInOneNewtonPerCubicMeter, newtonpercubicmeter.PoundsForcePerCubicInch, PoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(TonnesForcePerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.TonnesForcePerCubicCentimeter, TonnesForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.TonnesForcePerCubicMeter, TonnesForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.TonnesForcePerCubicMillimeter, TonnesForcePerCubicMillimeterTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicCentimeter).KilogramsForcePerCubicCentimeter, KilogramsForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicMeter).KilogramsForcePerCubicMeter, KilogramsForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilogramForcePerCubicMillimeter).KilogramsForcePerCubicMillimeter, KilogramsForcePerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicCentimeter).KilonewtonsPerCubicCentimeter, KilonewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicMeter).KilonewtonsPerCubicMeter, KilonewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilonewtonPerCubicMillimeter).KilonewtonsPerCubicMillimeter, KilonewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilopoundForcePerCubicFoot).KilopoundsForcePerCubicFoot, KilopoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.KilopoundForcePerCubicInch).KilopoundsForcePerCubicInch, KilopoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.MeganewtonPerCubicMeter).MeganewtonsPerCubicMeter, MeganewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicCentimeter).NewtonsPerCubicCentimeter, NewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicMeter).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.NewtonPerCubicMillimeter).NewtonsPerCubicMillimeter, NewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.PoundForcePerCubicFoot).PoundsForcePerCubicFoot, PoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.PoundForcePerCubicInch).PoundsForcePerCubicInch, PoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicCentimeter).TonnesForcePerCubicCentimeter, TonnesForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMeter).TonnesForcePerCubicMeter, TonnesForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.From(1, SpecificWeightUnit.TonneForcePerCubicMillimeter).TonnesForcePerCubicMillimeter, TonnesForcePerCubicMillimeterTolerance); - } - - [Fact] - public void FromNewtonsPerCubicMeter_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.PositiveInfinity)); - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtonsPerCubicMeter_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => SpecificWeight.FromNewtonsPerCubicMeter(double.NaN)); - } - - [Fact] - public void As() - { - var newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - AssertEx.EqualTolerance(KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilogramForcePerCubicCentimeter), KilogramsForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilogramForcePerCubicMeter), KilogramsForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(KilogramsForcePerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilogramForcePerCubicMillimeter), KilogramsForcePerCubicMillimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilonewtonPerCubicCentimeter), KilonewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilonewtonPerCubicMeter), KilonewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(KilonewtonsPerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilonewtonPerCubicMillimeter), KilonewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerCubicFootInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilopoundForcePerCubicFoot), KilopoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(KilopoundsForcePerCubicInchInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.KilopoundForcePerCubicInch), KilopoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(MeganewtonsPerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.MeganewtonPerCubicMeter), MeganewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.NewtonPerCubicCentimeter), NewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(NewtonsPerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.NewtonPerCubicMeter), NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(NewtonsPerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.NewtonPerCubicMillimeter), NewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(PoundsForcePerCubicFootInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.PoundForcePerCubicFoot), PoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(PoundsForcePerCubicInchInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.PoundForcePerCubicInch), PoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(TonnesForcePerCubicCentimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.TonneForcePerCubicCentimeter), TonnesForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerCubicMeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.TonneForcePerCubicMeter), TonnesForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(TonnesForcePerCubicMillimeterInOneNewtonPerCubicMeter, newtonpercubicmeter.As(SpecificWeightUnit.TonneForcePerCubicMillimeter), TonnesForcePerCubicMillimeterTolerance); - } - - [Fact] - public void ToUnit() - { - var newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - - var kilogramforcepercubiccentimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilogramForcePerCubicCentimeter); - AssertEx.EqualTolerance(KilogramsForcePerCubicCentimeterInOneNewtonPerCubicMeter, (double)kilogramforcepercubiccentimeterQuantity.Value, KilogramsForcePerCubicCentimeterTolerance); - Assert.Equal(SpecificWeightUnit.KilogramForcePerCubicCentimeter, kilogramforcepercubiccentimeterQuantity.Unit); - - var kilogramforcepercubicmeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilogramForcePerCubicMeter); - AssertEx.EqualTolerance(KilogramsForcePerCubicMeterInOneNewtonPerCubicMeter, (double)kilogramforcepercubicmeterQuantity.Value, KilogramsForcePerCubicMeterTolerance); - Assert.Equal(SpecificWeightUnit.KilogramForcePerCubicMeter, kilogramforcepercubicmeterQuantity.Unit); - - var kilogramforcepercubicmillimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilogramForcePerCubicMillimeter); - AssertEx.EqualTolerance(KilogramsForcePerCubicMillimeterInOneNewtonPerCubicMeter, (double)kilogramforcepercubicmillimeterQuantity.Value, KilogramsForcePerCubicMillimeterTolerance); - Assert.Equal(SpecificWeightUnit.KilogramForcePerCubicMillimeter, kilogramforcepercubicmillimeterQuantity.Unit); - - var kilonewtonpercubiccentimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilonewtonPerCubicCentimeter); - AssertEx.EqualTolerance(KilonewtonsPerCubicCentimeterInOneNewtonPerCubicMeter, (double)kilonewtonpercubiccentimeterQuantity.Value, KilonewtonsPerCubicCentimeterTolerance); - Assert.Equal(SpecificWeightUnit.KilonewtonPerCubicCentimeter, kilonewtonpercubiccentimeterQuantity.Unit); - - var kilonewtonpercubicmeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilonewtonPerCubicMeter); - AssertEx.EqualTolerance(KilonewtonsPerCubicMeterInOneNewtonPerCubicMeter, (double)kilonewtonpercubicmeterQuantity.Value, KilonewtonsPerCubicMeterTolerance); - Assert.Equal(SpecificWeightUnit.KilonewtonPerCubicMeter, kilonewtonpercubicmeterQuantity.Unit); - - var kilonewtonpercubicmillimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilonewtonPerCubicMillimeter); - AssertEx.EqualTolerance(KilonewtonsPerCubicMillimeterInOneNewtonPerCubicMeter, (double)kilonewtonpercubicmillimeterQuantity.Value, KilonewtonsPerCubicMillimeterTolerance); - Assert.Equal(SpecificWeightUnit.KilonewtonPerCubicMillimeter, kilonewtonpercubicmillimeterQuantity.Unit); - - var kilopoundforcepercubicfootQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilopoundForcePerCubicFoot); - AssertEx.EqualTolerance(KilopoundsForcePerCubicFootInOneNewtonPerCubicMeter, (double)kilopoundforcepercubicfootQuantity.Value, KilopoundsForcePerCubicFootTolerance); - Assert.Equal(SpecificWeightUnit.KilopoundForcePerCubicFoot, kilopoundforcepercubicfootQuantity.Unit); - - var kilopoundforcepercubicinchQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.KilopoundForcePerCubicInch); - AssertEx.EqualTolerance(KilopoundsForcePerCubicInchInOneNewtonPerCubicMeter, (double)kilopoundforcepercubicinchQuantity.Value, KilopoundsForcePerCubicInchTolerance); - Assert.Equal(SpecificWeightUnit.KilopoundForcePerCubicInch, kilopoundforcepercubicinchQuantity.Unit); - - var meganewtonpercubicmeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.MeganewtonPerCubicMeter); - AssertEx.EqualTolerance(MeganewtonsPerCubicMeterInOneNewtonPerCubicMeter, (double)meganewtonpercubicmeterQuantity.Value, MeganewtonsPerCubicMeterTolerance); - Assert.Equal(SpecificWeightUnit.MeganewtonPerCubicMeter, meganewtonpercubicmeterQuantity.Unit); - - var newtonpercubiccentimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.NewtonPerCubicCentimeter); - AssertEx.EqualTolerance(NewtonsPerCubicCentimeterInOneNewtonPerCubicMeter, (double)newtonpercubiccentimeterQuantity.Value, NewtonsPerCubicCentimeterTolerance); - Assert.Equal(SpecificWeightUnit.NewtonPerCubicCentimeter, newtonpercubiccentimeterQuantity.Unit); - - var newtonpercubicmeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.NewtonPerCubicMeter); - AssertEx.EqualTolerance(NewtonsPerCubicMeterInOneNewtonPerCubicMeter, (double)newtonpercubicmeterQuantity.Value, NewtonsPerCubicMeterTolerance); - Assert.Equal(SpecificWeightUnit.NewtonPerCubicMeter, newtonpercubicmeterQuantity.Unit); - - var newtonpercubicmillimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.NewtonPerCubicMillimeter); - AssertEx.EqualTolerance(NewtonsPerCubicMillimeterInOneNewtonPerCubicMeter, (double)newtonpercubicmillimeterQuantity.Value, NewtonsPerCubicMillimeterTolerance); - Assert.Equal(SpecificWeightUnit.NewtonPerCubicMillimeter, newtonpercubicmillimeterQuantity.Unit); - - var poundforcepercubicfootQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.PoundForcePerCubicFoot); - AssertEx.EqualTolerance(PoundsForcePerCubicFootInOneNewtonPerCubicMeter, (double)poundforcepercubicfootQuantity.Value, PoundsForcePerCubicFootTolerance); - Assert.Equal(SpecificWeightUnit.PoundForcePerCubicFoot, poundforcepercubicfootQuantity.Unit); - - var poundforcepercubicinchQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.PoundForcePerCubicInch); - AssertEx.EqualTolerance(PoundsForcePerCubicInchInOneNewtonPerCubicMeter, (double)poundforcepercubicinchQuantity.Value, PoundsForcePerCubicInchTolerance); - Assert.Equal(SpecificWeightUnit.PoundForcePerCubicInch, poundforcepercubicinchQuantity.Unit); - - var tonneforcepercubiccentimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.TonneForcePerCubicCentimeter); - AssertEx.EqualTolerance(TonnesForcePerCubicCentimeterInOneNewtonPerCubicMeter, (double)tonneforcepercubiccentimeterQuantity.Value, TonnesForcePerCubicCentimeterTolerance); - Assert.Equal(SpecificWeightUnit.TonneForcePerCubicCentimeter, tonneforcepercubiccentimeterQuantity.Unit); - - var tonneforcepercubicmeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.TonneForcePerCubicMeter); - AssertEx.EqualTolerance(TonnesForcePerCubicMeterInOneNewtonPerCubicMeter, (double)tonneforcepercubicmeterQuantity.Value, TonnesForcePerCubicMeterTolerance); - Assert.Equal(SpecificWeightUnit.TonneForcePerCubicMeter, tonneforcepercubicmeterQuantity.Unit); - - var tonneforcepercubicmillimeterQuantity = newtonpercubicmeter.ToUnit(SpecificWeightUnit.TonneForcePerCubicMillimeter); - AssertEx.EqualTolerance(TonnesForcePerCubicMillimeterInOneNewtonPerCubicMeter, (double)tonneforcepercubicmillimeterQuantity.Value, TonnesForcePerCubicMillimeterTolerance); - Assert.Equal(SpecificWeightUnit.TonneForcePerCubicMillimeter, tonneforcepercubicmillimeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicCentimeter(newtonpercubicmeter.KilogramsForcePerCubicCentimeter).NewtonsPerCubicMeter, KilogramsForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicMeter(newtonpercubicmeter.KilogramsForcePerCubicMeter).NewtonsPerCubicMeter, KilogramsForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilogramsForcePerCubicMillimeter(newtonpercubicmeter.KilogramsForcePerCubicMillimeter).NewtonsPerCubicMeter, KilogramsForcePerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicCentimeter(newtonpercubicmeter.KilonewtonsPerCubicCentimeter).NewtonsPerCubicMeter, KilonewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicMeter(newtonpercubicmeter.KilonewtonsPerCubicMeter).NewtonsPerCubicMeter, KilonewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilonewtonsPerCubicMillimeter(newtonpercubicmeter.KilonewtonsPerCubicMillimeter).NewtonsPerCubicMeter, KilonewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilopoundsForcePerCubicFoot(newtonpercubicmeter.KilopoundsForcePerCubicFoot).NewtonsPerCubicMeter, KilopoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromKilopoundsForcePerCubicInch(newtonpercubicmeter.KilopoundsForcePerCubicInch).NewtonsPerCubicMeter, KilopoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromMeganewtonsPerCubicMeter(newtonpercubicmeter.MeganewtonsPerCubicMeter).NewtonsPerCubicMeter, MeganewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicCentimeter(newtonpercubicmeter.NewtonsPerCubicCentimeter).NewtonsPerCubicMeter, NewtonsPerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicMeter(newtonpercubicmeter.NewtonsPerCubicMeter).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromNewtonsPerCubicMillimeter(newtonpercubicmeter.NewtonsPerCubicMillimeter).NewtonsPerCubicMeter, NewtonsPerCubicMillimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromPoundsForcePerCubicFoot(newtonpercubicmeter.PoundsForcePerCubicFoot).NewtonsPerCubicMeter, PoundsForcePerCubicFootTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromPoundsForcePerCubicInch(newtonpercubicmeter.PoundsForcePerCubicInch).NewtonsPerCubicMeter, PoundsForcePerCubicInchTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicCentimeter(newtonpercubicmeter.TonnesForcePerCubicCentimeter).NewtonsPerCubicMeter, TonnesForcePerCubicCentimeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicMeter(newtonpercubicmeter.TonnesForcePerCubicMeter).NewtonsPerCubicMeter, TonnesForcePerCubicMeterTolerance); - AssertEx.EqualTolerance(1, SpecificWeight.FromTonnesForcePerCubicMillimeter(newtonpercubicmeter.TonnesForcePerCubicMillimeter).NewtonsPerCubicMeter, TonnesForcePerCubicMillimeterTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - SpecificWeight v = SpecificWeight.FromNewtonsPerCubicMeter(1); - AssertEx.EqualTolerance(-1, -v.NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (SpecificWeight.FromNewtonsPerCubicMeter(3)-v).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (v + v).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (v*10).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(10, (10*v).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, (SpecificWeight.FromNewtonsPerCubicMeter(10)/5).NewtonsPerCubicMeter, NewtonsPerCubicMeterTolerance); - AssertEx.EqualTolerance(2, SpecificWeight.FromNewtonsPerCubicMeter(10)/SpecificWeight.FromNewtonsPerCubicMeter(5), NewtonsPerCubicMeterTolerance); - } - - [Fact] - public void ComparisonOperators() - { - SpecificWeight oneNewtonPerCubicMeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - SpecificWeight twoNewtonsPerCubicMeter = SpecificWeight.FromNewtonsPerCubicMeter(2); - - Assert.True(oneNewtonPerCubicMeter < twoNewtonsPerCubicMeter); - Assert.True(oneNewtonPerCubicMeter <= twoNewtonsPerCubicMeter); - Assert.True(twoNewtonsPerCubicMeter > oneNewtonPerCubicMeter); - Assert.True(twoNewtonsPerCubicMeter >= oneNewtonPerCubicMeter); - - Assert.False(oneNewtonPerCubicMeter > twoNewtonsPerCubicMeter); - Assert.False(oneNewtonPerCubicMeter >= twoNewtonsPerCubicMeter); - Assert.False(twoNewtonsPerCubicMeter < oneNewtonPerCubicMeter); - Assert.False(twoNewtonsPerCubicMeter <= oneNewtonPerCubicMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.Equal(0, newtonpercubicmeter.CompareTo(newtonpercubicmeter)); - Assert.True(newtonpercubicmeter.CompareTo(SpecificWeight.Zero) > 0); - Assert.True(SpecificWeight.Zero.CompareTo(newtonpercubicmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.Throws(() => newtonpercubicmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.Throws(() => newtonpercubicmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - SpecificWeight v = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.True(v.Equals(SpecificWeight.FromNewtonsPerCubicMeter(1), NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(SpecificWeight.Zero, NewtonsPerCubicMeterTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.False(newtonpercubicmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - SpecificWeight newtonpercubicmeter = SpecificWeight.FromNewtonsPerCubicMeter(1); - Assert.False(newtonpercubicmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(SpecificWeightUnit.Undefined, SpecificWeight.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(SpecificWeightUnit)).Cast(); - foreach(var unit in units) - { - if(unit == SpecificWeightUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs deleted file mode 100644 index d9b733b984..0000000000 --- a/UnitsNet.Tests/GeneratedCode/SpeedTestsBase.g.cs +++ /dev/null @@ -1,534 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Speed. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class SpeedTestsBase - { - protected abstract double CentimetersPerHourInOneMeterPerSecond { get; } - protected abstract double CentimetersPerMinutesInOneMeterPerSecond { get; } - protected abstract double CentimetersPerSecondInOneMeterPerSecond { get; } - protected abstract double DecimetersPerMinutesInOneMeterPerSecond { get; } - protected abstract double DecimetersPerSecondInOneMeterPerSecond { get; } - protected abstract double FeetPerHourInOneMeterPerSecond { get; } - protected abstract double FeetPerMinuteInOneMeterPerSecond { get; } - protected abstract double FeetPerSecondInOneMeterPerSecond { get; } - protected abstract double InchesPerHourInOneMeterPerSecond { get; } - protected abstract double InchesPerMinuteInOneMeterPerSecond { get; } - protected abstract double InchesPerSecondInOneMeterPerSecond { get; } - protected abstract double KilometersPerHourInOneMeterPerSecond { get; } - protected abstract double KilometersPerMinutesInOneMeterPerSecond { get; } - protected abstract double KilometersPerSecondInOneMeterPerSecond { get; } - protected abstract double KnotsInOneMeterPerSecond { get; } - protected abstract double MetersPerHourInOneMeterPerSecond { get; } - protected abstract double MetersPerMinutesInOneMeterPerSecond { get; } - protected abstract double MetersPerSecondInOneMeterPerSecond { get; } - protected abstract double MicrometersPerMinutesInOneMeterPerSecond { get; } - protected abstract double MicrometersPerSecondInOneMeterPerSecond { get; } - protected abstract double MilesPerHourInOneMeterPerSecond { get; } - protected abstract double MillimetersPerHourInOneMeterPerSecond { get; } - protected abstract double MillimetersPerMinutesInOneMeterPerSecond { get; } - protected abstract double MillimetersPerSecondInOneMeterPerSecond { get; } - protected abstract double NanometersPerMinutesInOneMeterPerSecond { get; } - protected abstract double NanometersPerSecondInOneMeterPerSecond { get; } - protected abstract double UsSurveyFeetPerHourInOneMeterPerSecond { get; } - protected abstract double UsSurveyFeetPerMinuteInOneMeterPerSecond { get; } - protected abstract double UsSurveyFeetPerSecondInOneMeterPerSecond { get; } - protected abstract double YardsPerHourInOneMeterPerSecond { get; } - protected abstract double YardsPerMinuteInOneMeterPerSecond { get; } - protected abstract double YardsPerSecondInOneMeterPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentimetersPerHourTolerance { get { return 1e-5; } } - protected virtual double CentimetersPerMinutesTolerance { get { return 1e-5; } } - protected virtual double CentimetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecimetersPerMinutesTolerance { get { return 1e-5; } } - protected virtual double DecimetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double FeetPerHourTolerance { get { return 1e-5; } } - protected virtual double FeetPerMinuteTolerance { get { return 1e-5; } } - protected virtual double FeetPerSecondTolerance { get { return 1e-5; } } - protected virtual double InchesPerHourTolerance { get { return 1e-5; } } - protected virtual double InchesPerMinuteTolerance { get { return 1e-5; } } - protected virtual double InchesPerSecondTolerance { get { return 1e-5; } } - protected virtual double KilometersPerHourTolerance { get { return 1e-5; } } - protected virtual double KilometersPerMinutesTolerance { get { return 1e-5; } } - protected virtual double KilometersPerSecondTolerance { get { return 1e-5; } } - protected virtual double KnotsTolerance { get { return 1e-5; } } - protected virtual double MetersPerHourTolerance { get { return 1e-5; } } - protected virtual double MetersPerMinutesTolerance { get { return 1e-5; } } - protected virtual double MetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicrometersPerMinutesTolerance { get { return 1e-5; } } - protected virtual double MicrometersPerSecondTolerance { get { return 1e-5; } } - protected virtual double MilesPerHourTolerance { get { return 1e-5; } } - protected virtual double MillimetersPerHourTolerance { get { return 1e-5; } } - protected virtual double MillimetersPerMinutesTolerance { get { return 1e-5; } } - protected virtual double MillimetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double NanometersPerMinutesTolerance { get { return 1e-5; } } - protected virtual double NanometersPerSecondTolerance { get { return 1e-5; } } - protected virtual double UsSurveyFeetPerHourTolerance { get { return 1e-5; } } - protected virtual double UsSurveyFeetPerMinuteTolerance { get { return 1e-5; } } - protected virtual double UsSurveyFeetPerSecondTolerance { get { return 1e-5; } } - protected virtual double YardsPerHourTolerance { get { return 1e-5; } } - protected virtual double YardsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double YardsPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Speed((double)0.0, SpeedUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Speed(double.PositiveInfinity, SpeedUnit.MeterPerSecond)); - Assert.Throws(() => new Speed(double.NegativeInfinity, SpeedUnit.MeterPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Speed(double.NaN, SpeedUnit.MeterPerSecond)); - } - - [Fact] - public void MeterPerSecondToSpeedUnits() - { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, meterpersecond.CentimetersPerHour, CentimetersPerHourTolerance); - AssertEx.EqualTolerance(CentimetersPerMinutesInOneMeterPerSecond, meterpersecond.CentimetersPerMinutes, CentimetersPerMinutesTolerance); - AssertEx.EqualTolerance(CentimetersPerSecondInOneMeterPerSecond, meterpersecond.CentimetersPerSecond, CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(DecimetersPerMinutesInOneMeterPerSecond, meterpersecond.DecimetersPerMinutes, DecimetersPerMinutesTolerance); - AssertEx.EqualTolerance(DecimetersPerSecondInOneMeterPerSecond, meterpersecond.DecimetersPerSecond, DecimetersPerSecondTolerance); - AssertEx.EqualTolerance(FeetPerHourInOneMeterPerSecond, meterpersecond.FeetPerHour, FeetPerHourTolerance); - AssertEx.EqualTolerance(FeetPerMinuteInOneMeterPerSecond, meterpersecond.FeetPerMinute, FeetPerMinuteTolerance); - AssertEx.EqualTolerance(FeetPerSecondInOneMeterPerSecond, meterpersecond.FeetPerSecond, FeetPerSecondTolerance); - AssertEx.EqualTolerance(InchesPerHourInOneMeterPerSecond, meterpersecond.InchesPerHour, InchesPerHourTolerance); - AssertEx.EqualTolerance(InchesPerMinuteInOneMeterPerSecond, meterpersecond.InchesPerMinute, InchesPerMinuteTolerance); - AssertEx.EqualTolerance(InchesPerSecondInOneMeterPerSecond, meterpersecond.InchesPerSecond, InchesPerSecondTolerance); - AssertEx.EqualTolerance(KilometersPerHourInOneMeterPerSecond, meterpersecond.KilometersPerHour, KilometersPerHourTolerance); - AssertEx.EqualTolerance(KilometersPerMinutesInOneMeterPerSecond, meterpersecond.KilometersPerMinutes, KilometersPerMinutesTolerance); - AssertEx.EqualTolerance(KilometersPerSecondInOneMeterPerSecond, meterpersecond.KilometersPerSecond, KilometersPerSecondTolerance); - AssertEx.EqualTolerance(KnotsInOneMeterPerSecond, meterpersecond.Knots, KnotsTolerance); - AssertEx.EqualTolerance(MetersPerHourInOneMeterPerSecond, meterpersecond.MetersPerHour, MetersPerHourTolerance); - AssertEx.EqualTolerance(MetersPerMinutesInOneMeterPerSecond, meterpersecond.MetersPerMinutes, MetersPerMinutesTolerance); - AssertEx.EqualTolerance(MetersPerSecondInOneMeterPerSecond, meterpersecond.MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(MicrometersPerMinutesInOneMeterPerSecond, meterpersecond.MicrometersPerMinutes, MicrometersPerMinutesTolerance); - AssertEx.EqualTolerance(MicrometersPerSecondInOneMeterPerSecond, meterpersecond.MicrometersPerSecond, MicrometersPerSecondTolerance); - AssertEx.EqualTolerance(MilesPerHourInOneMeterPerSecond, meterpersecond.MilesPerHour, MilesPerHourTolerance); - AssertEx.EqualTolerance(MillimetersPerHourInOneMeterPerSecond, meterpersecond.MillimetersPerHour, MillimetersPerHourTolerance); - AssertEx.EqualTolerance(MillimetersPerMinutesInOneMeterPerSecond, meterpersecond.MillimetersPerMinutes, MillimetersPerMinutesTolerance); - AssertEx.EqualTolerance(MillimetersPerSecondInOneMeterPerSecond, meterpersecond.MillimetersPerSecond, MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(NanometersPerMinutesInOneMeterPerSecond, meterpersecond.NanometersPerMinutes, NanometersPerMinutesTolerance); - AssertEx.EqualTolerance(NanometersPerSecondInOneMeterPerSecond, meterpersecond.NanometersPerSecond, NanometersPerSecondTolerance); - AssertEx.EqualTolerance(UsSurveyFeetPerHourInOneMeterPerSecond, meterpersecond.UsSurveyFeetPerHour, UsSurveyFeetPerHourTolerance); - AssertEx.EqualTolerance(UsSurveyFeetPerMinuteInOneMeterPerSecond, meterpersecond.UsSurveyFeetPerMinute, UsSurveyFeetPerMinuteTolerance); - AssertEx.EqualTolerance(UsSurveyFeetPerSecondInOneMeterPerSecond, meterpersecond.UsSurveyFeetPerSecond, UsSurveyFeetPerSecondTolerance); - AssertEx.EqualTolerance(YardsPerHourInOneMeterPerSecond, meterpersecond.YardsPerHour, YardsPerHourTolerance); - AssertEx.EqualTolerance(YardsPerMinuteInOneMeterPerSecond, meterpersecond.YardsPerMinute, YardsPerMinuteTolerance); - AssertEx.EqualTolerance(YardsPerSecondInOneMeterPerSecond, meterpersecond.YardsPerSecond, YardsPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerHour).CentimetersPerHour, CentimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerMinute).CentimetersPerMinutes, CentimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.CentimeterPerSecond).CentimetersPerSecond, CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.DecimeterPerMinute).DecimetersPerMinutes, DecimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.DecimeterPerSecond).DecimetersPerSecond, DecimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerHour).FeetPerHour, FeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerMinute).FeetPerMinute, FeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.FootPerSecond).FeetPerSecond, FeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerHour).InchesPerHour, InchesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerMinute).InchesPerMinute, InchesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.InchPerSecond).InchesPerSecond, InchesPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerHour).KilometersPerHour, KilometersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerMinute).KilometersPerMinutes, KilometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.KilometerPerSecond).KilometersPerSecond, KilometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.Knot).Knots, KnotsTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerHour).MetersPerHour, MetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerMinute).MetersPerMinutes, MetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MeterPerSecond).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MicrometerPerMinute).MicrometersPerMinutes, MicrometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MicrometerPerSecond).MicrometersPerSecond, MicrometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MilePerHour).MilesPerHour, MilesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerHour).MillimetersPerHour, MillimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerMinute).MillimetersPerMinutes, MillimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.MillimeterPerSecond).MillimetersPerSecond, MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.NanometerPerMinute).NanometersPerMinutes, NanometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.NanometerPerSecond).NanometersPerSecond, NanometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerHour).UsSurveyFeetPerHour, UsSurveyFeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerMinute).UsSurveyFeetPerMinute, UsSurveyFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.UsSurveyFootPerSecond).UsSurveyFeetPerSecond, UsSurveyFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerHour).YardsPerHour, YardsPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerMinute).YardsPerMinute, YardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.From(1, SpeedUnit.YardPerSecond).YardsPerSecond, YardsPerSecondTolerance); - } - - [Fact] - public void FromMetersPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Speed.FromMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => Speed.FromMetersPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromMetersPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Speed.FromMetersPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var meterpersecond = Speed.FromMetersPerSecond(1); - AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerHour), CentimetersPerHourTolerance); - AssertEx.EqualTolerance(CentimetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerMinute), CentimetersPerMinutesTolerance); - AssertEx.EqualTolerance(CentimetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.CentimeterPerSecond), CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(DecimetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.DecimeterPerMinute), DecimetersPerMinutesTolerance); - AssertEx.EqualTolerance(DecimetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.DecimeterPerSecond), DecimetersPerSecondTolerance); - AssertEx.EqualTolerance(FeetPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.FootPerHour), FeetPerHourTolerance); - AssertEx.EqualTolerance(FeetPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.FootPerMinute), FeetPerMinuteTolerance); - AssertEx.EqualTolerance(FeetPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.FootPerSecond), FeetPerSecondTolerance); - AssertEx.EqualTolerance(InchesPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.InchPerHour), InchesPerHourTolerance); - AssertEx.EqualTolerance(InchesPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.InchPerMinute), InchesPerMinuteTolerance); - AssertEx.EqualTolerance(InchesPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.InchPerSecond), InchesPerSecondTolerance); - AssertEx.EqualTolerance(KilometersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.KilometerPerHour), KilometersPerHourTolerance); - AssertEx.EqualTolerance(KilometersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.KilometerPerMinute), KilometersPerMinutesTolerance); - AssertEx.EqualTolerance(KilometersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.KilometerPerSecond), KilometersPerSecondTolerance); - AssertEx.EqualTolerance(KnotsInOneMeterPerSecond, meterpersecond.As(SpeedUnit.Knot), KnotsTolerance); - AssertEx.EqualTolerance(MetersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MeterPerHour), MetersPerHourTolerance); - AssertEx.EqualTolerance(MetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MeterPerMinute), MetersPerMinutesTolerance); - AssertEx.EqualTolerance(MetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MeterPerSecond), MetersPerSecondTolerance); - AssertEx.EqualTolerance(MicrometersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MicrometerPerMinute), MicrometersPerMinutesTolerance); - AssertEx.EqualTolerance(MicrometersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MicrometerPerSecond), MicrometersPerSecondTolerance); - AssertEx.EqualTolerance(MilesPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MilePerHour), MilesPerHourTolerance); - AssertEx.EqualTolerance(MillimetersPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MillimeterPerHour), MillimetersPerHourTolerance); - AssertEx.EqualTolerance(MillimetersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MillimeterPerMinute), MillimetersPerMinutesTolerance); - AssertEx.EqualTolerance(MillimetersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.MillimeterPerSecond), MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(NanometersPerMinutesInOneMeterPerSecond, meterpersecond.As(SpeedUnit.NanometerPerMinute), NanometersPerMinutesTolerance); - AssertEx.EqualTolerance(NanometersPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.NanometerPerSecond), NanometersPerSecondTolerance); - AssertEx.EqualTolerance(UsSurveyFeetPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.UsSurveyFootPerHour), UsSurveyFeetPerHourTolerance); - AssertEx.EqualTolerance(UsSurveyFeetPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.UsSurveyFootPerMinute), UsSurveyFeetPerMinuteTolerance); - AssertEx.EqualTolerance(UsSurveyFeetPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.UsSurveyFootPerSecond), UsSurveyFeetPerSecondTolerance); - AssertEx.EqualTolerance(YardsPerHourInOneMeterPerSecond, meterpersecond.As(SpeedUnit.YardPerHour), YardsPerHourTolerance); - AssertEx.EqualTolerance(YardsPerMinuteInOneMeterPerSecond, meterpersecond.As(SpeedUnit.YardPerMinute), YardsPerMinuteTolerance); - AssertEx.EqualTolerance(YardsPerSecondInOneMeterPerSecond, meterpersecond.As(SpeedUnit.YardPerSecond), YardsPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var meterpersecond = Speed.FromMetersPerSecond(1); - - var centimeterperhourQuantity = meterpersecond.ToUnit(SpeedUnit.CentimeterPerHour); - AssertEx.EqualTolerance(CentimetersPerHourInOneMeterPerSecond, (double)centimeterperhourQuantity.Value, CentimetersPerHourTolerance); - Assert.Equal(SpeedUnit.CentimeterPerHour, centimeterperhourQuantity.Unit); - - var centimeterperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.CentimeterPerMinute); - AssertEx.EqualTolerance(CentimetersPerMinutesInOneMeterPerSecond, (double)centimeterperminuteQuantity.Value, CentimetersPerMinutesTolerance); - Assert.Equal(SpeedUnit.CentimeterPerMinute, centimeterperminuteQuantity.Unit); - - var centimeterpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.CentimeterPerSecond); - AssertEx.EqualTolerance(CentimetersPerSecondInOneMeterPerSecond, (double)centimeterpersecondQuantity.Value, CentimetersPerSecondTolerance); - Assert.Equal(SpeedUnit.CentimeterPerSecond, centimeterpersecondQuantity.Unit); - - var decimeterperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.DecimeterPerMinute); - AssertEx.EqualTolerance(DecimetersPerMinutesInOneMeterPerSecond, (double)decimeterperminuteQuantity.Value, DecimetersPerMinutesTolerance); - Assert.Equal(SpeedUnit.DecimeterPerMinute, decimeterperminuteQuantity.Unit); - - var decimeterpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.DecimeterPerSecond); - AssertEx.EqualTolerance(DecimetersPerSecondInOneMeterPerSecond, (double)decimeterpersecondQuantity.Value, DecimetersPerSecondTolerance); - Assert.Equal(SpeedUnit.DecimeterPerSecond, decimeterpersecondQuantity.Unit); - - var footperhourQuantity = meterpersecond.ToUnit(SpeedUnit.FootPerHour); - AssertEx.EqualTolerance(FeetPerHourInOneMeterPerSecond, (double)footperhourQuantity.Value, FeetPerHourTolerance); - Assert.Equal(SpeedUnit.FootPerHour, footperhourQuantity.Unit); - - var footperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.FootPerMinute); - AssertEx.EqualTolerance(FeetPerMinuteInOneMeterPerSecond, (double)footperminuteQuantity.Value, FeetPerMinuteTolerance); - Assert.Equal(SpeedUnit.FootPerMinute, footperminuteQuantity.Unit); - - var footpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.FootPerSecond); - AssertEx.EqualTolerance(FeetPerSecondInOneMeterPerSecond, (double)footpersecondQuantity.Value, FeetPerSecondTolerance); - Assert.Equal(SpeedUnit.FootPerSecond, footpersecondQuantity.Unit); - - var inchperhourQuantity = meterpersecond.ToUnit(SpeedUnit.InchPerHour); - AssertEx.EqualTolerance(InchesPerHourInOneMeterPerSecond, (double)inchperhourQuantity.Value, InchesPerHourTolerance); - Assert.Equal(SpeedUnit.InchPerHour, inchperhourQuantity.Unit); - - var inchperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.InchPerMinute); - AssertEx.EqualTolerance(InchesPerMinuteInOneMeterPerSecond, (double)inchperminuteQuantity.Value, InchesPerMinuteTolerance); - Assert.Equal(SpeedUnit.InchPerMinute, inchperminuteQuantity.Unit); - - var inchpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.InchPerSecond); - AssertEx.EqualTolerance(InchesPerSecondInOneMeterPerSecond, (double)inchpersecondQuantity.Value, InchesPerSecondTolerance); - Assert.Equal(SpeedUnit.InchPerSecond, inchpersecondQuantity.Unit); - - var kilometerperhourQuantity = meterpersecond.ToUnit(SpeedUnit.KilometerPerHour); - AssertEx.EqualTolerance(KilometersPerHourInOneMeterPerSecond, (double)kilometerperhourQuantity.Value, KilometersPerHourTolerance); - Assert.Equal(SpeedUnit.KilometerPerHour, kilometerperhourQuantity.Unit); - - var kilometerperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.KilometerPerMinute); - AssertEx.EqualTolerance(KilometersPerMinutesInOneMeterPerSecond, (double)kilometerperminuteQuantity.Value, KilometersPerMinutesTolerance); - Assert.Equal(SpeedUnit.KilometerPerMinute, kilometerperminuteQuantity.Unit); - - var kilometerpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.KilometerPerSecond); - AssertEx.EqualTolerance(KilometersPerSecondInOneMeterPerSecond, (double)kilometerpersecondQuantity.Value, KilometersPerSecondTolerance); - Assert.Equal(SpeedUnit.KilometerPerSecond, kilometerpersecondQuantity.Unit); - - var knotQuantity = meterpersecond.ToUnit(SpeedUnit.Knot); - AssertEx.EqualTolerance(KnotsInOneMeterPerSecond, (double)knotQuantity.Value, KnotsTolerance); - Assert.Equal(SpeedUnit.Knot, knotQuantity.Unit); - - var meterperhourQuantity = meterpersecond.ToUnit(SpeedUnit.MeterPerHour); - AssertEx.EqualTolerance(MetersPerHourInOneMeterPerSecond, (double)meterperhourQuantity.Value, MetersPerHourTolerance); - Assert.Equal(SpeedUnit.MeterPerHour, meterperhourQuantity.Unit); - - var meterperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.MeterPerMinute); - AssertEx.EqualTolerance(MetersPerMinutesInOneMeterPerSecond, (double)meterperminuteQuantity.Value, MetersPerMinutesTolerance); - Assert.Equal(SpeedUnit.MeterPerMinute, meterperminuteQuantity.Unit); - - var meterpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.MeterPerSecond); - AssertEx.EqualTolerance(MetersPerSecondInOneMeterPerSecond, (double)meterpersecondQuantity.Value, MetersPerSecondTolerance); - Assert.Equal(SpeedUnit.MeterPerSecond, meterpersecondQuantity.Unit); - - var micrometerperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.MicrometerPerMinute); - AssertEx.EqualTolerance(MicrometersPerMinutesInOneMeterPerSecond, (double)micrometerperminuteQuantity.Value, MicrometersPerMinutesTolerance); - Assert.Equal(SpeedUnit.MicrometerPerMinute, micrometerperminuteQuantity.Unit); - - var micrometerpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.MicrometerPerSecond); - AssertEx.EqualTolerance(MicrometersPerSecondInOneMeterPerSecond, (double)micrometerpersecondQuantity.Value, MicrometersPerSecondTolerance); - Assert.Equal(SpeedUnit.MicrometerPerSecond, micrometerpersecondQuantity.Unit); - - var mileperhourQuantity = meterpersecond.ToUnit(SpeedUnit.MilePerHour); - AssertEx.EqualTolerance(MilesPerHourInOneMeterPerSecond, (double)mileperhourQuantity.Value, MilesPerHourTolerance); - Assert.Equal(SpeedUnit.MilePerHour, mileperhourQuantity.Unit); - - var millimeterperhourQuantity = meterpersecond.ToUnit(SpeedUnit.MillimeterPerHour); - AssertEx.EqualTolerance(MillimetersPerHourInOneMeterPerSecond, (double)millimeterperhourQuantity.Value, MillimetersPerHourTolerance); - Assert.Equal(SpeedUnit.MillimeterPerHour, millimeterperhourQuantity.Unit); - - var millimeterperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.MillimeterPerMinute); - AssertEx.EqualTolerance(MillimetersPerMinutesInOneMeterPerSecond, (double)millimeterperminuteQuantity.Value, MillimetersPerMinutesTolerance); - Assert.Equal(SpeedUnit.MillimeterPerMinute, millimeterperminuteQuantity.Unit); - - var millimeterpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.MillimeterPerSecond); - AssertEx.EqualTolerance(MillimetersPerSecondInOneMeterPerSecond, (double)millimeterpersecondQuantity.Value, MillimetersPerSecondTolerance); - Assert.Equal(SpeedUnit.MillimeterPerSecond, millimeterpersecondQuantity.Unit); - - var nanometerperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.NanometerPerMinute); - AssertEx.EqualTolerance(NanometersPerMinutesInOneMeterPerSecond, (double)nanometerperminuteQuantity.Value, NanometersPerMinutesTolerance); - Assert.Equal(SpeedUnit.NanometerPerMinute, nanometerperminuteQuantity.Unit); - - var nanometerpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.NanometerPerSecond); - AssertEx.EqualTolerance(NanometersPerSecondInOneMeterPerSecond, (double)nanometerpersecondQuantity.Value, NanometersPerSecondTolerance); - Assert.Equal(SpeedUnit.NanometerPerSecond, nanometerpersecondQuantity.Unit); - - var ussurveyfootperhourQuantity = meterpersecond.ToUnit(SpeedUnit.UsSurveyFootPerHour); - AssertEx.EqualTolerance(UsSurveyFeetPerHourInOneMeterPerSecond, (double)ussurveyfootperhourQuantity.Value, UsSurveyFeetPerHourTolerance); - Assert.Equal(SpeedUnit.UsSurveyFootPerHour, ussurveyfootperhourQuantity.Unit); - - var ussurveyfootperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.UsSurveyFootPerMinute); - AssertEx.EqualTolerance(UsSurveyFeetPerMinuteInOneMeterPerSecond, (double)ussurveyfootperminuteQuantity.Value, UsSurveyFeetPerMinuteTolerance); - Assert.Equal(SpeedUnit.UsSurveyFootPerMinute, ussurveyfootperminuteQuantity.Unit); - - var ussurveyfootpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.UsSurveyFootPerSecond); - AssertEx.EqualTolerance(UsSurveyFeetPerSecondInOneMeterPerSecond, (double)ussurveyfootpersecondQuantity.Value, UsSurveyFeetPerSecondTolerance); - Assert.Equal(SpeedUnit.UsSurveyFootPerSecond, ussurveyfootpersecondQuantity.Unit); - - var yardperhourQuantity = meterpersecond.ToUnit(SpeedUnit.YardPerHour); - AssertEx.EqualTolerance(YardsPerHourInOneMeterPerSecond, (double)yardperhourQuantity.Value, YardsPerHourTolerance); - Assert.Equal(SpeedUnit.YardPerHour, yardperhourQuantity.Unit); - - var yardperminuteQuantity = meterpersecond.ToUnit(SpeedUnit.YardPerMinute); - AssertEx.EqualTolerance(YardsPerMinuteInOneMeterPerSecond, (double)yardperminuteQuantity.Value, YardsPerMinuteTolerance); - Assert.Equal(SpeedUnit.YardPerMinute, yardperminuteQuantity.Unit); - - var yardpersecondQuantity = meterpersecond.ToUnit(SpeedUnit.YardPerSecond); - AssertEx.EqualTolerance(YardsPerSecondInOneMeterPerSecond, (double)yardpersecondQuantity.Value, YardsPerSecondTolerance); - Assert.Equal(SpeedUnit.YardPerSecond, yardpersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - AssertEx.EqualTolerance(1, Speed.FromCentimetersPerHour(meterpersecond.CentimetersPerHour).MetersPerSecond, CentimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromCentimetersPerMinutes(meterpersecond.CentimetersPerMinutes).MetersPerSecond, CentimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromCentimetersPerSecond(meterpersecond.CentimetersPerSecond).MetersPerSecond, CentimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromDecimetersPerMinutes(meterpersecond.DecimetersPerMinutes).MetersPerSecond, DecimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromDecimetersPerSecond(meterpersecond.DecimetersPerSecond).MetersPerSecond, DecimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromFeetPerHour(meterpersecond.FeetPerHour).MetersPerSecond, FeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromFeetPerMinute(meterpersecond.FeetPerMinute).MetersPerSecond, FeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromFeetPerSecond(meterpersecond.FeetPerSecond).MetersPerSecond, FeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromInchesPerHour(meterpersecond.InchesPerHour).MetersPerSecond, InchesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromInchesPerMinute(meterpersecond.InchesPerMinute).MetersPerSecond, InchesPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromInchesPerSecond(meterpersecond.InchesPerSecond).MetersPerSecond, InchesPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromKilometersPerHour(meterpersecond.KilometersPerHour).MetersPerSecond, KilometersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromKilometersPerMinutes(meterpersecond.KilometersPerMinutes).MetersPerSecond, KilometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromKilometersPerSecond(meterpersecond.KilometersPerSecond).MetersPerSecond, KilometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromKnots(meterpersecond.Knots).MetersPerSecond, KnotsTolerance); - AssertEx.EqualTolerance(1, Speed.FromMetersPerHour(meterpersecond.MetersPerHour).MetersPerSecond, MetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMetersPerMinutes(meterpersecond.MetersPerMinutes).MetersPerSecond, MetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromMetersPerSecond(meterpersecond.MetersPerSecond).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromMicrometersPerMinutes(meterpersecond.MicrometersPerMinutes).MetersPerSecond, MicrometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromMicrometersPerSecond(meterpersecond.MicrometersPerSecond).MetersPerSecond, MicrometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromMilesPerHour(meterpersecond.MilesPerHour).MetersPerSecond, MilesPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMillimetersPerHour(meterpersecond.MillimetersPerHour).MetersPerSecond, MillimetersPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromMillimetersPerMinutes(meterpersecond.MillimetersPerMinutes).MetersPerSecond, MillimetersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromMillimetersPerSecond(meterpersecond.MillimetersPerSecond).MetersPerSecond, MillimetersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromNanometersPerMinutes(meterpersecond.NanometersPerMinutes).MetersPerSecond, NanometersPerMinutesTolerance); - AssertEx.EqualTolerance(1, Speed.FromNanometersPerSecond(meterpersecond.NanometersPerSecond).MetersPerSecond, NanometersPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerHour(meterpersecond.UsSurveyFeetPerHour).MetersPerSecond, UsSurveyFeetPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerMinute(meterpersecond.UsSurveyFeetPerMinute).MetersPerSecond, UsSurveyFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromUsSurveyFeetPerSecond(meterpersecond.UsSurveyFeetPerSecond).MetersPerSecond, UsSurveyFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, Speed.FromYardsPerHour(meterpersecond.YardsPerHour).MetersPerSecond, YardsPerHourTolerance); - AssertEx.EqualTolerance(1, Speed.FromYardsPerMinute(meterpersecond.YardsPerMinute).MetersPerSecond, YardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, Speed.FromYardsPerSecond(meterpersecond.YardsPerSecond).MetersPerSecond, YardsPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Speed v = Speed.FromMetersPerSecond(1); - AssertEx.EqualTolerance(-1, -v.MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (Speed.FromMetersPerSecond(3)-v).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (Speed.FromMetersPerSecond(10)/5).MetersPerSecond, MetersPerSecondTolerance); - AssertEx.EqualTolerance(2, Speed.FromMetersPerSecond(10)/Speed.FromMetersPerSecond(5), MetersPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Speed oneMeterPerSecond = Speed.FromMetersPerSecond(1); - Speed twoMetersPerSecond = Speed.FromMetersPerSecond(2); - - Assert.True(oneMeterPerSecond < twoMetersPerSecond); - Assert.True(oneMeterPerSecond <= twoMetersPerSecond); - Assert.True(twoMetersPerSecond > oneMeterPerSecond); - Assert.True(twoMetersPerSecond >= oneMeterPerSecond); - - Assert.False(oneMeterPerSecond > twoMetersPerSecond); - Assert.False(oneMeterPerSecond >= twoMetersPerSecond); - Assert.False(twoMetersPerSecond < oneMeterPerSecond); - Assert.False(twoMetersPerSecond <= oneMeterPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - Assert.Equal(0, meterpersecond.CompareTo(meterpersecond)); - Assert.True(meterpersecond.CompareTo(Speed.Zero) > 0); - Assert.True(Speed.Zero.CompareTo(meterpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - Assert.Throws(() => meterpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - Assert.Throws(() => meterpersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Speed v = Speed.FromMetersPerSecond(1); - Assert.True(v.Equals(Speed.FromMetersPerSecond(1), MetersPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Speed.Zero, MetersPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - Assert.False(meterpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Speed meterpersecond = Speed.FromMetersPerSecond(1); - Assert.False(meterpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(SpeedUnit.Undefined, Speed.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(SpeedUnit)).Cast(); - foreach(var unit in units) - { - if(unit == SpeedUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs deleted file mode 100644 index 8e645c2a51..0000000000 --- a/UnitsNet.Tests/GeneratedCode/TemperatureChangeRateTestsBase.g.cs +++ /dev/null @@ -1,314 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of TemperatureChangeRate. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class TemperatureChangeRateTestsBase - { - protected abstract double CentidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double DecadegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double DecidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double DegreesCelsiusPerMinuteInOneDegreeCelsiusPerSecond { get; } - protected abstract double DegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double HectodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double KilodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double MicrodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double MillidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - protected abstract double NanodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentidegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecadegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecidegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double DegreesCelsiusPerMinuteTolerance { get { return 1e-5; } } - protected virtual double DegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double HectodegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double KilodegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicrodegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double MillidegreesCelsiusPerSecondTolerance { get { return 1e-5; } } - protected virtual double NanodegreesCelsiusPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new TemperatureChangeRate((double)0.0, TemperatureChangeRateUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new TemperatureChangeRate(double.PositiveInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); - Assert.Throws(() => new TemperatureChangeRate(double.NegativeInfinity, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new TemperatureChangeRate(double.NaN, TemperatureChangeRateUnit.DegreeCelsiusPerSecond)); - } - - [Fact] - public void DegreeCelsiusPerSecondToTemperatureChangeRateUnits() - { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - AssertEx.EqualTolerance(CentidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.CentidegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(DecadegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.DecadegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(DecidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.DecidegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(DegreesCelsiusPerMinuteInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.DegreesCelsiusPerMinute, DegreesCelsiusPerMinuteTolerance); - AssertEx.EqualTolerance(DegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(HectodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.HectodegreesCelsiusPerSecond, HectodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(KilodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.KilodegreesCelsiusPerSecond, KilodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(MicrodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.MicrodegreesCelsiusPerSecond, MicrodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(MillidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.MillidegreesCelsiusPerSecond, MillidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(NanodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.NanodegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond).CentidegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond).DecadegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond).DecidegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DegreeCelsiusPerMinute).DegreesCelsiusPerMinute, DegreesCelsiusPerMinuteTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.DegreeCelsiusPerSecond).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond).HectodegreesCelsiusPerSecond, HectodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond).KilodegreesCelsiusPerSecond, KilodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond).MicrodegreesCelsiusPerSecond, MicrodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond).MillidegreesCelsiusPerSecond, MillidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.From(1, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond).NanodegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); - } - - [Fact] - public void FromDegreesCelsiusPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.PositiveInfinity)); - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromDegreesCelsiusPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => TemperatureChangeRate.FromDegreesCelsiusPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - AssertEx.EqualTolerance(CentidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond), CentidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(DecadegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond), DecadegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(DecidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond), DecidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(DegreesCelsiusPerMinuteInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.DegreeCelsiusPerMinute), DegreesCelsiusPerMinuteTolerance); - AssertEx.EqualTolerance(DegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.DegreeCelsiusPerSecond), DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(HectodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond), HectodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(KilodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond), KilodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(MicrodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond), MicrodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(MillidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond), MillidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(NanodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, degreecelsiuspersecond.As(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond), NanodegreesCelsiusPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - - var centidegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); - AssertEx.EqualTolerance(CentidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)centidegreecelsiuspersecondQuantity.Value, CentidegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, centidegreecelsiuspersecondQuantity.Unit); - - var decadegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); - AssertEx.EqualTolerance(DecadegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)decadegreecelsiuspersecondQuantity.Value, DecadegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, decadegreecelsiuspersecondQuantity.Unit); - - var decidegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); - AssertEx.EqualTolerance(DecidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)decidegreecelsiuspersecondQuantity.Value, DecidegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, decidegreecelsiuspersecondQuantity.Unit); - - var degreecelsiusperminuteQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.DegreeCelsiusPerMinute); - AssertEx.EqualTolerance(DegreesCelsiusPerMinuteInOneDegreeCelsiusPerSecond, (double)degreecelsiusperminuteQuantity.Value, DegreesCelsiusPerMinuteTolerance); - Assert.Equal(TemperatureChangeRateUnit.DegreeCelsiusPerMinute, degreecelsiusperminuteQuantity.Unit); - - var degreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.DegreeCelsiusPerSecond); - AssertEx.EqualTolerance(DegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)degreecelsiuspersecondQuantity.Value, DegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.DegreeCelsiusPerSecond, degreecelsiuspersecondQuantity.Unit); - - var hectodegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); - AssertEx.EqualTolerance(HectodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)hectodegreecelsiuspersecondQuantity.Value, HectodegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, hectodegreecelsiuspersecondQuantity.Unit); - - var kilodegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); - AssertEx.EqualTolerance(KilodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)kilodegreecelsiuspersecondQuantity.Value, KilodegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, kilodegreecelsiuspersecondQuantity.Unit); - - var microdegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); - AssertEx.EqualTolerance(MicrodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)microdegreecelsiuspersecondQuantity.Value, MicrodegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, microdegreecelsiuspersecondQuantity.Unit); - - var millidegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); - AssertEx.EqualTolerance(MillidegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)millidegreecelsiuspersecondQuantity.Value, MillidegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, millidegreecelsiuspersecondQuantity.Unit); - - var nanodegreecelsiuspersecondQuantity = degreecelsiuspersecond.ToUnit(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); - AssertEx.EqualTolerance(NanodegreesCelsiusPerSecondInOneDegreeCelsiusPerSecond, (double)nanodegreecelsiuspersecondQuantity.Value, NanodegreesCelsiusPerSecondTolerance); - Assert.Equal(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, nanodegreecelsiuspersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromCentidegreesCelsiusPerSecond(degreecelsiuspersecond.CentidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, CentidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDecadegreesCelsiusPerSecond(degreecelsiuspersecond.DecadegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DecadegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDecidegreesCelsiusPerSecond(degreecelsiuspersecond.DecidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DecidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDegreesCelsiusPerMinute(degreecelsiuspersecond.DegreesCelsiusPerMinute).DegreesCelsiusPerSecond, DegreesCelsiusPerMinuteTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromDegreesCelsiusPerSecond(degreecelsiuspersecond.DegreesCelsiusPerSecond).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromHectodegreesCelsiusPerSecond(degreecelsiuspersecond.HectodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, HectodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromKilodegreesCelsiusPerSecond(degreecelsiuspersecond.KilodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, KilodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromMicrodegreesCelsiusPerSecond(degreecelsiuspersecond.MicrodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, MicrodegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromMillidegreesCelsiusPerSecond(degreecelsiuspersecond.MillidegreesCelsiusPerSecond).DegreesCelsiusPerSecond, MillidegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(1, TemperatureChangeRate.FromNanodegreesCelsiusPerSecond(degreecelsiuspersecond.NanodegreesCelsiusPerSecond).DegreesCelsiusPerSecond, NanodegreesCelsiusPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - TemperatureChangeRate v = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - AssertEx.EqualTolerance(-1, -v.DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(2, (TemperatureChangeRate.FromDegreesCelsiusPerSecond(3)-v).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(2, (TemperatureChangeRate.FromDegreesCelsiusPerSecond(10)/5).DegreesCelsiusPerSecond, DegreesCelsiusPerSecondTolerance); - AssertEx.EqualTolerance(2, TemperatureChangeRate.FromDegreesCelsiusPerSecond(10)/TemperatureChangeRate.FromDegreesCelsiusPerSecond(5), DegreesCelsiusPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - TemperatureChangeRate oneDegreeCelsiusPerSecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - TemperatureChangeRate twoDegreesCelsiusPerSecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(2); - - Assert.True(oneDegreeCelsiusPerSecond < twoDegreesCelsiusPerSecond); - Assert.True(oneDegreeCelsiusPerSecond <= twoDegreesCelsiusPerSecond); - Assert.True(twoDegreesCelsiusPerSecond > oneDegreeCelsiusPerSecond); - Assert.True(twoDegreesCelsiusPerSecond >= oneDegreeCelsiusPerSecond); - - Assert.False(oneDegreeCelsiusPerSecond > twoDegreesCelsiusPerSecond); - Assert.False(oneDegreeCelsiusPerSecond >= twoDegreesCelsiusPerSecond); - Assert.False(twoDegreesCelsiusPerSecond < oneDegreeCelsiusPerSecond); - Assert.False(twoDegreesCelsiusPerSecond <= oneDegreeCelsiusPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.Equal(0, degreecelsiuspersecond.CompareTo(degreecelsiuspersecond)); - Assert.True(degreecelsiuspersecond.CompareTo(TemperatureChangeRate.Zero) > 0); - Assert.True(TemperatureChangeRate.Zero.CompareTo(degreecelsiuspersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.Throws(() => degreecelsiuspersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.Throws(() => degreecelsiuspersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - TemperatureChangeRate v = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.True(v.Equals(TemperatureChangeRate.FromDegreesCelsiusPerSecond(1), DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(TemperatureChangeRate.Zero, DegreesCelsiusPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.False(degreecelsiuspersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - TemperatureChangeRate degreecelsiuspersecond = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1); - Assert.False(degreecelsiuspersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(TemperatureChangeRateUnit.Undefined, TemperatureChangeRate.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(TemperatureChangeRateUnit)).Cast(); - foreach(var unit in units) - { - if(unit == TemperatureChangeRateUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs deleted file mode 100644 index a5bcad847b..0000000000 --- a/UnitsNet.Tests/GeneratedCode/TemperatureDeltaTestsBase.g.cs +++ /dev/null @@ -1,294 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of TemperatureDelta. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class TemperatureDeltaTestsBase - { - protected abstract double DegreesCelsiusInOneKelvin { get; } - protected abstract double DegreesDelisleInOneKelvin { get; } - protected abstract double DegreesFahrenheitInOneKelvin { get; } - protected abstract double DegreesNewtonInOneKelvin { get; } - protected abstract double DegreesRankineInOneKelvin { get; } - protected abstract double DegreesReaumurInOneKelvin { get; } - protected abstract double DegreesRoemerInOneKelvin { get; } - protected abstract double KelvinsInOneKelvin { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DegreesCelsiusTolerance { get { return 1e-5; } } - protected virtual double DegreesDelisleTolerance { get { return 1e-5; } } - protected virtual double DegreesFahrenheitTolerance { get { return 1e-5; } } - protected virtual double DegreesNewtonTolerance { get { return 1e-5; } } - protected virtual double DegreesRankineTolerance { get { return 1e-5; } } - protected virtual double DegreesReaumurTolerance { get { return 1e-5; } } - protected virtual double DegreesRoemerTolerance { get { return 1e-5; } } - protected virtual double KelvinsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new TemperatureDelta((double)0.0, TemperatureDeltaUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new TemperatureDelta(double.PositiveInfinity, TemperatureDeltaUnit.Kelvin)); - Assert.Throws(() => new TemperatureDelta(double.NegativeInfinity, TemperatureDeltaUnit.Kelvin)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new TemperatureDelta(double.NaN, TemperatureDeltaUnit.Kelvin)); - } - - [Fact] - public void KelvinToTemperatureDeltaUnits() - { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, kelvin.DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(DegreesRankineInOneKelvin, kelvin.DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, kelvin.DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, kelvin.DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(KelvinsInOneKelvin, kelvin.Kelvins, KelvinsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance); - } - - [Fact] - public void FromKelvins_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => TemperatureDelta.FromKelvins(double.PositiveInfinity)); - Assert.Throws(() => TemperatureDelta.FromKelvins(double.NegativeInfinity)); - } - - [Fact] - public void FromKelvins_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => TemperatureDelta.FromKelvins(double.NaN)); - } - - [Fact] - public void As() - { - var kelvin = TemperatureDelta.FromKelvins(1); - AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeCelsius), DegreesCelsiusTolerance); - AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeDelisle), DegreesDelisleTolerance); - AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeFahrenheit), DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeNewton), DegreesNewtonTolerance); - AssertEx.EqualTolerance(DegreesRankineInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeRankine), DegreesRankineTolerance); - AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeReaumur), DegreesReaumurTolerance); - AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, kelvin.As(TemperatureDeltaUnit.DegreeRoemer), DegreesRoemerTolerance); - AssertEx.EqualTolerance(KelvinsInOneKelvin, kelvin.As(TemperatureDeltaUnit.Kelvin), KelvinsTolerance); - } - - [Fact] - public void ToUnit() - { - var kelvin = TemperatureDelta.FromKelvins(1); - - var degreecelsiusQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeCelsius); - AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, (double)degreecelsiusQuantity.Value, DegreesCelsiusTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeCelsius, degreecelsiusQuantity.Unit); - - var degreedelisleQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeDelisle); - AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, (double)degreedelisleQuantity.Value, DegreesDelisleTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeDelisle, degreedelisleQuantity.Unit); - - var degreefahrenheitQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeFahrenheit); - AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, (double)degreefahrenheitQuantity.Value, DegreesFahrenheitTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeFahrenheit, degreefahrenheitQuantity.Unit); - - var degreenewtonQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeNewton); - AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, (double)degreenewtonQuantity.Value, DegreesNewtonTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeNewton, degreenewtonQuantity.Unit); - - var degreerankineQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeRankine); - AssertEx.EqualTolerance(DegreesRankineInOneKelvin, (double)degreerankineQuantity.Value, DegreesRankineTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeRankine, degreerankineQuantity.Unit); - - var degreereaumurQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeReaumur); - AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, (double)degreereaumurQuantity.Value, DegreesReaumurTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeReaumur, degreereaumurQuantity.Unit); - - var degreeroemerQuantity = kelvin.ToUnit(TemperatureDeltaUnit.DegreeRoemer); - AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, (double)degreeroemerQuantity.Value, DegreesRoemerTolerance); - Assert.Equal(TemperatureDeltaUnit.DegreeRoemer, degreeroemerQuantity.Unit); - - var kelvinQuantity = kelvin.ToUnit(TemperatureDeltaUnit.Kelvin); - AssertEx.EqualTolerance(KelvinsInOneKelvin, (double)kelvinQuantity.Value, KelvinsTolerance); - Assert.Equal(TemperatureDeltaUnit.Kelvin, kelvinQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesCelsius(kelvin.DegreesCelsius).Kelvins, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesDelisle(kelvin.DegreesDelisle).Kelvins, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesFahrenheit(kelvin.DegreesFahrenheit).Kelvins, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesNewton(kelvin.DegreesNewton).Kelvins, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRankine(kelvin.DegreesRankine).Kelvins, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesReaumur(kelvin.DegreesReaumur).Kelvins, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromDegreesRoemer(kelvin.DegreesRoemer).Kelvins, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, TemperatureDelta.FromKelvins(kelvin.Kelvins).Kelvins, KelvinsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - TemperatureDelta v = TemperatureDelta.FromKelvins(1); - AssertEx.EqualTolerance(-1, -v.Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(2, (TemperatureDelta.FromKelvins(3)-v).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(2, (v + v).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(10, (v*10).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(10, (10*v).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(2, (TemperatureDelta.FromKelvins(10)/5).Kelvins, KelvinsTolerance); - AssertEx.EqualTolerance(2, TemperatureDelta.FromKelvins(10)/TemperatureDelta.FromKelvins(5), KelvinsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - TemperatureDelta oneKelvin = TemperatureDelta.FromKelvins(1); - TemperatureDelta twoKelvins = TemperatureDelta.FromKelvins(2); - - Assert.True(oneKelvin < twoKelvins); - Assert.True(oneKelvin <= twoKelvins); - Assert.True(twoKelvins > oneKelvin); - Assert.True(twoKelvins >= oneKelvin); - - Assert.False(oneKelvin > twoKelvins); - Assert.False(oneKelvin >= twoKelvins); - Assert.False(twoKelvins < oneKelvin); - Assert.False(twoKelvins <= oneKelvin); - } - - [Fact] - public void CompareToIsImplemented() - { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - Assert.Equal(0, kelvin.CompareTo(kelvin)); - Assert.True(kelvin.CompareTo(TemperatureDelta.Zero) > 0); - Assert.True(TemperatureDelta.Zero.CompareTo(kelvin) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - Assert.Throws(() => kelvin.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - Assert.Throws(() => kelvin.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - TemperatureDelta v = TemperatureDelta.FromKelvins(1); - Assert.True(v.Equals(TemperatureDelta.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(TemperatureDelta.Zero, KelvinsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - Assert.False(kelvin.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - TemperatureDelta kelvin = TemperatureDelta.FromKelvins(1); - Assert.False(kelvin.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(TemperatureDeltaUnit.Undefined, TemperatureDelta.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(TemperatureDeltaUnit)).Cast(); - foreach(var unit in units) - { - if(unit == TemperatureDeltaUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs deleted file mode 100644 index d16929aaa9..0000000000 --- a/UnitsNet.Tests/GeneratedCode/TemperatureTestsBase.g.cs +++ /dev/null @@ -1,282 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Temperature. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class TemperatureTestsBase - { - protected abstract double DegreesCelsiusInOneKelvin { get; } - protected abstract double DegreesDelisleInOneKelvin { get; } - protected abstract double DegreesFahrenheitInOneKelvin { get; } - protected abstract double DegreesNewtonInOneKelvin { get; } - protected abstract double DegreesRankineInOneKelvin { get; } - protected abstract double DegreesReaumurInOneKelvin { get; } - protected abstract double DegreesRoemerInOneKelvin { get; } - protected abstract double KelvinsInOneKelvin { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double DegreesCelsiusTolerance { get { return 1e-5; } } - protected virtual double DegreesDelisleTolerance { get { return 1e-5; } } - protected virtual double DegreesFahrenheitTolerance { get { return 1e-5; } } - protected virtual double DegreesNewtonTolerance { get { return 1e-5; } } - protected virtual double DegreesRankineTolerance { get { return 1e-5; } } - protected virtual double DegreesReaumurTolerance { get { return 1e-5; } } - protected virtual double DegreesRoemerTolerance { get { return 1e-5; } } - protected virtual double KelvinsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Temperature((double)0.0, TemperatureUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Temperature(double.PositiveInfinity, TemperatureUnit.Kelvin)); - Assert.Throws(() => new Temperature(double.NegativeInfinity, TemperatureUnit.Kelvin)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Temperature(double.NaN, TemperatureUnit.Kelvin)); - } - - [Fact] - public void KelvinToTemperatureUnits() - { - Temperature kelvin = Temperature.FromKelvins(1); - AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, kelvin.DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(DegreesRankineInOneKelvin, kelvin.DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, kelvin.DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, kelvin.DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(KelvinsInOneKelvin, kelvin.Kelvins, KelvinsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, Temperature.From(1, TemperatureUnit.Kelvin).Kelvins, KelvinsTolerance); - } - - [Fact] - public void FromKelvins_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Temperature.FromKelvins(double.PositiveInfinity)); - Assert.Throws(() => Temperature.FromKelvins(double.NegativeInfinity)); - } - - [Fact] - public void FromKelvins_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Temperature.FromKelvins(double.NaN)); - } - - [Fact] - public void As() - { - var kelvin = Temperature.FromKelvins(1); - AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, kelvin.As(TemperatureUnit.DegreeCelsius), DegreesCelsiusTolerance); - AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, kelvin.As(TemperatureUnit.DegreeDelisle), DegreesDelisleTolerance); - AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, kelvin.As(TemperatureUnit.DegreeFahrenheit), DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, kelvin.As(TemperatureUnit.DegreeNewton), DegreesNewtonTolerance); - AssertEx.EqualTolerance(DegreesRankineInOneKelvin, kelvin.As(TemperatureUnit.DegreeRankine), DegreesRankineTolerance); - AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, kelvin.As(TemperatureUnit.DegreeReaumur), DegreesReaumurTolerance); - AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, kelvin.As(TemperatureUnit.DegreeRoemer), DegreesRoemerTolerance); - AssertEx.EqualTolerance(KelvinsInOneKelvin, kelvin.As(TemperatureUnit.Kelvin), KelvinsTolerance); - } - - [Fact] - public void ToUnit() - { - var kelvin = Temperature.FromKelvins(1); - - var degreecelsiusQuantity = kelvin.ToUnit(TemperatureUnit.DegreeCelsius); - AssertEx.EqualTolerance(DegreesCelsiusInOneKelvin, (double)degreecelsiusQuantity.Value, DegreesCelsiusTolerance); - Assert.Equal(TemperatureUnit.DegreeCelsius, degreecelsiusQuantity.Unit); - - var degreedelisleQuantity = kelvin.ToUnit(TemperatureUnit.DegreeDelisle); - AssertEx.EqualTolerance(DegreesDelisleInOneKelvin, (double)degreedelisleQuantity.Value, DegreesDelisleTolerance); - Assert.Equal(TemperatureUnit.DegreeDelisle, degreedelisleQuantity.Unit); - - var degreefahrenheitQuantity = kelvin.ToUnit(TemperatureUnit.DegreeFahrenheit); - AssertEx.EqualTolerance(DegreesFahrenheitInOneKelvin, (double)degreefahrenheitQuantity.Value, DegreesFahrenheitTolerance); - Assert.Equal(TemperatureUnit.DegreeFahrenheit, degreefahrenheitQuantity.Unit); - - var degreenewtonQuantity = kelvin.ToUnit(TemperatureUnit.DegreeNewton); - AssertEx.EqualTolerance(DegreesNewtonInOneKelvin, (double)degreenewtonQuantity.Value, DegreesNewtonTolerance); - Assert.Equal(TemperatureUnit.DegreeNewton, degreenewtonQuantity.Unit); - - var degreerankineQuantity = kelvin.ToUnit(TemperatureUnit.DegreeRankine); - AssertEx.EqualTolerance(DegreesRankineInOneKelvin, (double)degreerankineQuantity.Value, DegreesRankineTolerance); - Assert.Equal(TemperatureUnit.DegreeRankine, degreerankineQuantity.Unit); - - var degreereaumurQuantity = kelvin.ToUnit(TemperatureUnit.DegreeReaumur); - AssertEx.EqualTolerance(DegreesReaumurInOneKelvin, (double)degreereaumurQuantity.Value, DegreesReaumurTolerance); - Assert.Equal(TemperatureUnit.DegreeReaumur, degreereaumurQuantity.Unit); - - var degreeroemerQuantity = kelvin.ToUnit(TemperatureUnit.DegreeRoemer); - AssertEx.EqualTolerance(DegreesRoemerInOneKelvin, (double)degreeroemerQuantity.Value, DegreesRoemerTolerance); - Assert.Equal(TemperatureUnit.DegreeRoemer, degreeroemerQuantity.Unit); - - var kelvinQuantity = kelvin.ToUnit(TemperatureUnit.Kelvin); - AssertEx.EqualTolerance(KelvinsInOneKelvin, (double)kelvinQuantity.Value, KelvinsTolerance); - Assert.Equal(TemperatureUnit.Kelvin, kelvinQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Temperature kelvin = Temperature.FromKelvins(1); - AssertEx.EqualTolerance(1, Temperature.FromDegreesCelsius(kelvin.DegreesCelsius).Kelvins, DegreesCelsiusTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesDelisle(kelvin.DegreesDelisle).Kelvins, DegreesDelisleTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesFahrenheit(kelvin.DegreesFahrenheit).Kelvins, DegreesFahrenheitTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesNewton(kelvin.DegreesNewton).Kelvins, DegreesNewtonTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesRankine(kelvin.DegreesRankine).Kelvins, DegreesRankineTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesReaumur(kelvin.DegreesReaumur).Kelvins, DegreesReaumurTolerance); - AssertEx.EqualTolerance(1, Temperature.FromDegreesRoemer(kelvin.DegreesRoemer).Kelvins, DegreesRoemerTolerance); - AssertEx.EqualTolerance(1, Temperature.FromKelvins(kelvin.Kelvins).Kelvins, KelvinsTolerance); - } - - - [Fact] - public void ComparisonOperators() - { - Temperature oneKelvin = Temperature.FromKelvins(1); - Temperature twoKelvins = Temperature.FromKelvins(2); - - Assert.True(oneKelvin < twoKelvins); - Assert.True(oneKelvin <= twoKelvins); - Assert.True(twoKelvins > oneKelvin); - Assert.True(twoKelvins >= oneKelvin); - - Assert.False(oneKelvin > twoKelvins); - Assert.False(oneKelvin >= twoKelvins); - Assert.False(twoKelvins < oneKelvin); - Assert.False(twoKelvins <= oneKelvin); - } - - [Fact] - public void CompareToIsImplemented() - { - Temperature kelvin = Temperature.FromKelvins(1); - Assert.Equal(0, kelvin.CompareTo(kelvin)); - Assert.True(kelvin.CompareTo(Temperature.Zero) > 0); - Assert.True(Temperature.Zero.CompareTo(kelvin) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Temperature kelvin = Temperature.FromKelvins(1); - Assert.Throws(() => kelvin.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Temperature kelvin = Temperature.FromKelvins(1); - Assert.Throws(() => kelvin.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Temperature v = Temperature.FromKelvins(1); - Assert.True(v.Equals(Temperature.FromKelvins(1), KelvinsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Temperature.Zero, KelvinsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Temperature kelvin = Temperature.FromKelvins(1); - Assert.False(kelvin.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Temperature kelvin = Temperature.FromKelvins(1); - Assert.False(kelvin.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(TemperatureUnit.Undefined, Temperature.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(TemperatureUnit)).Cast(); - foreach(var unit in units) - { - if(unit == TemperatureUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs deleted file mode 100644 index e7c5d0d8ab..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ThermalConductivityTestsBase.g.cs +++ /dev/null @@ -1,234 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ThermalConductivity. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ThermalConductivityTestsBase - { - protected abstract double BtusPerHourFootFahrenheitInOneWattPerMeterKelvin { get; } - protected abstract double WattsPerMeterKelvinInOneWattPerMeterKelvin { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double BtusPerHourFootFahrenheitTolerance { get { return 1e-5; } } - protected virtual double WattsPerMeterKelvinTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ThermalConductivity((double)0.0, ThermalConductivityUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ThermalConductivity(double.PositiveInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); - Assert.Throws(() => new ThermalConductivity(double.NegativeInfinity, ThermalConductivityUnit.WattPerMeterKelvin)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ThermalConductivity(double.NaN, ThermalConductivityUnit.WattPerMeterKelvin)); - } - - [Fact] - public void WattPerMeterKelvinToThermalConductivityUnits() - { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - AssertEx.EqualTolerance(BtusPerHourFootFahrenheitInOneWattPerMeterKelvin, wattpermeterkelvin.BtusPerHourFootFahrenheit, BtusPerHourFootFahrenheitTolerance); - AssertEx.EqualTolerance(WattsPerMeterKelvinInOneWattPerMeterKelvin, wattpermeterkelvin.WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.BtuPerHourFootFahrenheit).BtusPerHourFootFahrenheit, BtusPerHourFootFahrenheitTolerance); - AssertEx.EqualTolerance(1, ThermalConductivity.From(1, ThermalConductivityUnit.WattPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - } - - [Fact] - public void FromWattsPerMeterKelvin_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.PositiveInfinity)); - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NegativeInfinity)); - } - - [Fact] - public void FromWattsPerMeterKelvin_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ThermalConductivity.FromWattsPerMeterKelvin(double.NaN)); - } - - [Fact] - public void As() - { - var wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - AssertEx.EqualTolerance(BtusPerHourFootFahrenheitInOneWattPerMeterKelvin, wattpermeterkelvin.As(ThermalConductivityUnit.BtuPerHourFootFahrenheit), BtusPerHourFootFahrenheitTolerance); - AssertEx.EqualTolerance(WattsPerMeterKelvinInOneWattPerMeterKelvin, wattpermeterkelvin.As(ThermalConductivityUnit.WattPerMeterKelvin), WattsPerMeterKelvinTolerance); - } - - [Fact] - public void ToUnit() - { - var wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - - var btuperhourfootfahrenheitQuantity = wattpermeterkelvin.ToUnit(ThermalConductivityUnit.BtuPerHourFootFahrenheit); - AssertEx.EqualTolerance(BtusPerHourFootFahrenheitInOneWattPerMeterKelvin, (double)btuperhourfootfahrenheitQuantity.Value, BtusPerHourFootFahrenheitTolerance); - Assert.Equal(ThermalConductivityUnit.BtuPerHourFootFahrenheit, btuperhourfootfahrenheitQuantity.Unit); - - var wattpermeterkelvinQuantity = wattpermeterkelvin.ToUnit(ThermalConductivityUnit.WattPerMeterKelvin); - AssertEx.EqualTolerance(WattsPerMeterKelvinInOneWattPerMeterKelvin, (double)wattpermeterkelvinQuantity.Value, WattsPerMeterKelvinTolerance); - Assert.Equal(ThermalConductivityUnit.WattPerMeterKelvin, wattpermeterkelvinQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - AssertEx.EqualTolerance(1, ThermalConductivity.FromBtusPerHourFootFahrenheit(wattpermeterkelvin.BtusPerHourFootFahrenheit).WattsPerMeterKelvin, BtusPerHourFootFahrenheitTolerance); - AssertEx.EqualTolerance(1, ThermalConductivity.FromWattsPerMeterKelvin(wattpermeterkelvin.WattsPerMeterKelvin).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ThermalConductivity v = ThermalConductivity.FromWattsPerMeterKelvin(1); - AssertEx.EqualTolerance(-1, -v.WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (ThermalConductivity.FromWattsPerMeterKelvin(3)-v).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (v + v).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - AssertEx.EqualTolerance(10, (v*10).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - AssertEx.EqualTolerance(10, (10*v).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - AssertEx.EqualTolerance(2, (ThermalConductivity.FromWattsPerMeterKelvin(10)/5).WattsPerMeterKelvin, WattsPerMeterKelvinTolerance); - AssertEx.EqualTolerance(2, ThermalConductivity.FromWattsPerMeterKelvin(10)/ThermalConductivity.FromWattsPerMeterKelvin(5), WattsPerMeterKelvinTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ThermalConductivity oneWattPerMeterKelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - ThermalConductivity twoWattsPerMeterKelvin = ThermalConductivity.FromWattsPerMeterKelvin(2); - - Assert.True(oneWattPerMeterKelvin < twoWattsPerMeterKelvin); - Assert.True(oneWattPerMeterKelvin <= twoWattsPerMeterKelvin); - Assert.True(twoWattsPerMeterKelvin > oneWattPerMeterKelvin); - Assert.True(twoWattsPerMeterKelvin >= oneWattPerMeterKelvin); - - Assert.False(oneWattPerMeterKelvin > twoWattsPerMeterKelvin); - Assert.False(oneWattPerMeterKelvin >= twoWattsPerMeterKelvin); - Assert.False(twoWattsPerMeterKelvin < oneWattPerMeterKelvin); - Assert.False(twoWattsPerMeterKelvin <= oneWattPerMeterKelvin); - } - - [Fact] - public void CompareToIsImplemented() - { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.Equal(0, wattpermeterkelvin.CompareTo(wattpermeterkelvin)); - Assert.True(wattpermeterkelvin.CompareTo(ThermalConductivity.Zero) > 0); - Assert.True(ThermalConductivity.Zero.CompareTo(wattpermeterkelvin) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.Throws(() => wattpermeterkelvin.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.Throws(() => wattpermeterkelvin.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ThermalConductivity v = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.True(v.Equals(ThermalConductivity.FromWattsPerMeterKelvin(1), WattsPerMeterKelvinTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ThermalConductivity.Zero, WattsPerMeterKelvinTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.False(wattpermeterkelvin.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ThermalConductivity wattpermeterkelvin = ThermalConductivity.FromWattsPerMeterKelvin(1); - Assert.False(wattpermeterkelvin.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ThermalConductivityUnit.Undefined, ThermalConductivity.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ThermalConductivityUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs deleted file mode 100644 index 12b4acc98b..0000000000 --- a/UnitsNet.Tests/GeneratedCode/ThermalResistanceTestsBase.g.cs +++ /dev/null @@ -1,264 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of ThermalResistance. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class ThermalResistanceTestsBase - { - protected abstract double HourSquareFeetDegreesFahrenheitPerBtuInOneSquareMeterKelvinPerKilowatt { get; } - protected abstract double SquareCentimeterHourDegreesCelsiusPerKilocalorieInOneSquareMeterKelvinPerKilowatt { get; } - protected abstract double SquareCentimeterKelvinsPerWattInOneSquareMeterKelvinPerKilowatt { get; } - protected abstract double SquareMeterDegreesCelsiusPerWattInOneSquareMeterKelvinPerKilowatt { get; } - protected abstract double SquareMeterKelvinsPerKilowattInOneSquareMeterKelvinPerKilowatt { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double HourSquareFeetDegreesFahrenheitPerBtuTolerance { get { return 1e-5; } } - protected virtual double SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance { get { return 1e-5; } } - protected virtual double SquareCentimeterKelvinsPerWattTolerance { get { return 1e-5; } } - protected virtual double SquareMeterDegreesCelsiusPerWattTolerance { get { return 1e-5; } } - protected virtual double SquareMeterKelvinsPerKilowattTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new ThermalResistance((double)0.0, ThermalResistanceUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new ThermalResistance(double.PositiveInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); - Assert.Throws(() => new ThermalResistance(double.NegativeInfinity, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new ThermalResistance(double.NaN, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt)); - } - - [Fact] - public void SquareMeterKelvinPerKilowattToThermalResistanceUnits() - { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - AssertEx.EqualTolerance(HourSquareFeetDegreesFahrenheitPerBtuInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.HourSquareFeetDegreesFahrenheitPerBtu, HourSquareFeetDegreesFahrenheitPerBtuTolerance); - AssertEx.EqualTolerance(SquareCentimeterHourDegreesCelsiusPerKilocalorieInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.SquareCentimeterHourDegreesCelsiusPerKilocalorie, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); - AssertEx.EqualTolerance(SquareCentimeterKelvinsPerWattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.SquareCentimeterKelvinsPerWatt, SquareCentimeterKelvinsPerWattTolerance); - AssertEx.EqualTolerance(SquareMeterDegreesCelsiusPerWattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.SquareMeterDegreesCelsiusPerWatt, SquareMeterDegreesCelsiusPerWattTolerance); - AssertEx.EqualTolerance(SquareMeterKelvinsPerKilowattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu).HourSquareFeetDegreesFahrenheitPerBtu, HourSquareFeetDegreesFahrenheitPerBtuTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie).SquareCentimeterHourDegreesCelsiusPerKilocalorie, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt).SquareCentimeterKelvinsPerWatt, SquareCentimeterKelvinsPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt).SquareMeterDegreesCelsiusPerWatt, SquareMeterDegreesCelsiusPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.From(1, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - } - - [Fact] - public void FromSquareMeterKelvinsPerKilowatt_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.PositiveInfinity)); - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NegativeInfinity)); - } - - [Fact] - public void FromSquareMeterKelvinsPerKilowatt_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => ThermalResistance.FromSquareMeterKelvinsPerKilowatt(double.NaN)); - } - - [Fact] - public void As() - { - var squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - AssertEx.EqualTolerance(HourSquareFeetDegreesFahrenheitPerBtuInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu), HourSquareFeetDegreesFahrenheitPerBtuTolerance); - AssertEx.EqualTolerance(SquareCentimeterHourDegreesCelsiusPerKilocalorieInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie), SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); - AssertEx.EqualTolerance(SquareCentimeterKelvinsPerWattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt), SquareCentimeterKelvinsPerWattTolerance); - AssertEx.EqualTolerance(SquareMeterDegreesCelsiusPerWattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt), SquareMeterDegreesCelsiusPerWattTolerance); - AssertEx.EqualTolerance(SquareMeterKelvinsPerKilowattInOneSquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowatt.As(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt), SquareMeterKelvinsPerKilowattTolerance); - } - - [Fact] - public void ToUnit() - { - var squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - - var hoursquarefeetdegreefahrenheitperbtuQuantity = squaremeterkelvinperkilowatt.ToUnit(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); - AssertEx.EqualTolerance(HourSquareFeetDegreesFahrenheitPerBtuInOneSquareMeterKelvinPerKilowatt, (double)hoursquarefeetdegreefahrenheitperbtuQuantity.Value, HourSquareFeetDegreesFahrenheitPerBtuTolerance); - Assert.Equal(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, hoursquarefeetdegreefahrenheitperbtuQuantity.Unit); - - var squarecentimeterhourdegreecelsiusperkilocalorieQuantity = squaremeterkelvinperkilowatt.ToUnit(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); - AssertEx.EqualTolerance(SquareCentimeterHourDegreesCelsiusPerKilocalorieInOneSquareMeterKelvinPerKilowatt, (double)squarecentimeterhourdegreecelsiusperkilocalorieQuantity.Value, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); - Assert.Equal(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, squarecentimeterhourdegreecelsiusperkilocalorieQuantity.Unit); - - var squarecentimeterkelvinperwattQuantity = squaremeterkelvinperkilowatt.ToUnit(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); - AssertEx.EqualTolerance(SquareCentimeterKelvinsPerWattInOneSquareMeterKelvinPerKilowatt, (double)squarecentimeterkelvinperwattQuantity.Value, SquareCentimeterKelvinsPerWattTolerance); - Assert.Equal(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, squarecentimeterkelvinperwattQuantity.Unit); - - var squaremeterdegreecelsiusperwattQuantity = squaremeterkelvinperkilowatt.ToUnit(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); - AssertEx.EqualTolerance(SquareMeterDegreesCelsiusPerWattInOneSquareMeterKelvinPerKilowatt, (double)squaremeterdegreecelsiusperwattQuantity.Value, SquareMeterDegreesCelsiusPerWattTolerance); - Assert.Equal(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, squaremeterdegreecelsiusperwattQuantity.Unit); - - var squaremeterkelvinperkilowattQuantity = squaremeterkelvinperkilowatt.ToUnit(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); - AssertEx.EqualTolerance(SquareMeterKelvinsPerKilowattInOneSquareMeterKelvinPerKilowatt, (double)squaremeterkelvinperkilowattQuantity.Value, SquareMeterKelvinsPerKilowattTolerance); - Assert.Equal(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, squaremeterkelvinperkilowattQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - AssertEx.EqualTolerance(1, ThermalResistance.FromHourSquareFeetDegreesFahrenheitPerBtu(squaremeterkelvinperkilowatt.HourSquareFeetDegreesFahrenheitPerBtu).SquareMeterKelvinsPerKilowatt, HourSquareFeetDegreesFahrenheitPerBtuTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(squaremeterkelvinperkilowatt.SquareCentimeterHourDegreesCelsiusPerKilocalorie).SquareMeterKelvinsPerKilowatt, SquareCentimeterHourDegreesCelsiusPerKilocalorieTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareCentimeterKelvinsPerWatt(squaremeterkelvinperkilowatt.SquareCentimeterKelvinsPerWatt).SquareMeterKelvinsPerKilowatt, SquareCentimeterKelvinsPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareMeterDegreesCelsiusPerWatt(squaremeterkelvinperkilowatt.SquareMeterDegreesCelsiusPerWatt).SquareMeterKelvinsPerKilowatt, SquareMeterDegreesCelsiusPerWattTolerance); - AssertEx.EqualTolerance(1, ThermalResistance.FromSquareMeterKelvinsPerKilowatt(squaremeterkelvinperkilowatt.SquareMeterKelvinsPerKilowatt).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - ThermalResistance v = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - AssertEx.EqualTolerance(-1, -v.SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(2, (ThermalResistance.FromSquareMeterKelvinsPerKilowatt(3)-v).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(2, (v + v).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(10, (v*10).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(10, (10*v).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(2, (ThermalResistance.FromSquareMeterKelvinsPerKilowatt(10)/5).SquareMeterKelvinsPerKilowatt, SquareMeterKelvinsPerKilowattTolerance); - AssertEx.EqualTolerance(2, ThermalResistance.FromSquareMeterKelvinsPerKilowatt(10)/ThermalResistance.FromSquareMeterKelvinsPerKilowatt(5), SquareMeterKelvinsPerKilowattTolerance); - } - - [Fact] - public void ComparisonOperators() - { - ThermalResistance oneSquareMeterKelvinPerKilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - ThermalResistance twoSquareMeterKelvinsPerKilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(2); - - Assert.True(oneSquareMeterKelvinPerKilowatt < twoSquareMeterKelvinsPerKilowatt); - Assert.True(oneSquareMeterKelvinPerKilowatt <= twoSquareMeterKelvinsPerKilowatt); - Assert.True(twoSquareMeterKelvinsPerKilowatt > oneSquareMeterKelvinPerKilowatt); - Assert.True(twoSquareMeterKelvinsPerKilowatt >= oneSquareMeterKelvinPerKilowatt); - - Assert.False(oneSquareMeterKelvinPerKilowatt > twoSquareMeterKelvinsPerKilowatt); - Assert.False(oneSquareMeterKelvinPerKilowatt >= twoSquareMeterKelvinsPerKilowatt); - Assert.False(twoSquareMeterKelvinsPerKilowatt < oneSquareMeterKelvinPerKilowatt); - Assert.False(twoSquareMeterKelvinsPerKilowatt <= oneSquareMeterKelvinPerKilowatt); - } - - [Fact] - public void CompareToIsImplemented() - { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.Equal(0, squaremeterkelvinperkilowatt.CompareTo(squaremeterkelvinperkilowatt)); - Assert.True(squaremeterkelvinperkilowatt.CompareTo(ThermalResistance.Zero) > 0); - Assert.True(ThermalResistance.Zero.CompareTo(squaremeterkelvinperkilowatt) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.Throws(() => squaremeterkelvinperkilowatt.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.Throws(() => squaremeterkelvinperkilowatt.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - ThermalResistance v = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.True(v.Equals(ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1), SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(ThermalResistance.Zero, SquareMeterKelvinsPerKilowattTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.False(squaremeterkelvinperkilowatt.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - ThermalResistance squaremeterkelvinperkilowatt = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1); - Assert.False(squaremeterkelvinperkilowatt.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(ThermalResistanceUnit.Undefined, ThermalResistance.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(ThermalResistanceUnit)).Cast(); - foreach(var unit in units) - { - if(unit == ThermalResistanceUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs deleted file mode 100644 index 3bba357325..0000000000 --- a/UnitsNet.Tests/GeneratedCode/TorqueTestsBase.g.cs +++ /dev/null @@ -1,424 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Torque. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class TorqueTestsBase - { - protected abstract double KilogramForceCentimetersInOneNewtonMeter { get; } - protected abstract double KilogramForceMetersInOneNewtonMeter { get; } - protected abstract double KilogramForceMillimetersInOneNewtonMeter { get; } - protected abstract double KilonewtonCentimetersInOneNewtonMeter { get; } - protected abstract double KilonewtonMetersInOneNewtonMeter { get; } - protected abstract double KilonewtonMillimetersInOneNewtonMeter { get; } - protected abstract double KilopoundForceFeetInOneNewtonMeter { get; } - protected abstract double KilopoundForceInchesInOneNewtonMeter { get; } - protected abstract double MeganewtonCentimetersInOneNewtonMeter { get; } - protected abstract double MeganewtonMetersInOneNewtonMeter { get; } - protected abstract double MeganewtonMillimetersInOneNewtonMeter { get; } - protected abstract double MegapoundForceFeetInOneNewtonMeter { get; } - protected abstract double MegapoundForceInchesInOneNewtonMeter { get; } - protected abstract double NewtonCentimetersInOneNewtonMeter { get; } - protected abstract double NewtonMetersInOneNewtonMeter { get; } - protected abstract double NewtonMillimetersInOneNewtonMeter { get; } - protected abstract double PoundForceFeetInOneNewtonMeter { get; } - protected abstract double PoundForceInchesInOneNewtonMeter { get; } - protected abstract double TonneForceCentimetersInOneNewtonMeter { get; } - protected abstract double TonneForceMetersInOneNewtonMeter { get; } - protected abstract double TonneForceMillimetersInOneNewtonMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double KilogramForceCentimetersTolerance { get { return 1e-5; } } - protected virtual double KilogramForceMetersTolerance { get { return 1e-5; } } - protected virtual double KilogramForceMillimetersTolerance { get { return 1e-5; } } - protected virtual double KilonewtonCentimetersTolerance { get { return 1e-5; } } - protected virtual double KilonewtonMetersTolerance { get { return 1e-5; } } - protected virtual double KilonewtonMillimetersTolerance { get { return 1e-5; } } - protected virtual double KilopoundForceFeetTolerance { get { return 1e-5; } } - protected virtual double KilopoundForceInchesTolerance { get { return 1e-5; } } - protected virtual double MeganewtonCentimetersTolerance { get { return 1e-5; } } - protected virtual double MeganewtonMetersTolerance { get { return 1e-5; } } - protected virtual double MeganewtonMillimetersTolerance { get { return 1e-5; } } - protected virtual double MegapoundForceFeetTolerance { get { return 1e-5; } } - protected virtual double MegapoundForceInchesTolerance { get { return 1e-5; } } - protected virtual double NewtonCentimetersTolerance { get { return 1e-5; } } - protected virtual double NewtonMetersTolerance { get { return 1e-5; } } - protected virtual double NewtonMillimetersTolerance { get { return 1e-5; } } - protected virtual double PoundForceFeetTolerance { get { return 1e-5; } } - protected virtual double PoundForceInchesTolerance { get { return 1e-5; } } - protected virtual double TonneForceCentimetersTolerance { get { return 1e-5; } } - protected virtual double TonneForceMetersTolerance { get { return 1e-5; } } - protected virtual double TonneForceMillimetersTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Torque((double)0.0, TorqueUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Torque(double.PositiveInfinity, TorqueUnit.NewtonMeter)); - Assert.Throws(() => new Torque(double.NegativeInfinity, TorqueUnit.NewtonMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Torque(double.NaN, TorqueUnit.NewtonMeter)); - } - - [Fact] - public void NewtonMeterToTorqueUnits() - { - Torque newtonmeter = Torque.FromNewtonMeters(1); - AssertEx.EqualTolerance(KilogramForceCentimetersInOneNewtonMeter, newtonmeter.KilogramForceCentimeters, KilogramForceCentimetersTolerance); - AssertEx.EqualTolerance(KilogramForceMetersInOneNewtonMeter, newtonmeter.KilogramForceMeters, KilogramForceMetersTolerance); - AssertEx.EqualTolerance(KilogramForceMillimetersInOneNewtonMeter, newtonmeter.KilogramForceMillimeters, KilogramForceMillimetersTolerance); - AssertEx.EqualTolerance(KilonewtonCentimetersInOneNewtonMeter, newtonmeter.KilonewtonCentimeters, KilonewtonCentimetersTolerance); - AssertEx.EqualTolerance(KilonewtonMetersInOneNewtonMeter, newtonmeter.KilonewtonMeters, KilonewtonMetersTolerance); - AssertEx.EqualTolerance(KilonewtonMillimetersInOneNewtonMeter, newtonmeter.KilonewtonMillimeters, KilonewtonMillimetersTolerance); - AssertEx.EqualTolerance(KilopoundForceFeetInOneNewtonMeter, newtonmeter.KilopoundForceFeet, KilopoundForceFeetTolerance); - AssertEx.EqualTolerance(KilopoundForceInchesInOneNewtonMeter, newtonmeter.KilopoundForceInches, KilopoundForceInchesTolerance); - AssertEx.EqualTolerance(MeganewtonCentimetersInOneNewtonMeter, newtonmeter.MeganewtonCentimeters, MeganewtonCentimetersTolerance); - AssertEx.EqualTolerance(MeganewtonMetersInOneNewtonMeter, newtonmeter.MeganewtonMeters, MeganewtonMetersTolerance); - AssertEx.EqualTolerance(MeganewtonMillimetersInOneNewtonMeter, newtonmeter.MeganewtonMillimeters, MeganewtonMillimetersTolerance); - AssertEx.EqualTolerance(MegapoundForceFeetInOneNewtonMeter, newtonmeter.MegapoundForceFeet, MegapoundForceFeetTolerance); - AssertEx.EqualTolerance(MegapoundForceInchesInOneNewtonMeter, newtonmeter.MegapoundForceInches, MegapoundForceInchesTolerance); - AssertEx.EqualTolerance(NewtonCentimetersInOneNewtonMeter, newtonmeter.NewtonCentimeters, NewtonCentimetersTolerance); - AssertEx.EqualTolerance(NewtonMetersInOneNewtonMeter, newtonmeter.NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(NewtonMillimetersInOneNewtonMeter, newtonmeter.NewtonMillimeters, NewtonMillimetersTolerance); - AssertEx.EqualTolerance(PoundForceFeetInOneNewtonMeter, newtonmeter.PoundForceFeet, PoundForceFeetTolerance); - AssertEx.EqualTolerance(PoundForceInchesInOneNewtonMeter, newtonmeter.PoundForceInches, PoundForceInchesTolerance); - AssertEx.EqualTolerance(TonneForceCentimetersInOneNewtonMeter, newtonmeter.TonneForceCentimeters, TonneForceCentimetersTolerance); - AssertEx.EqualTolerance(TonneForceMetersInOneNewtonMeter, newtonmeter.TonneForceMeters, TonneForceMetersTolerance); - AssertEx.EqualTolerance(TonneForceMillimetersInOneNewtonMeter, newtonmeter.TonneForceMillimeters, TonneForceMillimetersTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceCentimeter).KilogramForceCentimeters, KilogramForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMeter).KilogramForceMeters, KilogramForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilogramForceMillimeter).KilogramForceMillimeters, KilogramForceMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonCentimeter).KilonewtonCentimeters, KilonewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMeter).KilonewtonMeters, KilonewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilonewtonMillimeter).KilonewtonMillimeters, KilonewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceFoot).KilopoundForceFeet, KilopoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.KilopoundForceInch).KilopoundForceInches, KilopoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonCentimeter).MeganewtonCentimeters, MeganewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonMeter).MeganewtonMeters, MeganewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MeganewtonMillimeter).MeganewtonMillimeters, MeganewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MegapoundForceFoot).MegapoundForceFeet, MegapoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.MegapoundForceInch).MegapoundForceInches, MegapoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonCentimeter).NewtonCentimeters, NewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMeter).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.NewtonMillimeter).NewtonMillimeters, NewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceFoot).PoundForceFeet, PoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.PoundForceInch).PoundForceInches, PoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceCentimeter).TonneForceCentimeters, TonneForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMeter).TonneForceMeters, TonneForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.From(1, TorqueUnit.TonneForceMillimeter).TonneForceMillimeters, TonneForceMillimetersTolerance); - } - - [Fact] - public void FromNewtonMeters_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Torque.FromNewtonMeters(double.PositiveInfinity)); - Assert.Throws(() => Torque.FromNewtonMeters(double.NegativeInfinity)); - } - - [Fact] - public void FromNewtonMeters_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Torque.FromNewtonMeters(double.NaN)); - } - - [Fact] - public void As() - { - var newtonmeter = Torque.FromNewtonMeters(1); - AssertEx.EqualTolerance(KilogramForceCentimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilogramForceCentimeter), KilogramForceCentimetersTolerance); - AssertEx.EqualTolerance(KilogramForceMetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilogramForceMeter), KilogramForceMetersTolerance); - AssertEx.EqualTolerance(KilogramForceMillimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilogramForceMillimeter), KilogramForceMillimetersTolerance); - AssertEx.EqualTolerance(KilonewtonCentimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilonewtonCentimeter), KilonewtonCentimetersTolerance); - AssertEx.EqualTolerance(KilonewtonMetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilonewtonMeter), KilonewtonMetersTolerance); - AssertEx.EqualTolerance(KilonewtonMillimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilonewtonMillimeter), KilonewtonMillimetersTolerance); - AssertEx.EqualTolerance(KilopoundForceFeetInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilopoundForceFoot), KilopoundForceFeetTolerance); - AssertEx.EqualTolerance(KilopoundForceInchesInOneNewtonMeter, newtonmeter.As(TorqueUnit.KilopoundForceInch), KilopoundForceInchesTolerance); - AssertEx.EqualTolerance(MeganewtonCentimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.MeganewtonCentimeter), MeganewtonCentimetersTolerance); - AssertEx.EqualTolerance(MeganewtonMetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.MeganewtonMeter), MeganewtonMetersTolerance); - AssertEx.EqualTolerance(MeganewtonMillimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.MeganewtonMillimeter), MeganewtonMillimetersTolerance); - AssertEx.EqualTolerance(MegapoundForceFeetInOneNewtonMeter, newtonmeter.As(TorqueUnit.MegapoundForceFoot), MegapoundForceFeetTolerance); - AssertEx.EqualTolerance(MegapoundForceInchesInOneNewtonMeter, newtonmeter.As(TorqueUnit.MegapoundForceInch), MegapoundForceInchesTolerance); - AssertEx.EqualTolerance(NewtonCentimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.NewtonCentimeter), NewtonCentimetersTolerance); - AssertEx.EqualTolerance(NewtonMetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.NewtonMeter), NewtonMetersTolerance); - AssertEx.EqualTolerance(NewtonMillimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.NewtonMillimeter), NewtonMillimetersTolerance); - AssertEx.EqualTolerance(PoundForceFeetInOneNewtonMeter, newtonmeter.As(TorqueUnit.PoundForceFoot), PoundForceFeetTolerance); - AssertEx.EqualTolerance(PoundForceInchesInOneNewtonMeter, newtonmeter.As(TorqueUnit.PoundForceInch), PoundForceInchesTolerance); - AssertEx.EqualTolerance(TonneForceCentimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.TonneForceCentimeter), TonneForceCentimetersTolerance); - AssertEx.EqualTolerance(TonneForceMetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.TonneForceMeter), TonneForceMetersTolerance); - AssertEx.EqualTolerance(TonneForceMillimetersInOneNewtonMeter, newtonmeter.As(TorqueUnit.TonneForceMillimeter), TonneForceMillimetersTolerance); - } - - [Fact] - public void ToUnit() - { - var newtonmeter = Torque.FromNewtonMeters(1); - - var kilogramforcecentimeterQuantity = newtonmeter.ToUnit(TorqueUnit.KilogramForceCentimeter); - AssertEx.EqualTolerance(KilogramForceCentimetersInOneNewtonMeter, (double)kilogramforcecentimeterQuantity.Value, KilogramForceCentimetersTolerance); - Assert.Equal(TorqueUnit.KilogramForceCentimeter, kilogramforcecentimeterQuantity.Unit); - - var kilogramforcemeterQuantity = newtonmeter.ToUnit(TorqueUnit.KilogramForceMeter); - AssertEx.EqualTolerance(KilogramForceMetersInOneNewtonMeter, (double)kilogramforcemeterQuantity.Value, KilogramForceMetersTolerance); - Assert.Equal(TorqueUnit.KilogramForceMeter, kilogramforcemeterQuantity.Unit); - - var kilogramforcemillimeterQuantity = newtonmeter.ToUnit(TorqueUnit.KilogramForceMillimeter); - AssertEx.EqualTolerance(KilogramForceMillimetersInOneNewtonMeter, (double)kilogramforcemillimeterQuantity.Value, KilogramForceMillimetersTolerance); - Assert.Equal(TorqueUnit.KilogramForceMillimeter, kilogramforcemillimeterQuantity.Unit); - - var kilonewtoncentimeterQuantity = newtonmeter.ToUnit(TorqueUnit.KilonewtonCentimeter); - AssertEx.EqualTolerance(KilonewtonCentimetersInOneNewtonMeter, (double)kilonewtoncentimeterQuantity.Value, KilonewtonCentimetersTolerance); - Assert.Equal(TorqueUnit.KilonewtonCentimeter, kilonewtoncentimeterQuantity.Unit); - - var kilonewtonmeterQuantity = newtonmeter.ToUnit(TorqueUnit.KilonewtonMeter); - AssertEx.EqualTolerance(KilonewtonMetersInOneNewtonMeter, (double)kilonewtonmeterQuantity.Value, KilonewtonMetersTolerance); - Assert.Equal(TorqueUnit.KilonewtonMeter, kilonewtonmeterQuantity.Unit); - - var kilonewtonmillimeterQuantity = newtonmeter.ToUnit(TorqueUnit.KilonewtonMillimeter); - AssertEx.EqualTolerance(KilonewtonMillimetersInOneNewtonMeter, (double)kilonewtonmillimeterQuantity.Value, KilonewtonMillimetersTolerance); - Assert.Equal(TorqueUnit.KilonewtonMillimeter, kilonewtonmillimeterQuantity.Unit); - - var kilopoundforcefootQuantity = newtonmeter.ToUnit(TorqueUnit.KilopoundForceFoot); - AssertEx.EqualTolerance(KilopoundForceFeetInOneNewtonMeter, (double)kilopoundforcefootQuantity.Value, KilopoundForceFeetTolerance); - Assert.Equal(TorqueUnit.KilopoundForceFoot, kilopoundforcefootQuantity.Unit); - - var kilopoundforceinchQuantity = newtonmeter.ToUnit(TorqueUnit.KilopoundForceInch); - AssertEx.EqualTolerance(KilopoundForceInchesInOneNewtonMeter, (double)kilopoundforceinchQuantity.Value, KilopoundForceInchesTolerance); - Assert.Equal(TorqueUnit.KilopoundForceInch, kilopoundforceinchQuantity.Unit); - - var meganewtoncentimeterQuantity = newtonmeter.ToUnit(TorqueUnit.MeganewtonCentimeter); - AssertEx.EqualTolerance(MeganewtonCentimetersInOneNewtonMeter, (double)meganewtoncentimeterQuantity.Value, MeganewtonCentimetersTolerance); - Assert.Equal(TorqueUnit.MeganewtonCentimeter, meganewtoncentimeterQuantity.Unit); - - var meganewtonmeterQuantity = newtonmeter.ToUnit(TorqueUnit.MeganewtonMeter); - AssertEx.EqualTolerance(MeganewtonMetersInOneNewtonMeter, (double)meganewtonmeterQuantity.Value, MeganewtonMetersTolerance); - Assert.Equal(TorqueUnit.MeganewtonMeter, meganewtonmeterQuantity.Unit); - - var meganewtonmillimeterQuantity = newtonmeter.ToUnit(TorqueUnit.MeganewtonMillimeter); - AssertEx.EqualTolerance(MeganewtonMillimetersInOneNewtonMeter, (double)meganewtonmillimeterQuantity.Value, MeganewtonMillimetersTolerance); - Assert.Equal(TorqueUnit.MeganewtonMillimeter, meganewtonmillimeterQuantity.Unit); - - var megapoundforcefootQuantity = newtonmeter.ToUnit(TorqueUnit.MegapoundForceFoot); - AssertEx.EqualTolerance(MegapoundForceFeetInOneNewtonMeter, (double)megapoundforcefootQuantity.Value, MegapoundForceFeetTolerance); - Assert.Equal(TorqueUnit.MegapoundForceFoot, megapoundforcefootQuantity.Unit); - - var megapoundforceinchQuantity = newtonmeter.ToUnit(TorqueUnit.MegapoundForceInch); - AssertEx.EqualTolerance(MegapoundForceInchesInOneNewtonMeter, (double)megapoundforceinchQuantity.Value, MegapoundForceInchesTolerance); - Assert.Equal(TorqueUnit.MegapoundForceInch, megapoundforceinchQuantity.Unit); - - var newtoncentimeterQuantity = newtonmeter.ToUnit(TorqueUnit.NewtonCentimeter); - AssertEx.EqualTolerance(NewtonCentimetersInOneNewtonMeter, (double)newtoncentimeterQuantity.Value, NewtonCentimetersTolerance); - Assert.Equal(TorqueUnit.NewtonCentimeter, newtoncentimeterQuantity.Unit); - - var newtonmeterQuantity = newtonmeter.ToUnit(TorqueUnit.NewtonMeter); - AssertEx.EqualTolerance(NewtonMetersInOneNewtonMeter, (double)newtonmeterQuantity.Value, NewtonMetersTolerance); - Assert.Equal(TorqueUnit.NewtonMeter, newtonmeterQuantity.Unit); - - var newtonmillimeterQuantity = newtonmeter.ToUnit(TorqueUnit.NewtonMillimeter); - AssertEx.EqualTolerance(NewtonMillimetersInOneNewtonMeter, (double)newtonmillimeterQuantity.Value, NewtonMillimetersTolerance); - Assert.Equal(TorqueUnit.NewtonMillimeter, newtonmillimeterQuantity.Unit); - - var poundforcefootQuantity = newtonmeter.ToUnit(TorqueUnit.PoundForceFoot); - AssertEx.EqualTolerance(PoundForceFeetInOneNewtonMeter, (double)poundforcefootQuantity.Value, PoundForceFeetTolerance); - Assert.Equal(TorqueUnit.PoundForceFoot, poundforcefootQuantity.Unit); - - var poundforceinchQuantity = newtonmeter.ToUnit(TorqueUnit.PoundForceInch); - AssertEx.EqualTolerance(PoundForceInchesInOneNewtonMeter, (double)poundforceinchQuantity.Value, PoundForceInchesTolerance); - Assert.Equal(TorqueUnit.PoundForceInch, poundforceinchQuantity.Unit); - - var tonneforcecentimeterQuantity = newtonmeter.ToUnit(TorqueUnit.TonneForceCentimeter); - AssertEx.EqualTolerance(TonneForceCentimetersInOneNewtonMeter, (double)tonneforcecentimeterQuantity.Value, TonneForceCentimetersTolerance); - Assert.Equal(TorqueUnit.TonneForceCentimeter, tonneforcecentimeterQuantity.Unit); - - var tonneforcemeterQuantity = newtonmeter.ToUnit(TorqueUnit.TonneForceMeter); - AssertEx.EqualTolerance(TonneForceMetersInOneNewtonMeter, (double)tonneforcemeterQuantity.Value, TonneForceMetersTolerance); - Assert.Equal(TorqueUnit.TonneForceMeter, tonneforcemeterQuantity.Unit); - - var tonneforcemillimeterQuantity = newtonmeter.ToUnit(TorqueUnit.TonneForceMillimeter); - AssertEx.EqualTolerance(TonneForceMillimetersInOneNewtonMeter, (double)tonneforcemillimeterQuantity.Value, TonneForceMillimetersTolerance); - Assert.Equal(TorqueUnit.TonneForceMillimeter, tonneforcemillimeterQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Torque newtonmeter = Torque.FromNewtonMeters(1); - AssertEx.EqualTolerance(1, Torque.FromKilogramForceCentimeters(newtonmeter.KilogramForceCentimeters).NewtonMeters, KilogramForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilogramForceMeters(newtonmeter.KilogramForceMeters).NewtonMeters, KilogramForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilogramForceMillimeters(newtonmeter.KilogramForceMillimeters).NewtonMeters, KilogramForceMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilonewtonCentimeters(newtonmeter.KilonewtonCentimeters).NewtonMeters, KilonewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilonewtonMeters(newtonmeter.KilonewtonMeters).NewtonMeters, KilonewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilonewtonMillimeters(newtonmeter.KilonewtonMillimeters).NewtonMeters, KilonewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilopoundForceFeet(newtonmeter.KilopoundForceFeet).NewtonMeters, KilopoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.FromKilopoundForceInches(newtonmeter.KilopoundForceInches).NewtonMeters, KilopoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.FromMeganewtonCentimeters(newtonmeter.MeganewtonCentimeters).NewtonMeters, MeganewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromMeganewtonMeters(newtonmeter.MeganewtonMeters).NewtonMeters, MeganewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromMeganewtonMillimeters(newtonmeter.MeganewtonMillimeters).NewtonMeters, MeganewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromMegapoundForceFeet(newtonmeter.MegapoundForceFeet).NewtonMeters, MegapoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.FromMegapoundForceInches(newtonmeter.MegapoundForceInches).NewtonMeters, MegapoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.FromNewtonCentimeters(newtonmeter.NewtonCentimeters).NewtonMeters, NewtonCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromNewtonMeters(newtonmeter.NewtonMeters).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromNewtonMillimeters(newtonmeter.NewtonMillimeters).NewtonMeters, NewtonMillimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromPoundForceFeet(newtonmeter.PoundForceFeet).NewtonMeters, PoundForceFeetTolerance); - AssertEx.EqualTolerance(1, Torque.FromPoundForceInches(newtonmeter.PoundForceInches).NewtonMeters, PoundForceInchesTolerance); - AssertEx.EqualTolerance(1, Torque.FromTonneForceCentimeters(newtonmeter.TonneForceCentimeters).NewtonMeters, TonneForceCentimetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromTonneForceMeters(newtonmeter.TonneForceMeters).NewtonMeters, TonneForceMetersTolerance); - AssertEx.EqualTolerance(1, Torque.FromTonneForceMillimeters(newtonmeter.TonneForceMillimeters).NewtonMeters, TonneForceMillimetersTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Torque v = Torque.FromNewtonMeters(1); - AssertEx.EqualTolerance(-1, -v.NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(2, (Torque.FromNewtonMeters(3)-v).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(2, (v + v).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(10, (v*10).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(10, (10*v).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(2, (Torque.FromNewtonMeters(10)/5).NewtonMeters, NewtonMetersTolerance); - AssertEx.EqualTolerance(2, Torque.FromNewtonMeters(10)/Torque.FromNewtonMeters(5), NewtonMetersTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Torque oneNewtonMeter = Torque.FromNewtonMeters(1); - Torque twoNewtonMeters = Torque.FromNewtonMeters(2); - - Assert.True(oneNewtonMeter < twoNewtonMeters); - Assert.True(oneNewtonMeter <= twoNewtonMeters); - Assert.True(twoNewtonMeters > oneNewtonMeter); - Assert.True(twoNewtonMeters >= oneNewtonMeter); - - Assert.False(oneNewtonMeter > twoNewtonMeters); - Assert.False(oneNewtonMeter >= twoNewtonMeters); - Assert.False(twoNewtonMeters < oneNewtonMeter); - Assert.False(twoNewtonMeters <= oneNewtonMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Torque newtonmeter = Torque.FromNewtonMeters(1); - Assert.Equal(0, newtonmeter.CompareTo(newtonmeter)); - Assert.True(newtonmeter.CompareTo(Torque.Zero) > 0); - Assert.True(Torque.Zero.CompareTo(newtonmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Torque newtonmeter = Torque.FromNewtonMeters(1); - Assert.Throws(() => newtonmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Torque newtonmeter = Torque.FromNewtonMeters(1); - Assert.Throws(() => newtonmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Torque v = Torque.FromNewtonMeters(1); - Assert.True(v.Equals(Torque.FromNewtonMeters(1), NewtonMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Torque.Zero, NewtonMetersTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Torque newtonmeter = Torque.FromNewtonMeters(1); - Assert.False(newtonmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Torque newtonmeter = Torque.FromNewtonMeters(1); - Assert.False(newtonmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(TorqueUnit.Undefined, Torque.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(TorqueUnit)).Cast(); - foreach(var unit in units) - { - if(unit == TorqueUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs deleted file mode 100644 index 8558740f27..0000000000 --- a/UnitsNet.Tests/GeneratedCode/VitaminATestsBase.g.cs +++ /dev/null @@ -1,224 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of VitaminA. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class VitaminATestsBase - { - protected abstract double InternationalUnitsInOneInternationalUnit { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double InternationalUnitsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new VitaminA((double)0.0, VitaminAUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new VitaminA(double.PositiveInfinity, VitaminAUnit.InternationalUnit)); - Assert.Throws(() => new VitaminA(double.NegativeInfinity, VitaminAUnit.InternationalUnit)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new VitaminA(double.NaN, VitaminAUnit.InternationalUnit)); - } - - [Fact] - public void InternationalUnitToVitaminAUnits() - { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - AssertEx.EqualTolerance(InternationalUnitsInOneInternationalUnit, internationalunit.InternationalUnits, InternationalUnitsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, VitaminA.From(1, VitaminAUnit.InternationalUnit).InternationalUnits, InternationalUnitsTolerance); - } - - [Fact] - public void FromInternationalUnits_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => VitaminA.FromInternationalUnits(double.PositiveInfinity)); - Assert.Throws(() => VitaminA.FromInternationalUnits(double.NegativeInfinity)); - } - - [Fact] - public void FromInternationalUnits_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => VitaminA.FromInternationalUnits(double.NaN)); - } - - [Fact] - public void As() - { - var internationalunit = VitaminA.FromInternationalUnits(1); - AssertEx.EqualTolerance(InternationalUnitsInOneInternationalUnit, internationalunit.As(VitaminAUnit.InternationalUnit), InternationalUnitsTolerance); - } - - [Fact] - public void ToUnit() - { - var internationalunit = VitaminA.FromInternationalUnits(1); - - var internationalunitQuantity = internationalunit.ToUnit(VitaminAUnit.InternationalUnit); - AssertEx.EqualTolerance(InternationalUnitsInOneInternationalUnit, (double)internationalunitQuantity.Value, InternationalUnitsTolerance); - Assert.Equal(VitaminAUnit.InternationalUnit, internationalunitQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - AssertEx.EqualTolerance(1, VitaminA.FromInternationalUnits(internationalunit.InternationalUnits).InternationalUnits, InternationalUnitsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - VitaminA v = VitaminA.FromInternationalUnits(1); - AssertEx.EqualTolerance(-1, -v.InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(2, (VitaminA.FromInternationalUnits(3)-v).InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(2, (v + v).InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(10, (v*10).InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(10, (10*v).InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(2, (VitaminA.FromInternationalUnits(10)/5).InternationalUnits, InternationalUnitsTolerance); - AssertEx.EqualTolerance(2, VitaminA.FromInternationalUnits(10)/VitaminA.FromInternationalUnits(5), InternationalUnitsTolerance); - } - - [Fact] - public void ComparisonOperators() - { - VitaminA oneInternationalUnit = VitaminA.FromInternationalUnits(1); - VitaminA twoInternationalUnits = VitaminA.FromInternationalUnits(2); - - Assert.True(oneInternationalUnit < twoInternationalUnits); - Assert.True(oneInternationalUnit <= twoInternationalUnits); - Assert.True(twoInternationalUnits > oneInternationalUnit); - Assert.True(twoInternationalUnits >= oneInternationalUnit); - - Assert.False(oneInternationalUnit > twoInternationalUnits); - Assert.False(oneInternationalUnit >= twoInternationalUnits); - Assert.False(twoInternationalUnits < oneInternationalUnit); - Assert.False(twoInternationalUnits <= oneInternationalUnit); - } - - [Fact] - public void CompareToIsImplemented() - { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - Assert.Equal(0, internationalunit.CompareTo(internationalunit)); - Assert.True(internationalunit.CompareTo(VitaminA.Zero) > 0); - Assert.True(VitaminA.Zero.CompareTo(internationalunit) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - Assert.Throws(() => internationalunit.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - Assert.Throws(() => internationalunit.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - VitaminA v = VitaminA.FromInternationalUnits(1); - Assert.True(v.Equals(VitaminA.FromInternationalUnits(1), InternationalUnitsTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(VitaminA.Zero, InternationalUnitsTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - Assert.False(internationalunit.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - VitaminA internationalunit = VitaminA.FromInternationalUnits(1); - Assert.False(internationalunit.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(VitaminAUnit.Undefined, VitaminA.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(VitaminAUnit)).Cast(); - foreach(var unit in units) - { - if(unit == VitaminAUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs deleted file mode 100644 index 918bfb736d..0000000000 --- a/UnitsNet.Tests/GeneratedCode/VolumeFlowTestsBase.g.cs +++ /dev/null @@ -1,474 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of VolumeFlow. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class VolumeFlowTestsBase - { - protected abstract double CentilitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicDecimetersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicFeetPerHourInOneCubicMeterPerSecond { get; } - protected abstract double CubicFeetPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicFeetPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double CubicMetersPerHourInOneCubicMeterPerSecond { get; } - protected abstract double CubicMetersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicMetersPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double CubicYardsPerHourInOneCubicMeterPerSecond { get; } - protected abstract double CubicYardsPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double CubicYardsPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double DecilitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double KilolitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double LitersPerHourInOneCubicMeterPerSecond { get; } - protected abstract double LitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double LitersPerSecondInOneCubicMeterPerSecond { get; } - protected abstract double MicrolitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double MillilitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double MillionUsGallonsPerDayInOneCubicMeterPerSecond { get; } - protected abstract double NanolitersPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double OilBarrelsPerDayInOneCubicMeterPerSecond { get; } - protected abstract double OilBarrelsPerHourInOneCubicMeterPerSecond { get; } - protected abstract double OilBarrelsPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double UsGallonsPerHourInOneCubicMeterPerSecond { get; } - protected abstract double UsGallonsPerMinuteInOneCubicMeterPerSecond { get; } - protected abstract double UsGallonsPerSecondInOneCubicMeterPerSecond { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double CentilitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicDecimetersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicFeetPerHourTolerance { get { return 1e-5; } } - protected virtual double CubicFeetPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicFeetPerSecondTolerance { get { return 1e-5; } } - protected virtual double CubicMetersPerHourTolerance { get { return 1e-5; } } - protected virtual double CubicMetersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicMetersPerSecondTolerance { get { return 1e-5; } } - protected virtual double CubicYardsPerHourTolerance { get { return 1e-5; } } - protected virtual double CubicYardsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double CubicYardsPerSecondTolerance { get { return 1e-5; } } - protected virtual double DecilitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double KilolitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double LitersPerHourTolerance { get { return 1e-5; } } - protected virtual double LitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double LitersPerSecondTolerance { get { return 1e-5; } } - protected virtual double MicrolitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double MillilitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double MillionUsGallonsPerDayTolerance { get { return 1e-5; } } - protected virtual double NanolitersPerMinuteTolerance { get { return 1e-5; } } - protected virtual double OilBarrelsPerDayTolerance { get { return 1e-5; } } - protected virtual double OilBarrelsPerHourTolerance { get { return 1e-5; } } - protected virtual double OilBarrelsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double UsGallonsPerHourTolerance { get { return 1e-5; } } - protected virtual double UsGallonsPerMinuteTolerance { get { return 1e-5; } } - protected virtual double UsGallonsPerSecondTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new VolumeFlow((double)0.0, VolumeFlowUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new VolumeFlow(double.PositiveInfinity, VolumeFlowUnit.CubicMeterPerSecond)); - Assert.Throws(() => new VolumeFlow(double.NegativeInfinity, VolumeFlowUnit.CubicMeterPerSecond)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new VolumeFlow(double.NaN, VolumeFlowUnit.CubicMeterPerSecond)); - } - - [Fact] - public void CubicMeterPerSecondToVolumeFlowUnits() - { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CentilitersPerMinute, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerHour, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerMinute, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicFeetPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerHour, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerMinute, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerHour, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerMinute, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.CubicYardsPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.DecilitersPerMinute, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.KilolitersPerMinute, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerHour, LitersPerHourTolerance); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerMinute, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.LitersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.MicrolitersPerMinute, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.MillilitersPerMinute, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.NanolitersPerMinute, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.OilBarrelsPerDay, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(OilBarrelsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.OilBarrelsPerHour, OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(OilBarrelsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerHour, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerMinute, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.UsGallonsPerSecond, UsGallonsPerSecondTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CentiliterPerMinute).CentilitersPerMinute, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicDecimeterPerMinute).CubicDecimetersPerMinute, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerHour).CubicFeetPerHour, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerMinute).CubicFeetPerMinute, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicFootPerSecond).CubicFeetPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerHour).CubicMetersPerHour, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerMinute).CubicMetersPerMinute, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicMeterPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerHour).CubicYardsPerHour, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerMinute).CubicYardsPerMinute, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.CubicYardPerSecond).CubicYardsPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.DeciliterPerMinute).DecilitersPerMinute, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.KiloliterPerMinute).KilolitersPerMinute, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerHour).LitersPerHour, LitersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerMinute).LitersPerMinute, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.LiterPerSecond).LitersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MicroliterPerMinute).MicrolitersPerMinute, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MilliliterPerMinute).MillilitersPerMinute, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.MillionUsGallonsPerDay).MillionUsGallonsPerDay, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.NanoliterPerMinute).NanolitersPerMinute, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerDay).OilBarrelsPerDay, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerHour).OilBarrelsPerHour, OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.OilBarrelPerMinute).OilBarrelsPerMinute, OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerHour).UsGallonsPerHour, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerMinute).UsGallonsPerMinute, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.From(1, VolumeFlowUnit.UsGallonPerSecond).UsGallonsPerSecond, UsGallonsPerSecondTolerance); - } - - [Fact] - public void FromCubicMetersPerSecond_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.PositiveInfinity)); - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NegativeInfinity)); - } - - [Fact] - public void FromCubicMetersPerSecond_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => VolumeFlow.FromCubicMetersPerSecond(double.NaN)); - } - - [Fact] - public void As() - { - var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CentiliterPerMinute), CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicDecimeterPerMinute), CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicFootPerHour), CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicFootPerMinute), CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicFootPerSecond), CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicMeterPerHour), CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicMeterPerMinute), CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicMeterPerSecond), CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicYardPerHour), CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicYardPerMinute), CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.CubicYardPerSecond), CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.DeciliterPerMinute), DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.KiloliterPerMinute), KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LiterPerHour), LitersPerHourTolerance); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LiterPerMinute), LitersPerMinuteTolerance); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.LiterPerSecond), LitersPerSecondTolerance); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MicroliterPerMinute), MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MilliliterPerMinute), MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.MillionUsGallonsPerDay), MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.NanoliterPerMinute), NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelPerDay), OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(OilBarrelsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelPerHour), OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(OilBarrelsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.OilBarrelPerMinute), OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonPerHour), UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonPerMinute), UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, cubicmeterpersecond.As(VolumeFlowUnit.UsGallonPerSecond), UsGallonsPerSecondTolerance); - } - - [Fact] - public void ToUnit() - { - var cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - - var centiliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CentiliterPerMinute); - AssertEx.EqualTolerance(CentilitersPerMinuteInOneCubicMeterPerSecond, (double)centiliterperminuteQuantity.Value, CentilitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.CentiliterPerMinute, centiliterperminuteQuantity.Unit); - - var cubicdecimeterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicDecimeterPerMinute); - AssertEx.EqualTolerance(CubicDecimetersPerMinuteInOneCubicMeterPerSecond, (double)cubicdecimeterperminuteQuantity.Value, CubicDecimetersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.CubicDecimeterPerMinute, cubicdecimeterperminuteQuantity.Unit); - - var cubicfootperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicFootPerHour); - AssertEx.EqualTolerance(CubicFeetPerHourInOneCubicMeterPerSecond, (double)cubicfootperhourQuantity.Value, CubicFeetPerHourTolerance); - Assert.Equal(VolumeFlowUnit.CubicFootPerHour, cubicfootperhourQuantity.Unit); - - var cubicfootperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicFootPerMinute); - AssertEx.EqualTolerance(CubicFeetPerMinuteInOneCubicMeterPerSecond, (double)cubicfootperminuteQuantity.Value, CubicFeetPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.CubicFootPerMinute, cubicfootperminuteQuantity.Unit); - - var cubicfootpersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicFootPerSecond); - AssertEx.EqualTolerance(CubicFeetPerSecondInOneCubicMeterPerSecond, (double)cubicfootpersecondQuantity.Value, CubicFeetPerSecondTolerance); - Assert.Equal(VolumeFlowUnit.CubicFootPerSecond, cubicfootpersecondQuantity.Unit); - - var cubicmeterperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicMeterPerHour); - AssertEx.EqualTolerance(CubicMetersPerHourInOneCubicMeterPerSecond, (double)cubicmeterperhourQuantity.Value, CubicMetersPerHourTolerance); - Assert.Equal(VolumeFlowUnit.CubicMeterPerHour, cubicmeterperhourQuantity.Unit); - - var cubicmeterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicMeterPerMinute); - AssertEx.EqualTolerance(CubicMetersPerMinuteInOneCubicMeterPerSecond, (double)cubicmeterperminuteQuantity.Value, CubicMetersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.CubicMeterPerMinute, cubicmeterperminuteQuantity.Unit); - - var cubicmeterpersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicMeterPerSecond); - AssertEx.EqualTolerance(CubicMetersPerSecondInOneCubicMeterPerSecond, (double)cubicmeterpersecondQuantity.Value, CubicMetersPerSecondTolerance); - Assert.Equal(VolumeFlowUnit.CubicMeterPerSecond, cubicmeterpersecondQuantity.Unit); - - var cubicyardperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicYardPerHour); - AssertEx.EqualTolerance(CubicYardsPerHourInOneCubicMeterPerSecond, (double)cubicyardperhourQuantity.Value, CubicYardsPerHourTolerance); - Assert.Equal(VolumeFlowUnit.CubicYardPerHour, cubicyardperhourQuantity.Unit); - - var cubicyardperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicYardPerMinute); - AssertEx.EqualTolerance(CubicYardsPerMinuteInOneCubicMeterPerSecond, (double)cubicyardperminuteQuantity.Value, CubicYardsPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.CubicYardPerMinute, cubicyardperminuteQuantity.Unit); - - var cubicyardpersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.CubicYardPerSecond); - AssertEx.EqualTolerance(CubicYardsPerSecondInOneCubicMeterPerSecond, (double)cubicyardpersecondQuantity.Value, CubicYardsPerSecondTolerance); - Assert.Equal(VolumeFlowUnit.CubicYardPerSecond, cubicyardpersecondQuantity.Unit); - - var deciliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.DeciliterPerMinute); - AssertEx.EqualTolerance(DecilitersPerMinuteInOneCubicMeterPerSecond, (double)deciliterperminuteQuantity.Value, DecilitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.DeciliterPerMinute, deciliterperminuteQuantity.Unit); - - var kiloliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.KiloliterPerMinute); - AssertEx.EqualTolerance(KilolitersPerMinuteInOneCubicMeterPerSecond, (double)kiloliterperminuteQuantity.Value, KilolitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.KiloliterPerMinute, kiloliterperminuteQuantity.Unit); - - var literperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LiterPerHour); - AssertEx.EqualTolerance(LitersPerHourInOneCubicMeterPerSecond, (double)literperhourQuantity.Value, LitersPerHourTolerance); - Assert.Equal(VolumeFlowUnit.LiterPerHour, literperhourQuantity.Unit); - - var literperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LiterPerMinute); - AssertEx.EqualTolerance(LitersPerMinuteInOneCubicMeterPerSecond, (double)literperminuteQuantity.Value, LitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.LiterPerMinute, literperminuteQuantity.Unit); - - var literpersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.LiterPerSecond); - AssertEx.EqualTolerance(LitersPerSecondInOneCubicMeterPerSecond, (double)literpersecondQuantity.Value, LitersPerSecondTolerance); - Assert.Equal(VolumeFlowUnit.LiterPerSecond, literpersecondQuantity.Unit); - - var microliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MicroliterPerMinute); - AssertEx.EqualTolerance(MicrolitersPerMinuteInOneCubicMeterPerSecond, (double)microliterperminuteQuantity.Value, MicrolitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.MicroliterPerMinute, microliterperminuteQuantity.Unit); - - var milliliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MilliliterPerMinute); - AssertEx.EqualTolerance(MillilitersPerMinuteInOneCubicMeterPerSecond, (double)milliliterperminuteQuantity.Value, MillilitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.MilliliterPerMinute, milliliterperminuteQuantity.Unit); - - var millionusgallonsperdayQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.MillionUsGallonsPerDay); - AssertEx.EqualTolerance(MillionUsGallonsPerDayInOneCubicMeterPerSecond, (double)millionusgallonsperdayQuantity.Value, MillionUsGallonsPerDayTolerance); - Assert.Equal(VolumeFlowUnit.MillionUsGallonsPerDay, millionusgallonsperdayQuantity.Unit); - - var nanoliterperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.NanoliterPerMinute); - AssertEx.EqualTolerance(NanolitersPerMinuteInOneCubicMeterPerSecond, (double)nanoliterperminuteQuantity.Value, NanolitersPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.NanoliterPerMinute, nanoliterperminuteQuantity.Unit); - - var oilbarrelperdayQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelPerDay); - AssertEx.EqualTolerance(OilBarrelsPerDayInOneCubicMeterPerSecond, (double)oilbarrelperdayQuantity.Value, OilBarrelsPerDayTolerance); - Assert.Equal(VolumeFlowUnit.OilBarrelPerDay, oilbarrelperdayQuantity.Unit); - - var oilbarrelperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelPerHour); - AssertEx.EqualTolerance(OilBarrelsPerHourInOneCubicMeterPerSecond, (double)oilbarrelperhourQuantity.Value, OilBarrelsPerHourTolerance); - Assert.Equal(VolumeFlowUnit.OilBarrelPerHour, oilbarrelperhourQuantity.Unit); - - var oilbarrelperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.OilBarrelPerMinute); - AssertEx.EqualTolerance(OilBarrelsPerMinuteInOneCubicMeterPerSecond, (double)oilbarrelperminuteQuantity.Value, OilBarrelsPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.OilBarrelPerMinute, oilbarrelperminuteQuantity.Unit); - - var usgallonperhourQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonPerHour); - AssertEx.EqualTolerance(UsGallonsPerHourInOneCubicMeterPerSecond, (double)usgallonperhourQuantity.Value, UsGallonsPerHourTolerance); - Assert.Equal(VolumeFlowUnit.UsGallonPerHour, usgallonperhourQuantity.Unit); - - var usgallonperminuteQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonPerMinute); - AssertEx.EqualTolerance(UsGallonsPerMinuteInOneCubicMeterPerSecond, (double)usgallonperminuteQuantity.Value, UsGallonsPerMinuteTolerance); - Assert.Equal(VolumeFlowUnit.UsGallonPerMinute, usgallonperminuteQuantity.Unit); - - var usgallonpersecondQuantity = cubicmeterpersecond.ToUnit(VolumeFlowUnit.UsGallonPerSecond); - AssertEx.EqualTolerance(UsGallonsPerSecondInOneCubicMeterPerSecond, (double)usgallonpersecondQuantity.Value, UsGallonsPerSecondTolerance); - Assert.Equal(VolumeFlowUnit.UsGallonPerSecond, usgallonpersecondQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(1, VolumeFlow.FromCentilitersPerMinute(cubicmeterpersecond.CentilitersPerMinute).CubicMetersPerSecond, CentilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicDecimetersPerMinute(cubicmeterpersecond.CubicDecimetersPerMinute).CubicMetersPerSecond, CubicDecimetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerHour(cubicmeterpersecond.CubicFeetPerHour).CubicMetersPerSecond, CubicFeetPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerMinute(cubicmeterpersecond.CubicFeetPerMinute).CubicMetersPerSecond, CubicFeetPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicFeetPerSecond(cubicmeterpersecond.CubicFeetPerSecond).CubicMetersPerSecond, CubicFeetPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerHour(cubicmeterpersecond.CubicMetersPerHour).CubicMetersPerSecond, CubicMetersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerMinute(cubicmeterpersecond.CubicMetersPerMinute).CubicMetersPerSecond, CubicMetersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicMetersPerSecond(cubicmeterpersecond.CubicMetersPerSecond).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerHour(cubicmeterpersecond.CubicYardsPerHour).CubicMetersPerSecond, CubicYardsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerMinute(cubicmeterpersecond.CubicYardsPerMinute).CubicMetersPerSecond, CubicYardsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromCubicYardsPerSecond(cubicmeterpersecond.CubicYardsPerSecond).CubicMetersPerSecond, CubicYardsPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromDecilitersPerMinute(cubicmeterpersecond.DecilitersPerMinute).CubicMetersPerSecond, DecilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromKilolitersPerMinute(cubicmeterpersecond.KilolitersPerMinute).CubicMetersPerSecond, KilolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerHour(cubicmeterpersecond.LitersPerHour).CubicMetersPerSecond, LitersPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerMinute(cubicmeterpersecond.LitersPerMinute).CubicMetersPerSecond, LitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromLitersPerSecond(cubicmeterpersecond.LitersPerSecond).CubicMetersPerSecond, LitersPerSecondTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMicrolitersPerMinute(cubicmeterpersecond.MicrolitersPerMinute).CubicMetersPerSecond, MicrolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMillilitersPerMinute(cubicmeterpersecond.MillilitersPerMinute).CubicMetersPerSecond, MillilitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromMillionUsGallonsPerDay(cubicmeterpersecond.MillionUsGallonsPerDay).CubicMetersPerSecond, MillionUsGallonsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromNanolitersPerMinute(cubicmeterpersecond.NanolitersPerMinute).CubicMetersPerSecond, NanolitersPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerDay(cubicmeterpersecond.OilBarrelsPerDay).CubicMetersPerSecond, OilBarrelsPerDayTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerHour(cubicmeterpersecond.OilBarrelsPerHour).CubicMetersPerSecond, OilBarrelsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromOilBarrelsPerMinute(cubicmeterpersecond.OilBarrelsPerMinute).CubicMetersPerSecond, OilBarrelsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerHour(cubicmeterpersecond.UsGallonsPerHour).CubicMetersPerSecond, UsGallonsPerHourTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerMinute(cubicmeterpersecond.UsGallonsPerMinute).CubicMetersPerSecond, UsGallonsPerMinuteTolerance); - AssertEx.EqualTolerance(1, VolumeFlow.FromUsGallonsPerSecond(cubicmeterpersecond.UsGallonsPerSecond).CubicMetersPerSecond, UsGallonsPerSecondTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - VolumeFlow v = VolumeFlow.FromCubicMetersPerSecond(1); - AssertEx.EqualTolerance(-1, -v.CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (VolumeFlow.FromCubicMetersPerSecond(3)-v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (v + v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (v*10).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(10, (10*v).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, (VolumeFlow.FromCubicMetersPerSecond(10)/5).CubicMetersPerSecond, CubicMetersPerSecondTolerance); - AssertEx.EqualTolerance(2, VolumeFlow.FromCubicMetersPerSecond(10)/VolumeFlow.FromCubicMetersPerSecond(5), CubicMetersPerSecondTolerance); - } - - [Fact] - public void ComparisonOperators() - { - VolumeFlow oneCubicMeterPerSecond = VolumeFlow.FromCubicMetersPerSecond(1); - VolumeFlow twoCubicMetersPerSecond = VolumeFlow.FromCubicMetersPerSecond(2); - - Assert.True(oneCubicMeterPerSecond < twoCubicMetersPerSecond); - Assert.True(oneCubicMeterPerSecond <= twoCubicMetersPerSecond); - Assert.True(twoCubicMetersPerSecond > oneCubicMeterPerSecond); - Assert.True(twoCubicMetersPerSecond >= oneCubicMeterPerSecond); - - Assert.False(oneCubicMeterPerSecond > twoCubicMetersPerSecond); - Assert.False(oneCubicMeterPerSecond >= twoCubicMetersPerSecond); - Assert.False(twoCubicMetersPerSecond < oneCubicMeterPerSecond); - Assert.False(twoCubicMetersPerSecond <= oneCubicMeterPerSecond); - } - - [Fact] - public void CompareToIsImplemented() - { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.Equal(0, cubicmeterpersecond.CompareTo(cubicmeterpersecond)); - Assert.True(cubicmeterpersecond.CompareTo(VolumeFlow.Zero) > 0); - Assert.True(VolumeFlow.Zero.CompareTo(cubicmeterpersecond) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.Throws(() => cubicmeterpersecond.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.Throws(() => cubicmeterpersecond.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - VolumeFlow v = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.True(v.Equals(VolumeFlow.FromCubicMetersPerSecond(1), CubicMetersPerSecondTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(VolumeFlow.Zero, CubicMetersPerSecondTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.False(cubicmeterpersecond.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - VolumeFlow cubicmeterpersecond = VolumeFlow.FromCubicMetersPerSecond(1); - Assert.False(cubicmeterpersecond.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(VolumeFlowUnit.Undefined, VolumeFlow.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(VolumeFlowUnit)).Cast(); - foreach(var unit in units) - { - if(unit == VolumeFlowUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} diff --git a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs deleted file mode 100644 index bd480669ff..0000000000 --- a/UnitsNet.Tests/GeneratedCode/VolumeTestsBase.g.cs +++ /dev/null @@ -1,634 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Linq; -using UnitsNet.Units; -using Xunit; - -// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? -#pragma warning disable 1718 - -// ReSharper disable once CheckNamespace -namespace UnitsNet.Tests -{ - /// - /// Test of Volume. - /// -// ReSharper disable once PartialTypeWithSinglePart - public abstract partial class VolumeTestsBase - { - protected abstract double AuTablespoonsInOneCubicMeter { get; } - protected abstract double CentilitersInOneCubicMeter { get; } - protected abstract double CubicCentimetersInOneCubicMeter { get; } - protected abstract double CubicDecimetersInOneCubicMeter { get; } - protected abstract double CubicFeetInOneCubicMeter { get; } - protected abstract double CubicInchesInOneCubicMeter { get; } - protected abstract double CubicKilometersInOneCubicMeter { get; } - protected abstract double CubicMetersInOneCubicMeter { get; } - protected abstract double CubicMicrometersInOneCubicMeter { get; } - protected abstract double CubicMilesInOneCubicMeter { get; } - protected abstract double CubicMillimetersInOneCubicMeter { get; } - protected abstract double CubicYardsInOneCubicMeter { get; } - protected abstract double DecilitersInOneCubicMeter { get; } - protected abstract double HectocubicFeetInOneCubicMeter { get; } - protected abstract double HectocubicMetersInOneCubicMeter { get; } - protected abstract double HectolitersInOneCubicMeter { get; } - protected abstract double ImperialBeerBarrelsInOneCubicMeter { get; } - protected abstract double ImperialGallonsInOneCubicMeter { get; } - protected abstract double ImperialOuncesInOneCubicMeter { get; } - protected abstract double KilocubicFeetInOneCubicMeter { get; } - protected abstract double KilocubicMetersInOneCubicMeter { get; } - protected abstract double KiloimperialGallonsInOneCubicMeter { get; } - protected abstract double KilousGallonsInOneCubicMeter { get; } - protected abstract double LitersInOneCubicMeter { get; } - protected abstract double MegacubicFeetInOneCubicMeter { get; } - protected abstract double MegaimperialGallonsInOneCubicMeter { get; } - protected abstract double MegausGallonsInOneCubicMeter { get; } - protected abstract double MetricCupsInOneCubicMeter { get; } - protected abstract double MetricTeaspoonsInOneCubicMeter { get; } - protected abstract double MicrolitersInOneCubicMeter { get; } - protected abstract double MillilitersInOneCubicMeter { get; } - protected abstract double OilBarrelsInOneCubicMeter { get; } - protected abstract double UkTablespoonsInOneCubicMeter { get; } - protected abstract double UsBeerBarrelsInOneCubicMeter { get; } - protected abstract double UsCustomaryCupsInOneCubicMeter { get; } - protected abstract double UsGallonsInOneCubicMeter { get; } - protected abstract double UsLegalCupsInOneCubicMeter { get; } - protected abstract double UsOuncesInOneCubicMeter { get; } - protected abstract double UsPintsInOneCubicMeter { get; } - protected abstract double UsQuartsInOneCubicMeter { get; } - protected abstract double UsTablespoonsInOneCubicMeter { get; } - protected abstract double UsTeaspoonsInOneCubicMeter { get; } - -// ReSharper disable VirtualMemberNeverOverriden.Global - protected virtual double AuTablespoonsTolerance { get { return 1e-5; } } - protected virtual double CentilitersTolerance { get { return 1e-5; } } - protected virtual double CubicCentimetersTolerance { get { return 1e-5; } } - protected virtual double CubicDecimetersTolerance { get { return 1e-5; } } - protected virtual double CubicFeetTolerance { get { return 1e-5; } } - protected virtual double CubicInchesTolerance { get { return 1e-5; } } - protected virtual double CubicKilometersTolerance { get { return 1e-5; } } - protected virtual double CubicMetersTolerance { get { return 1e-5; } } - protected virtual double CubicMicrometersTolerance { get { return 1e-5; } } - protected virtual double CubicMilesTolerance { get { return 1e-5; } } - protected virtual double CubicMillimetersTolerance { get { return 1e-5; } } - protected virtual double CubicYardsTolerance { get { return 1e-5; } } - protected virtual double DecilitersTolerance { get { return 1e-5; } } - protected virtual double HectocubicFeetTolerance { get { return 1e-5; } } - protected virtual double HectocubicMetersTolerance { get { return 1e-5; } } - protected virtual double HectolitersTolerance { get { return 1e-5; } } - protected virtual double ImperialBeerBarrelsTolerance { get { return 1e-5; } } - protected virtual double ImperialGallonsTolerance { get { return 1e-5; } } - protected virtual double ImperialOuncesTolerance { get { return 1e-5; } } - protected virtual double KilocubicFeetTolerance { get { return 1e-5; } } - protected virtual double KilocubicMetersTolerance { get { return 1e-5; } } - protected virtual double KiloimperialGallonsTolerance { get { return 1e-5; } } - protected virtual double KilousGallonsTolerance { get { return 1e-5; } } - protected virtual double LitersTolerance { get { return 1e-5; } } - protected virtual double MegacubicFeetTolerance { get { return 1e-5; } } - protected virtual double MegaimperialGallonsTolerance { get { return 1e-5; } } - protected virtual double MegausGallonsTolerance { get { return 1e-5; } } - protected virtual double MetricCupsTolerance { get { return 1e-5; } } - protected virtual double MetricTeaspoonsTolerance { get { return 1e-5; } } - protected virtual double MicrolitersTolerance { get { return 1e-5; } } - protected virtual double MillilitersTolerance { get { return 1e-5; } } - protected virtual double OilBarrelsTolerance { get { return 1e-5; } } - protected virtual double UkTablespoonsTolerance { get { return 1e-5; } } - protected virtual double UsBeerBarrelsTolerance { get { return 1e-5; } } - protected virtual double UsCustomaryCupsTolerance { get { return 1e-5; } } - protected virtual double UsGallonsTolerance { get { return 1e-5; } } - protected virtual double UsLegalCupsTolerance { get { return 1e-5; } } - protected virtual double UsOuncesTolerance { get { return 1e-5; } } - protected virtual double UsPintsTolerance { get { return 1e-5; } } - protected virtual double UsQuartsTolerance { get { return 1e-5; } } - protected virtual double UsTablespoonsTolerance { get { return 1e-5; } } - protected virtual double UsTeaspoonsTolerance { get { return 1e-5; } } -// ReSharper restore VirtualMemberNeverOverriden.Global - - [Fact] - public void Ctor_WithUndefinedUnit_ThrowsArgumentException() - { - Assert.Throws(() => new Volume((double)0.0, VolumeUnit.Undefined)); - } - - [Fact] - public void Ctor_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => new Volume(double.PositiveInfinity, VolumeUnit.CubicMeter)); - Assert.Throws(() => new Volume(double.NegativeInfinity, VolumeUnit.CubicMeter)); - } - - [Fact] - public void Ctor_WithNaNValue_ThrowsArgumentException() - { - Assert.Throws(() => new Volume(double.NaN, VolumeUnit.CubicMeter)); - } - - [Fact] - public void CubicMeterToVolumeUnits() - { - Volume cubicmeter = Volume.FromCubicMeters(1); - AssertEx.EqualTolerance(AuTablespoonsInOneCubicMeter, cubicmeter.AuTablespoons, AuTablespoonsTolerance); - AssertEx.EqualTolerance(CentilitersInOneCubicMeter, cubicmeter.Centiliters, CentilitersTolerance); - AssertEx.EqualTolerance(CubicCentimetersInOneCubicMeter, cubicmeter.CubicCentimeters, CubicCentimetersTolerance); - AssertEx.EqualTolerance(CubicDecimetersInOneCubicMeter, cubicmeter.CubicDecimeters, CubicDecimetersTolerance); - AssertEx.EqualTolerance(CubicFeetInOneCubicMeter, cubicmeter.CubicFeet, CubicFeetTolerance); - AssertEx.EqualTolerance(CubicInchesInOneCubicMeter, cubicmeter.CubicInches, CubicInchesTolerance); - AssertEx.EqualTolerance(CubicKilometersInOneCubicMeter, cubicmeter.CubicKilometers, CubicKilometersTolerance); - AssertEx.EqualTolerance(CubicMetersInOneCubicMeter, cubicmeter.CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(CubicMicrometersInOneCubicMeter, cubicmeter.CubicMicrometers, CubicMicrometersTolerance); - AssertEx.EqualTolerance(CubicMilesInOneCubicMeter, cubicmeter.CubicMiles, CubicMilesTolerance); - AssertEx.EqualTolerance(CubicMillimetersInOneCubicMeter, cubicmeter.CubicMillimeters, CubicMillimetersTolerance); - AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, cubicmeter.CubicYards, CubicYardsTolerance); - AssertEx.EqualTolerance(DecilitersInOneCubicMeter, cubicmeter.Deciliters, DecilitersTolerance); - AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, cubicmeter.HectocubicFeet, HectocubicFeetTolerance); - AssertEx.EqualTolerance(HectocubicMetersInOneCubicMeter, cubicmeter.HectocubicMeters, HectocubicMetersTolerance); - AssertEx.EqualTolerance(HectolitersInOneCubicMeter, cubicmeter.Hectoliters, HectolitersTolerance); - AssertEx.EqualTolerance(ImperialBeerBarrelsInOneCubicMeter, cubicmeter.ImperialBeerBarrels, ImperialBeerBarrelsTolerance); - AssertEx.EqualTolerance(ImperialGallonsInOneCubicMeter, cubicmeter.ImperialGallons, ImperialGallonsTolerance); - AssertEx.EqualTolerance(ImperialOuncesInOneCubicMeter, cubicmeter.ImperialOunces, ImperialOuncesTolerance); - AssertEx.EqualTolerance(KilocubicFeetInOneCubicMeter, cubicmeter.KilocubicFeet, KilocubicFeetTolerance); - AssertEx.EqualTolerance(KilocubicMetersInOneCubicMeter, cubicmeter.KilocubicMeters, KilocubicMetersTolerance); - AssertEx.EqualTolerance(KiloimperialGallonsInOneCubicMeter, cubicmeter.KiloimperialGallons, KiloimperialGallonsTolerance); - AssertEx.EqualTolerance(KilousGallonsInOneCubicMeter, cubicmeter.KilousGallons, KilousGallonsTolerance); - AssertEx.EqualTolerance(LitersInOneCubicMeter, cubicmeter.Liters, LitersTolerance); - AssertEx.EqualTolerance(MegacubicFeetInOneCubicMeter, cubicmeter.MegacubicFeet, MegacubicFeetTolerance); - AssertEx.EqualTolerance(MegaimperialGallonsInOneCubicMeter, cubicmeter.MegaimperialGallons, MegaimperialGallonsTolerance); - AssertEx.EqualTolerance(MegausGallonsInOneCubicMeter, cubicmeter.MegausGallons, MegausGallonsTolerance); - AssertEx.EqualTolerance(MetricCupsInOneCubicMeter, cubicmeter.MetricCups, MetricCupsTolerance); - AssertEx.EqualTolerance(MetricTeaspoonsInOneCubicMeter, cubicmeter.MetricTeaspoons, MetricTeaspoonsTolerance); - AssertEx.EqualTolerance(MicrolitersInOneCubicMeter, cubicmeter.Microliters, MicrolitersTolerance); - AssertEx.EqualTolerance(MillilitersInOneCubicMeter, cubicmeter.Milliliters, MillilitersTolerance); - AssertEx.EqualTolerance(OilBarrelsInOneCubicMeter, cubicmeter.OilBarrels, OilBarrelsTolerance); - AssertEx.EqualTolerance(UkTablespoonsInOneCubicMeter, cubicmeter.UkTablespoons, UkTablespoonsTolerance); - AssertEx.EqualTolerance(UsBeerBarrelsInOneCubicMeter, cubicmeter.UsBeerBarrels, UsBeerBarrelsTolerance); - AssertEx.EqualTolerance(UsCustomaryCupsInOneCubicMeter, cubicmeter.UsCustomaryCups, UsCustomaryCupsTolerance); - AssertEx.EqualTolerance(UsGallonsInOneCubicMeter, cubicmeter.UsGallons, UsGallonsTolerance); - AssertEx.EqualTolerance(UsLegalCupsInOneCubicMeter, cubicmeter.UsLegalCups, UsLegalCupsTolerance); - AssertEx.EqualTolerance(UsOuncesInOneCubicMeter, cubicmeter.UsOunces, UsOuncesTolerance); - AssertEx.EqualTolerance(UsPintsInOneCubicMeter, cubicmeter.UsPints, UsPintsTolerance); - AssertEx.EqualTolerance(UsQuartsInOneCubicMeter, cubicmeter.UsQuarts, UsQuartsTolerance); - AssertEx.EqualTolerance(UsTablespoonsInOneCubicMeter, cubicmeter.UsTablespoons, UsTablespoonsTolerance); - AssertEx.EqualTolerance(UsTeaspoonsInOneCubicMeter, cubicmeter.UsTeaspoons, UsTeaspoonsTolerance); - } - - [Fact] - public void FromValueAndUnit() - { - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.AuTablespoon).AuTablespoons, AuTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Centiliter).Centiliters, CentilitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicCentimeter).CubicCentimeters, CubicCentimetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicDecimeter).CubicDecimeters, CubicDecimetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicFoot).CubicFeet, CubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicInch).CubicInches, CubicInchesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicKilometer).CubicKilometers, CubicKilometersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMeter).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMicrometer).CubicMicrometers, CubicMicrometersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMile).CubicMiles, CubicMilesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicMillimeter).CubicMillimeters, CubicMillimetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.CubicYard).CubicYards, CubicYardsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Deciliter).Deciliters, DecilitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicFoot).HectocubicFeet, HectocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.HectocubicMeter).HectocubicMeters, HectocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Hectoliter).Hectoliters, HectolitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialBeerBarrel).ImperialBeerBarrels, ImperialBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialGallon).ImperialGallons, ImperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.ImperialOunce).ImperialOunces, ImperialOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicFoot).KilocubicFeet, KilocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilocubicMeter).KilocubicMeters, KilocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KiloimperialGallon).KiloimperialGallons, KiloimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.KilousGallon).KilousGallons, KilousGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Liter).Liters, LitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegacubicFoot).MegacubicFeet, MegacubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegaimperialGallon).MegaimperialGallons, MegaimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MegausGallon).MegausGallons, MegausGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricCup).MetricCups, MetricCupsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.MetricTeaspoon).MetricTeaspoons, MetricTeaspoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Microliter).Microliters, MicrolitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.Milliliter).Milliliters, MillilitersTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.OilBarrel).OilBarrels, OilBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UkTablespoon).UkTablespoons, UkTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsBeerBarrel).UsBeerBarrels, UsBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsCustomaryCup).UsCustomaryCups, UsCustomaryCupsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsGallon).UsGallons, UsGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsLegalCup).UsLegalCups, UsLegalCupsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsOunce).UsOunces, UsOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsPint).UsPints, UsPintsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsQuart).UsQuarts, UsQuartsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTablespoon).UsTablespoons, UsTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.From(1, VolumeUnit.UsTeaspoon).UsTeaspoons, UsTeaspoonsTolerance); - } - - [Fact] - public void FromCubicMeters_WithInfinityValue_ThrowsArgumentException() - { - Assert.Throws(() => Volume.FromCubicMeters(double.PositiveInfinity)); - Assert.Throws(() => Volume.FromCubicMeters(double.NegativeInfinity)); - } - - [Fact] - public void FromCubicMeters_WithNanValue_ThrowsArgumentException() - { - Assert.Throws(() => Volume.FromCubicMeters(double.NaN)); - } - - [Fact] - public void As() - { - var cubicmeter = Volume.FromCubicMeters(1); - AssertEx.EqualTolerance(AuTablespoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.AuTablespoon), AuTablespoonsTolerance); - AssertEx.EqualTolerance(CentilitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Centiliter), CentilitersTolerance); - AssertEx.EqualTolerance(CubicCentimetersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicCentimeter), CubicCentimetersTolerance); - AssertEx.EqualTolerance(CubicDecimetersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicDecimeter), CubicDecimetersTolerance); - AssertEx.EqualTolerance(CubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicFoot), CubicFeetTolerance); - AssertEx.EqualTolerance(CubicInchesInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicInch), CubicInchesTolerance); - AssertEx.EqualTolerance(CubicKilometersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicKilometer), CubicKilometersTolerance); - AssertEx.EqualTolerance(CubicMetersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicMeter), CubicMetersTolerance); - AssertEx.EqualTolerance(CubicMicrometersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicMicrometer), CubicMicrometersTolerance); - AssertEx.EqualTolerance(CubicMilesInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicMile), CubicMilesTolerance); - AssertEx.EqualTolerance(CubicMillimetersInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicMillimeter), CubicMillimetersTolerance); - AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, cubicmeter.As(VolumeUnit.CubicYard), CubicYardsTolerance); - AssertEx.EqualTolerance(DecilitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Deciliter), DecilitersTolerance); - AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.HectocubicFoot), HectocubicFeetTolerance); - AssertEx.EqualTolerance(HectocubicMetersInOneCubicMeter, cubicmeter.As(VolumeUnit.HectocubicMeter), HectocubicMetersTolerance); - AssertEx.EqualTolerance(HectolitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Hectoliter), HectolitersTolerance); - AssertEx.EqualTolerance(ImperialBeerBarrelsInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialBeerBarrel), ImperialBeerBarrelsTolerance); - AssertEx.EqualTolerance(ImperialGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialGallon), ImperialGallonsTolerance); - AssertEx.EqualTolerance(ImperialOuncesInOneCubicMeter, cubicmeter.As(VolumeUnit.ImperialOunce), ImperialOuncesTolerance); - AssertEx.EqualTolerance(KilocubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.KilocubicFoot), KilocubicFeetTolerance); - AssertEx.EqualTolerance(KilocubicMetersInOneCubicMeter, cubicmeter.As(VolumeUnit.KilocubicMeter), KilocubicMetersTolerance); - AssertEx.EqualTolerance(KiloimperialGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.KiloimperialGallon), KiloimperialGallonsTolerance); - AssertEx.EqualTolerance(KilousGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.KilousGallon), KilousGallonsTolerance); - AssertEx.EqualTolerance(LitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Liter), LitersTolerance); - AssertEx.EqualTolerance(MegacubicFeetInOneCubicMeter, cubicmeter.As(VolumeUnit.MegacubicFoot), MegacubicFeetTolerance); - AssertEx.EqualTolerance(MegaimperialGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.MegaimperialGallon), MegaimperialGallonsTolerance); - AssertEx.EqualTolerance(MegausGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.MegausGallon), MegausGallonsTolerance); - AssertEx.EqualTolerance(MetricCupsInOneCubicMeter, cubicmeter.As(VolumeUnit.MetricCup), MetricCupsTolerance); - AssertEx.EqualTolerance(MetricTeaspoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.MetricTeaspoon), MetricTeaspoonsTolerance); - AssertEx.EqualTolerance(MicrolitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Microliter), MicrolitersTolerance); - AssertEx.EqualTolerance(MillilitersInOneCubicMeter, cubicmeter.As(VolumeUnit.Milliliter), MillilitersTolerance); - AssertEx.EqualTolerance(OilBarrelsInOneCubicMeter, cubicmeter.As(VolumeUnit.OilBarrel), OilBarrelsTolerance); - AssertEx.EqualTolerance(UkTablespoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.UkTablespoon), UkTablespoonsTolerance); - AssertEx.EqualTolerance(UsBeerBarrelsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsBeerBarrel), UsBeerBarrelsTolerance); - AssertEx.EqualTolerance(UsCustomaryCupsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsCustomaryCup), UsCustomaryCupsTolerance); - AssertEx.EqualTolerance(UsGallonsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsGallon), UsGallonsTolerance); - AssertEx.EqualTolerance(UsLegalCupsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsLegalCup), UsLegalCupsTolerance); - AssertEx.EqualTolerance(UsOuncesInOneCubicMeter, cubicmeter.As(VolumeUnit.UsOunce), UsOuncesTolerance); - AssertEx.EqualTolerance(UsPintsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsPint), UsPintsTolerance); - AssertEx.EqualTolerance(UsQuartsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsQuart), UsQuartsTolerance); - AssertEx.EqualTolerance(UsTablespoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsTablespoon), UsTablespoonsTolerance); - AssertEx.EqualTolerance(UsTeaspoonsInOneCubicMeter, cubicmeter.As(VolumeUnit.UsTeaspoon), UsTeaspoonsTolerance); - } - - [Fact] - public void ToUnit() - { - var cubicmeter = Volume.FromCubicMeters(1); - - var autablespoonQuantity = cubicmeter.ToUnit(VolumeUnit.AuTablespoon); - AssertEx.EqualTolerance(AuTablespoonsInOneCubicMeter, (double)autablespoonQuantity.Value, AuTablespoonsTolerance); - Assert.Equal(VolumeUnit.AuTablespoon, autablespoonQuantity.Unit); - - var centiliterQuantity = cubicmeter.ToUnit(VolumeUnit.Centiliter); - AssertEx.EqualTolerance(CentilitersInOneCubicMeter, (double)centiliterQuantity.Value, CentilitersTolerance); - Assert.Equal(VolumeUnit.Centiliter, centiliterQuantity.Unit); - - var cubiccentimeterQuantity = cubicmeter.ToUnit(VolumeUnit.CubicCentimeter); - AssertEx.EqualTolerance(CubicCentimetersInOneCubicMeter, (double)cubiccentimeterQuantity.Value, CubicCentimetersTolerance); - Assert.Equal(VolumeUnit.CubicCentimeter, cubiccentimeterQuantity.Unit); - - var cubicdecimeterQuantity = cubicmeter.ToUnit(VolumeUnit.CubicDecimeter); - AssertEx.EqualTolerance(CubicDecimetersInOneCubicMeter, (double)cubicdecimeterQuantity.Value, CubicDecimetersTolerance); - Assert.Equal(VolumeUnit.CubicDecimeter, cubicdecimeterQuantity.Unit); - - var cubicfootQuantity = cubicmeter.ToUnit(VolumeUnit.CubicFoot); - AssertEx.EqualTolerance(CubicFeetInOneCubicMeter, (double)cubicfootQuantity.Value, CubicFeetTolerance); - Assert.Equal(VolumeUnit.CubicFoot, cubicfootQuantity.Unit); - - var cubicinchQuantity = cubicmeter.ToUnit(VolumeUnit.CubicInch); - AssertEx.EqualTolerance(CubicInchesInOneCubicMeter, (double)cubicinchQuantity.Value, CubicInchesTolerance); - Assert.Equal(VolumeUnit.CubicInch, cubicinchQuantity.Unit); - - var cubickilometerQuantity = cubicmeter.ToUnit(VolumeUnit.CubicKilometer); - AssertEx.EqualTolerance(CubicKilometersInOneCubicMeter, (double)cubickilometerQuantity.Value, CubicKilometersTolerance); - Assert.Equal(VolumeUnit.CubicKilometer, cubickilometerQuantity.Unit); - - var cubicmeterQuantity = cubicmeter.ToUnit(VolumeUnit.CubicMeter); - AssertEx.EqualTolerance(CubicMetersInOneCubicMeter, (double)cubicmeterQuantity.Value, CubicMetersTolerance); - Assert.Equal(VolumeUnit.CubicMeter, cubicmeterQuantity.Unit); - - var cubicmicrometerQuantity = cubicmeter.ToUnit(VolumeUnit.CubicMicrometer); - AssertEx.EqualTolerance(CubicMicrometersInOneCubicMeter, (double)cubicmicrometerQuantity.Value, CubicMicrometersTolerance); - Assert.Equal(VolumeUnit.CubicMicrometer, cubicmicrometerQuantity.Unit); - - var cubicmileQuantity = cubicmeter.ToUnit(VolumeUnit.CubicMile); - AssertEx.EqualTolerance(CubicMilesInOneCubicMeter, (double)cubicmileQuantity.Value, CubicMilesTolerance); - Assert.Equal(VolumeUnit.CubicMile, cubicmileQuantity.Unit); - - var cubicmillimeterQuantity = cubicmeter.ToUnit(VolumeUnit.CubicMillimeter); - AssertEx.EqualTolerance(CubicMillimetersInOneCubicMeter, (double)cubicmillimeterQuantity.Value, CubicMillimetersTolerance); - Assert.Equal(VolumeUnit.CubicMillimeter, cubicmillimeterQuantity.Unit); - - var cubicyardQuantity = cubicmeter.ToUnit(VolumeUnit.CubicYard); - AssertEx.EqualTolerance(CubicYardsInOneCubicMeter, (double)cubicyardQuantity.Value, CubicYardsTolerance); - Assert.Equal(VolumeUnit.CubicYard, cubicyardQuantity.Unit); - - var deciliterQuantity = cubicmeter.ToUnit(VolumeUnit.Deciliter); - AssertEx.EqualTolerance(DecilitersInOneCubicMeter, (double)deciliterQuantity.Value, DecilitersTolerance); - Assert.Equal(VolumeUnit.Deciliter, deciliterQuantity.Unit); - - var hectocubicfootQuantity = cubicmeter.ToUnit(VolumeUnit.HectocubicFoot); - AssertEx.EqualTolerance(HectocubicFeetInOneCubicMeter, (double)hectocubicfootQuantity.Value, HectocubicFeetTolerance); - Assert.Equal(VolumeUnit.HectocubicFoot, hectocubicfootQuantity.Unit); - - var hectocubicmeterQuantity = cubicmeter.ToUnit(VolumeUnit.HectocubicMeter); - AssertEx.EqualTolerance(HectocubicMetersInOneCubicMeter, (double)hectocubicmeterQuantity.Value, HectocubicMetersTolerance); - Assert.Equal(VolumeUnit.HectocubicMeter, hectocubicmeterQuantity.Unit); - - var hectoliterQuantity = cubicmeter.ToUnit(VolumeUnit.Hectoliter); - AssertEx.EqualTolerance(HectolitersInOneCubicMeter, (double)hectoliterQuantity.Value, HectolitersTolerance); - Assert.Equal(VolumeUnit.Hectoliter, hectoliterQuantity.Unit); - - var imperialbeerbarrelQuantity = cubicmeter.ToUnit(VolumeUnit.ImperialBeerBarrel); - AssertEx.EqualTolerance(ImperialBeerBarrelsInOneCubicMeter, (double)imperialbeerbarrelQuantity.Value, ImperialBeerBarrelsTolerance); - Assert.Equal(VolumeUnit.ImperialBeerBarrel, imperialbeerbarrelQuantity.Unit); - - var imperialgallonQuantity = cubicmeter.ToUnit(VolumeUnit.ImperialGallon); - AssertEx.EqualTolerance(ImperialGallonsInOneCubicMeter, (double)imperialgallonQuantity.Value, ImperialGallonsTolerance); - Assert.Equal(VolumeUnit.ImperialGallon, imperialgallonQuantity.Unit); - - var imperialounceQuantity = cubicmeter.ToUnit(VolumeUnit.ImperialOunce); - AssertEx.EqualTolerance(ImperialOuncesInOneCubicMeter, (double)imperialounceQuantity.Value, ImperialOuncesTolerance); - Assert.Equal(VolumeUnit.ImperialOunce, imperialounceQuantity.Unit); - - var kilocubicfootQuantity = cubicmeter.ToUnit(VolumeUnit.KilocubicFoot); - AssertEx.EqualTolerance(KilocubicFeetInOneCubicMeter, (double)kilocubicfootQuantity.Value, KilocubicFeetTolerance); - Assert.Equal(VolumeUnit.KilocubicFoot, kilocubicfootQuantity.Unit); - - var kilocubicmeterQuantity = cubicmeter.ToUnit(VolumeUnit.KilocubicMeter); - AssertEx.EqualTolerance(KilocubicMetersInOneCubicMeter, (double)kilocubicmeterQuantity.Value, KilocubicMetersTolerance); - Assert.Equal(VolumeUnit.KilocubicMeter, kilocubicmeterQuantity.Unit); - - var kiloimperialgallonQuantity = cubicmeter.ToUnit(VolumeUnit.KiloimperialGallon); - AssertEx.EqualTolerance(KiloimperialGallonsInOneCubicMeter, (double)kiloimperialgallonQuantity.Value, KiloimperialGallonsTolerance); - Assert.Equal(VolumeUnit.KiloimperialGallon, kiloimperialgallonQuantity.Unit); - - var kilousgallonQuantity = cubicmeter.ToUnit(VolumeUnit.KilousGallon); - AssertEx.EqualTolerance(KilousGallonsInOneCubicMeter, (double)kilousgallonQuantity.Value, KilousGallonsTolerance); - Assert.Equal(VolumeUnit.KilousGallon, kilousgallonQuantity.Unit); - - var literQuantity = cubicmeter.ToUnit(VolumeUnit.Liter); - AssertEx.EqualTolerance(LitersInOneCubicMeter, (double)literQuantity.Value, LitersTolerance); - Assert.Equal(VolumeUnit.Liter, literQuantity.Unit); - - var megacubicfootQuantity = cubicmeter.ToUnit(VolumeUnit.MegacubicFoot); - AssertEx.EqualTolerance(MegacubicFeetInOneCubicMeter, (double)megacubicfootQuantity.Value, MegacubicFeetTolerance); - Assert.Equal(VolumeUnit.MegacubicFoot, megacubicfootQuantity.Unit); - - var megaimperialgallonQuantity = cubicmeter.ToUnit(VolumeUnit.MegaimperialGallon); - AssertEx.EqualTolerance(MegaimperialGallonsInOneCubicMeter, (double)megaimperialgallonQuantity.Value, MegaimperialGallonsTolerance); - Assert.Equal(VolumeUnit.MegaimperialGallon, megaimperialgallonQuantity.Unit); - - var megausgallonQuantity = cubicmeter.ToUnit(VolumeUnit.MegausGallon); - AssertEx.EqualTolerance(MegausGallonsInOneCubicMeter, (double)megausgallonQuantity.Value, MegausGallonsTolerance); - Assert.Equal(VolumeUnit.MegausGallon, megausgallonQuantity.Unit); - - var metriccupQuantity = cubicmeter.ToUnit(VolumeUnit.MetricCup); - AssertEx.EqualTolerance(MetricCupsInOneCubicMeter, (double)metriccupQuantity.Value, MetricCupsTolerance); - Assert.Equal(VolumeUnit.MetricCup, metriccupQuantity.Unit); - - var metricteaspoonQuantity = cubicmeter.ToUnit(VolumeUnit.MetricTeaspoon); - AssertEx.EqualTolerance(MetricTeaspoonsInOneCubicMeter, (double)metricteaspoonQuantity.Value, MetricTeaspoonsTolerance); - Assert.Equal(VolumeUnit.MetricTeaspoon, metricteaspoonQuantity.Unit); - - var microliterQuantity = cubicmeter.ToUnit(VolumeUnit.Microliter); - AssertEx.EqualTolerance(MicrolitersInOneCubicMeter, (double)microliterQuantity.Value, MicrolitersTolerance); - Assert.Equal(VolumeUnit.Microliter, microliterQuantity.Unit); - - var milliliterQuantity = cubicmeter.ToUnit(VolumeUnit.Milliliter); - AssertEx.EqualTolerance(MillilitersInOneCubicMeter, (double)milliliterQuantity.Value, MillilitersTolerance); - Assert.Equal(VolumeUnit.Milliliter, milliliterQuantity.Unit); - - var oilbarrelQuantity = cubicmeter.ToUnit(VolumeUnit.OilBarrel); - AssertEx.EqualTolerance(OilBarrelsInOneCubicMeter, (double)oilbarrelQuantity.Value, OilBarrelsTolerance); - Assert.Equal(VolumeUnit.OilBarrel, oilbarrelQuantity.Unit); - - var uktablespoonQuantity = cubicmeter.ToUnit(VolumeUnit.UkTablespoon); - AssertEx.EqualTolerance(UkTablespoonsInOneCubicMeter, (double)uktablespoonQuantity.Value, UkTablespoonsTolerance); - Assert.Equal(VolumeUnit.UkTablespoon, uktablespoonQuantity.Unit); - - var usbeerbarrelQuantity = cubicmeter.ToUnit(VolumeUnit.UsBeerBarrel); - AssertEx.EqualTolerance(UsBeerBarrelsInOneCubicMeter, (double)usbeerbarrelQuantity.Value, UsBeerBarrelsTolerance); - Assert.Equal(VolumeUnit.UsBeerBarrel, usbeerbarrelQuantity.Unit); - - var uscustomarycupQuantity = cubicmeter.ToUnit(VolumeUnit.UsCustomaryCup); - AssertEx.EqualTolerance(UsCustomaryCupsInOneCubicMeter, (double)uscustomarycupQuantity.Value, UsCustomaryCupsTolerance); - Assert.Equal(VolumeUnit.UsCustomaryCup, uscustomarycupQuantity.Unit); - - var usgallonQuantity = cubicmeter.ToUnit(VolumeUnit.UsGallon); - AssertEx.EqualTolerance(UsGallonsInOneCubicMeter, (double)usgallonQuantity.Value, UsGallonsTolerance); - Assert.Equal(VolumeUnit.UsGallon, usgallonQuantity.Unit); - - var uslegalcupQuantity = cubicmeter.ToUnit(VolumeUnit.UsLegalCup); - AssertEx.EqualTolerance(UsLegalCupsInOneCubicMeter, (double)uslegalcupQuantity.Value, UsLegalCupsTolerance); - Assert.Equal(VolumeUnit.UsLegalCup, uslegalcupQuantity.Unit); - - var usounceQuantity = cubicmeter.ToUnit(VolumeUnit.UsOunce); - AssertEx.EqualTolerance(UsOuncesInOneCubicMeter, (double)usounceQuantity.Value, UsOuncesTolerance); - Assert.Equal(VolumeUnit.UsOunce, usounceQuantity.Unit); - - var uspintQuantity = cubicmeter.ToUnit(VolumeUnit.UsPint); - AssertEx.EqualTolerance(UsPintsInOneCubicMeter, (double)uspintQuantity.Value, UsPintsTolerance); - Assert.Equal(VolumeUnit.UsPint, uspintQuantity.Unit); - - var usquartQuantity = cubicmeter.ToUnit(VolumeUnit.UsQuart); - AssertEx.EqualTolerance(UsQuartsInOneCubicMeter, (double)usquartQuantity.Value, UsQuartsTolerance); - Assert.Equal(VolumeUnit.UsQuart, usquartQuantity.Unit); - - var ustablespoonQuantity = cubicmeter.ToUnit(VolumeUnit.UsTablespoon); - AssertEx.EqualTolerance(UsTablespoonsInOneCubicMeter, (double)ustablespoonQuantity.Value, UsTablespoonsTolerance); - Assert.Equal(VolumeUnit.UsTablespoon, ustablespoonQuantity.Unit); - - var usteaspoonQuantity = cubicmeter.ToUnit(VolumeUnit.UsTeaspoon); - AssertEx.EqualTolerance(UsTeaspoonsInOneCubicMeter, (double)usteaspoonQuantity.Value, UsTeaspoonsTolerance); - Assert.Equal(VolumeUnit.UsTeaspoon, usteaspoonQuantity.Unit); - } - - [Fact] - public void ConversionRoundTrip() - { - Volume cubicmeter = Volume.FromCubicMeters(1); - AssertEx.EqualTolerance(1, Volume.FromAuTablespoons(cubicmeter.AuTablespoons).CubicMeters, AuTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromCentiliters(cubicmeter.Centiliters).CubicMeters, CentilitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicCentimeters(cubicmeter.CubicCentimeters).CubicMeters, CubicCentimetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicDecimeters(cubicmeter.CubicDecimeters).CubicMeters, CubicDecimetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicFeet(cubicmeter.CubicFeet).CubicMeters, CubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicInches(cubicmeter.CubicInches).CubicMeters, CubicInchesTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicKilometers(cubicmeter.CubicKilometers).CubicMeters, CubicKilometersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMeters(cubicmeter.CubicMeters).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMicrometers(cubicmeter.CubicMicrometers).CubicMeters, CubicMicrometersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMiles(cubicmeter.CubicMiles).CubicMeters, CubicMilesTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicMillimeters(cubicmeter.CubicMillimeters).CubicMeters, CubicMillimetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromCubicYards(cubicmeter.CubicYards).CubicMeters, CubicYardsTolerance); - AssertEx.EqualTolerance(1, Volume.FromDeciliters(cubicmeter.Deciliters).CubicMeters, DecilitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromHectocubicFeet(cubicmeter.HectocubicFeet).CubicMeters, HectocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromHectocubicMeters(cubicmeter.HectocubicMeters).CubicMeters, HectocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromHectoliters(cubicmeter.Hectoliters).CubicMeters, HectolitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromImperialBeerBarrels(cubicmeter.ImperialBeerBarrels).CubicMeters, ImperialBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.FromImperialGallons(cubicmeter.ImperialGallons).CubicMeters, ImperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromImperialOunces(cubicmeter.ImperialOunces).CubicMeters, ImperialOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.FromKilocubicFeet(cubicmeter.KilocubicFeet).CubicMeters, KilocubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromKilocubicMeters(cubicmeter.KilocubicMeters).CubicMeters, KilocubicMetersTolerance); - AssertEx.EqualTolerance(1, Volume.FromKiloimperialGallons(cubicmeter.KiloimperialGallons).CubicMeters, KiloimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromKilousGallons(cubicmeter.KilousGallons).CubicMeters, KilousGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromLiters(cubicmeter.Liters).CubicMeters, LitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromMegacubicFeet(cubicmeter.MegacubicFeet).CubicMeters, MegacubicFeetTolerance); - AssertEx.EqualTolerance(1, Volume.FromMegaimperialGallons(cubicmeter.MegaimperialGallons).CubicMeters, MegaimperialGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMegausGallons(cubicmeter.MegausGallons).CubicMeters, MegausGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMetricCups(cubicmeter.MetricCups).CubicMeters, MetricCupsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMetricTeaspoons(cubicmeter.MetricTeaspoons).CubicMeters, MetricTeaspoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromMicroliters(cubicmeter.Microliters).CubicMeters, MicrolitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromMilliliters(cubicmeter.Milliliters).CubicMeters, MillilitersTolerance); - AssertEx.EqualTolerance(1, Volume.FromOilBarrels(cubicmeter.OilBarrels).CubicMeters, OilBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUkTablespoons(cubicmeter.UkTablespoons).CubicMeters, UkTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsBeerBarrels(cubicmeter.UsBeerBarrels).CubicMeters, UsBeerBarrelsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsCustomaryCups(cubicmeter.UsCustomaryCups).CubicMeters, UsCustomaryCupsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsGallons(cubicmeter.UsGallons).CubicMeters, UsGallonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsLegalCups(cubicmeter.UsLegalCups).CubicMeters, UsLegalCupsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsOunces(cubicmeter.UsOunces).CubicMeters, UsOuncesTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsPints(cubicmeter.UsPints).CubicMeters, UsPintsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsQuarts(cubicmeter.UsQuarts).CubicMeters, UsQuartsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsTablespoons(cubicmeter.UsTablespoons).CubicMeters, UsTablespoonsTolerance); - AssertEx.EqualTolerance(1, Volume.FromUsTeaspoons(cubicmeter.UsTeaspoons).CubicMeters, UsTeaspoonsTolerance); - } - - [Fact] - public void ArithmeticOperators() - { - Volume v = Volume.FromCubicMeters(1); - AssertEx.EqualTolerance(-1, -v.CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(2, (Volume.FromCubicMeters(3)-v).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(2, (v + v).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(10, (v*10).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(10, (10*v).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(2, (Volume.FromCubicMeters(10)/5).CubicMeters, CubicMetersTolerance); - AssertEx.EqualTolerance(2, Volume.FromCubicMeters(10)/Volume.FromCubicMeters(5), CubicMetersTolerance); - } - - [Fact] - public void ComparisonOperators() - { - Volume oneCubicMeter = Volume.FromCubicMeters(1); - Volume twoCubicMeters = Volume.FromCubicMeters(2); - - Assert.True(oneCubicMeter < twoCubicMeters); - Assert.True(oneCubicMeter <= twoCubicMeters); - Assert.True(twoCubicMeters > oneCubicMeter); - Assert.True(twoCubicMeters >= oneCubicMeter); - - Assert.False(oneCubicMeter > twoCubicMeters); - Assert.False(oneCubicMeter >= twoCubicMeters); - Assert.False(twoCubicMeters < oneCubicMeter); - Assert.False(twoCubicMeters <= oneCubicMeter); - } - - [Fact] - public void CompareToIsImplemented() - { - Volume cubicmeter = Volume.FromCubicMeters(1); - Assert.Equal(0, cubicmeter.CompareTo(cubicmeter)); - Assert.True(cubicmeter.CompareTo(Volume.Zero) > 0); - Assert.True(Volume.Zero.CompareTo(cubicmeter) < 0); - } - - [Fact] - public void CompareToThrowsOnTypeMismatch() - { - Volume cubicmeter = Volume.FromCubicMeters(1); - Assert.Throws(() => cubicmeter.CompareTo(new object())); - } - - [Fact] - public void CompareToThrowsOnNull() - { - Volume cubicmeter = Volume.FromCubicMeters(1); - Assert.Throws(() => cubicmeter.CompareTo(null)); - } - - [Fact] - public void EqualsIsImplemented() - { - Volume v = Volume.FromCubicMeters(1); - Assert.True(v.Equals(Volume.FromCubicMeters(1), CubicMetersTolerance, ComparisonType.Relative)); - Assert.False(v.Equals(Volume.Zero, CubicMetersTolerance, ComparisonType.Relative)); - } - - [Fact] - public void EqualsReturnsFalseOnTypeMismatch() - { - Volume cubicmeter = Volume.FromCubicMeters(1); - Assert.False(cubicmeter.Equals(new object())); - } - - [Fact] - public void EqualsReturnsFalseOnNull() - { - Volume cubicmeter = Volume.FromCubicMeters(1); - Assert.False(cubicmeter.Equals(null)); - } - - [Fact] - public void UnitsDoesNotContainUndefined() - { - Assert.DoesNotContain(VolumeUnit.Undefined, Volume.Units); - } - - [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() - { - var units = Enum.GetValues(typeof(VolumeUnit)).Cast(); - foreach(var unit in units) - { - if(unit == VolumeUnit.Undefined) - continue; - - var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); - } - } - } -} From 5f625cb2ead04f3727d56f67a798d8c3d09d34a2 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 15:13:58 -0400 Subject: [PATCH 079/131] Implementing dimensionless base dimension --- UnitsNet.Tests/BaseDimensionsTests.cs | 66 +++++++++++++++++++ .../Information.WindowsRuntimeComponent.g.cs | 2 +- .../Level.WindowsRuntimeComponent.g.cs | 2 +- UnitsNet/BaseDimensions.cs | 31 +++++++++ .../Quantities/Information.NetFramework.g.cs | 2 +- .../Quantities/Level.NetFramework.g.cs | 2 +- ...GenerateQuantitySourceCodeNetFramework.ps1 | 9 ++- ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 8 ++- 8 files changed, 115 insertions(+), 7 deletions(-) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 7ea943e63e..29e3ca5c64 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -6,6 +6,56 @@ namespace UnitsNet.Tests { public class BaseDimensionsTests { + [Fact] + public void ConstructorImplementedCorrectly() + { + var baseDimensions = new BaseDimensions(1, 2, 3, 4, 5, 6, 7); + + Assert.True(baseDimensions.Length == 1); + Assert.True(baseDimensions.Mass == 2); + Assert.True(baseDimensions.Time == 3); + Assert.True(baseDimensions.Current == 4); + Assert.True(baseDimensions.Temperature == 5); + Assert.True(baseDimensions.Amount == 6); + Assert.True(baseDimensions.LuminousIntensity == 7); + } + + [Theory] + [InlineData(1, 0, 0, 0, 0, 0, 0)] + [InlineData(0, 1, 0, 0, 0, 0, 0)] + [InlineData(0, 0, 1, 0, 0, 0, 0)] + [InlineData(0, 0, 0, 1, 0, 0, 0)] + [InlineData(0, 0, 0, 0, 1, 0, 0)] + [InlineData(0, 0, 0, 0, 0, 1, 0)] + [InlineData(0, 0, 0, 0, 0, 0, 1)] + public void IsBaseImplementedProperly(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) + { + var baseDimensions = new BaseDimensions(length, mass, time, current, temperature, amount, luminousIntensity); + var derivedDimensions = new BaseDimensions(length * 2, mass * 2, time * 2, current * 2, temperature * 2, amount * 2, luminousIntensity * 2); + + Assert.True(baseDimensions.IsBase()); + Assert.False(derivedDimensions.IsBase()); + Assert.False(BaseDimensions.Dimensionless.IsBase()); + } + + [Theory] + [InlineData(2, 0, 0, 0, 0, 0, 0)] + [InlineData(0, 2, 0, 0, 0, 0, 0)] + [InlineData(0, 0, 2, 0, 0, 0, 0)] + [InlineData(0, 0, 0, 2, 0, 0, 0)] + [InlineData(0, 0, 0, 0, 2, 0, 0)] + [InlineData(0, 0, 0, 0, 0, 2, 0)] + [InlineData(0, 0, 0, 0, 0, 0, 2)] + public void IsDerivedImplementedSuccessfully(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) + { + var baseDimensions = new BaseDimensions(length / 2, mass / 2, time / 2, current / 2, temperature / 2, amount / 2, luminousIntensity / 2); + var derivedDimensions = new BaseDimensions(length, mass, time, current, temperature, amount, luminousIntensity); + + Assert.False(baseDimensions.IsDerived()); + Assert.True(derivedDimensions.IsDerived()); + Assert.False(BaseDimensions.Dimensionless.IsDerived()); + } + [Fact] public void EqualsWorksAsExpected() { @@ -663,5 +713,21 @@ public void GetHashCodeWorksProperly() Assert.True(baseDimensions1.GetHashCode() != baseDimensions2.GetHashCode()); Assert.True(baseDimensions1.GetHashCode() == baseDimensions3.GetHashCode()); } + + [Fact] + public void DimensionLessPropertyIsCorrect() + { + Assert.True(BaseDimensions.Dimensionless == new BaseDimensions(0, 0, 0, 0, 0, 0, 0)); + } + + [Fact] + public void IsDimensionLessMethodImplementedCorrectly() + { + Assert.True(BaseDimensions.Dimensionless.IsDimensionless()); + Assert.True(new BaseDimensions(0, 0, 0, 0, 0, 0, 0).IsDimensionless()); + + // Example case + Assert.True(Level.BaseDimensions.IsDimensionless()); + } } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index a2fd03bcc8..661f864348 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -66,7 +66,7 @@ public sealed partial class Information : IQuantity static Information() { - BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); + BaseDimensions = BaseDimensions.Dimensionless; } /// /// Creates the quantity with a value of 0 in the base unit Bit. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index a8d924885c..91400e35e9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -66,7 +66,7 @@ public sealed partial class Level : IQuantity static Level() { - BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); + BaseDimensions = BaseDimensions.Dimensionless; } /// /// Creates the quantity with a value of 0 in the base unit Decibel. diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 8f1f0ea7d2..b118126211 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -41,6 +41,35 @@ public BaseDimensions(int length, int mass, int time, int current, int temperatu LuminousIntensity = luminousIntensity; } + /// + /// Checks if this base dimensions object represents a base quantity. + /// + /// True if this object represents a base quantity, otherwise false. + public bool IsBase() + { + var dimensionsArray = new int[]{Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}; + bool onlyOneEqualsOne = dimensionsArray.Where(dimension => dimension == 1).Take(2).Count() == 1; + return onlyOneEqualsOne; + } + + /// + /// Checks if this base dimensions object represents a derived quantity. + /// + /// True if this object represents a derived quantity, otherwise false. + public bool IsDerived() + { + return !IsBase() && !IsDimensionless(); + } + + /// + /// Checks if this base dimensions object represents a dimensionless quantity. + /// + /// True if this object represents a dimensionless quantity, otherwise false. + public bool IsDimensionless() + { + return this == Dimensionless; + } + /// public override bool Equals(object obj) { @@ -223,5 +252,7 @@ private static void AppendDimensionString(StringBuilder sb, string name, int val /// Gets the luminous intensity dimensions (J). /// public int LuminousIntensity{ get; } + + public static BaseDimensions Dimensionless { get; } = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); } } diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index f700290d38..72d82253f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -63,7 +63,7 @@ public partial struct Information : IQuantity, IComparable, ICo static Information() { - BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); + BaseDimensions = BaseDimensions.Dimensionless; } /// diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 2eb3c5b031..f5c6b09eb2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -63,7 +63,7 @@ public partial struct Level : IQuantity, IComparable, IComparable diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 6eff130e3a..ffa0872f5c 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -112,10 +112,15 @@ if ($obsoleteAttribute) static $quantityName() { -"@; if($baseDimensions) +"@; if($baseDimensions -eq $null -or ( $baseDimensions.Length -eq 0 -and $baseDimensions.Mass -eq 0 -and $baseDimensions.Time -eq 0 -and $baseDimensions.ElectricCurrent -eq 0 -and $baseDimensions.Temperature -eq 0 -and $baseDimensions.AmountOfSubstance -eq 0 -and $baseDimensions.LuminousIntensity -eq 0 ) ) + {@" + BaseDimensions = BaseDimensions.Dimensionless; +"@; } + else {@" BaseDimensions = new BaseDimensions($($baseDimensions.Length), $($baseDimensions.Mass), $($baseDimensions.Time), $($baseDimensions.ElectricCurrent), $($baseDimensions.Temperature), $($baseDimensions.AmountOfSubstance), $($baseDimensions.LuminousIntensity)); -"@; }@" +"@; } +@" } "@; # Windows Runtime Component requires a default constructor if ($wrc) {@" diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index 6248119c7a..4ca6bb70e5 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -264,7 +264,7 @@ namespace UnitsNet.Tests } [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + public void HasAtLeastOneAbbreviationSpecified() { var units = Enum.GetValues(typeof($unitEnumName)).Cast<$unitEnumName>(); foreach(var unit in units) @@ -275,6 +275,12 @@ namespace UnitsNet.Tests var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); } } + + [Fact] + public void BaseDimensionsShouldNeverBeNull() + { + Assert.False($quantityName.BaseDimensions is null); + } } } "@; From 466f68a045e7802a6bc002091303abe4778ec077 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 16 Oct 2018 16:31:32 -0400 Subject: [PATCH 080/131] Adding doc. Making tests cleaner. Small method name changes, --- UnitsNet.Tests/BaseDimensionsTests.cs | 12 ++-- UnitsNet.Tests/BaseUnitsTests.cs | 91 ++++++++++----------------- UnitsNet/BaseDimensions.cs | 14 ++++- 3 files changed, 49 insertions(+), 68 deletions(-) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 26a81fad36..cecb54327c 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -28,13 +28,13 @@ public void ConstructorImplementedCorrectly() [InlineData(0, 0, 0, 0, 1, 0, 0)] [InlineData(0, 0, 0, 0, 0, 1, 0)] [InlineData(0, 0, 0, 0, 0, 0, 1)] - public void IsBaseImplementedSuccessfully(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) + public void IsBaseQuantityImplementedProperly(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) { var baseDimensions = new BaseDimensions(length, mass, time, current, temperature, amount, luminousIntensity); var derivedDimensions = new BaseDimensions(length * 2, mass * 2, time * 2, current * 2, temperature * 2, amount * 2, luminousIntensity * 2); - Assert.True(baseDimensions.IsBase()); - Assert.False(derivedDimensions.IsBase()); + Assert.True(baseDimensions.IsBaseQuantity()); + Assert.False(derivedDimensions.IsBaseQuantity()); } [Theory] @@ -45,13 +45,13 @@ public void IsBaseImplementedSuccessfully(int length, int mass, int time, int cu [InlineData(0, 0, 0, 0, 2, 0, 0)] [InlineData(0, 0, 0, 0, 0, 2, 0)] [InlineData(0, 0, 0, 0, 0, 0, 2)] - public void IsDerivedImplementedSuccessfully(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) + public void IsDerivedQuantityImplementedProperly(int length, int mass, int time, int current, int temperature, int amount, int luminousIntensity) { var baseDimensions = new BaseDimensions(length / 2, mass / 2, time / 2, current / 2, temperature / 2, amount / 2, luminousIntensity / 2); var derivedDimensions = new BaseDimensions(length, mass, time, current, temperature, amount, luminousIntensity); - Assert.False(baseDimensions.IsDerived()); - Assert.True(derivedDimensions.IsDerived()); + Assert.False(baseDimensions.IsDerivedQuantity()); + Assert.True(derivedDimensions.IsDerivedQuantity()); } [Fact] diff --git a/UnitsNet.Tests/BaseUnitsTests.cs b/UnitsNet.Tests/BaseUnitsTests.cs index 16dacb1630..ad3a31370d 100644 --- a/UnitsNet.Tests/BaseUnitsTests.cs +++ b/UnitsNet.Tests/BaseUnitsTests.cs @@ -27,6 +27,15 @@ namespace UnitsNet.Tests { public class BaseUnitsTests { + private static BaseUnits siBaseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + private static BaseUnits siBaseUnitsCopy = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + + private static BaseUnits nonSiBaseUnits = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + [Fact] public void ConstructorSetsUnitsProperly() { @@ -45,63 +54,36 @@ public void ConstructorSetsUnitsProperly() [Fact] public void EqualsObjectIsImplementedCorrectly() { - var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + Assert.True(siBaseUnits.Equals((object)siBaseUnitsCopy)); + Assert.False(siBaseUnits.Equals((object)nonSiBaseUnits)); - var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - Assert.True(baseUnits1.Equals((object)baseUnits2)); - Assert.False(baseUnits1.Equals((object)baseUnits3)); - - Assert.False(baseUnits1.Equals("Some object.")); - Assert.False(baseUnits1.Equals((IFormatProvider)null)); + Assert.False(siBaseUnits.Equals("Some object.")); + Assert.False(siBaseUnits.Equals((IFormatProvider)null)); } [Fact] public void EqualsBaseUnitsIsImplementedCorrectly() { - var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + Assert.True(siBaseUnits.Equals(siBaseUnitsCopy)); + Assert.True(siBaseUnitsCopy.Equals(siBaseUnits)); - var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + Assert.False(siBaseUnits.Equals(nonSiBaseUnits)); + Assert.False(nonSiBaseUnits.Equals(siBaseUnits)); - Assert.True(baseUnits1.Equals(baseUnits2)); - Assert.True(baseUnits2.Equals(baseUnits1)); - - Assert.False(baseUnits1.Equals(baseUnits3)); - Assert.False(baseUnits3.Equals(baseUnits1)); - - Assert.False(baseUnits1.Equals(null)); + Assert.False(siBaseUnits.Equals(null)); } [Fact] public void EqualityOperatorIsImplementedCorrectly() { - var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); + Assert.True(siBaseUnits == siBaseUnitsCopy); + Assert.True(siBaseUnitsCopy == siBaseUnits); - Assert.True(baseUnits1 == baseUnits2); - Assert.True(baseUnits2 == baseUnits1); + Assert.False(siBaseUnits == nonSiBaseUnits); + Assert.False(nonSiBaseUnits == siBaseUnits); - Assert.False(baseUnits1 == baseUnits3); - Assert.False(baseUnits3 == baseUnits1); - - Assert.False(baseUnits1 == null); - Assert.False(null == baseUnits1); + Assert.False(siBaseUnits == null); + Assert.False(null == siBaseUnits); BaseUnits nullBaseUnits1 = null; BaseUnits nullBaseUnits2 = null; @@ -112,23 +94,14 @@ public void EqualityOperatorIsImplementedCorrectly() [Fact] public void InequalityOperatorIsImplementedCorrectly() { - var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - var baseUnits2 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - var baseUnits3 = new BaseUnits(LengthUnit.Foot, MassUnit.Pound, DurationUnit.Second, - ElectricCurrentUnit.Ampere, TemperatureUnit.DegreeFahrenheit, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - - Assert.False(baseUnits1 != baseUnits2); - Assert.False(baseUnits2 != baseUnits1); + Assert.False(siBaseUnits != siBaseUnitsCopy); + Assert.False(siBaseUnitsCopy != siBaseUnits); - Assert.True(baseUnits1 != baseUnits3); - Assert.True(baseUnits3 != baseUnits1); + Assert.True(siBaseUnits != nonSiBaseUnits); + Assert.True(nonSiBaseUnits != siBaseUnits); - Assert.True(baseUnits1 != null); - Assert.True(null != baseUnits1); + Assert.True(siBaseUnits != null); + Assert.True(null != siBaseUnits); BaseUnits nullBaseUnits1 = null; BaseUnits nullBaseUnits2 = null; @@ -139,10 +112,10 @@ public void InequalityOperatorIsImplementedCorrectly() [Fact] public void ToStringGivesExpectedResult() { - var baseUnits1 = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + var siBaseUnits = new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, LuminousIntensityUnit.Candela); - Assert.Equal("[Length]: m, [Mass]: kg, [Time]: s, [Current]: A, [Temperature]: K, [Amount]: mol, [LuminousIntensity]: cd", baseUnits1.ToString()); + Assert.Equal("[Length]: m, [Mass]: kg, [Time]: s, [Current]: A, [Temperature]: K, [Amount]: mol, [LuminousIntensity]: cd", siBaseUnits.ToString()); } } } diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index 4da59f07df..6e82d94ab1 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -42,16 +42,24 @@ public BaseDimensions(int length, int mass, int time, int current, int temperatu LuminousIntensity = luminousIntensity; } - public bool IsBase() + /// + /// Checks if the dimensions represent a base quantity. + /// + /// True if the dimensions represent a base quantity, otherwise false. + public bool IsBaseQuantity() { var dimensionsArray = new int[]{Length, Mass, Time, Current, Temperature, Amount, LuminousIntensity}; bool onlyOneEqualsOne = dimensionsArray.Where(dimension => dimension == 1).Take(2).Count() == 1; return onlyOneEqualsOne; } - public bool IsDerived() + /// + /// Checks the dimensions represent a derived quantity. + /// + /// True if the dimensions represent a derived quantity, otherwise false. + public bool IsDerivedQuantity() { - return !IsBase(); + return !IsBaseQuantity(); } /// From a187b58e598fd628770dcc03a3f438d58042605a Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 17 Oct 2018 09:18:46 -0400 Subject: [PATCH 081/131] Adding doc and tests --- UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs | 8 +++++++- UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs | 8 +++++++- UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs | 8 +++++++- UnitsNet/BaseDimensions.cs | 3 +++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 86a6c376d0..e118b75e76 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -435,7 +435,7 @@ public void UnitsDoesNotContainUndefined() } [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + public void HasAtLeastOneAbbreviationSpecified() { var units = Enum.GetValues(typeof(InformationUnit)).Cast(); foreach(var unit in units) @@ -446,5 +446,11 @@ public void AllUnitsHaveAtLeastOneAbbreviationSpecified() var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); } } + + [Fact] + public void BaseDimensionsShouldNeverBeNull() + { + Assert.False(Information.BaseDimensions is null); + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index e6ec38cd20..02e0798ada 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -419,7 +419,7 @@ public void UnitsDoesNotContainUndefined() } [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + public void HasAtLeastOneAbbreviationSpecified() { var units = Enum.GetValues(typeof(LengthUnit)).Cast(); foreach(var unit in units) @@ -430,5 +430,11 @@ public void AllUnitsHaveAtLeastOneAbbreviationSpecified() var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); } } + + [Fact] + public void BaseDimensionsShouldNeverBeNull() + { + Assert.False(Length.BaseDimensions is null); + } } } diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index 210411b811..e156b8563f 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -224,7 +224,7 @@ public void UnitsDoesNotContainUndefined() } [Fact] - public void AllUnitsHaveAtLeastOneAbbreviationSpecified() + public void HasAtLeastOneAbbreviationSpecified() { var units = Enum.GetValues(typeof(LevelUnit)).Cast(); foreach(var unit in units) @@ -235,5 +235,11 @@ public void AllUnitsHaveAtLeastOneAbbreviationSpecified() var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); } } + + [Fact] + public void BaseDimensionsShouldNeverBeNull() + { + Assert.False(Level.BaseDimensions is null); + } } } diff --git a/UnitsNet/BaseDimensions.cs b/UnitsNet/BaseDimensions.cs index e047289fd2..6ce00d968b 100644 --- a/UnitsNet/BaseDimensions.cs +++ b/UnitsNet/BaseDimensions.cs @@ -256,6 +256,9 @@ private static void AppendDimensionString(StringBuilder sb, string name, int val /// public int LuminousIntensity{ get; } + /// + /// Represents a dimensionless (unitless) quantity. + /// public static BaseDimensions Dimensionless { get; } = new BaseDimensions(0, 0, 0, 0, 0, 0, 0); } } From 8ca0738351dc956229f3508333540d47d7ec8b1c Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 17 Oct 2018 09:24:08 -0400 Subject: [PATCH 082/131] Cleanup --- UnitsNet.Tests/BaseDimensionsTests.cs | 4 ++-- .../Include-GenerateQuantitySourceCodeNetFramework.ps1 | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 8c470565da..2bc2ab2b90 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -723,13 +723,13 @@ public void GetHashCodeWorksProperly() } [Fact] - public void DimensionLessPropertyIsCorrect() + public void DimensionlessPropertyIsCorrect() { Assert.True(BaseDimensions.Dimensionless == new BaseDimensions(0, 0, 0, 0, 0, 0, 0)); } [Fact] - public void IsDimensionLessMethodImplementedCorrectly() + public void IsDimensionlessMethodImplementedCorrectly() { Assert.True(BaseDimensions.Dimensionless.IsDimensionless()); Assert.True(new BaseDimensions(0, 0, 0, 0, 0, 0, 0).IsDimensionless()); diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index ffa0872f5c..9f96b2e933 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -19,7 +19,9 @@ function GenerateQuantitySourceCodeNetFramework([Quantity]$quantity, [string]$ta $unitEnumName = "$quantityName" + "Unit" $wrc = $target -eq "WindowsRuntimeComponent" $privateAccessModifierIfWrc = if ($wrc) { "private" } else { "public" } + $baseDimensions = $quantity.BaseDimensions; + $isDimensionless = $baseDimensions -eq $null -or ( $baseDimensions.Length -eq 0 -and $baseDimensions.Mass -eq 0 -and $baseDimensions.Time -eq 0 -and $baseDimensions.ElectricCurrent -eq 0 -and $baseDimensions.Temperature -eq 0 -and $baseDimensions.AmountOfSubstance -eq 0 -and $baseDimensions.LuminousIntensity -eq 0 ) [GeneratorArgs]$genArgs = New-Object GeneratorArgs -Property @{ Quantity = $quantity; @@ -112,7 +114,7 @@ if ($obsoleteAttribute) static $quantityName() { -"@; if($baseDimensions -eq $null -or ( $baseDimensions.Length -eq 0 -and $baseDimensions.Mass -eq 0 -and $baseDimensions.Time -eq 0 -and $baseDimensions.ElectricCurrent -eq 0 -and $baseDimensions.Temperature -eq 0 -and $baseDimensions.AmountOfSubstance -eq 0 -and $baseDimensions.LuminousIntensity -eq 0 ) ) +"@; if($isDimensionless) {@" BaseDimensions = BaseDimensions.Dimensionless; "@; } From b2c0097cff3b7ae114461432b55d009491f8a744 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 17 Oct 2018 09:27:07 -0400 Subject: [PATCH 083/131] Add test --- UnitsNet.Tests/BaseDimensionsTests.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UnitsNet.Tests/BaseDimensionsTests.cs b/UnitsNet.Tests/BaseDimensionsTests.cs index 2bc2ab2b90..191d631946 100644 --- a/UnitsNet.Tests/BaseDimensionsTests.cs +++ b/UnitsNet.Tests/BaseDimensionsTests.cs @@ -734,6 +734,9 @@ public void IsDimensionlessMethodImplementedCorrectly() Assert.True(BaseDimensions.Dimensionless.IsDimensionless()); Assert.True(new BaseDimensions(0, 0, 0, 0, 0, 0, 0).IsDimensionless()); + Assert.False(BaseDimensions.Dimensionless.IsBaseQuantity()); + Assert.False(BaseDimensions.Dimensionless.IsDerivedQuantity()); + // Example case Assert.True(Level.BaseDimensions.IsDimensionless()); } From a3d043590d8671976ea25aba6eb1eca3aa3ba1c0 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 17 Oct 2018 11:43:40 -0400 Subject: [PATCH 084/131] Cleaning up some unused code and adding ValueTuple support to make unit abbreviations a bit clearer --- UnitsNet/CustomCode/UnitAbbreviationsCache.cs | 4 +- .../GeneratedCode/UnitAbbreviationsCache.g.cs | 1990 ++++++++--------- UnitsNet/I18n/AbbreviationsForCulture.cs | 39 - UnitsNet/I18n/CulturesForEnumValue.cs | 39 - UnitsNet/I18n/UnitLocalization.cs | 40 - ...de-GenerateUnitSystemDefaultSourceCode.ps1 | 10 +- UnitsNet/UnitsNet.Common.props | 1 + 7 files changed, 999 insertions(+), 1124 deletions(-) delete mode 100644 UnitsNet/I18n/AbbreviationsForCulture.cs delete mode 100644 UnitsNet/I18n/CulturesForEnumValue.cs delete mode 100644 UnitsNet/I18n/UnitLocalization.cs diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs index 7b7ec1cdd1..890fa74658 100644 --- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs +++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs @@ -65,8 +65,8 @@ private void LoadGeneratedAbbreviations() { foreach(var localization in GeneratedLocalizations) { - var culture = new CultureInfo(localization.Item1); - MapUnitToAbbreviation(localization.Item2, localization.Item3, culture, localization.Item4); + var culture = new CultureInfo(localization.CultureName); + MapUnitToAbbreviation(localization.UnitType, localization.UnitValue, culture, localization.UnitAbbreviations); } } diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index da7fe81ca9..d3e9d5c703 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -36,10 +36,6 @@ // THE SOFTWARE. using System; -using System.Globalization; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using UnitsNet.I18n; using UnitsNet.Units; // ReSharper disable RedundantCommaInArrayInitializer @@ -49,1000 +45,1000 @@ namespace UnitsNet { public partial class UnitAbbreviationsCache { - private static readonly Tuple[] GeneratedLocalizations - = new Tuple[] + private static readonly (string CultureName, Type UnitType, int UnitValue, string[] UnitAbbreviations)[] GeneratedLocalizations + = new [] { - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.CentimeterPerSecondSquared, new string[]{"cm/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.DecimeterPerSecondSquared, new string[]{"dm/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.FootPerSecondSquared, new string[]{"ft/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.InchPerSecondSquared, new string[]{"in/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KilometerPerSecondSquared, new string[]{"km/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerHour, new string[]{"kn/h"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerMinute, new string[]{"kn/min"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerSecond, new string[]{"kn/s"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MeterPerSecondSquared, new string[]{"m/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MicrometerPerSecondSquared, new string[]{"µm/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MillimeterPerSecondSquared, new string[]{"mm/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.NanometerPerSecondSquared, new string[]{"nm/s²"}), - Tuple.Create("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.StandardGravity, new string[]{"g"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Centimole, new string[]{"cmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.CentipoundMole, new string[]{"clbmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Decimole, new string[]{"dmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.DecipoundMole, new string[]{"dlbmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Kilomole, new string[]{"kmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.KilopoundMole, new string[]{"klbmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Micromole, new string[]{"µmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.MicropoundMole, new string[]{"µlbmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Millimole, new string[]{"mmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.MillipoundMole, new string[]{"mlbmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Mole, new string[]{"mol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Nanomole, new string[]{"nmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.NanopoundMole, new string[]{"nlbmol"}), - Tuple.Create("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.PoundMole, new string[]{"lbmol"}), - Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelMicrovolt, new string[]{"dBµV"}), - Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelMillivolt, new string[]{"dBmV"}), - Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelUnloaded, new string[]{"dBu"}), - Tuple.Create("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelVolt, new string[]{"dBV"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Arcminute, new string[]{"'", "arcmin", "amin", "min"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Arcsecond, new string[]{"″", "arcsec", "asec", "sec"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Centiradian, new string[]{"crad"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Centiradian, new string[]{"cрад"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Deciradian, new string[]{"drad"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Deciradian, new string[]{"dрад"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Degree, new string[]{"°", "deg"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Degree, new string[]{"°"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µrad"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µрад"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mrad"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mрад"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nrad"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nрад"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Radian, new string[]{"rad"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Radian, new string[]{"рад"}), - Tuple.Create("en-US", typeof(AngleUnit), (int)AngleUnit.Revolution, new string[]{"r"}), - Tuple.Create("ru-RU", typeof(AngleUnit), (int)AngleUnit.Revolution, new string[]{"r"}), - Tuple.Create("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.KilovoltampereHour, new string[]{"kVAh"}), - Tuple.Create("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.MegavoltampereHour, new string[]{"MVAh"}), - Tuple.Create("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.VoltampereHour, new string[]{"VAh"}), - Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Gigavoltampere, new string[]{"GVA"}), - Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Kilovoltampere, new string[]{"kVA"}), - Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Megavoltampere, new string[]{"MVA"}), - Tuple.Create("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Voltampere, new string[]{"VA"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.Acre, new string[]{"ac"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.Hectare, new string[]{"ha"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareCentimeter, new string[]{"cm²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareCentimeter, new string[]{"см²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareDecimeter, new string[]{"dm²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareDecimeter, new string[]{"дм²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareFoot, new string[]{"ft²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareFoot, new string[]{"фут²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareInch, new string[]{"in²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareInch, new string[]{"дюйм²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareKilometer, new string[]{"km²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareKilometer, new string[]{"км²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMeter, new string[]{"m²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMeter, new string[]{"м²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMicrometer, new string[]{"µm²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMicrometer, new string[]{"мкм²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMile, new string[]{"mi²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMile, new string[]{"миля²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMillimeter, new string[]{"mm²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMillimeter, new string[]{"мм²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.SquareYard, new string[]{"yd²"}), - Tuple.Create("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareYard, new string[]{"ярд²"}), - Tuple.Create("en-US", typeof(AreaUnit), (int)AreaUnit.UsSurveySquareFoot, new string[]{"ft² (US)"}), - Tuple.Create("en-US", typeof(AreaDensityUnit), (int)AreaDensityUnit.KilogramPerSquareMeter, new string[]{"kg/m²"}), - Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.CentimeterToTheFourth, new string[]{"cm⁴", "cm^4"}), - Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.DecimeterToTheFourth, new string[]{"dm⁴", "dm^4"}), - Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.FootToTheFourth, new string[]{"ft⁴", "ft^4"}), - Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.InchToTheFourth, new string[]{"in⁴", "in^4"}), - Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.MeterToTheFourth, new string[]{"m⁴", "m^4"}), - Tuple.Create("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.MillimeterToTheFourth, new string[]{"mm⁴", "mm^4"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.BitPerSecond, new string[]{"bit/s", "bps"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.BytePerSecond, new string[]{"B/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabitPerSecond, new string[]{"Ebit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabytePerSecond, new string[]{"EB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibitPerSecond, new string[]{"Eibit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibytePerSecond, new string[]{"EiB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibitPerSecond, new string[]{"Gibit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibytePerSecond, new string[]{"GiB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabitPerSecond, new string[]{"Gbit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabytePerSecond, new string[]{"GB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibitPerSecond, new string[]{"Kibit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibytePerSecond, new string[]{"KiB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobitPerSecond, new string[]{"kbit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobytePerSecond, new string[]{"kB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibitPerSecond, new string[]{"Mibit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibytePerSecond, new string[]{"MiB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabitPerSecond, new string[]{"Mbit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabytePerSecond, new string[]{"MB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibitPerSecond, new string[]{"Pibit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibytePerSecond, new string[]{"PiB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabitPerSecond, new string[]{"Pbit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabytePerSecond, new string[]{"PB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibitPerSecond, new string[]{"Tibit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibytePerSecond, new string[]{"TiB/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabitPerSecond, new string[]{"Tbit/s"}), - Tuple.Create("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabytePerSecond, new string[]{"TB/s"}), - Tuple.Create("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, new string[]{"g/kWh"}), - Tuple.Create("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, new string[]{"kg/J"}), - Tuple.Create("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, new string[]{"lb/hph"}), - Tuple.Create("en-US", typeof(CapacitanceUnit), (int)CapacitanceUnit.Farad, new string[]{"F"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerDeciliter, new string[]{"cg/dl"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerLiter, new string[]{"cg/L"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerMilliliter, new string[]{"cg/ml"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerDeciliter, new string[]{"dg/dl"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerLiter, new string[]{"dg/L"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerMilliliter, new string[]{"dg/ml"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicCentimeter, new string[]{"g/cm³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMeter, new string[]{"g/m³"}), - Tuple.Create("ru-RU", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMeter, new string[]{"г/м³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMillimeter, new string[]{"g/mm³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerDeciliter, new string[]{"g/dl"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerLiter, new string[]{"g/L"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerMilliliter, new string[]{"g/ml"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicCentimeter, new string[]{"kg/cm³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMeter, new string[]{"kg/m³"}), - Tuple.Create("ru-RU", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMeter, new string[]{"kг/м³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMillimeter, new string[]{"kg/mm³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilopoundPerCubicFoot, new string[]{"kip/ft³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.KilopoundPerCubicInch, new string[]{"kip/in³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerDeciliter, new string[]{"µg/dl"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerLiter, new string[]{"µg/L"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerMilliliter, new string[]{"µg/ml"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerCubicMeter, new string[]{"mg/m³"}), - Tuple.Create("ru-RU", typeof(DensityUnit), (int)DensityUnit.MilligramPerCubicMeter, new string[]{"mг/м³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerDeciliter, new string[]{"mg/dl"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerLiter, new string[]{"mg/L"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerMilliliter, new string[]{"mg/ml"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerDeciliter, new string[]{"ng/dl"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerLiter, new string[]{"ng/L"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerMilliliter, new string[]{"ng/ml"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerDeciliter, new string[]{"pg/dl"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerLiter, new string[]{"pg/L"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerMilliliter, new string[]{"pg/ml"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerCubicFoot, new string[]{"lb/ft³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerCubicInch, new string[]{"lb/in³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerImperialGallon, new string[]{"ppg (imp.)"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerUSGallon, new string[]{"ppg (U.S.)"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.SlugPerCubicFoot, new string[]{"slug/ft³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicCentimeter, new string[]{"t/cm³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicMeter, new string[]{"t/m³"}), - Tuple.Create("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicMillimeter, new string[]{"t/mm³"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Day, new string[]{"d", "day", "days"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Day, new string[]{"д"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"h", "hr", "hrs", "hour", "hours"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"ч"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µs"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мкс"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"ms"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мс"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"m", "min", "minute", "minutes"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"мин"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"mo", "month", "months"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"месяц"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"ns"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нс"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"s", "sec", "secs", "second", "seconds"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"с"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"wk", "week", "weeks"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"мин"}), - Tuple.Create("en-US", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"yr", "year", "years"}), - Tuple.Create("ru-RU", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"год"}), - Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.Centipoise, new string[]{"cP"}), - Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.MicropascalSecond, new string[]{"µPaS"}), - Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.MillipascalSecond, new string[]{"mPaS"}), - Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.NewtonSecondPerMeterSquared, new string[]{"Ns/m²"}), - Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.PascalSecond, new string[]{"PaS"}), - Tuple.Create("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.Poise, new string[]{"P"}), - Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Microsiemens, new string[]{"µS"}), - Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Millisiemens, new string[]{"mS"}), - Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Nanosiemens, new string[]{"nS"}), - Tuple.Create("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Siemens, new string[]{"S"}), - Tuple.Create("en-US", typeof(ElectricChargeUnit), (int)ElectricChargeUnit.Coulomb, new string[]{"C"}), - Tuple.Create("en-US", typeof(ElectricChargeDensityUnit), (int)ElectricChargeDensityUnit.CoulombPerCubicMeter, new string[]{"C/m³"}), - Tuple.Create("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Microsiemens, new string[]{"µS"}), - Tuple.Create("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Millisiemens, new string[]{"mS"}), - Tuple.Create("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Siemens, new string[]{"S"}), - Tuple.Create("en-US", typeof(ElectricConductivityUnit), (int)ElectricConductivityUnit.SiemensPerMeter, new string[]{"S/m"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Ampere, new string[]{"A"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Centiampere, new string[]{"cA"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Kiloampere, new string[]{"kA"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Megaampere, new string[]{"MA"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Microampere, new string[]{"µA"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Milliampere, new string[]{"mA"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Nanoampere, new string[]{"nA"}), - Tuple.Create("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Picoampere, new string[]{"pA"}), - Tuple.Create("en-US", typeof(ElectricCurrentDensityUnit), (int)ElectricCurrentDensityUnit.AmperePerSquareMeter, new string[]{"A/m²"}), - Tuple.Create("en-US", typeof(ElectricCurrentGradientUnit), (int)ElectricCurrentGradientUnit.AmperePerSecond, new string[]{"A/s"}), - Tuple.Create("en-US", typeof(ElectricFieldUnit), (int)ElectricFieldUnit.VoltPerMeter, new string[]{"V/m"}), - Tuple.Create("en-US", typeof(ElectricInductanceUnit), (int)ElectricInductanceUnit.Henry, new string[]{"H"}), - Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Kilovolt, new string[]{"kV"}), - Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Kilovolt, new string[]{"kВ"}), - Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Megavolt, new string[]{"MV"}), - Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Megavolt, new string[]{"MВ"}), - Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Microvolt, new string[]{"µV"}), - Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Microvolt, new string[]{"µВ"}), - Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Millivolt, new string[]{"mV"}), - Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Millivolt, new string[]{"mВ"}), - Tuple.Create("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Volt, new string[]{"V"}), - Tuple.Create("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Volt, new string[]{"В"}), - Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.KilovoltAc, new string[]{"kVac"}), - Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MegavoltAc, new string[]{"MVac"}), - Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MicrovoltAc, new string[]{"µVac"}), - Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MillivoltAc, new string[]{"mVac"}), - Tuple.Create("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.VoltAc, new string[]{"Vac"}), - Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.KilovoltDc, new string[]{"kVdc"}), - Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MegavoltDc, new string[]{"MVdc"}), - Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MicrovoltDc, new string[]{"µVdc"}), - Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MillivoltDc, new string[]{"mVdc"}), - Tuple.Create("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.VoltDc, new string[]{"Vdc"}), - Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Kiloohm, new string[]{"kΩ"}), - Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Megaohm, new string[]{"MΩ"}), - Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Milliohm, new string[]{"mΩ"}), - Tuple.Create("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Ohm, new string[]{"Ω"}), - Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.MicroohmMeter, new string[]{"µΩ·m"}), - Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.MilliohmMeter, new string[]{"mΩ·m"}), - Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.NanoohmMeter, new string[]{"nΩ·m"}), - Tuple.Create("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.OhmMeter, new string[]{"Ω·m"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.BritishThermalUnit, new string[]{"BTU"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Calorie, new string[]{"cal"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermEc, new string[]{"Dth (E.C.)"}), - Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermEc, new string[]{"Европейский декатерм"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermImperial, new string[]{"Dth (imp.)"}), - Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermImperial, new string[]{"Английский декатерм"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermUs, new string[]{"Dth (U.S.)"}), - Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermUs, new string[]{"Американский декатерм"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ElectronVolt, new string[]{"eV"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Erg, new string[]{"erg"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.FootPound, new string[]{"ft·lb"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigabritishThermalUnit, new string[]{"GBTU"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigawattHour, new string[]{"GWh"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigawattHour, new string[]{"GВт/ч"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Joule, new string[]{"J"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilobritishThermalUnit, new string[]{"kBTU"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Kilocalorie, new string[]{"kcal"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Kilojoule, new string[]{"kJ"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilowattHour, new string[]{"kWh"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilowattHour, new string[]{"kВт/ч"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegabritishThermalUnit, new string[]{"MBTU"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.Megajoule, new string[]{"MJ"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegawattHour, new string[]{"MWh"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegawattHour, new string[]{"MВт/ч"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermEc, new string[]{"th (E.C.)"}), - Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermEc, new string[]{"Европейский терм"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermImperial, new string[]{"th (imp.)"}), - Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermImperial, new string[]{"Английский терм"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermUs, new string[]{"th (U.S.)"}), - Tuple.Create("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermUs, new string[]{"Американский терм"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.WattHour, new string[]{"Wh"}), - Tuple.Create("en-US", typeof(EnergyUnit), (int)EnergyUnit.WattHour, new string[]{"Вт/ч"}), - Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.CaloriePerKelvin, new string[]{"cal/K"}), - Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.JoulePerDegreeCelsius, new string[]{"J/C"}), - Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.JoulePerKelvin, new string[]{"J/K"}), - Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilocaloriePerKelvin, new string[]{"kcal/K"}), - Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilojoulePerDegreeCelsius, new string[]{"kJ/C"}), - Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilojoulePerKelvin, new string[]{"kJ/K"}), - Tuple.Create("en-US", typeof(EntropyUnit), (int)EntropyUnit.MegajoulePerKelvin, new string[]{"MJ/K"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Decanewton, new string[]{"daN"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Decanewton, new string[]{"даН"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Dyn, new string[]{"dyn"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Dyn, new string[]{"дин"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.KilogramForce, new string[]{"kgf"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.KilogramForce, new string[]{"кгс"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Kilonewton, new string[]{"kN"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Kilonewton, new string[]{"кН"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.KiloPond, new string[]{"kp"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.KiloPond, new string[]{"кгс"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Meganewton, new string[]{"MN"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Meganewton, new string[]{""}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Newton, new string[]{"N"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Newton, new string[]{"Н"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.Poundal, new string[]{"pdl"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.Poundal, new string[]{"паундаль"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.PoundForce, new string[]{"lbf"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.PoundForce, new string[]{"фунт-сила"}), - Tuple.Create("en-US", typeof(ForceUnit), (int)ForceUnit.TonneForce, new string[]{"Ton"}), - Tuple.Create("ru-RU", typeof(ForceUnit), (int)ForceUnit.TonneForce, new string[]{"тс"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.CentinewtonPerSecond, new string[]{"cN/s"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecanewtonPerMinute, new string[]{"daN/min"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecanewtonPerSecond, new string[]{"daN/s"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecinewtonPerSecond, new string[]{"dN/s"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.KilonewtonPerMinute, new string[]{"kN/min"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.KilonewtonPerSecond, new string[]{"kN/s"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.MicronewtonPerSecond, new string[]{"µN/s"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.MillinewtonPerSecond, new string[]{"mN/s"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NanonewtonPerSecond, new string[]{"nN/s"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NewtonPerMinute, new string[]{"N/min"}), - Tuple.Create("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NewtonPerSecond, new string[]{"N/s"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.CentinewtonPerMeter, new string[]{"cN/m"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.DecinewtonPerMeter, new string[]{"dN/m"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"kgf/m"}), - Tuple.Create("ru-RU", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"кгс/м"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilonewtonPerMeter, new string[]{"kN/m"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MeganewtonPerMeter, new string[]{"MN/m"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MicronewtonPerMeter, new string[]{"µN/m"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MillinewtonPerMeter, new string[]{"mN/m"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.NanonewtonPerMeter, new string[]{"nN/m"}), - Tuple.Create("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.NewtonPerMeter, new string[]{"N/m"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.CyclePerHour, new string[]{"cph"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.CyclePerMinute, new string[]{"cpm"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Gigahertz, new string[]{"GHz"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Hertz, new string[]{"Hz"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Kilohertz, new string[]{"kHz"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Megahertz, new string[]{"MHz"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.RadianPerSecond, new string[]{"rad/s"}), - Tuple.Create("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Terahertz, new string[]{"THz"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerHourSquareFoot, new string[]{"BTU/h·ft²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerMinuteSquareFoot, new string[]{"BTU/min·ft²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerSecondSquareFoot, new string[]{"BTU/s·ft²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerSecondSquareInch, new string[]{"BTU/s·in²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.CaloriePerSecondSquareCentimeter, new string[]{"cal/s·cm²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.CentiwattPerSquareMeter, new string[]{"cW/m²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.DeciwattPerSquareMeter, new string[]{"dW/m²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilocaloriePerHourSquareMeter, new string[]{"kcal/h·m²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, new string[]{"kcal/s·cm²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilowattPerSquareMeter, new string[]{"kW/m²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MicrowattPerSquareMeter, new string[]{"µW/m²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MilliwattPerSquareMeter, new string[]{"mW/m²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.NanowattPerSquareMeter, new string[]{"nW/m²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareFoot, new string[]{"W/ft²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareInch, new string[]{"W/in²"}), - Tuple.Create("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareMeter, new string[]{"W/m²"}), - Tuple.Create("en-US", typeof(HeatTransferCoefficientUnit), (int)HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, new string[]{"W/m²·°C"}), - Tuple.Create("en-US", typeof(HeatTransferCoefficientUnit), (int)HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, new string[]{"W/m²·K"}), - Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Kilolux, new string[]{"klx"}), - Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Lux, new string[]{"lx"}), - Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Megalux, new string[]{"Mlx"}), - Tuple.Create("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Millilux, new string[]{"mlx"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Bit, new string[]{"b"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Byte, new string[]{"B"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exabit, new string[]{"Eb"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exabyte, new string[]{"EB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exbibit, new string[]{"Eib"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Exbibyte, new string[]{"EiB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gibibit, new string[]{"Gib"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gibibyte, new string[]{"GiB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gigabit, new string[]{"Gb"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Gigabyte, new string[]{"GB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kibibit, new string[]{"Kib"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kibibyte, new string[]{"KiB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kilobit, new string[]{"kb"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Kilobyte, new string[]{"kB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Mebibit, new string[]{"Mib"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Mebibyte, new string[]{"MiB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Megabit, new string[]{"Mb"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Megabyte, new string[]{"MB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Pebibit, new string[]{"Pib"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Pebibyte, new string[]{"PiB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Petabit, new string[]{"Pb"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Petabyte, new string[]{"PB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Tebibit, new string[]{"Tib"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Tebibyte, new string[]{"TiB"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Terabit, new string[]{"Tb"}), - Tuple.Create("en-US", typeof(InformationUnit), (int)InformationUnit.Terabyte, new string[]{"TB"}), - Tuple.Create("en-US", typeof(IrradianceUnit), (int)IrradianceUnit.KilowattPerSquareMeter, new string[]{"kW/m²"}), - Tuple.Create("en-US", typeof(IrradianceUnit), (int)IrradianceUnit.WattPerSquareMeter, new string[]{"W/m²"}), - Tuple.Create("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.JoulePerSquareMeter, new string[]{"J/m²"}), - Tuple.Create("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.KilowattHourPerSquareMeter, new string[]{"kWh/m²"}), - Tuple.Create("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.WattHourPerSquareMeter, new string[]{"Wh/m²"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Centistokes, new string[]{"cSt"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Centistokes, new string[]{"сСт"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Decistokes, new string[]{"dSt"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Decistokes, new string[]{"дСт"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Kilostokes, new string[]{"kSt"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Kilostokes, new string[]{"кСт"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Microstokes, new string[]{"µSt"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Microstokes, new string[]{"мкСт"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Millistokes, new string[]{"mSt"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Millistokes, new string[]{"мСт"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Nanostokes, new string[]{"nSt"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Nanostokes, new string[]{"нСт"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.SquareMeterPerSecond, new string[]{"m²/s"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.SquareMeterPerSecond, new string[]{"м²/с"}), - Tuple.Create("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Stokes, new string[]{"St"}), - Tuple.Create("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Stokes, new string[]{"Ст"}), - Tuple.Create("en-US", typeof(LapseRateUnit), (int)LapseRateUnit.DegreeCelsiusPerKilometer, new string[]{"∆°C/km"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Centimeter, new string[]{"cm"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Centimeter, new string[]{"см"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Decimeter, new string[]{"dm"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Decimeter, new string[]{"дм"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPica, new string[]{"pica"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPoint, new string[]{"pt"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Fathom, new string[]{"fathom"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"ft", "'", "′"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"фут"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"in", "\"", "″"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"дюйм"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"km"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"км"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Meter, new string[]{"m"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Meter, new string[]{"м"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Microinch, new string[]{"µin"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Microinch, new string[]{"микродюйм"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Micrometer, new string[]{"µm"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Micrometer, new string[]{"мкм"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Mil, new string[]{"mil"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Mil, new string[]{"мил"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Mile, new string[]{"mi"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Mile, new string[]{"миля"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Millimeter, new string[]{"mm"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Millimeter, new string[]{"мм"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Nanometer, new string[]{"nm"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Nanometer, new string[]{"нм"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.NauticalMile, new string[]{"NM"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.NauticalMile, new string[]{"мил"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.PrinterPica, new string[]{"pica"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.PrinterPoint, new string[]{"pt"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Shackle, new string[]{"shackle"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Twip, new string[]{"twip"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.UsSurveyFoot, new string[]{"ftUS"}), - Tuple.Create("en-US", typeof(LengthUnit), (int)LengthUnit.Yard, new string[]{"yd"}), - Tuple.Create("ru-RU", typeof(LengthUnit), (int)LengthUnit.Yard, new string[]{"ярд"}), - Tuple.Create("en-US", typeof(LevelUnit), (int)LevelUnit.Decibel, new string[]{"dB"}), - Tuple.Create("en-US", typeof(LevelUnit), (int)LevelUnit.Neper, new string[]{"Np"}), - Tuple.Create("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.GramPerMeter, new string[]{"g/m"}), - Tuple.Create("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.KilogramPerMeter, new string[]{"kg/m"}), - Tuple.Create("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.PoundPerFoot, new string[]{"lb/ft"}), - Tuple.Create("en-US", typeof(LuminousFluxUnit), (int)LuminousFluxUnit.Lumen, new string[]{"lm"}), - Tuple.Create("en-US", typeof(LuminousIntensityUnit), (int)LuminousIntensityUnit.Candela, new string[]{"cd"}), - Tuple.Create("en-US", typeof(MagneticFieldUnit), (int)MagneticFieldUnit.Tesla, new string[]{"T"}), - Tuple.Create("en-US", typeof(MagneticFluxUnit), (int)MagneticFluxUnit.Weber, new string[]{"Wb"}), - Tuple.Create("en-US", typeof(MagnetizationUnit), (int)MagnetizationUnit.AmperePerMeter, new string[]{"A/m"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Centigram, new string[]{"cg"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Centigram, new string[]{"сг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Decagram, new string[]{"dag"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Decagram, new string[]{"даг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Decigram, new string[]{"dg"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Decigram, new string[]{"дг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Gram, new string[]{"g"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Gram, new string[]{"г"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Hectogram, new string[]{"hg"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Hectogram, new string[]{"гг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"kg"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"кг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klb"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"kфунт"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"kt"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"кт"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.LongHundredweight, new string[]{"cwt"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"long tn"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"тонна большая"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlb"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mфунт"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Mt"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Мт"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Microgram, new string[]{"µg"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Microgram, new string[]{"мкг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Milligram, new string[]{"mg"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Milligram, new string[]{"мг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Nanogram, new string[]{"ng"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Nanogram, new string[]{"нг"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Ounce, new string[]{"oz"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Pound, new string[]{"lb", "lbs", "lbm"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Pound, new string[]{"фунт"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.ShortHundredweight, new string[]{"cwt"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.ShortTon, new string[]{"short tn"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.ShortTon, new string[]{"тонна малая"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Slug, new string[]{"slug"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Stone, new string[]{"st"}), - Tuple.Create("en-US", typeof(MassUnit), (int)MassUnit.Tonne, new string[]{"t"}), - Tuple.Create("ru-RU", typeof(MassUnit), (int)MassUnit.Tonne, new string[]{"т"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.CentigramPerSecond, new string[]{"cg/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.DecagramPerSecond, new string[]{"dag/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.DecigramPerSecond, new string[]{"dg/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.GramPerSecond, new string[]{"g/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.HectogramPerSecond, new string[]{"hg/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerHour, new string[]{"kg/h"}), - Tuple.Create("ru-RU", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerHour, new string[]{"кг/ч"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerSecond, new string[]{"kg/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MegapoundPerHour, new string[]{"Mlb/h"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MicrogramPerSecond, new string[]{"µg/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MilligramPerSecond, new string[]{"mg/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.NanogramPerSecond, new string[]{"ng/S"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.PoundPerHour, new string[]{"lb/h"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.ShortTonPerHour, new string[]{"short tn/h"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerDay, new string[]{"t/d"}), - Tuple.Create("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerHour, new string[]{"t/h"}), - Tuple.Create("en-US", typeof(MassFluxUnit), (int)MassFluxUnit.GramPerSecondPerSquareMeter, new string[]{"g·s⁻¹·m⁻²"}), - Tuple.Create("en-US", typeof(MassFluxUnit), (int)MassFluxUnit.KilogramPerSecondPerSquareMeter, new string[]{"kg·s⁻¹·m⁻²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareCentimeter, new string[]{"g·cm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareDecimeter, new string[]{"g·dm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareMeter, new string[]{"g·m²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareMillimeter, new string[]{"g·mm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareCentimeter, new string[]{"kg·cm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareDecimeter, new string[]{"kg·dm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareMeter, new string[]{"kg·m²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareMillimeter, new string[]{"kg·mm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareCentimeter, new string[]{"kt·cm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareDecimeter, new string[]{"kt·dm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareMeter, new string[]{"kt·m²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareMilimeter, new string[]{"kt·mm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareCentimeter, new string[]{"Mt·cm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareDecimeter, new string[]{"Mt·dm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareMeter, new string[]{"Mt·m²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareMilimeter, new string[]{"Mt·mm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareCentimeter, new string[]{"mg·cm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareDecimeter, new string[]{"mg·dm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareMeter, new string[]{"mg·m²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareMillimeter, new string[]{"mg·mm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.PoundSquareFoot, new string[]{"lb·ft²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.PoundSquareInch, new string[]{"lb·in²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.SlugSquareFoot, new string[]{"slug·ft²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.SlugSquareInch, new string[]{"slug·in²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareCentimeter, new string[]{"t·cm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareDecimeter, new string[]{"t·dm²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareMeter, new string[]{"t·m²"}), - Tuple.Create("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareMilimeter, new string[]{"t·mm²"}), - Tuple.Create("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.JoulePerMole, new string[]{"J/mol"}), - Tuple.Create("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.KilojoulePerMole, new string[]{"kJ/mol"}), - Tuple.Create("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.MegajoulePerMole, new string[]{"MJ/mol"}), - Tuple.Create("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.JoulePerMoleKelvin, new string[]{"J/(mol*K)"}), - Tuple.Create("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.KilojoulePerMoleKelvin, new string[]{"kJ/(mol*K)"}), - Tuple.Create("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.MegajoulePerMoleKelvin, new string[]{"MJ/(mol*K)"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.CentimolesPerLiter, new string[]{"cmol/L"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.DecimolesPerLiter, new string[]{"dmol/L"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MicromolesPerLiter, new string[]{"µmol/L"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MillimolesPerLiter, new string[]{"mmol/L"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerCubicMeter, new string[]{"mol/m³"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerLiter, new string[]{"mol/L"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.NanomolesPerLiter, new string[]{"nmol/L"}), - Tuple.Create("en-US", typeof(MolarityUnit), (int)MolarityUnit.PicomolesPerLiter, new string[]{"pmol/L"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"cg/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"сг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"dag/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"даг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecigramPerMole, new string[]{"dg/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.DecigramPerMole, new string[]{"дг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.GramPerMole, new string[]{"g/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.GramPerMole, new string[]{"г/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.HectogramPerMole, new string[]{"hg/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.HectogramPerMole, new string[]{"гг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.KilogramPerMole, new string[]{"kg/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.KilogramPerMole, new string[]{"кг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.KilopoundPerMole, new string[]{"klb/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.KilopoundPerMole, new string[]{"kфунт/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MegapoundPerMole, new string[]{"Mlb/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MegapoundPerMole, new string[]{"Mфунт/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MicrogramPerMole, new string[]{"µg/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MicrogramPerMole, new string[]{"мкг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MilligramPerMole, new string[]{"mg/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MilligramPerMole, new string[]{"мг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.NanogramPerMole, new string[]{"ng/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.NanogramPerMole, new string[]{"нг/моль"}), - Tuple.Create("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.PoundPerMole, new string[]{"lb/mol"}), - Tuple.Create("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.PoundPerMole, new string[]{"фунт/моль"}), - Tuple.Create("en-US", typeof(PermeabilityUnit), (int)PermeabilityUnit.HenryPerMeter, new string[]{"H/m"}), - Tuple.Create("en-US", typeof(PermittivityUnit), (int)PermittivityUnit.FaradPerMeter, new string[]{"F/m"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.BoilerHorsepower, new string[]{"hp(S)"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.BritishThermalUnitPerHour, new string[]{"Btu/hr"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Decawatt, new string[]{"daW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Deciwatt, new string[]{"dW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.ElectricalHorsepower, new string[]{"hp(E)"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Femtowatt, new string[]{"fW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Gigawatt, new string[]{"GW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.HydraulicHorsepower, new string[]{"hp(H)"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.KilobritishThermalUnitPerHour, new string[]{"kBtu/hr"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Kilowatt, new string[]{"kW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.MechanicalHorsepower, new string[]{"hp(I)"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Megawatt, new string[]{"MW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.MetricHorsepower, new string[]{"hp(M)"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Microwatt, new string[]{"µW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Milliwatt, new string[]{"mW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Nanowatt, new string[]{"nW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Petawatt, new string[]{"PW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Picowatt, new string[]{"pW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Terawatt, new string[]{"TW"}), - Tuple.Create("en-US", typeof(PowerUnit), (int)PowerUnit.Watt, new string[]{"W"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicFoot, new string[]{"daW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicInch, new string[]{"daW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicMeter, new string[]{"daW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerLiter, new string[]{"daW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicFoot, new string[]{"dW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicInch, new string[]{"dW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicMeter, new string[]{"dW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerLiter, new string[]{"dW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicFoot, new string[]{"GW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicInch, new string[]{"GW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicMeter, new string[]{"GW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerLiter, new string[]{"GW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicFoot, new string[]{"kW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicInch, new string[]{"kW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicMeter, new string[]{"kW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerLiter, new string[]{"kW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicFoot, new string[]{"MW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicInch, new string[]{"MW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicMeter, new string[]{"MW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerLiter, new string[]{"MW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicFoot, new string[]{"µW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicInch, new string[]{"µW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicMeter, new string[]{"µW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerLiter, new string[]{"µW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicFoot, new string[]{"mW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicInch, new string[]{"mW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicMeter, new string[]{"mW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerLiter, new string[]{"mW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicFoot, new string[]{"nW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicInch, new string[]{"nW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicMeter, new string[]{"nW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerLiter, new string[]{"nW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicFoot, new string[]{"pW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicInch, new string[]{"pW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicMeter, new string[]{"pW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerLiter, new string[]{"pW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicFoot, new string[]{"TW/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicInch, new string[]{"TW/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicMeter, new string[]{"TW/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerLiter, new string[]{"TW/l"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicFoot, new string[]{"W/ft³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicInch, new string[]{"W/in³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicMeter, new string[]{"W/m³"}), - Tuple.Create("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerLiter, new string[]{"W/l"}), - Tuple.Create("en-US", typeof(PowerRatioUnit), (int)PowerRatioUnit.DecibelMilliwatt, new string[]{"dBmW", "dBm"}), - Tuple.Create("en-US", typeof(PowerRatioUnit), (int)PowerRatioUnit.DecibelWatt, new string[]{"dBW"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Atmosphere, new string[]{"atm"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Atmosphere, new string[]{"атм"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Bar, new string[]{"bar"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Bar, new string[]{"бар"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Centibar, new string[]{"cbar"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Centibar, new string[]{"cбар"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Decapascal, new string[]{"daPa"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Decapascal, new string[]{"даПа"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Decibar, new string[]{"dbar"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Decibar, new string[]{"dбар"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.FootOfHead, new string[]{"ft of head"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Gigapascal, new string[]{"GPa"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Gigapascal, new string[]{"ГПа"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Hectopascal, new string[]{"hPa"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Hectopascal, new string[]{"гПа"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.InchOfMercury, new string[]{"inHg"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Kilobar, new string[]{"kbar"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilobar, new string[]{"kбар"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareCentimeter, new string[]{"kgf/cm²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareCentimeter, new string[]{"кгс/см²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMeter, new string[]{"kgf/m²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMeter, new string[]{"кгс/м²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMillimeter, new string[]{"kgf/mm²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMillimeter, new string[]{"кгс/мм²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareCentimeter, new string[]{"kN/cm²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareCentimeter, new string[]{"кН/см²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMeter, new string[]{"kN/m²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMeter, new string[]{"кН/м²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMillimeter, new string[]{"kN/mm²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMillimeter, new string[]{"кН/мм²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"kPa"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"кПа"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareFoot, new string[]{"kipf/ft²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareInch, new string[]{"kipf/in²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mbar"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mбар"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"MN/m²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"Мн/м²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Megapascal, new string[]{"MPa"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megapascal, new string[]{"МПа"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.MeterOfHead, new string[]{"m of head"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Micropascal, new string[]{"µPa"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Micropascal, new string[]{"мкПа"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Millibar, new string[]{"mbar"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Millibar, new string[]{"mбар"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.MillimeterOfMercury, new string[]{"mmHg"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareCentimeter, new string[]{"N/cm²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareCentimeter, new string[]{"Н/см²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMeter, new string[]{"N/m²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMeter, new string[]{"Н/м²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMillimeter, new string[]{"N/mm²"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMillimeter, new string[]{"Н/мм²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Pascal, new string[]{"Pa"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Pascal, new string[]{"Па"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.PoundForcePerSquareFoot, new string[]{"lb/ft²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.PoundForcePerSquareInch, new string[]{"psi", "lb/in²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TechnicalAtmosphere, new string[]{"at"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.TechnicalAtmosphere, new string[]{"ат"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareCentimeter, new string[]{"tf/cm²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareMeter, new string[]{"tf/m²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareMillimeter, new string[]{"tf/mm²"}), - Tuple.Create("en-US", typeof(PressureUnit), (int)PressureUnit.Torr, new string[]{"torr"}), - Tuple.Create("ru-RU", typeof(PressureUnit), (int)PressureUnit.Torr, new string[]{"торр"}), - Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.AtmospherePerSecond, new string[]{"atm/s"}), - Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.AtmospherePerSecond, new string[]{"атм/с"}), - Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.KilopascalPerSecond, new string[]{"kPa/s"}), - Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.KilopascalPerSecond, new string[]{"кПа/с"}), - Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.MegapascalPerSecond, new string[]{"MPa/s"}), - Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.MegapascalPerSecond, new string[]{"МПа/с"}), - Tuple.Create("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.PascalPerSecond, new string[]{"Pa/s"}), - Tuple.Create("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.PascalPerSecond, new string[]{"Па/с"}), - Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.DecimalFraction, new string[]{""}), - Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerBillion, new string[]{"ppb"}), - Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerMillion, new string[]{"ppm"}), - Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerThousand, new string[]{"‰"}), - Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerTrillion, new string[]{"ppt"}), - Tuple.Create("en-US", typeof(RatioUnit), (int)RatioUnit.Percent, new string[]{"%"}), - Tuple.Create("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.KilovoltampereReactiveHour, new string[]{"kvarh"}), - Tuple.Create("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.MegavoltampereReactiveHour, new string[]{"Mvarh"}), - Tuple.Create("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.VoltampereReactiveHour, new string[]{"varh"}), - Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.GigavoltampereReactive, new string[]{"Gvar"}), - Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.KilovoltampereReactive, new string[]{"kvar"}), - Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.MegavoltampereReactive, new string[]{"Mvar"}), - Tuple.Create("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.VoltampereReactive, new string[]{"var"}), - Tuple.Create("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.DegreePerSecondSquared, new string[]{"°/s²", "deg/s²"}), - Tuple.Create("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.RadianPerSecondSquared, new string[]{"rad/s²"}), - Tuple.Create("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.RevolutionPerMinutePerSecond, new string[]{"rpm/s"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.CentiradianPerSecond, new string[]{"crad/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.CentiradianPerSecond, new string[]{"cрад/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DeciradianPerSecond, new string[]{"drad/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DeciradianPerSecond, new string[]{"dрад/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerMinute, new string[]{"°/min", "deg/min"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/s", "deg/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µrad/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µрад/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mrad/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mрад/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nrad/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nрад/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RadianPerSecond, new string[]{"rad/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RadianPerSecond, new string[]{"рад/с"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerMinute, new string[]{"rpm", "r/min"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerMinute, new string[]{"об/мин"}), - Tuple.Create("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"r/s"}), - Tuple.Create("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"об/с"}), - Tuple.Create("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.KilonewtonMeterPerRadian, new string[]{"kN·m/rad"}), - Tuple.Create("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.MeganewtonMeterPerRadian, new string[]{"MN·m/rad"}), - Tuple.Create("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.NewtonMeterPerRadian, new string[]{"N·m/rad", "Nm/rad"}), - Tuple.Create("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, new string[]{"kN·m/rad/m"}), - Tuple.Create("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, new string[]{"MN·m/rad/m"}), - Tuple.Create("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, new string[]{"N·m/rad/m", "Nm/rad/m"}), - Tuple.Create("en-US", typeof(SolidAngleUnit), (int)SolidAngleUnit.Steradian, new string[]{"sr"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.CaloriePerGram, new string[]{"cal/g"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.JoulePerKilogram, new string[]{"J/kg"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilocaloriePerGram, new string[]{"kcal/g"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilojoulePerKilogram, new string[]{"kJ/kg"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilowattHourPerKilogram, new string[]{"kWh/kg"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.MegajoulePerKilogram, new string[]{"MJ/kg"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.MegawattHourPerKilogram, new string[]{"MWh/kg"}), - Tuple.Create("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.WattHourPerKilogram, new string[]{"Wh/kg"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.CaloriePerGramKelvin, new string[]{"cal/g.K"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, new string[]{"J/kg.C"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.JoulePerKilogramKelvin, new string[]{"J/kg.K"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilocaloriePerGramKelvin, new string[]{"kcal/g.K"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, new string[]{"kJ/kg.C"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilojoulePerKilogramKelvin, new string[]{"kJ/kg.K"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, new string[]{"MJ/kg.C"}), - Tuple.Create("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.MegajoulePerKilogramKelvin, new string[]{"MJ/kg.K"}), - Tuple.Create("en-US", typeof(SpecificVolumeUnit), (int)SpecificVolumeUnit.CubicFootPerPound, new string[]{"ft³/lb"}), - Tuple.Create("en-US", typeof(SpecificVolumeUnit), (int)SpecificVolumeUnit.CubicMeterPerKilogram, new string[]{"m³/kg"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicCentimeter, new string[]{"kgf/cm³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicMeter, new string[]{"kgf/m³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicMillimeter, new string[]{"kgf/mm³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicCentimeter, new string[]{"kN/cm³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicMeter, new string[]{"kN/m³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicMillimeter, new string[]{"kN/mm³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilopoundForcePerCubicFoot, new string[]{"kipf/ft³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilopoundForcePerCubicInch, new string[]{"kipf/in³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.MeganewtonPerCubicMeter, new string[]{"MN/m³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicCentimeter, new string[]{"N/cm³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicMeter, new string[]{"N/m³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicMillimeter, new string[]{"N/mm³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.PoundForcePerCubicFoot, new string[]{"lbf/ft³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.PoundForcePerCubicInch, new string[]{"lbf/in³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicCentimeter, new string[]{"tf/cm³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicMeter, new string[]{"tf/m³"}), - Tuple.Create("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicMillimeter, new string[]{"tf/mm³"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerHour, new string[]{"cm/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerMinute, new string[]{"cm/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerSecond, new string[]{"cm/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.DecimeterPerMinute, new string[]{"dm/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.DecimeterPerSecond, new string[]{"dm/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerHour, new string[]{"ft/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerMinute, new string[]{"ft/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerSecond, new string[]{"ft/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerHour, new string[]{"in/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerMinute, new string[]{"in/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerSecond, new string[]{"in/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerHour, new string[]{"km/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerMinute, new string[]{"km/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerSecond, new string[]{"km/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.Knot, new string[]{"kn", "kt", "knot", "knots"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerHour, new string[]{"m/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerMinute, new string[]{"m/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerSecond, new string[]{"m/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MicrometerPerMinute, new string[]{"µm/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MicrometerPerSecond, new string[]{"µm/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MilePerHour, new string[]{"mph"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerHour, new string[]{"mm/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerMinute, new string[]{"mm/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerSecond, new string[]{"mm/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.NanometerPerMinute, new string[]{"nm/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.NanometerPerSecond, new string[]{"nm/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerHour, new string[]{"ftUS/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerMinute, new string[]{"ftUS/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerSecond, new string[]{"ftUS/s"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerHour, new string[]{"yd/h"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerMinute, new string[]{"yd/min"}), - Tuple.Create("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerSecond, new string[]{"yd/s"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeCelsius, new string[]{"°C"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeDelisle, new string[]{"°De"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeFahrenheit, new string[]{"°F"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeNewton, new string[]{"°N"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeRankine, new string[]{"°R"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeReaumur, new string[]{"°Ré"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeRoemer, new string[]{"°Rø"}), - Tuple.Create("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.Kelvin, new string[]{"K"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, new string[]{"c°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, new string[]{"da°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, new string[]{"d°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DegreeCelsiusPerMinute, new string[]{"°C/min"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DegreeCelsiusPerSecond, new string[]{"°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, new string[]{"h°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, new string[]{"k°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, new string[]{"µ°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, new string[]{"m°C/s"}), - Tuple.Create("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, new string[]{"n°C/s"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeCelsius, new string[]{"∆°C"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeDelisle, new string[]{"∆°De"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeFahrenheit, new string[]{"∆°F"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeNewton, new string[]{"∆°N"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeRankine, new string[]{"∆°R"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeReaumur, new string[]{"∆°Ré"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeRoemer, new string[]{"∆°Rø"}), - Tuple.Create("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.Kelvin, new string[]{"∆K"}), - Tuple.Create("en-US", typeof(ThermalConductivityUnit), (int)ThermalConductivityUnit.BtuPerHourFootFahrenheit, new string[]{"BTU/h·ft·°F"}), - Tuple.Create("en-US", typeof(ThermalConductivityUnit), (int)ThermalConductivityUnit.WattPerMeterKelvin, new string[]{"W/m·K"}), - Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, new string[]{"Hrft²°F/Btu"}), - Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, new string[]{"cm²Hr°C/kcal"}), - Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, new string[]{"cm²K/W"}), - Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, new string[]{"m²°C/W"}), - Tuple.Create("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, new string[]{"m²K/kW"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceCentimeter, new string[]{"kgf·cm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceMeter, new string[]{"kgf·m"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceMillimeter, new string[]{"kgf·mm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonCentimeter, new string[]{"kN·cm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMeter, new string[]{"kN·m"}), - Tuple.Create("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMeter, new string[]{"кН·м"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMillimeter, new string[]{"kN·mm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilopoundForceFoot, new string[]{"kipf·ft"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilopoundForceInch, new string[]{"kipf·in"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonCentimeter, new string[]{"MN·cm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMeter, new string[]{"MN·m"}), - Tuple.Create("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMeter, new string[]{""}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMillimeter, new string[]{"MN·mm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MegapoundForceFoot, new string[]{"Mlbf·ft"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.MegapoundForceInch, new string[]{"Mlbf·in"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonCentimeter, new string[]{"N·cm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonMeter, new string[]{"N·m"}), - Tuple.Create("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.NewtonMeter, new string[]{"Н·м"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonMillimeter, new string[]{"N·mm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.PoundForceFoot, new string[]{"lbf·ft"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.PoundForceInch, new string[]{"lbf·in"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceCentimeter, new string[]{"tf·cm"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceMeter, new string[]{"tf·m"}), - Tuple.Create("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceMillimeter, new string[]{"tf·mm"}), - Tuple.Create("en-US", typeof(VitaminAUnit), (int)VitaminAUnit.InternationalUnit, new string[]{"IU"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), - Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Centiliter, new string[]{"cl"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Centiliter, new string[]{"сл"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicCentimeter, new string[]{"cm³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicCentimeter, new string[]{"см³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicDecimeter, new string[]{"dm³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicDecimeter, new string[]{"дм³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicFoot, new string[]{"ft³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicFoot, new string[]{"фут³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicInch, new string[]{"in³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicInch, new string[]{"дюйм³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicKilometer, new string[]{"km³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicKilometer, new string[]{"км³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMeter, new string[]{"m³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMeter, new string[]{"м³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMicrometer, new string[]{"µm³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMicrometer, new string[]{"мкм³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMile, new string[]{"mi³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMile, new string[]{"миля³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"mm³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"мм³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"yd³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"ярд³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"dl"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"дл"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hft³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hфут³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hm³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hм³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"hl"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"гл"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialBeerBarrel, new string[]{"bl (imp.)"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"gal (imp.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"Английский галлон"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialOunce, new string[]{"oz (imp.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialOunce, new string[]{"Английская унция"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilocubicFoot, new string[]{"kft³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilocubicFoot, new string[]{"kфут³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilocubicMeter, new string[]{"km³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilocubicMeter, new string[]{"kм³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kgal (imp.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kАнглийский галлон"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kgal (U.S.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kАмериканский галлон"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Liter, new string[]{"l"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Liter, new string[]{"л"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegacubicFoot, new string[]{"Mft³"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegacubicFoot, new string[]{"Mфут³"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegaimperialGallon, new string[]{"Mgal (imp.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegaimperialGallon, new string[]{"MАнглийский галлон"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegausGallon, new string[]{"Mgal (U.S.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegausGallon, new string[]{"MАмериканский галлон"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MetricCup, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{"tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{""}), - Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Microliter, new string[]{"µl"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Microliter, new string[]{"мкл"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.Milliliter, new string[]{"ml"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Milliliter, new string[]{"мл"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.OilBarrel, new string[]{"bbl"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), - Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsBeerBarrel, new string[]{"bl (U.S.)"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsCustomaryCup, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsGallon, new string[]{"gal (U.S.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsGallon, new string[]{"Американский галлон"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsLegalCup, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsOunce, new string[]{"oz (U.S.)"}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsOunce, new string[]{"Американская унция"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsPint, new string[]{"pt (U.S.)"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsQuart, new string[]{"qt (U.S.)"}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), - Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), - Tuple.Create("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), - Tuple.Create("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerMinute, new string[]{"cLPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"dm³/min"}), - Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"дм³/мин"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerHour, new string[]{"ft³/h", "cf/hr"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerMinute, new string[]{"ft³/min"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerSecond, new string[]{"ft³/s"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerHour, new string[]{"m³/h"}), - Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerHour, new string[]{"м³/ч"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerMinute, new string[]{"m³/min"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerSecond, new string[]{"m³/s"}), - Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerSecond, new string[]{"м³/с"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerHour, new string[]{"yd³/h"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerMinute, new string[]{"yd³/min"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerSecond, new string[]{"yd³/s"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerMinute, new string[]{"dLPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerMinute, new string[]{"kLPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerHour, new string[]{"LPH"}), - Tuple.Create("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerHour, new string[]{"л/ч"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerMinute, new string[]{"LPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerSecond, new string[]{"LPS"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerMinute, new string[]{"µLPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerMinute, new string[]{"mLPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MillionUsGallonsPerDay, new string[]{"MGD"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerMinute, new string[]{"nLPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerDay, new string[]{"bbl/d", "BOPD"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerHour, new string[]{"bbl/hr", "bph"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerMinute, new string[]{"bbl/min", "bpm"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerHour, new string[]{"gal (U.S.)/h"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerMinute, new string[]{"gal (U.S.)/min", "GPM"}), - Tuple.Create("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerSecond, new string[]{"gal (U.S.)/s"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.CentimeterPerSecondSquared, new string[]{"cm/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.DecimeterPerSecondSquared, new string[]{"dm/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.FootPerSecondSquared, new string[]{"ft/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.InchPerSecondSquared, new string[]{"in/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KilometerPerSecondSquared, new string[]{"km/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerHour, new string[]{"kn/h"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerMinute, new string[]{"kn/min"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.KnotPerSecond, new string[]{"kn/s"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MeterPerSecondSquared, new string[]{"m/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MicrometerPerSecondSquared, new string[]{"µm/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.MillimeterPerSecondSquared, new string[]{"mm/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.NanometerPerSecondSquared, new string[]{"nm/s²"}), + ("en-US", typeof(AccelerationUnit), (int)AccelerationUnit.StandardGravity, new string[]{"g"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Centimole, new string[]{"cmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.CentipoundMole, new string[]{"clbmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Decimole, new string[]{"dmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.DecipoundMole, new string[]{"dlbmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Kilomole, new string[]{"kmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.KilopoundMole, new string[]{"klbmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Micromole, new string[]{"µmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.MicropoundMole, new string[]{"µlbmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Millimole, new string[]{"mmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.MillipoundMole, new string[]{"mlbmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Mole, new string[]{"mol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.Nanomole, new string[]{"nmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.NanopoundMole, new string[]{"nlbmol"}), + ("en-US", typeof(AmountOfSubstanceUnit), (int)AmountOfSubstanceUnit.PoundMole, new string[]{"lbmol"}), + ("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelMicrovolt, new string[]{"dBµV"}), + ("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelMillivolt, new string[]{"dBmV"}), + ("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelUnloaded, new string[]{"dBu"}), + ("en-US", typeof(AmplitudeRatioUnit), (int)AmplitudeRatioUnit.DecibelVolt, new string[]{"dBV"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Arcminute, new string[]{"'", "arcmin", "amin", "min"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Arcsecond, new string[]{"″", "arcsec", "asec", "sec"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Centiradian, new string[]{"crad"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Centiradian, new string[]{"cрад"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Deciradian, new string[]{"drad"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Deciradian, new string[]{"dрад"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Degree, new string[]{"°", "deg"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Degree, new string[]{"°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µrad"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µрад"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mrad"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mрад"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nrad"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nрад"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Radian, new string[]{"rad"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Radian, new string[]{"рад"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Revolution, new string[]{"r"}), + ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Revolution, new string[]{"r"}), + ("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.KilovoltampereHour, new string[]{"kVAh"}), + ("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.MegavoltampereHour, new string[]{"MVAh"}), + ("en-US", typeof(ApparentEnergyUnit), (int)ApparentEnergyUnit.VoltampereHour, new string[]{"VAh"}), + ("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Gigavoltampere, new string[]{"GVA"}), + ("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Kilovoltampere, new string[]{"kVA"}), + ("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Megavoltampere, new string[]{"MVA"}), + ("en-US", typeof(ApparentPowerUnit), (int)ApparentPowerUnit.Voltampere, new string[]{"VA"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.Acre, new string[]{"ac"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.Hectare, new string[]{"ha"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareCentimeter, new string[]{"cm²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareCentimeter, new string[]{"см²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareDecimeter, new string[]{"dm²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareDecimeter, new string[]{"дм²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareFoot, new string[]{"ft²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareFoot, new string[]{"фут²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareInch, new string[]{"in²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareInch, new string[]{"дюйм²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareKilometer, new string[]{"km²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareKilometer, new string[]{"км²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMeter, new string[]{"m²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMeter, new string[]{"м²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMicrometer, new string[]{"µm²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMicrometer, new string[]{"мкм²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMile, new string[]{"mi²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMile, new string[]{"миля²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareMillimeter, new string[]{"mm²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareMillimeter, new string[]{"мм²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.SquareYard, new string[]{"yd²"}), + ("ru-RU", typeof(AreaUnit), (int)AreaUnit.SquareYard, new string[]{"ярд²"}), + ("en-US", typeof(AreaUnit), (int)AreaUnit.UsSurveySquareFoot, new string[]{"ft² (US)"}), + ("en-US", typeof(AreaDensityUnit), (int)AreaDensityUnit.KilogramPerSquareMeter, new string[]{"kg/m²"}), + ("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.CentimeterToTheFourth, new string[]{"cm⁴", "cm^4"}), + ("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.DecimeterToTheFourth, new string[]{"dm⁴", "dm^4"}), + ("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.FootToTheFourth, new string[]{"ft⁴", "ft^4"}), + ("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.InchToTheFourth, new string[]{"in⁴", "in^4"}), + ("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.MeterToTheFourth, new string[]{"m⁴", "m^4"}), + ("en-US", typeof(AreaMomentOfInertiaUnit), (int)AreaMomentOfInertiaUnit.MillimeterToTheFourth, new string[]{"mm⁴", "mm^4"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.BitPerSecond, new string[]{"bit/s", "bps"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.BytePerSecond, new string[]{"B/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabitPerSecond, new string[]{"Ebit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabytePerSecond, new string[]{"EB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibitPerSecond, new string[]{"Eibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibytePerSecond, new string[]{"EiB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibitPerSecond, new string[]{"Gibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibytePerSecond, new string[]{"GiB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabitPerSecond, new string[]{"Gbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabytePerSecond, new string[]{"GB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibitPerSecond, new string[]{"Kibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibytePerSecond, new string[]{"KiB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobitPerSecond, new string[]{"kbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobytePerSecond, new string[]{"kB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibitPerSecond, new string[]{"Mibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibytePerSecond, new string[]{"MiB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabitPerSecond, new string[]{"Mbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabytePerSecond, new string[]{"MB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibitPerSecond, new string[]{"Pibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibytePerSecond, new string[]{"PiB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabitPerSecond, new string[]{"Pbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabytePerSecond, new string[]{"PB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibitPerSecond, new string[]{"Tibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibytePerSecond, new string[]{"TiB/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabitPerSecond, new string[]{"Tbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabytePerSecond, new string[]{"TB/s"}), + ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, new string[]{"g/kWh"}), + ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, new string[]{"kg/J"}), + ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, new string[]{"lb/hph"}), + ("en-US", typeof(CapacitanceUnit), (int)CapacitanceUnit.Farad, new string[]{"F"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerDeciliter, new string[]{"cg/dl"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerLiter, new string[]{"cg/L"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerMilliliter, new string[]{"cg/ml"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerDeciliter, new string[]{"dg/dl"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerLiter, new string[]{"dg/L"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.DecigramPerMilliliter, new string[]{"dg/ml"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicCentimeter, new string[]{"g/cm³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMeter, new string[]{"g/m³"}), + ("ru-RU", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMeter, new string[]{"г/м³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerCubicMillimeter, new string[]{"g/mm³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerDeciliter, new string[]{"g/dl"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerLiter, new string[]{"g/L"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.GramPerMilliliter, new string[]{"g/ml"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicCentimeter, new string[]{"kg/cm³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMeter, new string[]{"kg/m³"}), + ("ru-RU", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMeter, new string[]{"kг/м³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.KilogramPerCubicMillimeter, new string[]{"kg/mm³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.KilopoundPerCubicFoot, new string[]{"kip/ft³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.KilopoundPerCubicInch, new string[]{"kip/in³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerDeciliter, new string[]{"µg/dl"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerLiter, new string[]{"µg/L"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.MicrogramPerMilliliter, new string[]{"µg/ml"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerCubicMeter, new string[]{"mg/m³"}), + ("ru-RU", typeof(DensityUnit), (int)DensityUnit.MilligramPerCubicMeter, new string[]{"mг/м³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerDeciliter, new string[]{"mg/dl"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerLiter, new string[]{"mg/L"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.MilligramPerMilliliter, new string[]{"mg/ml"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerDeciliter, new string[]{"ng/dl"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerLiter, new string[]{"ng/L"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.NanogramPerMilliliter, new string[]{"ng/ml"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerDeciliter, new string[]{"pg/dl"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerLiter, new string[]{"pg/L"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.PicogramPerMilliliter, new string[]{"pg/ml"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerCubicFoot, new string[]{"lb/ft³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerCubicInch, new string[]{"lb/in³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerImperialGallon, new string[]{"ppg (imp.)"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.PoundPerUSGallon, new string[]{"ppg (U.S.)"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.SlugPerCubicFoot, new string[]{"slug/ft³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicCentimeter, new string[]{"t/cm³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicMeter, new string[]{"t/m³"}), + ("en-US", typeof(DensityUnit), (int)DensityUnit.TonnePerCubicMillimeter, new string[]{"t/mm³"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Day, new string[]{"d", "day", "days"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Day, new string[]{"д"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"h", "hr", "hrs", "hour", "hours"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"ч"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µs"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мкс"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"ms"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мс"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"m", "min", "minute", "minutes"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"мин"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"mo", "month", "months"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"месяц"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"ns"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нс"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"s", "sec", "secs", "second", "seconds"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"с"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"wk", "week", "weeks"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"мин"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"yr", "year", "years"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"год"}), + ("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.Centipoise, new string[]{"cP"}), + ("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.MicropascalSecond, new string[]{"µPaS"}), + ("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.MillipascalSecond, new string[]{"mPaS"}), + ("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.NewtonSecondPerMeterSquared, new string[]{"Ns/m²"}), + ("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.PascalSecond, new string[]{"PaS"}), + ("en-US", typeof(DynamicViscosityUnit), (int)DynamicViscosityUnit.Poise, new string[]{"P"}), + ("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Microsiemens, new string[]{"µS"}), + ("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Millisiemens, new string[]{"mS"}), + ("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Nanosiemens, new string[]{"nS"}), + ("en-US", typeof(ElectricAdmittanceUnit), (int)ElectricAdmittanceUnit.Siemens, new string[]{"S"}), + ("en-US", typeof(ElectricChargeUnit), (int)ElectricChargeUnit.Coulomb, new string[]{"C"}), + ("en-US", typeof(ElectricChargeDensityUnit), (int)ElectricChargeDensityUnit.CoulombPerCubicMeter, new string[]{"C/m³"}), + ("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Microsiemens, new string[]{"µS"}), + ("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Millisiemens, new string[]{"mS"}), + ("en-US", typeof(ElectricConductanceUnit), (int)ElectricConductanceUnit.Siemens, new string[]{"S"}), + ("en-US", typeof(ElectricConductivityUnit), (int)ElectricConductivityUnit.SiemensPerMeter, new string[]{"S/m"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Ampere, new string[]{"A"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Centiampere, new string[]{"cA"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Kiloampere, new string[]{"kA"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Megaampere, new string[]{"MA"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Microampere, new string[]{"µA"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Milliampere, new string[]{"mA"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Nanoampere, new string[]{"nA"}), + ("en-US", typeof(ElectricCurrentUnit), (int)ElectricCurrentUnit.Picoampere, new string[]{"pA"}), + ("en-US", typeof(ElectricCurrentDensityUnit), (int)ElectricCurrentDensityUnit.AmperePerSquareMeter, new string[]{"A/m²"}), + ("en-US", typeof(ElectricCurrentGradientUnit), (int)ElectricCurrentGradientUnit.AmperePerSecond, new string[]{"A/s"}), + ("en-US", typeof(ElectricFieldUnit), (int)ElectricFieldUnit.VoltPerMeter, new string[]{"V/m"}), + ("en-US", typeof(ElectricInductanceUnit), (int)ElectricInductanceUnit.Henry, new string[]{"H"}), + ("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Kilovolt, new string[]{"kV"}), + ("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Kilovolt, new string[]{"kВ"}), + ("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Megavolt, new string[]{"MV"}), + ("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Megavolt, new string[]{"MВ"}), + ("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Microvolt, new string[]{"µV"}), + ("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Microvolt, new string[]{"µВ"}), + ("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Millivolt, new string[]{"mV"}), + ("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Millivolt, new string[]{"mВ"}), + ("en-US", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Volt, new string[]{"V"}), + ("ru-RU", typeof(ElectricPotentialUnit), (int)ElectricPotentialUnit.Volt, new string[]{"В"}), + ("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.KilovoltAc, new string[]{"kVac"}), + ("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MegavoltAc, new string[]{"MVac"}), + ("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MicrovoltAc, new string[]{"µVac"}), + ("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.MillivoltAc, new string[]{"mVac"}), + ("en-US", typeof(ElectricPotentialAcUnit), (int)ElectricPotentialAcUnit.VoltAc, new string[]{"Vac"}), + ("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.KilovoltDc, new string[]{"kVdc"}), + ("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MegavoltDc, new string[]{"MVdc"}), + ("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MicrovoltDc, new string[]{"µVdc"}), + ("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.MillivoltDc, new string[]{"mVdc"}), + ("en-US", typeof(ElectricPotentialDcUnit), (int)ElectricPotentialDcUnit.VoltDc, new string[]{"Vdc"}), + ("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Kiloohm, new string[]{"kΩ"}), + ("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Megaohm, new string[]{"MΩ"}), + ("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Milliohm, new string[]{"mΩ"}), + ("en-US", typeof(ElectricResistanceUnit), (int)ElectricResistanceUnit.Ohm, new string[]{"Ω"}), + ("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.MicroohmMeter, new string[]{"µΩ·m"}), + ("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.MilliohmMeter, new string[]{"mΩ·m"}), + ("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.NanoohmMeter, new string[]{"nΩ·m"}), + ("en-US", typeof(ElectricResistivityUnit), (int)ElectricResistivityUnit.OhmMeter, new string[]{"Ω·m"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.BritishThermalUnit, new string[]{"BTU"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.Calorie, new string[]{"cal"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermEc, new string[]{"Dth (E.C.)"}), + ("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermEc, new string[]{"Европейский декатерм"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermImperial, new string[]{"Dth (imp.)"}), + ("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermImperial, new string[]{"Английский декатерм"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.DecathermUs, new string[]{"Dth (U.S.)"}), + ("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.DecathermUs, new string[]{"Американский декатерм"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.ElectronVolt, new string[]{"eV"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.Erg, new string[]{"erg"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.FootPound, new string[]{"ft·lb"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigabritishThermalUnit, new string[]{"GBTU"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigawattHour, new string[]{"GWh"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.GigawattHour, new string[]{"GВт/ч"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.Joule, new string[]{"J"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilobritishThermalUnit, new string[]{"kBTU"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.Kilocalorie, new string[]{"kcal"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.Kilojoule, new string[]{"kJ"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilowattHour, new string[]{"kWh"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.KilowattHour, new string[]{"kВт/ч"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegabritishThermalUnit, new string[]{"MBTU"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.Megajoule, new string[]{"MJ"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegawattHour, new string[]{"MWh"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.MegawattHour, new string[]{"MВт/ч"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermEc, new string[]{"th (E.C.)"}), + ("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermEc, new string[]{"Европейский терм"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermImperial, new string[]{"th (imp.)"}), + ("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermImperial, new string[]{"Английский терм"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.ThermUs, new string[]{"th (U.S.)"}), + ("ru-RU", typeof(EnergyUnit), (int)EnergyUnit.ThermUs, new string[]{"Американский терм"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.WattHour, new string[]{"Wh"}), + ("en-US", typeof(EnergyUnit), (int)EnergyUnit.WattHour, new string[]{"Вт/ч"}), + ("en-US", typeof(EntropyUnit), (int)EntropyUnit.CaloriePerKelvin, new string[]{"cal/K"}), + ("en-US", typeof(EntropyUnit), (int)EntropyUnit.JoulePerDegreeCelsius, new string[]{"J/C"}), + ("en-US", typeof(EntropyUnit), (int)EntropyUnit.JoulePerKelvin, new string[]{"J/K"}), + ("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilocaloriePerKelvin, new string[]{"kcal/K"}), + ("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilojoulePerDegreeCelsius, new string[]{"kJ/C"}), + ("en-US", typeof(EntropyUnit), (int)EntropyUnit.KilojoulePerKelvin, new string[]{"kJ/K"}), + ("en-US", typeof(EntropyUnit), (int)EntropyUnit.MegajoulePerKelvin, new string[]{"MJ/K"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.Decanewton, new string[]{"daN"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.Decanewton, new string[]{"даН"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.Dyn, new string[]{"dyn"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.Dyn, new string[]{"дин"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.KilogramForce, new string[]{"kgf"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.KilogramForce, new string[]{"кгс"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.Kilonewton, new string[]{"kN"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.Kilonewton, new string[]{"кН"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.KiloPond, new string[]{"kp"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.KiloPond, new string[]{"кгс"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.Meganewton, new string[]{"MN"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.Meganewton, new string[]{""}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.Newton, new string[]{"N"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.Newton, new string[]{"Н"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.Poundal, new string[]{"pdl"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.Poundal, new string[]{"паундаль"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.PoundForce, new string[]{"lbf"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.PoundForce, new string[]{"фунт-сила"}), + ("en-US", typeof(ForceUnit), (int)ForceUnit.TonneForce, new string[]{"Ton"}), + ("ru-RU", typeof(ForceUnit), (int)ForceUnit.TonneForce, new string[]{"тс"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.CentinewtonPerSecond, new string[]{"cN/s"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecanewtonPerMinute, new string[]{"daN/min"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecanewtonPerSecond, new string[]{"daN/s"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.DecinewtonPerSecond, new string[]{"dN/s"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.KilonewtonPerMinute, new string[]{"kN/min"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.KilonewtonPerSecond, new string[]{"kN/s"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.MicronewtonPerSecond, new string[]{"µN/s"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.MillinewtonPerSecond, new string[]{"mN/s"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NanonewtonPerSecond, new string[]{"nN/s"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NewtonPerMinute, new string[]{"N/min"}), + ("en-US", typeof(ForceChangeRateUnit), (int)ForceChangeRateUnit.NewtonPerSecond, new string[]{"N/s"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.CentinewtonPerMeter, new string[]{"cN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.DecinewtonPerMeter, new string[]{"dN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"kgf/m"}), + ("ru-RU", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilogramForcePerMeter, new string[]{"кгс/м"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.KilonewtonPerMeter, new string[]{"kN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MeganewtonPerMeter, new string[]{"MN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MicronewtonPerMeter, new string[]{"µN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.MillinewtonPerMeter, new string[]{"mN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.NanonewtonPerMeter, new string[]{"nN/m"}), + ("en-US", typeof(ForcePerLengthUnit), (int)ForcePerLengthUnit.NewtonPerMeter, new string[]{"N/m"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.CyclePerHour, new string[]{"cph"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.CyclePerMinute, new string[]{"cpm"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Gigahertz, new string[]{"GHz"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Hertz, new string[]{"Hz"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Kilohertz, new string[]{"kHz"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Megahertz, new string[]{"MHz"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.RadianPerSecond, new string[]{"rad/s"}), + ("en-US", typeof(FrequencyUnit), (int)FrequencyUnit.Terahertz, new string[]{"THz"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerHourSquareFoot, new string[]{"BTU/h·ft²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerMinuteSquareFoot, new string[]{"BTU/min·ft²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerSecondSquareFoot, new string[]{"BTU/s·ft²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.BtuPerSecondSquareInch, new string[]{"BTU/s·in²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.CaloriePerSecondSquareCentimeter, new string[]{"cal/s·cm²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.CentiwattPerSquareMeter, new string[]{"cW/m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.DeciwattPerSquareMeter, new string[]{"dW/m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilocaloriePerHourSquareMeter, new string[]{"kcal/h·m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, new string[]{"kcal/s·cm²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.KilowattPerSquareMeter, new string[]{"kW/m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MicrowattPerSquareMeter, new string[]{"µW/m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MilliwattPerSquareMeter, new string[]{"mW/m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.NanowattPerSquareMeter, new string[]{"nW/m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareFoot, new string[]{"W/ft²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareInch, new string[]{"W/in²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareMeter, new string[]{"W/m²"}), + ("en-US", typeof(HeatTransferCoefficientUnit), (int)HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, new string[]{"W/m²·°C"}), + ("en-US", typeof(HeatTransferCoefficientUnit), (int)HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, new string[]{"W/m²·K"}), + ("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Kilolux, new string[]{"klx"}), + ("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Lux, new string[]{"lx"}), + ("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Megalux, new string[]{"Mlx"}), + ("en-US", typeof(IlluminanceUnit), (int)IlluminanceUnit.Millilux, new string[]{"mlx"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Bit, new string[]{"b"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Byte, new string[]{"B"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Exabit, new string[]{"Eb"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Exabyte, new string[]{"EB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Exbibit, new string[]{"Eib"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Exbibyte, new string[]{"EiB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Gibibit, new string[]{"Gib"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Gibibyte, new string[]{"GiB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Gigabit, new string[]{"Gb"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Gigabyte, new string[]{"GB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Kibibit, new string[]{"Kib"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Kibibyte, new string[]{"KiB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Kilobit, new string[]{"kb"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Kilobyte, new string[]{"kB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Mebibit, new string[]{"Mib"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Mebibyte, new string[]{"MiB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Megabit, new string[]{"Mb"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Megabyte, new string[]{"MB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Pebibit, new string[]{"Pib"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Pebibyte, new string[]{"PiB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Petabit, new string[]{"Pb"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Petabyte, new string[]{"PB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Tebibit, new string[]{"Tib"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Tebibyte, new string[]{"TiB"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Terabit, new string[]{"Tb"}), + ("en-US", typeof(InformationUnit), (int)InformationUnit.Terabyte, new string[]{"TB"}), + ("en-US", typeof(IrradianceUnit), (int)IrradianceUnit.KilowattPerSquareMeter, new string[]{"kW/m²"}), + ("en-US", typeof(IrradianceUnit), (int)IrradianceUnit.WattPerSquareMeter, new string[]{"W/m²"}), + ("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.JoulePerSquareMeter, new string[]{"J/m²"}), + ("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.KilowattHourPerSquareMeter, new string[]{"kWh/m²"}), + ("en-US", typeof(IrradiationUnit), (int)IrradiationUnit.WattHourPerSquareMeter, new string[]{"Wh/m²"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Centistokes, new string[]{"cSt"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Centistokes, new string[]{"сСт"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Decistokes, new string[]{"dSt"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Decistokes, new string[]{"дСт"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Kilostokes, new string[]{"kSt"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Kilostokes, new string[]{"кСт"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Microstokes, new string[]{"µSt"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Microstokes, new string[]{"мкСт"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Millistokes, new string[]{"mSt"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Millistokes, new string[]{"мСт"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Nanostokes, new string[]{"nSt"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Nanostokes, new string[]{"нСт"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.SquareMeterPerSecond, new string[]{"m²/s"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.SquareMeterPerSecond, new string[]{"м²/с"}), + ("en-US", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Stokes, new string[]{"St"}), + ("ru-RU", typeof(KinematicViscosityUnit), (int)KinematicViscosityUnit.Stokes, new string[]{"Ст"}), + ("en-US", typeof(LapseRateUnit), (int)LapseRateUnit.DegreeCelsiusPerKilometer, new string[]{"∆°C/km"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Centimeter, new string[]{"cm"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Centimeter, new string[]{"см"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Decimeter, new string[]{"dm"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Decimeter, new string[]{"дм"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPica, new string[]{"pica"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.DtpPoint, new string[]{"pt"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Fathom, new string[]{"fathom"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"ft", "'", "′"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Foot, new string[]{"фут"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"in", "\"", "″"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Inch, new string[]{"дюйм"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"km"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Kilometer, new string[]{"км"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Meter, new string[]{"m"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Meter, new string[]{"м"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Microinch, new string[]{"µin"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Microinch, new string[]{"микродюйм"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Micrometer, new string[]{"µm"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Micrometer, new string[]{"мкм"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Mil, new string[]{"mil"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Mil, new string[]{"мил"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Mile, new string[]{"mi"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Mile, new string[]{"миля"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Millimeter, new string[]{"mm"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Millimeter, new string[]{"мм"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Nanometer, new string[]{"nm"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Nanometer, new string[]{"нм"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.NauticalMile, new string[]{"NM"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.NauticalMile, new string[]{"мил"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.PrinterPica, new string[]{"pica"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.PrinterPoint, new string[]{"pt"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Shackle, new string[]{"shackle"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Twip, new string[]{"twip"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.UsSurveyFoot, new string[]{"ftUS"}), + ("en-US", typeof(LengthUnit), (int)LengthUnit.Yard, new string[]{"yd"}), + ("ru-RU", typeof(LengthUnit), (int)LengthUnit.Yard, new string[]{"ярд"}), + ("en-US", typeof(LevelUnit), (int)LevelUnit.Decibel, new string[]{"dB"}), + ("en-US", typeof(LevelUnit), (int)LevelUnit.Neper, new string[]{"Np"}), + ("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.GramPerMeter, new string[]{"g/m"}), + ("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.KilogramPerMeter, new string[]{"kg/m"}), + ("en-US", typeof(LinearDensityUnit), (int)LinearDensityUnit.PoundPerFoot, new string[]{"lb/ft"}), + ("en-US", typeof(LuminousFluxUnit), (int)LuminousFluxUnit.Lumen, new string[]{"lm"}), + ("en-US", typeof(LuminousIntensityUnit), (int)LuminousIntensityUnit.Candela, new string[]{"cd"}), + ("en-US", typeof(MagneticFieldUnit), (int)MagneticFieldUnit.Tesla, new string[]{"T"}), + ("en-US", typeof(MagneticFluxUnit), (int)MagneticFluxUnit.Weber, new string[]{"Wb"}), + ("en-US", typeof(MagnetizationUnit), (int)MagnetizationUnit.AmperePerMeter, new string[]{"A/m"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Centigram, new string[]{"cg"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Centigram, new string[]{"сг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Decagram, new string[]{"dag"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Decagram, new string[]{"даг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Decigram, new string[]{"dg"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Decigram, new string[]{"дг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Gram, new string[]{"g"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Gram, new string[]{"г"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Hectogram, new string[]{"hg"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Hectogram, new string[]{"гг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"kg"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"кг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klb"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"kфунт"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"kt"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"кт"}), + ("en-US", typeof(MassUnit), (int)MassUnit.LongHundredweight, new string[]{"cwt"}), + ("en-US", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"long tn"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"тонна большая"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlb"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mфунт"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Mt"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Мт"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Microgram, new string[]{"µg"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Microgram, new string[]{"мкг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Milligram, new string[]{"mg"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Milligram, new string[]{"мг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Nanogram, new string[]{"ng"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Nanogram, new string[]{"нг"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Ounce, new string[]{"oz"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Pound, new string[]{"lb", "lbs", "lbm"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Pound, new string[]{"фунт"}), + ("en-US", typeof(MassUnit), (int)MassUnit.ShortHundredweight, new string[]{"cwt"}), + ("en-US", typeof(MassUnit), (int)MassUnit.ShortTon, new string[]{"short tn"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.ShortTon, new string[]{"тонна малая"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Slug, new string[]{"slug"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Stone, new string[]{"st"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Tonne, new string[]{"t"}), + ("ru-RU", typeof(MassUnit), (int)MassUnit.Tonne, new string[]{"т"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.CentigramPerSecond, new string[]{"cg/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.DecagramPerSecond, new string[]{"dag/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.DecigramPerSecond, new string[]{"dg/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.GramPerSecond, new string[]{"g/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.HectogramPerSecond, new string[]{"hg/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerHour, new string[]{"kg/h"}), + ("ru-RU", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerHour, new string[]{"кг/ч"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerSecond, new string[]{"kg/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MegapoundPerHour, new string[]{"Mlb/h"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MicrogramPerSecond, new string[]{"µg/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MilligramPerSecond, new string[]{"mg/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.NanogramPerSecond, new string[]{"ng/S"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.PoundPerHour, new string[]{"lb/h"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.ShortTonPerHour, new string[]{"short tn/h"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerDay, new string[]{"t/d"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerHour, new string[]{"t/h"}), + ("en-US", typeof(MassFluxUnit), (int)MassFluxUnit.GramPerSecondPerSquareMeter, new string[]{"g·s⁻¹·m⁻²"}), + ("en-US", typeof(MassFluxUnit), (int)MassFluxUnit.KilogramPerSecondPerSquareMeter, new string[]{"kg·s⁻¹·m⁻²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareCentimeter, new string[]{"g·cm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareDecimeter, new string[]{"g·dm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareMeter, new string[]{"g·m²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.GramSquareMillimeter, new string[]{"g·mm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareCentimeter, new string[]{"kg·cm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareDecimeter, new string[]{"kg·dm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareMeter, new string[]{"kg·m²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilogramSquareMillimeter, new string[]{"kg·mm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareCentimeter, new string[]{"kt·cm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareDecimeter, new string[]{"kt·dm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareMeter, new string[]{"kt·m²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.KilotonneSquareMilimeter, new string[]{"kt·mm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareCentimeter, new string[]{"Mt·cm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareDecimeter, new string[]{"Mt·dm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareMeter, new string[]{"Mt·m²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MegatonneSquareMilimeter, new string[]{"Mt·mm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareCentimeter, new string[]{"mg·cm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareDecimeter, new string[]{"mg·dm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareMeter, new string[]{"mg·m²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.MilligramSquareMillimeter, new string[]{"mg·mm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.PoundSquareFoot, new string[]{"lb·ft²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.PoundSquareInch, new string[]{"lb·in²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.SlugSquareFoot, new string[]{"slug·ft²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.SlugSquareInch, new string[]{"slug·in²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareCentimeter, new string[]{"t·cm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareDecimeter, new string[]{"t·dm²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareMeter, new string[]{"t·m²"}), + ("en-US", typeof(MassMomentOfInertiaUnit), (int)MassMomentOfInertiaUnit.TonneSquareMilimeter, new string[]{"t·mm²"}), + ("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.JoulePerMole, new string[]{"J/mol"}), + ("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.KilojoulePerMole, new string[]{"kJ/mol"}), + ("en-US", typeof(MolarEnergyUnit), (int)MolarEnergyUnit.MegajoulePerMole, new string[]{"MJ/mol"}), + ("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.JoulePerMoleKelvin, new string[]{"J/(mol*K)"}), + ("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.KilojoulePerMoleKelvin, new string[]{"kJ/(mol*K)"}), + ("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.MegajoulePerMoleKelvin, new string[]{"MJ/(mol*K)"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.CentimolesPerLiter, new string[]{"cmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.DecimolesPerLiter, new string[]{"dmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MicromolesPerLiter, new string[]{"µmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MillimolesPerLiter, new string[]{"mmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerCubicMeter, new string[]{"mol/m³"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerLiter, new string[]{"mol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.NanomolesPerLiter, new string[]{"nmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.PicomolesPerLiter, new string[]{"pmol/L"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"cg/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"сг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"dag/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"даг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecigramPerMole, new string[]{"dg/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.DecigramPerMole, new string[]{"дг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.GramPerMole, new string[]{"g/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.GramPerMole, new string[]{"г/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.HectogramPerMole, new string[]{"hg/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.HectogramPerMole, new string[]{"гг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.KilogramPerMole, new string[]{"kg/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.KilogramPerMole, new string[]{"кг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.KilopoundPerMole, new string[]{"klb/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.KilopoundPerMole, new string[]{"kфунт/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MegapoundPerMole, new string[]{"Mlb/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MegapoundPerMole, new string[]{"Mфунт/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MicrogramPerMole, new string[]{"µg/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MicrogramPerMole, new string[]{"мкг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.MilligramPerMole, new string[]{"mg/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.MilligramPerMole, new string[]{"мг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.NanogramPerMole, new string[]{"ng/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.NanogramPerMole, new string[]{"нг/моль"}), + ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.PoundPerMole, new string[]{"lb/mol"}), + ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.PoundPerMole, new string[]{"фунт/моль"}), + ("en-US", typeof(PermeabilityUnit), (int)PermeabilityUnit.HenryPerMeter, new string[]{"H/m"}), + ("en-US", typeof(PermittivityUnit), (int)PermittivityUnit.FaradPerMeter, new string[]{"F/m"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.BoilerHorsepower, new string[]{"hp(S)"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.BritishThermalUnitPerHour, new string[]{"Btu/hr"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Decawatt, new string[]{"daW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Deciwatt, new string[]{"dW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.ElectricalHorsepower, new string[]{"hp(E)"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Femtowatt, new string[]{"fW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Gigawatt, new string[]{"GW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.HydraulicHorsepower, new string[]{"hp(H)"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.KilobritishThermalUnitPerHour, new string[]{"kBtu/hr"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Kilowatt, new string[]{"kW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.MechanicalHorsepower, new string[]{"hp(I)"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Megawatt, new string[]{"MW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.MetricHorsepower, new string[]{"hp(M)"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Microwatt, new string[]{"µW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Milliwatt, new string[]{"mW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Nanowatt, new string[]{"nW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Petawatt, new string[]{"PW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Picowatt, new string[]{"pW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Terawatt, new string[]{"TW"}), + ("en-US", typeof(PowerUnit), (int)PowerUnit.Watt, new string[]{"W"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicFoot, new string[]{"daW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicInch, new string[]{"daW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerCubicMeter, new string[]{"daW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DecawattPerLiter, new string[]{"daW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicFoot, new string[]{"dW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicInch, new string[]{"dW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerCubicMeter, new string[]{"dW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.DeciwattPerLiter, new string[]{"dW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicFoot, new string[]{"GW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicInch, new string[]{"GW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerCubicMeter, new string[]{"GW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.GigawattPerLiter, new string[]{"GW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicFoot, new string[]{"kW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicInch, new string[]{"kW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerCubicMeter, new string[]{"kW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.KilowattPerLiter, new string[]{"kW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicFoot, new string[]{"MW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicInch, new string[]{"MW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerCubicMeter, new string[]{"MW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MegawattPerLiter, new string[]{"MW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicFoot, new string[]{"µW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicInch, new string[]{"µW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerCubicMeter, new string[]{"µW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MicrowattPerLiter, new string[]{"µW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicFoot, new string[]{"mW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicInch, new string[]{"mW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerCubicMeter, new string[]{"mW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.MilliwattPerLiter, new string[]{"mW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicFoot, new string[]{"nW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicInch, new string[]{"nW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerCubicMeter, new string[]{"nW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.NanowattPerLiter, new string[]{"nW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicFoot, new string[]{"pW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicInch, new string[]{"pW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerCubicMeter, new string[]{"pW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.PicowattPerLiter, new string[]{"pW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicFoot, new string[]{"TW/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicInch, new string[]{"TW/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerCubicMeter, new string[]{"TW/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.TerawattPerLiter, new string[]{"TW/l"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicFoot, new string[]{"W/ft³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicInch, new string[]{"W/in³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerCubicMeter, new string[]{"W/m³"}), + ("en-US", typeof(PowerDensityUnit), (int)PowerDensityUnit.WattPerLiter, new string[]{"W/l"}), + ("en-US", typeof(PowerRatioUnit), (int)PowerRatioUnit.DecibelMilliwatt, new string[]{"dBmW", "dBm"}), + ("en-US", typeof(PowerRatioUnit), (int)PowerRatioUnit.DecibelWatt, new string[]{"dBW"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Atmosphere, new string[]{"atm"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Atmosphere, new string[]{"атм"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Bar, new string[]{"bar"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Bar, new string[]{"бар"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Centibar, new string[]{"cbar"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Centibar, new string[]{"cбар"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Decapascal, new string[]{"daPa"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Decapascal, new string[]{"даПа"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Decibar, new string[]{"dbar"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Decibar, new string[]{"dбар"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.FootOfHead, new string[]{"ft of head"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Gigapascal, new string[]{"GPa"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Gigapascal, new string[]{"ГПа"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Hectopascal, new string[]{"hPa"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Hectopascal, new string[]{"гПа"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.InchOfMercury, new string[]{"inHg"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Kilobar, new string[]{"kbar"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilobar, new string[]{"kбар"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareCentimeter, new string[]{"kgf/cm²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareCentimeter, new string[]{"кгс/см²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMeter, new string[]{"kgf/m²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMeter, new string[]{"кгс/м²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMillimeter, new string[]{"kgf/mm²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilogramForcePerSquareMillimeter, new string[]{"кгс/мм²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareCentimeter, new string[]{"kN/cm²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareCentimeter, new string[]{"кН/см²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMeter, new string[]{"kN/m²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMeter, new string[]{"кН/м²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMillimeter, new string[]{"kN/mm²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.KilonewtonPerSquareMillimeter, new string[]{"кН/мм²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"kPa"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"кПа"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareFoot, new string[]{"kipf/ft²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareInch, new string[]{"kipf/in²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mbar"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mбар"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"MN/m²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"Мн/м²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Megapascal, new string[]{"MPa"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megapascal, new string[]{"МПа"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.MeterOfHead, new string[]{"m of head"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Micropascal, new string[]{"µPa"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Micropascal, new string[]{"мкПа"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Millibar, new string[]{"mbar"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Millibar, new string[]{"mбар"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.MillimeterOfMercury, new string[]{"mmHg"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareCentimeter, new string[]{"N/cm²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareCentimeter, new string[]{"Н/см²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMeter, new string[]{"N/m²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMeter, new string[]{"Н/м²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMillimeter, new string[]{"N/mm²"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.NewtonPerSquareMillimeter, new string[]{"Н/мм²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Pascal, new string[]{"Pa"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Pascal, new string[]{"Па"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.PoundForcePerSquareFoot, new string[]{"lb/ft²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.PoundForcePerSquareInch, new string[]{"psi", "lb/in²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.TechnicalAtmosphere, new string[]{"at"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.TechnicalAtmosphere, new string[]{"ат"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareCentimeter, new string[]{"tf/cm²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareMeter, new string[]{"tf/m²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.TonneForcePerSquareMillimeter, new string[]{"tf/mm²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.Torr, new string[]{"torr"}), + ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Torr, new string[]{"торр"}), + ("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.AtmospherePerSecond, new string[]{"atm/s"}), + ("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.AtmospherePerSecond, new string[]{"атм/с"}), + ("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.KilopascalPerSecond, new string[]{"kPa/s"}), + ("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.KilopascalPerSecond, new string[]{"кПа/с"}), + ("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.MegapascalPerSecond, new string[]{"MPa/s"}), + ("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.MegapascalPerSecond, new string[]{"МПа/с"}), + ("en-US", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.PascalPerSecond, new string[]{"Pa/s"}), + ("ru-RU", typeof(PressureChangeRateUnit), (int)PressureChangeRateUnit.PascalPerSecond, new string[]{"Па/с"}), + ("en-US", typeof(RatioUnit), (int)RatioUnit.DecimalFraction, new string[]{""}), + ("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerBillion, new string[]{"ppb"}), + ("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerMillion, new string[]{"ppm"}), + ("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerThousand, new string[]{"‰"}), + ("en-US", typeof(RatioUnit), (int)RatioUnit.PartPerTrillion, new string[]{"ppt"}), + ("en-US", typeof(RatioUnit), (int)RatioUnit.Percent, new string[]{"%"}), + ("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.KilovoltampereReactiveHour, new string[]{"kvarh"}), + ("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.MegavoltampereReactiveHour, new string[]{"Mvarh"}), + ("en-US", typeof(ReactiveEnergyUnit), (int)ReactiveEnergyUnit.VoltampereReactiveHour, new string[]{"varh"}), + ("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.GigavoltampereReactive, new string[]{"Gvar"}), + ("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.KilovoltampereReactive, new string[]{"kvar"}), + ("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.MegavoltampereReactive, new string[]{"Mvar"}), + ("en-US", typeof(ReactivePowerUnit), (int)ReactivePowerUnit.VoltampereReactive, new string[]{"var"}), + ("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.DegreePerSecondSquared, new string[]{"°/s²", "deg/s²"}), + ("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.RadianPerSecondSquared, new string[]{"rad/s²"}), + ("en-US", typeof(RotationalAccelerationUnit), (int)RotationalAccelerationUnit.RevolutionPerMinutePerSecond, new string[]{"rpm/s"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.CentiradianPerSecond, new string[]{"crad/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.CentiradianPerSecond, new string[]{"cрад/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DeciradianPerSecond, new string[]{"drad/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DeciradianPerSecond, new string[]{"dрад/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerMinute, new string[]{"°/min", "deg/min"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/s", "deg/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µrad/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µрад/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mrad/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mрад/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nrad/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nрад/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RadianPerSecond, new string[]{"rad/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RadianPerSecond, new string[]{"рад/с"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerMinute, new string[]{"rpm", "r/min"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerMinute, new string[]{"об/мин"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"r/s"}), + ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"об/с"}), + ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.KilonewtonMeterPerRadian, new string[]{"kN·m/rad"}), + ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.MeganewtonMeterPerRadian, new string[]{"MN·m/rad"}), + ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.NewtonMeterPerRadian, new string[]{"N·m/rad", "Nm/rad"}), + ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, new string[]{"kN·m/rad/m"}), + ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, new string[]{"MN·m/rad/m"}), + ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, new string[]{"N·m/rad/m", "Nm/rad/m"}), + ("en-US", typeof(SolidAngleUnit), (int)SolidAngleUnit.Steradian, new string[]{"sr"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.CaloriePerGram, new string[]{"cal/g"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.JoulePerKilogram, new string[]{"J/kg"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilocaloriePerGram, new string[]{"kcal/g"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilojoulePerKilogram, new string[]{"kJ/kg"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.KilowattHourPerKilogram, new string[]{"kWh/kg"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.MegajoulePerKilogram, new string[]{"MJ/kg"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.MegawattHourPerKilogram, new string[]{"MWh/kg"}), + ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.WattHourPerKilogram, new string[]{"Wh/kg"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.CaloriePerGramKelvin, new string[]{"cal/g.K"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, new string[]{"J/kg.C"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.JoulePerKilogramKelvin, new string[]{"J/kg.K"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilocaloriePerGramKelvin, new string[]{"kcal/g.K"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, new string[]{"kJ/kg.C"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.KilojoulePerKilogramKelvin, new string[]{"kJ/kg.K"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, new string[]{"MJ/kg.C"}), + ("en-US", typeof(SpecificEntropyUnit), (int)SpecificEntropyUnit.MegajoulePerKilogramKelvin, new string[]{"MJ/kg.K"}), + ("en-US", typeof(SpecificVolumeUnit), (int)SpecificVolumeUnit.CubicFootPerPound, new string[]{"ft³/lb"}), + ("en-US", typeof(SpecificVolumeUnit), (int)SpecificVolumeUnit.CubicMeterPerKilogram, new string[]{"m³/kg"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicCentimeter, new string[]{"kgf/cm³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicMeter, new string[]{"kgf/m³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilogramForcePerCubicMillimeter, new string[]{"kgf/mm³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicCentimeter, new string[]{"kN/cm³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicMeter, new string[]{"kN/m³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilonewtonPerCubicMillimeter, new string[]{"kN/mm³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilopoundForcePerCubicFoot, new string[]{"kipf/ft³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.KilopoundForcePerCubicInch, new string[]{"kipf/in³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.MeganewtonPerCubicMeter, new string[]{"MN/m³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicCentimeter, new string[]{"N/cm³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicMeter, new string[]{"N/m³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.NewtonPerCubicMillimeter, new string[]{"N/mm³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.PoundForcePerCubicFoot, new string[]{"lbf/ft³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.PoundForcePerCubicInch, new string[]{"lbf/in³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicCentimeter, new string[]{"tf/cm³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicMeter, new string[]{"tf/m³"}), + ("en-US", typeof(SpecificWeightUnit), (int)SpecificWeightUnit.TonneForcePerCubicMillimeter, new string[]{"tf/mm³"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerHour, new string[]{"cm/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerMinute, new string[]{"cm/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.CentimeterPerSecond, new string[]{"cm/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.DecimeterPerMinute, new string[]{"dm/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.DecimeterPerSecond, new string[]{"dm/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerHour, new string[]{"ft/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerMinute, new string[]{"ft/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.FootPerSecond, new string[]{"ft/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerHour, new string[]{"in/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerMinute, new string[]{"in/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.InchPerSecond, new string[]{"in/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerHour, new string[]{"km/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerMinute, new string[]{"km/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.KilometerPerSecond, new string[]{"km/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.Knot, new string[]{"kn", "kt", "knot", "knots"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerHour, new string[]{"m/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerMinute, new string[]{"m/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MeterPerSecond, new string[]{"m/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MicrometerPerMinute, new string[]{"µm/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MicrometerPerSecond, new string[]{"µm/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MilePerHour, new string[]{"mph"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerHour, new string[]{"mm/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerMinute, new string[]{"mm/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.MillimeterPerSecond, new string[]{"mm/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.NanometerPerMinute, new string[]{"nm/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.NanometerPerSecond, new string[]{"nm/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerHour, new string[]{"ftUS/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerMinute, new string[]{"ftUS/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.UsSurveyFootPerSecond, new string[]{"ftUS/s"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerHour, new string[]{"yd/h"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerMinute, new string[]{"yd/min"}), + ("en-US", typeof(SpeedUnit), (int)SpeedUnit.YardPerSecond, new string[]{"yd/s"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeCelsius, new string[]{"°C"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeDelisle, new string[]{"°De"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeFahrenheit, new string[]{"°F"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeNewton, new string[]{"°N"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeRankine, new string[]{"°R"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeReaumur, new string[]{"°Ré"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.DegreeRoemer, new string[]{"°Rø"}), + ("en-US", typeof(TemperatureUnit), (int)TemperatureUnit.Kelvin, new string[]{"K"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, new string[]{"c°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, new string[]{"da°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, new string[]{"d°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DegreeCelsiusPerMinute, new string[]{"°C/min"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.DegreeCelsiusPerSecond, new string[]{"°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, new string[]{"h°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, new string[]{"k°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, new string[]{"µ°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, new string[]{"m°C/s"}), + ("en-US", typeof(TemperatureChangeRateUnit), (int)TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, new string[]{"n°C/s"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeCelsius, new string[]{"∆°C"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeDelisle, new string[]{"∆°De"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeFahrenheit, new string[]{"∆°F"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeNewton, new string[]{"∆°N"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeRankine, new string[]{"∆°R"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeReaumur, new string[]{"∆°Ré"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.DegreeRoemer, new string[]{"∆°Rø"}), + ("en-US", typeof(TemperatureDeltaUnit), (int)TemperatureDeltaUnit.Kelvin, new string[]{"∆K"}), + ("en-US", typeof(ThermalConductivityUnit), (int)ThermalConductivityUnit.BtuPerHourFootFahrenheit, new string[]{"BTU/h·ft·°F"}), + ("en-US", typeof(ThermalConductivityUnit), (int)ThermalConductivityUnit.WattPerMeterKelvin, new string[]{"W/m·K"}), + ("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, new string[]{"Hrft²°F/Btu"}), + ("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, new string[]{"cm²Hr°C/kcal"}), + ("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, new string[]{"cm²K/W"}), + ("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, new string[]{"m²°C/W"}), + ("en-US", typeof(ThermalResistanceUnit), (int)ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, new string[]{"m²K/kW"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceCentimeter, new string[]{"kgf·cm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceMeter, new string[]{"kgf·m"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilogramForceMillimeter, new string[]{"kgf·mm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonCentimeter, new string[]{"kN·cm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMeter, new string[]{"kN·m"}), + ("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMeter, new string[]{"кН·м"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilonewtonMillimeter, new string[]{"kN·mm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilopoundForceFoot, new string[]{"kipf·ft"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.KilopoundForceInch, new string[]{"kipf·in"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonCentimeter, new string[]{"MN·cm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMeter, new string[]{"MN·m"}), + ("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMeter, new string[]{""}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.MeganewtonMillimeter, new string[]{"MN·mm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.MegapoundForceFoot, new string[]{"Mlbf·ft"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.MegapoundForceInch, new string[]{"Mlbf·in"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonCentimeter, new string[]{"N·cm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonMeter, new string[]{"N·m"}), + ("ru-RU", typeof(TorqueUnit), (int)TorqueUnit.NewtonMeter, new string[]{"Н·м"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.NewtonMillimeter, new string[]{"N·mm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.PoundForceFoot, new string[]{"lbf·ft"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.PoundForceInch, new string[]{"lbf·in"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceCentimeter, new string[]{"tf·cm"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceMeter, new string[]{"tf·m"}), + ("en-US", typeof(TorqueUnit), (int)TorqueUnit.TonneForceMillimeter, new string[]{"tf·mm"}), + ("en-US", typeof(VitaminAUnit), (int)VitaminAUnit.InternationalUnit, new string[]{"IU"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), + ("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.AuTablespoon, new string[]{""}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Centiliter, new string[]{"cl"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Centiliter, new string[]{"сл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicCentimeter, new string[]{"cm³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicCentimeter, new string[]{"см³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicDecimeter, new string[]{"dm³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicDecimeter, new string[]{"дм³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicFoot, new string[]{"ft³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicFoot, new string[]{"фут³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicInch, new string[]{"in³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicInch, new string[]{"дюйм³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicKilometer, new string[]{"km³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicKilometer, new string[]{"км³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMeter, new string[]{"m³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMeter, new string[]{"м³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMicrometer, new string[]{"µm³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMicrometer, new string[]{"мкм³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMile, new string[]{"mi³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMile, new string[]{"миля³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"mm³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicMillimeter, new string[]{"мм³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"yd³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.CubicYard, new string[]{"ярд³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"dl"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Deciliter, new string[]{"дл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hft³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicFoot, new string[]{"hфут³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hm³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.HectocubicMeter, new string[]{"hм³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"hl"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Hectoliter, new string[]{"гл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialBeerBarrel, new string[]{"bl (imp.)"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"gal (imp.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialGallon, new string[]{"Английский галлон"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.ImperialOunce, new string[]{"oz (imp.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.ImperialOunce, new string[]{"Английская унция"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilocubicFoot, new string[]{"kft³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilocubicFoot, new string[]{"kфут³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilocubicMeter, new string[]{"km³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilocubicMeter, new string[]{"kм³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kgal (imp.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kАнглийский галлон"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kgal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kАмериканский галлон"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Liter, new string[]{"l"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Liter, new string[]{"л"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegacubicFoot, new string[]{"Mft³"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegacubicFoot, new string[]{"Mфут³"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegaimperialGallon, new string[]{"Mgal (imp.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegaimperialGallon, new string[]{"MАнглийский галлон"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.MegausGallon, new string[]{"Mgal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MegausGallon, new string[]{"MАмериканский галлон"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.MetricCup, new string[]{""}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{"tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{""}), + ("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.MetricTeaspoon, new string[]{""}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Microliter, new string[]{"µl"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Microliter, new string[]{"мкл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Milliliter, new string[]{"ml"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Milliliter, new string[]{"мл"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.OilBarrel, new string[]{"bbl"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), + ("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UkTablespoon, new string[]{""}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsBeerBarrel, new string[]{"bl (U.S.)"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsCustomaryCup, new string[]{""}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsGallon, new string[]{"gal (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsGallon, new string[]{"Американский галлон"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsLegalCup, new string[]{""}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsOunce, new string[]{"oz (U.S.)"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsOunce, new string[]{"Американская унция"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsPint, new string[]{"pt (U.S.)"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsQuart, new string[]{"qt (U.S.)"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), + ("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UsTablespoon, new string[]{""}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), + ("nb-NO", typeof(VolumeUnit), (int)VolumeUnit.UsTeaspoon, new string[]{""}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerMinute, new string[]{"cLPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"dm³/min"}), + ("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"дм³/мин"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerHour, new string[]{"ft³/h", "cf/hr"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerMinute, new string[]{"ft³/min"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicFootPerSecond, new string[]{"ft³/s"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerHour, new string[]{"m³/h"}), + ("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerHour, new string[]{"м³/ч"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerMinute, new string[]{"m³/min"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerSecond, new string[]{"m³/s"}), + ("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicMeterPerSecond, new string[]{"м³/с"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerHour, new string[]{"yd³/h"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerMinute, new string[]{"yd³/min"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerSecond, new string[]{"yd³/s"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerMinute, new string[]{"dLPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerMinute, new string[]{"kLPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerHour, new string[]{"LPH"}), + ("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerHour, new string[]{"л/ч"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerMinute, new string[]{"LPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerSecond, new string[]{"LPS"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerMinute, new string[]{"µLPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerMinute, new string[]{"mLPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MillionUsGallonsPerDay, new string[]{"MGD"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerMinute, new string[]{"nLPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerDay, new string[]{"bbl/d", "BOPD"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerHour, new string[]{"bbl/hr", "bph"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerMinute, new string[]{"bbl/min", "bpm"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerHour, new string[]{"gal (U.S.)/h"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerMinute, new string[]{"gal (U.S.)/min", "GPM"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.UsGallonPerSecond, new string[]{"gal (U.S.)/s"}), }; } } diff --git a/UnitsNet/I18n/AbbreviationsForCulture.cs b/UnitsNet/I18n/AbbreviationsForCulture.cs deleted file mode 100644 index beef5b0918..0000000000 --- a/UnitsNet/I18n/AbbreviationsForCulture.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System.Collections.ObjectModel; -using System.Globalization; -using System.Linq; - -namespace UnitsNet.I18n -{ - internal class AbbreviationsForCulture - { - public readonly ReadOnlyCollection Abbreviations; - public readonly CultureInfo Cult; - - public AbbreviationsForCulture(string cultureName, params string[] abbreviations) - { - Cult = new CultureInfo(cultureName); - Abbreviations = new ReadOnlyCollection(abbreviations.ToList()); - } - } -} \ No newline at end of file diff --git a/UnitsNet/I18n/CulturesForEnumValue.cs b/UnitsNet/I18n/CulturesForEnumValue.cs deleted file mode 100644 index 981c099095..0000000000 --- a/UnitsNet/I18n/CulturesForEnumValue.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; - -namespace UnitsNet.I18n -{ - internal class CulturesForEnumValue - { - public readonly ReadOnlyCollection Cultures; - public readonly int Value; - - public CulturesForEnumValue(int value, IEnumerable cultures) - { - Value = value; - Cultures = new ReadOnlyCollection(cultures.ToList()); - } - } -} \ No newline at end of file diff --git a/UnitsNet/I18n/UnitLocalization.cs b/UnitsNet/I18n/UnitLocalization.cs deleted file mode 100644 index 0f9879a89e..0000000000 --- a/UnitsNet/I18n/UnitLocalization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; - -namespace UnitsNet.I18n -{ - internal class UnitLocalization - { - public readonly ReadOnlyCollection EnumValues; - public readonly Type UnitEnumType; - - public UnitLocalization(Type unitEnumType, IEnumerable enumValues) - { - UnitEnumType = unitEnumType; - EnumValues = new ReadOnlyCollection(enumValues.ToList()); - } - } -} \ No newline at end of file diff --git a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 index a46758d8d6..cd60a3c04a 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 @@ -39,10 +39,6 @@ // THE SOFTWARE. using System; -using System.Globalization; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using UnitsNet.I18n; using UnitsNet.Units; // ReSharper disable RedundantCommaInArrayInitializer @@ -52,8 +48,8 @@ namespace UnitsNet { public partial class UnitAbbreviationsCache { - private static readonly Tuple[] GeneratedLocalizations - = new Tuple[] + private static readonly (string CultureName, Type UnitType, int UnitValue, string[] UnitAbbreviations)[] GeneratedLocalizations + = new [] { "@; foreach ($quantity in $quantities) @@ -70,7 +66,7 @@ namespace UnitsNet $cultureName = $localization.Culture; $abbreviationParams = $localization.Abbreviations -join '", "' @" - Tuple.Create(`"$cultureName`", typeof($unitEnumName), (int)$unitEnumName.$enumValue, new string[]{`"$abbreviationParams`"}), + (`"$cultureName`", typeof($unitEnumName), (int)$unitEnumName.$enumValue, new string[]{`"$abbreviationParams`"}), "@; } } diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index 92ff16127f..671889db65 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -28,6 +28,7 @@ + From 49026b22a7560db1ddeaad37ffb8d76245812d03 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Wed, 17 Oct 2018 11:55:11 -0400 Subject: [PATCH 085/131] Adding ValueTuple package to WRC --- .../UnitsNet.WindowsRuntimeComponent.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj index f54db87c4c..42dc4f39c1 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj @@ -210,6 +210,9 @@ 11.1.0 + + 4.5.0 + From 40a551e6b76d2c9505253aa4c2cc779ae90adf5f Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Mon, 22 Oct 2018 17:00:57 -0400 Subject: [PATCH 086/131] Adding additional functionality to IQuantity --- UnitsNet/IQuantity.cs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 07d0c250a0..611d440ff9 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -20,6 +20,7 @@ // THE SOFTWARE. using System; +using JetBrains.Annotations; namespace UnitsNet { @@ -46,6 +47,7 @@ BaseDimensions Dimensions } #if !WINDOWS_UWP + public interface IQuantity : IQuantity where UnitType : Enum { /// @@ -60,6 +62,42 @@ public interface IQuantity : IQuantity where UnitType : Enum /// Unit representation to use. /// String representation. string ToString(UnitType unit); + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// Unit representation to use. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + string ToString(UnitType unit, [CanBeNull] IFormatProvider provider); + + /// + /// Get string representation of value and unit. + /// + /// Unit representation to use. + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + string ToString(UnitType unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix); + + /// + /// Get string representation of value and unit. + /// + /// Unit representation to use. + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + string ToString(UnitType unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args); + + /// + /// The unit this quantity was constructed with or the BaseUnit if the default constructor was used. + /// + UnitType Unit + { + get; + } } + #endif } From 30363ceb41ae4153b001184c2f52f7847ab922f4 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 2 Nov 2018 14:57:35 +0100 Subject: [PATCH 087/131] Delete Vector2/3 --- UnitsNet/Vector2.cs | 108 -------------------------------------------- UnitsNet/Vector3.cs | 108 -------------------------------------------- 2 files changed, 216 deletions(-) delete mode 100644 UnitsNet/Vector2.cs delete mode 100644 UnitsNet/Vector3.cs diff --git a/UnitsNet/Vector2.cs b/UnitsNet/Vector2.cs deleted file mode 100644 index c9aa4617c3..0000000000 --- a/UnitsNet/Vector2.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; - -namespace UnitsNet -{ -#if WINDOWS_UWP - public struct Vector2 - { - public double X; - public double Y; - } -#else - public struct Vector2 : IEquatable - { - public readonly double X; - public readonly double Y; - - public Vector2(double x, double y) - { - X = x; - Y = y; - } - - public Vector2(double xy) : this() - { - X = xy; - Y = xy; - } - - #region Equality - - private static IEqualityComparer XyComparer { get; } = new XyEqualityComparer(); - - public bool Equals(Vector2 other) - { - return XyComparer.Equals(this, other); - } - - public static bool operator !=(Vector2 left, Vector2 right) - { - return !XyComparer.Equals(left, right); - } - - public static bool operator ==(Vector2 left, Vector2 right) - { - return XyComparer.Equals(left, right); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - return obj is Vector2 && Equals((Vector2) obj); - } - - public override int GetHashCode() - { - unchecked - { - return (X.GetHashCode()*397) ^ Y.GetHashCode(); - } - } - - private sealed class XyEqualityComparer : IEqualityComparer - { - public bool Equals(Vector2 x, Vector2 y) - { - return x.X.Equals(y.X) && x.Y.Equals(y.Y); - } - - public int GetHashCode(Vector2 obj) - { - unchecked - { - return (obj.X.GetHashCode()*397) ^ obj.Y.GetHashCode(); - } - } - } - - #endregion - - public override string ToString() - { - return $"[{X:0.####}, {Y:0.####}]"; - } - } -#endif -} \ No newline at end of file diff --git a/UnitsNet/Vector3.cs b/UnitsNet/Vector3.cs deleted file mode 100644 index 9917984426..0000000000 --- a/UnitsNet/Vector3.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; - -namespace UnitsNet -{ -#if WINDOWS_UWP - public struct Vector3 - { - public double X; - public double Y; - public double Z; - } -#else - public struct Vector3 : IEquatable - { - public readonly double X; - public readonly double Y; - public readonly double Z; - - public Vector3(double x, double y, double z) - { - X = x; - Y = y; - Z = z; - } - - #region Equality - - public Vector3(double xyz) : this() - { - X = xyz; - Y = xyz; - Z = xyz; - } - - private static IEqualityComparer XyzComparer { get; } = new XyzEqualityComparer(); - - public bool Equals(Vector3 other) - { - return XyzComparer.Equals(this, other); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - return obj is Vector3 && Equals((Vector3) obj); - } - - public override int GetHashCode() - { - unchecked - { - int hashCode = X.GetHashCode(); - hashCode = (hashCode*397) ^ Y.GetHashCode(); - hashCode = (hashCode*397) ^ Z.GetHashCode(); - return hashCode; - } - } - - private sealed class XyzEqualityComparer : IEqualityComparer - { - public bool Equals(Vector3 x, Vector3 y) - { - return x.X.Equals(y.X) && x.Y.Equals(y.Y) && x.Z.Equals(y.Z); - } - - public int GetHashCode(Vector3 obj) - { - unchecked - { - int hashCode = obj.X.GetHashCode(); - hashCode = (hashCode*397) ^ obj.Y.GetHashCode(); - hashCode = (hashCode*397) ^ obj.Z.GetHashCode(); - return hashCode; - } - } - } - - #endregion - - public override string ToString() - { - return $"[{X:0.####}, {Y:0.####}, {Z:0.####}]"; - } - } -#endif -} \ No newline at end of file From 9c4352349608c11ba36850dfc223b0304bb1c21f Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 2 Nov 2018 10:25:44 -0400 Subject: [PATCH 088/131] Merge remote-tracking branch 'angularsen/master' into v4 --- .../CoefficientOfThermalExpansion.json | 46 ++++++++++++++++ Common/UnitDefinitions/MassFlow.json | 13 +++++ Common/UnitDefinitions/Volume.json | 4 +- .../CoefficientOfThermalExpansionTests.cs | 55 +++++++++++++++++++ UnitsNet.Tests/CustomCode/MassFlowTests.cs | 4 ++ UnitsNet.Tests/CustomCode/VolumeTests.cs | 2 + UnitsNet/GeneratedCode/QuantityType.g.cs | 1 + .../GeneratedCode/UnitAbbreviationsCache.g.cs | 7 +++ .../CoefficientOfThermalExpansionUnit.g.cs | 53 ++++++++++++++++++ .../GeneratedCode/Units/MassFlowUnit.g.cs | 2 + UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs | 1 + 11 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 Common/UnitDefinitions/CoefficientOfThermalExpansion.json create mode 100644 UnitsNet.Tests/CustomCode/CoefficientOfThermalExpansionTests.cs create mode 100644 UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs diff --git a/Common/UnitDefinitions/CoefficientOfThermalExpansion.json b/Common/UnitDefinitions/CoefficientOfThermalExpansion.json new file mode 100644 index 0000000000..c944de5a4c --- /dev/null +++ b/Common/UnitDefinitions/CoefficientOfThermalExpansion.json @@ -0,0 +1,46 @@ +{ + "Name": "CoefficientOfThermalExpansion", + "BaseUnit": "InverseKelvin", + "XmlDoc": "A unit that represents a fractional change in size in response to a change in temperature.", + "BaseDimensions": { + "Θ": -1 + }, + "Units": [ + { + "SingularName": "InverseKelvin", + "PluralName": "InverseKelvin", + "FromUnitToBaseFunc": "x", + "FromBaseToUnitFunc": "x", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "K⁻¹", "1/K" ] + } + ] + }, + { + "SingularName": "InverseDegreeCelsius", + "PluralName": "InverseDegreeCelsius", + "FromUnitToBaseFunc": "x", + "FromBaseToUnitFunc": "x", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "°C⁻¹", "1/°C" ] + } + ] + }, + { + "SingularName": "InverseDegreeFahrenheit", + "PluralName": "InverseDegreeFahrenheit", + "FromUnitToBaseFunc": "x*5/9", + "FromBaseToUnitFunc": "x*9/5", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "°F⁻¹", "1/°F" ] + } + ] + } + ] +} \ No newline at end of file diff --git a/Common/UnitDefinitions/MassFlow.json b/Common/UnitDefinitions/MassFlow.json index 92c8161ac6..5a97357d9b 100644 --- a/Common/UnitDefinitions/MassFlow.json +++ b/Common/UnitDefinitions/MassFlow.json @@ -60,6 +60,19 @@ "Abbreviations": [ "lb/h" ] } ] + }, + { + "SingularName": "PoundPerMinute", + "PluralName": "PoundsPerMinute", + "FromUnitToBaseFunc": "x/0.132277", + "FromBaseToUnitFunc": "x*0.132277", + "Prefixes": [ "Mega" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "lb/min" ] + } + ] }, { "SingularName": "TonnePerDay", diff --git a/Common/UnitDefinitions/Volume.json b/Common/UnitDefinitions/Volume.json index 1b2c417995..4eef10b912 100644 --- a/Common/UnitDefinitions/Volume.json +++ b/Common/UnitDefinitions/Volume.json @@ -11,7 +11,7 @@ "PluralName": "Liters", "FromUnitToBaseFunc": "x/1e3", "FromBaseToUnitFunc": "x*1e3", - "Prefixes": [ "Micro", "Milli", "Centi", "Deci", "Hecto" ], + "Prefixes": [ "Micro", "Milli", "Centi", "Deci", "Hecto", "Kilo" ], "Localization": [ { "Culture": "en-US", @@ -20,7 +20,7 @@ { "Culture": "ru-RU", "Abbreviations": [ "л" ], - "AbbreviationsWithPrefixes": [ "мкл", "мл", "сл", "дл", "гл" ] + "AbbreviationsWithPrefixes": [ "мкл", "мл", "сл", "дл", "гл", "кл" ] } ] }, diff --git a/UnitsNet.Tests/CustomCode/CoefficientOfThermalExpansionTests.cs b/UnitsNet.Tests/CustomCode/CoefficientOfThermalExpansionTests.cs new file mode 100644 index 0000000000..3e8f10b6f5 --- /dev/null +++ b/UnitsNet.Tests/CustomCode/CoefficientOfThermalExpansionTests.cs @@ -0,0 +1,55 @@ +//------------------------------------------------------------------------------ +// +// This code was generated (once) by \generate-code.bat, but will not be +// regenerated when it already exists. The purpose of creating this file is to make +// it easier to remember to implement all the unit conversion test cases. +// +// Whenever a new unit is added to this quantity and \generate-code.bat is run, +// the base test class will get a new abstract property and cause a compile error +// in this derived class, reminding the developer to implement the test case +// for the new unit. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +using System; + +namespace UnitsNet.Tests.CustomCode +{ + public class CoefficientOfThermalExpansionTests : CoefficientOfThermalExpansionTestsBase + { + protected override double InverseDegreeCelsiusInOneInverseKelvin => 1.0; + + protected override double InverseDegreeFahrenheitInOneInverseKelvin => 1.8; + + protected override double InverseKelvinInOneInverseKelvin => 1.0; + } +} diff --git a/UnitsNet.Tests/CustomCode/MassFlowTests.cs b/UnitsNet.Tests/CustomCode/MassFlowTests.cs index 6769cced24..750280d09a 100644 --- a/UnitsNet.Tests/CustomCode/MassFlowTests.cs +++ b/UnitsNet.Tests/CustomCode/MassFlowTests.cs @@ -56,6 +56,10 @@ public class MassFlowTests : MassFlowTestsBase protected override double PoundsPerHourInOneGramPerSecond => 7.93664; + protected override double PoundsPerMinuteInOneGramPerSecond => 0.132277; + + protected override double MegapoundsPerMinuteInOneGramPerSecond => 0.132277e-6; + [Fact] public void DurationTimesMassFlowEqualsMass() { diff --git a/UnitsNet.Tests/CustomCode/VolumeTests.cs b/UnitsNet.Tests/CustomCode/VolumeTests.cs index 3ab757796a..34f3f7900c 100644 --- a/UnitsNet.Tests/CustomCode/VolumeTests.cs +++ b/UnitsNet.Tests/CustomCode/VolumeTests.cs @@ -64,6 +64,8 @@ public class VolumeTests : VolumeTestsBase protected override double KilousGallonsInOneCubicMeter => 2.6417217e-1; protected override double LitersInOneCubicMeter => 1E3; + protected override double KilolitersInOneCubicMeter => 1; + protected override double MegacubicFeetInOneCubicMeter => 3.531472e-5; protected override double MegaimperialGallonsInOneCubicMeter => 2.1996924e-4; protected override double MegausGallonsInOneCubicMeter => 2.6417217e-4; diff --git a/UnitsNet/GeneratedCode/QuantityType.g.cs b/UnitsNet/GeneratedCode/QuantityType.g.cs index 42961ed2d1..fdfa76c901 100644 --- a/UnitsNet/GeneratedCode/QuantityType.g.cs +++ b/UnitsNet/GeneratedCode/QuantityType.g.cs @@ -60,6 +60,7 @@ public enum QuantityType BitRate, BrakeSpecificFuelConsumption, Capacitance, + CoefficientOfThermalExpansion, Density, Duration, DynamicViscosity, diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index 6ae334251d..cdfa8ebc3b 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -172,6 +172,9 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, new string[]{"kg/J"}), ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, new string[]{"lb/hph"}), ("en-US", typeof(CapacitanceUnit), (int)CapacitanceUnit.Farad, new string[]{"F"}), + ("en-US", typeof(CoefficientOfThermalExpansionUnit), (int)CoefficientOfThermalExpansionUnit.InverseDegreeCelsius, new string[]{"°C⁻¹", "1/°C"}), + ("en-US", typeof(CoefficientOfThermalExpansionUnit), (int)CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit, new string[]{"°F⁻¹", "1/°F"}), + ("en-US", typeof(CoefficientOfThermalExpansionUnit), (int)CoefficientOfThermalExpansionUnit.InverseKelvin, new string[]{"K⁻¹", "1/K"}), ("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerDeciliter, new string[]{"cg/dl"}), ("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerLiter, new string[]{"cg/L"}), ("en-US", typeof(DensityUnit), (int)DensityUnit.CentigramPerMilliliter, new string[]{"cg/ml"}), @@ -546,10 +549,12 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("ru-RU", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerHour, new string[]{"кг/ч"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.KilogramPerSecond, new string[]{"kg/S"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MegapoundPerHour, new string[]{"Mlb/h"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MegapoundPerMinute, new string[]{"Mlb/min"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MicrogramPerSecond, new string[]{"µg/S"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.MilligramPerSecond, new string[]{"mg/S"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.NanogramPerSecond, new string[]{"ng/S"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.PoundPerHour, new string[]{"lb/h"}), + ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.PoundPerMinute, new string[]{"lb/min"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.ShortTonPerHour, new string[]{"short tn/h"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerDay, new string[]{"t/d"}), ("en-US", typeof(MassFlowUnit), (int)MassFlowUnit.TonnePerHour, new string[]{"t/h"}), @@ -981,6 +986,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilocubicMeter, new string[]{"kм³"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kgal (imp.)"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KiloimperialGallon, new string[]{"kАнглийский галлон"}), + ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Kiloliter, new string[]{"kl"}), + ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.Kiloliter, new string[]{"кл"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kgal (U.S.)"}), ("ru-RU", typeof(VolumeUnit), (int)VolumeUnit.KilousGallon, new string[]{"kАмериканский галлон"}), ("en-US", typeof(VolumeUnit), (int)VolumeUnit.Liter, new string[]{"l"}), diff --git a/UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs b/UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs new file mode 100644 index 0000000000..65919213d8 --- /dev/null +++ b/UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// ReSharper disable once CheckNamespace +namespace UnitsNet.Units +{ + // Disable missing XML comment warnings for the generated unit enums. + #pragma warning disable 1591 + + public enum CoefficientOfThermalExpansionUnit + { + Undefined = 0, + InverseDegreeCelsius, + InverseDegreeFahrenheit, + InverseKelvin, + } + + #pragma warning restore 1591 +} diff --git a/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs index 6788b21f7d..efcf66df90 100644 --- a/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs @@ -52,10 +52,12 @@ public enum MassFlowUnit KilogramPerHour, KilogramPerSecond, MegapoundPerHour, + MegapoundPerMinute, MicrogramPerSecond, MilligramPerSecond, NanogramPerSecond, PoundPerHour, + PoundPerMinute, ShortTonPerHour, TonnePerDay, TonnePerHour, diff --git a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs index 1df0696f47..81ead13ed4 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs @@ -66,6 +66,7 @@ public enum VolumeUnit KilocubicFoot, KilocubicMeter, KiloimperialGallon, + Kiloliter, KilousGallon, Liter, MegacubicFoot, From a05a86eb65e74f3805be45f67000d16b3f86e3d3 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Sat, 3 Nov 2018 07:08:51 -0400 Subject: [PATCH 089/131] =?UTF-8?q?Removing=20unit=20conversion=20from=20T?= =?UTF-8?q?oString=20methods.=20ToUnit=20must=20be=20called=E2=80=A6=20(#5?= =?UTF-8?q?46)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removing unit conversion from ToString methods. ToUnit must be called first. ToString now has a single responsibility of converting to quantity into a string representation. * WRC fix --- UnitsNet.Tests/CustomCode/TemperatureTests.cs | 12 ++-- UnitsNet.Tests/QuantityTests.ToString.cs | 20 +++--- UnitsNet.Tests/UnitAbbreviationsCacheTests.cs | 72 +++++++++---------- .../Information.WindowsRuntimeComponent.g.cs | 35 +++------ .../Length.WindowsRuntimeComponent.g.cs | 35 +++------ .../Level.WindowsRuntimeComponent.g.cs | 35 +++------ .../Quantities/Information.NetFramework.g.cs | 33 +++------ .../Quantities/Length.NetFramework.g.cs | 33 +++------ .../Quantities/Level.NetFramework.g.cs | 33 +++------ UnitsNet/IQuantity.cs | 60 +++++++++++----- ...GenerateQuantitySourceCodeNetFramework.ps1 | 41 ++++------- 11 files changed, 172 insertions(+), 237 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/TemperatureTests.cs b/UnitsNet.Tests/CustomCode/TemperatureTests.cs index ad2c029b78..0aa5f9d234 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureTests.cs @@ -61,7 +61,7 @@ public void DividedByTemperatureDeltaEqualsTemperature(TemperatureUnit unit, int // Act Temperature resultTemp = temperature.Divide(divisor, unit); - string actual = resultTemp.ToString(unit, CultureInfo.InvariantCulture, "{0:0} {1}"); + string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); Assert.Equal(expected, actual); } @@ -81,7 +81,7 @@ public void MultiplyByTemperatureDeltaEqualsTemperature(TemperatureUnit unit, in // Act Temperature resultTemp = temperature.Multiply(factor, unit); - string actual = resultTemp.ToString(unit, CultureInfo.InvariantCulture, "{0:0} {1}"); + string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); Assert.Equal(expected, actual); } @@ -100,7 +100,7 @@ public void TemperatureDeltaPlusTemperatureEqualsTemperature(TemperatureUnit uni // Act Temperature resultTemp = delta + temperature; - string actual = resultTemp.ToString(unit, CultureInfo.InvariantCulture, "{0:0} {1}"); + string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); Assert.Equal(expected, actual); } @@ -119,7 +119,7 @@ public void TemperatureMinusTemperatureDeltaEqualsTemperature(TemperatureUnit un // Act Temperature resultTemp = temperature - delta; - string actual = resultTemp.ToString(unit, CultureInfo.InvariantCulture, "{0:0} {1}"); + string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); Assert.Equal(expected, actual); } @@ -138,8 +138,8 @@ public void TemperaturePlusTemperatureDeltaEqualsTemperature(TemperatureUnit uni // Act Temperature resultTemp = temperature + delta; - string actual = resultTemp.ToString(unit, CultureInfo.InvariantCulture, "{0:0} {1}"); + string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); Assert.Equal(expected, actual); } } -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/QuantityTests.ToString.cs b/UnitsNet.Tests/QuantityTests.ToString.cs index 970fccb3a6..0c6c21e935 100644 --- a/UnitsNet.Tests/QuantityTests.ToString.cs +++ b/UnitsNet.Tests/QuantityTests.ToString.cs @@ -106,10 +106,10 @@ public void ConvertsToTheGivenUnit() try { GlobalConfiguration.DefaultCulture = CultureInfo.InvariantCulture; - Assert.Equal("5,000 g", Mass.FromKilograms(5).ToString(MassUnit.Gram)); - Assert.Equal("5 kg", Mass.FromGrams(5000).ToString(MassUnit.Kilogram)); - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter)); - Assert.Equal("1.97 in", Length.FromCentimeters(5).ToString(LengthUnit.Inch)); + Assert.Equal("5,000 g", Mass.FromKilograms(5).ToUnit(MassUnit.Gram).ToString()); + Assert.Equal("5 kg", Mass.FromGrams(5000).ToUnit(MassUnit.Kilogram).ToString()); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString()); + Assert.Equal("1.97 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString()); } finally { @@ -124,9 +124,9 @@ public void FormatsNumberUsingGivenCulture() try { GlobalConfiguration.DefaultCulture = CultureInfo.InvariantCulture; - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, null)); - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, CultureInfo.InvariantCulture)); - Assert.Equal("0,05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, new CultureInfo("nb-NO"))); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(null)); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(CultureInfo.InvariantCulture)); + Assert.Equal("0,05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(new CultureInfo("nb-NO"))); } finally { @@ -141,9 +141,9 @@ public void FormatsNumberUsingGivenDigitsAfterRadix() try { GlobalConfiguration.DefaultCulture = CultureInfo.InvariantCulture; - Assert.Equal("0.05 m", Length.FromCentimeters(5).ToString(LengthUnit.Meter, null, 4)); - Assert.Equal("1.97 in", Length.FromCentimeters(5).ToString(LengthUnit.Inch, null, 2)); - Assert.Equal("1.9685 in", Length.FromCentimeters(5).ToString(LengthUnit.Inch, null, 4)); + Assert.Equal("0.05 m", Length.FromCentimeters(5).ToUnit(LengthUnit.Meter).ToString(null, 4)); + Assert.Equal("1.97 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString(null, 2)); + Assert.Equal("1.9685 in", Length.FromCentimeters(5).ToUnit(LengthUnit.Inch).ToString(null, 4)); } finally { diff --git a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs index 449c5cf042..cfdf98338f 100644 --- a/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs +++ b/UnitsNet.Tests/UnitAbbreviationsCacheTests.cs @@ -55,7 +55,7 @@ public UnitAbbreviationsCacheTests(ITestOutputHelper output) [InlineData(0.115, "0.12 m")] public void DefaultToStringFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToString(LengthUnit.Meter, AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -77,7 +77,7 @@ private enum CustomUnit [InlineData("it-IT")] public void CommaRadixPointCultureFormatting(string culture) { - Assert.Equal("0,12 m", Length.FromMeters(0.12).ToString(LengthUnit.Meter, GetCulture(culture))); + Assert.Equal("0,12 m", Length.FromMeters(0.12).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } // These cultures all use a decimal point for the radix point @@ -89,7 +89,7 @@ public void CommaRadixPointCultureFormatting(string culture) [InlineData("es-MX")] public void DecimalRadixPointCultureFormatting(string culture) { - Assert.Equal("0.12 m", Length.FromMeters(0.12).ToString(LengthUnit.Meter, GetCulture(culture))); + Assert.Equal("0.12 m", Length.FromMeters(0.12).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } // These cultures all use a comma in digit grouping @@ -102,7 +102,7 @@ public void DecimalRadixPointCultureFormatting(string culture) public void CommaDigitGroupingCultureFormatting(string cultureName) { CultureInfo culture = GetCulture(cultureName); - Assert.Equal("1,111 m", Length.FromMeters(1111).ToString(LengthUnit.Meter, culture)); + Assert.Equal("1,111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(culture)); // Feet/Inch and Stone/Pound combinations are only used (customarily) in the US, UK and maybe Ireland - all English speaking countries. // FeetInches returns a whole number of feet, with the remainder expressed (rounded) in inches. Same for SonePounds. @@ -119,7 +119,7 @@ public void CommaDigitGroupingCultureFormatting(string cultureName) public void SpaceDigitGroupingCultureFormatting(string culture) { // Note: the space used in digit groupings is actually a "thin space" Unicode character U+2009 - Assert.Equal("1 111 m", Length.FromMeters(1111).ToString(LengthUnit.Meter, GetCulture(culture))); + Assert.Equal("1 111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } // These cultures all use a decimal point in digit grouping @@ -131,7 +131,7 @@ public void SpaceDigitGroupingCultureFormatting(string culture) [InlineData("it-IT")] public void DecimalPointDigitGroupingCultureFormatting(string culture) { - Assert.Equal("1.111 m", Length.FromMeters(1111).ToString(LengthUnit.Meter, GetCulture(culture))); + Assert.Equal("1.111 m", Length.FromMeters(1111).ToUnit(LengthUnit.Meter).ToString(GetCulture(culture))); } [Theory] @@ -143,7 +143,7 @@ public void DecimalPointDigitGroupingCultureFormatting(string culture) [InlineData(6, "1.123457 m")] public void CustomNumberOfSignificantDigitsAfterRadixFormatting(int significantDigitsAfterRadix, string expected) { - string actual = Length.FromMeters(1.123456789).ToString(LengthUnit.Meter, AmericanCulture, significantDigitsAfterRadix); + string actual = Length.FromMeters(1.123456789).ToUnit(LengthUnit.Meter).ToString(AmericanCulture, significantDigitsAfterRadix); Assert.Equal(expected, actual); } @@ -158,7 +158,7 @@ public void CustomNumberOfSignificantDigitsAfterRadixFormatting(int significantD public void RoundingErrorsWithSignificantDigitsAfterRadixFormatting(double value, int maxSignificantDigitsAfterRadix, string expected) { - string actual = Length.FromMeters(value).ToString(LengthUnit.Meter, AmericanCulture, maxSignificantDigitsAfterRadix); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture, maxSignificantDigitsAfterRadix); Assert.Equal(expected, actual); } @@ -170,7 +170,7 @@ public void RoundingErrorsWithSignificantDigitsAfterRadixFormatting(double value [InlineData(1.99e-4, "1.99e-04 m")] public void ScientificNotationLowerInterval(double value, string expected) { - string actual = Length.FromMeters(value).ToString(LengthUnit.Meter, AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -181,7 +181,7 @@ public void ScientificNotationLowerInterval(double value, string expected) [InlineData(999.99, "999.99 m")] public void FixedPointNotationIntervalFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToString(LengthUnit.Meter, AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -193,7 +193,7 @@ public void FixedPointNotationIntervalFormatting(double value, string expected) [InlineData(999999.99, "999,999.99 m")] public void FixedPointNotationWithDigitGroupingIntervalFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToString(LengthUnit.Meter, AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -204,7 +204,7 @@ public void FixedPointNotationWithDigitGroupingIntervalFormatting(double value, [InlineData(double.MaxValue, "1.8e+308 m")] public void ScientificNotationUpperIntervalFormatting(double value, string expected) { - string actual = Length.FromMeters(value).ToString(LengthUnit.Meter, AmericanCulture); + string actual = Length.FromMeters(value).ToUnit(LengthUnit.Meter).ToString(AmericanCulture); Assert.Equal(expected, actual); } @@ -231,35 +231,35 @@ public void AllUnitsImplementToStringForInvariantCulture() [Fact] public void ToString_WithNorwegianCulture() { - Assert.Equal("1 °", Angle.FromDegrees(1).ToString(AngleUnit.Degree, NorwegianCulture)); - Assert.Equal("1 m²", Area.FromSquareMeters(1).ToString(AreaUnit.SquareMeter, NorwegianCulture)); - Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToString(ElectricPotentialUnit.Volt, NorwegianCulture)); - Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToString(VolumeFlowUnit.CubicMeterPerSecond, NorwegianCulture)); - Assert.Equal("1 N", Force.FromNewtons(1).ToString(ForceUnit.Newton, NorwegianCulture)); - Assert.Equal("1 m", Length.FromMeters(1).ToString(LengthUnit.Meter, NorwegianCulture)); - Assert.Equal("1 kg", Mass.FromKilograms(1).ToString(MassUnit.Kilogram, NorwegianCulture)); - Assert.Equal("1 Pa", Pressure.FromPascals(1).ToString(PressureUnit.Pascal, NorwegianCulture)); - Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToString(RotationalSpeedUnit.RadianPerSecond, NorwegianCulture)); - Assert.Equal("1 K", Temperature.FromKelvins(1).ToString(TemperatureUnit.Kelvin, NorwegianCulture)); - Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToString(TorqueUnit.NewtonMeter, NorwegianCulture)); - Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToString(VolumeUnit.CubicMeter, NorwegianCulture)); + Assert.Equal("1 °", Angle.FromDegrees(1).ToUnit(AngleUnit.Degree).ToString(NorwegianCulture)); + Assert.Equal("1 m²", Area.FromSquareMeters(1).ToUnit(AreaUnit.SquareMeter).ToString(NorwegianCulture)); + Assert.Equal("1 V", ElectricPotential.FromVolts(1).ToUnit(ElectricPotentialUnit.Volt).ToString(NorwegianCulture)); + Assert.Equal("1 m³/s", VolumeFlow.FromCubicMetersPerSecond(1).ToUnit(VolumeFlowUnit.CubicMeterPerSecond).ToString(NorwegianCulture)); + Assert.Equal("1 N", Force.FromNewtons(1).ToUnit(ForceUnit.Newton).ToString(NorwegianCulture)); + Assert.Equal("1 m", Length.FromMeters(1).ToUnit(LengthUnit.Meter).ToString(NorwegianCulture)); + Assert.Equal("1 kg", Mass.FromKilograms(1).ToUnit(MassUnit.Kilogram).ToString(NorwegianCulture)); + Assert.Equal("1 Pa", Pressure.FromPascals(1).ToUnit(PressureUnit.Pascal).ToString(NorwegianCulture)); + Assert.Equal("1 rad/s", RotationalSpeed.FromRadiansPerSecond(1).ToUnit(RotationalSpeedUnit.RadianPerSecond).ToString(NorwegianCulture)); + Assert.Equal("1 K", Temperature.FromKelvins(1).ToUnit(TemperatureUnit.Kelvin).ToString(NorwegianCulture)); + Assert.Equal("1 N·m", Torque.FromNewtonMeters(1).ToUnit(TorqueUnit.NewtonMeter).ToString(NorwegianCulture)); + Assert.Equal("1 m³", Volume.FromCubicMeters(1).ToUnit(VolumeUnit.CubicMeter).ToString(NorwegianCulture)); } [Fact] public void ToString_WithRussianCulture() { - Assert.Equal("1 °", Angle.FromDegrees(1).ToString(AngleUnit.Degree, RussianCulture)); - Assert.Equal("1 м²", Area.FromSquareMeters(1).ToString(AreaUnit.SquareMeter, RussianCulture)); - Assert.Equal("1 В", ElectricPotential.FromVolts(1).ToString(ElectricPotentialUnit.Volt, RussianCulture)); - Assert.Equal("1 м³/с", VolumeFlow.FromCubicMetersPerSecond(1).ToString(VolumeFlowUnit.CubicMeterPerSecond, RussianCulture)); - Assert.Equal("1 Н", Force.FromNewtons(1).ToString(ForceUnit.Newton, RussianCulture)); - Assert.Equal("1 м", Length.FromMeters(1).ToString(LengthUnit.Meter, RussianCulture)); - Assert.Equal("1 кг", Mass.FromKilograms(1).ToString(MassUnit.Kilogram, RussianCulture)); - Assert.Equal("1 Па", Pressure.FromPascals(1).ToString(PressureUnit.Pascal, RussianCulture)); - Assert.Equal("1 рад/с", RotationalSpeed.FromRadiansPerSecond(1).ToString(RotationalSpeedUnit.RadianPerSecond, RussianCulture)); - Assert.Equal("1 K", Temperature.FromKelvins(1).ToString(TemperatureUnit.Kelvin, RussianCulture)); - Assert.Equal("1 Н·м", Torque.FromNewtonMeters(1).ToString(TorqueUnit.NewtonMeter, RussianCulture)); - Assert.Equal("1 м³", Volume.FromCubicMeters(1).ToString(VolumeUnit.CubicMeter, RussianCulture)); + Assert.Equal("1 °", Angle.FromDegrees(1).ToUnit(AngleUnit.Degree).ToString(RussianCulture)); + Assert.Equal("1 м²", Area.FromSquareMeters(1).ToUnit(AreaUnit.SquareMeter).ToString(RussianCulture)); + Assert.Equal("1 В", ElectricPotential.FromVolts(1).ToUnit(ElectricPotentialUnit.Volt).ToString(RussianCulture)); + Assert.Equal("1 м³/с", VolumeFlow.FromCubicMetersPerSecond(1).ToUnit(VolumeFlowUnit.CubicMeterPerSecond).ToString(RussianCulture)); + Assert.Equal("1 Н", Force.FromNewtons(1).ToUnit(ForceUnit.Newton).ToString(RussianCulture)); + Assert.Equal("1 м", Length.FromMeters(1).ToUnit(LengthUnit.Meter).ToString(RussianCulture)); + Assert.Equal("1 кг", Mass.FromKilograms(1).ToUnit(MassUnit.Kilogram).ToString(RussianCulture)); + Assert.Equal("1 Па", Pressure.FromPascals(1).ToUnit(PressureUnit.Pascal).ToString(RussianCulture)); + Assert.Equal("1 рад/с", RotationalSpeed.FromRadiansPerSecond(1).ToUnit(RotationalSpeedUnit.RadianPerSecond).ToString(RussianCulture)); + Assert.Equal("1 K", Temperature.FromKelvins(1).ToUnit(TemperatureUnit.Kelvin).ToString(RussianCulture)); + Assert.Equal("1 Н·м", Torque.FromNewtonMeters(1).ToUnit(TorqueUnit.NewtonMeter).ToString(RussianCulture)); + Assert.Equal("1 м³", Volume.FromCubicMeters(1).ToUnit(VolumeUnit.CubicMeter).ToString(RussianCulture)); } [Fact] diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index be689fa22b..0e5491bac3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -937,64 +937,51 @@ private decimal AsBaseNumericType(InformationUnit unit) /// String representation. public override string ToString() { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(InformationUnit unit) - { - return ToString(unit, null, 2); + return ToString(null); } /// /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Unit representation to use. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(InformationUnit unit, [CanBeNull] string cultureName) + public string ToString([CanBeNull] string cultureName) { var provider = cultureName; - return ToString(unit, provider, 2); + return ToString(provider, 2); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(InformationUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) + public string ToString(string cultureName, int significantDigitsAfterRadix) { var provider = cultureName; - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(InformationUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { - IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + var provider = GetFormatProviderFromCultureName(cultureName); if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); provider = provider ?? GlobalConfiguration.DefaultCulture; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); return string.Format(provider, format, formatArgs); } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index 85e037b5d1..ff1d2450fb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -869,64 +869,51 @@ private double AsBaseNumericType(LengthUnit unit) /// String representation. public override string ToString() { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LengthUnit unit) - { - return ToString(unit, null, 2); + return ToString(null); } /// /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Unit representation to use. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(LengthUnit unit, [CanBeNull] string cultureName) + public string ToString([CanBeNull] string cultureName) { var provider = cultureName; - return ToString(unit, provider, 2); + return ToString(provider, 2); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(LengthUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) + public string ToString(string cultureName, int significantDigitsAfterRadix) { var provider = cultureName; - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(LengthUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { - IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + var provider = GetFormatProviderFromCultureName(cultureName); if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); provider = provider ?? GlobalConfiguration.DefaultCulture; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); return string.Format(provider, format, formatArgs); } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 891c98f5a1..1104c74058 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -529,64 +529,51 @@ private double AsBaseNumericType(LevelUnit unit) /// String representation. public override string ToString() { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LevelUnit unit) - { - return ToString(unit, null, 2); + return ToString(null); } /// /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Unit representation to use. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(LevelUnit unit, [CanBeNull] string cultureName) + public string ToString([CanBeNull] string cultureName) { var provider = cultureName; - return ToString(unit, provider, 2); + return ToString(provider, 2); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(LevelUnit unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) + public string ToString(string cultureName, int significantDigitsAfterRadix) { var provider = cultureName; - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString(LevelUnit unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { - IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + var provider = GetFormatProviderFromCultureName(cultureName); if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); provider = provider ?? GlobalConfiguration.DefaultCulture; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); return string.Format(provider, format, formatArgs); } diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 58365f60fb..c12969f03e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -949,61 +949,48 @@ private decimal AsBaseNumericType(InformationUnit unit) /// String representation. public override string ToString() { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(InformationUnit unit) - { - return ToString(unit, null, 2); + return ToString(null); } /// /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Unit representation to use. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider) + public string ToString([CanBeNull] IFormatProvider provider) { - return ToString(unit, provider, 2); + return ToString(provider, 2); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(InformationUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) { if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); provider = provider ?? GlobalConfiguration.DefaultCulture; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); return string.Format(provider, format, formatArgs); } diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index c1deaa2b60..2b75619d57 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -885,61 +885,48 @@ private double AsBaseNumericType(LengthUnit unit) /// String representation. public override string ToString() { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LengthUnit unit) - { - return ToString(unit, null, 2); + return ToString(null); } /// /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Unit representation to use. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider) + public string ToString([CanBeNull] IFormatProvider provider) { - return ToString(unit, provider, 2); + return ToString(provider, 2); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(LengthUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) { if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); provider = provider ?? GlobalConfiguration.DefaultCulture; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); return string.Format(provider, format, formatArgs); } diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 8a8e7ddae3..bf30df8c73 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -573,61 +573,48 @@ private double AsBaseNumericType(LevelUnit unit) /// String representation. public override string ToString() { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(LevelUnit unit) - { - return ToString(unit, null, 2); + return ToString(null); } /// /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Unit representation to use. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider) + public string ToString([CanBeNull] IFormatProvider provider) { - return ToString(unit, provider, 2); + return ToString(provider, 2); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) { - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - public string ToString(LevelUnit unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) { if (format == null) throw new ArgumentNullException(nameof(format)); if (args == null) throw new ArgumentNullException(nameof(args)); provider = provider ?? GlobalConfiguration.DefaultCulture; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); return string.Format(provider, format, formatArgs); } diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 611d440ff9..2b499f4507 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -27,7 +27,7 @@ namespace UnitsNet /// /// Represents a quantity. /// - public interface IQuantity + public partial interface IQuantity { /// /// The of this quantity. @@ -48,47 +48,73 @@ BaseDimensions Dimensions #if !WINDOWS_UWP - public interface IQuantity : IQuantity where UnitType : Enum + public partial interface IQuantity { /// - /// Convert to the unit representation . + /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Value converted to the specified unit. - double As(UnitType unit); + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + string ToString([CanBeNull] IFormatProvider provider); /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. + /// Get string representation of value and unit. /// - /// Unit representation to use. + /// The number of significant digits after the radix point. /// String representation. - string ToString(UnitType unit); + /// Format to use for localization and number formatting. Defaults to if null. + string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix); /// - /// Get string representation of value and unit. Using two significant digits after radix. + /// Get string representation of value and unit. /// - /// Unit representation to use. + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. /// Format to use for localization and number formatting. Defaults to if null. - string ToString(UnitType unit, [CanBeNull] IFormatProvider provider); + string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args); + } + +#else + + public partial interface IQuantity + { + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + string ToString([CanBeNull] string cultureName); /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. - /// Format to use for localization and number formatting. Defaults to if null. - string ToString(UnitType unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix); + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + string ToString(string cultureName, int significantDigitsAfterRadix); /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. - /// Format to use for localization and number formatting. Defaults to if null. - string ToString(UnitType unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args); + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args); + } + +#endif + +#if !WINDOWS_UWP + + public interface IQuantity : IQuantity where UnitType : Enum + { + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + double As(UnitType unit); /// /// The unit this quantity was constructed with or the BaseUnit if the default constructor was used. diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 0f2b8a5d9b..a9a6aa0b73 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -178,76 +178,63 @@ if ($obsoleteAttribute) /// String representation. public override string ToString() { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString($unitEnumName unit) - { - return ToString(unit, null, 2); + return ToString(null); } /// /// Get string representation of value and unit. Using two significant digits after radix. /// - /// Unit representation to use. /// String representation. "@; # Windows Runtime Component does not support IFormatProvider type if ($wrc) {@" /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString($unitEnumName unit, [CanBeNull] string cultureName) + public string ToString([CanBeNull] string cultureName) { var provider = cultureName; "@; } else {@" /// Format to use for localization and number formatting. Defaults to if null. - public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider) + public string ToString([CanBeNull] IFormatProvider provider) { "@; }@" - return ToString(unit, provider, 2); + return ToString(provider, 2); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// The number of significant digits after the radix point. /// String representation. "@; # Windows Runtime Component does not support IFormatProvider type if ($wrc) {@" /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString($unitEnumName unit, [CanBeNull] string cultureName, int significantDigitsAfterRadix) + public string ToString(string cultureName, int significantDigitsAfterRadix) { var provider = cultureName; "@; } else {@" /// Format to use for localization and number formatting. Defaults to if null. - public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) { "@; }@" - double value = As(unit); - string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); - return ToString(unit, provider, format); + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); } /// /// Get string representation of value and unit. /// - /// Unit representation to use. /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. /// String representation. "@; # Windows Runtime Component does not support IFormatProvider type if ($wrc) {@" /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. - public string ToString($unitEnumName unit, [CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) { - IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + var provider = GetFormatProviderFromCultureName(cultureName); "@; } else {@" /// Format to use for localization and number formatting. Defaults to if null. - public string ToString($unitEnumName unit, [CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) { "@; }@" if (format == null) throw new ArgumentNullException(nameof(format)); @@ -255,8 +242,8 @@ if ($obsoleteAttribute) provider = provider ?? GlobalConfiguration.DefaultCulture; - double value = As(unit); - object[] formatArgs = UnitFormatter.GetFormatArgs(unit, value, provider, args); + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); return string.Format(provider, format, formatArgs); } From 875ca711a2729937fe43950c2b04437f3b5e173b Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 4 Nov 2018 10:22:19 +0100 Subject: [PATCH 090/131] UnitsNet: 4.0.0-alpha5 --- .../UnitsNet.WindowsRuntimeComponent.nuspec | 2 +- UnitsNet/UnitsNet.Common.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec index b69fc8e802..281442a9ef 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec @@ -2,7 +2,7 @@ UnitsNet.WindowsRuntimeComponent - 4.0.0-alpha4 + 4.0.0-alpha5 Units.NET - Windows Runtime Component Andreas Gullberg Larsen Andreas Gullberg Larsen diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index 671889db65..06e98cefc1 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -2,7 +2,7 @@ UnitsNet - 4.0.0-alpha4 + 4.0.0-alpha5 Andreas Gullberg Larsen Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. From 619b524fd13301073d338ca55d3192b4046a719e Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sun, 4 Nov 2018 21:31:54 +0100 Subject: [PATCH 091/131] Update test apps to work with v4 (#549) * Fix xunit build warnings on using Contains() * Adapt code to UnitsNet v4 New ToString() overloads, need to use ToUnit() to print for a given unit. * Upgrade UWP test apps to latest UWP nuget To support netstandard2.0 of UnitsNet * Update to UWP 16299 to support netstandard 2.0 WinJS does not require this change for some reason, it actually fails to build if trying to change it. * Update to UnitsNet 4.0.0-alpha5 To get latest API changes, such as new ToString() overloads. --- UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml.cs | 6 +++--- .../UnitsNet.TestApps.Uwp.Csharp.csproj | 2 +- UnitsNet.TestApps.Uwp.Csharp/project.json | 6 +++--- .../UnitsNet.TestApps.Uwp.WinJS.jsproj | 8 -------- UnitsNet.TestApps.Uwp.WinJS/js/main.js | 2 +- UnitsNet.TestApps.Uwp.WinJS/project.json | 5 +++-- UnitsNet.Tests/BaseDimensionsTests.cs | 6 +++--- 7 files changed, 14 insertions(+), 21 deletions(-) diff --git a/UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml.cs b/UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml.cs index 7905f7df5f..d2e8c25c54 100644 --- a/UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml.cs +++ b/UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml.cs @@ -19,9 +19,9 @@ public MainPage() InitializeComponent(); // Test some variations, From() constructors, Parse(), As() - string celsius = Temperature.FromDegreesCelsius(100).ToString(TemperatureUnit.DegreeCelsius); - string fahrenheit = Temperature.Parse("100 °C").ToString(TemperatureUnit.DegreeFahrenheit); - string kelvin = Temperature.FromDegreesCelsius(Temperature.Parse(fahrenheit).As(TemperatureUnit.DegreeCelsius)).ToString(TemperatureUnit.Kelvin); + string celsius = Temperature.FromDegreesCelsius(100).ToUnit(TemperatureUnit.DegreeCelsius).ToString(); + string fahrenheit = Temperature.Parse("100 °C").ToUnit(TemperatureUnit.DegreeFahrenheit).ToString(); + string kelvin = Temperature.FromDegreesCelsius(Temperature.Parse(fahrenheit).As(TemperatureUnit.DegreeCelsius)).ToUnit(TemperatureUnit.Kelvin).ToString(); // Arithmetic operators not allowed in WinRT Components, but SHOULD be allowed in UWP C# apps // new Temperature(5) + new Temperature(6) diff --git a/UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp.csproj b/UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp.csproj index d89fc5a964..3c7046dac5 100644 --- a/UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp.csproj +++ b/UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp.csproj @@ -12,7 +12,7 @@ en-US UAP 10.0.16299.0 - 10.0.10240.0 + 10.0.16299.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/UnitsNet.TestApps.Uwp.Csharp/project.json b/UnitsNet.TestApps.Uwp.Csharp/project.json index ad01ad434d..1757f498b4 100644 --- a/UnitsNet.TestApps.Uwp.Csharp/project.json +++ b/UnitsNet.TestApps.Uwp.Csharp/project.json @@ -1,10 +1,10 @@ { "dependencies": { - "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0", - "UnitsNet.WindowsRuntimeComponent": "3.40.0" + "Microsoft.NETCore.UniversalWindowsPlatform": "6.1.9", + "UnitsNet.WindowsRuntimeComponent": "4.0.0-alpha5" }, "frameworks": { - "uap10.0": {} + "uap10.0.16299": {} }, "runtimes": { "win10-arm": {}, diff --git a/UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS.jsproj b/UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS.jsproj index 866b991d93..1b67d22e82 100644 --- a/UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS.jsproj +++ b/UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS.jsproj @@ -76,14 +76,6 @@ - - - ..\packages\UnitsNet.WindowsRuntimeComponent.3.64.0\lib\uap10.0\UnitsNet.winmd - true - True - False - - + true + true + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/.gitignore b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/.gitignore deleted file mode 100644 index ccb86a88b8..0000000000 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.g.cs -!Information.WindowsRuntimeComponent.g.cs -!Length.WindowsRuntimeComponent.g.cs -!Level.WindowsRuntimeComponent.g.cs diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..eb339e199a --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -0,0 +1,774 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Acceleration : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AccelerationUnit? _unit; + + static Acceleration() + { + BaseDimensions = new BaseDimensions(1, 0, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit MeterPerSecondSquared. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Acceleration() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Acceleration(double numericValue, AccelerationUnit unit) + { + if(unit == AccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Acceleration, which is MeterPerSecondSquared. All conversions go via this value. + /// + public static AccelerationUnit BaseUnit => AccelerationUnit.MeterPerSecondSquared; + + /// + /// Represents the largest possible value of Acceleration + /// + public static Acceleration MaxValue => new Acceleration(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Acceleration + /// + public static Acceleration MinValue => new Acceleration(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Acceleration; + + /// + /// All units of measurement for the Acceleration quantity. + /// + public static AccelerationUnit[] Units { get; } = Enum.GetValues(typeof(AccelerationUnit)).Cast().Except(new AccelerationUnit[]{ AccelerationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecondSquared. + /// + public static Acceleration Zero => new Acceleration(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Acceleration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Acceleration.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Acceleration in CentimetersPerSecondSquared. + /// + public double CentimetersPerSecondSquared => As(AccelerationUnit.CentimeterPerSecondSquared); + + /// + /// Get Acceleration in DecimetersPerSecondSquared. + /// + public double DecimetersPerSecondSquared => As(AccelerationUnit.DecimeterPerSecondSquared); + + /// + /// Get Acceleration in FeetPerSecondSquared. + /// + public double FeetPerSecondSquared => As(AccelerationUnit.FootPerSecondSquared); + + /// + /// Get Acceleration in InchesPerSecondSquared. + /// + public double InchesPerSecondSquared => As(AccelerationUnit.InchPerSecondSquared); + + /// + /// Get Acceleration in KilometersPerSecondSquared. + /// + public double KilometersPerSecondSquared => As(AccelerationUnit.KilometerPerSecondSquared); + + /// + /// Get Acceleration in KnotsPerHour. + /// + public double KnotsPerHour => As(AccelerationUnit.KnotPerHour); + + /// + /// Get Acceleration in KnotsPerMinute. + /// + public double KnotsPerMinute => As(AccelerationUnit.KnotPerMinute); + + /// + /// Get Acceleration in KnotsPerSecond. + /// + public double KnotsPerSecond => As(AccelerationUnit.KnotPerSecond); + + /// + /// Get Acceleration in MetersPerSecondSquared. + /// + public double MetersPerSecondSquared => As(AccelerationUnit.MeterPerSecondSquared); + + /// + /// Get Acceleration in MicrometersPerSecondSquared. + /// + public double MicrometersPerSecondSquared => As(AccelerationUnit.MicrometerPerSecondSquared); + + /// + /// Get Acceleration in MillimetersPerSecondSquared. + /// + public double MillimetersPerSecondSquared => As(AccelerationUnit.MillimeterPerSecondSquared); + + /// + /// Get Acceleration in NanometersPerSecondSquared. + /// + public double NanometersPerSecondSquared => As(AccelerationUnit.NanometerPerSecondSquared); + + /// + /// Get Acceleration in StandardGravity. + /// + public double StandardGravity => As(AccelerationUnit.StandardGravity); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AccelerationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Acceleration from CentimetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromCentimetersPerSecondSquared(double centimeterspersecondsquared) + { + double value = (double) centimeterspersecondsquared; + return new Acceleration(value, AccelerationUnit.CentimeterPerSecondSquared); + } + /// + /// Get Acceleration from DecimetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromDecimetersPerSecondSquared(double decimeterspersecondsquared) + { + double value = (double) decimeterspersecondsquared; + return new Acceleration(value, AccelerationUnit.DecimeterPerSecondSquared); + } + /// + /// Get Acceleration from FeetPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromFeetPerSecondSquared(double feetpersecondsquared) + { + double value = (double) feetpersecondsquared; + return new Acceleration(value, AccelerationUnit.FootPerSecondSquared); + } + /// + /// Get Acceleration from InchesPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromInchesPerSecondSquared(double inchespersecondsquared) + { + double value = (double) inchespersecondsquared; + return new Acceleration(value, AccelerationUnit.InchPerSecondSquared); + } + /// + /// Get Acceleration from KilometersPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromKilometersPerSecondSquared(double kilometerspersecondsquared) + { + double value = (double) kilometerspersecondsquared; + return new Acceleration(value, AccelerationUnit.KilometerPerSecondSquared); + } + /// + /// Get Acceleration from KnotsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromKnotsPerHour(double knotsperhour) + { + double value = (double) knotsperhour; + return new Acceleration(value, AccelerationUnit.KnotPerHour); + } + /// + /// Get Acceleration from KnotsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromKnotsPerMinute(double knotsperminute) + { + double value = (double) knotsperminute; + return new Acceleration(value, AccelerationUnit.KnotPerMinute); + } + /// + /// Get Acceleration from KnotsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromKnotsPerSecond(double knotspersecond) + { + double value = (double) knotspersecond; + return new Acceleration(value, AccelerationUnit.KnotPerSecond); + } + /// + /// Get Acceleration from MetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromMetersPerSecondSquared(double meterspersecondsquared) + { + double value = (double) meterspersecondsquared; + return new Acceleration(value, AccelerationUnit.MeterPerSecondSquared); + } + /// + /// Get Acceleration from MicrometersPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromMicrometersPerSecondSquared(double micrometerspersecondsquared) + { + double value = (double) micrometerspersecondsquared; + return new Acceleration(value, AccelerationUnit.MicrometerPerSecondSquared); + } + /// + /// Get Acceleration from MillimetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromMillimetersPerSecondSquared(double millimeterspersecondsquared) + { + double value = (double) millimeterspersecondsquared; + return new Acceleration(value, AccelerationUnit.MillimeterPerSecondSquared); + } + /// + /// Get Acceleration from NanometersPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromNanometersPerSecondSquared(double nanometerspersecondsquared) + { + double value = (double) nanometerspersecondsquared; + return new Acceleration(value, AccelerationUnit.NanometerPerSecondSquared); + } + /// + /// Get Acceleration from StandardGravity. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Acceleration FromStandardGravity(double standardgravity) + { + double value = (double) standardgravity; + return new Acceleration(value, AccelerationUnit.StandardGravity); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Acceleration unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Acceleration From(double value, AccelerationUnit fromUnit) + { + return new Acceleration((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Acceleration Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Acceleration Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Acceleration result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Acceleration result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AccelerationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AccelerationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AccelerationUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Acceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); + + return CompareTo((Acceleration)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Acceleration other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Acceleration within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Acceleration. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AccelerationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Acceleration to another Acceleration with the unit representation . + /// + /// A Acceleration with the specified unit. + public Acceleration ToUnit(AccelerationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Acceleration(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AccelerationUnit.CentimeterPerSecondSquared: return (_value) * 1e-2d; + case AccelerationUnit.DecimeterPerSecondSquared: return (_value) * 1e-1d; + case AccelerationUnit.FootPerSecondSquared: return _value*0.304800; + case AccelerationUnit.InchPerSecondSquared: return _value*0.0254; + case AccelerationUnit.KilometerPerSecondSquared: return (_value) * 1e3d; + case AccelerationUnit.KnotPerHour: return _value*0.5144444444444/3600; + case AccelerationUnit.KnotPerMinute: return _value*0.5144444444444/60; + case AccelerationUnit.KnotPerSecond: return _value*0.5144444444444; + case AccelerationUnit.MeterPerSecondSquared: return _value; + case AccelerationUnit.MicrometerPerSecondSquared: return (_value) * 1e-6d; + case AccelerationUnit.MillimeterPerSecondSquared: return (_value) * 1e-3d; + case AccelerationUnit.NanometerPerSecondSquared: return (_value) * 1e-9d; + case AccelerationUnit.StandardGravity: return _value*9.80665; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AccelerationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AccelerationUnit.CentimeterPerSecondSquared: return (baseUnitValue) / 1e-2d; + case AccelerationUnit.DecimeterPerSecondSquared: return (baseUnitValue) / 1e-1d; + case AccelerationUnit.FootPerSecondSquared: return baseUnitValue/0.304800; + case AccelerationUnit.InchPerSecondSquared: return baseUnitValue/0.0254; + case AccelerationUnit.KilometerPerSecondSquared: return (baseUnitValue) / 1e3d; + case AccelerationUnit.KnotPerHour: return baseUnitValue/0.5144444444444*3600; + case AccelerationUnit.KnotPerMinute: return baseUnitValue/0.5144444444444*60; + case AccelerationUnit.KnotPerSecond: return baseUnitValue/0.5144444444444; + case AccelerationUnit.MeterPerSecondSquared: return baseUnitValue; + case AccelerationUnit.MicrometerPerSecondSquared: return (baseUnitValue) / 1e-6d; + case AccelerationUnit.MillimeterPerSecondSquared: return (baseUnitValue) / 1e-3d; + case AccelerationUnit.NanometerPerSecondSquared: return (baseUnitValue) / 1e-9d; + case AccelerationUnit.StandardGravity: return baseUnitValue/9.80665; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..ce290025ca --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,791 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class AmountOfSubstance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AmountOfSubstanceUnit? _unit; + + static AmountOfSubstance() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 1, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Mole. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public AmountOfSubstance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit) + { + if(unit == AmountOfSubstanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AmountOfSubstance, which is Mole. All conversions go via this value. + /// + public static AmountOfSubstanceUnit BaseUnit => AmountOfSubstanceUnit.Mole; + + /// + /// Represents the largest possible value of AmountOfSubstance + /// + public static AmountOfSubstance MaxValue => new AmountOfSubstance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AmountOfSubstance + /// + public static AmountOfSubstance MinValue => new AmountOfSubstance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AmountOfSubstance; + + /// + /// All units of measurement for the AmountOfSubstance quantity. + /// + public static AmountOfSubstanceUnit[] Units { get; } = Enum.GetValues(typeof(AmountOfSubstanceUnit)).Cast().Except(new AmountOfSubstanceUnit[]{ AmountOfSubstanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Mole. + /// + public static AmountOfSubstance Zero => new AmountOfSubstance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AmountOfSubstanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AmountOfSubstance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AmountOfSubstance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AmountOfSubstance in Centimoles. + /// + public double Centimoles => As(AmountOfSubstanceUnit.Centimole); + + /// + /// Get AmountOfSubstance in CentipoundMoles. + /// + public double CentipoundMoles => As(AmountOfSubstanceUnit.CentipoundMole); + + /// + /// Get AmountOfSubstance in Decimoles. + /// + public double Decimoles => As(AmountOfSubstanceUnit.Decimole); + + /// + /// Get AmountOfSubstance in DecipoundMoles. + /// + public double DecipoundMoles => As(AmountOfSubstanceUnit.DecipoundMole); + + /// + /// Get AmountOfSubstance in Kilomoles. + /// + public double Kilomoles => As(AmountOfSubstanceUnit.Kilomole); + + /// + /// Get AmountOfSubstance in KilopoundMoles. + /// + public double KilopoundMoles => As(AmountOfSubstanceUnit.KilopoundMole); + + /// + /// Get AmountOfSubstance in Micromoles. + /// + public double Micromoles => As(AmountOfSubstanceUnit.Micromole); + + /// + /// Get AmountOfSubstance in MicropoundMoles. + /// + public double MicropoundMoles => As(AmountOfSubstanceUnit.MicropoundMole); + + /// + /// Get AmountOfSubstance in Millimoles. + /// + public double Millimoles => As(AmountOfSubstanceUnit.Millimole); + + /// + /// Get AmountOfSubstance in MillipoundMoles. + /// + public double MillipoundMoles => As(AmountOfSubstanceUnit.MillipoundMole); + + /// + /// Get AmountOfSubstance in Moles. + /// + public double Moles => As(AmountOfSubstanceUnit.Mole); + + /// + /// Get AmountOfSubstance in Nanomoles. + /// + public double Nanomoles => As(AmountOfSubstanceUnit.Nanomole); + + /// + /// Get AmountOfSubstance in NanopoundMoles. + /// + public double NanopoundMoles => As(AmountOfSubstanceUnit.NanopoundMole); + + /// + /// Get AmountOfSubstance in PoundMoles. + /// + public double PoundMoles => As(AmountOfSubstanceUnit.PoundMole); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AmountOfSubstanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AmountOfSubstance from Centimoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromCentimoles(double centimoles) + { + double value = (double) centimoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Centimole); + } + /// + /// Get AmountOfSubstance from CentipoundMoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromCentipoundMoles(double centipoundmoles) + { + double value = (double) centipoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.CentipoundMole); + } + /// + /// Get AmountOfSubstance from Decimoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromDecimoles(double decimoles) + { + double value = (double) decimoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Decimole); + } + /// + /// Get AmountOfSubstance from DecipoundMoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromDecipoundMoles(double decipoundmoles) + { + double value = (double) decipoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.DecipoundMole); + } + /// + /// Get AmountOfSubstance from Kilomoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromKilomoles(double kilomoles) + { + double value = (double) kilomoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Kilomole); + } + /// + /// Get AmountOfSubstance from KilopoundMoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromKilopoundMoles(double kilopoundmoles) + { + double value = (double) kilopoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.KilopoundMole); + } + /// + /// Get AmountOfSubstance from Micromoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromMicromoles(double micromoles) + { + double value = (double) micromoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Micromole); + } + /// + /// Get AmountOfSubstance from MicropoundMoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromMicropoundMoles(double micropoundmoles) + { + double value = (double) micropoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.MicropoundMole); + } + /// + /// Get AmountOfSubstance from Millimoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromMillimoles(double millimoles) + { + double value = (double) millimoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Millimole); + } + /// + /// Get AmountOfSubstance from MillipoundMoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromMillipoundMoles(double millipoundmoles) + { + double value = (double) millipoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.MillipoundMole); + } + /// + /// Get AmountOfSubstance from Moles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromMoles(double moles) + { + double value = (double) moles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Mole); + } + /// + /// Get AmountOfSubstance from Nanomoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromNanomoles(double nanomoles) + { + double value = (double) nanomoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Nanomole); + } + /// + /// Get AmountOfSubstance from NanopoundMoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromNanopoundMoles(double nanopoundmoles) + { + double value = (double) nanopoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.NanopoundMole); + } + /// + /// Get AmountOfSubstance from PoundMoles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmountOfSubstance FromPoundMoles(double poundmoles) + { + double value = (double) poundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.PoundMole); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AmountOfSubstance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static AmountOfSubstance From(double value, AmountOfSubstanceUnit fromUnit) + { + return new AmountOfSubstance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AmountOfSubstance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AmountOfSubstance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmountOfSubstance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AmountOfSubstanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AmountOfSubstanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AmountOfSubstanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmountOfSubstanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); + + return CompareTo((AmountOfSubstance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(AmountOfSubstance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AmountOfSubstance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AmountOfSubstanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AmountOfSubstance to another AmountOfSubstance with the unit representation . + /// + /// A AmountOfSubstance with the specified unit. + public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AmountOfSubstance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AmountOfSubstanceUnit.Centimole: return (_value) * 1e-2d; + case AmountOfSubstanceUnit.CentipoundMole: return (_value*453.59237) * 1e-2d; + case AmountOfSubstanceUnit.Decimole: return (_value) * 1e-1d; + case AmountOfSubstanceUnit.DecipoundMole: return (_value*453.59237) * 1e-1d; + case AmountOfSubstanceUnit.Kilomole: return (_value) * 1e3d; + case AmountOfSubstanceUnit.KilopoundMole: return (_value*453.59237) * 1e3d; + case AmountOfSubstanceUnit.Micromole: return (_value) * 1e-6d; + case AmountOfSubstanceUnit.MicropoundMole: return (_value*453.59237) * 1e-6d; + case AmountOfSubstanceUnit.Millimole: return (_value) * 1e-3d; + case AmountOfSubstanceUnit.MillipoundMole: return (_value*453.59237) * 1e-3d; + case AmountOfSubstanceUnit.Mole: return _value; + case AmountOfSubstanceUnit.Nanomole: return (_value) * 1e-9d; + case AmountOfSubstanceUnit.NanopoundMole: return (_value*453.59237) * 1e-9d; + case AmountOfSubstanceUnit.PoundMole: return _value*453.59237; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AmountOfSubstanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AmountOfSubstanceUnit.Centimole: return (baseUnitValue) / 1e-2d; + case AmountOfSubstanceUnit.CentipoundMole: return (baseUnitValue/453.59237) / 1e-2d; + case AmountOfSubstanceUnit.Decimole: return (baseUnitValue) / 1e-1d; + case AmountOfSubstanceUnit.DecipoundMole: return (baseUnitValue/453.59237) / 1e-1d; + case AmountOfSubstanceUnit.Kilomole: return (baseUnitValue) / 1e3d; + case AmountOfSubstanceUnit.KilopoundMole: return (baseUnitValue/453.59237) / 1e3d; + case AmountOfSubstanceUnit.Micromole: return (baseUnitValue) / 1e-6d; + case AmountOfSubstanceUnit.MicropoundMole: return (baseUnitValue/453.59237) / 1e-6d; + case AmountOfSubstanceUnit.Millimole: return (baseUnitValue) / 1e-3d; + case AmountOfSubstanceUnit.MillipoundMole: return (baseUnitValue/453.59237) / 1e-3d; + case AmountOfSubstanceUnit.Mole: return baseUnitValue; + case AmountOfSubstanceUnit.Nanomole: return (baseUnitValue) / 1e-9d; + case AmountOfSubstanceUnit.NanopoundMole: return (baseUnitValue/453.59237) / 1e-9d; + case AmountOfSubstanceUnit.PoundMole: return baseUnitValue/453.59237; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..ce45c7407c --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -0,0 +1,621 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class AmplitudeRatio : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AmplitudeRatioUnit? _unit; + + static AmplitudeRatio() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit DecibelVolt. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public AmplitudeRatio() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit) + { + if(unit == AmplitudeRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AmplitudeRatio, which is DecibelVolt. All conversions go via this value. + /// + public static AmplitudeRatioUnit BaseUnit => AmplitudeRatioUnit.DecibelVolt; + + /// + /// Represents the largest possible value of AmplitudeRatio + /// + public static AmplitudeRatio MaxValue => new AmplitudeRatio(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AmplitudeRatio + /// + public static AmplitudeRatio MinValue => new AmplitudeRatio(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AmplitudeRatio; + + /// + /// All units of measurement for the AmplitudeRatio quantity. + /// + public static AmplitudeRatioUnit[] Units { get; } = Enum.GetValues(typeof(AmplitudeRatioUnit)).Cast().Except(new AmplitudeRatioUnit[]{ AmplitudeRatioUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DecibelVolt. + /// + public static AmplitudeRatio Zero => new AmplitudeRatio(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AmplitudeRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AmplitudeRatio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AmplitudeRatio.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AmplitudeRatio in DecibelMicrovolts. + /// + public double DecibelMicrovolts => As(AmplitudeRatioUnit.DecibelMicrovolt); + + /// + /// Get AmplitudeRatio in DecibelMillivolts. + /// + public double DecibelMillivolts => As(AmplitudeRatioUnit.DecibelMillivolt); + + /// + /// Get AmplitudeRatio in DecibelsUnloaded. + /// + public double DecibelsUnloaded => As(AmplitudeRatioUnit.DecibelUnloaded); + + /// + /// Get AmplitudeRatio in DecibelVolts. + /// + public double DecibelVolts => As(AmplitudeRatioUnit.DecibelVolt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AmplitudeRatioUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AmplitudeRatio from DecibelMicrovolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmplitudeRatio FromDecibelMicrovolts(double decibelmicrovolts) + { + double value = (double) decibelmicrovolts; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMicrovolt); + } + /// + /// Get AmplitudeRatio from DecibelMillivolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmplitudeRatio FromDecibelMillivolts(double decibelmillivolts) + { + double value = (double) decibelmillivolts; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMillivolt); + } + /// + /// Get AmplitudeRatio from DecibelsUnloaded. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmplitudeRatio FromDecibelsUnloaded(double decibelsunloaded) + { + double value = (double) decibelsunloaded; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelUnloaded); + } + /// + /// Get AmplitudeRatio from DecibelVolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AmplitudeRatio FromDecibelVolts(double decibelvolts) + { + double value = (double) decibelvolts; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelVolt); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AmplitudeRatio unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static AmplitudeRatio From(double value, AmplitudeRatioUnit fromUnit) + { + return new AmplitudeRatio((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AmplitudeRatio Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AmplitudeRatio Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AmplitudeRatio result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AmplitudeRatioUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AmplitudeRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AmplitudeRatioUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AmplitudeRatioUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); + + return CompareTo((AmplitudeRatio)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(AmplitudeRatio other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AmplitudeRatio. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AmplitudeRatioUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AmplitudeRatio to another AmplitudeRatio with the unit representation . + /// + /// A AmplitudeRatio with the specified unit. + public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AmplitudeRatio(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AmplitudeRatioUnit.DecibelMicrovolt: return _value - 120; + case AmplitudeRatioUnit.DecibelMillivolt: return _value - 60; + case AmplitudeRatioUnit.DecibelUnloaded: return _value - 2.218487499; + case AmplitudeRatioUnit.DecibelVolt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AmplitudeRatioUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AmplitudeRatioUnit.DecibelMicrovolt: return baseUnitValue + 120; + case AmplitudeRatioUnit.DecibelMillivolt: return baseUnitValue + 60; + case AmplitudeRatioUnit.DecibelUnloaded: return baseUnitValue + 2.218487499; + case AmplitudeRatioUnit.DecibelVolt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..d721fd78bb --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -0,0 +1,791 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Angle : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AngleUnit? _unit; + + static Angle() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit Degree. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Angle() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Angle(double numericValue, AngleUnit unit) + { + if(unit == AngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Angle, which is Degree. All conversions go via this value. + /// + public static AngleUnit BaseUnit => AngleUnit.Degree; + + /// + /// Represents the largest possible value of Angle + /// + public static Angle MaxValue => new Angle(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Angle + /// + public static Angle MinValue => new Angle(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Angle; + + /// + /// All units of measurement for the Angle quantity. + /// + public static AngleUnit[] Units { get; } = Enum.GetValues(typeof(AngleUnit)).Cast().Except(new AngleUnit[]{ AngleUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Degree. + /// + public static Angle Zero => new Angle(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Angle.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Angle.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Angle in Arcminutes. + /// + public double Arcminutes => As(AngleUnit.Arcminute); + + /// + /// Get Angle in Arcseconds. + /// + public double Arcseconds => As(AngleUnit.Arcsecond); + + /// + /// Get Angle in Centiradians. + /// + public double Centiradians => As(AngleUnit.Centiradian); + + /// + /// Get Angle in Deciradians. + /// + public double Deciradians => As(AngleUnit.Deciradian); + + /// + /// Get Angle in Degrees. + /// + public double Degrees => As(AngleUnit.Degree); + + /// + /// Get Angle in Gradians. + /// + public double Gradians => As(AngleUnit.Gradian); + + /// + /// Get Angle in Microdegrees. + /// + public double Microdegrees => As(AngleUnit.Microdegree); + + /// + /// Get Angle in Microradians. + /// + public double Microradians => As(AngleUnit.Microradian); + + /// + /// Get Angle in Millidegrees. + /// + public double Millidegrees => As(AngleUnit.Millidegree); + + /// + /// Get Angle in Milliradians. + /// + public double Milliradians => As(AngleUnit.Milliradian); + + /// + /// Get Angle in Nanodegrees. + /// + public double Nanodegrees => As(AngleUnit.Nanodegree); + + /// + /// Get Angle in Nanoradians. + /// + public double Nanoradians => As(AngleUnit.Nanoradian); + + /// + /// Get Angle in Radians. + /// + public double Radians => As(AngleUnit.Radian); + + /// + /// Get Angle in Revolutions. + /// + public double Revolutions => As(AngleUnit.Revolution); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AngleUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(AngleUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Angle from Arcminutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromArcminutes(double arcminutes) + { + double value = (double) arcminutes; + return new Angle(value, AngleUnit.Arcminute); + } + /// + /// Get Angle from Arcseconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromArcseconds(double arcseconds) + { + double value = (double) arcseconds; + return new Angle(value, AngleUnit.Arcsecond); + } + /// + /// Get Angle from Centiradians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromCentiradians(double centiradians) + { + double value = (double) centiradians; + return new Angle(value, AngleUnit.Centiradian); + } + /// + /// Get Angle from Deciradians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromDeciradians(double deciradians) + { + double value = (double) deciradians; + return new Angle(value, AngleUnit.Deciradian); + } + /// + /// Get Angle from Degrees. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromDegrees(double degrees) + { + double value = (double) degrees; + return new Angle(value, AngleUnit.Degree); + } + /// + /// Get Angle from Gradians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromGradians(double gradians) + { + double value = (double) gradians; + return new Angle(value, AngleUnit.Gradian); + } + /// + /// Get Angle from Microdegrees. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromMicrodegrees(double microdegrees) + { + double value = (double) microdegrees; + return new Angle(value, AngleUnit.Microdegree); + } + /// + /// Get Angle from Microradians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromMicroradians(double microradians) + { + double value = (double) microradians; + return new Angle(value, AngleUnit.Microradian); + } + /// + /// Get Angle from Millidegrees. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromMillidegrees(double millidegrees) + { + double value = (double) millidegrees; + return new Angle(value, AngleUnit.Millidegree); + } + /// + /// Get Angle from Milliradians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromMilliradians(double milliradians) + { + double value = (double) milliradians; + return new Angle(value, AngleUnit.Milliradian); + } + /// + /// Get Angle from Nanodegrees. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromNanodegrees(double nanodegrees) + { + double value = (double) nanodegrees; + return new Angle(value, AngleUnit.Nanodegree); + } + /// + /// Get Angle from Nanoradians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromNanoradians(double nanoradians) + { + double value = (double) nanoradians; + return new Angle(value, AngleUnit.Nanoradian); + } + /// + /// Get Angle from Radians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromRadians(double radians) + { + double value = (double) radians; + return new Angle(value, AngleUnit.Radian); + } + /// + /// Get Angle from Revolutions. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Angle FromRevolutions(double revolutions) + { + double value = (double) revolutions; + return new Angle(value, AngleUnit.Revolution); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Angle unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Angle From(double value, AngleUnit fromUnit) + { + return new Angle((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Angle Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Angle Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Angle result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Angle result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AngleUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AngleUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AngleUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Angle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); + + return CompareTo((Angle)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Angle other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Angle within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Angle. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AngleUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Angle to another Angle with the unit representation . + /// + /// A Angle with the specified unit. + public Angle ToUnit(AngleUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Angle(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AngleUnit.Arcminute: return _value/60; + case AngleUnit.Arcsecond: return _value/3600; + case AngleUnit.Centiradian: return (_value*180/Math.PI) * 1e-2d; + case AngleUnit.Deciradian: return (_value*180/Math.PI) * 1e-1d; + case AngleUnit.Degree: return _value; + case AngleUnit.Gradian: return _value*0.9; + case AngleUnit.Microdegree: return (_value) * 1e-6d; + case AngleUnit.Microradian: return (_value*180/Math.PI) * 1e-6d; + case AngleUnit.Millidegree: return (_value) * 1e-3d; + case AngleUnit.Milliradian: return (_value*180/Math.PI) * 1e-3d; + case AngleUnit.Nanodegree: return (_value) * 1e-9d; + case AngleUnit.Nanoradian: return (_value*180/Math.PI) * 1e-9d; + case AngleUnit.Radian: return _value*180/Math.PI; + case AngleUnit.Revolution: return _value*360; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AngleUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AngleUnit.Arcminute: return baseUnitValue*60; + case AngleUnit.Arcsecond: return baseUnitValue*3600; + case AngleUnit.Centiradian: return (baseUnitValue/180*Math.PI) / 1e-2d; + case AngleUnit.Deciradian: return (baseUnitValue/180*Math.PI) / 1e-1d; + case AngleUnit.Degree: return baseUnitValue; + case AngleUnit.Gradian: return baseUnitValue/0.9; + case AngleUnit.Microdegree: return (baseUnitValue) / 1e-6d; + case AngleUnit.Microradian: return (baseUnitValue/180*Math.PI) / 1e-6d; + case AngleUnit.Millidegree: return (baseUnitValue) / 1e-3d; + case AngleUnit.Milliradian: return (baseUnitValue/180*Math.PI) / 1e-3d; + case AngleUnit.Nanodegree: return (baseUnitValue) / 1e-9d; + case AngleUnit.Nanoradian: return (baseUnitValue/180*Math.PI) / 1e-9d; + case AngleUnit.Radian: return baseUnitValue/180*Math.PI; + case AngleUnit.Revolution: return baseUnitValue/360; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..6af6c3626d --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ApparentEnergy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ApparentEnergyUnit? _unit; + + static ApparentEnergy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit VoltampereHour. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ApparentEnergy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ApparentEnergy(double numericValue, ApparentEnergyUnit unit) + { + if(unit == ApparentEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ApparentEnergy, which is VoltampereHour. All conversions go via this value. + /// + public static ApparentEnergyUnit BaseUnit => ApparentEnergyUnit.VoltampereHour; + + /// + /// Represents the largest possible value of ApparentEnergy + /// + public static ApparentEnergy MaxValue => new ApparentEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ApparentEnergy + /// + public static ApparentEnergy MinValue => new ApparentEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ApparentEnergy; + + /// + /// All units of measurement for the ApparentEnergy quantity. + /// + public static ApparentEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ApparentEnergyUnit)).Cast().Except(new ApparentEnergyUnit[]{ ApparentEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereHour. + /// + public static ApparentEnergy Zero => new ApparentEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ApparentEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ApparentEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ApparentEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ApparentEnergy in KilovoltampereHours. + /// + public double KilovoltampereHours => As(ApparentEnergyUnit.KilovoltampereHour); + + /// + /// Get ApparentEnergy in MegavoltampereHours. + /// + public double MegavoltampereHours => As(ApparentEnergyUnit.MegavoltampereHour); + + /// + /// Get ApparentEnergy in VoltampereHours. + /// + public double VoltampereHours => As(ApparentEnergyUnit.VoltampereHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ApparentEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ApparentEnergy from KilovoltampereHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ApparentEnergy FromKilovoltampereHours(double kilovoltamperehours) + { + double value = (double) kilovoltamperehours; + return new ApparentEnergy(value, ApparentEnergyUnit.KilovoltampereHour); + } + /// + /// Get ApparentEnergy from MegavoltampereHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ApparentEnergy FromMegavoltampereHours(double megavoltamperehours) + { + double value = (double) megavoltamperehours; + return new ApparentEnergy(value, ApparentEnergyUnit.MegavoltampereHour); + } + /// + /// Get ApparentEnergy from VoltampereHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ApparentEnergy FromVoltampereHours(double voltamperehours) + { + double value = (double) voltamperehours; + return new ApparentEnergy(value, ApparentEnergyUnit.VoltampereHour); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ApparentEnergy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ApparentEnergy From(double value, ApparentEnergyUnit fromUnit) + { + return new ApparentEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ApparentEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ApparentEnergy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentEnergy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ApparentEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ApparentEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ApparentEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentEnergyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); + + return CompareTo((ApparentEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ApparentEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ApparentEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ApparentEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ApparentEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ApparentEnergy to another ApparentEnergy with the unit representation . + /// + /// A ApparentEnergy with the specified unit. + public ApparentEnergy ToUnit(ApparentEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ApparentEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ApparentEnergyUnit.KilovoltampereHour: return (_value) * 1e3d; + case ApparentEnergyUnit.MegavoltampereHour: return (_value) * 1e6d; + case ApparentEnergyUnit.VoltampereHour: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ApparentEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ApparentEnergyUnit.KilovoltampereHour: return (baseUnitValue) / 1e3d; + case ApparentEnergyUnit.MegavoltampereHour: return (baseUnitValue) / 1e6d; + case ApparentEnergyUnit.VoltampereHour: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..3f17f61de0 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -0,0 +1,621 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ApparentPower : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ApparentPowerUnit? _unit; + + static ApparentPower() + { + BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Voltampere. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ApparentPower() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ApparentPower(double numericValue, ApparentPowerUnit unit) + { + if(unit == ApparentPowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ApparentPower, which is Voltampere. All conversions go via this value. + /// + public static ApparentPowerUnit BaseUnit => ApparentPowerUnit.Voltampere; + + /// + /// Represents the largest possible value of ApparentPower + /// + public static ApparentPower MaxValue => new ApparentPower(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ApparentPower + /// + public static ApparentPower MinValue => new ApparentPower(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ApparentPower; + + /// + /// All units of measurement for the ApparentPower quantity. + /// + public static ApparentPowerUnit[] Units { get; } = Enum.GetValues(typeof(ApparentPowerUnit)).Cast().Except(new ApparentPowerUnit[]{ ApparentPowerUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Voltampere. + /// + public static ApparentPower Zero => new ApparentPower(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ApparentPowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ApparentPower.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ApparentPower.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ApparentPower in Gigavoltamperes. + /// + public double Gigavoltamperes => As(ApparentPowerUnit.Gigavoltampere); + + /// + /// Get ApparentPower in Kilovoltamperes. + /// + public double Kilovoltamperes => As(ApparentPowerUnit.Kilovoltampere); + + /// + /// Get ApparentPower in Megavoltamperes. + /// + public double Megavoltamperes => As(ApparentPowerUnit.Megavoltampere); + + /// + /// Get ApparentPower in Voltamperes. + /// + public double Voltamperes => As(ApparentPowerUnit.Voltampere); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ApparentPowerUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ApparentPower from Gigavoltamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ApparentPower FromGigavoltamperes(double gigavoltamperes) + { + double value = (double) gigavoltamperes; + return new ApparentPower(value, ApparentPowerUnit.Gigavoltampere); + } + /// + /// Get ApparentPower from Kilovoltamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ApparentPower FromKilovoltamperes(double kilovoltamperes) + { + double value = (double) kilovoltamperes; + return new ApparentPower(value, ApparentPowerUnit.Kilovoltampere); + } + /// + /// Get ApparentPower from Megavoltamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ApparentPower FromMegavoltamperes(double megavoltamperes) + { + double value = (double) megavoltamperes; + return new ApparentPower(value, ApparentPowerUnit.Megavoltampere); + } + /// + /// Get ApparentPower from Voltamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ApparentPower FromVoltamperes(double voltamperes) + { + double value = (double) voltamperes; + return new ApparentPower(value, ApparentPowerUnit.Voltampere); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ApparentPower unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ApparentPower From(double value, ApparentPowerUnit fromUnit) + { + return new ApparentPower((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ApparentPower Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ApparentPower Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ApparentPower result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ApparentPower result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ApparentPowerUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ApparentPowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ApparentPowerUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ApparentPowerUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); + + return CompareTo((ApparentPower)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ApparentPower other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ApparentPower within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ApparentPower. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ApparentPowerUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ApparentPower to another ApparentPower with the unit representation . + /// + /// A ApparentPower with the specified unit. + public ApparentPower ToUnit(ApparentPowerUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ApparentPower(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ApparentPowerUnit.Gigavoltampere: return (_value) * 1e9d; + case ApparentPowerUnit.Kilovoltampere: return (_value) * 1e3d; + case ApparentPowerUnit.Megavoltampere: return (_value) * 1e6d; + case ApparentPowerUnit.Voltampere: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ApparentPowerUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ApparentPowerUnit.Gigavoltampere: return (baseUnitValue) / 1e9d; + case ApparentPowerUnit.Kilovoltampere: return (baseUnitValue) / 1e3d; + case ApparentPowerUnit.Megavoltampere: return (baseUnitValue) / 1e6d; + case ApparentPowerUnit.Voltampere: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..7ea98e2ea6 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -0,0 +1,774 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Area : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AreaUnit? _unit; + + static Area() + { + BaseDimensions = new BaseDimensions(2, 0, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit SquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Area() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Area(double numericValue, AreaUnit unit) + { + if(unit == AreaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Area, which is SquareMeter. All conversions go via this value. + /// + public static AreaUnit BaseUnit => AreaUnit.SquareMeter; + + /// + /// Represents the largest possible value of Area + /// + public static Area MaxValue => new Area(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Area + /// + public static Area MinValue => new Area(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Area; + + /// + /// All units of measurement for the Area quantity. + /// + public static AreaUnit[] Units { get; } = Enum.GetValues(typeof(AreaUnit)).Cast().Except(new AreaUnit[]{ AreaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeter. + /// + public static Area Zero => new Area(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AreaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Area.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Area.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Area in Acres. + /// + public double Acres => As(AreaUnit.Acre); + + /// + /// Get Area in Hectares. + /// + public double Hectares => As(AreaUnit.Hectare); + + /// + /// Get Area in SquareCentimeters. + /// + public double SquareCentimeters => As(AreaUnit.SquareCentimeter); + + /// + /// Get Area in SquareDecimeters. + /// + public double SquareDecimeters => As(AreaUnit.SquareDecimeter); + + /// + /// Get Area in SquareFeet. + /// + public double SquareFeet => As(AreaUnit.SquareFoot); + + /// + /// Get Area in SquareInches. + /// + public double SquareInches => As(AreaUnit.SquareInch); + + /// + /// Get Area in SquareKilometers. + /// + public double SquareKilometers => As(AreaUnit.SquareKilometer); + + /// + /// Get Area in SquareMeters. + /// + public double SquareMeters => As(AreaUnit.SquareMeter); + + /// + /// Get Area in SquareMicrometers. + /// + public double SquareMicrometers => As(AreaUnit.SquareMicrometer); + + /// + /// Get Area in SquareMiles. + /// + public double SquareMiles => As(AreaUnit.SquareMile); + + /// + /// Get Area in SquareMillimeters. + /// + public double SquareMillimeters => As(AreaUnit.SquareMillimeter); + + /// + /// Get Area in SquareYards. + /// + public double SquareYards => As(AreaUnit.SquareYard); + + /// + /// Get Area in UsSurveySquareFeet. + /// + public double UsSurveySquareFeet => As(AreaUnit.UsSurveySquareFoot); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AreaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(AreaUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Area from Acres. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromAcres(double acres) + { + double value = (double) acres; + return new Area(value, AreaUnit.Acre); + } + /// + /// Get Area from Hectares. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromHectares(double hectares) + { + double value = (double) hectares; + return new Area(value, AreaUnit.Hectare); + } + /// + /// Get Area from SquareCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareCentimeters(double squarecentimeters) + { + double value = (double) squarecentimeters; + return new Area(value, AreaUnit.SquareCentimeter); + } + /// + /// Get Area from SquareDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareDecimeters(double squaredecimeters) + { + double value = (double) squaredecimeters; + return new Area(value, AreaUnit.SquareDecimeter); + } + /// + /// Get Area from SquareFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareFeet(double squarefeet) + { + double value = (double) squarefeet; + return new Area(value, AreaUnit.SquareFoot); + } + /// + /// Get Area from SquareInches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareInches(double squareinches) + { + double value = (double) squareinches; + return new Area(value, AreaUnit.SquareInch); + } + /// + /// Get Area from SquareKilometers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareKilometers(double squarekilometers) + { + double value = (double) squarekilometers; + return new Area(value, AreaUnit.SquareKilometer); + } + /// + /// Get Area from SquareMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareMeters(double squaremeters) + { + double value = (double) squaremeters; + return new Area(value, AreaUnit.SquareMeter); + } + /// + /// Get Area from SquareMicrometers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareMicrometers(double squaremicrometers) + { + double value = (double) squaremicrometers; + return new Area(value, AreaUnit.SquareMicrometer); + } + /// + /// Get Area from SquareMiles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareMiles(double squaremiles) + { + double value = (double) squaremiles; + return new Area(value, AreaUnit.SquareMile); + } + /// + /// Get Area from SquareMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareMillimeters(double squaremillimeters) + { + double value = (double) squaremillimeters; + return new Area(value, AreaUnit.SquareMillimeter); + } + /// + /// Get Area from SquareYards. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromSquareYards(double squareyards) + { + double value = (double) squareyards; + return new Area(value, AreaUnit.SquareYard); + } + /// + /// Get Area from UsSurveySquareFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Area FromUsSurveySquareFeet(double ussurveysquarefeet) + { + double value = (double) ussurveysquarefeet; + return new Area(value, AreaUnit.UsSurveySquareFoot); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Area unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Area From(double value, AreaUnit fromUnit) + { + return new Area((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Area Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Area Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Area result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Area result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AreaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AreaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Area)) throw new ArgumentException("Expected type Area.", nameof(obj)); + + return CompareTo((Area)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Area other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Area within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Area other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Area. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AreaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Area to another Area with the unit representation . + /// + /// A Area with the specified unit. + public Area ToUnit(AreaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Area(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AreaUnit.Acre: return _value*4046.85642; + case AreaUnit.Hectare: return _value*1e4; + case AreaUnit.SquareCentimeter: return _value*1e-4; + case AreaUnit.SquareDecimeter: return _value*1e-2; + case AreaUnit.SquareFoot: return _value*0.092903; + case AreaUnit.SquareInch: return _value*0.00064516; + case AreaUnit.SquareKilometer: return _value*1e6; + case AreaUnit.SquareMeter: return _value; + case AreaUnit.SquareMicrometer: return _value*1e-12; + case AreaUnit.SquareMile: return _value*2.59e6; + case AreaUnit.SquareMillimeter: return _value*1e-6; + case AreaUnit.SquareYard: return _value*0.836127; + case AreaUnit.UsSurveySquareFoot: return _value*0.09290341161; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AreaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AreaUnit.Acre: return baseUnitValue/4046.85642; + case AreaUnit.Hectare: return baseUnitValue/1e4; + case AreaUnit.SquareCentimeter: return baseUnitValue/1e-4; + case AreaUnit.SquareDecimeter: return baseUnitValue/1e-2; + case AreaUnit.SquareFoot: return baseUnitValue/0.092903; + case AreaUnit.SquareInch: return baseUnitValue/0.00064516; + case AreaUnit.SquareKilometer: return baseUnitValue/1e6; + case AreaUnit.SquareMeter: return baseUnitValue; + case AreaUnit.SquareMicrometer: return baseUnitValue/1e-12; + case AreaUnit.SquareMile: return baseUnitValue/2.59e6; + case AreaUnit.SquareMillimeter: return baseUnitValue/1e-6; + case AreaUnit.SquareYard: return baseUnitValue/0.836127; + case AreaUnit.UsSurveySquareFoot: return baseUnitValue/0.09290341161; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..f13fa07cad --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,570 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The area density of a two-dimensional object is calculated as the mass per unit area. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class AreaDensity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AreaDensityUnit? _unit; + + static AreaDensity() + { + BaseDimensions = new BaseDimensions(-2, 1, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit KilogramPerSquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public AreaDensity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private AreaDensity(double numericValue, AreaDensityUnit unit) + { + if(unit == AreaDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AreaDensity, which is KilogramPerSquareMeter. All conversions go via this value. + /// + public static AreaDensityUnit BaseUnit => AreaDensityUnit.KilogramPerSquareMeter; + + /// + /// Represents the largest possible value of AreaDensity + /// + public static AreaDensity MaxValue => new AreaDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AreaDensity + /// + public static AreaDensity MinValue => new AreaDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AreaDensity; + + /// + /// All units of measurement for the AreaDensity quantity. + /// + public static AreaDensityUnit[] Units { get; } = Enum.GetValues(typeof(AreaDensityUnit)).Cast().Except(new AreaDensityUnit[]{ AreaDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSquareMeter. + /// + public static AreaDensity Zero => new AreaDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AreaDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AreaDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AreaDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AreaDensity in KilogramsPerSquareMeter. + /// + public double KilogramsPerSquareMeter => As(AreaDensityUnit.KilogramPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AreaDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AreaDensity from KilogramsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AreaDensity FromKilogramsPerSquareMeter(double kilogramspersquaremeter) + { + double value = (double) kilogramspersquaremeter; + return new AreaDensity(value, AreaDensityUnit.KilogramPerSquareMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AreaDensity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static AreaDensity From(double value, AreaDensityUnit fromUnit) + { + return new AreaDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AreaDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AreaDensity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AreaDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaDensity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AreaDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AreaDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaDensityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); + + return CompareTo((AreaDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(AreaDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AreaDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AreaDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AreaDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AreaDensity to another AreaDensity with the unit representation . + /// + /// A AreaDensity with the specified unit. + public AreaDensity ToUnit(AreaDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AreaDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AreaDensityUnit.KilogramPerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AreaDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AreaDensityUnit.KilogramPerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..40ba8402c8 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -0,0 +1,655 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A geometric property of an area that reflects how its points are distributed with regard to an axis. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class AreaMomentOfInertia : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AreaMomentOfInertiaUnit? _unit; + + static AreaMomentOfInertia() + { + BaseDimensions = new BaseDimensions(4, 0, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit MeterToTheFourth. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public AreaMomentOfInertia() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit) + { + if(unit == AreaMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AreaMomentOfInertia, which is MeterToTheFourth. All conversions go via this value. + /// + public static AreaMomentOfInertiaUnit BaseUnit => AreaMomentOfInertiaUnit.MeterToTheFourth; + + /// + /// Represents the largest possible value of AreaMomentOfInertia + /// + public static AreaMomentOfInertia MaxValue => new AreaMomentOfInertia(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AreaMomentOfInertia + /// + public static AreaMomentOfInertia MinValue => new AreaMomentOfInertia(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AreaMomentOfInertia; + + /// + /// All units of measurement for the AreaMomentOfInertia quantity. + /// + public static AreaMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(AreaMomentOfInertiaUnit)).Cast().Except(new AreaMomentOfInertiaUnit[]{ AreaMomentOfInertiaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MeterToTheFourth. + /// + public static AreaMomentOfInertia Zero => new AreaMomentOfInertia(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AreaMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AreaMomentOfInertia.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AreaMomentOfInertia.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AreaMomentOfInertia in CentimetersToTheFourth. + /// + public double CentimetersToTheFourth => As(AreaMomentOfInertiaUnit.CentimeterToTheFourth); + + /// + /// Get AreaMomentOfInertia in DecimetersToTheFourth. + /// + public double DecimetersToTheFourth => As(AreaMomentOfInertiaUnit.DecimeterToTheFourth); + + /// + /// Get AreaMomentOfInertia in FeetToTheFourth. + /// + public double FeetToTheFourth => As(AreaMomentOfInertiaUnit.FootToTheFourth); + + /// + /// Get AreaMomentOfInertia in InchesToTheFourth. + /// + public double InchesToTheFourth => As(AreaMomentOfInertiaUnit.InchToTheFourth); + + /// + /// Get AreaMomentOfInertia in MetersToTheFourth. + /// + public double MetersToTheFourth => As(AreaMomentOfInertiaUnit.MeterToTheFourth); + + /// + /// Get AreaMomentOfInertia in MillimetersToTheFourth. + /// + public double MillimetersToTheFourth => As(AreaMomentOfInertiaUnit.MillimeterToTheFourth); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AreaMomentOfInertiaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AreaMomentOfInertia from CentimetersToTheFourth. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AreaMomentOfInertia FromCentimetersToTheFourth(double centimeterstothefourth) + { + double value = (double) centimeterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.CentimeterToTheFourth); + } + /// + /// Get AreaMomentOfInertia from DecimetersToTheFourth. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AreaMomentOfInertia FromDecimetersToTheFourth(double decimeterstothefourth) + { + double value = (double) decimeterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.DecimeterToTheFourth); + } + /// + /// Get AreaMomentOfInertia from FeetToTheFourth. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AreaMomentOfInertia FromFeetToTheFourth(double feettothefourth) + { + double value = (double) feettothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.FootToTheFourth); + } + /// + /// Get AreaMomentOfInertia from InchesToTheFourth. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AreaMomentOfInertia FromInchesToTheFourth(double inchestothefourth) + { + double value = (double) inchestothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.InchToTheFourth); + } + /// + /// Get AreaMomentOfInertia from MetersToTheFourth. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AreaMomentOfInertia FromMetersToTheFourth(double meterstothefourth) + { + double value = (double) meterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MeterToTheFourth); + } + /// + /// Get AreaMomentOfInertia from MillimetersToTheFourth. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static AreaMomentOfInertia FromMillimetersToTheFourth(double millimeterstothefourth) + { + double value = (double) millimeterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MillimeterToTheFourth); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AreaMomentOfInertia unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static AreaMomentOfInertia From(double value, AreaMomentOfInertiaUnit fromUnit) + { + return new AreaMomentOfInertia((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AreaMomentOfInertia Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AreaMomentOfInertia Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out AreaMomentOfInertia result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaMomentOfInertiaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static AreaMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AreaMomentOfInertiaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out AreaMomentOfInertiaUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); + + return CompareTo((AreaMomentOfInertia)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(AreaMomentOfInertia other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AreaMomentOfInertia. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AreaMomentOfInertiaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AreaMomentOfInertia to another AreaMomentOfInertia with the unit representation . + /// + /// A AreaMomentOfInertia with the specified unit. + public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AreaMomentOfInertia(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return _value/1e8; + case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return _value/1e4; + case AreaMomentOfInertiaUnit.FootToTheFourth: return _value*Math.Pow(0.3048, 4); + case AreaMomentOfInertiaUnit.InchToTheFourth: return _value*Math.Pow(2.54e-2, 4); + case AreaMomentOfInertiaUnit.MeterToTheFourth: return _value; + case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return _value/1e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AreaMomentOfInertiaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return baseUnitValue*1e8; + case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return baseUnitValue*1e4; + case AreaMomentOfInertiaUnit.FootToTheFourth: return baseUnitValue/Math.Pow(0.3048, 4); + case AreaMomentOfInertiaUnit.InchToTheFourth: return baseUnitValue/Math.Pow(2.54e-2, 4); + case AreaMomentOfInertiaUnit.MeterToTheFourth: return baseUnitValue; + case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return baseUnitValue*1e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..550439140c --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -0,0 +1,998 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In telecommunications and computing, bit rate is the number of bits that are conveyed or processed per unit of time. + /// + /// + /// https://en.wikipedia.org/wiki/Bit_rate + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class BitRate : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly decimal _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly BitRateUnit? _unit; + + static BitRate() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit BitPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public BitRate() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private BitRate(decimal numericValue, BitRateUnit unit) + { + if(unit == BitRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = numericValue; + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of BitRate, which is BitPerSecond. All conversions go via this value. + /// + public static BitRateUnit BaseUnit => BitRateUnit.BitPerSecond; + + /// + /// Represents the largest possible value of BitRate + /// + public static BitRate MaxValue => new BitRate(decimal.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of BitRate + /// + public static BitRate MinValue => new BitRate(decimal.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.BitRate; + + /// + /// All units of measurement for the BitRate quantity. + /// + public static BitRateUnit[] Units { get; } = Enum.GetValues(typeof(BitRateUnit)).Cast().Except(new BitRateUnit[]{ BitRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit BitPerSecond. + /// + public static BitRate Zero => new BitRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public BitRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => BitRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => BitRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get BitRate in BitsPerSecond. + /// + public double BitsPerSecond => As(BitRateUnit.BitPerSecond); + + /// + /// Get BitRate in BytesPerSecond. + /// + public double BytesPerSecond => As(BitRateUnit.BytePerSecond); + + /// + /// Get BitRate in ExabitsPerSecond. + /// + public double ExabitsPerSecond => As(BitRateUnit.ExabitPerSecond); + + /// + /// Get BitRate in ExabytesPerSecond. + /// + public double ExabytesPerSecond => As(BitRateUnit.ExabytePerSecond); + + /// + /// Get BitRate in ExbibitsPerSecond. + /// + public double ExbibitsPerSecond => As(BitRateUnit.ExbibitPerSecond); + + /// + /// Get BitRate in ExbibytesPerSecond. + /// + public double ExbibytesPerSecond => As(BitRateUnit.ExbibytePerSecond); + + /// + /// Get BitRate in GibibitsPerSecond. + /// + public double GibibitsPerSecond => As(BitRateUnit.GibibitPerSecond); + + /// + /// Get BitRate in GibibytesPerSecond. + /// + public double GibibytesPerSecond => As(BitRateUnit.GibibytePerSecond); + + /// + /// Get BitRate in GigabitsPerSecond. + /// + public double GigabitsPerSecond => As(BitRateUnit.GigabitPerSecond); + + /// + /// Get BitRate in GigabytesPerSecond. + /// + public double GigabytesPerSecond => As(BitRateUnit.GigabytePerSecond); + + /// + /// Get BitRate in KibibitsPerSecond. + /// + public double KibibitsPerSecond => As(BitRateUnit.KibibitPerSecond); + + /// + /// Get BitRate in KibibytesPerSecond. + /// + public double KibibytesPerSecond => As(BitRateUnit.KibibytePerSecond); + + /// + /// Get BitRate in KilobitsPerSecond. + /// + public double KilobitsPerSecond => As(BitRateUnit.KilobitPerSecond); + + /// + /// Get BitRate in KilobytesPerSecond. + /// + public double KilobytesPerSecond => As(BitRateUnit.KilobytePerSecond); + + /// + /// Get BitRate in MebibitsPerSecond. + /// + public double MebibitsPerSecond => As(BitRateUnit.MebibitPerSecond); + + /// + /// Get BitRate in MebibytesPerSecond. + /// + public double MebibytesPerSecond => As(BitRateUnit.MebibytePerSecond); + + /// + /// Get BitRate in MegabitsPerSecond. + /// + public double MegabitsPerSecond => As(BitRateUnit.MegabitPerSecond); + + /// + /// Get BitRate in MegabytesPerSecond. + /// + public double MegabytesPerSecond => As(BitRateUnit.MegabytePerSecond); + + /// + /// Get BitRate in PebibitsPerSecond. + /// + public double PebibitsPerSecond => As(BitRateUnit.PebibitPerSecond); + + /// + /// Get BitRate in PebibytesPerSecond. + /// + public double PebibytesPerSecond => As(BitRateUnit.PebibytePerSecond); + + /// + /// Get BitRate in PetabitsPerSecond. + /// + public double PetabitsPerSecond => As(BitRateUnit.PetabitPerSecond); + + /// + /// Get BitRate in PetabytesPerSecond. + /// + public double PetabytesPerSecond => As(BitRateUnit.PetabytePerSecond); + + /// + /// Get BitRate in TebibitsPerSecond. + /// + public double TebibitsPerSecond => As(BitRateUnit.TebibitPerSecond); + + /// + /// Get BitRate in TebibytesPerSecond. + /// + public double TebibytesPerSecond => As(BitRateUnit.TebibytePerSecond); + + /// + /// Get BitRate in TerabitsPerSecond. + /// + public double TerabitsPerSecond => As(BitRateUnit.TerabitPerSecond); + + /// + /// Get BitRate in TerabytesPerSecond. + /// + public double TerabytesPerSecond => As(BitRateUnit.TerabytePerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(BitRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get BitRate from BitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromBitsPerSecond(double bitspersecond) + { + decimal value = (decimal) bitspersecond; + return new BitRate(value, BitRateUnit.BitPerSecond); + } + /// + /// Get BitRate from BytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromBytesPerSecond(double bytespersecond) + { + decimal value = (decimal) bytespersecond; + return new BitRate(value, BitRateUnit.BytePerSecond); + } + /// + /// Get BitRate from ExabitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromExabitsPerSecond(double exabitspersecond) + { + decimal value = (decimal) exabitspersecond; + return new BitRate(value, BitRateUnit.ExabitPerSecond); + } + /// + /// Get BitRate from ExabytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromExabytesPerSecond(double exabytespersecond) + { + decimal value = (decimal) exabytespersecond; + return new BitRate(value, BitRateUnit.ExabytePerSecond); + } + /// + /// Get BitRate from ExbibitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromExbibitsPerSecond(double exbibitspersecond) + { + decimal value = (decimal) exbibitspersecond; + return new BitRate(value, BitRateUnit.ExbibitPerSecond); + } + /// + /// Get BitRate from ExbibytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromExbibytesPerSecond(double exbibytespersecond) + { + decimal value = (decimal) exbibytespersecond; + return new BitRate(value, BitRateUnit.ExbibytePerSecond); + } + /// + /// Get BitRate from GibibitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromGibibitsPerSecond(double gibibitspersecond) + { + decimal value = (decimal) gibibitspersecond; + return new BitRate(value, BitRateUnit.GibibitPerSecond); + } + /// + /// Get BitRate from GibibytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromGibibytesPerSecond(double gibibytespersecond) + { + decimal value = (decimal) gibibytespersecond; + return new BitRate(value, BitRateUnit.GibibytePerSecond); + } + /// + /// Get BitRate from GigabitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromGigabitsPerSecond(double gigabitspersecond) + { + decimal value = (decimal) gigabitspersecond; + return new BitRate(value, BitRateUnit.GigabitPerSecond); + } + /// + /// Get BitRate from GigabytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromGigabytesPerSecond(double gigabytespersecond) + { + decimal value = (decimal) gigabytespersecond; + return new BitRate(value, BitRateUnit.GigabytePerSecond); + } + /// + /// Get BitRate from KibibitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromKibibitsPerSecond(double kibibitspersecond) + { + decimal value = (decimal) kibibitspersecond; + return new BitRate(value, BitRateUnit.KibibitPerSecond); + } + /// + /// Get BitRate from KibibytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromKibibytesPerSecond(double kibibytespersecond) + { + decimal value = (decimal) kibibytespersecond; + return new BitRate(value, BitRateUnit.KibibytePerSecond); + } + /// + /// Get BitRate from KilobitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromKilobitsPerSecond(double kilobitspersecond) + { + decimal value = (decimal) kilobitspersecond; + return new BitRate(value, BitRateUnit.KilobitPerSecond); + } + /// + /// Get BitRate from KilobytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromKilobytesPerSecond(double kilobytespersecond) + { + decimal value = (decimal) kilobytespersecond; + return new BitRate(value, BitRateUnit.KilobytePerSecond); + } + /// + /// Get BitRate from MebibitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromMebibitsPerSecond(double mebibitspersecond) + { + decimal value = (decimal) mebibitspersecond; + return new BitRate(value, BitRateUnit.MebibitPerSecond); + } + /// + /// Get BitRate from MebibytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromMebibytesPerSecond(double mebibytespersecond) + { + decimal value = (decimal) mebibytespersecond; + return new BitRate(value, BitRateUnit.MebibytePerSecond); + } + /// + /// Get BitRate from MegabitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromMegabitsPerSecond(double megabitspersecond) + { + decimal value = (decimal) megabitspersecond; + return new BitRate(value, BitRateUnit.MegabitPerSecond); + } + /// + /// Get BitRate from MegabytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromMegabytesPerSecond(double megabytespersecond) + { + decimal value = (decimal) megabytespersecond; + return new BitRate(value, BitRateUnit.MegabytePerSecond); + } + /// + /// Get BitRate from PebibitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromPebibitsPerSecond(double pebibitspersecond) + { + decimal value = (decimal) pebibitspersecond; + return new BitRate(value, BitRateUnit.PebibitPerSecond); + } + /// + /// Get BitRate from PebibytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromPebibytesPerSecond(double pebibytespersecond) + { + decimal value = (decimal) pebibytespersecond; + return new BitRate(value, BitRateUnit.PebibytePerSecond); + } + /// + /// Get BitRate from PetabitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromPetabitsPerSecond(double petabitspersecond) + { + decimal value = (decimal) petabitspersecond; + return new BitRate(value, BitRateUnit.PetabitPerSecond); + } + /// + /// Get BitRate from PetabytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromPetabytesPerSecond(double petabytespersecond) + { + decimal value = (decimal) petabytespersecond; + return new BitRate(value, BitRateUnit.PetabytePerSecond); + } + /// + /// Get BitRate from TebibitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromTebibitsPerSecond(double tebibitspersecond) + { + decimal value = (decimal) tebibitspersecond; + return new BitRate(value, BitRateUnit.TebibitPerSecond); + } + /// + /// Get BitRate from TebibytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromTebibytesPerSecond(double tebibytespersecond) + { + decimal value = (decimal) tebibytespersecond; + return new BitRate(value, BitRateUnit.TebibytePerSecond); + } + /// + /// Get BitRate from TerabitsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromTerabitsPerSecond(double terabitspersecond) + { + decimal value = (decimal) terabitspersecond; + return new BitRate(value, BitRateUnit.TerabitPerSecond); + } + /// + /// Get BitRate from TerabytesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BitRate FromTerabytesPerSecond(double terabytespersecond) + { + decimal value = (decimal) terabytespersecond; + return new BitRate(value, BitRateUnit.TerabytePerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// BitRate unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static BitRate From(double value, BitRateUnit fromUnit) + { + return new BitRate((decimal)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static BitRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static BitRate Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out BitRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BitRate result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static BitRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static BitRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out BitRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BitRateUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is BitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); + + return CompareTo((BitRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(BitRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another BitRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current BitRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(BitRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this BitRate to another BitRate with the unit representation . + /// + /// A BitRate with the specified unit. + public BitRate ToUnit(BitRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new BitRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private decimal AsBaseUnit() + { + switch(Unit) + { + case BitRateUnit.BitPerSecond: return _value; + case BitRateUnit.BytePerSecond: return _value*8m; + case BitRateUnit.ExabitPerSecond: return (_value) * 1e18m; + case BitRateUnit.ExabytePerSecond: return (_value*8m) * 1e18m; + case BitRateUnit.ExbibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.ExbibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.GibibitPerSecond: return (_value) * (1024m * 1024 * 1024); + case BitRateUnit.GibibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024); + case BitRateUnit.GigabitPerSecond: return (_value) * 1e9m; + case BitRateUnit.GigabytePerSecond: return (_value*8m) * 1e9m; + case BitRateUnit.KibibitPerSecond: return (_value) * 1024m; + case BitRateUnit.KibibytePerSecond: return (_value*8m) * 1024m; + case BitRateUnit.KilobitPerSecond: return (_value) * 1e3m; + case BitRateUnit.KilobytePerSecond: return (_value*8m) * 1e3m; + case BitRateUnit.MebibitPerSecond: return (_value) * (1024m * 1024); + case BitRateUnit.MebibytePerSecond: return (_value*8m) * (1024m * 1024); + case BitRateUnit.MegabitPerSecond: return (_value) * 1e6m; + case BitRateUnit.MegabytePerSecond: return (_value*8m) * 1e6m; + case BitRateUnit.PebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PetabitPerSecond: return (_value) * 1e15m; + case BitRateUnit.PetabytePerSecond: return (_value*8m) * 1e15m; + case BitRateUnit.TebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TerabitPerSecond: return (_value) * 1e12m; + case BitRateUnit.TerabytePerSecond: return (_value*8m) * 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private decimal AsBaseNumericType(BitRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case BitRateUnit.BitPerSecond: return baseUnitValue; + case BitRateUnit.BytePerSecond: return baseUnitValue/8m; + case BitRateUnit.ExabitPerSecond: return (baseUnitValue) / 1e18m; + case BitRateUnit.ExabytePerSecond: return (baseUnitValue/8m) / 1e18m; + case BitRateUnit.ExbibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.ExbibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.GibibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024); + case BitRateUnit.GibibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024); + case BitRateUnit.GigabitPerSecond: return (baseUnitValue) / 1e9m; + case BitRateUnit.GigabytePerSecond: return (baseUnitValue/8m) / 1e9m; + case BitRateUnit.KibibitPerSecond: return (baseUnitValue) / 1024m; + case BitRateUnit.KibibytePerSecond: return (baseUnitValue/8m) / 1024m; + case BitRateUnit.KilobitPerSecond: return (baseUnitValue) / 1e3m; + case BitRateUnit.KilobytePerSecond: return (baseUnitValue/8m) / 1e3m; + case BitRateUnit.MebibitPerSecond: return (baseUnitValue) / (1024m * 1024); + case BitRateUnit.MebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024); + case BitRateUnit.MegabitPerSecond: return (baseUnitValue) / 1e6m; + case BitRateUnit.MegabytePerSecond: return (baseUnitValue/8m) / 1e6m; + case BitRateUnit.PebibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PetabitPerSecond: return (baseUnitValue) / 1e15m; + case BitRateUnit.PetabytePerSecond: return (baseUnitValue/8m) / 1e15m; + case BitRateUnit.TebibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TerabitPerSecond: return (baseUnitValue) / 1e12m; + case BitRateUnit.TerabytePerSecond: return (baseUnitValue/8m) / 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..63ab43d231 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class BrakeSpecificFuelConsumption : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly BrakeSpecificFuelConsumptionUnit? _unit; + + static BrakeSpecificFuelConsumption() + { + BaseDimensions = new BaseDimensions(-2, 0, 2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit KilogramPerJoule. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public BrakeSpecificFuelConsumption() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsumptionUnit unit) + { + if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of BrakeSpecificFuelConsumption, which is KilogramPerJoule. All conversions go via this value. + /// + public static BrakeSpecificFuelConsumptionUnit BaseUnit => BrakeSpecificFuelConsumptionUnit.KilogramPerJoule; + + /// + /// Represents the largest possible value of BrakeSpecificFuelConsumption + /// + public static BrakeSpecificFuelConsumption MaxValue => new BrakeSpecificFuelConsumption(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of BrakeSpecificFuelConsumption + /// + public static BrakeSpecificFuelConsumption MinValue => new BrakeSpecificFuelConsumption(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.BrakeSpecificFuelConsumption; + + /// + /// All units of measurement for the BrakeSpecificFuelConsumption quantity. + /// + public static BrakeSpecificFuelConsumptionUnit[] Units { get; } = Enum.GetValues(typeof(BrakeSpecificFuelConsumptionUnit)).Cast().Except(new BrakeSpecificFuelConsumptionUnit[]{ BrakeSpecificFuelConsumptionUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerJoule. + /// + public static BrakeSpecificFuelConsumption Zero => new BrakeSpecificFuelConsumption(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public BrakeSpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => BrakeSpecificFuelConsumption.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => BrakeSpecificFuelConsumption.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get BrakeSpecificFuelConsumption in GramsPerKiloWattHour. + /// + public double GramsPerKiloWattHour => As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); + + /// + /// Get BrakeSpecificFuelConsumption in KilogramsPerJoule. + /// + public double KilogramsPerJoule => As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); + + /// + /// Get BrakeSpecificFuelConsumption in PoundsPerMechanicalHorsepowerHour. + /// + public double PoundsPerMechanicalHorsepowerHour => As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get BrakeSpecificFuelConsumption from GramsPerKiloWattHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(double gramsperkilowatthour) + { + double value = (double) gramsperkilowatthour; + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); + } + /// + /// Get BrakeSpecificFuelConsumption from KilogramsPerJoule. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(double kilogramsperjoule) + { + double value = (double) kilogramsperjoule; + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); + } + /// + /// Get BrakeSpecificFuelConsumption from PoundsPerMechanicalHorsepowerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(double poundspermechanicalhorsepowerhour) + { + double value = (double) poundspermechanicalhorsepowerhour; + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// BrakeSpecificFuelConsumption unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static BrakeSpecificFuelConsumption From(double value, BrakeSpecificFuelConsumptionUnit fromUnit) + { + return new BrakeSpecificFuelConsumption((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static BrakeSpecificFuelConsumption Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsumption result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumption result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out BrakeSpecificFuelConsumptionUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out BrakeSpecificFuelConsumptionUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is BrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); + + return CompareTo((BrakeSpecificFuelConsumption)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(BrakeSpecificFuelConsumption other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another BrakeSpecificFuelConsumption within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current BrakeSpecificFuelConsumption. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(BrakeSpecificFuelConsumptionUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this BrakeSpecificFuelConsumption to another BrakeSpecificFuelConsumption with the unit representation . + /// + /// A BrakeSpecificFuelConsumption with the specified unit. + public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new BrakeSpecificFuelConsumption(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return _value/3.6e9; + case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return _value; + case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return _value*1.689659410672e-7; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(BrakeSpecificFuelConsumptionUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return baseUnitValue*3.6e9; + case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return baseUnitValue; + case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return baseUnitValue/1.689659410672e-7; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..e420af6a62 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Capacitance is the ability of a body to store an electric charge. + /// + /// + /// https://en.wikipedia.org/wiki/Capacitance + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Capacitance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly CapacitanceUnit? _unit; + + static Capacitance() + { + BaseDimensions = new BaseDimensions(-2, -1, 4, 2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Farad. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Capacitance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Capacitance(double numericValue, CapacitanceUnit unit) + { + if(unit == CapacitanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Capacitance, which is Farad. All conversions go via this value. + /// + public static CapacitanceUnit BaseUnit => CapacitanceUnit.Farad; + + /// + /// Represents the largest possible value of Capacitance + /// + public static Capacitance MaxValue => new Capacitance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Capacitance + /// + public static Capacitance MinValue => new Capacitance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Capacitance; + + /// + /// All units of measurement for the Capacitance quantity. + /// + public static CapacitanceUnit[] Units { get; } = Enum.GetValues(typeof(CapacitanceUnit)).Cast().Except(new CapacitanceUnit[]{ CapacitanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Farad. + /// + public static Capacitance Zero => new Capacitance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public CapacitanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Capacitance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Capacitance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Capacitance in Farads. + /// + public double Farads => As(CapacitanceUnit.Farad); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(CapacitanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Capacitance from Farads. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Capacitance FromFarads(double farads) + { + double value = (double) farads; + return new Capacitance(value, CapacitanceUnit.Farad); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Capacitance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Capacitance From(double value, CapacitanceUnit fromUnit) + { + return new Capacitance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Capacitance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Capacitance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Capacitance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Capacitance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static CapacitanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static CapacitanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out CapacitanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out CapacitanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Capacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); + + return CompareTo((Capacitance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Capacitance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Capacitance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Capacitance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(CapacitanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Capacitance to another Capacitance with the unit representation . + /// + /// A Capacitance with the specified unit. + public Capacitance ToUnit(CapacitanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Capacitance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case CapacitanceUnit.Farad: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(CapacitanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case CapacitanceUnit.Farad: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..1173f6f511 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A unit that represents a fractional change in size in response to a change in temperature. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class CoefficientOfThermalExpansion : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly CoefficientOfThermalExpansionUnit? _unit; + + static CoefficientOfThermalExpansion() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, -1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit InverseKelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public CoefficientOfThermalExpansion() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private CoefficientOfThermalExpansion(double numericValue, CoefficientOfThermalExpansionUnit unit) + { + if(unit == CoefficientOfThermalExpansionUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of CoefficientOfThermalExpansion, which is InverseKelvin. All conversions go via this value. + /// + public static CoefficientOfThermalExpansionUnit BaseUnit => CoefficientOfThermalExpansionUnit.InverseKelvin; + + /// + /// Represents the largest possible value of CoefficientOfThermalExpansion + /// + public static CoefficientOfThermalExpansion MaxValue => new CoefficientOfThermalExpansion(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of CoefficientOfThermalExpansion + /// + public static CoefficientOfThermalExpansion MinValue => new CoefficientOfThermalExpansion(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.CoefficientOfThermalExpansion; + + /// + /// All units of measurement for the CoefficientOfThermalExpansion quantity. + /// + public static CoefficientOfThermalExpansionUnit[] Units { get; } = Enum.GetValues(typeof(CoefficientOfThermalExpansionUnit)).Cast().Except(new CoefficientOfThermalExpansionUnit[]{ CoefficientOfThermalExpansionUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit InverseKelvin. + /// + public static CoefficientOfThermalExpansion Zero => new CoefficientOfThermalExpansion(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public CoefficientOfThermalExpansionUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => CoefficientOfThermalExpansion.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => CoefficientOfThermalExpansion.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get CoefficientOfThermalExpansion in InverseDegreeCelsius. + /// + public double InverseDegreeCelsius => As(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); + + /// + /// Get CoefficientOfThermalExpansion in InverseDegreeFahrenheit. + /// + public double InverseDegreeFahrenheit => As(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); + + /// + /// Get CoefficientOfThermalExpansion in InverseKelvin. + /// + public double InverseKelvin => As(CoefficientOfThermalExpansionUnit.InverseKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get CoefficientOfThermalExpansion from InverseDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static CoefficientOfThermalExpansion FromInverseDegreeCelsius(double inversedegreecelsius) + { + double value = (double) inversedegreecelsius; + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); + } + /// + /// Get CoefficientOfThermalExpansion from InverseDegreeFahrenheit. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static CoefficientOfThermalExpansion FromInverseDegreeFahrenheit(double inversedegreefahrenheit) + { + double value = (double) inversedegreefahrenheit; + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); + } + /// + /// Get CoefficientOfThermalExpansion from InverseKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static CoefficientOfThermalExpansion FromInverseKelvin(double inversekelvin) + { + double value = (double) inversekelvin; + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// CoefficientOfThermalExpansion unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static CoefficientOfThermalExpansion From(double value, CoefficientOfThermalExpansionUnit fromUnit) + { + return new CoefficientOfThermalExpansion((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static CoefficientOfThermalExpansion Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static CoefficientOfThermalExpansion Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out CoefficientOfThermalExpansion result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out CoefficientOfThermalExpansion result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static CoefficientOfThermalExpansionUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static CoefficientOfThermalExpansionUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out CoefficientOfThermalExpansionUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out CoefficientOfThermalExpansionUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is CoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); + + return CompareTo((CoefficientOfThermalExpansion)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(CoefficientOfThermalExpansion other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another CoefficientOfThermalExpansion within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current CoefficientOfThermalExpansion. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(CoefficientOfThermalExpansionUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this CoefficientOfThermalExpansion to another CoefficientOfThermalExpansion with the unit representation . + /// + /// A CoefficientOfThermalExpansion with the specified unit. + public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new CoefficientOfThermalExpansion(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return _value; + case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return _value*5/9; + case CoefficientOfThermalExpansionUnit.InverseKelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(CoefficientOfThermalExpansionUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return baseUnitValue; + case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return baseUnitValue*9/5; + case CoefficientOfThermalExpansionUnit.InverseKelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..ccd0e18225 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -0,0 +1,1202 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The density, or more precisely, the volumetric mass density, of a substance is its mass per unit volume. + /// + /// + /// http://en.wikipedia.org/wiki/Density + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Density : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly DensityUnit? _unit; + + static Density() + { + BaseDimensions = new BaseDimensions(-3, 1, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit KilogramPerCubicMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Density() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Density(double numericValue, DensityUnit unit) + { + if(unit == DensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Density, which is KilogramPerCubicMeter. All conversions go via this value. + /// + public static DensityUnit BaseUnit => DensityUnit.KilogramPerCubicMeter; + + /// + /// Represents the largest possible value of Density + /// + public static Density MaxValue => new Density(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Density + /// + public static Density MinValue => new Density(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Density; + + /// + /// All units of measurement for the Density quantity. + /// + public static DensityUnit[] Units { get; } = Enum.GetValues(typeof(DensityUnit)).Cast().Except(new DensityUnit[]{ DensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. + /// + public static Density Zero => new Density(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public DensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Density.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Density.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Density in CentigramsPerDeciLiter. + /// + public double CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); + + /// + /// Get Density in CentigramsPerLiter. + /// + public double CentigramsPerLiter => As(DensityUnit.CentigramPerLiter); + + /// + /// Get Density in CentigramsPerMilliliter. + /// + public double CentigramsPerMilliliter => As(DensityUnit.CentigramPerMilliliter); + + /// + /// Get Density in DecigramsPerDeciLiter. + /// + public double DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); + + /// + /// Get Density in DecigramsPerLiter. + /// + public double DecigramsPerLiter => As(DensityUnit.DecigramPerLiter); + + /// + /// Get Density in DecigramsPerMilliliter. + /// + public double DecigramsPerMilliliter => As(DensityUnit.DecigramPerMilliliter); + + /// + /// Get Density in GramsPerCubicCentimeter. + /// + public double GramsPerCubicCentimeter => As(DensityUnit.GramPerCubicCentimeter); + + /// + /// Get Density in GramsPerCubicMeter. + /// + public double GramsPerCubicMeter => As(DensityUnit.GramPerCubicMeter); + + /// + /// Get Density in GramsPerCubicMillimeter. + /// + public double GramsPerCubicMillimeter => As(DensityUnit.GramPerCubicMillimeter); + + /// + /// Get Density in GramsPerDeciLiter. + /// + public double GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); + + /// + /// Get Density in GramsPerLiter. + /// + public double GramsPerLiter => As(DensityUnit.GramPerLiter); + + /// + /// Get Density in GramsPerMilliliter. + /// + public double GramsPerMilliliter => As(DensityUnit.GramPerMilliliter); + + /// + /// Get Density in KilogramsPerCubicCentimeter. + /// + public double KilogramsPerCubicCentimeter => As(DensityUnit.KilogramPerCubicCentimeter); + + /// + /// Get Density in KilogramsPerCubicMeter. + /// + public double KilogramsPerCubicMeter => As(DensityUnit.KilogramPerCubicMeter); + + /// + /// Get Density in KilogramsPerCubicMillimeter. + /// + public double KilogramsPerCubicMillimeter => As(DensityUnit.KilogramPerCubicMillimeter); + + /// + /// Get Density in KilopoundsPerCubicFoot. + /// + public double KilopoundsPerCubicFoot => As(DensityUnit.KilopoundPerCubicFoot); + + /// + /// Get Density in KilopoundsPerCubicInch. + /// + public double KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); + + /// + /// Get Density in MicrogramsPerDeciLiter. + /// + public double MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); + + /// + /// Get Density in MicrogramsPerLiter. + /// + public double MicrogramsPerLiter => As(DensityUnit.MicrogramPerLiter); + + /// + /// Get Density in MicrogramsPerMilliliter. + /// + public double MicrogramsPerMilliliter => As(DensityUnit.MicrogramPerMilliliter); + + /// + /// Get Density in MilligramsPerCubicMeter. + /// + public double MilligramsPerCubicMeter => As(DensityUnit.MilligramPerCubicMeter); + + /// + /// Get Density in MilligramsPerDeciLiter. + /// + public double MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); + + /// + /// Get Density in MilligramsPerLiter. + /// + public double MilligramsPerLiter => As(DensityUnit.MilligramPerLiter); + + /// + /// Get Density in MilligramsPerMilliliter. + /// + public double MilligramsPerMilliliter => As(DensityUnit.MilligramPerMilliliter); + + /// + /// Get Density in NanogramsPerDeciLiter. + /// + public double NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); + + /// + /// Get Density in NanogramsPerLiter. + /// + public double NanogramsPerLiter => As(DensityUnit.NanogramPerLiter); + + /// + /// Get Density in NanogramsPerMilliliter. + /// + public double NanogramsPerMilliliter => As(DensityUnit.NanogramPerMilliliter); + + /// + /// Get Density in PicogramsPerDeciLiter. + /// + public double PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); + + /// + /// Get Density in PicogramsPerLiter. + /// + public double PicogramsPerLiter => As(DensityUnit.PicogramPerLiter); + + /// + /// Get Density in PicogramsPerMilliliter. + /// + public double PicogramsPerMilliliter => As(DensityUnit.PicogramPerMilliliter); + + /// + /// Get Density in PoundsPerCubicFoot. + /// + public double PoundsPerCubicFoot => As(DensityUnit.PoundPerCubicFoot); + + /// + /// Get Density in PoundsPerCubicInch. + /// + public double PoundsPerCubicInch => As(DensityUnit.PoundPerCubicInch); + + /// + /// Get Density in PoundsPerImperialGallon. + /// + public double PoundsPerImperialGallon => As(DensityUnit.PoundPerImperialGallon); + + /// + /// Get Density in PoundsPerUSGallon. + /// + public double PoundsPerUSGallon => As(DensityUnit.PoundPerUSGallon); + + /// + /// Get Density in SlugsPerCubicFoot. + /// + public double SlugsPerCubicFoot => As(DensityUnit.SlugPerCubicFoot); + + /// + /// Get Density in TonnesPerCubicCentimeter. + /// + public double TonnesPerCubicCentimeter => As(DensityUnit.TonnePerCubicCentimeter); + + /// + /// Get Density in TonnesPerCubicMeter. + /// + public double TonnesPerCubicMeter => As(DensityUnit.TonnePerCubicMeter); + + /// + /// Get Density in TonnesPerCubicMillimeter. + /// + public double TonnesPerCubicMillimeter => As(DensityUnit.TonnePerCubicMillimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(DensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(DensityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Density from CentigramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromCentigramsPerDeciLiter(double centigramsperdeciliter) + { + double value = (double) centigramsperdeciliter; + return new Density(value, DensityUnit.CentigramPerDeciliter); + } + /// + /// Get Density from CentigramsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromCentigramsPerLiter(double centigramsperliter) + { + double value = (double) centigramsperliter; + return new Density(value, DensityUnit.CentigramPerLiter); + } + /// + /// Get Density from CentigramsPerMilliliter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromCentigramsPerMilliliter(double centigramspermilliliter) + { + double value = (double) centigramspermilliliter; + return new Density(value, DensityUnit.CentigramPerMilliliter); + } + /// + /// Get Density from DecigramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromDecigramsPerDeciLiter(double decigramsperdeciliter) + { + double value = (double) decigramsperdeciliter; + return new Density(value, DensityUnit.DecigramPerDeciliter); + } + /// + /// Get Density from DecigramsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromDecigramsPerLiter(double decigramsperliter) + { + double value = (double) decigramsperliter; + return new Density(value, DensityUnit.DecigramPerLiter); + } + /// + /// Get Density from DecigramsPerMilliliter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromDecigramsPerMilliliter(double decigramspermilliliter) + { + double value = (double) decigramspermilliliter; + return new Density(value, DensityUnit.DecigramPerMilliliter); + } + /// + /// Get Density from GramsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromGramsPerCubicCentimeter(double gramspercubiccentimeter) + { + double value = (double) gramspercubiccentimeter; + return new Density(value, DensityUnit.GramPerCubicCentimeter); + } + /// + /// Get Density from GramsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromGramsPerCubicMeter(double gramspercubicmeter) + { + double value = (double) gramspercubicmeter; + return new Density(value, DensityUnit.GramPerCubicMeter); + } + /// + /// Get Density from GramsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromGramsPerCubicMillimeter(double gramspercubicmillimeter) + { + double value = (double) gramspercubicmillimeter; + return new Density(value, DensityUnit.GramPerCubicMillimeter); + } + /// + /// Get Density from GramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromGramsPerDeciLiter(double gramsperdeciliter) + { + double value = (double) gramsperdeciliter; + return new Density(value, DensityUnit.GramPerDeciliter); + } + /// + /// Get Density from GramsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromGramsPerLiter(double gramsperliter) + { + double value = (double) gramsperliter; + return new Density(value, DensityUnit.GramPerLiter); + } + /// + /// Get Density from GramsPerMilliliter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromGramsPerMilliliter(double gramspermilliliter) + { + double value = (double) gramspermilliliter; + return new Density(value, DensityUnit.GramPerMilliliter); + } + /// + /// Get Density from KilogramsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromKilogramsPerCubicCentimeter(double kilogramspercubiccentimeter) + { + double value = (double) kilogramspercubiccentimeter; + return new Density(value, DensityUnit.KilogramPerCubicCentimeter); + } + /// + /// Get Density from KilogramsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromKilogramsPerCubicMeter(double kilogramspercubicmeter) + { + double value = (double) kilogramspercubicmeter; + return new Density(value, DensityUnit.KilogramPerCubicMeter); + } + /// + /// Get Density from KilogramsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromKilogramsPerCubicMillimeter(double kilogramspercubicmillimeter) + { + double value = (double) kilogramspercubicmillimeter; + return new Density(value, DensityUnit.KilogramPerCubicMillimeter); + } + /// + /// Get Density from KilopoundsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromKilopoundsPerCubicFoot(double kilopoundspercubicfoot) + { + double value = (double) kilopoundspercubicfoot; + return new Density(value, DensityUnit.KilopoundPerCubicFoot); + } + /// + /// Get Density from KilopoundsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromKilopoundsPerCubicInch(double kilopoundspercubicinch) + { + double value = (double) kilopoundspercubicinch; + return new Density(value, DensityUnit.KilopoundPerCubicInch); + } + /// + /// Get Density from MicrogramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromMicrogramsPerDeciLiter(double microgramsperdeciliter) + { + double value = (double) microgramsperdeciliter; + return new Density(value, DensityUnit.MicrogramPerDeciliter); + } + /// + /// Get Density from MicrogramsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromMicrogramsPerLiter(double microgramsperliter) + { + double value = (double) microgramsperliter; + return new Density(value, DensityUnit.MicrogramPerLiter); + } + /// + /// Get Density from MicrogramsPerMilliliter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromMicrogramsPerMilliliter(double microgramspermilliliter) + { + double value = (double) microgramspermilliliter; + return new Density(value, DensityUnit.MicrogramPerMilliliter); + } + /// + /// Get Density from MilligramsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromMilligramsPerCubicMeter(double milligramspercubicmeter) + { + double value = (double) milligramspercubicmeter; + return new Density(value, DensityUnit.MilligramPerCubicMeter); + } + /// + /// Get Density from MilligramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromMilligramsPerDeciLiter(double milligramsperdeciliter) + { + double value = (double) milligramsperdeciliter; + return new Density(value, DensityUnit.MilligramPerDeciliter); + } + /// + /// Get Density from MilligramsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromMilligramsPerLiter(double milligramsperliter) + { + double value = (double) milligramsperliter; + return new Density(value, DensityUnit.MilligramPerLiter); + } + /// + /// Get Density from MilligramsPerMilliliter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromMilligramsPerMilliliter(double milligramspermilliliter) + { + double value = (double) milligramspermilliliter; + return new Density(value, DensityUnit.MilligramPerMilliliter); + } + /// + /// Get Density from NanogramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromNanogramsPerDeciLiter(double nanogramsperdeciliter) + { + double value = (double) nanogramsperdeciliter; + return new Density(value, DensityUnit.NanogramPerDeciliter); + } + /// + /// Get Density from NanogramsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromNanogramsPerLiter(double nanogramsperliter) + { + double value = (double) nanogramsperliter; + return new Density(value, DensityUnit.NanogramPerLiter); + } + /// + /// Get Density from NanogramsPerMilliliter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromNanogramsPerMilliliter(double nanogramspermilliliter) + { + double value = (double) nanogramspermilliliter; + return new Density(value, DensityUnit.NanogramPerMilliliter); + } + /// + /// Get Density from PicogramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromPicogramsPerDeciLiter(double picogramsperdeciliter) + { + double value = (double) picogramsperdeciliter; + return new Density(value, DensityUnit.PicogramPerDeciliter); + } + /// + /// Get Density from PicogramsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromPicogramsPerLiter(double picogramsperliter) + { + double value = (double) picogramsperliter; + return new Density(value, DensityUnit.PicogramPerLiter); + } + /// + /// Get Density from PicogramsPerMilliliter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromPicogramsPerMilliliter(double picogramspermilliliter) + { + double value = (double) picogramspermilliliter; + return new Density(value, DensityUnit.PicogramPerMilliliter); + } + /// + /// Get Density from PoundsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromPoundsPerCubicFoot(double poundspercubicfoot) + { + double value = (double) poundspercubicfoot; + return new Density(value, DensityUnit.PoundPerCubicFoot); + } + /// + /// Get Density from PoundsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromPoundsPerCubicInch(double poundspercubicinch) + { + double value = (double) poundspercubicinch; + return new Density(value, DensityUnit.PoundPerCubicInch); + } + /// + /// Get Density from PoundsPerImperialGallon. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromPoundsPerImperialGallon(double poundsperimperialgallon) + { + double value = (double) poundsperimperialgallon; + return new Density(value, DensityUnit.PoundPerImperialGallon); + } + /// + /// Get Density from PoundsPerUSGallon. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromPoundsPerUSGallon(double poundsperusgallon) + { + double value = (double) poundsperusgallon; + return new Density(value, DensityUnit.PoundPerUSGallon); + } + /// + /// Get Density from SlugsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromSlugsPerCubicFoot(double slugspercubicfoot) + { + double value = (double) slugspercubicfoot; + return new Density(value, DensityUnit.SlugPerCubicFoot); + } + /// + /// Get Density from TonnesPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromTonnesPerCubicCentimeter(double tonnespercubiccentimeter) + { + double value = (double) tonnespercubiccentimeter; + return new Density(value, DensityUnit.TonnePerCubicCentimeter); + } + /// + /// Get Density from TonnesPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromTonnesPerCubicMeter(double tonnespercubicmeter) + { + double value = (double) tonnespercubicmeter; + return new Density(value, DensityUnit.TonnePerCubicMeter); + } + /// + /// Get Density from TonnesPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimeter) + { + double value = (double) tonnespercubicmillimeter; + return new Density(value, DensityUnit.TonnePerCubicMillimeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Density unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Density From(double value, DensityUnit fromUnit) + { + return new Density((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Density Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Density Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Density result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Density result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static DensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out DensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DensityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Density)) throw new ArgumentException("Expected type Density.", nameof(obj)); + + return CompareTo((Density)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Density other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Density within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Density other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Density. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(DensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Density to another Density with the unit representation . + /// + /// A Density with the specified unit. + public Density ToUnit(DensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Density(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case DensityUnit.CentigramPerDeciliter: return (_value/1e-1) * 1e-2d; + case DensityUnit.CentigramPerLiter: return (_value/1) * 1e-2d; + case DensityUnit.CentigramPerMilliliter: return (_value/1e-3) * 1e-2d; + case DensityUnit.DecigramPerDeciliter: return (_value/1e-1) * 1e-1d; + case DensityUnit.DecigramPerLiter: return (_value/1) * 1e-1d; + case DensityUnit.DecigramPerMilliliter: return (_value/1e-3) * 1e-1d; + case DensityUnit.GramPerCubicCentimeter: return _value/1e-3; + case DensityUnit.GramPerCubicMeter: return _value/1e3; + case DensityUnit.GramPerCubicMillimeter: return _value/1e-6; + case DensityUnit.GramPerDeciliter: return _value/1e-1; + case DensityUnit.GramPerLiter: return _value/1; + case DensityUnit.GramPerMilliliter: return _value/1e-3; + case DensityUnit.KilogramPerCubicCentimeter: return (_value/1e-3) * 1e3d; + case DensityUnit.KilogramPerCubicMeter: return (_value/1e3) * 1e3d; + case DensityUnit.KilogramPerCubicMillimeter: return (_value/1e-6) * 1e3d; + case DensityUnit.KilopoundPerCubicFoot: return (_value/0.062427961) * 1e3d; + case DensityUnit.KilopoundPerCubicInch: return (_value/3.6127298147753e-5) * 1e3d; + case DensityUnit.MicrogramPerDeciliter: return (_value/1e-1) * 1e-6d; + case DensityUnit.MicrogramPerLiter: return (_value/1) * 1e-6d; + case DensityUnit.MicrogramPerMilliliter: return (_value/1e-3) * 1e-6d; + case DensityUnit.MilligramPerCubicMeter: return (_value/1e3) * 1e-3d; + case DensityUnit.MilligramPerDeciliter: return (_value/1e-1) * 1e-3d; + case DensityUnit.MilligramPerLiter: return (_value/1) * 1e-3d; + case DensityUnit.MilligramPerMilliliter: return (_value/1e-3) * 1e-3d; + case DensityUnit.NanogramPerDeciliter: return (_value/1e-1) * 1e-9d; + case DensityUnit.NanogramPerLiter: return (_value/1) * 1e-9d; + case DensityUnit.NanogramPerMilliliter: return (_value/1e-3) * 1e-9d; + case DensityUnit.PicogramPerDeciliter: return (_value/1e-1) * 1e-12d; + case DensityUnit.PicogramPerLiter: return (_value/1) * 1e-12d; + case DensityUnit.PicogramPerMilliliter: return (_value/1e-3) * 1e-12d; + case DensityUnit.PoundPerCubicFoot: return _value/0.062427961; + case DensityUnit.PoundPerCubicInch: return _value/3.6127298147753e-5; + case DensityUnit.PoundPerImperialGallon: return _value*9.9776398e1; + case DensityUnit.PoundPerUSGallon: return _value*1.19826427e2; + case DensityUnit.SlugPerCubicFoot: return _value*515.378818; + case DensityUnit.TonnePerCubicCentimeter: return _value/1e-9; + case DensityUnit.TonnePerCubicMeter: return _value/0.001; + case DensityUnit.TonnePerCubicMillimeter: return _value/1e-12; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(DensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case DensityUnit.CentigramPerDeciliter: return (baseUnitValue*1e-1) / 1e-2d; + case DensityUnit.CentigramPerLiter: return (baseUnitValue*1) / 1e-2d; + case DensityUnit.CentigramPerMilliliter: return (baseUnitValue*1e-3) / 1e-2d; + case DensityUnit.DecigramPerDeciliter: return (baseUnitValue*1e-1) / 1e-1d; + case DensityUnit.DecigramPerLiter: return (baseUnitValue*1) / 1e-1d; + case DensityUnit.DecigramPerMilliliter: return (baseUnitValue*1e-3) / 1e-1d; + case DensityUnit.GramPerCubicCentimeter: return baseUnitValue*1e-3; + case DensityUnit.GramPerCubicMeter: return baseUnitValue*1e3; + case DensityUnit.GramPerCubicMillimeter: return baseUnitValue*1e-6; + case DensityUnit.GramPerDeciliter: return baseUnitValue*1e-1; + case DensityUnit.GramPerLiter: return baseUnitValue*1; + case DensityUnit.GramPerMilliliter: return baseUnitValue*1e-3; + case DensityUnit.KilogramPerCubicCentimeter: return (baseUnitValue*1e-3) / 1e3d; + case DensityUnit.KilogramPerCubicMeter: return (baseUnitValue*1e3) / 1e3d; + case DensityUnit.KilogramPerCubicMillimeter: return (baseUnitValue*1e-6) / 1e3d; + case DensityUnit.KilopoundPerCubicFoot: return (baseUnitValue*0.062427961) / 1e3d; + case DensityUnit.KilopoundPerCubicInch: return (baseUnitValue*3.6127298147753e-5) / 1e3d; + case DensityUnit.MicrogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-6d; + case DensityUnit.MicrogramPerLiter: return (baseUnitValue*1) / 1e-6d; + case DensityUnit.MicrogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-6d; + case DensityUnit.MilligramPerCubicMeter: return (baseUnitValue*1e3) / 1e-3d; + case DensityUnit.MilligramPerDeciliter: return (baseUnitValue*1e-1) / 1e-3d; + case DensityUnit.MilligramPerLiter: return (baseUnitValue*1) / 1e-3d; + case DensityUnit.MilligramPerMilliliter: return (baseUnitValue*1e-3) / 1e-3d; + case DensityUnit.NanogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-9d; + case DensityUnit.NanogramPerLiter: return (baseUnitValue*1) / 1e-9d; + case DensityUnit.NanogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-9d; + case DensityUnit.PicogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-12d; + case DensityUnit.PicogramPerLiter: return (baseUnitValue*1) / 1e-12d; + case DensityUnit.PicogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-12d; + case DensityUnit.PoundPerCubicFoot: return baseUnitValue*0.062427961; + case DensityUnit.PoundPerCubicInch: return baseUnitValue*3.6127298147753e-5; + case DensityUnit.PoundPerImperialGallon: return baseUnitValue/9.9776398e1; + case DensityUnit.PoundPerUSGallon: return baseUnitValue/1.19826427e2; + case DensityUnit.SlugPerCubicFoot: return baseUnitValue*0.00194032033; + case DensityUnit.TonnePerCubicCentimeter: return baseUnitValue*1e-9; + case DensityUnit.TonnePerCubicMeter: return baseUnitValue*0.001; + case DensityUnit.TonnePerCubicMillimeter: return baseUnitValue*1e-12; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..d6da3f36c3 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -0,0 +1,723 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Duration : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly DurationUnit? _unit; + + static Duration() + { + BaseDimensions = new BaseDimensions(0, 0, 1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Second. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Duration() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Duration(double numericValue, DurationUnit unit) + { + if(unit == DurationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Duration, which is Second. All conversions go via this value. + /// + public static DurationUnit BaseUnit => DurationUnit.Second; + + /// + /// Represents the largest possible value of Duration + /// + public static Duration MaxValue => new Duration(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Duration + /// + public static Duration MinValue => new Duration(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Duration; + + /// + /// All units of measurement for the Duration quantity. + /// + public static DurationUnit[] Units { get; } = Enum.GetValues(typeof(DurationUnit)).Cast().Except(new DurationUnit[]{ DurationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Second. + /// + public static Duration Zero => new Duration(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public DurationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Duration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Duration.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Duration in Days. + /// + public double Days => As(DurationUnit.Day); + + /// + /// Get Duration in Hours. + /// + public double Hours => As(DurationUnit.Hour); + + /// + /// Get Duration in Microseconds. + /// + public double Microseconds => As(DurationUnit.Microsecond); + + /// + /// Get Duration in Milliseconds. + /// + public double Milliseconds => As(DurationUnit.Millisecond); + + /// + /// Get Duration in Minutes. + /// + public double Minutes => As(DurationUnit.Minute); + + /// + /// Get Duration in Months30. + /// + public double Months30 => As(DurationUnit.Month30); + + /// + /// Get Duration in Nanoseconds. + /// + public double Nanoseconds => As(DurationUnit.Nanosecond); + + /// + /// Get Duration in Seconds. + /// + public double Seconds => As(DurationUnit.Second); + + /// + /// Get Duration in Weeks. + /// + public double Weeks => As(DurationUnit.Week); + + /// + /// Get Duration in Years365. + /// + public double Years365 => As(DurationUnit.Year365); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(DurationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(DurationUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Duration from Days. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromDays(double days) + { + double value = (double) days; + return new Duration(value, DurationUnit.Day); + } + /// + /// Get Duration from Hours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromHours(double hours) + { + double value = (double) hours; + return new Duration(value, DurationUnit.Hour); + } + /// + /// Get Duration from Microseconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromMicroseconds(double microseconds) + { + double value = (double) microseconds; + return new Duration(value, DurationUnit.Microsecond); + } + /// + /// Get Duration from Milliseconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromMilliseconds(double milliseconds) + { + double value = (double) milliseconds; + return new Duration(value, DurationUnit.Millisecond); + } + /// + /// Get Duration from Minutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromMinutes(double minutes) + { + double value = (double) minutes; + return new Duration(value, DurationUnit.Minute); + } + /// + /// Get Duration from Months30. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromMonths30(double months30) + { + double value = (double) months30; + return new Duration(value, DurationUnit.Month30); + } + /// + /// Get Duration from Nanoseconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromNanoseconds(double nanoseconds) + { + double value = (double) nanoseconds; + return new Duration(value, DurationUnit.Nanosecond); + } + /// + /// Get Duration from Seconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromSeconds(double seconds) + { + double value = (double) seconds; + return new Duration(value, DurationUnit.Second); + } + /// + /// Get Duration from Weeks. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromWeeks(double weeks) + { + double value = (double) weeks; + return new Duration(value, DurationUnit.Week); + } + /// + /// Get Duration from Years365. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Duration FromYears365(double years365) + { + double value = (double) years365; + return new Duration(value, DurationUnit.Year365); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Duration unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Duration From(double value, DurationUnit fromUnit) + { + return new Duration((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Duration Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Duration Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Duration result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Duration result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DurationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static DurationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out DurationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DurationUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Duration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); + + return CompareTo((Duration)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Duration other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Duration within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Duration. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(DurationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Duration to another Duration with the unit representation . + /// + /// A Duration with the specified unit. + public Duration ToUnit(DurationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Duration(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case DurationUnit.Day: return _value*24*3600; + case DurationUnit.Hour: return _value*3600; + case DurationUnit.Microsecond: return (_value) * 1e-6d; + case DurationUnit.Millisecond: return (_value) * 1e-3d; + case DurationUnit.Minute: return _value*60; + case DurationUnit.Month30: return _value*30*24*3600; + case DurationUnit.Nanosecond: return (_value) * 1e-9d; + case DurationUnit.Second: return _value; + case DurationUnit.Week: return _value*7*24*3600; + case DurationUnit.Year365: return _value*365*24*3600; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(DurationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case DurationUnit.Day: return baseUnitValue/(24*3600); + case DurationUnit.Hour: return baseUnitValue/3600; + case DurationUnit.Microsecond: return (baseUnitValue) / 1e-6d; + case DurationUnit.Millisecond: return (baseUnitValue) / 1e-3d; + case DurationUnit.Minute: return baseUnitValue/60; + case DurationUnit.Month30: return baseUnitValue/(30*24*3600); + case DurationUnit.Nanosecond: return (baseUnitValue) / 1e-9d; + case DurationUnit.Second: return baseUnitValue; + case DurationUnit.Week: return baseUnitValue/(7*24*3600); + case DurationUnit.Year365: return baseUnitValue/(365*24*3600); + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..4faa9c6a73 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,658 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The dynamic (shear) viscosity of a fluid expresses its resistance to shearing flows, where adjacent layers move parallel to each other with different speeds + /// + /// + /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class DynamicViscosity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly DynamicViscosityUnit? _unit; + + static DynamicViscosity() + { + BaseDimensions = new BaseDimensions(-1, 1, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public DynamicViscosity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private DynamicViscosity(double numericValue, DynamicViscosityUnit unit) + { + if(unit == DynamicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of DynamicViscosity, which is NewtonSecondPerMeterSquared. All conversions go via this value. + /// + public static DynamicViscosityUnit BaseUnit => DynamicViscosityUnit.NewtonSecondPerMeterSquared; + + /// + /// Represents the largest possible value of DynamicViscosity + /// + public static DynamicViscosity MaxValue => new DynamicViscosity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of DynamicViscosity + /// + public static DynamicViscosity MinValue => new DynamicViscosity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.DynamicViscosity; + + /// + /// All units of measurement for the DynamicViscosity quantity. + /// + public static DynamicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(DynamicViscosityUnit)).Cast().Except(new DynamicViscosityUnit[]{ DynamicViscosityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. + /// + public static DynamicViscosity Zero => new DynamicViscosity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public DynamicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => DynamicViscosity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => DynamicViscosity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get DynamicViscosity in Centipoise. + /// + public double Centipoise => As(DynamicViscosityUnit.Centipoise); + + /// + /// Get DynamicViscosity in MicropascalSeconds. + /// + public double MicropascalSeconds => As(DynamicViscosityUnit.MicropascalSecond); + + /// + /// Get DynamicViscosity in MillipascalSeconds. + /// + public double MillipascalSeconds => As(DynamicViscosityUnit.MillipascalSecond); + + /// + /// Get DynamicViscosity in NewtonSecondsPerMeterSquared. + /// + public double NewtonSecondsPerMeterSquared => As(DynamicViscosityUnit.NewtonSecondPerMeterSquared); + + /// + /// Get DynamicViscosity in PascalSeconds. + /// + public double PascalSeconds => As(DynamicViscosityUnit.PascalSecond); + + /// + /// Get DynamicViscosity in Poise. + /// + public double Poise => As(DynamicViscosityUnit.Poise); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(DynamicViscosityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get DynamicViscosity from Centipoise. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static DynamicViscosity FromCentipoise(double centipoise) + { + double value = (double) centipoise; + return new DynamicViscosity(value, DynamicViscosityUnit.Centipoise); + } + /// + /// Get DynamicViscosity from MicropascalSeconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static DynamicViscosity FromMicropascalSeconds(double micropascalseconds) + { + double value = (double) micropascalseconds; + return new DynamicViscosity(value, DynamicViscosityUnit.MicropascalSecond); + } + /// + /// Get DynamicViscosity from MillipascalSeconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static DynamicViscosity FromMillipascalSeconds(double millipascalseconds) + { + double value = (double) millipascalseconds; + return new DynamicViscosity(value, DynamicViscosityUnit.MillipascalSecond); + } + /// + /// Get DynamicViscosity from NewtonSecondsPerMeterSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static DynamicViscosity FromNewtonSecondsPerMeterSquared(double newtonsecondspermetersquared) + { + double value = (double) newtonsecondspermetersquared; + return new DynamicViscosity(value, DynamicViscosityUnit.NewtonSecondPerMeterSquared); + } + /// + /// Get DynamicViscosity from PascalSeconds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static DynamicViscosity FromPascalSeconds(double pascalseconds) + { + double value = (double) pascalseconds; + return new DynamicViscosity(value, DynamicViscosityUnit.PascalSecond); + } + /// + /// Get DynamicViscosity from Poise. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static DynamicViscosity FromPoise(double poise) + { + double value = (double) poise; + return new DynamicViscosity(value, DynamicViscosityUnit.Poise); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// DynamicViscosity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static DynamicViscosity From(double value, DynamicViscosityUnit fromUnit) + { + return new DynamicViscosity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static DynamicViscosity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static DynamicViscosity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out DynamicViscosity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DynamicViscosityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static DynamicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out DynamicViscosityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out DynamicViscosityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is DynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); + + return CompareTo((DynamicViscosity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(DynamicViscosity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another DynamicViscosity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current DynamicViscosity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(DynamicViscosityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this DynamicViscosity to another DynamicViscosity with the unit representation . + /// + /// A DynamicViscosity with the specified unit. + public DynamicViscosity ToUnit(DynamicViscosityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new DynamicViscosity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case DynamicViscosityUnit.Centipoise: return (_value/10) * 1e-2d; + case DynamicViscosityUnit.MicropascalSecond: return (_value) * 1e-6d; + case DynamicViscosityUnit.MillipascalSecond: return (_value) * 1e-3d; + case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return _value; + case DynamicViscosityUnit.PascalSecond: return _value; + case DynamicViscosityUnit.Poise: return _value/10; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(DynamicViscosityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case DynamicViscosityUnit.Centipoise: return (baseUnitValue*10) / 1e-2d; + case DynamicViscosityUnit.MicropascalSecond: return (baseUnitValue) / 1e-6d; + case DynamicViscosityUnit.MillipascalSecond: return (baseUnitValue) / 1e-3d; + case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return baseUnitValue; + case DynamicViscosityUnit.PascalSecond: return baseUnitValue; + case DynamicViscosityUnit.Poise: return baseUnitValue*10; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..42f0c6faaa --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,621 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricAdmittance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricAdmittanceUnit? _unit; + + static ElectricAdmittance() + { + BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Siemens. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricAdmittance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit) + { + if(unit == ElectricAdmittanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricAdmittance, which is Siemens. All conversions go via this value. + /// + public static ElectricAdmittanceUnit BaseUnit => ElectricAdmittanceUnit.Siemens; + + /// + /// Represents the largest possible value of ElectricAdmittance + /// + public static ElectricAdmittance MaxValue => new ElectricAdmittance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricAdmittance + /// + public static ElectricAdmittance MinValue => new ElectricAdmittance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricAdmittance; + + /// + /// All units of measurement for the ElectricAdmittance quantity. + /// + public static ElectricAdmittanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricAdmittanceUnit)).Cast().Except(new ElectricAdmittanceUnit[]{ ElectricAdmittanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. + /// + public static ElectricAdmittance Zero => new ElectricAdmittance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricAdmittanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricAdmittance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricAdmittance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricAdmittance in Microsiemens. + /// + public double Microsiemens => As(ElectricAdmittanceUnit.Microsiemens); + + /// + /// Get ElectricAdmittance in Millisiemens. + /// + public double Millisiemens => As(ElectricAdmittanceUnit.Millisiemens); + + /// + /// Get ElectricAdmittance in Nanosiemens. + /// + public double Nanosiemens => As(ElectricAdmittanceUnit.Nanosiemens); + + /// + /// Get ElectricAdmittance in Siemens. + /// + public double Siemens => As(ElectricAdmittanceUnit.Siemens); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricAdmittanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricAdmittance from Microsiemens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricAdmittance FromMicrosiemens(double microsiemens) + { + double value = (double) microsiemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Microsiemens); + } + /// + /// Get ElectricAdmittance from Millisiemens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricAdmittance FromMillisiemens(double millisiemens) + { + double value = (double) millisiemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Millisiemens); + } + /// + /// Get ElectricAdmittance from Nanosiemens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricAdmittance FromNanosiemens(double nanosiemens) + { + double value = (double) nanosiemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Nanosiemens); + } + /// + /// Get ElectricAdmittance from Siemens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricAdmittance FromSiemens(double siemens) + { + double value = (double) siemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Siemens); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricAdmittance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricAdmittance From(double value, ElectricAdmittanceUnit fromUnit) + { + return new ElectricAdmittance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricAdmittance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricAdmittance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricAdmittance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricAdmittance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricAdmittanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricAdmittanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricAdmittanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricAdmittanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); + + return CompareTo((ElectricAdmittance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricAdmittance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricAdmittance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricAdmittance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricAdmittanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricAdmittance to another ElectricAdmittance with the unit representation . + /// + /// A ElectricAdmittance with the specified unit. + public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricAdmittance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricAdmittanceUnit.Microsiemens: return (_value) * 1e-6d; + case ElectricAdmittanceUnit.Millisiemens: return (_value) * 1e-3d; + case ElectricAdmittanceUnit.Nanosiemens: return (_value) * 1e-9d; + case ElectricAdmittanceUnit.Siemens: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricAdmittanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricAdmittanceUnit.Microsiemens: return (baseUnitValue) / 1e-6d; + case ElectricAdmittanceUnit.Millisiemens: return (baseUnitValue) / 1e-3d; + case ElectricAdmittanceUnit.Nanosiemens: return (baseUnitValue) / 1e-9d; + case ElectricAdmittanceUnit.Siemens: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..a3f707e4d3 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electric charge is the physical property of matter that causes it to experience a force when placed in an electromagnetic field. + /// + /// + /// https://en.wikipedia.org/wiki/Electric_charge + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricCharge : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricChargeUnit? _unit; + + static ElectricCharge() + { + BaseDimensions = new BaseDimensions(0, 0, 1, 1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Coulomb. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricCharge() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricCharge(double numericValue, ElectricChargeUnit unit) + { + if(unit == ElectricChargeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCharge, which is Coulomb. All conversions go via this value. + /// + public static ElectricChargeUnit BaseUnit => ElectricChargeUnit.Coulomb; + + /// + /// Represents the largest possible value of ElectricCharge + /// + public static ElectricCharge MaxValue => new ElectricCharge(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCharge + /// + public static ElectricCharge MinValue => new ElectricCharge(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCharge; + + /// + /// All units of measurement for the ElectricCharge quantity. + /// + public static ElectricChargeUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeUnit)).Cast().Except(new ElectricChargeUnit[]{ ElectricChargeUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Coulomb. + /// + public static ElectricCharge Zero => new ElectricCharge(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricChargeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCharge.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCharge.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCharge in Coulombs. + /// + public double Coulombs => As(ElectricChargeUnit.Coulomb); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricChargeUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCharge from Coulombs. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCharge FromCoulombs(double coulombs) + { + double value = (double) coulombs; + return new ElectricCharge(value, ElectricChargeUnit.Coulomb); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCharge unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricCharge From(double value, ElectricChargeUnit fromUnit) + { + return new ElectricCharge((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCharge Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricCharge Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCharge result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCharge result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricChargeUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricChargeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricChargeUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); + + return CompareTo((ElectricCharge)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricCharge other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCharge within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCharge. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricChargeUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCharge to another ElectricCharge with the unit representation . + /// + /// A ElectricCharge with the specified unit. + public ElectricCharge ToUnit(ElectricChargeUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCharge(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricChargeUnit.Coulomb: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricChargeUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricChargeUnit.Coulomb: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..0e81c2f40b --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, charge density is a measure of the amount of electric charge per unit length, surface area, or volume. + /// + /// + /// https://en.wikipedia.org/wiki/Charge_density + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricChargeDensity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricChargeDensityUnit? _unit; + + static ElectricChargeDensity() + { + BaseDimensions = new BaseDimensions(-3, 0, 1, 1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit CoulombPerCubicMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricChargeDensity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit unit) + { + if(unit == ElectricChargeDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricChargeDensity, which is CoulombPerCubicMeter. All conversions go via this value. + /// + public static ElectricChargeDensityUnit BaseUnit => ElectricChargeDensityUnit.CoulombPerCubicMeter; + + /// + /// Represents the largest possible value of ElectricChargeDensity + /// + public static ElectricChargeDensity MaxValue => new ElectricChargeDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricChargeDensity + /// + public static ElectricChargeDensity MinValue => new ElectricChargeDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricChargeDensity; + + /// + /// All units of measurement for the ElectricChargeDensity quantity. + /// + public static ElectricChargeDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeDensityUnit)).Cast().Except(new ElectricChargeDensityUnit[]{ ElectricChargeDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerCubicMeter. + /// + public static ElectricChargeDensity Zero => new ElectricChargeDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricChargeDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricChargeDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricChargeDensity in CoulombsPerCubicMeter. + /// + public double CoulombsPerCubicMeter => As(ElectricChargeDensityUnit.CoulombPerCubicMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricChargeDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricChargeDensity from CoulombsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricChargeDensity FromCoulombsPerCubicMeter(double coulombspercubicmeter) + { + double value = (double) coulombspercubicmeter; + return new ElectricChargeDensity(value, ElectricChargeDensityUnit.CoulombPerCubicMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricChargeDensity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricChargeDensity From(double value, ElectricChargeDensityUnit fromUnit) + { + return new ElectricChargeDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricChargeDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricChargeDensity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricChargeDensity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricChargeDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricChargeDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricChargeDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricChargeDensityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); + + return CompareTo((ElectricChargeDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricChargeDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricChargeDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricChargeDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricChargeDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricChargeDensity to another ElectricChargeDensity with the unit representation . + /// + /// A ElectricChargeDensity with the specified unit. + public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricChargeDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricChargeDensityUnit.CoulombPerCubicMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricChargeDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricChargeDensityUnit.CoulombPerCubicMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..17b4739907 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,607 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The electrical conductance of an electrical conductor is a measure of the easeness to pass an electric current through that conductor. + /// + /// + /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricConductance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricConductanceUnit? _unit; + + static ElectricConductance() + { + BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Siemens. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricConductance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricConductance(double numericValue, ElectricConductanceUnit unit) + { + if(unit == ElectricConductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricConductance, which is Siemens. All conversions go via this value. + /// + public static ElectricConductanceUnit BaseUnit => ElectricConductanceUnit.Siemens; + + /// + /// Represents the largest possible value of ElectricConductance + /// + public static ElectricConductance MaxValue => new ElectricConductance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricConductance + /// + public static ElectricConductance MinValue => new ElectricConductance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricConductance; + + /// + /// All units of measurement for the ElectricConductance quantity. + /// + public static ElectricConductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductanceUnit)).Cast().Except(new ElectricConductanceUnit[]{ ElectricConductanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. + /// + public static ElectricConductance Zero => new ElectricConductance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricConductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricConductance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricConductance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricConductance in Microsiemens. + /// + public double Microsiemens => As(ElectricConductanceUnit.Microsiemens); + + /// + /// Get ElectricConductance in Millisiemens. + /// + public double Millisiemens => As(ElectricConductanceUnit.Millisiemens); + + /// + /// Get ElectricConductance in Siemens. + /// + public double Siemens => As(ElectricConductanceUnit.Siemens); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricConductanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricConductance from Microsiemens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricConductance FromMicrosiemens(double microsiemens) + { + double value = (double) microsiemens; + return new ElectricConductance(value, ElectricConductanceUnit.Microsiemens); + } + /// + /// Get ElectricConductance from Millisiemens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricConductance FromMillisiemens(double millisiemens) + { + double value = (double) millisiemens; + return new ElectricConductance(value, ElectricConductanceUnit.Millisiemens); + } + /// + /// Get ElectricConductance from Siemens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricConductance FromSiemens(double siemens) + { + double value = (double) siemens; + return new ElectricConductance(value, ElectricConductanceUnit.Siemens); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricConductance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricConductance From(double value, ElectricConductanceUnit fromUnit) + { + return new ElectricConductance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricConductance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricConductance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricConductance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricConductanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricConductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricConductanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); + + return CompareTo((ElectricConductance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricConductance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricConductance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricConductance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricConductanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricConductance to another ElectricConductance with the unit representation . + /// + /// A ElectricConductance with the specified unit. + public ElectricConductance ToUnit(ElectricConductanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricConductance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricConductanceUnit.Microsiemens: return (_value) * 1e-6d; + case ElectricConductanceUnit.Millisiemens: return (_value) * 1e-3d; + case ElectricConductanceUnit.Siemens: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricConductanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricConductanceUnit.Microsiemens: return (baseUnitValue) / 1e-6d; + case ElectricConductanceUnit.Millisiemens: return (baseUnitValue) / 1e-3d; + case ElectricConductanceUnit.Siemens: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..5f0854098d --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electrical conductivity or specific conductance is the reciprocal of electrical resistivity, and measures a material's ability to conduct an electric current. + /// + /// + /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricConductivity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricConductivityUnit? _unit; + + static ElectricConductivity() + { + BaseDimensions = new BaseDimensions(-3, -1, 3, 2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit SiemensPerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricConductivity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricConductivity(double numericValue, ElectricConductivityUnit unit) + { + if(unit == ElectricConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricConductivity, which is SiemensPerMeter. All conversions go via this value. + /// + public static ElectricConductivityUnit BaseUnit => ElectricConductivityUnit.SiemensPerMeter; + + /// + /// Represents the largest possible value of ElectricConductivity + /// + public static ElectricConductivity MaxValue => new ElectricConductivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricConductivity + /// + public static ElectricConductivity MinValue => new ElectricConductivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricConductivity; + + /// + /// All units of measurement for the ElectricConductivity quantity. + /// + public static ElectricConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductivityUnit)).Cast().Except(new ElectricConductivityUnit[]{ ElectricConductivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SiemensPerMeter. + /// + public static ElectricConductivity Zero => new ElectricConductivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricConductivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricConductivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricConductivity in SiemensPerMeter. + /// + public double SiemensPerMeter => As(ElectricConductivityUnit.SiemensPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricConductivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricConductivity from SiemensPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricConductivity FromSiemensPerMeter(double siemenspermeter) + { + double value = (double) siemenspermeter; + return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricConductivity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricConductivity From(double value, ElectricConductivityUnit fromUnit) + { + return new ElectricConductivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricConductivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricConductivity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricConductivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricConductivity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricConductivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricConductivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricConductivityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); + + return CompareTo((ElectricConductivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricConductivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricConductivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricConductivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricConductivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricConductivity to another ElectricConductivity with the unit representation . + /// + /// A ElectricConductivity with the specified unit. + public ElectricConductivity ToUnit(ElectricConductivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricConductivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricConductivityUnit.SiemensPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricConductivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricConductivityUnit.SiemensPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..922de73b93 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -0,0 +1,689 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricCurrent : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricCurrentUnit? _unit; + + static ElectricCurrent() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Ampere. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricCurrent() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricCurrent(double numericValue, ElectricCurrentUnit unit) + { + if(unit == ElectricCurrentUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCurrent, which is Ampere. All conversions go via this value. + /// + public static ElectricCurrentUnit BaseUnit => ElectricCurrentUnit.Ampere; + + /// + /// Represents the largest possible value of ElectricCurrent + /// + public static ElectricCurrent MaxValue => new ElectricCurrent(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCurrent + /// + public static ElectricCurrent MinValue => new ElectricCurrent(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCurrent; + + /// + /// All units of measurement for the ElectricCurrent quantity. + /// + public static ElectricCurrentUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentUnit)).Cast().Except(new ElectricCurrentUnit[]{ ElectricCurrentUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Ampere. + /// + public static ElectricCurrent Zero => new ElectricCurrent(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricCurrentUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrent.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrent.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCurrent in Amperes. + /// + public double Amperes => As(ElectricCurrentUnit.Ampere); + + /// + /// Get ElectricCurrent in Centiamperes. + /// + public double Centiamperes => As(ElectricCurrentUnit.Centiampere); + + /// + /// Get ElectricCurrent in Kiloamperes. + /// + public double Kiloamperes => As(ElectricCurrentUnit.Kiloampere); + + /// + /// Get ElectricCurrent in Megaamperes. + /// + public double Megaamperes => As(ElectricCurrentUnit.Megaampere); + + /// + /// Get ElectricCurrent in Microamperes. + /// + public double Microamperes => As(ElectricCurrentUnit.Microampere); + + /// + /// Get ElectricCurrent in Milliamperes. + /// + public double Milliamperes => As(ElectricCurrentUnit.Milliampere); + + /// + /// Get ElectricCurrent in Nanoamperes. + /// + public double Nanoamperes => As(ElectricCurrentUnit.Nanoampere); + + /// + /// Get ElectricCurrent in Picoamperes. + /// + public double Picoamperes => As(ElectricCurrentUnit.Picoampere); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricCurrentUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCurrent from Amperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromAmperes(double amperes) + { + double value = (double) amperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Ampere); + } + /// + /// Get ElectricCurrent from Centiamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromCentiamperes(double centiamperes) + { + double value = (double) centiamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Centiampere); + } + /// + /// Get ElectricCurrent from Kiloamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromKiloamperes(double kiloamperes) + { + double value = (double) kiloamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Kiloampere); + } + /// + /// Get ElectricCurrent from Megaamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromMegaamperes(double megaamperes) + { + double value = (double) megaamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Megaampere); + } + /// + /// Get ElectricCurrent from Microamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromMicroamperes(double microamperes) + { + double value = (double) microamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Microampere); + } + /// + /// Get ElectricCurrent from Milliamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromMilliamperes(double milliamperes) + { + double value = (double) milliamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Milliampere); + } + /// + /// Get ElectricCurrent from Nanoamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromNanoamperes(double nanoamperes) + { + double value = (double) nanoamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Nanoampere); + } + /// + /// Get ElectricCurrent from Picoamperes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrent FromPicoamperes(double picoamperes) + { + double value = (double) picoamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Picoampere); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCurrent unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricCurrent From(double value, ElectricCurrentUnit fromUnit) + { + return new ElectricCurrent((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCurrent Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricCurrent Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrent result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricCurrentUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); + + return CompareTo((ElectricCurrent)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricCurrent other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCurrent within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCurrent. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricCurrentUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCurrent to another ElectricCurrent with the unit representation . + /// + /// A ElectricCurrent with the specified unit. + public ElectricCurrent ToUnit(ElectricCurrentUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCurrent(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricCurrentUnit.Ampere: return _value; + case ElectricCurrentUnit.Centiampere: return (_value) * 1e-2d; + case ElectricCurrentUnit.Kiloampere: return (_value) * 1e3d; + case ElectricCurrentUnit.Megaampere: return (_value) * 1e6d; + case ElectricCurrentUnit.Microampere: return (_value) * 1e-6d; + case ElectricCurrentUnit.Milliampere: return (_value) * 1e-3d; + case ElectricCurrentUnit.Nanoampere: return (_value) * 1e-9d; + case ElectricCurrentUnit.Picoampere: return (_value) * 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricCurrentUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricCurrentUnit.Ampere: return baseUnitValue; + case ElectricCurrentUnit.Centiampere: return (baseUnitValue) / 1e-2d; + case ElectricCurrentUnit.Kiloampere: return (baseUnitValue) / 1e3d; + case ElectricCurrentUnit.Megaampere: return (baseUnitValue) / 1e6d; + case ElectricCurrentUnit.Microampere: return (baseUnitValue) / 1e-6d; + case ElectricCurrentUnit.Milliampere: return (baseUnitValue) / 1e-3d; + case ElectricCurrentUnit.Nanoampere: return (baseUnitValue) / 1e-9d; + case ElectricCurrentUnit.Picoampere: return (baseUnitValue) / 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..43963d75d5 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, current density is the electric current per unit area of cross section. + /// + /// + /// https://en.wikipedia.org/wiki/Current_density + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricCurrentDensity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricCurrentDensityUnit? _unit; + + static ElectricCurrentDensity() + { + BaseDimensions = new BaseDimensions(-2, 0, 0, 1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit AmperePerSquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricCurrentDensity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricCurrentDensity(double numericValue, ElectricCurrentDensityUnit unit) + { + if(unit == ElectricCurrentDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCurrentDensity, which is AmperePerSquareMeter. All conversions go via this value. + /// + public static ElectricCurrentDensityUnit BaseUnit => ElectricCurrentDensityUnit.AmperePerSquareMeter; + + /// + /// Represents the largest possible value of ElectricCurrentDensity + /// + public static ElectricCurrentDensity MaxValue => new ElectricCurrentDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCurrentDensity + /// + public static ElectricCurrentDensity MinValue => new ElectricCurrentDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCurrentDensity; + + /// + /// All units of measurement for the ElectricCurrentDensity quantity. + /// + public static ElectricCurrentDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentDensityUnit)).Cast().Except(new ElectricCurrentDensityUnit[]{ ElectricCurrentDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSquareMeter. + /// + public static ElectricCurrentDensity Zero => new ElectricCurrentDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricCurrentDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrentDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrentDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCurrentDensity in AmperesPerSquareMeter. + /// + public double AmperesPerSquareMeter => As(ElectricCurrentDensityUnit.AmperePerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricCurrentDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCurrentDensity from AmperesPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrentDensity FromAmperesPerSquareMeter(double amperespersquaremeter) + { + double value = (double) amperespersquaremeter; + return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCurrentDensity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricCurrentDensity From(double value, ElectricCurrentDensityUnit fromUnit) + { + return new ElectricCurrentDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCurrentDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentDensity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentDensity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricCurrentDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentDensityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); + + return CompareTo((ElectricCurrentDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricCurrentDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCurrentDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCurrentDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricCurrentDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCurrentDensity to another ElectricCurrentDensity with the unit representation . + /// + /// A ElectricCurrentDensity with the specified unit. + public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCurrentDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricCurrentDensityUnit.AmperePerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricCurrentDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricCurrentDensityUnit.AmperePerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..88ea70ce25 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -0,0 +1,570 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, the current gradient describes how the current changes in time. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricCurrentGradient : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricCurrentGradientUnit? _unit; + + static ElectricCurrentGradient() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit AmperePerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricCurrentGradient() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricCurrentGradient(double numericValue, ElectricCurrentGradientUnit unit) + { + if(unit == ElectricCurrentGradientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCurrentGradient, which is AmperePerSecond. All conversions go via this value. + /// + public static ElectricCurrentGradientUnit BaseUnit => ElectricCurrentGradientUnit.AmperePerSecond; + + /// + /// Represents the largest possible value of ElectricCurrentGradient + /// + public static ElectricCurrentGradient MaxValue => new ElectricCurrentGradient(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCurrentGradient + /// + public static ElectricCurrentGradient MinValue => new ElectricCurrentGradient(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCurrentGradient; + + /// + /// All units of measurement for the ElectricCurrentGradient quantity. + /// + public static ElectricCurrentGradientUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentGradientUnit)).Cast().Except(new ElectricCurrentGradientUnit[]{ ElectricCurrentGradientUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSecond. + /// + public static ElectricCurrentGradient Zero => new ElectricCurrentGradient(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricCurrentGradientUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrentGradient.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrentGradient.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCurrentGradient in AmperesPerSecond. + /// + public double AmperesPerSecond => As(ElectricCurrentGradientUnit.AmperePerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricCurrentGradientUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCurrentGradient from AmperesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricCurrentGradient FromAmperesPerSecond(double amperespersecond) + { + double value = (double) amperespersecond; + return new ElectricCurrentGradient(value, ElectricCurrentGradientUnit.AmperePerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCurrentGradient unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricCurrentGradient From(double value, ElectricCurrentGradientUnit fromUnit) + { + return new ElectricCurrentGradient((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCurrentGradient Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentGradient Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricCurrentGradient result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentGradientUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentGradientUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricCurrentGradientUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricCurrentGradientUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); + + return CompareTo((ElectricCurrentGradient)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricCurrentGradient other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCurrentGradient within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCurrentGradient. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricCurrentGradientUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCurrentGradient to another ElectricCurrentGradient with the unit representation . + /// + /// A ElectricCurrentGradient with the specified unit. + public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCurrentGradient(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricCurrentGradientUnit.AmperePerSecond: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricCurrentGradientUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricCurrentGradientUnit.AmperePerSecond: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..7fc78e14f1 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// An electric field is a force field that surrounds electric charges that attracts or repels other electric charges. + /// + /// + /// https://en.wikipedia.org/wiki/Electric_field + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricField : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricFieldUnit? _unit; + + static ElectricField() + { + BaseDimensions = new BaseDimensions(1, 1, -3, -1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit VoltPerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricField() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricField(double numericValue, ElectricFieldUnit unit) + { + if(unit == ElectricFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricField, which is VoltPerMeter. All conversions go via this value. + /// + public static ElectricFieldUnit BaseUnit => ElectricFieldUnit.VoltPerMeter; + + /// + /// Represents the largest possible value of ElectricField + /// + public static ElectricField MaxValue => new ElectricField(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricField + /// + public static ElectricField MinValue => new ElectricField(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricField; + + /// + /// All units of measurement for the ElectricField quantity. + /// + public static ElectricFieldUnit[] Units { get; } = Enum.GetValues(typeof(ElectricFieldUnit)).Cast().Except(new ElectricFieldUnit[]{ ElectricFieldUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltPerMeter. + /// + public static ElectricField Zero => new ElectricField(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricField.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricField.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricField in VoltsPerMeter. + /// + public double VoltsPerMeter => As(ElectricFieldUnit.VoltPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricFieldUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricField from VoltsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricField FromVoltsPerMeter(double voltspermeter) + { + double value = (double) voltspermeter; + return new ElectricField(value, ElectricFieldUnit.VoltPerMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricField unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricField From(double value, ElectricFieldUnit fromUnit) + { + return new ElectricField((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricField Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricField Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricField result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricField result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricFieldUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricFieldUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricFieldUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); + + return CompareTo((ElectricField)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricField other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricField within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricField. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricFieldUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricField to another ElectricField with the unit representation . + /// + /// A ElectricField with the specified unit. + public ElectricField ToUnit(ElectricFieldUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricField(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricFieldUnit.VoltPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricFieldUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricFieldUnit.VoltPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..903a89b9d4 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Inductance is a property of an electrical conductor which opposes a change in current. + /// + /// + /// https://en.wikipedia.org/wiki/Inductance + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricInductance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricInductanceUnit? _unit; + + static ElectricInductance() + { + BaseDimensions = new BaseDimensions(2, 1, -2, -2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Henry. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricInductance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricInductance(double numericValue, ElectricInductanceUnit unit) + { + if(unit == ElectricInductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricInductance, which is Henry. All conversions go via this value. + /// + public static ElectricInductanceUnit BaseUnit => ElectricInductanceUnit.Henry; + + /// + /// Represents the largest possible value of ElectricInductance + /// + public static ElectricInductance MaxValue => new ElectricInductance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricInductance + /// + public static ElectricInductance MinValue => new ElectricInductance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricInductance; + + /// + /// All units of measurement for the ElectricInductance quantity. + /// + public static ElectricInductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricInductanceUnit)).Cast().Except(new ElectricInductanceUnit[]{ ElectricInductanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Henry. + /// + public static ElectricInductance Zero => new ElectricInductance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricInductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricInductance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricInductance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricInductance in Henries. + /// + public double Henries => As(ElectricInductanceUnit.Henry); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricInductanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricInductance from Henries. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricInductance FromHenries(double henries) + { + double value = (double) henries; + return new ElectricInductance(value, ElectricInductanceUnit.Henry); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricInductance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricInductance From(double value, ElectricInductanceUnit fromUnit) + { + return new ElectricInductance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricInductance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricInductance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricInductance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricInductance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricInductanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricInductanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricInductanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricInductanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); + + return CompareTo((ElectricInductance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricInductance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricInductance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricInductance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricInductanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricInductance to another ElectricInductance with the unit representation . + /// + /// A ElectricInductance with the specified unit. + public ElectricInductance ToUnit(ElectricInductanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricInductance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricInductanceUnit.Henry: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricInductanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricInductanceUnit.Henry: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..d908ead398 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -0,0 +1,638 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricPotential : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricPotentialUnit? _unit; + + static ElectricPotential() + { + BaseDimensions = new BaseDimensions(2, 1, -3, -1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Volt. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricPotential() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricPotential(double numericValue, ElectricPotentialUnit unit) + { + if(unit == ElectricPotentialUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricPotential, which is Volt. All conversions go via this value. + /// + public static ElectricPotentialUnit BaseUnit => ElectricPotentialUnit.Volt; + + /// + /// Represents the largest possible value of ElectricPotential + /// + public static ElectricPotential MaxValue => new ElectricPotential(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricPotential + /// + public static ElectricPotential MinValue => new ElectricPotential(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricPotential; + + /// + /// All units of measurement for the ElectricPotential quantity. + /// + public static ElectricPotentialUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialUnit)).Cast().Except(new ElectricPotentialUnit[]{ ElectricPotentialUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Volt. + /// + public static ElectricPotential Zero => new ElectricPotential(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricPotentialUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotential.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotential.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricPotential in Kilovolts. + /// + public double Kilovolts => As(ElectricPotentialUnit.Kilovolt); + + /// + /// Get ElectricPotential in Megavolts. + /// + public double Megavolts => As(ElectricPotentialUnit.Megavolt); + + /// + /// Get ElectricPotential in Microvolts. + /// + public double Microvolts => As(ElectricPotentialUnit.Microvolt); + + /// + /// Get ElectricPotential in Millivolts. + /// + public double Millivolts => As(ElectricPotentialUnit.Millivolt); + + /// + /// Get ElectricPotential in Volts. + /// + public double Volts => As(ElectricPotentialUnit.Volt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricPotentialUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricPotential from Kilovolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotential FromKilovolts(double kilovolts) + { + double value = (double) kilovolts; + return new ElectricPotential(value, ElectricPotentialUnit.Kilovolt); + } + /// + /// Get ElectricPotential from Megavolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotential FromMegavolts(double megavolts) + { + double value = (double) megavolts; + return new ElectricPotential(value, ElectricPotentialUnit.Megavolt); + } + /// + /// Get ElectricPotential from Microvolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotential FromMicrovolts(double microvolts) + { + double value = (double) microvolts; + return new ElectricPotential(value, ElectricPotentialUnit.Microvolt); + } + /// + /// Get ElectricPotential from Millivolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotential FromMillivolts(double millivolts) + { + double value = (double) millivolts; + return new ElectricPotential(value, ElectricPotentialUnit.Millivolt); + } + /// + /// Get ElectricPotential from Volts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotential FromVolts(double volts) + { + double value = (double) volts; + return new ElectricPotential(value, ElectricPotentialUnit.Volt); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricPotential unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricPotential From(double value, ElectricPotentialUnit fromUnit) + { + return new ElectricPotential((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricPotential Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricPotential Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricPotential result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotential result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricPotentialUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); + + return CompareTo((ElectricPotential)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricPotential other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricPotential within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricPotential. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricPotentialUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricPotential to another ElectricPotential with the unit representation . + /// + /// A ElectricPotential with the specified unit. + public ElectricPotential ToUnit(ElectricPotentialUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricPotential(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricPotentialUnit.Kilovolt: return (_value) * 1e3d; + case ElectricPotentialUnit.Megavolt: return (_value) * 1e6d; + case ElectricPotentialUnit.Microvolt: return (_value) * 1e-6d; + case ElectricPotentialUnit.Millivolt: return (_value) * 1e-3d; + case ElectricPotentialUnit.Volt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricPotentialUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricPotentialUnit.Kilovolt: return (baseUnitValue) / 1e3d; + case ElectricPotentialUnit.Megavolt: return (baseUnitValue) / 1e6d; + case ElectricPotentialUnit.Microvolt: return (baseUnitValue) / 1e-6d; + case ElectricPotentialUnit.Millivolt: return (baseUnitValue) / 1e-3d; + case ElectricPotentialUnit.Volt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..449568468e --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -0,0 +1,638 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Electric Potential of a system known to use Alternating Current. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricPotentialAc : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricPotentialAcUnit? _unit; + + static ElectricPotentialAc() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit VoltAc. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricPotentialAc() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricPotentialAc(double numericValue, ElectricPotentialAcUnit unit) + { + if(unit == ElectricPotentialAcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricPotentialAc, which is VoltAc. All conversions go via this value. + /// + public static ElectricPotentialAcUnit BaseUnit => ElectricPotentialAcUnit.VoltAc; + + /// + /// Represents the largest possible value of ElectricPotentialAc + /// + public static ElectricPotentialAc MaxValue => new ElectricPotentialAc(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricPotentialAc + /// + public static ElectricPotentialAc MinValue => new ElectricPotentialAc(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricPotentialAc; + + /// + /// All units of measurement for the ElectricPotentialAc quantity. + /// + public static ElectricPotentialAcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialAcUnit)).Cast().Except(new ElectricPotentialAcUnit[]{ ElectricPotentialAcUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltAc. + /// + public static ElectricPotentialAc Zero => new ElectricPotentialAc(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricPotentialAcUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotentialAc.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotentialAc.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricPotentialAc in KilovoltsAc. + /// + public double KilovoltsAc => As(ElectricPotentialAcUnit.KilovoltAc); + + /// + /// Get ElectricPotentialAc in MegavoltsAc. + /// + public double MegavoltsAc => As(ElectricPotentialAcUnit.MegavoltAc); + + /// + /// Get ElectricPotentialAc in MicrovoltsAc. + /// + public double MicrovoltsAc => As(ElectricPotentialAcUnit.MicrovoltAc); + + /// + /// Get ElectricPotentialAc in MillivoltsAc. + /// + public double MillivoltsAc => As(ElectricPotentialAcUnit.MillivoltAc); + + /// + /// Get ElectricPotentialAc in VoltsAc. + /// + public double VoltsAc => As(ElectricPotentialAcUnit.VoltAc); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricPotentialAcUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricPotentialAc from KilovoltsAc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialAc FromKilovoltsAc(double kilovoltsac) + { + double value = (double) kilovoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.KilovoltAc); + } + /// + /// Get ElectricPotentialAc from MegavoltsAc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialAc FromMegavoltsAc(double megavoltsac) + { + double value = (double) megavoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MegavoltAc); + } + /// + /// Get ElectricPotentialAc from MicrovoltsAc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialAc FromMicrovoltsAc(double microvoltsac) + { + double value = (double) microvoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MicrovoltAc); + } + /// + /// Get ElectricPotentialAc from MillivoltsAc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialAc FromMillivoltsAc(double millivoltsac) + { + double value = (double) millivoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MillivoltAc); + } + /// + /// Get ElectricPotentialAc from VoltsAc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialAc FromVoltsAc(double voltsac) + { + double value = (double) voltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.VoltAc); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricPotentialAc unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricPotentialAc From(double value, ElectricPotentialAcUnit fromUnit) + { + return new ElectricPotentialAc((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricPotentialAc Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialAc Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialAc result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialAcUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialAcUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricPotentialAcUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialAcUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); + + return CompareTo((ElectricPotentialAc)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricPotentialAc other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricPotentialAc within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricPotentialAc. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricPotentialAcUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricPotentialAc to another ElectricPotentialAc with the unit representation . + /// + /// A ElectricPotentialAc with the specified unit. + public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricPotentialAc(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricPotentialAcUnit.KilovoltAc: return (_value) * 1e3d; + case ElectricPotentialAcUnit.MegavoltAc: return (_value) * 1e6d; + case ElectricPotentialAcUnit.MicrovoltAc: return (_value) * 1e-6d; + case ElectricPotentialAcUnit.MillivoltAc: return (_value) * 1e-3d; + case ElectricPotentialAcUnit.VoltAc: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricPotentialAcUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricPotentialAcUnit.KilovoltAc: return (baseUnitValue) / 1e3d; + case ElectricPotentialAcUnit.MegavoltAc: return (baseUnitValue) / 1e6d; + case ElectricPotentialAcUnit.MicrovoltAc: return (baseUnitValue) / 1e-6d; + case ElectricPotentialAcUnit.MillivoltAc: return (baseUnitValue) / 1e-3d; + case ElectricPotentialAcUnit.VoltAc: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..8d64cf696e --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -0,0 +1,638 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Electric Potential of a system known to use Direct Current. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricPotentialDc : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricPotentialDcUnit? _unit; + + static ElectricPotentialDc() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit VoltDc. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricPotentialDc() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricPotentialDc(double numericValue, ElectricPotentialDcUnit unit) + { + if(unit == ElectricPotentialDcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricPotentialDc, which is VoltDc. All conversions go via this value. + /// + public static ElectricPotentialDcUnit BaseUnit => ElectricPotentialDcUnit.VoltDc; + + /// + /// Represents the largest possible value of ElectricPotentialDc + /// + public static ElectricPotentialDc MaxValue => new ElectricPotentialDc(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricPotentialDc + /// + public static ElectricPotentialDc MinValue => new ElectricPotentialDc(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricPotentialDc; + + /// + /// All units of measurement for the ElectricPotentialDc quantity. + /// + public static ElectricPotentialDcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialDcUnit)).Cast().Except(new ElectricPotentialDcUnit[]{ ElectricPotentialDcUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltDc. + /// + public static ElectricPotentialDc Zero => new ElectricPotentialDc(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricPotentialDcUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotentialDc.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotentialDc.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricPotentialDc in KilovoltsDc. + /// + public double KilovoltsDc => As(ElectricPotentialDcUnit.KilovoltDc); + + /// + /// Get ElectricPotentialDc in MegavoltsDc. + /// + public double MegavoltsDc => As(ElectricPotentialDcUnit.MegavoltDc); + + /// + /// Get ElectricPotentialDc in MicrovoltsDc. + /// + public double MicrovoltsDc => As(ElectricPotentialDcUnit.MicrovoltDc); + + /// + /// Get ElectricPotentialDc in MillivoltsDc. + /// + public double MillivoltsDc => As(ElectricPotentialDcUnit.MillivoltDc); + + /// + /// Get ElectricPotentialDc in VoltsDc. + /// + public double VoltsDc => As(ElectricPotentialDcUnit.VoltDc); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricPotentialDcUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricPotentialDc from KilovoltsDc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialDc FromKilovoltsDc(double kilovoltsdc) + { + double value = (double) kilovoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.KilovoltDc); + } + /// + /// Get ElectricPotentialDc from MegavoltsDc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialDc FromMegavoltsDc(double megavoltsdc) + { + double value = (double) megavoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MegavoltDc); + } + /// + /// Get ElectricPotentialDc from MicrovoltsDc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialDc FromMicrovoltsDc(double microvoltsdc) + { + double value = (double) microvoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MicrovoltDc); + } + /// + /// Get ElectricPotentialDc from MillivoltsDc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialDc FromMillivoltsDc(double millivoltsdc) + { + double value = (double) millivoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MillivoltDc); + } + /// + /// Get ElectricPotentialDc from VoltsDc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricPotentialDc FromVoltsDc(double voltsdc) + { + double value = (double) voltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.VoltDc); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricPotentialDc unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricPotentialDc From(double value, ElectricPotentialDcUnit fromUnit) + { + return new ElectricPotentialDc((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricPotentialDc Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialDc Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricPotentialDc result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialDcUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialDcUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricPotentialDcUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricPotentialDcUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); + + return CompareTo((ElectricPotentialDc)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricPotentialDc other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricPotentialDc within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricPotentialDc. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricPotentialDcUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricPotentialDc to another ElectricPotentialDc with the unit representation . + /// + /// A ElectricPotentialDc with the specified unit. + public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricPotentialDc(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricPotentialDcUnit.KilovoltDc: return (_value) * 1e3d; + case ElectricPotentialDcUnit.MegavoltDc: return (_value) * 1e6d; + case ElectricPotentialDcUnit.MicrovoltDc: return (_value) * 1e-6d; + case ElectricPotentialDcUnit.MillivoltDc: return (_value) * 1e-3d; + case ElectricPotentialDcUnit.VoltDc: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricPotentialDcUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricPotentialDcUnit.KilovoltDc: return (baseUnitValue) / 1e3d; + case ElectricPotentialDcUnit.MegavoltDc: return (baseUnitValue) / 1e6d; + case ElectricPotentialDcUnit.MicrovoltDc: return (baseUnitValue) / 1e-6d; + case ElectricPotentialDcUnit.MillivoltDc: return (baseUnitValue) / 1e-3d; + case ElectricPotentialDcUnit.VoltDc: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..7978859d3d --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,621 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricResistance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricResistanceUnit? _unit; + + static ElectricResistance() + { + BaseDimensions = new BaseDimensions(2, 1, -3, -2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Ohm. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricResistance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricResistance(double numericValue, ElectricResistanceUnit unit) + { + if(unit == ElectricResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricResistance, which is Ohm. All conversions go via this value. + /// + public static ElectricResistanceUnit BaseUnit => ElectricResistanceUnit.Ohm; + + /// + /// Represents the largest possible value of ElectricResistance + /// + public static ElectricResistance MaxValue => new ElectricResistance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricResistance + /// + public static ElectricResistance MinValue => new ElectricResistance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricResistance; + + /// + /// All units of measurement for the ElectricResistance quantity. + /// + public static ElectricResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistanceUnit)).Cast().Except(new ElectricResistanceUnit[]{ ElectricResistanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Ohm. + /// + public static ElectricResistance Zero => new ElectricResistance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricResistance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricResistance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricResistance in Kiloohms. + /// + public double Kiloohms => As(ElectricResistanceUnit.Kiloohm); + + /// + /// Get ElectricResistance in Megaohms. + /// + public double Megaohms => As(ElectricResistanceUnit.Megaohm); + + /// + /// Get ElectricResistance in Milliohms. + /// + public double Milliohms => As(ElectricResistanceUnit.Milliohm); + + /// + /// Get ElectricResistance in Ohms. + /// + public double Ohms => As(ElectricResistanceUnit.Ohm); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricResistanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricResistance from Kiloohms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistance FromKiloohms(double kiloohms) + { + double value = (double) kiloohms; + return new ElectricResistance(value, ElectricResistanceUnit.Kiloohm); + } + /// + /// Get ElectricResistance from Megaohms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistance FromMegaohms(double megaohms) + { + double value = (double) megaohms; + return new ElectricResistance(value, ElectricResistanceUnit.Megaohm); + } + /// + /// Get ElectricResistance from Milliohms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistance FromMilliohms(double milliohms) + { + double value = (double) milliohms; + return new ElectricResistance(value, ElectricResistanceUnit.Milliohm); + } + /// + /// Get ElectricResistance from Ohms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistance FromOhms(double ohms) + { + double value = (double) ohms; + return new ElectricResistance(value, ElectricResistanceUnit.Ohm); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricResistance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricResistance From(double value, ElectricResistanceUnit fromUnit) + { + return new ElectricResistance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricResistance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricResistance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricResistance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricResistanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricResistanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); + + return CompareTo((ElectricResistance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricResistance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricResistance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricResistance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricResistanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricResistance to another ElectricResistance with the unit representation . + /// + /// A ElectricResistance with the specified unit. + public ElectricResistance ToUnit(ElectricResistanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricResistance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricResistanceUnit.Kiloohm: return (_value) * 1e3d; + case ElectricResistanceUnit.Megaohm: return (_value) * 1e6d; + case ElectricResistanceUnit.Milliohm: return (_value) * 1e-3d; + case ElectricResistanceUnit.Ohm: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricResistanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricResistanceUnit.Kiloohm: return (baseUnitValue) / 1e3d; + case ElectricResistanceUnit.Megaohm: return (baseUnitValue) / 1e6d; + case ElectricResistanceUnit.Milliohm: return (baseUnitValue) / 1e-3d; + case ElectricResistanceUnit.Ohm: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..62a12c9d78 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,624 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electrical resistivity (also known as resistivity, specific electrical resistance, or volume resistivity) is a fundamental property that quantifies how strongly a given material opposes the flow of electric current. + /// + /// + /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ElectricResistivity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricResistivityUnit? _unit; + + static ElectricResistivity() + { + BaseDimensions = new BaseDimensions(3, 1, -3, -2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit OhmMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ElectricResistivity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ElectricResistivity(double numericValue, ElectricResistivityUnit unit) + { + if(unit == ElectricResistivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricResistivity, which is OhmMeter. All conversions go via this value. + /// + public static ElectricResistivityUnit BaseUnit => ElectricResistivityUnit.OhmMeter; + + /// + /// Represents the largest possible value of ElectricResistivity + /// + public static ElectricResistivity MaxValue => new ElectricResistivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricResistivity + /// + public static ElectricResistivity MinValue => new ElectricResistivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricResistivity; + + /// + /// All units of measurement for the ElectricResistivity quantity. + /// + public static ElectricResistivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistivityUnit)).Cast().Except(new ElectricResistivityUnit[]{ ElectricResistivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit OhmMeter. + /// + public static ElectricResistivity Zero => new ElectricResistivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricResistivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricResistivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricResistivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricResistivity in MicroohmMeters. + /// + public double MicroohmMeters => As(ElectricResistivityUnit.MicroohmMeter); + + /// + /// Get ElectricResistivity in MilliohmMeters. + /// + public double MilliohmMeters => As(ElectricResistivityUnit.MilliohmMeter); + + /// + /// Get ElectricResistivity in NanoohmMeters. + /// + public double NanoohmMeters => As(ElectricResistivityUnit.NanoohmMeter); + + /// + /// Get ElectricResistivity in OhmMeters. + /// + public double OhmMeters => As(ElectricResistivityUnit.OhmMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricResistivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricResistivity from MicroohmMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistivity FromMicroohmMeters(double microohmmeters) + { + double value = (double) microohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmMeter); + } + /// + /// Get ElectricResistivity from MilliohmMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistivity FromMilliohmMeters(double milliohmmeters) + { + double value = (double) milliohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmMeter); + } + /// + /// Get ElectricResistivity from NanoohmMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistivity FromNanoohmMeters(double nanoohmmeters) + { + double value = (double) nanoohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmMeter); + } + /// + /// Get ElectricResistivity from OhmMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ElectricResistivity FromOhmMeters(double ohmmeters) + { + double value = (double) ohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.OhmMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricResistivity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ElectricResistivity From(double value, ElectricResistivityUnit fromUnit) + { + return new ElectricResistivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricResistivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricResistivity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricResistivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ElectricResistivity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricResistivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ElectricResistivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricResistivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ElectricResistivityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); + + return CompareTo((ElectricResistivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ElectricResistivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricResistivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricResistivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricResistivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricResistivity to another ElectricResistivity with the unit representation . + /// + /// A ElectricResistivity with the specified unit. + public ElectricResistivity ToUnit(ElectricResistivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricResistivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricResistivityUnit.MicroohmMeter: return (_value) * 1e-6d; + case ElectricResistivityUnit.MilliohmMeter: return (_value) * 1e-3d; + case ElectricResistivityUnit.NanoohmMeter: return (_value) * 1e-9d; + case ElectricResistivityUnit.OhmMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricResistivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricResistivityUnit.MicroohmMeter: return (baseUnitValue) / 1e-6d; + case ElectricResistivityUnit.MilliohmMeter: return (baseUnitValue) / 1e-3d; + case ElectricResistivityUnit.NanoohmMeter: return (baseUnitValue) / 1e-9d; + case ElectricResistivityUnit.OhmMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..1a019820bd --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,927 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Energy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly EnergyUnit? _unit; + + static Energy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Joule. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Energy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Energy(double numericValue, EnergyUnit unit) + { + if(unit == EnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Energy, which is Joule. All conversions go via this value. + /// + public static EnergyUnit BaseUnit => EnergyUnit.Joule; + + /// + /// Represents the largest possible value of Energy + /// + public static Energy MaxValue => new Energy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Energy + /// + public static Energy MinValue => new Energy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Energy; + + /// + /// All units of measurement for the Energy quantity. + /// + public static EnergyUnit[] Units { get; } = Enum.GetValues(typeof(EnergyUnit)).Cast().Except(new EnergyUnit[]{ EnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Joule. + /// + public static Energy Zero => new Energy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public EnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Energy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Energy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Energy in BritishThermalUnits. + /// + public double BritishThermalUnits => As(EnergyUnit.BritishThermalUnit); + + /// + /// Get Energy in Calories. + /// + public double Calories => As(EnergyUnit.Calorie); + + /// + /// Get Energy in DecathermsEc. + /// + public double DecathermsEc => As(EnergyUnit.DecathermEc); + + /// + /// Get Energy in DecathermsImperial. + /// + public double DecathermsImperial => As(EnergyUnit.DecathermImperial); + + /// + /// Get Energy in DecathermsUs. + /// + public double DecathermsUs => As(EnergyUnit.DecathermUs); + + /// + /// Get Energy in ElectronVolts. + /// + public double ElectronVolts => As(EnergyUnit.ElectronVolt); + + /// + /// Get Energy in Ergs. + /// + public double Ergs => As(EnergyUnit.Erg); + + /// + /// Get Energy in FootPounds. + /// + public double FootPounds => As(EnergyUnit.FootPound); + + /// + /// Get Energy in GigabritishThermalUnits. + /// + public double GigabritishThermalUnits => As(EnergyUnit.GigabritishThermalUnit); + + /// + /// Get Energy in GigawattHours. + /// + public double GigawattHours => As(EnergyUnit.GigawattHour); + + /// + /// Get Energy in Joules. + /// + public double Joules => As(EnergyUnit.Joule); + + /// + /// Get Energy in KilobritishThermalUnits. + /// + public double KilobritishThermalUnits => As(EnergyUnit.KilobritishThermalUnit); + + /// + /// Get Energy in Kilocalories. + /// + public double Kilocalories => As(EnergyUnit.Kilocalorie); + + /// + /// Get Energy in Kilojoules. + /// + public double Kilojoules => As(EnergyUnit.Kilojoule); + + /// + /// Get Energy in KilowattHours. + /// + public double KilowattHours => As(EnergyUnit.KilowattHour); + + /// + /// Get Energy in MegabritishThermalUnits. + /// + public double MegabritishThermalUnits => As(EnergyUnit.MegabritishThermalUnit); + + /// + /// Get Energy in Megajoules. + /// + public double Megajoules => As(EnergyUnit.Megajoule); + + /// + /// Get Energy in MegawattHours. + /// + public double MegawattHours => As(EnergyUnit.MegawattHour); + + /// + /// Get Energy in ThermsEc. + /// + public double ThermsEc => As(EnergyUnit.ThermEc); + + /// + /// Get Energy in ThermsImperial. + /// + public double ThermsImperial => As(EnergyUnit.ThermImperial); + + /// + /// Get Energy in ThermsUs. + /// + public double ThermsUs => As(EnergyUnit.ThermUs); + + /// + /// Get Energy in WattHours. + /// + public double WattHours => As(EnergyUnit.WattHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(EnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Energy from BritishThermalUnits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromBritishThermalUnits(double britishthermalunits) + { + double value = (double) britishthermalunits; + return new Energy(value, EnergyUnit.BritishThermalUnit); + } + /// + /// Get Energy from Calories. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromCalories(double calories) + { + double value = (double) calories; + return new Energy(value, EnergyUnit.Calorie); + } + /// + /// Get Energy from DecathermsEc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromDecathermsEc(double decathermsec) + { + double value = (double) decathermsec; + return new Energy(value, EnergyUnit.DecathermEc); + } + /// + /// Get Energy from DecathermsImperial. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromDecathermsImperial(double decathermsimperial) + { + double value = (double) decathermsimperial; + return new Energy(value, EnergyUnit.DecathermImperial); + } + /// + /// Get Energy from DecathermsUs. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromDecathermsUs(double decathermsus) + { + double value = (double) decathermsus; + return new Energy(value, EnergyUnit.DecathermUs); + } + /// + /// Get Energy from ElectronVolts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromElectronVolts(double electronvolts) + { + double value = (double) electronvolts; + return new Energy(value, EnergyUnit.ElectronVolt); + } + /// + /// Get Energy from Ergs. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromErgs(double ergs) + { + double value = (double) ergs; + return new Energy(value, EnergyUnit.Erg); + } + /// + /// Get Energy from FootPounds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromFootPounds(double footpounds) + { + double value = (double) footpounds; + return new Energy(value, EnergyUnit.FootPound); + } + /// + /// Get Energy from GigabritishThermalUnits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromGigabritishThermalUnits(double gigabritishthermalunits) + { + double value = (double) gigabritishthermalunits; + return new Energy(value, EnergyUnit.GigabritishThermalUnit); + } + /// + /// Get Energy from GigawattHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromGigawattHours(double gigawatthours) + { + double value = (double) gigawatthours; + return new Energy(value, EnergyUnit.GigawattHour); + } + /// + /// Get Energy from Joules. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromJoules(double joules) + { + double value = (double) joules; + return new Energy(value, EnergyUnit.Joule); + } + /// + /// Get Energy from KilobritishThermalUnits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromKilobritishThermalUnits(double kilobritishthermalunits) + { + double value = (double) kilobritishthermalunits; + return new Energy(value, EnergyUnit.KilobritishThermalUnit); + } + /// + /// Get Energy from Kilocalories. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromKilocalories(double kilocalories) + { + double value = (double) kilocalories; + return new Energy(value, EnergyUnit.Kilocalorie); + } + /// + /// Get Energy from Kilojoules. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromKilojoules(double kilojoules) + { + double value = (double) kilojoules; + return new Energy(value, EnergyUnit.Kilojoule); + } + /// + /// Get Energy from KilowattHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromKilowattHours(double kilowatthours) + { + double value = (double) kilowatthours; + return new Energy(value, EnergyUnit.KilowattHour); + } + /// + /// Get Energy from MegabritishThermalUnits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromMegabritishThermalUnits(double megabritishthermalunits) + { + double value = (double) megabritishthermalunits; + return new Energy(value, EnergyUnit.MegabritishThermalUnit); + } + /// + /// Get Energy from Megajoules. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromMegajoules(double megajoules) + { + double value = (double) megajoules; + return new Energy(value, EnergyUnit.Megajoule); + } + /// + /// Get Energy from MegawattHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromMegawattHours(double megawatthours) + { + double value = (double) megawatthours; + return new Energy(value, EnergyUnit.MegawattHour); + } + /// + /// Get Energy from ThermsEc. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromThermsEc(double thermsec) + { + double value = (double) thermsec; + return new Energy(value, EnergyUnit.ThermEc); + } + /// + /// Get Energy from ThermsImperial. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromThermsImperial(double thermsimperial) + { + double value = (double) thermsimperial; + return new Energy(value, EnergyUnit.ThermImperial); + } + /// + /// Get Energy from ThermsUs. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromThermsUs(double thermsus) + { + double value = (double) thermsus; + return new Energy(value, EnergyUnit.ThermUs); + } + /// + /// Get Energy from WattHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Energy FromWattHours(double watthours) + { + double value = (double) watthours; + return new Energy(value, EnergyUnit.WattHour); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Energy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Energy From(double value, EnergyUnit fromUnit) + { + return new Energy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Energy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Energy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Energy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Energy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static EnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static EnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out EnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EnergyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Energy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); + + return CompareTo((Energy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Energy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Energy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Energy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(EnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Energy to another Energy with the unit representation . + /// + /// A Energy with the specified unit. + public Energy ToUnit(EnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Energy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case EnergyUnit.BritishThermalUnit: return _value*1055.05585262; + case EnergyUnit.Calorie: return _value*4.184; + case EnergyUnit.DecathermEc: return (_value*1.05505585262e8) * 1e1d; + case EnergyUnit.DecathermImperial: return (_value*1.05505585257348e8) * 1e1d; + case EnergyUnit.DecathermUs: return (_value*1.054804e8) * 1e1d; + case EnergyUnit.ElectronVolt: return _value*1.602176565e-19; + case EnergyUnit.Erg: return _value*1e-7; + case EnergyUnit.FootPound: return _value*1.355817948; + case EnergyUnit.GigabritishThermalUnit: return (_value*1055.05585262) * 1e9d; + case EnergyUnit.GigawattHour: return (_value*3600d) * 1e9d; + case EnergyUnit.Joule: return _value; + case EnergyUnit.KilobritishThermalUnit: return (_value*1055.05585262) * 1e3d; + case EnergyUnit.Kilocalorie: return (_value*4.184) * 1e3d; + case EnergyUnit.Kilojoule: return (_value) * 1e3d; + case EnergyUnit.KilowattHour: return (_value*3600d) * 1e3d; + case EnergyUnit.MegabritishThermalUnit: return (_value*1055.05585262) * 1e6d; + case EnergyUnit.Megajoule: return (_value) * 1e6d; + case EnergyUnit.MegawattHour: return (_value*3600d) * 1e6d; + case EnergyUnit.ThermEc: return _value*1.05505585262e8; + case EnergyUnit.ThermImperial: return _value*1.05505585257348e8; + case EnergyUnit.ThermUs: return _value*1.054804e8; + case EnergyUnit.WattHour: return _value*3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(EnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case EnergyUnit.BritishThermalUnit: return baseUnitValue/1055.05585262; + case EnergyUnit.Calorie: return baseUnitValue/4.184; + case EnergyUnit.DecathermEc: return (baseUnitValue/1.05505585262e8) / 1e1d; + case EnergyUnit.DecathermImperial: return (baseUnitValue/1.05505585257348e8) / 1e1d; + case EnergyUnit.DecathermUs: return (baseUnitValue/1.054804e8) / 1e1d; + case EnergyUnit.ElectronVolt: return baseUnitValue/1.602176565e-19; + case EnergyUnit.Erg: return baseUnitValue/1e-7; + case EnergyUnit.FootPound: return baseUnitValue/1.355817948; + case EnergyUnit.GigabritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e9d; + case EnergyUnit.GigawattHour: return (baseUnitValue/3600d) / 1e9d; + case EnergyUnit.Joule: return baseUnitValue; + case EnergyUnit.KilobritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e3d; + case EnergyUnit.Kilocalorie: return (baseUnitValue/4.184) / 1e3d; + case EnergyUnit.Kilojoule: return (baseUnitValue) / 1e3d; + case EnergyUnit.KilowattHour: return (baseUnitValue/3600d) / 1e3d; + case EnergyUnit.MegabritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e6d; + case EnergyUnit.Megajoule: return (baseUnitValue) / 1e6d; + case EnergyUnit.MegawattHour: return (baseUnitValue/3600d) / 1e6d; + case EnergyUnit.ThermEc: return baseUnitValue/1.05505585262e8; + case EnergyUnit.ThermImperial: return baseUnitValue/1.05505585257348e8; + case EnergyUnit.ThermUs: return baseUnitValue/1.054804e8; + case EnergyUnit.WattHour: return baseUnitValue/3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..5314156dfd --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,672 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Entropy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly EntropyUnit? _unit; + + static Entropy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit JoulePerKelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Entropy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Entropy(double numericValue, EntropyUnit unit) + { + if(unit == EntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Entropy, which is JoulePerKelvin. All conversions go via this value. + /// + public static EntropyUnit BaseUnit => EntropyUnit.JoulePerKelvin; + + /// + /// Represents the largest possible value of Entropy + /// + public static Entropy MaxValue => new Entropy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Entropy + /// + public static Entropy MinValue => new Entropy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Entropy; + + /// + /// All units of measurement for the Entropy quantity. + /// + public static EntropyUnit[] Units { get; } = Enum.GetValues(typeof(EntropyUnit)).Cast().Except(new EntropyUnit[]{ EntropyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKelvin. + /// + public static Entropy Zero => new Entropy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public EntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Entropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Entropy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Entropy in CaloriesPerKelvin. + /// + public double CaloriesPerKelvin => As(EntropyUnit.CaloriePerKelvin); + + /// + /// Get Entropy in JoulesPerDegreeCelsius. + /// + public double JoulesPerDegreeCelsius => As(EntropyUnit.JoulePerDegreeCelsius); + + /// + /// Get Entropy in JoulesPerKelvin. + /// + public double JoulesPerKelvin => As(EntropyUnit.JoulePerKelvin); + + /// + /// Get Entropy in KilocaloriesPerKelvin. + /// + public double KilocaloriesPerKelvin => As(EntropyUnit.KilocaloriePerKelvin); + + /// + /// Get Entropy in KilojoulesPerDegreeCelsius. + /// + public double KilojoulesPerDegreeCelsius => As(EntropyUnit.KilojoulePerDegreeCelsius); + + /// + /// Get Entropy in KilojoulesPerKelvin. + /// + public double KilojoulesPerKelvin => As(EntropyUnit.KilojoulePerKelvin); + + /// + /// Get Entropy in MegajoulesPerKelvin. + /// + public double MegajoulesPerKelvin => As(EntropyUnit.MegajoulePerKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(EntropyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Entropy from CaloriesPerKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Entropy FromCaloriesPerKelvin(double caloriesperkelvin) + { + double value = (double) caloriesperkelvin; + return new Entropy(value, EntropyUnit.CaloriePerKelvin); + } + /// + /// Get Entropy from JoulesPerDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Entropy FromJoulesPerDegreeCelsius(double joulesperdegreecelsius) + { + double value = (double) joulesperdegreecelsius; + return new Entropy(value, EntropyUnit.JoulePerDegreeCelsius); + } + /// + /// Get Entropy from JoulesPerKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Entropy FromJoulesPerKelvin(double joulesperkelvin) + { + double value = (double) joulesperkelvin; + return new Entropy(value, EntropyUnit.JoulePerKelvin); + } + /// + /// Get Entropy from KilocaloriesPerKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Entropy FromKilocaloriesPerKelvin(double kilocaloriesperkelvin) + { + double value = (double) kilocaloriesperkelvin; + return new Entropy(value, EntropyUnit.KilocaloriePerKelvin); + } + /// + /// Get Entropy from KilojoulesPerDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Entropy FromKilojoulesPerDegreeCelsius(double kilojoulesperdegreecelsius) + { + double value = (double) kilojoulesperdegreecelsius; + return new Entropy(value, EntropyUnit.KilojoulePerDegreeCelsius); + } + /// + /// Get Entropy from KilojoulesPerKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Entropy FromKilojoulesPerKelvin(double kilojoulesperkelvin) + { + double value = (double) kilojoulesperkelvin; + return new Entropy(value, EntropyUnit.KilojoulePerKelvin); + } + /// + /// Get Entropy from MegajoulesPerKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Entropy FromMegajoulesPerKelvin(double megajoulesperkelvin) + { + double value = (double) megajoulesperkelvin; + return new Entropy(value, EntropyUnit.MegajoulePerKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Entropy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Entropy From(double value, EntropyUnit fromUnit) + { + return new Entropy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Entropy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Entropy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Entropy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Entropy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static EntropyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static EntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out EntropyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out EntropyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Entropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); + + return CompareTo((Entropy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Entropy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Entropy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Entropy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(EntropyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Entropy to another Entropy with the unit representation . + /// + /// A Entropy with the specified unit. + public Entropy ToUnit(EntropyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Entropy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case EntropyUnit.CaloriePerKelvin: return _value*4.184; + case EntropyUnit.JoulePerDegreeCelsius: return _value; + case EntropyUnit.JoulePerKelvin: return _value; + case EntropyUnit.KilocaloriePerKelvin: return (_value*4.184) * 1e3d; + case EntropyUnit.KilojoulePerDegreeCelsius: return (_value) * 1e3d; + case EntropyUnit.KilojoulePerKelvin: return (_value) * 1e3d; + case EntropyUnit.MegajoulePerKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(EntropyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case EntropyUnit.CaloriePerKelvin: return baseUnitValue/4.184; + case EntropyUnit.JoulePerDegreeCelsius: return baseUnitValue; + case EntropyUnit.JoulePerKelvin: return baseUnitValue; + case EntropyUnit.KilocaloriePerKelvin: return (baseUnitValue/4.184) / 1e3d; + case EntropyUnit.KilojoulePerDegreeCelsius: return (baseUnitValue) / 1e3d; + case EntropyUnit.KilojoulePerKelvin: return (baseUnitValue) / 1e3d; + case EntropyUnit.MegajoulePerKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..bbeb01758b --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -0,0 +1,774 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Force : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ForceUnit? _unit; + + static Force() + { + BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Newton. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Force() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Force(double numericValue, ForceUnit unit) + { + if(unit == ForceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Force, which is Newton. All conversions go via this value. + /// + public static ForceUnit BaseUnit => ForceUnit.Newton; + + /// + /// Represents the largest possible value of Force + /// + public static Force MaxValue => new Force(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Force + /// + public static Force MinValue => new Force(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Force; + + /// + /// All units of measurement for the Force quantity. + /// + public static ForceUnit[] Units { get; } = Enum.GetValues(typeof(ForceUnit)).Cast().Except(new ForceUnit[]{ ForceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Newton. + /// + public static Force Zero => new Force(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ForceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Force.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Force.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Force in Decanewtons. + /// + public double Decanewtons => As(ForceUnit.Decanewton); + + /// + /// Get Force in Dyne. + /// + public double Dyne => As(ForceUnit.Dyn); + + /// + /// Get Force in KilogramsForce. + /// + public double KilogramsForce => As(ForceUnit.KilogramForce); + + /// + /// Get Force in Kilonewtons. + /// + public double Kilonewtons => As(ForceUnit.Kilonewton); + + /// + /// Get Force in KiloPonds. + /// + public double KiloPonds => As(ForceUnit.KiloPond); + + /// + /// Get Force in Meganewtons. + /// + public double Meganewtons => As(ForceUnit.Meganewton); + + /// + /// Get Force in Micronewtons. + /// + public double Micronewtons => As(ForceUnit.Micronewton); + + /// + /// Get Force in Millinewtons. + /// + public double Millinewtons => As(ForceUnit.Millinewton); + + /// + /// Get Force in Newtons. + /// + public double Newtons => As(ForceUnit.Newton); + + /// + /// Get Force in OunceForce. + /// + public double OunceForce => As(ForceUnit.OunceForce); + + /// + /// Get Force in Poundals. + /// + public double Poundals => As(ForceUnit.Poundal); + + /// + /// Get Force in PoundsForce. + /// + public double PoundsForce => As(ForceUnit.PoundForce); + + /// + /// Get Force in TonnesForce. + /// + public double TonnesForce => As(ForceUnit.TonneForce); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ForceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ForceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Force from Decanewtons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromDecanewtons(double decanewtons) + { + double value = (double) decanewtons; + return new Force(value, ForceUnit.Decanewton); + } + /// + /// Get Force from Dyne. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromDyne(double dyne) + { + double value = (double) dyne; + return new Force(value, ForceUnit.Dyn); + } + /// + /// Get Force from KilogramsForce. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromKilogramsForce(double kilogramsforce) + { + double value = (double) kilogramsforce; + return new Force(value, ForceUnit.KilogramForce); + } + /// + /// Get Force from Kilonewtons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromKilonewtons(double kilonewtons) + { + double value = (double) kilonewtons; + return new Force(value, ForceUnit.Kilonewton); + } + /// + /// Get Force from KiloPonds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromKiloPonds(double kiloponds) + { + double value = (double) kiloponds; + return new Force(value, ForceUnit.KiloPond); + } + /// + /// Get Force from Meganewtons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromMeganewtons(double meganewtons) + { + double value = (double) meganewtons; + return new Force(value, ForceUnit.Meganewton); + } + /// + /// Get Force from Micronewtons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromMicronewtons(double micronewtons) + { + double value = (double) micronewtons; + return new Force(value, ForceUnit.Micronewton); + } + /// + /// Get Force from Millinewtons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromMillinewtons(double millinewtons) + { + double value = (double) millinewtons; + return new Force(value, ForceUnit.Millinewton); + } + /// + /// Get Force from Newtons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromNewtons(double newtons) + { + double value = (double) newtons; + return new Force(value, ForceUnit.Newton); + } + /// + /// Get Force from OunceForce. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromOunceForce(double ounceforce) + { + double value = (double) ounceforce; + return new Force(value, ForceUnit.OunceForce); + } + /// + /// Get Force from Poundals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromPoundals(double poundals) + { + double value = (double) poundals; + return new Force(value, ForceUnit.Poundal); + } + /// + /// Get Force from PoundsForce. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromPoundsForce(double poundsforce) + { + double value = (double) poundsforce; + return new Force(value, ForceUnit.PoundForce); + } + /// + /// Get Force from TonnesForce. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Force FromTonnesForce(double tonnesforce) + { + double value = (double) tonnesforce; + return new Force(value, ForceUnit.TonneForce); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Force unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Force From(double value, ForceUnit fromUnit) + { + return new Force((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Force Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Force Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Force result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Force result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ForceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ForceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Force)) throw new ArgumentException("Expected type Force.", nameof(obj)); + + return CompareTo((Force)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Force other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Force within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Force other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Force. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ForceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Force to another Force with the unit representation . + /// + /// A Force with the specified unit. + public Force ToUnit(ForceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Force(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ForceUnit.Decanewton: return (_value) * 1e1d; + case ForceUnit.Dyn: return _value/1e5; + case ForceUnit.KilogramForce: return _value*9.80665002864; + case ForceUnit.Kilonewton: return (_value) * 1e3d; + case ForceUnit.KiloPond: return _value*9.80665002864; + case ForceUnit.Meganewton: return (_value) * 1e6d; + case ForceUnit.Micronewton: return (_value) * 1e-6d; + case ForceUnit.Millinewton: return (_value) * 1e-3d; + case ForceUnit.Newton: return _value; + case ForceUnit.OunceForce: return _value*2.780138509537812e-1; + case ForceUnit.Poundal: return _value*0.13825502798973041652092282466083; + case ForceUnit.PoundForce: return _value*4.4482216152605095551842641431421; + case ForceUnit.TonneForce: return _value*9.80665002864e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ForceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ForceUnit.Decanewton: return (baseUnitValue) / 1e1d; + case ForceUnit.Dyn: return baseUnitValue*1e5; + case ForceUnit.KilogramForce: return baseUnitValue/9.80665002864; + case ForceUnit.Kilonewton: return (baseUnitValue) / 1e3d; + case ForceUnit.KiloPond: return baseUnitValue/9.80665002864; + case ForceUnit.Meganewton: return (baseUnitValue) / 1e6d; + case ForceUnit.Micronewton: return (baseUnitValue) / 1e-6d; + case ForceUnit.Millinewton: return (baseUnitValue) / 1e-3d; + case ForceUnit.Newton: return baseUnitValue; + case ForceUnit.OunceForce: return baseUnitValue/2.780138509537812e-1; + case ForceUnit.Poundal: return baseUnitValue/0.13825502798973041652092282466083; + case ForceUnit.PoundForce: return baseUnitValue/4.4482216152605095551842641431421; + case ForceUnit.TonneForce: return baseUnitValue/9.80665002864e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..0c46661ff2 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -0,0 +1,740 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ForceChangeRate : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ForceChangeRateUnit? _unit; + + static ForceChangeRate() + { + BaseDimensions = new BaseDimensions(1, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit NewtonPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ForceChangeRate() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ForceChangeRate(double numericValue, ForceChangeRateUnit unit) + { + if(unit == ForceChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ForceChangeRate, which is NewtonPerSecond. All conversions go via this value. + /// + public static ForceChangeRateUnit BaseUnit => ForceChangeRateUnit.NewtonPerSecond; + + /// + /// Represents the largest possible value of ForceChangeRate + /// + public static ForceChangeRate MaxValue => new ForceChangeRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ForceChangeRate + /// + public static ForceChangeRate MinValue => new ForceChangeRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ForceChangeRate; + + /// + /// All units of measurement for the ForceChangeRate quantity. + /// + public static ForceChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(ForceChangeRateUnit)).Cast().Except(new ForceChangeRateUnit[]{ ForceChangeRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerSecond. + /// + public static ForceChangeRate Zero => new ForceChangeRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ForceChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ForceChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ForceChangeRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ForceChangeRate in CentinewtonsPerSecond. + /// + public double CentinewtonsPerSecond => As(ForceChangeRateUnit.CentinewtonPerSecond); + + /// + /// Get ForceChangeRate in DecanewtonsPerMinute. + /// + public double DecanewtonsPerMinute => As(ForceChangeRateUnit.DecanewtonPerMinute); + + /// + /// Get ForceChangeRate in DecanewtonsPerSecond. + /// + public double DecanewtonsPerSecond => As(ForceChangeRateUnit.DecanewtonPerSecond); + + /// + /// Get ForceChangeRate in DecinewtonsPerSecond. + /// + public double DecinewtonsPerSecond => As(ForceChangeRateUnit.DecinewtonPerSecond); + + /// + /// Get ForceChangeRate in KilonewtonsPerMinute. + /// + public double KilonewtonsPerMinute => As(ForceChangeRateUnit.KilonewtonPerMinute); + + /// + /// Get ForceChangeRate in KilonewtonsPerSecond. + /// + public double KilonewtonsPerSecond => As(ForceChangeRateUnit.KilonewtonPerSecond); + + /// + /// Get ForceChangeRate in MicronewtonsPerSecond. + /// + public double MicronewtonsPerSecond => As(ForceChangeRateUnit.MicronewtonPerSecond); + + /// + /// Get ForceChangeRate in MillinewtonsPerSecond. + /// + public double MillinewtonsPerSecond => As(ForceChangeRateUnit.MillinewtonPerSecond); + + /// + /// Get ForceChangeRate in NanonewtonsPerSecond. + /// + public double NanonewtonsPerSecond => As(ForceChangeRateUnit.NanonewtonPerSecond); + + /// + /// Get ForceChangeRate in NewtonsPerMinute. + /// + public double NewtonsPerMinute => As(ForceChangeRateUnit.NewtonPerMinute); + + /// + /// Get ForceChangeRate in NewtonsPerSecond. + /// + public double NewtonsPerSecond => As(ForceChangeRateUnit.NewtonPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ForceChangeRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ForceChangeRate from CentinewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromCentinewtonsPerSecond(double centinewtonspersecond) + { + double value = (double) centinewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.CentinewtonPerSecond); + } + /// + /// Get ForceChangeRate from DecanewtonsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromDecanewtonsPerMinute(double decanewtonsperminute) + { + double value = (double) decanewtonsperminute; + return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerMinute); + } + /// + /// Get ForceChangeRate from DecanewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromDecanewtonsPerSecond(double decanewtonspersecond) + { + double value = (double) decanewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerSecond); + } + /// + /// Get ForceChangeRate from DecinewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromDecinewtonsPerSecond(double decinewtonspersecond) + { + double value = (double) decinewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.DecinewtonPerSecond); + } + /// + /// Get ForceChangeRate from KilonewtonsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromKilonewtonsPerMinute(double kilonewtonsperminute) + { + double value = (double) kilonewtonsperminute; + return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerMinute); + } + /// + /// Get ForceChangeRate from KilonewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromKilonewtonsPerSecond(double kilonewtonspersecond) + { + double value = (double) kilonewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerSecond); + } + /// + /// Get ForceChangeRate from MicronewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromMicronewtonsPerSecond(double micronewtonspersecond) + { + double value = (double) micronewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.MicronewtonPerSecond); + } + /// + /// Get ForceChangeRate from MillinewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromMillinewtonsPerSecond(double millinewtonspersecond) + { + double value = (double) millinewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.MillinewtonPerSecond); + } + /// + /// Get ForceChangeRate from NanonewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromNanonewtonsPerSecond(double nanonewtonspersecond) + { + double value = (double) nanonewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.NanonewtonPerSecond); + } + /// + /// Get ForceChangeRate from NewtonsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromNewtonsPerMinute(double newtonsperminute) + { + double value = (double) newtonsperminute; + return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerMinute); + } + /// + /// Get ForceChangeRate from NewtonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForceChangeRate FromNewtonsPerSecond(double newtonspersecond) + { + double value = (double) newtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ForceChangeRate unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ForceChangeRate From(double value, ForceChangeRateUnit fromUnit) + { + return new ForceChangeRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ForceChangeRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ForceChangeRate Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForceChangeRate result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForceChangeRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ForceChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ForceChangeRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForceChangeRateUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); + + return CompareTo((ForceChangeRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ForceChangeRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ForceChangeRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ForceChangeRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ForceChangeRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ForceChangeRate to another ForceChangeRate with the unit representation . + /// + /// A ForceChangeRate with the specified unit. + public ForceChangeRate ToUnit(ForceChangeRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ForceChangeRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ForceChangeRateUnit.CentinewtonPerSecond: return (_value) * 1e-2d; + case ForceChangeRateUnit.DecanewtonPerMinute: return (_value/60) * 1e1d; + case ForceChangeRateUnit.DecanewtonPerSecond: return (_value) * 1e1d; + case ForceChangeRateUnit.DecinewtonPerSecond: return (_value) * 1e-1d; + case ForceChangeRateUnit.KilonewtonPerMinute: return (_value/60) * 1e3d; + case ForceChangeRateUnit.KilonewtonPerSecond: return (_value) * 1e3d; + case ForceChangeRateUnit.MicronewtonPerSecond: return (_value) * 1e-6d; + case ForceChangeRateUnit.MillinewtonPerSecond: return (_value) * 1e-3d; + case ForceChangeRateUnit.NanonewtonPerSecond: return (_value) * 1e-9d; + case ForceChangeRateUnit.NewtonPerMinute: return _value/60; + case ForceChangeRateUnit.NewtonPerSecond: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ForceChangeRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ForceChangeRateUnit.CentinewtonPerSecond: return (baseUnitValue) / 1e-2d; + case ForceChangeRateUnit.DecanewtonPerMinute: return (baseUnitValue*60) / 1e1d; + case ForceChangeRateUnit.DecanewtonPerSecond: return (baseUnitValue) / 1e1d; + case ForceChangeRateUnit.DecinewtonPerSecond: return (baseUnitValue) / 1e-1d; + case ForceChangeRateUnit.KilonewtonPerMinute: return (baseUnitValue*60) / 1e3d; + case ForceChangeRateUnit.KilonewtonPerSecond: return (baseUnitValue) / 1e3d; + case ForceChangeRateUnit.MicronewtonPerSecond: return (baseUnitValue) / 1e-6d; + case ForceChangeRateUnit.MillinewtonPerSecond: return (baseUnitValue) / 1e-3d; + case ForceChangeRateUnit.NanonewtonPerSecond: return (baseUnitValue) / 1e-9d; + case ForceChangeRateUnit.NewtonPerMinute: return baseUnitValue*60; + case ForceChangeRateUnit.NewtonPerSecond: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..05c3e249b4 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -0,0 +1,706 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The magnitude of force per unit length. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ForcePerLength : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ForcePerLengthUnit? _unit; + + static ForcePerLength() + { + BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit NewtonPerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ForcePerLength() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ForcePerLength(double numericValue, ForcePerLengthUnit unit) + { + if(unit == ForcePerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ForcePerLength, which is NewtonPerMeter. All conversions go via this value. + /// + public static ForcePerLengthUnit BaseUnit => ForcePerLengthUnit.NewtonPerMeter; + + /// + /// Represents the largest possible value of ForcePerLength + /// + public static ForcePerLength MaxValue => new ForcePerLength(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ForcePerLength + /// + public static ForcePerLength MinValue => new ForcePerLength(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ForcePerLength; + + /// + /// All units of measurement for the ForcePerLength quantity. + /// + public static ForcePerLengthUnit[] Units { get; } = Enum.GetValues(typeof(ForcePerLengthUnit)).Cast().Except(new ForcePerLengthUnit[]{ ForcePerLengthUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerMeter. + /// + public static ForcePerLength Zero => new ForcePerLength(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ForcePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ForcePerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ForcePerLength.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ForcePerLength in CentinewtonsPerMeter. + /// + public double CentinewtonsPerMeter => As(ForcePerLengthUnit.CentinewtonPerMeter); + + /// + /// Get ForcePerLength in DecinewtonsPerMeter. + /// + public double DecinewtonsPerMeter => As(ForcePerLengthUnit.DecinewtonPerMeter); + + /// + /// Get ForcePerLength in KilogramsForcePerMeter. + /// + public double KilogramsForcePerMeter => As(ForcePerLengthUnit.KilogramForcePerMeter); + + /// + /// Get ForcePerLength in KilonewtonsPerMeter. + /// + public double KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); + + /// + /// Get ForcePerLength in MeganewtonsPerMeter. + /// + public double MeganewtonsPerMeter => As(ForcePerLengthUnit.MeganewtonPerMeter); + + /// + /// Get ForcePerLength in MicronewtonsPerMeter. + /// + public double MicronewtonsPerMeter => As(ForcePerLengthUnit.MicronewtonPerMeter); + + /// + /// Get ForcePerLength in MillinewtonsPerMeter. + /// + public double MillinewtonsPerMeter => As(ForcePerLengthUnit.MillinewtonPerMeter); + + /// + /// Get ForcePerLength in NanonewtonsPerMeter. + /// + public double NanonewtonsPerMeter => As(ForcePerLengthUnit.NanonewtonPerMeter); + + /// + /// Get ForcePerLength in NewtonsPerMeter. + /// + public double NewtonsPerMeter => As(ForcePerLengthUnit.NewtonPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ForcePerLengthUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ForcePerLength from CentinewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromCentinewtonsPerMeter(double centinewtonspermeter) + { + double value = (double) centinewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.CentinewtonPerMeter); + } + /// + /// Get ForcePerLength from DecinewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromDecinewtonsPerMeter(double decinewtonspermeter) + { + double value = (double) decinewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.DecinewtonPerMeter); + } + /// + /// Get ForcePerLength from KilogramsForcePerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromKilogramsForcePerMeter(double kilogramsforcepermeter) + { + double value = (double) kilogramsforcepermeter; + return new ForcePerLength(value, ForcePerLengthUnit.KilogramForcePerMeter); + } + /// + /// Get ForcePerLength from KilonewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromKilonewtonsPerMeter(double kilonewtonspermeter) + { + double value = (double) kilonewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); + } + /// + /// Get ForcePerLength from MeganewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromMeganewtonsPerMeter(double meganewtonspermeter) + { + double value = (double) meganewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.MeganewtonPerMeter); + } + /// + /// Get ForcePerLength from MicronewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromMicronewtonsPerMeter(double micronewtonspermeter) + { + double value = (double) micronewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.MicronewtonPerMeter); + } + /// + /// Get ForcePerLength from MillinewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromMillinewtonsPerMeter(double millinewtonspermeter) + { + double value = (double) millinewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.MillinewtonPerMeter); + } + /// + /// Get ForcePerLength from NanonewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromNanonewtonsPerMeter(double nanonewtonspermeter) + { + double value = (double) nanonewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.NanonewtonPerMeter); + } + /// + /// Get ForcePerLength from NewtonsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ForcePerLength FromNewtonsPerMeter(double newtonspermeter) + { + double value = (double) newtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.NewtonPerMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ForcePerLength unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ForcePerLength From(double value, ForcePerLengthUnit fromUnit) + { + return new ForcePerLength((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ForcePerLength Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ForcePerLength Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ForcePerLength result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ForcePerLength result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForcePerLengthUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ForcePerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ForcePerLengthUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ForcePerLengthUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); + + return CompareTo((ForcePerLength)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ForcePerLength other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ForcePerLength within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ForcePerLength. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ForcePerLengthUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ForcePerLength to another ForcePerLength with the unit representation . + /// + /// A ForcePerLength with the specified unit. + public ForcePerLength ToUnit(ForcePerLengthUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ForcePerLength(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ForcePerLengthUnit.CentinewtonPerMeter: return (_value) * 1e-2d; + case ForcePerLengthUnit.DecinewtonPerMeter: return (_value) * 1e-1d; + case ForcePerLengthUnit.KilogramForcePerMeter: return _value*9.80665002864; + case ForcePerLengthUnit.KilonewtonPerMeter: return (_value) * 1e3d; + case ForcePerLengthUnit.MeganewtonPerMeter: return (_value) * 1e6d; + case ForcePerLengthUnit.MicronewtonPerMeter: return (_value) * 1e-6d; + case ForcePerLengthUnit.MillinewtonPerMeter: return (_value) * 1e-3d; + case ForcePerLengthUnit.NanonewtonPerMeter: return (_value) * 1e-9d; + case ForcePerLengthUnit.NewtonPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ForcePerLengthUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ForcePerLengthUnit.CentinewtonPerMeter: return (baseUnitValue) / 1e-2d; + case ForcePerLengthUnit.DecinewtonPerMeter: return (baseUnitValue) / 1e-1d; + case ForcePerLengthUnit.KilogramForcePerMeter: return baseUnitValue/9.80665002864; + case ForcePerLengthUnit.KilonewtonPerMeter: return (baseUnitValue) / 1e3d; + case ForcePerLengthUnit.MeganewtonPerMeter: return (baseUnitValue) / 1e6d; + case ForcePerLengthUnit.MicronewtonPerMeter: return (baseUnitValue) / 1e-6d; + case ForcePerLengthUnit.MillinewtonPerMeter: return (baseUnitValue) / 1e-3d; + case ForcePerLengthUnit.NanonewtonPerMeter: return (baseUnitValue) / 1e-9d; + case ForcePerLengthUnit.NewtonPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..5822efad71 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -0,0 +1,689 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The number of occurrences of a repeating event per unit time. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Frequency : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly FrequencyUnit? _unit; + + static Frequency() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Hertz. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Frequency() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Frequency(double numericValue, FrequencyUnit unit) + { + if(unit == FrequencyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Frequency, which is Hertz. All conversions go via this value. + /// + public static FrequencyUnit BaseUnit => FrequencyUnit.Hertz; + + /// + /// Represents the largest possible value of Frequency + /// + public static Frequency MaxValue => new Frequency(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Frequency + /// + public static Frequency MinValue => new Frequency(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Frequency; + + /// + /// All units of measurement for the Frequency quantity. + /// + public static FrequencyUnit[] Units { get; } = Enum.GetValues(typeof(FrequencyUnit)).Cast().Except(new FrequencyUnit[]{ FrequencyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Hertz. + /// + public static Frequency Zero => new Frequency(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public FrequencyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Frequency.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Frequency.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Frequency in CyclesPerHour. + /// + public double CyclesPerHour => As(FrequencyUnit.CyclePerHour); + + /// + /// Get Frequency in CyclesPerMinute. + /// + public double CyclesPerMinute => As(FrequencyUnit.CyclePerMinute); + + /// + /// Get Frequency in Gigahertz. + /// + public double Gigahertz => As(FrequencyUnit.Gigahertz); + + /// + /// Get Frequency in Hertz. + /// + public double Hertz => As(FrequencyUnit.Hertz); + + /// + /// Get Frequency in Kilohertz. + /// + public double Kilohertz => As(FrequencyUnit.Kilohertz); + + /// + /// Get Frequency in Megahertz. + /// + public double Megahertz => As(FrequencyUnit.Megahertz); + + /// + /// Get Frequency in RadiansPerSecond. + /// + public double RadiansPerSecond => As(FrequencyUnit.RadianPerSecond); + + /// + /// Get Frequency in Terahertz. + /// + public double Terahertz => As(FrequencyUnit.Terahertz); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(FrequencyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Frequency from CyclesPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromCyclesPerHour(double cyclesperhour) + { + double value = (double) cyclesperhour; + return new Frequency(value, FrequencyUnit.CyclePerHour); + } + /// + /// Get Frequency from CyclesPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromCyclesPerMinute(double cyclesperminute) + { + double value = (double) cyclesperminute; + return new Frequency(value, FrequencyUnit.CyclePerMinute); + } + /// + /// Get Frequency from Gigahertz. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromGigahertz(double gigahertz) + { + double value = (double) gigahertz; + return new Frequency(value, FrequencyUnit.Gigahertz); + } + /// + /// Get Frequency from Hertz. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromHertz(double hertz) + { + double value = (double) hertz; + return new Frequency(value, FrequencyUnit.Hertz); + } + /// + /// Get Frequency from Kilohertz. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromKilohertz(double kilohertz) + { + double value = (double) kilohertz; + return new Frequency(value, FrequencyUnit.Kilohertz); + } + /// + /// Get Frequency from Megahertz. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromMegahertz(double megahertz) + { + double value = (double) megahertz; + return new Frequency(value, FrequencyUnit.Megahertz); + } + /// + /// Get Frequency from RadiansPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromRadiansPerSecond(double radianspersecond) + { + double value = (double) radianspersecond; + return new Frequency(value, FrequencyUnit.RadianPerSecond); + } + /// + /// Get Frequency from Terahertz. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Frequency FromTerahertz(double terahertz) + { + double value = (double) terahertz; + return new Frequency(value, FrequencyUnit.Terahertz); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Frequency unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Frequency From(double value, FrequencyUnit fromUnit) + { + return new Frequency((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Frequency Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Frequency Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Frequency result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Frequency result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static FrequencyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static FrequencyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out FrequencyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out FrequencyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Frequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); + + return CompareTo((Frequency)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Frequency other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Frequency within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Frequency. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(FrequencyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Frequency to another Frequency with the unit representation . + /// + /// A Frequency with the specified unit. + public Frequency ToUnit(FrequencyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Frequency(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case FrequencyUnit.CyclePerHour: return _value/3600; + case FrequencyUnit.CyclePerMinute: return _value/60; + case FrequencyUnit.Gigahertz: return (_value) * 1e9d; + case FrequencyUnit.Hertz: return _value; + case FrequencyUnit.Kilohertz: return (_value) * 1e3d; + case FrequencyUnit.Megahertz: return (_value) * 1e6d; + case FrequencyUnit.RadianPerSecond: return _value/6.2831853072; + case FrequencyUnit.Terahertz: return (_value) * 1e12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(FrequencyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case FrequencyUnit.CyclePerHour: return baseUnitValue*3600; + case FrequencyUnit.CyclePerMinute: return baseUnitValue*60; + case FrequencyUnit.Gigahertz: return (baseUnitValue) / 1e9d; + case FrequencyUnit.Hertz: return baseUnitValue; + case FrequencyUnit.Kilohertz: return (baseUnitValue) / 1e3d; + case FrequencyUnit.Megahertz: return (baseUnitValue) / 1e6d; + case FrequencyUnit.RadianPerSecond: return baseUnitValue*6.2831853072; + case FrequencyUnit.Terahertz: return (baseUnitValue) / 1e12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..408b7d2c64 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -0,0 +1,825 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Heat flux is the flow of energy per unit of area per unit of time + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class HeatFlux : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly HeatFluxUnit? _unit; + + static HeatFlux() + { + BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit WattPerSquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public HeatFlux() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private HeatFlux(double numericValue, HeatFluxUnit unit) + { + if(unit == HeatFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of HeatFlux, which is WattPerSquareMeter. All conversions go via this value. + /// + public static HeatFluxUnit BaseUnit => HeatFluxUnit.WattPerSquareMeter; + + /// + /// Represents the largest possible value of HeatFlux + /// + public static HeatFlux MaxValue => new HeatFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of HeatFlux + /// + public static HeatFlux MinValue => new HeatFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.HeatFlux; + + /// + /// All units of measurement for the HeatFlux quantity. + /// + public static HeatFluxUnit[] Units { get; } = Enum.GetValues(typeof(HeatFluxUnit)).Cast().Except(new HeatFluxUnit[]{ HeatFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. + /// + public static HeatFlux Zero => new HeatFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public HeatFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => HeatFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => HeatFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get HeatFlux in BtusPerHourSquareFoot. + /// + public double BtusPerHourSquareFoot => As(HeatFluxUnit.BtuPerHourSquareFoot); + + /// + /// Get HeatFlux in BtusPerMinuteSquareFoot. + /// + public double BtusPerMinuteSquareFoot => As(HeatFluxUnit.BtuPerMinuteSquareFoot); + + /// + /// Get HeatFlux in BtusPerSecondSquareFoot. + /// + public double BtusPerSecondSquareFoot => As(HeatFluxUnit.BtuPerSecondSquareFoot); + + /// + /// Get HeatFlux in BtusPerSecondSquareInch. + /// + public double BtusPerSecondSquareInch => As(HeatFluxUnit.BtuPerSecondSquareInch); + + /// + /// Get HeatFlux in CaloriesPerSecondSquareCentimeter. + /// + public double CaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.CaloriePerSecondSquareCentimeter); + + /// + /// Get HeatFlux in CentiwattsPerSquareMeter. + /// + public double CentiwattsPerSquareMeter => As(HeatFluxUnit.CentiwattPerSquareMeter); + + /// + /// Get HeatFlux in DeciwattsPerSquareMeter. + /// + public double DeciwattsPerSquareMeter => As(HeatFluxUnit.DeciwattPerSquareMeter); + + /// + /// Get HeatFlux in KilocaloriesPerHourSquareMeter. + /// + public double KilocaloriesPerHourSquareMeter => As(HeatFluxUnit.KilocaloriePerHourSquareMeter); + + /// + /// Get HeatFlux in KilocaloriesPerSecondSquareCentimeter. + /// + public double KilocaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); + + /// + /// Get HeatFlux in KilowattsPerSquareMeter. + /// + public double KilowattsPerSquareMeter => As(HeatFluxUnit.KilowattPerSquareMeter); + + /// + /// Get HeatFlux in MicrowattsPerSquareMeter. + /// + public double MicrowattsPerSquareMeter => As(HeatFluxUnit.MicrowattPerSquareMeter); + + /// + /// Get HeatFlux in MilliwattsPerSquareMeter. + /// + public double MilliwattsPerSquareMeter => As(HeatFluxUnit.MilliwattPerSquareMeter); + + /// + /// Get HeatFlux in NanowattsPerSquareMeter. + /// + public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); + + /// + /// Get HeatFlux in WattsPerSquareFoot. + /// + public double WattsPerSquareFoot => As(HeatFluxUnit.WattPerSquareFoot); + + /// + /// Get HeatFlux in WattsPerSquareInch. + /// + public double WattsPerSquareInch => As(HeatFluxUnit.WattPerSquareInch); + + /// + /// Get HeatFlux in WattsPerSquareMeter. + /// + public double WattsPerSquareMeter => As(HeatFluxUnit.WattPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(HeatFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get HeatFlux from BtusPerHourSquareFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromBtusPerHourSquareFoot(double btusperhoursquarefoot) + { + double value = (double) btusperhoursquarefoot; + return new HeatFlux(value, HeatFluxUnit.BtuPerHourSquareFoot); + } + /// + /// Get HeatFlux from BtusPerMinuteSquareFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromBtusPerMinuteSquareFoot(double btusperminutesquarefoot) + { + double value = (double) btusperminutesquarefoot; + return new HeatFlux(value, HeatFluxUnit.BtuPerMinuteSquareFoot); + } + /// + /// Get HeatFlux from BtusPerSecondSquareFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromBtusPerSecondSquareFoot(double btuspersecondsquarefoot) + { + double value = (double) btuspersecondsquarefoot; + return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareFoot); + } + /// + /// Get HeatFlux from BtusPerSecondSquareInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromBtusPerSecondSquareInch(double btuspersecondsquareinch) + { + double value = (double) btuspersecondsquareinch; + return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareInch); + } + /// + /// Get HeatFlux from CaloriesPerSecondSquareCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromCaloriesPerSecondSquareCentimeter(double caloriespersecondsquarecentimeter) + { + double value = (double) caloriespersecondsquarecentimeter; + return new HeatFlux(value, HeatFluxUnit.CaloriePerSecondSquareCentimeter); + } + /// + /// Get HeatFlux from CentiwattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromCentiwattsPerSquareMeter(double centiwattspersquaremeter) + { + double value = (double) centiwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.CentiwattPerSquareMeter); + } + /// + /// Get HeatFlux from DeciwattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromDeciwattsPerSquareMeter(double deciwattspersquaremeter) + { + double value = (double) deciwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.DeciwattPerSquareMeter); + } + /// + /// Get HeatFlux from KilocaloriesPerHourSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromKilocaloriesPerHourSquareMeter(double kilocaloriesperhoursquaremeter) + { + double value = (double) kilocaloriesperhoursquaremeter; + return new HeatFlux(value, HeatFluxUnit.KilocaloriePerHourSquareMeter); + } + /// + /// Get HeatFlux from KilocaloriesPerSecondSquareCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(double kilocaloriespersecondsquarecentimeter) + { + double value = (double) kilocaloriespersecondsquarecentimeter; + return new HeatFlux(value, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); + } + /// + /// Get HeatFlux from KilowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromKilowattsPerSquareMeter(double kilowattspersquaremeter) + { + double value = (double) kilowattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.KilowattPerSquareMeter); + } + /// + /// Get HeatFlux from MicrowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromMicrowattsPerSquareMeter(double microwattspersquaremeter) + { + double value = (double) microwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.MicrowattPerSquareMeter); + } + /// + /// Get HeatFlux from MilliwattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromMilliwattsPerSquareMeter(double milliwattspersquaremeter) + { + double value = (double) milliwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.MilliwattPerSquareMeter); + } + /// + /// Get HeatFlux from NanowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromNanowattsPerSquareMeter(double nanowattspersquaremeter) + { + double value = (double) nanowattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); + } + /// + /// Get HeatFlux from WattsPerSquareFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromWattsPerSquareFoot(double wattspersquarefoot) + { + double value = (double) wattspersquarefoot; + return new HeatFlux(value, HeatFluxUnit.WattPerSquareFoot); + } + /// + /// Get HeatFlux from WattsPerSquareInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromWattsPerSquareInch(double wattspersquareinch) + { + double value = (double) wattspersquareinch; + return new HeatFlux(value, HeatFluxUnit.WattPerSquareInch); + } + /// + /// Get HeatFlux from WattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromWattsPerSquareMeter(double wattspersquaremeter) + { + double value = (double) wattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.WattPerSquareMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// HeatFlux unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static HeatFlux From(double value, HeatFluxUnit fromUnit) + { + return new HeatFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static HeatFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static HeatFlux Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out HeatFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatFlux result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static HeatFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static HeatFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out HeatFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatFluxUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is HeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); + + return CompareTo((HeatFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(HeatFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another HeatFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current HeatFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(HeatFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this HeatFlux to another HeatFlux with the unit representation . + /// + /// A HeatFlux with the specified unit. + public HeatFlux ToUnit(HeatFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new HeatFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case HeatFluxUnit.BtuPerHourSquareFoot: return _value*3.15459075; + case HeatFluxUnit.BtuPerMinuteSquareFoot: return _value*1.89275445e2; + case HeatFluxUnit.BtuPerSecondSquareFoot: return _value*1.13565267e4; + case HeatFluxUnit.BtuPerSecondSquareInch: return _value*1.63533984e6; + case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return _value*4.1868e4; + case HeatFluxUnit.CentiwattPerSquareMeter: return (_value) * 1e-2d; + case HeatFluxUnit.DeciwattPerSquareMeter: return (_value) * 1e-1d; + case HeatFluxUnit.KilocaloriePerHourSquareMeter: return _value*1.163; + case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (_value*4.1868e4) * 1e3d; + case HeatFluxUnit.KilowattPerSquareMeter: return (_value) * 1e3d; + case HeatFluxUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d; + case HeatFluxUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d; + case HeatFluxUnit.NanowattPerSquareMeter: return (_value) * 1e-9d; + case HeatFluxUnit.WattPerSquareFoot: return _value*1.07639e1; + case HeatFluxUnit.WattPerSquareInch: return _value*1.5500031e3; + case HeatFluxUnit.WattPerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(HeatFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case HeatFluxUnit.BtuPerHourSquareFoot: return baseUnitValue/3.15459075; + case HeatFluxUnit.BtuPerMinuteSquareFoot: return baseUnitValue/1.89275445e2; + case HeatFluxUnit.BtuPerSecondSquareFoot: return baseUnitValue/1.13565267e4; + case HeatFluxUnit.BtuPerSecondSquareInch: return baseUnitValue/1.63533984e6; + case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return baseUnitValue/4.1868e4; + case HeatFluxUnit.CentiwattPerSquareMeter: return (baseUnitValue) / 1e-2d; + case HeatFluxUnit.DeciwattPerSquareMeter: return (baseUnitValue) / 1e-1d; + case HeatFluxUnit.KilocaloriePerHourSquareMeter: return baseUnitValue/1.163; + case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (baseUnitValue/4.1868e4) / 1e3d; + case HeatFluxUnit.KilowattPerSquareMeter: return (baseUnitValue) / 1e3d; + case HeatFluxUnit.MicrowattPerSquareMeter: return (baseUnitValue) / 1e-6d; + case HeatFluxUnit.MilliwattPerSquareMeter: return (baseUnitValue) / 1e-3d; + case HeatFluxUnit.NanowattPerSquareMeter: return (baseUnitValue) / 1e-9d; + case HeatFluxUnit.WattPerSquareFoot: return baseUnitValue/1.07639e1; + case HeatFluxUnit.WattPerSquareInch: return baseUnitValue/1.5500031e3; + case HeatFluxUnit.WattPerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..49fa0395d2 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -0,0 +1,587 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class HeatTransferCoefficient : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly HeatTransferCoefficientUnit? _unit; + + static HeatTransferCoefficient() + { + BaseDimensions = new BaseDimensions(0, 1, -3, 0, -1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public HeatTransferCoefficient() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private HeatTransferCoefficient(double numericValue, HeatTransferCoefficientUnit unit) + { + if(unit == HeatTransferCoefficientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of HeatTransferCoefficient, which is WattPerSquareMeterKelvin. All conversions go via this value. + /// + public static HeatTransferCoefficientUnit BaseUnit => HeatTransferCoefficientUnit.WattPerSquareMeterKelvin; + + /// + /// Represents the largest possible value of HeatTransferCoefficient + /// + public static HeatTransferCoefficient MaxValue => new HeatTransferCoefficient(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of HeatTransferCoefficient + /// + public static HeatTransferCoefficient MinValue => new HeatTransferCoefficient(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.HeatTransferCoefficient; + + /// + /// All units of measurement for the HeatTransferCoefficient quantity. + /// + public static HeatTransferCoefficientUnit[] Units { get; } = Enum.GetValues(typeof(HeatTransferCoefficientUnit)).Cast().Except(new HeatTransferCoefficientUnit[]{ HeatTransferCoefficientUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. + /// + public static HeatTransferCoefficient Zero => new HeatTransferCoefficient(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public HeatTransferCoefficientUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => HeatTransferCoefficient.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => HeatTransferCoefficient.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get HeatTransferCoefficient in WattsPerSquareMeterCelsius. + /// + public double WattsPerSquareMeterCelsius => As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); + + /// + /// Get HeatTransferCoefficient in WattsPerSquareMeterKelvin. + /// + public double WattsPerSquareMeterKelvin => As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(HeatTransferCoefficientUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get HeatTransferCoefficient from WattsPerSquareMeterCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(double wattspersquaremetercelsius) + { + double value = (double) wattspersquaremetercelsius; + return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); + } + /// + /// Get HeatTransferCoefficient from WattsPerSquareMeterKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(double wattspersquaremeterkelvin) + { + double value = (double) wattspersquaremeterkelvin; + return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// HeatTransferCoefficient unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static HeatTransferCoefficient From(double value, HeatTransferCoefficientUnit fromUnit) + { + return new HeatTransferCoefficient((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static HeatTransferCoefficient Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static HeatTransferCoefficient Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out HeatTransferCoefficient result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static HeatTransferCoefficientUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static HeatTransferCoefficientUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out HeatTransferCoefficientUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out HeatTransferCoefficientUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is HeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); + + return CompareTo((HeatTransferCoefficient)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(HeatTransferCoefficient other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another HeatTransferCoefficient within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current HeatTransferCoefficient. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(HeatTransferCoefficientUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this HeatTransferCoefficient to another HeatTransferCoefficient with the unit representation . + /// + /// A HeatTransferCoefficient with the specified unit. + public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new HeatTransferCoefficient(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return _value; + case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(HeatTransferCoefficientUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return baseUnitValue; + case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..87cc96ecbd --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,624 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In photometry, illuminance is the total luminous flux incident on a surface, per unit area. + /// + /// + /// https://en.wikipedia.org/wiki/Illuminance + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Illuminance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly IlluminanceUnit? _unit; + + static Illuminance() + { + BaseDimensions = new BaseDimensions(-2, 0, 0, 0, 0, 0, 1); + } + /// + /// Creates the quantity with a value of 0 in the base unit Lux. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Illuminance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Illuminance(double numericValue, IlluminanceUnit unit) + { + if(unit == IlluminanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Illuminance, which is Lux. All conversions go via this value. + /// + public static IlluminanceUnit BaseUnit => IlluminanceUnit.Lux; + + /// + /// Represents the largest possible value of Illuminance + /// + public static Illuminance MaxValue => new Illuminance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Illuminance + /// + public static Illuminance MinValue => new Illuminance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Illuminance; + + /// + /// All units of measurement for the Illuminance quantity. + /// + public static IlluminanceUnit[] Units { get; } = Enum.GetValues(typeof(IlluminanceUnit)).Cast().Except(new IlluminanceUnit[]{ IlluminanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Lux. + /// + public static Illuminance Zero => new Illuminance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public IlluminanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Illuminance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Illuminance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Illuminance in Kilolux. + /// + public double Kilolux => As(IlluminanceUnit.Kilolux); + + /// + /// Get Illuminance in Lux. + /// + public double Lux => As(IlluminanceUnit.Lux); + + /// + /// Get Illuminance in Megalux. + /// + public double Megalux => As(IlluminanceUnit.Megalux); + + /// + /// Get Illuminance in Millilux. + /// + public double Millilux => As(IlluminanceUnit.Millilux); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(IlluminanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Illuminance from Kilolux. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Illuminance FromKilolux(double kilolux) + { + double value = (double) kilolux; + return new Illuminance(value, IlluminanceUnit.Kilolux); + } + /// + /// Get Illuminance from Lux. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Illuminance FromLux(double lux) + { + double value = (double) lux; + return new Illuminance(value, IlluminanceUnit.Lux); + } + /// + /// Get Illuminance from Megalux. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Illuminance FromMegalux(double megalux) + { + double value = (double) megalux; + return new Illuminance(value, IlluminanceUnit.Megalux); + } + /// + /// Get Illuminance from Millilux. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Illuminance FromMillilux(double millilux) + { + double value = (double) millilux; + return new Illuminance(value, IlluminanceUnit.Millilux); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Illuminance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Illuminance From(double value, IlluminanceUnit fromUnit) + { + return new Illuminance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Illuminance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Illuminance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Illuminance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Illuminance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IlluminanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static IlluminanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out IlluminanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IlluminanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Illuminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); + + return CompareTo((Illuminance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Illuminance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Illuminance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Illuminance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(IlluminanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Illuminance to another Illuminance with the unit representation . + /// + /// A Illuminance with the specified unit. + public Illuminance ToUnit(IlluminanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Illuminance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case IlluminanceUnit.Kilolux: return (_value) * 1e3d; + case IlluminanceUnit.Lux: return _value; + case IlluminanceUnit.Megalux: return (_value) * 1e6d; + case IlluminanceUnit.Millilux: return (_value) * 1e-3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(IlluminanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case IlluminanceUnit.Kilolux: return (baseUnitValue) / 1e3d; + case IlluminanceUnit.Lux: return baseUnitValue; + case IlluminanceUnit.Megalux: return (baseUnitValue) / 1e6d; + case IlluminanceUnit.Millilux: return (baseUnitValue) / 1e-3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..87bee65bf0 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,587 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Irradiance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly IrradianceUnit? _unit; + + static Irradiance() + { + BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit WattPerSquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Irradiance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Irradiance(double numericValue, IrradianceUnit unit) + { + if(unit == IrradianceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Irradiance, which is WattPerSquareMeter. All conversions go via this value. + /// + public static IrradianceUnit BaseUnit => IrradianceUnit.WattPerSquareMeter; + + /// + /// Represents the largest possible value of Irradiance + /// + public static Irradiance MaxValue => new Irradiance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Irradiance + /// + public static Irradiance MinValue => new Irradiance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Irradiance; + + /// + /// All units of measurement for the Irradiance quantity. + /// + public static IrradianceUnit[] Units { get; } = Enum.GetValues(typeof(IrradianceUnit)).Cast().Except(new IrradianceUnit[]{ IrradianceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. + /// + public static Irradiance Zero => new Irradiance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public IrradianceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Irradiance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Irradiance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Irradiance in KilowattsPerSquareMeter. + /// + public double KilowattsPerSquareMeter => As(IrradianceUnit.KilowattPerSquareMeter); + + /// + /// Get Irradiance in WattsPerSquareMeter. + /// + public double WattsPerSquareMeter => As(IrradianceUnit.WattPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(IrradianceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Irradiance from KilowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Irradiance FromKilowattsPerSquareMeter(double kilowattspersquaremeter) + { + double value = (double) kilowattspersquaremeter; + return new Irradiance(value, IrradianceUnit.KilowattPerSquareMeter); + } + /// + /// Get Irradiance from WattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Irradiance FromWattsPerSquareMeter(double wattspersquaremeter) + { + double value = (double) wattspersquaremeter; + return new Irradiance(value, IrradianceUnit.WattPerSquareMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Irradiance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Irradiance From(double value, IrradianceUnit fromUnit) + { + return new Irradiance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Irradiance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Irradiance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Irradiance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IrradianceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static IrradianceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out IrradianceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradianceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Irradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); + + return CompareTo((Irradiance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Irradiance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Irradiance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Irradiance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(IrradianceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Irradiance to another Irradiance with the unit representation . + /// + /// A Irradiance with the specified unit. + public Irradiance ToUnit(IrradianceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Irradiance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case IrradianceUnit.KilowattPerSquareMeter: return (_value) * 1e3d; + case IrradianceUnit.WattPerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(IrradianceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case IrradianceUnit.KilowattPerSquareMeter: return (baseUnitValue) / 1e3d; + case IrradianceUnit.WattPerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..9478a879a7 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -0,0 +1,607 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Irradiation is the process by which an object is exposed to radiation. The exposure can originate from various sources, including natural sources. + /// + /// + /// https://en.wikipedia.org/wiki/Irradiation + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Irradiation : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly IrradiationUnit? _unit; + + static Irradiation() + { + BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit JoulePerSquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Irradiation() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Irradiation(double numericValue, IrradiationUnit unit) + { + if(unit == IrradiationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Irradiation, which is JoulePerSquareMeter. All conversions go via this value. + /// + public static IrradiationUnit BaseUnit => IrradiationUnit.JoulePerSquareMeter; + + /// + /// Represents the largest possible value of Irradiation + /// + public static Irradiation MaxValue => new Irradiation(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Irradiation + /// + public static Irradiation MinValue => new Irradiation(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Irradiation; + + /// + /// All units of measurement for the Irradiation quantity. + /// + public static IrradiationUnit[] Units { get; } = Enum.GetValues(typeof(IrradiationUnit)).Cast().Except(new IrradiationUnit[]{ IrradiationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerSquareMeter. + /// + public static Irradiation Zero => new Irradiation(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public IrradiationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Irradiation.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Irradiation.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Irradiation in JoulesPerSquareMeter. + /// + public double JoulesPerSquareMeter => As(IrradiationUnit.JoulePerSquareMeter); + + /// + /// Get Irradiation in KilowattHoursPerSquareMeter. + /// + public double KilowattHoursPerSquareMeter => As(IrradiationUnit.KilowattHourPerSquareMeter); + + /// + /// Get Irradiation in WattHoursPerSquareMeter. + /// + public double WattHoursPerSquareMeter => As(IrradiationUnit.WattHourPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(IrradiationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Irradiation from JoulesPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Irradiation FromJoulesPerSquareMeter(double joulespersquaremeter) + { + double value = (double) joulespersquaremeter; + return new Irradiation(value, IrradiationUnit.JoulePerSquareMeter); + } + /// + /// Get Irradiation from KilowattHoursPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Irradiation FromKilowattHoursPerSquareMeter(double kilowatthourspersquaremeter) + { + double value = (double) kilowatthourspersquaremeter; + return new Irradiation(value, IrradiationUnit.KilowattHourPerSquareMeter); + } + /// + /// Get Irradiation from WattHoursPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Irradiation FromWattHoursPerSquareMeter(double watthourspersquaremeter) + { + double value = (double) watthourspersquaremeter; + return new Irradiation(value, IrradiationUnit.WattHourPerSquareMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Irradiation unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Irradiation From(double value, IrradiationUnit fromUnit) + { + return new Irradiation((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Irradiation Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Irradiation Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Irradiation result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Irradiation result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IrradiationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static IrradiationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out IrradiationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out IrradiationUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Irradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); + + return CompareTo((Irradiation)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Irradiation other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Irradiation within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Irradiation. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(IrradiationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Irradiation to another Irradiation with the unit representation . + /// + /// A Irradiation with the specified unit. + public Irradiation ToUnit(IrradiationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Irradiation(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case IrradiationUnit.JoulePerSquareMeter: return _value; + case IrradiationUnit.KilowattHourPerSquareMeter: return (_value*3600d) * 1e3d; + case IrradiationUnit.WattHourPerSquareMeter: return _value*3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(IrradiationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case IrradiationUnit.JoulePerSquareMeter: return baseUnitValue; + case IrradiationUnit.KilowattHourPerSquareMeter: return (baseUnitValue/3600d) / 1e3d; + case IrradiationUnit.WattHourPerSquareMeter: return baseUnitValue/3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..cfc7afe804 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,692 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. + /// + /// + /// http://en.wikipedia.org/wiki/Viscosity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class KinematicViscosity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly KinematicViscosityUnit? _unit; + + static KinematicViscosity() + { + BaseDimensions = new BaseDimensions(2, 0, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit SquareMeterPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public KinematicViscosity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private KinematicViscosity(double numericValue, KinematicViscosityUnit unit) + { + if(unit == KinematicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of KinematicViscosity, which is SquareMeterPerSecond. All conversions go via this value. + /// + public static KinematicViscosityUnit BaseUnit => KinematicViscosityUnit.SquareMeterPerSecond; + + /// + /// Represents the largest possible value of KinematicViscosity + /// + public static KinematicViscosity MaxValue => new KinematicViscosity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of KinematicViscosity + /// + public static KinematicViscosity MinValue => new KinematicViscosity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.KinematicViscosity; + + /// + /// All units of measurement for the KinematicViscosity quantity. + /// + public static KinematicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(KinematicViscosityUnit)).Cast().Except(new KinematicViscosityUnit[]{ KinematicViscosityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterPerSecond. + /// + public static KinematicViscosity Zero => new KinematicViscosity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public KinematicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => KinematicViscosity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => KinematicViscosity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get KinematicViscosity in Centistokes. + /// + public double Centistokes => As(KinematicViscosityUnit.Centistokes); + + /// + /// Get KinematicViscosity in Decistokes. + /// + public double Decistokes => As(KinematicViscosityUnit.Decistokes); + + /// + /// Get KinematicViscosity in Kilostokes. + /// + public double Kilostokes => As(KinematicViscosityUnit.Kilostokes); + + /// + /// Get KinematicViscosity in Microstokes. + /// + public double Microstokes => As(KinematicViscosityUnit.Microstokes); + + /// + /// Get KinematicViscosity in Millistokes. + /// + public double Millistokes => As(KinematicViscosityUnit.Millistokes); + + /// + /// Get KinematicViscosity in Nanostokes. + /// + public double Nanostokes => As(KinematicViscosityUnit.Nanostokes); + + /// + /// Get KinematicViscosity in SquareMetersPerSecond. + /// + public double SquareMetersPerSecond => As(KinematicViscosityUnit.SquareMeterPerSecond); + + /// + /// Get KinematicViscosity in Stokes. + /// + public double Stokes => As(KinematicViscosityUnit.Stokes); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(KinematicViscosityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get KinematicViscosity from Centistokes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromCentistokes(double centistokes) + { + double value = (double) centistokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Centistokes); + } + /// + /// Get KinematicViscosity from Decistokes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromDecistokes(double decistokes) + { + double value = (double) decistokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Decistokes); + } + /// + /// Get KinematicViscosity from Kilostokes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromKilostokes(double kilostokes) + { + double value = (double) kilostokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Kilostokes); + } + /// + /// Get KinematicViscosity from Microstokes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromMicrostokes(double microstokes) + { + double value = (double) microstokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Microstokes); + } + /// + /// Get KinematicViscosity from Millistokes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromMillistokes(double millistokes) + { + double value = (double) millistokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Millistokes); + } + /// + /// Get KinematicViscosity from Nanostokes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromNanostokes(double nanostokes) + { + double value = (double) nanostokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Nanostokes); + } + /// + /// Get KinematicViscosity from SquareMetersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromSquareMetersPerSecond(double squaremeterspersecond) + { + double value = (double) squaremeterspersecond; + return new KinematicViscosity(value, KinematicViscosityUnit.SquareMeterPerSecond); + } + /// + /// Get KinematicViscosity from Stokes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static KinematicViscosity FromStokes(double stokes) + { + double value = (double) stokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Stokes); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// KinematicViscosity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static KinematicViscosity From(double value, KinematicViscosityUnit fromUnit) + { + return new KinematicViscosity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static KinematicViscosity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static KinematicViscosity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out KinematicViscosity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out KinematicViscosity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static KinematicViscosityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static KinematicViscosityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out KinematicViscosityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out KinematicViscosityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is KinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); + + return CompareTo((KinematicViscosity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(KinematicViscosity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another KinematicViscosity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current KinematicViscosity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(KinematicViscosityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this KinematicViscosity to another KinematicViscosity with the unit representation . + /// + /// A KinematicViscosity with the specified unit. + public KinematicViscosity ToUnit(KinematicViscosityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new KinematicViscosity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case KinematicViscosityUnit.Centistokes: return (_value/1e4) * 1e-2d; + case KinematicViscosityUnit.Decistokes: return (_value/1e4) * 1e-1d; + case KinematicViscosityUnit.Kilostokes: return (_value/1e4) * 1e3d; + case KinematicViscosityUnit.Microstokes: return (_value/1e4) * 1e-6d; + case KinematicViscosityUnit.Millistokes: return (_value/1e4) * 1e-3d; + case KinematicViscosityUnit.Nanostokes: return (_value/1e4) * 1e-9d; + case KinematicViscosityUnit.SquareMeterPerSecond: return _value; + case KinematicViscosityUnit.Stokes: return _value/1e4; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(KinematicViscosityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case KinematicViscosityUnit.Centistokes: return (baseUnitValue*1e4) / 1e-2d; + case KinematicViscosityUnit.Decistokes: return (baseUnitValue*1e4) / 1e-1d; + case KinematicViscosityUnit.Kilostokes: return (baseUnitValue*1e4) / 1e3d; + case KinematicViscosityUnit.Microstokes: return (baseUnitValue*1e4) / 1e-6d; + case KinematicViscosityUnit.Millistokes: return (baseUnitValue*1e4) / 1e-3d; + case KinematicViscosityUnit.Nanostokes: return (baseUnitValue*1e4) / 1e-9d; + case KinematicViscosityUnit.SquareMeterPerSecond: return baseUnitValue; + case KinematicViscosityUnit.Stokes: return baseUnitValue*1e4; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..f622b8d710 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -0,0 +1,570 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class LapseRate : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LapseRateUnit? _unit; + + static LapseRate() + { + BaseDimensions = new BaseDimensions(-1, 0, 0, 0, 1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public LapseRate() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private LapseRate(double numericValue, LapseRateUnit unit) + { + if(unit == LapseRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LapseRate, which is DegreeCelsiusPerKilometer. All conversions go via this value. + /// + public static LapseRateUnit BaseUnit => LapseRateUnit.DegreeCelsiusPerKilometer; + + /// + /// Represents the largest possible value of LapseRate + /// + public static LapseRate MaxValue => new LapseRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LapseRate + /// + public static LapseRate MinValue => new LapseRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LapseRate; + + /// + /// All units of measurement for the LapseRate quantity. + /// + public static LapseRateUnit[] Units { get; } = Enum.GetValues(typeof(LapseRateUnit)).Cast().Except(new LapseRateUnit[]{ LapseRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. + /// + public static LapseRate Zero => new LapseRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LapseRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LapseRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LapseRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LapseRate in DegreesCelciusPerKilometer. + /// + public double DegreesCelciusPerKilometer => As(LapseRateUnit.DegreeCelsiusPerKilometer); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LapseRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LapseRate from DegreesCelciusPerKilometer. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static LapseRate FromDegreesCelciusPerKilometer(double degreescelciusperkilometer) + { + double value = (double) degreescelciusperkilometer; + return new LapseRate(value, LapseRateUnit.DegreeCelsiusPerKilometer); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LapseRate unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static LapseRate From(double value, LapseRateUnit fromUnit) + { + return new LapseRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LapseRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LapseRate Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LapseRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LapseRate result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LapseRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LapseRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LapseRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LapseRateUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); + + return CompareTo((LapseRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(LapseRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LapseRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LapseRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LapseRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LapseRate to another LapseRate with the unit representation . + /// + /// A LapseRate with the specified unit. + public LapseRate ToUnit(LapseRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LapseRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LapseRateUnit.DegreeCelsiusPerKilometer: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LapseRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LapseRateUnit.DegreeCelsiusPerKilometer: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..7cfa3a7f33 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,607 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Linear Density, or more precisely, the linear mass density, of a substance is its mass per unit length. The term linear density is most often used when describing the characteristics of one-dimensional objects, although linear density can also be used to describe the density of a three-dimensional quantity along one particular dimension. + /// + /// + /// http://en.wikipedia.org/wiki/Linear_density + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class LinearDensity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LinearDensityUnit? _unit; + + static LinearDensity() + { + BaseDimensions = new BaseDimensions(-1, 1, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit KilogramPerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public LinearDensity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private LinearDensity(double numericValue, LinearDensityUnit unit) + { + if(unit == LinearDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LinearDensity, which is KilogramPerMeter. All conversions go via this value. + /// + public static LinearDensityUnit BaseUnit => LinearDensityUnit.KilogramPerMeter; + + /// + /// Represents the largest possible value of LinearDensity + /// + public static LinearDensity MaxValue => new LinearDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LinearDensity + /// + public static LinearDensity MinValue => new LinearDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LinearDensity; + + /// + /// All units of measurement for the LinearDensity quantity. + /// + public static LinearDensityUnit[] Units { get; } = Enum.GetValues(typeof(LinearDensityUnit)).Cast().Except(new LinearDensityUnit[]{ LinearDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMeter. + /// + public static LinearDensity Zero => new LinearDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LinearDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LinearDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LinearDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LinearDensity in GramsPerMeter. + /// + public double GramsPerMeter => As(LinearDensityUnit.GramPerMeter); + + /// + /// Get LinearDensity in KilogramsPerMeter. + /// + public double KilogramsPerMeter => As(LinearDensityUnit.KilogramPerMeter); + + /// + /// Get LinearDensity in PoundsPerFoot. + /// + public double PoundsPerFoot => As(LinearDensityUnit.PoundPerFoot); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LinearDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LinearDensity from GramsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static LinearDensity FromGramsPerMeter(double gramspermeter) + { + double value = (double) gramspermeter; + return new LinearDensity(value, LinearDensityUnit.GramPerMeter); + } + /// + /// Get LinearDensity from KilogramsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static LinearDensity FromKilogramsPerMeter(double kilogramspermeter) + { + double value = (double) kilogramspermeter; + return new LinearDensity(value, LinearDensityUnit.KilogramPerMeter); + } + /// + /// Get LinearDensity from PoundsPerFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static LinearDensity FromPoundsPerFoot(double poundsperfoot) + { + double value = (double) poundsperfoot; + return new LinearDensity(value, LinearDensityUnit.PoundPerFoot); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LinearDensity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static LinearDensity From(double value, LinearDensityUnit fromUnit) + { + return new LinearDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LinearDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LinearDensity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LinearDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LinearDensity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LinearDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LinearDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LinearDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LinearDensityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); + + return CompareTo((LinearDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(LinearDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LinearDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LinearDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LinearDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LinearDensity to another LinearDensity with the unit representation . + /// + /// A LinearDensity with the specified unit. + public LinearDensity ToUnit(LinearDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LinearDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LinearDensityUnit.GramPerMeter: return _value*1e-3; + case LinearDensityUnit.KilogramPerMeter: return (_value*1e-3) * 1e3d; + case LinearDensityUnit.PoundPerFoot: return _value*1.48816394; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LinearDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LinearDensityUnit.GramPerMeter: return baseUnitValue/1e-3; + case LinearDensityUnit.KilogramPerMeter: return (baseUnitValue/1e-3) / 1e3d; + case LinearDensityUnit.PoundPerFoot: return baseUnitValue/1.48816394; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..7188f7cd59 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In photometry, luminous flux or luminous power is the measure of the perceived power of light. + /// + /// + /// https://en.wikipedia.org/wiki/Luminous_flux + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class LuminousFlux : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LuminousFluxUnit? _unit; + + static LuminousFlux() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); + } + /// + /// Creates the quantity with a value of 0 in the base unit Lumen. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public LuminousFlux() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private LuminousFlux(double numericValue, LuminousFluxUnit unit) + { + if(unit == LuminousFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LuminousFlux, which is Lumen. All conversions go via this value. + /// + public static LuminousFluxUnit BaseUnit => LuminousFluxUnit.Lumen; + + /// + /// Represents the largest possible value of LuminousFlux + /// + public static LuminousFlux MaxValue => new LuminousFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LuminousFlux + /// + public static LuminousFlux MinValue => new LuminousFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LuminousFlux; + + /// + /// All units of measurement for the LuminousFlux quantity. + /// + public static LuminousFluxUnit[] Units { get; } = Enum.GetValues(typeof(LuminousFluxUnit)).Cast().Except(new LuminousFluxUnit[]{ LuminousFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Lumen. + /// + public static LuminousFlux Zero => new LuminousFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LuminousFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LuminousFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LuminousFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LuminousFlux in Lumens. + /// + public double Lumens => As(LuminousFluxUnit.Lumen); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LuminousFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LuminousFlux from Lumens. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static LuminousFlux FromLumens(double lumens) + { + double value = (double) lumens; + return new LuminousFlux(value, LuminousFluxUnit.Lumen); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LuminousFlux unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static LuminousFlux From(double value, LuminousFluxUnit fromUnit) + { + return new LuminousFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LuminousFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LuminousFlux Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LuminousFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousFlux result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LuminousFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LuminousFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LuminousFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousFluxUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); + + return CompareTo((LuminousFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(LuminousFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LuminousFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LuminousFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LuminousFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LuminousFlux to another LuminousFlux with the unit representation . + /// + /// A LuminousFlux with the specified unit. + public LuminousFlux ToUnit(LuminousFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LuminousFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LuminousFluxUnit.Lumen: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LuminousFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LuminousFluxUnit.Lumen: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..0ae059bf84 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In photometry, luminous intensity is a measure of the wavelength-weighted power emitted by a light source in a particular direction per unit solid angle, based on the luminosity function, a standardized model of the sensitivity of the human eye. + /// + /// + /// https://en.wikipedia.org/wiki/Luminous_intensity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class LuminousIntensity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LuminousIntensityUnit? _unit; + + static LuminousIntensity() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); + } + /// + /// Creates the quantity with a value of 0 in the base unit Candela. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public LuminousIntensity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private LuminousIntensity(double numericValue, LuminousIntensityUnit unit) + { + if(unit == LuminousIntensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LuminousIntensity, which is Candela. All conversions go via this value. + /// + public static LuminousIntensityUnit BaseUnit => LuminousIntensityUnit.Candela; + + /// + /// Represents the largest possible value of LuminousIntensity + /// + public static LuminousIntensity MaxValue => new LuminousIntensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LuminousIntensity + /// + public static LuminousIntensity MinValue => new LuminousIntensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LuminousIntensity; + + /// + /// All units of measurement for the LuminousIntensity quantity. + /// + public static LuminousIntensityUnit[] Units { get; } = Enum.GetValues(typeof(LuminousIntensityUnit)).Cast().Except(new LuminousIntensityUnit[]{ LuminousIntensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Candela. + /// + public static LuminousIntensity Zero => new LuminousIntensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LuminousIntensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LuminousIntensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LuminousIntensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LuminousIntensity in Candela. + /// + public double Candela => As(LuminousIntensityUnit.Candela); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LuminousIntensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LuminousIntensity from Candela. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static LuminousIntensity FromCandela(double candela) + { + double value = (double) candela; + return new LuminousIntensity(value, LuminousIntensityUnit.Candela); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LuminousIntensity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static LuminousIntensity From(double value, LuminousIntensityUnit fromUnit) + { + return new LuminousIntensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LuminousIntensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LuminousIntensity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LuminousIntensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out LuminousIntensity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LuminousIntensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static LuminousIntensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LuminousIntensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out LuminousIntensityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); + + return CompareTo((LuminousIntensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(LuminousIntensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LuminousIntensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LuminousIntensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LuminousIntensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LuminousIntensity to another LuminousIntensity with the unit representation . + /// + /// A LuminousIntensity with the specified unit. + public LuminousIntensity ToUnit(LuminousIntensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LuminousIntensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LuminousIntensityUnit.Candela: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LuminousIntensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LuminousIntensityUnit.Candela: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..543d738511 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A magnetic field is a force field that is created by moving electric charges (electric currents) and magnetic dipoles, and exerts a force on other nearby moving charges and magnetic dipoles. + /// + /// + /// https://en.wikipedia.org/wiki/Magnetic_field + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MagneticField : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MagneticFieldUnit? _unit; + + static MagneticField() + { + BaseDimensions = new BaseDimensions(0, 1, -2, -1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Tesla. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MagneticField() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MagneticField(double numericValue, MagneticFieldUnit unit) + { + if(unit == MagneticFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MagneticField, which is Tesla. All conversions go via this value. + /// + public static MagneticFieldUnit BaseUnit => MagneticFieldUnit.Tesla; + + /// + /// Represents the largest possible value of MagneticField + /// + public static MagneticField MaxValue => new MagneticField(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MagneticField + /// + public static MagneticField MinValue => new MagneticField(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MagneticField; + + /// + /// All units of measurement for the MagneticField quantity. + /// + public static MagneticFieldUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFieldUnit)).Cast().Except(new MagneticFieldUnit[]{ MagneticFieldUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Tesla. + /// + public static MagneticField Zero => new MagneticField(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MagneticFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MagneticField.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MagneticField.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MagneticField in Teslas. + /// + public double Teslas => As(MagneticFieldUnit.Tesla); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MagneticFieldUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MagneticField from Teslas. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MagneticField FromTeslas(double teslas) + { + double value = (double) teslas; + return new MagneticField(value, MagneticFieldUnit.Tesla); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MagneticField unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MagneticField From(double value, MagneticFieldUnit fromUnit) + { + return new MagneticField((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MagneticField Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MagneticField Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MagneticField result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticField result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagneticFieldUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MagneticFieldUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MagneticFieldUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFieldUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); + + return CompareTo((MagneticField)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MagneticField other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MagneticField within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MagneticField. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MagneticFieldUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MagneticField to another MagneticField with the unit representation . + /// + /// A MagneticField with the specified unit. + public MagneticField ToUnit(MagneticFieldUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MagneticField(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MagneticFieldUnit.Tesla: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MagneticFieldUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MagneticFieldUnit.Tesla: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..bc7a0ff539 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, specifically electromagnetism, the magnetic flux through a surface is the surface integral of the normal component of the magnetic field B passing through that surface. + /// + /// + /// https://en.wikipedia.org/wiki/Magnetic_flux + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MagneticFlux : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MagneticFluxUnit? _unit; + + static MagneticFlux() + { + BaseDimensions = new BaseDimensions(2, 1, -2, -1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Weber. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MagneticFlux() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MagneticFlux(double numericValue, MagneticFluxUnit unit) + { + if(unit == MagneticFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MagneticFlux, which is Weber. All conversions go via this value. + /// + public static MagneticFluxUnit BaseUnit => MagneticFluxUnit.Weber; + + /// + /// Represents the largest possible value of MagneticFlux + /// + public static MagneticFlux MaxValue => new MagneticFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MagneticFlux + /// + public static MagneticFlux MinValue => new MagneticFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MagneticFlux; + + /// + /// All units of measurement for the MagneticFlux quantity. + /// + public static MagneticFluxUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFluxUnit)).Cast().Except(new MagneticFluxUnit[]{ MagneticFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Weber. + /// + public static MagneticFlux Zero => new MagneticFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MagneticFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MagneticFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MagneticFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MagneticFlux in Webers. + /// + public double Webers => As(MagneticFluxUnit.Weber); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MagneticFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MagneticFlux from Webers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MagneticFlux FromWebers(double webers) + { + double value = (double) webers; + return new MagneticFlux(value, MagneticFluxUnit.Weber); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MagneticFlux unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MagneticFlux From(double value, MagneticFluxUnit fromUnit) + { + return new MagneticFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MagneticFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MagneticFlux Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MagneticFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MagneticFlux result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagneticFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MagneticFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MagneticFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagneticFluxUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); + + return CompareTo((MagneticFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MagneticFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MagneticFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MagneticFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MagneticFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MagneticFlux to another MagneticFlux with the unit representation . + /// + /// A MagneticFlux with the specified unit. + public MagneticFlux ToUnit(MagneticFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MagneticFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MagneticFluxUnit.Weber: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MagneticFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MagneticFluxUnit.Weber: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..ba3a41139d --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In classical electromagnetism, magnetization is the vector field that expresses the density of permanent or induced magnetic dipole moments in a magnetic material. + /// + /// + /// https://en.wikipedia.org/wiki/Magnetization + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Magnetization : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MagnetizationUnit? _unit; + + static Magnetization() + { + BaseDimensions = new BaseDimensions(-1, 0, 0, 1, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit AmperePerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Magnetization() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Magnetization(double numericValue, MagnetizationUnit unit) + { + if(unit == MagnetizationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Magnetization, which is AmperePerMeter. All conversions go via this value. + /// + public static MagnetizationUnit BaseUnit => MagnetizationUnit.AmperePerMeter; + + /// + /// Represents the largest possible value of Magnetization + /// + public static Magnetization MaxValue => new Magnetization(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Magnetization + /// + public static Magnetization MinValue => new Magnetization(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Magnetization; + + /// + /// All units of measurement for the Magnetization quantity. + /// + public static MagnetizationUnit[] Units { get; } = Enum.GetValues(typeof(MagnetizationUnit)).Cast().Except(new MagnetizationUnit[]{ MagnetizationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerMeter. + /// + public static Magnetization Zero => new Magnetization(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MagnetizationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Magnetization.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Magnetization.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Magnetization in AmperesPerMeter. + /// + public double AmperesPerMeter => As(MagnetizationUnit.AmperePerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MagnetizationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Magnetization from AmperesPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Magnetization FromAmperesPerMeter(double amperespermeter) + { + double value = (double) amperespermeter; + return new Magnetization(value, MagnetizationUnit.AmperePerMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Magnetization unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Magnetization From(double value, MagnetizationUnit fromUnit) + { + return new Magnetization((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Magnetization Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Magnetization Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Magnetization result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Magnetization result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagnetizationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MagnetizationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MagnetizationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MagnetizationUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Magnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); + + return CompareTo((Magnetization)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Magnetization other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Magnetization within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Magnetization. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MagnetizationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Magnetization to another Magnetization with the unit representation . + /// + /// A Magnetization with the specified unit. + public Magnetization ToUnit(MagnetizationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Magnetization(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MagnetizationUnit.AmperePerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MagnetizationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MagnetizationUnit.AmperePerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..30fb8adb4f --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -0,0 +1,927 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Mass : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassUnit? _unit; + + static Mass() + { + BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Kilogram. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Mass() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Mass(double numericValue, MassUnit unit) + { + if(unit == MassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Mass, which is Kilogram. All conversions go via this value. + /// + public static MassUnit BaseUnit => MassUnit.Kilogram; + + /// + /// Represents the largest possible value of Mass + /// + public static Mass MaxValue => new Mass(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Mass + /// + public static Mass MinValue => new Mass(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Mass; + + /// + /// All units of measurement for the Mass quantity. + /// + public static MassUnit[] Units { get; } = Enum.GetValues(typeof(MassUnit)).Cast().Except(new MassUnit[]{ MassUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Kilogram. + /// + public static Mass Zero => new Mass(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Mass.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Mass.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Mass in Centigrams. + /// + public double Centigrams => As(MassUnit.Centigram); + + /// + /// Get Mass in Decagrams. + /// + public double Decagrams => As(MassUnit.Decagram); + + /// + /// Get Mass in Decigrams. + /// + public double Decigrams => As(MassUnit.Decigram); + + /// + /// Get Mass in Grams. + /// + public double Grams => As(MassUnit.Gram); + + /// + /// Get Mass in Hectograms. + /// + public double Hectograms => As(MassUnit.Hectogram); + + /// + /// Get Mass in Kilograms. + /// + public double Kilograms => As(MassUnit.Kilogram); + + /// + /// Get Mass in Kilopounds. + /// + public double Kilopounds => As(MassUnit.Kilopound); + + /// + /// Get Mass in Kilotonnes. + /// + public double Kilotonnes => As(MassUnit.Kilotonne); + + /// + /// Get Mass in LongHundredweight. + /// + public double LongHundredweight => As(MassUnit.LongHundredweight); + + /// + /// Get Mass in LongTons. + /// + public double LongTons => As(MassUnit.LongTon); + + /// + /// Get Mass in Megapounds. + /// + public double Megapounds => As(MassUnit.Megapound); + + /// + /// Get Mass in Megatonnes. + /// + public double Megatonnes => As(MassUnit.Megatonne); + + /// + /// Get Mass in Micrograms. + /// + public double Micrograms => As(MassUnit.Microgram); + + /// + /// Get Mass in Milligrams. + /// + public double Milligrams => As(MassUnit.Milligram); + + /// + /// Get Mass in Nanograms. + /// + public double Nanograms => As(MassUnit.Nanogram); + + /// + /// Get Mass in Ounces. + /// + public double Ounces => As(MassUnit.Ounce); + + /// + /// Get Mass in Pounds. + /// + public double Pounds => As(MassUnit.Pound); + + /// + /// Get Mass in ShortHundredweight. + /// + public double ShortHundredweight => As(MassUnit.ShortHundredweight); + + /// + /// Get Mass in ShortTons. + /// + public double ShortTons => As(MassUnit.ShortTon); + + /// + /// Get Mass in Slugs. + /// + public double Slugs => As(MassUnit.Slug); + + /// + /// Get Mass in Stone. + /// + public double Stone => As(MassUnit.Stone); + + /// + /// Get Mass in Tonnes. + /// + public double Tonnes => As(MassUnit.Tonne); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MassUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Mass from Centigrams. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromCentigrams(double centigrams) + { + double value = (double) centigrams; + return new Mass(value, MassUnit.Centigram); + } + /// + /// Get Mass from Decagrams. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromDecagrams(double decagrams) + { + double value = (double) decagrams; + return new Mass(value, MassUnit.Decagram); + } + /// + /// Get Mass from Decigrams. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromDecigrams(double decigrams) + { + double value = (double) decigrams; + return new Mass(value, MassUnit.Decigram); + } + /// + /// Get Mass from Grams. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromGrams(double grams) + { + double value = (double) grams; + return new Mass(value, MassUnit.Gram); + } + /// + /// Get Mass from Hectograms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromHectograms(double hectograms) + { + double value = (double) hectograms; + return new Mass(value, MassUnit.Hectogram); + } + /// + /// Get Mass from Kilograms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromKilograms(double kilograms) + { + double value = (double) kilograms; + return new Mass(value, MassUnit.Kilogram); + } + /// + /// Get Mass from Kilopounds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromKilopounds(double kilopounds) + { + double value = (double) kilopounds; + return new Mass(value, MassUnit.Kilopound); + } + /// + /// Get Mass from Kilotonnes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromKilotonnes(double kilotonnes) + { + double value = (double) kilotonnes; + return new Mass(value, MassUnit.Kilotonne); + } + /// + /// Get Mass from LongHundredweight. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromLongHundredweight(double longhundredweight) + { + double value = (double) longhundredweight; + return new Mass(value, MassUnit.LongHundredweight); + } + /// + /// Get Mass from LongTons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromLongTons(double longtons) + { + double value = (double) longtons; + return new Mass(value, MassUnit.LongTon); + } + /// + /// Get Mass from Megapounds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromMegapounds(double megapounds) + { + double value = (double) megapounds; + return new Mass(value, MassUnit.Megapound); + } + /// + /// Get Mass from Megatonnes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromMegatonnes(double megatonnes) + { + double value = (double) megatonnes; + return new Mass(value, MassUnit.Megatonne); + } + /// + /// Get Mass from Micrograms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromMicrograms(double micrograms) + { + double value = (double) micrograms; + return new Mass(value, MassUnit.Microgram); + } + /// + /// Get Mass from Milligrams. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromMilligrams(double milligrams) + { + double value = (double) milligrams; + return new Mass(value, MassUnit.Milligram); + } + /// + /// Get Mass from Nanograms. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromNanograms(double nanograms) + { + double value = (double) nanograms; + return new Mass(value, MassUnit.Nanogram); + } + /// + /// Get Mass from Ounces. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromOunces(double ounces) + { + double value = (double) ounces; + return new Mass(value, MassUnit.Ounce); + } + /// + /// Get Mass from Pounds. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromPounds(double pounds) + { + double value = (double) pounds; + return new Mass(value, MassUnit.Pound); + } + /// + /// Get Mass from ShortHundredweight. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromShortHundredweight(double shorthundredweight) + { + double value = (double) shorthundredweight; + return new Mass(value, MassUnit.ShortHundredweight); + } + /// + /// Get Mass from ShortTons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromShortTons(double shorttons) + { + double value = (double) shorttons; + return new Mass(value, MassUnit.ShortTon); + } + /// + /// Get Mass from Slugs. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromSlugs(double slugs) + { + double value = (double) slugs; + return new Mass(value, MassUnit.Slug); + } + /// + /// Get Mass from Stone. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromStone(double stone) + { + double value = (double) stone; + return new Mass(value, MassUnit.Stone); + } + /// + /// Get Mass from Tonnes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Mass FromTonnes(double tonnes) + { + double value = (double) tonnes; + return new Mass(value, MassUnit.Tonne); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Mass unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Mass From(double value, MassUnit fromUnit) + { + return new Mass((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Mass Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Mass Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Mass result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Mass result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MassUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Mass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); + + return CompareTo((Mass)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Mass other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Mass within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Mass. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Mass to another Mass with the unit representation . + /// + /// A Mass with the specified unit. + public Mass ToUnit(MassUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Mass(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassUnit.Centigram: return (_value/1e3) * 1e-2d; + case MassUnit.Decagram: return (_value/1e3) * 1e1d; + case MassUnit.Decigram: return (_value/1e3) * 1e-1d; + case MassUnit.Gram: return _value/1e3; + case MassUnit.Hectogram: return (_value/1e3) * 1e2d; + case MassUnit.Kilogram: return (_value/1e3) * 1e3d; + case MassUnit.Kilopound: return (_value*0.45359237) * 1e3d; + case MassUnit.Kilotonne: return (_value*1e3) * 1e3d; + case MassUnit.LongHundredweight: return _value/0.01968413055222121; + case MassUnit.LongTon: return _value*1.0160469088e3; + case MassUnit.Megapound: return (_value*0.45359237) * 1e6d; + case MassUnit.Megatonne: return (_value*1e3) * 1e6d; + case MassUnit.Microgram: return (_value/1e3) * 1e-6d; + case MassUnit.Milligram: return (_value/1e3) * 1e-3d; + case MassUnit.Nanogram: return (_value/1e3) * 1e-9d; + case MassUnit.Ounce: return _value/35.2739619; + case MassUnit.Pound: return _value*0.45359237; + case MassUnit.ShortHundredweight: return _value/0.022046226218487758; + case MassUnit.ShortTon: return _value*9.0718474e2; + case MassUnit.Slug: return _value/6.852176556196105e-2; + case MassUnit.Stone: return _value/0.1574731728702698; + case MassUnit.Tonne: return _value*1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassUnit.Centigram: return (baseUnitValue*1e3) / 1e-2d; + case MassUnit.Decagram: return (baseUnitValue*1e3) / 1e1d; + case MassUnit.Decigram: return (baseUnitValue*1e3) / 1e-1d; + case MassUnit.Gram: return baseUnitValue*1e3; + case MassUnit.Hectogram: return (baseUnitValue*1e3) / 1e2d; + case MassUnit.Kilogram: return (baseUnitValue*1e3) / 1e3d; + case MassUnit.Kilopound: return (baseUnitValue/0.45359237) / 1e3d; + case MassUnit.Kilotonne: return (baseUnitValue/1e3) / 1e3d; + case MassUnit.LongHundredweight: return baseUnitValue*0.01968413055222121; + case MassUnit.LongTon: return baseUnitValue/1.0160469088e3; + case MassUnit.Megapound: return (baseUnitValue/0.45359237) / 1e6d; + case MassUnit.Megatonne: return (baseUnitValue/1e3) / 1e6d; + case MassUnit.Microgram: return (baseUnitValue*1e3) / 1e-6d; + case MassUnit.Milligram: return (baseUnitValue*1e3) / 1e-3d; + case MassUnit.Nanogram: return (baseUnitValue*1e3) / 1e-9d; + case MassUnit.Ounce: return baseUnitValue*35.2739619; + case MassUnit.Pound: return baseUnitValue/0.45359237; + case MassUnit.ShortHundredweight: return baseUnitValue*0.022046226218487758; + case MassUnit.ShortTon: return baseUnitValue/9.0718474e2; + case MassUnit.Slug: return baseUnitValue*6.852176556196105e-2; + case MassUnit.Stone: return baseUnitValue*0.1574731728702698; + case MassUnit.Tonne: return baseUnitValue/1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..b4fd71ac29 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -0,0 +1,842 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MassFlow : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassFlowUnit? _unit; + + static MassFlow() + { + BaseDimensions = new BaseDimensions(0, 1, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit GramPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MassFlow() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MassFlow(double numericValue, MassFlowUnit unit) + { + if(unit == MassFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MassFlow, which is GramPerSecond. All conversions go via this value. + /// + public static MassFlowUnit BaseUnit => MassFlowUnit.GramPerSecond; + + /// + /// Represents the largest possible value of MassFlow + /// + public static MassFlow MaxValue => new MassFlow(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MassFlow + /// + public static MassFlow MinValue => new MassFlow(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MassFlow; + + /// + /// All units of measurement for the MassFlow quantity. + /// + public static MassFlowUnit[] Units { get; } = Enum.GetValues(typeof(MassFlowUnit)).Cast().Except(new MassFlowUnit[]{ MassFlowUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit GramPerSecond. + /// + public static MassFlow Zero => new MassFlow(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MassFlow.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassFlow.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MassFlow in CentigramsPerSecond. + /// + public double CentigramsPerSecond => As(MassFlowUnit.CentigramPerSecond); + + /// + /// Get MassFlow in DecagramsPerSecond. + /// + public double DecagramsPerSecond => As(MassFlowUnit.DecagramPerSecond); + + /// + /// Get MassFlow in DecigramsPerSecond. + /// + public double DecigramsPerSecond => As(MassFlowUnit.DecigramPerSecond); + + /// + /// Get MassFlow in GramsPerSecond. + /// + public double GramsPerSecond => As(MassFlowUnit.GramPerSecond); + + /// + /// Get MassFlow in HectogramsPerSecond. + /// + public double HectogramsPerSecond => As(MassFlowUnit.HectogramPerSecond); + + /// + /// Get MassFlow in KilogramsPerHour. + /// + public double KilogramsPerHour => As(MassFlowUnit.KilogramPerHour); + + /// + /// Get MassFlow in KilogramsPerSecond. + /// + public double KilogramsPerSecond => As(MassFlowUnit.KilogramPerSecond); + + /// + /// Get MassFlow in MegapoundsPerHour. + /// + public double MegapoundsPerHour => As(MassFlowUnit.MegapoundPerHour); + + /// + /// Get MassFlow in MegapoundsPerMinute. + /// + public double MegapoundsPerMinute => As(MassFlowUnit.MegapoundPerMinute); + + /// + /// Get MassFlow in MicrogramsPerSecond. + /// + public double MicrogramsPerSecond => As(MassFlowUnit.MicrogramPerSecond); + + /// + /// Get MassFlow in MilligramsPerSecond. + /// + public double MilligramsPerSecond => As(MassFlowUnit.MilligramPerSecond); + + /// + /// Get MassFlow in NanogramsPerSecond. + /// + public double NanogramsPerSecond => As(MassFlowUnit.NanogramPerSecond); + + /// + /// Get MassFlow in PoundsPerHour. + /// + public double PoundsPerHour => As(MassFlowUnit.PoundPerHour); + + /// + /// Get MassFlow in PoundsPerMinute. + /// + public double PoundsPerMinute => As(MassFlowUnit.PoundPerMinute); + + /// + /// Get MassFlow in ShortTonsPerHour. + /// + public double ShortTonsPerHour => As(MassFlowUnit.ShortTonPerHour); + + /// + /// Get MassFlow in TonnesPerDay. + /// + public double TonnesPerDay => As(MassFlowUnit.TonnePerDay); + + /// + /// Get MassFlow in TonnesPerHour. + /// + public double TonnesPerHour => As(MassFlowUnit.TonnePerHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassFlowUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MassFlow from CentigramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromCentigramsPerSecond(double centigramspersecond) + { + double value = (double) centigramspersecond; + return new MassFlow(value, MassFlowUnit.CentigramPerSecond); + } + /// + /// Get MassFlow from DecagramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromDecagramsPerSecond(double decagramspersecond) + { + double value = (double) decagramspersecond; + return new MassFlow(value, MassFlowUnit.DecagramPerSecond); + } + /// + /// Get MassFlow from DecigramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromDecigramsPerSecond(double decigramspersecond) + { + double value = (double) decigramspersecond; + return new MassFlow(value, MassFlowUnit.DecigramPerSecond); + } + /// + /// Get MassFlow from GramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromGramsPerSecond(double gramspersecond) + { + double value = (double) gramspersecond; + return new MassFlow(value, MassFlowUnit.GramPerSecond); + } + /// + /// Get MassFlow from HectogramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromHectogramsPerSecond(double hectogramspersecond) + { + double value = (double) hectogramspersecond; + return new MassFlow(value, MassFlowUnit.HectogramPerSecond); + } + /// + /// Get MassFlow from KilogramsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromKilogramsPerHour(double kilogramsperhour) + { + double value = (double) kilogramsperhour; + return new MassFlow(value, MassFlowUnit.KilogramPerHour); + } + /// + /// Get MassFlow from KilogramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromKilogramsPerSecond(double kilogramspersecond) + { + double value = (double) kilogramspersecond; + return new MassFlow(value, MassFlowUnit.KilogramPerSecond); + } + /// + /// Get MassFlow from MegapoundsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromMegapoundsPerHour(double megapoundsperhour) + { + double value = (double) megapoundsperhour; + return new MassFlow(value, MassFlowUnit.MegapoundPerHour); + } + /// + /// Get MassFlow from MegapoundsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromMegapoundsPerMinute(double megapoundsperminute) + { + double value = (double) megapoundsperminute; + return new MassFlow(value, MassFlowUnit.MegapoundPerMinute); + } + /// + /// Get MassFlow from MicrogramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromMicrogramsPerSecond(double microgramspersecond) + { + double value = (double) microgramspersecond; + return new MassFlow(value, MassFlowUnit.MicrogramPerSecond); + } + /// + /// Get MassFlow from MilligramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromMilligramsPerSecond(double milligramspersecond) + { + double value = (double) milligramspersecond; + return new MassFlow(value, MassFlowUnit.MilligramPerSecond); + } + /// + /// Get MassFlow from NanogramsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromNanogramsPerSecond(double nanogramspersecond) + { + double value = (double) nanogramspersecond; + return new MassFlow(value, MassFlowUnit.NanogramPerSecond); + } + /// + /// Get MassFlow from PoundsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromPoundsPerHour(double poundsperhour) + { + double value = (double) poundsperhour; + return new MassFlow(value, MassFlowUnit.PoundPerHour); + } + /// + /// Get MassFlow from PoundsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromPoundsPerMinute(double poundsperminute) + { + double value = (double) poundsperminute; + return new MassFlow(value, MassFlowUnit.PoundPerMinute); + } + /// + /// Get MassFlow from ShortTonsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromShortTonsPerHour(double shorttonsperhour) + { + double value = (double) shorttonsperhour; + return new MassFlow(value, MassFlowUnit.ShortTonPerHour); + } + /// + /// Get MassFlow from TonnesPerDay. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromTonnesPerDay(double tonnesperday) + { + double value = (double) tonnesperday; + return new MassFlow(value, MassFlowUnit.TonnePerDay); + } + /// + /// Get MassFlow from TonnesPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlow FromTonnesPerHour(double tonnesperhour) + { + double value = (double) tonnesperhour; + return new MassFlow(value, MassFlowUnit.TonnePerHour); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MassFlow unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MassFlow From(double value, MassFlowUnit fromUnit) + { + return new MassFlow((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MassFlow Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MassFlow Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MassFlow result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlow result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassFlowUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MassFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassFlowUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFlowUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); + + return CompareTo((MassFlow)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MassFlow other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MassFlow within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MassFlow. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassFlowUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MassFlow to another MassFlow with the unit representation . + /// + /// A MassFlow with the specified unit. + public MassFlow ToUnit(MassFlowUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MassFlow(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassFlowUnit.CentigramPerSecond: return (_value) * 1e-2d; + case MassFlowUnit.DecagramPerSecond: return (_value) * 1e1d; + case MassFlowUnit.DecigramPerSecond: return (_value) * 1e-1d; + case MassFlowUnit.GramPerSecond: return _value; + case MassFlowUnit.HectogramPerSecond: return (_value) * 1e2d; + case MassFlowUnit.KilogramPerHour: return _value/3.6; + case MassFlowUnit.KilogramPerSecond: return (_value) * 1e3d; + case MassFlowUnit.MegapoundPerHour: return (_value/7.93664) * 1e6d; + case MassFlowUnit.MegapoundPerMinute: return (_value/0.132277) * 1e6d; + case MassFlowUnit.MicrogramPerSecond: return (_value) * 1e-6d; + case MassFlowUnit.MilligramPerSecond: return (_value) * 1e-3d; + case MassFlowUnit.NanogramPerSecond: return (_value) * 1e-9d; + case MassFlowUnit.PoundPerHour: return _value/7.93664; + case MassFlowUnit.PoundPerMinute: return _value/0.132277; + case MassFlowUnit.ShortTonPerHour: return _value*251.9957611; + case MassFlowUnit.TonnePerDay: return _value/0.0864000; + case MassFlowUnit.TonnePerHour: return 1000*_value/3.6; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassFlowUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassFlowUnit.CentigramPerSecond: return (baseUnitValue) / 1e-2d; + case MassFlowUnit.DecagramPerSecond: return (baseUnitValue) / 1e1d; + case MassFlowUnit.DecigramPerSecond: return (baseUnitValue) / 1e-1d; + case MassFlowUnit.GramPerSecond: return baseUnitValue; + case MassFlowUnit.HectogramPerSecond: return (baseUnitValue) / 1e2d; + case MassFlowUnit.KilogramPerHour: return baseUnitValue*3.6; + case MassFlowUnit.KilogramPerSecond: return (baseUnitValue) / 1e3d; + case MassFlowUnit.MegapoundPerHour: return (baseUnitValue*7.93664) / 1e6d; + case MassFlowUnit.MegapoundPerMinute: return (baseUnitValue*0.132277) / 1e6d; + case MassFlowUnit.MicrogramPerSecond: return (baseUnitValue) / 1e-6d; + case MassFlowUnit.MilligramPerSecond: return (baseUnitValue) / 1e-3d; + case MassFlowUnit.NanogramPerSecond: return (baseUnitValue) / 1e-9d; + case MassFlowUnit.PoundPerHour: return baseUnitValue*7.93664; + case MassFlowUnit.PoundPerMinute: return baseUnitValue*0.132277; + case MassFlowUnit.ShortTonPerHour: return baseUnitValue/251.9957611; + case MassFlowUnit.TonnePerDay: return baseUnitValue*0.0864000; + case MassFlowUnit.TonnePerHour: return baseUnitValue*3.6/1000; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..c8a81c7e16 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -0,0 +1,587 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Mass flux is the mass flow rate per unit area. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MassFlux : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassFluxUnit? _unit; + + static MassFlux() + { + BaseDimensions = new BaseDimensions(-2, 1, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MassFlux() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MassFlux(double numericValue, MassFluxUnit unit) + { + if(unit == MassFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MassFlux, which is KilogramPerSecondPerSquareMeter. All conversions go via this value. + /// + public static MassFluxUnit BaseUnit => MassFluxUnit.KilogramPerSecondPerSquareMeter; + + /// + /// Represents the largest possible value of MassFlux + /// + public static MassFlux MaxValue => new MassFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MassFlux + /// + public static MassFlux MinValue => new MassFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MassFlux; + + /// + /// All units of measurement for the MassFlux quantity. + /// + public static MassFluxUnit[] Units { get; } = Enum.GetValues(typeof(MassFluxUnit)).Cast().Except(new MassFluxUnit[]{ MassFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. + /// + public static MassFlux Zero => new MassFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MassFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MassFlux in GramsPerSecondPerSquareMeter. + /// + public double GramsPerSecondPerSquareMeter => As(MassFluxUnit.GramPerSecondPerSquareMeter); + + /// + /// Get MassFlux in KilogramsPerSecondPerSquareMeter. + /// + public double KilogramsPerSecondPerSquareMeter => As(MassFluxUnit.KilogramPerSecondPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MassFlux from GramsPerSecondPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlux FromGramsPerSecondPerSquareMeter(double gramspersecondpersquaremeter) + { + double value = (double) gramspersecondpersquaremeter; + return new MassFlux(value, MassFluxUnit.GramPerSecondPerSquareMeter); + } + /// + /// Get MassFlux from KilogramsPerSecondPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassFlux FromKilogramsPerSecondPerSquareMeter(double kilogramspersecondpersquaremeter) + { + double value = (double) kilogramspersecondpersquaremeter; + return new MassFlux(value, MassFluxUnit.KilogramPerSecondPerSquareMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MassFlux unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MassFlux From(double value, MassFluxUnit fromUnit) + { + return new MassFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MassFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MassFlux Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MassFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassFlux result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MassFluxUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassFluxUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); + + return CompareTo((MassFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MassFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MassFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MassFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MassFlux to another MassFlux with the unit representation . + /// + /// A MassFlux with the specified unit. + public MassFlux ToUnit(MassFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MassFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassFluxUnit.GramPerSecondPerSquareMeter: return _value/1e3; + case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (_value/1e3) * 1e3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassFluxUnit.GramPerSecondPerSquareMeter: return baseUnitValue*1e3; + case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (baseUnitValue*1e3) / 1e3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..9e86954cad --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -0,0 +1,1029 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A property of body reflects how its mass is distributed with regard to an axis. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MassMomentOfInertia : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassMomentOfInertiaUnit? _unit; + + static MassMomentOfInertia() + { + BaseDimensions = new BaseDimensions(2, 1, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit KilogramSquareMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MassMomentOfInertia() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MassMomentOfInertia(double numericValue, MassMomentOfInertiaUnit unit) + { + if(unit == MassMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MassMomentOfInertia, which is KilogramSquareMeter. All conversions go via this value. + /// + public static MassMomentOfInertiaUnit BaseUnit => MassMomentOfInertiaUnit.KilogramSquareMeter; + + /// + /// Represents the largest possible value of MassMomentOfInertia + /// + public static MassMomentOfInertia MaxValue => new MassMomentOfInertia(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MassMomentOfInertia + /// + public static MassMomentOfInertia MinValue => new MassMomentOfInertia(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MassMomentOfInertia; + + /// + /// All units of measurement for the MassMomentOfInertia quantity. + /// + public static MassMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(MassMomentOfInertiaUnit)).Cast().Except(new MassMomentOfInertiaUnit[]{ MassMomentOfInertiaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramSquareMeter. + /// + public static MassMomentOfInertia Zero => new MassMomentOfInertia(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MassMomentOfInertia.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassMomentOfInertia.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MassMomentOfInertia in GramSquareCentimeters. + /// + public double GramSquareCentimeters => As(MassMomentOfInertiaUnit.GramSquareCentimeter); + + /// + /// Get MassMomentOfInertia in GramSquareDecimeters. + /// + public double GramSquareDecimeters => As(MassMomentOfInertiaUnit.GramSquareDecimeter); + + /// + /// Get MassMomentOfInertia in GramSquareMeters. + /// + public double GramSquareMeters => As(MassMomentOfInertiaUnit.GramSquareMeter); + + /// + /// Get MassMomentOfInertia in GramSquareMillimeters. + /// + public double GramSquareMillimeters => As(MassMomentOfInertiaUnit.GramSquareMillimeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareCentimeters. + /// + public double KilogramSquareCentimeters => As(MassMomentOfInertiaUnit.KilogramSquareCentimeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareDecimeters. + /// + public double KilogramSquareDecimeters => As(MassMomentOfInertiaUnit.KilogramSquareDecimeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareMeters. + /// + public double KilogramSquareMeters => As(MassMomentOfInertiaUnit.KilogramSquareMeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareMillimeters. + /// + public double KilogramSquareMillimeters => As(MassMomentOfInertiaUnit.KilogramSquareMillimeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareCentimeters. + /// + public double KilotonneSquareCentimeters => As(MassMomentOfInertiaUnit.KilotonneSquareCentimeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareDecimeters. + /// + public double KilotonneSquareDecimeters => As(MassMomentOfInertiaUnit.KilotonneSquareDecimeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareMeters. + /// + public double KilotonneSquareMeters => As(MassMomentOfInertiaUnit.KilotonneSquareMeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareMilimeters. + /// + public double KilotonneSquareMilimeters => As(MassMomentOfInertiaUnit.KilotonneSquareMilimeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareCentimeters. + /// + public double MegatonneSquareCentimeters => As(MassMomentOfInertiaUnit.MegatonneSquareCentimeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareDecimeters. + /// + public double MegatonneSquareDecimeters => As(MassMomentOfInertiaUnit.MegatonneSquareDecimeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareMeters. + /// + public double MegatonneSquareMeters => As(MassMomentOfInertiaUnit.MegatonneSquareMeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareMilimeters. + /// + public double MegatonneSquareMilimeters => As(MassMomentOfInertiaUnit.MegatonneSquareMilimeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareCentimeters. + /// + public double MilligramSquareCentimeters => As(MassMomentOfInertiaUnit.MilligramSquareCentimeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareDecimeters. + /// + public double MilligramSquareDecimeters => As(MassMomentOfInertiaUnit.MilligramSquareDecimeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareMeters. + /// + public double MilligramSquareMeters => As(MassMomentOfInertiaUnit.MilligramSquareMeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareMillimeters. + /// + public double MilligramSquareMillimeters => As(MassMomentOfInertiaUnit.MilligramSquareMillimeter); + + /// + /// Get MassMomentOfInertia in PoundSquareFeet. + /// + public double PoundSquareFeet => As(MassMomentOfInertiaUnit.PoundSquareFoot); + + /// + /// Get MassMomentOfInertia in PoundSquareInches. + /// + public double PoundSquareInches => As(MassMomentOfInertiaUnit.PoundSquareInch); + + /// + /// Get MassMomentOfInertia in SlugSquareFeet. + /// + public double SlugSquareFeet => As(MassMomentOfInertiaUnit.SlugSquareFoot); + + /// + /// Get MassMomentOfInertia in SlugSquareInches. + /// + public double SlugSquareInches => As(MassMomentOfInertiaUnit.SlugSquareInch); + + /// + /// Get MassMomentOfInertia in TonneSquareCentimeters. + /// + public double TonneSquareCentimeters => As(MassMomentOfInertiaUnit.TonneSquareCentimeter); + + /// + /// Get MassMomentOfInertia in TonneSquareDecimeters. + /// + public double TonneSquareDecimeters => As(MassMomentOfInertiaUnit.TonneSquareDecimeter); + + /// + /// Get MassMomentOfInertia in TonneSquareMeters. + /// + public double TonneSquareMeters => As(MassMomentOfInertiaUnit.TonneSquareMeter); + + /// + /// Get MassMomentOfInertia in TonneSquareMilimeters. + /// + public double TonneSquareMilimeters => As(MassMomentOfInertiaUnit.TonneSquareMilimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassMomentOfInertiaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MassMomentOfInertia from GramSquareCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromGramSquareCentimeters(double gramsquarecentimeters) + { + double value = (double) gramsquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from GramSquareDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromGramSquareDecimeters(double gramsquaredecimeters) + { + double value = (double) gramsquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from GramSquareMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromGramSquareMeters(double gramsquaremeters) + { + double value = (double) gramsquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMeter); + } + /// + /// Get MassMomentOfInertia from GramSquareMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromGramSquareMillimeters(double gramsquaremillimeters) + { + double value = (double) gramsquaremillimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMillimeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilogramSquareCentimeters(double kilogramsquarecentimeters) + { + double value = (double) kilogramsquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilogramSquareDecimeters(double kilogramsquaredecimeters) + { + double value = (double) kilogramsquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilogramSquareMeters(double kilogramsquaremeters) + { + double value = (double) kilogramsquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilogramSquareMillimeters(double kilogramsquaremillimeters) + { + double value = (double) kilogramsquaremillimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMillimeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilotonneSquareCentimeters(double kilotonnesquarecentimeters) + { + double value = (double) kilotonnesquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilotonneSquareDecimeters(double kilotonnesquaredecimeters) + { + double value = (double) kilotonnesquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilotonneSquareMeters(double kilotonnesquaremeters) + { + double value = (double) kilotonnesquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareMilimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromKilotonneSquareMilimeters(double kilotonnesquaremilimeters) + { + double value = (double) kilotonnesquaremilimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMilimeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMegatonneSquareCentimeters(double megatonnesquarecentimeters) + { + double value = (double) megatonnesquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMegatonneSquareDecimeters(double megatonnesquaredecimeters) + { + double value = (double) megatonnesquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMegatonneSquareMeters(double megatonnesquaremeters) + { + double value = (double) megatonnesquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareMilimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMegatonneSquareMilimeters(double megatonnesquaremilimeters) + { + double value = (double) megatonnesquaremilimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMilimeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMilligramSquareCentimeters(double milligramsquarecentimeters) + { + double value = (double) milligramsquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMilligramSquareDecimeters(double milligramsquaredecimeters) + { + double value = (double) milligramsquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMilligramSquareMeters(double milligramsquaremeters) + { + double value = (double) milligramsquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromMilligramSquareMillimeters(double milligramsquaremillimeters) + { + double value = (double) milligramsquaremillimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMillimeter); + } + /// + /// Get MassMomentOfInertia from PoundSquareFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromPoundSquareFeet(double poundsquarefeet) + { + double value = (double) poundsquarefeet; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareFoot); + } + /// + /// Get MassMomentOfInertia from PoundSquareInches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromPoundSquareInches(double poundsquareinches) + { + double value = (double) poundsquareinches; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareInch); + } + /// + /// Get MassMomentOfInertia from SlugSquareFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromSlugSquareFeet(double slugsquarefeet) + { + double value = (double) slugsquarefeet; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareFoot); + } + /// + /// Get MassMomentOfInertia from SlugSquareInches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromSlugSquareInches(double slugsquareinches) + { + double value = (double) slugsquareinches; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareInch); + } + /// + /// Get MassMomentOfInertia from TonneSquareCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromTonneSquareCentimeters(double tonnesquarecentimeters) + { + double value = (double) tonnesquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from TonneSquareDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromTonneSquareDecimeters(double tonnesquaredecimeters) + { + double value = (double) tonnesquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from TonneSquareMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromTonneSquareMeters(double tonnesquaremeters) + { + double value = (double) tonnesquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMeter); + } + /// + /// Get MassMomentOfInertia from TonneSquareMilimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MassMomentOfInertia FromTonneSquareMilimeters(double tonnesquaremilimeters) + { + double value = (double) tonnesquaremilimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMilimeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MassMomentOfInertia unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MassMomentOfInertia From(double value, MassMomentOfInertiaUnit fromUnit) + { + return new MassMomentOfInertia((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MassMomentOfInertia Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MassMomentOfInertia Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MassMomentOfInertia result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassMomentOfInertiaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MassMomentOfInertiaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassMomentOfInertiaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MassMomentOfInertiaUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); + + return CompareTo((MassMomentOfInertia)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MassMomentOfInertia other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MassMomentOfInertia within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MassMomentOfInertia. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassMomentOfInertiaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MassMomentOfInertia to another MassMomentOfInertia with the unit representation . + /// + /// A MassMomentOfInertia with the specified unit. + public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MassMomentOfInertia(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassMomentOfInertiaUnit.GramSquareCentimeter: return _value/1e7; + case MassMomentOfInertiaUnit.GramSquareDecimeter: return _value/1e5; + case MassMomentOfInertiaUnit.GramSquareMeter: return _value/1e3; + case MassMomentOfInertiaUnit.GramSquareMillimeter: return _value/1e9; + case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (_value/1e7) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (_value/1e5) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMeter: return (_value/1e3) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (_value/1e9) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (_value/1e1) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (_value/1e-1) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (_value/1e-3) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (_value/1e3) * 1e3d; + case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (_value/1e1) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (_value/1e-1) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (_value/1e-3) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (_value/1e3) * 1e6d; + case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (_value/1e7) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (_value/1e5) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMeter: return (_value/1e3) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (_value/1e9) * 1e-3d; + case MassMomentOfInertiaUnit.PoundSquareFoot: return _value*4.21401101e-2; + case MassMomentOfInertiaUnit.PoundSquareInch: return _value*2.9263965e-4; + case MassMomentOfInertiaUnit.SlugSquareFoot: return _value*1.3558179619; + case MassMomentOfInertiaUnit.SlugSquareInch: return _value*9.41540242e-3; + case MassMomentOfInertiaUnit.TonneSquareCentimeter: return _value/1e1; + case MassMomentOfInertiaUnit.TonneSquareDecimeter: return _value/1e-1; + case MassMomentOfInertiaUnit.TonneSquareMeter: return _value/1e-3; + case MassMomentOfInertiaUnit.TonneSquareMilimeter: return _value/1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassMomentOfInertiaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassMomentOfInertiaUnit.GramSquareCentimeter: return baseUnitValue*1e7; + case MassMomentOfInertiaUnit.GramSquareDecimeter: return baseUnitValue*1e5; + case MassMomentOfInertiaUnit.GramSquareMeter: return baseUnitValue*1e3; + case MassMomentOfInertiaUnit.GramSquareMillimeter: return baseUnitValue*1e9; + case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (baseUnitValue*1e7) / 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (baseUnitValue*1e5) / 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMeter: return (baseUnitValue*1e3) / 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (baseUnitValue*1e9) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (baseUnitValue*1e1) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (baseUnitValue*1e-1) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (baseUnitValue*1e-3) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (baseUnitValue*1e3) / 1e3d; + case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (baseUnitValue*1e1) / 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (baseUnitValue*1e-1) / 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (baseUnitValue*1e-3) / 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (baseUnitValue*1e3) / 1e6d; + case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (baseUnitValue*1e7) / 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (baseUnitValue*1e5) / 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMeter: return (baseUnitValue*1e3) / 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (baseUnitValue*1e9) / 1e-3d; + case MassMomentOfInertiaUnit.PoundSquareFoot: return baseUnitValue/4.21401101e-2; + case MassMomentOfInertiaUnit.PoundSquareInch: return baseUnitValue/2.9263965e-4; + case MassMomentOfInertiaUnit.SlugSquareFoot: return baseUnitValue/1.3558179619; + case MassMomentOfInertiaUnit.SlugSquareInch: return baseUnitValue/9.41540242e-3; + case MassMomentOfInertiaUnit.TonneSquareCentimeter: return baseUnitValue*1e1; + case MassMomentOfInertiaUnit.TonneSquareDecimeter: return baseUnitValue*1e-1; + case MassMomentOfInertiaUnit.TonneSquareMeter: return baseUnitValue*1e-3; + case MassMomentOfInertiaUnit.TonneSquareMilimeter: return baseUnitValue*1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..c3627ad5c0 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Molar energy is the amount of energy stored in 1 mole of a substance. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MolarEnergy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarEnergyUnit? _unit; + + static MolarEnergy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, -1, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit JoulePerMole. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MolarEnergy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MolarEnergy(double numericValue, MolarEnergyUnit unit) + { + if(unit == MolarEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MolarEnergy, which is JoulePerMole. All conversions go via this value. + /// + public static MolarEnergyUnit BaseUnit => MolarEnergyUnit.JoulePerMole; + + /// + /// Represents the largest possible value of MolarEnergy + /// + public static MolarEnergy MaxValue => new MolarEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MolarEnergy + /// + public static MolarEnergy MinValue => new MolarEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MolarEnergy; + + /// + /// All units of measurement for the MolarEnergy quantity. + /// + public static MolarEnergyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEnergyUnit)).Cast().Except(new MolarEnergyUnit[]{ MolarEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMole. + /// + public static MolarEnergy Zero => new MolarEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MolarEnergy in JoulesPerMole. + /// + public double JoulesPerMole => As(MolarEnergyUnit.JoulePerMole); + + /// + /// Get MolarEnergy in KilojoulesPerMole. + /// + public double KilojoulesPerMole => As(MolarEnergyUnit.KilojoulePerMole); + + /// + /// Get MolarEnergy in MegajoulesPerMole. + /// + public double MegajoulesPerMole => As(MolarEnergyUnit.MegajoulePerMole); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MolarEnergy from JoulesPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarEnergy FromJoulesPerMole(double joulespermole) + { + double value = (double) joulespermole; + return new MolarEnergy(value, MolarEnergyUnit.JoulePerMole); + } + /// + /// Get MolarEnergy from KilojoulesPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarEnergy FromKilojoulesPerMole(double kilojoulespermole) + { + double value = (double) kilojoulespermole; + return new MolarEnergy(value, MolarEnergyUnit.KilojoulePerMole); + } + /// + /// Get MolarEnergy from MegajoulesPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarEnergy FromMegajoulesPerMole(double megajoulespermole) + { + double value = (double) megajoulespermole; + return new MolarEnergy(value, MolarEnergyUnit.MegajoulePerMole); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MolarEnergy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MolarEnergy From(double value, MolarEnergyUnit fromUnit) + { + return new MolarEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MolarEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MolarEnergy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MolarEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEnergy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MolarEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEnergyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); + + return CompareTo((MolarEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MolarEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MolarEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MolarEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MolarEnergy to another MolarEnergy with the unit representation . + /// + /// A MolarEnergy with the specified unit. + public MolarEnergy ToUnit(MolarEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MolarEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarEnergyUnit.JoulePerMole: return _value; + case MolarEnergyUnit.KilojoulePerMole: return (_value) * 1e3d; + case MolarEnergyUnit.MegajoulePerMole: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarEnergyUnit.JoulePerMole: return baseUnitValue; + case MolarEnergyUnit.KilojoulePerMole: return (baseUnitValue) / 1e3d; + case MolarEnergyUnit.MegajoulePerMole: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..e242f67383 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MolarEntropy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarEntropyUnit? _unit; + + static MolarEntropy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, -1, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit JoulePerMoleKelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MolarEntropy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MolarEntropy(double numericValue, MolarEntropyUnit unit) + { + if(unit == MolarEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MolarEntropy, which is JoulePerMoleKelvin. All conversions go via this value. + /// + public static MolarEntropyUnit BaseUnit => MolarEntropyUnit.JoulePerMoleKelvin; + + /// + /// Represents the largest possible value of MolarEntropy + /// + public static MolarEntropy MaxValue => new MolarEntropy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MolarEntropy + /// + public static MolarEntropy MinValue => new MolarEntropy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MolarEntropy; + + /// + /// All units of measurement for the MolarEntropy quantity. + /// + public static MolarEntropyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEntropyUnit)).Cast().Except(new MolarEntropyUnit[]{ MolarEntropyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMoleKelvin. + /// + public static MolarEntropy Zero => new MolarEntropy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarEntropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarEntropy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MolarEntropy in JoulesPerMoleKelvin. + /// + public double JoulesPerMoleKelvin => As(MolarEntropyUnit.JoulePerMoleKelvin); + + /// + /// Get MolarEntropy in KilojoulesPerMoleKelvin. + /// + public double KilojoulesPerMoleKelvin => As(MolarEntropyUnit.KilojoulePerMoleKelvin); + + /// + /// Get MolarEntropy in MegajoulesPerMoleKelvin. + /// + public double MegajoulesPerMoleKelvin => As(MolarEntropyUnit.MegajoulePerMoleKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarEntropyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MolarEntropy from JoulesPerMoleKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarEntropy FromJoulesPerMoleKelvin(double joulespermolekelvin) + { + double value = (double) joulespermolekelvin; + return new MolarEntropy(value, MolarEntropyUnit.JoulePerMoleKelvin); + } + /// + /// Get MolarEntropy from KilojoulesPerMoleKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarEntropy FromKilojoulesPerMoleKelvin(double kilojoulespermolekelvin) + { + double value = (double) kilojoulespermolekelvin; + return new MolarEntropy(value, MolarEntropyUnit.KilojoulePerMoleKelvin); + } + /// + /// Get MolarEntropy from MegajoulesPerMoleKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarEntropy FromMegajoulesPerMoleKelvin(double megajoulespermolekelvin) + { + double value = (double) megajoulespermolekelvin; + return new MolarEntropy(value, MolarEntropyUnit.MegajoulePerMoleKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MolarEntropy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MolarEntropy From(double value, MolarEntropyUnit fromUnit) + { + return new MolarEntropy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MolarEntropy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MolarEntropy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MolarEntropy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarEntropy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarEntropyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MolarEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarEntropyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarEntropyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); + + return CompareTo((MolarEntropy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MolarEntropy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MolarEntropy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MolarEntropy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarEntropyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MolarEntropy to another MolarEntropy with the unit representation . + /// + /// A MolarEntropy with the specified unit. + public MolarEntropy ToUnit(MolarEntropyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MolarEntropy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarEntropyUnit.JoulePerMoleKelvin: return _value; + case MolarEntropyUnit.KilojoulePerMoleKelvin: return (_value) * 1e3d; + case MolarEntropyUnit.MegajoulePerMoleKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarEntropyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarEntropyUnit.JoulePerMoleKelvin: return baseUnitValue; + case MolarEntropyUnit.KilojoulePerMoleKelvin: return (baseUnitValue) / 1e3d; + case MolarEntropyUnit.MegajoulePerMoleKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..6721889a8b --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -0,0 +1,757 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class MolarMass : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarMassUnit? _unit; + + static MolarMass() + { + BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, -1, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit KilogramPerMole. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public MolarMass() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private MolarMass(double numericValue, MolarMassUnit unit) + { + if(unit == MolarMassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MolarMass, which is KilogramPerMole. All conversions go via this value. + /// + public static MolarMassUnit BaseUnit => MolarMassUnit.KilogramPerMole; + + /// + /// Represents the largest possible value of MolarMass + /// + public static MolarMass MaxValue => new MolarMass(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MolarMass + /// + public static MolarMass MinValue => new MolarMass(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MolarMass; + + /// + /// All units of measurement for the MolarMass quantity. + /// + public static MolarMassUnit[] Units { get; } = Enum.GetValues(typeof(MolarMassUnit)).Cast().Except(new MolarMassUnit[]{ MolarMassUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMole. + /// + public static MolarMass Zero => new MolarMass(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarMassUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarMass.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarMass.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MolarMass in CentigramsPerMole. + /// + public double CentigramsPerMole => As(MolarMassUnit.CentigramPerMole); + + /// + /// Get MolarMass in DecagramsPerMole. + /// + public double DecagramsPerMole => As(MolarMassUnit.DecagramPerMole); + + /// + /// Get MolarMass in DecigramsPerMole. + /// + public double DecigramsPerMole => As(MolarMassUnit.DecigramPerMole); + + /// + /// Get MolarMass in GramsPerMole. + /// + public double GramsPerMole => As(MolarMassUnit.GramPerMole); + + /// + /// Get MolarMass in HectogramsPerMole. + /// + public double HectogramsPerMole => As(MolarMassUnit.HectogramPerMole); + + /// + /// Get MolarMass in KilogramsPerMole. + /// + public double KilogramsPerMole => As(MolarMassUnit.KilogramPerMole); + + /// + /// Get MolarMass in KilopoundsPerMole. + /// + public double KilopoundsPerMole => As(MolarMassUnit.KilopoundPerMole); + + /// + /// Get MolarMass in MegapoundsPerMole. + /// + public double MegapoundsPerMole => As(MolarMassUnit.MegapoundPerMole); + + /// + /// Get MolarMass in MicrogramsPerMole. + /// + public double MicrogramsPerMole => As(MolarMassUnit.MicrogramPerMole); + + /// + /// Get MolarMass in MilligramsPerMole. + /// + public double MilligramsPerMole => As(MolarMassUnit.MilligramPerMole); + + /// + /// Get MolarMass in NanogramsPerMole. + /// + public double NanogramsPerMole => As(MolarMassUnit.NanogramPerMole); + + /// + /// Get MolarMass in PoundsPerMole. + /// + public double PoundsPerMole => As(MolarMassUnit.PoundPerMole); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarMassUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MolarMass from CentigramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromCentigramsPerMole(double centigramspermole) + { + double value = (double) centigramspermole; + return new MolarMass(value, MolarMassUnit.CentigramPerMole); + } + /// + /// Get MolarMass from DecagramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromDecagramsPerMole(double decagramspermole) + { + double value = (double) decagramspermole; + return new MolarMass(value, MolarMassUnit.DecagramPerMole); + } + /// + /// Get MolarMass from DecigramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromDecigramsPerMole(double decigramspermole) + { + double value = (double) decigramspermole; + return new MolarMass(value, MolarMassUnit.DecigramPerMole); + } + /// + /// Get MolarMass from GramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromGramsPerMole(double gramspermole) + { + double value = (double) gramspermole; + return new MolarMass(value, MolarMassUnit.GramPerMole); + } + /// + /// Get MolarMass from HectogramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromHectogramsPerMole(double hectogramspermole) + { + double value = (double) hectogramspermole; + return new MolarMass(value, MolarMassUnit.HectogramPerMole); + } + /// + /// Get MolarMass from KilogramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromKilogramsPerMole(double kilogramspermole) + { + double value = (double) kilogramspermole; + return new MolarMass(value, MolarMassUnit.KilogramPerMole); + } + /// + /// Get MolarMass from KilopoundsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromKilopoundsPerMole(double kilopoundspermole) + { + double value = (double) kilopoundspermole; + return new MolarMass(value, MolarMassUnit.KilopoundPerMole); + } + /// + /// Get MolarMass from MegapoundsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromMegapoundsPerMole(double megapoundspermole) + { + double value = (double) megapoundspermole; + return new MolarMass(value, MolarMassUnit.MegapoundPerMole); + } + /// + /// Get MolarMass from MicrogramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromMicrogramsPerMole(double microgramspermole) + { + double value = (double) microgramspermole; + return new MolarMass(value, MolarMassUnit.MicrogramPerMole); + } + /// + /// Get MolarMass from MilligramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromMilligramsPerMole(double milligramspermole) + { + double value = (double) milligramspermole; + return new MolarMass(value, MolarMassUnit.MilligramPerMole); + } + /// + /// Get MolarMass from NanogramsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromNanogramsPerMole(double nanogramspermole) + { + double value = (double) nanogramspermole; + return new MolarMass(value, MolarMassUnit.NanogramPerMole); + } + /// + /// Get MolarMass from PoundsPerMole. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static MolarMass FromPoundsPerMole(double poundspermole) + { + double value = (double) poundspermole; + return new MolarMass(value, MolarMassUnit.PoundPerMole); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MolarMass unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static MolarMass From(double value, MolarMassUnit fromUnit) + { + return new MolarMass((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MolarMass Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MolarMass Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MolarMass result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out MolarMass result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarMassUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MolarMassUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarMassUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarMassUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); + + return CompareTo((MolarMass)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(MolarMass other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MolarMass within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MolarMass. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarMassUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MolarMass to another MolarMass with the unit representation . + /// + /// A MolarMass with the specified unit. + public MolarMass ToUnit(MolarMassUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MolarMass(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarMassUnit.CentigramPerMole: return (_value/1e3) * 1e-2d; + case MolarMassUnit.DecagramPerMole: return (_value/1e3) * 1e1d; + case MolarMassUnit.DecigramPerMole: return (_value/1e3) * 1e-1d; + case MolarMassUnit.GramPerMole: return _value/1e3; + case MolarMassUnit.HectogramPerMole: return (_value/1e3) * 1e2d; + case MolarMassUnit.KilogramPerMole: return (_value/1e3) * 1e3d; + case MolarMassUnit.KilopoundPerMole: return (_value*0.45359237) * 1e3d; + case MolarMassUnit.MegapoundPerMole: return (_value*0.45359237) * 1e6d; + case MolarMassUnit.MicrogramPerMole: return (_value/1e3) * 1e-6d; + case MolarMassUnit.MilligramPerMole: return (_value/1e3) * 1e-3d; + case MolarMassUnit.NanogramPerMole: return (_value/1e3) * 1e-9d; + case MolarMassUnit.PoundPerMole: return _value*0.45359237; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarMassUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarMassUnit.CentigramPerMole: return (baseUnitValue*1e3) / 1e-2d; + case MolarMassUnit.DecagramPerMole: return (baseUnitValue*1e3) / 1e1d; + case MolarMassUnit.DecigramPerMole: return (baseUnitValue*1e3) / 1e-1d; + case MolarMassUnit.GramPerMole: return baseUnitValue*1e3; + case MolarMassUnit.HectogramPerMole: return (baseUnitValue*1e3) / 1e2d; + case MolarMassUnit.KilogramPerMole: return (baseUnitValue*1e3) / 1e3d; + case MolarMassUnit.KilopoundPerMole: return (baseUnitValue/0.45359237) / 1e3d; + case MolarMassUnit.MegapoundPerMole: return (baseUnitValue/0.45359237) / 1e6d; + case MolarMassUnit.MicrogramPerMole: return (baseUnitValue*1e3) / 1e-6d; + case MolarMassUnit.MilligramPerMole: return (baseUnitValue*1e3) / 1e-3d; + case MolarMassUnit.NanogramPerMole: return (baseUnitValue*1e3) / 1e-9d; + case MolarMassUnit.PoundPerMole: return baseUnitValue/0.45359237; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..9906d6cc14 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,692 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Molar concentration, also called molarity, amount concentration or substance concentration, is a measure of the concentration of a solute in a solution, or of any chemical species, in terms of amount of substance in a given volume. + /// + /// + /// https://en.wikipedia.org/wiki/Molar_concentration + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Molarity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarityUnit? _unit; + + static Molarity() + { + BaseDimensions = new BaseDimensions(-3, 0, 0, 0, 0, 1, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit MolesPerCubicMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Molarity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Molarity(double numericValue, MolarityUnit unit) + { + if(unit == MolarityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Molarity, which is MolesPerCubicMeter. All conversions go via this value. + /// + public static MolarityUnit BaseUnit => MolarityUnit.MolesPerCubicMeter; + + /// + /// Represents the largest possible value of Molarity + /// + public static Molarity MaxValue => new Molarity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Molarity + /// + public static Molarity MinValue => new Molarity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Molarity; + + /// + /// All units of measurement for the Molarity quantity. + /// + public static MolarityUnit[] Units { get; } = Enum.GetValues(typeof(MolarityUnit)).Cast().Except(new MolarityUnit[]{ MolarityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MolesPerCubicMeter. + /// + public static Molarity Zero => new Molarity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Molarity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Molarity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Molarity in CentimolesPerLiter. + /// + public double CentimolesPerLiter => As(MolarityUnit.CentimolesPerLiter); + + /// + /// Get Molarity in DecimolesPerLiter. + /// + public double DecimolesPerLiter => As(MolarityUnit.DecimolesPerLiter); + + /// + /// Get Molarity in MicromolesPerLiter. + /// + public double MicromolesPerLiter => As(MolarityUnit.MicromolesPerLiter); + + /// + /// Get Molarity in MillimolesPerLiter. + /// + public double MillimolesPerLiter => As(MolarityUnit.MillimolesPerLiter); + + /// + /// Get Molarity in MolesPerCubicMeter. + /// + public double MolesPerCubicMeter => As(MolarityUnit.MolesPerCubicMeter); + + /// + /// Get Molarity in MolesPerLiter. + /// + public double MolesPerLiter => As(MolarityUnit.MolesPerLiter); + + /// + /// Get Molarity in NanomolesPerLiter. + /// + public double NanomolesPerLiter => As(MolarityUnit.NanomolesPerLiter); + + /// + /// Get Molarity in PicomolesPerLiter. + /// + public double PicomolesPerLiter => As(MolarityUnit.PicomolesPerLiter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Molarity from CentimolesPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromCentimolesPerLiter(double centimolesperliter) + { + double value = (double) centimolesperliter; + return new Molarity(value, MolarityUnit.CentimolesPerLiter); + } + /// + /// Get Molarity from DecimolesPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromDecimolesPerLiter(double decimolesperliter) + { + double value = (double) decimolesperliter; + return new Molarity(value, MolarityUnit.DecimolesPerLiter); + } + /// + /// Get Molarity from MicromolesPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromMicromolesPerLiter(double micromolesperliter) + { + double value = (double) micromolesperliter; + return new Molarity(value, MolarityUnit.MicromolesPerLiter); + } + /// + /// Get Molarity from MillimolesPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromMillimolesPerLiter(double millimolesperliter) + { + double value = (double) millimolesperliter; + return new Molarity(value, MolarityUnit.MillimolesPerLiter); + } + /// + /// Get Molarity from MolesPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromMolesPerCubicMeter(double molespercubicmeter) + { + double value = (double) molespercubicmeter; + return new Molarity(value, MolarityUnit.MolesPerCubicMeter); + } + /// + /// Get Molarity from MolesPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromMolesPerLiter(double molesperliter) + { + double value = (double) molesperliter; + return new Molarity(value, MolarityUnit.MolesPerLiter); + } + /// + /// Get Molarity from NanomolesPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromNanomolesPerLiter(double nanomolesperliter) + { + double value = (double) nanomolesperliter; + return new Molarity(value, MolarityUnit.NanomolesPerLiter); + } + /// + /// Get Molarity from PicomolesPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Molarity FromPicomolesPerLiter(double picomolesperliter) + { + double value = (double) picomolesperliter; + return new Molarity(value, MolarityUnit.PicomolesPerLiter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Molarity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Molarity From(double value, MolarityUnit fromUnit) + { + return new Molarity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Molarity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Molarity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Molarity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Molarity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static MolarityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out MolarityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Molarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); + + return CompareTo((Molarity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Molarity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Molarity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Molarity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Molarity to another Molarity with the unit representation . + /// + /// A Molarity with the specified unit. + public Molarity ToUnit(MolarityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Molarity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarityUnit.CentimolesPerLiter: return (_value/1e-3) * 1e-2d; + case MolarityUnit.DecimolesPerLiter: return (_value/1e-3) * 1e-1d; + case MolarityUnit.MicromolesPerLiter: return (_value/1e-3) * 1e-6d; + case MolarityUnit.MillimolesPerLiter: return (_value/1e-3) * 1e-3d; + case MolarityUnit.MolesPerCubicMeter: return _value; + case MolarityUnit.MolesPerLiter: return _value/1e-3; + case MolarityUnit.NanomolesPerLiter: return (_value/1e-3) * 1e-9d; + case MolarityUnit.PicomolesPerLiter: return (_value/1e-3) * 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarityUnit.CentimolesPerLiter: return (baseUnitValue*1e-3) / 1e-2d; + case MolarityUnit.DecimolesPerLiter: return (baseUnitValue*1e-3) / 1e-1d; + case MolarityUnit.MicromolesPerLiter: return (baseUnitValue*1e-3) / 1e-6d; + case MolarityUnit.MillimolesPerLiter: return (baseUnitValue*1e-3) / 1e-3d; + case MolarityUnit.MolesPerCubicMeter: return baseUnitValue; + case MolarityUnit.MolesPerLiter: return baseUnitValue*1e-3; + case MolarityUnit.NanomolesPerLiter: return (baseUnitValue*1e-3) / 1e-9d; + case MolarityUnit.PicomolesPerLiter: return (baseUnitValue*1e-3) / 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..0cc81c667b --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, permeability is the measure of the ability of a material to support the formation of a magnetic field within itself. + /// + /// + /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Permeability : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PermeabilityUnit? _unit; + + static Permeability() + { + BaseDimensions = new BaseDimensions(1, 1, -2, -2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit HenryPerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Permeability() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Permeability(double numericValue, PermeabilityUnit unit) + { + if(unit == PermeabilityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Permeability, which is HenryPerMeter. All conversions go via this value. + /// + public static PermeabilityUnit BaseUnit => PermeabilityUnit.HenryPerMeter; + + /// + /// Represents the largest possible value of Permeability + /// + public static Permeability MaxValue => new Permeability(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Permeability + /// + public static Permeability MinValue => new Permeability(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Permeability; + + /// + /// All units of measurement for the Permeability quantity. + /// + public static PermeabilityUnit[] Units { get; } = Enum.GetValues(typeof(PermeabilityUnit)).Cast().Except(new PermeabilityUnit[]{ PermeabilityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit HenryPerMeter. + /// + public static Permeability Zero => new Permeability(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PermeabilityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Permeability.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Permeability.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Permeability in HenriesPerMeter. + /// + public double HenriesPerMeter => As(PermeabilityUnit.HenryPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PermeabilityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Permeability from HenriesPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Permeability FromHenriesPerMeter(double henriespermeter) + { + double value = (double) henriespermeter; + return new Permeability(value, PermeabilityUnit.HenryPerMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Permeability unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Permeability From(double value, PermeabilityUnit fromUnit) + { + return new Permeability((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Permeability Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Permeability Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Permeability result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permeability result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PermeabilityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PermeabilityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PermeabilityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermeabilityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Permeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); + + return CompareTo((Permeability)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Permeability other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Permeability within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Permeability. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PermeabilityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Permeability to another Permeability with the unit representation . + /// + /// A Permeability with the specified unit. + public Permeability ToUnit(PermeabilityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Permeability(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PermeabilityUnit.HenryPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PermeabilityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PermeabilityUnit.HenryPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..4b244f0049 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, permittivity is the measure of resistance that is encountered when forming an electric field in a particular medium. + /// + /// + /// https://en.wikipedia.org/wiki/Permittivity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Permittivity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PermittivityUnit? _unit; + + static Permittivity() + { + BaseDimensions = new BaseDimensions(-3, -1, 4, 2, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit FaradPerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Permittivity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Permittivity(double numericValue, PermittivityUnit unit) + { + if(unit == PermittivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Permittivity, which is FaradPerMeter. All conversions go via this value. + /// + public static PermittivityUnit BaseUnit => PermittivityUnit.FaradPerMeter; + + /// + /// Represents the largest possible value of Permittivity + /// + public static Permittivity MaxValue => new Permittivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Permittivity + /// + public static Permittivity MinValue => new Permittivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Permittivity; + + /// + /// All units of measurement for the Permittivity quantity. + /// + public static PermittivityUnit[] Units { get; } = Enum.GetValues(typeof(PermittivityUnit)).Cast().Except(new PermittivityUnit[]{ PermittivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit FaradPerMeter. + /// + public static Permittivity Zero => new Permittivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PermittivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Permittivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Permittivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Permittivity in FaradsPerMeter. + /// + public double FaradsPerMeter => As(PermittivityUnit.FaradPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PermittivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Permittivity from FaradsPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Permittivity FromFaradsPerMeter(double faradspermeter) + { + double value = (double) faradspermeter; + return new Permittivity(value, PermittivityUnit.FaradPerMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Permittivity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Permittivity From(double value, PermittivityUnit fromUnit) + { + return new Permittivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Permittivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Permittivity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Permittivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Permittivity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PermittivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PermittivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PermittivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PermittivityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Permittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); + + return CompareTo((Permittivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Permittivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Permittivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Permittivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PermittivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Permittivity to another Permittivity with the unit representation . + /// + /// A Permittivity with the specified unit. + public Permittivity ToUnit(PermittivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Permittivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PermittivityUnit.FaradPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PermittivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PermittivityUnit.FaradPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..b63ecedc49 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -0,0 +1,893 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Power : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly decimal _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PowerUnit? _unit; + + static Power() + { + BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Watt. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Power() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Power(decimal numericValue, PowerUnit unit) + { + if(unit == PowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = numericValue; + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Power, which is Watt. All conversions go via this value. + /// + public static PowerUnit BaseUnit => PowerUnit.Watt; + + /// + /// Represents the largest possible value of Power + /// + public static Power MaxValue => new Power(decimal.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Power + /// + public static Power MinValue => new Power(decimal.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Power; + + /// + /// All units of measurement for the Power quantity. + /// + public static PowerUnit[] Units { get; } = Enum.GetValues(typeof(PowerUnit)).Cast().Except(new PowerUnit[]{ PowerUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Watt. + /// + public static Power Zero => new Power(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Power.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Power.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Power in BoilerHorsepower. + /// + public double BoilerHorsepower => As(PowerUnit.BoilerHorsepower); + + /// + /// Get Power in BritishThermalUnitsPerHour. + /// + public double BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour); + + /// + /// Get Power in Decawatts. + /// + public double Decawatts => As(PowerUnit.Decawatt); + + /// + /// Get Power in Deciwatts. + /// + public double Deciwatts => As(PowerUnit.Deciwatt); + + /// + /// Get Power in ElectricalHorsepower. + /// + public double ElectricalHorsepower => As(PowerUnit.ElectricalHorsepower); + + /// + /// Get Power in Femtowatts. + /// + public double Femtowatts => As(PowerUnit.Femtowatt); + + /// + /// Get Power in Gigawatts. + /// + public double Gigawatts => As(PowerUnit.Gigawatt); + + /// + /// Get Power in HydraulicHorsepower. + /// + public double HydraulicHorsepower => As(PowerUnit.HydraulicHorsepower); + + /// + /// Get Power in KilobritishThermalUnitsPerHour. + /// + public double KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour); + + /// + /// Get Power in Kilowatts. + /// + public double Kilowatts => As(PowerUnit.Kilowatt); + + /// + /// Get Power in MechanicalHorsepower. + /// + public double MechanicalHorsepower => As(PowerUnit.MechanicalHorsepower); + + /// + /// Get Power in Megawatts. + /// + public double Megawatts => As(PowerUnit.Megawatt); + + /// + /// Get Power in MetricHorsepower. + /// + public double MetricHorsepower => As(PowerUnit.MetricHorsepower); + + /// + /// Get Power in Microwatts. + /// + public double Microwatts => As(PowerUnit.Microwatt); + + /// + /// Get Power in Milliwatts. + /// + public double Milliwatts => As(PowerUnit.Milliwatt); + + /// + /// Get Power in Nanowatts. + /// + public double Nanowatts => As(PowerUnit.Nanowatt); + + /// + /// Get Power in Petawatts. + /// + public double Petawatts => As(PowerUnit.Petawatt); + + /// + /// Get Power in Picowatts. + /// + public double Picowatts => As(PowerUnit.Picowatt); + + /// + /// Get Power in Terawatts. + /// + public double Terawatts => As(PowerUnit.Terawatt); + + /// + /// Get Power in Watts. + /// + public double Watts => As(PowerUnit.Watt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PowerUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(PowerUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Power from BoilerHorsepower. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromBoilerHorsepower(double boilerhorsepower) + { + decimal value = (decimal) boilerhorsepower; + return new Power(value, PowerUnit.BoilerHorsepower); + } + /// + /// Get Power from BritishThermalUnitsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromBritishThermalUnitsPerHour(double britishthermalunitsperhour) + { + decimal value = (decimal) britishthermalunitsperhour; + return new Power(value, PowerUnit.BritishThermalUnitPerHour); + } + /// + /// Get Power from Decawatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromDecawatts(double decawatts) + { + decimal value = (decimal) decawatts; + return new Power(value, PowerUnit.Decawatt); + } + /// + /// Get Power from Deciwatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromDeciwatts(double deciwatts) + { + decimal value = (decimal) deciwatts; + return new Power(value, PowerUnit.Deciwatt); + } + /// + /// Get Power from ElectricalHorsepower. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromElectricalHorsepower(double electricalhorsepower) + { + decimal value = (decimal) electricalhorsepower; + return new Power(value, PowerUnit.ElectricalHorsepower); + } + /// + /// Get Power from Femtowatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromFemtowatts(double femtowatts) + { + decimal value = (decimal) femtowatts; + return new Power(value, PowerUnit.Femtowatt); + } + /// + /// Get Power from Gigawatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromGigawatts(double gigawatts) + { + decimal value = (decimal) gigawatts; + return new Power(value, PowerUnit.Gigawatt); + } + /// + /// Get Power from HydraulicHorsepower. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromHydraulicHorsepower(double hydraulichorsepower) + { + decimal value = (decimal) hydraulichorsepower; + return new Power(value, PowerUnit.HydraulicHorsepower); + } + /// + /// Get Power from KilobritishThermalUnitsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromKilobritishThermalUnitsPerHour(double kilobritishthermalunitsperhour) + { + decimal value = (decimal) kilobritishthermalunitsperhour; + return new Power(value, PowerUnit.KilobritishThermalUnitPerHour); + } + /// + /// Get Power from Kilowatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromKilowatts(double kilowatts) + { + decimal value = (decimal) kilowatts; + return new Power(value, PowerUnit.Kilowatt); + } + /// + /// Get Power from MechanicalHorsepower. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromMechanicalHorsepower(double mechanicalhorsepower) + { + decimal value = (decimal) mechanicalhorsepower; + return new Power(value, PowerUnit.MechanicalHorsepower); + } + /// + /// Get Power from Megawatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromMegawatts(double megawatts) + { + decimal value = (decimal) megawatts; + return new Power(value, PowerUnit.Megawatt); + } + /// + /// Get Power from MetricHorsepower. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromMetricHorsepower(double metrichorsepower) + { + decimal value = (decimal) metrichorsepower; + return new Power(value, PowerUnit.MetricHorsepower); + } + /// + /// Get Power from Microwatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromMicrowatts(double microwatts) + { + decimal value = (decimal) microwatts; + return new Power(value, PowerUnit.Microwatt); + } + /// + /// Get Power from Milliwatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromMilliwatts(double milliwatts) + { + decimal value = (decimal) milliwatts; + return new Power(value, PowerUnit.Milliwatt); + } + /// + /// Get Power from Nanowatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromNanowatts(double nanowatts) + { + decimal value = (decimal) nanowatts; + return new Power(value, PowerUnit.Nanowatt); + } + /// + /// Get Power from Petawatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromPetawatts(double petawatts) + { + decimal value = (decimal) petawatts; + return new Power(value, PowerUnit.Petawatt); + } + /// + /// Get Power from Picowatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromPicowatts(double picowatts) + { + decimal value = (decimal) picowatts; + return new Power(value, PowerUnit.Picowatt); + } + /// + /// Get Power from Terawatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromTerawatts(double terawatts) + { + decimal value = (decimal) terawatts; + return new Power(value, PowerUnit.Terawatt); + } + /// + /// Get Power from Watts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Power FromWatts(double watts) + { + decimal value = (decimal) watts; + return new Power(value, PowerUnit.Watt); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Power unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Power From(double value, PowerUnit fromUnit) + { + return new Power((decimal)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Power Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Power Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Power result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Power result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PowerUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Power)) throw new ArgumentException("Expected type Power.", nameof(obj)); + + return CompareTo((Power)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Power other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Power within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Power other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Power. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PowerUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Power to another Power with the unit representation . + /// + /// A Power with the specified unit. + public Power ToUnit(PowerUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Power(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private decimal AsBaseUnit() + { + switch(Unit) + { + case PowerUnit.BoilerHorsepower: return _value*9812.5m; + case PowerUnit.BritishThermalUnitPerHour: return _value*0.293071m; + case PowerUnit.Decawatt: return (_value) * 1e1m; + case PowerUnit.Deciwatt: return (_value) * 1e-1m; + case PowerUnit.ElectricalHorsepower: return _value*746m; + case PowerUnit.Femtowatt: return (_value) * 1e-15m; + case PowerUnit.Gigawatt: return (_value) * 1e9m; + case PowerUnit.HydraulicHorsepower: return _value*745.69988145m; + case PowerUnit.KilobritishThermalUnitPerHour: return (_value*0.293071m) * 1e3m; + case PowerUnit.Kilowatt: return (_value) * 1e3m; + case PowerUnit.MechanicalHorsepower: return _value*745.69m; + case PowerUnit.Megawatt: return (_value) * 1e6m; + case PowerUnit.MetricHorsepower: return _value*735.49875m; + case PowerUnit.Microwatt: return (_value) * 1e-6m; + case PowerUnit.Milliwatt: return (_value) * 1e-3m; + case PowerUnit.Nanowatt: return (_value) * 1e-9m; + case PowerUnit.Petawatt: return (_value) * 1e15m; + case PowerUnit.Picowatt: return (_value) * 1e-12m; + case PowerUnit.Terawatt: return (_value) * 1e12m; + case PowerUnit.Watt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private decimal AsBaseNumericType(PowerUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PowerUnit.BoilerHorsepower: return baseUnitValue/9812.5m; + case PowerUnit.BritishThermalUnitPerHour: return baseUnitValue/0.293071m; + case PowerUnit.Decawatt: return (baseUnitValue) / 1e1m; + case PowerUnit.Deciwatt: return (baseUnitValue) / 1e-1m; + case PowerUnit.ElectricalHorsepower: return baseUnitValue/746m; + case PowerUnit.Femtowatt: return (baseUnitValue) / 1e-15m; + case PowerUnit.Gigawatt: return (baseUnitValue) / 1e9m; + case PowerUnit.HydraulicHorsepower: return baseUnitValue/745.69988145m; + case PowerUnit.KilobritishThermalUnitPerHour: return (baseUnitValue/0.293071m) / 1e3m; + case PowerUnit.Kilowatt: return (baseUnitValue) / 1e3m; + case PowerUnit.MechanicalHorsepower: return baseUnitValue/745.69m; + case PowerUnit.Megawatt: return (baseUnitValue) / 1e6m; + case PowerUnit.MetricHorsepower: return baseUnitValue/735.49875m; + case PowerUnit.Microwatt: return (baseUnitValue) / 1e-6m; + case PowerUnit.Milliwatt: return (baseUnitValue) / 1e-3m; + case PowerUnit.Nanowatt: return (baseUnitValue) / 1e-9m; + case PowerUnit.Petawatt: return (baseUnitValue) / 1e15m; + case PowerUnit.Picowatt: return (baseUnitValue) / 1e-12m; + case PowerUnit.Terawatt: return (baseUnitValue) / 1e12m; + case PowerUnit.Watt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..0d0deb8f35 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,1301 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The amount of power in a volume. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class PowerDensity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PowerDensityUnit? _unit; + + static PowerDensity() + { + BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit WattPerCubicMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public PowerDensity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private PowerDensity(double numericValue, PowerDensityUnit unit) + { + if(unit == PowerDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of PowerDensity, which is WattPerCubicMeter. All conversions go via this value. + /// + public static PowerDensityUnit BaseUnit => PowerDensityUnit.WattPerCubicMeter; + + /// + /// Represents the largest possible value of PowerDensity + /// + public static PowerDensity MaxValue => new PowerDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of PowerDensity + /// + public static PowerDensity MinValue => new PowerDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.PowerDensity; + + /// + /// All units of measurement for the PowerDensity quantity. + /// + public static PowerDensityUnit[] Units { get; } = Enum.GetValues(typeof(PowerDensityUnit)).Cast().Except(new PowerDensityUnit[]{ PowerDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerCubicMeter. + /// + public static PowerDensity Zero => new PowerDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => PowerDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PowerDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get PowerDensity in DecawattsPerCubicFoot. + /// + public double DecawattsPerCubicFoot => As(PowerDensityUnit.DecawattPerCubicFoot); + + /// + /// Get PowerDensity in DecawattsPerCubicInch. + /// + public double DecawattsPerCubicInch => As(PowerDensityUnit.DecawattPerCubicInch); + + /// + /// Get PowerDensity in DecawattsPerCubicMeter. + /// + public double DecawattsPerCubicMeter => As(PowerDensityUnit.DecawattPerCubicMeter); + + /// + /// Get PowerDensity in DecawattsPerLiter. + /// + public double DecawattsPerLiter => As(PowerDensityUnit.DecawattPerLiter); + + /// + /// Get PowerDensity in DeciwattsPerCubicFoot. + /// + public double DeciwattsPerCubicFoot => As(PowerDensityUnit.DeciwattPerCubicFoot); + + /// + /// Get PowerDensity in DeciwattsPerCubicInch. + /// + public double DeciwattsPerCubicInch => As(PowerDensityUnit.DeciwattPerCubicInch); + + /// + /// Get PowerDensity in DeciwattsPerCubicMeter. + /// + public double DeciwattsPerCubicMeter => As(PowerDensityUnit.DeciwattPerCubicMeter); + + /// + /// Get PowerDensity in DeciwattsPerLiter. + /// + public double DeciwattsPerLiter => As(PowerDensityUnit.DeciwattPerLiter); + + /// + /// Get PowerDensity in GigawattsPerCubicFoot. + /// + public double GigawattsPerCubicFoot => As(PowerDensityUnit.GigawattPerCubicFoot); + + /// + /// Get PowerDensity in GigawattsPerCubicInch. + /// + public double GigawattsPerCubicInch => As(PowerDensityUnit.GigawattPerCubicInch); + + /// + /// Get PowerDensity in GigawattsPerCubicMeter. + /// + public double GigawattsPerCubicMeter => As(PowerDensityUnit.GigawattPerCubicMeter); + + /// + /// Get PowerDensity in GigawattsPerLiter. + /// + public double GigawattsPerLiter => As(PowerDensityUnit.GigawattPerLiter); + + /// + /// Get PowerDensity in KilowattsPerCubicFoot. + /// + public double KilowattsPerCubicFoot => As(PowerDensityUnit.KilowattPerCubicFoot); + + /// + /// Get PowerDensity in KilowattsPerCubicInch. + /// + public double KilowattsPerCubicInch => As(PowerDensityUnit.KilowattPerCubicInch); + + /// + /// Get PowerDensity in KilowattsPerCubicMeter. + /// + public double KilowattsPerCubicMeter => As(PowerDensityUnit.KilowattPerCubicMeter); + + /// + /// Get PowerDensity in KilowattsPerLiter. + /// + public double KilowattsPerLiter => As(PowerDensityUnit.KilowattPerLiter); + + /// + /// Get PowerDensity in MegawattsPerCubicFoot. + /// + public double MegawattsPerCubicFoot => As(PowerDensityUnit.MegawattPerCubicFoot); + + /// + /// Get PowerDensity in MegawattsPerCubicInch. + /// + public double MegawattsPerCubicInch => As(PowerDensityUnit.MegawattPerCubicInch); + + /// + /// Get PowerDensity in MegawattsPerCubicMeter. + /// + public double MegawattsPerCubicMeter => As(PowerDensityUnit.MegawattPerCubicMeter); + + /// + /// Get PowerDensity in MegawattsPerLiter. + /// + public double MegawattsPerLiter => As(PowerDensityUnit.MegawattPerLiter); + + /// + /// Get PowerDensity in MicrowattsPerCubicFoot. + /// + public double MicrowattsPerCubicFoot => As(PowerDensityUnit.MicrowattPerCubicFoot); + + /// + /// Get PowerDensity in MicrowattsPerCubicInch. + /// + public double MicrowattsPerCubicInch => As(PowerDensityUnit.MicrowattPerCubicInch); + + /// + /// Get PowerDensity in MicrowattsPerCubicMeter. + /// + public double MicrowattsPerCubicMeter => As(PowerDensityUnit.MicrowattPerCubicMeter); + + /// + /// Get PowerDensity in MicrowattsPerLiter. + /// + public double MicrowattsPerLiter => As(PowerDensityUnit.MicrowattPerLiter); + + /// + /// Get PowerDensity in MilliwattsPerCubicFoot. + /// + public double MilliwattsPerCubicFoot => As(PowerDensityUnit.MilliwattPerCubicFoot); + + /// + /// Get PowerDensity in MilliwattsPerCubicInch. + /// + public double MilliwattsPerCubicInch => As(PowerDensityUnit.MilliwattPerCubicInch); + + /// + /// Get PowerDensity in MilliwattsPerCubicMeter. + /// + public double MilliwattsPerCubicMeter => As(PowerDensityUnit.MilliwattPerCubicMeter); + + /// + /// Get PowerDensity in MilliwattsPerLiter. + /// + public double MilliwattsPerLiter => As(PowerDensityUnit.MilliwattPerLiter); + + /// + /// Get PowerDensity in NanowattsPerCubicFoot. + /// + public double NanowattsPerCubicFoot => As(PowerDensityUnit.NanowattPerCubicFoot); + + /// + /// Get PowerDensity in NanowattsPerCubicInch. + /// + public double NanowattsPerCubicInch => As(PowerDensityUnit.NanowattPerCubicInch); + + /// + /// Get PowerDensity in NanowattsPerCubicMeter. + /// + public double NanowattsPerCubicMeter => As(PowerDensityUnit.NanowattPerCubicMeter); + + /// + /// Get PowerDensity in NanowattsPerLiter. + /// + public double NanowattsPerLiter => As(PowerDensityUnit.NanowattPerLiter); + + /// + /// Get PowerDensity in PicowattsPerCubicFoot. + /// + public double PicowattsPerCubicFoot => As(PowerDensityUnit.PicowattPerCubicFoot); + + /// + /// Get PowerDensity in PicowattsPerCubicInch. + /// + public double PicowattsPerCubicInch => As(PowerDensityUnit.PicowattPerCubicInch); + + /// + /// Get PowerDensity in PicowattsPerCubicMeter. + /// + public double PicowattsPerCubicMeter => As(PowerDensityUnit.PicowattPerCubicMeter); + + /// + /// Get PowerDensity in PicowattsPerLiter. + /// + public double PicowattsPerLiter => As(PowerDensityUnit.PicowattPerLiter); + + /// + /// Get PowerDensity in TerawattsPerCubicFoot. + /// + public double TerawattsPerCubicFoot => As(PowerDensityUnit.TerawattPerCubicFoot); + + /// + /// Get PowerDensity in TerawattsPerCubicInch. + /// + public double TerawattsPerCubicInch => As(PowerDensityUnit.TerawattPerCubicInch); + + /// + /// Get PowerDensity in TerawattsPerCubicMeter. + /// + public double TerawattsPerCubicMeter => As(PowerDensityUnit.TerawattPerCubicMeter); + + /// + /// Get PowerDensity in TerawattsPerLiter. + /// + public double TerawattsPerLiter => As(PowerDensityUnit.TerawattPerLiter); + + /// + /// Get PowerDensity in WattsPerCubicFoot. + /// + public double WattsPerCubicFoot => As(PowerDensityUnit.WattPerCubicFoot); + + /// + /// Get PowerDensity in WattsPerCubicInch. + /// + public double WattsPerCubicInch => As(PowerDensityUnit.WattPerCubicInch); + + /// + /// Get PowerDensity in WattsPerCubicMeter. + /// + public double WattsPerCubicMeter => As(PowerDensityUnit.WattPerCubicMeter); + + /// + /// Get PowerDensity in WattsPerLiter. + /// + public double WattsPerLiter => As(PowerDensityUnit.WattPerLiter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PowerDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get PowerDensity from DecawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDecawattsPerCubicFoot(double decawattspercubicfoot) + { + double value = (double) decawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicFoot); + } + /// + /// Get PowerDensity from DecawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDecawattsPerCubicInch(double decawattspercubicinch) + { + double value = (double) decawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicInch); + } + /// + /// Get PowerDensity from DecawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDecawattsPerCubicMeter(double decawattspercubicmeter) + { + double value = (double) decawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicMeter); + } + /// + /// Get PowerDensity from DecawattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDecawattsPerLiter(double decawattsperliter) + { + double value = (double) decawattsperliter; + return new PowerDensity(value, PowerDensityUnit.DecawattPerLiter); + } + /// + /// Get PowerDensity from DeciwattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDeciwattsPerCubicFoot(double deciwattspercubicfoot) + { + double value = (double) deciwattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicFoot); + } + /// + /// Get PowerDensity from DeciwattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDeciwattsPerCubicInch(double deciwattspercubicinch) + { + double value = (double) deciwattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicInch); + } + /// + /// Get PowerDensity from DeciwattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDeciwattsPerCubicMeter(double deciwattspercubicmeter) + { + double value = (double) deciwattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicMeter); + } + /// + /// Get PowerDensity from DeciwattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromDeciwattsPerLiter(double deciwattsperliter) + { + double value = (double) deciwattsperliter; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerLiter); + } + /// + /// Get PowerDensity from GigawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromGigawattsPerCubicFoot(double gigawattspercubicfoot) + { + double value = (double) gigawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicFoot); + } + /// + /// Get PowerDensity from GigawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromGigawattsPerCubicInch(double gigawattspercubicinch) + { + double value = (double) gigawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicInch); + } + /// + /// Get PowerDensity from GigawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromGigawattsPerCubicMeter(double gigawattspercubicmeter) + { + double value = (double) gigawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicMeter); + } + /// + /// Get PowerDensity from GigawattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromGigawattsPerLiter(double gigawattsperliter) + { + double value = (double) gigawattsperliter; + return new PowerDensity(value, PowerDensityUnit.GigawattPerLiter); + } + /// + /// Get PowerDensity from KilowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromKilowattsPerCubicFoot(double kilowattspercubicfoot) + { + double value = (double) kilowattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicFoot); + } + /// + /// Get PowerDensity from KilowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromKilowattsPerCubicInch(double kilowattspercubicinch) + { + double value = (double) kilowattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicInch); + } + /// + /// Get PowerDensity from KilowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromKilowattsPerCubicMeter(double kilowattspercubicmeter) + { + double value = (double) kilowattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicMeter); + } + /// + /// Get PowerDensity from KilowattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromKilowattsPerLiter(double kilowattsperliter) + { + double value = (double) kilowattsperliter; + return new PowerDensity(value, PowerDensityUnit.KilowattPerLiter); + } + /// + /// Get PowerDensity from MegawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMegawattsPerCubicFoot(double megawattspercubicfoot) + { + double value = (double) megawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicFoot); + } + /// + /// Get PowerDensity from MegawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMegawattsPerCubicInch(double megawattspercubicinch) + { + double value = (double) megawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicInch); + } + /// + /// Get PowerDensity from MegawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMegawattsPerCubicMeter(double megawattspercubicmeter) + { + double value = (double) megawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicMeter); + } + /// + /// Get PowerDensity from MegawattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMegawattsPerLiter(double megawattsperliter) + { + double value = (double) megawattsperliter; + return new PowerDensity(value, PowerDensityUnit.MegawattPerLiter); + } + /// + /// Get PowerDensity from MicrowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMicrowattsPerCubicFoot(double microwattspercubicfoot) + { + double value = (double) microwattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicFoot); + } + /// + /// Get PowerDensity from MicrowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMicrowattsPerCubicInch(double microwattspercubicinch) + { + double value = (double) microwattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicInch); + } + /// + /// Get PowerDensity from MicrowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMicrowattsPerCubicMeter(double microwattspercubicmeter) + { + double value = (double) microwattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicMeter); + } + /// + /// Get PowerDensity from MicrowattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMicrowattsPerLiter(double microwattsperliter) + { + double value = (double) microwattsperliter; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerLiter); + } + /// + /// Get PowerDensity from MilliwattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMilliwattsPerCubicFoot(double milliwattspercubicfoot) + { + double value = (double) milliwattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicFoot); + } + /// + /// Get PowerDensity from MilliwattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMilliwattsPerCubicInch(double milliwattspercubicinch) + { + double value = (double) milliwattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicInch); + } + /// + /// Get PowerDensity from MilliwattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMilliwattsPerCubicMeter(double milliwattspercubicmeter) + { + double value = (double) milliwattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicMeter); + } + /// + /// Get PowerDensity from MilliwattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromMilliwattsPerLiter(double milliwattsperliter) + { + double value = (double) milliwattsperliter; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerLiter); + } + /// + /// Get PowerDensity from NanowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromNanowattsPerCubicFoot(double nanowattspercubicfoot) + { + double value = (double) nanowattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicFoot); + } + /// + /// Get PowerDensity from NanowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromNanowattsPerCubicInch(double nanowattspercubicinch) + { + double value = (double) nanowattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicInch); + } + /// + /// Get PowerDensity from NanowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromNanowattsPerCubicMeter(double nanowattspercubicmeter) + { + double value = (double) nanowattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicMeter); + } + /// + /// Get PowerDensity from NanowattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromNanowattsPerLiter(double nanowattsperliter) + { + double value = (double) nanowattsperliter; + return new PowerDensity(value, PowerDensityUnit.NanowattPerLiter); + } + /// + /// Get PowerDensity from PicowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromPicowattsPerCubicFoot(double picowattspercubicfoot) + { + double value = (double) picowattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicFoot); + } + /// + /// Get PowerDensity from PicowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromPicowattsPerCubicInch(double picowattspercubicinch) + { + double value = (double) picowattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicInch); + } + /// + /// Get PowerDensity from PicowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromPicowattsPerCubicMeter(double picowattspercubicmeter) + { + double value = (double) picowattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicMeter); + } + /// + /// Get PowerDensity from PicowattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromPicowattsPerLiter(double picowattsperliter) + { + double value = (double) picowattsperliter; + return new PowerDensity(value, PowerDensityUnit.PicowattPerLiter); + } + /// + /// Get PowerDensity from TerawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromTerawattsPerCubicFoot(double terawattspercubicfoot) + { + double value = (double) terawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicFoot); + } + /// + /// Get PowerDensity from TerawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromTerawattsPerCubicInch(double terawattspercubicinch) + { + double value = (double) terawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicInch); + } + /// + /// Get PowerDensity from TerawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromTerawattsPerCubicMeter(double terawattspercubicmeter) + { + double value = (double) terawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicMeter); + } + /// + /// Get PowerDensity from TerawattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromTerawattsPerLiter(double terawattsperliter) + { + double value = (double) terawattsperliter; + return new PowerDensity(value, PowerDensityUnit.TerawattPerLiter); + } + /// + /// Get PowerDensity from WattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromWattsPerCubicFoot(double wattspercubicfoot) + { + double value = (double) wattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.WattPerCubicFoot); + } + /// + /// Get PowerDensity from WattsPerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromWattsPerCubicInch(double wattspercubicinch) + { + double value = (double) wattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.WattPerCubicInch); + } + /// + /// Get PowerDensity from WattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromWattsPerCubicMeter(double wattspercubicmeter) + { + double value = (double) wattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.WattPerCubicMeter); + } + /// + /// Get PowerDensity from WattsPerLiter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerDensity FromWattsPerLiter(double wattsperliter) + { + double value = (double) wattsperliter; + return new PowerDensity(value, PowerDensityUnit.WattPerLiter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// PowerDensity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static PowerDensity From(double value, PowerDensityUnit fromUnit) + { + return new PowerDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static PowerDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PowerDensity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out PowerDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerDensity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PowerDensityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PowerDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerDensityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is PowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); + + return CompareTo((PowerDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(PowerDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another PowerDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current PowerDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PowerDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this PowerDensity to another PowerDensity with the unit representation . + /// + /// A PowerDensity with the specified unit. + public PowerDensity ToUnit(PowerDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new PowerDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PowerDensityUnit.DecawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e1d; + case PowerDensityUnit.DecawattPerCubicInch: return (_value*6.102374409473228e4) * 1e1d; + case PowerDensityUnit.DecawattPerCubicMeter: return (_value) * 1e1d; + case PowerDensityUnit.DecawattPerLiter: return (_value*1.0e3) * 1e1d; + case PowerDensityUnit.DeciwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-1d; + case PowerDensityUnit.DeciwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-1d; + case PowerDensityUnit.DeciwattPerCubicMeter: return (_value) * 1e-1d; + case PowerDensityUnit.DeciwattPerLiter: return (_value*1.0e3) * 1e-1d; + case PowerDensityUnit.GigawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e9d; + case PowerDensityUnit.GigawattPerCubicInch: return (_value*6.102374409473228e4) * 1e9d; + case PowerDensityUnit.GigawattPerCubicMeter: return (_value) * 1e9d; + case PowerDensityUnit.GigawattPerLiter: return (_value*1.0e3) * 1e9d; + case PowerDensityUnit.KilowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e3d; + case PowerDensityUnit.KilowattPerCubicInch: return (_value*6.102374409473228e4) * 1e3d; + case PowerDensityUnit.KilowattPerCubicMeter: return (_value) * 1e3d; + case PowerDensityUnit.KilowattPerLiter: return (_value*1.0e3) * 1e3d; + case PowerDensityUnit.MegawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e6d; + case PowerDensityUnit.MegawattPerCubicInch: return (_value*6.102374409473228e4) * 1e6d; + case PowerDensityUnit.MegawattPerCubicMeter: return (_value) * 1e6d; + case PowerDensityUnit.MegawattPerLiter: return (_value*1.0e3) * 1e6d; + case PowerDensityUnit.MicrowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-6d; + case PowerDensityUnit.MicrowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-6d; + case PowerDensityUnit.MicrowattPerCubicMeter: return (_value) * 1e-6d; + case PowerDensityUnit.MicrowattPerLiter: return (_value*1.0e3) * 1e-6d; + case PowerDensityUnit.MilliwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-3d; + case PowerDensityUnit.MilliwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-3d; + case PowerDensityUnit.MilliwattPerCubicMeter: return (_value) * 1e-3d; + case PowerDensityUnit.MilliwattPerLiter: return (_value*1.0e3) * 1e-3d; + case PowerDensityUnit.NanowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-9d; + case PowerDensityUnit.NanowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-9d; + case PowerDensityUnit.NanowattPerCubicMeter: return (_value) * 1e-9d; + case PowerDensityUnit.NanowattPerLiter: return (_value*1.0e3) * 1e-9d; + case PowerDensityUnit.PicowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-12d; + case PowerDensityUnit.PicowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-12d; + case PowerDensityUnit.PicowattPerCubicMeter: return (_value) * 1e-12d; + case PowerDensityUnit.PicowattPerLiter: return (_value*1.0e3) * 1e-12d; + case PowerDensityUnit.TerawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e12d; + case PowerDensityUnit.TerawattPerCubicInch: return (_value*6.102374409473228e4) * 1e12d; + case PowerDensityUnit.TerawattPerCubicMeter: return (_value) * 1e12d; + case PowerDensityUnit.TerawattPerLiter: return (_value*1.0e3) * 1e12d; + case PowerDensityUnit.WattPerCubicFoot: return _value*3.531466672148859e1; + case PowerDensityUnit.WattPerCubicInch: return _value*6.102374409473228e4; + case PowerDensityUnit.WattPerCubicMeter: return _value; + case PowerDensityUnit.WattPerLiter: return _value*1.0e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PowerDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PowerDensityUnit.DecawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e1d; + case PowerDensityUnit.DecawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e1d; + case PowerDensityUnit.DecawattPerCubicMeter: return (baseUnitValue) / 1e1d; + case PowerDensityUnit.DecawattPerLiter: return (baseUnitValue/1.0e3) / 1e1d; + case PowerDensityUnit.DeciwattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-1d; + case PowerDensityUnit.DeciwattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-1d; + case PowerDensityUnit.DeciwattPerCubicMeter: return (baseUnitValue) / 1e-1d; + case PowerDensityUnit.DeciwattPerLiter: return (baseUnitValue/1.0e3) / 1e-1d; + case PowerDensityUnit.GigawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e9d; + case PowerDensityUnit.GigawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e9d; + case PowerDensityUnit.GigawattPerCubicMeter: return (baseUnitValue) / 1e9d; + case PowerDensityUnit.GigawattPerLiter: return (baseUnitValue/1.0e3) / 1e9d; + case PowerDensityUnit.KilowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e3d; + case PowerDensityUnit.KilowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e3d; + case PowerDensityUnit.KilowattPerCubicMeter: return (baseUnitValue) / 1e3d; + case PowerDensityUnit.KilowattPerLiter: return (baseUnitValue/1.0e3) / 1e3d; + case PowerDensityUnit.MegawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e6d; + case PowerDensityUnit.MegawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e6d; + case PowerDensityUnit.MegawattPerCubicMeter: return (baseUnitValue) / 1e6d; + case PowerDensityUnit.MegawattPerLiter: return (baseUnitValue/1.0e3) / 1e6d; + case PowerDensityUnit.MicrowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-6d; + case PowerDensityUnit.MicrowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-6d; + case PowerDensityUnit.MicrowattPerCubicMeter: return (baseUnitValue) / 1e-6d; + case PowerDensityUnit.MicrowattPerLiter: return (baseUnitValue/1.0e3) / 1e-6d; + case PowerDensityUnit.MilliwattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-3d; + case PowerDensityUnit.MilliwattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-3d; + case PowerDensityUnit.MilliwattPerCubicMeter: return (baseUnitValue) / 1e-3d; + case PowerDensityUnit.MilliwattPerLiter: return (baseUnitValue/1.0e3) / 1e-3d; + case PowerDensityUnit.NanowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-9d; + case PowerDensityUnit.NanowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-9d; + case PowerDensityUnit.NanowattPerCubicMeter: return (baseUnitValue) / 1e-9d; + case PowerDensityUnit.NanowattPerLiter: return (baseUnitValue/1.0e3) / 1e-9d; + case PowerDensityUnit.PicowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-12d; + case PowerDensityUnit.PicowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-12d; + case PowerDensityUnit.PicowattPerCubicMeter: return (baseUnitValue) / 1e-12d; + case PowerDensityUnit.PicowattPerLiter: return (baseUnitValue/1.0e3) / 1e-12d; + case PowerDensityUnit.TerawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e12d; + case PowerDensityUnit.TerawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e12d; + case PowerDensityUnit.TerawattPerCubicMeter: return (baseUnitValue) / 1e12d; + case PowerDensityUnit.TerawattPerLiter: return (baseUnitValue/1.0e3) / 1e12d; + case PowerDensityUnit.WattPerCubicFoot: return baseUnitValue/3.531466672148859e1; + case PowerDensityUnit.WattPerCubicInch: return baseUnitValue/6.102374409473228e4; + case PowerDensityUnit.WattPerCubicMeter: return baseUnitValue; + case PowerDensityUnit.WattPerLiter: return baseUnitValue/1.0e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..3f6834c004 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -0,0 +1,587 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The strength of a signal expressed in decibels (dB) relative to one watt. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class PowerRatio : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PowerRatioUnit? _unit; + + static PowerRatio() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit DecibelWatt. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public PowerRatio() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private PowerRatio(double numericValue, PowerRatioUnit unit) + { + if(unit == PowerRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of PowerRatio, which is DecibelWatt. All conversions go via this value. + /// + public static PowerRatioUnit BaseUnit => PowerRatioUnit.DecibelWatt; + + /// + /// Represents the largest possible value of PowerRatio + /// + public static PowerRatio MaxValue => new PowerRatio(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of PowerRatio + /// + public static PowerRatio MinValue => new PowerRatio(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.PowerRatio; + + /// + /// All units of measurement for the PowerRatio quantity. + /// + public static PowerRatioUnit[] Units { get; } = Enum.GetValues(typeof(PowerRatioUnit)).Cast().Except(new PowerRatioUnit[]{ PowerRatioUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DecibelWatt. + /// + public static PowerRatio Zero => new PowerRatio(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PowerRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => PowerRatio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PowerRatio.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get PowerRatio in DecibelMilliwatts. + /// + public double DecibelMilliwatts => As(PowerRatioUnit.DecibelMilliwatt); + + /// + /// Get PowerRatio in DecibelWatts. + /// + public double DecibelWatts => As(PowerRatioUnit.DecibelWatt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PowerRatioUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get PowerRatio from DecibelMilliwatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerRatio FromDecibelMilliwatts(double decibelmilliwatts) + { + double value = (double) decibelmilliwatts; + return new PowerRatio(value, PowerRatioUnit.DecibelMilliwatt); + } + /// + /// Get PowerRatio from DecibelWatts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PowerRatio FromDecibelWatts(double decibelwatts) + { + double value = (double) decibelwatts; + return new PowerRatio(value, PowerRatioUnit.DecibelWatt); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// PowerRatio unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static PowerRatio From(double value, PowerRatioUnit fromUnit) + { + return new PowerRatio((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static PowerRatio Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PowerRatio Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out PowerRatio result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PowerRatio result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerRatioUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PowerRatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PowerRatioUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PowerRatioUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is PowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); + + return CompareTo((PowerRatio)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(PowerRatio other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another PowerRatio within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current PowerRatio. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PowerRatioUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this PowerRatio to another PowerRatio with the unit representation . + /// + /// A PowerRatio with the specified unit. + public PowerRatio ToUnit(PowerRatioUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new PowerRatio(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PowerRatioUnit.DecibelMilliwatt: return _value - 30; + case PowerRatioUnit.DecibelWatt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PowerRatioUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PowerRatioUnit.DecibelMilliwatt: return baseUnitValue + 30; + case PowerRatioUnit.DecibelWatt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..33cd62bf6a --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -0,0 +1,1233 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Pressure : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PressureUnit? _unit; + + static Pressure() + { + BaseDimensions = new BaseDimensions(-1, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Pascal. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Pressure() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Pressure(double numericValue, PressureUnit unit) + { + if(unit == PressureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Pressure, which is Pascal. All conversions go via this value. + /// + public static PressureUnit BaseUnit => PressureUnit.Pascal; + + /// + /// Represents the largest possible value of Pressure + /// + public static Pressure MaxValue => new Pressure(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Pressure + /// + public static Pressure MinValue => new Pressure(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Pressure; + + /// + /// All units of measurement for the Pressure quantity. + /// + public static PressureUnit[] Units { get; } = Enum.GetValues(typeof(PressureUnit)).Cast().Except(new PressureUnit[]{ PressureUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Pascal. + /// + public static Pressure Zero => new Pressure(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PressureUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Pressure.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Pressure.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Pressure in Atmospheres. + /// + public double Atmospheres => As(PressureUnit.Atmosphere); + + /// + /// Get Pressure in Bars. + /// + public double Bars => As(PressureUnit.Bar); + + /// + /// Get Pressure in Centibars. + /// + public double Centibars => As(PressureUnit.Centibar); + + /// + /// Get Pressure in Decapascals. + /// + public double Decapascals => As(PressureUnit.Decapascal); + + /// + /// Get Pressure in Decibars. + /// + public double Decibars => As(PressureUnit.Decibar); + + /// + /// Get Pressure in DynesPerSquareCentimeter. + /// + public double DynesPerSquareCentimeter => As(PressureUnit.DynePerSquareCentimeter); + + /// + /// Get Pressure in FeetOfHead. + /// + public double FeetOfHead => As(PressureUnit.FootOfHead); + + /// + /// Get Pressure in Gigapascals. + /// + public double Gigapascals => As(PressureUnit.Gigapascal); + + /// + /// Get Pressure in Hectopascals. + /// + public double Hectopascals => As(PressureUnit.Hectopascal); + + /// + /// Get Pressure in InchesOfMercury. + /// + public double InchesOfMercury => As(PressureUnit.InchOfMercury); + + /// + /// Get Pressure in Kilobars. + /// + public double Kilobars => As(PressureUnit.Kilobar); + + /// + /// Get Pressure in KilogramsForcePerSquareCentimeter. + /// + public double KilogramsForcePerSquareCentimeter => As(PressureUnit.KilogramForcePerSquareCentimeter); + + /// + /// Get Pressure in KilogramsForcePerSquareMeter. + /// + public double KilogramsForcePerSquareMeter => As(PressureUnit.KilogramForcePerSquareMeter); + + /// + /// Get Pressure in KilogramsForcePerSquareMillimeter. + /// + public double KilogramsForcePerSquareMillimeter => As(PressureUnit.KilogramForcePerSquareMillimeter); + + /// + /// Get Pressure in KilonewtonsPerSquareCentimeter. + /// + public double KilonewtonsPerSquareCentimeter => As(PressureUnit.KilonewtonPerSquareCentimeter); + + /// + /// Get Pressure in KilonewtonsPerSquareMeter. + /// + public double KilonewtonsPerSquareMeter => As(PressureUnit.KilonewtonPerSquareMeter); + + /// + /// Get Pressure in KilonewtonsPerSquareMillimeter. + /// + public double KilonewtonsPerSquareMillimeter => As(PressureUnit.KilonewtonPerSquareMillimeter); + + /// + /// Get Pressure in Kilopascals. + /// + public double Kilopascals => As(PressureUnit.Kilopascal); + + /// + /// Get Pressure in KilopoundsForcePerSquareFoot. + /// + public double KilopoundsForcePerSquareFoot => As(PressureUnit.KilopoundForcePerSquareFoot); + + /// + /// Get Pressure in KilopoundsForcePerSquareInch. + /// + public double KilopoundsForcePerSquareInch => As(PressureUnit.KilopoundForcePerSquareInch); + + /// + /// Get Pressure in Megabars. + /// + public double Megabars => As(PressureUnit.Megabar); + + /// + /// Get Pressure in MeganewtonsPerSquareMeter. + /// + public double MeganewtonsPerSquareMeter => As(PressureUnit.MeganewtonPerSquareMeter); + + /// + /// Get Pressure in Megapascals. + /// + public double Megapascals => As(PressureUnit.Megapascal); + + /// + /// Get Pressure in MetersOfHead. + /// + public double MetersOfHead => As(PressureUnit.MeterOfHead); + + /// + /// Get Pressure in Microbars. + /// + public double Microbars => As(PressureUnit.Microbar); + + /// + /// Get Pressure in Micropascals. + /// + public double Micropascals => As(PressureUnit.Micropascal); + + /// + /// Get Pressure in Millibars. + /// + public double Millibars => As(PressureUnit.Millibar); + + /// + /// Get Pressure in MillimetersOfMercury. + /// + public double MillimetersOfMercury => As(PressureUnit.MillimeterOfMercury); + + /// + /// Get Pressure in NewtonsPerSquareCentimeter. + /// + public double NewtonsPerSquareCentimeter => As(PressureUnit.NewtonPerSquareCentimeter); + + /// + /// Get Pressure in NewtonsPerSquareMeter. + /// + public double NewtonsPerSquareMeter => As(PressureUnit.NewtonPerSquareMeter); + + /// + /// Get Pressure in NewtonsPerSquareMillimeter. + /// + public double NewtonsPerSquareMillimeter => As(PressureUnit.NewtonPerSquareMillimeter); + + /// + /// Get Pressure in Pascals. + /// + public double Pascals => As(PressureUnit.Pascal); + + /// + /// Get Pressure in PoundsForcePerSquareFoot. + /// + public double PoundsForcePerSquareFoot => As(PressureUnit.PoundForcePerSquareFoot); + + /// + /// Get Pressure in PoundsForcePerSquareInch. + /// + public double PoundsForcePerSquareInch => As(PressureUnit.PoundForcePerSquareInch); + + /// + /// Get Pressure in PoundsPerInchSecondSquared. + /// + public double PoundsPerInchSecondSquared => As(PressureUnit.PoundPerInchSecondSquared); + + /// + /// Get Pressure in TechnicalAtmospheres. + /// + public double TechnicalAtmospheres => As(PressureUnit.TechnicalAtmosphere); + + /// + /// Get Pressure in TonnesForcePerSquareCentimeter. + /// + public double TonnesForcePerSquareCentimeter => As(PressureUnit.TonneForcePerSquareCentimeter); + + /// + /// Get Pressure in TonnesForcePerSquareMeter. + /// + public double TonnesForcePerSquareMeter => As(PressureUnit.TonneForcePerSquareMeter); + + /// + /// Get Pressure in TonnesForcePerSquareMillimeter. + /// + public double TonnesForcePerSquareMillimeter => As(PressureUnit.TonneForcePerSquareMillimeter); + + /// + /// Get Pressure in Torrs. + /// + public double Torrs => As(PressureUnit.Torr); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PressureUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(PressureUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Pressure from Atmospheres. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromAtmospheres(double atmospheres) + { + double value = (double) atmospheres; + return new Pressure(value, PressureUnit.Atmosphere); + } + /// + /// Get Pressure from Bars. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromBars(double bars) + { + double value = (double) bars; + return new Pressure(value, PressureUnit.Bar); + } + /// + /// Get Pressure from Centibars. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromCentibars(double centibars) + { + double value = (double) centibars; + return new Pressure(value, PressureUnit.Centibar); + } + /// + /// Get Pressure from Decapascals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromDecapascals(double decapascals) + { + double value = (double) decapascals; + return new Pressure(value, PressureUnit.Decapascal); + } + /// + /// Get Pressure from Decibars. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromDecibars(double decibars) + { + double value = (double) decibars; + return new Pressure(value, PressureUnit.Decibar); + } + /// + /// Get Pressure from DynesPerSquareCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromDynesPerSquareCentimeter(double dynespersquarecentimeter) + { + double value = (double) dynespersquarecentimeter; + return new Pressure(value, PressureUnit.DynePerSquareCentimeter); + } + /// + /// Get Pressure from FeetOfHead. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromFeetOfHead(double feetofhead) + { + double value = (double) feetofhead; + return new Pressure(value, PressureUnit.FootOfHead); + } + /// + /// Get Pressure from Gigapascals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromGigapascals(double gigapascals) + { + double value = (double) gigapascals; + return new Pressure(value, PressureUnit.Gigapascal); + } + /// + /// Get Pressure from Hectopascals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromHectopascals(double hectopascals) + { + double value = (double) hectopascals; + return new Pressure(value, PressureUnit.Hectopascal); + } + /// + /// Get Pressure from InchesOfMercury. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromInchesOfMercury(double inchesofmercury) + { + double value = (double) inchesofmercury; + return new Pressure(value, PressureUnit.InchOfMercury); + } + /// + /// Get Pressure from Kilobars. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilobars(double kilobars) + { + double value = (double) kilobars; + return new Pressure(value, PressureUnit.Kilobar); + } + /// + /// Get Pressure from KilogramsForcePerSquareCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilogramsForcePerSquareCentimeter(double kilogramsforcepersquarecentimeter) + { + double value = (double) kilogramsforcepersquarecentimeter; + return new Pressure(value, PressureUnit.KilogramForcePerSquareCentimeter); + } + /// + /// Get Pressure from KilogramsForcePerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilogramsForcePerSquareMeter(double kilogramsforcepersquaremeter) + { + double value = (double) kilogramsforcepersquaremeter; + return new Pressure(value, PressureUnit.KilogramForcePerSquareMeter); + } + /// + /// Get Pressure from KilogramsForcePerSquareMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilogramsForcePerSquareMillimeter(double kilogramsforcepersquaremillimeter) + { + double value = (double) kilogramsforcepersquaremillimeter; + return new Pressure(value, PressureUnit.KilogramForcePerSquareMillimeter); + } + /// + /// Get Pressure from KilonewtonsPerSquareCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilonewtonsPerSquareCentimeter(double kilonewtonspersquarecentimeter) + { + double value = (double) kilonewtonspersquarecentimeter; + return new Pressure(value, PressureUnit.KilonewtonPerSquareCentimeter); + } + /// + /// Get Pressure from KilonewtonsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilonewtonsPerSquareMeter(double kilonewtonspersquaremeter) + { + double value = (double) kilonewtonspersquaremeter; + return new Pressure(value, PressureUnit.KilonewtonPerSquareMeter); + } + /// + /// Get Pressure from KilonewtonsPerSquareMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilonewtonsPerSquareMillimeter(double kilonewtonspersquaremillimeter) + { + double value = (double) kilonewtonspersquaremillimeter; + return new Pressure(value, PressureUnit.KilonewtonPerSquareMillimeter); + } + /// + /// Get Pressure from Kilopascals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilopascals(double kilopascals) + { + double value = (double) kilopascals; + return new Pressure(value, PressureUnit.Kilopascal); + } + /// + /// Get Pressure from KilopoundsForcePerSquareFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilopoundsForcePerSquareFoot(double kilopoundsforcepersquarefoot) + { + double value = (double) kilopoundsforcepersquarefoot; + return new Pressure(value, PressureUnit.KilopoundForcePerSquareFoot); + } + /// + /// Get Pressure from KilopoundsForcePerSquareInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromKilopoundsForcePerSquareInch(double kilopoundsforcepersquareinch) + { + double value = (double) kilopoundsforcepersquareinch; + return new Pressure(value, PressureUnit.KilopoundForcePerSquareInch); + } + /// + /// Get Pressure from Megabars. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMegabars(double megabars) + { + double value = (double) megabars; + return new Pressure(value, PressureUnit.Megabar); + } + /// + /// Get Pressure from MeganewtonsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMeganewtonsPerSquareMeter(double meganewtonspersquaremeter) + { + double value = (double) meganewtonspersquaremeter; + return new Pressure(value, PressureUnit.MeganewtonPerSquareMeter); + } + /// + /// Get Pressure from Megapascals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMegapascals(double megapascals) + { + double value = (double) megapascals; + return new Pressure(value, PressureUnit.Megapascal); + } + /// + /// Get Pressure from MetersOfHead. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMetersOfHead(double metersofhead) + { + double value = (double) metersofhead; + return new Pressure(value, PressureUnit.MeterOfHead); + } + /// + /// Get Pressure from Microbars. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMicrobars(double microbars) + { + double value = (double) microbars; + return new Pressure(value, PressureUnit.Microbar); + } + /// + /// Get Pressure from Micropascals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMicropascals(double micropascals) + { + double value = (double) micropascals; + return new Pressure(value, PressureUnit.Micropascal); + } + /// + /// Get Pressure from Millibars. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMillibars(double millibars) + { + double value = (double) millibars; + return new Pressure(value, PressureUnit.Millibar); + } + /// + /// Get Pressure from MillimetersOfMercury. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromMillimetersOfMercury(double millimetersofmercury) + { + double value = (double) millimetersofmercury; + return new Pressure(value, PressureUnit.MillimeterOfMercury); + } + /// + /// Get Pressure from NewtonsPerSquareCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromNewtonsPerSquareCentimeter(double newtonspersquarecentimeter) + { + double value = (double) newtonspersquarecentimeter; + return new Pressure(value, PressureUnit.NewtonPerSquareCentimeter); + } + /// + /// Get Pressure from NewtonsPerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromNewtonsPerSquareMeter(double newtonspersquaremeter) + { + double value = (double) newtonspersquaremeter; + return new Pressure(value, PressureUnit.NewtonPerSquareMeter); + } + /// + /// Get Pressure from NewtonsPerSquareMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromNewtonsPerSquareMillimeter(double newtonspersquaremillimeter) + { + double value = (double) newtonspersquaremillimeter; + return new Pressure(value, PressureUnit.NewtonPerSquareMillimeter); + } + /// + /// Get Pressure from Pascals. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromPascals(double pascals) + { + double value = (double) pascals; + return new Pressure(value, PressureUnit.Pascal); + } + /// + /// Get Pressure from PoundsForcePerSquareFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromPoundsForcePerSquareFoot(double poundsforcepersquarefoot) + { + double value = (double) poundsforcepersquarefoot; + return new Pressure(value, PressureUnit.PoundForcePerSquareFoot); + } + /// + /// Get Pressure from PoundsForcePerSquareInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromPoundsForcePerSquareInch(double poundsforcepersquareinch) + { + double value = (double) poundsforcepersquareinch; + return new Pressure(value, PressureUnit.PoundForcePerSquareInch); + } + /// + /// Get Pressure from PoundsPerInchSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromPoundsPerInchSecondSquared(double poundsperinchsecondsquared) + { + double value = (double) poundsperinchsecondsquared; + return new Pressure(value, PressureUnit.PoundPerInchSecondSquared); + } + /// + /// Get Pressure from TechnicalAtmospheres. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromTechnicalAtmospheres(double technicalatmospheres) + { + double value = (double) technicalatmospheres; + return new Pressure(value, PressureUnit.TechnicalAtmosphere); + } + /// + /// Get Pressure from TonnesForcePerSquareCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromTonnesForcePerSquareCentimeter(double tonnesforcepersquarecentimeter) + { + double value = (double) tonnesforcepersquarecentimeter; + return new Pressure(value, PressureUnit.TonneForcePerSquareCentimeter); + } + /// + /// Get Pressure from TonnesForcePerSquareMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromTonnesForcePerSquareMeter(double tonnesforcepersquaremeter) + { + double value = (double) tonnesforcepersquaremeter; + return new Pressure(value, PressureUnit.TonneForcePerSquareMeter); + } + /// + /// Get Pressure from TonnesForcePerSquareMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromTonnesForcePerSquareMillimeter(double tonnesforcepersquaremillimeter) + { + double value = (double) tonnesforcepersquaremillimeter; + return new Pressure(value, PressureUnit.TonneForcePerSquareMillimeter); + } + /// + /// Get Pressure from Torrs. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Pressure FromTorrs(double torrs) + { + double value = (double) torrs; + return new Pressure(value, PressureUnit.Torr); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Pressure unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Pressure From(double value, PressureUnit fromUnit) + { + return new Pressure((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Pressure Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Pressure Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Pressure result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Pressure result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PressureUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PressureUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PressureUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Pressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); + + return CompareTo((Pressure)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Pressure other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Pressure within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Pressure. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PressureUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Pressure to another Pressure with the unit representation . + /// + /// A Pressure with the specified unit. + public Pressure ToUnit(PressureUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Pressure(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PressureUnit.Atmosphere: return _value*1.01325*1e5; + case PressureUnit.Bar: return _value*1e5; + case PressureUnit.Centibar: return (_value*1e5) * 1e-2d; + case PressureUnit.Decapascal: return (_value) * 1e1d; + case PressureUnit.Decibar: return (_value*1e5) * 1e-1d; + case PressureUnit.DynePerSquareCentimeter: return _value*1.0e-1; + case PressureUnit.FootOfHead: return _value*2989.0669; + case PressureUnit.Gigapascal: return (_value) * 1e9d; + case PressureUnit.Hectopascal: return (_value) * 1e2d; + case PressureUnit.InchOfMercury: return _value/2.95299830714159e-4; + case PressureUnit.Kilobar: return (_value*1e5) * 1e3d; + case PressureUnit.KilogramForcePerSquareCentimeter: return _value*9.80665e4; + case PressureUnit.KilogramForcePerSquareMeter: return _value*9.80665019960652; + case PressureUnit.KilogramForcePerSquareMillimeter: return _value*9.80665e6; + case PressureUnit.KilonewtonPerSquareCentimeter: return (_value*1e4) * 1e3d; + case PressureUnit.KilonewtonPerSquareMeter: return (_value) * 1e3d; + case PressureUnit.KilonewtonPerSquareMillimeter: return (_value*1e6) * 1e3d; + case PressureUnit.Kilopascal: return (_value) * 1e3d; + case PressureUnit.KilopoundForcePerSquareFoot: return (_value*4.788025898033584e1) * 1e3d; + case PressureUnit.KilopoundForcePerSquareInch: return (_value*6.894757293168361e3) * 1e3d; + case PressureUnit.Megabar: return (_value*1e5) * 1e6d; + case PressureUnit.MeganewtonPerSquareMeter: return (_value) * 1e6d; + case PressureUnit.Megapascal: return (_value) * 1e6d; + case PressureUnit.MeterOfHead: return _value*9804.139432; + case PressureUnit.Microbar: return (_value*1e5) * 1e-6d; + case PressureUnit.Micropascal: return (_value) * 1e-6d; + case PressureUnit.Millibar: return (_value*1e5) * 1e-3d; + case PressureUnit.MillimeterOfMercury: return _value/7.50061561302643e-3; + case PressureUnit.NewtonPerSquareCentimeter: return _value*1e4; + case PressureUnit.NewtonPerSquareMeter: return _value; + case PressureUnit.NewtonPerSquareMillimeter: return _value*1e6; + case PressureUnit.Pascal: return _value; + case PressureUnit.PoundForcePerSquareFoot: return _value*4.788025898033584e1; + case PressureUnit.PoundForcePerSquareInch: return _value*6.894757293168361e3; + case PressureUnit.PoundPerInchSecondSquared: return _value*1.785796732283465e1; + case PressureUnit.TechnicalAtmosphere: return _value*9.80680592331*1e4; + case PressureUnit.TonneForcePerSquareCentimeter: return _value*9.80665e7; + case PressureUnit.TonneForcePerSquareMeter: return _value*9.80665e3; + case PressureUnit.TonneForcePerSquareMillimeter: return _value*9.80665e9; + case PressureUnit.Torr: return _value*1.3332266752*1e2; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PressureUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PressureUnit.Atmosphere: return baseUnitValue/(1.01325*1e5); + case PressureUnit.Bar: return baseUnitValue/1e5; + case PressureUnit.Centibar: return (baseUnitValue/1e5) / 1e-2d; + case PressureUnit.Decapascal: return (baseUnitValue) / 1e1d; + case PressureUnit.Decibar: return (baseUnitValue/1e5) / 1e-1d; + case PressureUnit.DynePerSquareCentimeter: return baseUnitValue/1.0e-1; + case PressureUnit.FootOfHead: return baseUnitValue*0.000334552565551; + case PressureUnit.Gigapascal: return (baseUnitValue) / 1e9d; + case PressureUnit.Hectopascal: return (baseUnitValue) / 1e2d; + case PressureUnit.InchOfMercury: return baseUnitValue*2.95299830714159e-4; + case PressureUnit.Kilobar: return (baseUnitValue/1e5) / 1e3d; + case PressureUnit.KilogramForcePerSquareCentimeter: return baseUnitValue/9.80665e4; + case PressureUnit.KilogramForcePerSquareMeter: return baseUnitValue*0.101971619222242; + case PressureUnit.KilogramForcePerSquareMillimeter: return baseUnitValue/9.80665e6; + case PressureUnit.KilonewtonPerSquareCentimeter: return (baseUnitValue/1e4) / 1e3d; + case PressureUnit.KilonewtonPerSquareMeter: return (baseUnitValue) / 1e3d; + case PressureUnit.KilonewtonPerSquareMillimeter: return (baseUnitValue/1e6) / 1e3d; + case PressureUnit.Kilopascal: return (baseUnitValue) / 1e3d; + case PressureUnit.KilopoundForcePerSquareFoot: return (baseUnitValue/4.788025898033584e1) / 1e3d; + case PressureUnit.KilopoundForcePerSquareInch: return (baseUnitValue/6.894757293168361e3) / 1e3d; + case PressureUnit.Megabar: return (baseUnitValue/1e5) / 1e6d; + case PressureUnit.MeganewtonPerSquareMeter: return (baseUnitValue) / 1e6d; + case PressureUnit.Megapascal: return (baseUnitValue) / 1e6d; + case PressureUnit.MeterOfHead: return baseUnitValue*0.0001019977334; + case PressureUnit.Microbar: return (baseUnitValue/1e5) / 1e-6d; + case PressureUnit.Micropascal: return (baseUnitValue) / 1e-6d; + case PressureUnit.Millibar: return (baseUnitValue/1e5) / 1e-3d; + case PressureUnit.MillimeterOfMercury: return baseUnitValue*7.50061561302643e-3; + case PressureUnit.NewtonPerSquareCentimeter: return baseUnitValue/1e4; + case PressureUnit.NewtonPerSquareMeter: return baseUnitValue; + case PressureUnit.NewtonPerSquareMillimeter: return baseUnitValue/1e6; + case PressureUnit.Pascal: return baseUnitValue; + case PressureUnit.PoundForcePerSquareFoot: return baseUnitValue/4.788025898033584e1; + case PressureUnit.PoundForcePerSquareInch: return baseUnitValue/6.894757293168361e3; + case PressureUnit.PoundPerInchSecondSquared: return baseUnitValue/1.785796732283465e1; + case PressureUnit.TechnicalAtmosphere: return baseUnitValue/(9.80680592331*1e4); + case PressureUnit.TonneForcePerSquareCentimeter: return baseUnitValue/9.80665e7; + case PressureUnit.TonneForcePerSquareMeter: return baseUnitValue/9.80665e3; + case PressureUnit.TonneForcePerSquareMillimeter: return baseUnitValue/9.80665e9; + case PressureUnit.Torr: return baseUnitValue/(1.3332266752*1e2); + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..d9d49c8ca4 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -0,0 +1,621 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class PressureChangeRate : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PressureChangeRateUnit? _unit; + + static PressureChangeRate() + { + BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit PascalPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public PressureChangeRate() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private PressureChangeRate(double numericValue, PressureChangeRateUnit unit) + { + if(unit == PressureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of PressureChangeRate, which is PascalPerSecond. All conversions go via this value. + /// + public static PressureChangeRateUnit BaseUnit => PressureChangeRateUnit.PascalPerSecond; + + /// + /// Represents the largest possible value of PressureChangeRate + /// + public static PressureChangeRate MaxValue => new PressureChangeRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of PressureChangeRate + /// + public static PressureChangeRate MinValue => new PressureChangeRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.PressureChangeRate; + + /// + /// All units of measurement for the PressureChangeRate quantity. + /// + public static PressureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(PressureChangeRateUnit)).Cast().Except(new PressureChangeRateUnit[]{ PressureChangeRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit PascalPerSecond. + /// + public static PressureChangeRate Zero => new PressureChangeRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PressureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => PressureChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PressureChangeRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get PressureChangeRate in AtmospheresPerSecond. + /// + public double AtmospheresPerSecond => As(PressureChangeRateUnit.AtmospherePerSecond); + + /// + /// Get PressureChangeRate in KilopascalsPerSecond. + /// + public double KilopascalsPerSecond => As(PressureChangeRateUnit.KilopascalPerSecond); + + /// + /// Get PressureChangeRate in MegapascalsPerSecond. + /// + public double MegapascalsPerSecond => As(PressureChangeRateUnit.MegapascalPerSecond); + + /// + /// Get PressureChangeRate in PascalsPerSecond. + /// + public double PascalsPerSecond => As(PressureChangeRateUnit.PascalPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PressureChangeRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get PressureChangeRate from AtmospheresPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PressureChangeRate FromAtmospheresPerSecond(double atmospherespersecond) + { + double value = (double) atmospherespersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.AtmospherePerSecond); + } + /// + /// Get PressureChangeRate from KilopascalsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PressureChangeRate FromKilopascalsPerSecond(double kilopascalspersecond) + { + double value = (double) kilopascalspersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerSecond); + } + /// + /// Get PressureChangeRate from MegapascalsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PressureChangeRate FromMegapascalsPerSecond(double megapascalspersecond) + { + double value = (double) megapascalspersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerSecond); + } + /// + /// Get PressureChangeRate from PascalsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static PressureChangeRate FromPascalsPerSecond(double pascalspersecond) + { + double value = (double) pascalspersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// PressureChangeRate unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static PressureChangeRate From(double value, PressureChangeRateUnit fromUnit) + { + return new PressureChangeRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static PressureChangeRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PressureChangeRate Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out PressureChangeRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out PressureChangeRate result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PressureChangeRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static PressureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PressureChangeRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out PressureChangeRateUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is PressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); + + return CompareTo((PressureChangeRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(PressureChangeRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another PressureChangeRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current PressureChangeRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PressureChangeRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this PressureChangeRate to another PressureChangeRate with the unit representation . + /// + /// A PressureChangeRate with the specified unit. + public PressureChangeRate ToUnit(PressureChangeRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new PressureChangeRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PressureChangeRateUnit.AtmospherePerSecond: return _value * 1.01325*1e5; + case PressureChangeRateUnit.KilopascalPerSecond: return (_value) * 1e3d; + case PressureChangeRateUnit.MegapascalPerSecond: return (_value) * 1e6d; + case PressureChangeRateUnit.PascalPerSecond: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PressureChangeRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PressureChangeRateUnit.AtmospherePerSecond: return baseUnitValue / (1.01325*1e5); + case PressureChangeRateUnit.KilopascalPerSecond: return (baseUnitValue) / 1e3d; + case PressureChangeRateUnit.MegapascalPerSecond: return (baseUnitValue) / 1e6d; + case PressureChangeRateUnit.PascalPerSecond: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..28e40e140f --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -0,0 +1,655 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Ratio : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RatioUnit? _unit; + + static Ratio() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit DecimalFraction. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Ratio() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Ratio(double numericValue, RatioUnit unit) + { + if(unit == RatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Ratio, which is DecimalFraction. All conversions go via this value. + /// + public static RatioUnit BaseUnit => RatioUnit.DecimalFraction; + + /// + /// Represents the largest possible value of Ratio + /// + public static Ratio MaxValue => new Ratio(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Ratio + /// + public static Ratio MinValue => new Ratio(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Ratio; + + /// + /// All units of measurement for the Ratio quantity. + /// + public static RatioUnit[] Units { get; } = Enum.GetValues(typeof(RatioUnit)).Cast().Except(new RatioUnit[]{ RatioUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. + /// + public static Ratio Zero => new Ratio(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Ratio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Ratio.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Ratio in DecimalFractions. + /// + public double DecimalFractions => As(RatioUnit.DecimalFraction); + + /// + /// Get Ratio in PartsPerBillion. + /// + public double PartsPerBillion => As(RatioUnit.PartPerBillion); + + /// + /// Get Ratio in PartsPerMillion. + /// + public double PartsPerMillion => As(RatioUnit.PartPerMillion); + + /// + /// Get Ratio in PartsPerThousand. + /// + public double PartsPerThousand => As(RatioUnit.PartPerThousand); + + /// + /// Get Ratio in PartsPerTrillion. + /// + public double PartsPerTrillion => As(RatioUnit.PartPerTrillion); + + /// + /// Get Ratio in Percent. + /// + public double Percent => As(RatioUnit.Percent); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RatioUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(RatioUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Ratio from DecimalFractions. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Ratio FromDecimalFractions(double decimalfractions) + { + double value = (double) decimalfractions; + return new Ratio(value, RatioUnit.DecimalFraction); + } + /// + /// Get Ratio from PartsPerBillion. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Ratio FromPartsPerBillion(double partsperbillion) + { + double value = (double) partsperbillion; + return new Ratio(value, RatioUnit.PartPerBillion); + } + /// + /// Get Ratio from PartsPerMillion. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Ratio FromPartsPerMillion(double partspermillion) + { + double value = (double) partspermillion; + return new Ratio(value, RatioUnit.PartPerMillion); + } + /// + /// Get Ratio from PartsPerThousand. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Ratio FromPartsPerThousand(double partsperthousand) + { + double value = (double) partsperthousand; + return new Ratio(value, RatioUnit.PartPerThousand); + } + /// + /// Get Ratio from PartsPerTrillion. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Ratio FromPartsPerTrillion(double partspertrillion) + { + double value = (double) partspertrillion; + return new Ratio(value, RatioUnit.PartPerTrillion); + } + /// + /// Get Ratio from Percent. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Ratio FromPercent(double percent) + { + double value = (double) percent; + return new Ratio(value, RatioUnit.Percent); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Ratio unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Ratio From(double value, RatioUnit fromUnit) + { + return new Ratio((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Ratio Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Ratio Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Ratio result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Ratio result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RatioUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RatioUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RatioUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RatioUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Ratio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); + + return CompareTo((Ratio)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Ratio other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Ratio within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Ratio. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RatioUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Ratio to another Ratio with the unit representation . + /// + /// A Ratio with the specified unit. + public Ratio ToUnit(RatioUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Ratio(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RatioUnit.DecimalFraction: return _value; + case RatioUnit.PartPerBillion: return _value/1e9; + case RatioUnit.PartPerMillion: return _value/1e6; + case RatioUnit.PartPerThousand: return _value/1e3; + case RatioUnit.PartPerTrillion: return _value/1e12; + case RatioUnit.Percent: return _value/1e2; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RatioUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RatioUnit.DecimalFraction: return baseUnitValue; + case RatioUnit.PartPerBillion: return baseUnitValue*1e9; + case RatioUnit.PartPerMillion: return baseUnitValue*1e6; + case RatioUnit.PartPerThousand: return baseUnitValue*1e3; + case RatioUnit.PartPerTrillion: return baseUnitValue*1e12; + case RatioUnit.Percent: return baseUnitValue*1e2; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..893f7b32dc --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ReactiveEnergy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ReactiveEnergyUnit? _unit; + + static ReactiveEnergy() + { + BaseDimensions = new BaseDimensions(2, 1, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit VoltampereReactiveHour. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ReactiveEnergy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ReactiveEnergy(double numericValue, ReactiveEnergyUnit unit) + { + if(unit == ReactiveEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ReactiveEnergy, which is VoltampereReactiveHour. All conversions go via this value. + /// + public static ReactiveEnergyUnit BaseUnit => ReactiveEnergyUnit.VoltampereReactiveHour; + + /// + /// Represents the largest possible value of ReactiveEnergy + /// + public static ReactiveEnergy MaxValue => new ReactiveEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ReactiveEnergy + /// + public static ReactiveEnergy MinValue => new ReactiveEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ReactiveEnergy; + + /// + /// All units of measurement for the ReactiveEnergy quantity. + /// + public static ReactiveEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ReactiveEnergyUnit)).Cast().Except(new ReactiveEnergyUnit[]{ ReactiveEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactiveHour. + /// + public static ReactiveEnergy Zero => new ReactiveEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ReactiveEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ReactiveEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ReactiveEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ReactiveEnergy in KilovoltampereReactiveHours. + /// + public double KilovoltampereReactiveHours => As(ReactiveEnergyUnit.KilovoltampereReactiveHour); + + /// + /// Get ReactiveEnergy in MegavoltampereReactiveHours. + /// + public double MegavoltampereReactiveHours => As(ReactiveEnergyUnit.MegavoltampereReactiveHour); + + /// + /// Get ReactiveEnergy in VoltampereReactiveHours. + /// + public double VoltampereReactiveHours => As(ReactiveEnergyUnit.VoltampereReactiveHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ReactiveEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ReactiveEnergy from KilovoltampereReactiveHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ReactiveEnergy FromKilovoltampereReactiveHours(double kilovoltamperereactivehours) + { + double value = (double) kilovoltamperereactivehours; + return new ReactiveEnergy(value, ReactiveEnergyUnit.KilovoltampereReactiveHour); + } + /// + /// Get ReactiveEnergy from MegavoltampereReactiveHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ReactiveEnergy FromMegavoltampereReactiveHours(double megavoltamperereactivehours) + { + double value = (double) megavoltamperereactivehours; + return new ReactiveEnergy(value, ReactiveEnergyUnit.MegavoltampereReactiveHour); + } + /// + /// Get ReactiveEnergy from VoltampereReactiveHours. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ReactiveEnergy FromVoltampereReactiveHours(double voltamperereactivehours) + { + double value = (double) voltamperereactivehours; + return new ReactiveEnergy(value, ReactiveEnergyUnit.VoltampereReactiveHour); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ReactiveEnergy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ReactiveEnergy From(double value, ReactiveEnergyUnit fromUnit) + { + return new ReactiveEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ReactiveEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ReactiveEnergy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactiveEnergy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ReactiveEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ReactiveEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ReactiveEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactiveEnergyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); + + return CompareTo((ReactiveEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ReactiveEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ReactiveEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ReactiveEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ReactiveEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ReactiveEnergy to another ReactiveEnergy with the unit representation . + /// + /// A ReactiveEnergy with the specified unit. + public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ReactiveEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (_value) * 1e3d; + case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (_value) * 1e6d; + case ReactiveEnergyUnit.VoltampereReactiveHour: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ReactiveEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (baseUnitValue) / 1e3d; + case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (baseUnitValue) / 1e6d; + case ReactiveEnergyUnit.VoltampereReactiveHour: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..6cdb0d0f9b --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -0,0 +1,621 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ReactivePower : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ReactivePowerUnit? _unit; + + static ReactivePower() + { + BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit VoltampereReactive. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ReactivePower() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ReactivePower(double numericValue, ReactivePowerUnit unit) + { + if(unit == ReactivePowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ReactivePower, which is VoltampereReactive. All conversions go via this value. + /// + public static ReactivePowerUnit BaseUnit => ReactivePowerUnit.VoltampereReactive; + + /// + /// Represents the largest possible value of ReactivePower + /// + public static ReactivePower MaxValue => new ReactivePower(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ReactivePower + /// + public static ReactivePower MinValue => new ReactivePower(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ReactivePower; + + /// + /// All units of measurement for the ReactivePower quantity. + /// + public static ReactivePowerUnit[] Units { get; } = Enum.GetValues(typeof(ReactivePowerUnit)).Cast().Except(new ReactivePowerUnit[]{ ReactivePowerUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactive. + /// + public static ReactivePower Zero => new ReactivePower(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ReactivePowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ReactivePower.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ReactivePower.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ReactivePower in GigavoltamperesReactive. + /// + public double GigavoltamperesReactive => As(ReactivePowerUnit.GigavoltampereReactive); + + /// + /// Get ReactivePower in KilovoltamperesReactive. + /// + public double KilovoltamperesReactive => As(ReactivePowerUnit.KilovoltampereReactive); + + /// + /// Get ReactivePower in MegavoltamperesReactive. + /// + public double MegavoltamperesReactive => As(ReactivePowerUnit.MegavoltampereReactive); + + /// + /// Get ReactivePower in VoltamperesReactive. + /// + public double VoltamperesReactive => As(ReactivePowerUnit.VoltampereReactive); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ReactivePowerUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ReactivePower from GigavoltamperesReactive. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ReactivePower FromGigavoltamperesReactive(double gigavoltamperesreactive) + { + double value = (double) gigavoltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.GigavoltampereReactive); + } + /// + /// Get ReactivePower from KilovoltamperesReactive. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ReactivePower FromKilovoltamperesReactive(double kilovoltamperesreactive) + { + double value = (double) kilovoltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.KilovoltampereReactive); + } + /// + /// Get ReactivePower from MegavoltamperesReactive. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ReactivePower FromMegavoltamperesReactive(double megavoltamperesreactive) + { + double value = (double) megavoltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.MegavoltampereReactive); + } + /// + /// Get ReactivePower from VoltamperesReactive. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ReactivePower FromVoltamperesReactive(double voltamperesreactive) + { + double value = (double) voltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.VoltampereReactive); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ReactivePower unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ReactivePower From(double value, ReactivePowerUnit fromUnit) + { + return new ReactivePower((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ReactivePower Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ReactivePower Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ReactivePower result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ReactivePower result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ReactivePowerUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ReactivePowerUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ReactivePowerUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ReactivePowerUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); + + return CompareTo((ReactivePower)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ReactivePower other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ReactivePower within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ReactivePower. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ReactivePowerUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ReactivePower to another ReactivePower with the unit representation . + /// + /// A ReactivePower with the specified unit. + public ReactivePower ToUnit(ReactivePowerUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ReactivePower(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ReactivePowerUnit.GigavoltampereReactive: return (_value) * 1e9d; + case ReactivePowerUnit.KilovoltampereReactive: return (_value) * 1e3d; + case ReactivePowerUnit.MegavoltampereReactive: return (_value) * 1e6d; + case ReactivePowerUnit.VoltampereReactive: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ReactivePowerUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ReactivePowerUnit.GigavoltampereReactive: return (baseUnitValue) / 1e9d; + case ReactivePowerUnit.KilovoltampereReactive: return (baseUnitValue) / 1e3d; + case ReactivePowerUnit.MegavoltampereReactive: return (baseUnitValue) / 1e6d; + case ReactivePowerUnit.VoltampereReactive: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..8b9c1aea4c --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Angular acceleration is the rate of change of rotational speed. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class RotationalAcceleration : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalAccelerationUnit? _unit; + + static RotationalAcceleration() + { + BaseDimensions = new BaseDimensions(0, 0, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit RadianPerSecondSquared. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public RotationalAcceleration() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private RotationalAcceleration(double numericValue, RotationalAccelerationUnit unit) + { + if(unit == RotationalAccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalAcceleration, which is RadianPerSecondSquared. All conversions go via this value. + /// + public static RotationalAccelerationUnit BaseUnit => RotationalAccelerationUnit.RadianPerSecondSquared; + + /// + /// Represents the largest possible value of RotationalAcceleration + /// + public static RotationalAcceleration MaxValue => new RotationalAcceleration(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalAcceleration + /// + public static RotationalAcceleration MinValue => new RotationalAcceleration(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalAcceleration; + + /// + /// All units of measurement for the RotationalAcceleration quantity. + /// + public static RotationalAccelerationUnit[] Units { get; } = Enum.GetValues(typeof(RotationalAccelerationUnit)).Cast().Except(new RotationalAccelerationUnit[]{ RotationalAccelerationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecondSquared. + /// + public static RotationalAcceleration Zero => new RotationalAcceleration(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalAccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalAcceleration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalAcceleration.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalAcceleration in DegreesPerSecondSquared. + /// + public double DegreesPerSecondSquared => As(RotationalAccelerationUnit.DegreePerSecondSquared); + + /// + /// Get RotationalAcceleration in RadiansPerSecondSquared. + /// + public double RadiansPerSecondSquared => As(RotationalAccelerationUnit.RadianPerSecondSquared); + + /// + /// Get RotationalAcceleration in RevolutionsPerMinutePerSecond. + /// + public double RevolutionsPerMinutePerSecond => As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalAccelerationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalAcceleration from DegreesPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalAcceleration FromDegreesPerSecondSquared(double degreespersecondsquared) + { + double value = (double) degreespersecondsquared; + return new RotationalAcceleration(value, RotationalAccelerationUnit.DegreePerSecondSquared); + } + /// + /// Get RotationalAcceleration from RadiansPerSecondSquared. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalAcceleration FromRadiansPerSecondSquared(double radianspersecondsquared) + { + double value = (double) radianspersecondsquared; + return new RotationalAcceleration(value, RotationalAccelerationUnit.RadianPerSecondSquared); + } + /// + /// Get RotationalAcceleration from RevolutionsPerMinutePerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(double revolutionsperminutepersecond) + { + double value = (double) revolutionsperminutepersecond; + return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalAcceleration unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static RotationalAcceleration From(double value, RotationalAccelerationUnit fromUnit) + { + return new RotationalAcceleration((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalAcceleration Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalAcceleration Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalAcceleration result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalAcceleration result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalAccelerationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalAccelerationUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalAccelerationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalAccelerationUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); + + return CompareTo((RotationalAcceleration)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(RotationalAcceleration other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalAcceleration within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalAcceleration. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalAccelerationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalAcceleration to another RotationalAcceleration with the unit representation . + /// + /// A RotationalAcceleration with the specified unit. + public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalAcceleration(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalAccelerationUnit.DegreePerSecondSquared: return (Math.PI/180)*_value; + case RotationalAccelerationUnit.RadianPerSecondSquared: return _value; + case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return ((2*Math.PI)/60)*_value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalAccelerationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalAccelerationUnit.DegreePerSecondSquared: return (180/Math.PI)*baseUnitValue; + case RotationalAccelerationUnit.RadianPerSecondSquared: return baseUnitValue; + case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return (60/(2*Math.PI))*baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..da8191f564 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -0,0 +1,774 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class RotationalSpeed : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalSpeedUnit? _unit; + + static RotationalSpeed() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit RadianPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public RotationalSpeed() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private RotationalSpeed(double numericValue, RotationalSpeedUnit unit) + { + if(unit == RotationalSpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalSpeed, which is RadianPerSecond. All conversions go via this value. + /// + public static RotationalSpeedUnit BaseUnit => RotationalSpeedUnit.RadianPerSecond; + + /// + /// Represents the largest possible value of RotationalSpeed + /// + public static RotationalSpeed MaxValue => new RotationalSpeed(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalSpeed + /// + public static RotationalSpeed MinValue => new RotationalSpeed(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalSpeed; + + /// + /// All units of measurement for the RotationalSpeed quantity. + /// + public static RotationalSpeedUnit[] Units { get; } = Enum.GetValues(typeof(RotationalSpeedUnit)).Cast().Except(new RotationalSpeedUnit[]{ RotationalSpeedUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecond. + /// + public static RotationalSpeed Zero => new RotationalSpeed(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalSpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalSpeed.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalSpeed.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalSpeed in CentiradiansPerSecond. + /// + public double CentiradiansPerSecond => As(RotationalSpeedUnit.CentiradianPerSecond); + + /// + /// Get RotationalSpeed in DeciradiansPerSecond. + /// + public double DeciradiansPerSecond => As(RotationalSpeedUnit.DeciradianPerSecond); + + /// + /// Get RotationalSpeed in DegreesPerMinute. + /// + public double DegreesPerMinute => As(RotationalSpeedUnit.DegreePerMinute); + + /// + /// Get RotationalSpeed in DegreesPerSecond. + /// + public double DegreesPerSecond => As(RotationalSpeedUnit.DegreePerSecond); + + /// + /// Get RotationalSpeed in MicrodegreesPerSecond. + /// + public double MicrodegreesPerSecond => As(RotationalSpeedUnit.MicrodegreePerSecond); + + /// + /// Get RotationalSpeed in MicroradiansPerSecond. + /// + public double MicroradiansPerSecond => As(RotationalSpeedUnit.MicroradianPerSecond); + + /// + /// Get RotationalSpeed in MillidegreesPerSecond. + /// + public double MillidegreesPerSecond => As(RotationalSpeedUnit.MillidegreePerSecond); + + /// + /// Get RotationalSpeed in MilliradiansPerSecond. + /// + public double MilliradiansPerSecond => As(RotationalSpeedUnit.MilliradianPerSecond); + + /// + /// Get RotationalSpeed in NanodegreesPerSecond. + /// + public double NanodegreesPerSecond => As(RotationalSpeedUnit.NanodegreePerSecond); + + /// + /// Get RotationalSpeed in NanoradiansPerSecond. + /// + public double NanoradiansPerSecond => As(RotationalSpeedUnit.NanoradianPerSecond); + + /// + /// Get RotationalSpeed in RadiansPerSecond. + /// + public double RadiansPerSecond => As(RotationalSpeedUnit.RadianPerSecond); + + /// + /// Get RotationalSpeed in RevolutionsPerMinute. + /// + public double RevolutionsPerMinute => As(RotationalSpeedUnit.RevolutionPerMinute); + + /// + /// Get RotationalSpeed in RevolutionsPerSecond. + /// + public double RevolutionsPerSecond => As(RotationalSpeedUnit.RevolutionPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalSpeedUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalSpeed from CentiradiansPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromCentiradiansPerSecond(double centiradianspersecond) + { + double value = (double) centiradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.CentiradianPerSecond); + } + /// + /// Get RotationalSpeed from DeciradiansPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromDeciradiansPerSecond(double deciradianspersecond) + { + double value = (double) deciradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.DeciradianPerSecond); + } + /// + /// Get RotationalSpeed from DegreesPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromDegreesPerMinute(double degreesperminute) + { + double value = (double) degreesperminute; + return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerMinute); + } + /// + /// Get RotationalSpeed from DegreesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromDegreesPerSecond(double degreespersecond) + { + double value = (double) degreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerSecond); + } + /// + /// Get RotationalSpeed from MicrodegreesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromMicrodegreesPerSecond(double microdegreespersecond) + { + double value = (double) microdegreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MicrodegreePerSecond); + } + /// + /// Get RotationalSpeed from MicroradiansPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromMicroradiansPerSecond(double microradianspersecond) + { + double value = (double) microradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MicroradianPerSecond); + } + /// + /// Get RotationalSpeed from MillidegreesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromMillidegreesPerSecond(double millidegreespersecond) + { + double value = (double) millidegreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MillidegreePerSecond); + } + /// + /// Get RotationalSpeed from MilliradiansPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromMilliradiansPerSecond(double milliradianspersecond) + { + double value = (double) milliradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MilliradianPerSecond); + } + /// + /// Get RotationalSpeed from NanodegreesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromNanodegreesPerSecond(double nanodegreespersecond) + { + double value = (double) nanodegreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.NanodegreePerSecond); + } + /// + /// Get RotationalSpeed from NanoradiansPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromNanoradiansPerSecond(double nanoradianspersecond) + { + double value = (double) nanoradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.NanoradianPerSecond); + } + /// + /// Get RotationalSpeed from RadiansPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromRadiansPerSecond(double radianspersecond) + { + double value = (double) radianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.RadianPerSecond); + } + /// + /// Get RotationalSpeed from RevolutionsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromRevolutionsPerMinute(double revolutionsperminute) + { + double value = (double) revolutionsperminute; + return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerMinute); + } + /// + /// Get RotationalSpeed from RevolutionsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalSpeed FromRevolutionsPerSecond(double revolutionspersecond) + { + double value = (double) revolutionspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalSpeed unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static RotationalSpeed From(double value, RotationalSpeedUnit fromUnit) + { + return new RotationalSpeed((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalSpeed Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalSpeed Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalSpeed result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalSpeedUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalSpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalSpeedUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalSpeedUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); + + return CompareTo((RotationalSpeed)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(RotationalSpeed other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalSpeed within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalSpeed. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalSpeedUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalSpeed to another RotationalSpeed with the unit representation . + /// + /// A RotationalSpeed with the specified unit. + public RotationalSpeed ToUnit(RotationalSpeedUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalSpeed(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalSpeedUnit.CentiradianPerSecond: return (_value) * 1e-2d; + case RotationalSpeedUnit.DeciradianPerSecond: return (_value) * 1e-1d; + case RotationalSpeedUnit.DegreePerMinute: return (Math.PI/(180*60))*_value; + case RotationalSpeedUnit.DegreePerSecond: return (Math.PI/180)*_value; + case RotationalSpeedUnit.MicrodegreePerSecond: return ((Math.PI/180)*_value) * 1e-6d; + case RotationalSpeedUnit.MicroradianPerSecond: return (_value) * 1e-6d; + case RotationalSpeedUnit.MillidegreePerSecond: return ((Math.PI/180)*_value) * 1e-3d; + case RotationalSpeedUnit.MilliradianPerSecond: return (_value) * 1e-3d; + case RotationalSpeedUnit.NanodegreePerSecond: return ((Math.PI/180)*_value) * 1e-9d; + case RotationalSpeedUnit.NanoradianPerSecond: return (_value) * 1e-9d; + case RotationalSpeedUnit.RadianPerSecond: return _value; + case RotationalSpeedUnit.RevolutionPerMinute: return (_value*6.2831853072)/60; + case RotationalSpeedUnit.RevolutionPerSecond: return _value*6.2831853072; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalSpeedUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalSpeedUnit.CentiradianPerSecond: return (baseUnitValue) / 1e-2d; + case RotationalSpeedUnit.DeciradianPerSecond: return (baseUnitValue) / 1e-1d; + case RotationalSpeedUnit.DegreePerMinute: return (180*60/Math.PI)*baseUnitValue; + case RotationalSpeedUnit.DegreePerSecond: return (180/Math.PI)*baseUnitValue; + case RotationalSpeedUnit.MicrodegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-6d; + case RotationalSpeedUnit.MicroradianPerSecond: return (baseUnitValue) / 1e-6d; + case RotationalSpeedUnit.MillidegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-3d; + case RotationalSpeedUnit.MilliradianPerSecond: return (baseUnitValue) / 1e-3d; + case RotationalSpeedUnit.NanodegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-9d; + case RotationalSpeedUnit.NanoradianPerSecond: return (baseUnitValue) / 1e-9d; + case RotationalSpeedUnit.RadianPerSecond: return baseUnitValue; + case RotationalSpeedUnit.RevolutionPerMinute: return (baseUnitValue/6.2831853072)*60; + case RotationalSpeedUnit.RevolutionPerSecond: return baseUnitValue/6.2831853072; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..b335fe2018 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class RotationalStiffness : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalStiffnessUnit? _unit; + + static RotationalStiffness() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit NewtonMeterPerRadian. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public RotationalStiffness() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private RotationalStiffness(double numericValue, RotationalStiffnessUnit unit) + { + if(unit == RotationalStiffnessUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalStiffness, which is NewtonMeterPerRadian. All conversions go via this value. + /// + public static RotationalStiffnessUnit BaseUnit => RotationalStiffnessUnit.NewtonMeterPerRadian; + + /// + /// Represents the largest possible value of RotationalStiffness + /// + public static RotationalStiffness MaxValue => new RotationalStiffness(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalStiffness + /// + public static RotationalStiffness MinValue => new RotationalStiffness(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalStiffness; + + /// + /// All units of measurement for the RotationalStiffness quantity. + /// + public static RotationalStiffnessUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessUnit)).Cast().Except(new RotationalStiffnessUnit[]{ RotationalStiffnessUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadian. + /// + public static RotationalStiffness Zero => new RotationalStiffness(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalStiffnessUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalStiffness.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalStiffness.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalStiffness in KilonewtonMetersPerRadian. + /// + public double KilonewtonMetersPerRadian => As(RotationalStiffnessUnit.KilonewtonMeterPerRadian); + + /// + /// Get RotationalStiffness in MeganewtonMetersPerRadian. + /// + public double MeganewtonMetersPerRadian => As(RotationalStiffnessUnit.MeganewtonMeterPerRadian); + + /// + /// Get RotationalStiffness in NewtonMetersPerRadian. + /// + public double NewtonMetersPerRadian => As(RotationalStiffnessUnit.NewtonMeterPerRadian); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalStiffnessUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalStiffness from KilonewtonMetersPerRadian. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalStiffness FromKilonewtonMetersPerRadian(double kilonewtonmetersperradian) + { + double value = (double) kilonewtonmetersperradian; + return new RotationalStiffness(value, RotationalStiffnessUnit.KilonewtonMeterPerRadian); + } + /// + /// Get RotationalStiffness from MeganewtonMetersPerRadian. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalStiffness FromMeganewtonMetersPerRadian(double meganewtonmetersperradian) + { + double value = (double) meganewtonmetersperradian; + return new RotationalStiffness(value, RotationalStiffnessUnit.MeganewtonMeterPerRadian); + } + /// + /// Get RotationalStiffness from NewtonMetersPerRadian. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalStiffness FromNewtonMetersPerRadian(double newtonmetersperradian) + { + double value = (double) newtonmetersperradian; + return new RotationalStiffness(value, RotationalStiffnessUnit.NewtonMeterPerRadian); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalStiffness unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static RotationalStiffness From(double value, RotationalStiffnessUnit fromUnit) + { + return new RotationalStiffness((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalStiffness Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalStiffness Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalStiffness result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffness result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalStiffnessUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalStiffnessUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalStiffnessUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); + + return CompareTo((RotationalStiffness)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(RotationalStiffness other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalStiffness within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalStiffness. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalStiffnessUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalStiffness to another RotationalStiffness with the unit representation . + /// + /// A RotationalStiffness with the specified unit. + public RotationalStiffness ToUnit(RotationalStiffnessUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalStiffness(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (_value) * 1e3d; + case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (_value) * 1e6d; + case RotationalStiffnessUnit.NewtonMeterPerRadian: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalStiffnessUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (baseUnitValue) / 1e3d; + case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (baseUnitValue) / 1e6d; + case RotationalStiffnessUnit.NewtonMeterPerRadian: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..e537623e26 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -0,0 +1,604 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class RotationalStiffnessPerLength : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalStiffnessPerLengthUnit? _unit; + + static RotationalStiffnessPerLength() + { + BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public RotationalStiffnessPerLength() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPerLengthUnit unit) + { + if(unit == RotationalStiffnessPerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalStiffnessPerLength, which is NewtonMeterPerRadianPerMeter. All conversions go via this value. + /// + public static RotationalStiffnessPerLengthUnit BaseUnit => RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter; + + /// + /// Represents the largest possible value of RotationalStiffnessPerLength + /// + public static RotationalStiffnessPerLength MaxValue => new RotationalStiffnessPerLength(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalStiffnessPerLength + /// + public static RotationalStiffnessPerLength MinValue => new RotationalStiffnessPerLength(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalStiffnessPerLength; + + /// + /// All units of measurement for the RotationalStiffnessPerLength quantity. + /// + public static RotationalStiffnessPerLengthUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast().Except(new RotationalStiffnessPerLengthUnit[]{ RotationalStiffnessPerLengthUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. + /// + public static RotationalStiffnessPerLength Zero => new RotationalStiffnessPerLength(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalStiffnessPerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalStiffnessPerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalStiffnessPerLength.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalStiffnessPerLength in KilonewtonMetersPerRadianPerMeter. + /// + public double KilonewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); + + /// + /// Get RotationalStiffnessPerLength in MeganewtonMetersPerRadianPerMeter. + /// + public double MeganewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); + + /// + /// Get RotationalStiffnessPerLength in NewtonMetersPerRadianPerMeter. + /// + public double NewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(double kilonewtonmetersperradianpermeter) + { + double value = (double) kilonewtonmetersperradianpermeter; + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); + } + /// + /// Get RotationalStiffnessPerLength from MeganewtonMetersPerRadianPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(double meganewtonmetersperradianpermeter) + { + double value = (double) meganewtonmetersperradianpermeter; + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); + } + /// + /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(double newtonmetersperradianpermeter) + { + double value = (double) newtonmetersperradianpermeter; + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalStiffnessPerLength unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static RotationalStiffnessPerLength From(double value, RotationalStiffnessPerLengthUnit fromUnit) + { + return new RotationalStiffnessPerLength((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalStiffnessPerLength Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLength result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLength result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalStiffnessPerLengthUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static RotationalStiffnessPerLengthUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalStiffnessPerLengthUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out RotationalStiffnessPerLengthUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); + + return CompareTo((RotationalStiffnessPerLength)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(RotationalStiffnessPerLength other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalStiffnessPerLength within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalStiffnessPerLength. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalStiffnessPerLengthUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalStiffnessPerLength to another RotationalStiffnessPerLength with the unit representation . + /// + /// A RotationalStiffnessPerLength with the specified unit. + public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalStiffnessPerLength(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (_value) * 1e3d; + case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (_value) * 1e6d; + case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalStiffnessPerLengthUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e3d; + case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e6d; + case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..a2734f7231 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -0,0 +1,573 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In geometry, a solid angle is the two-dimensional angle in three-dimensional space that an object subtends at a point. + /// + /// + /// https://en.wikipedia.org/wiki/Solid_angle + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class SolidAngle : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SolidAngleUnit? _unit; + + static SolidAngle() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit Steradian. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public SolidAngle() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private SolidAngle(double numericValue, SolidAngleUnit unit) + { + if(unit == SolidAngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SolidAngle, which is Steradian. All conversions go via this value. + /// + public static SolidAngleUnit BaseUnit => SolidAngleUnit.Steradian; + + /// + /// Represents the largest possible value of SolidAngle + /// + public static SolidAngle MaxValue => new SolidAngle(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SolidAngle + /// + public static SolidAngle MinValue => new SolidAngle(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SolidAngle; + + /// + /// All units of measurement for the SolidAngle quantity. + /// + public static SolidAngleUnit[] Units { get; } = Enum.GetValues(typeof(SolidAngleUnit)).Cast().Except(new SolidAngleUnit[]{ SolidAngleUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Steradian. + /// + public static SolidAngle Zero => new SolidAngle(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SolidAngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SolidAngle.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SolidAngle.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SolidAngle in Steradians. + /// + public double Steradians => As(SolidAngleUnit.Steradian); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SolidAngleUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SolidAngle from Steradians. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SolidAngle FromSteradians(double steradians) + { + double value = (double) steradians; + return new SolidAngle(value, SolidAngleUnit.Steradian); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SolidAngle unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static SolidAngle From(double value, SolidAngleUnit fromUnit) + { + return new SolidAngle((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SolidAngle Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SolidAngle Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SolidAngle result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SolidAngle result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SolidAngleUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SolidAngleUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SolidAngleUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SolidAngleUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); + + return CompareTo((SolidAngle)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(SolidAngle other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SolidAngle within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SolidAngle. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SolidAngleUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SolidAngle to another SolidAngle with the unit representation . + /// + /// A SolidAngle with the specified unit. + public SolidAngle ToUnit(SolidAngleUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SolidAngle(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SolidAngleUnit.Steradian: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SolidAngleUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SolidAngleUnit.Steradian: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..c526b4488b --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,692 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The SpecificEnergy + /// + /// + /// https://en.wikipedia.org/wiki/Specific_energy + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class SpecificEnergy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificEnergyUnit? _unit; + + static SpecificEnergy() + { + BaseDimensions = new BaseDimensions(2, 0, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit JoulePerKilogram. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public SpecificEnergy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private SpecificEnergy(double numericValue, SpecificEnergyUnit unit) + { + if(unit == SpecificEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificEnergy, which is JoulePerKilogram. All conversions go via this value. + /// + public static SpecificEnergyUnit BaseUnit => SpecificEnergyUnit.JoulePerKilogram; + + /// + /// Represents the largest possible value of SpecificEnergy + /// + public static SpecificEnergy MaxValue => new SpecificEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificEnergy + /// + public static SpecificEnergy MinValue => new SpecificEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificEnergy; + + /// + /// All units of measurement for the SpecificEnergy quantity. + /// + public static SpecificEnergyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEnergyUnit)).Cast().Except(new SpecificEnergyUnit[]{ SpecificEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogram. + /// + public static SpecificEnergy Zero => new SpecificEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificEnergy in CaloriesPerGram. + /// + public double CaloriesPerGram => As(SpecificEnergyUnit.CaloriePerGram); + + /// + /// Get SpecificEnergy in JoulesPerKilogram. + /// + public double JoulesPerKilogram => As(SpecificEnergyUnit.JoulePerKilogram); + + /// + /// Get SpecificEnergy in KilocaloriesPerGram. + /// + public double KilocaloriesPerGram => As(SpecificEnergyUnit.KilocaloriePerGram); + + /// + /// Get SpecificEnergy in KilojoulesPerKilogram. + /// + public double KilojoulesPerKilogram => As(SpecificEnergyUnit.KilojoulePerKilogram); + + /// + /// Get SpecificEnergy in KilowattHoursPerKilogram. + /// + public double KilowattHoursPerKilogram => As(SpecificEnergyUnit.KilowattHourPerKilogram); + + /// + /// Get SpecificEnergy in MegajoulesPerKilogram. + /// + public double MegajoulesPerKilogram => As(SpecificEnergyUnit.MegajoulePerKilogram); + + /// + /// Get SpecificEnergy in MegawattHoursPerKilogram. + /// + public double MegawattHoursPerKilogram => As(SpecificEnergyUnit.MegawattHourPerKilogram); + + /// + /// Get SpecificEnergy in WattHoursPerKilogram. + /// + public double WattHoursPerKilogram => As(SpecificEnergyUnit.WattHourPerKilogram); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificEnergy from CaloriesPerGram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromCaloriesPerGram(double caloriespergram) + { + double value = (double) caloriespergram; + return new SpecificEnergy(value, SpecificEnergyUnit.CaloriePerGram); + } + /// + /// Get SpecificEnergy from JoulesPerKilogram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromJoulesPerKilogram(double joulesperkilogram) + { + double value = (double) joulesperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.JoulePerKilogram); + } + /// + /// Get SpecificEnergy from KilocaloriesPerGram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromKilocaloriesPerGram(double kilocaloriespergram) + { + double value = (double) kilocaloriespergram; + return new SpecificEnergy(value, SpecificEnergyUnit.KilocaloriePerGram); + } + /// + /// Get SpecificEnergy from KilojoulesPerKilogram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromKilojoulesPerKilogram(double kilojoulesperkilogram) + { + double value = (double) kilojoulesperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.KilojoulePerKilogram); + } + /// + /// Get SpecificEnergy from KilowattHoursPerKilogram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromKilowattHoursPerKilogram(double kilowatthoursperkilogram) + { + double value = (double) kilowatthoursperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.KilowattHourPerKilogram); + } + /// + /// Get SpecificEnergy from MegajoulesPerKilogram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromMegajoulesPerKilogram(double megajoulesperkilogram) + { + double value = (double) megajoulesperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.MegajoulePerKilogram); + } + /// + /// Get SpecificEnergy from MegawattHoursPerKilogram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromMegawattHoursPerKilogram(double megawatthoursperkilogram) + { + double value = (double) megawatthoursperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.MegawattHourPerKilogram); + } + /// + /// Get SpecificEnergy from WattHoursPerKilogram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEnergy FromWattHoursPerKilogram(double watthoursperkilogram) + { + double value = (double) watthoursperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.WattHourPerKilogram); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificEnergy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static SpecificEnergy From(double value, SpecificEnergyUnit fromUnit) + { + return new SpecificEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificEnergy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEnergy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificEnergyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEnergyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); + + return CompareTo((SpecificEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(SpecificEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificEnergy to another SpecificEnergy with the unit representation . + /// + /// A SpecificEnergy with the specified unit. + public SpecificEnergy ToUnit(SpecificEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificEnergyUnit.CaloriePerGram: return _value*4.184e3; + case SpecificEnergyUnit.JoulePerKilogram: return _value; + case SpecificEnergyUnit.KilocaloriePerGram: return (_value*4.184e3) * 1e3d; + case SpecificEnergyUnit.KilojoulePerKilogram: return (_value) * 1e3d; + case SpecificEnergyUnit.KilowattHourPerKilogram: return (_value*3.6e3) * 1e3d; + case SpecificEnergyUnit.MegajoulePerKilogram: return (_value) * 1e6d; + case SpecificEnergyUnit.MegawattHourPerKilogram: return (_value*3.6e3) * 1e6d; + case SpecificEnergyUnit.WattHourPerKilogram: return _value*3.6e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificEnergyUnit.CaloriePerGram: return baseUnitValue/4.184e3; + case SpecificEnergyUnit.JoulePerKilogram: return baseUnitValue; + case SpecificEnergyUnit.KilocaloriePerGram: return (baseUnitValue/4.184e3) / 1e3d; + case SpecificEnergyUnit.KilojoulePerKilogram: return (baseUnitValue) / 1e3d; + case SpecificEnergyUnit.KilowattHourPerKilogram: return (baseUnitValue/3.6e3) / 1e3d; + case SpecificEnergyUnit.MegajoulePerKilogram: return (baseUnitValue) / 1e6d; + case SpecificEnergyUnit.MegawattHourPerKilogram: return (baseUnitValue/3.6e3) / 1e6d; + case SpecificEnergyUnit.WattHourPerKilogram: return baseUnitValue/3.6e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..ebc52aea2a --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -0,0 +1,689 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class SpecificEntropy : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificEntropyUnit? _unit; + + static SpecificEntropy() + { + BaseDimensions = new BaseDimensions(2, 0, -2, 0, -1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit JoulePerKilogramKelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public SpecificEntropy() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private SpecificEntropy(double numericValue, SpecificEntropyUnit unit) + { + if(unit == SpecificEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificEntropy, which is JoulePerKilogramKelvin. All conversions go via this value. + /// + public static SpecificEntropyUnit BaseUnit => SpecificEntropyUnit.JoulePerKilogramKelvin; + + /// + /// Represents the largest possible value of SpecificEntropy + /// + public static SpecificEntropy MaxValue => new SpecificEntropy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificEntropy + /// + public static SpecificEntropy MinValue => new SpecificEntropy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificEntropy; + + /// + /// All units of measurement for the SpecificEntropy quantity. + /// + public static SpecificEntropyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEntropyUnit)).Cast().Except(new SpecificEntropyUnit[]{ SpecificEntropyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogramKelvin. + /// + public static SpecificEntropy Zero => new SpecificEntropy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificEntropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificEntropy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificEntropy in CaloriesPerGramKelvin. + /// + public double CaloriesPerGramKelvin => As(SpecificEntropyUnit.CaloriePerGramKelvin); + + /// + /// Get SpecificEntropy in JoulesPerKilogramDegreeCelsius. + /// + public double JoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); + + /// + /// Get SpecificEntropy in JoulesPerKilogramKelvin. + /// + public double JoulesPerKilogramKelvin => As(SpecificEntropyUnit.JoulePerKilogramKelvin); + + /// + /// Get SpecificEntropy in KilocaloriesPerGramKelvin. + /// + public double KilocaloriesPerGramKelvin => As(SpecificEntropyUnit.KilocaloriePerGramKelvin); + + /// + /// Get SpecificEntropy in KilojoulesPerKilogramDegreeCelsius. + /// + public double KilojoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); + + /// + /// Get SpecificEntropy in KilojoulesPerKilogramKelvin. + /// + public double KilojoulesPerKilogramKelvin => As(SpecificEntropyUnit.KilojoulePerKilogramKelvin); + + /// + /// Get SpecificEntropy in MegajoulesPerKilogramDegreeCelsius. + /// + public double MegajoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); + + /// + /// Get SpecificEntropy in MegajoulesPerKilogramKelvin. + /// + public double MegajoulesPerKilogramKelvin => As(SpecificEntropyUnit.MegajoulePerKilogramKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificEntropyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificEntropy from CaloriesPerGramKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromCaloriesPerGramKelvin(double caloriespergramkelvin) + { + double value = (double) caloriespergramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.CaloriePerGramKelvin); + } + /// + /// Get SpecificEntropy from JoulesPerKilogramDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(double joulesperkilogramdegreecelsius) + { + double value = (double) joulesperkilogramdegreecelsius; + return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); + } + /// + /// Get SpecificEntropy from JoulesPerKilogramKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromJoulesPerKilogramKelvin(double joulesperkilogramkelvin) + { + double value = (double) joulesperkilogramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramKelvin); + } + /// + /// Get SpecificEntropy from KilocaloriesPerGramKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromKilocaloriesPerGramKelvin(double kilocaloriespergramkelvin) + { + double value = (double) kilocaloriespergramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.KilocaloriePerGramKelvin); + } + /// + /// Get SpecificEntropy from KilojoulesPerKilogramDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(double kilojoulesperkilogramdegreecelsius) + { + double value = (double) kilojoulesperkilogramdegreecelsius; + return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); + } + /// + /// Get SpecificEntropy from KilojoulesPerKilogramKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromKilojoulesPerKilogramKelvin(double kilojoulesperkilogramkelvin) + { + double value = (double) kilojoulesperkilogramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramKelvin); + } + /// + /// Get SpecificEntropy from MegajoulesPerKilogramDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(double megajoulesperkilogramdegreecelsius) + { + double value = (double) megajoulesperkilogramdegreecelsius; + return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); + } + /// + /// Get SpecificEntropy from MegajoulesPerKilogramKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificEntropy FromMegajoulesPerKilogramKelvin(double megajoulesperkilogramkelvin) + { + double value = (double) megajoulesperkilogramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificEntropy unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static SpecificEntropy From(double value, SpecificEntropyUnit fromUnit) + { + return new SpecificEntropy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificEntropy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificEntropy Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificEntropy result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificEntropyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificEntropyUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificEntropyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificEntropyUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); + + return CompareTo((SpecificEntropy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(SpecificEntropy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificEntropy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificEntropy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificEntropyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificEntropy to another SpecificEntropy with the unit representation . + /// + /// A SpecificEntropy with the specified unit. + public SpecificEntropy ToUnit(SpecificEntropyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificEntropy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificEntropyUnit.CaloriePerGramKelvin: return _value*4.184e3; + case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return _value; + case SpecificEntropyUnit.JoulePerKilogramKelvin: return _value; + case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (_value*4.184e3) * 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (_value) * 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (_value) * 1e3d; + case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (_value) * 1e6d; + case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificEntropyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificEntropyUnit.CaloriePerGramKelvin: return baseUnitValue/4.184e3; + case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return baseUnitValue; + case SpecificEntropyUnit.JoulePerKilogramKelvin: return baseUnitValue; + case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (baseUnitValue/4.184e3) / 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (baseUnitValue) / 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (baseUnitValue) / 1e3d; + case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (baseUnitValue) / 1e6d; + case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..dab2338cc9 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -0,0 +1,587 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class SpecificVolume : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificVolumeUnit? _unit; + + static SpecificVolume() + { + BaseDimensions = new BaseDimensions(3, -1, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit CubicMeterPerKilogram. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public SpecificVolume() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private SpecificVolume(double numericValue, SpecificVolumeUnit unit) + { + if(unit == SpecificVolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificVolume, which is CubicMeterPerKilogram. All conversions go via this value. + /// + public static SpecificVolumeUnit BaseUnit => SpecificVolumeUnit.CubicMeterPerKilogram; + + /// + /// Represents the largest possible value of SpecificVolume + /// + public static SpecificVolume MaxValue => new SpecificVolume(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificVolume + /// + public static SpecificVolume MinValue => new SpecificVolume(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificVolume; + + /// + /// All units of measurement for the SpecificVolume quantity. + /// + public static SpecificVolumeUnit[] Units { get; } = Enum.GetValues(typeof(SpecificVolumeUnit)).Cast().Except(new SpecificVolumeUnit[]{ SpecificVolumeUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerKilogram. + /// + public static SpecificVolume Zero => new SpecificVolume(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificVolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificVolume.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificVolume.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificVolume in CubicFeetPerPound. + /// + public double CubicFeetPerPound => As(SpecificVolumeUnit.CubicFootPerPound); + + /// + /// Get SpecificVolume in CubicMetersPerKilogram. + /// + public double CubicMetersPerKilogram => As(SpecificVolumeUnit.CubicMeterPerKilogram); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificVolumeUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificVolume from CubicFeetPerPound. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificVolume FromCubicFeetPerPound(double cubicfeetperpound) + { + double value = (double) cubicfeetperpound; + return new SpecificVolume(value, SpecificVolumeUnit.CubicFootPerPound); + } + /// + /// Get SpecificVolume from CubicMetersPerKilogram. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificVolume FromCubicMetersPerKilogram(double cubicmetersperkilogram) + { + double value = (double) cubicmetersperkilogram; + return new SpecificVolume(value, SpecificVolumeUnit.CubicMeterPerKilogram); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificVolume unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static SpecificVolume From(double value, SpecificVolumeUnit fromUnit) + { + return new SpecificVolume((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificVolume Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificVolume Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificVolume result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificVolume result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificVolumeUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificVolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificVolumeUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificVolumeUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); + + return CompareTo((SpecificVolume)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(SpecificVolume other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificVolume within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificVolume. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificVolumeUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificVolume to another SpecificVolume with the unit representation . + /// + /// A SpecificVolume with the specified unit. + public SpecificVolume ToUnit(SpecificVolumeUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificVolume(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificVolumeUnit.CubicFootPerPound: return _value/16.01846353; + case SpecificVolumeUnit.CubicMeterPerKilogram: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificVolumeUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificVolumeUnit.CubicFootPerPound: return baseUnitValue*16.01846353; + case SpecificVolumeUnit.CubicMeterPerKilogram: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..e4fa1ed151 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -0,0 +1,845 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The SpecificWeight, or more precisely, the volumetric weight density, of a substance is its weight per unit volume. + /// + /// + /// http://en.wikipedia.org/wiki/Specificweight + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class SpecificWeight : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificWeightUnit? _unit; + + static SpecificWeight() + { + BaseDimensions = new BaseDimensions(-2, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit NewtonPerCubicMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public SpecificWeight() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private SpecificWeight(double numericValue, SpecificWeightUnit unit) + { + if(unit == SpecificWeightUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificWeight, which is NewtonPerCubicMeter. All conversions go via this value. + /// + public static SpecificWeightUnit BaseUnit => SpecificWeightUnit.NewtonPerCubicMeter; + + /// + /// Represents the largest possible value of SpecificWeight + /// + public static SpecificWeight MaxValue => new SpecificWeight(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificWeight + /// + public static SpecificWeight MinValue => new SpecificWeight(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificWeight; + + /// + /// All units of measurement for the SpecificWeight quantity. + /// + public static SpecificWeightUnit[] Units { get; } = Enum.GetValues(typeof(SpecificWeightUnit)).Cast().Except(new SpecificWeightUnit[]{ SpecificWeightUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerCubicMeter. + /// + public static SpecificWeight Zero => new SpecificWeight(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificWeightUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificWeight.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificWeight.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificWeight in KilogramsForcePerCubicCentimeter. + /// + public double KilogramsForcePerCubicCentimeter => As(SpecificWeightUnit.KilogramForcePerCubicCentimeter); + + /// + /// Get SpecificWeight in KilogramsForcePerCubicMeter. + /// + public double KilogramsForcePerCubicMeter => As(SpecificWeightUnit.KilogramForcePerCubicMeter); + + /// + /// Get SpecificWeight in KilogramsForcePerCubicMillimeter. + /// + public double KilogramsForcePerCubicMillimeter => As(SpecificWeightUnit.KilogramForcePerCubicMillimeter); + + /// + /// Get SpecificWeight in KilonewtonsPerCubicCentimeter. + /// + public double KilonewtonsPerCubicCentimeter => As(SpecificWeightUnit.KilonewtonPerCubicCentimeter); + + /// + /// Get SpecificWeight in KilonewtonsPerCubicMeter. + /// + public double KilonewtonsPerCubicMeter => As(SpecificWeightUnit.KilonewtonPerCubicMeter); + + /// + /// Get SpecificWeight in KilonewtonsPerCubicMillimeter. + /// + public double KilonewtonsPerCubicMillimeter => As(SpecificWeightUnit.KilonewtonPerCubicMillimeter); + + /// + /// Get SpecificWeight in KilopoundsForcePerCubicFoot. + /// + public double KilopoundsForcePerCubicFoot => As(SpecificWeightUnit.KilopoundForcePerCubicFoot); + + /// + /// Get SpecificWeight in KilopoundsForcePerCubicInch. + /// + public double KilopoundsForcePerCubicInch => As(SpecificWeightUnit.KilopoundForcePerCubicInch); + + /// + /// Get SpecificWeight in MeganewtonsPerCubicMeter. + /// + public double MeganewtonsPerCubicMeter => As(SpecificWeightUnit.MeganewtonPerCubicMeter); + + /// + /// Get SpecificWeight in NewtonsPerCubicCentimeter. + /// + public double NewtonsPerCubicCentimeter => As(SpecificWeightUnit.NewtonPerCubicCentimeter); + + /// + /// Get SpecificWeight in NewtonsPerCubicMeter. + /// + public double NewtonsPerCubicMeter => As(SpecificWeightUnit.NewtonPerCubicMeter); + + /// + /// Get SpecificWeight in NewtonsPerCubicMillimeter. + /// + public double NewtonsPerCubicMillimeter => As(SpecificWeightUnit.NewtonPerCubicMillimeter); + + /// + /// Get SpecificWeight in PoundsForcePerCubicFoot. + /// + public double PoundsForcePerCubicFoot => As(SpecificWeightUnit.PoundForcePerCubicFoot); + + /// + /// Get SpecificWeight in PoundsForcePerCubicInch. + /// + public double PoundsForcePerCubicInch => As(SpecificWeightUnit.PoundForcePerCubicInch); + + /// + /// Get SpecificWeight in TonnesForcePerCubicCentimeter. + /// + public double TonnesForcePerCubicCentimeter => As(SpecificWeightUnit.TonneForcePerCubicCentimeter); + + /// + /// Get SpecificWeight in TonnesForcePerCubicMeter. + /// + public double TonnesForcePerCubicMeter => As(SpecificWeightUnit.TonneForcePerCubicMeter); + + /// + /// Get SpecificWeight in TonnesForcePerCubicMillimeter. + /// + public double TonnesForcePerCubicMillimeter => As(SpecificWeightUnit.TonneForcePerCubicMillimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificWeightUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificWeight from KilogramsForcePerCubicCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilogramsForcePerCubicCentimeter(double kilogramsforcepercubiccentimeter) + { + double value = (double) kilogramsforcepercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicCentimeter); + } + /// + /// Get SpecificWeight from KilogramsForcePerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilogramsForcePerCubicMeter(double kilogramsforcepercubicmeter) + { + double value = (double) kilogramsforcepercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMeter); + } + /// + /// Get SpecificWeight from KilogramsForcePerCubicMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilogramsForcePerCubicMillimeter(double kilogramsforcepercubicmillimeter) + { + double value = (double) kilogramsforcepercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMillimeter); + } + /// + /// Get SpecificWeight from KilonewtonsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilonewtonsPerCubicCentimeter(double kilonewtonspercubiccentimeter) + { + double value = (double) kilonewtonspercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicCentimeter); + } + /// + /// Get SpecificWeight from KilonewtonsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilonewtonsPerCubicMeter(double kilonewtonspercubicmeter) + { + double value = (double) kilonewtonspercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMeter); + } + /// + /// Get SpecificWeight from KilonewtonsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilonewtonsPerCubicMillimeter(double kilonewtonspercubicmillimeter) + { + double value = (double) kilonewtonspercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMillimeter); + } + /// + /// Get SpecificWeight from KilopoundsForcePerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilopoundsForcePerCubicFoot(double kilopoundsforcepercubicfoot) + { + double value = (double) kilopoundsforcepercubicfoot; + return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicFoot); + } + /// + /// Get SpecificWeight from KilopoundsForcePerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromKilopoundsForcePerCubicInch(double kilopoundsforcepercubicinch) + { + double value = (double) kilopoundsforcepercubicinch; + return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicInch); + } + /// + /// Get SpecificWeight from MeganewtonsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromMeganewtonsPerCubicMeter(double meganewtonspercubicmeter) + { + double value = (double) meganewtonspercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.MeganewtonPerCubicMeter); + } + /// + /// Get SpecificWeight from NewtonsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromNewtonsPerCubicCentimeter(double newtonspercubiccentimeter) + { + double value = (double) newtonspercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicCentimeter); + } + /// + /// Get SpecificWeight from NewtonsPerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromNewtonsPerCubicMeter(double newtonspercubicmeter) + { + double value = (double) newtonspercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMeter); + } + /// + /// Get SpecificWeight from NewtonsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromNewtonsPerCubicMillimeter(double newtonspercubicmillimeter) + { + double value = (double) newtonspercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMillimeter); + } + /// + /// Get SpecificWeight from PoundsForcePerCubicFoot. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromPoundsForcePerCubicFoot(double poundsforcepercubicfoot) + { + double value = (double) poundsforcepercubicfoot; + return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicFoot); + } + /// + /// Get SpecificWeight from PoundsForcePerCubicInch. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromPoundsForcePerCubicInch(double poundsforcepercubicinch) + { + double value = (double) poundsforcepercubicinch; + return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicInch); + } + /// + /// Get SpecificWeight from TonnesForcePerCubicCentimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromTonnesForcePerCubicCentimeter(double tonnesforcepercubiccentimeter) + { + double value = (double) tonnesforcepercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicCentimeter); + } + /// + /// Get SpecificWeight from TonnesForcePerCubicMeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromTonnesForcePerCubicMeter(double tonnesforcepercubicmeter) + { + double value = (double) tonnesforcepercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMeter); + } + /// + /// Get SpecificWeight from TonnesForcePerCubicMillimeter. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static SpecificWeight FromTonnesForcePerCubicMillimeter(double tonnesforcepercubicmillimeter) + { + double value = (double) tonnesforcepercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMillimeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificWeight unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static SpecificWeight From(double value, SpecificWeightUnit fromUnit) + { + return new SpecificWeight((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificWeight Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificWeight Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificWeight result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out SpecificWeight result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificWeightUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpecificWeightUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificWeightUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpecificWeightUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); + + return CompareTo((SpecificWeight)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(SpecificWeight other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificWeight within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificWeight. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificWeightUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificWeight to another SpecificWeight with the unit representation . + /// + /// A SpecificWeight with the specified unit. + public SpecificWeight ToUnit(SpecificWeightUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificWeight(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return _value*9.80665e6; + case SpecificWeightUnit.KilogramForcePerCubicMeter: return _value*9.80665; + case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return _value*9.80665e9; + case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (_value*1000000) * 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMeter: return (_value) * 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (_value*1000000000) * 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (_value*1.570874638462462e2) * 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicInch: return (_value*2.714471375263134e5) * 1e3d; + case SpecificWeightUnit.MeganewtonPerCubicMeter: return (_value) * 1e6d; + case SpecificWeightUnit.NewtonPerCubicCentimeter: return _value*1000000; + case SpecificWeightUnit.NewtonPerCubicMeter: return _value; + case SpecificWeightUnit.NewtonPerCubicMillimeter: return _value*1000000000; + case SpecificWeightUnit.PoundForcePerCubicFoot: return _value*1.570874638462462e2; + case SpecificWeightUnit.PoundForcePerCubicInch: return _value*2.714471375263134e5; + case SpecificWeightUnit.TonneForcePerCubicCentimeter: return _value*9.80665e9; + case SpecificWeightUnit.TonneForcePerCubicMeter: return _value*9.80665e3; + case SpecificWeightUnit.TonneForcePerCubicMillimeter: return _value*9.80665e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificWeightUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return baseUnitValue/9.80665e6; + case SpecificWeightUnit.KilogramForcePerCubicMeter: return baseUnitValue/9.80665; + case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return baseUnitValue/9.80665e9; + case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (baseUnitValue*0.000001) / 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMeter: return (baseUnitValue) / 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (baseUnitValue*0.000000001) / 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (baseUnitValue/1.570874638462462e2) / 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicInch: return (baseUnitValue/2.714471375263134e5) / 1e3d; + case SpecificWeightUnit.MeganewtonPerCubicMeter: return (baseUnitValue) / 1e6d; + case SpecificWeightUnit.NewtonPerCubicCentimeter: return baseUnitValue*0.000001; + case SpecificWeightUnit.NewtonPerCubicMeter: return baseUnitValue; + case SpecificWeightUnit.NewtonPerCubicMillimeter: return baseUnitValue*0.000000001; + case SpecificWeightUnit.PoundForcePerCubicFoot: return baseUnitValue/1.570874638462462e2; + case SpecificWeightUnit.PoundForcePerCubicInch: return baseUnitValue/2.714471375263134e5; + case SpecificWeightUnit.TonneForcePerCubicCentimeter: return baseUnitValue/9.80665e9; + case SpecificWeightUnit.TonneForcePerCubicMeter: return baseUnitValue/9.80665e3; + case SpecificWeightUnit.TonneForcePerCubicMillimeter: return baseUnitValue/9.80665e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..2580e57b88 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -0,0 +1,1097 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Speed : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpeedUnit? _unit; + + static Speed() + { + BaseDimensions = new BaseDimensions(1, 0, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit MeterPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Speed() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Speed(double numericValue, SpeedUnit unit) + { + if(unit == SpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Speed, which is MeterPerSecond. All conversions go via this value. + /// + public static SpeedUnit BaseUnit => SpeedUnit.MeterPerSecond; + + /// + /// Represents the largest possible value of Speed + /// + public static Speed MaxValue => new Speed(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Speed + /// + public static Speed MinValue => new Speed(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Speed; + + /// + /// All units of measurement for the Speed quantity. + /// + public static SpeedUnit[] Units { get; } = Enum.GetValues(typeof(SpeedUnit)).Cast().Except(new SpeedUnit[]{ SpeedUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecond. + /// + public static Speed Zero => new Speed(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Speed.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Speed.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Speed in CentimetersPerHour. + /// + public double CentimetersPerHour => As(SpeedUnit.CentimeterPerHour); + + /// + /// Get Speed in CentimetersPerMinutes. + /// + public double CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); + + /// + /// Get Speed in CentimetersPerSecond. + /// + public double CentimetersPerSecond => As(SpeedUnit.CentimeterPerSecond); + + /// + /// Get Speed in DecimetersPerMinutes. + /// + public double DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); + + /// + /// Get Speed in DecimetersPerSecond. + /// + public double DecimetersPerSecond => As(SpeedUnit.DecimeterPerSecond); + + /// + /// Get Speed in FeetPerHour. + /// + public double FeetPerHour => As(SpeedUnit.FootPerHour); + + /// + /// Get Speed in FeetPerMinute. + /// + public double FeetPerMinute => As(SpeedUnit.FootPerMinute); + + /// + /// Get Speed in FeetPerSecond. + /// + public double FeetPerSecond => As(SpeedUnit.FootPerSecond); + + /// + /// Get Speed in InchesPerHour. + /// + public double InchesPerHour => As(SpeedUnit.InchPerHour); + + /// + /// Get Speed in InchesPerMinute. + /// + public double InchesPerMinute => As(SpeedUnit.InchPerMinute); + + /// + /// Get Speed in InchesPerSecond. + /// + public double InchesPerSecond => As(SpeedUnit.InchPerSecond); + + /// + /// Get Speed in KilometersPerHour. + /// + public double KilometersPerHour => As(SpeedUnit.KilometerPerHour); + + /// + /// Get Speed in KilometersPerMinutes. + /// + public double KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); + + /// + /// Get Speed in KilometersPerSecond. + /// + public double KilometersPerSecond => As(SpeedUnit.KilometerPerSecond); + + /// + /// Get Speed in Knots. + /// + public double Knots => As(SpeedUnit.Knot); + + /// + /// Get Speed in MetersPerHour. + /// + public double MetersPerHour => As(SpeedUnit.MeterPerHour); + + /// + /// Get Speed in MetersPerMinutes. + /// + public double MetersPerMinutes => As(SpeedUnit.MeterPerMinute); + + /// + /// Get Speed in MetersPerSecond. + /// + public double MetersPerSecond => As(SpeedUnit.MeterPerSecond); + + /// + /// Get Speed in MicrometersPerMinutes. + /// + public double MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); + + /// + /// Get Speed in MicrometersPerSecond. + /// + public double MicrometersPerSecond => As(SpeedUnit.MicrometerPerSecond); + + /// + /// Get Speed in MilesPerHour. + /// + public double MilesPerHour => As(SpeedUnit.MilePerHour); + + /// + /// Get Speed in MillimetersPerHour. + /// + public double MillimetersPerHour => As(SpeedUnit.MillimeterPerHour); + + /// + /// Get Speed in MillimetersPerMinutes. + /// + public double MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); + + /// + /// Get Speed in MillimetersPerSecond. + /// + public double MillimetersPerSecond => As(SpeedUnit.MillimeterPerSecond); + + /// + /// Get Speed in NanometersPerMinutes. + /// + public double NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); + + /// + /// Get Speed in NanometersPerSecond. + /// + public double NanometersPerSecond => As(SpeedUnit.NanometerPerSecond); + + /// + /// Get Speed in UsSurveyFeetPerHour. + /// + public double UsSurveyFeetPerHour => As(SpeedUnit.UsSurveyFootPerHour); + + /// + /// Get Speed in UsSurveyFeetPerMinute. + /// + public double UsSurveyFeetPerMinute => As(SpeedUnit.UsSurveyFootPerMinute); + + /// + /// Get Speed in UsSurveyFeetPerSecond. + /// + public double UsSurveyFeetPerSecond => As(SpeedUnit.UsSurveyFootPerSecond); + + /// + /// Get Speed in YardsPerHour. + /// + public double YardsPerHour => As(SpeedUnit.YardPerHour); + + /// + /// Get Speed in YardsPerMinute. + /// + public double YardsPerMinute => As(SpeedUnit.YardPerMinute); + + /// + /// Get Speed in YardsPerSecond. + /// + public double YardsPerSecond => As(SpeedUnit.YardPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpeedUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Speed from CentimetersPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromCentimetersPerHour(double centimetersperhour) + { + double value = (double) centimetersperhour; + return new Speed(value, SpeedUnit.CentimeterPerHour); + } + /// + /// Get Speed from CentimetersPerMinutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromCentimetersPerMinutes(double centimetersperminutes) + { + double value = (double) centimetersperminutes; + return new Speed(value, SpeedUnit.CentimeterPerMinute); + } + /// + /// Get Speed from CentimetersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromCentimetersPerSecond(double centimeterspersecond) + { + double value = (double) centimeterspersecond; + return new Speed(value, SpeedUnit.CentimeterPerSecond); + } + /// + /// Get Speed from DecimetersPerMinutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromDecimetersPerMinutes(double decimetersperminutes) + { + double value = (double) decimetersperminutes; + return new Speed(value, SpeedUnit.DecimeterPerMinute); + } + /// + /// Get Speed from DecimetersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromDecimetersPerSecond(double decimeterspersecond) + { + double value = (double) decimeterspersecond; + return new Speed(value, SpeedUnit.DecimeterPerSecond); + } + /// + /// Get Speed from FeetPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromFeetPerHour(double feetperhour) + { + double value = (double) feetperhour; + return new Speed(value, SpeedUnit.FootPerHour); + } + /// + /// Get Speed from FeetPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromFeetPerMinute(double feetperminute) + { + double value = (double) feetperminute; + return new Speed(value, SpeedUnit.FootPerMinute); + } + /// + /// Get Speed from FeetPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromFeetPerSecond(double feetpersecond) + { + double value = (double) feetpersecond; + return new Speed(value, SpeedUnit.FootPerSecond); + } + /// + /// Get Speed from InchesPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromInchesPerHour(double inchesperhour) + { + double value = (double) inchesperhour; + return new Speed(value, SpeedUnit.InchPerHour); + } + /// + /// Get Speed from InchesPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromInchesPerMinute(double inchesperminute) + { + double value = (double) inchesperminute; + return new Speed(value, SpeedUnit.InchPerMinute); + } + /// + /// Get Speed from InchesPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromInchesPerSecond(double inchespersecond) + { + double value = (double) inchespersecond; + return new Speed(value, SpeedUnit.InchPerSecond); + } + /// + /// Get Speed from KilometersPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromKilometersPerHour(double kilometersperhour) + { + double value = (double) kilometersperhour; + return new Speed(value, SpeedUnit.KilometerPerHour); + } + /// + /// Get Speed from KilometersPerMinutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromKilometersPerMinutes(double kilometersperminutes) + { + double value = (double) kilometersperminutes; + return new Speed(value, SpeedUnit.KilometerPerMinute); + } + /// + /// Get Speed from KilometersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromKilometersPerSecond(double kilometerspersecond) + { + double value = (double) kilometerspersecond; + return new Speed(value, SpeedUnit.KilometerPerSecond); + } + /// + /// Get Speed from Knots. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromKnots(double knots) + { + double value = (double) knots; + return new Speed(value, SpeedUnit.Knot); + } + /// + /// Get Speed from MetersPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMetersPerHour(double metersperhour) + { + double value = (double) metersperhour; + return new Speed(value, SpeedUnit.MeterPerHour); + } + /// + /// Get Speed from MetersPerMinutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMetersPerMinutes(double metersperminutes) + { + double value = (double) metersperminutes; + return new Speed(value, SpeedUnit.MeterPerMinute); + } + /// + /// Get Speed from MetersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMetersPerSecond(double meterspersecond) + { + double value = (double) meterspersecond; + return new Speed(value, SpeedUnit.MeterPerSecond); + } + /// + /// Get Speed from MicrometersPerMinutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMicrometersPerMinutes(double micrometersperminutes) + { + double value = (double) micrometersperminutes; + return new Speed(value, SpeedUnit.MicrometerPerMinute); + } + /// + /// Get Speed from MicrometersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMicrometersPerSecond(double micrometerspersecond) + { + double value = (double) micrometerspersecond; + return new Speed(value, SpeedUnit.MicrometerPerSecond); + } + /// + /// Get Speed from MilesPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMilesPerHour(double milesperhour) + { + double value = (double) milesperhour; + return new Speed(value, SpeedUnit.MilePerHour); + } + /// + /// Get Speed from MillimetersPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMillimetersPerHour(double millimetersperhour) + { + double value = (double) millimetersperhour; + return new Speed(value, SpeedUnit.MillimeterPerHour); + } + /// + /// Get Speed from MillimetersPerMinutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMillimetersPerMinutes(double millimetersperminutes) + { + double value = (double) millimetersperminutes; + return new Speed(value, SpeedUnit.MillimeterPerMinute); + } + /// + /// Get Speed from MillimetersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromMillimetersPerSecond(double millimeterspersecond) + { + double value = (double) millimeterspersecond; + return new Speed(value, SpeedUnit.MillimeterPerSecond); + } + /// + /// Get Speed from NanometersPerMinutes. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromNanometersPerMinutes(double nanometersperminutes) + { + double value = (double) nanometersperminutes; + return new Speed(value, SpeedUnit.NanometerPerMinute); + } + /// + /// Get Speed from NanometersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromNanometersPerSecond(double nanometerspersecond) + { + double value = (double) nanometerspersecond; + return new Speed(value, SpeedUnit.NanometerPerSecond); + } + /// + /// Get Speed from UsSurveyFeetPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromUsSurveyFeetPerHour(double ussurveyfeetperhour) + { + double value = (double) ussurveyfeetperhour; + return new Speed(value, SpeedUnit.UsSurveyFootPerHour); + } + /// + /// Get Speed from UsSurveyFeetPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromUsSurveyFeetPerMinute(double ussurveyfeetperminute) + { + double value = (double) ussurveyfeetperminute; + return new Speed(value, SpeedUnit.UsSurveyFootPerMinute); + } + /// + /// Get Speed from UsSurveyFeetPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromUsSurveyFeetPerSecond(double ussurveyfeetpersecond) + { + double value = (double) ussurveyfeetpersecond; + return new Speed(value, SpeedUnit.UsSurveyFootPerSecond); + } + /// + /// Get Speed from YardsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromYardsPerHour(double yardsperhour) + { + double value = (double) yardsperhour; + return new Speed(value, SpeedUnit.YardPerHour); + } + /// + /// Get Speed from YardsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromYardsPerMinute(double yardsperminute) + { + double value = (double) yardsperminute; + return new Speed(value, SpeedUnit.YardPerMinute); + } + /// + /// Get Speed from YardsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Speed FromYardsPerSecond(double yardspersecond) + { + double value = (double) yardspersecond; + return new Speed(value, SpeedUnit.YardPerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Speed unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Speed From(double value, SpeedUnit fromUnit) + { + return new Speed((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Speed Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Speed Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Speed result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Speed result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpeedUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static SpeedUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpeedUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out SpeedUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Speed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); + + return CompareTo((Speed)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Speed other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Speed within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Speed. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpeedUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Speed to another Speed with the unit representation . + /// + /// A Speed with the specified unit. + public Speed ToUnit(SpeedUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Speed(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpeedUnit.CentimeterPerHour: return (_value/3600) * 1e-2d; + case SpeedUnit.CentimeterPerMinute: return (_value/60) * 1e-2d; + case SpeedUnit.CentimeterPerSecond: return (_value) * 1e-2d; + case SpeedUnit.DecimeterPerMinute: return (_value/60) * 1e-1d; + case SpeedUnit.DecimeterPerSecond: return (_value) * 1e-1d; + case SpeedUnit.FootPerHour: return _value*0.3048/3600; + case SpeedUnit.FootPerMinute: return _value*0.3048/60; + case SpeedUnit.FootPerSecond: return _value*0.3048; + case SpeedUnit.InchPerHour: return (_value/3600)*2.54e-2; + case SpeedUnit.InchPerMinute: return (_value/60)*2.54e-2; + case SpeedUnit.InchPerSecond: return _value*2.54e-2; + case SpeedUnit.KilometerPerHour: return (_value/3600) * 1e3d; + case SpeedUnit.KilometerPerMinute: return (_value/60) * 1e3d; + case SpeedUnit.KilometerPerSecond: return (_value) * 1e3d; + case SpeedUnit.Knot: return _value*0.514444; + case SpeedUnit.MeterPerHour: return _value/3600; + case SpeedUnit.MeterPerMinute: return _value/60; + case SpeedUnit.MeterPerSecond: return _value; + case SpeedUnit.MicrometerPerMinute: return (_value/60) * 1e-6d; + case SpeedUnit.MicrometerPerSecond: return (_value) * 1e-6d; + case SpeedUnit.MilePerHour: return _value*0.44704; + case SpeedUnit.MillimeterPerHour: return (_value/3600) * 1e-3d; + case SpeedUnit.MillimeterPerMinute: return (_value/60) * 1e-3d; + case SpeedUnit.MillimeterPerSecond: return (_value) * 1e-3d; + case SpeedUnit.NanometerPerMinute: return (_value/60) * 1e-9d; + case SpeedUnit.NanometerPerSecond: return (_value) * 1e-9d; + case SpeedUnit.UsSurveyFootPerHour: return (_value*1200/3937)/3600; + case SpeedUnit.UsSurveyFootPerMinute: return (_value*1200/3937)/60; + case SpeedUnit.UsSurveyFootPerSecond: return _value*1200/3937; + case SpeedUnit.YardPerHour: return _value*0.9144/3600; + case SpeedUnit.YardPerMinute: return _value*0.9144/60; + case SpeedUnit.YardPerSecond: return _value*0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpeedUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpeedUnit.CentimeterPerHour: return (baseUnitValue*3600) / 1e-2d; + case SpeedUnit.CentimeterPerMinute: return (baseUnitValue*60) / 1e-2d; + case SpeedUnit.CentimeterPerSecond: return (baseUnitValue) / 1e-2d; + case SpeedUnit.DecimeterPerMinute: return (baseUnitValue*60) / 1e-1d; + case SpeedUnit.DecimeterPerSecond: return (baseUnitValue) / 1e-1d; + case SpeedUnit.FootPerHour: return baseUnitValue/0.3048*3600; + case SpeedUnit.FootPerMinute: return baseUnitValue/0.3048*60; + case SpeedUnit.FootPerSecond: return baseUnitValue/0.3048; + case SpeedUnit.InchPerHour: return (baseUnitValue/2.54e-2)*3600; + case SpeedUnit.InchPerMinute: return (baseUnitValue/2.54e-2)*60; + case SpeedUnit.InchPerSecond: return baseUnitValue/2.54e-2; + case SpeedUnit.KilometerPerHour: return (baseUnitValue*3600) / 1e3d; + case SpeedUnit.KilometerPerMinute: return (baseUnitValue*60) / 1e3d; + case SpeedUnit.KilometerPerSecond: return (baseUnitValue) / 1e3d; + case SpeedUnit.Knot: return baseUnitValue/0.514444; + case SpeedUnit.MeterPerHour: return baseUnitValue*3600; + case SpeedUnit.MeterPerMinute: return baseUnitValue*60; + case SpeedUnit.MeterPerSecond: return baseUnitValue; + case SpeedUnit.MicrometerPerMinute: return (baseUnitValue*60) / 1e-6d; + case SpeedUnit.MicrometerPerSecond: return (baseUnitValue) / 1e-6d; + case SpeedUnit.MilePerHour: return baseUnitValue/0.44704; + case SpeedUnit.MillimeterPerHour: return (baseUnitValue*3600) / 1e-3d; + case SpeedUnit.MillimeterPerMinute: return (baseUnitValue*60) / 1e-3d; + case SpeedUnit.MillimeterPerSecond: return (baseUnitValue) / 1e-3d; + case SpeedUnit.NanometerPerMinute: return (baseUnitValue*60) / 1e-9d; + case SpeedUnit.NanometerPerSecond: return (baseUnitValue) / 1e-9d; + case SpeedUnit.UsSurveyFootPerHour: return (baseUnitValue*3937/1200)*3600; + case SpeedUnit.UsSurveyFootPerMinute: return (baseUnitValue*3937/1200)*60; + case SpeedUnit.UsSurveyFootPerSecond: return baseUnitValue*3937/1200; + case SpeedUnit.YardPerHour: return baseUnitValue/0.9144*3600; + case SpeedUnit.YardPerMinute: return baseUnitValue/0.9144*60; + case SpeedUnit.YardPerSecond: return baseUnitValue/0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..d938c21971 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -0,0 +1,689 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Temperature : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TemperatureUnit? _unit; + + static Temperature() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit Kelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Temperature() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Temperature(double numericValue, TemperatureUnit unit) + { + if(unit == TemperatureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Temperature, which is Kelvin. All conversions go via this value. + /// + public static TemperatureUnit BaseUnit => TemperatureUnit.Kelvin; + + /// + /// Represents the largest possible value of Temperature + /// + public static Temperature MaxValue => new Temperature(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Temperature + /// + public static Temperature MinValue => new Temperature(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Temperature; + + /// + /// All units of measurement for the Temperature quantity. + /// + public static TemperatureUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureUnit)).Cast().Except(new TemperatureUnit[]{ TemperatureUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. + /// + public static Temperature Zero => new Temperature(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TemperatureUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Temperature.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Temperature.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Temperature in DegreesCelsius. + /// + public double DegreesCelsius => As(TemperatureUnit.DegreeCelsius); + + /// + /// Get Temperature in DegreesDelisle. + /// + public double DegreesDelisle => As(TemperatureUnit.DegreeDelisle); + + /// + /// Get Temperature in DegreesFahrenheit. + /// + public double DegreesFahrenheit => As(TemperatureUnit.DegreeFahrenheit); + + /// + /// Get Temperature in DegreesNewton. + /// + public double DegreesNewton => As(TemperatureUnit.DegreeNewton); + + /// + /// Get Temperature in DegreesRankine. + /// + public double DegreesRankine => As(TemperatureUnit.DegreeRankine); + + /// + /// Get Temperature in DegreesReaumur. + /// + public double DegreesReaumur => As(TemperatureUnit.DegreeReaumur); + + /// + /// Get Temperature in DegreesRoemer. + /// + public double DegreesRoemer => As(TemperatureUnit.DegreeRoemer); + + /// + /// Get Temperature in Kelvins. + /// + public double Kelvins => As(TemperatureUnit.Kelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TemperatureUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Temperature from DegreesCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromDegreesCelsius(double degreescelsius) + { + double value = (double) degreescelsius; + return new Temperature(value, TemperatureUnit.DegreeCelsius); + } + /// + /// Get Temperature from DegreesDelisle. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromDegreesDelisle(double degreesdelisle) + { + double value = (double) degreesdelisle; + return new Temperature(value, TemperatureUnit.DegreeDelisle); + } + /// + /// Get Temperature from DegreesFahrenheit. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromDegreesFahrenheit(double degreesfahrenheit) + { + double value = (double) degreesfahrenheit; + return new Temperature(value, TemperatureUnit.DegreeFahrenheit); + } + /// + /// Get Temperature from DegreesNewton. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromDegreesNewton(double degreesnewton) + { + double value = (double) degreesnewton; + return new Temperature(value, TemperatureUnit.DegreeNewton); + } + /// + /// Get Temperature from DegreesRankine. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromDegreesRankine(double degreesrankine) + { + double value = (double) degreesrankine; + return new Temperature(value, TemperatureUnit.DegreeRankine); + } + /// + /// Get Temperature from DegreesReaumur. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromDegreesReaumur(double degreesreaumur) + { + double value = (double) degreesreaumur; + return new Temperature(value, TemperatureUnit.DegreeReaumur); + } + /// + /// Get Temperature from DegreesRoemer. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromDegreesRoemer(double degreesroemer) + { + double value = (double) degreesroemer; + return new Temperature(value, TemperatureUnit.DegreeRoemer); + } + /// + /// Get Temperature from Kelvins. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Temperature FromKelvins(double kelvins) + { + double value = (double) kelvins; + return new Temperature(value, TemperatureUnit.Kelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Temperature unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Temperature From(double value, TemperatureUnit fromUnit) + { + return new Temperature((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Temperature Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Temperature Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Temperature result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Temperature result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static TemperatureUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TemperatureUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Temperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); + + return CompareTo((Temperature)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Temperature other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Temperature within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Temperature. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TemperatureUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Temperature to another Temperature with the unit representation . + /// + /// A Temperature with the specified unit. + public Temperature ToUnit(TemperatureUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Temperature(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TemperatureUnit.DegreeCelsius: return _value + 273.15; + case TemperatureUnit.DegreeDelisle: return _value*-2/3 + 373.15; + case TemperatureUnit.DegreeFahrenheit: return _value*5/9 + 459.67*5/9; + case TemperatureUnit.DegreeNewton: return _value*100/33 + 273.15; + case TemperatureUnit.DegreeRankine: return _value*5/9; + case TemperatureUnit.DegreeReaumur: return _value*5/4 + 273.15; + case TemperatureUnit.DegreeRoemer: return _value*40/21 + 273.15 - 7.5*40d/21; + case TemperatureUnit.Kelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TemperatureUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TemperatureUnit.DegreeCelsius: return baseUnitValue - 273.15; + case TemperatureUnit.DegreeDelisle: return (baseUnitValue - 373.15)*-3/2; + case TemperatureUnit.DegreeFahrenheit: return (baseUnitValue - 459.67*5/9)*9/5; + case TemperatureUnit.DegreeNewton: return (baseUnitValue - 273.15)*33/100; + case TemperatureUnit.DegreeRankine: return baseUnitValue*9/5; + case TemperatureUnit.DegreeReaumur: return (baseUnitValue - 273.15)*4/5; + case TemperatureUnit.DegreeRoemer: return (baseUnitValue - (273.15 - 7.5*40d/21))*21/40; + case TemperatureUnit.Kelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..e27815d279 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -0,0 +1,723 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class TemperatureChangeRate : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TemperatureChangeRateUnit? _unit; + + static TemperatureChangeRate() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 0, 1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public TemperatureChangeRate() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private TemperatureChangeRate(double numericValue, TemperatureChangeRateUnit unit) + { + if(unit == TemperatureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of TemperatureChangeRate, which is DegreeCelsiusPerSecond. All conversions go via this value. + /// + public static TemperatureChangeRateUnit BaseUnit => TemperatureChangeRateUnit.DegreeCelsiusPerSecond; + + /// + /// Represents the largest possible value of TemperatureChangeRate + /// + public static TemperatureChangeRate MaxValue => new TemperatureChangeRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of TemperatureChangeRate + /// + public static TemperatureChangeRate MinValue => new TemperatureChangeRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.TemperatureChangeRate; + + /// + /// All units of measurement for the TemperatureChangeRate quantity. + /// + public static TemperatureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureChangeRateUnit)).Cast().Except(new TemperatureChangeRateUnit[]{ TemperatureChangeRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. + /// + public static TemperatureChangeRate Zero => new TemperatureChangeRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TemperatureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => TemperatureChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => TemperatureChangeRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get TemperatureChangeRate in CentidegreesCelsiusPerSecond. + /// + public double CentidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in DecadegreesCelsiusPerSecond. + /// + public double DecadegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in DecidegreesCelsiusPerSecond. + /// + public double DecidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in DegreesCelsiusPerMinute. + /// + public double DegreesCelsiusPerMinute => As(TemperatureChangeRateUnit.DegreeCelsiusPerMinute); + + /// + /// Get TemperatureChangeRate in DegreesCelsiusPerSecond. + /// + public double DegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in HectodegreesCelsiusPerSecond. + /// + public double HectodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in KilodegreesCelsiusPerSecond. + /// + public double KilodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in MicrodegreesCelsiusPerSecond. + /// + public double MicrodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in MillidegreesCelsiusPerSecond. + /// + public double MillidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in NanodegreesCelsiusPerSecond. + /// + public double NanodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TemperatureChangeRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get TemperatureChangeRate from CentidegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(double centidegreescelsiuspersecond) + { + double value = (double) centidegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from DecadegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(double decadegreescelsiuspersecond) + { + double value = (double) decadegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from DecidegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(double decidegreescelsiuspersecond) + { + double value = (double) decidegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from DegreesCelsiusPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromDegreesCelsiusPerMinute(double degreescelsiusperminute) + { + double value = (double) degreescelsiusperminute; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerMinute); + } + /// + /// Get TemperatureChangeRate from DegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromDegreesCelsiusPerSecond(double degreescelsiuspersecond) + { + double value = (double) degreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from HectodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(double hectodegreescelsiuspersecond) + { + double value = (double) hectodegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from KilodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(double kilodegreescelsiuspersecond) + { + double value = (double) kilodegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from MicrodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(double microdegreescelsiuspersecond) + { + double value = (double) microdegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from MillidegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(double millidegreescelsiuspersecond) + { + double value = (double) millidegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from NanodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(double nanodegreescelsiuspersecond) + { + double value = (double) nanodegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// TemperatureChangeRate unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static TemperatureChangeRate From(double value, TemperatureChangeRateUnit fromUnit) + { + return new TemperatureChangeRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static TemperatureChangeRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static TemperatureChangeRate Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureChangeRate result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureChangeRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static TemperatureChangeRateUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TemperatureChangeRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureChangeRateUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is TemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); + + return CompareTo((TemperatureChangeRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(TemperatureChangeRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another TemperatureChangeRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current TemperatureChangeRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TemperatureChangeRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this TemperatureChangeRate to another TemperatureChangeRate with the unit representation . + /// + /// A TemperatureChangeRate with the specified unit. + public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new TemperatureChangeRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (_value) * 1e-2d; + case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (_value) * 1e1d; + case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (_value) * 1e-1d; + case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return _value/60; + case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return _value; + case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (_value) * 1e2d; + case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (_value) * 1e3d; + case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (_value) * 1e-6d; + case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (_value) * 1e-3d; + case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (_value) * 1e-9d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TemperatureChangeRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-2d; + case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (baseUnitValue) / 1e1d; + case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-1d; + case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return baseUnitValue*60; + case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return baseUnitValue; + case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (baseUnitValue) / 1e2d; + case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (baseUnitValue) / 1e3d; + case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (baseUnitValue) / 1e-6d; + case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-3d; + case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (baseUnitValue) / 1e-9d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..85bef47194 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -0,0 +1,689 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Difference between two temperatures. The conversions are different than for Temperature. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class TemperatureDelta : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TemperatureDeltaUnit? _unit; + + static TemperatureDelta() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit Kelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public TemperatureDelta() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private TemperatureDelta(double numericValue, TemperatureDeltaUnit unit) + { + if(unit == TemperatureDeltaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of TemperatureDelta, which is Kelvin. All conversions go via this value. + /// + public static TemperatureDeltaUnit BaseUnit => TemperatureDeltaUnit.Kelvin; + + /// + /// Represents the largest possible value of TemperatureDelta + /// + public static TemperatureDelta MaxValue => new TemperatureDelta(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of TemperatureDelta + /// + public static TemperatureDelta MinValue => new TemperatureDelta(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.TemperatureDelta; + + /// + /// All units of measurement for the TemperatureDelta quantity. + /// + public static TemperatureDeltaUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureDeltaUnit)).Cast().Except(new TemperatureDeltaUnit[]{ TemperatureDeltaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. + /// + public static TemperatureDelta Zero => new TemperatureDelta(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TemperatureDeltaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => TemperatureDelta.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => TemperatureDelta.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get TemperatureDelta in DegreesCelsius. + /// + public double DegreesCelsius => As(TemperatureDeltaUnit.DegreeCelsius); + + /// + /// Get TemperatureDelta in DegreesDelisle. + /// + public double DegreesDelisle => As(TemperatureDeltaUnit.DegreeDelisle); + + /// + /// Get TemperatureDelta in DegreesFahrenheit. + /// + public double DegreesFahrenheit => As(TemperatureDeltaUnit.DegreeFahrenheit); + + /// + /// Get TemperatureDelta in DegreesNewton. + /// + public double DegreesNewton => As(TemperatureDeltaUnit.DegreeNewton); + + /// + /// Get TemperatureDelta in DegreesRankine. + /// + public double DegreesRankine => As(TemperatureDeltaUnit.DegreeRankine); + + /// + /// Get TemperatureDelta in DegreesReaumur. + /// + public double DegreesReaumur => As(TemperatureDeltaUnit.DegreeReaumur); + + /// + /// Get TemperatureDelta in DegreesRoemer. + /// + public double DegreesRoemer => As(TemperatureDeltaUnit.DegreeRoemer); + + /// + /// Get TemperatureDelta in Kelvins. + /// + public double Kelvins => As(TemperatureDeltaUnit.Kelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TemperatureDeltaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get TemperatureDelta from DegreesCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromDegreesCelsius(double degreescelsius) + { + double value = (double) degreescelsius; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsius); + } + /// + /// Get TemperatureDelta from DegreesDelisle. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromDegreesDelisle(double degreesdelisle) + { + double value = (double) degreesdelisle; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisle); + } + /// + /// Get TemperatureDelta from DegreesFahrenheit. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromDegreesFahrenheit(double degreesfahrenheit) + { + double value = (double) degreesfahrenheit; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheit); + } + /// + /// Get TemperatureDelta from DegreesNewton. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromDegreesNewton(double degreesnewton) + { + double value = (double) degreesnewton; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewton); + } + /// + /// Get TemperatureDelta from DegreesRankine. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromDegreesRankine(double degreesrankine) + { + double value = (double) degreesrankine; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankine); + } + /// + /// Get TemperatureDelta from DegreesReaumur. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromDegreesReaumur(double degreesreaumur) + { + double value = (double) degreesreaumur; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumur); + } + /// + /// Get TemperatureDelta from DegreesRoemer. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromDegreesRoemer(double degreesroemer) + { + double value = (double) degreesroemer; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemer); + } + /// + /// Get TemperatureDelta from Kelvins. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static TemperatureDelta FromKelvins(double kelvins) + { + double value = (double) kelvins; + return new TemperatureDelta(value, TemperatureDeltaUnit.Kelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// TemperatureDelta unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static TemperatureDelta From(double value, TemperatureDeltaUnit fromUnit) + { + return new TemperatureDelta((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static TemperatureDelta Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static TemperatureDelta Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out TemperatureDelta result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureDeltaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static TemperatureDeltaUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TemperatureDeltaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TemperatureDeltaUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is TemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); + + return CompareTo((TemperatureDelta)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(TemperatureDelta other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another TemperatureDelta within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current TemperatureDelta. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TemperatureDeltaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this TemperatureDelta to another TemperatureDelta with the unit representation . + /// + /// A TemperatureDelta with the specified unit. + public TemperatureDelta ToUnit(TemperatureDeltaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new TemperatureDelta(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TemperatureDeltaUnit.DegreeCelsius: return _value; + case TemperatureDeltaUnit.DegreeDelisle: return _value*-2/3; + case TemperatureDeltaUnit.DegreeFahrenheit: return _value*5/9; + case TemperatureDeltaUnit.DegreeNewton: return _value*100/33; + case TemperatureDeltaUnit.DegreeRankine: return _value*5/9; + case TemperatureDeltaUnit.DegreeReaumur: return _value*5/4; + case TemperatureDeltaUnit.DegreeRoemer: return _value*40/21; + case TemperatureDeltaUnit.Kelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TemperatureDeltaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TemperatureDeltaUnit.DegreeCelsius: return baseUnitValue; + case TemperatureDeltaUnit.DegreeDelisle: return baseUnitValue*-3/2; + case TemperatureDeltaUnit.DegreeFahrenheit: return baseUnitValue*9/5; + case TemperatureDeltaUnit.DegreeNewton: return baseUnitValue*33/100; + case TemperatureDeltaUnit.DegreeRankine: return baseUnitValue*9/5; + case TemperatureDeltaUnit.DegreeReaumur: return baseUnitValue*4/5; + case TemperatureDeltaUnit.DegreeRoemer: return baseUnitValue*21/40; + case TemperatureDeltaUnit.Kelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..1cfdd85421 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -0,0 +1,590 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Thermal conductivity is the property of a material to conduct heat. + /// + /// + /// https://en.wikipedia.org/wiki/Thermal_Conductivity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ThermalConductivity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ThermalConductivityUnit? _unit; + + static ThermalConductivity() + { + BaseDimensions = new BaseDimensions(1, 1, -3, 0, -1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit WattPerMeterKelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ThermalConductivity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ThermalConductivity(double numericValue, ThermalConductivityUnit unit) + { + if(unit == ThermalConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ThermalConductivity, which is WattPerMeterKelvin. All conversions go via this value. + /// + public static ThermalConductivityUnit BaseUnit => ThermalConductivityUnit.WattPerMeterKelvin; + + /// + /// Represents the largest possible value of ThermalConductivity + /// + public static ThermalConductivity MaxValue => new ThermalConductivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ThermalConductivity + /// + public static ThermalConductivity MinValue => new ThermalConductivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ThermalConductivity; + + /// + /// All units of measurement for the ThermalConductivity quantity. + /// + public static ThermalConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast().Except(new ThermalConductivityUnit[]{ ThermalConductivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerMeterKelvin. + /// + public static ThermalConductivity Zero => new ThermalConductivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ThermalConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ThermalConductivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ThermalConductivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ThermalConductivity in BtusPerHourFootFahrenheit. + /// + public double BtusPerHourFootFahrenheit => As(ThermalConductivityUnit.BtuPerHourFootFahrenheit); + + /// + /// Get ThermalConductivity in WattsPerMeterKelvin. + /// + public double WattsPerMeterKelvin => As(ThermalConductivityUnit.WattPerMeterKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ThermalConductivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ThermalConductivity from BtusPerHourFootFahrenheit. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ThermalConductivity FromBtusPerHourFootFahrenheit(double btusperhourfootfahrenheit) + { + double value = (double) btusperhourfootfahrenheit; + return new ThermalConductivity(value, ThermalConductivityUnit.BtuPerHourFootFahrenheit); + } + /// + /// Get ThermalConductivity from WattsPerMeterKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ThermalConductivity FromWattsPerMeterKelvin(double wattspermeterkelvin) + { + double value = (double) wattspermeterkelvin; + return new ThermalConductivity(value, ThermalConductivityUnit.WattPerMeterKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ThermalConductivity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ThermalConductivity From(double value, ThermalConductivityUnit fromUnit) + { + return new ThermalConductivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ThermalConductivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ThermalConductivity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ThermalConductivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalConductivity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ThermalConductivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ThermalConductivityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ThermalConductivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalConductivityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); + + return CompareTo((ThermalConductivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ThermalConductivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ThermalConductivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ThermalConductivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ThermalConductivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ThermalConductivity to another ThermalConductivity with the unit representation . + /// + /// A ThermalConductivity with the specified unit. + public ThermalConductivity ToUnit(ThermalConductivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ThermalConductivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return _value*1.73073467; + case ThermalConductivityUnit.WattPerMeterKelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ThermalConductivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return baseUnitValue/1.73073467; + case ThermalConductivityUnit.WattPerMeterKelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..c4e9a2caf2 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -0,0 +1,638 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class ThermalResistance : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ThermalResistanceUnit? _unit; + + static ThermalResistance() + { + BaseDimensions = new BaseDimensions(0, -1, 3, 0, 1, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public ThermalResistance() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private ThermalResistance(double numericValue, ThermalResistanceUnit unit) + { + if(unit == ThermalResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ThermalResistance, which is SquareMeterKelvinPerKilowatt. All conversions go via this value. + /// + public static ThermalResistanceUnit BaseUnit => ThermalResistanceUnit.SquareMeterKelvinPerKilowatt; + + /// + /// Represents the largest possible value of ThermalResistance + /// + public static ThermalResistance MaxValue => new ThermalResistance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ThermalResistance + /// + public static ThermalResistance MinValue => new ThermalResistance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ThermalResistance; + + /// + /// All units of measurement for the ThermalResistance quantity. + /// + public static ThermalResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ThermalResistanceUnit)).Cast().Except(new ThermalResistanceUnit[]{ ThermalResistanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. + /// + public static ThermalResistance Zero => new ThermalResistance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ThermalResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ThermalResistance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ThermalResistance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ThermalResistance in HourSquareFeetDegreesFahrenheitPerBtu. + /// + public double HourSquareFeetDegreesFahrenheitPerBtu => As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); + + /// + /// Get ThermalResistance in SquareCentimeterHourDegreesCelsiusPerKilocalorie. + /// + public double SquareCentimeterHourDegreesCelsiusPerKilocalorie => As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); + + /// + /// Get ThermalResistance in SquareCentimeterKelvinsPerWatt. + /// + public double SquareCentimeterKelvinsPerWatt => As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); + + /// + /// Get ThermalResistance in SquareMeterDegreesCelsiusPerWatt. + /// + public double SquareMeterDegreesCelsiusPerWatt => As(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); + + /// + /// Get ThermalResistance in SquareMeterKelvinsPerKilowatt. + /// + public double SquareMeterKelvinsPerKilowatt => As(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ThermalResistanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ThermalResistance from HourSquareFeetDegreesFahrenheitPerBtu. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(double hoursquarefeetdegreesfahrenheitperbtu) + { + double value = (double) hoursquarefeetdegreesfahrenheitperbtu; + return new ThermalResistance(value, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); + } + /// + /// Get ThermalResistance from SquareCentimeterHourDegreesCelsiusPerKilocalorie. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(double squarecentimeterhourdegreescelsiusperkilocalorie) + { + double value = (double) squarecentimeterhourdegreescelsiusperkilocalorie; + return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); + } + /// + /// Get ThermalResistance from SquareCentimeterKelvinsPerWatt. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(double squarecentimeterkelvinsperwatt) + { + double value = (double) squarecentimeterkelvinsperwatt; + return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); + } + /// + /// Get ThermalResistance from SquareMeterDegreesCelsiusPerWatt. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(double squaremeterdegreescelsiusperwatt) + { + double value = (double) squaremeterdegreescelsiusperwatt; + return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); + } + /// + /// Get ThermalResistance from SquareMeterKelvinsPerKilowatt. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(double squaremeterkelvinsperkilowatt) + { + double value = (double) squaremeterkelvinsperkilowatt; + return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ThermalResistance unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static ThermalResistance From(double value, ThermalResistanceUnit fromUnit) + { + return new ThermalResistance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ThermalResistance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ThermalResistance Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ThermalResistance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out ThermalResistance result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ThermalResistanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static ThermalResistanceUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ThermalResistanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out ThermalResistanceUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); + + return CompareTo((ThermalResistance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(ThermalResistance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ThermalResistance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ThermalResistance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ThermalResistanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ThermalResistance to another ThermalResistance with the unit representation . + /// + /// A ThermalResistance with the specified unit. + public ThermalResistance ToUnit(ThermalResistanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ThermalResistance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return _value*176.1121482159839; + case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return _value*0.0859779507590433; + case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return _value*0.0999964777570357; + case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return _value*1000.088056074108; + case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ThermalResistanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return baseUnitValue/176.1121482159839; + case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return baseUnitValue/0.0859779507590433; + case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return baseUnitValue/0.0999964777570357; + case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return baseUnitValue/1000.088056074108; + case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..5f5be9e35a --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -0,0 +1,910 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Torque : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TorqueUnit? _unit; + + static Torque() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit NewtonMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Torque() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Torque(double numericValue, TorqueUnit unit) + { + if(unit == TorqueUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Torque, which is NewtonMeter. All conversions go via this value. + /// + public static TorqueUnit BaseUnit => TorqueUnit.NewtonMeter; + + /// + /// Represents the largest possible value of Torque + /// + public static Torque MaxValue => new Torque(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Torque + /// + public static Torque MinValue => new Torque(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Torque; + + /// + /// All units of measurement for the Torque quantity. + /// + public static TorqueUnit[] Units { get; } = Enum.GetValues(typeof(TorqueUnit)).Cast().Except(new TorqueUnit[]{ TorqueUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeter. + /// + public static Torque Zero => new Torque(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TorqueUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Torque.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Torque.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Torque in KilogramForceCentimeters. + /// + public double KilogramForceCentimeters => As(TorqueUnit.KilogramForceCentimeter); + + /// + /// Get Torque in KilogramForceMeters. + /// + public double KilogramForceMeters => As(TorqueUnit.KilogramForceMeter); + + /// + /// Get Torque in KilogramForceMillimeters. + /// + public double KilogramForceMillimeters => As(TorqueUnit.KilogramForceMillimeter); + + /// + /// Get Torque in KilonewtonCentimeters. + /// + public double KilonewtonCentimeters => As(TorqueUnit.KilonewtonCentimeter); + + /// + /// Get Torque in KilonewtonMeters. + /// + public double KilonewtonMeters => As(TorqueUnit.KilonewtonMeter); + + /// + /// Get Torque in KilonewtonMillimeters. + /// + public double KilonewtonMillimeters => As(TorqueUnit.KilonewtonMillimeter); + + /// + /// Get Torque in KilopoundForceFeet. + /// + public double KilopoundForceFeet => As(TorqueUnit.KilopoundForceFoot); + + /// + /// Get Torque in KilopoundForceInches. + /// + public double KilopoundForceInches => As(TorqueUnit.KilopoundForceInch); + + /// + /// Get Torque in MeganewtonCentimeters. + /// + public double MeganewtonCentimeters => As(TorqueUnit.MeganewtonCentimeter); + + /// + /// Get Torque in MeganewtonMeters. + /// + public double MeganewtonMeters => As(TorqueUnit.MeganewtonMeter); + + /// + /// Get Torque in MeganewtonMillimeters. + /// + public double MeganewtonMillimeters => As(TorqueUnit.MeganewtonMillimeter); + + /// + /// Get Torque in MegapoundForceFeet. + /// + public double MegapoundForceFeet => As(TorqueUnit.MegapoundForceFoot); + + /// + /// Get Torque in MegapoundForceInches. + /// + public double MegapoundForceInches => As(TorqueUnit.MegapoundForceInch); + + /// + /// Get Torque in NewtonCentimeters. + /// + public double NewtonCentimeters => As(TorqueUnit.NewtonCentimeter); + + /// + /// Get Torque in NewtonMeters. + /// + public double NewtonMeters => As(TorqueUnit.NewtonMeter); + + /// + /// Get Torque in NewtonMillimeters. + /// + public double NewtonMillimeters => As(TorqueUnit.NewtonMillimeter); + + /// + /// Get Torque in PoundForceFeet. + /// + public double PoundForceFeet => As(TorqueUnit.PoundForceFoot); + + /// + /// Get Torque in PoundForceInches. + /// + public double PoundForceInches => As(TorqueUnit.PoundForceInch); + + /// + /// Get Torque in TonneForceCentimeters. + /// + public double TonneForceCentimeters => As(TorqueUnit.TonneForceCentimeter); + + /// + /// Get Torque in TonneForceMeters. + /// + public double TonneForceMeters => As(TorqueUnit.TonneForceMeter); + + /// + /// Get Torque in TonneForceMillimeters. + /// + public double TonneForceMillimeters => As(TorqueUnit.TonneForceMillimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TorqueUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Torque from KilogramForceCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilogramForceCentimeters(double kilogramforcecentimeters) + { + double value = (double) kilogramforcecentimeters; + return new Torque(value, TorqueUnit.KilogramForceCentimeter); + } + /// + /// Get Torque from KilogramForceMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilogramForceMeters(double kilogramforcemeters) + { + double value = (double) kilogramforcemeters; + return new Torque(value, TorqueUnit.KilogramForceMeter); + } + /// + /// Get Torque from KilogramForceMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilogramForceMillimeters(double kilogramforcemillimeters) + { + double value = (double) kilogramforcemillimeters; + return new Torque(value, TorqueUnit.KilogramForceMillimeter); + } + /// + /// Get Torque from KilonewtonCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilonewtonCentimeters(double kilonewtoncentimeters) + { + double value = (double) kilonewtoncentimeters; + return new Torque(value, TorqueUnit.KilonewtonCentimeter); + } + /// + /// Get Torque from KilonewtonMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilonewtonMeters(double kilonewtonmeters) + { + double value = (double) kilonewtonmeters; + return new Torque(value, TorqueUnit.KilonewtonMeter); + } + /// + /// Get Torque from KilonewtonMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilonewtonMillimeters(double kilonewtonmillimeters) + { + double value = (double) kilonewtonmillimeters; + return new Torque(value, TorqueUnit.KilonewtonMillimeter); + } + /// + /// Get Torque from KilopoundForceFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilopoundForceFeet(double kilopoundforcefeet) + { + double value = (double) kilopoundforcefeet; + return new Torque(value, TorqueUnit.KilopoundForceFoot); + } + /// + /// Get Torque from KilopoundForceInches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromKilopoundForceInches(double kilopoundforceinches) + { + double value = (double) kilopoundforceinches; + return new Torque(value, TorqueUnit.KilopoundForceInch); + } + /// + /// Get Torque from MeganewtonCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromMeganewtonCentimeters(double meganewtoncentimeters) + { + double value = (double) meganewtoncentimeters; + return new Torque(value, TorqueUnit.MeganewtonCentimeter); + } + /// + /// Get Torque from MeganewtonMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromMeganewtonMeters(double meganewtonmeters) + { + double value = (double) meganewtonmeters; + return new Torque(value, TorqueUnit.MeganewtonMeter); + } + /// + /// Get Torque from MeganewtonMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromMeganewtonMillimeters(double meganewtonmillimeters) + { + double value = (double) meganewtonmillimeters; + return new Torque(value, TorqueUnit.MeganewtonMillimeter); + } + /// + /// Get Torque from MegapoundForceFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromMegapoundForceFeet(double megapoundforcefeet) + { + double value = (double) megapoundforcefeet; + return new Torque(value, TorqueUnit.MegapoundForceFoot); + } + /// + /// Get Torque from MegapoundForceInches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromMegapoundForceInches(double megapoundforceinches) + { + double value = (double) megapoundforceinches; + return new Torque(value, TorqueUnit.MegapoundForceInch); + } + /// + /// Get Torque from NewtonCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromNewtonCentimeters(double newtoncentimeters) + { + double value = (double) newtoncentimeters; + return new Torque(value, TorqueUnit.NewtonCentimeter); + } + /// + /// Get Torque from NewtonMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromNewtonMeters(double newtonmeters) + { + double value = (double) newtonmeters; + return new Torque(value, TorqueUnit.NewtonMeter); + } + /// + /// Get Torque from NewtonMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromNewtonMillimeters(double newtonmillimeters) + { + double value = (double) newtonmillimeters; + return new Torque(value, TorqueUnit.NewtonMillimeter); + } + /// + /// Get Torque from PoundForceFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromPoundForceFeet(double poundforcefeet) + { + double value = (double) poundforcefeet; + return new Torque(value, TorqueUnit.PoundForceFoot); + } + /// + /// Get Torque from PoundForceInches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromPoundForceInches(double poundforceinches) + { + double value = (double) poundforceinches; + return new Torque(value, TorqueUnit.PoundForceInch); + } + /// + /// Get Torque from TonneForceCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromTonneForceCentimeters(double tonneforcecentimeters) + { + double value = (double) tonneforcecentimeters; + return new Torque(value, TorqueUnit.TonneForceCentimeter); + } + /// + /// Get Torque from TonneForceMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromTonneForceMeters(double tonneforcemeters) + { + double value = (double) tonneforcemeters; + return new Torque(value, TorqueUnit.TonneForceMeter); + } + /// + /// Get Torque from TonneForceMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Torque FromTonneForceMillimeters(double tonneforcemillimeters) + { + double value = (double) tonneforcemillimeters; + return new Torque(value, TorqueUnit.TonneForceMillimeter); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Torque unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Torque From(double value, TorqueUnit fromUnit) + { + return new Torque((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Torque Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Torque Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Torque result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Torque result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TorqueUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static TorqueUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TorqueUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out TorqueUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Torque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); + + return CompareTo((Torque)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Torque other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Torque within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Torque. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TorqueUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Torque to another Torque with the unit representation . + /// + /// A Torque with the specified unit. + public Torque ToUnit(TorqueUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Torque(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TorqueUnit.KilogramForceCentimeter: return _value*0.0980665019960652; + case TorqueUnit.KilogramForceMeter: return _value*9.80665019960652; + case TorqueUnit.KilogramForceMillimeter: return _value*0.00980665019960652; + case TorqueUnit.KilonewtonCentimeter: return (_value*0.01) * 1e3d; + case TorqueUnit.KilonewtonMeter: return (_value) * 1e3d; + case TorqueUnit.KilonewtonMillimeter: return (_value*0.001) * 1e3d; + case TorqueUnit.KilopoundForceFoot: return (_value*1.3558179483314) * 1e3d; + case TorqueUnit.KilopoundForceInch: return (_value*1.129848290276167e-1) * 1e3d; + case TorqueUnit.MeganewtonCentimeter: return (_value*0.01) * 1e6d; + case TorqueUnit.MeganewtonMeter: return (_value) * 1e6d; + case TorqueUnit.MeganewtonMillimeter: return (_value*0.001) * 1e6d; + case TorqueUnit.MegapoundForceFoot: return (_value*1.3558179483314) * 1e6d; + case TorqueUnit.MegapoundForceInch: return (_value*1.129848290276167e-1) * 1e6d; + case TorqueUnit.NewtonCentimeter: return _value*0.01; + case TorqueUnit.NewtonMeter: return _value; + case TorqueUnit.NewtonMillimeter: return _value*0.001; + case TorqueUnit.PoundForceFoot: return _value*1.3558179483314; + case TorqueUnit.PoundForceInch: return _value*1.129848290276167e-1; + case TorqueUnit.TonneForceCentimeter: return _value*98.0665019960652; + case TorqueUnit.TonneForceMeter: return _value*9806.65019960653; + case TorqueUnit.TonneForceMillimeter: return _value*9.80665019960652; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TorqueUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TorqueUnit.KilogramForceCentimeter: return baseUnitValue*10.1971619222242; + case TorqueUnit.KilogramForceMeter: return baseUnitValue*0.101971619222242; + case TorqueUnit.KilogramForceMillimeter: return baseUnitValue*101.971619222242; + case TorqueUnit.KilonewtonCentimeter: return (baseUnitValue*100) / 1e3d; + case TorqueUnit.KilonewtonMeter: return (baseUnitValue) / 1e3d; + case TorqueUnit.KilonewtonMillimeter: return (baseUnitValue*1000) / 1e3d; + case TorqueUnit.KilopoundForceFoot: return (baseUnitValue/1.3558179483314) / 1e3d; + case TorqueUnit.KilopoundForceInch: return (baseUnitValue/1.129848290276167e-1) / 1e3d; + case TorqueUnit.MeganewtonCentimeter: return (baseUnitValue*100) / 1e6d; + case TorqueUnit.MeganewtonMeter: return (baseUnitValue) / 1e6d; + case TorqueUnit.MeganewtonMillimeter: return (baseUnitValue*1000) / 1e6d; + case TorqueUnit.MegapoundForceFoot: return (baseUnitValue/1.3558179483314) / 1e6d; + case TorqueUnit.MegapoundForceInch: return (baseUnitValue/1.129848290276167e-1) / 1e6d; + case TorqueUnit.NewtonCentimeter: return baseUnitValue*100; + case TorqueUnit.NewtonMeter: return baseUnitValue; + case TorqueUnit.NewtonMillimeter: return baseUnitValue*1000; + case TorqueUnit.PoundForceFoot: return baseUnitValue/1.3558179483314; + case TorqueUnit.PoundForceInch: return baseUnitValue/1.129848290276167e-1; + case TorqueUnit.TonneForceCentimeter: return baseUnitValue*0.0101971619222242; + case TorqueUnit.TonneForceMeter: return baseUnitValue*0.000101971619222242; + case TorqueUnit.TonneForceMillimeter: return baseUnitValue*0.101971619222242; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..0d41dea4cf --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -0,0 +1,570 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class VitaminA : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VitaminAUnit? _unit; + + static VitaminA() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + /// + /// Creates the quantity with a value of 0 in the base unit InternationalUnit. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public VitaminA() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private VitaminA(double numericValue, VitaminAUnit unit) + { + if(unit == VitaminAUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of VitaminA, which is InternationalUnit. All conversions go via this value. + /// + public static VitaminAUnit BaseUnit => VitaminAUnit.InternationalUnit; + + /// + /// Represents the largest possible value of VitaminA + /// + public static VitaminA MaxValue => new VitaminA(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of VitaminA + /// + public static VitaminA MinValue => new VitaminA(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.VitaminA; + + /// + /// All units of measurement for the VitaminA quantity. + /// + public static VitaminAUnit[] Units { get; } = Enum.GetValues(typeof(VitaminAUnit)).Cast().Except(new VitaminAUnit[]{ VitaminAUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit InternationalUnit. + /// + public static VitaminA Zero => new VitaminA(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public VitaminAUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => VitaminA.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VitaminA.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get VitaminA in InternationalUnits. + /// + public double InternationalUnits => As(VitaminAUnit.InternationalUnit); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VitaminAUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get VitaminA from InternationalUnits. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VitaminA FromInternationalUnits(double internationalunits) + { + double value = (double) internationalunits; + return new VitaminA(value, VitaminAUnit.InternationalUnit); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// VitaminA unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static VitaminA From(double value, VitaminAUnit fromUnit) + { + return new VitaminA((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static VitaminA Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static VitaminA Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out VitaminA result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VitaminA result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VitaminAUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static VitaminAUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out VitaminAUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VitaminAUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is VitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); + + return CompareTo((VitaminA)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(VitaminA other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another VitaminA within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current VitaminA. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VitaminAUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this VitaminA to another VitaminA with the unit representation . + /// + /// A VitaminA with the specified unit. + public VitaminA ToUnit(VitaminAUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new VitaminA(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case VitaminAUnit.InternationalUnit: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(VitaminAUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case VitaminAUnit.InternationalUnit: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..4696c60bdd --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -0,0 +1,1284 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class Volume : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VolumeUnit? _unit; + + static Volume() + { + BaseDimensions = new BaseDimensions(3, 0, 0, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit CubicMeter. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public Volume() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private Volume(double numericValue, VolumeUnit unit) + { + if(unit == VolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Volume, which is CubicMeter. All conversions go via this value. + /// + public static VolumeUnit BaseUnit => VolumeUnit.CubicMeter; + + /// + /// Represents the largest possible value of Volume + /// + public static Volume MaxValue => new Volume(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Volume + /// + public static Volume MinValue => new Volume(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Volume; + + /// + /// All units of measurement for the Volume quantity. + /// + public static VolumeUnit[] Units { get; } = Enum.GetValues(typeof(VolumeUnit)).Cast().Except(new VolumeUnit[]{ VolumeUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeter. + /// + public static Volume Zero => new Volume(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public VolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Volume.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Volume.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Volume in AuTablespoons. + /// + public double AuTablespoons => As(VolumeUnit.AuTablespoon); + + /// + /// Get Volume in Centiliters. + /// + public double Centiliters => As(VolumeUnit.Centiliter); + + /// + /// Get Volume in CubicCentimeters. + /// + public double CubicCentimeters => As(VolumeUnit.CubicCentimeter); + + /// + /// Get Volume in CubicDecimeters. + /// + public double CubicDecimeters => As(VolumeUnit.CubicDecimeter); + + /// + /// Get Volume in CubicFeet. + /// + public double CubicFeet => As(VolumeUnit.CubicFoot); + + /// + /// Get Volume in CubicInches. + /// + public double CubicInches => As(VolumeUnit.CubicInch); + + /// + /// Get Volume in CubicKilometers. + /// + public double CubicKilometers => As(VolumeUnit.CubicKilometer); + + /// + /// Get Volume in CubicMeters. + /// + public double CubicMeters => As(VolumeUnit.CubicMeter); + + /// + /// Get Volume in CubicMicrometers. + /// + public double CubicMicrometers => As(VolumeUnit.CubicMicrometer); + + /// + /// Get Volume in CubicMiles. + /// + public double CubicMiles => As(VolumeUnit.CubicMile); + + /// + /// Get Volume in CubicMillimeters. + /// + public double CubicMillimeters => As(VolumeUnit.CubicMillimeter); + + /// + /// Get Volume in CubicYards. + /// + public double CubicYards => As(VolumeUnit.CubicYard); + + /// + /// Get Volume in Deciliters. + /// + public double Deciliters => As(VolumeUnit.Deciliter); + + /// + /// Get Volume in HectocubicFeet. + /// + public double HectocubicFeet => As(VolumeUnit.HectocubicFoot); + + /// + /// Get Volume in HectocubicMeters. + /// + public double HectocubicMeters => As(VolumeUnit.HectocubicMeter); + + /// + /// Get Volume in Hectoliters. + /// + public double Hectoliters => As(VolumeUnit.Hectoliter); + + /// + /// Get Volume in ImperialBeerBarrels. + /// + public double ImperialBeerBarrels => As(VolumeUnit.ImperialBeerBarrel); + + /// + /// Get Volume in ImperialGallons. + /// + public double ImperialGallons => As(VolumeUnit.ImperialGallon); + + /// + /// Get Volume in ImperialOunces. + /// + public double ImperialOunces => As(VolumeUnit.ImperialOunce); + + /// + /// Get Volume in KilocubicFeet. + /// + public double KilocubicFeet => As(VolumeUnit.KilocubicFoot); + + /// + /// Get Volume in KilocubicMeters. + /// + public double KilocubicMeters => As(VolumeUnit.KilocubicMeter); + + /// + /// Get Volume in KiloimperialGallons. + /// + public double KiloimperialGallons => As(VolumeUnit.KiloimperialGallon); + + /// + /// Get Volume in Kiloliters. + /// + public double Kiloliters => As(VolumeUnit.Kiloliter); + + /// + /// Get Volume in KilousGallons. + /// + public double KilousGallons => As(VolumeUnit.KilousGallon); + + /// + /// Get Volume in Liters. + /// + public double Liters => As(VolumeUnit.Liter); + + /// + /// Get Volume in MegacubicFeet. + /// + public double MegacubicFeet => As(VolumeUnit.MegacubicFoot); + + /// + /// Get Volume in MegaimperialGallons. + /// + public double MegaimperialGallons => As(VolumeUnit.MegaimperialGallon); + + /// + /// Get Volume in MegausGallons. + /// + public double MegausGallons => As(VolumeUnit.MegausGallon); + + /// + /// Get Volume in MetricCups. + /// + public double MetricCups => As(VolumeUnit.MetricCup); + + /// + /// Get Volume in MetricTeaspoons. + /// + public double MetricTeaspoons => As(VolumeUnit.MetricTeaspoon); + + /// + /// Get Volume in Microliters. + /// + public double Microliters => As(VolumeUnit.Microliter); + + /// + /// Get Volume in Milliliters. + /// + public double Milliliters => As(VolumeUnit.Milliliter); + + /// + /// Get Volume in OilBarrels. + /// + public double OilBarrels => As(VolumeUnit.OilBarrel); + + /// + /// Get Volume in UkTablespoons. + /// + public double UkTablespoons => As(VolumeUnit.UkTablespoon); + + /// + /// Get Volume in UsBeerBarrels. + /// + public double UsBeerBarrels => As(VolumeUnit.UsBeerBarrel); + + /// + /// Get Volume in UsCustomaryCups. + /// + public double UsCustomaryCups => As(VolumeUnit.UsCustomaryCup); + + /// + /// Get Volume in UsGallons. + /// + public double UsGallons => As(VolumeUnit.UsGallon); + + /// + /// Get Volume in UsLegalCups. + /// + public double UsLegalCups => As(VolumeUnit.UsLegalCup); + + /// + /// Get Volume in UsOunces. + /// + public double UsOunces => As(VolumeUnit.UsOunce); + + /// + /// Get Volume in UsPints. + /// + public double UsPints => As(VolumeUnit.UsPint); + + /// + /// Get Volume in UsQuarts. + /// + public double UsQuarts => As(VolumeUnit.UsQuart); + + /// + /// Get Volume in UsTablespoons. + /// + public double UsTablespoons => As(VolumeUnit.UsTablespoon); + + /// + /// Get Volume in UsTeaspoons. + /// + public double UsTeaspoons => As(VolumeUnit.UsTeaspoon); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VolumeUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Volume from AuTablespoons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromAuTablespoons(double autablespoons) + { + double value = (double) autablespoons; + return new Volume(value, VolumeUnit.AuTablespoon); + } + /// + /// Get Volume from Centiliters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCentiliters(double centiliters) + { + double value = (double) centiliters; + return new Volume(value, VolumeUnit.Centiliter); + } + /// + /// Get Volume from CubicCentimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicCentimeters(double cubiccentimeters) + { + double value = (double) cubiccentimeters; + return new Volume(value, VolumeUnit.CubicCentimeter); + } + /// + /// Get Volume from CubicDecimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicDecimeters(double cubicdecimeters) + { + double value = (double) cubicdecimeters; + return new Volume(value, VolumeUnit.CubicDecimeter); + } + /// + /// Get Volume from CubicFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicFeet(double cubicfeet) + { + double value = (double) cubicfeet; + return new Volume(value, VolumeUnit.CubicFoot); + } + /// + /// Get Volume from CubicInches. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicInches(double cubicinches) + { + double value = (double) cubicinches; + return new Volume(value, VolumeUnit.CubicInch); + } + /// + /// Get Volume from CubicKilometers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicKilometers(double cubickilometers) + { + double value = (double) cubickilometers; + return new Volume(value, VolumeUnit.CubicKilometer); + } + /// + /// Get Volume from CubicMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicMeters(double cubicmeters) + { + double value = (double) cubicmeters; + return new Volume(value, VolumeUnit.CubicMeter); + } + /// + /// Get Volume from CubicMicrometers. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicMicrometers(double cubicmicrometers) + { + double value = (double) cubicmicrometers; + return new Volume(value, VolumeUnit.CubicMicrometer); + } + /// + /// Get Volume from CubicMiles. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicMiles(double cubicmiles) + { + double value = (double) cubicmiles; + return new Volume(value, VolumeUnit.CubicMile); + } + /// + /// Get Volume from CubicMillimeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicMillimeters(double cubicmillimeters) + { + double value = (double) cubicmillimeters; + return new Volume(value, VolumeUnit.CubicMillimeter); + } + /// + /// Get Volume from CubicYards. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromCubicYards(double cubicyards) + { + double value = (double) cubicyards; + return new Volume(value, VolumeUnit.CubicYard); + } + /// + /// Get Volume from Deciliters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromDeciliters(double deciliters) + { + double value = (double) deciliters; + return new Volume(value, VolumeUnit.Deciliter); + } + /// + /// Get Volume from HectocubicFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromHectocubicFeet(double hectocubicfeet) + { + double value = (double) hectocubicfeet; + return new Volume(value, VolumeUnit.HectocubicFoot); + } + /// + /// Get Volume from HectocubicMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromHectocubicMeters(double hectocubicmeters) + { + double value = (double) hectocubicmeters; + return new Volume(value, VolumeUnit.HectocubicMeter); + } + /// + /// Get Volume from Hectoliters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromHectoliters(double hectoliters) + { + double value = (double) hectoliters; + return new Volume(value, VolumeUnit.Hectoliter); + } + /// + /// Get Volume from ImperialBeerBarrels. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromImperialBeerBarrels(double imperialbeerbarrels) + { + double value = (double) imperialbeerbarrels; + return new Volume(value, VolumeUnit.ImperialBeerBarrel); + } + /// + /// Get Volume from ImperialGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromImperialGallons(double imperialgallons) + { + double value = (double) imperialgallons; + return new Volume(value, VolumeUnit.ImperialGallon); + } + /// + /// Get Volume from ImperialOunces. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromImperialOunces(double imperialounces) + { + double value = (double) imperialounces; + return new Volume(value, VolumeUnit.ImperialOunce); + } + /// + /// Get Volume from KilocubicFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromKilocubicFeet(double kilocubicfeet) + { + double value = (double) kilocubicfeet; + return new Volume(value, VolumeUnit.KilocubicFoot); + } + /// + /// Get Volume from KilocubicMeters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromKilocubicMeters(double kilocubicmeters) + { + double value = (double) kilocubicmeters; + return new Volume(value, VolumeUnit.KilocubicMeter); + } + /// + /// Get Volume from KiloimperialGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromKiloimperialGallons(double kiloimperialgallons) + { + double value = (double) kiloimperialgallons; + return new Volume(value, VolumeUnit.KiloimperialGallon); + } + /// + /// Get Volume from Kiloliters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromKiloliters(double kiloliters) + { + double value = (double) kiloliters; + return new Volume(value, VolumeUnit.Kiloliter); + } + /// + /// Get Volume from KilousGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromKilousGallons(double kilousgallons) + { + double value = (double) kilousgallons; + return new Volume(value, VolumeUnit.KilousGallon); + } + /// + /// Get Volume from Liters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromLiters(double liters) + { + double value = (double) liters; + return new Volume(value, VolumeUnit.Liter); + } + /// + /// Get Volume from MegacubicFeet. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromMegacubicFeet(double megacubicfeet) + { + double value = (double) megacubicfeet; + return new Volume(value, VolumeUnit.MegacubicFoot); + } + /// + /// Get Volume from MegaimperialGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromMegaimperialGallons(double megaimperialgallons) + { + double value = (double) megaimperialgallons; + return new Volume(value, VolumeUnit.MegaimperialGallon); + } + /// + /// Get Volume from MegausGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromMegausGallons(double megausgallons) + { + double value = (double) megausgallons; + return new Volume(value, VolumeUnit.MegausGallon); + } + /// + /// Get Volume from MetricCups. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromMetricCups(double metriccups) + { + double value = (double) metriccups; + return new Volume(value, VolumeUnit.MetricCup); + } + /// + /// Get Volume from MetricTeaspoons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromMetricTeaspoons(double metricteaspoons) + { + double value = (double) metricteaspoons; + return new Volume(value, VolumeUnit.MetricTeaspoon); + } + /// + /// Get Volume from Microliters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromMicroliters(double microliters) + { + double value = (double) microliters; + return new Volume(value, VolumeUnit.Microliter); + } + /// + /// Get Volume from Milliliters. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromMilliliters(double milliliters) + { + double value = (double) milliliters; + return new Volume(value, VolumeUnit.Milliliter); + } + /// + /// Get Volume from OilBarrels. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromOilBarrels(double oilbarrels) + { + double value = (double) oilbarrels; + return new Volume(value, VolumeUnit.OilBarrel); + } + /// + /// Get Volume from UkTablespoons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUkTablespoons(double uktablespoons) + { + double value = (double) uktablespoons; + return new Volume(value, VolumeUnit.UkTablespoon); + } + /// + /// Get Volume from UsBeerBarrels. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsBeerBarrels(double usbeerbarrels) + { + double value = (double) usbeerbarrels; + return new Volume(value, VolumeUnit.UsBeerBarrel); + } + /// + /// Get Volume from UsCustomaryCups. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsCustomaryCups(double uscustomarycups) + { + double value = (double) uscustomarycups; + return new Volume(value, VolumeUnit.UsCustomaryCup); + } + /// + /// Get Volume from UsGallons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsGallons(double usgallons) + { + double value = (double) usgallons; + return new Volume(value, VolumeUnit.UsGallon); + } + /// + /// Get Volume from UsLegalCups. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsLegalCups(double uslegalcups) + { + double value = (double) uslegalcups; + return new Volume(value, VolumeUnit.UsLegalCup); + } + /// + /// Get Volume from UsOunces. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsOunces(double usounces) + { + double value = (double) usounces; + return new Volume(value, VolumeUnit.UsOunce); + } + /// + /// Get Volume from UsPints. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsPints(double uspints) + { + double value = (double) uspints; + return new Volume(value, VolumeUnit.UsPint); + } + /// + /// Get Volume from UsQuarts. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsQuarts(double usquarts) + { + double value = (double) usquarts; + return new Volume(value, VolumeUnit.UsQuart); + } + /// + /// Get Volume from UsTablespoons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsTablespoons(double ustablespoons) + { + double value = (double) ustablespoons; + return new Volume(value, VolumeUnit.UsTablespoon); + } + /// + /// Get Volume from UsTeaspoons. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static Volume FromUsTeaspoons(double usteaspoons) + { + double value = (double) usteaspoons; + return new Volume(value, VolumeUnit.UsTeaspoon); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Volume unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static Volume From(double value, VolumeUnit fromUnit) + { + return new Volume((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Volume Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static Volume Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Volume result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out Volume result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumeUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static VolumeUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out VolumeUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Volume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); + + return CompareTo((Volume)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(Volume other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Volume within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Volume. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VolumeUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Volume to another Volume with the unit representation . + /// + /// A Volume with the specified unit. + public Volume ToUnit(VolumeUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Volume(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case VolumeUnit.AuTablespoon: return _value*2e-5; + case VolumeUnit.Centiliter: return (_value/1e3) * 1e-2d; + case VolumeUnit.CubicCentimeter: return _value/1e6; + case VolumeUnit.CubicDecimeter: return _value/1e3; + case VolumeUnit.CubicFoot: return _value*0.0283168; + case VolumeUnit.CubicInch: return _value*1.6387*1e-5; + case VolumeUnit.CubicKilometer: return _value*1e9; + case VolumeUnit.CubicMeter: return _value; + case VolumeUnit.CubicMicrometer: return _value/1e18; + case VolumeUnit.CubicMile: return _value*4.16818182544058e9; + case VolumeUnit.CubicMillimeter: return _value/1e9; + case VolumeUnit.CubicYard: return _value*0.764554858; + case VolumeUnit.Deciliter: return (_value/1e3) * 1e-1d; + case VolumeUnit.HectocubicFoot: return (_value*0.0283168) * 1e2d; + case VolumeUnit.HectocubicMeter: return (_value) * 1e2d; + case VolumeUnit.Hectoliter: return (_value/1e3) * 1e2d; + case VolumeUnit.ImperialBeerBarrel: return _value*0.16365924; + case VolumeUnit.ImperialGallon: return _value*0.00454609000000181429905810072407; + case VolumeUnit.ImperialOunce: return _value*2.8413062499962901241875439064617e-5; + case VolumeUnit.KilocubicFoot: return (_value*0.0283168) * 1e3d; + case VolumeUnit.KilocubicMeter: return (_value) * 1e3d; + case VolumeUnit.KiloimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e3d; + case VolumeUnit.Kiloliter: return (_value/1e3) * 1e3d; + case VolumeUnit.KilousGallon: return (_value*0.00378541) * 1e3d; + case VolumeUnit.Liter: return _value/1e3; + case VolumeUnit.MegacubicFoot: return (_value*0.0283168) * 1e6d; + case VolumeUnit.MegaimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e6d; + case VolumeUnit.MegausGallon: return (_value*0.00378541) * 1e6d; + case VolumeUnit.MetricCup: return _value*0.00025; + case VolumeUnit.MetricTeaspoon: return _value*0.5e-5; + case VolumeUnit.Microliter: return (_value/1e3) * 1e-6d; + case VolumeUnit.Milliliter: return (_value/1e3) * 1e-3d; + case VolumeUnit.OilBarrel: return _value*0.158987294928; + case VolumeUnit.UkTablespoon: return _value*1.5e-5; + case VolumeUnit.UsBeerBarrel: return _value*0.1173477658; + case VolumeUnit.UsCustomaryCup: return _value*0.0002365882365; + case VolumeUnit.UsGallon: return _value*0.00378541; + case VolumeUnit.UsLegalCup: return _value*0.00024; + case VolumeUnit.UsOunce: return _value*2.957352956253760505068307980135e-5; + case VolumeUnit.UsPint: return _value*4.73176473e-4; + case VolumeUnit.UsQuart: return _value*9.46352946e-4; + case VolumeUnit.UsTablespoon: return _value*1.478676478125e-5; + case VolumeUnit.UsTeaspoon: return _value*4.92892159375e-6; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(VolumeUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case VolumeUnit.AuTablespoon: return baseUnitValue/2e-5; + case VolumeUnit.Centiliter: return (baseUnitValue*1e3) / 1e-2d; + case VolumeUnit.CubicCentimeter: return baseUnitValue*1e6; + case VolumeUnit.CubicDecimeter: return baseUnitValue*1e3; + case VolumeUnit.CubicFoot: return baseUnitValue/0.0283168; + case VolumeUnit.CubicInch: return baseUnitValue/(1.6387*1e-5); + case VolumeUnit.CubicKilometer: return baseUnitValue/1e9; + case VolumeUnit.CubicMeter: return baseUnitValue; + case VolumeUnit.CubicMicrometer: return baseUnitValue*1e18; + case VolumeUnit.CubicMile: return baseUnitValue/4.16818182544058e9; + case VolumeUnit.CubicMillimeter: return baseUnitValue*1e9; + case VolumeUnit.CubicYard: return baseUnitValue/0.764554858; + case VolumeUnit.Deciliter: return (baseUnitValue*1e3) / 1e-1d; + case VolumeUnit.HectocubicFoot: return (baseUnitValue/0.0283168) / 1e2d; + case VolumeUnit.HectocubicMeter: return (baseUnitValue) / 1e2d; + case VolumeUnit.Hectoliter: return (baseUnitValue*1e3) / 1e2d; + case VolumeUnit.ImperialBeerBarrel: return baseUnitValue/0.16365924; + case VolumeUnit.ImperialGallon: return baseUnitValue/0.00454609000000181429905810072407; + case VolumeUnit.ImperialOunce: return baseUnitValue/2.8413062499962901241875439064617e-5; + case VolumeUnit.KilocubicFoot: return (baseUnitValue/0.0283168) / 1e3d; + case VolumeUnit.KilocubicMeter: return (baseUnitValue) / 1e3d; + case VolumeUnit.KiloimperialGallon: return (baseUnitValue/0.00454609000000181429905810072407) / 1e3d; + case VolumeUnit.Kiloliter: return (baseUnitValue*1e3) / 1e3d; + case VolumeUnit.KilousGallon: return (baseUnitValue/0.00378541) / 1e3d; + case VolumeUnit.Liter: return baseUnitValue*1e3; + case VolumeUnit.MegacubicFoot: return (baseUnitValue/0.0283168) / 1e6d; + case VolumeUnit.MegaimperialGallon: return (baseUnitValue/0.00454609000000181429905810072407) / 1e6d; + case VolumeUnit.MegausGallon: return (baseUnitValue/0.00378541) / 1e6d; + case VolumeUnit.MetricCup: return baseUnitValue/0.00025; + case VolumeUnit.MetricTeaspoon: return baseUnitValue/0.5e-5; + case VolumeUnit.Microliter: return (baseUnitValue*1e3) / 1e-6d; + case VolumeUnit.Milliliter: return (baseUnitValue*1e3) / 1e-3d; + case VolumeUnit.OilBarrel: return baseUnitValue/0.158987294928; + case VolumeUnit.UkTablespoon: return baseUnitValue/1.5e-5; + case VolumeUnit.UsBeerBarrel: return baseUnitValue/0.1173477658; + case VolumeUnit.UsCustomaryCup: return baseUnitValue/0.0002365882365; + case VolumeUnit.UsGallon: return baseUnitValue/0.00378541; + case VolumeUnit.UsLegalCup: return baseUnitValue/0.00024; + case VolumeUnit.UsOunce: return baseUnitValue/2.957352956253760505068307980135e-5; + case VolumeUnit.UsPint: return baseUnitValue/4.73176473e-4; + case VolumeUnit.UsQuart: return baseUnitValue/9.46352946e-4; + case VolumeUnit.UsTablespoon: return baseUnitValue/1.478676478125e-5; + case VolumeUnit.UsTeaspoon: return baseUnitValue/4.92892159375e-6; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs new file mode 100644 index 0000000000..4b90abd00c --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -0,0 +1,995 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class VolumeFlow : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VolumeFlowUnit? _unit; + + static VolumeFlow() + { + BaseDimensions = new BaseDimensions(3, 0, -1, 0, 0, 0, 0); + } + /// + /// Creates the quantity with a value of 0 in the base unit CubicMeterPerSecond. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public VolumeFlow() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private VolumeFlow(double numericValue, VolumeFlowUnit unit) + { + if(unit == VolumeFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of VolumeFlow, which is CubicMeterPerSecond. All conversions go via this value. + /// + public static VolumeFlowUnit BaseUnit => VolumeFlowUnit.CubicMeterPerSecond; + + /// + /// Represents the largest possible value of VolumeFlow + /// + public static VolumeFlow MaxValue => new VolumeFlow(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of VolumeFlow + /// + public static VolumeFlow MinValue => new VolumeFlow(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.VolumeFlow; + + /// + /// All units of measurement for the VolumeFlow quantity. + /// + public static VolumeFlowUnit[] Units { get; } = Enum.GetValues(typeof(VolumeFlowUnit)).Cast().Except(new VolumeFlowUnit[]{ VolumeFlowUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. + /// + public static VolumeFlow Zero => new VolumeFlow(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public VolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => VolumeFlow.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get VolumeFlow in CentilitersPerMinute. + /// + public double CentilitersPerMinute => As(VolumeFlowUnit.CentiliterPerMinute); + + /// + /// Get VolumeFlow in CubicDecimetersPerMinute. + /// + public double CubicDecimetersPerMinute => As(VolumeFlowUnit.CubicDecimeterPerMinute); + + /// + /// Get VolumeFlow in CubicFeetPerHour. + /// + public double CubicFeetPerHour => As(VolumeFlowUnit.CubicFootPerHour); + + /// + /// Get VolumeFlow in CubicFeetPerMinute. + /// + public double CubicFeetPerMinute => As(VolumeFlowUnit.CubicFootPerMinute); + + /// + /// Get VolumeFlow in CubicFeetPerSecond. + /// + public double CubicFeetPerSecond => As(VolumeFlowUnit.CubicFootPerSecond); + + /// + /// Get VolumeFlow in CubicMetersPerHour. + /// + public double CubicMetersPerHour => As(VolumeFlowUnit.CubicMeterPerHour); + + /// + /// Get VolumeFlow in CubicMetersPerMinute. + /// + public double CubicMetersPerMinute => As(VolumeFlowUnit.CubicMeterPerMinute); + + /// + /// Get VolumeFlow in CubicMetersPerSecond. + /// + public double CubicMetersPerSecond => As(VolumeFlowUnit.CubicMeterPerSecond); + + /// + /// Get VolumeFlow in CubicYardsPerHour. + /// + public double CubicYardsPerHour => As(VolumeFlowUnit.CubicYardPerHour); + + /// + /// Get VolumeFlow in CubicYardsPerMinute. + /// + public double CubicYardsPerMinute => As(VolumeFlowUnit.CubicYardPerMinute); + + /// + /// Get VolumeFlow in CubicYardsPerSecond. + /// + public double CubicYardsPerSecond => As(VolumeFlowUnit.CubicYardPerSecond); + + /// + /// Get VolumeFlow in DecilitersPerMinute. + /// + public double DecilitersPerMinute => As(VolumeFlowUnit.DeciliterPerMinute); + + /// + /// Get VolumeFlow in KilolitersPerMinute. + /// + public double KilolitersPerMinute => As(VolumeFlowUnit.KiloliterPerMinute); + + /// + /// Get VolumeFlow in LitersPerHour. + /// + public double LitersPerHour => As(VolumeFlowUnit.LiterPerHour); + + /// + /// Get VolumeFlow in LitersPerMinute. + /// + public double LitersPerMinute => As(VolumeFlowUnit.LiterPerMinute); + + /// + /// Get VolumeFlow in LitersPerSecond. + /// + public double LitersPerSecond => As(VolumeFlowUnit.LiterPerSecond); + + /// + /// Get VolumeFlow in MicrolitersPerMinute. + /// + public double MicrolitersPerMinute => As(VolumeFlowUnit.MicroliterPerMinute); + + /// + /// Get VolumeFlow in MillilitersPerMinute. + /// + public double MillilitersPerMinute => As(VolumeFlowUnit.MilliliterPerMinute); + + /// + /// Get VolumeFlow in MillionUsGallonsPerDay. + /// + public double MillionUsGallonsPerDay => As(VolumeFlowUnit.MillionUsGallonsPerDay); + + /// + /// Get VolumeFlow in NanolitersPerMinute. + /// + public double NanolitersPerMinute => As(VolumeFlowUnit.NanoliterPerMinute); + + /// + /// Get VolumeFlow in OilBarrelsPerDay. + /// + public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelPerDay); + + /// + /// Get VolumeFlow in OilBarrelsPerHour. + /// + public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelPerHour); + + /// + /// Get VolumeFlow in OilBarrelsPerMinute. + /// + public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelPerMinute); + + /// + /// Get VolumeFlow in UsGallonsPerHour. + /// + public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonPerHour); + + /// + /// Get VolumeFlow in UsGallonsPerMinute. + /// + public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonPerMinute); + + /// + /// Get VolumeFlow in UsGallonsPerSecond. + /// + public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VolumeFlowUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get VolumeFlow from CentilitersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCentilitersPerMinute(double centilitersperminute) + { + double value = (double) centilitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerMinute); + } + /// + /// Get VolumeFlow from CubicDecimetersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) + { + double value = (double) cubicdecimetersperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicDecimeterPerMinute); + } + /// + /// Get VolumeFlow from CubicFeetPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicFeetPerHour(double cubicfeetperhour) + { + double value = (double) cubicfeetperhour; + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerHour); + } + /// + /// Get VolumeFlow from CubicFeetPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicFeetPerMinute(double cubicfeetperminute) + { + double value = (double) cubicfeetperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerMinute); + } + /// + /// Get VolumeFlow from CubicFeetPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicFeetPerSecond(double cubicfeetpersecond) + { + double value = (double) cubicfeetpersecond; + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerSecond); + } + /// + /// Get VolumeFlow from CubicMetersPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicMetersPerHour(double cubicmetersperhour) + { + double value = (double) cubicmetersperhour; + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerHour); + } + /// + /// Get VolumeFlow from CubicMetersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicMetersPerMinute(double cubicmetersperminute) + { + double value = (double) cubicmetersperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerMinute); + } + /// + /// Get VolumeFlow from CubicMetersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicMetersPerSecond(double cubicmeterspersecond) + { + double value = (double) cubicmeterspersecond; + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerSecond); + } + /// + /// Get VolumeFlow from CubicYardsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicYardsPerHour(double cubicyardsperhour) + { + double value = (double) cubicyardsperhour; + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerHour); + } + /// + /// Get VolumeFlow from CubicYardsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicYardsPerMinute(double cubicyardsperminute) + { + double value = (double) cubicyardsperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerMinute); + } + /// + /// Get VolumeFlow from CubicYardsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromCubicYardsPerSecond(double cubicyardspersecond) + { + double value = (double) cubicyardspersecond; + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerSecond); + } + /// + /// Get VolumeFlow from DecilitersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromDecilitersPerMinute(double decilitersperminute) + { + double value = (double) decilitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerMinute); + } + /// + /// Get VolumeFlow from KilolitersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromKilolitersPerMinute(double kilolitersperminute) + { + double value = (double) kilolitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerMinute); + } + /// + /// Get VolumeFlow from LitersPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromLitersPerHour(double litersperhour) + { + double value = (double) litersperhour; + return new VolumeFlow(value, VolumeFlowUnit.LiterPerHour); + } + /// + /// Get VolumeFlow from LitersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromLitersPerMinute(double litersperminute) + { + double value = (double) litersperminute; + return new VolumeFlow(value, VolumeFlowUnit.LiterPerMinute); + } + /// + /// Get VolumeFlow from LitersPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromLitersPerSecond(double literspersecond) + { + double value = (double) literspersecond; + return new VolumeFlow(value, VolumeFlowUnit.LiterPerSecond); + } + /// + /// Get VolumeFlow from MicrolitersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromMicrolitersPerMinute(double microlitersperminute) + { + double value = (double) microlitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerMinute); + } + /// + /// Get VolumeFlow from MillilitersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromMillilitersPerMinute(double millilitersperminute) + { + double value = (double) millilitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerMinute); + } + /// + /// Get VolumeFlow from MillionUsGallonsPerDay. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromMillionUsGallonsPerDay(double millionusgallonsperday) + { + double value = (double) millionusgallonsperday; + return new VolumeFlow(value, VolumeFlowUnit.MillionUsGallonsPerDay); + } + /// + /// Get VolumeFlow from NanolitersPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromNanolitersPerMinute(double nanolitersperminute) + { + double value = (double) nanolitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerMinute); + } + /// + /// Get VolumeFlow from OilBarrelsPerDay. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromOilBarrelsPerDay(double oilbarrelsperday) + { + double value = (double) oilbarrelsperday; + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerDay); + } + /// + /// Get VolumeFlow from OilBarrelsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromOilBarrelsPerHour(double oilbarrelsperhour) + { + double value = (double) oilbarrelsperhour; + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerHour); + } + /// + /// Get VolumeFlow from OilBarrelsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromOilBarrelsPerMinute(double oilbarrelsperminute) + { + double value = (double) oilbarrelsperminute; + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerMinute); + } + /// + /// Get VolumeFlow from UsGallonsPerHour. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromUsGallonsPerHour(double usgallonsperhour) + { + double value = (double) usgallonsperhour; + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerHour); + } + /// + /// Get VolumeFlow from UsGallonsPerMinute. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromUsGallonsPerMinute(double usgallonsperminute) + { + double value = (double) usgallonsperminute; + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerMinute); + } + /// + /// Get VolumeFlow from UsGallonsPerSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumeFlow FromUsGallonsPerSecond(double usgallonspersecond) + { + double value = (double) usgallonspersecond; + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerSecond); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// VolumeFlow unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static VolumeFlow From(double value, VolumeFlowUnit fromUnit) + { + return new VolumeFlow((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static VolumeFlow Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static VolumeFlow Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out VolumeFlow result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VolumeFlow result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumeFlowUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static VolumeFlowUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out VolumeFlowUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumeFlowUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is VolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); + + return CompareTo((VolumeFlow)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(VolumeFlow other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current VolumeFlow. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VolumeFlowUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this VolumeFlow to another VolumeFlow with the unit representation . + /// + /// A VolumeFlow with the specified unit. + public VolumeFlow ToUnit(VolumeFlowUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new VolumeFlow(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case VolumeFlowUnit.CentiliterPerMinute: return (_value/60000.00000) * 1e-2d; + case VolumeFlowUnit.CubicDecimeterPerMinute: return _value/60000.00000; + case VolumeFlowUnit.CubicFootPerHour: return _value*7.8657907199999087346816086183876e-6; + case VolumeFlowUnit.CubicFootPerMinute: return _value/2118.88000326; + case VolumeFlowUnit.CubicFootPerSecond: return _value/35.314666721; + case VolumeFlowUnit.CubicMeterPerHour: return _value/3600; + case VolumeFlowUnit.CubicMeterPerMinute: return _value/60; + case VolumeFlowUnit.CubicMeterPerSecond: return _value; + case VolumeFlowUnit.CubicYardPerHour: return _value*2.1237634944E-4; + case VolumeFlowUnit.CubicYardPerMinute: return _value*0.0127425809664; + case VolumeFlowUnit.CubicYardPerSecond: return _value*0.764554857984; + case VolumeFlowUnit.DeciliterPerMinute: return (_value/60000.00000) * 1e-1d; + case VolumeFlowUnit.KiloliterPerMinute: return (_value/60000.00000) * 1e3d; + case VolumeFlowUnit.LiterPerHour: return _value/3600000.000; + case VolumeFlowUnit.LiterPerMinute: return _value/60000.00000; + case VolumeFlowUnit.LiterPerSecond: return _value/1000; + case VolumeFlowUnit.MicroliterPerMinute: return (_value/60000.00000) * 1e-6d; + case VolumeFlowUnit.MilliliterPerMinute: return (_value/60000.00000) * 1e-3d; + case VolumeFlowUnit.MillionUsGallonsPerDay: return _value/22.824465227; + case VolumeFlowUnit.NanoliterPerMinute: return (_value/60000.00000) * 1e-9d; + case VolumeFlowUnit.OilBarrelPerDay: return _value*1.8401307283333333333333333333333e-6; + case VolumeFlowUnit.OilBarrelPerHour: return _value*4.41631375e-5; + case VolumeFlowUnit.OilBarrelPerMinute: return _value*2.64978825e-3; + case VolumeFlowUnit.UsGallonPerHour: return _value/951019.38848933424; + case VolumeFlowUnit.UsGallonPerMinute: return _value/15850.323141489; + case VolumeFlowUnit.UsGallonPerSecond: return _value/264.1720523581484; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(VolumeFlowUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case VolumeFlowUnit.CentiliterPerMinute: return (baseUnitValue*60000.00000) / 1e-2d; + case VolumeFlowUnit.CubicDecimeterPerMinute: return baseUnitValue*60000.00000; + case VolumeFlowUnit.CubicFootPerHour: return baseUnitValue/7.8657907199999087346816086183876e-6; + case VolumeFlowUnit.CubicFootPerMinute: return baseUnitValue*2118.88000326; + case VolumeFlowUnit.CubicFootPerSecond: return baseUnitValue*35.314666721; + case VolumeFlowUnit.CubicMeterPerHour: return baseUnitValue*3600; + case VolumeFlowUnit.CubicMeterPerMinute: return baseUnitValue*60; + case VolumeFlowUnit.CubicMeterPerSecond: return baseUnitValue; + case VolumeFlowUnit.CubicYardPerHour: return baseUnitValue/2.1237634944E-4; + case VolumeFlowUnit.CubicYardPerMinute: return baseUnitValue/0.0127425809664; + case VolumeFlowUnit.CubicYardPerSecond: return baseUnitValue/0.764554857984; + case VolumeFlowUnit.DeciliterPerMinute: return (baseUnitValue*60000.00000) / 1e-1d; + case VolumeFlowUnit.KiloliterPerMinute: return (baseUnitValue*60000.00000) / 1e3d; + case VolumeFlowUnit.LiterPerHour: return baseUnitValue*3600000.000; + case VolumeFlowUnit.LiterPerMinute: return baseUnitValue*60000.00000; + case VolumeFlowUnit.LiterPerSecond: return baseUnitValue*1000; + case VolumeFlowUnit.MicroliterPerMinute: return (baseUnitValue*60000.00000) / 1e-6d; + case VolumeFlowUnit.MilliliterPerMinute: return (baseUnitValue*60000.00000) / 1e-3d; + case VolumeFlowUnit.MillionUsGallonsPerDay: return baseUnitValue*22.824465227; + case VolumeFlowUnit.NanoliterPerMinute: return (baseUnitValue*60000.00000) / 1e-9d; + case VolumeFlowUnit.OilBarrelPerDay: return baseUnitValue/1.8401307283333333333333333333333e-6; + case VolumeFlowUnit.OilBarrelPerHour: return baseUnitValue/4.41631375e-5; + case VolumeFlowUnit.OilBarrelPerMinute: return baseUnitValue/2.64978825e-3; + case VolumeFlowUnit.UsGallonPerHour: return baseUnitValue*951019.38848933424; + case VolumeFlowUnit.UsGallonPerMinute: return baseUnitValue*15850.323141489; + case VolumeFlowUnit.UsGallonPerSecond: return baseUnitValue*264.1720523581484; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj index 42dc4f39c1..e254fd55f5 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj @@ -20,7 +20,13 @@ ..\Artifacts\UnitsNet.WindowsRuntimeComponent CS1701;CS1702;CS1705;CS0618;CS0809;CS1591 7.3 + + + true + true + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + AnyCPU true @@ -210,6 +216,7 @@ 11.1.0 + 4.5.0 diff --git a/UnitsNet/GeneratedCode/Quantities/.gitignore b/UnitsNet/GeneratedCode/Quantities/.gitignore deleted file mode 100644 index 0360dd5ae9..0000000000 --- a/UnitsNet/GeneratedCode/Quantities/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.g.cs -!Information.NetFramework.g.cs -!Length.NetFramework.g.cs -!Level.NetFramework.g.cs diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs new file mode 100644 index 0000000000..571ee22b18 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -0,0 +1,792 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. + /// + public partial struct Acceleration : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AccelerationUnit? _unit; + + static Acceleration() + { + BaseDimensions = new BaseDimensions(1, 0, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Acceleration(double numericValue, AccelerationUnit unit) + { + if(unit == AccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Acceleration, which is MeterPerSecondSquared. All conversions go via this value. + /// + public static AccelerationUnit BaseUnit => AccelerationUnit.MeterPerSecondSquared; + + /// + /// Represents the largest possible value of Acceleration + /// + public static Acceleration MaxValue => new Acceleration(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Acceleration + /// + public static Acceleration MinValue => new Acceleration(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Acceleration; + + /// + /// All units of measurement for the Acceleration quantity. + /// + public static AccelerationUnit[] Units { get; } = Enum.GetValues(typeof(AccelerationUnit)).Cast().Except(new AccelerationUnit[]{ AccelerationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecondSquared. + /// + public static Acceleration Zero => new Acceleration(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Acceleration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Acceleration.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Acceleration in CentimetersPerSecondSquared. + /// + public double CentimetersPerSecondSquared => As(AccelerationUnit.CentimeterPerSecondSquared); + + /// + /// Get Acceleration in DecimetersPerSecondSquared. + /// + public double DecimetersPerSecondSquared => As(AccelerationUnit.DecimeterPerSecondSquared); + + /// + /// Get Acceleration in FeetPerSecondSquared. + /// + public double FeetPerSecondSquared => As(AccelerationUnit.FootPerSecondSquared); + + /// + /// Get Acceleration in InchesPerSecondSquared. + /// + public double InchesPerSecondSquared => As(AccelerationUnit.InchPerSecondSquared); + + /// + /// Get Acceleration in KilometersPerSecondSquared. + /// + public double KilometersPerSecondSquared => As(AccelerationUnit.KilometerPerSecondSquared); + + /// + /// Get Acceleration in KnotsPerHour. + /// + public double KnotsPerHour => As(AccelerationUnit.KnotPerHour); + + /// + /// Get Acceleration in KnotsPerMinute. + /// + public double KnotsPerMinute => As(AccelerationUnit.KnotPerMinute); + + /// + /// Get Acceleration in KnotsPerSecond. + /// + public double KnotsPerSecond => As(AccelerationUnit.KnotPerSecond); + + /// + /// Get Acceleration in MetersPerSecondSquared. + /// + public double MetersPerSecondSquared => As(AccelerationUnit.MeterPerSecondSquared); + + /// + /// Get Acceleration in MicrometersPerSecondSquared. + /// + public double MicrometersPerSecondSquared => As(AccelerationUnit.MicrometerPerSecondSquared); + + /// + /// Get Acceleration in MillimetersPerSecondSquared. + /// + public double MillimetersPerSecondSquared => As(AccelerationUnit.MillimeterPerSecondSquared); + + /// + /// Get Acceleration in NanometersPerSecondSquared. + /// + public double NanometersPerSecondSquared => As(AccelerationUnit.NanometerPerSecondSquared); + + /// + /// Get Acceleration in StandardGravity. + /// + public double StandardGravity => As(AccelerationUnit.StandardGravity); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AccelerationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(AccelerationUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Acceleration from CentimetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromCentimetersPerSecondSquared(QuantityValue centimeterspersecondsquared) + { + double value = (double) centimeterspersecondsquared; + return new Acceleration(value, AccelerationUnit.CentimeterPerSecondSquared); + } + /// + /// Get Acceleration from DecimetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromDecimetersPerSecondSquared(QuantityValue decimeterspersecondsquared) + { + double value = (double) decimeterspersecondsquared; + return new Acceleration(value, AccelerationUnit.DecimeterPerSecondSquared); + } + /// + /// Get Acceleration from FeetPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromFeetPerSecondSquared(QuantityValue feetpersecondsquared) + { + double value = (double) feetpersecondsquared; + return new Acceleration(value, AccelerationUnit.FootPerSecondSquared); + } + /// + /// Get Acceleration from InchesPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromInchesPerSecondSquared(QuantityValue inchespersecondsquared) + { + double value = (double) inchespersecondsquared; + return new Acceleration(value, AccelerationUnit.InchPerSecondSquared); + } + /// + /// Get Acceleration from KilometersPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromKilometersPerSecondSquared(QuantityValue kilometerspersecondsquared) + { + double value = (double) kilometerspersecondsquared; + return new Acceleration(value, AccelerationUnit.KilometerPerSecondSquared); + } + /// + /// Get Acceleration from KnotsPerHour. + /// + /// If value is NaN or Infinity. + public static Acceleration FromKnotsPerHour(QuantityValue knotsperhour) + { + double value = (double) knotsperhour; + return new Acceleration(value, AccelerationUnit.KnotPerHour); + } + /// + /// Get Acceleration from KnotsPerMinute. + /// + /// If value is NaN or Infinity. + public static Acceleration FromKnotsPerMinute(QuantityValue knotsperminute) + { + double value = (double) knotsperminute; + return new Acceleration(value, AccelerationUnit.KnotPerMinute); + } + /// + /// Get Acceleration from KnotsPerSecond. + /// + /// If value is NaN or Infinity. + public static Acceleration FromKnotsPerSecond(QuantityValue knotspersecond) + { + double value = (double) knotspersecond; + return new Acceleration(value, AccelerationUnit.KnotPerSecond); + } + /// + /// Get Acceleration from MetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromMetersPerSecondSquared(QuantityValue meterspersecondsquared) + { + double value = (double) meterspersecondsquared; + return new Acceleration(value, AccelerationUnit.MeterPerSecondSquared); + } + /// + /// Get Acceleration from MicrometersPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromMicrometersPerSecondSquared(QuantityValue micrometerspersecondsquared) + { + double value = (double) micrometerspersecondsquared; + return new Acceleration(value, AccelerationUnit.MicrometerPerSecondSquared); + } + /// + /// Get Acceleration from MillimetersPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromMillimetersPerSecondSquared(QuantityValue millimeterspersecondsquared) + { + double value = (double) millimeterspersecondsquared; + return new Acceleration(value, AccelerationUnit.MillimeterPerSecondSquared); + } + /// + /// Get Acceleration from NanometersPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static Acceleration FromNanometersPerSecondSquared(QuantityValue nanometerspersecondsquared) + { + double value = (double) nanometerspersecondsquared; + return new Acceleration(value, AccelerationUnit.NanometerPerSecondSquared); + } + /// + /// Get Acceleration from StandardGravity. + /// + /// If value is NaN or Infinity. + public static Acceleration FromStandardGravity(QuantityValue standardgravity) + { + double value = (double) standardgravity; + return new Acceleration(value, AccelerationUnit.StandardGravity); + } + + /// + /// 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 new Acceleration((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Acceleration Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Acceleration Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Acceleration result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Acceleration result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AccelerationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static AccelerationUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AccelerationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out AccelerationUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Acceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); + + return CompareTo((Acceleration)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Acceleration other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Acceleration within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Acceleration other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Acceleration. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AccelerationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Acceleration to another Acceleration with the unit representation . + /// + /// A Acceleration with the specified unit. + public Acceleration ToUnit(AccelerationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Acceleration(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AccelerationUnit.CentimeterPerSecondSquared: return (_value) * 1e-2d; + case AccelerationUnit.DecimeterPerSecondSquared: return (_value) * 1e-1d; + case AccelerationUnit.FootPerSecondSquared: return _value*0.304800; + case AccelerationUnit.InchPerSecondSquared: return _value*0.0254; + case AccelerationUnit.KilometerPerSecondSquared: return (_value) * 1e3d; + case AccelerationUnit.KnotPerHour: return _value*0.5144444444444/3600; + case AccelerationUnit.KnotPerMinute: return _value*0.5144444444444/60; + case AccelerationUnit.KnotPerSecond: return _value*0.5144444444444; + case AccelerationUnit.MeterPerSecondSquared: return _value; + case AccelerationUnit.MicrometerPerSecondSquared: return (_value) * 1e-6d; + case AccelerationUnit.MillimeterPerSecondSquared: return (_value) * 1e-3d; + case AccelerationUnit.NanometerPerSecondSquared: return (_value) * 1e-9d; + case AccelerationUnit.StandardGravity: return _value*9.80665; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AccelerationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AccelerationUnit.CentimeterPerSecondSquared: return (baseUnitValue) / 1e-2d; + case AccelerationUnit.DecimeterPerSecondSquared: return (baseUnitValue) / 1e-1d; + case AccelerationUnit.FootPerSecondSquared: return baseUnitValue/0.304800; + case AccelerationUnit.InchPerSecondSquared: return baseUnitValue/0.0254; + case AccelerationUnit.KilometerPerSecondSquared: return (baseUnitValue) / 1e3d; + case AccelerationUnit.KnotPerHour: return baseUnitValue/0.5144444444444*3600; + case AccelerationUnit.KnotPerMinute: return baseUnitValue/0.5144444444444*60; + case AccelerationUnit.KnotPerSecond: return baseUnitValue/0.5144444444444; + case AccelerationUnit.MeterPerSecondSquared: return baseUnitValue; + case AccelerationUnit.MicrometerPerSecondSquared: return (baseUnitValue) / 1e-6d; + case AccelerationUnit.MillimeterPerSecondSquared: return (baseUnitValue) / 1e-3d; + case AccelerationUnit.NanometerPerSecondSquared: return (baseUnitValue) / 1e-9d; + case AccelerationUnit.StandardGravity: return baseUnitValue/9.80665; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs new file mode 100644 index 0000000000..c73bbd675f --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -0,0 +1,808 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. + /// + public partial struct AmountOfSubstance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AmountOfSubstanceUnit? _unit; + + static AmountOfSubstance() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 1, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit) + { + if(unit == AmountOfSubstanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AmountOfSubstance, which is Mole. All conversions go via this value. + /// + public static AmountOfSubstanceUnit BaseUnit => AmountOfSubstanceUnit.Mole; + + /// + /// Represents the largest possible value of AmountOfSubstance + /// + public static AmountOfSubstance MaxValue => new AmountOfSubstance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AmountOfSubstance + /// + public static AmountOfSubstance MinValue => new AmountOfSubstance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AmountOfSubstance; + + /// + /// All units of measurement for the AmountOfSubstance quantity. + /// + public static AmountOfSubstanceUnit[] Units { get; } = Enum.GetValues(typeof(AmountOfSubstanceUnit)).Cast().Except(new AmountOfSubstanceUnit[]{ AmountOfSubstanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Mole. + /// + public static AmountOfSubstance Zero => new AmountOfSubstance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AmountOfSubstanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AmountOfSubstance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AmountOfSubstance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AmountOfSubstance in Centimoles. + /// + public double Centimoles => As(AmountOfSubstanceUnit.Centimole); + + /// + /// Get AmountOfSubstance in CentipoundMoles. + /// + public double CentipoundMoles => As(AmountOfSubstanceUnit.CentipoundMole); + + /// + /// Get AmountOfSubstance in Decimoles. + /// + public double Decimoles => As(AmountOfSubstanceUnit.Decimole); + + /// + /// Get AmountOfSubstance in DecipoundMoles. + /// + public double DecipoundMoles => As(AmountOfSubstanceUnit.DecipoundMole); + + /// + /// Get AmountOfSubstance in Kilomoles. + /// + public double Kilomoles => As(AmountOfSubstanceUnit.Kilomole); + + /// + /// Get AmountOfSubstance in KilopoundMoles. + /// + public double KilopoundMoles => As(AmountOfSubstanceUnit.KilopoundMole); + + /// + /// Get AmountOfSubstance in Micromoles. + /// + public double Micromoles => As(AmountOfSubstanceUnit.Micromole); + + /// + /// Get AmountOfSubstance in MicropoundMoles. + /// + public double MicropoundMoles => As(AmountOfSubstanceUnit.MicropoundMole); + + /// + /// Get AmountOfSubstance in Millimoles. + /// + public double Millimoles => As(AmountOfSubstanceUnit.Millimole); + + /// + /// Get AmountOfSubstance in MillipoundMoles. + /// + public double MillipoundMoles => As(AmountOfSubstanceUnit.MillipoundMole); + + /// + /// Get AmountOfSubstance in Moles. + /// + public double Moles => As(AmountOfSubstanceUnit.Mole); + + /// + /// Get AmountOfSubstance in Nanomoles. + /// + public double Nanomoles => As(AmountOfSubstanceUnit.Nanomole); + + /// + /// Get AmountOfSubstance in NanopoundMoles. + /// + public double NanopoundMoles => As(AmountOfSubstanceUnit.NanopoundMole); + + /// + /// Get AmountOfSubstance in PoundMoles. + /// + public double PoundMoles => As(AmountOfSubstanceUnit.PoundMole); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AmountOfSubstanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(AmountOfSubstanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AmountOfSubstance from Centimoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromCentimoles(QuantityValue centimoles) + { + double value = (double) centimoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Centimole); + } + /// + /// Get AmountOfSubstance from CentipoundMoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromCentipoundMoles(QuantityValue centipoundmoles) + { + double value = (double) centipoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.CentipoundMole); + } + /// + /// Get AmountOfSubstance from Decimoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromDecimoles(QuantityValue decimoles) + { + double value = (double) decimoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Decimole); + } + /// + /// Get AmountOfSubstance from DecipoundMoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromDecipoundMoles(QuantityValue decipoundmoles) + { + double value = (double) decipoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.DecipoundMole); + } + /// + /// Get AmountOfSubstance from Kilomoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromKilomoles(QuantityValue kilomoles) + { + double value = (double) kilomoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Kilomole); + } + /// + /// Get AmountOfSubstance from KilopoundMoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromKilopoundMoles(QuantityValue kilopoundmoles) + { + double value = (double) kilopoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.KilopoundMole); + } + /// + /// Get AmountOfSubstance from Micromoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromMicromoles(QuantityValue micromoles) + { + double value = (double) micromoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Micromole); + } + /// + /// Get AmountOfSubstance from MicropoundMoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromMicropoundMoles(QuantityValue micropoundmoles) + { + double value = (double) micropoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.MicropoundMole); + } + /// + /// Get AmountOfSubstance from Millimoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromMillimoles(QuantityValue millimoles) + { + double value = (double) millimoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Millimole); + } + /// + /// Get AmountOfSubstance from MillipoundMoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromMillipoundMoles(QuantityValue millipoundmoles) + { + double value = (double) millipoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.MillipoundMole); + } + /// + /// Get AmountOfSubstance from Moles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromMoles(QuantityValue moles) + { + double value = (double) moles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Mole); + } + /// + /// Get AmountOfSubstance from Nanomoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromNanomoles(QuantityValue nanomoles) + { + double value = (double) nanomoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.Nanomole); + } + /// + /// Get AmountOfSubstance from NanopoundMoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromNanopoundMoles(QuantityValue nanopoundmoles) + { + double value = (double) nanopoundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.NanopoundMole); + } + /// + /// Get AmountOfSubstance from PoundMoles. + /// + /// If value is NaN or Infinity. + public static AmountOfSubstance FromPoundMoles(QuantityValue poundmoles) + { + double value = (double) poundmoles; + return new AmountOfSubstance(value, AmountOfSubstanceUnit.PoundMole); + } + + /// + /// 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 new AmountOfSubstance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AmountOfSubstance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static AmountOfSubstance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AmountOfSubstance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmountOfSubstance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AmountOfSubstanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static AmountOfSubstanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AmountOfSubstanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out AmountOfSubstanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); + + return CompareTo((AmountOfSubstance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(AmountOfSubstance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AmountOfSubstance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AmountOfSubstanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AmountOfSubstance to another AmountOfSubstance with the unit representation . + /// + /// A AmountOfSubstance with the specified unit. + public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AmountOfSubstance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AmountOfSubstanceUnit.Centimole: return (_value) * 1e-2d; + case AmountOfSubstanceUnit.CentipoundMole: return (_value*453.59237) * 1e-2d; + case AmountOfSubstanceUnit.Decimole: return (_value) * 1e-1d; + case AmountOfSubstanceUnit.DecipoundMole: return (_value*453.59237) * 1e-1d; + case AmountOfSubstanceUnit.Kilomole: return (_value) * 1e3d; + case AmountOfSubstanceUnit.KilopoundMole: return (_value*453.59237) * 1e3d; + case AmountOfSubstanceUnit.Micromole: return (_value) * 1e-6d; + case AmountOfSubstanceUnit.MicropoundMole: return (_value*453.59237) * 1e-6d; + case AmountOfSubstanceUnit.Millimole: return (_value) * 1e-3d; + case AmountOfSubstanceUnit.MillipoundMole: return (_value*453.59237) * 1e-3d; + case AmountOfSubstanceUnit.Mole: return _value; + case AmountOfSubstanceUnit.Nanomole: return (_value) * 1e-9d; + case AmountOfSubstanceUnit.NanopoundMole: return (_value*453.59237) * 1e-9d; + case AmountOfSubstanceUnit.PoundMole: return _value*453.59237; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AmountOfSubstanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AmountOfSubstanceUnit.Centimole: return (baseUnitValue) / 1e-2d; + case AmountOfSubstanceUnit.CentipoundMole: return (baseUnitValue/453.59237) / 1e-2d; + case AmountOfSubstanceUnit.Decimole: return (baseUnitValue) / 1e-1d; + case AmountOfSubstanceUnit.DecipoundMole: return (baseUnitValue/453.59237) / 1e-1d; + case AmountOfSubstanceUnit.Kilomole: return (baseUnitValue) / 1e3d; + case AmountOfSubstanceUnit.KilopoundMole: return (baseUnitValue/453.59237) / 1e3d; + case AmountOfSubstanceUnit.Micromole: return (baseUnitValue) / 1e-6d; + case AmountOfSubstanceUnit.MicropoundMole: return (baseUnitValue/453.59237) / 1e-6d; + case AmountOfSubstanceUnit.Millimole: return (baseUnitValue) / 1e-3d; + case AmountOfSubstanceUnit.MillipoundMole: return (baseUnitValue/453.59237) / 1e-3d; + case AmountOfSubstanceUnit.Mole: return baseUnitValue; + case AmountOfSubstanceUnit.Nanomole: return (baseUnitValue) / 1e-9d; + case AmountOfSubstanceUnit.NanopoundMole: return (baseUnitValue/453.59237) / 1e-9d; + case AmountOfSubstanceUnit.PoundMole: return baseUnitValue/453.59237; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs new file mode 100644 index 0000000000..0996a6c36c --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -0,0 +1,656 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. + /// + public partial struct AmplitudeRatio : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AmplitudeRatioUnit? _unit; + + static AmplitudeRatio() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit) + { + if(unit == AmplitudeRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AmplitudeRatio, which is DecibelVolt. All conversions go via this value. + /// + public static AmplitudeRatioUnit BaseUnit => AmplitudeRatioUnit.DecibelVolt; + + /// + /// Represents the largest possible value of AmplitudeRatio + /// + public static AmplitudeRatio MaxValue => new AmplitudeRatio(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AmplitudeRatio + /// + public static AmplitudeRatio MinValue => new AmplitudeRatio(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AmplitudeRatio; + + /// + /// All units of measurement for the AmplitudeRatio quantity. + /// + public static AmplitudeRatioUnit[] Units { get; } = Enum.GetValues(typeof(AmplitudeRatioUnit)).Cast().Except(new AmplitudeRatioUnit[]{ AmplitudeRatioUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DecibelVolt. + /// + public static AmplitudeRatio Zero => new AmplitudeRatio(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AmplitudeRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AmplitudeRatio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AmplitudeRatio.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AmplitudeRatio in DecibelMicrovolts. + /// + public double DecibelMicrovolts => As(AmplitudeRatioUnit.DecibelMicrovolt); + + /// + /// Get AmplitudeRatio in DecibelMillivolts. + /// + public double DecibelMillivolts => As(AmplitudeRatioUnit.DecibelMillivolt); + + /// + /// Get AmplitudeRatio in DecibelsUnloaded. + /// + public double DecibelsUnloaded => As(AmplitudeRatioUnit.DecibelUnloaded); + + /// + /// Get AmplitudeRatio in DecibelVolts. + /// + public double DecibelVolts => As(AmplitudeRatioUnit.DecibelVolt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AmplitudeRatioUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(AmplitudeRatioUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AmplitudeRatio from DecibelMicrovolts. + /// + /// If value is NaN or Infinity. + public static AmplitudeRatio FromDecibelMicrovolts(QuantityValue decibelmicrovolts) + { + double value = (double) decibelmicrovolts; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMicrovolt); + } + /// + /// Get AmplitudeRatio from DecibelMillivolts. + /// + /// If value is NaN or Infinity. + public static AmplitudeRatio FromDecibelMillivolts(QuantityValue decibelmillivolts) + { + double value = (double) decibelmillivolts; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelMillivolt); + } + /// + /// Get AmplitudeRatio from DecibelsUnloaded. + /// + /// If value is NaN or Infinity. + public static AmplitudeRatio FromDecibelsUnloaded(QuantityValue decibelsunloaded) + { + double value = (double) decibelsunloaded; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelUnloaded); + } + /// + /// Get AmplitudeRatio from DecibelVolts. + /// + /// If value is NaN or Infinity. + public static AmplitudeRatio FromDecibelVolts(QuantityValue decibelvolts) + { + double value = (double) decibelvolts; + return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelVolt); + } + + /// + /// 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 new AmplitudeRatio((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AmplitudeRatio Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static AmplitudeRatio Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AmplitudeRatio result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AmplitudeRatio result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AmplitudeRatioUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static AmplitudeRatioUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AmplitudeRatioUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out AmplitudeRatioUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); + + return CompareTo((AmplitudeRatio)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(AmplitudeRatio other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AmplitudeRatio. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AmplitudeRatioUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AmplitudeRatio to another AmplitudeRatio with the unit representation . + /// + /// A AmplitudeRatio with the specified unit. + public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AmplitudeRatio(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AmplitudeRatioUnit.DecibelMicrovolt: return _value - 120; + case AmplitudeRatioUnit.DecibelMillivolt: return _value - 60; + case AmplitudeRatioUnit.DecibelUnloaded: return _value - 2.218487499; + case AmplitudeRatioUnit.DecibelVolt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AmplitudeRatioUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AmplitudeRatioUnit.DecibelMicrovolt: return baseUnitValue + 120; + case AmplitudeRatioUnit.DecibelMillivolt: return baseUnitValue + 60; + case AmplitudeRatioUnit.DecibelUnloaded: return baseUnitValue + 2.218487499; + case AmplitudeRatioUnit.DecibelVolt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs new file mode 100644 index 0000000000..5c05c6b4b2 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -0,0 +1,808 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. + /// + public partial struct Angle : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AngleUnit? _unit; + + static Angle() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Angle(double numericValue, AngleUnit unit) + { + if(unit == AngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Angle, which is Degree. All conversions go via this value. + /// + public static AngleUnit BaseUnit => AngleUnit.Degree; + + /// + /// Represents the largest possible value of Angle + /// + public static Angle MaxValue => new Angle(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Angle + /// + public static Angle MinValue => new Angle(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Angle; + + /// + /// All units of measurement for the Angle quantity. + /// + public static AngleUnit[] Units { get; } = Enum.GetValues(typeof(AngleUnit)).Cast().Except(new AngleUnit[]{ AngleUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Degree. + /// + public static Angle Zero => new Angle(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Angle.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Angle.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Angle in Arcminutes. + /// + public double Arcminutes => As(AngleUnit.Arcminute); + + /// + /// Get Angle in Arcseconds. + /// + public double Arcseconds => As(AngleUnit.Arcsecond); + + /// + /// Get Angle in Centiradians. + /// + public double Centiradians => As(AngleUnit.Centiradian); + + /// + /// Get Angle in Deciradians. + /// + public double Deciradians => As(AngleUnit.Deciradian); + + /// + /// Get Angle in Degrees. + /// + public double Degrees => As(AngleUnit.Degree); + + /// + /// Get Angle in Gradians. + /// + public double Gradians => As(AngleUnit.Gradian); + + /// + /// Get Angle in Microdegrees. + /// + public double Microdegrees => As(AngleUnit.Microdegree); + + /// + /// Get Angle in Microradians. + /// + public double Microradians => As(AngleUnit.Microradian); + + /// + /// Get Angle in Millidegrees. + /// + public double Millidegrees => As(AngleUnit.Millidegree); + + /// + /// Get Angle in Milliradians. + /// + public double Milliradians => As(AngleUnit.Milliradian); + + /// + /// Get Angle in Nanodegrees. + /// + public double Nanodegrees => As(AngleUnit.Nanodegree); + + /// + /// Get Angle in Nanoradians. + /// + public double Nanoradians => As(AngleUnit.Nanoradian); + + /// + /// Get Angle in Radians. + /// + public double Radians => As(AngleUnit.Radian); + + /// + /// Get Angle in Revolutions. + /// + public double Revolutions => As(AngleUnit.Revolution); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AngleUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(AngleUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Angle from Arcminutes. + /// + /// If value is NaN or Infinity. + public static Angle FromArcminutes(QuantityValue arcminutes) + { + double value = (double) arcminutes; + return new Angle(value, AngleUnit.Arcminute); + } + /// + /// Get Angle from Arcseconds. + /// + /// If value is NaN or Infinity. + public static Angle FromArcseconds(QuantityValue arcseconds) + { + double value = (double) arcseconds; + return new Angle(value, AngleUnit.Arcsecond); + } + /// + /// Get Angle from Centiradians. + /// + /// If value is NaN or Infinity. + public static Angle FromCentiradians(QuantityValue centiradians) + { + double value = (double) centiradians; + return new Angle(value, AngleUnit.Centiradian); + } + /// + /// Get Angle from Deciradians. + /// + /// If value is NaN or Infinity. + public static Angle FromDeciradians(QuantityValue deciradians) + { + double value = (double) deciradians; + return new Angle(value, AngleUnit.Deciradian); + } + /// + /// Get Angle from Degrees. + /// + /// If value is NaN or Infinity. + public static Angle FromDegrees(QuantityValue degrees) + { + double value = (double) degrees; + return new Angle(value, AngleUnit.Degree); + } + /// + /// Get Angle from Gradians. + /// + /// If value is NaN or Infinity. + public static Angle FromGradians(QuantityValue gradians) + { + double value = (double) gradians; + return new Angle(value, AngleUnit.Gradian); + } + /// + /// Get Angle from Microdegrees. + /// + /// If value is NaN or Infinity. + public static Angle FromMicrodegrees(QuantityValue microdegrees) + { + double value = (double) microdegrees; + return new Angle(value, AngleUnit.Microdegree); + } + /// + /// Get Angle from Microradians. + /// + /// If value is NaN or Infinity. + public static Angle FromMicroradians(QuantityValue microradians) + { + double value = (double) microradians; + return new Angle(value, AngleUnit.Microradian); + } + /// + /// Get Angle from Millidegrees. + /// + /// If value is NaN or Infinity. + public static Angle FromMillidegrees(QuantityValue millidegrees) + { + double value = (double) millidegrees; + return new Angle(value, AngleUnit.Millidegree); + } + /// + /// Get Angle from Milliradians. + /// + /// If value is NaN or Infinity. + public static Angle FromMilliradians(QuantityValue milliradians) + { + double value = (double) milliradians; + return new Angle(value, AngleUnit.Milliradian); + } + /// + /// Get Angle from Nanodegrees. + /// + /// If value is NaN or Infinity. + public static Angle FromNanodegrees(QuantityValue nanodegrees) + { + double value = (double) nanodegrees; + return new Angle(value, AngleUnit.Nanodegree); + } + /// + /// Get Angle from Nanoradians. + /// + /// If value is NaN or Infinity. + public static Angle FromNanoradians(QuantityValue nanoradians) + { + double value = (double) nanoradians; + return new Angle(value, AngleUnit.Nanoradian); + } + /// + /// Get Angle from Radians. + /// + /// If value is NaN or Infinity. + public static Angle FromRadians(QuantityValue radians) + { + double value = (double) radians; + return new Angle(value, AngleUnit.Radian); + } + /// + /// Get Angle from Revolutions. + /// + /// If value is NaN or Infinity. + public static Angle FromRevolutions(QuantityValue revolutions) + { + double value = (double) revolutions; + return new Angle(value, AngleUnit.Revolution); + } + + /// + /// 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 new Angle((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Angle Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Angle Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Angle result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Angle result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AngleUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static AngleUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AngleUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out AngleUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Angle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); + + return CompareTo((Angle)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Angle other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Angle within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Angle. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AngleUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Angle to another Angle with the unit representation . + /// + /// A Angle with the specified unit. + public Angle ToUnit(AngleUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Angle(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AngleUnit.Arcminute: return _value/60; + case AngleUnit.Arcsecond: return _value/3600; + case AngleUnit.Centiradian: return (_value*180/Math.PI) * 1e-2d; + case AngleUnit.Deciradian: return (_value*180/Math.PI) * 1e-1d; + case AngleUnit.Degree: return _value; + case AngleUnit.Gradian: return _value*0.9; + case AngleUnit.Microdegree: return (_value) * 1e-6d; + case AngleUnit.Microradian: return (_value*180/Math.PI) * 1e-6d; + case AngleUnit.Millidegree: return (_value) * 1e-3d; + case AngleUnit.Milliradian: return (_value*180/Math.PI) * 1e-3d; + case AngleUnit.Nanodegree: return (_value) * 1e-9d; + case AngleUnit.Nanoradian: return (_value*180/Math.PI) * 1e-9d; + case AngleUnit.Radian: return _value*180/Math.PI; + case AngleUnit.Revolution: return _value*360; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AngleUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AngleUnit.Arcminute: return baseUnitValue*60; + case AngleUnit.Arcsecond: return baseUnitValue*3600; + case AngleUnit.Centiradian: return (baseUnitValue/180*Math.PI) / 1e-2d; + case AngleUnit.Deciradian: return (baseUnitValue/180*Math.PI) / 1e-1d; + case AngleUnit.Degree: return baseUnitValue; + case AngleUnit.Gradian: return baseUnitValue/0.9; + case AngleUnit.Microdegree: return (baseUnitValue) / 1e-6d; + case AngleUnit.Microradian: return (baseUnitValue/180*Math.PI) / 1e-6d; + case AngleUnit.Millidegree: return (baseUnitValue) / 1e-3d; + case AngleUnit.Milliradian: return (baseUnitValue/180*Math.PI) / 1e-3d; + case AngleUnit.Nanodegree: return (baseUnitValue) / 1e-9d; + case AngleUnit.Nanoradian: return (baseUnitValue/180*Math.PI) / 1e-9d; + case AngleUnit.Radian: return baseUnitValue/180*Math.PI; + case AngleUnit.Revolution: return baseUnitValue/360; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs new file mode 100644 index 0000000000..472ad59e8f --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. + /// + public partial struct ApparentEnergy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ApparentEnergyUnit? _unit; + + static ApparentEnergy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ApparentEnergy(double numericValue, ApparentEnergyUnit unit) + { + if(unit == ApparentEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ApparentEnergy, which is VoltampereHour. All conversions go via this value. + /// + public static ApparentEnergyUnit BaseUnit => ApparentEnergyUnit.VoltampereHour; + + /// + /// Represents the largest possible value of ApparentEnergy + /// + public static ApparentEnergy MaxValue => new ApparentEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ApparentEnergy + /// + public static ApparentEnergy MinValue => new ApparentEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ApparentEnergy; + + /// + /// All units of measurement for the ApparentEnergy quantity. + /// + public static ApparentEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ApparentEnergyUnit)).Cast().Except(new ApparentEnergyUnit[]{ ApparentEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereHour. + /// + public static ApparentEnergy Zero => new ApparentEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ApparentEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ApparentEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ApparentEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ApparentEnergy in KilovoltampereHours. + /// + public double KilovoltampereHours => As(ApparentEnergyUnit.KilovoltampereHour); + + /// + /// Get ApparentEnergy in MegavoltampereHours. + /// + public double MegavoltampereHours => As(ApparentEnergyUnit.MegavoltampereHour); + + /// + /// Get ApparentEnergy in VoltampereHours. + /// + public double VoltampereHours => As(ApparentEnergyUnit.VoltampereHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ApparentEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ApparentEnergyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ApparentEnergy from KilovoltampereHours. + /// + /// If value is NaN or Infinity. + public static ApparentEnergy FromKilovoltampereHours(QuantityValue kilovoltamperehours) + { + double value = (double) kilovoltamperehours; + return new ApparentEnergy(value, ApparentEnergyUnit.KilovoltampereHour); + } + /// + /// Get ApparentEnergy from MegavoltampereHours. + /// + /// If value is NaN or Infinity. + public static ApparentEnergy FromMegavoltampereHours(QuantityValue megavoltamperehours) + { + double value = (double) megavoltamperehours; + return new ApparentEnergy(value, ApparentEnergyUnit.MegavoltampereHour); + } + /// + /// Get ApparentEnergy from VoltampereHours. + /// + /// If value is NaN or Infinity. + public static ApparentEnergy FromVoltampereHours(QuantityValue voltamperehours) + { + double value = (double) voltamperehours; + return new ApparentEnergy(value, ApparentEnergyUnit.VoltampereHour); + } + + /// + /// 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 new ApparentEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ApparentEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ApparentEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ApparentEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentEnergy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ApparentEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ApparentEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ApparentEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ApparentEnergyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); + + return CompareTo((ApparentEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ApparentEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ApparentEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ApparentEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ApparentEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ApparentEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ApparentEnergy to another ApparentEnergy with the unit representation . + /// + /// A ApparentEnergy with the specified unit. + public ApparentEnergy ToUnit(ApparentEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ApparentEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ApparentEnergyUnit.KilovoltampereHour: return (_value) * 1e3d; + case ApparentEnergyUnit.MegavoltampereHour: return (_value) * 1e6d; + case ApparentEnergyUnit.VoltampereHour: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ApparentEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ApparentEnergyUnit.KilovoltampereHour: return (baseUnitValue) / 1e3d; + case ApparentEnergyUnit.MegavoltampereHour: return (baseUnitValue) / 1e6d; + case ApparentEnergyUnit.VoltampereHour: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs new file mode 100644 index 0000000000..97b13fdfb4 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -0,0 +1,648 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. + /// + public partial struct ApparentPower : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ApparentPowerUnit? _unit; + + static ApparentPower() + { + BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ApparentPower(double numericValue, ApparentPowerUnit unit) + { + if(unit == ApparentPowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ApparentPower, which is Voltampere. All conversions go via this value. + /// + public static ApparentPowerUnit BaseUnit => ApparentPowerUnit.Voltampere; + + /// + /// Represents the largest possible value of ApparentPower + /// + public static ApparentPower MaxValue => new ApparentPower(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ApparentPower + /// + public static ApparentPower MinValue => new ApparentPower(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ApparentPower; + + /// + /// All units of measurement for the ApparentPower quantity. + /// + public static ApparentPowerUnit[] Units { get; } = Enum.GetValues(typeof(ApparentPowerUnit)).Cast().Except(new ApparentPowerUnit[]{ ApparentPowerUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Voltampere. + /// + public static ApparentPower Zero => new ApparentPower(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ApparentPowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ApparentPower.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ApparentPower.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ApparentPower in Gigavoltamperes. + /// + public double Gigavoltamperes => As(ApparentPowerUnit.Gigavoltampere); + + /// + /// Get ApparentPower in Kilovoltamperes. + /// + public double Kilovoltamperes => As(ApparentPowerUnit.Kilovoltampere); + + /// + /// Get ApparentPower in Megavoltamperes. + /// + public double Megavoltamperes => As(ApparentPowerUnit.Megavoltampere); + + /// + /// Get ApparentPower in Voltamperes. + /// + public double Voltamperes => As(ApparentPowerUnit.Voltampere); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ApparentPowerUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ApparentPowerUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ApparentPower from Gigavoltamperes. + /// + /// If value is NaN or Infinity. + public static ApparentPower FromGigavoltamperes(QuantityValue gigavoltamperes) + { + double value = (double) gigavoltamperes; + return new ApparentPower(value, ApparentPowerUnit.Gigavoltampere); + } + /// + /// Get ApparentPower from Kilovoltamperes. + /// + /// If value is NaN or Infinity. + public static ApparentPower FromKilovoltamperes(QuantityValue kilovoltamperes) + { + double value = (double) kilovoltamperes; + return new ApparentPower(value, ApparentPowerUnit.Kilovoltampere); + } + /// + /// Get ApparentPower from Megavoltamperes. + /// + /// If value is NaN or Infinity. + public static ApparentPower FromMegavoltamperes(QuantityValue megavoltamperes) + { + double value = (double) megavoltamperes; + return new ApparentPower(value, ApparentPowerUnit.Megavoltampere); + } + /// + /// Get ApparentPower from Voltamperes. + /// + /// If value is NaN or Infinity. + public static ApparentPower FromVoltamperes(QuantityValue voltamperes) + { + double value = (double) voltamperes; + return new ApparentPower(value, ApparentPowerUnit.Voltampere); + } + + /// + /// 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 new ApparentPower((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ApparentPower Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ApparentPower Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ApparentPower result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ApparentPower result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ApparentPowerUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ApparentPowerUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ApparentPowerUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ApparentPowerUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); + + return CompareTo((ApparentPower)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ApparentPower other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ApparentPower within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ApparentPower other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ApparentPower. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ApparentPowerUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ApparentPower to another ApparentPower with the unit representation . + /// + /// A ApparentPower with the specified unit. + public ApparentPower ToUnit(ApparentPowerUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ApparentPower(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ApparentPowerUnit.Gigavoltampere: return (_value) * 1e9d; + case ApparentPowerUnit.Kilovoltampere: return (_value) * 1e3d; + case ApparentPowerUnit.Megavoltampere: return (_value) * 1e6d; + case ApparentPowerUnit.Voltampere: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ApparentPowerUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ApparentPowerUnit.Gigavoltampere: return (baseUnitValue) / 1e9d; + case ApparentPowerUnit.Kilovoltampere: return (baseUnitValue) / 1e3d; + case ApparentPowerUnit.Megavoltampere: return (baseUnitValue) / 1e6d; + case ApparentPowerUnit.Voltampere: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs new file mode 100644 index 0000000000..328946fdad --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -0,0 +1,792 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). + /// + public partial struct Area : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AreaUnit? _unit; + + static Area() + { + BaseDimensions = new BaseDimensions(2, 0, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Area(double numericValue, AreaUnit unit) + { + if(unit == AreaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Area, which is SquareMeter. All conversions go via this value. + /// + public static AreaUnit BaseUnit => AreaUnit.SquareMeter; + + /// + /// Represents the largest possible value of Area + /// + public static Area MaxValue => new Area(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Area + /// + public static Area MinValue => new Area(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Area; + + /// + /// All units of measurement for the Area quantity. + /// + public static AreaUnit[] Units { get; } = Enum.GetValues(typeof(AreaUnit)).Cast().Except(new AreaUnit[]{ AreaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeter. + /// + public static Area Zero => new Area(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AreaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Area.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Area.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Area in Acres. + /// + public double Acres => As(AreaUnit.Acre); + + /// + /// Get Area in Hectares. + /// + public double Hectares => As(AreaUnit.Hectare); + + /// + /// Get Area in SquareCentimeters. + /// + public double SquareCentimeters => As(AreaUnit.SquareCentimeter); + + /// + /// Get Area in SquareDecimeters. + /// + public double SquareDecimeters => As(AreaUnit.SquareDecimeter); + + /// + /// Get Area in SquareFeet. + /// + public double SquareFeet => As(AreaUnit.SquareFoot); + + /// + /// Get Area in SquareInches. + /// + public double SquareInches => As(AreaUnit.SquareInch); + + /// + /// Get Area in SquareKilometers. + /// + public double SquareKilometers => As(AreaUnit.SquareKilometer); + + /// + /// Get Area in SquareMeters. + /// + public double SquareMeters => As(AreaUnit.SquareMeter); + + /// + /// Get Area in SquareMicrometers. + /// + public double SquareMicrometers => As(AreaUnit.SquareMicrometer); + + /// + /// Get Area in SquareMiles. + /// + public double SquareMiles => As(AreaUnit.SquareMile); + + /// + /// Get Area in SquareMillimeters. + /// + public double SquareMillimeters => As(AreaUnit.SquareMillimeter); + + /// + /// Get Area in SquareYards. + /// + public double SquareYards => As(AreaUnit.SquareYard); + + /// + /// Get Area in UsSurveySquareFeet. + /// + public double UsSurveySquareFeet => As(AreaUnit.UsSurveySquareFoot); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AreaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(AreaUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Area from Acres. + /// + /// If value is NaN or Infinity. + public static Area FromAcres(QuantityValue acres) + { + double value = (double) acres; + return new Area(value, AreaUnit.Acre); + } + /// + /// Get Area from Hectares. + /// + /// If value is NaN or Infinity. + public static Area FromHectares(QuantityValue hectares) + { + double value = (double) hectares; + return new Area(value, AreaUnit.Hectare); + } + /// + /// Get Area from SquareCentimeters. + /// + /// If value is NaN or Infinity. + public static Area FromSquareCentimeters(QuantityValue squarecentimeters) + { + double value = (double) squarecentimeters; + return new Area(value, AreaUnit.SquareCentimeter); + } + /// + /// Get Area from SquareDecimeters. + /// + /// If value is NaN or Infinity. + public static Area FromSquareDecimeters(QuantityValue squaredecimeters) + { + double value = (double) squaredecimeters; + return new Area(value, AreaUnit.SquareDecimeter); + } + /// + /// Get Area from SquareFeet. + /// + /// If value is NaN or Infinity. + public static Area FromSquareFeet(QuantityValue squarefeet) + { + double value = (double) squarefeet; + return new Area(value, AreaUnit.SquareFoot); + } + /// + /// Get Area from SquareInches. + /// + /// If value is NaN or Infinity. + public static Area FromSquareInches(QuantityValue squareinches) + { + double value = (double) squareinches; + return new Area(value, AreaUnit.SquareInch); + } + /// + /// Get Area from SquareKilometers. + /// + /// If value is NaN or Infinity. + public static Area FromSquareKilometers(QuantityValue squarekilometers) + { + double value = (double) squarekilometers; + return new Area(value, AreaUnit.SquareKilometer); + } + /// + /// Get Area from SquareMeters. + /// + /// If value is NaN or Infinity. + public static Area FromSquareMeters(QuantityValue squaremeters) + { + double value = (double) squaremeters; + return new Area(value, AreaUnit.SquareMeter); + } + /// + /// Get Area from SquareMicrometers. + /// + /// If value is NaN or Infinity. + public static Area FromSquareMicrometers(QuantityValue squaremicrometers) + { + double value = (double) squaremicrometers; + return new Area(value, AreaUnit.SquareMicrometer); + } + /// + /// Get Area from SquareMiles. + /// + /// If value is NaN or Infinity. + public static Area FromSquareMiles(QuantityValue squaremiles) + { + double value = (double) squaremiles; + return new Area(value, AreaUnit.SquareMile); + } + /// + /// Get Area from SquareMillimeters. + /// + /// If value is NaN or Infinity. + public static Area FromSquareMillimeters(QuantityValue squaremillimeters) + { + double value = (double) squaremillimeters; + return new Area(value, AreaUnit.SquareMillimeter); + } + /// + /// Get Area from SquareYards. + /// + /// If value is NaN or Infinity. + public static Area FromSquareYards(QuantityValue squareyards) + { + double value = (double) squareyards; + return new Area(value, AreaUnit.SquareYard); + } + /// + /// Get Area from UsSurveySquareFeet. + /// + /// If value is NaN or Infinity. + public static Area FromUsSurveySquareFeet(QuantityValue ussurveysquarefeet) + { + double value = (double) ussurveysquarefeet; + return new Area(value, AreaUnit.UsSurveySquareFoot); + } + + /// + /// 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 new Area((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Area Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Area Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Area result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Area result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static AreaUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AreaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Area)) throw new ArgumentException("Expected type Area.", nameof(obj)); + + return CompareTo((Area)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Area other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Area within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Area other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Area. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AreaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Area to another Area with the unit representation . + /// + /// A Area with the specified unit. + public Area ToUnit(AreaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Area(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AreaUnit.Acre: return _value*4046.85642; + case AreaUnit.Hectare: return _value*1e4; + case AreaUnit.SquareCentimeter: return _value*1e-4; + case AreaUnit.SquareDecimeter: return _value*1e-2; + case AreaUnit.SquareFoot: return _value*0.092903; + case AreaUnit.SquareInch: return _value*0.00064516; + case AreaUnit.SquareKilometer: return _value*1e6; + case AreaUnit.SquareMeter: return _value; + case AreaUnit.SquareMicrometer: return _value*1e-12; + case AreaUnit.SquareMile: return _value*2.59e6; + case AreaUnit.SquareMillimeter: return _value*1e-6; + case AreaUnit.SquareYard: return _value*0.836127; + case AreaUnit.UsSurveySquareFoot: return _value*0.09290341161; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AreaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AreaUnit.Acre: return baseUnitValue/4046.85642; + case AreaUnit.Hectare: return baseUnitValue/1e4; + case AreaUnit.SquareCentimeter: return baseUnitValue/1e-4; + case AreaUnit.SquareDecimeter: return baseUnitValue/1e-2; + case AreaUnit.SquareFoot: return baseUnitValue/0.092903; + case AreaUnit.SquareInch: return baseUnitValue/0.00064516; + case AreaUnit.SquareKilometer: return baseUnitValue/1e6; + case AreaUnit.SquareMeter: return baseUnitValue; + case AreaUnit.SquareMicrometer: return baseUnitValue/1e-12; + case AreaUnit.SquareMile: return baseUnitValue/2.59e6; + case AreaUnit.SquareMillimeter: return baseUnitValue/1e-6; + case AreaUnit.SquareYard: return baseUnitValue/0.836127; + case AreaUnit.UsSurveySquareFoot: return baseUnitValue/0.09290341161; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs new file mode 100644 index 0000000000..c288aa6440 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -0,0 +1,600 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The area density of a two-dimensional object is calculated as the mass per unit area. + /// + public partial struct AreaDensity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AreaDensityUnit? _unit; + + static AreaDensity() + { + BaseDimensions = new BaseDimensions(-2, 1, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public AreaDensity(double numericValue, AreaDensityUnit unit) + { + if(unit == AreaDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AreaDensity, which is KilogramPerSquareMeter. All conversions go via this value. + /// + public static AreaDensityUnit BaseUnit => AreaDensityUnit.KilogramPerSquareMeter; + + /// + /// Represents the largest possible value of AreaDensity + /// + public static AreaDensity MaxValue => new AreaDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AreaDensity + /// + public static AreaDensity MinValue => new AreaDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AreaDensity; + + /// + /// All units of measurement for the AreaDensity quantity. + /// + public static AreaDensityUnit[] Units { get; } = Enum.GetValues(typeof(AreaDensityUnit)).Cast().Except(new AreaDensityUnit[]{ AreaDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSquareMeter. + /// + public static AreaDensity Zero => new AreaDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AreaDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AreaDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AreaDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AreaDensity in KilogramsPerSquareMeter. + /// + public double KilogramsPerSquareMeter => As(AreaDensityUnit.KilogramPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AreaDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(AreaDensityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AreaDensity from KilogramsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static AreaDensity FromKilogramsPerSquareMeter(QuantityValue kilogramspersquaremeter) + { + double value = (double) kilogramspersquaremeter; + return new AreaDensity(value, AreaDensityUnit.KilogramPerSquareMeter); + } + + /// + /// 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 new AreaDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AreaDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static AreaDensity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AreaDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaDensity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static AreaDensityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AreaDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDensityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); + + return CompareTo((AreaDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(AreaDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AreaDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AreaDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AreaDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AreaDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AreaDensity to another AreaDensity with the unit representation . + /// + /// A AreaDensity with the specified unit. + public AreaDensity ToUnit(AreaDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AreaDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AreaDensityUnit.KilogramPerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AreaDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AreaDensityUnit.KilogramPerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs new file mode 100644 index 0000000000..83b7e00bb2 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -0,0 +1,680 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A geometric property of an area that reflects how its points are distributed with regard to an axis. + /// + public partial struct AreaMomentOfInertia : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly AreaMomentOfInertiaUnit? _unit; + + static AreaMomentOfInertia() + { + BaseDimensions = new BaseDimensions(4, 0, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit) + { + if(unit == AreaMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of AreaMomentOfInertia, which is MeterToTheFourth. All conversions go via this value. + /// + public static AreaMomentOfInertiaUnit BaseUnit => AreaMomentOfInertiaUnit.MeterToTheFourth; + + /// + /// Represents the largest possible value of AreaMomentOfInertia + /// + public static AreaMomentOfInertia MaxValue => new AreaMomentOfInertia(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of AreaMomentOfInertia + /// + public static AreaMomentOfInertia MinValue => new AreaMomentOfInertia(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.AreaMomentOfInertia; + + /// + /// All units of measurement for the AreaMomentOfInertia quantity. + /// + public static AreaMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(AreaMomentOfInertiaUnit)).Cast().Except(new AreaMomentOfInertiaUnit[]{ AreaMomentOfInertiaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MeterToTheFourth. + /// + public static AreaMomentOfInertia Zero => new AreaMomentOfInertia(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public AreaMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => AreaMomentOfInertia.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => AreaMomentOfInertia.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get AreaMomentOfInertia in CentimetersToTheFourth. + /// + public double CentimetersToTheFourth => As(AreaMomentOfInertiaUnit.CentimeterToTheFourth); + + /// + /// Get AreaMomentOfInertia in DecimetersToTheFourth. + /// + public double DecimetersToTheFourth => As(AreaMomentOfInertiaUnit.DecimeterToTheFourth); + + /// + /// Get AreaMomentOfInertia in FeetToTheFourth. + /// + public double FeetToTheFourth => As(AreaMomentOfInertiaUnit.FootToTheFourth); + + /// + /// Get AreaMomentOfInertia in InchesToTheFourth. + /// + public double InchesToTheFourth => As(AreaMomentOfInertiaUnit.InchToTheFourth); + + /// + /// Get AreaMomentOfInertia in MetersToTheFourth. + /// + public double MetersToTheFourth => As(AreaMomentOfInertiaUnit.MeterToTheFourth); + + /// + /// Get AreaMomentOfInertia in MillimetersToTheFourth. + /// + public double MillimetersToTheFourth => As(AreaMomentOfInertiaUnit.MillimeterToTheFourth); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(AreaMomentOfInertiaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(AreaMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get AreaMomentOfInertia from CentimetersToTheFourth. + /// + /// If value is NaN or Infinity. + public static AreaMomentOfInertia FromCentimetersToTheFourth(QuantityValue centimeterstothefourth) + { + double value = (double) centimeterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.CentimeterToTheFourth); + } + /// + /// Get AreaMomentOfInertia from DecimetersToTheFourth. + /// + /// If value is NaN or Infinity. + public static AreaMomentOfInertia FromDecimetersToTheFourth(QuantityValue decimeterstothefourth) + { + double value = (double) decimeterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.DecimeterToTheFourth); + } + /// + /// Get AreaMomentOfInertia from FeetToTheFourth. + /// + /// If value is NaN or Infinity. + public static AreaMomentOfInertia FromFeetToTheFourth(QuantityValue feettothefourth) + { + double value = (double) feettothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.FootToTheFourth); + } + /// + /// Get AreaMomentOfInertia from InchesToTheFourth. + /// + /// If value is NaN or Infinity. + public static AreaMomentOfInertia FromInchesToTheFourth(QuantityValue inchestothefourth) + { + double value = (double) inchestothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.InchToTheFourth); + } + /// + /// Get AreaMomentOfInertia from MetersToTheFourth. + /// + /// If value is NaN or Infinity. + public static AreaMomentOfInertia FromMetersToTheFourth(QuantityValue meterstothefourth) + { + double value = (double) meterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MeterToTheFourth); + } + /// + /// Get AreaMomentOfInertia from MillimetersToTheFourth. + /// + /// If value is NaN or Infinity. + public static AreaMomentOfInertia FromMillimetersToTheFourth(QuantityValue millimeterstothefourth) + { + double value = (double) millimeterstothefourth; + return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MillimeterToTheFourth); + } + + /// + /// 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 new AreaMomentOfInertia((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static AreaMomentOfInertia Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static AreaMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out AreaMomentOfInertia result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out AreaMomentOfInertia result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static AreaMomentOfInertiaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static AreaMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out AreaMomentOfInertiaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMomentOfInertiaUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is AreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); + + return CompareTo((AreaMomentOfInertia)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(AreaMomentOfInertia other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current AreaMomentOfInertia. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(AreaMomentOfInertiaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this AreaMomentOfInertia to another AreaMomentOfInertia with the unit representation . + /// + /// A AreaMomentOfInertia with the specified unit. + public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new AreaMomentOfInertia(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return _value/1e8; + case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return _value/1e4; + case AreaMomentOfInertiaUnit.FootToTheFourth: return _value*Math.Pow(0.3048, 4); + case AreaMomentOfInertiaUnit.InchToTheFourth: return _value*Math.Pow(2.54e-2, 4); + case AreaMomentOfInertiaUnit.MeterToTheFourth: return _value; + case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return _value/1e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(AreaMomentOfInertiaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case AreaMomentOfInertiaUnit.CentimeterToTheFourth: return baseUnitValue*1e8; + case AreaMomentOfInertiaUnit.DecimeterToTheFourth: return baseUnitValue*1e4; + case AreaMomentOfInertiaUnit.FootToTheFourth: return baseUnitValue/Math.Pow(0.3048, 4); + case AreaMomentOfInertiaUnit.InchToTheFourth: return baseUnitValue/Math.Pow(2.54e-2, 4); + case AreaMomentOfInertiaUnit.MeterToTheFourth: return baseUnitValue; + case AreaMomentOfInertiaUnit.MillimeterToTheFourth: return baseUnitValue*1e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs new file mode 100644 index 0000000000..60d0bbce91 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -0,0 +1,1003 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In telecommunications and computing, bit rate is the number of bits that are conveyed or processed per unit of time. + /// + /// + /// https://en.wikipedia.org/wiki/Bit_rate + /// + public partial struct BitRate : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly decimal _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly BitRateUnit? _unit; + + static BitRate() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public BitRate(decimal numericValue, BitRateUnit unit) + { + if(unit == BitRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = numericValue; + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of BitRate, which is BitPerSecond. All conversions go via this value. + /// + public static BitRateUnit BaseUnit => BitRateUnit.BitPerSecond; + + /// + /// Represents the largest possible value of BitRate + /// + public static BitRate MaxValue => new BitRate(decimal.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of BitRate + /// + public static BitRate MinValue => new BitRate(decimal.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.BitRate; + + /// + /// All units of measurement for the BitRate quantity. + /// + public static BitRateUnit[] Units { get; } = Enum.GetValues(typeof(BitRateUnit)).Cast().Except(new BitRateUnit[]{ BitRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit BitPerSecond. + /// + public static BitRate Zero => new BitRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public decimal Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public BitRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => BitRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => BitRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get BitRate in BitsPerSecond. + /// + public double BitsPerSecond => As(BitRateUnit.BitPerSecond); + + /// + /// Get BitRate in BytesPerSecond. + /// + public double BytesPerSecond => As(BitRateUnit.BytePerSecond); + + /// + /// Get BitRate in ExabitsPerSecond. + /// + public double ExabitsPerSecond => As(BitRateUnit.ExabitPerSecond); + + /// + /// Get BitRate in ExabytesPerSecond. + /// + public double ExabytesPerSecond => As(BitRateUnit.ExabytePerSecond); + + /// + /// Get BitRate in ExbibitsPerSecond. + /// + public double ExbibitsPerSecond => As(BitRateUnit.ExbibitPerSecond); + + /// + /// Get BitRate in ExbibytesPerSecond. + /// + public double ExbibytesPerSecond => As(BitRateUnit.ExbibytePerSecond); + + /// + /// Get BitRate in GibibitsPerSecond. + /// + public double GibibitsPerSecond => As(BitRateUnit.GibibitPerSecond); + + /// + /// Get BitRate in GibibytesPerSecond. + /// + public double GibibytesPerSecond => As(BitRateUnit.GibibytePerSecond); + + /// + /// Get BitRate in GigabitsPerSecond. + /// + public double GigabitsPerSecond => As(BitRateUnit.GigabitPerSecond); + + /// + /// Get BitRate in GigabytesPerSecond. + /// + public double GigabytesPerSecond => As(BitRateUnit.GigabytePerSecond); + + /// + /// Get BitRate in KibibitsPerSecond. + /// + public double KibibitsPerSecond => As(BitRateUnit.KibibitPerSecond); + + /// + /// Get BitRate in KibibytesPerSecond. + /// + public double KibibytesPerSecond => As(BitRateUnit.KibibytePerSecond); + + /// + /// Get BitRate in KilobitsPerSecond. + /// + public double KilobitsPerSecond => As(BitRateUnit.KilobitPerSecond); + + /// + /// Get BitRate in KilobytesPerSecond. + /// + public double KilobytesPerSecond => As(BitRateUnit.KilobytePerSecond); + + /// + /// Get BitRate in MebibitsPerSecond. + /// + public double MebibitsPerSecond => As(BitRateUnit.MebibitPerSecond); + + /// + /// Get BitRate in MebibytesPerSecond. + /// + public double MebibytesPerSecond => As(BitRateUnit.MebibytePerSecond); + + /// + /// Get BitRate in MegabitsPerSecond. + /// + public double MegabitsPerSecond => As(BitRateUnit.MegabitPerSecond); + + /// + /// Get BitRate in MegabytesPerSecond. + /// + public double MegabytesPerSecond => As(BitRateUnit.MegabytePerSecond); + + /// + /// Get BitRate in PebibitsPerSecond. + /// + public double PebibitsPerSecond => As(BitRateUnit.PebibitPerSecond); + + /// + /// Get BitRate in PebibytesPerSecond. + /// + public double PebibytesPerSecond => As(BitRateUnit.PebibytePerSecond); + + /// + /// Get BitRate in PetabitsPerSecond. + /// + public double PetabitsPerSecond => As(BitRateUnit.PetabitPerSecond); + + /// + /// Get BitRate in PetabytesPerSecond. + /// + public double PetabytesPerSecond => As(BitRateUnit.PetabytePerSecond); + + /// + /// Get BitRate in TebibitsPerSecond. + /// + public double TebibitsPerSecond => As(BitRateUnit.TebibitPerSecond); + + /// + /// Get BitRate in TebibytesPerSecond. + /// + public double TebibytesPerSecond => As(BitRateUnit.TebibytePerSecond); + + /// + /// Get BitRate in TerabitsPerSecond. + /// + public double TerabitsPerSecond => As(BitRateUnit.TerabitPerSecond); + + /// + /// Get BitRate in TerabytesPerSecond. + /// + public double TerabytesPerSecond => As(BitRateUnit.TerabytePerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(BitRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(BitRateUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get BitRate from BitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromBitsPerSecond(QuantityValue bitspersecond) + { + decimal value = (decimal) bitspersecond; + return new BitRate(value, BitRateUnit.BitPerSecond); + } + /// + /// Get BitRate from BytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromBytesPerSecond(QuantityValue bytespersecond) + { + decimal value = (decimal) bytespersecond; + return new BitRate(value, BitRateUnit.BytePerSecond); + } + /// + /// Get BitRate from ExabitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromExabitsPerSecond(QuantityValue exabitspersecond) + { + decimal value = (decimal) exabitspersecond; + return new BitRate(value, BitRateUnit.ExabitPerSecond); + } + /// + /// Get BitRate from ExabytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromExabytesPerSecond(QuantityValue exabytespersecond) + { + decimal value = (decimal) exabytespersecond; + return new BitRate(value, BitRateUnit.ExabytePerSecond); + } + /// + /// Get BitRate from ExbibitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromExbibitsPerSecond(QuantityValue exbibitspersecond) + { + decimal value = (decimal) exbibitspersecond; + return new BitRate(value, BitRateUnit.ExbibitPerSecond); + } + /// + /// Get BitRate from ExbibytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromExbibytesPerSecond(QuantityValue exbibytespersecond) + { + decimal value = (decimal) exbibytespersecond; + return new BitRate(value, BitRateUnit.ExbibytePerSecond); + } + /// + /// Get BitRate from GibibitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromGibibitsPerSecond(QuantityValue gibibitspersecond) + { + decimal value = (decimal) gibibitspersecond; + return new BitRate(value, BitRateUnit.GibibitPerSecond); + } + /// + /// Get BitRate from GibibytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromGibibytesPerSecond(QuantityValue gibibytespersecond) + { + decimal value = (decimal) gibibytespersecond; + return new BitRate(value, BitRateUnit.GibibytePerSecond); + } + /// + /// Get BitRate from GigabitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromGigabitsPerSecond(QuantityValue gigabitspersecond) + { + decimal value = (decimal) gigabitspersecond; + return new BitRate(value, BitRateUnit.GigabitPerSecond); + } + /// + /// Get BitRate from GigabytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromGigabytesPerSecond(QuantityValue gigabytespersecond) + { + decimal value = (decimal) gigabytespersecond; + return new BitRate(value, BitRateUnit.GigabytePerSecond); + } + /// + /// Get BitRate from KibibitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromKibibitsPerSecond(QuantityValue kibibitspersecond) + { + decimal value = (decimal) kibibitspersecond; + return new BitRate(value, BitRateUnit.KibibitPerSecond); + } + /// + /// Get BitRate from KibibytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromKibibytesPerSecond(QuantityValue kibibytespersecond) + { + decimal value = (decimal) kibibytespersecond; + return new BitRate(value, BitRateUnit.KibibytePerSecond); + } + /// + /// Get BitRate from KilobitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromKilobitsPerSecond(QuantityValue kilobitspersecond) + { + decimal value = (decimal) kilobitspersecond; + return new BitRate(value, BitRateUnit.KilobitPerSecond); + } + /// + /// Get BitRate from KilobytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromKilobytesPerSecond(QuantityValue kilobytespersecond) + { + decimal value = (decimal) kilobytespersecond; + return new BitRate(value, BitRateUnit.KilobytePerSecond); + } + /// + /// Get BitRate from MebibitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromMebibitsPerSecond(QuantityValue mebibitspersecond) + { + decimal value = (decimal) mebibitspersecond; + return new BitRate(value, BitRateUnit.MebibitPerSecond); + } + /// + /// Get BitRate from MebibytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromMebibytesPerSecond(QuantityValue mebibytespersecond) + { + decimal value = (decimal) mebibytespersecond; + return new BitRate(value, BitRateUnit.MebibytePerSecond); + } + /// + /// Get BitRate from MegabitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromMegabitsPerSecond(QuantityValue megabitspersecond) + { + decimal value = (decimal) megabitspersecond; + return new BitRate(value, BitRateUnit.MegabitPerSecond); + } + /// + /// Get BitRate from MegabytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromMegabytesPerSecond(QuantityValue megabytespersecond) + { + decimal value = (decimal) megabytespersecond; + return new BitRate(value, BitRateUnit.MegabytePerSecond); + } + /// + /// Get BitRate from PebibitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromPebibitsPerSecond(QuantityValue pebibitspersecond) + { + decimal value = (decimal) pebibitspersecond; + return new BitRate(value, BitRateUnit.PebibitPerSecond); + } + /// + /// Get BitRate from PebibytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromPebibytesPerSecond(QuantityValue pebibytespersecond) + { + decimal value = (decimal) pebibytespersecond; + return new BitRate(value, BitRateUnit.PebibytePerSecond); + } + /// + /// Get BitRate from PetabitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromPetabitsPerSecond(QuantityValue petabitspersecond) + { + decimal value = (decimal) petabitspersecond; + return new BitRate(value, BitRateUnit.PetabitPerSecond); + } + /// + /// Get BitRate from PetabytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromPetabytesPerSecond(QuantityValue petabytespersecond) + { + decimal value = (decimal) petabytespersecond; + return new BitRate(value, BitRateUnit.PetabytePerSecond); + } + /// + /// Get BitRate from TebibitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromTebibitsPerSecond(QuantityValue tebibitspersecond) + { + decimal value = (decimal) tebibitspersecond; + return new BitRate(value, BitRateUnit.TebibitPerSecond); + } + /// + /// Get BitRate from TebibytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromTebibytesPerSecond(QuantityValue tebibytespersecond) + { + decimal value = (decimal) tebibytespersecond; + return new BitRate(value, BitRateUnit.TebibytePerSecond); + } + /// + /// Get BitRate from TerabitsPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromTerabitsPerSecond(QuantityValue terabitspersecond) + { + decimal value = (decimal) terabitspersecond; + return new BitRate(value, BitRateUnit.TerabitPerSecond); + } + /// + /// Get BitRate from TerabytesPerSecond. + /// + /// If value is NaN or Infinity. + public static BitRate FromTerabytesPerSecond(QuantityValue terabytespersecond) + { + decimal value = (decimal) terabytespersecond; + return new BitRate(value, BitRateUnit.TerabytePerSecond); + } + + /// + /// 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 new BitRate((decimal)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static BitRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static BitRate Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out BitRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BitRate result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static BitRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static BitRateUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out BitRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out BitRateUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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 int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is BitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); + + return CompareTo((BitRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(BitRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another BitRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(BitRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current BitRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(BitRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this BitRate to another BitRate with the unit representation . + /// + /// A BitRate with the specified unit. + public BitRate ToUnit(BitRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new BitRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private decimal AsBaseUnit() + { + switch(Unit) + { + case BitRateUnit.BitPerSecond: return _value; + case BitRateUnit.BytePerSecond: return _value*8m; + case BitRateUnit.ExabitPerSecond: return (_value) * 1e18m; + case BitRateUnit.ExabytePerSecond: return (_value*8m) * 1e18m; + case BitRateUnit.ExbibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.ExbibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.GibibitPerSecond: return (_value) * (1024m * 1024 * 1024); + case BitRateUnit.GibibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024); + case BitRateUnit.GigabitPerSecond: return (_value) * 1e9m; + case BitRateUnit.GigabytePerSecond: return (_value*8m) * 1e9m; + case BitRateUnit.KibibitPerSecond: return (_value) * 1024m; + case BitRateUnit.KibibytePerSecond: return (_value*8m) * 1024m; + case BitRateUnit.KilobitPerSecond: return (_value) * 1e3m; + case BitRateUnit.KilobytePerSecond: return (_value*8m) * 1e3m; + case BitRateUnit.MebibitPerSecond: return (_value) * (1024m * 1024); + case BitRateUnit.MebibytePerSecond: return (_value*8m) * (1024m * 1024); + case BitRateUnit.MegabitPerSecond: return (_value) * 1e6m; + case BitRateUnit.MegabytePerSecond: return (_value*8m) * 1e6m; + case BitRateUnit.PebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PetabitPerSecond: return (_value) * 1e15m; + case BitRateUnit.PetabytePerSecond: return (_value*8m) * 1e15m; + case BitRateUnit.TebibitPerSecond: return (_value) * (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TebibytePerSecond: return (_value*8m) * (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TerabitPerSecond: return (_value) * 1e12m; + case BitRateUnit.TerabytePerSecond: return (_value*8m) * 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private decimal AsBaseNumericType(BitRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case BitRateUnit.BitPerSecond: return baseUnitValue; + case BitRateUnit.BytePerSecond: return baseUnitValue/8m; + case BitRateUnit.ExabitPerSecond: return (baseUnitValue) / 1e18m; + case BitRateUnit.ExabytePerSecond: return (baseUnitValue/8m) / 1e18m; + case BitRateUnit.ExbibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.ExbibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.GibibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024); + case BitRateUnit.GibibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024); + case BitRateUnit.GigabitPerSecond: return (baseUnitValue) / 1e9m; + case BitRateUnit.GigabytePerSecond: return (baseUnitValue/8m) / 1e9m; + case BitRateUnit.KibibitPerSecond: return (baseUnitValue) / 1024m; + case BitRateUnit.KibibytePerSecond: return (baseUnitValue/8m) / 1024m; + case BitRateUnit.KilobitPerSecond: return (baseUnitValue) / 1e3m; + case BitRateUnit.KilobytePerSecond: return (baseUnitValue/8m) / 1e3m; + case BitRateUnit.MebibitPerSecond: return (baseUnitValue) / (1024m * 1024); + case BitRateUnit.MebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024); + case BitRateUnit.MegabitPerSecond: return (baseUnitValue) / 1e6m; + case BitRateUnit.MegabytePerSecond: return (baseUnitValue/8m) / 1e6m; + case BitRateUnit.PebibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024 * 1024); + case BitRateUnit.PetabitPerSecond: return (baseUnitValue) / 1e15m; + case BitRateUnit.PetabytePerSecond: return (baseUnitValue/8m) / 1e15m; + case BitRateUnit.TebibitPerSecond: return (baseUnitValue) / (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TebibytePerSecond: return (baseUnitValue/8m) / (1024m * 1024 * 1024 * 1024); + case BitRateUnit.TerabitPerSecond: return (baseUnitValue) / 1e12m; + case BitRateUnit.TerabytePerSecond: return (baseUnitValue/8m) / 1e12m; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs new file mode 100644 index 0000000000..167b27987d --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. + /// + public partial struct BrakeSpecificFuelConsumption : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly BrakeSpecificFuelConsumptionUnit? _unit; + + static BrakeSpecificFuelConsumption() + { + BaseDimensions = new BaseDimensions(-2, 0, 2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsumptionUnit unit) + { + if(unit == BrakeSpecificFuelConsumptionUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of BrakeSpecificFuelConsumption, which is KilogramPerJoule. All conversions go via this value. + /// + public static BrakeSpecificFuelConsumptionUnit BaseUnit => BrakeSpecificFuelConsumptionUnit.KilogramPerJoule; + + /// + /// Represents the largest possible value of BrakeSpecificFuelConsumption + /// + public static BrakeSpecificFuelConsumption MaxValue => new BrakeSpecificFuelConsumption(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of BrakeSpecificFuelConsumption + /// + public static BrakeSpecificFuelConsumption MinValue => new BrakeSpecificFuelConsumption(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.BrakeSpecificFuelConsumption; + + /// + /// All units of measurement for the BrakeSpecificFuelConsumption quantity. + /// + public static BrakeSpecificFuelConsumptionUnit[] Units { get; } = Enum.GetValues(typeof(BrakeSpecificFuelConsumptionUnit)).Cast().Except(new BrakeSpecificFuelConsumptionUnit[]{ BrakeSpecificFuelConsumptionUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerJoule. + /// + public static BrakeSpecificFuelConsumption Zero => new BrakeSpecificFuelConsumption(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public BrakeSpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => BrakeSpecificFuelConsumption.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => BrakeSpecificFuelConsumption.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get BrakeSpecificFuelConsumption in GramsPerKiloWattHour. + /// + public double GramsPerKiloWattHour => As(BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); + + /// + /// Get BrakeSpecificFuelConsumption in KilogramsPerJoule. + /// + public double KilogramsPerJoule => As(BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); + + /// + /// Get BrakeSpecificFuelConsumption in PoundsPerMechanicalHorsepowerHour. + /// + public double PoundsPerMechanicalHorsepowerHour => As(BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(BrakeSpecificFuelConsumptionUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get BrakeSpecificFuelConsumption from GramsPerKiloWattHour. + /// + /// If value is NaN or Infinity. + public static BrakeSpecificFuelConsumption FromGramsPerKiloWattHour(QuantityValue gramsperkilowatthour) + { + double value = (double) gramsperkilowatthour; + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour); + } + /// + /// Get BrakeSpecificFuelConsumption from KilogramsPerJoule. + /// + /// If value is NaN or Infinity. + public static BrakeSpecificFuelConsumption FromKilogramsPerJoule(QuantityValue kilogramsperjoule) + { + double value = (double) kilogramsperjoule; + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.KilogramPerJoule); + } + /// + /// Get BrakeSpecificFuelConsumption from PoundsPerMechanicalHorsepowerHour. + /// + /// If value is NaN or Infinity. + public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour(QuantityValue poundspermechanicalhorsepowerhour) + { + double value = (double) poundspermechanicalhorsepowerhour; + return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); + } + + /// + /// 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 new BrakeSpecificFuelConsumption((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static BrakeSpecificFuelConsumption Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static BrakeSpecificFuelConsumption Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out BrakeSpecificFuelConsumption result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out BrakeSpecificFuelConsumption result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static BrakeSpecificFuelConsumptionUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out BrakeSpecificFuelConsumptionUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeSpecificFuelConsumptionUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is BrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); + + return CompareTo((BrakeSpecificFuelConsumption)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(BrakeSpecificFuelConsumption other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another BrakeSpecificFuelConsumption within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current BrakeSpecificFuelConsumption. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(BrakeSpecificFuelConsumptionUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this BrakeSpecificFuelConsumption to another BrakeSpecificFuelConsumption with the unit representation . + /// + /// A BrakeSpecificFuelConsumption with the specified unit. + public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new BrakeSpecificFuelConsumption(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return _value/3.6e9; + case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return _value; + case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return _value*1.689659410672e-7; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(BrakeSpecificFuelConsumptionUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour: return baseUnitValue*3.6e9; + case BrakeSpecificFuelConsumptionUnit.KilogramPerJoule: return baseUnitValue; + case BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour: return baseUnitValue/1.689659410672e-7; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs new file mode 100644 index 0000000000..55ac3cd742 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Capacitance is the ability of a body to store an electric charge. + /// + /// + /// https://en.wikipedia.org/wiki/Capacitance + /// + public partial struct Capacitance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly CapacitanceUnit? _unit; + + static Capacitance() + { + BaseDimensions = new BaseDimensions(-2, -1, 4, 2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Capacitance(double numericValue, CapacitanceUnit unit) + { + if(unit == CapacitanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Capacitance, which is Farad. All conversions go via this value. + /// + public static CapacitanceUnit BaseUnit => CapacitanceUnit.Farad; + + /// + /// Represents the largest possible value of Capacitance + /// + public static Capacitance MaxValue => new Capacitance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Capacitance + /// + public static Capacitance MinValue => new Capacitance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Capacitance; + + /// + /// All units of measurement for the Capacitance quantity. + /// + public static CapacitanceUnit[] Units { get; } = Enum.GetValues(typeof(CapacitanceUnit)).Cast().Except(new CapacitanceUnit[]{ CapacitanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Farad. + /// + public static Capacitance Zero => new Capacitance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public CapacitanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Capacitance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Capacitance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Capacitance in Farads. + /// + public double Farads => As(CapacitanceUnit.Farad); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(CapacitanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(CapacitanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Capacitance from Farads. + /// + /// If value is NaN or Infinity. + public static Capacitance FromFarads(QuantityValue farads) + { + double value = (double) farads; + return new Capacitance(value, CapacitanceUnit.Farad); + } + + /// + /// 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 new Capacitance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Capacitance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Capacitance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Capacitance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Capacitance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static CapacitanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static CapacitanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out CapacitanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out CapacitanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Capacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); + + return CompareTo((Capacitance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Capacitance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Capacitance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Capacitance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Capacitance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(CapacitanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Capacitance to another Capacitance with the unit representation . + /// + /// A Capacitance with the specified unit. + public Capacitance ToUnit(CapacitanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Capacitance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case CapacitanceUnit.Farad: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(CapacitanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case CapacitanceUnit.Farad: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs new file mode 100644 index 0000000000..d27cca70a7 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A unit that represents a fractional change in size in response to a change in temperature. + /// + public partial struct CoefficientOfThermalExpansion : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly CoefficientOfThermalExpansionUnit? _unit; + + static CoefficientOfThermalExpansion() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, -1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public CoefficientOfThermalExpansion(double numericValue, CoefficientOfThermalExpansionUnit unit) + { + if(unit == CoefficientOfThermalExpansionUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of CoefficientOfThermalExpansion, which is InverseKelvin. All conversions go via this value. + /// + public static CoefficientOfThermalExpansionUnit BaseUnit => CoefficientOfThermalExpansionUnit.InverseKelvin; + + /// + /// Represents the largest possible value of CoefficientOfThermalExpansion + /// + public static CoefficientOfThermalExpansion MaxValue => new CoefficientOfThermalExpansion(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of CoefficientOfThermalExpansion + /// + public static CoefficientOfThermalExpansion MinValue => new CoefficientOfThermalExpansion(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.CoefficientOfThermalExpansion; + + /// + /// All units of measurement for the CoefficientOfThermalExpansion quantity. + /// + public static CoefficientOfThermalExpansionUnit[] Units { get; } = Enum.GetValues(typeof(CoefficientOfThermalExpansionUnit)).Cast().Except(new CoefficientOfThermalExpansionUnit[]{ CoefficientOfThermalExpansionUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit InverseKelvin. + /// + public static CoefficientOfThermalExpansion Zero => new CoefficientOfThermalExpansion(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public CoefficientOfThermalExpansionUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => CoefficientOfThermalExpansion.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => CoefficientOfThermalExpansion.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get CoefficientOfThermalExpansion in InverseDegreeCelsius. + /// + public double InverseDegreeCelsius => As(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); + + /// + /// Get CoefficientOfThermalExpansion in InverseDegreeFahrenheit. + /// + public double InverseDegreeFahrenheit => As(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); + + /// + /// Get CoefficientOfThermalExpansion in InverseKelvin. + /// + public double InverseKelvin => As(CoefficientOfThermalExpansionUnit.InverseKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get CoefficientOfThermalExpansion from InverseDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static CoefficientOfThermalExpansion FromInverseDegreeCelsius(QuantityValue inversedegreecelsius) + { + double value = (double) inversedegreecelsius; + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius); + } + /// + /// Get CoefficientOfThermalExpansion from InverseDegreeFahrenheit. + /// + /// If value is NaN or Infinity. + public static CoefficientOfThermalExpansion FromInverseDegreeFahrenheit(QuantityValue inversedegreefahrenheit) + { + double value = (double) inversedegreefahrenheit; + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit); + } + /// + /// Get CoefficientOfThermalExpansion from InverseKelvin. + /// + /// If value is NaN or Infinity. + public static CoefficientOfThermalExpansion FromInverseKelvin(QuantityValue inversekelvin) + { + double value = (double) inversekelvin; + return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// CoefficientOfThermalExpansion unit value. + public static CoefficientOfThermalExpansion From(QuantityValue value, CoefficientOfThermalExpansionUnit fromUnit) + { + return new CoefficientOfThermalExpansion((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static CoefficientOfThermalExpansion Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static CoefficientOfThermalExpansion Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out CoefficientOfThermalExpansion result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out CoefficientOfThermalExpansion result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static CoefficientOfThermalExpansionUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static CoefficientOfThermalExpansionUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out CoefficientOfThermalExpansionUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out CoefficientOfThermalExpansionUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Arithmetic Operators + + public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion right) + { + return new CoefficientOfThermalExpansion(-right.Value, right.Unit); + } + + public static CoefficientOfThermalExpansion operator +(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return new CoefficientOfThermalExpansion(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static CoefficientOfThermalExpansion operator -(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return new CoefficientOfThermalExpansion(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static CoefficientOfThermalExpansion operator *(double left, CoefficientOfThermalExpansion right) + { + return new CoefficientOfThermalExpansion(left * right.Value, right.Unit); + } + + public static CoefficientOfThermalExpansion operator *(CoefficientOfThermalExpansion left, double right) + { + return new CoefficientOfThermalExpansion(left.Value * right, left.Unit); + } + + public static CoefficientOfThermalExpansion operator /(CoefficientOfThermalExpansion left, double right) + { + return new CoefficientOfThermalExpansion(left.Value / right, left.Unit); + } + + public static double operator /(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return left.InverseKelvin / right.InverseKelvin; + } + + #endregion + + #region Equality / IComparable + + public static bool operator <=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is CoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); + + return CompareTo((CoefficientOfThermalExpansion)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(CoefficientOfThermalExpansion other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another CoefficientOfThermalExpansion within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current CoefficientOfThermalExpansion. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(CoefficientOfThermalExpansionUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this CoefficientOfThermalExpansion to another CoefficientOfThermalExpansion with the unit representation . + /// + /// A CoefficientOfThermalExpansion with the specified unit. + public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new CoefficientOfThermalExpansion(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return _value; + case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return _value*5/9; + case CoefficientOfThermalExpansionUnit.InverseKelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(CoefficientOfThermalExpansionUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return baseUnitValue; + case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return baseUnitValue*9/5; + case CoefficientOfThermalExpansionUnit.InverseKelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs new file mode 100644 index 0000000000..79b9788d67 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -0,0 +1,1195 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The density, or more precisely, the volumetric mass density, of a substance is its mass per unit volume. + /// + /// + /// http://en.wikipedia.org/wiki/Density + /// + public partial struct Density : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly DensityUnit? _unit; + + static Density() + { + BaseDimensions = new BaseDimensions(-3, 1, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Density(double numericValue, DensityUnit unit) + { + if(unit == DensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Density, which is KilogramPerCubicMeter. All conversions go via this value. + /// + public static DensityUnit BaseUnit => DensityUnit.KilogramPerCubicMeter; + + /// + /// Represents the largest possible value of Density + /// + public static Density MaxValue => new Density(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Density + /// + public static Density MinValue => new Density(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Density; + + /// + /// All units of measurement for the Density quantity. + /// + public static DensityUnit[] Units { get; } = Enum.GetValues(typeof(DensityUnit)).Cast().Except(new DensityUnit[]{ DensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerCubicMeter. + /// + public static Density Zero => new Density(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public DensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Density.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Density.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Density in CentigramsPerDeciLiter. + /// + public double CentigramsPerDeciLiter => As(DensityUnit.CentigramPerDeciliter); + + /// + /// Get Density in CentigramsPerLiter. + /// + public double CentigramsPerLiter => As(DensityUnit.CentigramPerLiter); + + /// + /// Get Density in CentigramsPerMilliliter. + /// + public double CentigramsPerMilliliter => As(DensityUnit.CentigramPerMilliliter); + + /// + /// Get Density in DecigramsPerDeciLiter. + /// + public double DecigramsPerDeciLiter => As(DensityUnit.DecigramPerDeciliter); + + /// + /// Get Density in DecigramsPerLiter. + /// + public double DecigramsPerLiter => As(DensityUnit.DecigramPerLiter); + + /// + /// Get Density in DecigramsPerMilliliter. + /// + public double DecigramsPerMilliliter => As(DensityUnit.DecigramPerMilliliter); + + /// + /// Get Density in GramsPerCubicCentimeter. + /// + public double GramsPerCubicCentimeter => As(DensityUnit.GramPerCubicCentimeter); + + /// + /// Get Density in GramsPerCubicMeter. + /// + public double GramsPerCubicMeter => As(DensityUnit.GramPerCubicMeter); + + /// + /// Get Density in GramsPerCubicMillimeter. + /// + public double GramsPerCubicMillimeter => As(DensityUnit.GramPerCubicMillimeter); + + /// + /// Get Density in GramsPerDeciLiter. + /// + public double GramsPerDeciLiter => As(DensityUnit.GramPerDeciliter); + + /// + /// Get Density in GramsPerLiter. + /// + public double GramsPerLiter => As(DensityUnit.GramPerLiter); + + /// + /// Get Density in GramsPerMilliliter. + /// + public double GramsPerMilliliter => As(DensityUnit.GramPerMilliliter); + + /// + /// Get Density in KilogramsPerCubicCentimeter. + /// + public double KilogramsPerCubicCentimeter => As(DensityUnit.KilogramPerCubicCentimeter); + + /// + /// Get Density in KilogramsPerCubicMeter. + /// + public double KilogramsPerCubicMeter => As(DensityUnit.KilogramPerCubicMeter); + + /// + /// Get Density in KilogramsPerCubicMillimeter. + /// + public double KilogramsPerCubicMillimeter => As(DensityUnit.KilogramPerCubicMillimeter); + + /// + /// Get Density in KilopoundsPerCubicFoot. + /// + public double KilopoundsPerCubicFoot => As(DensityUnit.KilopoundPerCubicFoot); + + /// + /// Get Density in KilopoundsPerCubicInch. + /// + public double KilopoundsPerCubicInch => As(DensityUnit.KilopoundPerCubicInch); + + /// + /// Get Density in MicrogramsPerDeciLiter. + /// + public double MicrogramsPerDeciLiter => As(DensityUnit.MicrogramPerDeciliter); + + /// + /// Get Density in MicrogramsPerLiter. + /// + public double MicrogramsPerLiter => As(DensityUnit.MicrogramPerLiter); + + /// + /// Get Density in MicrogramsPerMilliliter. + /// + public double MicrogramsPerMilliliter => As(DensityUnit.MicrogramPerMilliliter); + + /// + /// Get Density in MilligramsPerCubicMeter. + /// + public double MilligramsPerCubicMeter => As(DensityUnit.MilligramPerCubicMeter); + + /// + /// Get Density in MilligramsPerDeciLiter. + /// + public double MilligramsPerDeciLiter => As(DensityUnit.MilligramPerDeciliter); + + /// + /// Get Density in MilligramsPerLiter. + /// + public double MilligramsPerLiter => As(DensityUnit.MilligramPerLiter); + + /// + /// Get Density in MilligramsPerMilliliter. + /// + public double MilligramsPerMilliliter => As(DensityUnit.MilligramPerMilliliter); + + /// + /// Get Density in NanogramsPerDeciLiter. + /// + public double NanogramsPerDeciLiter => As(DensityUnit.NanogramPerDeciliter); + + /// + /// Get Density in NanogramsPerLiter. + /// + public double NanogramsPerLiter => As(DensityUnit.NanogramPerLiter); + + /// + /// Get Density in NanogramsPerMilliliter. + /// + public double NanogramsPerMilliliter => As(DensityUnit.NanogramPerMilliliter); + + /// + /// Get Density in PicogramsPerDeciLiter. + /// + public double PicogramsPerDeciLiter => As(DensityUnit.PicogramPerDeciliter); + + /// + /// Get Density in PicogramsPerLiter. + /// + public double PicogramsPerLiter => As(DensityUnit.PicogramPerLiter); + + /// + /// Get Density in PicogramsPerMilliliter. + /// + public double PicogramsPerMilliliter => As(DensityUnit.PicogramPerMilliliter); + + /// + /// Get Density in PoundsPerCubicFoot. + /// + public double PoundsPerCubicFoot => As(DensityUnit.PoundPerCubicFoot); + + /// + /// Get Density in PoundsPerCubicInch. + /// + public double PoundsPerCubicInch => As(DensityUnit.PoundPerCubicInch); + + /// + /// Get Density in PoundsPerImperialGallon. + /// + public double PoundsPerImperialGallon => As(DensityUnit.PoundPerImperialGallon); + + /// + /// Get Density in PoundsPerUSGallon. + /// + public double PoundsPerUSGallon => As(DensityUnit.PoundPerUSGallon); + + /// + /// Get Density in SlugsPerCubicFoot. + /// + public double SlugsPerCubicFoot => As(DensityUnit.SlugPerCubicFoot); + + /// + /// Get Density in TonnesPerCubicCentimeter. + /// + public double TonnesPerCubicCentimeter => As(DensityUnit.TonnePerCubicCentimeter); + + /// + /// Get Density in TonnesPerCubicMeter. + /// + public double TonnesPerCubicMeter => As(DensityUnit.TonnePerCubicMeter); + + /// + /// Get Density in TonnesPerCubicMillimeter. + /// + public double TonnesPerCubicMillimeter => As(DensityUnit.TonnePerCubicMillimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(DensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(DensityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Density from CentigramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + public static Density FromCentigramsPerDeciLiter(QuantityValue centigramsperdeciliter) + { + double value = (double) centigramsperdeciliter; + return new Density(value, DensityUnit.CentigramPerDeciliter); + } + /// + /// Get Density from CentigramsPerLiter. + /// + /// If value is NaN or Infinity. + public static Density FromCentigramsPerLiter(QuantityValue centigramsperliter) + { + double value = (double) centigramsperliter; + return new Density(value, DensityUnit.CentigramPerLiter); + } + /// + /// Get Density from CentigramsPerMilliliter. + /// + /// If value is NaN or Infinity. + public static Density FromCentigramsPerMilliliter(QuantityValue centigramspermilliliter) + { + double value = (double) centigramspermilliliter; + return new Density(value, DensityUnit.CentigramPerMilliliter); + } + /// + /// Get Density from DecigramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + public static Density FromDecigramsPerDeciLiter(QuantityValue decigramsperdeciliter) + { + double value = (double) decigramsperdeciliter; + return new Density(value, DensityUnit.DecigramPerDeciliter); + } + /// + /// Get Density from DecigramsPerLiter. + /// + /// If value is NaN or Infinity. + public static Density FromDecigramsPerLiter(QuantityValue decigramsperliter) + { + double value = (double) decigramsperliter; + return new Density(value, DensityUnit.DecigramPerLiter); + } + /// + /// Get Density from DecigramsPerMilliliter. + /// + /// If value is NaN or Infinity. + public static Density FromDecigramsPerMilliliter(QuantityValue decigramspermilliliter) + { + double value = (double) decigramspermilliliter; + return new Density(value, DensityUnit.DecigramPerMilliliter); + } + /// + /// Get Density from GramsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + public static Density FromGramsPerCubicCentimeter(QuantityValue gramspercubiccentimeter) + { + double value = (double) gramspercubiccentimeter; + return new Density(value, DensityUnit.GramPerCubicCentimeter); + } + /// + /// Get Density from GramsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static Density FromGramsPerCubicMeter(QuantityValue gramspercubicmeter) + { + double value = (double) gramspercubicmeter; + return new Density(value, DensityUnit.GramPerCubicMeter); + } + /// + /// Get Density from GramsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + public static Density FromGramsPerCubicMillimeter(QuantityValue gramspercubicmillimeter) + { + double value = (double) gramspercubicmillimeter; + return new Density(value, DensityUnit.GramPerCubicMillimeter); + } + /// + /// Get Density from GramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + public static Density FromGramsPerDeciLiter(QuantityValue gramsperdeciliter) + { + double value = (double) gramsperdeciliter; + return new Density(value, DensityUnit.GramPerDeciliter); + } + /// + /// Get Density from GramsPerLiter. + /// + /// If value is NaN or Infinity. + public static Density FromGramsPerLiter(QuantityValue gramsperliter) + { + double value = (double) gramsperliter; + return new Density(value, DensityUnit.GramPerLiter); + } + /// + /// Get Density from GramsPerMilliliter. + /// + /// If value is NaN or Infinity. + public static Density FromGramsPerMilliliter(QuantityValue gramspermilliliter) + { + double value = (double) gramspermilliliter; + return new Density(value, DensityUnit.GramPerMilliliter); + } + /// + /// Get Density from KilogramsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + public static Density FromKilogramsPerCubicCentimeter(QuantityValue kilogramspercubiccentimeter) + { + double value = (double) kilogramspercubiccentimeter; + return new Density(value, DensityUnit.KilogramPerCubicCentimeter); + } + /// + /// Get Density from KilogramsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static Density FromKilogramsPerCubicMeter(QuantityValue kilogramspercubicmeter) + { + double value = (double) kilogramspercubicmeter; + return new Density(value, DensityUnit.KilogramPerCubicMeter); + } + /// + /// Get Density from KilogramsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + public static Density FromKilogramsPerCubicMillimeter(QuantityValue kilogramspercubicmillimeter) + { + double value = (double) kilogramspercubicmillimeter; + return new Density(value, DensityUnit.KilogramPerCubicMillimeter); + } + /// + /// Get Density from KilopoundsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static Density FromKilopoundsPerCubicFoot(QuantityValue kilopoundspercubicfoot) + { + double value = (double) kilopoundspercubicfoot; + return new Density(value, DensityUnit.KilopoundPerCubicFoot); + } + /// + /// Get Density from KilopoundsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static Density FromKilopoundsPerCubicInch(QuantityValue kilopoundspercubicinch) + { + double value = (double) kilopoundspercubicinch; + return new Density(value, DensityUnit.KilopoundPerCubicInch); + } + /// + /// Get Density from MicrogramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + public static Density FromMicrogramsPerDeciLiter(QuantityValue microgramsperdeciliter) + { + double value = (double) microgramsperdeciliter; + return new Density(value, DensityUnit.MicrogramPerDeciliter); + } + /// + /// Get Density from MicrogramsPerLiter. + /// + /// If value is NaN or Infinity. + public static Density FromMicrogramsPerLiter(QuantityValue microgramsperliter) + { + double value = (double) microgramsperliter; + return new Density(value, DensityUnit.MicrogramPerLiter); + } + /// + /// Get Density from MicrogramsPerMilliliter. + /// + /// If value is NaN or Infinity. + public static Density FromMicrogramsPerMilliliter(QuantityValue microgramspermilliliter) + { + double value = (double) microgramspermilliliter; + return new Density(value, DensityUnit.MicrogramPerMilliliter); + } + /// + /// Get Density from MilligramsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static Density FromMilligramsPerCubicMeter(QuantityValue milligramspercubicmeter) + { + double value = (double) milligramspercubicmeter; + return new Density(value, DensityUnit.MilligramPerCubicMeter); + } + /// + /// Get Density from MilligramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + public static Density FromMilligramsPerDeciLiter(QuantityValue milligramsperdeciliter) + { + double value = (double) milligramsperdeciliter; + return new Density(value, DensityUnit.MilligramPerDeciliter); + } + /// + /// Get Density from MilligramsPerLiter. + /// + /// If value is NaN or Infinity. + public static Density FromMilligramsPerLiter(QuantityValue milligramsperliter) + { + double value = (double) milligramsperliter; + return new Density(value, DensityUnit.MilligramPerLiter); + } + /// + /// Get Density from MilligramsPerMilliliter. + /// + /// If value is NaN or Infinity. + public static Density FromMilligramsPerMilliliter(QuantityValue milligramspermilliliter) + { + double value = (double) milligramspermilliliter; + return new Density(value, DensityUnit.MilligramPerMilliliter); + } + /// + /// Get Density from NanogramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + public static Density FromNanogramsPerDeciLiter(QuantityValue nanogramsperdeciliter) + { + double value = (double) nanogramsperdeciliter; + return new Density(value, DensityUnit.NanogramPerDeciliter); + } + /// + /// Get Density from NanogramsPerLiter. + /// + /// If value is NaN or Infinity. + public static Density FromNanogramsPerLiter(QuantityValue nanogramsperliter) + { + double value = (double) nanogramsperliter; + return new Density(value, DensityUnit.NanogramPerLiter); + } + /// + /// Get Density from NanogramsPerMilliliter. + /// + /// If value is NaN or Infinity. + public static Density FromNanogramsPerMilliliter(QuantityValue nanogramspermilliliter) + { + double value = (double) nanogramspermilliliter; + return new Density(value, DensityUnit.NanogramPerMilliliter); + } + /// + /// Get Density from PicogramsPerDeciLiter. + /// + /// If value is NaN or Infinity. + public static Density FromPicogramsPerDeciLiter(QuantityValue picogramsperdeciliter) + { + double value = (double) picogramsperdeciliter; + return new Density(value, DensityUnit.PicogramPerDeciliter); + } + /// + /// Get Density from PicogramsPerLiter. + /// + /// If value is NaN or Infinity. + public static Density FromPicogramsPerLiter(QuantityValue picogramsperliter) + { + double value = (double) picogramsperliter; + return new Density(value, DensityUnit.PicogramPerLiter); + } + /// + /// Get Density from PicogramsPerMilliliter. + /// + /// If value is NaN or Infinity. + public static Density FromPicogramsPerMilliliter(QuantityValue picogramspermilliliter) + { + double value = (double) picogramspermilliliter; + return new Density(value, DensityUnit.PicogramPerMilliliter); + } + /// + /// Get Density from PoundsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static Density FromPoundsPerCubicFoot(QuantityValue poundspercubicfoot) + { + double value = (double) poundspercubicfoot; + return new Density(value, DensityUnit.PoundPerCubicFoot); + } + /// + /// Get Density from PoundsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static Density FromPoundsPerCubicInch(QuantityValue poundspercubicinch) + { + double value = (double) poundspercubicinch; + return new Density(value, DensityUnit.PoundPerCubicInch); + } + /// + /// Get Density from PoundsPerImperialGallon. + /// + /// If value is NaN or Infinity. + public static Density FromPoundsPerImperialGallon(QuantityValue poundsperimperialgallon) + { + double value = (double) poundsperimperialgallon; + return new Density(value, DensityUnit.PoundPerImperialGallon); + } + /// + /// Get Density from PoundsPerUSGallon. + /// + /// If value is NaN or Infinity. + public static Density FromPoundsPerUSGallon(QuantityValue poundsperusgallon) + { + double value = (double) poundsperusgallon; + return new Density(value, DensityUnit.PoundPerUSGallon); + } + /// + /// Get Density from SlugsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static Density FromSlugsPerCubicFoot(QuantityValue slugspercubicfoot) + { + double value = (double) slugspercubicfoot; + return new Density(value, DensityUnit.SlugPerCubicFoot); + } + /// + /// Get Density from TonnesPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + public static Density FromTonnesPerCubicCentimeter(QuantityValue tonnespercubiccentimeter) + { + double value = (double) tonnespercubiccentimeter; + return new Density(value, DensityUnit.TonnePerCubicCentimeter); + } + /// + /// Get Density from TonnesPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static Density FromTonnesPerCubicMeter(QuantityValue tonnespercubicmeter) + { + double value = (double) tonnespercubicmeter; + return new Density(value, DensityUnit.TonnePerCubicMeter); + } + /// + /// Get Density from TonnesPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + public static Density FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicmillimeter) + { + double value = (double) tonnespercubicmillimeter; + return new Density(value, DensityUnit.TonnePerCubicMillimeter); + } + + /// + /// 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 new Density((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Density Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Density Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Density result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Density result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static DensityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out DensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out DensityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Density)) throw new ArgumentException("Expected type Density.", nameof(obj)); + + return CompareTo((Density)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Density other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Density within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Density other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Density. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(DensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Density to another Density with the unit representation . + /// + /// A Density with the specified unit. + public Density ToUnit(DensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Density(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case DensityUnit.CentigramPerDeciliter: return (_value/1e-1) * 1e-2d; + case DensityUnit.CentigramPerLiter: return (_value/1) * 1e-2d; + case DensityUnit.CentigramPerMilliliter: return (_value/1e-3) * 1e-2d; + case DensityUnit.DecigramPerDeciliter: return (_value/1e-1) * 1e-1d; + case DensityUnit.DecigramPerLiter: return (_value/1) * 1e-1d; + case DensityUnit.DecigramPerMilliliter: return (_value/1e-3) * 1e-1d; + case DensityUnit.GramPerCubicCentimeter: return _value/1e-3; + case DensityUnit.GramPerCubicMeter: return _value/1e3; + case DensityUnit.GramPerCubicMillimeter: return _value/1e-6; + case DensityUnit.GramPerDeciliter: return _value/1e-1; + case DensityUnit.GramPerLiter: return _value/1; + case DensityUnit.GramPerMilliliter: return _value/1e-3; + case DensityUnit.KilogramPerCubicCentimeter: return (_value/1e-3) * 1e3d; + case DensityUnit.KilogramPerCubicMeter: return (_value/1e3) * 1e3d; + case DensityUnit.KilogramPerCubicMillimeter: return (_value/1e-6) * 1e3d; + case DensityUnit.KilopoundPerCubicFoot: return (_value/0.062427961) * 1e3d; + case DensityUnit.KilopoundPerCubicInch: return (_value/3.6127298147753e-5) * 1e3d; + case DensityUnit.MicrogramPerDeciliter: return (_value/1e-1) * 1e-6d; + case DensityUnit.MicrogramPerLiter: return (_value/1) * 1e-6d; + case DensityUnit.MicrogramPerMilliliter: return (_value/1e-3) * 1e-6d; + case DensityUnit.MilligramPerCubicMeter: return (_value/1e3) * 1e-3d; + case DensityUnit.MilligramPerDeciliter: return (_value/1e-1) * 1e-3d; + case DensityUnit.MilligramPerLiter: return (_value/1) * 1e-3d; + case DensityUnit.MilligramPerMilliliter: return (_value/1e-3) * 1e-3d; + case DensityUnit.NanogramPerDeciliter: return (_value/1e-1) * 1e-9d; + case DensityUnit.NanogramPerLiter: return (_value/1) * 1e-9d; + case DensityUnit.NanogramPerMilliliter: return (_value/1e-3) * 1e-9d; + case DensityUnit.PicogramPerDeciliter: return (_value/1e-1) * 1e-12d; + case DensityUnit.PicogramPerLiter: return (_value/1) * 1e-12d; + case DensityUnit.PicogramPerMilliliter: return (_value/1e-3) * 1e-12d; + case DensityUnit.PoundPerCubicFoot: return _value/0.062427961; + case DensityUnit.PoundPerCubicInch: return _value/3.6127298147753e-5; + case DensityUnit.PoundPerImperialGallon: return _value*9.9776398e1; + case DensityUnit.PoundPerUSGallon: return _value*1.19826427e2; + case DensityUnit.SlugPerCubicFoot: return _value*515.378818; + case DensityUnit.TonnePerCubicCentimeter: return _value/1e-9; + case DensityUnit.TonnePerCubicMeter: return _value/0.001; + case DensityUnit.TonnePerCubicMillimeter: return _value/1e-12; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(DensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case DensityUnit.CentigramPerDeciliter: return (baseUnitValue*1e-1) / 1e-2d; + case DensityUnit.CentigramPerLiter: return (baseUnitValue*1) / 1e-2d; + case DensityUnit.CentigramPerMilliliter: return (baseUnitValue*1e-3) / 1e-2d; + case DensityUnit.DecigramPerDeciliter: return (baseUnitValue*1e-1) / 1e-1d; + case DensityUnit.DecigramPerLiter: return (baseUnitValue*1) / 1e-1d; + case DensityUnit.DecigramPerMilliliter: return (baseUnitValue*1e-3) / 1e-1d; + case DensityUnit.GramPerCubicCentimeter: return baseUnitValue*1e-3; + case DensityUnit.GramPerCubicMeter: return baseUnitValue*1e3; + case DensityUnit.GramPerCubicMillimeter: return baseUnitValue*1e-6; + case DensityUnit.GramPerDeciliter: return baseUnitValue*1e-1; + case DensityUnit.GramPerLiter: return baseUnitValue*1; + case DensityUnit.GramPerMilliliter: return baseUnitValue*1e-3; + case DensityUnit.KilogramPerCubicCentimeter: return (baseUnitValue*1e-3) / 1e3d; + case DensityUnit.KilogramPerCubicMeter: return (baseUnitValue*1e3) / 1e3d; + case DensityUnit.KilogramPerCubicMillimeter: return (baseUnitValue*1e-6) / 1e3d; + case DensityUnit.KilopoundPerCubicFoot: return (baseUnitValue*0.062427961) / 1e3d; + case DensityUnit.KilopoundPerCubicInch: return (baseUnitValue*3.6127298147753e-5) / 1e3d; + case DensityUnit.MicrogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-6d; + case DensityUnit.MicrogramPerLiter: return (baseUnitValue*1) / 1e-6d; + case DensityUnit.MicrogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-6d; + case DensityUnit.MilligramPerCubicMeter: return (baseUnitValue*1e3) / 1e-3d; + case DensityUnit.MilligramPerDeciliter: return (baseUnitValue*1e-1) / 1e-3d; + case DensityUnit.MilligramPerLiter: return (baseUnitValue*1) / 1e-3d; + case DensityUnit.MilligramPerMilliliter: return (baseUnitValue*1e-3) / 1e-3d; + case DensityUnit.NanogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-9d; + case DensityUnit.NanogramPerLiter: return (baseUnitValue*1) / 1e-9d; + case DensityUnit.NanogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-9d; + case DensityUnit.PicogramPerDeciliter: return (baseUnitValue*1e-1) / 1e-12d; + case DensityUnit.PicogramPerLiter: return (baseUnitValue*1) / 1e-12d; + case DensityUnit.PicogramPerMilliliter: return (baseUnitValue*1e-3) / 1e-12d; + case DensityUnit.PoundPerCubicFoot: return baseUnitValue*0.062427961; + case DensityUnit.PoundPerCubicInch: return baseUnitValue*3.6127298147753e-5; + case DensityUnit.PoundPerImperialGallon: return baseUnitValue/9.9776398e1; + case DensityUnit.PoundPerUSGallon: return baseUnitValue/1.19826427e2; + case DensityUnit.SlugPerCubicFoot: return baseUnitValue*0.00194032033; + case DensityUnit.TonnePerCubicCentimeter: return baseUnitValue*1e-9; + case DensityUnit.TonnePerCubicMeter: return baseUnitValue*0.001; + case DensityUnit.TonnePerCubicMillimeter: return baseUnitValue*1e-12; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs new file mode 100644 index 0000000000..9d60580fcb --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -0,0 +1,744 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. + /// + public partial struct Duration : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly DurationUnit? _unit; + + static Duration() + { + BaseDimensions = new BaseDimensions(0, 0, 1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Duration(double numericValue, DurationUnit unit) + { + if(unit == DurationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Duration, which is Second. All conversions go via this value. + /// + public static DurationUnit BaseUnit => DurationUnit.Second; + + /// + /// Represents the largest possible value of Duration + /// + public static Duration MaxValue => new Duration(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Duration + /// + public static Duration MinValue => new Duration(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Duration; + + /// + /// All units of measurement for the Duration quantity. + /// + public static DurationUnit[] Units { get; } = Enum.GetValues(typeof(DurationUnit)).Cast().Except(new DurationUnit[]{ DurationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Second. + /// + public static Duration Zero => new Duration(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public DurationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Duration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Duration.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Duration in Days. + /// + public double Days => As(DurationUnit.Day); + + /// + /// Get Duration in Hours. + /// + public double Hours => As(DurationUnit.Hour); + + /// + /// Get Duration in Microseconds. + /// + public double Microseconds => As(DurationUnit.Microsecond); + + /// + /// Get Duration in Milliseconds. + /// + public double Milliseconds => As(DurationUnit.Millisecond); + + /// + /// Get Duration in Minutes. + /// + public double Minutes => As(DurationUnit.Minute); + + /// + /// Get Duration in Months30. + /// + public double Months30 => As(DurationUnit.Month30); + + /// + /// Get Duration in Nanoseconds. + /// + public double Nanoseconds => As(DurationUnit.Nanosecond); + + /// + /// Get Duration in Seconds. + /// + public double Seconds => As(DurationUnit.Second); + + /// + /// Get Duration in Weeks. + /// + public double Weeks => As(DurationUnit.Week); + + /// + /// Get Duration in Years365. + /// + public double Years365 => As(DurationUnit.Year365); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(DurationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(DurationUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Duration from Days. + /// + /// If value is NaN or Infinity. + public static Duration FromDays(QuantityValue days) + { + double value = (double) days; + return new Duration(value, DurationUnit.Day); + } + /// + /// Get Duration from Hours. + /// + /// If value is NaN or Infinity. + public static Duration FromHours(QuantityValue hours) + { + double value = (double) hours; + return new Duration(value, DurationUnit.Hour); + } + /// + /// Get Duration from Microseconds. + /// + /// If value is NaN or Infinity. + public static Duration FromMicroseconds(QuantityValue microseconds) + { + double value = (double) microseconds; + return new Duration(value, DurationUnit.Microsecond); + } + /// + /// Get Duration from Milliseconds. + /// + /// If value is NaN or Infinity. + public static Duration FromMilliseconds(QuantityValue milliseconds) + { + double value = (double) milliseconds; + return new Duration(value, DurationUnit.Millisecond); + } + /// + /// Get Duration from Minutes. + /// + /// If value is NaN or Infinity. + public static Duration FromMinutes(QuantityValue minutes) + { + double value = (double) minutes; + return new Duration(value, DurationUnit.Minute); + } + /// + /// Get Duration from Months30. + /// + /// If value is NaN or Infinity. + public static Duration FromMonths30(QuantityValue months30) + { + double value = (double) months30; + return new Duration(value, DurationUnit.Month30); + } + /// + /// Get Duration from Nanoseconds. + /// + /// If value is NaN or Infinity. + public static Duration FromNanoseconds(QuantityValue nanoseconds) + { + double value = (double) nanoseconds; + return new Duration(value, DurationUnit.Nanosecond); + } + /// + /// Get Duration from Seconds. + /// + /// If value is NaN or Infinity. + public static Duration FromSeconds(QuantityValue seconds) + { + double value = (double) seconds; + return new Duration(value, DurationUnit.Second); + } + /// + /// Get Duration from Weeks. + /// + /// If value is NaN or Infinity. + public static Duration FromWeeks(QuantityValue weeks) + { + double value = (double) weeks; + return new Duration(value, DurationUnit.Week); + } + /// + /// Get Duration from Years365. + /// + /// If value is NaN or Infinity. + public static Duration FromYears365(QuantityValue years365) + { + double value = (double) years365; + return new Duration(value, DurationUnit.Year365); + } + + /// + /// 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 new Duration((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Duration Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Duration Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Duration result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Duration result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DurationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static DurationUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out DurationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out DurationUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Duration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); + + return CompareTo((Duration)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Duration other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Duration within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Duration other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Duration. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(DurationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Duration to another Duration with the unit representation . + /// + /// A Duration with the specified unit. + public Duration ToUnit(DurationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Duration(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case DurationUnit.Day: return _value*24*3600; + case DurationUnit.Hour: return _value*3600; + case DurationUnit.Microsecond: return (_value) * 1e-6d; + case DurationUnit.Millisecond: return (_value) * 1e-3d; + case DurationUnit.Minute: return _value*60; + case DurationUnit.Month30: return _value*30*24*3600; + case DurationUnit.Nanosecond: return (_value) * 1e-9d; + case DurationUnit.Second: return _value; + case DurationUnit.Week: return _value*7*24*3600; + case DurationUnit.Year365: return _value*365*24*3600; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(DurationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case DurationUnit.Day: return baseUnitValue/(24*3600); + case DurationUnit.Hour: return baseUnitValue/3600; + case DurationUnit.Microsecond: return (baseUnitValue) / 1e-6d; + case DurationUnit.Millisecond: return (baseUnitValue) / 1e-3d; + case DurationUnit.Minute: return baseUnitValue/60; + case DurationUnit.Month30: return baseUnitValue/(30*24*3600); + case DurationUnit.Nanosecond: return (baseUnitValue) / 1e-9d; + case DurationUnit.Second: return baseUnitValue; + case DurationUnit.Week: return baseUnitValue/(7*24*3600); + case DurationUnit.Year365: return baseUnitValue/(365*24*3600); + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs new file mode 100644 index 0000000000..f92c2d2e61 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -0,0 +1,683 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The dynamic (shear) viscosity of a fluid expresses its resistance to shearing flows, where adjacent layers move parallel to each other with different speeds + /// + /// + /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity + /// + public partial struct DynamicViscosity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly DynamicViscosityUnit? _unit; + + static DynamicViscosity() + { + BaseDimensions = new BaseDimensions(-1, 1, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public DynamicViscosity(double numericValue, DynamicViscosityUnit unit) + { + if(unit == DynamicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of DynamicViscosity, which is NewtonSecondPerMeterSquared. All conversions go via this value. + /// + public static DynamicViscosityUnit BaseUnit => DynamicViscosityUnit.NewtonSecondPerMeterSquared; + + /// + /// Represents the largest possible value of DynamicViscosity + /// + public static DynamicViscosity MaxValue => new DynamicViscosity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of DynamicViscosity + /// + public static DynamicViscosity MinValue => new DynamicViscosity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.DynamicViscosity; + + /// + /// All units of measurement for the DynamicViscosity quantity. + /// + public static DynamicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(DynamicViscosityUnit)).Cast().Except(new DynamicViscosityUnit[]{ DynamicViscosityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared. + /// + public static DynamicViscosity Zero => new DynamicViscosity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public DynamicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => DynamicViscosity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => DynamicViscosity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get DynamicViscosity in Centipoise. + /// + public double Centipoise => As(DynamicViscosityUnit.Centipoise); + + /// + /// Get DynamicViscosity in MicropascalSeconds. + /// + public double MicropascalSeconds => As(DynamicViscosityUnit.MicropascalSecond); + + /// + /// Get DynamicViscosity in MillipascalSeconds. + /// + public double MillipascalSeconds => As(DynamicViscosityUnit.MillipascalSecond); + + /// + /// Get DynamicViscosity in NewtonSecondsPerMeterSquared. + /// + public double NewtonSecondsPerMeterSquared => As(DynamicViscosityUnit.NewtonSecondPerMeterSquared); + + /// + /// Get DynamicViscosity in PascalSeconds. + /// + public double PascalSeconds => As(DynamicViscosityUnit.PascalSecond); + + /// + /// Get DynamicViscosity in Poise. + /// + public double Poise => As(DynamicViscosityUnit.Poise); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(DynamicViscosityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(DynamicViscosityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get DynamicViscosity from Centipoise. + /// + /// If value is NaN or Infinity. + public static DynamicViscosity FromCentipoise(QuantityValue centipoise) + { + double value = (double) centipoise; + return new DynamicViscosity(value, DynamicViscosityUnit.Centipoise); + } + /// + /// Get DynamicViscosity from MicropascalSeconds. + /// + /// If value is NaN or Infinity. + public static DynamicViscosity FromMicropascalSeconds(QuantityValue micropascalseconds) + { + double value = (double) micropascalseconds; + return new DynamicViscosity(value, DynamicViscosityUnit.MicropascalSecond); + } + /// + /// Get DynamicViscosity from MillipascalSeconds. + /// + /// If value is NaN or Infinity. + public static DynamicViscosity FromMillipascalSeconds(QuantityValue millipascalseconds) + { + double value = (double) millipascalseconds; + return new DynamicViscosity(value, DynamicViscosityUnit.MillipascalSecond); + } + /// + /// Get DynamicViscosity from NewtonSecondsPerMeterSquared. + /// + /// If value is NaN or Infinity. + public static DynamicViscosity FromNewtonSecondsPerMeterSquared(QuantityValue newtonsecondspermetersquared) + { + double value = (double) newtonsecondspermetersquared; + return new DynamicViscosity(value, DynamicViscosityUnit.NewtonSecondPerMeterSquared); + } + /// + /// Get DynamicViscosity from PascalSeconds. + /// + /// If value is NaN or Infinity. + public static DynamicViscosity FromPascalSeconds(QuantityValue pascalseconds) + { + double value = (double) pascalseconds; + return new DynamicViscosity(value, DynamicViscosityUnit.PascalSecond); + } + /// + /// Get DynamicViscosity from Poise. + /// + /// If value is NaN or Infinity. + public static DynamicViscosity FromPoise(QuantityValue poise) + { + double value = (double) poise; + return new DynamicViscosity(value, DynamicViscosityUnit.Poise); + } + + /// + /// 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 new DynamicViscosity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static DynamicViscosity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static DynamicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out DynamicViscosity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out DynamicViscosity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static DynamicViscosityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static DynamicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out DynamicViscosityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out DynamicViscosityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is DynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); + + return CompareTo((DynamicViscosity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(DynamicViscosity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another DynamicViscosity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current DynamicViscosity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(DynamicViscosityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this DynamicViscosity to another DynamicViscosity with the unit representation . + /// + /// A DynamicViscosity with the specified unit. + public DynamicViscosity ToUnit(DynamicViscosityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new DynamicViscosity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case DynamicViscosityUnit.Centipoise: return (_value/10) * 1e-2d; + case DynamicViscosityUnit.MicropascalSecond: return (_value) * 1e-6d; + case DynamicViscosityUnit.MillipascalSecond: return (_value) * 1e-3d; + case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return _value; + case DynamicViscosityUnit.PascalSecond: return _value; + case DynamicViscosityUnit.Poise: return _value/10; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(DynamicViscosityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case DynamicViscosityUnit.Centipoise: return (baseUnitValue*10) / 1e-2d; + case DynamicViscosityUnit.MicropascalSecond: return (baseUnitValue) / 1e-6d; + case DynamicViscosityUnit.MillipascalSecond: return (baseUnitValue) / 1e-3d; + case DynamicViscosityUnit.NewtonSecondPerMeterSquared: return baseUnitValue; + case DynamicViscosityUnit.PascalSecond: return baseUnitValue; + case DynamicViscosityUnit.Poise: return baseUnitValue*10; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs new file mode 100644 index 0000000000..56c568d5aa --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -0,0 +1,648 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). + /// + public partial struct ElectricAdmittance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricAdmittanceUnit? _unit; + + static ElectricAdmittance() + { + BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit) + { + if(unit == ElectricAdmittanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricAdmittance, which is Siemens. All conversions go via this value. + /// + public static ElectricAdmittanceUnit BaseUnit => ElectricAdmittanceUnit.Siemens; + + /// + /// Represents the largest possible value of ElectricAdmittance + /// + public static ElectricAdmittance MaxValue => new ElectricAdmittance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricAdmittance + /// + public static ElectricAdmittance MinValue => new ElectricAdmittance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricAdmittance; + + /// + /// All units of measurement for the ElectricAdmittance quantity. + /// + public static ElectricAdmittanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricAdmittanceUnit)).Cast().Except(new ElectricAdmittanceUnit[]{ ElectricAdmittanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. + /// + public static ElectricAdmittance Zero => new ElectricAdmittance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricAdmittanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricAdmittance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricAdmittance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricAdmittance in Microsiemens. + /// + public double Microsiemens => As(ElectricAdmittanceUnit.Microsiemens); + + /// + /// Get ElectricAdmittance in Millisiemens. + /// + public double Millisiemens => As(ElectricAdmittanceUnit.Millisiemens); + + /// + /// Get ElectricAdmittance in Nanosiemens. + /// + public double Nanosiemens => As(ElectricAdmittanceUnit.Nanosiemens); + + /// + /// Get ElectricAdmittance in Siemens. + /// + public double Siemens => As(ElectricAdmittanceUnit.Siemens); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricAdmittanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricAdmittanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricAdmittance from Microsiemens. + /// + /// If value is NaN or Infinity. + public static ElectricAdmittance FromMicrosiemens(QuantityValue microsiemens) + { + double value = (double) microsiemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Microsiemens); + } + /// + /// Get ElectricAdmittance from Millisiemens. + /// + /// If value is NaN or Infinity. + public static ElectricAdmittance FromMillisiemens(QuantityValue millisiemens) + { + double value = (double) millisiemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Millisiemens); + } + /// + /// Get ElectricAdmittance from Nanosiemens. + /// + /// If value is NaN or Infinity. + public static ElectricAdmittance FromNanosiemens(QuantityValue nanosiemens) + { + double value = (double) nanosiemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Nanosiemens); + } + /// + /// Get ElectricAdmittance from Siemens. + /// + /// If value is NaN or Infinity. + public static ElectricAdmittance FromSiemens(QuantityValue siemens) + { + double value = (double) siemens; + return new ElectricAdmittance(value, ElectricAdmittanceUnit.Siemens); + } + + /// + /// 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 new ElectricAdmittance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricAdmittance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricAdmittance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricAdmittance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricAdmittance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricAdmittanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricAdmittanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricAdmittanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricAdmittanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); + + return CompareTo((ElectricAdmittance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricAdmittance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricAdmittance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricAdmittance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricAdmittanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricAdmittance to another ElectricAdmittance with the unit representation . + /// + /// A ElectricAdmittance with the specified unit. + public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricAdmittance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricAdmittanceUnit.Microsiemens: return (_value) * 1e-6d; + case ElectricAdmittanceUnit.Millisiemens: return (_value) * 1e-3d; + case ElectricAdmittanceUnit.Nanosiemens: return (_value) * 1e-9d; + case ElectricAdmittanceUnit.Siemens: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricAdmittanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricAdmittanceUnit.Microsiemens: return (baseUnitValue) / 1e-6d; + case ElectricAdmittanceUnit.Millisiemens: return (baseUnitValue) / 1e-3d; + case ElectricAdmittanceUnit.Nanosiemens: return (baseUnitValue) / 1e-9d; + case ElectricAdmittanceUnit.Siemens: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs new file mode 100644 index 0000000000..14b5a81345 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electric charge is the physical property of matter that causes it to experience a force when placed in an electromagnetic field. + /// + /// + /// https://en.wikipedia.org/wiki/Electric_charge + /// + public partial struct ElectricCharge : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricChargeUnit? _unit; + + static ElectricCharge() + { + BaseDimensions = new BaseDimensions(0, 0, 1, 1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricCharge(double numericValue, ElectricChargeUnit unit) + { + if(unit == ElectricChargeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCharge, which is Coulomb. All conversions go via this value. + /// + public static ElectricChargeUnit BaseUnit => ElectricChargeUnit.Coulomb; + + /// + /// Represents the largest possible value of ElectricCharge + /// + public static ElectricCharge MaxValue => new ElectricCharge(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCharge + /// + public static ElectricCharge MinValue => new ElectricCharge(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCharge; + + /// + /// All units of measurement for the ElectricCharge quantity. + /// + public static ElectricChargeUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeUnit)).Cast().Except(new ElectricChargeUnit[]{ ElectricChargeUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Coulomb. + /// + public static ElectricCharge Zero => new ElectricCharge(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricChargeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCharge.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCharge.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCharge in Coulombs. + /// + public double Coulombs => As(ElectricChargeUnit.Coulomb); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricChargeUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricChargeUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCharge from Coulombs. + /// + /// If value is NaN or Infinity. + public static ElectricCharge FromCoulombs(QuantityValue coulombs) + { + double value = (double) coulombs; + return new ElectricCharge(value, ElectricChargeUnit.Coulomb); + } + + /// + /// 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 new ElectricCharge((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCharge Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricCharge Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCharge result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCharge result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricChargeUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricChargeUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricChargeUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricChargeUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); + + return CompareTo((ElectricCharge)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricCharge other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCharge within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCharge other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCharge. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricChargeUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCharge to another ElectricCharge with the unit representation . + /// + /// A ElectricCharge with the specified unit. + public ElectricCharge ToUnit(ElectricChargeUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCharge(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricChargeUnit.Coulomb: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricChargeUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricChargeUnit.Coulomb: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs new file mode 100644 index 0000000000..0a16178af6 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, charge density is a measure of the amount of electric charge per unit length, surface area, or volume. + /// + /// + /// https://en.wikipedia.org/wiki/Charge_density + /// + public partial struct ElectricChargeDensity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricChargeDensityUnit? _unit; + + static ElectricChargeDensity() + { + BaseDimensions = new BaseDimensions(-3, 0, 1, 1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit unit) + { + if(unit == ElectricChargeDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricChargeDensity, which is CoulombPerCubicMeter. All conversions go via this value. + /// + public static ElectricChargeDensityUnit BaseUnit => ElectricChargeDensityUnit.CoulombPerCubicMeter; + + /// + /// Represents the largest possible value of ElectricChargeDensity + /// + public static ElectricChargeDensity MaxValue => new ElectricChargeDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricChargeDensity + /// + public static ElectricChargeDensity MinValue => new ElectricChargeDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricChargeDensity; + + /// + /// All units of measurement for the ElectricChargeDensity quantity. + /// + public static ElectricChargeDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricChargeDensityUnit)).Cast().Except(new ElectricChargeDensityUnit[]{ ElectricChargeDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CoulombPerCubicMeter. + /// + public static ElectricChargeDensity Zero => new ElectricChargeDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricChargeDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricChargeDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricChargeDensity in CoulombsPerCubicMeter. + /// + public double CoulombsPerCubicMeter => As(ElectricChargeDensityUnit.CoulombPerCubicMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricChargeDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricChargeDensityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricChargeDensity from CoulombsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static ElectricChargeDensity FromCoulombsPerCubicMeter(QuantityValue coulombspercubicmeter) + { + double value = (double) coulombspercubicmeter; + return new ElectricChargeDensity(value, ElectricChargeDensityUnit.CoulombPerCubicMeter); + } + + /// + /// 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 new ElectricChargeDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricChargeDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricChargeDensity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricChargeDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricChargeDensity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricChargeDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricChargeDensityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricChargeDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricChargeDensityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); + + return CompareTo((ElectricChargeDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricChargeDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricChargeDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricChargeDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricChargeDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricChargeDensity to another ElectricChargeDensity with the unit representation . + /// + /// A ElectricChargeDensity with the specified unit. + public ElectricChargeDensity ToUnit(ElectricChargeDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricChargeDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricChargeDensityUnit.CoulombPerCubicMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricChargeDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricChargeDensityUnit.CoulombPerCubicMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs new file mode 100644 index 0000000000..cf63700d7a --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -0,0 +1,635 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The electrical conductance of an electrical conductor is a measure of the easeness to pass an electric current through that conductor. + /// + /// + /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance + /// + public partial struct ElectricConductance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricConductanceUnit? _unit; + + static ElectricConductance() + { + BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricConductance(double numericValue, ElectricConductanceUnit unit) + { + if(unit == ElectricConductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricConductance, which is Siemens. All conversions go via this value. + /// + public static ElectricConductanceUnit BaseUnit => ElectricConductanceUnit.Siemens; + + /// + /// Represents the largest possible value of ElectricConductance + /// + public static ElectricConductance MaxValue => new ElectricConductance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricConductance + /// + public static ElectricConductance MinValue => new ElectricConductance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricConductance; + + /// + /// All units of measurement for the ElectricConductance quantity. + /// + public static ElectricConductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductanceUnit)).Cast().Except(new ElectricConductanceUnit[]{ ElectricConductanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Siemens. + /// + public static ElectricConductance Zero => new ElectricConductance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricConductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricConductance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricConductance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricConductance in Microsiemens. + /// + public double Microsiemens => As(ElectricConductanceUnit.Microsiemens); + + /// + /// Get ElectricConductance in Millisiemens. + /// + public double Millisiemens => As(ElectricConductanceUnit.Millisiemens); + + /// + /// Get ElectricConductance in Siemens. + /// + public double Siemens => As(ElectricConductanceUnit.Siemens); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricConductanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricConductanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricConductance from Microsiemens. + /// + /// If value is NaN or Infinity. + public static ElectricConductance FromMicrosiemens(QuantityValue microsiemens) + { + double value = (double) microsiemens; + return new ElectricConductance(value, ElectricConductanceUnit.Microsiemens); + } + /// + /// Get ElectricConductance from Millisiemens. + /// + /// If value is NaN or Infinity. + public static ElectricConductance FromMillisiemens(QuantityValue millisiemens) + { + double value = (double) millisiemens; + return new ElectricConductance(value, ElectricConductanceUnit.Millisiemens); + } + /// + /// Get ElectricConductance from Siemens. + /// + /// If value is NaN or Infinity. + public static ElectricConductance FromSiemens(QuantityValue siemens) + { + double value = (double) siemens; + return new ElectricConductance(value, ElectricConductanceUnit.Siemens); + } + + /// + /// 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 new ElectricConductance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricConductance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricConductance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricConductance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricConductanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricConductanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricConductanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricConductanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); + + return CompareTo((ElectricConductance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricConductance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricConductance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricConductance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricConductance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricConductanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricConductance to another ElectricConductance with the unit representation . + /// + /// A ElectricConductance with the specified unit. + public ElectricConductance ToUnit(ElectricConductanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricConductance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricConductanceUnit.Microsiemens: return (_value) * 1e-6d; + case ElectricConductanceUnit.Millisiemens: return (_value) * 1e-3d; + case ElectricConductanceUnit.Siemens: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricConductanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricConductanceUnit.Microsiemens: return (baseUnitValue) / 1e-6d; + case ElectricConductanceUnit.Millisiemens: return (baseUnitValue) / 1e-3d; + case ElectricConductanceUnit.Siemens: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs new file mode 100644 index 0000000000..07b04d69e2 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electrical conductivity or specific conductance is the reciprocal of electrical resistivity, and measures a material's ability to conduct an electric current. + /// + /// + /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity + /// + public partial struct ElectricConductivity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricConductivityUnit? _unit; + + static ElectricConductivity() + { + BaseDimensions = new BaseDimensions(-3, -1, 3, 2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricConductivity(double numericValue, ElectricConductivityUnit unit) + { + if(unit == ElectricConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricConductivity, which is SiemensPerMeter. All conversions go via this value. + /// + public static ElectricConductivityUnit BaseUnit => ElectricConductivityUnit.SiemensPerMeter; + + /// + /// Represents the largest possible value of ElectricConductivity + /// + public static ElectricConductivity MaxValue => new ElectricConductivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricConductivity + /// + public static ElectricConductivity MinValue => new ElectricConductivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricConductivity; + + /// + /// All units of measurement for the ElectricConductivity quantity. + /// + public static ElectricConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricConductivityUnit)).Cast().Except(new ElectricConductivityUnit[]{ ElectricConductivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SiemensPerMeter. + /// + public static ElectricConductivity Zero => new ElectricConductivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricConductivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricConductivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricConductivity in SiemensPerMeter. + /// + public double SiemensPerMeter => As(ElectricConductivityUnit.SiemensPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricConductivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricConductivityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricConductivity from SiemensPerMeter. + /// + /// If value is NaN or Infinity. + public static ElectricConductivity FromSiemensPerMeter(QuantityValue siemenspermeter) + { + double value = (double) siemenspermeter; + return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerMeter); + } + + /// + /// 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 new ElectricConductivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricConductivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricConductivity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricConductivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricConductivity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricConductivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricConductivityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricConductivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricConductivityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); + + return CompareTo((ElectricConductivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricConductivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricConductivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricConductivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricConductivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricConductivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricConductivity to another ElectricConductivity with the unit representation . + /// + /// A ElectricConductivity with the specified unit. + public ElectricConductivity ToUnit(ElectricConductivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricConductivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricConductivityUnit.SiemensPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricConductivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricConductivityUnit.SiemensPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs new file mode 100644 index 0000000000..546bca6c60 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -0,0 +1,712 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. + /// + public partial struct ElectricCurrent : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricCurrentUnit? _unit; + + static ElectricCurrent() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricCurrent(double numericValue, ElectricCurrentUnit unit) + { + if(unit == ElectricCurrentUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCurrent, which is Ampere. All conversions go via this value. + /// + public static ElectricCurrentUnit BaseUnit => ElectricCurrentUnit.Ampere; + + /// + /// Represents the largest possible value of ElectricCurrent + /// + public static ElectricCurrent MaxValue => new ElectricCurrent(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCurrent + /// + public static ElectricCurrent MinValue => new ElectricCurrent(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCurrent; + + /// + /// All units of measurement for the ElectricCurrent quantity. + /// + public static ElectricCurrentUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentUnit)).Cast().Except(new ElectricCurrentUnit[]{ ElectricCurrentUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Ampere. + /// + public static ElectricCurrent Zero => new ElectricCurrent(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricCurrentUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrent.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrent.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCurrent in Amperes. + /// + public double Amperes => As(ElectricCurrentUnit.Ampere); + + /// + /// Get ElectricCurrent in Centiamperes. + /// + public double Centiamperes => As(ElectricCurrentUnit.Centiampere); + + /// + /// Get ElectricCurrent in Kiloamperes. + /// + public double Kiloamperes => As(ElectricCurrentUnit.Kiloampere); + + /// + /// Get ElectricCurrent in Megaamperes. + /// + public double Megaamperes => As(ElectricCurrentUnit.Megaampere); + + /// + /// Get ElectricCurrent in Microamperes. + /// + public double Microamperes => As(ElectricCurrentUnit.Microampere); + + /// + /// Get ElectricCurrent in Milliamperes. + /// + public double Milliamperes => As(ElectricCurrentUnit.Milliampere); + + /// + /// Get ElectricCurrent in Nanoamperes. + /// + public double Nanoamperes => As(ElectricCurrentUnit.Nanoampere); + + /// + /// Get ElectricCurrent in Picoamperes. + /// + public double Picoamperes => As(ElectricCurrentUnit.Picoampere); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricCurrentUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricCurrentUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCurrent from Amperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromAmperes(QuantityValue amperes) + { + double value = (double) amperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Ampere); + } + /// + /// Get ElectricCurrent from Centiamperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromCentiamperes(QuantityValue centiamperes) + { + double value = (double) centiamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Centiampere); + } + /// + /// Get ElectricCurrent from Kiloamperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromKiloamperes(QuantityValue kiloamperes) + { + double value = (double) kiloamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Kiloampere); + } + /// + /// Get ElectricCurrent from Megaamperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromMegaamperes(QuantityValue megaamperes) + { + double value = (double) megaamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Megaampere); + } + /// + /// Get ElectricCurrent from Microamperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromMicroamperes(QuantityValue microamperes) + { + double value = (double) microamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Microampere); + } + /// + /// Get ElectricCurrent from Milliamperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromMilliamperes(QuantityValue milliamperes) + { + double value = (double) milliamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Milliampere); + } + /// + /// Get ElectricCurrent from Nanoamperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromNanoamperes(QuantityValue nanoamperes) + { + double value = (double) nanoamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Nanoampere); + } + /// + /// Get ElectricCurrent from Picoamperes. + /// + /// If value is NaN or Infinity. + public static ElectricCurrent FromPicoamperes(QuantityValue picoamperes) + { + double value = (double) picoamperes; + return new ElectricCurrent(value, ElectricCurrentUnit.Picoampere); + } + + /// + /// 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 new ElectricCurrent((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCurrent Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricCurrent Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCurrent result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrent result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricCurrentUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); + + return CompareTo((ElectricCurrent)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricCurrent other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCurrent within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCurrent other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCurrent. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricCurrentUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCurrent to another ElectricCurrent with the unit representation . + /// + /// A ElectricCurrent with the specified unit. + public ElectricCurrent ToUnit(ElectricCurrentUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCurrent(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricCurrentUnit.Ampere: return _value; + case ElectricCurrentUnit.Centiampere: return (_value) * 1e-2d; + case ElectricCurrentUnit.Kiloampere: return (_value) * 1e3d; + case ElectricCurrentUnit.Megaampere: return (_value) * 1e6d; + case ElectricCurrentUnit.Microampere: return (_value) * 1e-6d; + case ElectricCurrentUnit.Milliampere: return (_value) * 1e-3d; + case ElectricCurrentUnit.Nanoampere: return (_value) * 1e-9d; + case ElectricCurrentUnit.Picoampere: return (_value) * 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricCurrentUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricCurrentUnit.Ampere: return baseUnitValue; + case ElectricCurrentUnit.Centiampere: return (baseUnitValue) / 1e-2d; + case ElectricCurrentUnit.Kiloampere: return (baseUnitValue) / 1e3d; + case ElectricCurrentUnit.Megaampere: return (baseUnitValue) / 1e6d; + case ElectricCurrentUnit.Microampere: return (baseUnitValue) / 1e-6d; + case ElectricCurrentUnit.Milliampere: return (baseUnitValue) / 1e-3d; + case ElectricCurrentUnit.Nanoampere: return (baseUnitValue) / 1e-9d; + case ElectricCurrentUnit.Picoampere: return (baseUnitValue) / 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs new file mode 100644 index 0000000000..59306fe6ac --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, current density is the electric current per unit area of cross section. + /// + /// + /// https://en.wikipedia.org/wiki/Current_density + /// + public partial struct ElectricCurrentDensity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricCurrentDensityUnit? _unit; + + static ElectricCurrentDensity() + { + BaseDimensions = new BaseDimensions(-2, 0, 0, 1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricCurrentDensity(double numericValue, ElectricCurrentDensityUnit unit) + { + if(unit == ElectricCurrentDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCurrentDensity, which is AmperePerSquareMeter. All conversions go via this value. + /// + public static ElectricCurrentDensityUnit BaseUnit => ElectricCurrentDensityUnit.AmperePerSquareMeter; + + /// + /// Represents the largest possible value of ElectricCurrentDensity + /// + public static ElectricCurrentDensity MaxValue => new ElectricCurrentDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCurrentDensity + /// + public static ElectricCurrentDensity MinValue => new ElectricCurrentDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCurrentDensity; + + /// + /// All units of measurement for the ElectricCurrentDensity quantity. + /// + public static ElectricCurrentDensityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentDensityUnit)).Cast().Except(new ElectricCurrentDensityUnit[]{ ElectricCurrentDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSquareMeter. + /// + public static ElectricCurrentDensity Zero => new ElectricCurrentDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricCurrentDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrentDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrentDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCurrentDensity in AmperesPerSquareMeter. + /// + public double AmperesPerSquareMeter => As(ElectricCurrentDensityUnit.AmperePerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricCurrentDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricCurrentDensityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCurrentDensity from AmperesPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static ElectricCurrentDensity FromAmperesPerSquareMeter(QuantityValue amperespersquaremeter) + { + double value = (double) amperespersquaremeter; + return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareMeter); + } + + /// + /// 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 new ElectricCurrentDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCurrentDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentDensity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCurrentDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentDensity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentDensityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricCurrentDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentDensityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); + + return CompareTo((ElectricCurrentDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricCurrentDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCurrentDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCurrentDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricCurrentDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCurrentDensity to another ElectricCurrentDensity with the unit representation . + /// + /// A ElectricCurrentDensity with the specified unit. + public ElectricCurrentDensity ToUnit(ElectricCurrentDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCurrentDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricCurrentDensityUnit.AmperePerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricCurrentDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricCurrentDensityUnit.AmperePerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs new file mode 100644 index 0000000000..8a71720550 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -0,0 +1,600 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, the current gradient describes how the current changes in time. + /// + public partial struct ElectricCurrentGradient : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricCurrentGradientUnit? _unit; + + static ElectricCurrentGradient() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricCurrentGradient(double numericValue, ElectricCurrentGradientUnit unit) + { + if(unit == ElectricCurrentGradientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricCurrentGradient, which is AmperePerSecond. All conversions go via this value. + /// + public static ElectricCurrentGradientUnit BaseUnit => ElectricCurrentGradientUnit.AmperePerSecond; + + /// + /// Represents the largest possible value of ElectricCurrentGradient + /// + public static ElectricCurrentGradient MaxValue => new ElectricCurrentGradient(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricCurrentGradient + /// + public static ElectricCurrentGradient MinValue => new ElectricCurrentGradient(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricCurrentGradient; + + /// + /// All units of measurement for the ElectricCurrentGradient quantity. + /// + public static ElectricCurrentGradientUnit[] Units { get; } = Enum.GetValues(typeof(ElectricCurrentGradientUnit)).Cast().Except(new ElectricCurrentGradientUnit[]{ ElectricCurrentGradientUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerSecond. + /// + public static ElectricCurrentGradient Zero => new ElectricCurrentGradient(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricCurrentGradientUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricCurrentGradient.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricCurrentGradient.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricCurrentGradient in AmperesPerSecond. + /// + public double AmperesPerSecond => As(ElectricCurrentGradientUnit.AmperePerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricCurrentGradientUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricCurrentGradientUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricCurrentGradient from AmperesPerSecond. + /// + /// If value is NaN or Infinity. + public static ElectricCurrentGradient FromAmperesPerSecond(QuantityValue amperespersecond) + { + double value = (double) amperespersecond; + return new ElectricCurrentGradient(value, ElectricCurrentGradientUnit.AmperePerSecond); + } + + /// + /// 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 new ElectricCurrentGradient((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricCurrentGradient Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentGradient Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricCurrentGradient result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricCurrentGradient result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricCurrentGradientUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricCurrentGradientUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricCurrentGradientUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricCurrentGradientUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); + + return CompareTo((ElectricCurrentGradient)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricCurrentGradient other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricCurrentGradient within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricCurrentGradient. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricCurrentGradientUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricCurrentGradient to another ElectricCurrentGradient with the unit representation . + /// + /// A ElectricCurrentGradient with the specified unit. + public ElectricCurrentGradient ToUnit(ElectricCurrentGradientUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricCurrentGradient(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricCurrentGradientUnit.AmperePerSecond: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricCurrentGradientUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricCurrentGradientUnit.AmperePerSecond: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs new file mode 100644 index 0000000000..1abc713686 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// An electric field is a force field that surrounds electric charges that attracts or repels other electric charges. + /// + /// + /// https://en.wikipedia.org/wiki/Electric_field + /// + public partial struct ElectricField : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricFieldUnit? _unit; + + static ElectricField() + { + BaseDimensions = new BaseDimensions(1, 1, -3, -1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricField(double numericValue, ElectricFieldUnit unit) + { + if(unit == ElectricFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricField, which is VoltPerMeter. All conversions go via this value. + /// + public static ElectricFieldUnit BaseUnit => ElectricFieldUnit.VoltPerMeter; + + /// + /// Represents the largest possible value of ElectricField + /// + public static ElectricField MaxValue => new ElectricField(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricField + /// + public static ElectricField MinValue => new ElectricField(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricField; + + /// + /// All units of measurement for the ElectricField quantity. + /// + public static ElectricFieldUnit[] Units { get; } = Enum.GetValues(typeof(ElectricFieldUnit)).Cast().Except(new ElectricFieldUnit[]{ ElectricFieldUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltPerMeter. + /// + public static ElectricField Zero => new ElectricField(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricField.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricField.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricField in VoltsPerMeter. + /// + public double VoltsPerMeter => As(ElectricFieldUnit.VoltPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricFieldUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricFieldUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricField from VoltsPerMeter. + /// + /// If value is NaN or Infinity. + public static ElectricField FromVoltsPerMeter(QuantityValue voltspermeter) + { + double value = (double) voltspermeter; + return new ElectricField(value, ElectricFieldUnit.VoltPerMeter); + } + + /// + /// 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 new ElectricField((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricField Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricField Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricField result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricField result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricFieldUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricFieldUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricFieldUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricFieldUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); + + return CompareTo((ElectricField)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricField other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricField within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricField other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricField. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricFieldUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricField to another ElectricField with the unit representation . + /// + /// A ElectricField with the specified unit. + public ElectricField ToUnit(ElectricFieldUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricField(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricFieldUnit.VoltPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricFieldUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricFieldUnit.VoltPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs new file mode 100644 index 0000000000..c7c7f24382 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Inductance is a property of an electrical conductor which opposes a change in current. + /// + /// + /// https://en.wikipedia.org/wiki/Inductance + /// + public partial struct ElectricInductance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricInductanceUnit? _unit; + + static ElectricInductance() + { + BaseDimensions = new BaseDimensions(2, 1, -2, -2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricInductance(double numericValue, ElectricInductanceUnit unit) + { + if(unit == ElectricInductanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricInductance, which is Henry. All conversions go via this value. + /// + public static ElectricInductanceUnit BaseUnit => ElectricInductanceUnit.Henry; + + /// + /// Represents the largest possible value of ElectricInductance + /// + public static ElectricInductance MaxValue => new ElectricInductance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricInductance + /// + public static ElectricInductance MinValue => new ElectricInductance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricInductance; + + /// + /// All units of measurement for the ElectricInductance quantity. + /// + public static ElectricInductanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricInductanceUnit)).Cast().Except(new ElectricInductanceUnit[]{ ElectricInductanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Henry. + /// + public static ElectricInductance Zero => new ElectricInductance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricInductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricInductance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricInductance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricInductance in Henries. + /// + public double Henries => As(ElectricInductanceUnit.Henry); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricInductanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricInductanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricInductance from Henries. + /// + /// If value is NaN or Infinity. + public static ElectricInductance FromHenries(QuantityValue henries) + { + double value = (double) henries; + return new ElectricInductance(value, ElectricInductanceUnit.Henry); + } + + /// + /// 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 new ElectricInductance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricInductance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricInductance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricInductance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricInductance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricInductanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricInductanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricInductanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricInductanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); + + return CompareTo((ElectricInductance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricInductance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricInductance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricInductance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricInductance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricInductanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricInductance to another ElectricInductance with the unit representation . + /// + /// A ElectricInductance with the specified unit. + public ElectricInductance ToUnit(ElectricInductanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricInductance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricInductanceUnit.Henry: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricInductanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricInductanceUnit.Henry: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs new file mode 100644 index 0000000000..b28667c840 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -0,0 +1,664 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. + /// + public partial struct ElectricPotential : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricPotentialUnit? _unit; + + static ElectricPotential() + { + BaseDimensions = new BaseDimensions(2, 1, -3, -1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricPotential(double numericValue, ElectricPotentialUnit unit) + { + if(unit == ElectricPotentialUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricPotential, which is Volt. All conversions go via this value. + /// + public static ElectricPotentialUnit BaseUnit => ElectricPotentialUnit.Volt; + + /// + /// Represents the largest possible value of ElectricPotential + /// + public static ElectricPotential MaxValue => new ElectricPotential(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricPotential + /// + public static ElectricPotential MinValue => new ElectricPotential(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricPotential; + + /// + /// All units of measurement for the ElectricPotential quantity. + /// + public static ElectricPotentialUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialUnit)).Cast().Except(new ElectricPotentialUnit[]{ ElectricPotentialUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Volt. + /// + public static ElectricPotential Zero => new ElectricPotential(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricPotentialUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotential.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotential.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricPotential in Kilovolts. + /// + public double Kilovolts => As(ElectricPotentialUnit.Kilovolt); + + /// + /// Get ElectricPotential in Megavolts. + /// + public double Megavolts => As(ElectricPotentialUnit.Megavolt); + + /// + /// Get ElectricPotential in Microvolts. + /// + public double Microvolts => As(ElectricPotentialUnit.Microvolt); + + /// + /// Get ElectricPotential in Millivolts. + /// + public double Millivolts => As(ElectricPotentialUnit.Millivolt); + + /// + /// Get ElectricPotential in Volts. + /// + public double Volts => As(ElectricPotentialUnit.Volt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricPotentialUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricPotentialUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricPotential from Kilovolts. + /// + /// If value is NaN or Infinity. + public static ElectricPotential FromKilovolts(QuantityValue kilovolts) + { + double value = (double) kilovolts; + return new ElectricPotential(value, ElectricPotentialUnit.Kilovolt); + } + /// + /// Get ElectricPotential from Megavolts. + /// + /// If value is NaN or Infinity. + public static ElectricPotential FromMegavolts(QuantityValue megavolts) + { + double value = (double) megavolts; + return new ElectricPotential(value, ElectricPotentialUnit.Megavolt); + } + /// + /// Get ElectricPotential from Microvolts. + /// + /// If value is NaN or Infinity. + public static ElectricPotential FromMicrovolts(QuantityValue microvolts) + { + double value = (double) microvolts; + return new ElectricPotential(value, ElectricPotentialUnit.Microvolt); + } + /// + /// Get ElectricPotential from Millivolts. + /// + /// If value is NaN or Infinity. + public static ElectricPotential FromMillivolts(QuantityValue millivolts) + { + double value = (double) millivolts; + return new ElectricPotential(value, ElectricPotentialUnit.Millivolt); + } + /// + /// Get ElectricPotential from Volts. + /// + /// If value is NaN or Infinity. + public static ElectricPotential FromVolts(QuantityValue volts) + { + double value = (double) volts; + return new ElectricPotential(value, ElectricPotentialUnit.Volt); + } + + /// + /// 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 new ElectricPotential((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricPotential Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricPotential Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricPotential result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotential result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricPotentialUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); + + return CompareTo((ElectricPotential)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricPotential other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricPotential within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricPotential other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricPotential. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricPotentialUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricPotential to another ElectricPotential with the unit representation . + /// + /// A ElectricPotential with the specified unit. + public ElectricPotential ToUnit(ElectricPotentialUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricPotential(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricPotentialUnit.Kilovolt: return (_value) * 1e3d; + case ElectricPotentialUnit.Megavolt: return (_value) * 1e6d; + case ElectricPotentialUnit.Microvolt: return (_value) * 1e-6d; + case ElectricPotentialUnit.Millivolt: return (_value) * 1e-3d; + case ElectricPotentialUnit.Volt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricPotentialUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricPotentialUnit.Kilovolt: return (baseUnitValue) / 1e3d; + case ElectricPotentialUnit.Megavolt: return (baseUnitValue) / 1e6d; + case ElectricPotentialUnit.Microvolt: return (baseUnitValue) / 1e-6d; + case ElectricPotentialUnit.Millivolt: return (baseUnitValue) / 1e-3d; + case ElectricPotentialUnit.Volt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs new file mode 100644 index 0000000000..a172668d60 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -0,0 +1,664 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Electric Potential of a system known to use Alternating Current. + /// + public partial struct ElectricPotentialAc : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricPotentialAcUnit? _unit; + + static ElectricPotentialAc() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricPotentialAc(double numericValue, ElectricPotentialAcUnit unit) + { + if(unit == ElectricPotentialAcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricPotentialAc, which is VoltAc. All conversions go via this value. + /// + public static ElectricPotentialAcUnit BaseUnit => ElectricPotentialAcUnit.VoltAc; + + /// + /// Represents the largest possible value of ElectricPotentialAc + /// + public static ElectricPotentialAc MaxValue => new ElectricPotentialAc(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricPotentialAc + /// + public static ElectricPotentialAc MinValue => new ElectricPotentialAc(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricPotentialAc; + + /// + /// All units of measurement for the ElectricPotentialAc quantity. + /// + public static ElectricPotentialAcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialAcUnit)).Cast().Except(new ElectricPotentialAcUnit[]{ ElectricPotentialAcUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltAc. + /// + public static ElectricPotentialAc Zero => new ElectricPotentialAc(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricPotentialAcUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotentialAc.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotentialAc.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricPotentialAc in KilovoltsAc. + /// + public double KilovoltsAc => As(ElectricPotentialAcUnit.KilovoltAc); + + /// + /// Get ElectricPotentialAc in MegavoltsAc. + /// + public double MegavoltsAc => As(ElectricPotentialAcUnit.MegavoltAc); + + /// + /// Get ElectricPotentialAc in MicrovoltsAc. + /// + public double MicrovoltsAc => As(ElectricPotentialAcUnit.MicrovoltAc); + + /// + /// Get ElectricPotentialAc in MillivoltsAc. + /// + public double MillivoltsAc => As(ElectricPotentialAcUnit.MillivoltAc); + + /// + /// Get ElectricPotentialAc in VoltsAc. + /// + public double VoltsAc => As(ElectricPotentialAcUnit.VoltAc); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricPotentialAcUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricPotentialAcUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricPotentialAc from KilovoltsAc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialAc FromKilovoltsAc(QuantityValue kilovoltsac) + { + double value = (double) kilovoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.KilovoltAc); + } + /// + /// Get ElectricPotentialAc from MegavoltsAc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialAc FromMegavoltsAc(QuantityValue megavoltsac) + { + double value = (double) megavoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MegavoltAc); + } + /// + /// Get ElectricPotentialAc from MicrovoltsAc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialAc FromMicrovoltsAc(QuantityValue microvoltsac) + { + double value = (double) microvoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MicrovoltAc); + } + /// + /// Get ElectricPotentialAc from MillivoltsAc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialAc FromMillivoltsAc(QuantityValue millivoltsac) + { + double value = (double) millivoltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.MillivoltAc); + } + /// + /// Get ElectricPotentialAc from VoltsAc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialAc FromVoltsAc(QuantityValue voltsac) + { + double value = (double) voltsac; + return new ElectricPotentialAc(value, ElectricPotentialAcUnit.VoltAc); + } + + /// + /// 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 new ElectricPotentialAc((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricPotentialAc Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialAc Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricPotentialAc result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialAc result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialAcUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialAcUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricPotentialAcUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialAcUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); + + return CompareTo((ElectricPotentialAc)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricPotentialAc other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricPotentialAc within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricPotentialAc. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricPotentialAcUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricPotentialAc to another ElectricPotentialAc with the unit representation . + /// + /// A ElectricPotentialAc with the specified unit. + public ElectricPotentialAc ToUnit(ElectricPotentialAcUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricPotentialAc(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricPotentialAcUnit.KilovoltAc: return (_value) * 1e3d; + case ElectricPotentialAcUnit.MegavoltAc: return (_value) * 1e6d; + case ElectricPotentialAcUnit.MicrovoltAc: return (_value) * 1e-6d; + case ElectricPotentialAcUnit.MillivoltAc: return (_value) * 1e-3d; + case ElectricPotentialAcUnit.VoltAc: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricPotentialAcUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricPotentialAcUnit.KilovoltAc: return (baseUnitValue) / 1e3d; + case ElectricPotentialAcUnit.MegavoltAc: return (baseUnitValue) / 1e6d; + case ElectricPotentialAcUnit.MicrovoltAc: return (baseUnitValue) / 1e-6d; + case ElectricPotentialAcUnit.MillivoltAc: return (baseUnitValue) / 1e-3d; + case ElectricPotentialAcUnit.VoltAc: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs new file mode 100644 index 0000000000..8f1cf03d97 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -0,0 +1,664 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Electric Potential of a system known to use Direct Current. + /// + public partial struct ElectricPotentialDc : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricPotentialDcUnit? _unit; + + static ElectricPotentialDc() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricPotentialDc(double numericValue, ElectricPotentialDcUnit unit) + { + if(unit == ElectricPotentialDcUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricPotentialDc, which is VoltDc. All conversions go via this value. + /// + public static ElectricPotentialDcUnit BaseUnit => ElectricPotentialDcUnit.VoltDc; + + /// + /// Represents the largest possible value of ElectricPotentialDc + /// + public static ElectricPotentialDc MaxValue => new ElectricPotentialDc(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricPotentialDc + /// + public static ElectricPotentialDc MinValue => new ElectricPotentialDc(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricPotentialDc; + + /// + /// All units of measurement for the ElectricPotentialDc quantity. + /// + public static ElectricPotentialDcUnit[] Units { get; } = Enum.GetValues(typeof(ElectricPotentialDcUnit)).Cast().Except(new ElectricPotentialDcUnit[]{ ElectricPotentialDcUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltDc. + /// + public static ElectricPotentialDc Zero => new ElectricPotentialDc(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricPotentialDcUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricPotentialDc.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricPotentialDc.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricPotentialDc in KilovoltsDc. + /// + public double KilovoltsDc => As(ElectricPotentialDcUnit.KilovoltDc); + + /// + /// Get ElectricPotentialDc in MegavoltsDc. + /// + public double MegavoltsDc => As(ElectricPotentialDcUnit.MegavoltDc); + + /// + /// Get ElectricPotentialDc in MicrovoltsDc. + /// + public double MicrovoltsDc => As(ElectricPotentialDcUnit.MicrovoltDc); + + /// + /// Get ElectricPotentialDc in MillivoltsDc. + /// + public double MillivoltsDc => As(ElectricPotentialDcUnit.MillivoltDc); + + /// + /// Get ElectricPotentialDc in VoltsDc. + /// + public double VoltsDc => As(ElectricPotentialDcUnit.VoltDc); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricPotentialDcUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricPotentialDcUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricPotentialDc from KilovoltsDc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialDc FromKilovoltsDc(QuantityValue kilovoltsdc) + { + double value = (double) kilovoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.KilovoltDc); + } + /// + /// Get ElectricPotentialDc from MegavoltsDc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialDc FromMegavoltsDc(QuantityValue megavoltsdc) + { + double value = (double) megavoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MegavoltDc); + } + /// + /// Get ElectricPotentialDc from MicrovoltsDc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialDc FromMicrovoltsDc(QuantityValue microvoltsdc) + { + double value = (double) microvoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MicrovoltDc); + } + /// + /// Get ElectricPotentialDc from MillivoltsDc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialDc FromMillivoltsDc(QuantityValue millivoltsdc) + { + double value = (double) millivoltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.MillivoltDc); + } + /// + /// Get ElectricPotentialDc from VoltsDc. + /// + /// If value is NaN or Infinity. + public static ElectricPotentialDc FromVoltsDc(QuantityValue voltsdc) + { + double value = (double) voltsdc; + return new ElectricPotentialDc(value, ElectricPotentialDcUnit.VoltDc); + } + + /// + /// 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 new ElectricPotentialDc((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricPotentialDc Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialDc Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricPotentialDc result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricPotentialDc result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricPotentialDcUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricPotentialDcUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricPotentialDcUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricPotentialDcUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); + + return CompareTo((ElectricPotentialDc)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricPotentialDc other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricPotentialDc within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricPotentialDc. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricPotentialDcUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricPotentialDc to another ElectricPotentialDc with the unit representation . + /// + /// A ElectricPotentialDc with the specified unit. + public ElectricPotentialDc ToUnit(ElectricPotentialDcUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricPotentialDc(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricPotentialDcUnit.KilovoltDc: return (_value) * 1e3d; + case ElectricPotentialDcUnit.MegavoltDc: return (_value) * 1e6d; + case ElectricPotentialDcUnit.MicrovoltDc: return (_value) * 1e-6d; + case ElectricPotentialDcUnit.MillivoltDc: return (_value) * 1e-3d; + case ElectricPotentialDcUnit.VoltDc: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricPotentialDcUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricPotentialDcUnit.KilovoltDc: return (baseUnitValue) / 1e3d; + case ElectricPotentialDcUnit.MegavoltDc: return (baseUnitValue) / 1e6d; + case ElectricPotentialDcUnit.MicrovoltDc: return (baseUnitValue) / 1e-6d; + case ElectricPotentialDcUnit.MillivoltDc: return (baseUnitValue) / 1e-3d; + case ElectricPotentialDcUnit.VoltDc: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs new file mode 100644 index 0000000000..f70db6dcc1 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -0,0 +1,648 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. + /// + public partial struct ElectricResistance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricResistanceUnit? _unit; + + static ElectricResistance() + { + BaseDimensions = new BaseDimensions(2, 1, -3, -2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricResistance(double numericValue, ElectricResistanceUnit unit) + { + if(unit == ElectricResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricResistance, which is Ohm. All conversions go via this value. + /// + public static ElectricResistanceUnit BaseUnit => ElectricResistanceUnit.Ohm; + + /// + /// Represents the largest possible value of ElectricResistance + /// + public static ElectricResistance MaxValue => new ElectricResistance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricResistance + /// + public static ElectricResistance MinValue => new ElectricResistance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricResistance; + + /// + /// All units of measurement for the ElectricResistance quantity. + /// + public static ElectricResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistanceUnit)).Cast().Except(new ElectricResistanceUnit[]{ ElectricResistanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Ohm. + /// + public static ElectricResistance Zero => new ElectricResistance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricResistance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricResistance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricResistance in Kiloohms. + /// + public double Kiloohms => As(ElectricResistanceUnit.Kiloohm); + + /// + /// Get ElectricResistance in Megaohms. + /// + public double Megaohms => As(ElectricResistanceUnit.Megaohm); + + /// + /// Get ElectricResistance in Milliohms. + /// + public double Milliohms => As(ElectricResistanceUnit.Milliohm); + + /// + /// Get ElectricResistance in Ohms. + /// + public double Ohms => As(ElectricResistanceUnit.Ohm); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricResistanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricResistanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricResistance from Kiloohms. + /// + /// If value is NaN or Infinity. + public static ElectricResistance FromKiloohms(QuantityValue kiloohms) + { + double value = (double) kiloohms; + return new ElectricResistance(value, ElectricResistanceUnit.Kiloohm); + } + /// + /// Get ElectricResistance from Megaohms. + /// + /// If value is NaN or Infinity. + public static ElectricResistance FromMegaohms(QuantityValue megaohms) + { + double value = (double) megaohms; + return new ElectricResistance(value, ElectricResistanceUnit.Megaohm); + } + /// + /// Get ElectricResistance from Milliohms. + /// + /// If value is NaN or Infinity. + public static ElectricResistance FromMilliohms(QuantityValue milliohms) + { + double value = (double) milliohms; + return new ElectricResistance(value, ElectricResistanceUnit.Milliohm); + } + /// + /// Get ElectricResistance from Ohms. + /// + /// If value is NaN or Infinity. + public static ElectricResistance FromOhms(QuantityValue ohms) + { + double value = (double) ohms; + return new ElectricResistance(value, ElectricResistanceUnit.Ohm); + } + + /// + /// 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 new ElectricResistance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricResistance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricResistance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricResistance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricResistanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricResistanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricResistanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricResistanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); + + return CompareTo((ElectricResistance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricResistance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricResistance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricResistance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricResistance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricResistanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricResistance to another ElectricResistance with the unit representation . + /// + /// A ElectricResistance with the specified unit. + public ElectricResistance ToUnit(ElectricResistanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricResistance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricResistanceUnit.Kiloohm: return (_value) * 1e3d; + case ElectricResistanceUnit.Megaohm: return (_value) * 1e6d; + case ElectricResistanceUnit.Milliohm: return (_value) * 1e-3d; + case ElectricResistanceUnit.Ohm: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricResistanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricResistanceUnit.Kiloohm: return (baseUnitValue) / 1e3d; + case ElectricResistanceUnit.Megaohm: return (baseUnitValue) / 1e6d; + case ElectricResistanceUnit.Milliohm: return (baseUnitValue) / 1e-3d; + case ElectricResistanceUnit.Ohm: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs new file mode 100644 index 0000000000..4233c05f13 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -0,0 +1,651 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Electrical resistivity (also known as resistivity, specific electrical resistance, or volume resistivity) is a fundamental property that quantifies how strongly a given material opposes the flow of electric current. + /// + /// + /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity + /// + public partial struct ElectricResistivity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ElectricResistivityUnit? _unit; + + static ElectricResistivity() + { + BaseDimensions = new BaseDimensions(3, 1, -3, -2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ElectricResistivity(double numericValue, ElectricResistivityUnit unit) + { + if(unit == ElectricResistivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ElectricResistivity, which is OhmMeter. All conversions go via this value. + /// + public static ElectricResistivityUnit BaseUnit => ElectricResistivityUnit.OhmMeter; + + /// + /// Represents the largest possible value of ElectricResistivity + /// + public static ElectricResistivity MaxValue => new ElectricResistivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ElectricResistivity + /// + public static ElectricResistivity MinValue => new ElectricResistivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ElectricResistivity; + + /// + /// All units of measurement for the ElectricResistivity quantity. + /// + public static ElectricResistivityUnit[] Units { get; } = Enum.GetValues(typeof(ElectricResistivityUnit)).Cast().Except(new ElectricResistivityUnit[]{ ElectricResistivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit OhmMeter. + /// + public static ElectricResistivity Zero => new ElectricResistivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ElectricResistivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ElectricResistivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ElectricResistivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ElectricResistivity in MicroohmMeters. + /// + public double MicroohmMeters => As(ElectricResistivityUnit.MicroohmMeter); + + /// + /// Get ElectricResistivity in MilliohmMeters. + /// + public double MilliohmMeters => As(ElectricResistivityUnit.MilliohmMeter); + + /// + /// Get ElectricResistivity in NanoohmMeters. + /// + public double NanoohmMeters => As(ElectricResistivityUnit.NanoohmMeter); + + /// + /// Get ElectricResistivity in OhmMeters. + /// + public double OhmMeters => As(ElectricResistivityUnit.OhmMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ElectricResistivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ElectricResistivityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ElectricResistivity from MicroohmMeters. + /// + /// If value is NaN or Infinity. + public static ElectricResistivity FromMicroohmMeters(QuantityValue microohmmeters) + { + double value = (double) microohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.MicroohmMeter); + } + /// + /// Get ElectricResistivity from MilliohmMeters. + /// + /// If value is NaN or Infinity. + public static ElectricResistivity FromMilliohmMeters(QuantityValue milliohmmeters) + { + double value = (double) milliohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.MilliohmMeter); + } + /// + /// Get ElectricResistivity from NanoohmMeters. + /// + /// If value is NaN or Infinity. + public static ElectricResistivity FromNanoohmMeters(QuantityValue nanoohmmeters) + { + double value = (double) nanoohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.NanoohmMeter); + } + /// + /// Get ElectricResistivity from OhmMeters. + /// + /// If value is NaN or Infinity. + public static ElectricResistivity FromOhmMeters(QuantityValue ohmmeters) + { + double value = (double) ohmmeters; + return new ElectricResistivity(value, ElectricResistivityUnit.OhmMeter); + } + + /// + /// 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 new ElectricResistivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ElectricResistivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricResistivity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ElectricResistivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ElectricResistivity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ElectricResistivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ElectricResistivityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ElectricResistivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ElectricResistivityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); + + return CompareTo((ElectricResistivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ElectricResistivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ElectricResistivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ElectricResistivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ElectricResistivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ElectricResistivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ElectricResistivity to another ElectricResistivity with the unit representation . + /// + /// A ElectricResistivity with the specified unit. + public ElectricResistivity ToUnit(ElectricResistivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ElectricResistivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ElectricResistivityUnit.MicroohmMeter: return (_value) * 1e-6d; + case ElectricResistivityUnit.MilliohmMeter: return (_value) * 1e-3d; + case ElectricResistivityUnit.NanoohmMeter: return (_value) * 1e-9d; + case ElectricResistivityUnit.OhmMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ElectricResistivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ElectricResistivityUnit.MicroohmMeter: return (baseUnitValue) / 1e-6d; + case ElectricResistivityUnit.MilliohmMeter: return (baseUnitValue) / 1e-3d; + case ElectricResistivityUnit.NanoohmMeter: return (baseUnitValue) / 1e-9d; + case ElectricResistivityUnit.OhmMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs new file mode 100644 index 0000000000..7feddd4041 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -0,0 +1,936 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. + /// + public partial struct Energy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly EnergyUnit? _unit; + + static Energy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Energy(double numericValue, EnergyUnit unit) + { + if(unit == EnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Energy, which is Joule. All conversions go via this value. + /// + public static EnergyUnit BaseUnit => EnergyUnit.Joule; + + /// + /// Represents the largest possible value of Energy + /// + public static Energy MaxValue => new Energy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Energy + /// + public static Energy MinValue => new Energy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Energy; + + /// + /// All units of measurement for the Energy quantity. + /// + public static EnergyUnit[] Units { get; } = Enum.GetValues(typeof(EnergyUnit)).Cast().Except(new EnergyUnit[]{ EnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Joule. + /// + public static Energy Zero => new Energy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public EnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Energy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Energy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Energy in BritishThermalUnits. + /// + public double BritishThermalUnits => As(EnergyUnit.BritishThermalUnit); + + /// + /// Get Energy in Calories. + /// + public double Calories => As(EnergyUnit.Calorie); + + /// + /// Get Energy in DecathermsEc. + /// + public double DecathermsEc => As(EnergyUnit.DecathermEc); + + /// + /// Get Energy in DecathermsImperial. + /// + public double DecathermsImperial => As(EnergyUnit.DecathermImperial); + + /// + /// Get Energy in DecathermsUs. + /// + public double DecathermsUs => As(EnergyUnit.DecathermUs); + + /// + /// Get Energy in ElectronVolts. + /// + public double ElectronVolts => As(EnergyUnit.ElectronVolt); + + /// + /// Get Energy in Ergs. + /// + public double Ergs => As(EnergyUnit.Erg); + + /// + /// Get Energy in FootPounds. + /// + public double FootPounds => As(EnergyUnit.FootPound); + + /// + /// Get Energy in GigabritishThermalUnits. + /// + public double GigabritishThermalUnits => As(EnergyUnit.GigabritishThermalUnit); + + /// + /// Get Energy in GigawattHours. + /// + public double GigawattHours => As(EnergyUnit.GigawattHour); + + /// + /// Get Energy in Joules. + /// + public double Joules => As(EnergyUnit.Joule); + + /// + /// Get Energy in KilobritishThermalUnits. + /// + public double KilobritishThermalUnits => As(EnergyUnit.KilobritishThermalUnit); + + /// + /// Get Energy in Kilocalories. + /// + public double Kilocalories => As(EnergyUnit.Kilocalorie); + + /// + /// Get Energy in Kilojoules. + /// + public double Kilojoules => As(EnergyUnit.Kilojoule); + + /// + /// Get Energy in KilowattHours. + /// + public double KilowattHours => As(EnergyUnit.KilowattHour); + + /// + /// Get Energy in MegabritishThermalUnits. + /// + public double MegabritishThermalUnits => As(EnergyUnit.MegabritishThermalUnit); + + /// + /// Get Energy in Megajoules. + /// + public double Megajoules => As(EnergyUnit.Megajoule); + + /// + /// Get Energy in MegawattHours. + /// + public double MegawattHours => As(EnergyUnit.MegawattHour); + + /// + /// Get Energy in ThermsEc. + /// + public double ThermsEc => As(EnergyUnit.ThermEc); + + /// + /// Get Energy in ThermsImperial. + /// + public double ThermsImperial => As(EnergyUnit.ThermImperial); + + /// + /// Get Energy in ThermsUs. + /// + public double ThermsUs => As(EnergyUnit.ThermUs); + + /// + /// Get Energy in WattHours. + /// + public double WattHours => As(EnergyUnit.WattHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(EnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(EnergyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Energy from BritishThermalUnits. + /// + /// If value is NaN or Infinity. + public static Energy FromBritishThermalUnits(QuantityValue britishthermalunits) + { + double value = (double) britishthermalunits; + return new Energy(value, EnergyUnit.BritishThermalUnit); + } + /// + /// Get Energy from Calories. + /// + /// If value is NaN or Infinity. + public static Energy FromCalories(QuantityValue calories) + { + double value = (double) calories; + return new Energy(value, EnergyUnit.Calorie); + } + /// + /// Get Energy from DecathermsEc. + /// + /// If value is NaN or Infinity. + public static Energy FromDecathermsEc(QuantityValue decathermsec) + { + double value = (double) decathermsec; + return new Energy(value, EnergyUnit.DecathermEc); + } + /// + /// Get Energy from DecathermsImperial. + /// + /// If value is NaN or Infinity. + public static Energy FromDecathermsImperial(QuantityValue decathermsimperial) + { + double value = (double) decathermsimperial; + return new Energy(value, EnergyUnit.DecathermImperial); + } + /// + /// Get Energy from DecathermsUs. + /// + /// If value is NaN or Infinity. + public static Energy FromDecathermsUs(QuantityValue decathermsus) + { + double value = (double) decathermsus; + return new Energy(value, EnergyUnit.DecathermUs); + } + /// + /// Get Energy from ElectronVolts. + /// + /// If value is NaN or Infinity. + public static Energy FromElectronVolts(QuantityValue electronvolts) + { + double value = (double) electronvolts; + return new Energy(value, EnergyUnit.ElectronVolt); + } + /// + /// Get Energy from Ergs. + /// + /// If value is NaN or Infinity. + public static Energy FromErgs(QuantityValue ergs) + { + double value = (double) ergs; + return new Energy(value, EnergyUnit.Erg); + } + /// + /// Get Energy from FootPounds. + /// + /// If value is NaN or Infinity. + public static Energy FromFootPounds(QuantityValue footpounds) + { + double value = (double) footpounds; + return new Energy(value, EnergyUnit.FootPound); + } + /// + /// Get Energy from GigabritishThermalUnits. + /// + /// If value is NaN or Infinity. + public static Energy FromGigabritishThermalUnits(QuantityValue gigabritishthermalunits) + { + double value = (double) gigabritishthermalunits; + return new Energy(value, EnergyUnit.GigabritishThermalUnit); + } + /// + /// Get Energy from GigawattHours. + /// + /// If value is NaN or Infinity. + public static Energy FromGigawattHours(QuantityValue gigawatthours) + { + double value = (double) gigawatthours; + return new Energy(value, EnergyUnit.GigawattHour); + } + /// + /// Get Energy from Joules. + /// + /// If value is NaN or Infinity. + public static Energy FromJoules(QuantityValue joules) + { + double value = (double) joules; + return new Energy(value, EnergyUnit.Joule); + } + /// + /// Get Energy from KilobritishThermalUnits. + /// + /// If value is NaN or Infinity. + public static Energy FromKilobritishThermalUnits(QuantityValue kilobritishthermalunits) + { + double value = (double) kilobritishthermalunits; + return new Energy(value, EnergyUnit.KilobritishThermalUnit); + } + /// + /// Get Energy from Kilocalories. + /// + /// If value is NaN or Infinity. + public static Energy FromKilocalories(QuantityValue kilocalories) + { + double value = (double) kilocalories; + return new Energy(value, EnergyUnit.Kilocalorie); + } + /// + /// Get Energy from Kilojoules. + /// + /// If value is NaN or Infinity. + public static Energy FromKilojoules(QuantityValue kilojoules) + { + double value = (double) kilojoules; + return new Energy(value, EnergyUnit.Kilojoule); + } + /// + /// Get Energy from KilowattHours. + /// + /// If value is NaN or Infinity. + public static Energy FromKilowattHours(QuantityValue kilowatthours) + { + double value = (double) kilowatthours; + return new Energy(value, EnergyUnit.KilowattHour); + } + /// + /// Get Energy from MegabritishThermalUnits. + /// + /// If value is NaN or Infinity. + public static Energy FromMegabritishThermalUnits(QuantityValue megabritishthermalunits) + { + double value = (double) megabritishthermalunits; + return new Energy(value, EnergyUnit.MegabritishThermalUnit); + } + /// + /// Get Energy from Megajoules. + /// + /// If value is NaN or Infinity. + public static Energy FromMegajoules(QuantityValue megajoules) + { + double value = (double) megajoules; + return new Energy(value, EnergyUnit.Megajoule); + } + /// + /// Get Energy from MegawattHours. + /// + /// If value is NaN or Infinity. + public static Energy FromMegawattHours(QuantityValue megawatthours) + { + double value = (double) megawatthours; + return new Energy(value, EnergyUnit.MegawattHour); + } + /// + /// Get Energy from ThermsEc. + /// + /// If value is NaN or Infinity. + public static Energy FromThermsEc(QuantityValue thermsec) + { + double value = (double) thermsec; + return new Energy(value, EnergyUnit.ThermEc); + } + /// + /// Get Energy from ThermsImperial. + /// + /// If value is NaN or Infinity. + public static Energy FromThermsImperial(QuantityValue thermsimperial) + { + double value = (double) thermsimperial; + return new Energy(value, EnergyUnit.ThermImperial); + } + /// + /// Get Energy from ThermsUs. + /// + /// If value is NaN or Infinity. + public static Energy FromThermsUs(QuantityValue thermsus) + { + double value = (double) thermsus; + return new Energy(value, EnergyUnit.ThermUs); + } + /// + /// Get Energy from WattHours. + /// + /// If value is NaN or Infinity. + public static Energy FromWattHours(QuantityValue watthours) + { + double value = (double) watthours; + return new Energy(value, EnergyUnit.WattHour); + } + + /// + /// 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 new Energy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Energy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Energy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Energy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Energy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static EnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static EnergyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out EnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out EnergyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Energy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); + + return CompareTo((Energy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Energy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Energy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Energy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Energy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(EnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Energy to another Energy with the unit representation . + /// + /// A Energy with the specified unit. + public Energy ToUnit(EnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Energy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case EnergyUnit.BritishThermalUnit: return _value*1055.05585262; + case EnergyUnit.Calorie: return _value*4.184; + case EnergyUnit.DecathermEc: return (_value*1.05505585262e8) * 1e1d; + case EnergyUnit.DecathermImperial: return (_value*1.05505585257348e8) * 1e1d; + case EnergyUnit.DecathermUs: return (_value*1.054804e8) * 1e1d; + case EnergyUnit.ElectronVolt: return _value*1.602176565e-19; + case EnergyUnit.Erg: return _value*1e-7; + case EnergyUnit.FootPound: return _value*1.355817948; + case EnergyUnit.GigabritishThermalUnit: return (_value*1055.05585262) * 1e9d; + case EnergyUnit.GigawattHour: return (_value*3600d) * 1e9d; + case EnergyUnit.Joule: return _value; + case EnergyUnit.KilobritishThermalUnit: return (_value*1055.05585262) * 1e3d; + case EnergyUnit.Kilocalorie: return (_value*4.184) * 1e3d; + case EnergyUnit.Kilojoule: return (_value) * 1e3d; + case EnergyUnit.KilowattHour: return (_value*3600d) * 1e3d; + case EnergyUnit.MegabritishThermalUnit: return (_value*1055.05585262) * 1e6d; + case EnergyUnit.Megajoule: return (_value) * 1e6d; + case EnergyUnit.MegawattHour: return (_value*3600d) * 1e6d; + case EnergyUnit.ThermEc: return _value*1.05505585262e8; + case EnergyUnit.ThermImperial: return _value*1.05505585257348e8; + case EnergyUnit.ThermUs: return _value*1.054804e8; + case EnergyUnit.WattHour: return _value*3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(EnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case EnergyUnit.BritishThermalUnit: return baseUnitValue/1055.05585262; + case EnergyUnit.Calorie: return baseUnitValue/4.184; + case EnergyUnit.DecathermEc: return (baseUnitValue/1.05505585262e8) / 1e1d; + case EnergyUnit.DecathermImperial: return (baseUnitValue/1.05505585257348e8) / 1e1d; + case EnergyUnit.DecathermUs: return (baseUnitValue/1.054804e8) / 1e1d; + case EnergyUnit.ElectronVolt: return baseUnitValue/1.602176565e-19; + case EnergyUnit.Erg: return baseUnitValue/1e-7; + case EnergyUnit.FootPound: return baseUnitValue/1.355817948; + case EnergyUnit.GigabritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e9d; + case EnergyUnit.GigawattHour: return (baseUnitValue/3600d) / 1e9d; + case EnergyUnit.Joule: return baseUnitValue; + case EnergyUnit.KilobritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e3d; + case EnergyUnit.Kilocalorie: return (baseUnitValue/4.184) / 1e3d; + case EnergyUnit.Kilojoule: return (baseUnitValue) / 1e3d; + case EnergyUnit.KilowattHour: return (baseUnitValue/3600d) / 1e3d; + case EnergyUnit.MegabritishThermalUnit: return (baseUnitValue/1055.05585262) / 1e6d; + case EnergyUnit.Megajoule: return (baseUnitValue) / 1e6d; + case EnergyUnit.MegawattHour: return (baseUnitValue/3600d) / 1e6d; + case EnergyUnit.ThermEc: return baseUnitValue/1.05505585262e8; + case EnergyUnit.ThermImperial: return baseUnitValue/1.05505585257348e8; + case EnergyUnit.ThermUs: return baseUnitValue/1.054804e8; + case EnergyUnit.WattHour: return baseUnitValue/3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs new file mode 100644 index 0000000000..efa316a1f4 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -0,0 +1,696 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units + /// + public partial struct Entropy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly EntropyUnit? _unit; + + static Entropy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Entropy(double numericValue, EntropyUnit unit) + { + if(unit == EntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Entropy, which is JoulePerKelvin. All conversions go via this value. + /// + public static EntropyUnit BaseUnit => EntropyUnit.JoulePerKelvin; + + /// + /// Represents the largest possible value of Entropy + /// + public static Entropy MaxValue => new Entropy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Entropy + /// + public static Entropy MinValue => new Entropy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Entropy; + + /// + /// All units of measurement for the Entropy quantity. + /// + public static EntropyUnit[] Units { get; } = Enum.GetValues(typeof(EntropyUnit)).Cast().Except(new EntropyUnit[]{ EntropyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKelvin. + /// + public static Entropy Zero => new Entropy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public EntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Entropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Entropy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Entropy in CaloriesPerKelvin. + /// + public double CaloriesPerKelvin => As(EntropyUnit.CaloriePerKelvin); + + /// + /// Get Entropy in JoulesPerDegreeCelsius. + /// + public double JoulesPerDegreeCelsius => As(EntropyUnit.JoulePerDegreeCelsius); + + /// + /// Get Entropy in JoulesPerKelvin. + /// + public double JoulesPerKelvin => As(EntropyUnit.JoulePerKelvin); + + /// + /// Get Entropy in KilocaloriesPerKelvin. + /// + public double KilocaloriesPerKelvin => As(EntropyUnit.KilocaloriePerKelvin); + + /// + /// Get Entropy in KilojoulesPerDegreeCelsius. + /// + public double KilojoulesPerDegreeCelsius => As(EntropyUnit.KilojoulePerDegreeCelsius); + + /// + /// Get Entropy in KilojoulesPerKelvin. + /// + public double KilojoulesPerKelvin => As(EntropyUnit.KilojoulePerKelvin); + + /// + /// Get Entropy in MegajoulesPerKelvin. + /// + public double MegajoulesPerKelvin => As(EntropyUnit.MegajoulePerKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(EntropyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(EntropyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Entropy from CaloriesPerKelvin. + /// + /// If value is NaN or Infinity. + public static Entropy FromCaloriesPerKelvin(QuantityValue caloriesperkelvin) + { + double value = (double) caloriesperkelvin; + return new Entropy(value, EntropyUnit.CaloriePerKelvin); + } + /// + /// Get Entropy from JoulesPerDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static Entropy FromJoulesPerDegreeCelsius(QuantityValue joulesperdegreecelsius) + { + double value = (double) joulesperdegreecelsius; + return new Entropy(value, EntropyUnit.JoulePerDegreeCelsius); + } + /// + /// Get Entropy from JoulesPerKelvin. + /// + /// If value is NaN or Infinity. + public static Entropy FromJoulesPerKelvin(QuantityValue joulesperkelvin) + { + double value = (double) joulesperkelvin; + return new Entropy(value, EntropyUnit.JoulePerKelvin); + } + /// + /// Get Entropy from KilocaloriesPerKelvin. + /// + /// If value is NaN or Infinity. + public static Entropy FromKilocaloriesPerKelvin(QuantityValue kilocaloriesperkelvin) + { + double value = (double) kilocaloriesperkelvin; + return new Entropy(value, EntropyUnit.KilocaloriePerKelvin); + } + /// + /// Get Entropy from KilojoulesPerDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static Entropy FromKilojoulesPerDegreeCelsius(QuantityValue kilojoulesperdegreecelsius) + { + double value = (double) kilojoulesperdegreecelsius; + return new Entropy(value, EntropyUnit.KilojoulePerDegreeCelsius); + } + /// + /// Get Entropy from KilojoulesPerKelvin. + /// + /// If value is NaN or Infinity. + public static Entropy FromKilojoulesPerKelvin(QuantityValue kilojoulesperkelvin) + { + double value = (double) kilojoulesperkelvin; + return new Entropy(value, EntropyUnit.KilojoulePerKelvin); + } + /// + /// Get Entropy from MegajoulesPerKelvin. + /// + /// If value is NaN or Infinity. + public static Entropy FromMegajoulesPerKelvin(QuantityValue megajoulesperkelvin) + { + double value = (double) megajoulesperkelvin; + return new Entropy(value, EntropyUnit.MegajoulePerKelvin); + } + + /// + /// 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 new Entropy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Entropy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Entropy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Entropy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Entropy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static EntropyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static EntropyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out EntropyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out EntropyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Entropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); + + return CompareTo((Entropy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Entropy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Entropy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Entropy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Entropy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(EntropyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Entropy to another Entropy with the unit representation . + /// + /// A Entropy with the specified unit. + public Entropy ToUnit(EntropyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Entropy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case EntropyUnit.CaloriePerKelvin: return _value*4.184; + case EntropyUnit.JoulePerDegreeCelsius: return _value; + case EntropyUnit.JoulePerKelvin: return _value; + case EntropyUnit.KilocaloriePerKelvin: return (_value*4.184) * 1e3d; + case EntropyUnit.KilojoulePerDegreeCelsius: return (_value) * 1e3d; + case EntropyUnit.KilojoulePerKelvin: return (_value) * 1e3d; + case EntropyUnit.MegajoulePerKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(EntropyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case EntropyUnit.CaloriePerKelvin: return baseUnitValue/4.184; + case EntropyUnit.JoulePerDegreeCelsius: return baseUnitValue; + case EntropyUnit.JoulePerKelvin: return baseUnitValue; + case EntropyUnit.KilocaloriePerKelvin: return (baseUnitValue/4.184) / 1e3d; + case EntropyUnit.KilojoulePerDegreeCelsius: return (baseUnitValue) / 1e3d; + case EntropyUnit.KilojoulePerKelvin: return (baseUnitValue) / 1e3d; + case EntropyUnit.MegajoulePerKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs new file mode 100644 index 0000000000..9bf4cbd0a1 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -0,0 +1,792 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. + /// + public partial struct Force : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ForceUnit? _unit; + + static Force() + { + BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Force(double numericValue, ForceUnit unit) + { + if(unit == ForceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Force, which is Newton. All conversions go via this value. + /// + public static ForceUnit BaseUnit => ForceUnit.Newton; + + /// + /// Represents the largest possible value of Force + /// + public static Force MaxValue => new Force(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Force + /// + public static Force MinValue => new Force(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Force; + + /// + /// All units of measurement for the Force quantity. + /// + public static ForceUnit[] Units { get; } = Enum.GetValues(typeof(ForceUnit)).Cast().Except(new ForceUnit[]{ ForceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Newton. + /// + public static Force Zero => new Force(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ForceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Force.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Force.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Force in Decanewtons. + /// + public double Decanewtons => As(ForceUnit.Decanewton); + + /// + /// Get Force in Dyne. + /// + public double Dyne => As(ForceUnit.Dyn); + + /// + /// Get Force in KilogramsForce. + /// + public double KilogramsForce => As(ForceUnit.KilogramForce); + + /// + /// Get Force in Kilonewtons. + /// + public double Kilonewtons => As(ForceUnit.Kilonewton); + + /// + /// Get Force in KiloPonds. + /// + public double KiloPonds => As(ForceUnit.KiloPond); + + /// + /// Get Force in Meganewtons. + /// + public double Meganewtons => As(ForceUnit.Meganewton); + + /// + /// Get Force in Micronewtons. + /// + public double Micronewtons => As(ForceUnit.Micronewton); + + /// + /// Get Force in Millinewtons. + /// + public double Millinewtons => As(ForceUnit.Millinewton); + + /// + /// Get Force in Newtons. + /// + public double Newtons => As(ForceUnit.Newton); + + /// + /// Get Force in OunceForce. + /// + public double OunceForce => As(ForceUnit.OunceForce); + + /// + /// Get Force in Poundals. + /// + public double Poundals => As(ForceUnit.Poundal); + + /// + /// Get Force in PoundsForce. + /// + public double PoundsForce => As(ForceUnit.PoundForce); + + /// + /// Get Force in TonnesForce. + /// + public double TonnesForce => As(ForceUnit.TonneForce); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ForceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ForceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Force from Decanewtons. + /// + /// If value is NaN or Infinity. + public static Force FromDecanewtons(QuantityValue decanewtons) + { + double value = (double) decanewtons; + return new Force(value, ForceUnit.Decanewton); + } + /// + /// Get Force from Dyne. + /// + /// If value is NaN or Infinity. + public static Force FromDyne(QuantityValue dyne) + { + double value = (double) dyne; + return new Force(value, ForceUnit.Dyn); + } + /// + /// Get Force from KilogramsForce. + /// + /// If value is NaN or Infinity. + public static Force FromKilogramsForce(QuantityValue kilogramsforce) + { + double value = (double) kilogramsforce; + return new Force(value, ForceUnit.KilogramForce); + } + /// + /// Get Force from Kilonewtons. + /// + /// If value is NaN or Infinity. + public static Force FromKilonewtons(QuantityValue kilonewtons) + { + double value = (double) kilonewtons; + return new Force(value, ForceUnit.Kilonewton); + } + /// + /// Get Force from KiloPonds. + /// + /// If value is NaN or Infinity. + public static Force FromKiloPonds(QuantityValue kiloponds) + { + double value = (double) kiloponds; + return new Force(value, ForceUnit.KiloPond); + } + /// + /// Get Force from Meganewtons. + /// + /// If value is NaN or Infinity. + public static Force FromMeganewtons(QuantityValue meganewtons) + { + double value = (double) meganewtons; + return new Force(value, ForceUnit.Meganewton); + } + /// + /// Get Force from Micronewtons. + /// + /// If value is NaN or Infinity. + public static Force FromMicronewtons(QuantityValue micronewtons) + { + double value = (double) micronewtons; + return new Force(value, ForceUnit.Micronewton); + } + /// + /// Get Force from Millinewtons. + /// + /// If value is NaN or Infinity. + public static Force FromMillinewtons(QuantityValue millinewtons) + { + double value = (double) millinewtons; + return new Force(value, ForceUnit.Millinewton); + } + /// + /// Get Force from Newtons. + /// + /// If value is NaN or Infinity. + public static Force FromNewtons(QuantityValue newtons) + { + double value = (double) newtons; + return new Force(value, ForceUnit.Newton); + } + /// + /// Get Force from OunceForce. + /// + /// If value is NaN or Infinity. + public static Force FromOunceForce(QuantityValue ounceforce) + { + double value = (double) ounceforce; + return new Force(value, ForceUnit.OunceForce); + } + /// + /// Get Force from Poundals. + /// + /// If value is NaN or Infinity. + public static Force FromPoundals(QuantityValue poundals) + { + double value = (double) poundals; + return new Force(value, ForceUnit.Poundal); + } + /// + /// Get Force from PoundsForce. + /// + /// If value is NaN or Infinity. + public static Force FromPoundsForce(QuantityValue poundsforce) + { + double value = (double) poundsforce; + return new Force(value, ForceUnit.PoundForce); + } + /// + /// Get Force from TonnesForce. + /// + /// If value is NaN or Infinity. + public static Force FromTonnesForce(QuantityValue tonnesforce) + { + double value = (double) tonnesforce; + return new Force(value, ForceUnit.TonneForce); + } + + /// + /// 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 new Force((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Force Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Force Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Force result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Force result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ForceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ForceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ForceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Force)) throw new ArgumentException("Expected type Force.", nameof(obj)); + + return CompareTo((Force)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Force other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Force within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Force other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Force. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ForceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Force to another Force with the unit representation . + /// + /// A Force with the specified unit. + public Force ToUnit(ForceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Force(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ForceUnit.Decanewton: return (_value) * 1e1d; + case ForceUnit.Dyn: return _value/1e5; + case ForceUnit.KilogramForce: return _value*9.80665002864; + case ForceUnit.Kilonewton: return (_value) * 1e3d; + case ForceUnit.KiloPond: return _value*9.80665002864; + case ForceUnit.Meganewton: return (_value) * 1e6d; + case ForceUnit.Micronewton: return (_value) * 1e-6d; + case ForceUnit.Millinewton: return (_value) * 1e-3d; + case ForceUnit.Newton: return _value; + case ForceUnit.OunceForce: return _value*2.780138509537812e-1; + case ForceUnit.Poundal: return _value*0.13825502798973041652092282466083; + case ForceUnit.PoundForce: return _value*4.4482216152605095551842641431421; + case ForceUnit.TonneForce: return _value*9.80665002864e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ForceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ForceUnit.Decanewton: return (baseUnitValue) / 1e1d; + case ForceUnit.Dyn: return baseUnitValue*1e5; + case ForceUnit.KilogramForce: return baseUnitValue/9.80665002864; + case ForceUnit.Kilonewton: return (baseUnitValue) / 1e3d; + case ForceUnit.KiloPond: return baseUnitValue/9.80665002864; + case ForceUnit.Meganewton: return (baseUnitValue) / 1e6d; + case ForceUnit.Micronewton: return (baseUnitValue) / 1e-6d; + case ForceUnit.Millinewton: return (baseUnitValue) / 1e-3d; + case ForceUnit.Newton: return baseUnitValue; + case ForceUnit.OunceForce: return baseUnitValue/2.780138509537812e-1; + case ForceUnit.Poundal: return baseUnitValue/0.13825502798973041652092282466083; + case ForceUnit.PoundForce: return baseUnitValue/4.4482216152605095551842641431421; + case ForceUnit.TonneForce: return baseUnitValue/9.80665002864e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs new file mode 100644 index 0000000000..20dc3630b2 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -0,0 +1,760 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). + /// + public partial struct ForceChangeRate : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ForceChangeRateUnit? _unit; + + static ForceChangeRate() + { + BaseDimensions = new BaseDimensions(1, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ForceChangeRate(double numericValue, ForceChangeRateUnit unit) + { + if(unit == ForceChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ForceChangeRate, which is NewtonPerSecond. All conversions go via this value. + /// + public static ForceChangeRateUnit BaseUnit => ForceChangeRateUnit.NewtonPerSecond; + + /// + /// Represents the largest possible value of ForceChangeRate + /// + public static ForceChangeRate MaxValue => new ForceChangeRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ForceChangeRate + /// + public static ForceChangeRate MinValue => new ForceChangeRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ForceChangeRate; + + /// + /// All units of measurement for the ForceChangeRate quantity. + /// + public static ForceChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(ForceChangeRateUnit)).Cast().Except(new ForceChangeRateUnit[]{ ForceChangeRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerSecond. + /// + public static ForceChangeRate Zero => new ForceChangeRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ForceChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ForceChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ForceChangeRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ForceChangeRate in CentinewtonsPerSecond. + /// + public double CentinewtonsPerSecond => As(ForceChangeRateUnit.CentinewtonPerSecond); + + /// + /// Get ForceChangeRate in DecanewtonsPerMinute. + /// + public double DecanewtonsPerMinute => As(ForceChangeRateUnit.DecanewtonPerMinute); + + /// + /// Get ForceChangeRate in DecanewtonsPerSecond. + /// + public double DecanewtonsPerSecond => As(ForceChangeRateUnit.DecanewtonPerSecond); + + /// + /// Get ForceChangeRate in DecinewtonsPerSecond. + /// + public double DecinewtonsPerSecond => As(ForceChangeRateUnit.DecinewtonPerSecond); + + /// + /// Get ForceChangeRate in KilonewtonsPerMinute. + /// + public double KilonewtonsPerMinute => As(ForceChangeRateUnit.KilonewtonPerMinute); + + /// + /// Get ForceChangeRate in KilonewtonsPerSecond. + /// + public double KilonewtonsPerSecond => As(ForceChangeRateUnit.KilonewtonPerSecond); + + /// + /// Get ForceChangeRate in MicronewtonsPerSecond. + /// + public double MicronewtonsPerSecond => As(ForceChangeRateUnit.MicronewtonPerSecond); + + /// + /// Get ForceChangeRate in MillinewtonsPerSecond. + /// + public double MillinewtonsPerSecond => As(ForceChangeRateUnit.MillinewtonPerSecond); + + /// + /// Get ForceChangeRate in NanonewtonsPerSecond. + /// + public double NanonewtonsPerSecond => As(ForceChangeRateUnit.NanonewtonPerSecond); + + /// + /// Get ForceChangeRate in NewtonsPerMinute. + /// + public double NewtonsPerMinute => As(ForceChangeRateUnit.NewtonPerMinute); + + /// + /// Get ForceChangeRate in NewtonsPerSecond. + /// + public double NewtonsPerSecond => As(ForceChangeRateUnit.NewtonPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ForceChangeRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ForceChangeRateUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ForceChangeRate from CentinewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromCentinewtonsPerSecond(QuantityValue centinewtonspersecond) + { + double value = (double) centinewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.CentinewtonPerSecond); + } + /// + /// Get ForceChangeRate from DecanewtonsPerMinute. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromDecanewtonsPerMinute(QuantityValue decanewtonsperminute) + { + double value = (double) decanewtonsperminute; + return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerMinute); + } + /// + /// Get ForceChangeRate from DecanewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromDecanewtonsPerSecond(QuantityValue decanewtonspersecond) + { + double value = (double) decanewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.DecanewtonPerSecond); + } + /// + /// Get ForceChangeRate from DecinewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromDecinewtonsPerSecond(QuantityValue decinewtonspersecond) + { + double value = (double) decinewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.DecinewtonPerSecond); + } + /// + /// Get ForceChangeRate from KilonewtonsPerMinute. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromKilonewtonsPerMinute(QuantityValue kilonewtonsperminute) + { + double value = (double) kilonewtonsperminute; + return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerMinute); + } + /// + /// Get ForceChangeRate from KilonewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromKilonewtonsPerSecond(QuantityValue kilonewtonspersecond) + { + double value = (double) kilonewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.KilonewtonPerSecond); + } + /// + /// Get ForceChangeRate from MicronewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromMicronewtonsPerSecond(QuantityValue micronewtonspersecond) + { + double value = (double) micronewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.MicronewtonPerSecond); + } + /// + /// Get ForceChangeRate from MillinewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromMillinewtonsPerSecond(QuantityValue millinewtonspersecond) + { + double value = (double) millinewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.MillinewtonPerSecond); + } + /// + /// Get ForceChangeRate from NanonewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromNanonewtonsPerSecond(QuantityValue nanonewtonspersecond) + { + double value = (double) nanonewtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.NanonewtonPerSecond); + } + /// + /// Get ForceChangeRate from NewtonsPerMinute. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromNewtonsPerMinute(QuantityValue newtonsperminute) + { + double value = (double) newtonsperminute; + return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerMinute); + } + /// + /// Get ForceChangeRate from NewtonsPerSecond. + /// + /// If value is NaN or Infinity. + public static ForceChangeRate FromNewtonsPerSecond(QuantityValue newtonspersecond) + { + double value = (double) newtonspersecond; + return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerSecond); + } + + /// + /// 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 new ForceChangeRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ForceChangeRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ForceChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ForceChangeRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForceChangeRate result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForceChangeRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ForceChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ForceChangeRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ForceChangeRateUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); + + return CompareTo((ForceChangeRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ForceChangeRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ForceChangeRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ForceChangeRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ForceChangeRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ForceChangeRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ForceChangeRate to another ForceChangeRate with the unit representation . + /// + /// A ForceChangeRate with the specified unit. + public ForceChangeRate ToUnit(ForceChangeRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ForceChangeRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ForceChangeRateUnit.CentinewtonPerSecond: return (_value) * 1e-2d; + case ForceChangeRateUnit.DecanewtonPerMinute: return (_value/60) * 1e1d; + case ForceChangeRateUnit.DecanewtonPerSecond: return (_value) * 1e1d; + case ForceChangeRateUnit.DecinewtonPerSecond: return (_value) * 1e-1d; + case ForceChangeRateUnit.KilonewtonPerMinute: return (_value/60) * 1e3d; + case ForceChangeRateUnit.KilonewtonPerSecond: return (_value) * 1e3d; + case ForceChangeRateUnit.MicronewtonPerSecond: return (_value) * 1e-6d; + case ForceChangeRateUnit.MillinewtonPerSecond: return (_value) * 1e-3d; + case ForceChangeRateUnit.NanonewtonPerSecond: return (_value) * 1e-9d; + case ForceChangeRateUnit.NewtonPerMinute: return _value/60; + case ForceChangeRateUnit.NewtonPerSecond: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ForceChangeRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ForceChangeRateUnit.CentinewtonPerSecond: return (baseUnitValue) / 1e-2d; + case ForceChangeRateUnit.DecanewtonPerMinute: return (baseUnitValue*60) / 1e1d; + case ForceChangeRateUnit.DecanewtonPerSecond: return (baseUnitValue) / 1e1d; + case ForceChangeRateUnit.DecinewtonPerSecond: return (baseUnitValue) / 1e-1d; + case ForceChangeRateUnit.KilonewtonPerMinute: return (baseUnitValue*60) / 1e3d; + case ForceChangeRateUnit.KilonewtonPerSecond: return (baseUnitValue) / 1e3d; + case ForceChangeRateUnit.MicronewtonPerSecond: return (baseUnitValue) / 1e-6d; + case ForceChangeRateUnit.MillinewtonPerSecond: return (baseUnitValue) / 1e-3d; + case ForceChangeRateUnit.NanonewtonPerSecond: return (baseUnitValue) / 1e-9d; + case ForceChangeRateUnit.NewtonPerMinute: return baseUnitValue*60; + case ForceChangeRateUnit.NewtonPerSecond: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs new file mode 100644 index 0000000000..201b21a8c9 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -0,0 +1,728 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The magnitude of force per unit length. + /// + public partial struct ForcePerLength : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ForcePerLengthUnit? _unit; + + static ForcePerLength() + { + BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ForcePerLength(double numericValue, ForcePerLengthUnit unit) + { + if(unit == ForcePerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ForcePerLength, which is NewtonPerMeter. All conversions go via this value. + /// + public static ForcePerLengthUnit BaseUnit => ForcePerLengthUnit.NewtonPerMeter; + + /// + /// Represents the largest possible value of ForcePerLength + /// + public static ForcePerLength MaxValue => new ForcePerLength(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ForcePerLength + /// + public static ForcePerLength MinValue => new ForcePerLength(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ForcePerLength; + + /// + /// All units of measurement for the ForcePerLength quantity. + /// + public static ForcePerLengthUnit[] Units { get; } = Enum.GetValues(typeof(ForcePerLengthUnit)).Cast().Except(new ForcePerLengthUnit[]{ ForcePerLengthUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerMeter. + /// + public static ForcePerLength Zero => new ForcePerLength(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ForcePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ForcePerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ForcePerLength.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ForcePerLength in CentinewtonsPerMeter. + /// + public double CentinewtonsPerMeter => As(ForcePerLengthUnit.CentinewtonPerMeter); + + /// + /// Get ForcePerLength in DecinewtonsPerMeter. + /// + public double DecinewtonsPerMeter => As(ForcePerLengthUnit.DecinewtonPerMeter); + + /// + /// Get ForcePerLength in KilogramsForcePerMeter. + /// + public double KilogramsForcePerMeter => As(ForcePerLengthUnit.KilogramForcePerMeter); + + /// + /// Get ForcePerLength in KilonewtonsPerMeter. + /// + public double KilonewtonsPerMeter => As(ForcePerLengthUnit.KilonewtonPerMeter); + + /// + /// Get ForcePerLength in MeganewtonsPerMeter. + /// + public double MeganewtonsPerMeter => As(ForcePerLengthUnit.MeganewtonPerMeter); + + /// + /// Get ForcePerLength in MicronewtonsPerMeter. + /// + public double MicronewtonsPerMeter => As(ForcePerLengthUnit.MicronewtonPerMeter); + + /// + /// Get ForcePerLength in MillinewtonsPerMeter. + /// + public double MillinewtonsPerMeter => As(ForcePerLengthUnit.MillinewtonPerMeter); + + /// + /// Get ForcePerLength in NanonewtonsPerMeter. + /// + public double NanonewtonsPerMeter => As(ForcePerLengthUnit.NanonewtonPerMeter); + + /// + /// Get ForcePerLength in NewtonsPerMeter. + /// + public double NewtonsPerMeter => As(ForcePerLengthUnit.NewtonPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ForcePerLengthUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ForcePerLengthUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ForcePerLength from CentinewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromCentinewtonsPerMeter(QuantityValue centinewtonspermeter) + { + double value = (double) centinewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.CentinewtonPerMeter); + } + /// + /// Get ForcePerLength from DecinewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromDecinewtonsPerMeter(QuantityValue decinewtonspermeter) + { + double value = (double) decinewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.DecinewtonPerMeter); + } + /// + /// Get ForcePerLength from KilogramsForcePerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromKilogramsForcePerMeter(QuantityValue kilogramsforcepermeter) + { + double value = (double) kilogramsforcepermeter; + return new ForcePerLength(value, ForcePerLengthUnit.KilogramForcePerMeter); + } + /// + /// Get ForcePerLength from KilonewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromKilonewtonsPerMeter(QuantityValue kilonewtonspermeter) + { + double value = (double) kilonewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.KilonewtonPerMeter); + } + /// + /// Get ForcePerLength from MeganewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromMeganewtonsPerMeter(QuantityValue meganewtonspermeter) + { + double value = (double) meganewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.MeganewtonPerMeter); + } + /// + /// Get ForcePerLength from MicronewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromMicronewtonsPerMeter(QuantityValue micronewtonspermeter) + { + double value = (double) micronewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.MicronewtonPerMeter); + } + /// + /// Get ForcePerLength from MillinewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromMillinewtonsPerMeter(QuantityValue millinewtonspermeter) + { + double value = (double) millinewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.MillinewtonPerMeter); + } + /// + /// Get ForcePerLength from NanonewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromNanonewtonsPerMeter(QuantityValue nanonewtonspermeter) + { + double value = (double) nanonewtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.NanonewtonPerMeter); + } + /// + /// Get ForcePerLength from NewtonsPerMeter. + /// + /// If value is NaN or Infinity. + public static ForcePerLength FromNewtonsPerMeter(QuantityValue newtonspermeter) + { + double value = (double) newtonspermeter; + return new ForcePerLength(value, ForcePerLengthUnit.NewtonPerMeter); + } + + /// + /// 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 new ForcePerLength((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ForcePerLength Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ForcePerLength Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ForcePerLength result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ForcePerLength result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ForcePerLengthUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ForcePerLengthUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ForcePerLengthUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ForcePerLengthUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); + + return CompareTo((ForcePerLength)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ForcePerLength other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ForcePerLength within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ForcePerLength other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ForcePerLength. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ForcePerLengthUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ForcePerLength to another ForcePerLength with the unit representation . + /// + /// A ForcePerLength with the specified unit. + public ForcePerLength ToUnit(ForcePerLengthUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ForcePerLength(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ForcePerLengthUnit.CentinewtonPerMeter: return (_value) * 1e-2d; + case ForcePerLengthUnit.DecinewtonPerMeter: return (_value) * 1e-1d; + case ForcePerLengthUnit.KilogramForcePerMeter: return _value*9.80665002864; + case ForcePerLengthUnit.KilonewtonPerMeter: return (_value) * 1e3d; + case ForcePerLengthUnit.MeganewtonPerMeter: return (_value) * 1e6d; + case ForcePerLengthUnit.MicronewtonPerMeter: return (_value) * 1e-6d; + case ForcePerLengthUnit.MillinewtonPerMeter: return (_value) * 1e-3d; + case ForcePerLengthUnit.NanonewtonPerMeter: return (_value) * 1e-9d; + case ForcePerLengthUnit.NewtonPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ForcePerLengthUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ForcePerLengthUnit.CentinewtonPerMeter: return (baseUnitValue) / 1e-2d; + case ForcePerLengthUnit.DecinewtonPerMeter: return (baseUnitValue) / 1e-1d; + case ForcePerLengthUnit.KilogramForcePerMeter: return baseUnitValue/9.80665002864; + case ForcePerLengthUnit.KilonewtonPerMeter: return (baseUnitValue) / 1e3d; + case ForcePerLengthUnit.MeganewtonPerMeter: return (baseUnitValue) / 1e6d; + case ForcePerLengthUnit.MicronewtonPerMeter: return (baseUnitValue) / 1e-6d; + case ForcePerLengthUnit.MillinewtonPerMeter: return (baseUnitValue) / 1e-3d; + case ForcePerLengthUnit.NanonewtonPerMeter: return (baseUnitValue) / 1e-9d; + case ForcePerLengthUnit.NewtonPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs new file mode 100644 index 0000000000..49959d51ca --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -0,0 +1,712 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The number of occurrences of a repeating event per unit time. + /// + public partial struct Frequency : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly FrequencyUnit? _unit; + + static Frequency() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Frequency(double numericValue, FrequencyUnit unit) + { + if(unit == FrequencyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Frequency, which is Hertz. All conversions go via this value. + /// + public static FrequencyUnit BaseUnit => FrequencyUnit.Hertz; + + /// + /// Represents the largest possible value of Frequency + /// + public static Frequency MaxValue => new Frequency(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Frequency + /// + public static Frequency MinValue => new Frequency(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Frequency; + + /// + /// All units of measurement for the Frequency quantity. + /// + public static FrequencyUnit[] Units { get; } = Enum.GetValues(typeof(FrequencyUnit)).Cast().Except(new FrequencyUnit[]{ FrequencyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Hertz. + /// + public static Frequency Zero => new Frequency(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public FrequencyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Frequency.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Frequency.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Frequency in CyclesPerHour. + /// + public double CyclesPerHour => As(FrequencyUnit.CyclePerHour); + + /// + /// Get Frequency in CyclesPerMinute. + /// + public double CyclesPerMinute => As(FrequencyUnit.CyclePerMinute); + + /// + /// Get Frequency in Gigahertz. + /// + public double Gigahertz => As(FrequencyUnit.Gigahertz); + + /// + /// Get Frequency in Hertz. + /// + public double Hertz => As(FrequencyUnit.Hertz); + + /// + /// Get Frequency in Kilohertz. + /// + public double Kilohertz => As(FrequencyUnit.Kilohertz); + + /// + /// Get Frequency in Megahertz. + /// + public double Megahertz => As(FrequencyUnit.Megahertz); + + /// + /// Get Frequency in RadiansPerSecond. + /// + public double RadiansPerSecond => As(FrequencyUnit.RadianPerSecond); + + /// + /// Get Frequency in Terahertz. + /// + public double Terahertz => As(FrequencyUnit.Terahertz); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(FrequencyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(FrequencyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Frequency from CyclesPerHour. + /// + /// If value is NaN or Infinity. + public static Frequency FromCyclesPerHour(QuantityValue cyclesperhour) + { + double value = (double) cyclesperhour; + return new Frequency(value, FrequencyUnit.CyclePerHour); + } + /// + /// Get Frequency from CyclesPerMinute. + /// + /// If value is NaN or Infinity. + public static Frequency FromCyclesPerMinute(QuantityValue cyclesperminute) + { + double value = (double) cyclesperminute; + return new Frequency(value, FrequencyUnit.CyclePerMinute); + } + /// + /// Get Frequency from Gigahertz. + /// + /// If value is NaN or Infinity. + public static Frequency FromGigahertz(QuantityValue gigahertz) + { + double value = (double) gigahertz; + return new Frequency(value, FrequencyUnit.Gigahertz); + } + /// + /// Get Frequency from Hertz. + /// + /// If value is NaN or Infinity. + public static Frequency FromHertz(QuantityValue hertz) + { + double value = (double) hertz; + return new Frequency(value, FrequencyUnit.Hertz); + } + /// + /// Get Frequency from Kilohertz. + /// + /// If value is NaN or Infinity. + public static Frequency FromKilohertz(QuantityValue kilohertz) + { + double value = (double) kilohertz; + return new Frequency(value, FrequencyUnit.Kilohertz); + } + /// + /// Get Frequency from Megahertz. + /// + /// If value is NaN or Infinity. + public static Frequency FromMegahertz(QuantityValue megahertz) + { + double value = (double) megahertz; + return new Frequency(value, FrequencyUnit.Megahertz); + } + /// + /// Get Frequency from RadiansPerSecond. + /// + /// If value is NaN or Infinity. + public static Frequency FromRadiansPerSecond(QuantityValue radianspersecond) + { + double value = (double) radianspersecond; + return new Frequency(value, FrequencyUnit.RadianPerSecond); + } + /// + /// Get Frequency from Terahertz. + /// + /// If value is NaN or Infinity. + public static Frequency FromTerahertz(QuantityValue terahertz) + { + double value = (double) terahertz; + return new Frequency(value, FrequencyUnit.Terahertz); + } + + /// + /// 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 new Frequency((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Frequency Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Frequency Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Frequency result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Frequency result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static FrequencyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static FrequencyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out FrequencyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out FrequencyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Frequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); + + return CompareTo((Frequency)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Frequency other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Frequency within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Frequency other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Frequency. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(FrequencyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Frequency to another Frequency with the unit representation . + /// + /// A Frequency with the specified unit. + public Frequency ToUnit(FrequencyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Frequency(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case FrequencyUnit.CyclePerHour: return _value/3600; + case FrequencyUnit.CyclePerMinute: return _value/60; + case FrequencyUnit.Gigahertz: return (_value) * 1e9d; + case FrequencyUnit.Hertz: return _value; + case FrequencyUnit.Kilohertz: return (_value) * 1e3d; + case FrequencyUnit.Megahertz: return (_value) * 1e6d; + case FrequencyUnit.RadianPerSecond: return _value/6.2831853072; + case FrequencyUnit.Terahertz: return (_value) * 1e12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(FrequencyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case FrequencyUnit.CyclePerHour: return baseUnitValue*3600; + case FrequencyUnit.CyclePerMinute: return baseUnitValue*60; + case FrequencyUnit.Gigahertz: return (baseUnitValue) / 1e9d; + case FrequencyUnit.Hertz: return baseUnitValue; + case FrequencyUnit.Kilohertz: return (baseUnitValue) / 1e3d; + case FrequencyUnit.Megahertz: return (baseUnitValue) / 1e6d; + case FrequencyUnit.RadianPerSecond: return baseUnitValue*6.2831853072; + case FrequencyUnit.Terahertz: return (baseUnitValue) / 1e12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs new file mode 100644 index 0000000000..8005e0e610 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -0,0 +1,840 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Heat flux is the flow of energy per unit of area per unit of time + /// + public partial struct HeatFlux : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly HeatFluxUnit? _unit; + + static HeatFlux() + { + BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public HeatFlux(double numericValue, HeatFluxUnit unit) + { + if(unit == HeatFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of HeatFlux, which is WattPerSquareMeter. All conversions go via this value. + /// + public static HeatFluxUnit BaseUnit => HeatFluxUnit.WattPerSquareMeter; + + /// + /// Represents the largest possible value of HeatFlux + /// + public static HeatFlux MaxValue => new HeatFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of HeatFlux + /// + public static HeatFlux MinValue => new HeatFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.HeatFlux; + + /// + /// All units of measurement for the HeatFlux quantity. + /// + public static HeatFluxUnit[] Units { get; } = Enum.GetValues(typeof(HeatFluxUnit)).Cast().Except(new HeatFluxUnit[]{ HeatFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. + /// + public static HeatFlux Zero => new HeatFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public HeatFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => HeatFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => HeatFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get HeatFlux in BtusPerHourSquareFoot. + /// + public double BtusPerHourSquareFoot => As(HeatFluxUnit.BtuPerHourSquareFoot); + + /// + /// Get HeatFlux in BtusPerMinuteSquareFoot. + /// + public double BtusPerMinuteSquareFoot => As(HeatFluxUnit.BtuPerMinuteSquareFoot); + + /// + /// Get HeatFlux in BtusPerSecondSquareFoot. + /// + public double BtusPerSecondSquareFoot => As(HeatFluxUnit.BtuPerSecondSquareFoot); + + /// + /// Get HeatFlux in BtusPerSecondSquareInch. + /// + public double BtusPerSecondSquareInch => As(HeatFluxUnit.BtuPerSecondSquareInch); + + /// + /// Get HeatFlux in CaloriesPerSecondSquareCentimeter. + /// + public double CaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.CaloriePerSecondSquareCentimeter); + + /// + /// Get HeatFlux in CentiwattsPerSquareMeter. + /// + public double CentiwattsPerSquareMeter => As(HeatFluxUnit.CentiwattPerSquareMeter); + + /// + /// Get HeatFlux in DeciwattsPerSquareMeter. + /// + public double DeciwattsPerSquareMeter => As(HeatFluxUnit.DeciwattPerSquareMeter); + + /// + /// Get HeatFlux in KilocaloriesPerHourSquareMeter. + /// + public double KilocaloriesPerHourSquareMeter => As(HeatFluxUnit.KilocaloriePerHourSquareMeter); + + /// + /// Get HeatFlux in KilocaloriesPerSecondSquareCentimeter. + /// + public double KilocaloriesPerSecondSquareCentimeter => As(HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); + + /// + /// Get HeatFlux in KilowattsPerSquareMeter. + /// + public double KilowattsPerSquareMeter => As(HeatFluxUnit.KilowattPerSquareMeter); + + /// + /// Get HeatFlux in MicrowattsPerSquareMeter. + /// + public double MicrowattsPerSquareMeter => As(HeatFluxUnit.MicrowattPerSquareMeter); + + /// + /// Get HeatFlux in MilliwattsPerSquareMeter. + /// + public double MilliwattsPerSquareMeter => As(HeatFluxUnit.MilliwattPerSquareMeter); + + /// + /// Get HeatFlux in NanowattsPerSquareMeter. + /// + public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); + + /// + /// Get HeatFlux in WattsPerSquareFoot. + /// + public double WattsPerSquareFoot => As(HeatFluxUnit.WattPerSquareFoot); + + /// + /// Get HeatFlux in WattsPerSquareInch. + /// + public double WattsPerSquareInch => As(HeatFluxUnit.WattPerSquareInch); + + /// + /// Get HeatFlux in WattsPerSquareMeter. + /// + public double WattsPerSquareMeter => As(HeatFluxUnit.WattPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(HeatFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(HeatFluxUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get HeatFlux from BtusPerHourSquareFoot. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromBtusPerHourSquareFoot(QuantityValue btusperhoursquarefoot) + { + double value = (double) btusperhoursquarefoot; + return new HeatFlux(value, HeatFluxUnit.BtuPerHourSquareFoot); + } + /// + /// Get HeatFlux from BtusPerMinuteSquareFoot. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromBtusPerMinuteSquareFoot(QuantityValue btusperminutesquarefoot) + { + double value = (double) btusperminutesquarefoot; + return new HeatFlux(value, HeatFluxUnit.BtuPerMinuteSquareFoot); + } + /// + /// Get HeatFlux from BtusPerSecondSquareFoot. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromBtusPerSecondSquareFoot(QuantityValue btuspersecondsquarefoot) + { + double value = (double) btuspersecondsquarefoot; + return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareFoot); + } + /// + /// Get HeatFlux from BtusPerSecondSquareInch. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromBtusPerSecondSquareInch(QuantityValue btuspersecondsquareinch) + { + double value = (double) btuspersecondsquareinch; + return new HeatFlux(value, HeatFluxUnit.BtuPerSecondSquareInch); + } + /// + /// Get HeatFlux from CaloriesPerSecondSquareCentimeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromCaloriesPerSecondSquareCentimeter(QuantityValue caloriespersecondsquarecentimeter) + { + double value = (double) caloriespersecondsquarecentimeter; + return new HeatFlux(value, HeatFluxUnit.CaloriePerSecondSquareCentimeter); + } + /// + /// Get HeatFlux from CentiwattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromCentiwattsPerSquareMeter(QuantityValue centiwattspersquaremeter) + { + double value = (double) centiwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.CentiwattPerSquareMeter); + } + /// + /// Get HeatFlux from DeciwattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromDeciwattsPerSquareMeter(QuantityValue deciwattspersquaremeter) + { + double value = (double) deciwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.DeciwattPerSquareMeter); + } + /// + /// Get HeatFlux from KilocaloriesPerHourSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromKilocaloriesPerHourSquareMeter(QuantityValue kilocaloriesperhoursquaremeter) + { + double value = (double) kilocaloriesperhoursquaremeter; + return new HeatFlux(value, HeatFluxUnit.KilocaloriePerHourSquareMeter); + } + /// + /// Get HeatFlux from KilocaloriesPerSecondSquareCentimeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromKilocaloriesPerSecondSquareCentimeter(QuantityValue kilocaloriespersecondsquarecentimeter) + { + double value = (double) kilocaloriespersecondsquarecentimeter; + return new HeatFlux(value, HeatFluxUnit.KilocaloriePerSecondSquareCentimeter); + } + /// + /// Get HeatFlux from KilowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) + { + double value = (double) kilowattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.KilowattPerSquareMeter); + } + /// + /// Get HeatFlux from MicrowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromMicrowattsPerSquareMeter(QuantityValue microwattspersquaremeter) + { + double value = (double) microwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.MicrowattPerSquareMeter); + } + /// + /// Get HeatFlux from MilliwattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromMilliwattsPerSquareMeter(QuantityValue milliwattspersquaremeter) + { + double value = (double) milliwattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.MilliwattPerSquareMeter); + } + /// + /// Get HeatFlux from NanowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersquaremeter) + { + double value = (double) nanowattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); + } + /// + /// Get HeatFlux from WattsPerSquareFoot. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromWattsPerSquareFoot(QuantityValue wattspersquarefoot) + { + double value = (double) wattspersquarefoot; + return new HeatFlux(value, HeatFluxUnit.WattPerSquareFoot); + } + /// + /// Get HeatFlux from WattsPerSquareInch. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromWattsPerSquareInch(QuantityValue wattspersquareinch) + { + double value = (double) wattspersquareinch; + return new HeatFlux(value, HeatFluxUnit.WattPerSquareInch); + } + /// + /// Get HeatFlux from WattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static HeatFlux FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) + { + double value = (double) wattspersquaremeter; + return new HeatFlux(value, HeatFluxUnit.WattPerSquareMeter); + } + + /// + /// 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 new HeatFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static HeatFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static HeatFlux Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out HeatFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatFlux result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static HeatFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static HeatFluxUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out HeatFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFluxUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is HeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); + + return CompareTo((HeatFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(HeatFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another HeatFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current HeatFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(HeatFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this HeatFlux to another HeatFlux with the unit representation . + /// + /// A HeatFlux with the specified unit. + public HeatFlux ToUnit(HeatFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new HeatFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case HeatFluxUnit.BtuPerHourSquareFoot: return _value*3.15459075; + case HeatFluxUnit.BtuPerMinuteSquareFoot: return _value*1.89275445e2; + case HeatFluxUnit.BtuPerSecondSquareFoot: return _value*1.13565267e4; + case HeatFluxUnit.BtuPerSecondSquareInch: return _value*1.63533984e6; + case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return _value*4.1868e4; + case HeatFluxUnit.CentiwattPerSquareMeter: return (_value) * 1e-2d; + case HeatFluxUnit.DeciwattPerSquareMeter: return (_value) * 1e-1d; + case HeatFluxUnit.KilocaloriePerHourSquareMeter: return _value*1.163; + case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (_value*4.1868e4) * 1e3d; + case HeatFluxUnit.KilowattPerSquareMeter: return (_value) * 1e3d; + case HeatFluxUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d; + case HeatFluxUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d; + case HeatFluxUnit.NanowattPerSquareMeter: return (_value) * 1e-9d; + case HeatFluxUnit.WattPerSquareFoot: return _value*1.07639e1; + case HeatFluxUnit.WattPerSquareInch: return _value*1.5500031e3; + case HeatFluxUnit.WattPerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(HeatFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case HeatFluxUnit.BtuPerHourSquareFoot: return baseUnitValue/3.15459075; + case HeatFluxUnit.BtuPerMinuteSquareFoot: return baseUnitValue/1.89275445e2; + case HeatFluxUnit.BtuPerSecondSquareFoot: return baseUnitValue/1.13565267e4; + case HeatFluxUnit.BtuPerSecondSquareInch: return baseUnitValue/1.63533984e6; + case HeatFluxUnit.CaloriePerSecondSquareCentimeter: return baseUnitValue/4.1868e4; + case HeatFluxUnit.CentiwattPerSquareMeter: return (baseUnitValue) / 1e-2d; + case HeatFluxUnit.DeciwattPerSquareMeter: return (baseUnitValue) / 1e-1d; + case HeatFluxUnit.KilocaloriePerHourSquareMeter: return baseUnitValue/1.163; + case HeatFluxUnit.KilocaloriePerSecondSquareCentimeter: return (baseUnitValue/4.1868e4) / 1e3d; + case HeatFluxUnit.KilowattPerSquareMeter: return (baseUnitValue) / 1e3d; + case HeatFluxUnit.MicrowattPerSquareMeter: return (baseUnitValue) / 1e-6d; + case HeatFluxUnit.MilliwattPerSquareMeter: return (baseUnitValue) / 1e-3d; + case HeatFluxUnit.NanowattPerSquareMeter: return (baseUnitValue) / 1e-9d; + case HeatFluxUnit.WattPerSquareFoot: return baseUnitValue/1.07639e1; + case HeatFluxUnit.WattPerSquareInch: return baseUnitValue/1.5500031e3; + case HeatFluxUnit.WattPerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs new file mode 100644 index 0000000000..6c6624f9ed --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -0,0 +1,616 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) + /// + public partial struct HeatTransferCoefficient : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly HeatTransferCoefficientUnit? _unit; + + static HeatTransferCoefficient() + { + BaseDimensions = new BaseDimensions(0, 1, -3, 0, -1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public HeatTransferCoefficient(double numericValue, HeatTransferCoefficientUnit unit) + { + if(unit == HeatTransferCoefficientUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of HeatTransferCoefficient, which is WattPerSquareMeterKelvin. All conversions go via this value. + /// + public static HeatTransferCoefficientUnit BaseUnit => HeatTransferCoefficientUnit.WattPerSquareMeterKelvin; + + /// + /// Represents the largest possible value of HeatTransferCoefficient + /// + public static HeatTransferCoefficient MaxValue => new HeatTransferCoefficient(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of HeatTransferCoefficient + /// + public static HeatTransferCoefficient MinValue => new HeatTransferCoefficient(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.HeatTransferCoefficient; + + /// + /// All units of measurement for the HeatTransferCoefficient quantity. + /// + public static HeatTransferCoefficientUnit[] Units { get; } = Enum.GetValues(typeof(HeatTransferCoefficientUnit)).Cast().Except(new HeatTransferCoefficientUnit[]{ HeatTransferCoefficientUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeterKelvin. + /// + public static HeatTransferCoefficient Zero => new HeatTransferCoefficient(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public HeatTransferCoefficientUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => HeatTransferCoefficient.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => HeatTransferCoefficient.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get HeatTransferCoefficient in WattsPerSquareMeterCelsius. + /// + public double WattsPerSquareMeterCelsius => As(HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); + + /// + /// Get HeatTransferCoefficient in WattsPerSquareMeterKelvin. + /// + public double WattsPerSquareMeterKelvin => As(HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(HeatTransferCoefficientUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(HeatTransferCoefficientUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get HeatTransferCoefficient from WattsPerSquareMeterCelsius. + /// + /// If value is NaN or Infinity. + public static HeatTransferCoefficient FromWattsPerSquareMeterCelsius(QuantityValue wattspersquaremetercelsius) + { + double value = (double) wattspersquaremetercelsius; + return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterCelsius); + } + /// + /// Get HeatTransferCoefficient from WattsPerSquareMeterKelvin. + /// + /// If value is NaN or Infinity. + public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(QuantityValue wattspersquaremeterkelvin) + { + double value = (double) wattspersquaremeterkelvin; + return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); + } + + /// + /// 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 new HeatTransferCoefficient((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static HeatTransferCoefficient Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static HeatTransferCoefficient Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out HeatTransferCoefficient result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out HeatTransferCoefficient result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static HeatTransferCoefficientUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static HeatTransferCoefficientUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out HeatTransferCoefficientUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTransferCoefficientUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is HeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); + + return CompareTo((HeatTransferCoefficient)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(HeatTransferCoefficient other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another HeatTransferCoefficient within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current HeatTransferCoefficient. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(HeatTransferCoefficientUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this HeatTransferCoefficient to another HeatTransferCoefficient with the unit representation . + /// + /// A HeatTransferCoefficient with the specified unit. + public HeatTransferCoefficient ToUnit(HeatTransferCoefficientUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new HeatTransferCoefficient(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return _value; + case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(HeatTransferCoefficientUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case HeatTransferCoefficientUnit.WattPerSquareMeterCelsius: return baseUnitValue; + case HeatTransferCoefficientUnit.WattPerSquareMeterKelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs new file mode 100644 index 0000000000..e565b6477a --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -0,0 +1,651 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In photometry, illuminance is the total luminous flux incident on a surface, per unit area. + /// + /// + /// https://en.wikipedia.org/wiki/Illuminance + /// + public partial struct Illuminance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly IlluminanceUnit? _unit; + + static Illuminance() + { + BaseDimensions = new BaseDimensions(-2, 0, 0, 0, 0, 0, 1); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Illuminance(double numericValue, IlluminanceUnit unit) + { + if(unit == IlluminanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Illuminance, which is Lux. All conversions go via this value. + /// + public static IlluminanceUnit BaseUnit => IlluminanceUnit.Lux; + + /// + /// Represents the largest possible value of Illuminance + /// + public static Illuminance MaxValue => new Illuminance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Illuminance + /// + public static Illuminance MinValue => new Illuminance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Illuminance; + + /// + /// All units of measurement for the Illuminance quantity. + /// + public static IlluminanceUnit[] Units { get; } = Enum.GetValues(typeof(IlluminanceUnit)).Cast().Except(new IlluminanceUnit[]{ IlluminanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Lux. + /// + public static Illuminance Zero => new Illuminance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public IlluminanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Illuminance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Illuminance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Illuminance in Kilolux. + /// + public double Kilolux => As(IlluminanceUnit.Kilolux); + + /// + /// Get Illuminance in Lux. + /// + public double Lux => As(IlluminanceUnit.Lux); + + /// + /// Get Illuminance in Megalux. + /// + public double Megalux => As(IlluminanceUnit.Megalux); + + /// + /// Get Illuminance in Millilux. + /// + public double Millilux => As(IlluminanceUnit.Millilux); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(IlluminanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(IlluminanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Illuminance from Kilolux. + /// + /// If value is NaN or Infinity. + public static Illuminance FromKilolux(QuantityValue kilolux) + { + double value = (double) kilolux; + return new Illuminance(value, IlluminanceUnit.Kilolux); + } + /// + /// Get Illuminance from Lux. + /// + /// If value is NaN or Infinity. + public static Illuminance FromLux(QuantityValue lux) + { + double value = (double) lux; + return new Illuminance(value, IlluminanceUnit.Lux); + } + /// + /// Get Illuminance from Megalux. + /// + /// If value is NaN or Infinity. + public static Illuminance FromMegalux(QuantityValue megalux) + { + double value = (double) megalux; + return new Illuminance(value, IlluminanceUnit.Megalux); + } + /// + /// Get Illuminance from Millilux. + /// + /// If value is NaN or Infinity. + public static Illuminance FromMillilux(QuantityValue millilux) + { + double value = (double) millilux; + return new Illuminance(value, IlluminanceUnit.Millilux); + } + + /// + /// 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 new Illuminance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Illuminance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Illuminance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Illuminance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Illuminance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IlluminanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static IlluminanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out IlluminanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out IlluminanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Illuminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); + + return CompareTo((Illuminance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Illuminance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Illuminance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Illuminance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Illuminance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(IlluminanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Illuminance to another Illuminance with the unit representation . + /// + /// A Illuminance with the specified unit. + public Illuminance ToUnit(IlluminanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Illuminance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case IlluminanceUnit.Kilolux: return (_value) * 1e3d; + case IlluminanceUnit.Lux: return _value; + case IlluminanceUnit.Megalux: return (_value) * 1e6d; + case IlluminanceUnit.Millilux: return (_value) * 1e-3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(IlluminanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case IlluminanceUnit.Kilolux: return (baseUnitValue) / 1e3d; + case IlluminanceUnit.Lux: return baseUnitValue; + case IlluminanceUnit.Megalux: return (baseUnitValue) / 1e6d; + case IlluminanceUnit.Millilux: return (baseUnitValue) / 1e-3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs new file mode 100644 index 0000000000..285b42268a --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -0,0 +1,616 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. + /// + public partial struct Irradiance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly IrradianceUnit? _unit; + + static Irradiance() + { + BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Irradiance(double numericValue, IrradianceUnit unit) + { + if(unit == IrradianceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Irradiance, which is WattPerSquareMeter. All conversions go via this value. + /// + public static IrradianceUnit BaseUnit => IrradianceUnit.WattPerSquareMeter; + + /// + /// Represents the largest possible value of Irradiance + /// + public static Irradiance MaxValue => new Irradiance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Irradiance + /// + public static Irradiance MinValue => new Irradiance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Irradiance; + + /// + /// All units of measurement for the Irradiance quantity. + /// + public static IrradianceUnit[] Units { get; } = Enum.GetValues(typeof(IrradianceUnit)).Cast().Except(new IrradianceUnit[]{ IrradianceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerSquareMeter. + /// + public static Irradiance Zero => new Irradiance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public IrradianceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Irradiance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Irradiance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Irradiance in KilowattsPerSquareMeter. + /// + public double KilowattsPerSquareMeter => As(IrradianceUnit.KilowattPerSquareMeter); + + /// + /// Get Irradiance in WattsPerSquareMeter. + /// + public double WattsPerSquareMeter => As(IrradianceUnit.WattPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(IrradianceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(IrradianceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Irradiance from KilowattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Irradiance FromKilowattsPerSquareMeter(QuantityValue kilowattspersquaremeter) + { + double value = (double) kilowattspersquaremeter; + return new Irradiance(value, IrradianceUnit.KilowattPerSquareMeter); + } + /// + /// Get Irradiance from WattsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Irradiance FromWattsPerSquareMeter(QuantityValue wattspersquaremeter) + { + double value = (double) wattspersquaremeter; + return new Irradiance(value, IrradianceUnit.WattPerSquareMeter); + } + + /// + /// 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 new Irradiance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Irradiance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Irradiance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Irradiance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IrradianceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static IrradianceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out IrradianceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out IrradianceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Irradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); + + return CompareTo((Irradiance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Irradiance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Irradiance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Irradiance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Irradiance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(IrradianceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Irradiance to another Irradiance with the unit representation . + /// + /// A Irradiance with the specified unit. + public Irradiance ToUnit(IrradianceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Irradiance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case IrradianceUnit.KilowattPerSquareMeter: return (_value) * 1e3d; + case IrradianceUnit.WattPerSquareMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(IrradianceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case IrradianceUnit.KilowattPerSquareMeter: return (baseUnitValue) / 1e3d; + case IrradianceUnit.WattPerSquareMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs new file mode 100644 index 0000000000..60a18e3ee3 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -0,0 +1,635 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Irradiation is the process by which an object is exposed to radiation. The exposure can originate from various sources, including natural sources. + /// + /// + /// https://en.wikipedia.org/wiki/Irradiation + /// + public partial struct Irradiation : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly IrradiationUnit? _unit; + + static Irradiation() + { + BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Irradiation(double numericValue, IrradiationUnit unit) + { + if(unit == IrradiationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Irradiation, which is JoulePerSquareMeter. All conversions go via this value. + /// + public static IrradiationUnit BaseUnit => IrradiationUnit.JoulePerSquareMeter; + + /// + /// Represents the largest possible value of Irradiation + /// + public static Irradiation MaxValue => new Irradiation(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Irradiation + /// + public static Irradiation MinValue => new Irradiation(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Irradiation; + + /// + /// All units of measurement for the Irradiation quantity. + /// + public static IrradiationUnit[] Units { get; } = Enum.GetValues(typeof(IrradiationUnit)).Cast().Except(new IrradiationUnit[]{ IrradiationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerSquareMeter. + /// + public static Irradiation Zero => new Irradiation(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public IrradiationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Irradiation.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Irradiation.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Irradiation in JoulesPerSquareMeter. + /// + public double JoulesPerSquareMeter => As(IrradiationUnit.JoulePerSquareMeter); + + /// + /// Get Irradiation in KilowattHoursPerSquareMeter. + /// + public double KilowattHoursPerSquareMeter => As(IrradiationUnit.KilowattHourPerSquareMeter); + + /// + /// Get Irradiation in WattHoursPerSquareMeter. + /// + public double WattHoursPerSquareMeter => As(IrradiationUnit.WattHourPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(IrradiationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(IrradiationUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Irradiation from JoulesPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Irradiation FromJoulesPerSquareMeter(QuantityValue joulespersquaremeter) + { + double value = (double) joulespersquaremeter; + return new Irradiation(value, IrradiationUnit.JoulePerSquareMeter); + } + /// + /// Get Irradiation from KilowattHoursPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Irradiation FromKilowattHoursPerSquareMeter(QuantityValue kilowatthourspersquaremeter) + { + double value = (double) kilowatthourspersquaremeter; + return new Irradiation(value, IrradiationUnit.KilowattHourPerSquareMeter); + } + /// + /// Get Irradiation from WattHoursPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Irradiation FromWattHoursPerSquareMeter(QuantityValue watthourspersquaremeter) + { + double value = (double) watthourspersquaremeter; + return new Irradiation(value, IrradiationUnit.WattHourPerSquareMeter); + } + + /// + /// 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 new Irradiation((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Irradiation Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Irradiation Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Irradiation result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Irradiation result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static IrradiationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static IrradiationUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out IrradiationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out IrradiationUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Irradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); + + return CompareTo((Irradiation)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Irradiation other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Irradiation within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Irradiation other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Irradiation. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(IrradiationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Irradiation to another Irradiation with the unit representation . + /// + /// A Irradiation with the specified unit. + public Irradiation ToUnit(IrradiationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Irradiation(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case IrradiationUnit.JoulePerSquareMeter: return _value; + case IrradiationUnit.KilowattHourPerSquareMeter: return (_value*3600d) * 1e3d; + case IrradiationUnit.WattHourPerSquareMeter: return _value*3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(IrradiationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case IrradiationUnit.JoulePerSquareMeter: return baseUnitValue; + case IrradiationUnit.KilowattHourPerSquareMeter: return (baseUnitValue/3600d) / 1e3d; + case IrradiationUnit.WattHourPerSquareMeter: return baseUnitValue/3600d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs new file mode 100644 index 0000000000..27c4a59d9a --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -0,0 +1,715 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. + /// + /// + /// http://en.wikipedia.org/wiki/Viscosity + /// + public partial struct KinematicViscosity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly KinematicViscosityUnit? _unit; + + static KinematicViscosity() + { + BaseDimensions = new BaseDimensions(2, 0, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public KinematicViscosity(double numericValue, KinematicViscosityUnit unit) + { + if(unit == KinematicViscosityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of KinematicViscosity, which is SquareMeterPerSecond. All conversions go via this value. + /// + public static KinematicViscosityUnit BaseUnit => KinematicViscosityUnit.SquareMeterPerSecond; + + /// + /// Represents the largest possible value of KinematicViscosity + /// + public static KinematicViscosity MaxValue => new KinematicViscosity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of KinematicViscosity + /// + public static KinematicViscosity MinValue => new KinematicViscosity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.KinematicViscosity; + + /// + /// All units of measurement for the KinematicViscosity quantity. + /// + public static KinematicViscosityUnit[] Units { get; } = Enum.GetValues(typeof(KinematicViscosityUnit)).Cast().Except(new KinematicViscosityUnit[]{ KinematicViscosityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterPerSecond. + /// + public static KinematicViscosity Zero => new KinematicViscosity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public KinematicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => KinematicViscosity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => KinematicViscosity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get KinematicViscosity in Centistokes. + /// + public double Centistokes => As(KinematicViscosityUnit.Centistokes); + + /// + /// Get KinematicViscosity in Decistokes. + /// + public double Decistokes => As(KinematicViscosityUnit.Decistokes); + + /// + /// Get KinematicViscosity in Kilostokes. + /// + public double Kilostokes => As(KinematicViscosityUnit.Kilostokes); + + /// + /// Get KinematicViscosity in Microstokes. + /// + public double Microstokes => As(KinematicViscosityUnit.Microstokes); + + /// + /// Get KinematicViscosity in Millistokes. + /// + public double Millistokes => As(KinematicViscosityUnit.Millistokes); + + /// + /// Get KinematicViscosity in Nanostokes. + /// + public double Nanostokes => As(KinematicViscosityUnit.Nanostokes); + + /// + /// Get KinematicViscosity in SquareMetersPerSecond. + /// + public double SquareMetersPerSecond => As(KinematicViscosityUnit.SquareMeterPerSecond); + + /// + /// Get KinematicViscosity in Stokes. + /// + public double Stokes => As(KinematicViscosityUnit.Stokes); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(KinematicViscosityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(KinematicViscosityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get KinematicViscosity from Centistokes. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromCentistokes(QuantityValue centistokes) + { + double value = (double) centistokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Centistokes); + } + /// + /// Get KinematicViscosity from Decistokes. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromDecistokes(QuantityValue decistokes) + { + double value = (double) decistokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Decistokes); + } + /// + /// Get KinematicViscosity from Kilostokes. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromKilostokes(QuantityValue kilostokes) + { + double value = (double) kilostokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Kilostokes); + } + /// + /// Get KinematicViscosity from Microstokes. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromMicrostokes(QuantityValue microstokes) + { + double value = (double) microstokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Microstokes); + } + /// + /// Get KinematicViscosity from Millistokes. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromMillistokes(QuantityValue millistokes) + { + double value = (double) millistokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Millistokes); + } + /// + /// Get KinematicViscosity from Nanostokes. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromNanostokes(QuantityValue nanostokes) + { + double value = (double) nanostokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Nanostokes); + } + /// + /// Get KinematicViscosity from SquareMetersPerSecond. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromSquareMetersPerSecond(QuantityValue squaremeterspersecond) + { + double value = (double) squaremeterspersecond; + return new KinematicViscosity(value, KinematicViscosityUnit.SquareMeterPerSecond); + } + /// + /// Get KinematicViscosity from Stokes. + /// + /// If value is NaN or Infinity. + public static KinematicViscosity FromStokes(QuantityValue stokes) + { + double value = (double) stokes; + return new KinematicViscosity(value, KinematicViscosityUnit.Stokes); + } + + /// + /// 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 new KinematicViscosity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static KinematicViscosity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static KinematicViscosity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out KinematicViscosity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out KinematicViscosity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static KinematicViscosityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static KinematicViscosityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out KinematicViscosityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out KinematicViscosityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is KinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); + + return CompareTo((KinematicViscosity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(KinematicViscosity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another KinematicViscosity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(KinematicViscosity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current KinematicViscosity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(KinematicViscosityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this KinematicViscosity to another KinematicViscosity with the unit representation . + /// + /// A KinematicViscosity with the specified unit. + public KinematicViscosity ToUnit(KinematicViscosityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new KinematicViscosity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case KinematicViscosityUnit.Centistokes: return (_value/1e4) * 1e-2d; + case KinematicViscosityUnit.Decistokes: return (_value/1e4) * 1e-1d; + case KinematicViscosityUnit.Kilostokes: return (_value/1e4) * 1e3d; + case KinematicViscosityUnit.Microstokes: return (_value/1e4) * 1e-6d; + case KinematicViscosityUnit.Millistokes: return (_value/1e4) * 1e-3d; + case KinematicViscosityUnit.Nanostokes: return (_value/1e4) * 1e-9d; + case KinematicViscosityUnit.SquareMeterPerSecond: return _value; + case KinematicViscosityUnit.Stokes: return _value/1e4; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(KinematicViscosityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case KinematicViscosityUnit.Centistokes: return (baseUnitValue*1e4) / 1e-2d; + case KinematicViscosityUnit.Decistokes: return (baseUnitValue*1e4) / 1e-1d; + case KinematicViscosityUnit.Kilostokes: return (baseUnitValue*1e4) / 1e3d; + case KinematicViscosityUnit.Microstokes: return (baseUnitValue*1e4) / 1e-6d; + case KinematicViscosityUnit.Millistokes: return (baseUnitValue*1e4) / 1e-3d; + case KinematicViscosityUnit.Nanostokes: return (baseUnitValue*1e4) / 1e-9d; + case KinematicViscosityUnit.SquareMeterPerSecond: return baseUnitValue; + case KinematicViscosityUnit.Stokes: return baseUnitValue*1e4; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs new file mode 100644 index 0000000000..26d834afad --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -0,0 +1,600 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. + /// + public partial struct LapseRate : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LapseRateUnit? _unit; + + static LapseRate() + { + BaseDimensions = new BaseDimensions(-1, 0, 0, 0, 1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public LapseRate(double numericValue, LapseRateUnit unit) + { + if(unit == LapseRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LapseRate, which is DegreeCelsiusPerKilometer. All conversions go via this value. + /// + public static LapseRateUnit BaseUnit => LapseRateUnit.DegreeCelsiusPerKilometer; + + /// + /// Represents the largest possible value of LapseRate + /// + public static LapseRate MaxValue => new LapseRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LapseRate + /// + public static LapseRate MinValue => new LapseRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LapseRate; + + /// + /// All units of measurement for the LapseRate quantity. + /// + public static LapseRateUnit[] Units { get; } = Enum.GetValues(typeof(LapseRateUnit)).Cast().Except(new LapseRateUnit[]{ LapseRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer. + /// + public static LapseRate Zero => new LapseRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LapseRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LapseRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LapseRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LapseRate in DegreesCelciusPerKilometer. + /// + public double DegreesCelciusPerKilometer => As(LapseRateUnit.DegreeCelsiusPerKilometer); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LapseRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(LapseRateUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LapseRate from DegreesCelciusPerKilometer. + /// + /// If value is NaN or Infinity. + public static LapseRate FromDegreesCelciusPerKilometer(QuantityValue degreescelciusperkilometer) + { + double value = (double) degreescelciusperkilometer; + return new LapseRate(value, LapseRateUnit.DegreeCelsiusPerKilometer); + } + + /// + /// 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 new LapseRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LapseRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static LapseRate Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LapseRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LapseRate result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LapseRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static LapseRateUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LapseRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out LapseRateUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); + + return CompareTo((LapseRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(LapseRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LapseRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LapseRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LapseRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LapseRate to another LapseRate with the unit representation . + /// + /// A LapseRate with the specified unit. + public LapseRate ToUnit(LapseRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LapseRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LapseRateUnit.DegreeCelsiusPerKilometer: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LapseRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LapseRateUnit.DegreeCelsiusPerKilometer: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs new file mode 100644 index 0000000000..96e9b0c092 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -0,0 +1,635 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Linear Density, or more precisely, the linear mass density, of a substance is its mass per unit length. The term linear density is most often used when describing the characteristics of one-dimensional objects, although linear density can also be used to describe the density of a three-dimensional quantity along one particular dimension. + /// + /// + /// http://en.wikipedia.org/wiki/Linear_density + /// + public partial struct LinearDensity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LinearDensityUnit? _unit; + + static LinearDensity() + { + BaseDimensions = new BaseDimensions(-1, 1, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public LinearDensity(double numericValue, LinearDensityUnit unit) + { + if(unit == LinearDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LinearDensity, which is KilogramPerMeter. All conversions go via this value. + /// + public static LinearDensityUnit BaseUnit => LinearDensityUnit.KilogramPerMeter; + + /// + /// Represents the largest possible value of LinearDensity + /// + public static LinearDensity MaxValue => new LinearDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LinearDensity + /// + public static LinearDensity MinValue => new LinearDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LinearDensity; + + /// + /// All units of measurement for the LinearDensity quantity. + /// + public static LinearDensityUnit[] Units { get; } = Enum.GetValues(typeof(LinearDensityUnit)).Cast().Except(new LinearDensityUnit[]{ LinearDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMeter. + /// + public static LinearDensity Zero => new LinearDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LinearDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LinearDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LinearDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LinearDensity in GramsPerMeter. + /// + public double GramsPerMeter => As(LinearDensityUnit.GramPerMeter); + + /// + /// Get LinearDensity in KilogramsPerMeter. + /// + public double KilogramsPerMeter => As(LinearDensityUnit.KilogramPerMeter); + + /// + /// Get LinearDensity in PoundsPerFoot. + /// + public double PoundsPerFoot => As(LinearDensityUnit.PoundPerFoot); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LinearDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(LinearDensityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LinearDensity from GramsPerMeter. + /// + /// If value is NaN or Infinity. + public static LinearDensity FromGramsPerMeter(QuantityValue gramspermeter) + { + double value = (double) gramspermeter; + return new LinearDensity(value, LinearDensityUnit.GramPerMeter); + } + /// + /// Get LinearDensity from KilogramsPerMeter. + /// + /// If value is NaN or Infinity. + public static LinearDensity FromKilogramsPerMeter(QuantityValue kilogramspermeter) + { + double value = (double) kilogramspermeter; + return new LinearDensity(value, LinearDensityUnit.KilogramPerMeter); + } + /// + /// Get LinearDensity from PoundsPerFoot. + /// + /// If value is NaN or Infinity. + public static LinearDensity FromPoundsPerFoot(QuantityValue poundsperfoot) + { + double value = (double) poundsperfoot; + return new LinearDensity(value, LinearDensityUnit.PoundPerFoot); + } + + /// + /// 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 new LinearDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LinearDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static LinearDensity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LinearDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LinearDensity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LinearDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static LinearDensityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LinearDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out LinearDensityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); + + return CompareTo((LinearDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(LinearDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LinearDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LinearDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LinearDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LinearDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LinearDensity to another LinearDensity with the unit representation . + /// + /// A LinearDensity with the specified unit. + public LinearDensity ToUnit(LinearDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LinearDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LinearDensityUnit.GramPerMeter: return _value*1e-3; + case LinearDensityUnit.KilogramPerMeter: return (_value*1e-3) * 1e3d; + case LinearDensityUnit.PoundPerFoot: return _value*1.48816394; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LinearDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LinearDensityUnit.GramPerMeter: return baseUnitValue/1e-3; + case LinearDensityUnit.KilogramPerMeter: return (baseUnitValue/1e-3) / 1e3d; + case LinearDensityUnit.PoundPerFoot: return baseUnitValue/1.48816394; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs new file mode 100644 index 0000000000..d7aaa86a5f --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In photometry, luminous flux or luminous power is the measure of the perceived power of light. + /// + /// + /// https://en.wikipedia.org/wiki/Luminous_flux + /// + public partial struct LuminousFlux : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LuminousFluxUnit? _unit; + + static LuminousFlux() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public LuminousFlux(double numericValue, LuminousFluxUnit unit) + { + if(unit == LuminousFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LuminousFlux, which is Lumen. All conversions go via this value. + /// + public static LuminousFluxUnit BaseUnit => LuminousFluxUnit.Lumen; + + /// + /// Represents the largest possible value of LuminousFlux + /// + public static LuminousFlux MaxValue => new LuminousFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LuminousFlux + /// + public static LuminousFlux MinValue => new LuminousFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LuminousFlux; + + /// + /// All units of measurement for the LuminousFlux quantity. + /// + public static LuminousFluxUnit[] Units { get; } = Enum.GetValues(typeof(LuminousFluxUnit)).Cast().Except(new LuminousFluxUnit[]{ LuminousFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Lumen. + /// + public static LuminousFlux Zero => new LuminousFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LuminousFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LuminousFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LuminousFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LuminousFlux in Lumens. + /// + public double Lumens => As(LuminousFluxUnit.Lumen); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LuminousFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(LuminousFluxUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LuminousFlux from Lumens. + /// + /// If value is NaN or Infinity. + public static LuminousFlux FromLumens(QuantityValue lumens) + { + double value = (double) lumens; + return new LuminousFlux(value, LuminousFluxUnit.Lumen); + } + + /// + /// 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 new LuminousFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LuminousFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static LuminousFlux Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LuminousFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousFlux result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LuminousFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static LuminousFluxUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LuminousFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out LuminousFluxUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); + + return CompareTo((LuminousFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(LuminousFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LuminousFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LuminousFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LuminousFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LuminousFlux to another LuminousFlux with the unit representation . + /// + /// A LuminousFlux with the specified unit. + public LuminousFlux ToUnit(LuminousFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LuminousFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LuminousFluxUnit.Lumen: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LuminousFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LuminousFluxUnit.Lumen: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs new file mode 100644 index 0000000000..2f70b17d03 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In photometry, luminous intensity is a measure of the wavelength-weighted power emitted by a light source in a particular direction per unit solid angle, based on the luminosity function, a standardized model of the sensitivity of the human eye. + /// + /// + /// https://en.wikipedia.org/wiki/Luminous_intensity + /// + public partial struct LuminousIntensity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly LuminousIntensityUnit? _unit; + + static LuminousIntensity() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public LuminousIntensity(double numericValue, LuminousIntensityUnit unit) + { + if(unit == LuminousIntensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of LuminousIntensity, which is Candela. All conversions go via this value. + /// + public static LuminousIntensityUnit BaseUnit => LuminousIntensityUnit.Candela; + + /// + /// Represents the largest possible value of LuminousIntensity + /// + public static LuminousIntensity MaxValue => new LuminousIntensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of LuminousIntensity + /// + public static LuminousIntensity MinValue => new LuminousIntensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.LuminousIntensity; + + /// + /// All units of measurement for the LuminousIntensity quantity. + /// + public static LuminousIntensityUnit[] Units { get; } = Enum.GetValues(typeof(LuminousIntensityUnit)).Cast().Except(new LuminousIntensityUnit[]{ LuminousIntensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Candela. + /// + public static LuminousIntensity Zero => new LuminousIntensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public LuminousIntensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => LuminousIntensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => LuminousIntensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get LuminousIntensity in Candela. + /// + public double Candela => As(LuminousIntensityUnit.Candela); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(LuminousIntensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(LuminousIntensityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get LuminousIntensity from Candela. + /// + /// If value is NaN or Infinity. + public static LuminousIntensity FromCandela(QuantityValue candela) + { + double value = (double) candela; + return new LuminousIntensity(value, LuminousIntensityUnit.Candela); + } + + /// + /// 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 new LuminousIntensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static LuminousIntensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static LuminousIntensity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out LuminousIntensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out LuminousIntensity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static LuminousIntensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static LuminousIntensityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out LuminousIntensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out LuminousIntensityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is LuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); + + return CompareTo((LuminousIntensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(LuminousIntensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another LuminousIntensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(LuminousIntensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current LuminousIntensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(LuminousIntensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this LuminousIntensity to another LuminousIntensity with the unit representation . + /// + /// A LuminousIntensity with the specified unit. + public LuminousIntensity ToUnit(LuminousIntensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new LuminousIntensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case LuminousIntensityUnit.Candela: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(LuminousIntensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case LuminousIntensityUnit.Candela: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs new file mode 100644 index 0000000000..2e4ced2daf --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A magnetic field is a force field that is created by moving electric charges (electric currents) and magnetic dipoles, and exerts a force on other nearby moving charges and magnetic dipoles. + /// + /// + /// https://en.wikipedia.org/wiki/Magnetic_field + /// + public partial struct MagneticField : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MagneticFieldUnit? _unit; + + static MagneticField() + { + BaseDimensions = new BaseDimensions(0, 1, -2, -1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MagneticField(double numericValue, MagneticFieldUnit unit) + { + if(unit == MagneticFieldUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MagneticField, which is Tesla. All conversions go via this value. + /// + public static MagneticFieldUnit BaseUnit => MagneticFieldUnit.Tesla; + + /// + /// Represents the largest possible value of MagneticField + /// + public static MagneticField MaxValue => new MagneticField(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MagneticField + /// + public static MagneticField MinValue => new MagneticField(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MagneticField; + + /// + /// All units of measurement for the MagneticField quantity. + /// + public static MagneticFieldUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFieldUnit)).Cast().Except(new MagneticFieldUnit[]{ MagneticFieldUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Tesla. + /// + public static MagneticField Zero => new MagneticField(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MagneticFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MagneticField.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MagneticField.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MagneticField in Teslas. + /// + public double Teslas => As(MagneticFieldUnit.Tesla); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MagneticFieldUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MagneticFieldUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MagneticField from Teslas. + /// + /// If value is NaN or Infinity. + public static MagneticField FromTeslas(QuantityValue teslas) + { + double value = (double) teslas; + return new MagneticField(value, MagneticFieldUnit.Tesla); + } + + /// + /// 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 new MagneticField((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MagneticField Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MagneticField Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MagneticField result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticField result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagneticFieldUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MagneticFieldUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MagneticFieldUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MagneticFieldUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); + + return CompareTo((MagneticField)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MagneticField other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MagneticField within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MagneticField other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MagneticField. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MagneticFieldUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MagneticField to another MagneticField with the unit representation . + /// + /// A MagneticField with the specified unit. + public MagneticField ToUnit(MagneticFieldUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MagneticField(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MagneticFieldUnit.Tesla: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MagneticFieldUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MagneticFieldUnit.Tesla: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs new file mode 100644 index 0000000000..9a5151b38c --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, specifically electromagnetism, the magnetic flux through a surface is the surface integral of the normal component of the magnetic field B passing through that surface. + /// + /// + /// https://en.wikipedia.org/wiki/Magnetic_flux + /// + public partial struct MagneticFlux : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MagneticFluxUnit? _unit; + + static MagneticFlux() + { + BaseDimensions = new BaseDimensions(2, 1, -2, -1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MagneticFlux(double numericValue, MagneticFluxUnit unit) + { + if(unit == MagneticFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MagneticFlux, which is Weber. All conversions go via this value. + /// + public static MagneticFluxUnit BaseUnit => MagneticFluxUnit.Weber; + + /// + /// Represents the largest possible value of MagneticFlux + /// + public static MagneticFlux MaxValue => new MagneticFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MagneticFlux + /// + public static MagneticFlux MinValue => new MagneticFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MagneticFlux; + + /// + /// All units of measurement for the MagneticFlux quantity. + /// + public static MagneticFluxUnit[] Units { get; } = Enum.GetValues(typeof(MagneticFluxUnit)).Cast().Except(new MagneticFluxUnit[]{ MagneticFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Weber. + /// + public static MagneticFlux Zero => new MagneticFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MagneticFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MagneticFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MagneticFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MagneticFlux in Webers. + /// + public double Webers => As(MagneticFluxUnit.Weber); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MagneticFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MagneticFluxUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MagneticFlux from Webers. + /// + /// If value is NaN or Infinity. + public static MagneticFlux FromWebers(QuantityValue webers) + { + double value = (double) webers; + return new MagneticFlux(value, MagneticFluxUnit.Weber); + } + + /// + /// 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 new MagneticFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MagneticFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MagneticFlux Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MagneticFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MagneticFlux result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagneticFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MagneticFluxUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MagneticFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MagneticFluxUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); + + return CompareTo((MagneticFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MagneticFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MagneticFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MagneticFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MagneticFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MagneticFlux to another MagneticFlux with the unit representation . + /// + /// A MagneticFlux with the specified unit. + public MagneticFlux ToUnit(MagneticFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MagneticFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MagneticFluxUnit.Weber: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MagneticFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MagneticFluxUnit.Weber: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs new file mode 100644 index 0000000000..9c4be74aac --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In classical electromagnetism, magnetization is the vector field that expresses the density of permanent or induced magnetic dipole moments in a magnetic material. + /// + /// + /// https://en.wikipedia.org/wiki/Magnetization + /// + public partial struct Magnetization : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MagnetizationUnit? _unit; + + static Magnetization() + { + BaseDimensions = new BaseDimensions(-1, 0, 0, 1, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Magnetization(double numericValue, MagnetizationUnit unit) + { + if(unit == MagnetizationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Magnetization, which is AmperePerMeter. All conversions go via this value. + /// + public static MagnetizationUnit BaseUnit => MagnetizationUnit.AmperePerMeter; + + /// + /// Represents the largest possible value of Magnetization + /// + public static Magnetization MaxValue => new Magnetization(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Magnetization + /// + public static Magnetization MinValue => new Magnetization(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Magnetization; + + /// + /// All units of measurement for the Magnetization quantity. + /// + public static MagnetizationUnit[] Units { get; } = Enum.GetValues(typeof(MagnetizationUnit)).Cast().Except(new MagnetizationUnit[]{ MagnetizationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit AmperePerMeter. + /// + public static Magnetization Zero => new Magnetization(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MagnetizationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Magnetization.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Magnetization.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Magnetization in AmperesPerMeter. + /// + public double AmperesPerMeter => As(MagnetizationUnit.AmperePerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MagnetizationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MagnetizationUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Magnetization from AmperesPerMeter. + /// + /// If value is NaN or Infinity. + public static Magnetization FromAmperesPerMeter(QuantityValue amperespermeter) + { + double value = (double) amperespermeter; + return new Magnetization(value, MagnetizationUnit.AmperePerMeter); + } + + /// + /// 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 new Magnetization((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Magnetization Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Magnetization Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Magnetization result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Magnetization result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MagnetizationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MagnetizationUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MagnetizationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MagnetizationUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Magnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); + + return CompareTo((Magnetization)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Magnetization other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Magnetization within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Magnetization other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Magnetization. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MagnetizationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Magnetization to another Magnetization with the unit representation . + /// + /// A Magnetization with the specified unit. + public Magnetization ToUnit(MagnetizationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Magnetization(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MagnetizationUnit.AmperePerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MagnetizationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MagnetizationUnit.AmperePerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs new file mode 100644 index 0000000000..0f35914d2b --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -0,0 +1,936 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). + /// + public partial struct Mass : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassUnit? _unit; + + static Mass() + { + BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Mass(double numericValue, MassUnit unit) + { + if(unit == MassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Mass, which is Kilogram. All conversions go via this value. + /// + public static MassUnit BaseUnit => MassUnit.Kilogram; + + /// + /// Represents the largest possible value of Mass + /// + public static Mass MaxValue => new Mass(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Mass + /// + public static Mass MinValue => new Mass(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Mass; + + /// + /// All units of measurement for the Mass quantity. + /// + public static MassUnit[] Units { get; } = Enum.GetValues(typeof(MassUnit)).Cast().Except(new MassUnit[]{ MassUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Kilogram. + /// + public static Mass Zero => new Mass(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Mass.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Mass.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Mass in Centigrams. + /// + public double Centigrams => As(MassUnit.Centigram); + + /// + /// Get Mass in Decagrams. + /// + public double Decagrams => As(MassUnit.Decagram); + + /// + /// Get Mass in Decigrams. + /// + public double Decigrams => As(MassUnit.Decigram); + + /// + /// Get Mass in Grams. + /// + public double Grams => As(MassUnit.Gram); + + /// + /// Get Mass in Hectograms. + /// + public double Hectograms => As(MassUnit.Hectogram); + + /// + /// Get Mass in Kilograms. + /// + public double Kilograms => As(MassUnit.Kilogram); + + /// + /// Get Mass in Kilopounds. + /// + public double Kilopounds => As(MassUnit.Kilopound); + + /// + /// Get Mass in Kilotonnes. + /// + public double Kilotonnes => As(MassUnit.Kilotonne); + + /// + /// Get Mass in LongHundredweight. + /// + public double LongHundredweight => As(MassUnit.LongHundredweight); + + /// + /// Get Mass in LongTons. + /// + public double LongTons => As(MassUnit.LongTon); + + /// + /// Get Mass in Megapounds. + /// + public double Megapounds => As(MassUnit.Megapound); + + /// + /// Get Mass in Megatonnes. + /// + public double Megatonnes => As(MassUnit.Megatonne); + + /// + /// Get Mass in Micrograms. + /// + public double Micrograms => As(MassUnit.Microgram); + + /// + /// Get Mass in Milligrams. + /// + public double Milligrams => As(MassUnit.Milligram); + + /// + /// Get Mass in Nanograms. + /// + public double Nanograms => As(MassUnit.Nanogram); + + /// + /// Get Mass in Ounces. + /// + public double Ounces => As(MassUnit.Ounce); + + /// + /// Get Mass in Pounds. + /// + public double Pounds => As(MassUnit.Pound); + + /// + /// Get Mass in ShortHundredweight. + /// + public double ShortHundredweight => As(MassUnit.ShortHundredweight); + + /// + /// Get Mass in ShortTons. + /// + public double ShortTons => As(MassUnit.ShortTon); + + /// + /// Get Mass in Slugs. + /// + public double Slugs => As(MassUnit.Slug); + + /// + /// Get Mass in Stone. + /// + public double Stone => As(MassUnit.Stone); + + /// + /// Get Mass in Tonnes. + /// + public double Tonnes => As(MassUnit.Tonne); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MassUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Mass from Centigrams. + /// + /// If value is NaN or Infinity. + public static Mass FromCentigrams(QuantityValue centigrams) + { + double value = (double) centigrams; + return new Mass(value, MassUnit.Centigram); + } + /// + /// Get Mass from Decagrams. + /// + /// If value is NaN or Infinity. + public static Mass FromDecagrams(QuantityValue decagrams) + { + double value = (double) decagrams; + return new Mass(value, MassUnit.Decagram); + } + /// + /// Get Mass from Decigrams. + /// + /// If value is NaN or Infinity. + public static Mass FromDecigrams(QuantityValue decigrams) + { + double value = (double) decigrams; + return new Mass(value, MassUnit.Decigram); + } + /// + /// Get Mass from Grams. + /// + /// If value is NaN or Infinity. + public static Mass FromGrams(QuantityValue grams) + { + double value = (double) grams; + return new Mass(value, MassUnit.Gram); + } + /// + /// Get Mass from Hectograms. + /// + /// If value is NaN or Infinity. + public static Mass FromHectograms(QuantityValue hectograms) + { + double value = (double) hectograms; + return new Mass(value, MassUnit.Hectogram); + } + /// + /// Get Mass from Kilograms. + /// + /// If value is NaN or Infinity. + public static Mass FromKilograms(QuantityValue kilograms) + { + double value = (double) kilograms; + return new Mass(value, MassUnit.Kilogram); + } + /// + /// Get Mass from Kilopounds. + /// + /// If value is NaN or Infinity. + public static Mass FromKilopounds(QuantityValue kilopounds) + { + double value = (double) kilopounds; + return new Mass(value, MassUnit.Kilopound); + } + /// + /// Get Mass from Kilotonnes. + /// + /// If value is NaN or Infinity. + public static Mass FromKilotonnes(QuantityValue kilotonnes) + { + double value = (double) kilotonnes; + return new Mass(value, MassUnit.Kilotonne); + } + /// + /// Get Mass from LongHundredweight. + /// + /// If value is NaN or Infinity. + public static Mass FromLongHundredweight(QuantityValue longhundredweight) + { + double value = (double) longhundredweight; + return new Mass(value, MassUnit.LongHundredweight); + } + /// + /// Get Mass from LongTons. + /// + /// If value is NaN or Infinity. + public static Mass FromLongTons(QuantityValue longtons) + { + double value = (double) longtons; + return new Mass(value, MassUnit.LongTon); + } + /// + /// Get Mass from Megapounds. + /// + /// If value is NaN or Infinity. + public static Mass FromMegapounds(QuantityValue megapounds) + { + double value = (double) megapounds; + return new Mass(value, MassUnit.Megapound); + } + /// + /// Get Mass from Megatonnes. + /// + /// If value is NaN or Infinity. + public static Mass FromMegatonnes(QuantityValue megatonnes) + { + double value = (double) megatonnes; + return new Mass(value, MassUnit.Megatonne); + } + /// + /// Get Mass from Micrograms. + /// + /// If value is NaN or Infinity. + public static Mass FromMicrograms(QuantityValue micrograms) + { + double value = (double) micrograms; + return new Mass(value, MassUnit.Microgram); + } + /// + /// Get Mass from Milligrams. + /// + /// If value is NaN or Infinity. + public static Mass FromMilligrams(QuantityValue milligrams) + { + double value = (double) milligrams; + return new Mass(value, MassUnit.Milligram); + } + /// + /// Get Mass from Nanograms. + /// + /// If value is NaN or Infinity. + public static Mass FromNanograms(QuantityValue nanograms) + { + double value = (double) nanograms; + return new Mass(value, MassUnit.Nanogram); + } + /// + /// Get Mass from Ounces. + /// + /// If value is NaN or Infinity. + public static Mass FromOunces(QuantityValue ounces) + { + double value = (double) ounces; + return new Mass(value, MassUnit.Ounce); + } + /// + /// Get Mass from Pounds. + /// + /// If value is NaN or Infinity. + public static Mass FromPounds(QuantityValue pounds) + { + double value = (double) pounds; + return new Mass(value, MassUnit.Pound); + } + /// + /// Get Mass from ShortHundredweight. + /// + /// If value is NaN or Infinity. + public static Mass FromShortHundredweight(QuantityValue shorthundredweight) + { + double value = (double) shorthundredweight; + return new Mass(value, MassUnit.ShortHundredweight); + } + /// + /// Get Mass from ShortTons. + /// + /// If value is NaN or Infinity. + public static Mass FromShortTons(QuantityValue shorttons) + { + double value = (double) shorttons; + return new Mass(value, MassUnit.ShortTon); + } + /// + /// Get Mass from Slugs. + /// + /// If value is NaN or Infinity. + public static Mass FromSlugs(QuantityValue slugs) + { + double value = (double) slugs; + return new Mass(value, MassUnit.Slug); + } + /// + /// Get Mass from Stone. + /// + /// If value is NaN or Infinity. + public static Mass FromStone(QuantityValue stone) + { + double value = (double) stone; + return new Mass(value, MassUnit.Stone); + } + /// + /// Get Mass from Tonnes. + /// + /// If value is NaN or Infinity. + public static Mass FromTonnes(QuantityValue tonnes) + { + double value = (double) tonnes; + return new Mass(value, MassUnit.Tonne); + } + + /// + /// 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 new Mass((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Mass Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Mass Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Mass result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Mass result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MassUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MassUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Mass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); + + return CompareTo((Mass)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Mass other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Mass within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Mass. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Mass to another Mass with the unit representation . + /// + /// A Mass with the specified unit. + public Mass ToUnit(MassUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Mass(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassUnit.Centigram: return (_value/1e3) * 1e-2d; + case MassUnit.Decagram: return (_value/1e3) * 1e1d; + case MassUnit.Decigram: return (_value/1e3) * 1e-1d; + case MassUnit.Gram: return _value/1e3; + case MassUnit.Hectogram: return (_value/1e3) * 1e2d; + case MassUnit.Kilogram: return (_value/1e3) * 1e3d; + case MassUnit.Kilopound: return (_value*0.45359237) * 1e3d; + case MassUnit.Kilotonne: return (_value*1e3) * 1e3d; + case MassUnit.LongHundredweight: return _value/0.01968413055222121; + case MassUnit.LongTon: return _value*1.0160469088e3; + case MassUnit.Megapound: return (_value*0.45359237) * 1e6d; + case MassUnit.Megatonne: return (_value*1e3) * 1e6d; + case MassUnit.Microgram: return (_value/1e3) * 1e-6d; + case MassUnit.Milligram: return (_value/1e3) * 1e-3d; + case MassUnit.Nanogram: return (_value/1e3) * 1e-9d; + case MassUnit.Ounce: return _value/35.2739619; + case MassUnit.Pound: return _value*0.45359237; + case MassUnit.ShortHundredweight: return _value/0.022046226218487758; + case MassUnit.ShortTon: return _value*9.0718474e2; + case MassUnit.Slug: return _value/6.852176556196105e-2; + case MassUnit.Stone: return _value/0.1574731728702698; + case MassUnit.Tonne: return _value*1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassUnit.Centigram: return (baseUnitValue*1e3) / 1e-2d; + case MassUnit.Decagram: return (baseUnitValue*1e3) / 1e1d; + case MassUnit.Decigram: return (baseUnitValue*1e3) / 1e-1d; + case MassUnit.Gram: return baseUnitValue*1e3; + case MassUnit.Hectogram: return (baseUnitValue*1e3) / 1e2d; + case MassUnit.Kilogram: return (baseUnitValue*1e3) / 1e3d; + case MassUnit.Kilopound: return (baseUnitValue/0.45359237) / 1e3d; + case MassUnit.Kilotonne: return (baseUnitValue/1e3) / 1e3d; + case MassUnit.LongHundredweight: return baseUnitValue*0.01968413055222121; + case MassUnit.LongTon: return baseUnitValue/1.0160469088e3; + case MassUnit.Megapound: return (baseUnitValue/0.45359237) / 1e6d; + case MassUnit.Megatonne: return (baseUnitValue/1e3) / 1e6d; + case MassUnit.Microgram: return (baseUnitValue*1e3) / 1e-6d; + case MassUnit.Milligram: return (baseUnitValue*1e3) / 1e-3d; + case MassUnit.Nanogram: return (baseUnitValue*1e3) / 1e-9d; + case MassUnit.Ounce: return baseUnitValue*35.2739619; + case MassUnit.Pound: return baseUnitValue/0.45359237; + case MassUnit.ShortHundredweight: return baseUnitValue*0.022046226218487758; + case MassUnit.ShortTon: return baseUnitValue/9.0718474e2; + case MassUnit.Slug: return baseUnitValue*6.852176556196105e-2; + case MassUnit.Stone: return baseUnitValue*0.1574731728702698; + case MassUnit.Tonne: return baseUnitValue/1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs new file mode 100644 index 0000000000..940552ccff --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -0,0 +1,856 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). + /// + public partial struct MassFlow : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassFlowUnit? _unit; + + static MassFlow() + { + BaseDimensions = new BaseDimensions(0, 1, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MassFlow(double numericValue, MassFlowUnit unit) + { + if(unit == MassFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MassFlow, which is GramPerSecond. All conversions go via this value. + /// + public static MassFlowUnit BaseUnit => MassFlowUnit.GramPerSecond; + + /// + /// Represents the largest possible value of MassFlow + /// + public static MassFlow MaxValue => new MassFlow(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MassFlow + /// + public static MassFlow MinValue => new MassFlow(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MassFlow; + + /// + /// All units of measurement for the MassFlow quantity. + /// + public static MassFlowUnit[] Units { get; } = Enum.GetValues(typeof(MassFlowUnit)).Cast().Except(new MassFlowUnit[]{ MassFlowUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit GramPerSecond. + /// + public static MassFlow Zero => new MassFlow(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MassFlow.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassFlow.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MassFlow in CentigramsPerSecond. + /// + public double CentigramsPerSecond => As(MassFlowUnit.CentigramPerSecond); + + /// + /// Get MassFlow in DecagramsPerSecond. + /// + public double DecagramsPerSecond => As(MassFlowUnit.DecagramPerSecond); + + /// + /// Get MassFlow in DecigramsPerSecond. + /// + public double DecigramsPerSecond => As(MassFlowUnit.DecigramPerSecond); + + /// + /// Get MassFlow in GramsPerSecond. + /// + public double GramsPerSecond => As(MassFlowUnit.GramPerSecond); + + /// + /// Get MassFlow in HectogramsPerSecond. + /// + public double HectogramsPerSecond => As(MassFlowUnit.HectogramPerSecond); + + /// + /// Get MassFlow in KilogramsPerHour. + /// + public double KilogramsPerHour => As(MassFlowUnit.KilogramPerHour); + + /// + /// Get MassFlow in KilogramsPerSecond. + /// + public double KilogramsPerSecond => As(MassFlowUnit.KilogramPerSecond); + + /// + /// Get MassFlow in MegapoundsPerHour. + /// + public double MegapoundsPerHour => As(MassFlowUnit.MegapoundPerHour); + + /// + /// Get MassFlow in MegapoundsPerMinute. + /// + public double MegapoundsPerMinute => As(MassFlowUnit.MegapoundPerMinute); + + /// + /// Get MassFlow in MicrogramsPerSecond. + /// + public double MicrogramsPerSecond => As(MassFlowUnit.MicrogramPerSecond); + + /// + /// Get MassFlow in MilligramsPerSecond. + /// + public double MilligramsPerSecond => As(MassFlowUnit.MilligramPerSecond); + + /// + /// Get MassFlow in NanogramsPerSecond. + /// + public double NanogramsPerSecond => As(MassFlowUnit.NanogramPerSecond); + + /// + /// Get MassFlow in PoundsPerHour. + /// + public double PoundsPerHour => As(MassFlowUnit.PoundPerHour); + + /// + /// Get MassFlow in PoundsPerMinute. + /// + public double PoundsPerMinute => As(MassFlowUnit.PoundPerMinute); + + /// + /// Get MassFlow in ShortTonsPerHour. + /// + public double ShortTonsPerHour => As(MassFlowUnit.ShortTonPerHour); + + /// + /// Get MassFlow in TonnesPerDay. + /// + public double TonnesPerDay => As(MassFlowUnit.TonnePerDay); + + /// + /// Get MassFlow in TonnesPerHour. + /// + public double TonnesPerHour => As(MassFlowUnit.TonnePerHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassFlowUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MassFlowUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MassFlow from CentigramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond) + { + double value = (double) centigramspersecond; + return new MassFlow(value, MassFlowUnit.CentigramPerSecond); + } + /// + /// Get MassFlow from DecagramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) + { + double value = (double) decagramspersecond; + return new MassFlow(value, MassFlowUnit.DecagramPerSecond); + } + /// + /// Get MassFlow from DecigramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) + { + double value = (double) decigramspersecond; + return new MassFlow(value, MassFlowUnit.DecigramPerSecond); + } + /// + /// Get MassFlow from GramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) + { + double value = (double) gramspersecond; + return new MassFlow(value, MassFlowUnit.GramPerSecond); + } + /// + /// Get MassFlow from HectogramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond) + { + double value = (double) hectogramspersecond; + return new MassFlow(value, MassFlowUnit.HectogramPerSecond); + } + /// + /// Get MassFlow from KilogramsPerHour. + /// + /// If value is NaN or Infinity. + public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) + { + double value = (double) kilogramsperhour; + return new MassFlow(value, MassFlowUnit.KilogramPerHour); + } + /// + /// Get MassFlow from KilogramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) + { + double value = (double) kilogramspersecond; + return new MassFlow(value, MassFlowUnit.KilogramPerSecond); + } + /// + /// Get MassFlow from MegapoundsPerHour. + /// + /// If value is NaN or Infinity. + public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) + { + double value = (double) megapoundsperhour; + return new MassFlow(value, MassFlowUnit.MegapoundPerHour); + } + /// + /// Get MassFlow from MegapoundsPerMinute. + /// + /// If value is NaN or Infinity. + public static MassFlow FromMegapoundsPerMinute(QuantityValue megapoundsperminute) + { + double value = (double) megapoundsperminute; + return new MassFlow(value, MassFlowUnit.MegapoundPerMinute); + } + /// + /// Get MassFlow from MicrogramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond) + { + double value = (double) microgramspersecond; + return new MassFlow(value, MassFlowUnit.MicrogramPerSecond); + } + /// + /// Get MassFlow from MilligramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond) + { + double value = (double) milligramspersecond; + return new MassFlow(value, MassFlowUnit.MilligramPerSecond); + } + /// + /// Get MassFlow from NanogramsPerSecond. + /// + /// If value is NaN or Infinity. + public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) + { + double value = (double) nanogramspersecond; + return new MassFlow(value, MassFlowUnit.NanogramPerSecond); + } + /// + /// Get MassFlow from PoundsPerHour. + /// + /// If value is NaN or Infinity. + public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) + { + double value = (double) poundsperhour; + return new MassFlow(value, MassFlowUnit.PoundPerHour); + } + /// + /// Get MassFlow from PoundsPerMinute. + /// + /// If value is NaN or Infinity. + public static MassFlow FromPoundsPerMinute(QuantityValue poundsperminute) + { + double value = (double) poundsperminute; + return new MassFlow(value, MassFlowUnit.PoundPerMinute); + } + /// + /// Get MassFlow from ShortTonsPerHour. + /// + /// If value is NaN or Infinity. + public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) + { + double value = (double) shorttonsperhour; + return new MassFlow(value, MassFlowUnit.ShortTonPerHour); + } + /// + /// Get MassFlow from TonnesPerDay. + /// + /// If value is NaN or Infinity. + public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) + { + double value = (double) tonnesperday; + return new MassFlow(value, MassFlowUnit.TonnePerDay); + } + /// + /// Get MassFlow from TonnesPerHour. + /// + /// If value is NaN or Infinity. + public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) + { + double value = (double) tonnesperhour; + return new MassFlow(value, MassFlowUnit.TonnePerHour); + } + + /// + /// 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 new MassFlow((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MassFlow Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MassFlow Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MassFlow result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlow result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassFlowUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MassFlowUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassFlowUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MassFlowUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); + + return CompareTo((MassFlow)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MassFlow other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MassFlow within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MassFlow. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassFlowUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MassFlow to another MassFlow with the unit representation . + /// + /// A MassFlow with the specified unit. + public MassFlow ToUnit(MassFlowUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MassFlow(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassFlowUnit.CentigramPerSecond: return (_value) * 1e-2d; + case MassFlowUnit.DecagramPerSecond: return (_value) * 1e1d; + case MassFlowUnit.DecigramPerSecond: return (_value) * 1e-1d; + case MassFlowUnit.GramPerSecond: return _value; + case MassFlowUnit.HectogramPerSecond: return (_value) * 1e2d; + case MassFlowUnit.KilogramPerHour: return _value/3.6; + case MassFlowUnit.KilogramPerSecond: return (_value) * 1e3d; + case MassFlowUnit.MegapoundPerHour: return (_value/7.93664) * 1e6d; + case MassFlowUnit.MegapoundPerMinute: return (_value/0.132277) * 1e6d; + case MassFlowUnit.MicrogramPerSecond: return (_value) * 1e-6d; + case MassFlowUnit.MilligramPerSecond: return (_value) * 1e-3d; + case MassFlowUnit.NanogramPerSecond: return (_value) * 1e-9d; + case MassFlowUnit.PoundPerHour: return _value/7.93664; + case MassFlowUnit.PoundPerMinute: return _value/0.132277; + case MassFlowUnit.ShortTonPerHour: return _value*251.9957611; + case MassFlowUnit.TonnePerDay: return _value/0.0864000; + case MassFlowUnit.TonnePerHour: return 1000*_value/3.6; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassFlowUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassFlowUnit.CentigramPerSecond: return (baseUnitValue) / 1e-2d; + case MassFlowUnit.DecagramPerSecond: return (baseUnitValue) / 1e1d; + case MassFlowUnit.DecigramPerSecond: return (baseUnitValue) / 1e-1d; + case MassFlowUnit.GramPerSecond: return baseUnitValue; + case MassFlowUnit.HectogramPerSecond: return (baseUnitValue) / 1e2d; + case MassFlowUnit.KilogramPerHour: return baseUnitValue*3.6; + case MassFlowUnit.KilogramPerSecond: return (baseUnitValue) / 1e3d; + case MassFlowUnit.MegapoundPerHour: return (baseUnitValue*7.93664) / 1e6d; + case MassFlowUnit.MegapoundPerMinute: return (baseUnitValue*0.132277) / 1e6d; + case MassFlowUnit.MicrogramPerSecond: return (baseUnitValue) / 1e-6d; + case MassFlowUnit.MilligramPerSecond: return (baseUnitValue) / 1e-3d; + case MassFlowUnit.NanogramPerSecond: return (baseUnitValue) / 1e-9d; + case MassFlowUnit.PoundPerHour: return baseUnitValue*7.93664; + case MassFlowUnit.PoundPerMinute: return baseUnitValue*0.132277; + case MassFlowUnit.ShortTonPerHour: return baseUnitValue/251.9957611; + case MassFlowUnit.TonnePerDay: return baseUnitValue*0.0864000; + case MassFlowUnit.TonnePerHour: return baseUnitValue*3.6/1000; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs new file mode 100644 index 0000000000..3e0c9b3650 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -0,0 +1,616 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Mass flux is the mass flow rate per unit area. + /// + public partial struct MassFlux : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassFluxUnit? _unit; + + static MassFlux() + { + BaseDimensions = new BaseDimensions(-2, 1, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MassFlux(double numericValue, MassFluxUnit unit) + { + if(unit == MassFluxUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MassFlux, which is KilogramPerSecondPerSquareMeter. All conversions go via this value. + /// + public static MassFluxUnit BaseUnit => MassFluxUnit.KilogramPerSecondPerSquareMeter; + + /// + /// Represents the largest possible value of MassFlux + /// + public static MassFlux MaxValue => new MassFlux(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MassFlux + /// + public static MassFlux MinValue => new MassFlux(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MassFlux; + + /// + /// All units of measurement for the MassFlux quantity. + /// + public static MassFluxUnit[] Units { get; } = Enum.GetValues(typeof(MassFluxUnit)).Cast().Except(new MassFluxUnit[]{ MassFluxUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter. + /// + public static MassFlux Zero => new MassFlux(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MassFlux.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassFlux.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MassFlux in GramsPerSecondPerSquareMeter. + /// + public double GramsPerSecondPerSquareMeter => As(MassFluxUnit.GramPerSecondPerSquareMeter); + + /// + /// Get MassFlux in KilogramsPerSecondPerSquareMeter. + /// + public double KilogramsPerSecondPerSquareMeter => As(MassFluxUnit.KilogramPerSecondPerSquareMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassFluxUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MassFluxUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MassFlux from GramsPerSecondPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static MassFlux FromGramsPerSecondPerSquareMeter(QuantityValue gramspersecondpersquaremeter) + { + double value = (double) gramspersecondpersquaremeter; + return new MassFlux(value, MassFluxUnit.GramPerSecondPerSquareMeter); + } + /// + /// Get MassFlux from KilogramsPerSecondPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static MassFlux FromKilogramsPerSecondPerSquareMeter(QuantityValue kilogramspersecondpersquaremeter) + { + double value = (double) kilogramspersecondpersquaremeter; + return new MassFlux(value, MassFluxUnit.KilogramPerSecondPerSquareMeter); + } + + /// + /// 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 new MassFlux((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MassFlux Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MassFlux Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MassFlux result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassFlux result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassFluxUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MassFluxUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassFluxUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MassFluxUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); + + return CompareTo((MassFlux)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MassFlux other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MassFlux within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MassFlux. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassFluxUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MassFlux to another MassFlux with the unit representation . + /// + /// A MassFlux with the specified unit. + public MassFlux ToUnit(MassFluxUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MassFlux(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassFluxUnit.GramPerSecondPerSquareMeter: return _value/1e3; + case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (_value/1e3) * 1e3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassFluxUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassFluxUnit.GramPerSecondPerSquareMeter: return baseUnitValue*1e3; + case MassFluxUnit.KilogramPerSecondPerSquareMeter: return (baseUnitValue*1e3) / 1e3d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs new file mode 100644 index 0000000000..2f4abcf978 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -0,0 +1,1032 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A property of body reflects how its mass is distributed with regard to an axis. + /// + public partial struct MassMomentOfInertia : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MassMomentOfInertiaUnit? _unit; + + static MassMomentOfInertia() + { + BaseDimensions = new BaseDimensions(2, 1, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MassMomentOfInertia(double numericValue, MassMomentOfInertiaUnit unit) + { + if(unit == MassMomentOfInertiaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MassMomentOfInertia, which is KilogramSquareMeter. All conversions go via this value. + /// + public static MassMomentOfInertiaUnit BaseUnit => MassMomentOfInertiaUnit.KilogramSquareMeter; + + /// + /// Represents the largest possible value of MassMomentOfInertia + /// + public static MassMomentOfInertia MaxValue => new MassMomentOfInertia(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MassMomentOfInertia + /// + public static MassMomentOfInertia MinValue => new MassMomentOfInertia(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MassMomentOfInertia; + + /// + /// All units of measurement for the MassMomentOfInertia quantity. + /// + public static MassMomentOfInertiaUnit[] Units { get; } = Enum.GetValues(typeof(MassMomentOfInertiaUnit)).Cast().Except(new MassMomentOfInertiaUnit[]{ MassMomentOfInertiaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramSquareMeter. + /// + public static MassMomentOfInertia Zero => new MassMomentOfInertia(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MassMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MassMomentOfInertia.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MassMomentOfInertia.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MassMomentOfInertia in GramSquareCentimeters. + /// + public double GramSquareCentimeters => As(MassMomentOfInertiaUnit.GramSquareCentimeter); + + /// + /// Get MassMomentOfInertia in GramSquareDecimeters. + /// + public double GramSquareDecimeters => As(MassMomentOfInertiaUnit.GramSquareDecimeter); + + /// + /// Get MassMomentOfInertia in GramSquareMeters. + /// + public double GramSquareMeters => As(MassMomentOfInertiaUnit.GramSquareMeter); + + /// + /// Get MassMomentOfInertia in GramSquareMillimeters. + /// + public double GramSquareMillimeters => As(MassMomentOfInertiaUnit.GramSquareMillimeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareCentimeters. + /// + public double KilogramSquareCentimeters => As(MassMomentOfInertiaUnit.KilogramSquareCentimeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareDecimeters. + /// + public double KilogramSquareDecimeters => As(MassMomentOfInertiaUnit.KilogramSquareDecimeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareMeters. + /// + public double KilogramSquareMeters => As(MassMomentOfInertiaUnit.KilogramSquareMeter); + + /// + /// Get MassMomentOfInertia in KilogramSquareMillimeters. + /// + public double KilogramSquareMillimeters => As(MassMomentOfInertiaUnit.KilogramSquareMillimeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareCentimeters. + /// + public double KilotonneSquareCentimeters => As(MassMomentOfInertiaUnit.KilotonneSquareCentimeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareDecimeters. + /// + public double KilotonneSquareDecimeters => As(MassMomentOfInertiaUnit.KilotonneSquareDecimeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareMeters. + /// + public double KilotonneSquareMeters => As(MassMomentOfInertiaUnit.KilotonneSquareMeter); + + /// + /// Get MassMomentOfInertia in KilotonneSquareMilimeters. + /// + public double KilotonneSquareMilimeters => As(MassMomentOfInertiaUnit.KilotonneSquareMilimeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareCentimeters. + /// + public double MegatonneSquareCentimeters => As(MassMomentOfInertiaUnit.MegatonneSquareCentimeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareDecimeters. + /// + public double MegatonneSquareDecimeters => As(MassMomentOfInertiaUnit.MegatonneSquareDecimeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareMeters. + /// + public double MegatonneSquareMeters => As(MassMomentOfInertiaUnit.MegatonneSquareMeter); + + /// + /// Get MassMomentOfInertia in MegatonneSquareMilimeters. + /// + public double MegatonneSquareMilimeters => As(MassMomentOfInertiaUnit.MegatonneSquareMilimeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareCentimeters. + /// + public double MilligramSquareCentimeters => As(MassMomentOfInertiaUnit.MilligramSquareCentimeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareDecimeters. + /// + public double MilligramSquareDecimeters => As(MassMomentOfInertiaUnit.MilligramSquareDecimeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareMeters. + /// + public double MilligramSquareMeters => As(MassMomentOfInertiaUnit.MilligramSquareMeter); + + /// + /// Get MassMomentOfInertia in MilligramSquareMillimeters. + /// + public double MilligramSquareMillimeters => As(MassMomentOfInertiaUnit.MilligramSquareMillimeter); + + /// + /// Get MassMomentOfInertia in PoundSquareFeet. + /// + public double PoundSquareFeet => As(MassMomentOfInertiaUnit.PoundSquareFoot); + + /// + /// Get MassMomentOfInertia in PoundSquareInches. + /// + public double PoundSquareInches => As(MassMomentOfInertiaUnit.PoundSquareInch); + + /// + /// Get MassMomentOfInertia in SlugSquareFeet. + /// + public double SlugSquareFeet => As(MassMomentOfInertiaUnit.SlugSquareFoot); + + /// + /// Get MassMomentOfInertia in SlugSquareInches. + /// + public double SlugSquareInches => As(MassMomentOfInertiaUnit.SlugSquareInch); + + /// + /// Get MassMomentOfInertia in TonneSquareCentimeters. + /// + public double TonneSquareCentimeters => As(MassMomentOfInertiaUnit.TonneSquareCentimeter); + + /// + /// Get MassMomentOfInertia in TonneSquareDecimeters. + /// + public double TonneSquareDecimeters => As(MassMomentOfInertiaUnit.TonneSquareDecimeter); + + /// + /// Get MassMomentOfInertia in TonneSquareMeters. + /// + public double TonneSquareMeters => As(MassMomentOfInertiaUnit.TonneSquareMeter); + + /// + /// Get MassMomentOfInertia in TonneSquareMilimeters. + /// + public double TonneSquareMilimeters => As(MassMomentOfInertiaUnit.TonneSquareMilimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MassMomentOfInertiaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MassMomentOfInertiaUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MassMomentOfInertia from GramSquareCentimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromGramSquareCentimeters(QuantityValue gramsquarecentimeters) + { + double value = (double) gramsquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from GramSquareDecimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromGramSquareDecimeters(QuantityValue gramsquaredecimeters) + { + double value = (double) gramsquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from GramSquareMeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromGramSquareMeters(QuantityValue gramsquaremeters) + { + double value = (double) gramsquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMeter); + } + /// + /// Get MassMomentOfInertia from GramSquareMillimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromGramSquareMillimeters(QuantityValue gramsquaremillimeters) + { + double value = (double) gramsquaremillimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.GramSquareMillimeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareCentimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilogramSquareCentimeters(QuantityValue kilogramsquarecentimeters) + { + double value = (double) kilogramsquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareDecimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilogramSquareDecimeters(QuantityValue kilogramsquaredecimeters) + { + double value = (double) kilogramsquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareMeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilogramSquareMeters(QuantityValue kilogramsquaremeters) + { + double value = (double) kilogramsquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMeter); + } + /// + /// Get MassMomentOfInertia from KilogramSquareMillimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilogramSquareMillimeters(QuantityValue kilogramsquaremillimeters) + { + double value = (double) kilogramsquaremillimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilogramSquareMillimeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareCentimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilotonneSquareCentimeters(QuantityValue kilotonnesquarecentimeters) + { + double value = (double) kilotonnesquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareDecimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilotonneSquareDecimeters(QuantityValue kilotonnesquaredecimeters) + { + double value = (double) kilotonnesquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareMeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilotonneSquareMeters(QuantityValue kilotonnesquaremeters) + { + double value = (double) kilotonnesquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMeter); + } + /// + /// Get MassMomentOfInertia from KilotonneSquareMilimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromKilotonneSquareMilimeters(QuantityValue kilotonnesquaremilimeters) + { + double value = (double) kilotonnesquaremilimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.KilotonneSquareMilimeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareCentimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMegatonneSquareCentimeters(QuantityValue megatonnesquarecentimeters) + { + double value = (double) megatonnesquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareDecimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMegatonneSquareDecimeters(QuantityValue megatonnesquaredecimeters) + { + double value = (double) megatonnesquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareMeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMegatonneSquareMeters(QuantityValue megatonnesquaremeters) + { + double value = (double) megatonnesquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMeter); + } + /// + /// Get MassMomentOfInertia from MegatonneSquareMilimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMegatonneSquareMilimeters(QuantityValue megatonnesquaremilimeters) + { + double value = (double) megatonnesquaremilimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MegatonneSquareMilimeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareCentimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMilligramSquareCentimeters(QuantityValue milligramsquarecentimeters) + { + double value = (double) milligramsquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareDecimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMilligramSquareDecimeters(QuantityValue milligramsquaredecimeters) + { + double value = (double) milligramsquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareMeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMilligramSquareMeters(QuantityValue milligramsquaremeters) + { + double value = (double) milligramsquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMeter); + } + /// + /// Get MassMomentOfInertia from MilligramSquareMillimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromMilligramSquareMillimeters(QuantityValue milligramsquaremillimeters) + { + double value = (double) milligramsquaremillimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.MilligramSquareMillimeter); + } + /// + /// Get MassMomentOfInertia from PoundSquareFeet. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromPoundSquareFeet(QuantityValue poundsquarefeet) + { + double value = (double) poundsquarefeet; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareFoot); + } + /// + /// Get MassMomentOfInertia from PoundSquareInches. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromPoundSquareInches(QuantityValue poundsquareinches) + { + double value = (double) poundsquareinches; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.PoundSquareInch); + } + /// + /// Get MassMomentOfInertia from SlugSquareFeet. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromSlugSquareFeet(QuantityValue slugsquarefeet) + { + double value = (double) slugsquarefeet; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareFoot); + } + /// + /// Get MassMomentOfInertia from SlugSquareInches. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromSlugSquareInches(QuantityValue slugsquareinches) + { + double value = (double) slugsquareinches; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.SlugSquareInch); + } + /// + /// Get MassMomentOfInertia from TonneSquareCentimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromTonneSquareCentimeters(QuantityValue tonnesquarecentimeters) + { + double value = (double) tonnesquarecentimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareCentimeter); + } + /// + /// Get MassMomentOfInertia from TonneSquareDecimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromTonneSquareDecimeters(QuantityValue tonnesquaredecimeters) + { + double value = (double) tonnesquaredecimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareDecimeter); + } + /// + /// Get MassMomentOfInertia from TonneSquareMeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromTonneSquareMeters(QuantityValue tonnesquaremeters) + { + double value = (double) tonnesquaremeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMeter); + } + /// + /// Get MassMomentOfInertia from TonneSquareMilimeters. + /// + /// If value is NaN or Infinity. + public static MassMomentOfInertia FromTonneSquareMilimeters(QuantityValue tonnesquaremilimeters) + { + double value = (double) tonnesquaremilimeters; + return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMilimeter); + } + + /// + /// 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 new MassMomentOfInertia((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MassMomentOfInertia Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MassMomentOfInertia Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MassMomentOfInertia result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MassMomentOfInertia result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MassMomentOfInertiaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MassMomentOfInertiaUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MassMomentOfInertiaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MassMomentOfInertiaUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); + + return CompareTo((MassMomentOfInertia)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MassMomentOfInertia other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MassMomentOfInertia within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MassMomentOfInertia. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MassMomentOfInertiaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MassMomentOfInertia to another MassMomentOfInertia with the unit representation . + /// + /// A MassMomentOfInertia with the specified unit. + public MassMomentOfInertia ToUnit(MassMomentOfInertiaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MassMomentOfInertia(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MassMomentOfInertiaUnit.GramSquareCentimeter: return _value/1e7; + case MassMomentOfInertiaUnit.GramSquareDecimeter: return _value/1e5; + case MassMomentOfInertiaUnit.GramSquareMeter: return _value/1e3; + case MassMomentOfInertiaUnit.GramSquareMillimeter: return _value/1e9; + case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (_value/1e7) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (_value/1e5) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMeter: return (_value/1e3) * 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (_value/1e9) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (_value/1e1) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (_value/1e-1) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (_value/1e-3) * 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (_value/1e3) * 1e3d; + case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (_value/1e1) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (_value/1e-1) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (_value/1e-3) * 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (_value/1e3) * 1e6d; + case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (_value/1e7) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (_value/1e5) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMeter: return (_value/1e3) * 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (_value/1e9) * 1e-3d; + case MassMomentOfInertiaUnit.PoundSquareFoot: return _value*4.21401101e-2; + case MassMomentOfInertiaUnit.PoundSquareInch: return _value*2.9263965e-4; + case MassMomentOfInertiaUnit.SlugSquareFoot: return _value*1.3558179619; + case MassMomentOfInertiaUnit.SlugSquareInch: return _value*9.41540242e-3; + case MassMomentOfInertiaUnit.TonneSquareCentimeter: return _value/1e1; + case MassMomentOfInertiaUnit.TonneSquareDecimeter: return _value/1e-1; + case MassMomentOfInertiaUnit.TonneSquareMeter: return _value/1e-3; + case MassMomentOfInertiaUnit.TonneSquareMilimeter: return _value/1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MassMomentOfInertiaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MassMomentOfInertiaUnit.GramSquareCentimeter: return baseUnitValue*1e7; + case MassMomentOfInertiaUnit.GramSquareDecimeter: return baseUnitValue*1e5; + case MassMomentOfInertiaUnit.GramSquareMeter: return baseUnitValue*1e3; + case MassMomentOfInertiaUnit.GramSquareMillimeter: return baseUnitValue*1e9; + case MassMomentOfInertiaUnit.KilogramSquareCentimeter: return (baseUnitValue*1e7) / 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareDecimeter: return (baseUnitValue*1e5) / 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMeter: return (baseUnitValue*1e3) / 1e3d; + case MassMomentOfInertiaUnit.KilogramSquareMillimeter: return (baseUnitValue*1e9) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareCentimeter: return (baseUnitValue*1e1) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareDecimeter: return (baseUnitValue*1e-1) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMeter: return (baseUnitValue*1e-3) / 1e3d; + case MassMomentOfInertiaUnit.KilotonneSquareMilimeter: return (baseUnitValue*1e3) / 1e3d; + case MassMomentOfInertiaUnit.MegatonneSquareCentimeter: return (baseUnitValue*1e1) / 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareDecimeter: return (baseUnitValue*1e-1) / 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMeter: return (baseUnitValue*1e-3) / 1e6d; + case MassMomentOfInertiaUnit.MegatonneSquareMilimeter: return (baseUnitValue*1e3) / 1e6d; + case MassMomentOfInertiaUnit.MilligramSquareCentimeter: return (baseUnitValue*1e7) / 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareDecimeter: return (baseUnitValue*1e5) / 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMeter: return (baseUnitValue*1e3) / 1e-3d; + case MassMomentOfInertiaUnit.MilligramSquareMillimeter: return (baseUnitValue*1e9) / 1e-3d; + case MassMomentOfInertiaUnit.PoundSquareFoot: return baseUnitValue/4.21401101e-2; + case MassMomentOfInertiaUnit.PoundSquareInch: return baseUnitValue/2.9263965e-4; + case MassMomentOfInertiaUnit.SlugSquareFoot: return baseUnitValue/1.3558179619; + case MassMomentOfInertiaUnit.SlugSquareInch: return baseUnitValue/9.41540242e-3; + case MassMomentOfInertiaUnit.TonneSquareCentimeter: return baseUnitValue*1e1; + case MassMomentOfInertiaUnit.TonneSquareDecimeter: return baseUnitValue*1e-1; + case MassMomentOfInertiaUnit.TonneSquareMeter: return baseUnitValue*1e-3; + case MassMomentOfInertiaUnit.TonneSquareMilimeter: return baseUnitValue*1e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs new file mode 100644 index 0000000000..00b21fdd99 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Molar energy is the amount of energy stored in 1 mole of a substance. + /// + public partial struct MolarEnergy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarEnergyUnit? _unit; + + static MolarEnergy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, -1, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MolarEnergy(double numericValue, MolarEnergyUnit unit) + { + if(unit == MolarEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MolarEnergy, which is JoulePerMole. All conversions go via this value. + /// + public static MolarEnergyUnit BaseUnit => MolarEnergyUnit.JoulePerMole; + + /// + /// Represents the largest possible value of MolarEnergy + /// + public static MolarEnergy MaxValue => new MolarEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MolarEnergy + /// + public static MolarEnergy MinValue => new MolarEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MolarEnergy; + + /// + /// All units of measurement for the MolarEnergy quantity. + /// + public static MolarEnergyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEnergyUnit)).Cast().Except(new MolarEnergyUnit[]{ MolarEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMole. + /// + public static MolarEnergy Zero => new MolarEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MolarEnergy in JoulesPerMole. + /// + public double JoulesPerMole => As(MolarEnergyUnit.JoulePerMole); + + /// + /// Get MolarEnergy in KilojoulesPerMole. + /// + public double KilojoulesPerMole => As(MolarEnergyUnit.KilojoulePerMole); + + /// + /// Get MolarEnergy in MegajoulesPerMole. + /// + public double MegajoulesPerMole => As(MolarEnergyUnit.MegajoulePerMole); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MolarEnergyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MolarEnergy from JoulesPerMole. + /// + /// If value is NaN or Infinity. + public static MolarEnergy FromJoulesPerMole(QuantityValue joulespermole) + { + double value = (double) joulespermole; + return new MolarEnergy(value, MolarEnergyUnit.JoulePerMole); + } + /// + /// Get MolarEnergy from KilojoulesPerMole. + /// + /// If value is NaN or Infinity. + public static MolarEnergy FromKilojoulesPerMole(QuantityValue kilojoulespermole) + { + double value = (double) kilojoulespermole; + return new MolarEnergy(value, MolarEnergyUnit.KilojoulePerMole); + } + /// + /// Get MolarEnergy from MegajoulesPerMole. + /// + /// If value is NaN or Infinity. + public static MolarEnergy FromMegajoulesPerMole(QuantityValue megajoulespermole) + { + double value = (double) megajoulespermole; + return new MolarEnergy(value, MolarEnergyUnit.MegajoulePerMole); + } + + /// + /// 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 new MolarEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MolarEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MolarEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MolarEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEnergy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MolarEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarEnergyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); + + return CompareTo((MolarEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MolarEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MolarEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MolarEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MolarEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MolarEnergy to another MolarEnergy with the unit representation . + /// + /// A MolarEnergy with the specified unit. + public MolarEnergy ToUnit(MolarEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MolarEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarEnergyUnit.JoulePerMole: return _value; + case MolarEnergyUnit.KilojoulePerMole: return (_value) * 1e3d; + case MolarEnergyUnit.MegajoulePerMole: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarEnergyUnit.JoulePerMole: return baseUnitValue; + case MolarEnergyUnit.KilojoulePerMole: return (baseUnitValue) / 1e3d; + case MolarEnergyUnit.MegajoulePerMole: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs new file mode 100644 index 0000000000..5ef2ea0fe3 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. + /// + public partial struct MolarEntropy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarEntropyUnit? _unit; + + static MolarEntropy() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, -1, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MolarEntropy(double numericValue, MolarEntropyUnit unit) + { + if(unit == MolarEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MolarEntropy, which is JoulePerMoleKelvin. All conversions go via this value. + /// + public static MolarEntropyUnit BaseUnit => MolarEntropyUnit.JoulePerMoleKelvin; + + /// + /// Represents the largest possible value of MolarEntropy + /// + public static MolarEntropy MaxValue => new MolarEntropy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MolarEntropy + /// + public static MolarEntropy MinValue => new MolarEntropy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MolarEntropy; + + /// + /// All units of measurement for the MolarEntropy quantity. + /// + public static MolarEntropyUnit[] Units { get; } = Enum.GetValues(typeof(MolarEntropyUnit)).Cast().Except(new MolarEntropyUnit[]{ MolarEntropyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerMoleKelvin. + /// + public static MolarEntropy Zero => new MolarEntropy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarEntropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarEntropy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MolarEntropy in JoulesPerMoleKelvin. + /// + public double JoulesPerMoleKelvin => As(MolarEntropyUnit.JoulePerMoleKelvin); + + /// + /// Get MolarEntropy in KilojoulesPerMoleKelvin. + /// + public double KilojoulesPerMoleKelvin => As(MolarEntropyUnit.KilojoulePerMoleKelvin); + + /// + /// Get MolarEntropy in MegajoulesPerMoleKelvin. + /// + public double MegajoulesPerMoleKelvin => As(MolarEntropyUnit.MegajoulePerMoleKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarEntropyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MolarEntropyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MolarEntropy from JoulesPerMoleKelvin. + /// + /// If value is NaN or Infinity. + public static MolarEntropy FromJoulesPerMoleKelvin(QuantityValue joulespermolekelvin) + { + double value = (double) joulespermolekelvin; + return new MolarEntropy(value, MolarEntropyUnit.JoulePerMoleKelvin); + } + /// + /// Get MolarEntropy from KilojoulesPerMoleKelvin. + /// + /// If value is NaN or Infinity. + public static MolarEntropy FromKilojoulesPerMoleKelvin(QuantityValue kilojoulespermolekelvin) + { + double value = (double) kilojoulespermolekelvin; + return new MolarEntropy(value, MolarEntropyUnit.KilojoulePerMoleKelvin); + } + /// + /// Get MolarEntropy from MegajoulesPerMoleKelvin. + /// + /// If value is NaN or Infinity. + public static MolarEntropy FromMegajoulesPerMoleKelvin(QuantityValue megajoulespermolekelvin) + { + double value = (double) megajoulespermolekelvin; + return new MolarEntropy(value, MolarEntropyUnit.MegajoulePerMoleKelvin); + } + + /// + /// 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 new MolarEntropy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MolarEntropy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MolarEntropy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MolarEntropy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarEntropy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarEntropyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MolarEntropyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarEntropyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarEntropyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); + + return CompareTo((MolarEntropy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MolarEntropy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MolarEntropy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MolarEntropy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarEntropyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MolarEntropy to another MolarEntropy with the unit representation . + /// + /// A MolarEntropy with the specified unit. + public MolarEntropy ToUnit(MolarEntropyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MolarEntropy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarEntropyUnit.JoulePerMoleKelvin: return _value; + case MolarEntropyUnit.KilojoulePerMoleKelvin: return (_value) * 1e3d; + case MolarEntropyUnit.MegajoulePerMoleKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarEntropyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarEntropyUnit.JoulePerMoleKelvin: return baseUnitValue; + case MolarEntropyUnit.KilojoulePerMoleKelvin: return (baseUnitValue) / 1e3d; + case MolarEntropyUnit.MegajoulePerMoleKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs new file mode 100644 index 0000000000..8ff5fe548c --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -0,0 +1,776 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. + /// + public partial struct MolarMass : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarMassUnit? _unit; + + static MolarMass() + { + BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, -1, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public MolarMass(double numericValue, MolarMassUnit unit) + { + if(unit == MolarMassUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of MolarMass, which is KilogramPerMole. All conversions go via this value. + /// + public static MolarMassUnit BaseUnit => MolarMassUnit.KilogramPerMole; + + /// + /// Represents the largest possible value of MolarMass + /// + public static MolarMass MaxValue => new MolarMass(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of MolarMass + /// + public static MolarMass MinValue => new MolarMass(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.MolarMass; + + /// + /// All units of measurement for the MolarMass quantity. + /// + public static MolarMassUnit[] Units { get; } = Enum.GetValues(typeof(MolarMassUnit)).Cast().Except(new MolarMassUnit[]{ MolarMassUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit KilogramPerMole. + /// + public static MolarMass Zero => new MolarMass(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarMassUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => MolarMass.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => MolarMass.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get MolarMass in CentigramsPerMole. + /// + public double CentigramsPerMole => As(MolarMassUnit.CentigramPerMole); + + /// + /// Get MolarMass in DecagramsPerMole. + /// + public double DecagramsPerMole => As(MolarMassUnit.DecagramPerMole); + + /// + /// Get MolarMass in DecigramsPerMole. + /// + public double DecigramsPerMole => As(MolarMassUnit.DecigramPerMole); + + /// + /// Get MolarMass in GramsPerMole. + /// + public double GramsPerMole => As(MolarMassUnit.GramPerMole); + + /// + /// Get MolarMass in HectogramsPerMole. + /// + public double HectogramsPerMole => As(MolarMassUnit.HectogramPerMole); + + /// + /// Get MolarMass in KilogramsPerMole. + /// + public double KilogramsPerMole => As(MolarMassUnit.KilogramPerMole); + + /// + /// Get MolarMass in KilopoundsPerMole. + /// + public double KilopoundsPerMole => As(MolarMassUnit.KilopoundPerMole); + + /// + /// Get MolarMass in MegapoundsPerMole. + /// + public double MegapoundsPerMole => As(MolarMassUnit.MegapoundPerMole); + + /// + /// Get MolarMass in MicrogramsPerMole. + /// + public double MicrogramsPerMole => As(MolarMassUnit.MicrogramPerMole); + + /// + /// Get MolarMass in MilligramsPerMole. + /// + public double MilligramsPerMole => As(MolarMassUnit.MilligramPerMole); + + /// + /// Get MolarMass in NanogramsPerMole. + /// + public double NanogramsPerMole => As(MolarMassUnit.NanogramPerMole); + + /// + /// Get MolarMass in PoundsPerMole. + /// + public double PoundsPerMole => As(MolarMassUnit.PoundPerMole); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarMassUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MolarMassUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get MolarMass from CentigramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromCentigramsPerMole(QuantityValue centigramspermole) + { + double value = (double) centigramspermole; + return new MolarMass(value, MolarMassUnit.CentigramPerMole); + } + /// + /// Get MolarMass from DecagramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromDecagramsPerMole(QuantityValue decagramspermole) + { + double value = (double) decagramspermole; + return new MolarMass(value, MolarMassUnit.DecagramPerMole); + } + /// + /// Get MolarMass from DecigramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromDecigramsPerMole(QuantityValue decigramspermole) + { + double value = (double) decigramspermole; + return new MolarMass(value, MolarMassUnit.DecigramPerMole); + } + /// + /// Get MolarMass from GramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromGramsPerMole(QuantityValue gramspermole) + { + double value = (double) gramspermole; + return new MolarMass(value, MolarMassUnit.GramPerMole); + } + /// + /// Get MolarMass from HectogramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromHectogramsPerMole(QuantityValue hectogramspermole) + { + double value = (double) hectogramspermole; + return new MolarMass(value, MolarMassUnit.HectogramPerMole); + } + /// + /// Get MolarMass from KilogramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromKilogramsPerMole(QuantityValue kilogramspermole) + { + double value = (double) kilogramspermole; + return new MolarMass(value, MolarMassUnit.KilogramPerMole); + } + /// + /// Get MolarMass from KilopoundsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromKilopoundsPerMole(QuantityValue kilopoundspermole) + { + double value = (double) kilopoundspermole; + return new MolarMass(value, MolarMassUnit.KilopoundPerMole); + } + /// + /// Get MolarMass from MegapoundsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromMegapoundsPerMole(QuantityValue megapoundspermole) + { + double value = (double) megapoundspermole; + return new MolarMass(value, MolarMassUnit.MegapoundPerMole); + } + /// + /// Get MolarMass from MicrogramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromMicrogramsPerMole(QuantityValue microgramspermole) + { + double value = (double) microgramspermole; + return new MolarMass(value, MolarMassUnit.MicrogramPerMole); + } + /// + /// Get MolarMass from MilligramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromMilligramsPerMole(QuantityValue milligramspermole) + { + double value = (double) milligramspermole; + return new MolarMass(value, MolarMassUnit.MilligramPerMole); + } + /// + /// Get MolarMass from NanogramsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromNanogramsPerMole(QuantityValue nanogramspermole) + { + double value = (double) nanogramspermole; + return new MolarMass(value, MolarMassUnit.NanogramPerMole); + } + /// + /// Get MolarMass from PoundsPerMole. + /// + /// If value is NaN or Infinity. + public static MolarMass FromPoundsPerMole(QuantityValue poundspermole) + { + double value = (double) poundspermole; + return new MolarMass(value, MolarMassUnit.PoundPerMole); + } + + /// + /// 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 new MolarMass((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static MolarMass Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static MolarMass Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out MolarMass result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out MolarMass result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarMassUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MolarMassUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarMassUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarMassUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is MolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); + + return CompareTo((MolarMass)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(MolarMass other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another MolarMass within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current MolarMass. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarMassUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this MolarMass to another MolarMass with the unit representation . + /// + /// A MolarMass with the specified unit. + public MolarMass ToUnit(MolarMassUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new MolarMass(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarMassUnit.CentigramPerMole: return (_value/1e3) * 1e-2d; + case MolarMassUnit.DecagramPerMole: return (_value/1e3) * 1e1d; + case MolarMassUnit.DecigramPerMole: return (_value/1e3) * 1e-1d; + case MolarMassUnit.GramPerMole: return _value/1e3; + case MolarMassUnit.HectogramPerMole: return (_value/1e3) * 1e2d; + case MolarMassUnit.KilogramPerMole: return (_value/1e3) * 1e3d; + case MolarMassUnit.KilopoundPerMole: return (_value*0.45359237) * 1e3d; + case MolarMassUnit.MegapoundPerMole: return (_value*0.45359237) * 1e6d; + case MolarMassUnit.MicrogramPerMole: return (_value/1e3) * 1e-6d; + case MolarMassUnit.MilligramPerMole: return (_value/1e3) * 1e-3d; + case MolarMassUnit.NanogramPerMole: return (_value/1e3) * 1e-9d; + case MolarMassUnit.PoundPerMole: return _value*0.45359237; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarMassUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarMassUnit.CentigramPerMole: return (baseUnitValue*1e3) / 1e-2d; + case MolarMassUnit.DecagramPerMole: return (baseUnitValue*1e3) / 1e1d; + case MolarMassUnit.DecigramPerMole: return (baseUnitValue*1e3) / 1e-1d; + case MolarMassUnit.GramPerMole: return baseUnitValue*1e3; + case MolarMassUnit.HectogramPerMole: return (baseUnitValue*1e3) / 1e2d; + case MolarMassUnit.KilogramPerMole: return (baseUnitValue*1e3) / 1e3d; + case MolarMassUnit.KilopoundPerMole: return (baseUnitValue/0.45359237) / 1e3d; + case MolarMassUnit.MegapoundPerMole: return (baseUnitValue/0.45359237) / 1e6d; + case MolarMassUnit.MicrogramPerMole: return (baseUnitValue*1e3) / 1e-6d; + case MolarMassUnit.MilligramPerMole: return (baseUnitValue*1e3) / 1e-3d; + case MolarMassUnit.NanogramPerMole: return (baseUnitValue*1e3) / 1e-9d; + case MolarMassUnit.PoundPerMole: return baseUnitValue/0.45359237; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs new file mode 100644 index 0000000000..adff096d47 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -0,0 +1,715 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Molar concentration, also called molarity, amount concentration or substance concentration, is a measure of the concentration of a solute in a solution, or of any chemical species, in terms of amount of substance in a given volume. + /// + /// + /// https://en.wikipedia.org/wiki/Molar_concentration + /// + public partial struct Molarity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly MolarityUnit? _unit; + + static Molarity() + { + BaseDimensions = new BaseDimensions(-3, 0, 0, 0, 0, 1, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Molarity(double numericValue, MolarityUnit unit) + { + if(unit == MolarityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Molarity, which is MolesPerCubicMeter. All conversions go via this value. + /// + public static MolarityUnit BaseUnit => MolarityUnit.MolesPerCubicMeter; + + /// + /// Represents the largest possible value of Molarity + /// + public static Molarity MaxValue => new Molarity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Molarity + /// + public static Molarity MinValue => new Molarity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Molarity; + + /// + /// All units of measurement for the Molarity quantity. + /// + public static MolarityUnit[] Units { get; } = Enum.GetValues(typeof(MolarityUnit)).Cast().Except(new MolarityUnit[]{ MolarityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MolesPerCubicMeter. + /// + public static Molarity Zero => new Molarity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public MolarityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Molarity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Molarity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Molarity in CentimolesPerLiter. + /// + public double CentimolesPerLiter => As(MolarityUnit.CentimolesPerLiter); + + /// + /// Get Molarity in DecimolesPerLiter. + /// + public double DecimolesPerLiter => As(MolarityUnit.DecimolesPerLiter); + + /// + /// Get Molarity in MicromolesPerLiter. + /// + public double MicromolesPerLiter => As(MolarityUnit.MicromolesPerLiter); + + /// + /// Get Molarity in MillimolesPerLiter. + /// + public double MillimolesPerLiter => As(MolarityUnit.MillimolesPerLiter); + + /// + /// Get Molarity in MolesPerCubicMeter. + /// + public double MolesPerCubicMeter => As(MolarityUnit.MolesPerCubicMeter); + + /// + /// Get Molarity in MolesPerLiter. + /// + public double MolesPerLiter => As(MolarityUnit.MolesPerLiter); + + /// + /// Get Molarity in NanomolesPerLiter. + /// + public double NanomolesPerLiter => As(MolarityUnit.NanomolesPerLiter); + + /// + /// Get Molarity in PicomolesPerLiter. + /// + public double PicomolesPerLiter => As(MolarityUnit.PicomolesPerLiter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(MolarityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(MolarityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Molarity from CentimolesPerLiter. + /// + /// If value is NaN or Infinity. + public static Molarity FromCentimolesPerLiter(QuantityValue centimolesperliter) + { + double value = (double) centimolesperliter; + return new Molarity(value, MolarityUnit.CentimolesPerLiter); + } + /// + /// Get Molarity from DecimolesPerLiter. + /// + /// If value is NaN or Infinity. + public static Molarity FromDecimolesPerLiter(QuantityValue decimolesperliter) + { + double value = (double) decimolesperliter; + return new Molarity(value, MolarityUnit.DecimolesPerLiter); + } + /// + /// Get Molarity from MicromolesPerLiter. + /// + /// If value is NaN or Infinity. + public static Molarity FromMicromolesPerLiter(QuantityValue micromolesperliter) + { + double value = (double) micromolesperliter; + return new Molarity(value, MolarityUnit.MicromolesPerLiter); + } + /// + /// Get Molarity from MillimolesPerLiter. + /// + /// If value is NaN or Infinity. + public static Molarity FromMillimolesPerLiter(QuantityValue millimolesperliter) + { + double value = (double) millimolesperliter; + return new Molarity(value, MolarityUnit.MillimolesPerLiter); + } + /// + /// Get Molarity from MolesPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static Molarity FromMolesPerCubicMeter(QuantityValue molespercubicmeter) + { + double value = (double) molespercubicmeter; + return new Molarity(value, MolarityUnit.MolesPerCubicMeter); + } + /// + /// Get Molarity from MolesPerLiter. + /// + /// If value is NaN or Infinity. + public static Molarity FromMolesPerLiter(QuantityValue molesperliter) + { + double value = (double) molesperliter; + return new Molarity(value, MolarityUnit.MolesPerLiter); + } + /// + /// Get Molarity from NanomolesPerLiter. + /// + /// If value is NaN or Infinity. + public static Molarity FromNanomolesPerLiter(QuantityValue nanomolesperliter) + { + double value = (double) nanomolesperliter; + return new Molarity(value, MolarityUnit.NanomolesPerLiter); + } + /// + /// Get Molarity from PicomolesPerLiter. + /// + /// If value is NaN or Infinity. + public static Molarity FromPicomolesPerLiter(QuantityValue picomolesperliter) + { + double value = (double) picomolesperliter; + return new Molarity(value, MolarityUnit.PicomolesPerLiter); + } + + /// + /// 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 new Molarity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Molarity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Molarity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Molarity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Molarity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static MolarityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static MolarityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out MolarityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out MolarityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Molarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); + + return CompareTo((Molarity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Molarity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Molarity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Molarity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Molarity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(MolarityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Molarity to another Molarity with the unit representation . + /// + /// A Molarity with the specified unit. + public Molarity ToUnit(MolarityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Molarity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case MolarityUnit.CentimolesPerLiter: return (_value/1e-3) * 1e-2d; + case MolarityUnit.DecimolesPerLiter: return (_value/1e-3) * 1e-1d; + case MolarityUnit.MicromolesPerLiter: return (_value/1e-3) * 1e-6d; + case MolarityUnit.MillimolesPerLiter: return (_value/1e-3) * 1e-3d; + case MolarityUnit.MolesPerCubicMeter: return _value; + case MolarityUnit.MolesPerLiter: return _value/1e-3; + case MolarityUnit.NanomolesPerLiter: return (_value/1e-3) * 1e-9d; + case MolarityUnit.PicomolesPerLiter: return (_value/1e-3) * 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(MolarityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case MolarityUnit.CentimolesPerLiter: return (baseUnitValue*1e-3) / 1e-2d; + case MolarityUnit.DecimolesPerLiter: return (baseUnitValue*1e-3) / 1e-1d; + case MolarityUnit.MicromolesPerLiter: return (baseUnitValue*1e-3) / 1e-6d; + case MolarityUnit.MillimolesPerLiter: return (baseUnitValue*1e-3) / 1e-3d; + case MolarityUnit.MolesPerCubicMeter: return baseUnitValue; + case MolarityUnit.MolesPerLiter: return baseUnitValue*1e-3; + case MolarityUnit.NanomolesPerLiter: return (baseUnitValue*1e-3) / 1e-9d; + case MolarityUnit.PicomolesPerLiter: return (baseUnitValue*1e-3) / 1e-12d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs new file mode 100644 index 0000000000..9717d459d4 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, permeability is the measure of the ability of a material to support the formation of a magnetic field within itself. + /// + /// + /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) + /// + public partial struct Permeability : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PermeabilityUnit? _unit; + + static Permeability() + { + BaseDimensions = new BaseDimensions(1, 1, -2, -2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Permeability(double numericValue, PermeabilityUnit unit) + { + if(unit == PermeabilityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Permeability, which is HenryPerMeter. All conversions go via this value. + /// + public static PermeabilityUnit BaseUnit => PermeabilityUnit.HenryPerMeter; + + /// + /// Represents the largest possible value of Permeability + /// + public static Permeability MaxValue => new Permeability(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Permeability + /// + public static Permeability MinValue => new Permeability(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Permeability; + + /// + /// All units of measurement for the Permeability quantity. + /// + public static PermeabilityUnit[] Units { get; } = Enum.GetValues(typeof(PermeabilityUnit)).Cast().Except(new PermeabilityUnit[]{ PermeabilityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit HenryPerMeter. + /// + public static Permeability Zero => new Permeability(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PermeabilityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Permeability.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Permeability.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Permeability in HenriesPerMeter. + /// + public double HenriesPerMeter => As(PermeabilityUnit.HenryPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PermeabilityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(PermeabilityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Permeability from HenriesPerMeter. + /// + /// If value is NaN or Infinity. + public static Permeability FromHenriesPerMeter(QuantityValue henriespermeter) + { + double value = (double) henriespermeter; + return new Permeability(value, PermeabilityUnit.HenryPerMeter); + } + + /// + /// 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 new Permeability((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Permeability Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Permeability Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Permeability result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permeability result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PermeabilityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static PermeabilityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PermeabilityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out PermeabilityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Permeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); + + return CompareTo((Permeability)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Permeability other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Permeability within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Permeability other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Permeability. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PermeabilityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Permeability to another Permeability with the unit representation . + /// + /// A Permeability with the specified unit. + public Permeability ToUnit(PermeabilityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Permeability(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PermeabilityUnit.HenryPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PermeabilityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PermeabilityUnit.HenryPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs new file mode 100644 index 0000000000..134e7e4745 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In electromagnetism, permittivity is the measure of resistance that is encountered when forming an electric field in a particular medium. + /// + /// + /// https://en.wikipedia.org/wiki/Permittivity + /// + public partial struct Permittivity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PermittivityUnit? _unit; + + static Permittivity() + { + BaseDimensions = new BaseDimensions(-3, -1, 4, 2, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Permittivity(double numericValue, PermittivityUnit unit) + { + if(unit == PermittivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Permittivity, which is FaradPerMeter. All conversions go via this value. + /// + public static PermittivityUnit BaseUnit => PermittivityUnit.FaradPerMeter; + + /// + /// Represents the largest possible value of Permittivity + /// + public static Permittivity MaxValue => new Permittivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Permittivity + /// + public static Permittivity MinValue => new Permittivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Permittivity; + + /// + /// All units of measurement for the Permittivity quantity. + /// + public static PermittivityUnit[] Units { get; } = Enum.GetValues(typeof(PermittivityUnit)).Cast().Except(new PermittivityUnit[]{ PermittivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit FaradPerMeter. + /// + public static Permittivity Zero => new Permittivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PermittivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Permittivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Permittivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Permittivity in FaradsPerMeter. + /// + public double FaradsPerMeter => As(PermittivityUnit.FaradPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PermittivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(PermittivityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Permittivity from FaradsPerMeter. + /// + /// If value is NaN or Infinity. + public static Permittivity FromFaradsPerMeter(QuantityValue faradspermeter) + { + double value = (double) faradspermeter; + return new Permittivity(value, PermittivityUnit.FaradPerMeter); + } + + /// + /// 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 new Permittivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Permittivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Permittivity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Permittivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Permittivity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PermittivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static PermittivityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PermittivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out PermittivityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Permittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); + + return CompareTo((Permittivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Permittivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Permittivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Permittivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Permittivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PermittivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Permittivity to another Permittivity with the unit representation . + /// + /// A Permittivity with the specified unit. + public Permittivity ToUnit(PermittivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Permittivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PermittivityUnit.FaradPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PermittivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PermittivityUnit.FaradPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs new file mode 100644 index 0000000000..43441207ae --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -0,0 +1,904 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. + /// + public partial struct Power : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly decimal _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PowerUnit? _unit; + + static Power() + { + BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Power(decimal numericValue, PowerUnit unit) + { + if(unit == PowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = numericValue; + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Power, which is Watt. All conversions go via this value. + /// + public static PowerUnit BaseUnit => PowerUnit.Watt; + + /// + /// Represents the largest possible value of Power + /// + public static Power MaxValue => new Power(decimal.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Power + /// + public static Power MinValue => new Power(decimal.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Power; + + /// + /// All units of measurement for the Power quantity. + /// + public static PowerUnit[] Units { get; } = Enum.GetValues(typeof(PowerUnit)).Cast().Except(new PowerUnit[]{ PowerUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Watt. + /// + public static Power Zero => new Power(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public decimal Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Power.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Power.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Power in BoilerHorsepower. + /// + public double BoilerHorsepower => As(PowerUnit.BoilerHorsepower); + + /// + /// Get Power in BritishThermalUnitsPerHour. + /// + public double BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour); + + /// + /// Get Power in Decawatts. + /// + public double Decawatts => As(PowerUnit.Decawatt); + + /// + /// Get Power in Deciwatts. + /// + public double Deciwatts => As(PowerUnit.Deciwatt); + + /// + /// Get Power in ElectricalHorsepower. + /// + public double ElectricalHorsepower => As(PowerUnit.ElectricalHorsepower); + + /// + /// Get Power in Femtowatts. + /// + public double Femtowatts => As(PowerUnit.Femtowatt); + + /// + /// Get Power in Gigawatts. + /// + public double Gigawatts => As(PowerUnit.Gigawatt); + + /// + /// Get Power in HydraulicHorsepower. + /// + public double HydraulicHorsepower => As(PowerUnit.HydraulicHorsepower); + + /// + /// Get Power in KilobritishThermalUnitsPerHour. + /// + public double KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour); + + /// + /// Get Power in Kilowatts. + /// + public double Kilowatts => As(PowerUnit.Kilowatt); + + /// + /// Get Power in MechanicalHorsepower. + /// + public double MechanicalHorsepower => As(PowerUnit.MechanicalHorsepower); + + /// + /// Get Power in Megawatts. + /// + public double Megawatts => As(PowerUnit.Megawatt); + + /// + /// Get Power in MetricHorsepower. + /// + public double MetricHorsepower => As(PowerUnit.MetricHorsepower); + + /// + /// Get Power in Microwatts. + /// + public double Microwatts => As(PowerUnit.Microwatt); + + /// + /// Get Power in Milliwatts. + /// + public double Milliwatts => As(PowerUnit.Milliwatt); + + /// + /// Get Power in Nanowatts. + /// + public double Nanowatts => As(PowerUnit.Nanowatt); + + /// + /// Get Power in Petawatts. + /// + public double Petawatts => As(PowerUnit.Petawatt); + + /// + /// Get Power in Picowatts. + /// + public double Picowatts => As(PowerUnit.Picowatt); + + /// + /// Get Power in Terawatts. + /// + public double Terawatts => As(PowerUnit.Terawatt); + + /// + /// Get Power in Watts. + /// + public double Watts => As(PowerUnit.Watt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PowerUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(PowerUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Power from BoilerHorsepower. + /// + /// If value is NaN or Infinity. + public static Power FromBoilerHorsepower(QuantityValue boilerhorsepower) + { + decimal value = (decimal) boilerhorsepower; + return new Power(value, PowerUnit.BoilerHorsepower); + } + /// + /// Get Power from BritishThermalUnitsPerHour. + /// + /// If value is NaN or Infinity. + public static Power FromBritishThermalUnitsPerHour(QuantityValue britishthermalunitsperhour) + { + decimal value = (decimal) britishthermalunitsperhour; + return new Power(value, PowerUnit.BritishThermalUnitPerHour); + } + /// + /// Get Power from Decawatts. + /// + /// If value is NaN or Infinity. + public static Power FromDecawatts(QuantityValue decawatts) + { + decimal value = (decimal) decawatts; + return new Power(value, PowerUnit.Decawatt); + } + /// + /// Get Power from Deciwatts. + /// + /// If value is NaN or Infinity. + public static Power FromDeciwatts(QuantityValue deciwatts) + { + decimal value = (decimal) deciwatts; + return new Power(value, PowerUnit.Deciwatt); + } + /// + /// Get Power from ElectricalHorsepower. + /// + /// If value is NaN or Infinity. + public static Power FromElectricalHorsepower(QuantityValue electricalhorsepower) + { + decimal value = (decimal) electricalhorsepower; + return new Power(value, PowerUnit.ElectricalHorsepower); + } + /// + /// Get Power from Femtowatts. + /// + /// If value is NaN or Infinity. + public static Power FromFemtowatts(QuantityValue femtowatts) + { + decimal value = (decimal) femtowatts; + return new Power(value, PowerUnit.Femtowatt); + } + /// + /// Get Power from Gigawatts. + /// + /// If value is NaN or Infinity. + public static Power FromGigawatts(QuantityValue gigawatts) + { + decimal value = (decimal) gigawatts; + return new Power(value, PowerUnit.Gigawatt); + } + /// + /// Get Power from HydraulicHorsepower. + /// + /// If value is NaN or Infinity. + public static Power FromHydraulicHorsepower(QuantityValue hydraulichorsepower) + { + decimal value = (decimal) hydraulichorsepower; + return new Power(value, PowerUnit.HydraulicHorsepower); + } + /// + /// Get Power from KilobritishThermalUnitsPerHour. + /// + /// If value is NaN or Infinity. + public static Power FromKilobritishThermalUnitsPerHour(QuantityValue kilobritishthermalunitsperhour) + { + decimal value = (decimal) kilobritishthermalunitsperhour; + return new Power(value, PowerUnit.KilobritishThermalUnitPerHour); + } + /// + /// Get Power from Kilowatts. + /// + /// If value is NaN or Infinity. + public static Power FromKilowatts(QuantityValue kilowatts) + { + decimal value = (decimal) kilowatts; + return new Power(value, PowerUnit.Kilowatt); + } + /// + /// Get Power from MechanicalHorsepower. + /// + /// If value is NaN or Infinity. + public static Power FromMechanicalHorsepower(QuantityValue mechanicalhorsepower) + { + decimal value = (decimal) mechanicalhorsepower; + return new Power(value, PowerUnit.MechanicalHorsepower); + } + /// + /// Get Power from Megawatts. + /// + /// If value is NaN or Infinity. + public static Power FromMegawatts(QuantityValue megawatts) + { + decimal value = (decimal) megawatts; + return new Power(value, PowerUnit.Megawatt); + } + /// + /// Get Power from MetricHorsepower. + /// + /// If value is NaN or Infinity. + public static Power FromMetricHorsepower(QuantityValue metrichorsepower) + { + decimal value = (decimal) metrichorsepower; + return new Power(value, PowerUnit.MetricHorsepower); + } + /// + /// Get Power from Microwatts. + /// + /// If value is NaN or Infinity. + public static Power FromMicrowatts(QuantityValue microwatts) + { + decimal value = (decimal) microwatts; + return new Power(value, PowerUnit.Microwatt); + } + /// + /// Get Power from Milliwatts. + /// + /// If value is NaN or Infinity. + public static Power FromMilliwatts(QuantityValue milliwatts) + { + decimal value = (decimal) milliwatts; + return new Power(value, PowerUnit.Milliwatt); + } + /// + /// Get Power from Nanowatts. + /// + /// If value is NaN or Infinity. + public static Power FromNanowatts(QuantityValue nanowatts) + { + decimal value = (decimal) nanowatts; + return new Power(value, PowerUnit.Nanowatt); + } + /// + /// Get Power from Petawatts. + /// + /// If value is NaN or Infinity. + public static Power FromPetawatts(QuantityValue petawatts) + { + decimal value = (decimal) petawatts; + return new Power(value, PowerUnit.Petawatt); + } + /// + /// Get Power from Picowatts. + /// + /// If value is NaN or Infinity. + public static Power FromPicowatts(QuantityValue picowatts) + { + decimal value = (decimal) picowatts; + return new Power(value, PowerUnit.Picowatt); + } + /// + /// Get Power from Terawatts. + /// + /// If value is NaN or Infinity. + public static Power FromTerawatts(QuantityValue terawatts) + { + decimal value = (decimal) terawatts; + return new Power(value, PowerUnit.Terawatt); + } + /// + /// Get Power from Watts. + /// + /// If value is NaN or Infinity. + public static Power FromWatts(QuantityValue watts) + { + decimal value = (decimal) watts; + return new Power(value, PowerUnit.Watt); + } + + /// + /// 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 new Power((decimal)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Power Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Power Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Power result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Power result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static PowerUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PowerUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out PowerUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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 int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Power)) throw new ArgumentException("Expected type Power.", nameof(obj)); + + return CompareTo((Power)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Power other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Power within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Power other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Power. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PowerUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Power to another Power with the unit representation . + /// + /// A Power with the specified unit. + public Power ToUnit(PowerUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Power(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private decimal AsBaseUnit() + { + switch(Unit) + { + case PowerUnit.BoilerHorsepower: return _value*9812.5m; + case PowerUnit.BritishThermalUnitPerHour: return _value*0.293071m; + case PowerUnit.Decawatt: return (_value) * 1e1m; + case PowerUnit.Deciwatt: return (_value) * 1e-1m; + case PowerUnit.ElectricalHorsepower: return _value*746m; + case PowerUnit.Femtowatt: return (_value) * 1e-15m; + case PowerUnit.Gigawatt: return (_value) * 1e9m; + case PowerUnit.HydraulicHorsepower: return _value*745.69988145m; + case PowerUnit.KilobritishThermalUnitPerHour: return (_value*0.293071m) * 1e3m; + case PowerUnit.Kilowatt: return (_value) * 1e3m; + case PowerUnit.MechanicalHorsepower: return _value*745.69m; + case PowerUnit.Megawatt: return (_value) * 1e6m; + case PowerUnit.MetricHorsepower: return _value*735.49875m; + case PowerUnit.Microwatt: return (_value) * 1e-6m; + case PowerUnit.Milliwatt: return (_value) * 1e-3m; + case PowerUnit.Nanowatt: return (_value) * 1e-9m; + case PowerUnit.Petawatt: return (_value) * 1e15m; + case PowerUnit.Picowatt: return (_value) * 1e-12m; + case PowerUnit.Terawatt: return (_value) * 1e12m; + case PowerUnit.Watt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private decimal AsBaseNumericType(PowerUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PowerUnit.BoilerHorsepower: return baseUnitValue/9812.5m; + case PowerUnit.BritishThermalUnitPerHour: return baseUnitValue/0.293071m; + case PowerUnit.Decawatt: return (baseUnitValue) / 1e1m; + case PowerUnit.Deciwatt: return (baseUnitValue) / 1e-1m; + case PowerUnit.ElectricalHorsepower: return baseUnitValue/746m; + case PowerUnit.Femtowatt: return (baseUnitValue) / 1e-15m; + case PowerUnit.Gigawatt: return (baseUnitValue) / 1e9m; + case PowerUnit.HydraulicHorsepower: return baseUnitValue/745.69988145m; + case PowerUnit.KilobritishThermalUnitPerHour: return (baseUnitValue/0.293071m) / 1e3m; + case PowerUnit.Kilowatt: return (baseUnitValue) / 1e3m; + case PowerUnit.MechanicalHorsepower: return baseUnitValue/745.69m; + case PowerUnit.Megawatt: return (baseUnitValue) / 1e6m; + case PowerUnit.MetricHorsepower: return baseUnitValue/735.49875m; + case PowerUnit.Microwatt: return (baseUnitValue) / 1e-6m; + case PowerUnit.Milliwatt: return (baseUnitValue) / 1e-3m; + case PowerUnit.Nanowatt: return (baseUnitValue) / 1e-9m; + case PowerUnit.Petawatt: return (baseUnitValue) / 1e15m; + case PowerUnit.Picowatt: return (baseUnitValue) / 1e-12m; + case PowerUnit.Terawatt: return (baseUnitValue) / 1e12m; + case PowerUnit.Watt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs new file mode 100644 index 0000000000..470d8945ea --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -0,0 +1,1288 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The amount of power in a volume. + /// + public partial struct PowerDensity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PowerDensityUnit? _unit; + + static PowerDensity() + { + BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public PowerDensity(double numericValue, PowerDensityUnit unit) + { + if(unit == PowerDensityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of PowerDensity, which is WattPerCubicMeter. All conversions go via this value. + /// + public static PowerDensityUnit BaseUnit => PowerDensityUnit.WattPerCubicMeter; + + /// + /// Represents the largest possible value of PowerDensity + /// + public static PowerDensity MaxValue => new PowerDensity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of PowerDensity + /// + public static PowerDensity MinValue => new PowerDensity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.PowerDensity; + + /// + /// All units of measurement for the PowerDensity quantity. + /// + public static PowerDensityUnit[] Units { get; } = Enum.GetValues(typeof(PowerDensityUnit)).Cast().Except(new PowerDensityUnit[]{ PowerDensityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerCubicMeter. + /// + public static PowerDensity Zero => new PowerDensity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => PowerDensity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PowerDensity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get PowerDensity in DecawattsPerCubicFoot. + /// + public double DecawattsPerCubicFoot => As(PowerDensityUnit.DecawattPerCubicFoot); + + /// + /// Get PowerDensity in DecawattsPerCubicInch. + /// + public double DecawattsPerCubicInch => As(PowerDensityUnit.DecawattPerCubicInch); + + /// + /// Get PowerDensity in DecawattsPerCubicMeter. + /// + public double DecawattsPerCubicMeter => As(PowerDensityUnit.DecawattPerCubicMeter); + + /// + /// Get PowerDensity in DecawattsPerLiter. + /// + public double DecawattsPerLiter => As(PowerDensityUnit.DecawattPerLiter); + + /// + /// Get PowerDensity in DeciwattsPerCubicFoot. + /// + public double DeciwattsPerCubicFoot => As(PowerDensityUnit.DeciwattPerCubicFoot); + + /// + /// Get PowerDensity in DeciwattsPerCubicInch. + /// + public double DeciwattsPerCubicInch => As(PowerDensityUnit.DeciwattPerCubicInch); + + /// + /// Get PowerDensity in DeciwattsPerCubicMeter. + /// + public double DeciwattsPerCubicMeter => As(PowerDensityUnit.DeciwattPerCubicMeter); + + /// + /// Get PowerDensity in DeciwattsPerLiter. + /// + public double DeciwattsPerLiter => As(PowerDensityUnit.DeciwattPerLiter); + + /// + /// Get PowerDensity in GigawattsPerCubicFoot. + /// + public double GigawattsPerCubicFoot => As(PowerDensityUnit.GigawattPerCubicFoot); + + /// + /// Get PowerDensity in GigawattsPerCubicInch. + /// + public double GigawattsPerCubicInch => As(PowerDensityUnit.GigawattPerCubicInch); + + /// + /// Get PowerDensity in GigawattsPerCubicMeter. + /// + public double GigawattsPerCubicMeter => As(PowerDensityUnit.GigawattPerCubicMeter); + + /// + /// Get PowerDensity in GigawattsPerLiter. + /// + public double GigawattsPerLiter => As(PowerDensityUnit.GigawattPerLiter); + + /// + /// Get PowerDensity in KilowattsPerCubicFoot. + /// + public double KilowattsPerCubicFoot => As(PowerDensityUnit.KilowattPerCubicFoot); + + /// + /// Get PowerDensity in KilowattsPerCubicInch. + /// + public double KilowattsPerCubicInch => As(PowerDensityUnit.KilowattPerCubicInch); + + /// + /// Get PowerDensity in KilowattsPerCubicMeter. + /// + public double KilowattsPerCubicMeter => As(PowerDensityUnit.KilowattPerCubicMeter); + + /// + /// Get PowerDensity in KilowattsPerLiter. + /// + public double KilowattsPerLiter => As(PowerDensityUnit.KilowattPerLiter); + + /// + /// Get PowerDensity in MegawattsPerCubicFoot. + /// + public double MegawattsPerCubicFoot => As(PowerDensityUnit.MegawattPerCubicFoot); + + /// + /// Get PowerDensity in MegawattsPerCubicInch. + /// + public double MegawattsPerCubicInch => As(PowerDensityUnit.MegawattPerCubicInch); + + /// + /// Get PowerDensity in MegawattsPerCubicMeter. + /// + public double MegawattsPerCubicMeter => As(PowerDensityUnit.MegawattPerCubicMeter); + + /// + /// Get PowerDensity in MegawattsPerLiter. + /// + public double MegawattsPerLiter => As(PowerDensityUnit.MegawattPerLiter); + + /// + /// Get PowerDensity in MicrowattsPerCubicFoot. + /// + public double MicrowattsPerCubicFoot => As(PowerDensityUnit.MicrowattPerCubicFoot); + + /// + /// Get PowerDensity in MicrowattsPerCubicInch. + /// + public double MicrowattsPerCubicInch => As(PowerDensityUnit.MicrowattPerCubicInch); + + /// + /// Get PowerDensity in MicrowattsPerCubicMeter. + /// + public double MicrowattsPerCubicMeter => As(PowerDensityUnit.MicrowattPerCubicMeter); + + /// + /// Get PowerDensity in MicrowattsPerLiter. + /// + public double MicrowattsPerLiter => As(PowerDensityUnit.MicrowattPerLiter); + + /// + /// Get PowerDensity in MilliwattsPerCubicFoot. + /// + public double MilliwattsPerCubicFoot => As(PowerDensityUnit.MilliwattPerCubicFoot); + + /// + /// Get PowerDensity in MilliwattsPerCubicInch. + /// + public double MilliwattsPerCubicInch => As(PowerDensityUnit.MilliwattPerCubicInch); + + /// + /// Get PowerDensity in MilliwattsPerCubicMeter. + /// + public double MilliwattsPerCubicMeter => As(PowerDensityUnit.MilliwattPerCubicMeter); + + /// + /// Get PowerDensity in MilliwattsPerLiter. + /// + public double MilliwattsPerLiter => As(PowerDensityUnit.MilliwattPerLiter); + + /// + /// Get PowerDensity in NanowattsPerCubicFoot. + /// + public double NanowattsPerCubicFoot => As(PowerDensityUnit.NanowattPerCubicFoot); + + /// + /// Get PowerDensity in NanowattsPerCubicInch. + /// + public double NanowattsPerCubicInch => As(PowerDensityUnit.NanowattPerCubicInch); + + /// + /// Get PowerDensity in NanowattsPerCubicMeter. + /// + public double NanowattsPerCubicMeter => As(PowerDensityUnit.NanowattPerCubicMeter); + + /// + /// Get PowerDensity in NanowattsPerLiter. + /// + public double NanowattsPerLiter => As(PowerDensityUnit.NanowattPerLiter); + + /// + /// Get PowerDensity in PicowattsPerCubicFoot. + /// + public double PicowattsPerCubicFoot => As(PowerDensityUnit.PicowattPerCubicFoot); + + /// + /// Get PowerDensity in PicowattsPerCubicInch. + /// + public double PicowattsPerCubicInch => As(PowerDensityUnit.PicowattPerCubicInch); + + /// + /// Get PowerDensity in PicowattsPerCubicMeter. + /// + public double PicowattsPerCubicMeter => As(PowerDensityUnit.PicowattPerCubicMeter); + + /// + /// Get PowerDensity in PicowattsPerLiter. + /// + public double PicowattsPerLiter => As(PowerDensityUnit.PicowattPerLiter); + + /// + /// Get PowerDensity in TerawattsPerCubicFoot. + /// + public double TerawattsPerCubicFoot => As(PowerDensityUnit.TerawattPerCubicFoot); + + /// + /// Get PowerDensity in TerawattsPerCubicInch. + /// + public double TerawattsPerCubicInch => As(PowerDensityUnit.TerawattPerCubicInch); + + /// + /// Get PowerDensity in TerawattsPerCubicMeter. + /// + public double TerawattsPerCubicMeter => As(PowerDensityUnit.TerawattPerCubicMeter); + + /// + /// Get PowerDensity in TerawattsPerLiter. + /// + public double TerawattsPerLiter => As(PowerDensityUnit.TerawattPerLiter); + + /// + /// Get PowerDensity in WattsPerCubicFoot. + /// + public double WattsPerCubicFoot => As(PowerDensityUnit.WattPerCubicFoot); + + /// + /// Get PowerDensity in WattsPerCubicInch. + /// + public double WattsPerCubicInch => As(PowerDensityUnit.WattPerCubicInch); + + /// + /// Get PowerDensity in WattsPerCubicMeter. + /// + public double WattsPerCubicMeter => As(PowerDensityUnit.WattPerCubicMeter); + + /// + /// Get PowerDensity in WattsPerLiter. + /// + public double WattsPerLiter => As(PowerDensityUnit.WattPerLiter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PowerDensityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(PowerDensityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get PowerDensity from DecawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDecawattsPerCubicFoot(QuantityValue decawattspercubicfoot) + { + double value = (double) decawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicFoot); + } + /// + /// Get PowerDensity from DecawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDecawattsPerCubicInch(QuantityValue decawattspercubicinch) + { + double value = (double) decawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicInch); + } + /// + /// Get PowerDensity from DecawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDecawattsPerCubicMeter(QuantityValue decawattspercubicmeter) + { + double value = (double) decawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.DecawattPerCubicMeter); + } + /// + /// Get PowerDensity from DecawattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDecawattsPerLiter(QuantityValue decawattsperliter) + { + double value = (double) decawattsperliter; + return new PowerDensity(value, PowerDensityUnit.DecawattPerLiter); + } + /// + /// Get PowerDensity from DeciwattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDeciwattsPerCubicFoot(QuantityValue deciwattspercubicfoot) + { + double value = (double) deciwattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicFoot); + } + /// + /// Get PowerDensity from DeciwattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDeciwattsPerCubicInch(QuantityValue deciwattspercubicinch) + { + double value = (double) deciwattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicInch); + } + /// + /// Get PowerDensity from DeciwattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDeciwattsPerCubicMeter(QuantityValue deciwattspercubicmeter) + { + double value = (double) deciwattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerCubicMeter); + } + /// + /// Get PowerDensity from DeciwattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromDeciwattsPerLiter(QuantityValue deciwattsperliter) + { + double value = (double) deciwattsperliter; + return new PowerDensity(value, PowerDensityUnit.DeciwattPerLiter); + } + /// + /// Get PowerDensity from GigawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromGigawattsPerCubicFoot(QuantityValue gigawattspercubicfoot) + { + double value = (double) gigawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicFoot); + } + /// + /// Get PowerDensity from GigawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromGigawattsPerCubicInch(QuantityValue gigawattspercubicinch) + { + double value = (double) gigawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicInch); + } + /// + /// Get PowerDensity from GigawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromGigawattsPerCubicMeter(QuantityValue gigawattspercubicmeter) + { + double value = (double) gigawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.GigawattPerCubicMeter); + } + /// + /// Get PowerDensity from GigawattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromGigawattsPerLiter(QuantityValue gigawattsperliter) + { + double value = (double) gigawattsperliter; + return new PowerDensity(value, PowerDensityUnit.GigawattPerLiter); + } + /// + /// Get PowerDensity from KilowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromKilowattsPerCubicFoot(QuantityValue kilowattspercubicfoot) + { + double value = (double) kilowattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicFoot); + } + /// + /// Get PowerDensity from KilowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromKilowattsPerCubicInch(QuantityValue kilowattspercubicinch) + { + double value = (double) kilowattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicInch); + } + /// + /// Get PowerDensity from KilowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromKilowattsPerCubicMeter(QuantityValue kilowattspercubicmeter) + { + double value = (double) kilowattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.KilowattPerCubicMeter); + } + /// + /// Get PowerDensity from KilowattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromKilowattsPerLiter(QuantityValue kilowattsperliter) + { + double value = (double) kilowattsperliter; + return new PowerDensity(value, PowerDensityUnit.KilowattPerLiter); + } + /// + /// Get PowerDensity from MegawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMegawattsPerCubicFoot(QuantityValue megawattspercubicfoot) + { + double value = (double) megawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicFoot); + } + /// + /// Get PowerDensity from MegawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMegawattsPerCubicInch(QuantityValue megawattspercubicinch) + { + double value = (double) megawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicInch); + } + /// + /// Get PowerDensity from MegawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMegawattsPerCubicMeter(QuantityValue megawattspercubicmeter) + { + double value = (double) megawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.MegawattPerCubicMeter); + } + /// + /// Get PowerDensity from MegawattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMegawattsPerLiter(QuantityValue megawattsperliter) + { + double value = (double) megawattsperliter; + return new PowerDensity(value, PowerDensityUnit.MegawattPerLiter); + } + /// + /// Get PowerDensity from MicrowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMicrowattsPerCubicFoot(QuantityValue microwattspercubicfoot) + { + double value = (double) microwattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicFoot); + } + /// + /// Get PowerDensity from MicrowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMicrowattsPerCubicInch(QuantityValue microwattspercubicinch) + { + double value = (double) microwattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicInch); + } + /// + /// Get PowerDensity from MicrowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMicrowattsPerCubicMeter(QuantityValue microwattspercubicmeter) + { + double value = (double) microwattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerCubicMeter); + } + /// + /// Get PowerDensity from MicrowattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMicrowattsPerLiter(QuantityValue microwattsperliter) + { + double value = (double) microwattsperliter; + return new PowerDensity(value, PowerDensityUnit.MicrowattPerLiter); + } + /// + /// Get PowerDensity from MilliwattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMilliwattsPerCubicFoot(QuantityValue milliwattspercubicfoot) + { + double value = (double) milliwattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicFoot); + } + /// + /// Get PowerDensity from MilliwattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMilliwattsPerCubicInch(QuantityValue milliwattspercubicinch) + { + double value = (double) milliwattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicInch); + } + /// + /// Get PowerDensity from MilliwattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMilliwattsPerCubicMeter(QuantityValue milliwattspercubicmeter) + { + double value = (double) milliwattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerCubicMeter); + } + /// + /// Get PowerDensity from MilliwattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromMilliwattsPerLiter(QuantityValue milliwattsperliter) + { + double value = (double) milliwattsperliter; + return new PowerDensity(value, PowerDensityUnit.MilliwattPerLiter); + } + /// + /// Get PowerDensity from NanowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromNanowattsPerCubicFoot(QuantityValue nanowattspercubicfoot) + { + double value = (double) nanowattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicFoot); + } + /// + /// Get PowerDensity from NanowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromNanowattsPerCubicInch(QuantityValue nanowattspercubicinch) + { + double value = (double) nanowattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicInch); + } + /// + /// Get PowerDensity from NanowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromNanowattsPerCubicMeter(QuantityValue nanowattspercubicmeter) + { + double value = (double) nanowattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.NanowattPerCubicMeter); + } + /// + /// Get PowerDensity from NanowattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromNanowattsPerLiter(QuantityValue nanowattsperliter) + { + double value = (double) nanowattsperliter; + return new PowerDensity(value, PowerDensityUnit.NanowattPerLiter); + } + /// + /// Get PowerDensity from PicowattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromPicowattsPerCubicFoot(QuantityValue picowattspercubicfoot) + { + double value = (double) picowattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicFoot); + } + /// + /// Get PowerDensity from PicowattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromPicowattsPerCubicInch(QuantityValue picowattspercubicinch) + { + double value = (double) picowattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicInch); + } + /// + /// Get PowerDensity from PicowattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromPicowattsPerCubicMeter(QuantityValue picowattspercubicmeter) + { + double value = (double) picowattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.PicowattPerCubicMeter); + } + /// + /// Get PowerDensity from PicowattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromPicowattsPerLiter(QuantityValue picowattsperliter) + { + double value = (double) picowattsperliter; + return new PowerDensity(value, PowerDensityUnit.PicowattPerLiter); + } + /// + /// Get PowerDensity from TerawattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromTerawattsPerCubicFoot(QuantityValue terawattspercubicfoot) + { + double value = (double) terawattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicFoot); + } + /// + /// Get PowerDensity from TerawattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromTerawattsPerCubicInch(QuantityValue terawattspercubicinch) + { + double value = (double) terawattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicInch); + } + /// + /// Get PowerDensity from TerawattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromTerawattsPerCubicMeter(QuantityValue terawattspercubicmeter) + { + double value = (double) terawattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.TerawattPerCubicMeter); + } + /// + /// Get PowerDensity from TerawattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromTerawattsPerLiter(QuantityValue terawattsperliter) + { + double value = (double) terawattsperliter; + return new PowerDensity(value, PowerDensityUnit.TerawattPerLiter); + } + /// + /// Get PowerDensity from WattsPerCubicFoot. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromWattsPerCubicFoot(QuantityValue wattspercubicfoot) + { + double value = (double) wattspercubicfoot; + return new PowerDensity(value, PowerDensityUnit.WattPerCubicFoot); + } + /// + /// Get PowerDensity from WattsPerCubicInch. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromWattsPerCubicInch(QuantityValue wattspercubicinch) + { + double value = (double) wattspercubicinch; + return new PowerDensity(value, PowerDensityUnit.WattPerCubicInch); + } + /// + /// Get PowerDensity from WattsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromWattsPerCubicMeter(QuantityValue wattspercubicmeter) + { + double value = (double) wattspercubicmeter; + return new PowerDensity(value, PowerDensityUnit.WattPerCubicMeter); + } + /// + /// Get PowerDensity from WattsPerLiter. + /// + /// If value is NaN or Infinity. + public static PowerDensity FromWattsPerLiter(QuantityValue wattsperliter) + { + double value = (double) wattsperliter; + return new PowerDensity(value, PowerDensityUnit.WattPerLiter); + } + + /// + /// 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 new PowerDensity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static PowerDensity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static PowerDensity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out PowerDensity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerDensity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerDensityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static PowerDensityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PowerDensityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out PowerDensityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is PowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); + + return CompareTo((PowerDensity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(PowerDensity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another PowerDensity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(PowerDensity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current PowerDensity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PowerDensityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this PowerDensity to another PowerDensity with the unit representation . + /// + /// A PowerDensity with the specified unit. + public PowerDensity ToUnit(PowerDensityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new PowerDensity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PowerDensityUnit.DecawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e1d; + case PowerDensityUnit.DecawattPerCubicInch: return (_value*6.102374409473228e4) * 1e1d; + case PowerDensityUnit.DecawattPerCubicMeter: return (_value) * 1e1d; + case PowerDensityUnit.DecawattPerLiter: return (_value*1.0e3) * 1e1d; + case PowerDensityUnit.DeciwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-1d; + case PowerDensityUnit.DeciwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-1d; + case PowerDensityUnit.DeciwattPerCubicMeter: return (_value) * 1e-1d; + case PowerDensityUnit.DeciwattPerLiter: return (_value*1.0e3) * 1e-1d; + case PowerDensityUnit.GigawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e9d; + case PowerDensityUnit.GigawattPerCubicInch: return (_value*6.102374409473228e4) * 1e9d; + case PowerDensityUnit.GigawattPerCubicMeter: return (_value) * 1e9d; + case PowerDensityUnit.GigawattPerLiter: return (_value*1.0e3) * 1e9d; + case PowerDensityUnit.KilowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e3d; + case PowerDensityUnit.KilowattPerCubicInch: return (_value*6.102374409473228e4) * 1e3d; + case PowerDensityUnit.KilowattPerCubicMeter: return (_value) * 1e3d; + case PowerDensityUnit.KilowattPerLiter: return (_value*1.0e3) * 1e3d; + case PowerDensityUnit.MegawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e6d; + case PowerDensityUnit.MegawattPerCubicInch: return (_value*6.102374409473228e4) * 1e6d; + case PowerDensityUnit.MegawattPerCubicMeter: return (_value) * 1e6d; + case PowerDensityUnit.MegawattPerLiter: return (_value*1.0e3) * 1e6d; + case PowerDensityUnit.MicrowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-6d; + case PowerDensityUnit.MicrowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-6d; + case PowerDensityUnit.MicrowattPerCubicMeter: return (_value) * 1e-6d; + case PowerDensityUnit.MicrowattPerLiter: return (_value*1.0e3) * 1e-6d; + case PowerDensityUnit.MilliwattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-3d; + case PowerDensityUnit.MilliwattPerCubicInch: return (_value*6.102374409473228e4) * 1e-3d; + case PowerDensityUnit.MilliwattPerCubicMeter: return (_value) * 1e-3d; + case PowerDensityUnit.MilliwattPerLiter: return (_value*1.0e3) * 1e-3d; + case PowerDensityUnit.NanowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-9d; + case PowerDensityUnit.NanowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-9d; + case PowerDensityUnit.NanowattPerCubicMeter: return (_value) * 1e-9d; + case PowerDensityUnit.NanowattPerLiter: return (_value*1.0e3) * 1e-9d; + case PowerDensityUnit.PicowattPerCubicFoot: return (_value*3.531466672148859e1) * 1e-12d; + case PowerDensityUnit.PicowattPerCubicInch: return (_value*6.102374409473228e4) * 1e-12d; + case PowerDensityUnit.PicowattPerCubicMeter: return (_value) * 1e-12d; + case PowerDensityUnit.PicowattPerLiter: return (_value*1.0e3) * 1e-12d; + case PowerDensityUnit.TerawattPerCubicFoot: return (_value*3.531466672148859e1) * 1e12d; + case PowerDensityUnit.TerawattPerCubicInch: return (_value*6.102374409473228e4) * 1e12d; + case PowerDensityUnit.TerawattPerCubicMeter: return (_value) * 1e12d; + case PowerDensityUnit.TerawattPerLiter: return (_value*1.0e3) * 1e12d; + case PowerDensityUnit.WattPerCubicFoot: return _value*3.531466672148859e1; + case PowerDensityUnit.WattPerCubicInch: return _value*6.102374409473228e4; + case PowerDensityUnit.WattPerCubicMeter: return _value; + case PowerDensityUnit.WattPerLiter: return _value*1.0e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PowerDensityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PowerDensityUnit.DecawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e1d; + case PowerDensityUnit.DecawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e1d; + case PowerDensityUnit.DecawattPerCubicMeter: return (baseUnitValue) / 1e1d; + case PowerDensityUnit.DecawattPerLiter: return (baseUnitValue/1.0e3) / 1e1d; + case PowerDensityUnit.DeciwattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-1d; + case PowerDensityUnit.DeciwattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-1d; + case PowerDensityUnit.DeciwattPerCubicMeter: return (baseUnitValue) / 1e-1d; + case PowerDensityUnit.DeciwattPerLiter: return (baseUnitValue/1.0e3) / 1e-1d; + case PowerDensityUnit.GigawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e9d; + case PowerDensityUnit.GigawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e9d; + case PowerDensityUnit.GigawattPerCubicMeter: return (baseUnitValue) / 1e9d; + case PowerDensityUnit.GigawattPerLiter: return (baseUnitValue/1.0e3) / 1e9d; + case PowerDensityUnit.KilowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e3d; + case PowerDensityUnit.KilowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e3d; + case PowerDensityUnit.KilowattPerCubicMeter: return (baseUnitValue) / 1e3d; + case PowerDensityUnit.KilowattPerLiter: return (baseUnitValue/1.0e3) / 1e3d; + case PowerDensityUnit.MegawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e6d; + case PowerDensityUnit.MegawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e6d; + case PowerDensityUnit.MegawattPerCubicMeter: return (baseUnitValue) / 1e6d; + case PowerDensityUnit.MegawattPerLiter: return (baseUnitValue/1.0e3) / 1e6d; + case PowerDensityUnit.MicrowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-6d; + case PowerDensityUnit.MicrowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-6d; + case PowerDensityUnit.MicrowattPerCubicMeter: return (baseUnitValue) / 1e-6d; + case PowerDensityUnit.MicrowattPerLiter: return (baseUnitValue/1.0e3) / 1e-6d; + case PowerDensityUnit.MilliwattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-3d; + case PowerDensityUnit.MilliwattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-3d; + case PowerDensityUnit.MilliwattPerCubicMeter: return (baseUnitValue) / 1e-3d; + case PowerDensityUnit.MilliwattPerLiter: return (baseUnitValue/1.0e3) / 1e-3d; + case PowerDensityUnit.NanowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-9d; + case PowerDensityUnit.NanowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-9d; + case PowerDensityUnit.NanowattPerCubicMeter: return (baseUnitValue) / 1e-9d; + case PowerDensityUnit.NanowattPerLiter: return (baseUnitValue/1.0e3) / 1e-9d; + case PowerDensityUnit.PicowattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e-12d; + case PowerDensityUnit.PicowattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e-12d; + case PowerDensityUnit.PicowattPerCubicMeter: return (baseUnitValue) / 1e-12d; + case PowerDensityUnit.PicowattPerLiter: return (baseUnitValue/1.0e3) / 1e-12d; + case PowerDensityUnit.TerawattPerCubicFoot: return (baseUnitValue/3.531466672148859e1) / 1e12d; + case PowerDensityUnit.TerawattPerCubicInch: return (baseUnitValue/6.102374409473228e4) / 1e12d; + case PowerDensityUnit.TerawattPerCubicMeter: return (baseUnitValue) / 1e12d; + case PowerDensityUnit.TerawattPerLiter: return (baseUnitValue/1.0e3) / 1e12d; + case PowerDensityUnit.WattPerCubicFoot: return baseUnitValue/3.531466672148859e1; + case PowerDensityUnit.WattPerCubicInch: return baseUnitValue/6.102374409473228e4; + case PowerDensityUnit.WattPerCubicMeter: return baseUnitValue; + case PowerDensityUnit.WattPerLiter: return baseUnitValue/1.0e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs new file mode 100644 index 0000000000..ff7d700a7a --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -0,0 +1,624 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The strength of a signal expressed in decibels (dB) relative to one watt. + /// + public partial struct PowerRatio : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PowerRatioUnit? _unit; + + static PowerRatio() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public PowerRatio(double numericValue, PowerRatioUnit unit) + { + if(unit == PowerRatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of PowerRatio, which is DecibelWatt. All conversions go via this value. + /// + public static PowerRatioUnit BaseUnit => PowerRatioUnit.DecibelWatt; + + /// + /// Represents the largest possible value of PowerRatio + /// + public static PowerRatio MaxValue => new PowerRatio(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of PowerRatio + /// + public static PowerRatio MinValue => new PowerRatio(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.PowerRatio; + + /// + /// All units of measurement for the PowerRatio quantity. + /// + public static PowerRatioUnit[] Units { get; } = Enum.GetValues(typeof(PowerRatioUnit)).Cast().Except(new PowerRatioUnit[]{ PowerRatioUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DecibelWatt. + /// + public static PowerRatio Zero => new PowerRatio(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PowerRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => PowerRatio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PowerRatio.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get PowerRatio in DecibelMilliwatts. + /// + public double DecibelMilliwatts => As(PowerRatioUnit.DecibelMilliwatt); + + /// + /// Get PowerRatio in DecibelWatts. + /// + public double DecibelWatts => As(PowerRatioUnit.DecibelWatt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PowerRatioUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(PowerRatioUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get PowerRatio from DecibelMilliwatts. + /// + /// If value is NaN or Infinity. + public static PowerRatio FromDecibelMilliwatts(QuantityValue decibelmilliwatts) + { + double value = (double) decibelmilliwatts; + return new PowerRatio(value, PowerRatioUnit.DecibelMilliwatt); + } + /// + /// Get PowerRatio from DecibelWatts. + /// + /// If value is NaN or Infinity. + public static PowerRatio FromDecibelWatts(QuantityValue decibelwatts) + { + double value = (double) decibelwatts; + return new PowerRatio(value, PowerRatioUnit.DecibelWatt); + } + + /// + /// 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 new PowerRatio((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static PowerRatio Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static PowerRatio Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out PowerRatio result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PowerRatio result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PowerRatioUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static PowerRatioUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PowerRatioUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out PowerRatioUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is PowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); + + return CompareTo((PowerRatio)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(PowerRatio other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another PowerRatio within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(PowerRatio other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current PowerRatio. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PowerRatioUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this PowerRatio to another PowerRatio with the unit representation . + /// + /// A PowerRatio with the specified unit. + public PowerRatio ToUnit(PowerRatioUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new PowerRatio(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PowerRatioUnit.DecibelMilliwatt: return _value - 30; + case PowerRatioUnit.DecibelWatt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PowerRatioUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PowerRatioUnit.DecibelMilliwatt: return baseUnitValue + 30; + case PowerRatioUnit.DecibelWatt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs new file mode 100644 index 0000000000..bb9c25858d --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -0,0 +1,1224 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). + /// + public partial struct Pressure : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PressureUnit? _unit; + + static Pressure() + { + BaseDimensions = new BaseDimensions(-1, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Pressure(double numericValue, PressureUnit unit) + { + if(unit == PressureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Pressure, which is Pascal. All conversions go via this value. + /// + public static PressureUnit BaseUnit => PressureUnit.Pascal; + + /// + /// Represents the largest possible value of Pressure + /// + public static Pressure MaxValue => new Pressure(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Pressure + /// + public static Pressure MinValue => new Pressure(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Pressure; + + /// + /// All units of measurement for the Pressure quantity. + /// + public static PressureUnit[] Units { get; } = Enum.GetValues(typeof(PressureUnit)).Cast().Except(new PressureUnit[]{ PressureUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Pascal. + /// + public static Pressure Zero => new Pressure(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PressureUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Pressure.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Pressure.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Pressure in Atmospheres. + /// + public double Atmospheres => As(PressureUnit.Atmosphere); + + /// + /// Get Pressure in Bars. + /// + public double Bars => As(PressureUnit.Bar); + + /// + /// Get Pressure in Centibars. + /// + public double Centibars => As(PressureUnit.Centibar); + + /// + /// Get Pressure in Decapascals. + /// + public double Decapascals => As(PressureUnit.Decapascal); + + /// + /// Get Pressure in Decibars. + /// + public double Decibars => As(PressureUnit.Decibar); + + /// + /// Get Pressure in DynesPerSquareCentimeter. + /// + public double DynesPerSquareCentimeter => As(PressureUnit.DynePerSquareCentimeter); + + /// + /// Get Pressure in FeetOfHead. + /// + public double FeetOfHead => As(PressureUnit.FootOfHead); + + /// + /// Get Pressure in Gigapascals. + /// + public double Gigapascals => As(PressureUnit.Gigapascal); + + /// + /// Get Pressure in Hectopascals. + /// + public double Hectopascals => As(PressureUnit.Hectopascal); + + /// + /// Get Pressure in InchesOfMercury. + /// + public double InchesOfMercury => As(PressureUnit.InchOfMercury); + + /// + /// Get Pressure in Kilobars. + /// + public double Kilobars => As(PressureUnit.Kilobar); + + /// + /// Get Pressure in KilogramsForcePerSquareCentimeter. + /// + public double KilogramsForcePerSquareCentimeter => As(PressureUnit.KilogramForcePerSquareCentimeter); + + /// + /// Get Pressure in KilogramsForcePerSquareMeter. + /// + public double KilogramsForcePerSquareMeter => As(PressureUnit.KilogramForcePerSquareMeter); + + /// + /// Get Pressure in KilogramsForcePerSquareMillimeter. + /// + public double KilogramsForcePerSquareMillimeter => As(PressureUnit.KilogramForcePerSquareMillimeter); + + /// + /// Get Pressure in KilonewtonsPerSquareCentimeter. + /// + public double KilonewtonsPerSquareCentimeter => As(PressureUnit.KilonewtonPerSquareCentimeter); + + /// + /// Get Pressure in KilonewtonsPerSquareMeter. + /// + public double KilonewtonsPerSquareMeter => As(PressureUnit.KilonewtonPerSquareMeter); + + /// + /// Get Pressure in KilonewtonsPerSquareMillimeter. + /// + public double KilonewtonsPerSquareMillimeter => As(PressureUnit.KilonewtonPerSquareMillimeter); + + /// + /// Get Pressure in Kilopascals. + /// + public double Kilopascals => As(PressureUnit.Kilopascal); + + /// + /// Get Pressure in KilopoundsForcePerSquareFoot. + /// + public double KilopoundsForcePerSquareFoot => As(PressureUnit.KilopoundForcePerSquareFoot); + + /// + /// Get Pressure in KilopoundsForcePerSquareInch. + /// + public double KilopoundsForcePerSquareInch => As(PressureUnit.KilopoundForcePerSquareInch); + + /// + /// Get Pressure in Megabars. + /// + public double Megabars => As(PressureUnit.Megabar); + + /// + /// Get Pressure in MeganewtonsPerSquareMeter. + /// + public double MeganewtonsPerSquareMeter => As(PressureUnit.MeganewtonPerSquareMeter); + + /// + /// Get Pressure in Megapascals. + /// + public double Megapascals => As(PressureUnit.Megapascal); + + /// + /// Get Pressure in MetersOfHead. + /// + public double MetersOfHead => As(PressureUnit.MeterOfHead); + + /// + /// Get Pressure in Microbars. + /// + public double Microbars => As(PressureUnit.Microbar); + + /// + /// Get Pressure in Micropascals. + /// + public double Micropascals => As(PressureUnit.Micropascal); + + /// + /// Get Pressure in Millibars. + /// + public double Millibars => As(PressureUnit.Millibar); + + /// + /// Get Pressure in MillimetersOfMercury. + /// + public double MillimetersOfMercury => As(PressureUnit.MillimeterOfMercury); + + /// + /// Get Pressure in NewtonsPerSquareCentimeter. + /// + public double NewtonsPerSquareCentimeter => As(PressureUnit.NewtonPerSquareCentimeter); + + /// + /// Get Pressure in NewtonsPerSquareMeter. + /// + public double NewtonsPerSquareMeter => As(PressureUnit.NewtonPerSquareMeter); + + /// + /// Get Pressure in NewtonsPerSquareMillimeter. + /// + public double NewtonsPerSquareMillimeter => As(PressureUnit.NewtonPerSquareMillimeter); + + /// + /// Get Pressure in Pascals. + /// + public double Pascals => As(PressureUnit.Pascal); + + /// + /// Get Pressure in PoundsForcePerSquareFoot. + /// + public double PoundsForcePerSquareFoot => As(PressureUnit.PoundForcePerSquareFoot); + + /// + /// Get Pressure in PoundsForcePerSquareInch. + /// + public double PoundsForcePerSquareInch => As(PressureUnit.PoundForcePerSquareInch); + + /// + /// Get Pressure in PoundsPerInchSecondSquared. + /// + public double PoundsPerInchSecondSquared => As(PressureUnit.PoundPerInchSecondSquared); + + /// + /// Get Pressure in TechnicalAtmospheres. + /// + public double TechnicalAtmospheres => As(PressureUnit.TechnicalAtmosphere); + + /// + /// Get Pressure in TonnesForcePerSquareCentimeter. + /// + public double TonnesForcePerSquareCentimeter => As(PressureUnit.TonneForcePerSquareCentimeter); + + /// + /// Get Pressure in TonnesForcePerSquareMeter. + /// + public double TonnesForcePerSquareMeter => As(PressureUnit.TonneForcePerSquareMeter); + + /// + /// Get Pressure in TonnesForcePerSquareMillimeter. + /// + public double TonnesForcePerSquareMillimeter => As(PressureUnit.TonneForcePerSquareMillimeter); + + /// + /// Get Pressure in Torrs. + /// + public double Torrs => As(PressureUnit.Torr); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PressureUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(PressureUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Pressure from Atmospheres. + /// + /// If value is NaN or Infinity. + public static Pressure FromAtmospheres(QuantityValue atmospheres) + { + double value = (double) atmospheres; + return new Pressure(value, PressureUnit.Atmosphere); + } + /// + /// Get Pressure from Bars. + /// + /// If value is NaN or Infinity. + public static Pressure FromBars(QuantityValue bars) + { + double value = (double) bars; + return new Pressure(value, PressureUnit.Bar); + } + /// + /// Get Pressure from Centibars. + /// + /// If value is NaN or Infinity. + public static Pressure FromCentibars(QuantityValue centibars) + { + double value = (double) centibars; + return new Pressure(value, PressureUnit.Centibar); + } + /// + /// Get Pressure from Decapascals. + /// + /// If value is NaN or Infinity. + public static Pressure FromDecapascals(QuantityValue decapascals) + { + double value = (double) decapascals; + return new Pressure(value, PressureUnit.Decapascal); + } + /// + /// Get Pressure from Decibars. + /// + /// If value is NaN or Infinity. + public static Pressure FromDecibars(QuantityValue decibars) + { + double value = (double) decibars; + return new Pressure(value, PressureUnit.Decibar); + } + /// + /// Get Pressure from DynesPerSquareCentimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromDynesPerSquareCentimeter(QuantityValue dynespersquarecentimeter) + { + double value = (double) dynespersquarecentimeter; + return new Pressure(value, PressureUnit.DynePerSquareCentimeter); + } + /// + /// Get Pressure from FeetOfHead. + /// + /// If value is NaN or Infinity. + public static Pressure FromFeetOfHead(QuantityValue feetofhead) + { + double value = (double) feetofhead; + return new Pressure(value, PressureUnit.FootOfHead); + } + /// + /// Get Pressure from Gigapascals. + /// + /// If value is NaN or Infinity. + public static Pressure FromGigapascals(QuantityValue gigapascals) + { + double value = (double) gigapascals; + return new Pressure(value, PressureUnit.Gigapascal); + } + /// + /// Get Pressure from Hectopascals. + /// + /// If value is NaN or Infinity. + public static Pressure FromHectopascals(QuantityValue hectopascals) + { + double value = (double) hectopascals; + return new Pressure(value, PressureUnit.Hectopascal); + } + /// + /// Get Pressure from InchesOfMercury. + /// + /// If value is NaN or Infinity. + public static Pressure FromInchesOfMercury(QuantityValue inchesofmercury) + { + double value = (double) inchesofmercury; + return new Pressure(value, PressureUnit.InchOfMercury); + } + /// + /// Get Pressure from Kilobars. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilobars(QuantityValue kilobars) + { + double value = (double) kilobars; + return new Pressure(value, PressureUnit.Kilobar); + } + /// + /// Get Pressure from KilogramsForcePerSquareCentimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilogramsForcePerSquareCentimeter(QuantityValue kilogramsforcepersquarecentimeter) + { + double value = (double) kilogramsforcepersquarecentimeter; + return new Pressure(value, PressureUnit.KilogramForcePerSquareCentimeter); + } + /// + /// Get Pressure from KilogramsForcePerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilogramsForcePerSquareMeter(QuantityValue kilogramsforcepersquaremeter) + { + double value = (double) kilogramsforcepersquaremeter; + return new Pressure(value, PressureUnit.KilogramForcePerSquareMeter); + } + /// + /// Get Pressure from KilogramsForcePerSquareMillimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilogramsForcePerSquareMillimeter(QuantityValue kilogramsforcepersquaremillimeter) + { + double value = (double) kilogramsforcepersquaremillimeter; + return new Pressure(value, PressureUnit.KilogramForcePerSquareMillimeter); + } + /// + /// Get Pressure from KilonewtonsPerSquareCentimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilonewtonsPerSquareCentimeter(QuantityValue kilonewtonspersquarecentimeter) + { + double value = (double) kilonewtonspersquarecentimeter; + return new Pressure(value, PressureUnit.KilonewtonPerSquareCentimeter); + } + /// + /// Get Pressure from KilonewtonsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilonewtonsPerSquareMeter(QuantityValue kilonewtonspersquaremeter) + { + double value = (double) kilonewtonspersquaremeter; + return new Pressure(value, PressureUnit.KilonewtonPerSquareMeter); + } + /// + /// Get Pressure from KilonewtonsPerSquareMillimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilonewtonsPerSquareMillimeter(QuantityValue kilonewtonspersquaremillimeter) + { + double value = (double) kilonewtonspersquaremillimeter; + return new Pressure(value, PressureUnit.KilonewtonPerSquareMillimeter); + } + /// + /// Get Pressure from Kilopascals. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilopascals(QuantityValue kilopascals) + { + double value = (double) kilopascals; + return new Pressure(value, PressureUnit.Kilopascal); + } + /// + /// Get Pressure from KilopoundsForcePerSquareFoot. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilopoundsForcePerSquareFoot(QuantityValue kilopoundsforcepersquarefoot) + { + double value = (double) kilopoundsforcepersquarefoot; + return new Pressure(value, PressureUnit.KilopoundForcePerSquareFoot); + } + /// + /// Get Pressure from KilopoundsForcePerSquareInch. + /// + /// If value is NaN or Infinity. + public static Pressure FromKilopoundsForcePerSquareInch(QuantityValue kilopoundsforcepersquareinch) + { + double value = (double) kilopoundsforcepersquareinch; + return new Pressure(value, PressureUnit.KilopoundForcePerSquareInch); + } + /// + /// Get Pressure from Megabars. + /// + /// If value is NaN or Infinity. + public static Pressure FromMegabars(QuantityValue megabars) + { + double value = (double) megabars; + return new Pressure(value, PressureUnit.Megabar); + } + /// + /// Get Pressure from MeganewtonsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromMeganewtonsPerSquareMeter(QuantityValue meganewtonspersquaremeter) + { + double value = (double) meganewtonspersquaremeter; + return new Pressure(value, PressureUnit.MeganewtonPerSquareMeter); + } + /// + /// Get Pressure from Megapascals. + /// + /// If value is NaN or Infinity. + public static Pressure FromMegapascals(QuantityValue megapascals) + { + double value = (double) megapascals; + return new Pressure(value, PressureUnit.Megapascal); + } + /// + /// Get Pressure from MetersOfHead. + /// + /// If value is NaN or Infinity. + public static Pressure FromMetersOfHead(QuantityValue metersofhead) + { + double value = (double) metersofhead; + return new Pressure(value, PressureUnit.MeterOfHead); + } + /// + /// Get Pressure from Microbars. + /// + /// If value is NaN or Infinity. + public static Pressure FromMicrobars(QuantityValue microbars) + { + double value = (double) microbars; + return new Pressure(value, PressureUnit.Microbar); + } + /// + /// Get Pressure from Micropascals. + /// + /// If value is NaN or Infinity. + public static Pressure FromMicropascals(QuantityValue micropascals) + { + double value = (double) micropascals; + return new Pressure(value, PressureUnit.Micropascal); + } + /// + /// Get Pressure from Millibars. + /// + /// If value is NaN or Infinity. + public static Pressure FromMillibars(QuantityValue millibars) + { + double value = (double) millibars; + return new Pressure(value, PressureUnit.Millibar); + } + /// + /// Get Pressure from MillimetersOfMercury. + /// + /// If value is NaN or Infinity. + public static Pressure FromMillimetersOfMercury(QuantityValue millimetersofmercury) + { + double value = (double) millimetersofmercury; + return new Pressure(value, PressureUnit.MillimeterOfMercury); + } + /// + /// Get Pressure from NewtonsPerSquareCentimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromNewtonsPerSquareCentimeter(QuantityValue newtonspersquarecentimeter) + { + double value = (double) newtonspersquarecentimeter; + return new Pressure(value, PressureUnit.NewtonPerSquareCentimeter); + } + /// + /// Get Pressure from NewtonsPerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromNewtonsPerSquareMeter(QuantityValue newtonspersquaremeter) + { + double value = (double) newtonspersquaremeter; + return new Pressure(value, PressureUnit.NewtonPerSquareMeter); + } + /// + /// Get Pressure from NewtonsPerSquareMillimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromNewtonsPerSquareMillimeter(QuantityValue newtonspersquaremillimeter) + { + double value = (double) newtonspersquaremillimeter; + return new Pressure(value, PressureUnit.NewtonPerSquareMillimeter); + } + /// + /// Get Pressure from Pascals. + /// + /// If value is NaN or Infinity. + public static Pressure FromPascals(QuantityValue pascals) + { + double value = (double) pascals; + return new Pressure(value, PressureUnit.Pascal); + } + /// + /// Get Pressure from PoundsForcePerSquareFoot. + /// + /// If value is NaN or Infinity. + public static Pressure FromPoundsForcePerSquareFoot(QuantityValue poundsforcepersquarefoot) + { + double value = (double) poundsforcepersquarefoot; + return new Pressure(value, PressureUnit.PoundForcePerSquareFoot); + } + /// + /// Get Pressure from PoundsForcePerSquareInch. + /// + /// If value is NaN or Infinity. + public static Pressure FromPoundsForcePerSquareInch(QuantityValue poundsforcepersquareinch) + { + double value = (double) poundsforcepersquareinch; + return new Pressure(value, PressureUnit.PoundForcePerSquareInch); + } + /// + /// Get Pressure from PoundsPerInchSecondSquared. + /// + /// If value is NaN or Infinity. + public static Pressure FromPoundsPerInchSecondSquared(QuantityValue poundsperinchsecondsquared) + { + double value = (double) poundsperinchsecondsquared; + return new Pressure(value, PressureUnit.PoundPerInchSecondSquared); + } + /// + /// Get Pressure from TechnicalAtmospheres. + /// + /// If value is NaN or Infinity. + public static Pressure FromTechnicalAtmospheres(QuantityValue technicalatmospheres) + { + double value = (double) technicalatmospheres; + return new Pressure(value, PressureUnit.TechnicalAtmosphere); + } + /// + /// Get Pressure from TonnesForcePerSquareCentimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromTonnesForcePerSquareCentimeter(QuantityValue tonnesforcepersquarecentimeter) + { + double value = (double) tonnesforcepersquarecentimeter; + return new Pressure(value, PressureUnit.TonneForcePerSquareCentimeter); + } + /// + /// Get Pressure from TonnesForcePerSquareMeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromTonnesForcePerSquareMeter(QuantityValue tonnesforcepersquaremeter) + { + double value = (double) tonnesforcepersquaremeter; + return new Pressure(value, PressureUnit.TonneForcePerSquareMeter); + } + /// + /// Get Pressure from TonnesForcePerSquareMillimeter. + /// + /// If value is NaN or Infinity. + public static Pressure FromTonnesForcePerSquareMillimeter(QuantityValue tonnesforcepersquaremillimeter) + { + double value = (double) tonnesforcepersquaremillimeter; + return new Pressure(value, PressureUnit.TonneForcePerSquareMillimeter); + } + /// + /// Get Pressure from Torrs. + /// + /// If value is NaN or Infinity. + public static Pressure FromTorrs(QuantityValue torrs) + { + double value = (double) torrs; + return new Pressure(value, PressureUnit.Torr); + } + + /// + /// 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 new Pressure((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Pressure Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Pressure Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Pressure result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Pressure result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PressureUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static PressureUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PressureUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out PressureUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Pressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); + + return CompareTo((Pressure)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Pressure other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Pressure within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Pressure other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Pressure. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PressureUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Pressure to another Pressure with the unit representation . + /// + /// A Pressure with the specified unit. + public Pressure ToUnit(PressureUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Pressure(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PressureUnit.Atmosphere: return _value*1.01325*1e5; + case PressureUnit.Bar: return _value*1e5; + case PressureUnit.Centibar: return (_value*1e5) * 1e-2d; + case PressureUnit.Decapascal: return (_value) * 1e1d; + case PressureUnit.Decibar: return (_value*1e5) * 1e-1d; + case PressureUnit.DynePerSquareCentimeter: return _value*1.0e-1; + case PressureUnit.FootOfHead: return _value*2989.0669; + case PressureUnit.Gigapascal: return (_value) * 1e9d; + case PressureUnit.Hectopascal: return (_value) * 1e2d; + case PressureUnit.InchOfMercury: return _value/2.95299830714159e-4; + case PressureUnit.Kilobar: return (_value*1e5) * 1e3d; + case PressureUnit.KilogramForcePerSquareCentimeter: return _value*9.80665e4; + case PressureUnit.KilogramForcePerSquareMeter: return _value*9.80665019960652; + case PressureUnit.KilogramForcePerSquareMillimeter: return _value*9.80665e6; + case PressureUnit.KilonewtonPerSquareCentimeter: return (_value*1e4) * 1e3d; + case PressureUnit.KilonewtonPerSquareMeter: return (_value) * 1e3d; + case PressureUnit.KilonewtonPerSquareMillimeter: return (_value*1e6) * 1e3d; + case PressureUnit.Kilopascal: return (_value) * 1e3d; + case PressureUnit.KilopoundForcePerSquareFoot: return (_value*4.788025898033584e1) * 1e3d; + case PressureUnit.KilopoundForcePerSquareInch: return (_value*6.894757293168361e3) * 1e3d; + case PressureUnit.Megabar: return (_value*1e5) * 1e6d; + case PressureUnit.MeganewtonPerSquareMeter: return (_value) * 1e6d; + case PressureUnit.Megapascal: return (_value) * 1e6d; + case PressureUnit.MeterOfHead: return _value*9804.139432; + case PressureUnit.Microbar: return (_value*1e5) * 1e-6d; + case PressureUnit.Micropascal: return (_value) * 1e-6d; + case PressureUnit.Millibar: return (_value*1e5) * 1e-3d; + case PressureUnit.MillimeterOfMercury: return _value/7.50061561302643e-3; + case PressureUnit.NewtonPerSquareCentimeter: return _value*1e4; + case PressureUnit.NewtonPerSquareMeter: return _value; + case PressureUnit.NewtonPerSquareMillimeter: return _value*1e6; + case PressureUnit.Pascal: return _value; + case PressureUnit.PoundForcePerSquareFoot: return _value*4.788025898033584e1; + case PressureUnit.PoundForcePerSquareInch: return _value*6.894757293168361e3; + case PressureUnit.PoundPerInchSecondSquared: return _value*1.785796732283465e1; + case PressureUnit.TechnicalAtmosphere: return _value*9.80680592331*1e4; + case PressureUnit.TonneForcePerSquareCentimeter: return _value*9.80665e7; + case PressureUnit.TonneForcePerSquareMeter: return _value*9.80665e3; + case PressureUnit.TonneForcePerSquareMillimeter: return _value*9.80665e9; + case PressureUnit.Torr: return _value*1.3332266752*1e2; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PressureUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PressureUnit.Atmosphere: return baseUnitValue/(1.01325*1e5); + case PressureUnit.Bar: return baseUnitValue/1e5; + case PressureUnit.Centibar: return (baseUnitValue/1e5) / 1e-2d; + case PressureUnit.Decapascal: return (baseUnitValue) / 1e1d; + case PressureUnit.Decibar: return (baseUnitValue/1e5) / 1e-1d; + case PressureUnit.DynePerSquareCentimeter: return baseUnitValue/1.0e-1; + case PressureUnit.FootOfHead: return baseUnitValue*0.000334552565551; + case PressureUnit.Gigapascal: return (baseUnitValue) / 1e9d; + case PressureUnit.Hectopascal: return (baseUnitValue) / 1e2d; + case PressureUnit.InchOfMercury: return baseUnitValue*2.95299830714159e-4; + case PressureUnit.Kilobar: return (baseUnitValue/1e5) / 1e3d; + case PressureUnit.KilogramForcePerSquareCentimeter: return baseUnitValue/9.80665e4; + case PressureUnit.KilogramForcePerSquareMeter: return baseUnitValue*0.101971619222242; + case PressureUnit.KilogramForcePerSquareMillimeter: return baseUnitValue/9.80665e6; + case PressureUnit.KilonewtonPerSquareCentimeter: return (baseUnitValue/1e4) / 1e3d; + case PressureUnit.KilonewtonPerSquareMeter: return (baseUnitValue) / 1e3d; + case PressureUnit.KilonewtonPerSquareMillimeter: return (baseUnitValue/1e6) / 1e3d; + case PressureUnit.Kilopascal: return (baseUnitValue) / 1e3d; + case PressureUnit.KilopoundForcePerSquareFoot: return (baseUnitValue/4.788025898033584e1) / 1e3d; + case PressureUnit.KilopoundForcePerSquareInch: return (baseUnitValue/6.894757293168361e3) / 1e3d; + case PressureUnit.Megabar: return (baseUnitValue/1e5) / 1e6d; + case PressureUnit.MeganewtonPerSquareMeter: return (baseUnitValue) / 1e6d; + case PressureUnit.Megapascal: return (baseUnitValue) / 1e6d; + case PressureUnit.MeterOfHead: return baseUnitValue*0.0001019977334; + case PressureUnit.Microbar: return (baseUnitValue/1e5) / 1e-6d; + case PressureUnit.Micropascal: return (baseUnitValue) / 1e-6d; + case PressureUnit.Millibar: return (baseUnitValue/1e5) / 1e-3d; + case PressureUnit.MillimeterOfMercury: return baseUnitValue*7.50061561302643e-3; + case PressureUnit.NewtonPerSquareCentimeter: return baseUnitValue/1e4; + case PressureUnit.NewtonPerSquareMeter: return baseUnitValue; + case PressureUnit.NewtonPerSquareMillimeter: return baseUnitValue/1e6; + case PressureUnit.Pascal: return baseUnitValue; + case PressureUnit.PoundForcePerSquareFoot: return baseUnitValue/4.788025898033584e1; + case PressureUnit.PoundForcePerSquareInch: return baseUnitValue/6.894757293168361e3; + case PressureUnit.PoundPerInchSecondSquared: return baseUnitValue/1.785796732283465e1; + case PressureUnit.TechnicalAtmosphere: return baseUnitValue/(9.80680592331*1e4); + case PressureUnit.TonneForcePerSquareCentimeter: return baseUnitValue/9.80665e7; + case PressureUnit.TonneForcePerSquareMeter: return baseUnitValue/9.80665e3; + case PressureUnit.TonneForcePerSquareMillimeter: return baseUnitValue/9.80665e9; + case PressureUnit.Torr: return baseUnitValue/(1.3332266752*1e2); + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs new file mode 100644 index 0000000000..4fc0a607da --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -0,0 +1,648 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). + /// + public partial struct PressureChangeRate : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly PressureChangeRateUnit? _unit; + + static PressureChangeRate() + { + BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public PressureChangeRate(double numericValue, PressureChangeRateUnit unit) + { + if(unit == PressureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of PressureChangeRate, which is PascalPerSecond. All conversions go via this value. + /// + public static PressureChangeRateUnit BaseUnit => PressureChangeRateUnit.PascalPerSecond; + + /// + /// Represents the largest possible value of PressureChangeRate + /// + public static PressureChangeRate MaxValue => new PressureChangeRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of PressureChangeRate + /// + public static PressureChangeRate MinValue => new PressureChangeRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.PressureChangeRate; + + /// + /// All units of measurement for the PressureChangeRate quantity. + /// + public static PressureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(PressureChangeRateUnit)).Cast().Except(new PressureChangeRateUnit[]{ PressureChangeRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit PascalPerSecond. + /// + public static PressureChangeRate Zero => new PressureChangeRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public PressureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => PressureChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => PressureChangeRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get PressureChangeRate in AtmospheresPerSecond. + /// + public double AtmospheresPerSecond => As(PressureChangeRateUnit.AtmospherePerSecond); + + /// + /// Get PressureChangeRate in KilopascalsPerSecond. + /// + public double KilopascalsPerSecond => As(PressureChangeRateUnit.KilopascalPerSecond); + + /// + /// Get PressureChangeRate in MegapascalsPerSecond. + /// + public double MegapascalsPerSecond => As(PressureChangeRateUnit.MegapascalPerSecond); + + /// + /// Get PressureChangeRate in PascalsPerSecond. + /// + public double PascalsPerSecond => As(PressureChangeRateUnit.PascalPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(PressureChangeRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(PressureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get PressureChangeRate from AtmospheresPerSecond. + /// + /// If value is NaN or Infinity. + public static PressureChangeRate FromAtmospheresPerSecond(QuantityValue atmospherespersecond) + { + double value = (double) atmospherespersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.AtmospherePerSecond); + } + /// + /// Get PressureChangeRate from KilopascalsPerSecond. + /// + /// If value is NaN or Infinity. + public static PressureChangeRate FromKilopascalsPerSecond(QuantityValue kilopascalspersecond) + { + double value = (double) kilopascalspersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.KilopascalPerSecond); + } + /// + /// Get PressureChangeRate from MegapascalsPerSecond. + /// + /// If value is NaN or Infinity. + public static PressureChangeRate FromMegapascalsPerSecond(QuantityValue megapascalspersecond) + { + double value = (double) megapascalspersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.MegapascalPerSecond); + } + /// + /// Get PressureChangeRate from PascalsPerSecond. + /// + /// If value is NaN or Infinity. + public static PressureChangeRate FromPascalsPerSecond(QuantityValue pascalspersecond) + { + double value = (double) pascalspersecond; + return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerSecond); + } + + /// + /// 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 new PressureChangeRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static PressureChangeRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static PressureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out PressureChangeRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out PressureChangeRate result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static PressureChangeRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static PressureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out PressureChangeRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out PressureChangeRateUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is PressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); + + return CompareTo((PressureChangeRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(PressureChangeRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another PressureChangeRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(PressureChangeRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current PressureChangeRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(PressureChangeRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this PressureChangeRate to another PressureChangeRate with the unit representation . + /// + /// A PressureChangeRate with the specified unit. + public PressureChangeRate ToUnit(PressureChangeRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new PressureChangeRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case PressureChangeRateUnit.AtmospherePerSecond: return _value * 1.01325*1e5; + case PressureChangeRateUnit.KilopascalPerSecond: return (_value) * 1e3d; + case PressureChangeRateUnit.MegapascalPerSecond: return (_value) * 1e6d; + case PressureChangeRateUnit.PascalPerSecond: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(PressureChangeRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case PressureChangeRateUnit.AtmospherePerSecond: return baseUnitValue / (1.01325*1e5); + case PressureChangeRateUnit.KilopascalPerSecond: return (baseUnitValue) / 1e3d; + case PressureChangeRateUnit.MegapascalPerSecond: return (baseUnitValue) / 1e6d; + case PressureChangeRateUnit.PascalPerSecond: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs new file mode 100644 index 0000000000..4a462f93b7 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -0,0 +1,680 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). + /// + public partial struct Ratio : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RatioUnit? _unit; + + static Ratio() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Ratio(double numericValue, RatioUnit unit) + { + if(unit == RatioUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Ratio, which is DecimalFraction. All conversions go via this value. + /// + public static RatioUnit BaseUnit => RatioUnit.DecimalFraction; + + /// + /// Represents the largest possible value of Ratio + /// + public static Ratio MaxValue => new Ratio(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Ratio + /// + public static Ratio MinValue => new Ratio(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Ratio; + + /// + /// All units of measurement for the Ratio quantity. + /// + public static RatioUnit[] Units { get; } = Enum.GetValues(typeof(RatioUnit)).Cast().Except(new RatioUnit[]{ RatioUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DecimalFraction. + /// + public static Ratio Zero => new Ratio(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RatioUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Ratio.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Ratio.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Ratio in DecimalFractions. + /// + public double DecimalFractions => As(RatioUnit.DecimalFraction); + + /// + /// Get Ratio in PartsPerBillion. + /// + public double PartsPerBillion => As(RatioUnit.PartPerBillion); + + /// + /// Get Ratio in PartsPerMillion. + /// + public double PartsPerMillion => As(RatioUnit.PartPerMillion); + + /// + /// Get Ratio in PartsPerThousand. + /// + public double PartsPerThousand => As(RatioUnit.PartPerThousand); + + /// + /// Get Ratio in PartsPerTrillion. + /// + public double PartsPerTrillion => As(RatioUnit.PartPerTrillion); + + /// + /// Get Ratio in Percent. + /// + public double Percent => As(RatioUnit.Percent); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RatioUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(RatioUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Ratio from DecimalFractions. + /// + /// If value is NaN or Infinity. + public static Ratio FromDecimalFractions(QuantityValue decimalfractions) + { + double value = (double) decimalfractions; + return new Ratio(value, RatioUnit.DecimalFraction); + } + /// + /// Get Ratio from PartsPerBillion. + /// + /// If value is NaN or Infinity. + public static Ratio FromPartsPerBillion(QuantityValue partsperbillion) + { + double value = (double) partsperbillion; + return new Ratio(value, RatioUnit.PartPerBillion); + } + /// + /// Get Ratio from PartsPerMillion. + /// + /// If value is NaN or Infinity. + public static Ratio FromPartsPerMillion(QuantityValue partspermillion) + { + double value = (double) partspermillion; + return new Ratio(value, RatioUnit.PartPerMillion); + } + /// + /// Get Ratio from PartsPerThousand. + /// + /// If value is NaN or Infinity. + public static Ratio FromPartsPerThousand(QuantityValue partsperthousand) + { + double value = (double) partsperthousand; + return new Ratio(value, RatioUnit.PartPerThousand); + } + /// + /// Get Ratio from PartsPerTrillion. + /// + /// If value is NaN or Infinity. + public static Ratio FromPartsPerTrillion(QuantityValue partspertrillion) + { + double value = (double) partspertrillion; + return new Ratio(value, RatioUnit.PartPerTrillion); + } + /// + /// Get Ratio from Percent. + /// + /// If value is NaN or Infinity. + public static Ratio FromPercent(QuantityValue percent) + { + double value = (double) percent; + return new Ratio(value, RatioUnit.Percent); + } + + /// + /// 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 new Ratio((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Ratio Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Ratio Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Ratio result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Ratio result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RatioUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static RatioUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RatioUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out RatioUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Ratio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); + + return CompareTo((Ratio)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Ratio other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Ratio within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Ratio. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RatioUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Ratio to another Ratio with the unit representation . + /// + /// A Ratio with the specified unit. + public Ratio ToUnit(RatioUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Ratio(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RatioUnit.DecimalFraction: return _value; + case RatioUnit.PartPerBillion: return _value/1e9; + case RatioUnit.PartPerMillion: return _value/1e6; + case RatioUnit.PartPerThousand: return _value/1e3; + case RatioUnit.PartPerTrillion: return _value/1e12; + case RatioUnit.Percent: return _value/1e2; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RatioUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RatioUnit.DecimalFraction: return baseUnitValue; + case RatioUnit.PartPerBillion: return baseUnitValue*1e9; + case RatioUnit.PartPerMillion: return baseUnitValue*1e6; + case RatioUnit.PartPerThousand: return baseUnitValue*1e3; + case RatioUnit.PartPerTrillion: return baseUnitValue*1e12; + case RatioUnit.Percent: return baseUnitValue*1e2; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs new file mode 100644 index 0000000000..6e45a16399 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. + /// + public partial struct ReactiveEnergy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ReactiveEnergyUnit? _unit; + + static ReactiveEnergy() + { + BaseDimensions = new BaseDimensions(2, 1, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ReactiveEnergy(double numericValue, ReactiveEnergyUnit unit) + { + if(unit == ReactiveEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ReactiveEnergy, which is VoltampereReactiveHour. All conversions go via this value. + /// + public static ReactiveEnergyUnit BaseUnit => ReactiveEnergyUnit.VoltampereReactiveHour; + + /// + /// Represents the largest possible value of ReactiveEnergy + /// + public static ReactiveEnergy MaxValue => new ReactiveEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ReactiveEnergy + /// + public static ReactiveEnergy MinValue => new ReactiveEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ReactiveEnergy; + + /// + /// All units of measurement for the ReactiveEnergy quantity. + /// + public static ReactiveEnergyUnit[] Units { get; } = Enum.GetValues(typeof(ReactiveEnergyUnit)).Cast().Except(new ReactiveEnergyUnit[]{ ReactiveEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactiveHour. + /// + public static ReactiveEnergy Zero => new ReactiveEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ReactiveEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ReactiveEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ReactiveEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ReactiveEnergy in KilovoltampereReactiveHours. + /// + public double KilovoltampereReactiveHours => As(ReactiveEnergyUnit.KilovoltampereReactiveHour); + + /// + /// Get ReactiveEnergy in MegavoltampereReactiveHours. + /// + public double MegavoltampereReactiveHours => As(ReactiveEnergyUnit.MegavoltampereReactiveHour); + + /// + /// Get ReactiveEnergy in VoltampereReactiveHours. + /// + public double VoltampereReactiveHours => As(ReactiveEnergyUnit.VoltampereReactiveHour); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ReactiveEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ReactiveEnergyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ReactiveEnergy from KilovoltampereReactiveHours. + /// + /// If value is NaN or Infinity. + public static ReactiveEnergy FromKilovoltampereReactiveHours(QuantityValue kilovoltamperereactivehours) + { + double value = (double) kilovoltamperereactivehours; + return new ReactiveEnergy(value, ReactiveEnergyUnit.KilovoltampereReactiveHour); + } + /// + /// Get ReactiveEnergy from MegavoltampereReactiveHours. + /// + /// If value is NaN or Infinity. + public static ReactiveEnergy FromMegavoltampereReactiveHours(QuantityValue megavoltamperereactivehours) + { + double value = (double) megavoltamperereactivehours; + return new ReactiveEnergy(value, ReactiveEnergyUnit.MegavoltampereReactiveHour); + } + /// + /// Get ReactiveEnergy from VoltampereReactiveHours. + /// + /// If value is NaN or Infinity. + public static ReactiveEnergy FromVoltampereReactiveHours(QuantityValue voltamperereactivehours) + { + double value = (double) voltamperereactivehours; + return new ReactiveEnergy(value, ReactiveEnergyUnit.VoltampereReactiveHour); + } + + /// + /// 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 new ReactiveEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ReactiveEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ReactiveEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ReactiveEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactiveEnergy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ReactiveEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ReactiveEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ReactiveEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ReactiveEnergyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); + + return CompareTo((ReactiveEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ReactiveEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ReactiveEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ReactiveEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ReactiveEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ReactiveEnergy to another ReactiveEnergy with the unit representation . + /// + /// A ReactiveEnergy with the specified unit. + public ReactiveEnergy ToUnit(ReactiveEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ReactiveEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (_value) * 1e3d; + case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (_value) * 1e6d; + case ReactiveEnergyUnit.VoltampereReactiveHour: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ReactiveEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ReactiveEnergyUnit.KilovoltampereReactiveHour: return (baseUnitValue) / 1e3d; + case ReactiveEnergyUnit.MegavoltampereReactiveHour: return (baseUnitValue) / 1e6d; + case ReactiveEnergyUnit.VoltampereReactiveHour: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs new file mode 100644 index 0000000000..7cb2597718 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -0,0 +1,648 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. + /// + public partial struct ReactivePower : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ReactivePowerUnit? _unit; + + static ReactivePower() + { + BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ReactivePower(double numericValue, ReactivePowerUnit unit) + { + if(unit == ReactivePowerUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ReactivePower, which is VoltampereReactive. All conversions go via this value. + /// + public static ReactivePowerUnit BaseUnit => ReactivePowerUnit.VoltampereReactive; + + /// + /// Represents the largest possible value of ReactivePower + /// + public static ReactivePower MaxValue => new ReactivePower(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ReactivePower + /// + public static ReactivePower MinValue => new ReactivePower(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ReactivePower; + + /// + /// All units of measurement for the ReactivePower quantity. + /// + public static ReactivePowerUnit[] Units { get; } = Enum.GetValues(typeof(ReactivePowerUnit)).Cast().Except(new ReactivePowerUnit[]{ ReactivePowerUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit VoltampereReactive. + /// + public static ReactivePower Zero => new ReactivePower(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ReactivePowerUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ReactivePower.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ReactivePower.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ReactivePower in GigavoltamperesReactive. + /// + public double GigavoltamperesReactive => As(ReactivePowerUnit.GigavoltampereReactive); + + /// + /// Get ReactivePower in KilovoltamperesReactive. + /// + public double KilovoltamperesReactive => As(ReactivePowerUnit.KilovoltampereReactive); + + /// + /// Get ReactivePower in MegavoltamperesReactive. + /// + public double MegavoltamperesReactive => As(ReactivePowerUnit.MegavoltampereReactive); + + /// + /// Get ReactivePower in VoltamperesReactive. + /// + public double VoltamperesReactive => As(ReactivePowerUnit.VoltampereReactive); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ReactivePowerUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ReactivePowerUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ReactivePower from GigavoltamperesReactive. + /// + /// If value is NaN or Infinity. + public static ReactivePower FromGigavoltamperesReactive(QuantityValue gigavoltamperesreactive) + { + double value = (double) gigavoltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.GigavoltampereReactive); + } + /// + /// Get ReactivePower from KilovoltamperesReactive. + /// + /// If value is NaN or Infinity. + public static ReactivePower FromKilovoltamperesReactive(QuantityValue kilovoltamperesreactive) + { + double value = (double) kilovoltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.KilovoltampereReactive); + } + /// + /// Get ReactivePower from MegavoltamperesReactive. + /// + /// If value is NaN or Infinity. + public static ReactivePower FromMegavoltamperesReactive(QuantityValue megavoltamperesreactive) + { + double value = (double) megavoltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.MegavoltampereReactive); + } + /// + /// Get ReactivePower from VoltamperesReactive. + /// + /// If value is NaN or Infinity. + public static ReactivePower FromVoltamperesReactive(QuantityValue voltamperesreactive) + { + double value = (double) voltamperesreactive; + return new ReactivePower(value, ReactivePowerUnit.VoltampereReactive); + } + + /// + /// 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 new ReactivePower((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ReactivePower Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ReactivePower Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ReactivePower result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ReactivePower result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ReactivePowerUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ReactivePowerUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ReactivePowerUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ReactivePowerUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); + + return CompareTo((ReactivePower)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ReactivePower other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ReactivePower within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ReactivePower other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ReactivePower. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ReactivePowerUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ReactivePower to another ReactivePower with the unit representation . + /// + /// A ReactivePower with the specified unit. + public ReactivePower ToUnit(ReactivePowerUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ReactivePower(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ReactivePowerUnit.GigavoltampereReactive: return (_value) * 1e9d; + case ReactivePowerUnit.KilovoltampereReactive: return (_value) * 1e3d; + case ReactivePowerUnit.MegavoltampereReactive: return (_value) * 1e6d; + case ReactivePowerUnit.VoltampereReactive: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ReactivePowerUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ReactivePowerUnit.GigavoltampereReactive: return (baseUnitValue) / 1e9d; + case ReactivePowerUnit.KilovoltampereReactive: return (baseUnitValue) / 1e3d; + case ReactivePowerUnit.MegavoltampereReactive: return (baseUnitValue) / 1e6d; + case ReactivePowerUnit.VoltampereReactive: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs new file mode 100644 index 0000000000..fa98eebef2 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Angular acceleration is the rate of change of rotational speed. + /// + public partial struct RotationalAcceleration : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalAccelerationUnit? _unit; + + static RotationalAcceleration() + { + BaseDimensions = new BaseDimensions(0, 0, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public RotationalAcceleration(double numericValue, RotationalAccelerationUnit unit) + { + if(unit == RotationalAccelerationUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalAcceleration, which is RadianPerSecondSquared. All conversions go via this value. + /// + public static RotationalAccelerationUnit BaseUnit => RotationalAccelerationUnit.RadianPerSecondSquared; + + /// + /// Represents the largest possible value of RotationalAcceleration + /// + public static RotationalAcceleration MaxValue => new RotationalAcceleration(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalAcceleration + /// + public static RotationalAcceleration MinValue => new RotationalAcceleration(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalAcceleration; + + /// + /// All units of measurement for the RotationalAcceleration quantity. + /// + public static RotationalAccelerationUnit[] Units { get; } = Enum.GetValues(typeof(RotationalAccelerationUnit)).Cast().Except(new RotationalAccelerationUnit[]{ RotationalAccelerationUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecondSquared. + /// + public static RotationalAcceleration Zero => new RotationalAcceleration(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalAccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalAcceleration.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalAcceleration.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalAcceleration in DegreesPerSecondSquared. + /// + public double DegreesPerSecondSquared => As(RotationalAccelerationUnit.DegreePerSecondSquared); + + /// + /// Get RotationalAcceleration in RadiansPerSecondSquared. + /// + public double RadiansPerSecondSquared => As(RotationalAccelerationUnit.RadianPerSecondSquared); + + /// + /// Get RotationalAcceleration in RevolutionsPerMinutePerSecond. + /// + public double RevolutionsPerMinutePerSecond => As(RotationalAccelerationUnit.RevolutionPerMinutePerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalAccelerationUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(RotationalAccelerationUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalAcceleration from DegreesPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static RotationalAcceleration FromDegreesPerSecondSquared(QuantityValue degreespersecondsquared) + { + double value = (double) degreespersecondsquared; + return new RotationalAcceleration(value, RotationalAccelerationUnit.DegreePerSecondSquared); + } + /// + /// Get RotationalAcceleration from RadiansPerSecondSquared. + /// + /// If value is NaN or Infinity. + public static RotationalAcceleration FromRadiansPerSecondSquared(QuantityValue radianspersecondsquared) + { + double value = (double) radianspersecondsquared; + return new RotationalAcceleration(value, RotationalAccelerationUnit.RadianPerSecondSquared); + } + /// + /// Get RotationalAcceleration from RevolutionsPerMinutePerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(QuantityValue revolutionsperminutepersecond) + { + double value = (double) revolutionsperminutepersecond; + return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); + } + + /// + /// 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 new RotationalAcceleration((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalAcceleration Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalAcceleration Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalAcceleration result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalAcceleration result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalAccelerationUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalAccelerationUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalAccelerationUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalAccelerationUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); + + return CompareTo((RotationalAcceleration)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(RotationalAcceleration other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalAcceleration within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalAcceleration other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalAcceleration. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalAccelerationUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalAcceleration to another RotationalAcceleration with the unit representation . + /// + /// A RotationalAcceleration with the specified unit. + public RotationalAcceleration ToUnit(RotationalAccelerationUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalAcceleration(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalAccelerationUnit.DegreePerSecondSquared: return (Math.PI/180)*_value; + case RotationalAccelerationUnit.RadianPerSecondSquared: return _value; + case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return ((2*Math.PI)/60)*_value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalAccelerationUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalAccelerationUnit.DegreePerSecondSquared: return (180/Math.PI)*baseUnitValue; + case RotationalAccelerationUnit.RadianPerSecondSquared: return baseUnitValue; + case RotationalAccelerationUnit.RevolutionPerMinutePerSecond: return (60/(2*Math.PI))*baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs new file mode 100644 index 0000000000..1c5a6bca8d --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -0,0 +1,792 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). + /// + public partial struct RotationalSpeed : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalSpeedUnit? _unit; + + static RotationalSpeed() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public RotationalSpeed(double numericValue, RotationalSpeedUnit unit) + { + if(unit == RotationalSpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalSpeed, which is RadianPerSecond. All conversions go via this value. + /// + public static RotationalSpeedUnit BaseUnit => RotationalSpeedUnit.RadianPerSecond; + + /// + /// Represents the largest possible value of RotationalSpeed + /// + public static RotationalSpeed MaxValue => new RotationalSpeed(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalSpeed + /// + public static RotationalSpeed MinValue => new RotationalSpeed(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalSpeed; + + /// + /// All units of measurement for the RotationalSpeed quantity. + /// + public static RotationalSpeedUnit[] Units { get; } = Enum.GetValues(typeof(RotationalSpeedUnit)).Cast().Except(new RotationalSpeedUnit[]{ RotationalSpeedUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit RadianPerSecond. + /// + public static RotationalSpeed Zero => new RotationalSpeed(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalSpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalSpeed.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalSpeed.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalSpeed in CentiradiansPerSecond. + /// + public double CentiradiansPerSecond => As(RotationalSpeedUnit.CentiradianPerSecond); + + /// + /// Get RotationalSpeed in DeciradiansPerSecond. + /// + public double DeciradiansPerSecond => As(RotationalSpeedUnit.DeciradianPerSecond); + + /// + /// Get RotationalSpeed in DegreesPerMinute. + /// + public double DegreesPerMinute => As(RotationalSpeedUnit.DegreePerMinute); + + /// + /// Get RotationalSpeed in DegreesPerSecond. + /// + public double DegreesPerSecond => As(RotationalSpeedUnit.DegreePerSecond); + + /// + /// Get RotationalSpeed in MicrodegreesPerSecond. + /// + public double MicrodegreesPerSecond => As(RotationalSpeedUnit.MicrodegreePerSecond); + + /// + /// Get RotationalSpeed in MicroradiansPerSecond. + /// + public double MicroradiansPerSecond => As(RotationalSpeedUnit.MicroradianPerSecond); + + /// + /// Get RotationalSpeed in MillidegreesPerSecond. + /// + public double MillidegreesPerSecond => As(RotationalSpeedUnit.MillidegreePerSecond); + + /// + /// Get RotationalSpeed in MilliradiansPerSecond. + /// + public double MilliradiansPerSecond => As(RotationalSpeedUnit.MilliradianPerSecond); + + /// + /// Get RotationalSpeed in NanodegreesPerSecond. + /// + public double NanodegreesPerSecond => As(RotationalSpeedUnit.NanodegreePerSecond); + + /// + /// Get RotationalSpeed in NanoradiansPerSecond. + /// + public double NanoradiansPerSecond => As(RotationalSpeedUnit.NanoradianPerSecond); + + /// + /// Get RotationalSpeed in RadiansPerSecond. + /// + public double RadiansPerSecond => As(RotationalSpeedUnit.RadianPerSecond); + + /// + /// Get RotationalSpeed in RevolutionsPerMinute. + /// + public double RevolutionsPerMinute => As(RotationalSpeedUnit.RevolutionPerMinute); + + /// + /// Get RotationalSpeed in RevolutionsPerSecond. + /// + public double RevolutionsPerSecond => As(RotationalSpeedUnit.RevolutionPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalSpeedUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(RotationalSpeedUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalSpeed from CentiradiansPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromCentiradiansPerSecond(QuantityValue centiradianspersecond) + { + double value = (double) centiradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.CentiradianPerSecond); + } + /// + /// Get RotationalSpeed from DeciradiansPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromDeciradiansPerSecond(QuantityValue deciradianspersecond) + { + double value = (double) deciradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.DeciradianPerSecond); + } + /// + /// Get RotationalSpeed from DegreesPerMinute. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromDegreesPerMinute(QuantityValue degreesperminute) + { + double value = (double) degreesperminute; + return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerMinute); + } + /// + /// Get RotationalSpeed from DegreesPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromDegreesPerSecond(QuantityValue degreespersecond) + { + double value = (double) degreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.DegreePerSecond); + } + /// + /// Get RotationalSpeed from MicrodegreesPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromMicrodegreesPerSecond(QuantityValue microdegreespersecond) + { + double value = (double) microdegreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MicrodegreePerSecond); + } + /// + /// Get RotationalSpeed from MicroradiansPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromMicroradiansPerSecond(QuantityValue microradianspersecond) + { + double value = (double) microradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MicroradianPerSecond); + } + /// + /// Get RotationalSpeed from MillidegreesPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromMillidegreesPerSecond(QuantityValue millidegreespersecond) + { + double value = (double) millidegreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MillidegreePerSecond); + } + /// + /// Get RotationalSpeed from MilliradiansPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromMilliradiansPerSecond(QuantityValue milliradianspersecond) + { + double value = (double) milliradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.MilliradianPerSecond); + } + /// + /// Get RotationalSpeed from NanodegreesPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromNanodegreesPerSecond(QuantityValue nanodegreespersecond) + { + double value = (double) nanodegreespersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.NanodegreePerSecond); + } + /// + /// Get RotationalSpeed from NanoradiansPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromNanoradiansPerSecond(QuantityValue nanoradianspersecond) + { + double value = (double) nanoradianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.NanoradianPerSecond); + } + /// + /// Get RotationalSpeed from RadiansPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromRadiansPerSecond(QuantityValue radianspersecond) + { + double value = (double) radianspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.RadianPerSecond); + } + /// + /// Get RotationalSpeed from RevolutionsPerMinute. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromRevolutionsPerMinute(QuantityValue revolutionsperminute) + { + double value = (double) revolutionsperminute; + return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerMinute); + } + /// + /// Get RotationalSpeed from RevolutionsPerSecond. + /// + /// If value is NaN or Infinity. + public static RotationalSpeed FromRevolutionsPerSecond(QuantityValue revolutionspersecond) + { + double value = (double) revolutionspersecond; + return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerSecond); + } + + /// + /// 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 new RotationalSpeed((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalSpeed Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalSpeed Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalSpeed result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalSpeed result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalSpeedUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalSpeedUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalSpeedUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalSpeedUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); + + return CompareTo((RotationalSpeed)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(RotationalSpeed other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalSpeed within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalSpeed other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalSpeed. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalSpeedUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalSpeed to another RotationalSpeed with the unit representation . + /// + /// A RotationalSpeed with the specified unit. + public RotationalSpeed ToUnit(RotationalSpeedUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalSpeed(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalSpeedUnit.CentiradianPerSecond: return (_value) * 1e-2d; + case RotationalSpeedUnit.DeciradianPerSecond: return (_value) * 1e-1d; + case RotationalSpeedUnit.DegreePerMinute: return (Math.PI/(180*60))*_value; + case RotationalSpeedUnit.DegreePerSecond: return (Math.PI/180)*_value; + case RotationalSpeedUnit.MicrodegreePerSecond: return ((Math.PI/180)*_value) * 1e-6d; + case RotationalSpeedUnit.MicroradianPerSecond: return (_value) * 1e-6d; + case RotationalSpeedUnit.MillidegreePerSecond: return ((Math.PI/180)*_value) * 1e-3d; + case RotationalSpeedUnit.MilliradianPerSecond: return (_value) * 1e-3d; + case RotationalSpeedUnit.NanodegreePerSecond: return ((Math.PI/180)*_value) * 1e-9d; + case RotationalSpeedUnit.NanoradianPerSecond: return (_value) * 1e-9d; + case RotationalSpeedUnit.RadianPerSecond: return _value; + case RotationalSpeedUnit.RevolutionPerMinute: return (_value*6.2831853072)/60; + case RotationalSpeedUnit.RevolutionPerSecond: return _value*6.2831853072; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalSpeedUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalSpeedUnit.CentiradianPerSecond: return (baseUnitValue) / 1e-2d; + case RotationalSpeedUnit.DeciradianPerSecond: return (baseUnitValue) / 1e-1d; + case RotationalSpeedUnit.DegreePerMinute: return (180*60/Math.PI)*baseUnitValue; + case RotationalSpeedUnit.DegreePerSecond: return (180/Math.PI)*baseUnitValue; + case RotationalSpeedUnit.MicrodegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-6d; + case RotationalSpeedUnit.MicroradianPerSecond: return (baseUnitValue) / 1e-6d; + case RotationalSpeedUnit.MillidegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-3d; + case RotationalSpeedUnit.MilliradianPerSecond: return (baseUnitValue) / 1e-3d; + case RotationalSpeedUnit.NanodegreePerSecond: return ((180/Math.PI)*baseUnitValue) / 1e-9d; + case RotationalSpeedUnit.NanoradianPerSecond: return (baseUnitValue) / 1e-9d; + case RotationalSpeedUnit.RadianPerSecond: return baseUnitValue; + case RotationalSpeedUnit.RevolutionPerMinute: return (baseUnitValue/6.2831853072)*60; + case RotationalSpeedUnit.RevolutionPerSecond: return baseUnitValue/6.2831853072; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs new file mode 100644 index 0000000000..621019cb7e --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness + /// + public partial struct RotationalStiffness : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalStiffnessUnit? _unit; + + static RotationalStiffness() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public RotationalStiffness(double numericValue, RotationalStiffnessUnit unit) + { + if(unit == RotationalStiffnessUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalStiffness, which is NewtonMeterPerRadian. All conversions go via this value. + /// + public static RotationalStiffnessUnit BaseUnit => RotationalStiffnessUnit.NewtonMeterPerRadian; + + /// + /// Represents the largest possible value of RotationalStiffness + /// + public static RotationalStiffness MaxValue => new RotationalStiffness(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalStiffness + /// + public static RotationalStiffness MinValue => new RotationalStiffness(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalStiffness; + + /// + /// All units of measurement for the RotationalStiffness quantity. + /// + public static RotationalStiffnessUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessUnit)).Cast().Except(new RotationalStiffnessUnit[]{ RotationalStiffnessUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadian. + /// + public static RotationalStiffness Zero => new RotationalStiffness(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalStiffnessUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalStiffness.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalStiffness.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalStiffness in KilonewtonMetersPerRadian. + /// + public double KilonewtonMetersPerRadian => As(RotationalStiffnessUnit.KilonewtonMeterPerRadian); + + /// + /// Get RotationalStiffness in MeganewtonMetersPerRadian. + /// + public double MeganewtonMetersPerRadian => As(RotationalStiffnessUnit.MeganewtonMeterPerRadian); + + /// + /// Get RotationalStiffness in NewtonMetersPerRadian. + /// + public double NewtonMetersPerRadian => As(RotationalStiffnessUnit.NewtonMeterPerRadian); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalStiffnessUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(RotationalStiffnessUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalStiffness from KilonewtonMetersPerRadian. + /// + /// If value is NaN or Infinity. + public static RotationalStiffness FromKilonewtonMetersPerRadian(QuantityValue kilonewtonmetersperradian) + { + double value = (double) kilonewtonmetersperradian; + return new RotationalStiffness(value, RotationalStiffnessUnit.KilonewtonMeterPerRadian); + } + /// + /// Get RotationalStiffness from MeganewtonMetersPerRadian. + /// + /// If value is NaN or Infinity. + public static RotationalStiffness FromMeganewtonMetersPerRadian(QuantityValue meganewtonmetersperradian) + { + double value = (double) meganewtonmetersperradian; + return new RotationalStiffness(value, RotationalStiffnessUnit.MeganewtonMeterPerRadian); + } + /// + /// Get RotationalStiffness from NewtonMetersPerRadian. + /// + /// If value is NaN or Infinity. + public static RotationalStiffness FromNewtonMetersPerRadian(QuantityValue newtonmetersperradian) + { + double value = (double) newtonmetersperradian; + return new RotationalStiffness(value, RotationalStiffnessUnit.NewtonMeterPerRadian); + } + + /// + /// 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 new RotationalStiffness((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalStiffness Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalStiffness Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalStiffness result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffness result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalStiffnessUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalStiffnessUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalStiffnessUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalStiffnessUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); + + return CompareTo((RotationalStiffness)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(RotationalStiffness other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalStiffness within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalStiffness other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalStiffness. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalStiffnessUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalStiffness to another RotationalStiffness with the unit representation . + /// + /// A RotationalStiffness with the specified unit. + public RotationalStiffness ToUnit(RotationalStiffnessUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalStiffness(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (_value) * 1e3d; + case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (_value) * 1e6d; + case RotationalStiffnessUnit.NewtonMeterPerRadian: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalStiffnessUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalStiffnessUnit.KilonewtonMeterPerRadian: return (baseUnitValue) / 1e3d; + case RotationalStiffnessUnit.MeganewtonMeterPerRadian: return (baseUnitValue) / 1e6d; + case RotationalStiffnessUnit.NewtonMeterPerRadian: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs new file mode 100644 index 0000000000..e8684b1465 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -0,0 +1,632 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness + /// + public partial struct RotationalStiffnessPerLength : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly RotationalStiffnessPerLengthUnit? _unit; + + static RotationalStiffnessPerLength() + { + BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPerLengthUnit unit) + { + if(unit == RotationalStiffnessPerLengthUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of RotationalStiffnessPerLength, which is NewtonMeterPerRadianPerMeter. All conversions go via this value. + /// + public static RotationalStiffnessPerLengthUnit BaseUnit => RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter; + + /// + /// Represents the largest possible value of RotationalStiffnessPerLength + /// + public static RotationalStiffnessPerLength MaxValue => new RotationalStiffnessPerLength(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of RotationalStiffnessPerLength + /// + public static RotationalStiffnessPerLength MinValue => new RotationalStiffnessPerLength(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.RotationalStiffnessPerLength; + + /// + /// All units of measurement for the RotationalStiffnessPerLength quantity. + /// + public static RotationalStiffnessPerLengthUnit[] Units { get; } = Enum.GetValues(typeof(RotationalStiffnessPerLengthUnit)).Cast().Except(new RotationalStiffnessPerLengthUnit[]{ RotationalStiffnessPerLengthUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter. + /// + public static RotationalStiffnessPerLength Zero => new RotationalStiffnessPerLength(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public RotationalStiffnessPerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => RotationalStiffnessPerLength.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => RotationalStiffnessPerLength.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get RotationalStiffnessPerLength in KilonewtonMetersPerRadianPerMeter. + /// + public double KilonewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); + + /// + /// Get RotationalStiffnessPerLength in MeganewtonMetersPerRadianPerMeter. + /// + public double MeganewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); + + /// + /// Get RotationalStiffnessPerLength in NewtonMetersPerRadianPerMeter. + /// + public double NewtonMetersPerRadianPerMeter => As(RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(RotationalStiffnessPerLengthUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get RotationalStiffnessPerLength from KilonewtonMetersPerRadianPerMeter. + /// + /// If value is NaN or Infinity. + public static RotationalStiffnessPerLength FromKilonewtonMetersPerRadianPerMeter(QuantityValue kilonewtonmetersperradianpermeter) + { + double value = (double) kilonewtonmetersperradianpermeter; + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter); + } + /// + /// Get RotationalStiffnessPerLength from MeganewtonMetersPerRadianPerMeter. + /// + /// If value is NaN or Infinity. + public static RotationalStiffnessPerLength FromMeganewtonMetersPerRadianPerMeter(QuantityValue meganewtonmetersperradianpermeter) + { + double value = (double) meganewtonmetersperradianpermeter; + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter); + } + /// + /// Get RotationalStiffnessPerLength from NewtonMetersPerRadianPerMeter. + /// + /// If value is NaN or Infinity. + public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(QuantityValue newtonmetersperradianpermeter) + { + double value = (double) newtonmetersperradianpermeter; + return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); + } + + /// + /// 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 new RotationalStiffnessPerLength((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static RotationalStiffnessPerLength Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalStiffnessPerLength Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out RotationalStiffnessPerLength result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out RotationalStiffnessPerLength result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static RotationalStiffnessPerLengthUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static RotationalStiffnessPerLengthUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out RotationalStiffnessPerLengthUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out RotationalStiffnessPerLengthUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is RotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); + + return CompareTo((RotationalStiffnessPerLength)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(RotationalStiffnessPerLength other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another RotationalStiffnessPerLength within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(RotationalStiffnessPerLength other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current RotationalStiffnessPerLength. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(RotationalStiffnessPerLengthUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this RotationalStiffnessPerLength to another RotationalStiffnessPerLength with the unit representation . + /// + /// A RotationalStiffnessPerLength with the specified unit. + public RotationalStiffnessPerLength ToUnit(RotationalStiffnessPerLengthUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new RotationalStiffnessPerLength(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (_value) * 1e3d; + case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (_value) * 1e6d; + case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(RotationalStiffnessPerLengthUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e3d; + case RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter: return (baseUnitValue) / 1e6d; + case RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs new file mode 100644 index 0000000000..dbaac8e546 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -0,0 +1,603 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In geometry, a solid angle is the two-dimensional angle in three-dimensional space that an object subtends at a point. + /// + /// + /// https://en.wikipedia.org/wiki/Solid_angle + /// + public partial struct SolidAngle : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SolidAngleUnit? _unit; + + static SolidAngle() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public SolidAngle(double numericValue, SolidAngleUnit unit) + { + if(unit == SolidAngleUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SolidAngle, which is Steradian. All conversions go via this value. + /// + public static SolidAngleUnit BaseUnit => SolidAngleUnit.Steradian; + + /// + /// Represents the largest possible value of SolidAngle + /// + public static SolidAngle MaxValue => new SolidAngle(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SolidAngle + /// + public static SolidAngle MinValue => new SolidAngle(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SolidAngle; + + /// + /// All units of measurement for the SolidAngle quantity. + /// + public static SolidAngleUnit[] Units { get; } = Enum.GetValues(typeof(SolidAngleUnit)).Cast().Except(new SolidAngleUnit[]{ SolidAngleUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Steradian. + /// + public static SolidAngle Zero => new SolidAngle(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SolidAngleUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SolidAngle.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SolidAngle.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SolidAngle in Steradians. + /// + public double Steradians => As(SolidAngleUnit.Steradian); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SolidAngleUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(SolidAngleUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SolidAngle from Steradians. + /// + /// If value is NaN or Infinity. + public static SolidAngle FromSteradians(QuantityValue steradians) + { + double value = (double) steradians; + return new SolidAngle(value, SolidAngleUnit.Steradian); + } + + /// + /// 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 new SolidAngle((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SolidAngle Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static SolidAngle Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SolidAngle result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SolidAngle result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SolidAngleUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static SolidAngleUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SolidAngleUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out SolidAngleUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); + + return CompareTo((SolidAngle)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(SolidAngle other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SolidAngle within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SolidAngle other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SolidAngle. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SolidAngleUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SolidAngle to another SolidAngle with the unit representation . + /// + /// A SolidAngle with the specified unit. + public SolidAngle ToUnit(SolidAngleUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SolidAngle(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SolidAngleUnit.Steradian: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SolidAngleUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SolidAngleUnit.Steradian: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs new file mode 100644 index 0000000000..e62ab6fd6d --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -0,0 +1,715 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The SpecificEnergy + /// + /// + /// https://en.wikipedia.org/wiki/Specific_energy + /// + public partial struct SpecificEnergy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificEnergyUnit? _unit; + + static SpecificEnergy() + { + BaseDimensions = new BaseDimensions(2, 0, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public SpecificEnergy(double numericValue, SpecificEnergyUnit unit) + { + if(unit == SpecificEnergyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificEnergy, which is JoulePerKilogram. All conversions go via this value. + /// + public static SpecificEnergyUnit BaseUnit => SpecificEnergyUnit.JoulePerKilogram; + + /// + /// Represents the largest possible value of SpecificEnergy + /// + public static SpecificEnergy MaxValue => new SpecificEnergy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificEnergy + /// + public static SpecificEnergy MinValue => new SpecificEnergy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificEnergy; + + /// + /// All units of measurement for the SpecificEnergy quantity. + /// + public static SpecificEnergyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEnergyUnit)).Cast().Except(new SpecificEnergyUnit[]{ SpecificEnergyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogram. + /// + public static SpecificEnergy Zero => new SpecificEnergy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificEnergy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificEnergy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificEnergy in CaloriesPerGram. + /// + public double CaloriesPerGram => As(SpecificEnergyUnit.CaloriePerGram); + + /// + /// Get SpecificEnergy in JoulesPerKilogram. + /// + public double JoulesPerKilogram => As(SpecificEnergyUnit.JoulePerKilogram); + + /// + /// Get SpecificEnergy in KilocaloriesPerGram. + /// + public double KilocaloriesPerGram => As(SpecificEnergyUnit.KilocaloriePerGram); + + /// + /// Get SpecificEnergy in KilojoulesPerKilogram. + /// + public double KilojoulesPerKilogram => As(SpecificEnergyUnit.KilojoulePerKilogram); + + /// + /// Get SpecificEnergy in KilowattHoursPerKilogram. + /// + public double KilowattHoursPerKilogram => As(SpecificEnergyUnit.KilowattHourPerKilogram); + + /// + /// Get SpecificEnergy in MegajoulesPerKilogram. + /// + public double MegajoulesPerKilogram => As(SpecificEnergyUnit.MegajoulePerKilogram); + + /// + /// Get SpecificEnergy in MegawattHoursPerKilogram. + /// + public double MegawattHoursPerKilogram => As(SpecificEnergyUnit.MegawattHourPerKilogram); + + /// + /// Get SpecificEnergy in WattHoursPerKilogram. + /// + public double WattHoursPerKilogram => As(SpecificEnergyUnit.WattHourPerKilogram); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificEnergyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(SpecificEnergyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificEnergy from CaloriesPerGram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromCaloriesPerGram(QuantityValue caloriespergram) + { + double value = (double) caloriespergram; + return new SpecificEnergy(value, SpecificEnergyUnit.CaloriePerGram); + } + /// + /// Get SpecificEnergy from JoulesPerKilogram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromJoulesPerKilogram(QuantityValue joulesperkilogram) + { + double value = (double) joulesperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.JoulePerKilogram); + } + /// + /// Get SpecificEnergy from KilocaloriesPerGram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromKilocaloriesPerGram(QuantityValue kilocaloriespergram) + { + double value = (double) kilocaloriespergram; + return new SpecificEnergy(value, SpecificEnergyUnit.KilocaloriePerGram); + } + /// + /// Get SpecificEnergy from KilojoulesPerKilogram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromKilojoulesPerKilogram(QuantityValue kilojoulesperkilogram) + { + double value = (double) kilojoulesperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.KilojoulePerKilogram); + } + /// + /// Get SpecificEnergy from KilowattHoursPerKilogram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromKilowattHoursPerKilogram(QuantityValue kilowatthoursperkilogram) + { + double value = (double) kilowatthoursperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.KilowattHourPerKilogram); + } + /// + /// Get SpecificEnergy from MegajoulesPerKilogram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromMegajoulesPerKilogram(QuantityValue megajoulesperkilogram) + { + double value = (double) megajoulesperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.MegajoulePerKilogram); + } + /// + /// Get SpecificEnergy from MegawattHoursPerKilogram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromMegawattHoursPerKilogram(QuantityValue megawatthoursperkilogram) + { + double value = (double) megawatthoursperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.MegawattHourPerKilogram); + } + /// + /// Get SpecificEnergy from WattHoursPerKilogram. + /// + /// If value is NaN or Infinity. + public static SpecificEnergy FromWattHoursPerKilogram(QuantityValue watthoursperkilogram) + { + double value = (double) watthoursperkilogram; + return new SpecificEnergy(value, SpecificEnergyUnit.WattHourPerKilogram); + } + + /// + /// 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 new SpecificEnergy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificEnergy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificEnergy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificEnergy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEnergy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificEnergyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificEnergyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificEnergyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificEnergyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); + + return CompareTo((SpecificEnergy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(SpecificEnergy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificEnergy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificEnergy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificEnergy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificEnergyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificEnergy to another SpecificEnergy with the unit representation . + /// + /// A SpecificEnergy with the specified unit. + public SpecificEnergy ToUnit(SpecificEnergyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificEnergy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificEnergyUnit.CaloriePerGram: return _value*4.184e3; + case SpecificEnergyUnit.JoulePerKilogram: return _value; + case SpecificEnergyUnit.KilocaloriePerGram: return (_value*4.184e3) * 1e3d; + case SpecificEnergyUnit.KilojoulePerKilogram: return (_value) * 1e3d; + case SpecificEnergyUnit.KilowattHourPerKilogram: return (_value*3.6e3) * 1e3d; + case SpecificEnergyUnit.MegajoulePerKilogram: return (_value) * 1e6d; + case SpecificEnergyUnit.MegawattHourPerKilogram: return (_value*3.6e3) * 1e6d; + case SpecificEnergyUnit.WattHourPerKilogram: return _value*3.6e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificEnergyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificEnergyUnit.CaloriePerGram: return baseUnitValue/4.184e3; + case SpecificEnergyUnit.JoulePerKilogram: return baseUnitValue; + case SpecificEnergyUnit.KilocaloriePerGram: return (baseUnitValue/4.184e3) / 1e3d; + case SpecificEnergyUnit.KilojoulePerKilogram: return (baseUnitValue) / 1e3d; + case SpecificEnergyUnit.KilowattHourPerKilogram: return (baseUnitValue/3.6e3) / 1e3d; + case SpecificEnergyUnit.MegajoulePerKilogram: return (baseUnitValue) / 1e6d; + case SpecificEnergyUnit.MegawattHourPerKilogram: return (baseUnitValue/3.6e3) / 1e6d; + case SpecificEnergyUnit.WattHourPerKilogram: return baseUnitValue/3.6e3; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs new file mode 100644 index 0000000000..e5b949a084 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -0,0 +1,712 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. + /// + public partial struct SpecificEntropy : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificEntropyUnit? _unit; + + static SpecificEntropy() + { + BaseDimensions = new BaseDimensions(2, 0, -2, 0, -1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public SpecificEntropy(double numericValue, SpecificEntropyUnit unit) + { + if(unit == SpecificEntropyUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificEntropy, which is JoulePerKilogramKelvin. All conversions go via this value. + /// + public static SpecificEntropyUnit BaseUnit => SpecificEntropyUnit.JoulePerKilogramKelvin; + + /// + /// Represents the largest possible value of SpecificEntropy + /// + public static SpecificEntropy MaxValue => new SpecificEntropy(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificEntropy + /// + public static SpecificEntropy MinValue => new SpecificEntropy(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificEntropy; + + /// + /// All units of measurement for the SpecificEntropy quantity. + /// + public static SpecificEntropyUnit[] Units { get; } = Enum.GetValues(typeof(SpecificEntropyUnit)).Cast().Except(new SpecificEntropyUnit[]{ SpecificEntropyUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerKilogramKelvin. + /// + public static SpecificEntropy Zero => new SpecificEntropy(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificEntropy.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificEntropy.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificEntropy in CaloriesPerGramKelvin. + /// + public double CaloriesPerGramKelvin => As(SpecificEntropyUnit.CaloriePerGramKelvin); + + /// + /// Get SpecificEntropy in JoulesPerKilogramDegreeCelsius. + /// + public double JoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); + + /// + /// Get SpecificEntropy in JoulesPerKilogramKelvin. + /// + public double JoulesPerKilogramKelvin => As(SpecificEntropyUnit.JoulePerKilogramKelvin); + + /// + /// Get SpecificEntropy in KilocaloriesPerGramKelvin. + /// + public double KilocaloriesPerGramKelvin => As(SpecificEntropyUnit.KilocaloriePerGramKelvin); + + /// + /// Get SpecificEntropy in KilojoulesPerKilogramDegreeCelsius. + /// + public double KilojoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); + + /// + /// Get SpecificEntropy in KilojoulesPerKilogramKelvin. + /// + public double KilojoulesPerKilogramKelvin => As(SpecificEntropyUnit.KilojoulePerKilogramKelvin); + + /// + /// Get SpecificEntropy in MegajoulesPerKilogramDegreeCelsius. + /// + public double MegajoulesPerKilogramDegreeCelsius => As(SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); + + /// + /// Get SpecificEntropy in MegajoulesPerKilogramKelvin. + /// + public double MegajoulesPerKilogramKelvin => As(SpecificEntropyUnit.MegajoulePerKilogramKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificEntropyUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(SpecificEntropyUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificEntropy from CaloriesPerGramKelvin. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromCaloriesPerGramKelvin(QuantityValue caloriespergramkelvin) + { + double value = (double) caloriespergramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.CaloriePerGramKelvin); + } + /// + /// Get SpecificEntropy from JoulesPerKilogramDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromJoulesPerKilogramDegreeCelsius(QuantityValue joulesperkilogramdegreecelsius) + { + double value = (double) joulesperkilogramdegreecelsius; + return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramDegreeCelsius); + } + /// + /// Get SpecificEntropy from JoulesPerKilogramKelvin. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromJoulesPerKilogramKelvin(QuantityValue joulesperkilogramkelvin) + { + double value = (double) joulesperkilogramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.JoulePerKilogramKelvin); + } + /// + /// Get SpecificEntropy from KilocaloriesPerGramKelvin. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromKilocaloriesPerGramKelvin(QuantityValue kilocaloriespergramkelvin) + { + double value = (double) kilocaloriespergramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.KilocaloriePerGramKelvin); + } + /// + /// Get SpecificEntropy from KilojoulesPerKilogramDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromKilojoulesPerKilogramDegreeCelsius(QuantityValue kilojoulesperkilogramdegreecelsius) + { + double value = (double) kilojoulesperkilogramdegreecelsius; + return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius); + } + /// + /// Get SpecificEntropy from KilojoulesPerKilogramKelvin. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromKilojoulesPerKilogramKelvin(QuantityValue kilojoulesperkilogramkelvin) + { + double value = (double) kilojoulesperkilogramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.KilojoulePerKilogramKelvin); + } + /// + /// Get SpecificEntropy from MegajoulesPerKilogramDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromMegajoulesPerKilogramDegreeCelsius(QuantityValue megajoulesperkilogramdegreecelsius) + { + double value = (double) megajoulesperkilogramdegreecelsius; + return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius); + } + /// + /// Get SpecificEntropy from MegajoulesPerKilogramKelvin. + /// + /// If value is NaN or Infinity. + public static SpecificEntropy FromMegajoulesPerKilogramKelvin(QuantityValue megajoulesperkilogramkelvin) + { + double value = (double) megajoulesperkilogramkelvin; + return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramKelvin); + } + + /// + /// 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 new SpecificEntropy((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificEntropy Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificEntropy Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificEntropy result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificEntropy result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificEntropyUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificEntropyUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificEntropyUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificEntropyUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); + + return CompareTo((SpecificEntropy)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(SpecificEntropy other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificEntropy within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificEntropy other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificEntropy. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificEntropyUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificEntropy to another SpecificEntropy with the unit representation . + /// + /// A SpecificEntropy with the specified unit. + public SpecificEntropy ToUnit(SpecificEntropyUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificEntropy(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificEntropyUnit.CaloriePerGramKelvin: return _value*4.184e3; + case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return _value; + case SpecificEntropyUnit.JoulePerKilogramKelvin: return _value; + case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (_value*4.184e3) * 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (_value) * 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (_value) * 1e3d; + case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (_value) * 1e6d; + case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificEntropyUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificEntropyUnit.CaloriePerGramKelvin: return baseUnitValue/4.184e3; + case SpecificEntropyUnit.JoulePerKilogramDegreeCelsius: return baseUnitValue; + case SpecificEntropyUnit.JoulePerKilogramKelvin: return baseUnitValue; + case SpecificEntropyUnit.KilocaloriePerGramKelvin: return (baseUnitValue/4.184e3) / 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius: return (baseUnitValue) / 1e3d; + case SpecificEntropyUnit.KilojoulePerKilogramKelvin: return (baseUnitValue) / 1e3d; + case SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius: return (baseUnitValue) / 1e6d; + case SpecificEntropyUnit.MegajoulePerKilogramKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs new file mode 100644 index 0000000000..fe365194bb --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -0,0 +1,616 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. + /// + public partial struct SpecificVolume : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificVolumeUnit? _unit; + + static SpecificVolume() + { + BaseDimensions = new BaseDimensions(3, -1, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public SpecificVolume(double numericValue, SpecificVolumeUnit unit) + { + if(unit == SpecificVolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificVolume, which is CubicMeterPerKilogram. All conversions go via this value. + /// + public static SpecificVolumeUnit BaseUnit => SpecificVolumeUnit.CubicMeterPerKilogram; + + /// + /// Represents the largest possible value of SpecificVolume + /// + public static SpecificVolume MaxValue => new SpecificVolume(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificVolume + /// + public static SpecificVolume MinValue => new SpecificVolume(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificVolume; + + /// + /// All units of measurement for the SpecificVolume quantity. + /// + public static SpecificVolumeUnit[] Units { get; } = Enum.GetValues(typeof(SpecificVolumeUnit)).Cast().Except(new SpecificVolumeUnit[]{ SpecificVolumeUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerKilogram. + /// + public static SpecificVolume Zero => new SpecificVolume(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificVolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificVolume.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificVolume.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificVolume in CubicFeetPerPound. + /// + public double CubicFeetPerPound => As(SpecificVolumeUnit.CubicFootPerPound); + + /// + /// Get SpecificVolume in CubicMetersPerKilogram. + /// + public double CubicMetersPerKilogram => As(SpecificVolumeUnit.CubicMeterPerKilogram); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificVolumeUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(SpecificVolumeUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificVolume from CubicFeetPerPound. + /// + /// If value is NaN or Infinity. + public static SpecificVolume FromCubicFeetPerPound(QuantityValue cubicfeetperpound) + { + double value = (double) cubicfeetperpound; + return new SpecificVolume(value, SpecificVolumeUnit.CubicFootPerPound); + } + /// + /// Get SpecificVolume from CubicMetersPerKilogram. + /// + /// If value is NaN or Infinity. + public static SpecificVolume FromCubicMetersPerKilogram(QuantityValue cubicmetersperkilogram) + { + double value = (double) cubicmetersperkilogram; + return new SpecificVolume(value, SpecificVolumeUnit.CubicMeterPerKilogram); + } + + /// + /// 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 new SpecificVolume((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificVolume Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificVolume Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificVolume result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificVolume result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificVolumeUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificVolumeUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificVolumeUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificVolumeUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); + + return CompareTo((SpecificVolume)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(SpecificVolume other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificVolume within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificVolume other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificVolume. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificVolumeUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificVolume to another SpecificVolume with the unit representation . + /// + /// A SpecificVolume with the specified unit. + public SpecificVolume ToUnit(SpecificVolumeUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificVolume(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificVolumeUnit.CubicFootPerPound: return _value/16.01846353; + case SpecificVolumeUnit.CubicMeterPerKilogram: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificVolumeUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificVolumeUnit.CubicFootPerPound: return baseUnitValue*16.01846353; + case SpecificVolumeUnit.CubicMeterPerKilogram: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs new file mode 100644 index 0000000000..9a751b0820 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -0,0 +1,859 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The SpecificWeight, or more precisely, the volumetric weight density, of a substance is its weight per unit volume. + /// + /// + /// http://en.wikipedia.org/wiki/Specificweight + /// + public partial struct SpecificWeight : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpecificWeightUnit? _unit; + + static SpecificWeight() + { + BaseDimensions = new BaseDimensions(-2, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public SpecificWeight(double numericValue, SpecificWeightUnit unit) + { + if(unit == SpecificWeightUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of SpecificWeight, which is NewtonPerCubicMeter. All conversions go via this value. + /// + public static SpecificWeightUnit BaseUnit => SpecificWeightUnit.NewtonPerCubicMeter; + + /// + /// Represents the largest possible value of SpecificWeight + /// + public static SpecificWeight MaxValue => new SpecificWeight(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of SpecificWeight + /// + public static SpecificWeight MinValue => new SpecificWeight(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.SpecificWeight; + + /// + /// All units of measurement for the SpecificWeight quantity. + /// + public static SpecificWeightUnit[] Units { get; } = Enum.GetValues(typeof(SpecificWeightUnit)).Cast().Except(new SpecificWeightUnit[]{ SpecificWeightUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonPerCubicMeter. + /// + public static SpecificWeight Zero => new SpecificWeight(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpecificWeightUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => SpecificWeight.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => SpecificWeight.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get SpecificWeight in KilogramsForcePerCubicCentimeter. + /// + public double KilogramsForcePerCubicCentimeter => As(SpecificWeightUnit.KilogramForcePerCubicCentimeter); + + /// + /// Get SpecificWeight in KilogramsForcePerCubicMeter. + /// + public double KilogramsForcePerCubicMeter => As(SpecificWeightUnit.KilogramForcePerCubicMeter); + + /// + /// Get SpecificWeight in KilogramsForcePerCubicMillimeter. + /// + public double KilogramsForcePerCubicMillimeter => As(SpecificWeightUnit.KilogramForcePerCubicMillimeter); + + /// + /// Get SpecificWeight in KilonewtonsPerCubicCentimeter. + /// + public double KilonewtonsPerCubicCentimeter => As(SpecificWeightUnit.KilonewtonPerCubicCentimeter); + + /// + /// Get SpecificWeight in KilonewtonsPerCubicMeter. + /// + public double KilonewtonsPerCubicMeter => As(SpecificWeightUnit.KilonewtonPerCubicMeter); + + /// + /// Get SpecificWeight in KilonewtonsPerCubicMillimeter. + /// + public double KilonewtonsPerCubicMillimeter => As(SpecificWeightUnit.KilonewtonPerCubicMillimeter); + + /// + /// Get SpecificWeight in KilopoundsForcePerCubicFoot. + /// + public double KilopoundsForcePerCubicFoot => As(SpecificWeightUnit.KilopoundForcePerCubicFoot); + + /// + /// Get SpecificWeight in KilopoundsForcePerCubicInch. + /// + public double KilopoundsForcePerCubicInch => As(SpecificWeightUnit.KilopoundForcePerCubicInch); + + /// + /// Get SpecificWeight in MeganewtonsPerCubicMeter. + /// + public double MeganewtonsPerCubicMeter => As(SpecificWeightUnit.MeganewtonPerCubicMeter); + + /// + /// Get SpecificWeight in NewtonsPerCubicCentimeter. + /// + public double NewtonsPerCubicCentimeter => As(SpecificWeightUnit.NewtonPerCubicCentimeter); + + /// + /// Get SpecificWeight in NewtonsPerCubicMeter. + /// + public double NewtonsPerCubicMeter => As(SpecificWeightUnit.NewtonPerCubicMeter); + + /// + /// Get SpecificWeight in NewtonsPerCubicMillimeter. + /// + public double NewtonsPerCubicMillimeter => As(SpecificWeightUnit.NewtonPerCubicMillimeter); + + /// + /// Get SpecificWeight in PoundsForcePerCubicFoot. + /// + public double PoundsForcePerCubicFoot => As(SpecificWeightUnit.PoundForcePerCubicFoot); + + /// + /// Get SpecificWeight in PoundsForcePerCubicInch. + /// + public double PoundsForcePerCubicInch => As(SpecificWeightUnit.PoundForcePerCubicInch); + + /// + /// Get SpecificWeight in TonnesForcePerCubicCentimeter. + /// + public double TonnesForcePerCubicCentimeter => As(SpecificWeightUnit.TonneForcePerCubicCentimeter); + + /// + /// Get SpecificWeight in TonnesForcePerCubicMeter. + /// + public double TonnesForcePerCubicMeter => As(SpecificWeightUnit.TonneForcePerCubicMeter); + + /// + /// Get SpecificWeight in TonnesForcePerCubicMillimeter. + /// + public double TonnesForcePerCubicMillimeter => As(SpecificWeightUnit.TonneForcePerCubicMillimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpecificWeightUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(SpecificWeightUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get SpecificWeight from KilogramsForcePerCubicCentimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilogramsForcePerCubicCentimeter(QuantityValue kilogramsforcepercubiccentimeter) + { + double value = (double) kilogramsforcepercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicCentimeter); + } + /// + /// Get SpecificWeight from KilogramsForcePerCubicMeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilogramsForcePerCubicMeter(QuantityValue kilogramsforcepercubicmeter) + { + double value = (double) kilogramsforcepercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMeter); + } + /// + /// Get SpecificWeight from KilogramsForcePerCubicMillimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilogramsForcePerCubicMillimeter(QuantityValue kilogramsforcepercubicmillimeter) + { + double value = (double) kilogramsforcepercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilogramForcePerCubicMillimeter); + } + /// + /// Get SpecificWeight from KilonewtonsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilonewtonsPerCubicCentimeter(QuantityValue kilonewtonspercubiccentimeter) + { + double value = (double) kilonewtonspercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicCentimeter); + } + /// + /// Get SpecificWeight from KilonewtonsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilonewtonsPerCubicMeter(QuantityValue kilonewtonspercubicmeter) + { + double value = (double) kilonewtonspercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMeter); + } + /// + /// Get SpecificWeight from KilonewtonsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilonewtonsPerCubicMillimeter(QuantityValue kilonewtonspercubicmillimeter) + { + double value = (double) kilonewtonspercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.KilonewtonPerCubicMillimeter); + } + /// + /// Get SpecificWeight from KilopoundsForcePerCubicFoot. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilopoundsForcePerCubicFoot(QuantityValue kilopoundsforcepercubicfoot) + { + double value = (double) kilopoundsforcepercubicfoot; + return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicFoot); + } + /// + /// Get SpecificWeight from KilopoundsForcePerCubicInch. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromKilopoundsForcePerCubicInch(QuantityValue kilopoundsforcepercubicinch) + { + double value = (double) kilopoundsforcepercubicinch; + return new SpecificWeight(value, SpecificWeightUnit.KilopoundForcePerCubicInch); + } + /// + /// Get SpecificWeight from MeganewtonsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromMeganewtonsPerCubicMeter(QuantityValue meganewtonspercubicmeter) + { + double value = (double) meganewtonspercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.MeganewtonPerCubicMeter); + } + /// + /// Get SpecificWeight from NewtonsPerCubicCentimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromNewtonsPerCubicCentimeter(QuantityValue newtonspercubiccentimeter) + { + double value = (double) newtonspercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicCentimeter); + } + /// + /// Get SpecificWeight from NewtonsPerCubicMeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromNewtonsPerCubicMeter(QuantityValue newtonspercubicmeter) + { + double value = (double) newtonspercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMeter); + } + /// + /// Get SpecificWeight from NewtonsPerCubicMillimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromNewtonsPerCubicMillimeter(QuantityValue newtonspercubicmillimeter) + { + double value = (double) newtonspercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.NewtonPerCubicMillimeter); + } + /// + /// Get SpecificWeight from PoundsForcePerCubicFoot. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromPoundsForcePerCubicFoot(QuantityValue poundsforcepercubicfoot) + { + double value = (double) poundsforcepercubicfoot; + return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicFoot); + } + /// + /// Get SpecificWeight from PoundsForcePerCubicInch. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromPoundsForcePerCubicInch(QuantityValue poundsforcepercubicinch) + { + double value = (double) poundsforcepercubicinch; + return new SpecificWeight(value, SpecificWeightUnit.PoundForcePerCubicInch); + } + /// + /// Get SpecificWeight from TonnesForcePerCubicCentimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromTonnesForcePerCubicCentimeter(QuantityValue tonnesforcepercubiccentimeter) + { + double value = (double) tonnesforcepercubiccentimeter; + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicCentimeter); + } + /// + /// Get SpecificWeight from TonnesForcePerCubicMeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromTonnesForcePerCubicMeter(QuantityValue tonnesforcepercubicmeter) + { + double value = (double) tonnesforcepercubicmeter; + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMeter); + } + /// + /// Get SpecificWeight from TonnesForcePerCubicMillimeter. + /// + /// If value is NaN or Infinity. + public static SpecificWeight FromTonnesForcePerCubicMillimeter(QuantityValue tonnesforcepercubicmillimeter) + { + double value = (double) tonnesforcepercubicmillimeter; + return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMillimeter); + } + + /// + /// 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 new SpecificWeight((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static SpecificWeight Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificWeight Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out SpecificWeight result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out SpecificWeight result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpecificWeightUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static SpecificWeightUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpecificWeightUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out SpecificWeightUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is SpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); + + return CompareTo((SpecificWeight)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(SpecificWeight other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another SpecificWeight within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(SpecificWeight other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current SpecificWeight. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpecificWeightUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this SpecificWeight to another SpecificWeight with the unit representation . + /// + /// A SpecificWeight with the specified unit. + public SpecificWeight ToUnit(SpecificWeightUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new SpecificWeight(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return _value*9.80665e6; + case SpecificWeightUnit.KilogramForcePerCubicMeter: return _value*9.80665; + case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return _value*9.80665e9; + case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (_value*1000000) * 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMeter: return (_value) * 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (_value*1000000000) * 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (_value*1.570874638462462e2) * 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicInch: return (_value*2.714471375263134e5) * 1e3d; + case SpecificWeightUnit.MeganewtonPerCubicMeter: return (_value) * 1e6d; + case SpecificWeightUnit.NewtonPerCubicCentimeter: return _value*1000000; + case SpecificWeightUnit.NewtonPerCubicMeter: return _value; + case SpecificWeightUnit.NewtonPerCubicMillimeter: return _value*1000000000; + case SpecificWeightUnit.PoundForcePerCubicFoot: return _value*1.570874638462462e2; + case SpecificWeightUnit.PoundForcePerCubicInch: return _value*2.714471375263134e5; + case SpecificWeightUnit.TonneForcePerCubicCentimeter: return _value*9.80665e9; + case SpecificWeightUnit.TonneForcePerCubicMeter: return _value*9.80665e3; + case SpecificWeightUnit.TonneForcePerCubicMillimeter: return _value*9.80665e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpecificWeightUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpecificWeightUnit.KilogramForcePerCubicCentimeter: return baseUnitValue/9.80665e6; + case SpecificWeightUnit.KilogramForcePerCubicMeter: return baseUnitValue/9.80665; + case SpecificWeightUnit.KilogramForcePerCubicMillimeter: return baseUnitValue/9.80665e9; + case SpecificWeightUnit.KilonewtonPerCubicCentimeter: return (baseUnitValue*0.000001) / 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMeter: return (baseUnitValue) / 1e3d; + case SpecificWeightUnit.KilonewtonPerCubicMillimeter: return (baseUnitValue*0.000000001) / 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicFoot: return (baseUnitValue/1.570874638462462e2) / 1e3d; + case SpecificWeightUnit.KilopoundForcePerCubicInch: return (baseUnitValue/2.714471375263134e5) / 1e3d; + case SpecificWeightUnit.MeganewtonPerCubicMeter: return (baseUnitValue) / 1e6d; + case SpecificWeightUnit.NewtonPerCubicCentimeter: return baseUnitValue*0.000001; + case SpecificWeightUnit.NewtonPerCubicMeter: return baseUnitValue; + case SpecificWeightUnit.NewtonPerCubicMillimeter: return baseUnitValue*0.000000001; + case SpecificWeightUnit.PoundForcePerCubicFoot: return baseUnitValue/1.570874638462462e2; + case SpecificWeightUnit.PoundForcePerCubicInch: return baseUnitValue/2.714471375263134e5; + case SpecificWeightUnit.TonneForcePerCubicCentimeter: return baseUnitValue/9.80665e9; + case SpecificWeightUnit.TonneForcePerCubicMeter: return baseUnitValue/9.80665e3; + case SpecificWeightUnit.TonneForcePerCubicMillimeter: return baseUnitValue/9.80665e12; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs new file mode 100644 index 0000000000..319cd59327 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -0,0 +1,1096 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. + /// + public partial struct Speed : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly SpeedUnit? _unit; + + static Speed() + { + BaseDimensions = new BaseDimensions(1, 0, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Speed(double numericValue, SpeedUnit unit) + { + if(unit == SpeedUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Speed, which is MeterPerSecond. All conversions go via this value. + /// + public static SpeedUnit BaseUnit => SpeedUnit.MeterPerSecond; + + /// + /// Represents the largest possible value of Speed + /// + public static Speed MaxValue => new Speed(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Speed + /// + public static Speed MinValue => new Speed(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Speed; + + /// + /// All units of measurement for the Speed quantity. + /// + public static SpeedUnit[] Units { get; } = Enum.GetValues(typeof(SpeedUnit)).Cast().Except(new SpeedUnit[]{ SpeedUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit MeterPerSecond. + /// + public static Speed Zero => new Speed(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public SpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Speed.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Speed.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Speed in CentimetersPerHour. + /// + public double CentimetersPerHour => As(SpeedUnit.CentimeterPerHour); + + /// + /// Get Speed in CentimetersPerMinutes. + /// + public double CentimetersPerMinutes => As(SpeedUnit.CentimeterPerMinute); + + /// + /// Get Speed in CentimetersPerSecond. + /// + public double CentimetersPerSecond => As(SpeedUnit.CentimeterPerSecond); + + /// + /// Get Speed in DecimetersPerMinutes. + /// + public double DecimetersPerMinutes => As(SpeedUnit.DecimeterPerMinute); + + /// + /// Get Speed in DecimetersPerSecond. + /// + public double DecimetersPerSecond => As(SpeedUnit.DecimeterPerSecond); + + /// + /// Get Speed in FeetPerHour. + /// + public double FeetPerHour => As(SpeedUnit.FootPerHour); + + /// + /// Get Speed in FeetPerMinute. + /// + public double FeetPerMinute => As(SpeedUnit.FootPerMinute); + + /// + /// Get Speed in FeetPerSecond. + /// + public double FeetPerSecond => As(SpeedUnit.FootPerSecond); + + /// + /// Get Speed in InchesPerHour. + /// + public double InchesPerHour => As(SpeedUnit.InchPerHour); + + /// + /// Get Speed in InchesPerMinute. + /// + public double InchesPerMinute => As(SpeedUnit.InchPerMinute); + + /// + /// Get Speed in InchesPerSecond. + /// + public double InchesPerSecond => As(SpeedUnit.InchPerSecond); + + /// + /// Get Speed in KilometersPerHour. + /// + public double KilometersPerHour => As(SpeedUnit.KilometerPerHour); + + /// + /// Get Speed in KilometersPerMinutes. + /// + public double KilometersPerMinutes => As(SpeedUnit.KilometerPerMinute); + + /// + /// Get Speed in KilometersPerSecond. + /// + public double KilometersPerSecond => As(SpeedUnit.KilometerPerSecond); + + /// + /// Get Speed in Knots. + /// + public double Knots => As(SpeedUnit.Knot); + + /// + /// Get Speed in MetersPerHour. + /// + public double MetersPerHour => As(SpeedUnit.MeterPerHour); + + /// + /// Get Speed in MetersPerMinutes. + /// + public double MetersPerMinutes => As(SpeedUnit.MeterPerMinute); + + /// + /// Get Speed in MetersPerSecond. + /// + public double MetersPerSecond => As(SpeedUnit.MeterPerSecond); + + /// + /// Get Speed in MicrometersPerMinutes. + /// + public double MicrometersPerMinutes => As(SpeedUnit.MicrometerPerMinute); + + /// + /// Get Speed in MicrometersPerSecond. + /// + public double MicrometersPerSecond => As(SpeedUnit.MicrometerPerSecond); + + /// + /// Get Speed in MilesPerHour. + /// + public double MilesPerHour => As(SpeedUnit.MilePerHour); + + /// + /// Get Speed in MillimetersPerHour. + /// + public double MillimetersPerHour => As(SpeedUnit.MillimeterPerHour); + + /// + /// Get Speed in MillimetersPerMinutes. + /// + public double MillimetersPerMinutes => As(SpeedUnit.MillimeterPerMinute); + + /// + /// Get Speed in MillimetersPerSecond. + /// + public double MillimetersPerSecond => As(SpeedUnit.MillimeterPerSecond); + + /// + /// Get Speed in NanometersPerMinutes. + /// + public double NanometersPerMinutes => As(SpeedUnit.NanometerPerMinute); + + /// + /// Get Speed in NanometersPerSecond. + /// + public double NanometersPerSecond => As(SpeedUnit.NanometerPerSecond); + + /// + /// Get Speed in UsSurveyFeetPerHour. + /// + public double UsSurveyFeetPerHour => As(SpeedUnit.UsSurveyFootPerHour); + + /// + /// Get Speed in UsSurveyFeetPerMinute. + /// + public double UsSurveyFeetPerMinute => As(SpeedUnit.UsSurveyFootPerMinute); + + /// + /// Get Speed in UsSurveyFeetPerSecond. + /// + public double UsSurveyFeetPerSecond => As(SpeedUnit.UsSurveyFootPerSecond); + + /// + /// Get Speed in YardsPerHour. + /// + public double YardsPerHour => As(SpeedUnit.YardPerHour); + + /// + /// Get Speed in YardsPerMinute. + /// + public double YardsPerMinute => As(SpeedUnit.YardPerMinute); + + /// + /// Get Speed in YardsPerSecond. + /// + public double YardsPerSecond => As(SpeedUnit.YardPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(SpeedUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(SpeedUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Speed from CentimetersPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromCentimetersPerHour(QuantityValue centimetersperhour) + { + double value = (double) centimetersperhour; + return new Speed(value, SpeedUnit.CentimeterPerHour); + } + /// + /// Get Speed from CentimetersPerMinutes. + /// + /// If value is NaN or Infinity. + public static Speed FromCentimetersPerMinutes(QuantityValue centimetersperminutes) + { + double value = (double) centimetersperminutes; + return new Speed(value, SpeedUnit.CentimeterPerMinute); + } + /// + /// Get Speed from CentimetersPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromCentimetersPerSecond(QuantityValue centimeterspersecond) + { + double value = (double) centimeterspersecond; + return new Speed(value, SpeedUnit.CentimeterPerSecond); + } + /// + /// Get Speed from DecimetersPerMinutes. + /// + /// If value is NaN or Infinity. + public static Speed FromDecimetersPerMinutes(QuantityValue decimetersperminutes) + { + double value = (double) decimetersperminutes; + return new Speed(value, SpeedUnit.DecimeterPerMinute); + } + /// + /// Get Speed from DecimetersPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromDecimetersPerSecond(QuantityValue decimeterspersecond) + { + double value = (double) decimeterspersecond; + return new Speed(value, SpeedUnit.DecimeterPerSecond); + } + /// + /// Get Speed from FeetPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromFeetPerHour(QuantityValue feetperhour) + { + double value = (double) feetperhour; + return new Speed(value, SpeedUnit.FootPerHour); + } + /// + /// Get Speed from FeetPerMinute. + /// + /// If value is NaN or Infinity. + public static Speed FromFeetPerMinute(QuantityValue feetperminute) + { + double value = (double) feetperminute; + return new Speed(value, SpeedUnit.FootPerMinute); + } + /// + /// Get Speed from FeetPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromFeetPerSecond(QuantityValue feetpersecond) + { + double value = (double) feetpersecond; + return new Speed(value, SpeedUnit.FootPerSecond); + } + /// + /// Get Speed from InchesPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromInchesPerHour(QuantityValue inchesperhour) + { + double value = (double) inchesperhour; + return new Speed(value, SpeedUnit.InchPerHour); + } + /// + /// Get Speed from InchesPerMinute. + /// + /// If value is NaN or Infinity. + public static Speed FromInchesPerMinute(QuantityValue inchesperminute) + { + double value = (double) inchesperminute; + return new Speed(value, SpeedUnit.InchPerMinute); + } + /// + /// Get Speed from InchesPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromInchesPerSecond(QuantityValue inchespersecond) + { + double value = (double) inchespersecond; + return new Speed(value, SpeedUnit.InchPerSecond); + } + /// + /// Get Speed from KilometersPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromKilometersPerHour(QuantityValue kilometersperhour) + { + double value = (double) kilometersperhour; + return new Speed(value, SpeedUnit.KilometerPerHour); + } + /// + /// Get Speed from KilometersPerMinutes. + /// + /// If value is NaN or Infinity. + public static Speed FromKilometersPerMinutes(QuantityValue kilometersperminutes) + { + double value = (double) kilometersperminutes; + return new Speed(value, SpeedUnit.KilometerPerMinute); + } + /// + /// Get Speed from KilometersPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromKilometersPerSecond(QuantityValue kilometerspersecond) + { + double value = (double) kilometerspersecond; + return new Speed(value, SpeedUnit.KilometerPerSecond); + } + /// + /// Get Speed from Knots. + /// + /// If value is NaN or Infinity. + public static Speed FromKnots(QuantityValue knots) + { + double value = (double) knots; + return new Speed(value, SpeedUnit.Knot); + } + /// + /// Get Speed from MetersPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromMetersPerHour(QuantityValue metersperhour) + { + double value = (double) metersperhour; + return new Speed(value, SpeedUnit.MeterPerHour); + } + /// + /// Get Speed from MetersPerMinutes. + /// + /// If value is NaN or Infinity. + public static Speed FromMetersPerMinutes(QuantityValue metersperminutes) + { + double value = (double) metersperminutes; + return new Speed(value, SpeedUnit.MeterPerMinute); + } + /// + /// Get Speed from MetersPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromMetersPerSecond(QuantityValue meterspersecond) + { + double value = (double) meterspersecond; + return new Speed(value, SpeedUnit.MeterPerSecond); + } + /// + /// Get Speed from MicrometersPerMinutes. + /// + /// If value is NaN or Infinity. + public static Speed FromMicrometersPerMinutes(QuantityValue micrometersperminutes) + { + double value = (double) micrometersperminutes; + return new Speed(value, SpeedUnit.MicrometerPerMinute); + } + /// + /// Get Speed from MicrometersPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromMicrometersPerSecond(QuantityValue micrometerspersecond) + { + double value = (double) micrometerspersecond; + return new Speed(value, SpeedUnit.MicrometerPerSecond); + } + /// + /// Get Speed from MilesPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromMilesPerHour(QuantityValue milesperhour) + { + double value = (double) milesperhour; + return new Speed(value, SpeedUnit.MilePerHour); + } + /// + /// Get Speed from MillimetersPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromMillimetersPerHour(QuantityValue millimetersperhour) + { + double value = (double) millimetersperhour; + return new Speed(value, SpeedUnit.MillimeterPerHour); + } + /// + /// Get Speed from MillimetersPerMinutes. + /// + /// If value is NaN or Infinity. + public static Speed FromMillimetersPerMinutes(QuantityValue millimetersperminutes) + { + double value = (double) millimetersperminutes; + return new Speed(value, SpeedUnit.MillimeterPerMinute); + } + /// + /// Get Speed from MillimetersPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromMillimetersPerSecond(QuantityValue millimeterspersecond) + { + double value = (double) millimeterspersecond; + return new Speed(value, SpeedUnit.MillimeterPerSecond); + } + /// + /// Get Speed from NanometersPerMinutes. + /// + /// If value is NaN or Infinity. + public static Speed FromNanometersPerMinutes(QuantityValue nanometersperminutes) + { + double value = (double) nanometersperminutes; + return new Speed(value, SpeedUnit.NanometerPerMinute); + } + /// + /// Get Speed from NanometersPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromNanometersPerSecond(QuantityValue nanometerspersecond) + { + double value = (double) nanometerspersecond; + return new Speed(value, SpeedUnit.NanometerPerSecond); + } + /// + /// Get Speed from UsSurveyFeetPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromUsSurveyFeetPerHour(QuantityValue ussurveyfeetperhour) + { + double value = (double) ussurveyfeetperhour; + return new Speed(value, SpeedUnit.UsSurveyFootPerHour); + } + /// + /// Get Speed from UsSurveyFeetPerMinute. + /// + /// If value is NaN or Infinity. + public static Speed FromUsSurveyFeetPerMinute(QuantityValue ussurveyfeetperminute) + { + double value = (double) ussurveyfeetperminute; + return new Speed(value, SpeedUnit.UsSurveyFootPerMinute); + } + /// + /// Get Speed from UsSurveyFeetPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromUsSurveyFeetPerSecond(QuantityValue ussurveyfeetpersecond) + { + double value = (double) ussurveyfeetpersecond; + return new Speed(value, SpeedUnit.UsSurveyFootPerSecond); + } + /// + /// Get Speed from YardsPerHour. + /// + /// If value is NaN or Infinity. + public static Speed FromYardsPerHour(QuantityValue yardsperhour) + { + double value = (double) yardsperhour; + return new Speed(value, SpeedUnit.YardPerHour); + } + /// + /// Get Speed from YardsPerMinute. + /// + /// If value is NaN or Infinity. + public static Speed FromYardsPerMinute(QuantityValue yardsperminute) + { + double value = (double) yardsperminute; + return new Speed(value, SpeedUnit.YardPerMinute); + } + /// + /// Get Speed from YardsPerSecond. + /// + /// If value is NaN or Infinity. + public static Speed FromYardsPerSecond(QuantityValue yardspersecond) + { + double value = (double) yardspersecond; + return new Speed(value, SpeedUnit.YardPerSecond); + } + + /// + /// 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 new Speed((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Speed Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Speed Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Speed result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Speed result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static SpeedUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static SpeedUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out SpeedUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Speed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); + + return CompareTo((Speed)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Speed other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Speed within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Speed. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(SpeedUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Speed to another Speed with the unit representation . + /// + /// A Speed with the specified unit. + public Speed ToUnit(SpeedUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Speed(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case SpeedUnit.CentimeterPerHour: return (_value/3600) * 1e-2d; + case SpeedUnit.CentimeterPerMinute: return (_value/60) * 1e-2d; + case SpeedUnit.CentimeterPerSecond: return (_value) * 1e-2d; + case SpeedUnit.DecimeterPerMinute: return (_value/60) * 1e-1d; + case SpeedUnit.DecimeterPerSecond: return (_value) * 1e-1d; + case SpeedUnit.FootPerHour: return _value*0.3048/3600; + case SpeedUnit.FootPerMinute: return _value*0.3048/60; + case SpeedUnit.FootPerSecond: return _value*0.3048; + case SpeedUnit.InchPerHour: return (_value/3600)*2.54e-2; + case SpeedUnit.InchPerMinute: return (_value/60)*2.54e-2; + case SpeedUnit.InchPerSecond: return _value*2.54e-2; + case SpeedUnit.KilometerPerHour: return (_value/3600) * 1e3d; + case SpeedUnit.KilometerPerMinute: return (_value/60) * 1e3d; + case SpeedUnit.KilometerPerSecond: return (_value) * 1e3d; + case SpeedUnit.Knot: return _value*0.514444; + case SpeedUnit.MeterPerHour: return _value/3600; + case SpeedUnit.MeterPerMinute: return _value/60; + case SpeedUnit.MeterPerSecond: return _value; + case SpeedUnit.MicrometerPerMinute: return (_value/60) * 1e-6d; + case SpeedUnit.MicrometerPerSecond: return (_value) * 1e-6d; + case SpeedUnit.MilePerHour: return _value*0.44704; + case SpeedUnit.MillimeterPerHour: return (_value/3600) * 1e-3d; + case SpeedUnit.MillimeterPerMinute: return (_value/60) * 1e-3d; + case SpeedUnit.MillimeterPerSecond: return (_value) * 1e-3d; + case SpeedUnit.NanometerPerMinute: return (_value/60) * 1e-9d; + case SpeedUnit.NanometerPerSecond: return (_value) * 1e-9d; + case SpeedUnit.UsSurveyFootPerHour: return (_value*1200/3937)/3600; + case SpeedUnit.UsSurveyFootPerMinute: return (_value*1200/3937)/60; + case SpeedUnit.UsSurveyFootPerSecond: return _value*1200/3937; + case SpeedUnit.YardPerHour: return _value*0.9144/3600; + case SpeedUnit.YardPerMinute: return _value*0.9144/60; + case SpeedUnit.YardPerSecond: return _value*0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(SpeedUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case SpeedUnit.CentimeterPerHour: return (baseUnitValue*3600) / 1e-2d; + case SpeedUnit.CentimeterPerMinute: return (baseUnitValue*60) / 1e-2d; + case SpeedUnit.CentimeterPerSecond: return (baseUnitValue) / 1e-2d; + case SpeedUnit.DecimeterPerMinute: return (baseUnitValue*60) / 1e-1d; + case SpeedUnit.DecimeterPerSecond: return (baseUnitValue) / 1e-1d; + case SpeedUnit.FootPerHour: return baseUnitValue/0.3048*3600; + case SpeedUnit.FootPerMinute: return baseUnitValue/0.3048*60; + case SpeedUnit.FootPerSecond: return baseUnitValue/0.3048; + case SpeedUnit.InchPerHour: return (baseUnitValue/2.54e-2)*3600; + case SpeedUnit.InchPerMinute: return (baseUnitValue/2.54e-2)*60; + case SpeedUnit.InchPerSecond: return baseUnitValue/2.54e-2; + case SpeedUnit.KilometerPerHour: return (baseUnitValue*3600) / 1e3d; + case SpeedUnit.KilometerPerMinute: return (baseUnitValue*60) / 1e3d; + case SpeedUnit.KilometerPerSecond: return (baseUnitValue) / 1e3d; + case SpeedUnit.Knot: return baseUnitValue/0.514444; + case SpeedUnit.MeterPerHour: return baseUnitValue*3600; + case SpeedUnit.MeterPerMinute: return baseUnitValue*60; + case SpeedUnit.MeterPerSecond: return baseUnitValue; + case SpeedUnit.MicrometerPerMinute: return (baseUnitValue*60) / 1e-6d; + case SpeedUnit.MicrometerPerSecond: return (baseUnitValue) / 1e-6d; + case SpeedUnit.MilePerHour: return baseUnitValue/0.44704; + case SpeedUnit.MillimeterPerHour: return (baseUnitValue*3600) / 1e-3d; + case SpeedUnit.MillimeterPerMinute: return (baseUnitValue*60) / 1e-3d; + case SpeedUnit.MillimeterPerSecond: return (baseUnitValue) / 1e-3d; + case SpeedUnit.NanometerPerMinute: return (baseUnitValue*60) / 1e-9d; + case SpeedUnit.NanometerPerSecond: return (baseUnitValue) / 1e-9d; + case SpeedUnit.UsSurveyFootPerHour: return (baseUnitValue*3937/1200)*3600; + case SpeedUnit.UsSurveyFootPerMinute: return (baseUnitValue*3937/1200)*60; + case SpeedUnit.UsSurveyFootPerSecond: return baseUnitValue*3937/1200; + case SpeedUnit.YardPerHour: return baseUnitValue/0.9144*3600; + case SpeedUnit.YardPerMinute: return baseUnitValue/0.9144*60; + case SpeedUnit.YardPerSecond: return baseUnitValue/0.9144; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs new file mode 100644 index 0000000000..354a364071 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -0,0 +1,673 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. + /// + public partial struct Temperature : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TemperatureUnit? _unit; + + static Temperature() + { + BaseDimensions = new BaseDimensions(0, 0, 0, 0, 1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Temperature(double numericValue, TemperatureUnit unit) + { + if(unit == TemperatureUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Temperature, which is Kelvin. All conversions go via this value. + /// + public static TemperatureUnit BaseUnit => TemperatureUnit.Kelvin; + + /// + /// Represents the largest possible value of Temperature + /// + public static Temperature MaxValue => new Temperature(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Temperature + /// + public static Temperature MinValue => new Temperature(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Temperature; + + /// + /// All units of measurement for the Temperature quantity. + /// + public static TemperatureUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureUnit)).Cast().Except(new TemperatureUnit[]{ TemperatureUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. + /// + public static Temperature Zero => new Temperature(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TemperatureUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Temperature.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Temperature.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Temperature in DegreesCelsius. + /// + public double DegreesCelsius => As(TemperatureUnit.DegreeCelsius); + + /// + /// Get Temperature in DegreesDelisle. + /// + public double DegreesDelisle => As(TemperatureUnit.DegreeDelisle); + + /// + /// Get Temperature in DegreesFahrenheit. + /// + public double DegreesFahrenheit => As(TemperatureUnit.DegreeFahrenheit); + + /// + /// Get Temperature in DegreesNewton. + /// + public double DegreesNewton => As(TemperatureUnit.DegreeNewton); + + /// + /// Get Temperature in DegreesRankine. + /// + public double DegreesRankine => As(TemperatureUnit.DegreeRankine); + + /// + /// Get Temperature in DegreesReaumur. + /// + public double DegreesReaumur => As(TemperatureUnit.DegreeReaumur); + + /// + /// Get Temperature in DegreesRoemer. + /// + public double DegreesRoemer => As(TemperatureUnit.DegreeRoemer); + + /// + /// Get Temperature in Kelvins. + /// + public double Kelvins => As(TemperatureUnit.Kelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TemperatureUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(TemperatureUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Temperature from DegreesCelsius. + /// + /// If value is NaN or Infinity. + public static Temperature FromDegreesCelsius(QuantityValue degreescelsius) + { + double value = (double) degreescelsius; + return new Temperature(value, TemperatureUnit.DegreeCelsius); + } + /// + /// Get Temperature from DegreesDelisle. + /// + /// If value is NaN or Infinity. + public static Temperature FromDegreesDelisle(QuantityValue degreesdelisle) + { + double value = (double) degreesdelisle; + return new Temperature(value, TemperatureUnit.DegreeDelisle); + } + /// + /// Get Temperature from DegreesFahrenheit. + /// + /// If value is NaN or Infinity. + public static Temperature FromDegreesFahrenheit(QuantityValue degreesfahrenheit) + { + double value = (double) degreesfahrenheit; + return new Temperature(value, TemperatureUnit.DegreeFahrenheit); + } + /// + /// Get Temperature from DegreesNewton. + /// + /// If value is NaN or Infinity. + public static Temperature FromDegreesNewton(QuantityValue degreesnewton) + { + double value = (double) degreesnewton; + return new Temperature(value, TemperatureUnit.DegreeNewton); + } + /// + /// Get Temperature from DegreesRankine. + /// + /// If value is NaN or Infinity. + public static Temperature FromDegreesRankine(QuantityValue degreesrankine) + { + double value = (double) degreesrankine; + return new Temperature(value, TemperatureUnit.DegreeRankine); + } + /// + /// Get Temperature from DegreesReaumur. + /// + /// If value is NaN or Infinity. + public static Temperature FromDegreesReaumur(QuantityValue degreesreaumur) + { + double value = (double) degreesreaumur; + return new Temperature(value, TemperatureUnit.DegreeReaumur); + } + /// + /// Get Temperature from DegreesRoemer. + /// + /// If value is NaN or Infinity. + public static Temperature FromDegreesRoemer(QuantityValue degreesroemer) + { + double value = (double) degreesroemer; + return new Temperature(value, TemperatureUnit.DegreeRoemer); + } + /// + /// Get Temperature from Kelvins. + /// + /// If value is NaN or Infinity. + public static Temperature FromKelvins(QuantityValue kelvins) + { + double value = (double) kelvins; + return new Temperature(value, TemperatureUnit.Kelvin); + } + + /// + /// 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 new Temperature((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Temperature Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Temperature Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Temperature result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Temperature result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static TemperatureUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TemperatureUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Temperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); + + return CompareTo((Temperature)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Temperature other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Temperature within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Temperature other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Temperature. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TemperatureUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Temperature to another Temperature with the unit representation . + /// + /// A Temperature with the specified unit. + public Temperature ToUnit(TemperatureUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Temperature(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TemperatureUnit.DegreeCelsius: return _value + 273.15; + case TemperatureUnit.DegreeDelisle: return _value*-2/3 + 373.15; + case TemperatureUnit.DegreeFahrenheit: return _value*5/9 + 459.67*5/9; + case TemperatureUnit.DegreeNewton: return _value*100/33 + 273.15; + case TemperatureUnit.DegreeRankine: return _value*5/9; + case TemperatureUnit.DegreeReaumur: return _value*5/4 + 273.15; + case TemperatureUnit.DegreeRoemer: return _value*40/21 + 273.15 - 7.5*40d/21; + case TemperatureUnit.Kelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TemperatureUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TemperatureUnit.DegreeCelsius: return baseUnitValue - 273.15; + case TemperatureUnit.DegreeDelisle: return (baseUnitValue - 373.15)*-3/2; + case TemperatureUnit.DegreeFahrenheit: return (baseUnitValue - 459.67*5/9)*9/5; + case TemperatureUnit.DegreeNewton: return (baseUnitValue - 273.15)*33/100; + case TemperatureUnit.DegreeRankine: return baseUnitValue*9/5; + case TemperatureUnit.DegreeReaumur: return (baseUnitValue - 273.15)*4/5; + case TemperatureUnit.DegreeRoemer: return (baseUnitValue - (273.15 - 7.5*40d/21))*21/40; + case TemperatureUnit.Kelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs new file mode 100644 index 0000000000..b9bb26d9ed --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -0,0 +1,744 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). + /// + public partial struct TemperatureChangeRate : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TemperatureChangeRateUnit? _unit; + + static TemperatureChangeRate() + { + BaseDimensions = new BaseDimensions(0, 0, -1, 0, 1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public TemperatureChangeRate(double numericValue, TemperatureChangeRateUnit unit) + { + if(unit == TemperatureChangeRateUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of TemperatureChangeRate, which is DegreeCelsiusPerSecond. All conversions go via this value. + /// + public static TemperatureChangeRateUnit BaseUnit => TemperatureChangeRateUnit.DegreeCelsiusPerSecond; + + /// + /// Represents the largest possible value of TemperatureChangeRate + /// + public static TemperatureChangeRate MaxValue => new TemperatureChangeRate(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of TemperatureChangeRate + /// + public static TemperatureChangeRate MinValue => new TemperatureChangeRate(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.TemperatureChangeRate; + + /// + /// All units of measurement for the TemperatureChangeRate quantity. + /// + public static TemperatureChangeRateUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureChangeRateUnit)).Cast().Except(new TemperatureChangeRateUnit[]{ TemperatureChangeRateUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit DegreeCelsiusPerSecond. + /// + public static TemperatureChangeRate Zero => new TemperatureChangeRate(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TemperatureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => TemperatureChangeRate.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => TemperatureChangeRate.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get TemperatureChangeRate in CentidegreesCelsiusPerSecond. + /// + public double CentidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in DecadegreesCelsiusPerSecond. + /// + public double DecadegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in DecidegreesCelsiusPerSecond. + /// + public double DecidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in DegreesCelsiusPerMinute. + /// + public double DegreesCelsiusPerMinute => As(TemperatureChangeRateUnit.DegreeCelsiusPerMinute); + + /// + /// Get TemperatureChangeRate in DegreesCelsiusPerSecond. + /// + public double DegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.DegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in HectodegreesCelsiusPerSecond. + /// + public double HectodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in KilodegreesCelsiusPerSecond. + /// + public double KilodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in MicrodegreesCelsiusPerSecond. + /// + public double MicrodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in MillidegreesCelsiusPerSecond. + /// + public double MillidegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); + + /// + /// Get TemperatureChangeRate in NanodegreesCelsiusPerSecond. + /// + public double NanodegreesCelsiusPerSecond => As(TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TemperatureChangeRateUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(TemperatureChangeRateUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get TemperatureChangeRate from CentidegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromCentidegreesCelsiusPerSecond(QuantityValue centidegreescelsiuspersecond) + { + double value = (double) centidegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from DecadegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromDecadegreesCelsiusPerSecond(QuantityValue decadegreescelsiuspersecond) + { + double value = (double) decadegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from DecidegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromDecidegreesCelsiusPerSecond(QuantityValue decidegreescelsiuspersecond) + { + double value = (double) decidegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from DegreesCelsiusPerMinute. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromDegreesCelsiusPerMinute(QuantityValue degreescelsiusperminute) + { + double value = (double) degreescelsiusperminute; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerMinute); + } + /// + /// Get TemperatureChangeRate from DegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromDegreesCelsiusPerSecond(QuantityValue degreescelsiuspersecond) + { + double value = (double) degreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.DegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from HectodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromHectodegreesCelsiusPerSecond(QuantityValue hectodegreescelsiuspersecond) + { + double value = (double) hectodegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from KilodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromKilodegreesCelsiusPerSecond(QuantityValue kilodegreescelsiuspersecond) + { + double value = (double) kilodegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from MicrodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromMicrodegreesCelsiusPerSecond(QuantityValue microdegreescelsiuspersecond) + { + double value = (double) microdegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from MillidegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromMillidegreesCelsiusPerSecond(QuantityValue millidegreescelsiuspersecond) + { + double value = (double) millidegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond); + } + /// + /// Get TemperatureChangeRate from NanodegreesCelsiusPerSecond. + /// + /// If value is NaN or Infinity. + public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(QuantityValue nanodegreescelsiuspersecond) + { + double value = (double) nanodegreescelsiuspersecond; + return new TemperatureChangeRate(value, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); + } + + /// + /// 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 new TemperatureChangeRate((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static TemperatureChangeRate Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static TemperatureChangeRate Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out TemperatureChangeRate result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureChangeRate result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureChangeRateUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static TemperatureChangeRateUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TemperatureChangeRateUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureChangeRateUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is TemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); + + return CompareTo((TemperatureChangeRate)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(TemperatureChangeRate other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another TemperatureChangeRate within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current TemperatureChangeRate. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TemperatureChangeRateUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this TemperatureChangeRate to another TemperatureChangeRate with the unit representation . + /// + /// A TemperatureChangeRate with the specified unit. + public TemperatureChangeRate ToUnit(TemperatureChangeRateUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new TemperatureChangeRate(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (_value) * 1e-2d; + case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (_value) * 1e1d; + case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (_value) * 1e-1d; + case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return _value/60; + case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return _value; + case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (_value) * 1e2d; + case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (_value) * 1e3d; + case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (_value) * 1e-6d; + case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (_value) * 1e-3d; + case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (_value) * 1e-9d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TemperatureChangeRateUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-2d; + case TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond: return (baseUnitValue) / 1e1d; + case TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-1d; + case TemperatureChangeRateUnit.DegreeCelsiusPerMinute: return baseUnitValue*60; + case TemperatureChangeRateUnit.DegreeCelsiusPerSecond: return baseUnitValue; + case TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond: return (baseUnitValue) / 1e2d; + case TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond: return (baseUnitValue) / 1e3d; + case TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond: return (baseUnitValue) / 1e-6d; + case TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond: return (baseUnitValue) / 1e-3d; + case TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond: return (baseUnitValue) / 1e-9d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs new file mode 100644 index 0000000000..3b482dcc03 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -0,0 +1,712 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Difference between two temperatures. The conversions are different than for Temperature. + /// + public partial struct TemperatureDelta : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TemperatureDeltaUnit? _unit; + + static TemperatureDelta() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public TemperatureDelta(double numericValue, TemperatureDeltaUnit unit) + { + if(unit == TemperatureDeltaUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of TemperatureDelta, which is Kelvin. All conversions go via this value. + /// + public static TemperatureDeltaUnit BaseUnit => TemperatureDeltaUnit.Kelvin; + + /// + /// Represents the largest possible value of TemperatureDelta + /// + public static TemperatureDelta MaxValue => new TemperatureDelta(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of TemperatureDelta + /// + public static TemperatureDelta MinValue => new TemperatureDelta(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.TemperatureDelta; + + /// + /// All units of measurement for the TemperatureDelta quantity. + /// + public static TemperatureDeltaUnit[] Units { get; } = Enum.GetValues(typeof(TemperatureDeltaUnit)).Cast().Except(new TemperatureDeltaUnit[]{ TemperatureDeltaUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Kelvin. + /// + public static TemperatureDelta Zero => new TemperatureDelta(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TemperatureDeltaUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => TemperatureDelta.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => TemperatureDelta.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get TemperatureDelta in DegreesCelsius. + /// + public double DegreesCelsius => As(TemperatureDeltaUnit.DegreeCelsius); + + /// + /// Get TemperatureDelta in DegreesDelisle. + /// + public double DegreesDelisle => As(TemperatureDeltaUnit.DegreeDelisle); + + /// + /// Get TemperatureDelta in DegreesFahrenheit. + /// + public double DegreesFahrenheit => As(TemperatureDeltaUnit.DegreeFahrenheit); + + /// + /// Get TemperatureDelta in DegreesNewton. + /// + public double DegreesNewton => As(TemperatureDeltaUnit.DegreeNewton); + + /// + /// Get TemperatureDelta in DegreesRankine. + /// + public double DegreesRankine => As(TemperatureDeltaUnit.DegreeRankine); + + /// + /// Get TemperatureDelta in DegreesReaumur. + /// + public double DegreesReaumur => As(TemperatureDeltaUnit.DegreeReaumur); + + /// + /// Get TemperatureDelta in DegreesRoemer. + /// + public double DegreesRoemer => As(TemperatureDeltaUnit.DegreeRoemer); + + /// + /// Get TemperatureDelta in Kelvins. + /// + public double Kelvins => As(TemperatureDeltaUnit.Kelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TemperatureDeltaUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(TemperatureDeltaUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get TemperatureDelta from DegreesCelsius. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromDegreesCelsius(QuantityValue degreescelsius) + { + double value = (double) degreescelsius; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeCelsius); + } + /// + /// Get TemperatureDelta from DegreesDelisle. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromDegreesDelisle(QuantityValue degreesdelisle) + { + double value = (double) degreesdelisle; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeDelisle); + } + /// + /// Get TemperatureDelta from DegreesFahrenheit. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromDegreesFahrenheit(QuantityValue degreesfahrenheit) + { + double value = (double) degreesfahrenheit; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeFahrenheit); + } + /// + /// Get TemperatureDelta from DegreesNewton. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromDegreesNewton(QuantityValue degreesnewton) + { + double value = (double) degreesnewton; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeNewton); + } + /// + /// Get TemperatureDelta from DegreesRankine. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromDegreesRankine(QuantityValue degreesrankine) + { + double value = (double) degreesrankine; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRankine); + } + /// + /// Get TemperatureDelta from DegreesReaumur. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromDegreesReaumur(QuantityValue degreesreaumur) + { + double value = (double) degreesreaumur; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeReaumur); + } + /// + /// Get TemperatureDelta from DegreesRoemer. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromDegreesRoemer(QuantityValue degreesroemer) + { + double value = (double) degreesroemer; + return new TemperatureDelta(value, TemperatureDeltaUnit.DegreeRoemer); + } + /// + /// Get TemperatureDelta from Kelvins. + /// + /// If value is NaN or Infinity. + public static TemperatureDelta FromKelvins(QuantityValue kelvins) + { + double value = (double) kelvins; + return new TemperatureDelta(value, TemperatureDeltaUnit.Kelvin); + } + + /// + /// 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 new TemperatureDelta((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static TemperatureDelta Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static TemperatureDelta Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out TemperatureDelta result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out TemperatureDelta result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TemperatureDeltaUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static TemperatureDeltaUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TemperatureDeltaUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out TemperatureDeltaUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is TemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); + + return CompareTo((TemperatureDelta)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(TemperatureDelta other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another TemperatureDelta within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current TemperatureDelta. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TemperatureDeltaUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this TemperatureDelta to another TemperatureDelta with the unit representation . + /// + /// A TemperatureDelta with the specified unit. + public TemperatureDelta ToUnit(TemperatureDeltaUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new TemperatureDelta(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TemperatureDeltaUnit.DegreeCelsius: return _value; + case TemperatureDeltaUnit.DegreeDelisle: return _value*-2/3; + case TemperatureDeltaUnit.DegreeFahrenheit: return _value*5/9; + case TemperatureDeltaUnit.DegreeNewton: return _value*100/33; + case TemperatureDeltaUnit.DegreeRankine: return _value*5/9; + case TemperatureDeltaUnit.DegreeReaumur: return _value*5/4; + case TemperatureDeltaUnit.DegreeRoemer: return _value*40/21; + case TemperatureDeltaUnit.Kelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TemperatureDeltaUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TemperatureDeltaUnit.DegreeCelsius: return baseUnitValue; + case TemperatureDeltaUnit.DegreeDelisle: return baseUnitValue*-3/2; + case TemperatureDeltaUnit.DegreeFahrenheit: return baseUnitValue*9/5; + case TemperatureDeltaUnit.DegreeNewton: return baseUnitValue*33/100; + case TemperatureDeltaUnit.DegreeRankine: return baseUnitValue*9/5; + case TemperatureDeltaUnit.DegreeReaumur: return baseUnitValue*4/5; + case TemperatureDeltaUnit.DegreeRoemer: return baseUnitValue*21/40; + case TemperatureDeltaUnit.Kelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs new file mode 100644 index 0000000000..95b434ca49 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -0,0 +1,619 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Thermal conductivity is the property of a material to conduct heat. + /// + /// + /// https://en.wikipedia.org/wiki/Thermal_Conductivity + /// + public partial struct ThermalConductivity : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ThermalConductivityUnit? _unit; + + static ThermalConductivity() + { + BaseDimensions = new BaseDimensions(1, 1, -3, 0, -1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ThermalConductivity(double numericValue, ThermalConductivityUnit unit) + { + if(unit == ThermalConductivityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ThermalConductivity, which is WattPerMeterKelvin. All conversions go via this value. + /// + public static ThermalConductivityUnit BaseUnit => ThermalConductivityUnit.WattPerMeterKelvin; + + /// + /// Represents the largest possible value of ThermalConductivity + /// + public static ThermalConductivity MaxValue => new ThermalConductivity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ThermalConductivity + /// + public static ThermalConductivity MinValue => new ThermalConductivity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ThermalConductivity; + + /// + /// All units of measurement for the ThermalConductivity quantity. + /// + public static ThermalConductivityUnit[] Units { get; } = Enum.GetValues(typeof(ThermalConductivityUnit)).Cast().Except(new ThermalConductivityUnit[]{ ThermalConductivityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit WattPerMeterKelvin. + /// + public static ThermalConductivity Zero => new ThermalConductivity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ThermalConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ThermalConductivity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ThermalConductivity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ThermalConductivity in BtusPerHourFootFahrenheit. + /// + public double BtusPerHourFootFahrenheit => As(ThermalConductivityUnit.BtuPerHourFootFahrenheit); + + /// + /// Get ThermalConductivity in WattsPerMeterKelvin. + /// + public double WattsPerMeterKelvin => As(ThermalConductivityUnit.WattPerMeterKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ThermalConductivityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ThermalConductivityUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ThermalConductivity from BtusPerHourFootFahrenheit. + /// + /// If value is NaN or Infinity. + public static ThermalConductivity FromBtusPerHourFootFahrenheit(QuantityValue btusperhourfootfahrenheit) + { + double value = (double) btusperhourfootfahrenheit; + return new ThermalConductivity(value, ThermalConductivityUnit.BtuPerHourFootFahrenheit); + } + /// + /// Get ThermalConductivity from WattsPerMeterKelvin. + /// + /// If value is NaN or Infinity. + public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue wattspermeterkelvin) + { + double value = (double) wattspermeterkelvin; + return new ThermalConductivity(value, ThermalConductivityUnit.WattPerMeterKelvin); + } + + /// + /// 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 new ThermalConductivity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ThermalConductivity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ThermalConductivity Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ThermalConductivity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalConductivity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ThermalConductivityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ThermalConductivityUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ThermalConductivityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ThermalConductivityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); + + return CompareTo((ThermalConductivity)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ThermalConductivity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ThermalConductivity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ThermalConductivity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ThermalConductivity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ThermalConductivityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ThermalConductivity to another ThermalConductivity with the unit representation . + /// + /// A ThermalConductivity with the specified unit. + public ThermalConductivity ToUnit(ThermalConductivityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ThermalConductivity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return _value*1.73073467; + case ThermalConductivityUnit.WattPerMeterKelvin: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ThermalConductivityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ThermalConductivityUnit.BtuPerHourFootFahrenheit: return baseUnitValue/1.73073467; + case ThermalConductivityUnit.WattPerMeterKelvin: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs new file mode 100644 index 0000000000..ecb20bd412 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -0,0 +1,664 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. + /// + public partial struct ThermalResistance : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly ThermalResistanceUnit? _unit; + + static ThermalResistance() + { + BaseDimensions = new BaseDimensions(0, -1, 3, 0, 1, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public ThermalResistance(double numericValue, ThermalResistanceUnit unit) + { + if(unit == ThermalResistanceUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of ThermalResistance, which is SquareMeterKelvinPerKilowatt. All conversions go via this value. + /// + public static ThermalResistanceUnit BaseUnit => ThermalResistanceUnit.SquareMeterKelvinPerKilowatt; + + /// + /// Represents the largest possible value of ThermalResistance + /// + public static ThermalResistance MaxValue => new ThermalResistance(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of ThermalResistance + /// + public static ThermalResistance MinValue => new ThermalResistance(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.ThermalResistance; + + /// + /// All units of measurement for the ThermalResistance quantity. + /// + public static ThermalResistanceUnit[] Units { get; } = Enum.GetValues(typeof(ThermalResistanceUnit)).Cast().Except(new ThermalResistanceUnit[]{ ThermalResistanceUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt. + /// + public static ThermalResistance Zero => new ThermalResistance(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public ThermalResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => ThermalResistance.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => ThermalResistance.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get ThermalResistance in HourSquareFeetDegreesFahrenheitPerBtu. + /// + public double HourSquareFeetDegreesFahrenheitPerBtu => As(ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); + + /// + /// Get ThermalResistance in SquareCentimeterHourDegreesCelsiusPerKilocalorie. + /// + public double SquareCentimeterHourDegreesCelsiusPerKilocalorie => As(ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); + + /// + /// Get ThermalResistance in SquareCentimeterKelvinsPerWatt. + /// + public double SquareCentimeterKelvinsPerWatt => As(ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); + + /// + /// Get ThermalResistance in SquareMeterDegreesCelsiusPerWatt. + /// + public double SquareMeterDegreesCelsiusPerWatt => As(ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); + + /// + /// Get ThermalResistance in SquareMeterKelvinsPerKilowatt. + /// + public double SquareMeterKelvinsPerKilowatt => As(ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(ThermalResistanceUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(ThermalResistanceUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get ThermalResistance from HourSquareFeetDegreesFahrenheitPerBtu. + /// + /// If value is NaN or Infinity. + public static ThermalResistance FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue hoursquarefeetdegreesfahrenheitperbtu) + { + double value = (double) hoursquarefeetdegreesfahrenheitperbtu; + return new ThermalResistance(value, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); + } + /// + /// Get ThermalResistance from SquareCentimeterHourDegreesCelsiusPerKilocalorie. + /// + /// If value is NaN or Infinity. + public static ThermalResistance FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue squarecentimeterhourdegreescelsiusperkilocalorie) + { + double value = (double) squarecentimeterhourdegreescelsiusperkilocalorie; + return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie); + } + /// + /// Get ThermalResistance from SquareCentimeterKelvinsPerWatt. + /// + /// If value is NaN or Infinity. + public static ThermalResistance FromSquareCentimeterKelvinsPerWatt(QuantityValue squarecentimeterkelvinsperwatt) + { + double value = (double) squarecentimeterkelvinsperwatt; + return new ThermalResistance(value, ThermalResistanceUnit.SquareCentimeterKelvinPerWatt); + } + /// + /// Get ThermalResistance from SquareMeterDegreesCelsiusPerWatt. + /// + /// If value is NaN or Infinity. + public static ThermalResistance FromSquareMeterDegreesCelsiusPerWatt(QuantityValue squaremeterdegreescelsiusperwatt) + { + double value = (double) squaremeterdegreescelsiusperwatt; + return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt); + } + /// + /// Get ThermalResistance from SquareMeterKelvinsPerKilowatt. + /// + /// If value is NaN or Infinity. + public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(QuantityValue squaremeterkelvinsperkilowatt) + { + double value = (double) squaremeterkelvinsperkilowatt; + return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); + } + + /// + /// 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 new ThermalResistance((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static ThermalResistance Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static ThermalResistance Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out ThermalResistance result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out ThermalResistance result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static ThermalResistanceUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static ThermalResistanceUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out ThermalResistanceUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out ThermalResistanceUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is ThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); + + return CompareTo((ThermalResistance)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(ThermalResistance other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another ThermalResistance within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(ThermalResistance other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current ThermalResistance. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(ThermalResistanceUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this ThermalResistance to another ThermalResistance with the unit representation . + /// + /// A ThermalResistance with the specified unit. + public ThermalResistance ToUnit(ThermalResistanceUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new ThermalResistance(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return _value*176.1121482159839; + case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return _value*0.0859779507590433; + case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return _value*0.0999964777570357; + case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return _value*1000.088056074108; + case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(ThermalResistanceUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu: return baseUnitValue/176.1121482159839; + case ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie: return baseUnitValue/0.0859779507590433; + case ThermalResistanceUnit.SquareCentimeterKelvinPerWatt: return baseUnitValue/0.0999964777570357; + case ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt: return baseUnitValue/1000.088056074108; + case ThermalResistanceUnit.SquareMeterKelvinPerKilowatt: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs new file mode 100644 index 0000000000..1870282761 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -0,0 +1,920 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. + /// + public partial struct Torque : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly TorqueUnit? _unit; + + static Torque() + { + BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Torque(double numericValue, TorqueUnit unit) + { + if(unit == TorqueUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Torque, which is NewtonMeter. All conversions go via this value. + /// + public static TorqueUnit BaseUnit => TorqueUnit.NewtonMeter; + + /// + /// Represents the largest possible value of Torque + /// + public static Torque MaxValue => new Torque(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Torque + /// + public static Torque MinValue => new Torque(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Torque; + + /// + /// All units of measurement for the Torque quantity. + /// + public static TorqueUnit[] Units { get; } = Enum.GetValues(typeof(TorqueUnit)).Cast().Except(new TorqueUnit[]{ TorqueUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit NewtonMeter. + /// + public static Torque Zero => new Torque(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public TorqueUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Torque.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Torque.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Torque in KilogramForceCentimeters. + /// + public double KilogramForceCentimeters => As(TorqueUnit.KilogramForceCentimeter); + + /// + /// Get Torque in KilogramForceMeters. + /// + public double KilogramForceMeters => As(TorqueUnit.KilogramForceMeter); + + /// + /// Get Torque in KilogramForceMillimeters. + /// + public double KilogramForceMillimeters => As(TorqueUnit.KilogramForceMillimeter); + + /// + /// Get Torque in KilonewtonCentimeters. + /// + public double KilonewtonCentimeters => As(TorqueUnit.KilonewtonCentimeter); + + /// + /// Get Torque in KilonewtonMeters. + /// + public double KilonewtonMeters => As(TorqueUnit.KilonewtonMeter); + + /// + /// Get Torque in KilonewtonMillimeters. + /// + public double KilonewtonMillimeters => As(TorqueUnit.KilonewtonMillimeter); + + /// + /// Get Torque in KilopoundForceFeet. + /// + public double KilopoundForceFeet => As(TorqueUnit.KilopoundForceFoot); + + /// + /// Get Torque in KilopoundForceInches. + /// + public double KilopoundForceInches => As(TorqueUnit.KilopoundForceInch); + + /// + /// Get Torque in MeganewtonCentimeters. + /// + public double MeganewtonCentimeters => As(TorqueUnit.MeganewtonCentimeter); + + /// + /// Get Torque in MeganewtonMeters. + /// + public double MeganewtonMeters => As(TorqueUnit.MeganewtonMeter); + + /// + /// Get Torque in MeganewtonMillimeters. + /// + public double MeganewtonMillimeters => As(TorqueUnit.MeganewtonMillimeter); + + /// + /// Get Torque in MegapoundForceFeet. + /// + public double MegapoundForceFeet => As(TorqueUnit.MegapoundForceFoot); + + /// + /// Get Torque in MegapoundForceInches. + /// + public double MegapoundForceInches => As(TorqueUnit.MegapoundForceInch); + + /// + /// Get Torque in NewtonCentimeters. + /// + public double NewtonCentimeters => As(TorqueUnit.NewtonCentimeter); + + /// + /// Get Torque in NewtonMeters. + /// + public double NewtonMeters => As(TorqueUnit.NewtonMeter); + + /// + /// Get Torque in NewtonMillimeters. + /// + public double NewtonMillimeters => As(TorqueUnit.NewtonMillimeter); + + /// + /// Get Torque in PoundForceFeet. + /// + public double PoundForceFeet => As(TorqueUnit.PoundForceFoot); + + /// + /// Get Torque in PoundForceInches. + /// + public double PoundForceInches => As(TorqueUnit.PoundForceInch); + + /// + /// Get Torque in TonneForceCentimeters. + /// + public double TonneForceCentimeters => As(TorqueUnit.TonneForceCentimeter); + + /// + /// Get Torque in TonneForceMeters. + /// + public double TonneForceMeters => As(TorqueUnit.TonneForceMeter); + + /// + /// Get Torque in TonneForceMillimeters. + /// + public double TonneForceMillimeters => As(TorqueUnit.TonneForceMillimeter); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(TorqueUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(TorqueUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Torque from KilogramForceCentimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromKilogramForceCentimeters(QuantityValue kilogramforcecentimeters) + { + double value = (double) kilogramforcecentimeters; + return new Torque(value, TorqueUnit.KilogramForceCentimeter); + } + /// + /// Get Torque from KilogramForceMeters. + /// + /// If value is NaN or Infinity. + public static Torque FromKilogramForceMeters(QuantityValue kilogramforcemeters) + { + double value = (double) kilogramforcemeters; + return new Torque(value, TorqueUnit.KilogramForceMeter); + } + /// + /// Get Torque from KilogramForceMillimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromKilogramForceMillimeters(QuantityValue kilogramforcemillimeters) + { + double value = (double) kilogramforcemillimeters; + return new Torque(value, TorqueUnit.KilogramForceMillimeter); + } + /// + /// Get Torque from KilonewtonCentimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromKilonewtonCentimeters(QuantityValue kilonewtoncentimeters) + { + double value = (double) kilonewtoncentimeters; + return new Torque(value, TorqueUnit.KilonewtonCentimeter); + } + /// + /// Get Torque from KilonewtonMeters. + /// + /// If value is NaN or Infinity. + public static Torque FromKilonewtonMeters(QuantityValue kilonewtonmeters) + { + double value = (double) kilonewtonmeters; + return new Torque(value, TorqueUnit.KilonewtonMeter); + } + /// + /// Get Torque from KilonewtonMillimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromKilonewtonMillimeters(QuantityValue kilonewtonmillimeters) + { + double value = (double) kilonewtonmillimeters; + return new Torque(value, TorqueUnit.KilonewtonMillimeter); + } + /// + /// Get Torque from KilopoundForceFeet. + /// + /// If value is NaN or Infinity. + public static Torque FromKilopoundForceFeet(QuantityValue kilopoundforcefeet) + { + double value = (double) kilopoundforcefeet; + return new Torque(value, TorqueUnit.KilopoundForceFoot); + } + /// + /// Get Torque from KilopoundForceInches. + /// + /// If value is NaN or Infinity. + public static Torque FromKilopoundForceInches(QuantityValue kilopoundforceinches) + { + double value = (double) kilopoundforceinches; + return new Torque(value, TorqueUnit.KilopoundForceInch); + } + /// + /// Get Torque from MeganewtonCentimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromMeganewtonCentimeters(QuantityValue meganewtoncentimeters) + { + double value = (double) meganewtoncentimeters; + return new Torque(value, TorqueUnit.MeganewtonCentimeter); + } + /// + /// Get Torque from MeganewtonMeters. + /// + /// If value is NaN or Infinity. + public static Torque FromMeganewtonMeters(QuantityValue meganewtonmeters) + { + double value = (double) meganewtonmeters; + return new Torque(value, TorqueUnit.MeganewtonMeter); + } + /// + /// Get Torque from MeganewtonMillimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromMeganewtonMillimeters(QuantityValue meganewtonmillimeters) + { + double value = (double) meganewtonmillimeters; + return new Torque(value, TorqueUnit.MeganewtonMillimeter); + } + /// + /// Get Torque from MegapoundForceFeet. + /// + /// If value is NaN or Infinity. + public static Torque FromMegapoundForceFeet(QuantityValue megapoundforcefeet) + { + double value = (double) megapoundforcefeet; + return new Torque(value, TorqueUnit.MegapoundForceFoot); + } + /// + /// Get Torque from MegapoundForceInches. + /// + /// If value is NaN or Infinity. + public static Torque FromMegapoundForceInches(QuantityValue megapoundforceinches) + { + double value = (double) megapoundforceinches; + return new Torque(value, TorqueUnit.MegapoundForceInch); + } + /// + /// Get Torque from NewtonCentimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromNewtonCentimeters(QuantityValue newtoncentimeters) + { + double value = (double) newtoncentimeters; + return new Torque(value, TorqueUnit.NewtonCentimeter); + } + /// + /// Get Torque from NewtonMeters. + /// + /// If value is NaN or Infinity. + public static Torque FromNewtonMeters(QuantityValue newtonmeters) + { + double value = (double) newtonmeters; + return new Torque(value, TorqueUnit.NewtonMeter); + } + /// + /// Get Torque from NewtonMillimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromNewtonMillimeters(QuantityValue newtonmillimeters) + { + double value = (double) newtonmillimeters; + return new Torque(value, TorqueUnit.NewtonMillimeter); + } + /// + /// Get Torque from PoundForceFeet. + /// + /// If value is NaN or Infinity. + public static Torque FromPoundForceFeet(QuantityValue poundforcefeet) + { + double value = (double) poundforcefeet; + return new Torque(value, TorqueUnit.PoundForceFoot); + } + /// + /// Get Torque from PoundForceInches. + /// + /// If value is NaN or Infinity. + public static Torque FromPoundForceInches(QuantityValue poundforceinches) + { + double value = (double) poundforceinches; + return new Torque(value, TorqueUnit.PoundForceInch); + } + /// + /// Get Torque from TonneForceCentimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromTonneForceCentimeters(QuantityValue tonneforcecentimeters) + { + double value = (double) tonneforcecentimeters; + return new Torque(value, TorqueUnit.TonneForceCentimeter); + } + /// + /// Get Torque from TonneForceMeters. + /// + /// If value is NaN or Infinity. + public static Torque FromTonneForceMeters(QuantityValue tonneforcemeters) + { + double value = (double) tonneforcemeters; + return new Torque(value, TorqueUnit.TonneForceMeter); + } + /// + /// Get Torque from TonneForceMillimeters. + /// + /// If value is NaN or Infinity. + public static Torque FromTonneForceMillimeters(QuantityValue tonneforcemillimeters) + { + double value = (double) tonneforcemillimeters; + return new Torque(value, TorqueUnit.TonneForceMillimeter); + } + + /// + /// 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 new Torque((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Torque Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Torque Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Torque result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Torque result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static TorqueUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static TorqueUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out TorqueUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out TorqueUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Torque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); + + return CompareTo((Torque)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Torque other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Torque within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Torque other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Torque. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(TorqueUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Torque to another Torque with the unit representation . + /// + /// A Torque with the specified unit. + public Torque ToUnit(TorqueUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Torque(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case TorqueUnit.KilogramForceCentimeter: return _value*0.0980665019960652; + case TorqueUnit.KilogramForceMeter: return _value*9.80665019960652; + case TorqueUnit.KilogramForceMillimeter: return _value*0.00980665019960652; + case TorqueUnit.KilonewtonCentimeter: return (_value*0.01) * 1e3d; + case TorqueUnit.KilonewtonMeter: return (_value) * 1e3d; + case TorqueUnit.KilonewtonMillimeter: return (_value*0.001) * 1e3d; + case TorqueUnit.KilopoundForceFoot: return (_value*1.3558179483314) * 1e3d; + case TorqueUnit.KilopoundForceInch: return (_value*1.129848290276167e-1) * 1e3d; + case TorqueUnit.MeganewtonCentimeter: return (_value*0.01) * 1e6d; + case TorqueUnit.MeganewtonMeter: return (_value) * 1e6d; + case TorqueUnit.MeganewtonMillimeter: return (_value*0.001) * 1e6d; + case TorqueUnit.MegapoundForceFoot: return (_value*1.3558179483314) * 1e6d; + case TorqueUnit.MegapoundForceInch: return (_value*1.129848290276167e-1) * 1e6d; + case TorqueUnit.NewtonCentimeter: return _value*0.01; + case TorqueUnit.NewtonMeter: return _value; + case TorqueUnit.NewtonMillimeter: return _value*0.001; + case TorqueUnit.PoundForceFoot: return _value*1.3558179483314; + case TorqueUnit.PoundForceInch: return _value*1.129848290276167e-1; + case TorqueUnit.TonneForceCentimeter: return _value*98.0665019960652; + case TorqueUnit.TonneForceMeter: return _value*9806.65019960653; + case TorqueUnit.TonneForceMillimeter: return _value*9.80665019960652; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(TorqueUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case TorqueUnit.KilogramForceCentimeter: return baseUnitValue*10.1971619222242; + case TorqueUnit.KilogramForceMeter: return baseUnitValue*0.101971619222242; + case TorqueUnit.KilogramForceMillimeter: return baseUnitValue*101.971619222242; + case TorqueUnit.KilonewtonCentimeter: return (baseUnitValue*100) / 1e3d; + case TorqueUnit.KilonewtonMeter: return (baseUnitValue) / 1e3d; + case TorqueUnit.KilonewtonMillimeter: return (baseUnitValue*1000) / 1e3d; + case TorqueUnit.KilopoundForceFoot: return (baseUnitValue/1.3558179483314) / 1e3d; + case TorqueUnit.KilopoundForceInch: return (baseUnitValue/1.129848290276167e-1) / 1e3d; + case TorqueUnit.MeganewtonCentimeter: return (baseUnitValue*100) / 1e6d; + case TorqueUnit.MeganewtonMeter: return (baseUnitValue) / 1e6d; + case TorqueUnit.MeganewtonMillimeter: return (baseUnitValue*1000) / 1e6d; + case TorqueUnit.MegapoundForceFoot: return (baseUnitValue/1.3558179483314) / 1e6d; + case TorqueUnit.MegapoundForceInch: return (baseUnitValue/1.129848290276167e-1) / 1e6d; + case TorqueUnit.NewtonCentimeter: return baseUnitValue*100; + case TorqueUnit.NewtonMeter: return baseUnitValue; + case TorqueUnit.NewtonMillimeter: return baseUnitValue*1000; + case TorqueUnit.PoundForceFoot: return baseUnitValue/1.3558179483314; + case TorqueUnit.PoundForceInch: return baseUnitValue/1.129848290276167e-1; + case TorqueUnit.TonneForceCentimeter: return baseUnitValue*0.0101971619222242; + case TorqueUnit.TonneForceMeter: return baseUnitValue*0.000101971619222242; + case TorqueUnit.TonneForceMillimeter: return baseUnitValue*0.101971619222242; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs new file mode 100644 index 0000000000..25837bf80d --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -0,0 +1,600 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. + /// + public partial struct VitaminA : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VitaminAUnit? _unit; + + static VitaminA() + { + BaseDimensions = BaseDimensions.Dimensionless; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public VitaminA(double numericValue, VitaminAUnit unit) + { + if(unit == VitaminAUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of VitaminA, which is InternationalUnit. All conversions go via this value. + /// + public static VitaminAUnit BaseUnit => VitaminAUnit.InternationalUnit; + + /// + /// Represents the largest possible value of VitaminA + /// + public static VitaminA MaxValue => new VitaminA(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of VitaminA + /// + public static VitaminA MinValue => new VitaminA(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.VitaminA; + + /// + /// All units of measurement for the VitaminA quantity. + /// + public static VitaminAUnit[] Units { get; } = Enum.GetValues(typeof(VitaminAUnit)).Cast().Except(new VitaminAUnit[]{ VitaminAUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit InternationalUnit. + /// + public static VitaminA Zero => new VitaminA(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public VitaminAUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => VitaminA.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VitaminA.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get VitaminA in InternationalUnits. + /// + public double InternationalUnits => As(VitaminAUnit.InternationalUnit); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VitaminAUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(VitaminAUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get VitaminA from InternationalUnits. + /// + /// If value is NaN or Infinity. + public static VitaminA FromInternationalUnits(QuantityValue internationalunits) + { + double value = (double) internationalunits; + return new VitaminA(value, VitaminAUnit.InternationalUnit); + } + + /// + /// 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 new VitaminA((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static VitaminA Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static VitaminA Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out VitaminA result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VitaminA result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VitaminAUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static VitaminAUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out VitaminAUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out VitaminAUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is VitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); + + return CompareTo((VitaminA)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(VitaminA other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another VitaminA within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current VitaminA. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VitaminAUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this VitaminA to another VitaminA with the unit representation . + /// + /// A VitaminA with the specified unit. + public VitaminA ToUnit(VitaminAUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new VitaminA(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case VitaminAUnit.InternationalUnit: return _value; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(VitaminAUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case VitaminAUnit.InternationalUnit: return baseUnitValue; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs new file mode 100644 index 0000000000..f7fe76f379 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -0,0 +1,1272 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. + /// + public partial struct Volume : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VolumeUnit? _unit; + + static Volume() + { + BaseDimensions = new BaseDimensions(3, 0, 0, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public Volume(double numericValue, VolumeUnit unit) + { + if(unit == VolumeUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of Volume, which is CubicMeter. All conversions go via this value. + /// + public static VolumeUnit BaseUnit => VolumeUnit.CubicMeter; + + /// + /// Represents the largest possible value of Volume + /// + public static Volume MaxValue => new Volume(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Volume + /// + public static Volume MinValue => new Volume(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.Volume; + + /// + /// All units of measurement for the Volume quantity. + /// + public static VolumeUnit[] Units { get; } = Enum.GetValues(typeof(VolumeUnit)).Cast().Except(new VolumeUnit[]{ VolumeUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeter. + /// + public static Volume Zero => new Volume(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public VolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => Volume.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => Volume.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get Volume in AuTablespoons. + /// + public double AuTablespoons => As(VolumeUnit.AuTablespoon); + + /// + /// Get Volume in Centiliters. + /// + public double Centiliters => As(VolumeUnit.Centiliter); + + /// + /// Get Volume in CubicCentimeters. + /// + public double CubicCentimeters => As(VolumeUnit.CubicCentimeter); + + /// + /// Get Volume in CubicDecimeters. + /// + public double CubicDecimeters => As(VolumeUnit.CubicDecimeter); + + /// + /// Get Volume in CubicFeet. + /// + public double CubicFeet => As(VolumeUnit.CubicFoot); + + /// + /// Get Volume in CubicInches. + /// + public double CubicInches => As(VolumeUnit.CubicInch); + + /// + /// Get Volume in CubicKilometers. + /// + public double CubicKilometers => As(VolumeUnit.CubicKilometer); + + /// + /// Get Volume in CubicMeters. + /// + public double CubicMeters => As(VolumeUnit.CubicMeter); + + /// + /// Get Volume in CubicMicrometers. + /// + public double CubicMicrometers => As(VolumeUnit.CubicMicrometer); + + /// + /// Get Volume in CubicMiles. + /// + public double CubicMiles => As(VolumeUnit.CubicMile); + + /// + /// Get Volume in CubicMillimeters. + /// + public double CubicMillimeters => As(VolumeUnit.CubicMillimeter); + + /// + /// Get Volume in CubicYards. + /// + public double CubicYards => As(VolumeUnit.CubicYard); + + /// + /// Get Volume in Deciliters. + /// + public double Deciliters => As(VolumeUnit.Deciliter); + + /// + /// Get Volume in HectocubicFeet. + /// + public double HectocubicFeet => As(VolumeUnit.HectocubicFoot); + + /// + /// Get Volume in HectocubicMeters. + /// + public double HectocubicMeters => As(VolumeUnit.HectocubicMeter); + + /// + /// Get Volume in Hectoliters. + /// + public double Hectoliters => As(VolumeUnit.Hectoliter); + + /// + /// Get Volume in ImperialBeerBarrels. + /// + public double ImperialBeerBarrels => As(VolumeUnit.ImperialBeerBarrel); + + /// + /// Get Volume in ImperialGallons. + /// + public double ImperialGallons => As(VolumeUnit.ImperialGallon); + + /// + /// Get Volume in ImperialOunces. + /// + public double ImperialOunces => As(VolumeUnit.ImperialOunce); + + /// + /// Get Volume in KilocubicFeet. + /// + public double KilocubicFeet => As(VolumeUnit.KilocubicFoot); + + /// + /// Get Volume in KilocubicMeters. + /// + public double KilocubicMeters => As(VolumeUnit.KilocubicMeter); + + /// + /// Get Volume in KiloimperialGallons. + /// + public double KiloimperialGallons => As(VolumeUnit.KiloimperialGallon); + + /// + /// Get Volume in Kiloliters. + /// + public double Kiloliters => As(VolumeUnit.Kiloliter); + + /// + /// Get Volume in KilousGallons. + /// + public double KilousGallons => As(VolumeUnit.KilousGallon); + + /// + /// Get Volume in Liters. + /// + public double Liters => As(VolumeUnit.Liter); + + /// + /// Get Volume in MegacubicFeet. + /// + public double MegacubicFeet => As(VolumeUnit.MegacubicFoot); + + /// + /// Get Volume in MegaimperialGallons. + /// + public double MegaimperialGallons => As(VolumeUnit.MegaimperialGallon); + + /// + /// Get Volume in MegausGallons. + /// + public double MegausGallons => As(VolumeUnit.MegausGallon); + + /// + /// Get Volume in MetricCups. + /// + public double MetricCups => As(VolumeUnit.MetricCup); + + /// + /// Get Volume in MetricTeaspoons. + /// + public double MetricTeaspoons => As(VolumeUnit.MetricTeaspoon); + + /// + /// Get Volume in Microliters. + /// + public double Microliters => As(VolumeUnit.Microliter); + + /// + /// Get Volume in Milliliters. + /// + public double Milliliters => As(VolumeUnit.Milliliter); + + /// + /// Get Volume in OilBarrels. + /// + public double OilBarrels => As(VolumeUnit.OilBarrel); + + /// + /// Get Volume in UkTablespoons. + /// + public double UkTablespoons => As(VolumeUnit.UkTablespoon); + + /// + /// Get Volume in UsBeerBarrels. + /// + public double UsBeerBarrels => As(VolumeUnit.UsBeerBarrel); + + /// + /// Get Volume in UsCustomaryCups. + /// + public double UsCustomaryCups => As(VolumeUnit.UsCustomaryCup); + + /// + /// Get Volume in UsGallons. + /// + public double UsGallons => As(VolumeUnit.UsGallon); + + /// + /// Get Volume in UsLegalCups. + /// + public double UsLegalCups => As(VolumeUnit.UsLegalCup); + + /// + /// Get Volume in UsOunces. + /// + public double UsOunces => As(VolumeUnit.UsOunce); + + /// + /// Get Volume in UsPints. + /// + public double UsPints => As(VolumeUnit.UsPint); + + /// + /// Get Volume in UsQuarts. + /// + public double UsQuarts => As(VolumeUnit.UsQuart); + + /// + /// Get Volume in UsTablespoons. + /// + public double UsTablespoons => As(VolumeUnit.UsTablespoon); + + /// + /// Get Volume in UsTeaspoons. + /// + public double UsTeaspoons => As(VolumeUnit.UsTeaspoon); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VolumeUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(VolumeUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get Volume from AuTablespoons. + /// + /// If value is NaN or Infinity. + public static Volume FromAuTablespoons(QuantityValue autablespoons) + { + double value = (double) autablespoons; + return new Volume(value, VolumeUnit.AuTablespoon); + } + /// + /// Get Volume from Centiliters. + /// + /// If value is NaN or Infinity. + public static Volume FromCentiliters(QuantityValue centiliters) + { + double value = (double) centiliters; + return new Volume(value, VolumeUnit.Centiliter); + } + /// + /// Get Volume from CubicCentimeters. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicCentimeters(QuantityValue cubiccentimeters) + { + double value = (double) cubiccentimeters; + return new Volume(value, VolumeUnit.CubicCentimeter); + } + /// + /// Get Volume from CubicDecimeters. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicDecimeters(QuantityValue cubicdecimeters) + { + double value = (double) cubicdecimeters; + return new Volume(value, VolumeUnit.CubicDecimeter); + } + /// + /// Get Volume from CubicFeet. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicFeet(QuantityValue cubicfeet) + { + double value = (double) cubicfeet; + return new Volume(value, VolumeUnit.CubicFoot); + } + /// + /// Get Volume from CubicInches. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicInches(QuantityValue cubicinches) + { + double value = (double) cubicinches; + return new Volume(value, VolumeUnit.CubicInch); + } + /// + /// Get Volume from CubicKilometers. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicKilometers(QuantityValue cubickilometers) + { + double value = (double) cubickilometers; + return new Volume(value, VolumeUnit.CubicKilometer); + } + /// + /// Get Volume from CubicMeters. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicMeters(QuantityValue cubicmeters) + { + double value = (double) cubicmeters; + return new Volume(value, VolumeUnit.CubicMeter); + } + /// + /// Get Volume from CubicMicrometers. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicMicrometers(QuantityValue cubicmicrometers) + { + double value = (double) cubicmicrometers; + return new Volume(value, VolumeUnit.CubicMicrometer); + } + /// + /// Get Volume from CubicMiles. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicMiles(QuantityValue cubicmiles) + { + double value = (double) cubicmiles; + return new Volume(value, VolumeUnit.CubicMile); + } + /// + /// Get Volume from CubicMillimeters. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicMillimeters(QuantityValue cubicmillimeters) + { + double value = (double) cubicmillimeters; + return new Volume(value, VolumeUnit.CubicMillimeter); + } + /// + /// Get Volume from CubicYards. + /// + /// If value is NaN or Infinity. + public static Volume FromCubicYards(QuantityValue cubicyards) + { + double value = (double) cubicyards; + return new Volume(value, VolumeUnit.CubicYard); + } + /// + /// Get Volume from Deciliters. + /// + /// If value is NaN or Infinity. + public static Volume FromDeciliters(QuantityValue deciliters) + { + double value = (double) deciliters; + return new Volume(value, VolumeUnit.Deciliter); + } + /// + /// Get Volume from HectocubicFeet. + /// + /// If value is NaN or Infinity. + public static Volume FromHectocubicFeet(QuantityValue hectocubicfeet) + { + double value = (double) hectocubicfeet; + return new Volume(value, VolumeUnit.HectocubicFoot); + } + /// + /// Get Volume from HectocubicMeters. + /// + /// If value is NaN or Infinity. + public static Volume FromHectocubicMeters(QuantityValue hectocubicmeters) + { + double value = (double) hectocubicmeters; + return new Volume(value, VolumeUnit.HectocubicMeter); + } + /// + /// Get Volume from Hectoliters. + /// + /// If value is NaN or Infinity. + public static Volume FromHectoliters(QuantityValue hectoliters) + { + double value = (double) hectoliters; + return new Volume(value, VolumeUnit.Hectoliter); + } + /// + /// Get Volume from ImperialBeerBarrels. + /// + /// If value is NaN or Infinity. + public static Volume FromImperialBeerBarrels(QuantityValue imperialbeerbarrels) + { + double value = (double) imperialbeerbarrels; + return new Volume(value, VolumeUnit.ImperialBeerBarrel); + } + /// + /// Get Volume from ImperialGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromImperialGallons(QuantityValue imperialgallons) + { + double value = (double) imperialgallons; + return new Volume(value, VolumeUnit.ImperialGallon); + } + /// + /// Get Volume from ImperialOunces. + /// + /// If value is NaN or Infinity. + public static Volume FromImperialOunces(QuantityValue imperialounces) + { + double value = (double) imperialounces; + return new Volume(value, VolumeUnit.ImperialOunce); + } + /// + /// Get Volume from KilocubicFeet. + /// + /// If value is NaN or Infinity. + public static Volume FromKilocubicFeet(QuantityValue kilocubicfeet) + { + double value = (double) kilocubicfeet; + return new Volume(value, VolumeUnit.KilocubicFoot); + } + /// + /// Get Volume from KilocubicMeters. + /// + /// If value is NaN or Infinity. + public static Volume FromKilocubicMeters(QuantityValue kilocubicmeters) + { + double value = (double) kilocubicmeters; + return new Volume(value, VolumeUnit.KilocubicMeter); + } + /// + /// Get Volume from KiloimperialGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromKiloimperialGallons(QuantityValue kiloimperialgallons) + { + double value = (double) kiloimperialgallons; + return new Volume(value, VolumeUnit.KiloimperialGallon); + } + /// + /// Get Volume from Kiloliters. + /// + /// If value is NaN or Infinity. + public static Volume FromKiloliters(QuantityValue kiloliters) + { + double value = (double) kiloliters; + return new Volume(value, VolumeUnit.Kiloliter); + } + /// + /// Get Volume from KilousGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromKilousGallons(QuantityValue kilousgallons) + { + double value = (double) kilousgallons; + return new Volume(value, VolumeUnit.KilousGallon); + } + /// + /// Get Volume from Liters. + /// + /// If value is NaN or Infinity. + public static Volume FromLiters(QuantityValue liters) + { + double value = (double) liters; + return new Volume(value, VolumeUnit.Liter); + } + /// + /// Get Volume from MegacubicFeet. + /// + /// If value is NaN or Infinity. + public static Volume FromMegacubicFeet(QuantityValue megacubicfeet) + { + double value = (double) megacubicfeet; + return new Volume(value, VolumeUnit.MegacubicFoot); + } + /// + /// Get Volume from MegaimperialGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromMegaimperialGallons(QuantityValue megaimperialgallons) + { + double value = (double) megaimperialgallons; + return new Volume(value, VolumeUnit.MegaimperialGallon); + } + /// + /// Get Volume from MegausGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromMegausGallons(QuantityValue megausgallons) + { + double value = (double) megausgallons; + return new Volume(value, VolumeUnit.MegausGallon); + } + /// + /// Get Volume from MetricCups. + /// + /// If value is NaN or Infinity. + public static Volume FromMetricCups(QuantityValue metriccups) + { + double value = (double) metriccups; + return new Volume(value, VolumeUnit.MetricCup); + } + /// + /// Get Volume from MetricTeaspoons. + /// + /// If value is NaN or Infinity. + public static Volume FromMetricTeaspoons(QuantityValue metricteaspoons) + { + double value = (double) metricteaspoons; + return new Volume(value, VolumeUnit.MetricTeaspoon); + } + /// + /// Get Volume from Microliters. + /// + /// If value is NaN or Infinity. + public static Volume FromMicroliters(QuantityValue microliters) + { + double value = (double) microliters; + return new Volume(value, VolumeUnit.Microliter); + } + /// + /// Get Volume from Milliliters. + /// + /// If value is NaN or Infinity. + public static Volume FromMilliliters(QuantityValue milliliters) + { + double value = (double) milliliters; + return new Volume(value, VolumeUnit.Milliliter); + } + /// + /// Get Volume from OilBarrels. + /// + /// If value is NaN or Infinity. + public static Volume FromOilBarrels(QuantityValue oilbarrels) + { + double value = (double) oilbarrels; + return new Volume(value, VolumeUnit.OilBarrel); + } + /// + /// Get Volume from UkTablespoons. + /// + /// If value is NaN or Infinity. + public static Volume FromUkTablespoons(QuantityValue uktablespoons) + { + double value = (double) uktablespoons; + return new Volume(value, VolumeUnit.UkTablespoon); + } + /// + /// Get Volume from UsBeerBarrels. + /// + /// If value is NaN or Infinity. + public static Volume FromUsBeerBarrels(QuantityValue usbeerbarrels) + { + double value = (double) usbeerbarrels; + return new Volume(value, VolumeUnit.UsBeerBarrel); + } + /// + /// Get Volume from UsCustomaryCups. + /// + /// If value is NaN or Infinity. + public static Volume FromUsCustomaryCups(QuantityValue uscustomarycups) + { + double value = (double) uscustomarycups; + return new Volume(value, VolumeUnit.UsCustomaryCup); + } + /// + /// Get Volume from UsGallons. + /// + /// If value is NaN or Infinity. + public static Volume FromUsGallons(QuantityValue usgallons) + { + double value = (double) usgallons; + return new Volume(value, VolumeUnit.UsGallon); + } + /// + /// Get Volume from UsLegalCups. + /// + /// If value is NaN or Infinity. + public static Volume FromUsLegalCups(QuantityValue uslegalcups) + { + double value = (double) uslegalcups; + return new Volume(value, VolumeUnit.UsLegalCup); + } + /// + /// Get Volume from UsOunces. + /// + /// If value is NaN or Infinity. + public static Volume FromUsOunces(QuantityValue usounces) + { + double value = (double) usounces; + return new Volume(value, VolumeUnit.UsOunce); + } + /// + /// Get Volume from UsPints. + /// + /// If value is NaN or Infinity. + public static Volume FromUsPints(QuantityValue uspints) + { + double value = (double) uspints; + return new Volume(value, VolumeUnit.UsPint); + } + /// + /// Get Volume from UsQuarts. + /// + /// If value is NaN or Infinity. + public static Volume FromUsQuarts(QuantityValue usquarts) + { + double value = (double) usquarts; + return new Volume(value, VolumeUnit.UsQuart); + } + /// + /// Get Volume from UsTablespoons. + /// + /// If value is NaN or Infinity. + public static Volume FromUsTablespoons(QuantityValue ustablespoons) + { + double value = (double) ustablespoons; + return new Volume(value, VolumeUnit.UsTablespoon); + } + /// + /// Get Volume from UsTeaspoons. + /// + /// If value is NaN or Infinity. + public static Volume FromUsTeaspoons(QuantityValue usteaspoons) + { + double value = (double) usteaspoons; + return new Volume(value, VolumeUnit.UsTeaspoon); + } + + /// + /// 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 new Volume((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static Volume Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static Volume Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out Volume result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out Volume result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumeUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static VolumeUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out VolumeUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out VolumeUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is Volume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); + + return CompareTo((Volume)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(Volume other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another Volume within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(Volume other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current Volume. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VolumeUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this Volume to another Volume with the unit representation . + /// + /// A Volume with the specified unit. + public Volume ToUnit(VolumeUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new Volume(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case VolumeUnit.AuTablespoon: return _value*2e-5; + case VolumeUnit.Centiliter: return (_value/1e3) * 1e-2d; + case VolumeUnit.CubicCentimeter: return _value/1e6; + case VolumeUnit.CubicDecimeter: return _value/1e3; + case VolumeUnit.CubicFoot: return _value*0.0283168; + case VolumeUnit.CubicInch: return _value*1.6387*1e-5; + case VolumeUnit.CubicKilometer: return _value*1e9; + case VolumeUnit.CubicMeter: return _value; + case VolumeUnit.CubicMicrometer: return _value/1e18; + case VolumeUnit.CubicMile: return _value*4.16818182544058e9; + case VolumeUnit.CubicMillimeter: return _value/1e9; + case VolumeUnit.CubicYard: return _value*0.764554858; + case VolumeUnit.Deciliter: return (_value/1e3) * 1e-1d; + case VolumeUnit.HectocubicFoot: return (_value*0.0283168) * 1e2d; + case VolumeUnit.HectocubicMeter: return (_value) * 1e2d; + case VolumeUnit.Hectoliter: return (_value/1e3) * 1e2d; + case VolumeUnit.ImperialBeerBarrel: return _value*0.16365924; + case VolumeUnit.ImperialGallon: return _value*0.00454609000000181429905810072407; + case VolumeUnit.ImperialOunce: return _value*2.8413062499962901241875439064617e-5; + case VolumeUnit.KilocubicFoot: return (_value*0.0283168) * 1e3d; + case VolumeUnit.KilocubicMeter: return (_value) * 1e3d; + case VolumeUnit.KiloimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e3d; + case VolumeUnit.Kiloliter: return (_value/1e3) * 1e3d; + case VolumeUnit.KilousGallon: return (_value*0.00378541) * 1e3d; + case VolumeUnit.Liter: return _value/1e3; + case VolumeUnit.MegacubicFoot: return (_value*0.0283168) * 1e6d; + case VolumeUnit.MegaimperialGallon: return (_value*0.00454609000000181429905810072407) * 1e6d; + case VolumeUnit.MegausGallon: return (_value*0.00378541) * 1e6d; + case VolumeUnit.MetricCup: return _value*0.00025; + case VolumeUnit.MetricTeaspoon: return _value*0.5e-5; + case VolumeUnit.Microliter: return (_value/1e3) * 1e-6d; + case VolumeUnit.Milliliter: return (_value/1e3) * 1e-3d; + case VolumeUnit.OilBarrel: return _value*0.158987294928; + case VolumeUnit.UkTablespoon: return _value*1.5e-5; + case VolumeUnit.UsBeerBarrel: return _value*0.1173477658; + case VolumeUnit.UsCustomaryCup: return _value*0.0002365882365; + case VolumeUnit.UsGallon: return _value*0.00378541; + case VolumeUnit.UsLegalCup: return _value*0.00024; + case VolumeUnit.UsOunce: return _value*2.957352956253760505068307980135e-5; + case VolumeUnit.UsPint: return _value*4.73176473e-4; + case VolumeUnit.UsQuart: return _value*9.46352946e-4; + case VolumeUnit.UsTablespoon: return _value*1.478676478125e-5; + case VolumeUnit.UsTeaspoon: return _value*4.92892159375e-6; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(VolumeUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case VolumeUnit.AuTablespoon: return baseUnitValue/2e-5; + case VolumeUnit.Centiliter: return (baseUnitValue*1e3) / 1e-2d; + case VolumeUnit.CubicCentimeter: return baseUnitValue*1e6; + case VolumeUnit.CubicDecimeter: return baseUnitValue*1e3; + case VolumeUnit.CubicFoot: return baseUnitValue/0.0283168; + case VolumeUnit.CubicInch: return baseUnitValue/(1.6387*1e-5); + case VolumeUnit.CubicKilometer: return baseUnitValue/1e9; + case VolumeUnit.CubicMeter: return baseUnitValue; + case VolumeUnit.CubicMicrometer: return baseUnitValue*1e18; + case VolumeUnit.CubicMile: return baseUnitValue/4.16818182544058e9; + case VolumeUnit.CubicMillimeter: return baseUnitValue*1e9; + case VolumeUnit.CubicYard: return baseUnitValue/0.764554858; + case VolumeUnit.Deciliter: return (baseUnitValue*1e3) / 1e-1d; + case VolumeUnit.HectocubicFoot: return (baseUnitValue/0.0283168) / 1e2d; + case VolumeUnit.HectocubicMeter: return (baseUnitValue) / 1e2d; + case VolumeUnit.Hectoliter: return (baseUnitValue*1e3) / 1e2d; + case VolumeUnit.ImperialBeerBarrel: return baseUnitValue/0.16365924; + case VolumeUnit.ImperialGallon: return baseUnitValue/0.00454609000000181429905810072407; + case VolumeUnit.ImperialOunce: return baseUnitValue/2.8413062499962901241875439064617e-5; + case VolumeUnit.KilocubicFoot: return (baseUnitValue/0.0283168) / 1e3d; + case VolumeUnit.KilocubicMeter: return (baseUnitValue) / 1e3d; + case VolumeUnit.KiloimperialGallon: return (baseUnitValue/0.00454609000000181429905810072407) / 1e3d; + case VolumeUnit.Kiloliter: return (baseUnitValue*1e3) / 1e3d; + case VolumeUnit.KilousGallon: return (baseUnitValue/0.00378541) / 1e3d; + case VolumeUnit.Liter: return baseUnitValue*1e3; + case VolumeUnit.MegacubicFoot: return (baseUnitValue/0.0283168) / 1e6d; + case VolumeUnit.MegaimperialGallon: return (baseUnitValue/0.00454609000000181429905810072407) / 1e6d; + case VolumeUnit.MegausGallon: return (baseUnitValue/0.00378541) / 1e6d; + case VolumeUnit.MetricCup: return baseUnitValue/0.00025; + case VolumeUnit.MetricTeaspoon: return baseUnitValue/0.5e-5; + case VolumeUnit.Microliter: return (baseUnitValue*1e3) / 1e-6d; + case VolumeUnit.Milliliter: return (baseUnitValue*1e3) / 1e-3d; + case VolumeUnit.OilBarrel: return baseUnitValue/0.158987294928; + case VolumeUnit.UkTablespoon: return baseUnitValue/1.5e-5; + case VolumeUnit.UsBeerBarrel: return baseUnitValue/0.1173477658; + case VolumeUnit.UsCustomaryCup: return baseUnitValue/0.0002365882365; + case VolumeUnit.UsGallon: return baseUnitValue/0.00378541; + case VolumeUnit.UsLegalCup: return baseUnitValue/0.00024; + case VolumeUnit.UsOunce: return baseUnitValue/2.957352956253760505068307980135e-5; + case VolumeUnit.UsPint: return baseUnitValue/4.73176473e-4; + case VolumeUnit.UsQuart: return baseUnitValue/9.46352946e-4; + case VolumeUnit.UsTablespoon: return baseUnitValue/1.478676478125e-5; + case VolumeUnit.UsTeaspoon: return baseUnitValue/4.92892159375e-6; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs new file mode 100644 index 0000000000..4d4755793d --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -0,0 +1,1000 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). +// https://github.com/angularsen/UnitsNet +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. + /// + public partial struct VolumeFlow : IQuantity, IComparable, IComparable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VolumeFlowUnit? _unit; + + static VolumeFlow() + { + BaseDimensions = new BaseDimensions(3, 0, -1, 0, 0, 0, 0); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to contruct this quantity with. + /// The unit representation to contruct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + public VolumeFlow(double numericValue, VolumeFlowUnit unit) + { + if(unit == VolumeFlowUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(numericValue, nameof(numericValue)); + _unit = unit; + } + + #region Static Properties + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of VolumeFlow, which is CubicMeterPerSecond. All conversions go via this value. + /// + public static VolumeFlowUnit BaseUnit => VolumeFlowUnit.CubicMeterPerSecond; + + /// + /// Represents the largest possible value of VolumeFlow + /// + public static VolumeFlow MaxValue => new VolumeFlow(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of VolumeFlow + /// + public static VolumeFlow MinValue => new VolumeFlow(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType => QuantityType.VolumeFlow; + + /// + /// All units of measurement for the VolumeFlow quantity. + /// + public static VolumeFlowUnit[] Units { get; } = Enum.GetValues(typeof(VolumeFlowUnit)).Cast().Except(new VolumeFlowUnit[]{ VolumeFlowUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. + /// + public static VolumeFlow Zero => new VolumeFlow(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public VolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + /// The of this quantity. + /// + public QuantityType Type => VolumeFlow.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get VolumeFlow in CentilitersPerMinute. + /// + public double CentilitersPerMinute => As(VolumeFlowUnit.CentiliterPerMinute); + + /// + /// Get VolumeFlow in CubicDecimetersPerMinute. + /// + public double CubicDecimetersPerMinute => As(VolumeFlowUnit.CubicDecimeterPerMinute); + + /// + /// Get VolumeFlow in CubicFeetPerHour. + /// + public double CubicFeetPerHour => As(VolumeFlowUnit.CubicFootPerHour); + + /// + /// Get VolumeFlow in CubicFeetPerMinute. + /// + public double CubicFeetPerMinute => As(VolumeFlowUnit.CubicFootPerMinute); + + /// + /// Get VolumeFlow in CubicFeetPerSecond. + /// + public double CubicFeetPerSecond => As(VolumeFlowUnit.CubicFootPerSecond); + + /// + /// Get VolumeFlow in CubicMetersPerHour. + /// + public double CubicMetersPerHour => As(VolumeFlowUnit.CubicMeterPerHour); + + /// + /// Get VolumeFlow in CubicMetersPerMinute. + /// + public double CubicMetersPerMinute => As(VolumeFlowUnit.CubicMeterPerMinute); + + /// + /// Get VolumeFlow in CubicMetersPerSecond. + /// + public double CubicMetersPerSecond => As(VolumeFlowUnit.CubicMeterPerSecond); + + /// + /// Get VolumeFlow in CubicYardsPerHour. + /// + public double CubicYardsPerHour => As(VolumeFlowUnit.CubicYardPerHour); + + /// + /// Get VolumeFlow in CubicYardsPerMinute. + /// + public double CubicYardsPerMinute => As(VolumeFlowUnit.CubicYardPerMinute); + + /// + /// Get VolumeFlow in CubicYardsPerSecond. + /// + public double CubicYardsPerSecond => As(VolumeFlowUnit.CubicYardPerSecond); + + /// + /// Get VolumeFlow in DecilitersPerMinute. + /// + public double DecilitersPerMinute => As(VolumeFlowUnit.DeciliterPerMinute); + + /// + /// Get VolumeFlow in KilolitersPerMinute. + /// + public double KilolitersPerMinute => As(VolumeFlowUnit.KiloliterPerMinute); + + /// + /// Get VolumeFlow in LitersPerHour. + /// + public double LitersPerHour => As(VolumeFlowUnit.LiterPerHour); + + /// + /// Get VolumeFlow in LitersPerMinute. + /// + public double LitersPerMinute => As(VolumeFlowUnit.LiterPerMinute); + + /// + /// Get VolumeFlow in LitersPerSecond. + /// + public double LitersPerSecond => As(VolumeFlowUnit.LiterPerSecond); + + /// + /// Get VolumeFlow in MicrolitersPerMinute. + /// + public double MicrolitersPerMinute => As(VolumeFlowUnit.MicroliterPerMinute); + + /// + /// Get VolumeFlow in MillilitersPerMinute. + /// + public double MillilitersPerMinute => As(VolumeFlowUnit.MilliliterPerMinute); + + /// + /// Get VolumeFlow in MillionUsGallonsPerDay. + /// + public double MillionUsGallonsPerDay => As(VolumeFlowUnit.MillionUsGallonsPerDay); + + /// + /// Get VolumeFlow in NanolitersPerMinute. + /// + public double NanolitersPerMinute => As(VolumeFlowUnit.NanoliterPerMinute); + + /// + /// Get VolumeFlow in OilBarrelsPerDay. + /// + public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelPerDay); + + /// + /// Get VolumeFlow in OilBarrelsPerHour. + /// + public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelPerHour); + + /// + /// Get VolumeFlow in OilBarrelsPerMinute. + /// + public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelPerMinute); + + /// + /// Get VolumeFlow in UsGallonsPerHour. + /// + public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonPerHour); + + /// + /// Get VolumeFlow in UsGallonsPerMinute. + /// + public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonPerMinute); + + /// + /// Get VolumeFlow in UsGallonsPerSecond. + /// + public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonPerSecond); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VolumeFlowUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(VolumeFlowUnit unit, [CanBeNull] IFormatProvider provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get VolumeFlow from CentilitersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCentilitersPerMinute(QuantityValue centilitersperminute) + { + double value = (double) centilitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.CentiliterPerMinute); + } + /// + /// Get VolumeFlow from CubicDecimetersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimetersperminute) + { + double value = (double) cubicdecimetersperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicDecimeterPerMinute); + } + /// + /// Get VolumeFlow from CubicFeetPerHour. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) + { + double value = (double) cubicfeetperhour; + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerHour); + } + /// + /// Get VolumeFlow from CubicFeetPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute) + { + double value = (double) cubicfeetperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerMinute); + } + /// + /// Get VolumeFlow from CubicFeetPerSecond. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond) + { + double value = (double) cubicfeetpersecond; + return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerSecond); + } + /// + /// Get VolumeFlow from CubicMetersPerHour. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour) + { + double value = (double) cubicmetersperhour; + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerHour); + } + /// + /// Get VolumeFlow from CubicMetersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmetersperminute) + { + double value = (double) cubicmetersperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerMinute); + } + /// + /// Get VolumeFlow from CubicMetersPerSecond. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmeterspersecond) + { + double value = (double) cubicmeterspersecond; + return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerSecond); + } + /// + /// Get VolumeFlow from CubicYardsPerHour. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) + { + double value = (double) cubicyardsperhour; + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerHour); + } + /// + /// Get VolumeFlow from CubicYardsPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminute) + { + double value = (double) cubicyardsperminute; + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerMinute); + } + /// + /// Get VolumeFlow from CubicYardsPerSecond. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardspersecond) + { + double value = (double) cubicyardspersecond; + return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerSecond); + } + /// + /// Get VolumeFlow from DecilitersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminute) + { + double value = (double) decilitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.DeciliterPerMinute); + } + /// + /// Get VolumeFlow from KilolitersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminute) + { + double value = (double) kilolitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.KiloliterPerMinute); + } + /// + /// Get VolumeFlow from LitersPerHour. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) + { + double value = (double) litersperhour; + return new VolumeFlow(value, VolumeFlowUnit.LiterPerHour); + } + /// + /// Get VolumeFlow from LitersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) + { + double value = (double) litersperminute; + return new VolumeFlow(value, VolumeFlowUnit.LiterPerMinute); + } + /// + /// Get VolumeFlow from LitersPerSecond. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) + { + double value = (double) literspersecond; + return new VolumeFlow(value, VolumeFlowUnit.LiterPerSecond); + } + /// + /// Get VolumeFlow from MicrolitersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microlitersperminute) + { + double value = (double) microlitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.MicroliterPerMinute); + } + /// + /// Get VolumeFlow from MillilitersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromMillilitersPerMinute(QuantityValue millilitersperminute) + { + double value = (double) millilitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.MilliliterPerMinute); + } + /// + /// Get VolumeFlow from MillionUsGallonsPerDay. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallonsperday) + { + double value = (double) millionusgallonsperday; + return new VolumeFlow(value, VolumeFlowUnit.MillionUsGallonsPerDay); + } + /// + /// Get VolumeFlow from NanolitersPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminute) + { + double value = (double) nanolitersperminute; + return new VolumeFlow(value, VolumeFlowUnit.NanoliterPerMinute); + } + /// + /// Get VolumeFlow from OilBarrelsPerDay. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) + { + double value = (double) oilbarrelsperday; + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerDay); + } + /// + /// Get VolumeFlow from OilBarrelsPerHour. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) + { + double value = (double) oilbarrelsperhour; + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerHour); + } + /// + /// Get VolumeFlow from OilBarrelsPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminute) + { + double value = (double) oilbarrelsperminute; + return new VolumeFlow(value, VolumeFlowUnit.OilBarrelPerMinute); + } + /// + /// Get VolumeFlow from UsGallonsPerHour. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) + { + double value = (double) usgallonsperhour; + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerHour); + } + /// + /// Get VolumeFlow from UsGallonsPerMinute. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute) + { + double value = (double) usgallonsperminute; + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerMinute); + } + /// + /// Get VolumeFlow from UsGallonsPerSecond. + /// + /// If value is NaN or Infinity. + public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) + { + double value = (double) usgallonspersecond; + return new VolumeFlow(value, VolumeFlowUnit.UsGallonPerSecond); + } + + /// + /// 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 new VolumeFlow((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static VolumeFlow Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static VolumeFlow Parse(string str, [CanBeNull] IFormatProvider provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out VolumeFlow result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] IFormatProvider provider, out VolumeFlow result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumeFlowUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Format to use when parsing number and unit. Defaults to if null. + public static VolumeFlowUnit ParseUnit(string str, IFormatProvider provider = null) + { + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out VolumeFlowUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider provider, out VolumeFlowUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #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 + + #region Equality / IComparable + + 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); + } + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is VolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); + + return CompareTo((VolumeFlow)obj); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + public int CompareTo(VolumeFlow other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current VolumeFlow. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VolumeFlowUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this VolumeFlow to another VolumeFlow with the unit representation . + /// + /// A VolumeFlow with the specified unit. + public VolumeFlow ToUnit(VolumeFlowUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new VolumeFlow(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case VolumeFlowUnit.CentiliterPerMinute: return (_value/60000.00000) * 1e-2d; + case VolumeFlowUnit.CubicDecimeterPerMinute: return _value/60000.00000; + case VolumeFlowUnit.CubicFootPerHour: return _value*7.8657907199999087346816086183876e-6; + case VolumeFlowUnit.CubicFootPerMinute: return _value/2118.88000326; + case VolumeFlowUnit.CubicFootPerSecond: return _value/35.314666721; + case VolumeFlowUnit.CubicMeterPerHour: return _value/3600; + case VolumeFlowUnit.CubicMeterPerMinute: return _value/60; + case VolumeFlowUnit.CubicMeterPerSecond: return _value; + case VolumeFlowUnit.CubicYardPerHour: return _value*2.1237634944E-4; + case VolumeFlowUnit.CubicYardPerMinute: return _value*0.0127425809664; + case VolumeFlowUnit.CubicYardPerSecond: return _value*0.764554857984; + case VolumeFlowUnit.DeciliterPerMinute: return (_value/60000.00000) * 1e-1d; + case VolumeFlowUnit.KiloliterPerMinute: return (_value/60000.00000) * 1e3d; + case VolumeFlowUnit.LiterPerHour: return _value/3600000.000; + case VolumeFlowUnit.LiterPerMinute: return _value/60000.00000; + case VolumeFlowUnit.LiterPerSecond: return _value/1000; + case VolumeFlowUnit.MicroliterPerMinute: return (_value/60000.00000) * 1e-6d; + case VolumeFlowUnit.MilliliterPerMinute: return (_value/60000.00000) * 1e-3d; + case VolumeFlowUnit.MillionUsGallonsPerDay: return _value/22.824465227; + case VolumeFlowUnit.NanoliterPerMinute: return (_value/60000.00000) * 1e-9d; + case VolumeFlowUnit.OilBarrelPerDay: return _value*1.8401307283333333333333333333333e-6; + case VolumeFlowUnit.OilBarrelPerHour: return _value*4.41631375e-5; + case VolumeFlowUnit.OilBarrelPerMinute: return _value*2.64978825e-3; + case VolumeFlowUnit.UsGallonPerHour: return _value/951019.38848933424; + case VolumeFlowUnit.UsGallonPerMinute: return _value/15850.323141489; + case VolumeFlowUnit.UsGallonPerSecond: return _value/264.1720523581484; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(VolumeFlowUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case VolumeFlowUnit.CentiliterPerMinute: return (baseUnitValue*60000.00000) / 1e-2d; + case VolumeFlowUnit.CubicDecimeterPerMinute: return baseUnitValue*60000.00000; + case VolumeFlowUnit.CubicFootPerHour: return baseUnitValue/7.8657907199999087346816086183876e-6; + case VolumeFlowUnit.CubicFootPerMinute: return baseUnitValue*2118.88000326; + case VolumeFlowUnit.CubicFootPerSecond: return baseUnitValue*35.314666721; + case VolumeFlowUnit.CubicMeterPerHour: return baseUnitValue*3600; + case VolumeFlowUnit.CubicMeterPerMinute: return baseUnitValue*60; + case VolumeFlowUnit.CubicMeterPerSecond: return baseUnitValue; + case VolumeFlowUnit.CubicYardPerHour: return baseUnitValue/2.1237634944E-4; + case VolumeFlowUnit.CubicYardPerMinute: return baseUnitValue/0.0127425809664; + case VolumeFlowUnit.CubicYardPerSecond: return baseUnitValue/0.764554857984; + case VolumeFlowUnit.DeciliterPerMinute: return (baseUnitValue*60000.00000) / 1e-1d; + case VolumeFlowUnit.KiloliterPerMinute: return (baseUnitValue*60000.00000) / 1e3d; + case VolumeFlowUnit.LiterPerHour: return baseUnitValue*3600000.000; + case VolumeFlowUnit.LiterPerMinute: return baseUnitValue*60000.00000; + case VolumeFlowUnit.LiterPerSecond: return baseUnitValue*1000; + case VolumeFlowUnit.MicroliterPerMinute: return (baseUnitValue*60000.00000) / 1e-6d; + case VolumeFlowUnit.MilliliterPerMinute: return (baseUnitValue*60000.00000) / 1e-3d; + case VolumeFlowUnit.MillionUsGallonsPerDay: return baseUnitValue*22.824465227; + case VolumeFlowUnit.NanoliterPerMinute: return (baseUnitValue*60000.00000) / 1e-9d; + case VolumeFlowUnit.OilBarrelPerDay: return baseUnitValue/1.8401307283333333333333333333333e-6; + case VolumeFlowUnit.OilBarrelPerHour: return baseUnitValue/4.41631375e-5; + case VolumeFlowUnit.OilBarrelPerMinute: return baseUnitValue/2.64978825e-3; + case VolumeFlowUnit.UsGallonPerHour: return baseUnitValue*951019.38848933424; + case VolumeFlowUnit.UsGallonPerMinute: return baseUnitValue*15850.323141489; + case VolumeFlowUnit.UsGallonPerSecond: return baseUnitValue*264.1720523581484; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider) + { + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implictly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] IFormatProvider provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + } +} diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index 06e98cefc1..4d79fe578d 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -7,8 +7,6 @@ Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. Copyright (c) 2013 Andreas Gullberg Larsen - true - true true https://github.com/angularsen/UnitsNet https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png @@ -23,11 +21,17 @@ netstandard2.0;net40 UnitsNet CS1701;CS1702;CS1705;CS0618;CS0809;CS1591 + + + true + true + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + diff --git a/appveyor.yml b/appveyor.yml index 7288bf1497..199338deae 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,8 +5,8 @@ skip_commits: - docs/* - '**/*.md' -# fetch repository as zip archive, not doing any git operations on it -shallow_clone: true +# Only fetch the latest commits to reduce time to download on agent, but support pushes containing multiple commits +clone_depth: 50 # build cache to preserve files/folders between builds cache: From b958303f69fd945324f4e744fad98480fef8f748 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Tue, 6 Nov 2018 11:12:52 -0500 Subject: [PATCH 093/131] Sign all packages and remove .Signed packages (#539) * Signing packages in favor of separate .Signed assemblies. * Set assembly version when updating versions Set to major version (x.0.0.0) for version x.y.z as per recommendation. * Add assembly version to projects To version it as major part of element, per recommendation: https://docs.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming * Remove signed projects - Merge Common.props files into .csproj - Remove projects from solution * Remove signed projects from build scripts --- Build/build-functions.psm1 | 4 +- ...version-UnitsNet.Serialization.JsonNet.ps1 | 10 ++-- Build/set-version-UnitsNet.ps1 | 8 +-- Build/set-version.psm1 | 4 +- ...nitsNet.Serialization.JsonNet.Common.props | 45 ----------------- ...itsNet.Serialization.JsonNet.Signed.csproj | 23 --------- .../UnitsNet.Serialization.JsonNet.csproj | 40 ++++++++++++++- UnitsNet.sln | 12 ----- .../ReflectionBridgeExtensions.cs | 6 +-- UnitsNet/UnitsNet.Common.props | 50 ------------------- UnitsNet/UnitsNet.Signed.csproj | 19 ------- UnitsNet/UnitsNet.csproj | 47 ++++++++++++++++- 12 files changed, 98 insertions(+), 170 deletions(-) delete mode 100644 UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props delete mode 100644 UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj delete mode 100644 UnitsNet/UnitsNet.Signed.csproj diff --git a/Build/build-functions.psm1 b/Build/build-functions.psm1 index 5ff85c1875..549b9adca0 100644 --- a/Build/build-functions.psm1 +++ b/Build/build-functions.psm1 @@ -89,9 +89,7 @@ function Start-Tests { function Start-PackNugets { $projectPaths = @( "UnitsNet\UnitsNet.csproj", - "UnitsNet\UnitsNet.Signed.csproj", - "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj", - "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Signed.csproj" + "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj" ) write-host -foreground blue "Pack nugets...`n---" diff --git a/Build/set-version-UnitsNet.Serialization.JsonNet.ps1 b/Build/set-version-UnitsNet.Serialization.JsonNet.ps1 index 572399b01e..02628dda90 100644 --- a/Build/set-version-UnitsNet.Serialization.JsonNet.ps1 +++ b/Build/set-version-UnitsNet.Serialization.JsonNet.ps1 @@ -48,12 +48,12 @@ Import-Module "$PSScriptRoot\set-version.psm1" $root = Resolve-Path "$PSScriptRoot\.." $paramSet = $PsCmdlet.ParameterSetName -$commonPropsFile = "$root\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Common.props" -$versionFiles = @($commonPropsFile) +$projFile = "$root\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj" +$versionFiles = @($projFile) $projectName = "JsonNet" # Use UnitsNet.Common.props version as base if bumping major/minor/patch -$newVersion = Get-NewProjectVersion $commonPropsFile $paramSet $setVersion $bumpVersion +$newVersion = Get-NewProjectVersion $projFile $paramSet $setVersion $bumpVersion -Set-ProjectVersion $commonPropsFile $newVersion -Invoke-CommitAndTagVersion $projectName $versionFiles $newVersion \ No newline at end of file +Set-ProjectVersion $projFile $newVersion +Invoke-CommitAndTagVersion $projectName $versionFiles $newVersion diff --git a/Build/set-version-UnitsNet.ps1 b/Build/set-version-UnitsNet.ps1 index fe378565f5..4f75f49cde 100644 --- a/Build/set-version-UnitsNet.ps1 +++ b/Build/set-version-UnitsNet.ps1 @@ -50,16 +50,16 @@ Import-Module "$PSScriptRoot\set-version.psm1" $root = Resolve-Path "$PSScriptRoot\.." $paramSet = $PsCmdlet.ParameterSetName -$commonPropsFile = "$root\UnitsNet\UnitsNet.Common.props" +$projFile = "$root\UnitsNet\UnitsNet.csproj" $winrtAssemblyInfoFile = "$root\UnitsNet\Properties\AssemblyInfo.WindowsRuntimeComponent.cs" $winrtNuspecFile = "$root\UnitsNet.WindowsRuntimeComponent\UnitsNet.WindowsRuntimeComponent.nuspec" -$versionFiles = @($commonPropsFile, $winrtAssemblyInfoFile, $winrtNuspecFile) +$versionFiles = @($projFile, $winrtAssemblyInfoFile, $winrtNuspecFile) $projectName = "UnitsNet" # Use UnitsNet.Common.props version as base if bumping major/minor/patch -$newVersion = Get-NewProjectVersion $commonPropsFile $paramSet $setVersion $bumpVersion +$newVersion = Get-NewProjectVersion $projFile $paramSet $setVersion $bumpVersion -Set-ProjectVersion $commonPropsFile $newVersion +Set-ProjectVersion $projFile $newVersion Set-AssemblyInfoVersion $winrtAssemblyInfoFile $newVersion Set-NuspecVersion $winrtNuspecFile $newVersion Invoke-CommitAndTagVersion $projectName $versionFiles $newVersion diff --git a/Build/set-version.psm1 b/Build/set-version.psm1 index fabb3b3efe..0626a343e5 100644 --- a/Build/set-version.psm1 +++ b/Build/set-version.psm1 @@ -43,8 +43,10 @@ function Invoke-CommitAndTagVersion( } function Set-ProjectVersion([string] $file, [string] $version) { - Write-Host "$file -> $version" + $assemblyVersion = $version -replace "(\d+)(?:\.\d+)+.*", '$1.0.0.0' + Write-Host "$file -> $version (AssemblyVersion $assemblyVersion)" (Get-Content $file) -replace '.*?', "$version" | Set-Content $file + (Get-Content $file) -replace '.*?', "$assemblyVersion" | Set-Content $file } function Set-AssemblyInfoVersion([string] $file, [string] $version) { diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props deleted file mode 100644 index 3c59dfcb57..0000000000 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props +++ /dev/null @@ -1,45 +0,0 @@ - - - - UnitsNet.Serialization.JsonNet - 4.0.0-alpha4 - Andreas Gullberg Larsen - Units.NET Serialization with Json.NET - A helper library for serializing and deserializing types in Units.NET using Json.NET. - Copyright (c) 2015 Andreas Gullberg Larsen - true - https://github.com/angularsen/UnitsNet - https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png - https://github.com/angularsen/UnitsNet - https://github.com/angularsen/UnitsNet/blob/master/LICENSE - false - unit units measurement json Json.NET Newtonsoft serialize deserialize serialization deserialization - - - - - netstandard2.0;net40 - UnitsNet.Serialization.JsonNet - CS1701;CS1702;CS1705;CS0618 - - - true - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - - - - - - - - - - - - - diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj deleted file mode 100644 index 0e588dd04d..0000000000 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - UnitsNet.Serialization.JsonNet.Signed - Units.NET Serialization with Json.NET (signed) - DEPRECATED - DEPRECATED! Use UnitsNet.Serialization.JsonNet 4.0.0 or later instead, which is now signed. This package will be unlisted sometime later. A helper library for serializing and deserializing types in Units.NET using Json.NET. - - - - - SIGNED - true - $(MSBuildProjectDirectory)\..\UnitsNet.snk - 7.3 - - - - - - - diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj index 9e9c93daff..b6b7a47afb 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj @@ -1,10 +1,46 @@  - + + UnitsNet.Serialization.JsonNet + 4.0.0-alpha4 + Andreas Gullberg Larsen + Units.NET Serialization with Json.NET + A helper library for serializing and deserializing types in Units.NET using Json.NET. + Copyright (c) 2015 Andreas Gullberg Larsen + true + true + true + https://github.com/angularsen/UnitsNet + https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png + https://github.com/angularsen/UnitsNet + https://github.com/angularsen/UnitsNet/blob/master/LICENSE + false + unit units measurement json Json.NET Newtonsoft serialize deserialize serialization deserialization + + + + + 4.0.0.0 7.3 + CS1701;CS1702;CS1705;CS0618 + UnitsNet.Serialization.JsonNet + netstandard2.0;net40 - + + + ../UnitsNet.snk + false + true + + + + + + + + + diff --git a/UnitsNet.sln b/UnitsNet.sln index b4fa90e778..f827f95b70 100644 --- a/UnitsNet.sln +++ b/UnitsNet.sln @@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet", "UnitsNet\UnitsN EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet", "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj", "{FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet.Signed", "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Signed.csproj", "{7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Signed", "UnitsNet\UnitsNet.Signed.csproj", "{21C1AFDC-354E-4D97-947B-2DB63C529E6E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet.Tests", "UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj", "{FFEEDF44-F32D-4D92-A75E-487CB0582EB1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Tests", "UnitsNet.Tests\UnitsNet.Tests.csproj", "{0E3B7567-5DF2-44BD-88DB-CCF050D3F943}" @@ -31,14 +27,6 @@ Global {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|Any CPU.Build.0 = Debug|Any CPU {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|Any CPU.ActiveCfg = Release|Any CPU {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|Any CPU.Build.0 = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|Any CPU.Build.0 = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|Any CPU.Build.0 = Release|Any CPU {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/UnitsNet/InternalHelpers/ReflectionBridgeExtensions.cs b/UnitsNet/InternalHelpers/ReflectionBridgeExtensions.cs index 85138d716f..993f389f96 100644 --- a/UnitsNet/InternalHelpers/ReflectionBridgeExtensions.cs +++ b/UnitsNet/InternalHelpers/ReflectionBridgeExtensions.cs @@ -24,11 +24,7 @@ using System.Collections.Generic; using System.Reflection; -#if SIGNED -[assembly: InternalsVisibleTo("UnitsNet.Serialization.JsonNet.Signed, PublicKey=002400000480000094000000060200000024000052534131000400000100010089abdcb0025f7d1c4c766686dd852b978ca5bb9fd80bba9d3539e8399b01170ae0ea10c0c3baa301b1d13090d5aff770532de00c88b67c4b24669fde7f9d87218f1c6c073a09016cbb2f87119b94227c2301f4e2a096043e30f7c47c872bbd8e0b80d924952e6b36990f13f847e83e9efb107ec2121fe39d7edaaa4e235af8c4")] -#else -[assembly: InternalsVisibleTo("UnitsNet.Serialization.JsonNet")] -#endif +[assembly: InternalsVisibleTo("UnitsNet.Serialization.JsonNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010089abdcb0025f7d1c4c766686dd852b978ca5bb9fd80bba9d3539e8399b01170ae0ea10c0c3baa301b1d13090d5aff770532de00c88b67c4b24669fde7f9d87218f1c6c073a09016cbb2f87119b94227c2301f4e2a096043e30f7c47c872bbd8e0b80d924952e6b36990f13f847e83e9efb107ec2121fe39d7edaaa4e235af8c4")] // Based on // https://github.com/StefH/ReflectionBridge/blob/c1e34e57fe3fc93507e83d5cebc1677396645397/ReflectionBridge/src/ReflectionBridge/Extensions/ReflectionBridgeExtensions.cs diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props index 4d79fe578d..8c119d5413 100644 --- a/UnitsNet/UnitsNet.Common.props +++ b/UnitsNet/UnitsNet.Common.props @@ -1,52 +1,2 @@ - - - UnitsNet - 4.0.0-alpha5 - Andreas Gullberg Larsen - Units.NET - Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. - Copyright (c) 2013 Andreas Gullberg Larsen - true - https://github.com/angularsen/UnitsNet - https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png - https://github.com/angularsen/UnitsNet - https://github.com/angularsen/UnitsNet/blob/master/LICENSE - false - unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable - - - - - netstandard2.0;net40 - UnitsNet - CS1701;CS1702;CS1705;CS0618;CS0809;CS1591 - - - true - true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - - - - - - - - - Common\%(RecursiveDir)%(Filename)%(Extension) - - - Common\%(RecursiveDir)%(Filename)%(Extension) - - - - - - - diff --git a/UnitsNet/UnitsNet.Signed.csproj b/UnitsNet/UnitsNet.Signed.csproj deleted file mode 100644 index 9fcfd5d553..0000000000 --- a/UnitsNet/UnitsNet.Signed.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - UnitsNet.Signed - Units.NET (signed) - DEPRECATED - DEPRECATED! Use UnitsNet 4.0.0 or later instead, which is now signed. This package will be unlisted sometime later. Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. - - - - - SIGNED - true - $(MSBuildProjectDirectory)\..\UnitsNet.snk - 7.3 - - - diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index 9c83b4a665..998baaaffa 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -1,6 +1,51 @@  + + UnitsNet + 4.0.0-alpha5 + Andreas Gullberg Larsen + Units.NET + Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. + Copyright (c) 2013 Andreas Gullberg Larsen + true + true + true + https://github.com/angularsen/UnitsNet + https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png + https://github.com/angularsen/UnitsNet + https://github.com/angularsen/UnitsNet/blob/master/LICENSE + false + unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable + + + + + 4.0.0.0 7.3 + CS1701;CS1702;CS1705;CS0618;CS0809;CS1591 + UnitsNet + netstandard2.0;net40 + + + + + ../UnitsNet.snk + false + true - + + + + + + + + + + + Common\%(RecursiveDir)%(Filename)%(Extension) + + + + From 2b4821bb99d35784368fa4705b3cd973ee35cce8 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Tue, 6 Nov 2018 19:31:18 +0100 Subject: [PATCH 094/131] Fix typo in header (#554) * Fix name of file in header * Regenerate --- .../GeneratedCode/InformationTestsBase.g.cs | 2 +- UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs | 2 +- UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs | 2 +- .../Information.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Length.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Level.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Information.NetFramework.g.cs | 2 +- .../Quantities/Length.NetFramework.g.cs | 2 +- .../Quantities/Level.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/QuantityType.g.cs | 8 ++++---- UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs | 8 ++++---- UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs | 2 +- .../GeneratedCode/Units/AmountOfSubstanceUnit.g.cs | 2 +- .../GeneratedCode/Units/AmplitudeRatioUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/AngleUnit.g.cs | 2 +- .../GeneratedCode/Units/ApparentEnergyUnit.g.cs | 2 +- .../GeneratedCode/Units/ApparentPowerUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs | 2 +- .../Units/AreaMomentOfInertiaUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/AreaUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs | 2 +- .../Units/BrakeSpecificFuelConsumptionUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs | 2 +- .../Units/CoefficientOfThermalExpansionUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/DensityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/DurationUnit.g.cs | 2 +- .../GeneratedCode/Units/DynamicViscosityUnit.g.cs | 2 +- .../Units/ElectricAdmittanceUnit.g.cs | 2 +- .../Units/ElectricChargeDensityUnit.g.cs | 2 +- .../GeneratedCode/Units/ElectricChargeUnit.g.cs | 2 +- .../Units/ElectricConductanceUnit.g.cs | 2 +- .../Units/ElectricConductivityUnit.g.cs | 2 +- .../Units/ElectricCurrentDensityUnit.g.cs | 2 +- .../Units/ElectricCurrentGradientUnit.g.cs | 2 +- .../GeneratedCode/Units/ElectricCurrentUnit.g.cs | 2 +- .../GeneratedCode/Units/ElectricFieldUnit.g.cs | 2 +- .../Units/ElectricInductanceUnit.g.cs | 2 +- .../Units/ElectricPotentialAcUnit.g.cs | 2 +- .../Units/ElectricPotentialDcUnit.g.cs | 2 +- .../GeneratedCode/Units/ElectricPotentialUnit.g.cs | 2 +- .../Units/ElectricResistanceUnit.g.cs | 2 +- .../Units/ElectricResistivityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs | 2 +- .../GeneratedCode/Units/ForceChangeRateUnit.g.cs | 2 +- .../GeneratedCode/Units/ForcePerLengthUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/ForceUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs | 2 +- .../Units/HeatTransferCoefficientUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/InformationUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs | 2 +- .../Units/KinematicViscosityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/LengthUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/LevelUnit.g.cs | 2 +- .../GeneratedCode/Units/LinearDensityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs | 2 +- .../GeneratedCode/Units/LuminousIntensityUnit.g.cs | 2 +- .../GeneratedCode/Units/MagneticFieldUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs | 2 +- .../GeneratedCode/Units/MagnetizationUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs | 2 +- .../Units/MassMomentOfInertiaUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MassUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/PowerUnit.g.cs | 2 +- .../Units/PressureChangeRateUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/PressureUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/RatioUnit.g.cs | 2 +- .../GeneratedCode/Units/ReactiveEnergyUnit.g.cs | 2 +- .../GeneratedCode/Units/ReactivePowerUnit.g.cs | 2 +- .../Units/RotationalAccelerationUnit.g.cs | 2 +- .../GeneratedCode/Units/RotationalSpeedUnit.g.cs | 2 +- .../Units/RotationalStiffnessPerLengthUnit.g.cs | 2 +- .../Units/RotationalStiffnessUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs | 2 +- .../GeneratedCode/Units/SpecificEnergyUnit.g.cs | 2 +- .../GeneratedCode/Units/SpecificEntropyUnit.g.cs | 2 +- .../GeneratedCode/Units/SpecificVolumeUnit.g.cs | 2 +- .../GeneratedCode/Units/SpecificWeightUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs | 2 +- .../Units/TemperatureChangeRateUnit.g.cs | 2 +- .../GeneratedCode/Units/TemperatureDeltaUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs | 2 +- .../Units/ThermalConductivityUnit.g.cs | 2 +- .../GeneratedCode/Units/ThermalResistanceUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs | 2 +- UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs | 2 +- ...lude-GenerateQuantitySourceCodeNetFramework.ps1 | 2 +- .../Include-GenerateQuantityTypeSourceCode.ps1 | 8 ++++---- ...Include-GenerateUnitSystemDefaultSourceCode.ps1 | 14 +++++++------- ...Include-GenerateUnitTestBaseClassSourceCode.ps1 | 2 +- ...clude-GenerateUnitTestPlaceholderSourceCode.ps1 | 2 +- .../Scripts/Include-GenerateUnitTypeSourceCode.ps1 | 2 +- 107 files changed, 122 insertions(+), 122 deletions(-) diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index e118b75e76..5551e3aa76 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index 02e0798ada..fdbfd6a231 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index e156b8563f..f2c485b3c4 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index 0e5491bac3..b10f5f09ab 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index ff1d2450fb..d72e687bfe 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 1104c74058..105411344a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index c12969f03e..70b19de0c1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 2b75619d57..51e7126158 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index bf30df8c73..e1dda31785 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/QuantityType.g.cs b/UnitsNet/GeneratedCode/QuantityType.g.cs index fdfa76c901..470b8c5862 100644 --- a/UnitsNet/GeneratedCode/QuantityType.g.cs +++ b/UnitsNet/GeneratedCode/QuantityType.g.cs @@ -9,24 +9,24 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index cdfa8ebc3b..344dcc8c4d 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -9,24 +9,24 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs b/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs index b0c49bde87..2b9021f204 100644 --- a/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AccelerationUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs index bcabd91e77..1390321f73 100644 --- a/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AmountOfSubstanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs b/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs index 6fb4962a34..34fbf79551 100644 --- a/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AmplitudeRatioUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs b/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs index 3279d5821e..e0685956e2 100644 --- a/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AngleUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs index 7a1acff4e8..d7302fffe5 100644 --- a/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ApparentEnergyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs index e4bcbfa34e..802534b7ad 100644 --- a/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ApparentPowerUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs index 1ed64cfae3..aef1c8b643 100644 --- a/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AreaDensityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs b/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs index fec0b2c008..46e1832024 100644 --- a/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AreaMomentOfInertiaUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs b/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs index c6a16021ad..2530b08548 100644 --- a/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/AreaUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs index 9b7411b170..df94d0cdf8 100644 --- a/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/BitRateUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs b/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs index d5b7857368..0ee63f52c1 100644 --- a/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/BrakeSpecificFuelConsumptionUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs index 984e8dd83f..da990a42fd 100644 --- a/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/CapacitanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs b/UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs index 65919213d8..a9ab3be40f 100644 --- a/UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/CoefficientOfThermalExpansionUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs index 5ef6bd4e77..9b20e3e13e 100644 --- a/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DensityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs b/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs index 961559a051..57b59e4143 100644 --- a/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DurationUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs b/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs index 84b74d6442..f4cd0a365b 100644 --- a/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/DynamicViscosityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs index b2de3ce9d4..56241699b0 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricAdmittanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs index 195bd7eec8..0c895418ba 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricChargeDensityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs index d36e438166..b1a74e6ef5 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricChargeUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs index efb2d3b628..4bc13c12b0 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricConductanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs index 42b02561de..d47b79e70a 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricConductivityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs index 52eb62d9d8..806746666e 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricCurrentDensityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs index a3095b0518..dd0b12f633 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricCurrentGradientUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs index 1df148e23c..dd9dce6a63 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricCurrentUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs index c27481604e..97eb162198 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricFieldUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs index d453a32a83..627982b361 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricInductanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs index 0eeaf32d88..ac0ac58180 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricPotentialAcUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs index 06072a5d5f..c3e26c24b8 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricPotentialDcUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs index b084204e83..5c7800adbe 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricPotentialUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs index df05e507d4..49da2c0ed2 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricResistanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs index a87d79ae8e..09d3dedf65 100644 --- a/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ElectricResistivityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs index df09fa777e..d29480b5e8 100644 --- a/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/EnergyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs b/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs index afe6b86cd8..b493323b9b 100644 --- a/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/EntropyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs index 4e62ae2f78..32eb98ab5f 100644 --- a/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForceChangeRateUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs index 37989ccfc6..5673df929e 100644 --- a/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForcePerLengthUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs index 97c3256181..97ed2c68cf 100644 --- a/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ForceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs b/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs index abf9231bcd..98d4d43584 100644 --- a/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/FrequencyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs index c8d50957b8..5cc394d475 100644 --- a/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs b/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs index e15edddb3c..7421fde985 100644 --- a/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/HeatTransferCoefficientUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs index aa20dfe390..715d90b7a2 100644 --- a/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/IlluminanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs b/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs index c3d9fd3b08..d9b59e1841 100644 --- a/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/InformationUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs b/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs index 8cffb9aaac..7a9a483b21 100644 --- a/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/IrradianceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs b/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs index 3d0443e105..9248de58bb 100644 --- a/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/IrradiationUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs b/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs index b4f5dcb200..cb8d525fc6 100644 --- a/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/KinematicViscosityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs index 73ac4f8b88..f13c5b65c3 100644 --- a/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LapseRateUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs index 6444e3c960..8da7420323 100644 --- a/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LengthUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs b/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs index fe01e7447e..0f3441fe14 100644 --- a/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LevelUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs index 4906903b18..84ca79123a 100644 --- a/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LinearDensityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs index ee19dae739..0bfa2c6815 100644 --- a/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LuminousFluxUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs index ada0c10463..d5d34cac09 100644 --- a/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/LuminousIntensityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs b/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs index 61cb705d5b..e64dae3b3a 100644 --- a/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MagneticFieldUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs index bd93eb48f2..76eb6ee7d4 100644 --- a/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MagneticFluxUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs b/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs index 8e3e345034..46baaadc67 100644 --- a/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MagnetizationUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs index efcf66df90..6f36194a39 100644 --- a/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassFlowUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs index 3af4d5e64e..e801ad4c63 100644 --- a/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassFluxUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs index 1a0785b8d8..48269e967a 100644 --- a/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassMomentOfInertiaUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MassUnit.g.cs b/UnitsNet/GeneratedCode/Units/MassUnit.g.cs index d1f6b616eb..8fb2ebc11f 100644 --- a/UnitsNet/GeneratedCode/Units/MassUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MassUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs index c12f6ce671..fcb75d0bb9 100644 --- a/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarEnergyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs index faec0c8cef..1ba0f0ae63 100644 --- a/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarEntropyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs index cd665b84f9..80dd9d1374 100644 --- a/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarMassUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs b/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs index 212ccab116..4766690daa 100644 --- a/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/MolarityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs b/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs index ce35038c53..5d8e8033fd 100644 --- a/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PermeabilityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs index e6b0ce6f26..9693bc2f0c 100644 --- a/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PermittivityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs b/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs index a28b6b1436..fed2a74c81 100644 --- a/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PowerDensityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs b/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs index 901d65c6d4..2a2702b85e 100644 --- a/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PowerRatioUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs index a9edfce06a..7ab0c3d46f 100644 --- a/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs index 9097656205..7cacc7c0bf 100644 --- a/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PressureChangeRateUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs b/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs index 71449aaa6a..7838e1699e 100644 --- a/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/PressureUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs b/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs index b9ade5c47e..cdeb18176e 100644 --- a/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RatioUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs index d32891faa6..f48ea86ece 100644 --- a/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ReactiveEnergyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs index 023770095a..78f0610799 100644 --- a/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ReactivePowerUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs index 99692cc035..dfd69c5d9b 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalAccelerationUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs index 9f4e87a1d5..b5215b9ba1 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalSpeedUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs index 2b1d9d5fc0..9e15fe4a17 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalStiffnessPerLengthUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs b/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs index b26767d649..4308f84274 100644 --- a/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/RotationalStiffnessUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs b/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs index 0d5b869ec6..79aa7ae5ad 100644 --- a/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SolidAngleUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs index abd1b1e766..9879456b83 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificEnergyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs index 8dc5047030..c58a0a00d7 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificEntropyUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs index 31dee77c70..5494f9cdad 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificVolumeUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs index 5749bb693c..4de112c05e 100644 --- a/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpecificWeightUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs b/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs index e9240af553..78d4029157 100644 --- a/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/SpeedUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs b/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs index cfdec582d9..ea6d2d10e2 100644 --- a/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TemperatureChangeRateUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs b/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs index a5413b1cf6..031ee4369c 100644 --- a/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TemperatureDeltaUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs b/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs index 828b7f01ed..6aed814f0b 100644 --- a/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TemperatureUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs b/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs index 29cdbf2738..9b440faa73 100644 --- a/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ThermalConductivityUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs b/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs index dbc524b022..d4f267cee8 100644 --- a/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/ThermalResistanceUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs b/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs index ba96c3420c..e8a126324e 100644 --- a/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/TorqueUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs b/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs index 7159afbbcb..3563925062 100644 --- a/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VitaminAUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs index 25a68d9047..94bb695708 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeFlowUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs index 81ead13ed4..2cba36be1d 100644 --- a/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs +++ b/UnitsNet/GeneratedCode/Units/VolumeUnit.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index a9a6aa0b73..1fef8c2596 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -42,7 +42,7 @@ function GenerateQuantitySourceCodeNetFramework([Quantity]$quantity, [string]$ta // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 index f88f1152f2..a480e56f37 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantityTypeSourceCode.ps1 @@ -12,24 +12,24 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 index cd60a3c04a..70f5fb2d82 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitSystemDefaultSourceCode.ps1 @@ -12,24 +12,24 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -52,16 +52,16 @@ namespace UnitsNet = new [] { "@; - foreach ($quantity in $quantities) + foreach ($quantity in $quantities) { $quantityName = $quantity.Name; $unitEnumName = "$quantityName" + "Unit"; - foreach ($unit in $quantity.Units) + foreach ($unit in $quantity.Units) { $enumValue = $unit.SingularName; - foreach ($localization in $unit.Localization) + foreach ($localization in $unit.Localization) { $cultureName = $localization.Culture; $abbreviationParams = $localization.Abbreviations -join '", "' diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index 4ca6bb70e5..fc13976f38 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -22,7 +22,7 @@ function GenerateUnitTestBaseClassSourceCode([Quantity]$quantity) // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 index 03ac77c224..870714e402 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestPlaceholderSourceCode.ps1 @@ -16,7 +16,7 @@ function GenerateUnitTestPlaceholderSourceCode($quantity) // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 index 3d8ab0c635..548b03b6f6 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTypeSourceCode.ps1 @@ -14,7 +14,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ From f4d255102cdd5e8f1c87063d7ddd583e9e2d3c6a Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 20:42:22 +0100 Subject: [PATCH 095/131] Regenerate code --- .../Quantities/Acceleration.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ApparentPower.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/AreaDensity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/BitRate.WindowsRuntimeComponent.g.cs | 2 +- .../BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Capacitance.WindowsRuntimeComponent.g.cs | 2 +- .../CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Density.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Duration.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs | 2 +- .../ElectricChargeDensity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs | 2 +- .../ElectricConductivity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs | 2 +- .../ElectricCurrentDensity.WindowsRuntimeComponent.g.cs | 2 +- .../ElectricCurrentGradient.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricField.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Energy.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Entropy.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Frequency.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/HeatFlux.WindowsRuntimeComponent.g.cs | 2 +- .../HeatTransferCoefficient.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Illuminance.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Irradiance.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Irradiation.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/LapseRate.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/LinearDensity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MagneticField.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Magnetization.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MassFlow.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MassFlux.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/MolarMass.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Molarity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Permeability.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Permittivity.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/PowerDensity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/PowerRatio.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Pressure.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ReactivePower.WindowsRuntimeComponent.g.cs | 2 +- .../RotationalAcceleration.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs | 2 +- .../RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/SolidAngle.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Temperature.WindowsRuntimeComponent.g.cs | 2 +- .../TemperatureChangeRate.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Torque.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/VitaminA.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/Volume.WindowsRuntimeComponent.g.cs | 2 +- .../Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs | 2 +- .../GeneratedCode/Quantities/Acceleration.NetFramework.g.cs | 2 +- .../Quantities/AmountOfSubstance.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs | 2 +- .../Quantities/AreaMomentOfInertia.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs | 2 +- .../Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs | 2 +- .../Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs | 2 +- .../Quantities/ElectricAdmittance.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs | 2 +- .../Quantities/ElectricChargeDensity.NetFramework.g.cs | 2 +- .../Quantities/ElectricConductance.NetFramework.g.cs | 2 +- .../Quantities/ElectricConductivity.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs | 2 +- .../Quantities/ElectricCurrentDensity.NetFramework.g.cs | 2 +- .../Quantities/ElectricCurrentGradient.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ElectricField.NetFramework.g.cs | 2 +- .../Quantities/ElectricInductance.NetFramework.g.cs | 2 +- .../Quantities/ElectricPotential.NetFramework.g.cs | 2 +- .../Quantities/ElectricPotentialAc.NetFramework.g.cs | 2 +- .../Quantities/ElectricPotentialDc.NetFramework.g.cs | 2 +- .../Quantities/ElectricResistance.NetFramework.g.cs | 2 +- .../Quantities/ElectricResistivity.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs | 2 +- .../Quantities/HeatTransferCoefficient.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs | 2 +- .../Quantities/KinematicViscosity.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs | 2 +- .../Quantities/LuminousIntensity.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/MagneticField.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/Magnetization.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs | 2 +- .../Quantities/MassMomentOfInertia.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/Permeability.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/Permittivity.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs | 2 +- .../Quantities/PressureChangeRate.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs | 2 +- .../Quantities/RotationalAcceleration.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs | 2 +- .../Quantities/RotationalStiffness.NetFramework.g.cs | 2 +- .../Quantities/RotationalStiffnessPerLength.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs | 2 +- .../Quantities/TemperatureChangeRate.NetFramework.g.cs | 2 +- .../GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs | 2 +- .../Quantities/ThermalConductivity.NetFramework.g.cs | 2 +- .../Quantities/ThermalResistance.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs | 2 +- 174 files changed, 174 insertions(+), 174 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index eb339e199a..578412fe8f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index ce290025ca..ed19fe4f7b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index ce45c7407c..97dc62c27e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index d721fd78bb..6c910c685e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 6af6c3626d..4e45c0688e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index 3f17f61de0..ce0af78d15 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 7ea98e2ea6..49bf4ea9ce 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index f13fa07cad..78955f1fa0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index 40ba8402c8..0c6af8982c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 550439140c..12199f17cc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 63ab43d231..1e9b13ef94 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index e420af6a62..2eb38b0c7f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs index 1173f6f511..1fa88f8503 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index ccd0e18225..c18a493276 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index d6da3f36c3..b62c28cc3e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index 4faa9c6a73..7d84a117da 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index 42f0c6faaa..aa4ab80273 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index a3f707e4d3..360d09c392 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 0e81c2f40b..26e59dc268 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 17b4739907..6c9a791c65 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 5f0854098d..895715d29d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 922de73b93..8683a80ac3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index 43963d75d5..6fe6181a41 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index 88ea70ce25..a3f0beb293 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index 7fc78e14f1..a5d7e4157b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index 903a89b9d4..2b6f1a0352 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index d908ead398..ffd6590d76 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 449568468e..598b397cd0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index 8d64cf696e..a11d51d3fa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index 7978859d3d..c5b6cfa38b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index 62a12c9d78..aabe5e44af 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index 1a019820bd..ecda926f69 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 5314156dfd..2443c67d04 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index bbeb01758b..896ef95569 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index 0c46661ff2..ef8ecbf8a8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index 05c3e249b4..69ad74ffbc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index 5822efad71..4b43ba52d1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 408b7d2c64..1df5830c3a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 49fa0395d2..4a7ba5b2a5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 87cc96ecbd..02b493fc47 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index 87bee65bf0..b61544512f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index 9478a879a7..aeb2e5a8f1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index cfc7afe804..50d9fce29d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index f622b8d710..e93dcf6eca 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 7cfa3a7f33..0ef457a073 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 7188f7cd59..059e50e234 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index 0ae059bf84..d82624e8fd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index 543d738511..f1879573c4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index bc7a0ff539..32e498fbdb 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index ba3a41139d..db53737918 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 30fb8adb4f..435a446927 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index b4fd71ac29..e8a34a59a9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index c8a81c7e16..0f6268d0af 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index 9e86954cad..d2cbba7402 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index c3627ad5c0..111b8b22c0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index e242f67383..241bb40336 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index 6721889a8b..dd3bd5ead0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index 9906d6cc14..7b1663188d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index 0cc81c667b..6152c8460e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index 4b244f0049..17ce417516 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index b63ecedc49..2466bd891f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 0d0deb8f35..433304161c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index 3f6834c004..ab05792d67 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 33cd62bf6a..4911ea8644 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index d9d49c8ca4..8c6d898c2e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 28e40e140f..4e032a8581 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 893f7b32dc..5cfbb25054 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 6cdb0d0f9b..554ab8fd9f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index 8b9c1aea4c..038b770068 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index da8191f564..0931c79953 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index b335fe2018..0ef15ffa75 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index e537623e26..80490f6e4d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index a2734f7231..33c9024460 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index c526b4488b..e665b6317f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index ebc52aea2a..9e18a6a326 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index dab2338cc9..1498cab663 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index e4fa1ed151..a4bcb3aba8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 2580e57b88..916336a1f4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index d938c21971..ef47f9dd04 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index e27815d279..b9c68c56d6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index 85bef47194..b21d794196 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index 1cfdd85421..57b92151ea 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index c4e9a2caf2..77ef84cda9 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index 5f5be9e35a..ed0af616b2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 0d41dea4cf..498b6efbe8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index 4696c60bdd..df88729a2f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 4b90abd00c..1c2b4bf28a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 571ee22b18..d81d1d6d5e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index c73bbd675f..28ba064270 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index 0996a6c36c..f859fbad1f 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 5c05c6b4b2..65b6bb6dfa 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 472ad59e8f..596f827be0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 97b13fdfb4..64d8151c26 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 328946fdad..b1ec2d2b4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index c288aa6440..964eb04da1 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 83b7e00bb2..bf966032e2 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 60d0bbce91..90a213a3c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 167b27987d..7cf1844ee5 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 55ac3cd742..7ac339a54e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs index d27cca70a7..9fbafe82cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index 79b9788d67..a08f4d9681 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index 9d60580fcb..ffe34c5325 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index f92c2d2e61..c34d64f223 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 56c568d5aa..90565b5fac 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index 14b5a81345..da923c8128 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 0a16178af6..5e550efd3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index cf63700d7a..60fb3b81ff 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 07b04d69e2..7836917468 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index 546bca6c60..b6f0f0e58c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 59306fe6ac..e8740cb1d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 8a71720550..40935eba59 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 1abc713686..5d9bf92cb2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index c7c7f24382..11965db9e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index b28667c840..5427c05eff 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index a172668d60..78fb046ae6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 8f1cf03d97..68d61de663 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index f70db6dcc1..66945411ed 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index 4233c05f13..a02d262b66 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index 7feddd4041..c26dd5137a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index efa316a1f4..7deb4c03e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 9bf4cbd0a1..90fce0215d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 20dc3630b2..99d4d66a9d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 201b21a8c9..6db84c97ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 49959d51ca..6d40d94683 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 8005e0e610..3f46529e65 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 6c6624f9ed..6f727619ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index e565b6477a..f3c0a403b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 285b42268a..26cdfdec40 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 60a18e3ee3..dc2a76cb7d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index 27c4a59d9a..e7a4ccb2b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 26d834afad..43654a3a37 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 96e9b0c092..26c0c639a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index d7aaa86a5f..1e6dd41ffa 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 2f70b17d03..9ed6bca64a 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 2e4ced2daf..15c469f1dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index 9a5151b38c..b3d2057cfb 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 9c4be74aac..d1e33f1393 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 0f35914d2b..00b917fb96 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 940552ccff..920244de6f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 3e0c9b3650..cad76e59b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 2f4abcf978..03dc8b9dc4 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 00b21fdd99..6c6cd51080 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 5ef2ea0fe3..0fcbf107b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 8ff5fe548c..11d2794738 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index adff096d47..9503775cf3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 9717d459d4..8082a6de81 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 134e7e4745..b8bb4e17a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 43441207ae..2bc7cf438d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 470d8945ea..5151160a74 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index ff7d700a7a..5df9c78aba 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index bb9c25858d..cc45146e5b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 4fc0a607da..d9a57ba793 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 4a462f93b7..55a6b68607 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 6e45a16399..9f5d322b4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index 7cb2597718..cb2d1893e7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index fa98eebef2..ff836dfcfb 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 1c5a6bca8d..0c83767b7a 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index 621019cb7e..b6b3ca5bef 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index e8684b1465..7a92189734 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index dbaac8e546..b9e5105a40 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index e62ab6fd6d..162a834530 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index e5b949a084..b7ac544415 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index fe365194bb..3de58af3fd 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 9a751b0820..b5fd23d73c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 319cd59327..bf5f48db2c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 354a364071..74f5a9c948 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index b9bb26d9ed..90038a3e41 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index 3b482dcc03..b6b7ebeb75 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 95b434ca49..637a5be289 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index ecb20bd412..3b9ea14c67 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 1870282761..0438e7f5d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index 25837bf80d..d4483f2aa0 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index f7fe76f379..0c9a0e1a1b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 4d4755793d..962de7fd4e 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -9,7 +9,7 @@ // See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. // // Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. // // //------------------------------------------------------------------------------ From f752062b79e111af4034ba2504ff4eb969d8a195 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Thu, 8 Nov 2018 15:03:24 -0500 Subject: [PATCH 096/131] Adding equality methods/operators back (#558) --- .../GeneratedCode/InformationTestsBase.g.cs | 33 ++++++++++++++++++- .../GeneratedCode/LengthTestsBase.g.cs | 33 ++++++++++++++++++- .../GeneratedCode/LevelTestsBase.g.cs | 33 ++++++++++++++++++- .../Acceleration.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ntOfSubstance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...mplitudeRatio.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Angle.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...pparentEnergy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ApparentPower.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Area.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../AreaDensity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../BitRate.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...elConsumption.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Capacitance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...rmalExpansion.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Density.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Duration.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...amicViscosity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ricAdmittance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...lectricCharge.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ChargeDensity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...icConductance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...cConductivity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ectricCurrent.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...urrentDensity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...rrentGradient.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ElectricField.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ricInductance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...tricPotential.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...icPotentialAc.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...icPotentialDc.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ricResistance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...icResistivity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Energy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Entropy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Force.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...rceChangeRate.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...orcePerLength.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Frequency.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../HeatFlux.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...erCoefficient.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Illuminance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Information.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Irradiance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Irradiation.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...aticViscosity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../LapseRate.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Length.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Level.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...LinearDensity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../LuminousFlux.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...nousIntensity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...MagneticField.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../MagneticFlux.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...Magnetization.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Mass.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../MassFlow.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../MassFlux.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...mentOfInertia.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../MolarEnergy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../MolarEntropy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../MolarMass.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Molarity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Permeability.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Permittivity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Power.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../PowerDensity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../PowerRatio.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Pressure.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Ratio.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...eactiveEnergy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ReactivePower.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...lAcceleration.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...tationalSpeed.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...onalStiffness.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...nessPerLength.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../SolidAngle.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...pecificEnergy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ecificEntropy.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...pecificVolume.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...pecificWeight.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Speed.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Temperature.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...ureChangeRate.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...peratureDelta.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...lConductivity.WindowsRuntimeComponent.g.cs | 18 ++++++++-- ...malResistance.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Torque.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../VitaminA.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Volume.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../VolumeFlow.WindowsRuntimeComponent.g.cs | 18 ++++++++-- .../Quantities/Acceleration.NetFramework.g.cs | 29 ++++++++++++++-- .../AmountOfSubstance.NetFramework.g.cs | 29 ++++++++++++++-- .../AmplitudeRatio.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Angle.NetFramework.g.cs | 29 ++++++++++++++-- .../ApparentEnergy.NetFramework.g.cs | 29 ++++++++++++++-- .../ApparentPower.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Area.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/AreaDensity.NetFramework.g.cs | 29 ++++++++++++++-- .../AreaMomentOfInertia.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/BitRate.NetFramework.g.cs | 29 ++++++++++++++-- ...eSpecificFuelConsumption.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Capacitance.NetFramework.g.cs | 29 ++++++++++++++-- ...icientOfThermalExpansion.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Density.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Duration.NetFramework.g.cs | 29 ++++++++++++++-- .../DynamicViscosity.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricAdmittance.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricCharge.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricChargeDensity.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricConductance.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricConductivity.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricCurrent.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricCurrentDensity.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricCurrentGradient.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricField.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricInductance.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricPotential.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricPotentialAc.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricPotentialDc.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricResistance.NetFramework.g.cs | 29 ++++++++++++++-- .../ElectricResistivity.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Energy.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Entropy.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Force.NetFramework.g.cs | 29 ++++++++++++++-- .../ForceChangeRate.NetFramework.g.cs | 29 ++++++++++++++-- .../ForcePerLength.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Frequency.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/HeatFlux.NetFramework.g.cs | 29 ++++++++++++++-- .../HeatTransferCoefficient.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Illuminance.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Information.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Irradiance.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Irradiation.NetFramework.g.cs | 29 ++++++++++++++-- .../KinematicViscosity.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/LapseRate.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Length.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Level.NetFramework.g.cs | 29 ++++++++++++++-- .../LinearDensity.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/LuminousFlux.NetFramework.g.cs | 29 ++++++++++++++-- .../LuminousIntensity.NetFramework.g.cs | 29 ++++++++++++++-- .../MagneticField.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/MagneticFlux.NetFramework.g.cs | 29 ++++++++++++++-- .../Magnetization.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Mass.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/MassFlow.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/MassFlux.NetFramework.g.cs | 29 ++++++++++++++-- .../MassMomentOfInertia.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/MolarEnergy.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/MolarEntropy.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/MolarMass.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Molarity.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Permeability.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Permittivity.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Power.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/PowerDensity.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/PowerRatio.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Pressure.NetFramework.g.cs | 29 ++++++++++++++-- .../PressureChangeRate.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Ratio.NetFramework.g.cs | 29 ++++++++++++++-- .../ReactiveEnergy.NetFramework.g.cs | 29 ++++++++++++++-- .../ReactivePower.NetFramework.g.cs | 29 ++++++++++++++-- .../RotationalAcceleration.NetFramework.g.cs | 29 ++++++++++++++-- .../RotationalSpeed.NetFramework.g.cs | 29 ++++++++++++++-- .../RotationalStiffness.NetFramework.g.cs | 29 ++++++++++++++-- ...tionalStiffnessPerLength.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/SolidAngle.NetFramework.g.cs | 29 ++++++++++++++-- .../SpecificEnergy.NetFramework.g.cs | 29 ++++++++++++++-- .../SpecificEntropy.NetFramework.g.cs | 29 ++++++++++++++-- .../SpecificVolume.NetFramework.g.cs | 29 ++++++++++++++-- .../SpecificWeight.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Speed.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Temperature.NetFramework.g.cs | 29 ++++++++++++++-- .../TemperatureChangeRate.NetFramework.g.cs | 29 ++++++++++++++-- .../TemperatureDelta.NetFramework.g.cs | 29 ++++++++++++++-- .../ThermalConductivity.NetFramework.g.cs | 29 ++++++++++++++-- .../ThermalResistance.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Torque.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/VitaminA.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/Volume.NetFramework.g.cs | 29 ++++++++++++++-- .../Quantities/VolumeFlow.NetFramework.g.cs | 29 ++++++++++++++-- ...GenerateQuantitySourceCodeNetFramework.ps1 | 33 +++++++++++++++++-- ...de-GenerateUnitTestBaseClassSourceCode.ps1 | 33 ++++++++++++++++++- 185 files changed, 3938 insertions(+), 457 deletions(-) diff --git a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs index 5551e3aa76..bab9608cbc 100644 --- a/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/InformationTestsBase.g.cs @@ -406,10 +406,41 @@ public void CompareToThrowsOnNull() Assert.Throws(() => bit.CompareTo(null)); } + [Fact] + public void EqualityOperators() + { + var a = Information.FromBits(1); + var b = Information.FromBits(2); + + // ReSharper disable EqualExpressionComparison + + Assert.True(a == a); + Assert.False(a != a); + + Assert.True(a != b); + Assert.False(a == b); + + Assert.False(a == null); + Assert.False(null == a); + +// ReSharper restore EqualExpressionComparison + } + [Fact] public void EqualsIsImplemented() { - Information v = Information.FromBits(1); + var a = Information.FromBits(1); + var b = Information.FromBits(2); + + Assert.True(a.Equals(a)); + Assert.False(a.Equals(b)); + Assert.False(a.Equals(null)); + } + + [Fact] + public void EqualsRelativeToleranceIsImplemented() + { + var v = Information.FromBits(1); Assert.True(v.Equals(Information.FromBits(1), BitsTolerance, ComparisonType.Relative)); Assert.False(v.Equals(Information.Zero, BitsTolerance, ComparisonType.Relative)); } diff --git a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs index fdbfd6a231..18228172a5 100644 --- a/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LengthTestsBase.g.cs @@ -390,10 +390,41 @@ public void CompareToThrowsOnNull() Assert.Throws(() => meter.CompareTo(null)); } + [Fact] + public void EqualityOperators() + { + var a = Length.FromMeters(1); + var b = Length.FromMeters(2); + + // ReSharper disable EqualExpressionComparison + + Assert.True(a == a); + Assert.False(a != a); + + Assert.True(a != b); + Assert.False(a == b); + + Assert.False(a == null); + Assert.False(null == a); + +// ReSharper restore EqualExpressionComparison + } + [Fact] public void EqualsIsImplemented() { - Length v = Length.FromMeters(1); + var a = Length.FromMeters(1); + var b = Length.FromMeters(2); + + Assert.True(a.Equals(a)); + Assert.False(a.Equals(b)); + Assert.False(a.Equals(null)); + } + + [Fact] + public void EqualsRelativeToleranceIsImplemented() + { + var v = Length.FromMeters(1); Assert.True(v.Equals(Length.FromMeters(1), MetersTolerance, ComparisonType.Relative)); Assert.False(v.Equals(Length.Zero, MetersTolerance, ComparisonType.Relative)); } diff --git a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs index f2c485b3c4..2f9bfd5f11 100644 --- a/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/LevelTestsBase.g.cs @@ -195,10 +195,41 @@ public void CompareToThrowsOnNull() Assert.Throws(() => decibel.CompareTo(null)); } + [Fact] + public void EqualityOperators() + { + var a = Level.FromDecibels(1); + var b = Level.FromDecibels(2); + + // ReSharper disable EqualExpressionComparison + + Assert.True(a == a); + Assert.False(a != a); + + Assert.True(a != b); + Assert.False(a == b); + + Assert.False(a == null); + Assert.False(null == a); + +// ReSharper restore EqualExpressionComparison + } + [Fact] public void EqualsIsImplemented() { - Level v = Level.FromDecibels(1); + var a = Level.FromDecibels(1); + var b = Level.FromDecibels(2); + + Assert.True(a.Equals(a)); + Assert.False(a.Equals(b)); + Assert.False(a.Equals(null)); + } + + [Fact] + public void EqualsRelativeToleranceIsImplemented() + { + var v = Level.FromDecibels(1); Assert.True(v.Equals(Level.FromDecibels(1), DecibelsTolerance, ComparisonType.Relative)); Assert.False(v.Equals(Level.Zero, DecibelsTolerance, ComparisonType.Relative)); } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs index 578412fe8f..683d1e5f9f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs @@ -554,9 +554,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Acceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); + if(!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); - return CompareTo((Acceleration)obj); + return CompareTo(objAcceleration); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -565,6 +565,20 @@ internal int CompareTo(Acceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Acceleration objAcceleration)) + return false; + + return Equals(objAcceleration); + } + + public bool Equals(Acceleration other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Acceleration within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs index ed19fe4f7b..892ce2ab01 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs @@ -569,9 +569,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); + if(!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); - return CompareTo((AmountOfSubstance)obj); + return CompareTo(objAmountOfSubstance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -580,6 +580,20 @@ internal int CompareTo(AmountOfSubstance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) + return false; + + return Equals(objAmountOfSubstance); + } + + public bool Equals(AmountOfSubstance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs index 97dc62c27e..fd7bcd0813 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs @@ -419,9 +419,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); + if(!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); - return CompareTo((AmplitudeRatio)obj); + return CompareTo(objAmplitudeRatio); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -430,6 +430,20 @@ internal int CompareTo(AmplitudeRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) + return false; + + return Equals(objAmplitudeRatio); + } + + public bool Equals(AmplitudeRatio other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs index 6c910c685e..00d0b13620 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs @@ -569,9 +569,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Angle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); + if(!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); - return CompareTo((Angle)obj); + return CompareTo(objAngle); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -580,6 +580,20 @@ internal int CompareTo(Angle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Angle objAngle)) + return false; + + return Equals(objAngle); + } + + public bool Equals(Angle other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Angle within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs index 4e45c0688e..cbc5a659c1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); + if(!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); - return CompareTo((ApparentEnergy)obj); + return CompareTo(objApparentEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(ApparentEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ApparentEnergy objApparentEnergy)) + return false; + + return Equals(objApparentEnergy); + } + + public bool Equals(ApparentEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ApparentEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs index ce0af78d15..daaf46e2cd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs @@ -419,9 +419,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); + if(!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); - return CompareTo((ApparentPower)obj); + return CompareTo(objApparentPower); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -430,6 +430,20 @@ internal int CompareTo(ApparentPower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ApparentPower objApparentPower)) + return false; + + return Equals(objApparentPower); + } + + public bool Equals(ApparentPower other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ApparentPower within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs index 49bf4ea9ce..a586b76c29 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs @@ -554,9 +554,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Area)) throw new ArgumentException("Expected type Area.", nameof(obj)); + if(!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); - return CompareTo((Area)obj); + return CompareTo(objArea); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -565,6 +565,20 @@ internal int CompareTo(Area other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Area objArea)) + return false; + + return Equals(objArea); + } + + public bool Equals(Area other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Area within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs index 78955f1fa0..10bf58c368 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs @@ -374,9 +374,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); + if(!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); - return CompareTo((AreaDensity)obj); + return CompareTo(objAreaDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -385,6 +385,20 @@ internal int CompareTo(AreaDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is AreaDensity objAreaDensity)) + return false; + + return Equals(objAreaDensity); + } + + public bool Equals(AreaDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AreaDensity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs index 0c6af8982c..88e609fde3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -449,9 +449,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); + if(!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); - return CompareTo((AreaMomentOfInertia)obj); + return CompareTo(objAreaMomentOfInertia); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -460,6 +460,20 @@ internal int CompareTo(AreaMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) + return false; + + return Equals(objAreaMomentOfInertia); + } + + public bool Equals(AreaMomentOfInertia other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs index 12199f17cc..9f94b2b184 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs @@ -752,9 +752,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); + if(!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); - return CompareTo((BitRate)obj); + return CompareTo(objBitRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -763,6 +763,20 @@ internal int CompareTo(BitRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is BitRate objBitRate)) + return false; + + return Equals(objBitRate); + } + + public bool Equals(BitRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another BitRate within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs index 1e9b13ef94..7951122f05 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); + if(!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); - return CompareTo((BrakeSpecificFuelConsumption)obj); + return CompareTo(objBrakeSpecificFuelConsumption); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(BrakeSpecificFuelConsumption other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) + return false; + + return Equals(objBrakeSpecificFuelConsumption); + } + + public bool Equals(BrakeSpecificFuelConsumption other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another BrakeSpecificFuelConsumption within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs index 2eb38b0c7f..022cbca3ac 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Capacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); + if(!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); - return CompareTo((Capacitance)obj); + return CompareTo(objCapacitance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(Capacitance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Capacitance objCapacitance)) + return false; + + return Equals(objCapacitance); + } + + public bool Equals(Capacitance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Capacitance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs index 1fa88f8503..5fbf89f4fa 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is CoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); + if(!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); - return CompareTo((CoefficientOfThermalExpansion)obj); + return CompareTo(objCoefficientOfThermalExpansion); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(CoefficientOfThermalExpansion other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) + return false; + + return Equals(objCoefficientOfThermalExpansion); + } + + public bool Equals(CoefficientOfThermalExpansion other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another CoefficientOfThermalExpansion within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs index c18a493276..ef5d5855f4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs @@ -932,9 +932,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Density)) throw new ArgumentException("Expected type Density.", nameof(obj)); + if(!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); - return CompareTo((Density)obj); + return CompareTo(objDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -943,6 +943,20 @@ internal int CompareTo(Density other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Density objDensity)) + return false; + + return Equals(objDensity); + } + + public bool Equals(Density other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Density within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs index b62c28cc3e..e57ea85bbd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs @@ -509,9 +509,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Duration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); + if(!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); - return CompareTo((Duration)obj); + return CompareTo(objDuration); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -520,6 +520,20 @@ internal int CompareTo(Duration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Duration objDuration)) + return false; + + return Equals(objDuration); + } + + public bool Equals(Duration other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Duration within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs index 7d84a117da..20534fd15c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs @@ -452,9 +452,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is DynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); + if(!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); - return CompareTo((DynamicViscosity)obj); + return CompareTo(objDynamicViscosity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -463,6 +463,20 @@ internal int CompareTo(DynamicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is DynamicViscosity objDynamicViscosity)) + return false; + + return Equals(objDynamicViscosity); + } + + public bool Equals(DynamicViscosity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another DynamicViscosity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs index aa4ab80273..f22a5da97d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs @@ -419,9 +419,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); + if(!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); - return CompareTo((ElectricAdmittance)obj); + return CompareTo(objElectricAdmittance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -430,6 +430,20 @@ internal int CompareTo(ElectricAdmittance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) + return false; + + return Equals(objElectricAdmittance); + } + + public bool Equals(ElectricAdmittance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricAdmittance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs index 360d09c392..bb6f5726f4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); + if(!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); - return CompareTo((ElectricCharge)obj); + return CompareTo(objElectricCharge); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(ElectricCharge other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCharge objElectricCharge)) + return false; + + return Equals(objElectricCharge); + } + + public bool Equals(ElectricCharge other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCharge within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs index 26e59dc268..1bc6aa4bd2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); + if(!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); - return CompareTo((ElectricChargeDensity)obj); + return CompareTo(objElectricChargeDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(ElectricChargeDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) + return false; + + return Equals(objElectricChargeDensity); + } + + public bool Equals(ElectricChargeDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricChargeDensity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs index 6c9a791c65..a8ea454d26 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs @@ -407,9 +407,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); + if(!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); - return CompareTo((ElectricConductance)obj); + return CompareTo(objElectricConductance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -418,6 +418,20 @@ internal int CompareTo(ElectricConductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricConductance objElectricConductance)) + return false; + + return Equals(objElectricConductance); + } + + public bool Equals(ElectricConductance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricConductance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs index 895715d29d..843805c29e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); + if(!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); - return CompareTo((ElectricConductivity)obj); + return CompareTo(objElectricConductivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(ElectricConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricConductivity objElectricConductivity)) + return false; + + return Equals(objElectricConductivity); + } + + public bool Equals(ElectricConductivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricConductivity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs index 8683a80ac3..31c19ff2db 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs @@ -479,9 +479,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); + if(!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); - return CompareTo((ElectricCurrent)obj); + return CompareTo(objElectricCurrent); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -490,6 +490,20 @@ internal int CompareTo(ElectricCurrent other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCurrent objElectricCurrent)) + return false; + + return Equals(objElectricCurrent); + } + + public bool Equals(ElectricCurrent other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCurrent within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs index 6fe6181a41..ba1566386b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); + if(!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); - return CompareTo((ElectricCurrentDensity)obj); + return CompareTo(objElectricCurrentDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(ElectricCurrentDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) + return false; + + return Equals(objElectricCurrentDensity); + } + + public bool Equals(ElectricCurrentDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCurrentDensity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs index a3f0beb293..79a90f05ca 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs @@ -374,9 +374,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); + if(!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); - return CompareTo((ElectricCurrentGradient)obj); + return CompareTo(objElectricCurrentGradient); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -385,6 +385,20 @@ internal int CompareTo(ElectricCurrentGradient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) + return false; + + return Equals(objElectricCurrentGradient); + } + + public bool Equals(ElectricCurrentGradient other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCurrentGradient within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs index a5d7e4157b..758928d9bf 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); + if(!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); - return CompareTo((ElectricField)obj); + return CompareTo(objElectricField); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(ElectricField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricField objElectricField)) + return false; + + return Equals(objElectricField); + } + + public bool Equals(ElectricField other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricField within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs index 2b6f1a0352..7deb755050 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); + if(!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); - return CompareTo((ElectricInductance)obj); + return CompareTo(objElectricInductance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(ElectricInductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricInductance objElectricInductance)) + return false; + + return Equals(objElectricInductance); + } + + public bool Equals(ElectricInductance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricInductance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs index ffd6590d76..546af6e12b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs @@ -434,9 +434,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); + if(!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); - return CompareTo((ElectricPotential)obj); + return CompareTo(objElectricPotential); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -445,6 +445,20 @@ internal int CompareTo(ElectricPotential other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricPotential objElectricPotential)) + return false; + + return Equals(objElectricPotential); + } + + public bool Equals(ElectricPotential other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricPotential within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs index 598b397cd0..153a1e0aa2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs @@ -434,9 +434,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); + if(!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); - return CompareTo((ElectricPotentialAc)obj); + return CompareTo(objElectricPotentialAc); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -445,6 +445,20 @@ internal int CompareTo(ElectricPotentialAc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) + return false; + + return Equals(objElectricPotentialAc); + } + + public bool Equals(ElectricPotentialAc other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricPotentialAc within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs index a11d51d3fa..adf9532fd1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs @@ -434,9 +434,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); + if(!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); - return CompareTo((ElectricPotentialDc)obj); + return CompareTo(objElectricPotentialDc); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -445,6 +445,20 @@ internal int CompareTo(ElectricPotentialDc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) + return false; + + return Equals(objElectricPotentialDc); + } + + public bool Equals(ElectricPotentialDc other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricPotentialDc within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs index c5b6cfa38b..0141bf3a16 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs @@ -419,9 +419,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); + if(!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); - return CompareTo((ElectricResistance)obj); + return CompareTo(objElectricResistance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -430,6 +430,20 @@ internal int CompareTo(ElectricResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricResistance objElectricResistance)) + return false; + + return Equals(objElectricResistance); + } + + public bool Equals(ElectricResistance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricResistance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs index aabe5e44af..92d978ba66 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs @@ -422,9 +422,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); + if(!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); - return CompareTo((ElectricResistivity)obj); + return CompareTo(objElectricResistivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -433,6 +433,20 @@ internal int CompareTo(ElectricResistivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricResistivity objElectricResistivity)) + return false; + + return Equals(objElectricResistivity); + } + + public bool Equals(ElectricResistivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricResistivity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs index ecda926f69..6003594404 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs @@ -689,9 +689,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Energy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); + if(!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); - return CompareTo((Energy)obj); + return CompareTo(objEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -700,6 +700,20 @@ internal int CompareTo(Energy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Energy objEnergy)) + return false; + + return Equals(objEnergy); + } + + public bool Equals(Energy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Energy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs index 2443c67d04..3bb85a46fd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs @@ -464,9 +464,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Entropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); + if(!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); - return CompareTo((Entropy)obj); + return CompareTo(objEntropy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -475,6 +475,20 @@ internal int CompareTo(Entropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Entropy objEntropy)) + return false; + + return Equals(objEntropy); + } + + public bool Equals(Entropy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Entropy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs index 896ef95569..f681bc23b8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs @@ -554,9 +554,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Force)) throw new ArgumentException("Expected type Force.", nameof(obj)); + if(!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); - return CompareTo((Force)obj); + return CompareTo(objForce); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -565,6 +565,20 @@ internal int CompareTo(Force other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Force objForce)) + return false; + + return Equals(objForce); + } + + public bool Equals(Force other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Force within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs index ef8ecbf8a8..130bbaaab2 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs @@ -524,9 +524,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); + if(!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); - return CompareTo((ForceChangeRate)obj); + return CompareTo(objForceChangeRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -535,6 +535,20 @@ internal int CompareTo(ForceChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ForceChangeRate objForceChangeRate)) + return false; + + return Equals(objForceChangeRate); + } + + public bool Equals(ForceChangeRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ForceChangeRate within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs index 69ad74ffbc..0d349719e1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs @@ -494,9 +494,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); + if(!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); - return CompareTo((ForcePerLength)obj); + return CompareTo(objForcePerLength); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -505,6 +505,20 @@ internal int CompareTo(ForcePerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ForcePerLength objForcePerLength)) + return false; + + return Equals(objForcePerLength); + } + + public bool Equals(ForcePerLength other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ForcePerLength within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs index 4b43ba52d1..91e1b46e3d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs @@ -479,9 +479,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Frequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); + if(!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); - return CompareTo((Frequency)obj); + return CompareTo(objFrequency); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -490,6 +490,20 @@ internal int CompareTo(Frequency other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Frequency objFrequency)) + return false; + + return Equals(objFrequency); + } + + public bool Equals(Frequency other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Frequency within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index 1df5830c3a..f95d55565e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -599,9 +599,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); + if(!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); - return CompareTo((HeatFlux)obj); + return CompareTo(objHeatFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -610,6 +610,20 @@ internal int CompareTo(HeatFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is HeatFlux objHeatFlux)) + return false; + + return Equals(objHeatFlux); + } + + public bool Equals(HeatFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another HeatFlux within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs index 4a7ba5b2a5..40413dc114 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs @@ -389,9 +389,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); + if(!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); - return CompareTo((HeatTransferCoefficient)obj); + return CompareTo(objHeatTransferCoefficient); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -400,6 +400,20 @@ internal int CompareTo(HeatTransferCoefficient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) + return false; + + return Equals(objHeatTransferCoefficient); + } + + public bool Equals(HeatTransferCoefficient other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another HeatTransferCoefficient within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs index 02b493fc47..a5f6ee518a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs @@ -422,9 +422,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Illuminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); + if(!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); - return CompareTo((Illuminance)obj); + return CompareTo(objIlluminance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -433,6 +433,20 @@ internal int CompareTo(Illuminance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Illuminance objIlluminance)) + return false; + + return Equals(objIlluminance); + } + + public bool Equals(Illuminance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Illuminance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs index b10f5f09ab..8e51a2ef3f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs @@ -749,9 +749,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Information)) throw new ArgumentException("Expected type Information.", nameof(obj)); + if(!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); - return CompareTo((Information)obj); + return CompareTo(objInformation); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -760,6 +760,20 @@ internal int CompareTo(Information other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Information objInformation)) + return false; + + return Equals(objInformation); + } + + public bool Equals(Information other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Information within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs index b61544512f..b5bed9e0bc 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs @@ -389,9 +389,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); + if(!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); - return CompareTo((Irradiance)obj); + return CompareTo(objIrradiance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -400,6 +400,20 @@ internal int CompareTo(Irradiance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Irradiance objIrradiance)) + return false; + + return Equals(objIrradiance); + } + + public bool Equals(Irradiance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Irradiance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs index aeb2e5a8f1..3edbfea3ef 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs @@ -407,9 +407,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); + if(!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); - return CompareTo((Irradiation)obj); + return CompareTo(objIrradiation); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -418,6 +418,20 @@ internal int CompareTo(Irradiation other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Irradiation objIrradiation)) + return false; + + return Equals(objIrradiation); + } + + public bool Equals(Irradiation other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Irradiation within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs index 50d9fce29d..f2944f61d5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs @@ -482,9 +482,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is KinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); + if(!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); - return CompareTo((KinematicViscosity)obj); + return CompareTo(objKinematicViscosity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -493,6 +493,20 @@ internal int CompareTo(KinematicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is KinematicViscosity objKinematicViscosity)) + return false; + + return Equals(objKinematicViscosity); + } + + public bool Equals(KinematicViscosity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another KinematicViscosity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs index e93dcf6eca..1242a38c3d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs @@ -374,9 +374,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); + if(!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); - return CompareTo((LapseRate)obj); + return CompareTo(objLapseRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -385,6 +385,20 @@ internal int CompareTo(LapseRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is LapseRate objLapseRate)) + return false; + + return Equals(objLapseRate); + } + + public bool Equals(LapseRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LapseRate within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs index d72e687bfe..c3caf25b5d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs @@ -689,9 +689,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Length)) throw new ArgumentException("Expected type Length.", nameof(obj)); + if(!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); - return CompareTo((Length)obj); + return CompareTo(objLength); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -700,6 +700,20 @@ internal int CompareTo(Length other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Length objLength)) + return false; + + return Equals(objLength); + } + + public bool Equals(Length other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Length within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs index 105411344a..67f61d03d0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs @@ -389,9 +389,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Level)) throw new ArgumentException("Expected type Level.", nameof(obj)); + if(!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); - return CompareTo((Level)obj); + return CompareTo(objLevel); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -400,6 +400,20 @@ internal int CompareTo(Level other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Level objLevel)) + return false; + + return Equals(objLevel); + } + + public bool Equals(Level other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Level within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs index 0ef457a073..7dad64c701 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs @@ -407,9 +407,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); + if(!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); - return CompareTo((LinearDensity)obj); + return CompareTo(objLinearDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -418,6 +418,20 @@ internal int CompareTo(LinearDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is LinearDensity objLinearDensity)) + return false; + + return Equals(objLinearDensity); + } + + public bool Equals(LinearDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LinearDensity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs index 059e50e234..9d867e79a5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); + if(!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); - return CompareTo((LuminousFlux)obj); + return CompareTo(objLuminousFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(LuminousFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is LuminousFlux objLuminousFlux)) + return false; + + return Equals(objLuminousFlux); + } + + public bool Equals(LuminousFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LuminousFlux within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs index d82624e8fd..6ba10e506e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); + if(!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); - return CompareTo((LuminousIntensity)obj); + return CompareTo(objLuminousIntensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(LuminousIntensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is LuminousIntensity objLuminousIntensity)) + return false; + + return Equals(objLuminousIntensity); + } + + public bool Equals(LuminousIntensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LuminousIntensity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs index f1879573c4..86a8cb29e6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); + if(!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); - return CompareTo((MagneticField)obj); + return CompareTo(objMagneticField); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(MagneticField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MagneticField objMagneticField)) + return false; + + return Equals(objMagneticField); + } + + public bool Equals(MagneticField other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MagneticField within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs index 32e498fbdb..ba0b4d1bb1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); + if(!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); - return CompareTo((MagneticFlux)obj); + return CompareTo(objMagneticFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(MagneticFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MagneticFlux objMagneticFlux)) + return false; + + return Equals(objMagneticFlux); + } + + public bool Equals(MagneticFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MagneticFlux within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs index db53737918..0c3a26cf2d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Magnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); + if(!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); - return CompareTo((Magnetization)obj); + return CompareTo(objMagnetization); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(Magnetization other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Magnetization objMagnetization)) + return false; + + return Equals(objMagnetization); + } + + public bool Equals(Magnetization other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Magnetization within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs index 435a446927..f6b75df0f3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs @@ -689,9 +689,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Mass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); + if(!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); - return CompareTo((Mass)obj); + return CompareTo(objMass); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -700,6 +700,20 @@ internal int CompareTo(Mass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Mass objMass)) + return false; + + return Equals(objMass); + } + + public bool Equals(Mass other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Mass within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs index e8a34a59a9..2acd71db31 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs @@ -614,9 +614,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); + if(!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); - return CompareTo((MassFlow)obj); + return CompareTo(objMassFlow); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -625,6 +625,20 @@ internal int CompareTo(MassFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MassFlow objMassFlow)) + return false; + + return Equals(objMassFlow); + } + + public bool Equals(MassFlow other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MassFlow within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs index 0f6268d0af..32a8c1697c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs @@ -389,9 +389,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); + if(!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); - return CompareTo((MassFlux)obj); + return CompareTo(objMassFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -400,6 +400,20 @@ internal int CompareTo(MassFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MassFlux objMassFlux)) + return false; + + return Equals(objMassFlux); + } + + public bool Equals(MassFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MassFlux within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs index d2cbba7402..39191b30f7 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs @@ -779,9 +779,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); + if(!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); - return CompareTo((MassMomentOfInertia)obj); + return CompareTo(objMassMomentOfInertia); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -790,6 +790,20 @@ internal int CompareTo(MassMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) + return false; + + return Equals(objMassMomentOfInertia); + } + + public bool Equals(MassMomentOfInertia other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MassMomentOfInertia within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs index 111b8b22c0..e52392f58c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); + if(!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); - return CompareTo((MolarEnergy)obj); + return CompareTo(objMolarEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(MolarEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MolarEnergy objMolarEnergy)) + return false; + + return Equals(objMolarEnergy); + } + + public bool Equals(MolarEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MolarEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs index 241bb40336..8aeef88d13 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); + if(!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); - return CompareTo((MolarEntropy)obj); + return CompareTo(objMolarEntropy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(MolarEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MolarEntropy objMolarEntropy)) + return false; + + return Equals(objMolarEntropy); + } + + public bool Equals(MolarEntropy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MolarEntropy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs index dd3bd5ead0..3c1d4158ed 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs @@ -539,9 +539,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); + if(!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); - return CompareTo((MolarMass)obj); + return CompareTo(objMolarMass); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -550,6 +550,20 @@ internal int CompareTo(MolarMass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is MolarMass objMolarMass)) + return false; + + return Equals(objMolarMass); + } + + public bool Equals(MolarMass other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MolarMass within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs index 7b1663188d..f84d42c175 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs @@ -482,9 +482,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Molarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); + if(!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); - return CompareTo((Molarity)obj); + return CompareTo(objMolarity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -493,6 +493,20 @@ internal int CompareTo(Molarity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Molarity objMolarity)) + return false; + + return Equals(objMolarity); + } + + public bool Equals(Molarity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Molarity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs index 6152c8460e..2916a7cc26 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); + if(!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); - return CompareTo((Permeability)obj); + return CompareTo(objPermeability); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(Permeability other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Permeability objPermeability)) + return false; + + return Equals(objPermeability); + } + + public bool Equals(Permeability other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Permeability within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs index 17ce417516..8ddb1a058e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); + if(!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); - return CompareTo((Permittivity)obj); + return CompareTo(objPermittivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(Permittivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Permittivity objPermittivity)) + return false; + + return Equals(objPermittivity); + } + + public bool Equals(Permittivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Permittivity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs index 2466bd891f..142abfee8c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs @@ -659,9 +659,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Power)) throw new ArgumentException("Expected type Power.", nameof(obj)); + if(!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); - return CompareTo((Power)obj); + return CompareTo(objPower); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -670,6 +670,20 @@ internal int CompareTo(Power other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Power objPower)) + return false; + + return Equals(objPower); + } + + public bool Equals(Power other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Power within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs index 433304161c..47ea186351 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs @@ -1019,9 +1019,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); + if(!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); - return CompareTo((PowerDensity)obj); + return CompareTo(objPowerDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -1030,6 +1030,20 @@ internal int CompareTo(PowerDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is PowerDensity objPowerDensity)) + return false; + + return Equals(objPowerDensity); + } + + public bool Equals(PowerDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another PowerDensity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs index ab05792d67..e603267b0e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs @@ -389,9 +389,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); + if(!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); - return CompareTo((PowerRatio)obj); + return CompareTo(objPowerRatio); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -400,6 +400,20 @@ internal int CompareTo(PowerRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is PowerRatio objPowerRatio)) + return false; + + return Equals(objPowerRatio); + } + + public bool Equals(PowerRatio other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another PowerRatio within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs index 4911ea8644..c3f2397f4d 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs @@ -959,9 +959,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Pressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); + if(!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); - return CompareTo((Pressure)obj); + return CompareTo(objPressure); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -970,6 +970,20 @@ internal int CompareTo(Pressure other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Pressure objPressure)) + return false; + + return Equals(objPressure); + } + + public bool Equals(Pressure other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Pressure within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs index 8c6d898c2e..50ac7e13a5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs @@ -419,9 +419,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); + if(!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); - return CompareTo((PressureChangeRate)obj); + return CompareTo(objPressureChangeRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -430,6 +430,20 @@ internal int CompareTo(PressureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is PressureChangeRate objPressureChangeRate)) + return false; + + return Equals(objPressureChangeRate); + } + + public bool Equals(PressureChangeRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another PressureChangeRate within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs index 4e032a8581..8eb8809246 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs @@ -449,9 +449,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Ratio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); + if(!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); - return CompareTo((Ratio)obj); + return CompareTo(objRatio); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -460,6 +460,20 @@ internal int CompareTo(Ratio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Ratio objRatio)) + return false; + + return Equals(objRatio); + } + + public bool Equals(Ratio other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Ratio within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs index 5cfbb25054..4416fafce4 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); + if(!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); - return CompareTo((ReactiveEnergy)obj); + return CompareTo(objReactiveEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(ReactiveEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) + return false; + + return Equals(objReactiveEnergy); + } + + public bool Equals(ReactiveEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ReactiveEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs index 554ab8fd9f..586c4fba33 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs @@ -419,9 +419,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); + if(!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); - return CompareTo((ReactivePower)obj); + return CompareTo(objReactivePower); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -430,6 +430,20 @@ internal int CompareTo(ReactivePower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ReactivePower objReactivePower)) + return false; + + return Equals(objReactivePower); + } + + public bool Equals(ReactivePower other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ReactivePower within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs index 038b770068..f8b24a5ec0 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); + if(!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); - return CompareTo((RotationalAcceleration)obj); + return CompareTo(objRotationalAcceleration); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(RotationalAcceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) + return false; + + return Equals(objRotationalAcceleration); + } + + public bool Equals(RotationalAcceleration other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalAcceleration within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs index 0931c79953..9a2c78e98a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs @@ -554,9 +554,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); + if(!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); - return CompareTo((RotationalSpeed)obj); + return CompareTo(objRotationalSpeed); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -565,6 +565,20 @@ internal int CompareTo(RotationalSpeed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalSpeed objRotationalSpeed)) + return false; + + return Equals(objRotationalSpeed); + } + + public bool Equals(RotationalSpeed other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalSpeed within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs index 0ef15ffa75..61fc5c97dd 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); + if(!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); - return CompareTo((RotationalStiffness)obj); + return CompareTo(objRotationalStiffness); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(RotationalStiffness other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalStiffness objRotationalStiffness)) + return false; + + return Equals(objRotationalStiffness); + } + + public bool Equals(RotationalStiffness other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalStiffness within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs index 80490f6e4d..2e47b2cfe3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs @@ -404,9 +404,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); + if(!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); - return CompareTo((RotationalStiffnessPerLength)obj); + return CompareTo(objRotationalStiffnessPerLength); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -415,6 +415,20 @@ internal int CompareTo(RotationalStiffnessPerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) + return false; + + return Equals(objRotationalStiffnessPerLength); + } + + public bool Equals(RotationalStiffnessPerLength other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalStiffnessPerLength within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs index 33c9024460..77bdb7da20 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs @@ -377,9 +377,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); + if(!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); - return CompareTo((SolidAngle)obj); + return CompareTo(objSolidAngle); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -388,6 +388,20 @@ internal int CompareTo(SolidAngle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is SolidAngle objSolidAngle)) + return false; + + return Equals(objSolidAngle); + } + + public bool Equals(SolidAngle other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SolidAngle within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs index e665b6317f..54b8293db5 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs @@ -482,9 +482,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); + if(!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); - return CompareTo((SpecificEnergy)obj); + return CompareTo(objSpecificEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -493,6 +493,20 @@ internal int CompareTo(SpecificEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificEnergy objSpecificEnergy)) + return false; + + return Equals(objSpecificEnergy); + } + + public bool Equals(SpecificEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs index 9e18a6a326..2b5bad71d1 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs @@ -479,9 +479,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); + if(!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); - return CompareTo((SpecificEntropy)obj); + return CompareTo(objSpecificEntropy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -490,6 +490,20 @@ internal int CompareTo(SpecificEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificEntropy objSpecificEntropy)) + return false; + + return Equals(objSpecificEntropy); + } + + public bool Equals(SpecificEntropy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificEntropy within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs index 1498cab663..5ec24394c6 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs @@ -389,9 +389,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); + if(!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); - return CompareTo((SpecificVolume)obj); + return CompareTo(objSpecificVolume); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -400,6 +400,20 @@ internal int CompareTo(SpecificVolume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificVolume objSpecificVolume)) + return false; + + return Equals(objSpecificVolume); + } + + public bool Equals(SpecificVolume other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificVolume within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs index a4bcb3aba8..6d8f47f547 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs @@ -617,9 +617,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); + if(!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); - return CompareTo((SpecificWeight)obj); + return CompareTo(objSpecificWeight); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -628,6 +628,20 @@ internal int CompareTo(SpecificWeight other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificWeight objSpecificWeight)) + return false; + + return Equals(objSpecificWeight); + } + + public bool Equals(SpecificWeight other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificWeight within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs index 916336a1f4..c7b3ec280e 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs @@ -839,9 +839,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Speed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); + if(!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); - return CompareTo((Speed)obj); + return CompareTo(objSpeed); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -850,6 +850,20 @@ internal int CompareTo(Speed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Speed objSpeed)) + return false; + + return Equals(objSpeed); + } + + public bool Equals(Speed other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Speed within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs index ef47f9dd04..77796a121f 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs @@ -479,9 +479,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Temperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); + if(!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); - return CompareTo((Temperature)obj); + return CompareTo(objTemperature); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -490,6 +490,20 @@ internal int CompareTo(Temperature other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Temperature objTemperature)) + return false; + + return Equals(objTemperature); + } + + public bool Equals(Temperature other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Temperature within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs index b9c68c56d6..0c244aa4d8 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs @@ -509,9 +509,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); + if(!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); - return CompareTo((TemperatureChangeRate)obj); + return CompareTo(objTemperatureChangeRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -520,6 +520,20 @@ internal int CompareTo(TemperatureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) + return false; + + return Equals(objTemperatureChangeRate); + } + + public bool Equals(TemperatureChangeRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another TemperatureChangeRate within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs index b21d794196..f5343b234c 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs @@ -479,9 +479,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); + if(!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); - return CompareTo((TemperatureDelta)obj); + return CompareTo(objTemperatureDelta); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -490,6 +490,20 @@ internal int CompareTo(TemperatureDelta other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is TemperatureDelta objTemperatureDelta)) + return false; + + return Equals(objTemperatureDelta); + } + + public bool Equals(TemperatureDelta other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another TemperatureDelta within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs index 57b92151ea..aaa091df43 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs @@ -392,9 +392,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); + if(!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); - return CompareTo((ThermalConductivity)obj); + return CompareTo(objThermalConductivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -403,6 +403,20 @@ internal int CompareTo(ThermalConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ThermalConductivity objThermalConductivity)) + return false; + + return Equals(objThermalConductivity); + } + + public bool Equals(ThermalConductivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ThermalConductivity within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs index 77ef84cda9..ba41692a9b 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs @@ -434,9 +434,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); + if(!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); - return CompareTo((ThermalResistance)obj); + return CompareTo(objThermalResistance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -445,6 +445,20 @@ internal int CompareTo(ThermalResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is ThermalResistance objThermalResistance)) + return false; + + return Equals(objThermalResistance); + } + + public bool Equals(ThermalResistance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ThermalResistance within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs index ed0af616b2..b94c2afb09 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs @@ -674,9 +674,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Torque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); + if(!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); - return CompareTo((Torque)obj); + return CompareTo(objTorque); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -685,6 +685,20 @@ internal int CompareTo(Torque other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Torque objTorque)) + return false; + + return Equals(objTorque); + } + + public bool Equals(Torque other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Torque within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs index 498b6efbe8..ae58a1d057 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs @@ -374,9 +374,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); + if(!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); - return CompareTo((VitaminA)obj); + return CompareTo(objVitaminA); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -385,6 +385,20 @@ internal int CompareTo(VitaminA other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is VitaminA objVitaminA)) + return false; + + return Equals(objVitaminA); + } + + public bool Equals(VitaminA other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another VitaminA within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs index df88729a2f..c6aa7afafe 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs @@ -1004,9 +1004,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Volume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); + if(!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); - return CompareTo((Volume)obj); + return CompareTo(objVolume); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -1015,6 +1015,20 @@ internal int CompareTo(Volume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is Volume objVolume)) + return false; + + return Equals(objVolume); + } + + public bool Equals(Volume other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Volume within the given absolute or relative tolerance. diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs index 1c2b4bf28a..9da54b5bca 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs @@ -749,9 +749,9 @@ public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); + if(!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); - return CompareTo((VolumeFlow)obj); + return CompareTo(objVolumeFlow); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -760,6 +760,20 @@ internal int CompareTo(VolumeFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is VolumeFlow objVolumeFlow)) + return false; + + return Equals(objVolumeFlow); + } + + public bool Equals(VolumeFlow other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index d81d1d6d5e..84ccd613a6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. /// - public partial struct Acceleration : IQuantity, IComparable, IComparable + public partial struct Acceleration : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -576,12 +576,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Acceleration left, Acceleration right) + { + return left.Equals(right); + } + + public static bool operator !=(Acceleration left, Acceleration right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Acceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); + if(!(obj is Acceleration objAcceleration)) throw new ArgumentException("Expected type Acceleration.", nameof(obj)); - return CompareTo((Acceleration)obj); + return CompareTo(objAcceleration); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -590,6 +600,19 @@ public int CompareTo(Acceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Acceleration objAcceleration)) + return false; + + return Equals(objAcceleration); + } + + public bool Equals(Acceleration other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Acceleration within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 28ba064270..0c444e8343 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. /// - public partial struct AmountOfSubstance : IQuantity, IComparable, IComparable + public partial struct AmountOfSubstance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -590,12 +590,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(AmountOfSubstance left, AmountOfSubstance right) + { + return left.Equals(right); + } + + public static bool operator !=(AmountOfSubstance left, AmountOfSubstance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); + if(!(obj is AmountOfSubstance objAmountOfSubstance)) throw new ArgumentException("Expected type AmountOfSubstance.", nameof(obj)); - return CompareTo((AmountOfSubstance)obj); + return CompareTo(objAmountOfSubstance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -604,6 +614,19 @@ public int CompareTo(AmountOfSubstance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is AmountOfSubstance objAmountOfSubstance)) + return false; + + return Equals(objAmountOfSubstance); + } + + public bool Equals(AmountOfSubstance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AmountOfSubstance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index f859fbad1f..5c92424eee 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. /// - public partial struct AmplitudeRatio : IQuantity, IComparable, IComparable + public partial struct AmplitudeRatio : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -458,12 +458,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(AmplitudeRatio left, AmplitudeRatio right) + { + return left.Equals(right); + } + + public static bool operator !=(AmplitudeRatio left, AmplitudeRatio right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); + if(!(obj is AmplitudeRatio objAmplitudeRatio)) throw new ArgumentException("Expected type AmplitudeRatio.", nameof(obj)); - return CompareTo((AmplitudeRatio)obj); + return CompareTo(objAmplitudeRatio); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -472,6 +482,19 @@ public int CompareTo(AmplitudeRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is AmplitudeRatio objAmplitudeRatio)) + return false; + + return Equals(objAmplitudeRatio); + } + + public bool Equals(AmplitudeRatio other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AmplitudeRatio within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 65b6bb6dfa..da67ba174f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. /// - public partial struct Angle : IQuantity, IComparable, IComparable + public partial struct Angle : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -590,12 +590,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Angle left, Angle right) + { + return left.Equals(right); + } + + public static bool operator !=(Angle left, Angle right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Angle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); + if(!(obj is Angle objAngle)) throw new ArgumentException("Expected type Angle.", nameof(obj)); - return CompareTo((Angle)obj); + return CompareTo(objAngle); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -604,6 +614,19 @@ public int CompareTo(Angle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Angle objAngle)) + return false; + + return Equals(objAngle); + } + + public bool Equals(Angle other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Angle within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index 596f827be0..d9ffd9f485 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. /// - public partial struct ApparentEnergy : IQuantity, IComparable, IComparable + public partial struct ApparentEnergy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ApparentEnergy left, ApparentEnergy right) + { + return left.Equals(right); + } + + public static bool operator !=(ApparentEnergy left, ApparentEnergy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); + if(!(obj is ApparentEnergy objApparentEnergy)) throw new ArgumentException("Expected type ApparentEnergy.", nameof(obj)); - return CompareTo((ApparentEnergy)obj); + return CompareTo(objApparentEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(ApparentEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ApparentEnergy objApparentEnergy)) + return false; + + return Equals(objApparentEnergy); + } + + public bool Equals(ApparentEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ApparentEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 64d8151c26..339f0a85ed 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. /// - public partial struct ApparentPower : IQuantity, IComparable, IComparable + public partial struct ApparentPower : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -450,12 +450,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ApparentPower left, ApparentPower right) + { + return left.Equals(right); + } + + public static bool operator !=(ApparentPower left, ApparentPower right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); + if(!(obj is ApparentPower objApparentPower)) throw new ArgumentException("Expected type ApparentPower.", nameof(obj)); - return CompareTo((ApparentPower)obj); + return CompareTo(objApparentPower); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -464,6 +474,19 @@ public int CompareTo(ApparentPower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ApparentPower objApparentPower)) + return false; + + return Equals(objApparentPower); + } + + public bool Equals(ApparentPower other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ApparentPower within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index b1ec2d2b4b..834ca4aa2e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). /// - public partial struct Area : IQuantity, IComparable, IComparable + public partial struct Area : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -576,12 +576,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Area left, Area right) + { + return left.Equals(right); + } + + public static bool operator !=(Area left, Area right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Area)) throw new ArgumentException("Expected type Area.", nameof(obj)); + if(!(obj is Area objArea)) throw new ArgumentException("Expected type Area.", nameof(obj)); - return CompareTo((Area)obj); + return CompareTo(objArea); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -590,6 +600,19 @@ public int CompareTo(Area other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Area objArea)) + return false; + + return Equals(objArea); + } + + public bool Equals(Area other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Area within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 964eb04da1..4d2aa8e3c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The area density of a two-dimensional object is calculated as the mass per unit area. /// - public partial struct AreaDensity : IQuantity, IComparable, IComparable + public partial struct AreaDensity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -408,12 +408,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(AreaDensity left, AreaDensity right) + { + return left.Equals(right); + } + + public static bool operator !=(AreaDensity left, AreaDensity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); + if(!(obj is AreaDensity objAreaDensity)) throw new ArgumentException("Expected type AreaDensity.", nameof(obj)); - return CompareTo((AreaDensity)obj); + return CompareTo(objAreaDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -422,6 +432,19 @@ public int CompareTo(AreaDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is AreaDensity objAreaDensity)) + return false; + + return Equals(objAreaDensity); + } + + public bool Equals(AreaDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AreaDensity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index bf966032e2..df5403d431 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A geometric property of an area that reflects how its points are distributed with regard to an axis. /// - public partial struct AreaMomentOfInertia : IQuantity, IComparable, IComparable + public partial struct AreaMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -478,12 +478,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return left.Equals(right); + } + + public static bool operator !=(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is AreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); + if(!(obj is AreaMomentOfInertia objAreaMomentOfInertia)) throw new ArgumentException("Expected type AreaMomentOfInertia.", nameof(obj)); - return CompareTo((AreaMomentOfInertia)obj); + return CompareTo(objAreaMomentOfInertia); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -492,6 +502,19 @@ public int CompareTo(AreaMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is AreaMomentOfInertia objAreaMomentOfInertia)) + return false; + + return Equals(objAreaMomentOfInertia); + } + + public bool Equals(AreaMomentOfInertia other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another AreaMomentOfInertia within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 90a213a3c3..bc9a4ed598 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Bit_rate /// - public partial struct BitRate : IQuantity, IComparable, IComparable + public partial struct BitRate : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -761,12 +761,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(BitRate left, BitRate right) + { + return left.Equals(right); + } + + public static bool operator !=(BitRate left, BitRate right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); + if(!(obj is BitRate objBitRate)) throw new ArgumentException("Expected type BitRate.", nameof(obj)); - return CompareTo((BitRate)obj); + return CompareTo(objBitRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -775,6 +785,19 @@ public int CompareTo(BitRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is BitRate objBitRate)) + return false; + + return Equals(objBitRate); + } + + public bool Equals(BitRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another BitRate within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 7cf1844ee5..24001bf446 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. /// - public partial struct BrakeSpecificFuelConsumption : IQuantity, IComparable, IComparable + public partial struct BrakeSpecificFuelConsumption : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return left.Equals(right); + } + + public static bool operator !=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is BrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); + if(!(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) throw new ArgumentException("Expected type BrakeSpecificFuelConsumption.", nameof(obj)); - return CompareTo((BrakeSpecificFuelConsumption)obj); + return CompareTo(objBrakeSpecificFuelConsumption); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(BrakeSpecificFuelConsumption other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is BrakeSpecificFuelConsumption objBrakeSpecificFuelConsumption)) + return false; + + return Equals(objBrakeSpecificFuelConsumption); + } + + public bool Equals(BrakeSpecificFuelConsumption other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another BrakeSpecificFuelConsumption within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index 7ac339a54e..fb834ff5cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Capacitance /// - public partial struct Capacitance : IQuantity, IComparable, IComparable + public partial struct Capacitance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Capacitance left, Capacitance right) + { + return left.Equals(right); + } + + public static bool operator !=(Capacitance left, Capacitance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Capacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); + if(!(obj is Capacitance objCapacitance)) throw new ArgumentException("Expected type Capacitance.", nameof(obj)); - return CompareTo((Capacitance)obj); + return CompareTo(objCapacitance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(Capacitance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Capacitance objCapacitance)) + return false; + + return Equals(objCapacitance); + } + + public bool Equals(Capacitance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Capacitance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs index 9fbafe82cd..f0f973ddc0 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A unit that represents a fractional change in size in response to a change in temperature. /// - public partial struct CoefficientOfThermalExpansion : IQuantity, IComparable, IComparable + public partial struct CoefficientOfThermalExpansion : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Coeffi return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return left.Equals(right); + } + + public static bool operator !=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is CoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); + if(!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj)); - return CompareTo((CoefficientOfThermalExpansion)obj); + return CompareTo(objCoefficientOfThermalExpansion); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(CoefficientOfThermalExpansion other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) + return false; + + return Equals(objCoefficientOfThermalExpansion); + } + + public bool Equals(CoefficientOfThermalExpansion other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another CoefficientOfThermalExpansion within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index a08f4d9681..a1bc4cec77 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Density /// - public partial struct Density : IQuantity, IComparable, IComparable + public partial struct Density : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -929,12 +929,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Density left, Density right) + { + return left.Equals(right); + } + + public static bool operator !=(Density left, Density right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Density)) throw new ArgumentException("Expected type Density.", nameof(obj)); + if(!(obj is Density objDensity)) throw new ArgumentException("Expected type Density.", nameof(obj)); - return CompareTo((Density)obj); + return CompareTo(objDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -943,6 +953,19 @@ public int CompareTo(Density other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Density objDensity)) + return false; + + return Equals(objDensity); + } + + public bool Equals(Density other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Density within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index ffe34c5325..a492045fa3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. /// - public partial struct Duration : IQuantity, IComparable, IComparable + public partial struct Duration : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -534,12 +534,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Duration left, Duration right) + { + return left.Equals(right); + } + + public static bool operator !=(Duration left, Duration right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Duration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); + if(!(obj is Duration objDuration)) throw new ArgumentException("Expected type Duration.", nameof(obj)); - return CompareTo((Duration)obj); + return CompareTo(objDuration); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -548,6 +558,19 @@ public int CompareTo(Duration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Duration objDuration)) + return false; + + return Equals(objDuration); + } + + public bool Equals(Duration other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Duration within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index c34d64f223..c6f68cbcb4 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity /// - public partial struct DynamicViscosity : IQuantity, IComparable, IComparable + public partial struct DynamicViscosity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -481,12 +481,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(DynamicViscosity left, DynamicViscosity right) + { + return left.Equals(right); + } + + public static bool operator !=(DynamicViscosity left, DynamicViscosity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is DynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); + if(!(obj is DynamicViscosity objDynamicViscosity)) throw new ArgumentException("Expected type DynamicViscosity.", nameof(obj)); - return CompareTo((DynamicViscosity)obj); + return CompareTo(objDynamicViscosity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -495,6 +505,19 @@ public int CompareTo(DynamicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is DynamicViscosity objDynamicViscosity)) + return false; + + return Equals(objDynamicViscosity); + } + + public bool Equals(DynamicViscosity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another DynamicViscosity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 90565b5fac..0aa8614684 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). /// - public partial struct ElectricAdmittance : IQuantity, IComparable, IComparable + public partial struct ElectricAdmittance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -450,12 +450,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricAdmittance left, ElectricAdmittance right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricAdmittance left, ElectricAdmittance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); + if(!(obj is ElectricAdmittance objElectricAdmittance)) throw new ArgumentException("Expected type ElectricAdmittance.", nameof(obj)); - return CompareTo((ElectricAdmittance)obj); + return CompareTo(objElectricAdmittance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -464,6 +474,19 @@ public int CompareTo(ElectricAdmittance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricAdmittance objElectricAdmittance)) + return false; + + return Equals(objElectricAdmittance); + } + + public bool Equals(ElectricAdmittance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricAdmittance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index da923c8128..ad8c89f4e9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_charge /// - public partial struct ElectricCharge : IQuantity, IComparable, IComparable + public partial struct ElectricCharge : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricCharge left, ElectricCharge right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricCharge left, ElectricCharge right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); + if(!(obj is ElectricCharge objElectricCharge)) throw new ArgumentException("Expected type ElectricCharge.", nameof(obj)); - return CompareTo((ElectricCharge)obj); + return CompareTo(objElectricCharge); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(ElectricCharge other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCharge objElectricCharge)) + return false; + + return Equals(objElectricCharge); + } + + public bool Equals(ElectricCharge other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCharge within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 5e550efd3b..c7f07b4c82 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Charge_density /// - public partial struct ElectricChargeDensity : IQuantity, IComparable, IComparable + public partial struct ElectricChargeDensity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricChargeDensity left, ElectricChargeDensity right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricChargeDensity left, ElectricChargeDensity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); + if(!(obj is ElectricChargeDensity objElectricChargeDensity)) throw new ArgumentException("Expected type ElectricChargeDensity.", nameof(obj)); - return CompareTo((ElectricChargeDensity)obj); + return CompareTo(objElectricChargeDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(ElectricChargeDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricChargeDensity objElectricChargeDensity)) + return false; + + return Equals(objElectricChargeDensity); + } + + public bool Equals(ElectricChargeDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricChargeDensity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index 60fb3b81ff..055e85ca6e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance /// - public partial struct ElectricConductance : IQuantity, IComparable, IComparable + public partial struct ElectricConductance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -439,12 +439,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricConductance left, ElectricConductance right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricConductance left, ElectricConductance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); + if(!(obj is ElectricConductance objElectricConductance)) throw new ArgumentException("Expected type ElectricConductance.", nameof(obj)); - return CompareTo((ElectricConductance)obj); + return CompareTo(objElectricConductance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -453,6 +463,19 @@ public int CompareTo(ElectricConductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricConductance objElectricConductance)) + return false; + + return Equals(objElectricConductance); + } + + public bool Equals(ElectricConductance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricConductance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 7836917468..2bf2645bb3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricConductivity : IQuantity, IComparable, IComparable + public partial struct ElectricConductivity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricConductivity left, ElectricConductivity right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricConductivity left, ElectricConductivity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); + if(!(obj is ElectricConductivity objElectricConductivity)) throw new ArgumentException("Expected type ElectricConductivity.", nameof(obj)); - return CompareTo((ElectricConductivity)obj); + return CompareTo(objElectricConductivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(ElectricConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricConductivity objElectricConductivity)) + return false; + + return Equals(objElectricConductivity); + } + + public bool Equals(ElectricConductivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricConductivity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index b6f0f0e58c..297cf7cb67 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. /// - public partial struct ElectricCurrent : IQuantity, IComparable, IComparable + public partial struct ElectricCurrent : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -506,12 +506,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricCurrent left, ElectricCurrent right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricCurrent left, ElectricCurrent right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); + if(!(obj is ElectricCurrent objElectricCurrent)) throw new ArgumentException("Expected type ElectricCurrent.", nameof(obj)); - return CompareTo((ElectricCurrent)obj); + return CompareTo(objElectricCurrent); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -520,6 +530,19 @@ public int CompareTo(ElectricCurrent other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCurrent objElectricCurrent)) + return false; + + return Equals(objElectricCurrent); + } + + public bool Equals(ElectricCurrent other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCurrent within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index e8740cb1d7..454421c96a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Current_density /// - public partial struct ElectricCurrentDensity : IQuantity, IComparable, IComparable + public partial struct ElectricCurrentDensity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); + if(!(obj is ElectricCurrentDensity objElectricCurrentDensity)) throw new ArgumentException("Expected type ElectricCurrentDensity.", nameof(obj)); - return CompareTo((ElectricCurrentDensity)obj); + return CompareTo(objElectricCurrentDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(ElectricCurrentDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCurrentDensity objElectricCurrentDensity)) + return false; + + return Equals(objElectricCurrentDensity); + } + + public bool Equals(ElectricCurrentDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCurrentDensity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 40935eba59..45c50ff74e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In electromagnetism, the current gradient describes how the current changes in time. /// - public partial struct ElectricCurrentGradient : IQuantity, IComparable, IComparable + public partial struct ElectricCurrentGradient : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -408,12 +408,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); + if(!(obj is ElectricCurrentGradient objElectricCurrentGradient)) throw new ArgumentException("Expected type ElectricCurrentGradient.", nameof(obj)); - return CompareTo((ElectricCurrentGradient)obj); + return CompareTo(objElectricCurrentGradient); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -422,6 +432,19 @@ public int CompareTo(ElectricCurrentGradient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricCurrentGradient objElectricCurrentGradient)) + return false; + + return Equals(objElectricCurrentGradient); + } + + public bool Equals(ElectricCurrentGradient other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricCurrentGradient within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 5d9bf92cb2..92ad660991 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electric_field /// - public partial struct ElectricField : IQuantity, IComparable, IComparable + public partial struct ElectricField : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricField left, ElectricField right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricField left, ElectricField right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); + if(!(obj is ElectricField objElectricField)) throw new ArgumentException("Expected type ElectricField.", nameof(obj)); - return CompareTo((ElectricField)obj); + return CompareTo(objElectricField); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(ElectricField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricField objElectricField)) + return false; + + return Equals(objElectricField); + } + + public bool Equals(ElectricField other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricField within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 11965db9e3..f16d5ea0be 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Inductance /// - public partial struct ElectricInductance : IQuantity, IComparable, IComparable + public partial struct ElectricInductance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricInductance left, ElectricInductance right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricInductance left, ElectricInductance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); + if(!(obj is ElectricInductance objElectricInductance)) throw new ArgumentException("Expected type ElectricInductance.", nameof(obj)); - return CompareTo((ElectricInductance)obj); + return CompareTo(objElectricInductance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(ElectricInductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricInductance objElectricInductance)) + return false; + + return Equals(objElectricInductance); + } + + public bool Equals(ElectricInductance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricInductance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index 5427c05eff..94bb36db61 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. /// - public partial struct ElectricPotential : IQuantity, IComparable, IComparable + public partial struct ElectricPotential : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -464,12 +464,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricPotential left, ElectricPotential right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricPotential left, ElectricPotential right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); + if(!(obj is ElectricPotential objElectricPotential)) throw new ArgumentException("Expected type ElectricPotential.", nameof(obj)); - return CompareTo((ElectricPotential)obj); + return CompareTo(objElectricPotential); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -478,6 +488,19 @@ public int CompareTo(ElectricPotential other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricPotential objElectricPotential)) + return false; + + return Equals(objElectricPotential); + } + + public bool Equals(ElectricPotential other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricPotential within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index 78fb046ae6..decd51b7f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Alternating Current. /// - public partial struct ElectricPotentialAc : IQuantity, IComparable, IComparable + public partial struct ElectricPotentialAc : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -464,12 +464,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricPotentialAc left, ElectricPotentialAc right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricPotentialAc left, ElectricPotentialAc right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); + if(!(obj is ElectricPotentialAc objElectricPotentialAc)) throw new ArgumentException("Expected type ElectricPotentialAc.", nameof(obj)); - return CompareTo((ElectricPotentialAc)obj); + return CompareTo(objElectricPotentialAc); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -478,6 +488,19 @@ public int CompareTo(ElectricPotentialAc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricPotentialAc objElectricPotentialAc)) + return false; + + return Equals(objElectricPotentialAc); + } + + public bool Equals(ElectricPotentialAc other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricPotentialAc within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 68d61de663..8e52d3a11f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The Electric Potential of a system known to use Direct Current. /// - public partial struct ElectricPotentialDc : IQuantity, IComparable, IComparable + public partial struct ElectricPotentialDc : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -464,12 +464,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricPotentialDc left, ElectricPotentialDc right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricPotentialDc left, ElectricPotentialDc right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); + if(!(obj is ElectricPotentialDc objElectricPotentialDc)) throw new ArgumentException("Expected type ElectricPotentialDc.", nameof(obj)); - return CompareTo((ElectricPotentialDc)obj); + return CompareTo(objElectricPotentialDc); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -478,6 +488,19 @@ public int CompareTo(ElectricPotentialDc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricPotentialDc objElectricPotentialDc)) + return false; + + return Equals(objElectricPotentialDc); + } + + public bool Equals(ElectricPotentialDc other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricPotentialDc within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index 66945411ed..39977abb4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. /// - public partial struct ElectricResistance : IQuantity, IComparable, IComparable + public partial struct ElectricResistance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -450,12 +450,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricResistance left, ElectricResistance right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricResistance left, ElectricResistance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); + if(!(obj is ElectricResistance objElectricResistance)) throw new ArgumentException("Expected type ElectricResistance.", nameof(obj)); - return CompareTo((ElectricResistance)obj); + return CompareTo(objElectricResistance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -464,6 +474,19 @@ public int CompareTo(ElectricResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricResistance objElectricResistance)) + return false; + + return Equals(objElectricResistance); + } + + public bool Equals(ElectricResistance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricResistance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index a02d262b66..9a5659af14 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// - public partial struct ElectricResistivity : IQuantity, IComparable, IComparable + public partial struct ElectricResistivity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -453,12 +453,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ElectricResistivity left, ElectricResistivity right) + { + return left.Equals(right); + } + + public static bool operator !=(ElectricResistivity left, ElectricResistivity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); + if(!(obj is ElectricResistivity objElectricResistivity)) throw new ArgumentException("Expected type ElectricResistivity.", nameof(obj)); - return CompareTo((ElectricResistivity)obj); + return CompareTo(objElectricResistivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -467,6 +477,19 @@ public int CompareTo(ElectricResistivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ElectricResistivity objElectricResistivity)) + return false; + + return Equals(objElectricResistivity); + } + + public bool Equals(ElectricResistivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ElectricResistivity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index c26dd5137a..70dd0022b9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. /// - public partial struct Energy : IQuantity, IComparable, IComparable + public partial struct Energy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -702,12 +702,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Energy return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Energy left, Energy right) + { + return left.Equals(right); + } + + public static bool operator !=(Energy left, Energy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Energy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); + if(!(obj is Energy objEnergy)) throw new ArgumentException("Expected type Energy.", nameof(obj)); - return CompareTo((Energy)obj); + return CompareTo(objEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -716,6 +726,19 @@ public int CompareTo(Energy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Energy objEnergy)) + return false; + + return Equals(objEnergy); + } + + public bool Equals(Energy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Energy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index 7deb4c03e8..d70b0e10ea 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units /// - public partial struct Entropy : IQuantity, IComparable, IComparable + public partial struct Entropy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -492,12 +492,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Entrop return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Entropy left, Entropy right) + { + return left.Equals(right); + } + + public static bool operator !=(Entropy left, Entropy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Entropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); + if(!(obj is Entropy objEntropy)) throw new ArgumentException("Expected type Entropy.", nameof(obj)); - return CompareTo((Entropy)obj); + return CompareTo(objEntropy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -506,6 +516,19 @@ public int CompareTo(Entropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Entropy objEntropy)) + return false; + + return Equals(objEntropy); + } + + public bool Equals(Entropy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Entropy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 90fce0215d..be24f8f69e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. /// - public partial struct Force : IQuantity, IComparable, IComparable + public partial struct Force : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -576,12 +576,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceU return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Force left, Force right) + { + return left.Equals(right); + } + + public static bool operator !=(Force left, Force right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Force)) throw new ArgumentException("Expected type Force.", nameof(obj)); + if(!(obj is Force objForce)) throw new ArgumentException("Expected type Force.", nameof(obj)); - return CompareTo((Force)obj); + return CompareTo(objForce); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -590,6 +600,19 @@ public int CompareTo(Force other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Force objForce)) + return false; + + return Equals(objForce); + } + + public bool Equals(Force other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Force within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 99d4d66a9d..0d6065acc8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). /// - public partial struct ForceChangeRate : IQuantity, IComparable, IComparable + public partial struct ForceChangeRate : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -548,12 +548,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceC return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ForceChangeRate left, ForceChangeRate right) + { + return left.Equals(right); + } + + public static bool operator !=(ForceChangeRate left, ForceChangeRate right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); + if(!(obj is ForceChangeRate objForceChangeRate)) throw new ArgumentException("Expected type ForceChangeRate.", nameof(obj)); - return CompareTo((ForceChangeRate)obj); + return CompareTo(objForceChangeRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -562,6 +572,19 @@ public int CompareTo(ForceChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ForceChangeRate objForceChangeRate)) + return false; + + return Equals(objForceChangeRate); + } + + public bool Equals(ForceChangeRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ForceChangeRate within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 6db84c97ba..1cf9184c55 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The magnitude of force per unit length. /// - public partial struct ForcePerLength : IQuantity, IComparable, IComparable + public partial struct ForcePerLength : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -520,12 +520,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out ForceP return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ForcePerLength left, ForcePerLength right) + { + return left.Equals(right); + } + + public static bool operator !=(ForcePerLength left, ForcePerLength right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); + if(!(obj is ForcePerLength objForcePerLength)) throw new ArgumentException("Expected type ForcePerLength.", nameof(obj)); - return CompareTo((ForcePerLength)obj); + return CompareTo(objForcePerLength); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -534,6 +544,19 @@ public int CompareTo(ForcePerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ForcePerLength objForcePerLength)) + return false; + + return Equals(objForcePerLength); + } + + public bool Equals(ForcePerLength other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ForcePerLength within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 6d40d94683..b3a24c9827 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The number of occurrences of a repeating event per unit time. /// - public partial struct Frequency : IQuantity, IComparable, IComparable + public partial struct Frequency : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -506,12 +506,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Freque return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Frequency left, Frequency right) + { + return left.Equals(right); + } + + public static bool operator !=(Frequency left, Frequency right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Frequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); + if(!(obj is Frequency objFrequency)) throw new ArgumentException("Expected type Frequency.", nameof(obj)); - return CompareTo((Frequency)obj); + return CompareTo(objFrequency); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -520,6 +530,19 @@ public int CompareTo(Frequency other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Frequency objFrequency)) + return false; + + return Equals(objFrequency); + } + + public bool Equals(Frequency other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Frequency within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 3f46529e65..d236d8de5a 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Heat flux is the flow of energy per unit of area per unit of time /// - public partial struct HeatFlux : IQuantity, IComparable, IComparable + public partial struct HeatFlux : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -618,12 +618,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatFl return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(HeatFlux left, HeatFlux right) + { + return left.Equals(right); + } + + public static bool operator !=(HeatFlux left, HeatFlux right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); + if(!(obj is HeatFlux objHeatFlux)) throw new ArgumentException("Expected type HeatFlux.", nameof(obj)); - return CompareTo((HeatFlux)obj); + return CompareTo(objHeatFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -632,6 +642,19 @@ public int CompareTo(HeatFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is HeatFlux objHeatFlux)) + return false; + + return Equals(objHeatFlux); + } + + public bool Equals(HeatFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another HeatFlux within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 6f727619ef..c355fb90d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) /// - public partial struct HeatTransferCoefficient : IQuantity, IComparable, IComparable + public partial struct HeatTransferCoefficient : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -422,12 +422,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out HeatTr return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return left.Equals(right); + } + + public static bool operator !=(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is HeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); + if(!(obj is HeatTransferCoefficient objHeatTransferCoefficient)) throw new ArgumentException("Expected type HeatTransferCoefficient.", nameof(obj)); - return CompareTo((HeatTransferCoefficient)obj); + return CompareTo(objHeatTransferCoefficient); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -436,6 +446,19 @@ public int CompareTo(HeatTransferCoefficient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is HeatTransferCoefficient objHeatTransferCoefficient)) + return false; + + return Equals(objHeatTransferCoefficient); + } + + public bool Equals(HeatTransferCoefficient other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another HeatTransferCoefficient within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index f3c0a403b8..c5da84031f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Illuminance /// - public partial struct Illuminance : IQuantity, IComparable, IComparable + public partial struct Illuminance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -453,12 +453,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Illumi return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Illuminance left, Illuminance right) + { + return left.Equals(right); + } + + public static bool operator !=(Illuminance left, Illuminance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Illuminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); + if(!(obj is Illuminance objIlluminance)) throw new ArgumentException("Expected type Illuminance.", nameof(obj)); - return CompareTo((Illuminance)obj); + return CompareTo(objIlluminance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -467,6 +477,19 @@ public int CompareTo(Illuminance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Illuminance objIlluminance)) + return false; + + return Equals(objIlluminance); + } + + public bool Equals(Illuminance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Illuminance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 70b19de0c1..d713e80770 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// - public partial struct Information : IQuantity, IComparable, IComparable + public partial struct Information : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -758,12 +758,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Inform return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Information left, Information right) + { + return left.Equals(right); + } + + public static bool operator !=(Information left, Information right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Information)) throw new ArgumentException("Expected type Information.", nameof(obj)); + if(!(obj is Information objInformation)) throw new ArgumentException("Expected type Information.", nameof(obj)); - return CompareTo((Information)obj); + return CompareTo(objInformation); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -772,6 +782,19 @@ public int CompareTo(Information other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Information objInformation)) + return false; + + return Equals(objInformation); + } + + public bool Equals(Information other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Information within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index 26cdfdec40..8a216b2374 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. /// - public partial struct Irradiance : IQuantity, IComparable, IComparable + public partial struct Irradiance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -422,12 +422,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Irradiance left, Irradiance right) + { + return left.Equals(right); + } + + public static bool operator !=(Irradiance left, Irradiance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); + if(!(obj is Irradiance objIrradiance)) throw new ArgumentException("Expected type Irradiance.", nameof(obj)); - return CompareTo((Irradiance)obj); + return CompareTo(objIrradiance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -436,6 +446,19 @@ public int CompareTo(Irradiance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Irradiance objIrradiance)) + return false; + + return Equals(objIrradiance); + } + + public bool Equals(Irradiance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Irradiance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index dc2a76cb7d..9661a629eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Irradiation /// - public partial struct Irradiation : IQuantity, IComparable, IComparable + public partial struct Irradiation : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -439,12 +439,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Irradi return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Irradiation left, Irradiation right) + { + return left.Equals(right); + } + + public static bool operator !=(Irradiation left, Irradiation right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Irradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); + if(!(obj is Irradiation objIrradiation)) throw new ArgumentException("Expected type Irradiation.", nameof(obj)); - return CompareTo((Irradiation)obj); + return CompareTo(objIrradiation); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -453,6 +463,19 @@ public int CompareTo(Irradiation other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Irradiation objIrradiation)) + return false; + + return Equals(objIrradiation); + } + + public bool Equals(Irradiation other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Irradiation within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index e7a4ccb2b6..7f291dac8a 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Viscosity /// - public partial struct KinematicViscosity : IQuantity, IComparable, IComparable + public partial struct KinematicViscosity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -509,12 +509,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Kinema return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(KinematicViscosity left, KinematicViscosity right) + { + return left.Equals(right); + } + + public static bool operator !=(KinematicViscosity left, KinematicViscosity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is KinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); + if(!(obj is KinematicViscosity objKinematicViscosity)) throw new ArgumentException("Expected type KinematicViscosity.", nameof(obj)); - return CompareTo((KinematicViscosity)obj); + return CompareTo(objKinematicViscosity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -523,6 +533,19 @@ public int CompareTo(KinematicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is KinematicViscosity objKinematicViscosity)) + return false; + + return Equals(objKinematicViscosity); + } + + public bool Equals(KinematicViscosity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another KinematicViscosity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index 43654a3a37..be4066d7f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Lapse rate is the rate at which Earth's atmospheric temperature decreases with an increase in altitude, or increases with the decrease in altitude. /// - public partial struct LapseRate : IQuantity, IComparable, IComparable + public partial struct LapseRate : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -408,12 +408,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LapseR return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(LapseRate left, LapseRate right) + { + return left.Equals(right); + } + + public static bool operator !=(LapseRate left, LapseRate right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); + if(!(obj is LapseRate objLapseRate)) throw new ArgumentException("Expected type LapseRate.", nameof(obj)); - return CompareTo((LapseRate)obj); + return CompareTo(objLapseRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -422,6 +432,19 @@ public int CompareTo(LapseRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is LapseRate objLapseRate)) + return false; + + return Equals(objLapseRate); + } + + public bool Equals(LapseRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LapseRate within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 51e7126158..e03e322247 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// - public partial struct Length : IQuantity, IComparable, IComparable + public partial struct Length : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -702,12 +702,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Length return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Length left, Length right) + { + return left.Equals(right); + } + + public static bool operator !=(Length left, Length right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Length)) throw new ArgumentException("Expected type Length.", nameof(obj)); + if(!(obj is Length objLength)) throw new ArgumentException("Expected type Length.", nameof(obj)); - return CompareTo((Length)obj); + return CompareTo(objLength); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -716,6 +726,19 @@ public int CompareTo(Length other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Length objLength)) + return false; + + return Equals(objLength); + } + + public bool Equals(Length other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Length within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index e1dda31785..e35db5d5c1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// - public partial struct Level : IQuantity, IComparable, IComparable + public partial struct Level : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -430,12 +430,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out LevelU return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Level left, Level right) + { + return left.Equals(right); + } + + public static bool operator !=(Level left, Level right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Level)) throw new ArgumentException("Expected type Level.", nameof(obj)); + if(!(obj is Level objLevel)) throw new ArgumentException("Expected type Level.", nameof(obj)); - return CompareTo((Level)obj); + return CompareTo(objLevel); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -444,6 +454,19 @@ public int CompareTo(Level other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Level objLevel)) + return false; + + return Equals(objLevel); + } + + public bool Equals(Level other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Level within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 26c0c639a3..cbf5870f3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Linear_density /// - public partial struct LinearDensity : IQuantity, IComparable, IComparable + public partial struct LinearDensity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -439,12 +439,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Linear return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(LinearDensity left, LinearDensity right) + { + return left.Equals(right); + } + + public static bool operator !=(LinearDensity left, LinearDensity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); + if(!(obj is LinearDensity objLinearDensity)) throw new ArgumentException("Expected type LinearDensity.", nameof(obj)); - return CompareTo((LinearDensity)obj); + return CompareTo(objLinearDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -453,6 +463,19 @@ public int CompareTo(LinearDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is LinearDensity objLinearDensity)) + return false; + + return Equals(objLinearDensity); + } + + public bool Equals(LinearDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LinearDensity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index 1e6dd41ffa..a7ee796bb5 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_flux /// - public partial struct LuminousFlux : IQuantity, IComparable, IComparable + public partial struct LuminousFlux : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(LuminousFlux left, LuminousFlux right) + { + return left.Equals(right); + } + + public static bool operator !=(LuminousFlux left, LuminousFlux right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); + if(!(obj is LuminousFlux objLuminousFlux)) throw new ArgumentException("Expected type LuminousFlux.", nameof(obj)); - return CompareTo((LuminousFlux)obj); + return CompareTo(objLuminousFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(LuminousFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is LuminousFlux objLuminousFlux)) + return false; + + return Equals(objLuminousFlux); + } + + public bool Equals(LuminousFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LuminousFlux within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 9ed6bca64a..ebfd3b327e 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Luminous_intensity /// - public partial struct LuminousIntensity : IQuantity, IComparable, IComparable + public partial struct LuminousIntensity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Lumino return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(LuminousIntensity left, LuminousIntensity right) + { + return left.Equals(right); + } + + public static bool operator !=(LuminousIntensity left, LuminousIntensity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is LuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); + if(!(obj is LuminousIntensity objLuminousIntensity)) throw new ArgumentException("Expected type LuminousIntensity.", nameof(obj)); - return CompareTo((LuminousIntensity)obj); + return CompareTo(objLuminousIntensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(LuminousIntensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is LuminousIntensity objLuminousIntensity)) + return false; + + return Equals(objLuminousIntensity); + } + + public bool Equals(LuminousIntensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another LuminousIntensity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index 15c469f1dd..53efad53e9 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_field /// - public partial struct MagneticField : IQuantity, IComparable, IComparable + public partial struct MagneticField : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MagneticField left, MagneticField right) + { + return left.Equals(right); + } + + public static bool operator !=(MagneticField left, MagneticField right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); + if(!(obj is MagneticField objMagneticField)) throw new ArgumentException("Expected type MagneticField.", nameof(obj)); - return CompareTo((MagneticField)obj); + return CompareTo(objMagneticField); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(MagneticField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MagneticField objMagneticField)) + return false; + + return Equals(objMagneticField); + } + + public bool Equals(MagneticField other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MagneticField within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index b3d2057cfb..6758122032 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetic_flux /// - public partial struct MagneticFlux : IQuantity, IComparable, IComparable + public partial struct MagneticFlux : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MagneticFlux left, MagneticFlux right) + { + return left.Equals(right); + } + + public static bool operator !=(MagneticFlux left, MagneticFlux right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); + if(!(obj is MagneticFlux objMagneticFlux)) throw new ArgumentException("Expected type MagneticFlux.", nameof(obj)); - return CompareTo((MagneticFlux)obj); + return CompareTo(objMagneticFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(MagneticFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MagneticFlux objMagneticFlux)) + return false; + + return Equals(objMagneticFlux); + } + + public bool Equals(MagneticFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MagneticFlux within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index d1e33f1393..fb03bce307 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Magnetization /// - public partial struct Magnetization : IQuantity, IComparable, IComparable + public partial struct Magnetization : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Magnet return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Magnetization left, Magnetization right) + { + return left.Equals(right); + } + + public static bool operator !=(Magnetization left, Magnetization right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Magnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); + if(!(obj is Magnetization objMagnetization)) throw new ArgumentException("Expected type Magnetization.", nameof(obj)); - return CompareTo((Magnetization)obj); + return CompareTo(objMagnetization); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(Magnetization other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Magnetization objMagnetization)) + return false; + + return Equals(objMagnetization); + } + + public bool Equals(Magnetization other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Magnetization within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 00b917fb96..f68c7a731b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). /// - public partial struct Mass : IQuantity, IComparable, IComparable + public partial struct Mass : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -702,12 +702,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassUn return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Mass left, Mass right) + { + return left.Equals(right); + } + + public static bool operator !=(Mass left, Mass right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Mass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); + if(!(obj is Mass objMass)) throw new ArgumentException("Expected type Mass.", nameof(obj)); - return CompareTo((Mass)obj); + return CompareTo(objMass); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -716,6 +726,19 @@ public int CompareTo(Mass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Mass objMass)) + return false; + + return Equals(objMass); + } + + public bool Equals(Mass other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Mass within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 920244de6f..1b21e02463 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). /// - public partial struct MassFlow : IQuantity, IComparable, IComparable + public partial struct MassFlow : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -632,12 +632,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MassFlow left, MassFlow right) + { + return left.Equals(right); + } + + public static bool operator !=(MassFlow left, MassFlow right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); + if(!(obj is MassFlow objMassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); - return CompareTo((MassFlow)obj); + return CompareTo(objMassFlow); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -646,6 +656,19 @@ public int CompareTo(MassFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MassFlow objMassFlow)) + return false; + + return Equals(objMassFlow); + } + + public bool Equals(MassFlow other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MassFlow within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index cad76e59b4..6e77cad9f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Mass flux is the mass flow rate per unit area. /// - public partial struct MassFlux : IQuantity, IComparable, IComparable + public partial struct MassFlux : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -422,12 +422,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassFl return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MassFlux left, MassFlux right) + { + return left.Equals(right); + } + + public static bool operator !=(MassFlux left, MassFlux right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); + if(!(obj is MassFlux objMassFlux)) throw new ArgumentException("Expected type MassFlux.", nameof(obj)); - return CompareTo((MassFlux)obj); + return CompareTo(objMassFlux); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -436,6 +446,19 @@ public int CompareTo(MassFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MassFlux objMassFlux)) + return false; + + return Equals(objMassFlux); + } + + public bool Equals(MassFlux other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MassFlux within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 03dc8b9dc4..8a99f8e914 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A property of body reflects how its mass is distributed with regard to an axis. /// - public partial struct MassMomentOfInertia : IQuantity, IComparable, IComparable + public partial struct MassMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -786,12 +786,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MassMo return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MassMomentOfInertia left, MassMomentOfInertia right) + { + return left.Equals(right); + } + + public static bool operator !=(MassMomentOfInertia left, MassMomentOfInertia right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); + if(!(obj is MassMomentOfInertia objMassMomentOfInertia)) throw new ArgumentException("Expected type MassMomentOfInertia.", nameof(obj)); - return CompareTo((MassMomentOfInertia)obj); + return CompareTo(objMassMomentOfInertia); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -800,6 +810,19 @@ public int CompareTo(MassMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MassMomentOfInertia objMassMomentOfInertia)) + return false; + + return Equals(objMassMomentOfInertia); + } + + public bool Equals(MassMomentOfInertia other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MassMomentOfInertia within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index 6c6cd51080..a1e0c9befd 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Molar energy is the amount of energy stored in 1 mole of a substance. /// - public partial struct MolarEnergy : IQuantity, IComparable, IComparable + public partial struct MolarEnergy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MolarEnergy left, MolarEnergy right) + { + return left.Equals(right); + } + + public static bool operator !=(MolarEnergy left, MolarEnergy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); + if(!(obj is MolarEnergy objMolarEnergy)) throw new ArgumentException("Expected type MolarEnergy.", nameof(obj)); - return CompareTo((MolarEnergy)obj); + return CompareTo(objMolarEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(MolarEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MolarEnergy objMolarEnergy)) + return false; + + return Equals(objMolarEnergy); + } + + public bool Equals(MolarEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MolarEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 0fcbf107b6..807f2ef8b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. /// - public partial struct MolarEntropy : IQuantity, IComparable, IComparable + public partial struct MolarEntropy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarE return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MolarEntropy left, MolarEntropy right) + { + return left.Equals(right); + } + + public static bool operator !=(MolarEntropy left, MolarEntropy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); + if(!(obj is MolarEntropy objMolarEntropy)) throw new ArgumentException("Expected type MolarEntropy.", nameof(obj)); - return CompareTo((MolarEntropy)obj); + return CompareTo(objMolarEntropy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(MolarEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MolarEntropy objMolarEntropy)) + return false; + + return Equals(objMolarEntropy); + } + + public bool Equals(MolarEntropy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MolarEntropy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index 11d2794738..a9ac972482 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. /// - public partial struct MolarMass : IQuantity, IComparable, IComparable + public partial struct MolarMass : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -562,12 +562,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out MolarM return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(MolarMass left, MolarMass right) + { + return left.Equals(right); + } + + public static bool operator !=(MolarMass left, MolarMass right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); + if(!(obj is MolarMass objMolarMass)) throw new ArgumentException("Expected type MolarMass.", nameof(obj)); - return CompareTo((MolarMass)obj); + return CompareTo(objMolarMass); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -576,6 +586,19 @@ public int CompareTo(MolarMass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is MolarMass objMolarMass)) + return false; + + return Equals(objMolarMass); + } + + public bool Equals(MolarMass other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another MolarMass within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 9503775cf3..c3bb500b58 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Molar_concentration /// - public partial struct Molarity : IQuantity, IComparable, IComparable + public partial struct Molarity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -509,12 +509,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Molari return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Molarity left, Molarity right) + { + return left.Equals(right); + } + + public static bool operator !=(Molarity left, Molarity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Molarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); + if(!(obj is Molarity objMolarity)) throw new ArgumentException("Expected type Molarity.", nameof(obj)); - return CompareTo((Molarity)obj); + return CompareTo(objMolarity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -523,6 +533,19 @@ public int CompareTo(Molarity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Molarity objMolarity)) + return false; + + return Equals(objMolarity); + } + + public bool Equals(Molarity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Molarity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 8082a6de81..c837854442 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) /// - public partial struct Permeability : IQuantity, IComparable, IComparable + public partial struct Permeability : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permea return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Permeability left, Permeability right) + { + return left.Equals(right); + } + + public static bool operator !=(Permeability left, Permeability right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); + if(!(obj is Permeability objPermeability)) throw new ArgumentException("Expected type Permeability.", nameof(obj)); - return CompareTo((Permeability)obj); + return CompareTo(objPermeability); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(Permeability other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Permeability objPermeability)) + return false; + + return Equals(objPermeability); + } + + public bool Equals(Permeability other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Permeability within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index b8bb4e17a2..0135c92d4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Permittivity /// - public partial struct Permittivity : IQuantity, IComparable, IComparable + public partial struct Permittivity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Permit return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Permittivity left, Permittivity right) + { + return left.Equals(right); + } + + public static bool operator !=(Permittivity left, Permittivity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Permittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); + if(!(obj is Permittivity objPermittivity)) throw new ArgumentException("Expected type Permittivity.", nameof(obj)); - return CompareTo((Permittivity)obj); + return CompareTo(objPermittivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(Permittivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Permittivity objPermittivity)) + return false; + + return Equals(objPermittivity); + } + + public bool Equals(Permittivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Permittivity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 2bc7cf438d..5af1aba2d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. /// - public partial struct Power : IQuantity, IComparable, IComparable + public partial struct Power : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -674,12 +674,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerU return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Power left, Power right) + { + return left.Equals(right); + } + + public static bool operator !=(Power left, Power right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Power)) throw new ArgumentException("Expected type Power.", nameof(obj)); + if(!(obj is Power objPower)) throw new ArgumentException("Expected type Power.", nameof(obj)); - return CompareTo((Power)obj); + return CompareTo(objPower); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -688,6 +698,19 @@ public int CompareTo(Power other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Power objPower)) + return false; + + return Equals(objPower); + } + + public bool Equals(Power other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Power within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index 5151160a74..0561b93c66 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The amount of power in a volume. /// - public partial struct PowerDensity : IQuantity, IComparable, IComparable + public partial struct PowerDensity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -1010,12 +1010,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerD return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(PowerDensity left, PowerDensity right) + { + return left.Equals(right); + } + + public static bool operator !=(PowerDensity left, PowerDensity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); + if(!(obj is PowerDensity objPowerDensity)) throw new ArgumentException("Expected type PowerDensity.", nameof(obj)); - return CompareTo((PowerDensity)obj); + return CompareTo(objPowerDensity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -1024,6 +1034,19 @@ public int CompareTo(PowerDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is PowerDensity objPowerDensity)) + return false; + + return Equals(objPowerDensity); + } + + public bool Equals(PowerDensity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another PowerDensity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index 5df9c78aba..3173544500 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The strength of a signal expressed in decibels (dB) relative to one watt. /// - public partial struct PowerRatio : IQuantity, IComparable, IComparable + public partial struct PowerRatio : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -430,12 +430,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out PowerR return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(PowerRatio left, PowerRatio right) + { + return left.Equals(right); + } + + public static bool operator !=(PowerRatio left, PowerRatio right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); + if(!(obj is PowerRatio objPowerRatio)) throw new ArgumentException("Expected type PowerRatio.", nameof(obj)); - return CompareTo((PowerRatio)obj); + return CompareTo(objPowerRatio); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -444,6 +454,19 @@ public int CompareTo(PowerRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is PowerRatio objPowerRatio)) + return false; + + return Equals(objPowerRatio); + } + + public bool Equals(PowerRatio other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another PowerRatio within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index cc45146e5b..3071a864d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). /// - public partial struct Pressure : IQuantity, IComparable, IComparable + public partial struct Pressure : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -954,12 +954,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Pressure left, Pressure right) + { + return left.Equals(right); + } + + public static bool operator !=(Pressure left, Pressure right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Pressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); + if(!(obj is Pressure objPressure)) throw new ArgumentException("Expected type Pressure.", nameof(obj)); - return CompareTo((Pressure)obj); + return CompareTo(objPressure); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -968,6 +978,19 @@ public int CompareTo(Pressure other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Pressure objPressure)) + return false; + + return Equals(objPressure); + } + + public bool Equals(Pressure other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Pressure within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index d9a57ba793..eebe52221b 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). /// - public partial struct PressureChangeRate : IQuantity, IComparable, IComparable + public partial struct PressureChangeRate : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -450,12 +450,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Pressu return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(PressureChangeRate left, PressureChangeRate right) + { + return left.Equals(right); + } + + public static bool operator !=(PressureChangeRate left, PressureChangeRate right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is PressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); + if(!(obj is PressureChangeRate objPressureChangeRate)) throw new ArgumentException("Expected type PressureChangeRate.", nameof(obj)); - return CompareTo((PressureChangeRate)obj); + return CompareTo(objPressureChangeRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -464,6 +474,19 @@ public int CompareTo(PressureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is PressureChangeRate objPressureChangeRate)) + return false; + + return Equals(objPressureChangeRate); + } + + public bool Equals(PressureChangeRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another PressureChangeRate within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index 55a6b68607..3162555801 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). /// - public partial struct Ratio : IQuantity, IComparable, IComparable + public partial struct Ratio : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -478,12 +478,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out RatioU return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Ratio left, Ratio right) + { + return left.Equals(right); + } + + public static bool operator !=(Ratio left, Ratio right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Ratio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); + if(!(obj is Ratio objRatio)) throw new ArgumentException("Expected type Ratio.", nameof(obj)); - return CompareTo((Ratio)obj); + return CompareTo(objRatio); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -492,6 +502,19 @@ public int CompareTo(Ratio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Ratio objRatio)) + return false; + + return Equals(objRatio); + } + + public bool Equals(Ratio other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Ratio within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 9f5d322b4c..11a5edac93 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. /// - public partial struct ReactiveEnergy : IQuantity, IComparable, IComparable + public partial struct ReactiveEnergy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ReactiveEnergy left, ReactiveEnergy right) + { + return left.Equals(right); + } + + public static bool operator !=(ReactiveEnergy left, ReactiveEnergy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); + if(!(obj is ReactiveEnergy objReactiveEnergy)) throw new ArgumentException("Expected type ReactiveEnergy.", nameof(obj)); - return CompareTo((ReactiveEnergy)obj); + return CompareTo(objReactiveEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(ReactiveEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ReactiveEnergy objReactiveEnergy)) + return false; + + return Equals(objReactiveEnergy); + } + + public bool Equals(ReactiveEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ReactiveEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index cb2d1893e7..aa09b88dd1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. /// - public partial struct ReactivePower : IQuantity, IComparable, IComparable + public partial struct ReactivePower : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -450,12 +450,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Reacti return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ReactivePower left, ReactivePower right) + { + return left.Equals(right); + } + + public static bool operator !=(ReactivePower left, ReactivePower right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); + if(!(obj is ReactivePower objReactivePower)) throw new ArgumentException("Expected type ReactivePower.", nameof(obj)); - return CompareTo((ReactivePower)obj); + return CompareTo(objReactivePower); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -464,6 +474,19 @@ public int CompareTo(ReactivePower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ReactivePower objReactivePower)) + return false; + + return Equals(objReactivePower); + } + + public bool Equals(ReactivePower other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ReactivePower within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index ff836dfcfb..687e2d4e0e 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Angular acceleration is the rate of change of rotational speed. /// - public partial struct RotationalAcceleration : IQuantity, IComparable, IComparable + public partial struct RotationalAcceleration : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(RotationalAcceleration left, RotationalAcceleration right) + { + return left.Equals(right); + } + + public static bool operator !=(RotationalAcceleration left, RotationalAcceleration right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); + if(!(obj is RotationalAcceleration objRotationalAcceleration)) throw new ArgumentException("Expected type RotationalAcceleration.", nameof(obj)); - return CompareTo((RotationalAcceleration)obj); + return CompareTo(objRotationalAcceleration); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(RotationalAcceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalAcceleration objRotationalAcceleration)) + return false; + + return Equals(objRotationalAcceleration); + } + + public bool Equals(RotationalAcceleration other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalAcceleration within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 0c83767b7a..9757bcca37 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). /// - public partial struct RotationalSpeed : IQuantity, IComparable, IComparable + public partial struct RotationalSpeed : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -576,12 +576,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(RotationalSpeed left, RotationalSpeed right) + { + return left.Equals(right); + } + + public static bool operator !=(RotationalSpeed left, RotationalSpeed right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); + if(!(obj is RotationalSpeed objRotationalSpeed)) throw new ArgumentException("Expected type RotationalSpeed.", nameof(obj)); - return CompareTo((RotationalSpeed)obj); + return CompareTo(objRotationalSpeed); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -590,6 +600,19 @@ public int CompareTo(RotationalSpeed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalSpeed objRotationalSpeed)) + return false; + + return Equals(objRotationalSpeed); + } + + public bool Equals(RotationalSpeed other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalSpeed within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index b6b3ca5bef..083edb31ff 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffness : IQuantity, IComparable, IComparable + public partial struct RotationalStiffness : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(RotationalStiffness left, RotationalStiffness right) + { + return left.Equals(right); + } + + public static bool operator !=(RotationalStiffness left, RotationalStiffness right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); + if(!(obj is RotationalStiffness objRotationalStiffness)) throw new ArgumentException("Expected type RotationalStiffness.", nameof(obj)); - return CompareTo((RotationalStiffness)obj); + return CompareTo(objRotationalStiffness); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(RotationalStiffness other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalStiffness objRotationalStiffness)) + return false; + + return Equals(objRotationalStiffness); + } + + public bool Equals(RotationalStiffness other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalStiffness within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index 7a92189734..7c0d807bcc 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// - public partial struct RotationalStiffnessPerLength : IQuantity, IComparable, IComparable + public partial struct RotationalStiffnessPerLength : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -436,12 +436,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Rotati return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return left.Equals(right); + } + + public static bool operator !=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is RotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); + if(!(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) throw new ArgumentException("Expected type RotationalStiffnessPerLength.", nameof(obj)); - return CompareTo((RotationalStiffnessPerLength)obj); + return CompareTo(objRotationalStiffnessPerLength); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -450,6 +460,19 @@ public int CompareTo(RotationalStiffnessPerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is RotationalStiffnessPerLength objRotationalStiffnessPerLength)) + return false; + + return Equals(objRotationalStiffnessPerLength); + } + + public bool Equals(RotationalStiffnessPerLength other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another RotationalStiffnessPerLength within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index b9e5105a40..d8f03d8b08 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Solid_angle /// - public partial struct SolidAngle : IQuantity, IComparable, IComparable + public partial struct SolidAngle : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -411,12 +411,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SolidA return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(SolidAngle left, SolidAngle right) + { + return left.Equals(right); + } + + public static bool operator !=(SolidAngle left, SolidAngle right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); + if(!(obj is SolidAngle objSolidAngle)) throw new ArgumentException("Expected type SolidAngle.", nameof(obj)); - return CompareTo((SolidAngle)obj); + return CompareTo(objSolidAngle); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -425,6 +435,19 @@ public int CompareTo(SolidAngle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is SolidAngle objSolidAngle)) + return false; + + return Equals(objSolidAngle); + } + + public bool Equals(SolidAngle other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SolidAngle within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 162a834530..d72c3d329b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Specific_energy /// - public partial struct SpecificEnergy : IQuantity, IComparable, IComparable + public partial struct SpecificEnergy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -509,12 +509,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(SpecificEnergy left, SpecificEnergy right) + { + return left.Equals(right); + } + + public static bool operator !=(SpecificEnergy left, SpecificEnergy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); + if(!(obj is SpecificEnergy objSpecificEnergy)) throw new ArgumentException("Expected type SpecificEnergy.", nameof(obj)); - return CompareTo((SpecificEnergy)obj); + return CompareTo(objSpecificEnergy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -523,6 +533,19 @@ public int CompareTo(SpecificEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificEnergy objSpecificEnergy)) + return false; + + return Equals(objSpecificEnergy); + } + + public bool Equals(SpecificEnergy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificEnergy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index b7ac544415..b91712cb2e 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. /// - public partial struct SpecificEntropy : IQuantity, IComparable, IComparable + public partial struct SpecificEntropy : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -506,12 +506,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(SpecificEntropy left, SpecificEntropy right) + { + return left.Equals(right); + } + + public static bool operator !=(SpecificEntropy left, SpecificEntropy right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); + if(!(obj is SpecificEntropy objSpecificEntropy)) throw new ArgumentException("Expected type SpecificEntropy.", nameof(obj)); - return CompareTo((SpecificEntropy)obj); + return CompareTo(objSpecificEntropy); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -520,6 +530,19 @@ public int CompareTo(SpecificEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificEntropy objSpecificEntropy)) + return false; + + return Equals(objSpecificEntropy); + } + + public bool Equals(SpecificEntropy other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificEntropy within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index 3de58af3fd..04e161eb6a 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. /// - public partial struct SpecificVolume : IQuantity, IComparable, IComparable + public partial struct SpecificVolume : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -422,12 +422,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(SpecificVolume left, SpecificVolume right) + { + return left.Equals(right); + } + + public static bool operator !=(SpecificVolume left, SpecificVolume right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); + if(!(obj is SpecificVolume objSpecificVolume)) throw new ArgumentException("Expected type SpecificVolume.", nameof(obj)); - return CompareTo((SpecificVolume)obj); + return CompareTo(objSpecificVolume); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -436,6 +446,19 @@ public int CompareTo(SpecificVolume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificVolume objSpecificVolume)) + return false; + + return Equals(objSpecificVolume); + } + + public bool Equals(SpecificVolume other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificVolume within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index b5fd23d73c..ce31c9bb27 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// http://en.wikipedia.org/wiki/Specificweight /// - public partial struct SpecificWeight : IQuantity, IComparable, IComparable + public partial struct SpecificWeight : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -635,12 +635,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Specif return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(SpecificWeight left, SpecificWeight right) + { + return left.Equals(right); + } + + public static bool operator !=(SpecificWeight left, SpecificWeight right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is SpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); + if(!(obj is SpecificWeight objSpecificWeight)) throw new ArgumentException("Expected type SpecificWeight.", nameof(obj)); - return CompareTo((SpecificWeight)obj); + return CompareTo(objSpecificWeight); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -649,6 +659,19 @@ public int CompareTo(SpecificWeight other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is SpecificWeight objSpecificWeight)) + return false; + + return Equals(objSpecificWeight); + } + + public bool Equals(SpecificWeight other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another SpecificWeight within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index bf5f48db2c..a557138fe8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. /// - public partial struct Speed : IQuantity, IComparable, IComparable + public partial struct Speed : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -842,12 +842,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out SpeedU return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Speed left, Speed right) + { + return left.Equals(right); + } + + public static bool operator !=(Speed left, Speed right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Speed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); + if(!(obj is Speed objSpeed)) throw new ArgumentException("Expected type Speed.", nameof(obj)); - return CompareTo((Speed)obj); + return CompareTo(objSpeed); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -856,6 +866,19 @@ public int CompareTo(Speed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Speed objSpeed)) + return false; + + return Equals(objSpeed); + } + + public bool Equals(Speed other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Speed within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 74f5a9c948..6f4ad8306c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. /// - public partial struct Temperature : IQuantity, IComparable, IComparable + public partial struct Temperature : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -467,12 +467,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Temperature left, Temperature right) + { + return left.Equals(right); + } + + public static bool operator !=(Temperature left, Temperature right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Temperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); + if(!(obj is Temperature objTemperature)) throw new ArgumentException("Expected type Temperature.", nameof(obj)); - return CompareTo((Temperature)obj); + return CompareTo(objTemperature); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -481,6 +491,19 @@ public int CompareTo(Temperature other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Temperature objTemperature)) + return false; + + return Equals(objTemperature); + } + + public bool Equals(Temperature other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Temperature within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 90038a3e41..40a63cb355 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). /// - public partial struct TemperatureChangeRate : IQuantity, IComparable, IComparable + public partial struct TemperatureChangeRate : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -534,12 +534,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(TemperatureChangeRate left, TemperatureChangeRate right) + { + return left.Equals(right); + } + + public static bool operator !=(TemperatureChangeRate left, TemperatureChangeRate right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); + if(!(obj is TemperatureChangeRate objTemperatureChangeRate)) throw new ArgumentException("Expected type TemperatureChangeRate.", nameof(obj)); - return CompareTo((TemperatureChangeRate)obj); + return CompareTo(objTemperatureChangeRate); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -548,6 +558,19 @@ public int CompareTo(TemperatureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is TemperatureChangeRate objTemperatureChangeRate)) + return false; + + return Equals(objTemperatureChangeRate); + } + + public bool Equals(TemperatureChangeRate other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another TemperatureChangeRate within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index b6b7ebeb75..b30f38b0c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Difference between two temperatures. The conversions are different than for Temperature. /// - public partial struct TemperatureDelta : IQuantity, IComparable, IComparable + public partial struct TemperatureDelta : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -506,12 +506,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(TemperatureDelta left, TemperatureDelta right) + { + return left.Equals(right); + } + + public static bool operator !=(TemperatureDelta left, TemperatureDelta right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is TemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); + if(!(obj is TemperatureDelta objTemperatureDelta)) throw new ArgumentException("Expected type TemperatureDelta.", nameof(obj)); - return CompareTo((TemperatureDelta)obj); + return CompareTo(objTemperatureDelta); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -520,6 +530,19 @@ public int CompareTo(TemperatureDelta other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is TemperatureDelta objTemperatureDelta)) + return false; + + return Equals(objTemperatureDelta); + } + + public bool Equals(TemperatureDelta other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another TemperatureDelta within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 637a5be289..77ee8a8895 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -52,7 +52,7 @@ namespace UnitsNet /// /// https://en.wikipedia.org/wiki/Thermal_Conductivity /// - public partial struct ThermalConductivity : IQuantity, IComparable, IComparable + public partial struct ThermalConductivity : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -425,12 +425,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ThermalConductivity left, ThermalConductivity right) + { + return left.Equals(right); + } + + public static bool operator !=(ThermalConductivity left, ThermalConductivity right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); + if(!(obj is ThermalConductivity objThermalConductivity)) throw new ArgumentException("Expected type ThermalConductivity.", nameof(obj)); - return CompareTo((ThermalConductivity)obj); + return CompareTo(objThermalConductivity); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -439,6 +449,19 @@ public int CompareTo(ThermalConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ThermalConductivity objThermalConductivity)) + return false; + + return Equals(objThermalConductivity); + } + + public bool Equals(ThermalConductivity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ThermalConductivity within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 3b9ea14c67..1c7fd72572 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. /// - public partial struct ThermalResistance : IQuantity, IComparable, IComparable + public partial struct ThermalResistance : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -464,12 +464,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Therma return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(ThermalResistance left, ThermalResistance right) + { + return left.Equals(right); + } + + public static bool operator !=(ThermalResistance left, ThermalResistance right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is ThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); + if(!(obj is ThermalResistance objThermalResistance)) throw new ArgumentException("Expected type ThermalResistance.", nameof(obj)); - return CompareTo((ThermalResistance)obj); + return CompareTo(objThermalResistance); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -478,6 +488,19 @@ public int CompareTo(ThermalResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is ThermalResistance objThermalResistance)) + return false; + + return Equals(objThermalResistance); + } + + public bool Equals(ThermalResistance other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another ThermalResistance within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 0438e7f5d1..a73e74b5fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. /// - public partial struct Torque : IQuantity, IComparable, IComparable + public partial struct Torque : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -688,12 +688,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Torque return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Torque left, Torque right) + { + return left.Equals(right); + } + + public static bool operator !=(Torque left, Torque right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Torque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); + if(!(obj is Torque objTorque)) throw new ArgumentException("Expected type Torque.", nameof(obj)); - return CompareTo((Torque)obj); + return CompareTo(objTorque); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -702,6 +712,19 @@ public int CompareTo(Torque other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Torque objTorque)) + return false; + + return Equals(objTorque); + } + + public bool Equals(Torque other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Torque within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index d4483f2aa0..e27bca2e83 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. /// - public partial struct VitaminA : IQuantity, IComparable, IComparable + public partial struct VitaminA : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -408,12 +408,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Vitami return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(VitaminA left, VitaminA right) + { + return left.Equals(right); + } + + public static bool operator !=(VitaminA left, VitaminA right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); + if(!(obj is VitaminA objVitaminA)) throw new ArgumentException("Expected type VitaminA.", nameof(obj)); - return CompareTo((VitaminA)obj); + return CompareTo(objVitaminA); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -422,6 +432,19 @@ public int CompareTo(VitaminA other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is VitaminA objVitaminA)) + return false; + + return Equals(objVitaminA); + } + + public bool Equals(VitaminA other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another VitaminA within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 0c9a0e1a1b..5dfddc94db 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. /// - public partial struct Volume : IQuantity, IComparable, IComparable + public partial struct Volume : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -996,12 +996,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(Volume left, Volume right) + { + return left.Equals(right); + } + + public static bool operator !=(Volume left, Volume right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is Volume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); + if(!(obj is Volume objVolume)) throw new ArgumentException("Expected type Volume.", nameof(obj)); - return CompareTo((Volume)obj); + return CompareTo(objVolume); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -1010,6 +1020,19 @@ public int CompareTo(Volume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is Volume objVolume)) + return false; + + return Equals(objVolume); + } + + public bool Equals(Volume other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another Volume within the given absolute or relative tolerance. diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 962de7fd4e..c43ad13b3c 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -49,7 +49,7 @@ namespace UnitsNet /// /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. /// - public partial struct VolumeFlow : IQuantity, IComparable, IComparable + public partial struct VolumeFlow : IQuantity, IEquatable, IComparable, IComparable { /// /// The numeric value this quantity was constructed with. @@ -758,12 +758,22 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Volume return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==(VolumeFlow left, VolumeFlow right) + { + return left.Equals(right); + } + + public static bool operator !=(VolumeFlow left, VolumeFlow right) + { + return !(left == right); + } + public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); + if(!(obj is VolumeFlow objVolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); - return CompareTo((VolumeFlow)obj); + return CompareTo(objVolumeFlow); } // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods @@ -772,6 +782,19 @@ public int CompareTo(VolumeFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } + public override bool Equals(object obj) + { + if(obj is null || !(obj is VolumeFlow objVolumeFlow)) + return false; + + return Equals(objVolumeFlow); + } + + public bool Equals(VolumeFlow other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index 1fef8c2596..d876ece7bb 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -99,7 +99,7 @@ if ($obsoleteAttribute) // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. public sealed partial class $quantityName : IQuantity "@; } else {@" - public partial struct $quantityName : IQuantity<$unitEnumName>, IComparable, IComparable<$quantityName> + public partial struct $quantityName : IQuantity<$unitEnumName>, IEquatable<$quantityName>, IComparable, IComparable<$quantityName> "@; }@" { /// @@ -812,13 +812,23 @@ function GenerateEqualityAndComparison([GeneratorArgs]$genArgs) return left.Value > right.AsBaseNumericType(left.Unit); } + public static bool operator ==($quantityName left, $quantityName right) + { + return left.Equals(right); + } + + public static bool operator !=($quantityName left, $quantityName right) + { + return !(left == right); + } + "@; }@" public int CompareTo(object obj) { if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is $quantityName)) throw new ArgumentException("Expected type $quantityName.", nameof(obj)); + if(!(obj is $quantityName obj$quantityName)) throw new ArgumentException("Expected type $quantityName.", nameof(obj)); - return CompareTo(($quantityName)obj); + return CompareTo(obj$quantityName); } "@; # Windows Runtime Component does not support overloads with same number of parameters @@ -829,6 +839,23 @@ $accessModifier = if ($wrc) { "internal" } else { "public" } @" return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } +"@; + if ($wrc) {@" + [Windows.Foundation.Metadata.DefaultOverload] +"@; }@" + public override bool Equals(object obj) + { + if(obj is null || !(obj is $quantityName obj$quantityName)) + return false; + + return Equals(obj$quantityName); + } + + public bool Equals($quantityName other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + /// /// /// Compare equality to another $quantityName within the given absolute or relative tolerance. diff --git a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 index fc13976f38..2529555d72 100644 --- a/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateUnitTestBaseClassSourceCode.ps1 @@ -235,10 +235,41 @@ namespace UnitsNet.Tests Assert.Throws(() => $baseUnitVariableName.CompareTo(null)); } + [Fact] + public void EqualityOperators() + { + var a = $quantityName.From$baseUnitPluralName(1); + var b = $quantityName.From$baseUnitPluralName(2); + + // ReSharper disable EqualExpressionComparison + + Assert.True(a == a); + Assert.False(a != a); + + Assert.True(a != b); + Assert.False(a == b); + + Assert.False(a == null); + Assert.False(null == a); + +// ReSharper restore EqualExpressionComparison + } + [Fact] public void EqualsIsImplemented() { - $quantityName v = $quantityName.From$baseUnitPluralName(1); + var a = $quantityName.From$baseUnitPluralName(1); + var b = $quantityName.From$baseUnitPluralName(2); + + Assert.True(a.Equals(a)); + Assert.False(a.Equals(b)); + Assert.False(a.Equals(null)); + } + + [Fact] + public void EqualsRelativeToleranceIsImplemented() + { + var v = $quantityName.From$baseUnitPluralName(1); Assert.True(v.Equals($quantityName.From$baseUnitPluralName(1), $($baseUnitPluralName)Tolerance, ComparisonType.Relative)); Assert.False(v.Equals($quantityName.Zero, $($baseUnitPluralName)Tolerance, ComparisonType.Relative)); } From 03680d1eeb2dc9b327b97baaa30f672e3f92d8ff Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:07:35 +0100 Subject: [PATCH 097/131] Regenerate code --- .../HeatFlux.WindowsRuntimeComponent.g.cs | 34 +++++++++++++++++++ .../Quantities/HeatFlux.NetFramework.g.cs | 34 +++++++++++++------ .../GeneratedCode/UnitAbbreviationsCache.g.cs | 2 ++ 3 files changed, 60 insertions(+), 10 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs index f95d55565e..b7451ac273 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs @@ -226,6 +226,16 @@ private HeatFlux(double numericValue, HeatFluxUnit unit) /// public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); + /// + /// Get HeatFlux in PoundsForcePerFootSecond. + /// + public double PoundsForcePerFootSecond => As(HeatFluxUnit.PoundForcePerFootSecond); + + /// + /// Get HeatFlux in PoundsPerSecondCubed. + /// + public double PoundsPerSecondCubed => As(HeatFluxUnit.PoundPerSecondCubed); + /// /// Get HeatFlux in WattsPerSquareFoot. /// @@ -402,6 +412,26 @@ public static HeatFlux FromNanowattsPerSquareMeter(double nanowattspersquaremete return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); } /// + /// Get HeatFlux from PoundsForcePerFootSecond. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromPoundsForcePerFootSecond(double poundsforceperfootsecond) + { + double value = (double) poundsforceperfootsecond; + return new HeatFlux(value, HeatFluxUnit.PoundForcePerFootSecond); + } + /// + /// Get HeatFlux from PoundsPerSecondCubed. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static HeatFlux FromPoundsPerSecondCubed(double poundspersecondcubed) + { + double value = (double) poundspersecondcubed; + return new HeatFlux(value, HeatFluxUnit.PoundPerSecondCubed); + } + /// /// Get HeatFlux from WattsPerSquareFoot. /// /// If value is NaN or Infinity. @@ -733,6 +763,8 @@ private double AsBaseUnit() case HeatFluxUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d; case HeatFluxUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d; case HeatFluxUnit.NanowattPerSquareMeter: return (_value) * 1e-9d; + case HeatFluxUnit.PoundForcePerFootSecond: return _value*1.459390293720636e1; + case HeatFluxUnit.PoundPerSecondCubed: return _value*4.5359237e-1; case HeatFluxUnit.WattPerSquareFoot: return _value*1.07639e1; case HeatFluxUnit.WattPerSquareInch: return _value*1.5500031e3; case HeatFluxUnit.WattPerSquareMeter: return _value; @@ -763,6 +795,8 @@ private double AsBaseNumericType(HeatFluxUnit unit) case HeatFluxUnit.MicrowattPerSquareMeter: return (baseUnitValue) / 1e-6d; case HeatFluxUnit.MilliwattPerSquareMeter: return (baseUnitValue) / 1e-3d; case HeatFluxUnit.NanowattPerSquareMeter: return (baseUnitValue) / 1e-9d; + case HeatFluxUnit.PoundForcePerFootSecond: return baseUnitValue/1.459390293720636e1; + case HeatFluxUnit.PoundPerSecondCubed: return baseUnitValue/4.5359237e-1; case HeatFluxUnit.WattPerSquareFoot: return baseUnitValue/1.07639e1; case HeatFluxUnit.WattPerSquareInch: return baseUnitValue/1.5500031e3; case HeatFluxUnit.WattPerSquareMeter: return baseUnitValue; diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 4d51476b05..81a2941027 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -212,6 +212,16 @@ public HeatFlux(double numericValue, HeatFluxUnit unit) /// public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter); + /// + /// Get HeatFlux in PoundsForcePerFootSecond. + /// + public double PoundsForcePerFootSecond => As(HeatFluxUnit.PoundForcePerFootSecond); + + /// + /// Get HeatFlux in PoundsPerSecondCubed. + /// + public double PoundsPerSecondCubed => As(HeatFluxUnit.PoundPerSecondCubed); + /// /// Get HeatFlux in WattsPerSquareFoot. /// @@ -373,23 +383,23 @@ public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersqu double value = (double) nanowattspersquaremeter; return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter); } - /// - /// Get nullable HeatFlux from nullable PoundsForcePerFootSecond. + /// Get HeatFlux from PoundsForcePerFootSecond. /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromPoundsForcePerFootSecond(QuantityValue? poundsforceperfootsecond) + /// If value is NaN or Infinity. + public static HeatFlux FromPoundsForcePerFootSecond(QuantityValue poundsforceperfootsecond) { - return poundsforceperfootsecond.HasValue ? FromPoundsForcePerFootSecond(poundsforceperfootsecond.Value) : default(HeatFlux?); + double value = (double) poundsforceperfootsecond; + return new HeatFlux(value, HeatFluxUnit.PoundForcePerFootSecond); } - /// - /// Get nullable HeatFlux from nullable PoundsPerSecondCubed. + /// Get HeatFlux from PoundsPerSecondCubed. /// - [Obsolete("Nullable type support is obsolete and will be removed in a future release.")] - public static HeatFlux? FromPoundsPerSecondCubed(QuantityValue? poundspersecondcubed) + /// If value is NaN or Infinity. + public static HeatFlux FromPoundsPerSecondCubed(QuantityValue poundspersecondcubed) { - return poundspersecondcubed.HasValue ? FromPoundsPerSecondCubed(poundspersecondcubed.Value) : default(HeatFlux?); + double value = (double) poundspersecondcubed; + return new HeatFlux(value, HeatFluxUnit.PoundPerSecondCubed); } /// /// Get HeatFlux from WattsPerSquareFoot. @@ -782,6 +792,8 @@ private double AsBaseUnit() case HeatFluxUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d; case HeatFluxUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d; case HeatFluxUnit.NanowattPerSquareMeter: return (_value) * 1e-9d; + case HeatFluxUnit.PoundForcePerFootSecond: return _value*1.459390293720636e1; + case HeatFluxUnit.PoundPerSecondCubed: return _value*4.5359237e-1; case HeatFluxUnit.WattPerSquareFoot: return _value*1.07639e1; case HeatFluxUnit.WattPerSquareInch: return _value*1.5500031e3; case HeatFluxUnit.WattPerSquareMeter: return _value; @@ -812,6 +824,8 @@ private double AsBaseNumericType(HeatFluxUnit unit) case HeatFluxUnit.MicrowattPerSquareMeter: return (baseUnitValue) / 1e-6d; case HeatFluxUnit.MilliwattPerSquareMeter: return (baseUnitValue) / 1e-3d; case HeatFluxUnit.NanowattPerSquareMeter: return (baseUnitValue) / 1e-9d; + case HeatFluxUnit.PoundForcePerFootSecond: return baseUnitValue/1.459390293720636e1; + case HeatFluxUnit.PoundPerSecondCubed: return baseUnitValue/4.5359237e-1; case HeatFluxUnit.WattPerSquareFoot: return baseUnitValue/1.07639e1; case HeatFluxUnit.WattPerSquareInch: return baseUnitValue/1.5500031e3; case HeatFluxUnit.WattPerSquareMeter: return baseUnitValue; diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index 344dcc8c4d..cbcb309514 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -398,6 +398,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MicrowattPerSquareMeter, new string[]{"µW/m²"}), ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.MilliwattPerSquareMeter, new string[]{"mW/m²"}), ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.NanowattPerSquareMeter, new string[]{"nW/m²"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.PoundForcePerFootSecond, new string[]{"lbf/(ft·s)"}), + ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.PoundPerSecondCubed, new string[]{"lb/s³", "lbm/s³"}), ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareFoot, new string[]{"W/ft²"}), ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareInch, new string[]{"W/in²"}), ("en-US", typeof(HeatFluxUnit), (int)HeatFluxUnit.WattPerSquareMeter, new string[]{"W/m²"}), From b0361ba24490c59bcd91383fb19c57a8babf1e6b Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:13:50 +0100 Subject: [PATCH 098/131] Normalize Temperature arithmetic (#550) * Temperature: Generate default arithmetic * Remove Temperature.Multiply/Divide and - operator methods These are instead handled by standard arithmetic, now generated for Temperature. * Add Temperature.ToDelta(other) instance method * Add TemperatureDelta.FromTemperatures(left, right) static method * Add ToDeltaUnit() Use ToString() and Enum.Parse() to get slightly more robust conversion without having to generate a switch statement for all cases. --- Common/UnitDefinitions/Temperature.json | 3 +- .../CustomCode/TemperatureDeltaTests.cs | 31 +++++++-- UnitsNet.Tests/CustomCode/TemperatureTests.cs | 65 +++++++------------ .../Quantities/Temperature.extra.cs | 62 ++++-------------- .../Quantities/TemperatureDelta.extra.cs | 30 +++++++++ 5 files changed, 93 insertions(+), 98 deletions(-) diff --git a/Common/UnitDefinitions/Temperature.json b/Common/UnitDefinitions/Temperature.json index 4bbf2a513e..732b744b3e 100644 --- a/Common/UnitDefinitions/Temperature.json +++ b/Common/UnitDefinitions/Temperature.json @@ -2,7 +2,6 @@ "Name": "Temperature", "BaseUnit": "Kelvin", "XmlDoc": "A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics.", - "GenerateArithmetic": false, "BaseDimensions": { "Θ": 1 }, @@ -104,4 +103,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs index a4f51502d4..76e516ed47 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureDeltaTests.cs @@ -1,9 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated (once) by \generate-code.bat, but will not be -// regenerated when it already exists. The purpose of creating this file is to make +// regenerated when it already exists. The purpose of creating this file is to make // it easier to remember to implement all the unit conversion test cases. -// +// // Whenever a new unit is added to this unit class and \generate-code.bat is run, // the base test class will get a new abstract property and cause a compile error // in this derived class, reminding the developer to implement the test case @@ -19,17 +19,17 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -38,6 +38,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; +using System.Globalization; +using UnitsNet.Units; using Xunit; namespace UnitsNet.Tests.CustomCode @@ -59,5 +61,24 @@ public void TemperatureDeltaTimesSpecificEntropyEqualsSpecificEnergy() SpecificEnergy specificEnergy = SpecificEntropy.FromJoulesPerKilogramKelvin(10) * TemperatureDelta.FromKelvins(6); Assert.Equal(specificEnergy, SpecificEnergy.FromJoulesPerKilogram(60)); } + + [Theory] + [InlineData(TemperatureUnit.DegreeCelsius, 30, 20, "10 ∆°C")] + [InlineData(TemperatureUnit.DegreeCelsius, 20, 30, "-10 ∆°C")] + [InlineData(TemperatureUnit.DegreeFahrenheit, 30, 20, "10 ∆°F")] + [InlineData(TemperatureUnit.DegreeFahrenheit, 20, 30, "-10 ∆°F")] + [InlineData(TemperatureUnit.Kelvin, 30, 20, "10 ∆K")] + [InlineData(TemperatureUnit.Kelvin, 20, 30, "-10 ∆K")] + public void FromTemperatures_ReturnsDeltaOfTheTwoTemperaturesInLeftUnit(TemperatureUnit unit, int value, int otherValue, string expected) + { + Temperature temperature = Temperature.From(value, unit); + Temperature otherTemperature = Temperature.From(otherValue, unit); + + // Act + var delta = TemperatureDelta.FromTemperatures(temperature, otherTemperature); + + // Assert + Assert.Equal(expected, delta.ToString(CultureInfo.InvariantCulture, "{0:0} {1}")); + } } } diff --git a/UnitsNet.Tests/CustomCode/TemperatureTests.cs b/UnitsNet.Tests/CustomCode/TemperatureTests.cs index 0aa5f9d234..a923721e86 100644 --- a/UnitsNet.Tests/CustomCode/TemperatureTests.cs +++ b/UnitsNet.Tests/CustomCode/TemperatureTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -45,46 +45,6 @@ public class TemperatureTests : TemperatureTestsBase protected override double KelvinsInOneKelvin => 1; - [SuppressMessage("ReSharper", "ImpureMethodCallOnReadonlyValueField", - Justification = "R# incorrectly identifies method as impure, due to internal method calls.")] - [Theory] - [InlineData(TemperatureUnit.DegreeCelsius, 10, 1, "10 °C")] - [InlineData(TemperatureUnit.DegreeCelsius, 10, 5, "2 °C")] - [InlineData(TemperatureUnit.DegreeCelsius, 10, -10, "-1 °C")] - [InlineData(TemperatureUnit.DegreeFahrenheit, 10, 1, "10 °F")] - [InlineData(TemperatureUnit.DegreeFahrenheit, 10, 5, "2 °F")] - [InlineData(TemperatureUnit.DegreeFahrenheit, 10, -10, "-1 °F")] - public void DividedByTemperatureDeltaEqualsTemperature(TemperatureUnit unit, int temperatureVal, int divisor, string expected) - { - Temperature temperature = Temperature.From(temperatureVal, unit); - - // Act - Temperature resultTemp = temperature.Divide(divisor, unit); - - string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); - Assert.Equal(expected, actual); - } - - [SuppressMessage("ReSharper", "ImpureMethodCallOnReadonlyValueField", - Justification = "R# incorrectly identifies method as impure, due to internal method calls.")] - [Theory] - [InlineData(TemperatureUnit.DegreeCelsius, 10, 0, "0 °C")] - [InlineData(TemperatureUnit.DegreeCelsius, 10, 5, "50 °C")] - [InlineData(TemperatureUnit.DegreeCelsius, 10, -5, "-50 °C")] - [InlineData(TemperatureUnit.DegreeFahrenheit, 10, 0, "0 °F")] - [InlineData(TemperatureUnit.DegreeFahrenheit, 10, 5, "50 °F")] - [InlineData(TemperatureUnit.DegreeFahrenheit, 10, -5, "-50 °F")] - public void MultiplyByTemperatureDeltaEqualsTemperature(TemperatureUnit unit, int temperatureVal, int factor, string expected) - { - Temperature temperature = Temperature.From(temperatureVal, unit); - - // Act - Temperature resultTemp = temperature.Multiply(factor, unit); - - string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); - Assert.Equal(expected, actual); - } - [Theory] [InlineData(TemperatureUnit.DegreeCelsius, -10, 0, "-10 °C")] [InlineData(TemperatureUnit.DegreeCelsius, -10, 10, "0 °C")] @@ -141,5 +101,24 @@ public void TemperaturePlusTemperatureDeltaEqualsTemperature(TemperatureUnit uni string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}"); Assert.Equal(expected, actual); } + + [Theory] + [InlineData(TemperatureUnit.DegreeCelsius, 30, 20, "10 ∆°C")] + [InlineData(TemperatureUnit.DegreeCelsius, 20, 30, "-10 ∆°C")] + [InlineData(TemperatureUnit.DegreeFahrenheit, 30, 20, "10 ∆°F")] + [InlineData(TemperatureUnit.DegreeFahrenheit, 20, 30, "-10 ∆°F")] + [InlineData(TemperatureUnit.Kelvin, 30, 20, "10 ∆K")] + [InlineData(TemperatureUnit.Kelvin, 20, 30, "-10 ∆K")] + public void ToDelta_ReturnsDeltaOfTwoTemperaturesInSameUnit(TemperatureUnit unit, int value, int otherValue, string expected) + { + Temperature temperature = Temperature.From(value, unit); + Temperature otherTemperature = Temperature.From(otherValue, unit); + + // Act + var delta = temperature.ToDelta(otherTemperature); + + // Assert + Assert.Equal(expected, delta.ToString(CultureInfo.InvariantCulture, "{0:0} {1}")); + } } } diff --git a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs index fed00fd718..41b866d4e1 100644 --- a/UnitsNet/CustomCode/Quantities/Temperature.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Temperature.extra.cs @@ -1,16 +1,16 @@ // Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). // https://github.com/angularsen/UnitsNet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -36,7 +36,7 @@ public partial struct Temperature // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP /// - /// Add a and a . + /// Add a to a . /// /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. /// The new temperature. @@ -46,7 +46,7 @@ public partial struct Temperature } /// - /// Add a and a . + /// Add a to a . /// /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. /// The new temperature. @@ -56,7 +56,7 @@ public partial struct Temperature } /// - /// Subtract a by a . + /// Subtract a from a . /// /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. /// The new temperature. @@ -66,49 +66,15 @@ public partial struct Temperature } /// - /// Subtract a by a . + /// Subtract two temperatures to get a in this temperature's unit, which you can later convert to any temperature unit. + /// This is useful since Celsius, Fahrenheit and Kelvins don't share a common zero point on the scale and normal subtraction + /// would operate on Kelvins and likely give an unexpected result. + /// Example: + /// double deltaCelsius = celsius30.ToDelta(celsius20).DegreesCelsius; // 10 C + /// double wrongDeltaCelsius = (celsius30 - celsius20).DegreesCelsius; // 303.15 K - 293.15 K = 10 K = -263.15 degrees Celsius /// - /// Due to temperature units having different scales, the arithmetic must be performed on the same scale. - /// The delta temperature (difference). - public static TemperatureDelta operator -(Temperature left, Temperature right) - { - return new TemperatureDelta(left.Kelvins - right.Kelvins, TemperatureDeltaUnit.Kelvin); - } + /// A temperature delta. + public TemperatureDelta ToDelta(Temperature other) => TemperatureDelta.FromTemperatures(this, other); #endif - - /// - /// Multiply temperature with a in a given . - /// - /// - /// Due to different temperature units having different zero points, we cannot simply - /// multiply or divide a temperature by a factor. We must first convert to the desired unit, then perform the - /// calculation. - /// - /// Factor to multiply by. - /// Unit to perform multiplication in. - /// The resulting . - public Temperature Multiply(double factor, TemperatureUnit unit) - { - double resultInUnit = As(unit) * factor; - return From(resultInUnit, unit); - } - - - /// - /// Divide temperature by a in a given . - /// - /// - /// Due to different temperature units having different zero points, we cannot simply - /// multiply or divide a temperature by a factor. We must first convert to the desired unit, then perform the - /// calculation. - /// - /// Factor to multiply by. - /// Unit to perform multiplication in. - /// The resulting . - public Temperature Divide(double divisor, TemperatureUnit unit) - { - double resultInUnit = As(unit) / divisor; - return From(resultInUnit, unit); - } } } diff --git a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs b/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs index 4ec7201483..b1b4c9c4d1 100644 --- a/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs +++ b/UnitsNet/CustomCode/Quantities/TemperatureDelta.extra.cs @@ -20,6 +20,10 @@ // THE SOFTWARE. // ReSharper disable once CheckNamespace + +using System; +using UnitsNet.Units; + namespace UnitsNet { // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components @@ -47,6 +51,32 @@ public partial struct TemperatureDelta { return specificEntropy * temperatureDelta; } + + /// + /// Subtract two temperatures to get a in 's unit, which you can later convert to any temperature unit. + /// This is useful since Celsius, Fahrenheit and Kelvins don't share a common zero point on the scale and normal subtraction + /// would operate on Kelvins and likely give an unexpected result. + /// Example: + /// double deltaCelsius = TemperatureDelta.FromTemperatures(celsius30, celsius20).DegreesCelsius; // 10 C + /// double wrongDeltaCelsius = (celsius30 - celsius20).DegreesCelsius; // 303.15 K - 293.15 K = 10 K = -263.15 degrees Celsius + /// + /// A temperature delta. + public static TemperatureDelta FromTemperatures(Temperature left, Temperature right) + { + TemperatureDeltaUnit deltaUnit = ToDeltaUnit(left.Unit); + return new TemperatureDelta(left.Value - right.As(left.Unit), deltaUnit); + } + + /// + /// Converts a temperature unit to a temperature delta unit. + /// They share the exact same unit names, but are of different enum types and have slightly different semantic meaning. + /// + /// Temperature unit. + /// Equivalent temperature delta unit. + public static TemperatureDeltaUnit ToDeltaUnit(TemperatureUnit temperatureUnit) + { + return (TemperatureDeltaUnit)Enum.Parse(typeof(TemperatureDeltaUnit), temperatureUnit.ToString()); + } #endif } } From 9afd143019324d0bae556f7d765da984221d4103 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:15:03 +0100 Subject: [PATCH 099/131] Delete UnitsNet.Common.props No longer used. --- UnitsNet/UnitsNet.Common.props | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 UnitsNet/UnitsNet.Common.props diff --git a/UnitsNet/UnitsNet.Common.props b/UnitsNet/UnitsNet.Common.props deleted file mode 100644 index 8c119d5413..0000000000 --- a/UnitsNet/UnitsNet.Common.props +++ /dev/null @@ -1,2 +0,0 @@ - - From 6f67afbeb1ec3b57da1a9693ccfc3c608fc8f6d1 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:17:04 +0100 Subject: [PATCH 100/131] Regenerate code --- .../Quantities/Temperature.NetFramework.g.cs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index 6f4ad8306c..5ed37bd6d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -445,6 +445,45 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Temper #endregion + #region Arithmetic Operators + + public static Temperature operator -(Temperature right) + { + return new Temperature(-right.Value, right.Unit); + } + + public static Temperature operator +(Temperature left, Temperature right) + { + return new Temperature(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Temperature operator -(Temperature left, Temperature right) + { + return new Temperature(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Temperature operator *(double left, Temperature right) + { + return new Temperature(left * right.Value, right.Unit); + } + + public static Temperature operator *(Temperature left, double right) + { + return new Temperature(left.Value * right, left.Unit); + } + + public static Temperature operator /(Temperature left, double right) + { + return new Temperature(left.Value / right, left.Unit); + } + + public static double operator /(Temperature left, Temperature right) + { + return left.Kelvins / right.Kelvins; + } + + #endregion + #region Equality / IComparable public static bool operator <=(Temperature left, Temperature right) From 99a8a502321323df4b41966e6d44b5b39afc3a1c Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:17:14 +0100 Subject: [PATCH 101/131] Fix build warning in JSON lib --- UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs b/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs index 90eeb1f2fa..27f99eff09 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs +++ b/UnitsNet.Serialization.JsonNet/UnitsNetJsonConverter.cs @@ -26,6 +26,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using UnitsNet.Serialization.JsonNet.Internal; +using UnitsNet.Units; namespace UnitsNet.Serialization.JsonNet { From 84668fb53c37cfe45ec3f8d9a90614d6151fa39e Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:18:50 +0100 Subject: [PATCH 102/131] UnitsNet: 4.0.0-beta1 --- .../UnitsNet.WindowsRuntimeComponent.nuspec | 2 +- UnitsNet/UnitsNet.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec index 281442a9ef..f32b61b129 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec @@ -2,7 +2,7 @@ UnitsNet.WindowsRuntimeComponent - 4.0.0-alpha5 + 4.0.0-beta1 Units.NET - Windows Runtime Component Andreas Gullberg Larsen Andreas Gullberg Larsen diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index 998baaaffa..0b6adfe693 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -1,8 +1,8 @@ - + UnitsNet - 4.0.0-alpha5 + 4.0.0-beta1 Andreas Gullberg Larsen Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. From badd2ee230cdd6e53c4ce295a9413414854e9e73 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:19:07 +0100 Subject: [PATCH 103/131] JsonNet: 4.0.0-beta1 --- .../UnitsNet.Serialization.JsonNet.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj index b6b7a47afb..07f85b3dca 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj @@ -1,8 +1,8 @@ - + UnitsNet.Serialization.JsonNet - 4.0.0-alpha4 + 4.0.0-beta1 Andreas Gullberg Larsen Units.NET Serialization with Json.NET A helper library for serializing and deserializing types in Units.NET using Json.NET. From 216108212bc9fe281a718e3bac15fe2c77aee451 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Thu, 8 Nov 2018 21:51:47 +0100 Subject: [PATCH 104/131] Remove symbols nuget packages Instead use SourceLink only. --- .../UnitsNet.Serialization.JsonNet.csproj | 4 +--- UnitsNet/UnitsNet.csproj | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj index 07f85b3dca..02d98ed54c 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj @@ -1,4 +1,4 @@ - + UnitsNet.Serialization.JsonNet @@ -7,8 +7,6 @@ Units.NET Serialization with Json.NET A helper library for serializing and deserializing types in Units.NET using Json.NET. Copyright (c) 2015 Andreas Gullberg Larsen - true - true true https://github.com/angularsen/UnitsNet https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index 0b6adfe693..16b71ba50f 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -7,8 +7,6 @@ Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. Copyright (c) 2013 Andreas Gullberg Larsen - true - true true https://github.com/angularsen/UnitsNet https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png From c815ba9a3d9849c2ce0fb40e4d91016e431abba8 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 08:48:16 +0100 Subject: [PATCH 105/131] Add back missing SourceLink It was lost in a bad merge conflict handling. Fixes: commit b958303f69fd945324f4e744fad98480fef8f748 Author: Tristan Milnthorp Date: Tue Nov 6 11:12:52 2018 -0500 Sign all packages and remove .Signed packages (#539) --- .../UnitsNet.Serialization.JsonNet.csproj | 8 ++++++++ UnitsNet/UnitsNet.csproj | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj index 02d98ed54c..1cd9f14865 100644 --- a/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj +++ b/UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj @@ -25,6 +25,13 @@ netstandard2.0;net40 + + + true + true + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + ../UnitsNet.snk @@ -35,6 +42,7 @@ + diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index 16b71ba50f..c98a4e25df 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -25,6 +25,13 @@ netstandard2.0;net40 + + + true + true + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + ../UnitsNet.snk @@ -35,6 +42,7 @@ + From f777e28813755a927c2eadeab10faaba91b9c442 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 21:22:54 +0100 Subject: [PATCH 106/131] Remove nunit binaries Using xunit now and fetching binaries via nuget. --- Tools/NUnit/framework/nunit.framework.dll | Bin 147456 -> 0 bytes Tools/NUnit/framework/nunit.framework.xml | 10899 ---------------- Tools/NUnit/framework/nunit.mocks.dll | Bin 11264 -> 0 bytes Tools/NUnit/framework/pnunit.framework.dll | Bin 9728 -> 0 bytes Tools/NUnit/lib/Images/Ellipsis.gif | Bin 101 -> 0 bytes .../NUnit/lib/Images/Tree/Circles/Failure.jpg | Bin 761 -> 0 bytes .../NUnit/lib/Images/Tree/Circles/Ignored.jpg | Bin 688 -> 0 bytes .../lib/Images/Tree/Circles/Inconclusive.jpg | Bin 734 -> 0 bytes .../NUnit/lib/Images/Tree/Circles/Skipped.jpg | Bin 689 -> 0 bytes .../NUnit/lib/Images/Tree/Circles/Success.jpg | Bin 731 -> 0 bytes .../NUnit/lib/Images/Tree/Classic/Failure.jpg | Bin 808 -> 0 bytes .../NUnit/lib/Images/Tree/Classic/Ignored.jpg | Bin 789 -> 0 bytes .../lib/Images/Tree/Classic/Inconclusive.jpg | Bin 784 -> 0 bytes .../NUnit/lib/Images/Tree/Classic/Skipped.jpg | Bin 689 -> 0 bytes .../NUnit/lib/Images/Tree/Classic/Success.jpg | Bin 768 -> 0 bytes .../NUnit/lib/Images/Tree/Default/Failure.png | Bin 1445 -> 0 bytes .../NUnit/lib/Images/Tree/Default/Ignored.png | Bin 592 -> 0 bytes .../lib/Images/Tree/Default/Inconclusive.png | Bin 1436 -> 0 bytes .../NUnit/lib/Images/Tree/Default/Skipped.png | Bin 1405 -> 0 bytes .../NUnit/lib/Images/Tree/Default/Success.png | Bin 1439 -> 0 bytes .../lib/Images/Tree/Visual Studio/Failure.png | Bin 747 -> 0 bytes .../lib/Images/Tree/Visual Studio/Ignored.png | Bin 773 -> 0 bytes .../Tree/Visual Studio/Inconclusive.png | Bin 782 -> 0 bytes .../Tree/Visual Studio/SeriousWarning.png | Bin 687 -> 0 bytes .../lib/Images/Tree/Visual Studio/Skipped.png | Bin 1405 -> 0 bytes .../lib/Images/Tree/Visual Studio/Success.png | Bin 3386 -> 0 bytes Tools/NUnit/lib/Images/pinned.gif | Bin 885 -> 0 bytes Tools/NUnit/lib/Images/unpinned.gif | Bin 881 -> 0 bytes Tools/NUnit/lib/NSubstitute.dll | Bin 1021952 -> 0 bytes Tools/NUnit/lib/NSubstitute.xml | 259 - Tools/NUnit/lib/Rhino.Mocks.dll | Bin 315904 -> 0 bytes Tools/NUnit/lib/Rhino.Mocks.xml | 5413 -------- Tools/NUnit/lib/log4net.dll | Bin 258048 -> 0 bytes Tools/NUnit/lib/nunit-console-runner.dll | Bin 36864 -> 0 bytes Tools/NUnit/lib/nunit-gui-runner.dll | Bin 155648 -> 0 bytes Tools/NUnit/lib/nunit.core.dll | Bin 151552 -> 0 bytes Tools/NUnit/lib/nunit.core.interfaces.dll | Bin 61440 -> 0 bytes Tools/NUnit/lib/nunit.uiexception.dll | Bin 90112 -> 0 bytes Tools/NUnit/lib/nunit.uikit.dll | Bin 241664 -> 0 bytes Tools/NUnit/lib/nunit.util.dll | Bin 135168 -> 0 bytes Tools/NUnit/nunit-agent-x86.exe | Bin 8192 -> 0 bytes Tools/NUnit/nunit-agent-x86.exe.config | 37 - Tools/NUnit/nunit-agent.exe | Bin 8192 -> 0 bytes Tools/NUnit/nunit-agent.exe.config | 37 - Tools/NUnit/nunit-console-x86.exe | Bin 5120 -> 0 bytes Tools/NUnit/nunit-console-x86.exe.config | 24 - Tools/NUnit/nunit-console.exe | Bin 5120 -> 0 bytes Tools/NUnit/nunit-console.exe.config | 24 - Tools/NUnit/nunit-x86.exe | Bin 6656 -> 0 bytes Tools/NUnit/nunit-x86.exe.config | 23 - Tools/NUnit/nunit.exe | Bin 6656 -> 0 bytes Tools/NUnit/nunit.exe.config | 23 - 52 files changed, 16739 deletions(-) delete mode 100644 Tools/NUnit/framework/nunit.framework.dll delete mode 100644 Tools/NUnit/framework/nunit.framework.xml delete mode 100644 Tools/NUnit/framework/nunit.mocks.dll delete mode 100644 Tools/NUnit/framework/pnunit.framework.dll delete mode 100644 Tools/NUnit/lib/Images/Ellipsis.gif delete mode 100644 Tools/NUnit/lib/Images/Tree/Circles/Failure.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Circles/Ignored.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Circles/Inconclusive.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Circles/Skipped.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Circles/Success.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Classic/Failure.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Classic/Ignored.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Classic/Inconclusive.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Classic/Skipped.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Classic/Success.jpg delete mode 100644 Tools/NUnit/lib/Images/Tree/Default/Failure.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Default/Ignored.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Default/Inconclusive.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Default/Skipped.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Default/Success.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Visual Studio/Failure.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Visual Studio/Ignored.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Visual Studio/Inconclusive.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Visual Studio/SeriousWarning.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Visual Studio/Skipped.png delete mode 100644 Tools/NUnit/lib/Images/Tree/Visual Studio/Success.png delete mode 100644 Tools/NUnit/lib/Images/pinned.gif delete mode 100644 Tools/NUnit/lib/Images/unpinned.gif delete mode 100644 Tools/NUnit/lib/NSubstitute.dll delete mode 100644 Tools/NUnit/lib/NSubstitute.xml delete mode 100644 Tools/NUnit/lib/Rhino.Mocks.dll delete mode 100644 Tools/NUnit/lib/Rhino.Mocks.xml delete mode 100644 Tools/NUnit/lib/log4net.dll delete mode 100644 Tools/NUnit/lib/nunit-console-runner.dll delete mode 100644 Tools/NUnit/lib/nunit-gui-runner.dll delete mode 100644 Tools/NUnit/lib/nunit.core.dll delete mode 100644 Tools/NUnit/lib/nunit.core.interfaces.dll delete mode 100644 Tools/NUnit/lib/nunit.uiexception.dll delete mode 100644 Tools/NUnit/lib/nunit.uikit.dll delete mode 100644 Tools/NUnit/lib/nunit.util.dll delete mode 100644 Tools/NUnit/nunit-agent-x86.exe delete mode 100644 Tools/NUnit/nunit-agent-x86.exe.config delete mode 100644 Tools/NUnit/nunit-agent.exe delete mode 100644 Tools/NUnit/nunit-agent.exe.config delete mode 100644 Tools/NUnit/nunit-console-x86.exe delete mode 100644 Tools/NUnit/nunit-console-x86.exe.config delete mode 100644 Tools/NUnit/nunit-console.exe delete mode 100644 Tools/NUnit/nunit-console.exe.config delete mode 100644 Tools/NUnit/nunit-x86.exe delete mode 100644 Tools/NUnit/nunit-x86.exe.config delete mode 100644 Tools/NUnit/nunit.exe delete mode 100644 Tools/NUnit/nunit.exe.config diff --git a/Tools/NUnit/framework/nunit.framework.dll b/Tools/NUnit/framework/nunit.framework.dll deleted file mode 100644 index 3e24ba1ca6260d7d0499624d13d2c5a2cd75b52a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147456 zcmeFacbr^R`9FT<-f25qvXkBHq>)WX;bvzy1(L9Y2qAO`5K2Nq57Gk2;7q~?SvD-a z1p)CRMQR`jNK>$&pooeH7Q_OGMzEn@@q>yeHu%2Z&vR~_*$|P>_xHz-eI;k^Q_pjr z^PFGP?@-=1{P39D)o zPpwvtude*S#P_c}<&?_miANthvAX7ziK|YTxXXSAPW(XSm}6(Owic#X)k}6YW^u|j zTa3M6iJ#kx#+lTd${W+}7&B3^H%_tF3-L?qh;LWBaV7Ti*9?IU{9RcWMGzFBpAiy~t0UB2gm_dM{P2j26* zdmebt1Mhj@JrBI+f%iP{o(JCZ!2gdtFvR<6{PEt@F&XoD@M#ED_q#up+4E=D{Qb_-oUfktj~l=G>ZL#5Vdifhf3S4TM|S_` z-;X*lwe+oze{$v0+Tg&CPF{NC#?qQU+_Ub%Q7`Y{_O4Dpa>b7h|DRW0+i{m$zxJie z4spDqF$EOHt&GIQV2W!4J*Hz;#vA~v0Tu%m$Ljz~rPJqg2FP7Sa%yE1kX>)43faDi zj^exYr_u#VchibW$rpoq=ugSLH@sOi%2+6yY|jMEEco3m$lM(SFHK9z5-qYlKCkIH z&A)WqK`bkzQM%F09@PXDQKgCrbYg9X_E1K2o(RXN21SNy=%ZK}s7Yj|QHD^xt#EXN zhfqBamLwuPgd#jxccOjGF&;t@9_!QA7!RSIWr16&sIOB8+klL_LoszeCR)mt)G(q> zgJKfCAu?G<(OQs|DHI{;Q{qFP5~?pJ;y1!WsGbL*9pNF=gJ{{pm@M+_nc=wJ1baOU z`om6b3fivUiZ*;|wT#4@ZvEvWcW;DT5k)R? zT=9a}XGQ(C&hm^$J>*y(Z;nu%(q(9h=uW!a_1Qu6IEYj7O-%BQj_{SzF3aa@V!wJKs#9-|NT}Gkux< zMP#o?FUkI3_wnFcydbbWMG^y^^gYRx{q6Ii@%$j<1_KD~1QjLbg0iw}s+gkN5n9W$vQMMQ**uZWu09aUrl7*irpY(I)A})=^(Mk# zZxWLACRbYCoKwn&SG}30k@GKk^R2fO)sZfnV!G!Hr%S5S>(_vB2Qkp3ovuOjYzUT5 zC&(EkyMt)PX(v61Hk)=vza2B;oy@4qv{SOoh>Ntj2fjuZkGSx*%$O`%5wq<`7t^~U zZZS0=&6r;N$FSxM(6-7{a5k6c0TjIhqE<;;327WiV&8z6r=)2@GET0tCA=eLmJsb~ zDR-zx^0|CvGCh|sEpN#ypSrDYBf7Tj;GovBY3iBhxapFInv`Bo%E5UI`mSQ!TWNPi z=Frmef|HG8*X*{GF{Vr0Pel#or8Te5XO_3*vTvqaoBDpPZFFzw#E{fb=ZRGMgH3AP z6VanuPgJ!p$$TVjRzfd^!-U=pN{+vUmoGfDAa-Y$E5`g`$K|V^emfP7_5C3qvb6oV<*V!a zL*B6Ox4aGeexF~<$*}@GF_Gd3zxy z2Evh3lE9xS&4*~4Puffe9hNeG43FvFvHDxO42>z(oa^fDy&+dYp$g?xrwB##IiZ}8 zq<*LcnfhgLl?NI$Pnp*e!epI4I?gRZ~gZsVNF`Ee0`+07Rhmi2Z+8MEIXZ+o) zc4qqrniunxjkRrjy!eVxy##%H&pcm;*PNSw9q`79+>TYykrf8X;|wsZ z=2CX$q;HhPwE7rn8C_@s-G~q}W8T6axp^CHS5qRYIwFFQ;v!5^s=E*o!$3p2I8O>h zsHexcPGx6DhBnlJ!*(reKR;Apb1s--18dM~FvYI! z4Oz##6Z%9!p}bf1-~a_@u$H|CNJgtH6w2l5Ne#(hWi2Z!I(o2TSqi?$m|c+*=JA;G zYZbTT`|{Nbp{2Pz)72ZJT=h!86@w>SkrdtlKqa>*KVM5T)<56b_jym9b5?Er-9TPWoLkJh4=WFA&;wm3VIYL z0bKnZ;2LIeg)?*vbj|M2iTZ_|uJm*6nth=xQf*z;*C8bL1Xy}-e0dD1%&JsDmtXks zs;)O3sk~E+Tg95{sg*t0G|^7Qo;|~M+Kv2TWnkRH))w>y4AjA$pjGC;t_jMU_P*+u zcTu9egp=hZZn*MZg8bp0Vakj9&Ed;SwOZcQIRsC0j>YC|15)Fv8&GOzAj~>+m6Pkb zZg6J^I|D47Gr()<&a^2?TRhbI1^)YKph+gs9_CR6^`|OOhs{FdQr(*45eK?>LpQqB z*8=w|gIl>zoYy1$rsN&;o36yELw{5=u3rF^vwa#mDvYQbeE;vl5~K&wZLyZLzupJG zsMpY^eQnMF8MW=($yljSp6>Q0C>)G9lN+G|ZUxgp?H$EhW>djz3^$dFoKEQ%y>E&s z2J6l`WvKSS@Cdd`CKA}_>7@Yll}tk5^wU9*=(^4G&`iL+*u zLE7Vd)X&b)Y>mR4h@R;=5sM(+Cww0vZs{X5E%<0_lAf_P(~h)3ZvObDa|>sHBCfw^S9U*bEsyb4C|E$BqgRO%Q8(it6{&w;6Nhz%LRc2xjdi9UIE?97IoHtB z1@+qlKaNAb??=9qB;PgYYPHisTWrb7q88lLQr^Wl6%6JDtnalH(-ln13(Z|E8~bpL zNp1n$zuh>lm|n9#hy^ZR%v81o+5E(m&_+34rrPPNsb<_l8D6E$LIcN@38(-V1(#>1WJuI1VAd z0Sc8WCre#RFp!RZElRJT3(C6QXrvX)X$#XF;ncR!m>0EJ-dtWp&t~(E`8RBE8|Y1o z)2FcP-anxW(>r>=O^-B{4+7SS1LriHTTTsq`%{Tk*ZT>48#L-WV~v`% z(PPFz-#ySbjrwZa!G#4Z+1qeB-VZ0RRxm3mbY#j~AZ{39Elw`)y$k}vpd(w%qKj+Y zcsz)VIYInrBX~9Ha>X2?PO$l6&W}6H*w9@SreRe&lv)QV8>@|_ux^eeWND9R5ssN+ zW*i{XH(a-y(=XC%c4803%KI~x_YAc07jXeWcM!9Hv{QWnT;5%RgHrlqIsCB|{b4=P zQtr-6nXv@x3{c81INDLV)V#5r_gmVt8^`9g$XF8f8(P{ga2M*(L`zMaT#=`g)xKZ(1KpYseUk$gSP)R5P2hg z1KOFTxgPE&tui-!1T}a-AVGVh{Asja&3yCtGn>I5+UgD-804(+I2Vl>p;OWA+7xR7Nr9ZBo4VR2ec?;0UWQJA4&0OIOXMh>7J(6_~``k^j zl^xi65xe=$3WjhD9^hjOk7)g5L#>8)LBh5V;*eF7ZK@RD*^Z1eK=1b!ikYrAIkF=f zg)!6Bk==NxQu~C;rL7qCeWt0vr&=tibS$uAe(tTe-a;>t(}vbmq>Z95Uu^Q5TB#$8 zwpK(BXUtC0Psm!m1YH~a$@@M2v2J0VjYZ!xFas0KHn;jRLvS`6VanqWk*%3Xz|)Hw zkti@rs8X1oZb!Dg&}Va<-ZkezKaDZf{XnQKggSKYwi3`TOWEp55EP|T;hn%UEzk;{ zmTYwuwORs$6Qx$+vqhMwh;X)ge!!oVN2tk*o+^O*ebIFy}{#vU7dH;N4Nh?9Z1c+SVe+I1fb6c7%cj2u%eVu|6jOn8GWbCGFFolm0f`lHEA>C=9n{%A&CGg*!r zqSD@sGbUSnyi;rO2?_kJzUvZr%$L=rn7LyZD{$LRGjzz9cQ9)gb;G#qKpwU(h{lEt z%wp}GiQ^rE`1P1KxMC_WKgYcau+%YtU(82}=4q5E^`RWC*yx)Oof z3GE5O86kUG``m#2POztw>~dF7a5pfMw4{~2d|RW%+x!0$+n8(2w#B|}nCi+8k$RaWZN!dEBCV~2bUQu@8s^kI zULO|3hK_gWCfQC82YL-+)WPFO1;EJLasN(-HnBYlKh{GiPrGNlTH;owDP@p4G{zi*Nuu9Bi!H;b8=(Der5w?KMcF$zv*X&5V~&R&^yMrQ zGpkGmr^}A>>HB><13=C3{T=-0g zKGA%93NzB8eBY9Lfsw%h+omw}EDU0R2u1{3j!wTE&H$+u^pUb{kzKdnuWzHi6*{JC z{u+l$xRw2ZVu+(IbR3BCWAsw~s#8P#76y-u*nqkEQ2;5-dW_gYt_sH9I$Or8EkcLS ztZw*#7`K8^1@}450M+^-BD%-HJ`8<~5s^j5h-Jo3Q2zG|Oa z`$mGnzc*GNxwUVTJ{w8IFD#$ZtCO<0kJ>&Y2j#Q$nQuei{%z=c*VEO0-@flQu#fSg z^rullI-q(BLnB$YkvjS&RV3@E6*{!;U2p496y?+WEv<(8+(MLrx|#nxi7|QhA>`FC z$PYxHXItg@HhNd(fl!jCUwOV0@IWZ!(REqOK+!h3WJ^?SYfd?6@#?D2NtYjQq9!Xwv13k4m zJ)6U$_2JeUR7H>%X5*6A_Ca22>hjtg9?acEPn+vk*o`qg6HzYZ3ENDq0kiK*Oq@ku zN1*TKI(^C$(bs_ae@owP*1oR5zFX?-Q=W)@4VZoVFsqmHjtTUwuhXYI5q%AqeSNqA z5Pg3N8V4dK5wDo!3(xBT4{AE#(RQe7GqpDY7F1%`RyFSTvU*+(n9vdeJ)6&iDZ1FR zF=%7&uhWBByYT!Xh}ZvqM?9E{iJo5vdOlXCXLEQk7ZW|d4fI@Hr)P6`Fjo^juLOFo zsnfGLJebpoo~r^qXV>Z3-|~Dc;5ny`2Xj5qb8WzLZiFW-YlD~rk|$j|#2=(qW7r!f zBe{RyEb{>Gk7<8^kK=zn4E|5U;D0#`{#P+P@5?1$$NRNUV7|m-nB=}@tQqNy!?#E9 z-fw&~`bWL*SNv~>!T+CO@V|@UBl*7K6Z|n+^gCgj_SPc!gSn8}AY;7@^-Azm&3 z#t|!)uizv31`LsWWt?(r9Gzmaf{(}s3=vrwx7-?stw5G_En}5idp*Q!?8*2f!;`QF zev>iDt#L?-=@||$V~<Omb@+l45unhuj*6A&YnU-hz>_#|}M0@E1}+^ZWXC)}1qOH14g1MYaMG z>Z#+wL?gmOD8kdHdXDjVeEk-GtdI9iScX*#x55>h%EL@#wTt^$zW_+|re$%N@{aci zkQiE>($vBrRb>a6k-v_@*q3`jSGKrGIgSg2O2X@Ot7HS2TYbMF_eYt#->+Dmx4#Yj z&Lka6DAWUk-NEAmJEQlk14O&EyM0OQ+Ob8n){d28!dUt-7nIMhMRk(zV@G{|Jah^J zpFd23jQZ{=-xSgtxe$4z8SA>f=XjriKyQcst~m;&@SnYM{jL*>O;l9754LNql}B5g z)@SX(fMV;hfh{MzTeeV9?NRh#5nG6}wtOw1^dKUvEBuH!#yXkz0~oJ1tNbI}&f2R% z0m~y@n^A~kou#?QO4r|%UeKRr*U4ooKZ1j8z=PM7XR_K(#P@5K!RLK>$K$GUxk-P! z3(IZY4$sepR`T=L=l5F_ZNhxd#>BJWV0#+fpgn2dp|PKqU8s^VWE<-k^R_yk^#>Ty z;h3B7i?vSnJ13&5^vP^%)BGXefy0y{ExTzo?(mR``{z~xyBf2oR87ViXW%3tu>K1& zT>2BXBquvaeWtvf<(HwY*%>$)SmXlMQcgCb$aWjW+buLX6}2YGWF6IeN#~BAP071)dA>#1<#7uwY*l+**@X=|xZm}wEC=hx zK1gn_uEGjp^#LThpB4M7 z4}ZJl-N;KH0$~42880XaYu9X4I%V+wARas5;liiEWgmRxvcqbUhX=SjgFUw-?b&lU zdt_U@7=_$-65D8@Y!D1g+ql$h%uF+8Bh(IO z`#+Pk|G?qw54Y_{3*m<7L`jZ(`;vULQAt9D(Hab~l1-vav(40HTBdugbL|dUxB3FY z$r)g*=u738*yQ?a_S{lTnZ`!G07khRPOX#r<`h$SEZ$+Q8E!47+ zsctW38_KTqE>&m?(NOjj?^k(p23;EmTg)?E_mM6CvJo(MwX{zUG4a)9%8F(=2 zy9ohpfOYz|`)Ae9QC^Hz!|aKz=j906c&}|e@9_I)>v=h{CiSMdCpJE35VM^DMzrgk zDRIV~wBnB=(7KeQjkC*ZWrX_U@_+lfER$~Z(pc(kjRY+>L1g>(MSqlULVqM%(;*|7 zrBF9f!OC06q9l9E#=F&a@LNXW*L@s4Z3X=&`W#0ceiG2=^q?P`%EnT?ZYqOqe6Q+n zzKuHV>ut+KrhjVJ7|c0j_Lq^=YhxMvG1CaPiDu&4M3L7x%3vOw%1GLl_S!}2GLaeq z0(0W8e}h90jHVQk8A&14NvZN7={4i52!HEDh|H{J3Xu^avXy!TGf(I(x@l}66nA1X zKNL0rQQ3u;T31F zjzYC(B=v3F-4B9O!QYmyOa{k>J>jN;yY|20##4A5Nn*TSsPU#e%Uyf=@Z6fEl~oZL z*RlpHvF1?epHT|bOp#XG!qB41mdLa%Et5mMvWYP!h}ww3s|SI_xC=)>$4KhP4qOd; zu%US18vM$T&i9zNaNO(w8eKX&@G+!q>C*D4?P+b3cGq-sdJTF=Mk(44=D(A&)f1si+k=!@ zs#@N>lHF{DjL0`@GwQ`}Ts|lA+L9W{H)nHl&W+A^$GdImwI4!pf_ERY>zgWzShDg2 z(#`-)!xryFf>z4;bX#wKLAfxULR%0+3TjVtmap7ovz3+bSxZiUoB*x)CTyNfXM3~U zp^rk#M%sBeU#C1Ni{1Q3Lm+2=?Jirl3mb$prR98=BtH{-g)u1;sqdoN#M|Efuo%1j zS-nEp%D8QrwF5!HIdc_X38_*smrwv7aR2^o z@Bt=~m|Lh1vb}9u@{)ur3W+<~_AK5Tp`ARJDSCWL^>CH>E`)OzjV{7FWu-K*=44Dw*Sse)|?CbH^1%m9TIJq zwx`(qhKJsM*oKGJ;$j_bf7rvn>J?}TL+m-L=>o3UEmkk*6+5IV?x9W{VrNrb$}5I( z^=e)*XsbWu6(gY9+=46CDyl1(L(6$#0xCI}7e??ChrwfsRJV(99vR_3b{PC|J|1)Jt#HlFvRgnmx;}Rh z9iUxrb!Bf2W>1{+5^eX}B6!5QsMK1K;yk$n<*+hDLI$gdYMzvHu1^m))JFE-_Lf3) zWS=d!6h?e?)FyRc4E}fa@CNL4dw97@O~24TSZXYYe^&8A`YxC6Ao=sRw09y2vV0Za zT8o7uEq+wX$)bh+n%+PMsj=<3djSz~dteOiifPPndPt7xSsc-We7VlI9>18w6|pJ$ z%~7~%bw;M_uW<&?K@E;fx%z7c&I8!peN4;9lz-Ve5#mE5m9!#%WCvdUD&oJ;^T!=| z)F5S)NrhH49odl?nJVJHFg5v15JEqK?Br*Khh?3D4%d7$LSBrZy>}tQqkMZmXzi6> z*n7UUSANaFg|v4^vDaR!*Qu4FHt2DCP zk@q)N`gV(-egA5??UIzVku6{##xbpvSlKkMBrgVpNc};tIMNKT`jWipEaG~_cr!qk z2`@HVZiOPigr2>y$cN)5v}3pk45o*#IsF&M3=Rp-UpWk2273`Ky+XL`+|BOkY#i77gd@+ zS5d`;9UN~WD$2txO@UFdHMT#ZTbC)2_C3D?`dG%5KY!7cetCVeqz87$I}hhIMy5h-(ai_k(%8bOm!=%U90l94jH=9{S-3*omeOKP-`~UH$Pe zJI1>P7^Go?Q{EvRu^6|BD_Zgyxqkt*r7M#gedr32XmOk+>AZIUW>)*VZgAP7^~-QS zQS#EPB=s=+E)+6-u2aTIH6DOw062Qg6`&>ETApO^E*~3OUVqRa(cbzpP3R~3P!r2r zoA8iGa6eQBx}w_W%YrX63JH%Kol(63;X1?$;3SaaAAZ(+&jtdLNc6>CPsPhCpaTc$Chc41t!f3}sG~oS6rg$s}Hy8SQA*Y_h>#h+G z1|n-kglXD4Oho<$Kctt)TILvkwW_(g0X3{IA*qk3F7%bE8{>Fqi8`j~CEnqp?@sY6 z{XiN1`iq2|+jKeJkjOBF%n_6+pRUfNK1OjJ^08O!P)3 z*EEZmq6`#TtkKGDv}`_bFMPbaG{w*fPK z$={eSOXAB5fu=7>rY{4w(3dDKeEAy`69&9XzMKVZxW_R4D2w<~GeKmCFE2)xC;P=^ zs^kt zrHmzhtE0Tiu|iiwgd}DpkMf?rJi5=q$&M#K8bi%Fn>l@!2%(nxV8IDBTF&S2i`!Yh zoE(ILl6Hc2ApZB?hJ;pr1iCxY{Tl$<+=hTbQBTyvz&UjtgKC_Uah(-qY_40;j8mEA zobYtH8fqvX=RicxLZC=Xgo4`iu7XnhV6C};f%>$QozqU%Lbf&yUq}p(bxi`pCF}Ab z*o!HuU&cgTqR$H(Hdf71m+-bPmLmh&rq<=sXRbFXwA; zva*cT$wkXZxR%Y?yN(6x|24`z{CogH>~~tR8&EDh%-|vPDG}mCpwWZ?)0iQ!VQDPw z%9VFLrOIoEpAtZXZ2}8r8CR~n8$@L9;U@(UVeEBeN8&L7ue=*Y1b9|iM{Z4E4B9H z?gvpIHPf7yU-5iNMREGt(a51yj)Za7Obez^LLTX^CMI3E8J4#8e;wXUCwV&3!s80h zv90}JHM)+B2dEv8YtB}0LJX8HYlSMd;;!6!JQlhIB>9wsVqpbysq^6Vzz>& zUD&V#WLnGn<&rA!>?f(BJ8z$Ti3&HS;@H-5bM=8B5}V@p5{~%+j23wEDSSc_Pk+s!rvwBs#rNK3Z{WF#AHD963V9)kLN% z=+O|N+gZl2e!w_Jky=HPz0^S=R#f@EkK8u-afS69#MNLVt|I4tIRhB6BYVyX^=M4C zpp=LuwDSQB=n)=55uVeO2gAL;H(K>uJO+CopNYJWk4^LE!laB>^$p{5?siwEqR3MZ zoT0GW*JL-aV!kZ5k$D7jKi*p~Zf{7^4{hYJI@SLaNofz`y39>@H!30z5HB(6hbrct z-f1vE1Cxv+@>pT(0t$LyARhX`e}&%moc`w38NMas9e4EvwirqI^!vY56z6jpcTF2e zd`87z|4v1VKtW>Dl2Y(=6~w*<2#%oO1buqd+hrei;feDCRfNVLwSe4qM+Fp}p^ETM zJQPu&?kSl#5&J!4qla$#@IItcSBTU&E5+Zq-IO9WEva{=N*y9n-Byaf^-{#9S2Ohn zREoVDw( z%H2R@T2gL&lMb9G$rhS;b|q&Q=)U1Xs-g?)vh17UNqEY4?J*7Sri;Uq|Pg*|o5?hOV?QL{!-b#miy`##+pU zmFFz-U^Fib5d|LpcscM$4(uB^ll>6&hZgD>gPk_os@LZ$4?snA(g>_5KZq+FYZ7da zz|qh;#4JYn{AV-V1Ay6s!CG7q(~kjmVsd<8aFE~X6M)CzcIiq9Cc?j1Q%h%~CpvBV zAiqvzWpJVsGHr(@>}2oTUS1P`KQr>Ye1Lhom6c*|T7ESbRMtFfxgPK4Do2Bu)}Mej zR@QFy`z=4=#u?l8b@h<@8!`s&FlVa%EvZ8Gm57F1S4%&py11RGdhp(L>C< zEByTq4$tJ_vOLEmj#QDANNizOOuCFxcrXA9p%u)xaSzH9OF5=x%q#fC&2!OYP@(5& zg?8ZZ$Ucl4+5Yc>swY~)Q*)>SPWm*E7zO45Y_%uLrQr$gWhtpB4v_2rD45U?w<%#) z@?5a$VQ9V&;5}hI#?;P6rtAmugAl>yn5IG8Wu)b6O|+x6m{A3T=+8hdrUx<_vc`X@=P?;>fuOqjVE14tKjrzrMZu&}R$Q}ct>%^|gSMfWo zDGqj>h$^U=e6~w8R=y@YxhRBCD9F>keojW=QL~b{?V{EfDvZcmVP^{iCOZ zqWi+>&4TW%e1mrA@p;hw1fW4ueBF3MkMmY`NrTrBpC0@;e(XLxN4|lA0AkxG*_D(h zT^H~w-2ho#Nd?t6-RB}9!9{UF={zbJ!yH)(m3GqU`qM{5K9A%c>#jjiJ2TFZyMcICvwk2bc!8 zLoE0x9GS>$l~h^BnwA|w>`!MQA52*B&c_XClKOE7pPjb%<*JW>fUh@+*F=a#A%&ZH9KAMlqsj33b~w8p@`>8Yz)P` zOmc|*o+GmIDJLFRAP>1$89bdrOE1Wrm$RadLb1@hcd=0Y9W5IVQeQiuR|BY}+y|Lm zKrrR${uMfES$|Tl%~t`Q-ZB{#!(fGF3Yk{Ym{MG(n2|lF9BKSbJoGt&Gu$`zG&G={ z+OWa+m^Md)J|HnAkLd7DWfzz*lFIX14*$D4E9|$x=%6r*E{Ki#2qu^xxbiN@xhVf=`6w7x+qw_CAzSL6c|&%H@hFF&U4#|@vt{jd z3*Vov_hF#Zl3F`1_ge~g?!1n$3U=XWcV3Y-d0dJJZUrUwa{gyN1HWK@cy$9H=S=1z+mouFqep&-_}6Z;95hyKyxfj>yWgd)7l*O`T!ox2 zi26&XPH0Ze+G+g=8gVfHnpTXvgSSG?8DJW)@k2iy;EB+j0qUPP2c@Vy3zGl!Az8CH z4h`_@G+mgacMM+1#ZFG@j(!IWqp6*rJs%29r&8Tx8AOCTcpF4*KbDmN$x>ZdhGxDpqC@z&symYQlR-aAv>jmk+Ir5_!{i4se85#ZNy=*p zC5;C9eHrXa(LUcBqHQMf*6LGH;)$56cVc(P!`h zZjNYn)xXog5rlgNLAG!Ps~f$`l9<{FveIJ2OS4jbb>?4_1j({1453qQ+5GI7fBl+#RL6-q-v|4|Fnb zG_&A5)6J*p*?_83KD*_H--pwjle(YSM82C(8!lh8`rsbRk^SqV#UGpa-W*O3_ivu{ z!(n$wXwmK#_~at>_mjTad^W^-K#xg3lR0|SFnp=caBMx0ZhMSKH+ZLHA$}hNUD6(d zxe{$*S7mGcyciGXcWNR-V>dvVB1S#M2xC^pa?)WJ~ z5xX<&N{q$xlR`L6-uAE?v(pT|aKuG#jv;Jev-UID6Jah72DphP>2&W5fP2da;&@Xm z{g_M`^*vj(aQ}Il_^kR3NJ`1Dl<_m83!)Wa* zb#3Ajsms#fJuH$oBZ-w6Vjbho*0cXq%dWI^=yNIkOe@NwJu7P~{#7Ee0CCS>L~?ao zSm)27IY#W6%tu3lxnM8mEPXbHDK!x7)%_qGxy=~XgiFB}xj%S;%XHJ za3N)HXMnE2D9D=~%|RBbodLQ|E-Sx4dHuH_#ww2`M=5r1p%a`51Lu5(mhC}%Fb@!g zdlCpT#Yh-`HJrDeQTs6%ZPNZ7168np!Z7yp#;Q>6j9IQYYjZk02MYITNt@lujxf60 zThS%El(mBh^4(++B(~m_GGHaNt_+H6V!>vw#C-!_*+7Qj+{H9W15(t<{<>}t)EW?J}%>c2O4M(&A~7samc>M%7#T#*{3KgLrxiM)Rcv0 zknqh%RV1qe!RQoECU^);w1@MtnTuhPi_>ud@58`oKTH8U#K z<)Mynt5a7;f|EMp6-<>$xQ?Ygrg?6?@Bc-s$6(SH@%@MC`_EY4lYzefY(wAk4reJ$ z({G!5zd|J04)uoDFvG ze}<765wCAFQ1Q>&>eYzdA=Yy>(}gQme6_|a*08+rc)Lzz+`%sZV|vyyvN;>&F*5v> zS!p@dX*&h3xV1=!>QoSA;Tp9p;-g9VBANC~|edz^lgtd_E8}G{7DvqSyzc3nc3&l>1vhvhAT3XmD z|G-!iu<05^e~?cwY&XdbMLQP;@!E)dqg%4&i9}6sFbA4;>^q!F!|~o&r?(BW?Lqmb zg5-nRw*CYC;uz6CFRov~|5$%_VE=Y;{R;la`nL@9FNo_`5br3vot;``d|}y5`vC9B zwne>M#W>Ox7JO@xI`C#8Zdmw*sx5FZQ|(gD6R>&blk5%k1z-)Qp535NmN$^YE|PnI zK{krP7`cgja0m8p=F^0QI(*g6&l&kBX4CngMVH^cJj;wDpXc`ej7Z16Kne7oIM#Px z3>$bDf#iBSiYtcqyi`NRYL`7a(@+l|Wj%Ca_T*2>bIm4K;Q5(ZCvCa2b^%`Jd#-72 zGvLCuZnR~NbC=4Pz&hR!Hu&>^wDcF2W?N63-WkZ&iV(!+wNL?d*U=*xkUlygpUi|j zTY%@kX_@g2zV1yA@J^LhLGY_L1#Cmy|@@S~myBl$UE5-bX`fxN>#@U{+> z9#Jp)xAe;%`Y=|us3Yk|&N&i3xBQZElwISd#$+|+y%EhSj`f9O*dSA45tifXHH6rxh5#FA zfR%EZYt(E-_;Nl+Oyqaycw-`hh>8#qh`>&*5iDAVa&fFL9K*hg8d#1Olg&~Pe$GBe zG*c0g?+66Ng@F;QFC4=L8g|27k=Kklf{D)F; zUonfI7!62%?)9X=jL>H*8hcpKzM?qyyQ`#uo0)e|zTxP;ZNtz5BXLhFhebMiWF+r< zf`Dp7^Yu2M#dKmBGUcpeD)&+`ok?0$XMz^fd6?*ATCX!ni|S0!Vmc2OolNU>CTUTf z30h3&7NV1Bz0M>psxv_gbYfXq-?7*l6D`v-Pryzu0)bT_^jjlR-d}Ooc(S~ep;*jN zLafgkMF#THB4a@iVti8rOkm(SHi)!Wl1QrT7i~DhGWa@&V~AxT(Ig$81Xg_(4H=?Y zG-8NlA;G0t@UlLOh78dx8ZpGOIGk~zS@5zxi-ru*EE+Myve+Wbf|vDKG-QZo(TE|I z#a>|+ysXcnAwx8aMhvkmWHP0W;$?jn4H=?YG-3#{2z%{Vs3y?9x;Q#eB5mQ#Xr~!s ze9-_CNQKIlL|aJ$?aRl}fs#`&TigMD(f-?eD{4d|ny;<_EvAzJ?5>kAuG5*MMRg`< zF`aC8u8szEI+L`h&IB!{^KjA0w7%>~T2yC(7Sp+f=ww>2Gf9i;OweLF8HBoiSg$il zi|S0!VmjG&+;!4|>in6cMRg`K zBrU2lL5t~(L{gp3BrU2lK?`(Bbj37<7+*fX1X77e!UO8)>^0Uu3eDHlKrW^;5=nJB zleDPL1TCgB5=nJBleDPL1TCiX@Gt`FbS7z0oe5e@XC#v9bS7z0oe5e@XC#v9bS7z0 zoe5e@XC#v9bS7z0oe5f?Q=%)TDa82l0Va@2M3TFS2o##HsexQfXC#v9bS7z0oe5e@ zXC#v9bS7z0oe5e@XC#v9bS7z0oe5e@XC#v9bS7z0oe5e@XC#v9bS7z0oe5e@XC#v9 zbS7z0oe5f?Q=%)TDa82l0VX2lIyF3|4tqXMI2990Sxg``K_8^zIT;?I_-q6+J}{4f z{|J-|UFqcWFN=YMKL7G1{O4n#M3a4z6-p?^mrw|w4Go`31uF(|tZ!Wm8x#Pa0!Z6u zQhdhHf;Ik+$uqy&1T;)}NQCV)~ghqKMY#RdM(x#6GPV;R@APgW|?8c_hBmC$cP*KWmPa1b*)7{|&~MP>%rIz7Ec z&)X@V(w22#kqcJSLOC3igxXg*z2(S_ENBTB$s^{fzSX z4|7lR(P{a7mndjx?}br&6%duQSF`n1MhbaJR7e53H{Q=h_%Dm{DEg@X8FtnhR2L11YheN<$_AX6BPM3}|Sgv8Ye35BWt4dj<#zAnM6 zFp8wi-ru7pvX?`@bA!l4JgEr3U9vyYesr-sZ`bd$@(nH@kHHN40i|O6{*@aQH_^XF zcKFn{01QD6%=&~i%k|r_BBbxqZ{1$4`N9o_g3AK(U2#-^GTPGJl`Neih6!n#_dUtH z6|ot4E2GW({$$<(qQ-A3ChG11;SNJXVO!A!Fe^gi=(7oCg&9ZG+$fG7N=PWov4+p# zuZj4QhACC^dN?7eFykW4Z@t?+Zoyus_UgZ|?W(%n=-|b=2r2O@xg)2z=&>%SxyK}@ zcUx~~L@)Ow>z=%bQSZ!N+s~`b62|;;d(Z*c7*KMgb^Y&@G2=b)zvR16@4N3i)h%t2 zzKeI$)`7|saiAiGpDw&j=OTUHcf?r{rHa6lcf|BAh>>fhJyib2z6G0<_}h%b)KI&^ zX*Ra=B`<8U%H{kQ*MZ|^RN}Heu7~eKId~_yZGyZQjO#pSl-NRTj4j~zlC~%!X$$*q z+9JRITekclX^SF;?JdQb&nATwu^GM;#&^?~KTevWh|TfkyKc)*leQ>ghsmsa{tZ2f zeXPN$M(j^h5*T9{do{k|>di$WV`>B1wws{!Z-Ta6NQ=BLEBQIze4hyWIKCJ0J2$Y$ z@o@gG|LQ_uuh6TL@WE#9Wt2H)uhM32g0}r8XnQAU_4X`G*fYwvH{8_Vz2X~X%Y>UC zGu)h|fuA?K4w|8Np7`opm}ZF^#7D$q?qFA*!{yG2l|KQ!J-K8KaSvaj<}F` zy;%@N{v2^9#ec^a@bOYkCoH0mU!?qVll;Ts#UD;BaD}f2@4wKV?UQ}N~~K8&f50W?1^yplp$?uCrW3O*tmFuY5$yJ@~%$$SML$v0q#DA3Jmejn ziSX+?q~u2@M+YV0&(W6@K~Bv$#vf z&aI&L7A+?xkoFaJXlr(AW6(Pe66p*u4P`i&SuZl~Af4=#2I*7(hz!v?Ho`;4;-ST8 z>Z3D#M#f-Ugl|(cI(s-dIy_3_yEkf|w;aB5E0`b`rYQ&e_RxOu4f-KXF~&$;^?V#I;tJ#CEDbUc{LDxT?Xfg>kah2~h(AL=l?E9wJ~1gTw5a@y>g5>G zhZryX7%}P_Lmry*4}h@mn6eDFvOcSy0IQcq*vO&&wG-ey>lBt1V>Q1w&NlZ$NC%Nu z!~v^RS33p#gCr?K)Sr~ypt3(|C|jj0NzMS%P*&e1vTcIdRDT95HI{KFVo(31AI2e% zDBnNo`Jx_p7P{>F!7*9ltEDkE4>{XKtx4n|eC18>WwpG*w|l^cnpB&kwmg@#<#v@N zzIwbbyWvqzfH-SJOr*>rl=lZV-hV-r!AW}`lHZIsAisEmJE#{K?<`(O?C6}l9X7}bTUu*dBD$W3-EyWt zGjhH|=syNZG9#TpKxdsf1207B1QPV0MCk+qI{Q~=;HObK0inY-J*!LCLL%!O!#|Jc zf{ffxgzG0x<%HmNSK4C>c=kcQxF?9+TToW;QQ1}XviquR?EZtYf{)6cR4?1;9)+@k zkIH_)m-R>eWzO1H;F-aHAaT4MFn53${N&1fTl`qh;NrD=S*P}w|5MLQ1K<0(U!i2O3s z+nhWt~pufW>w;1i@74srO}G;;B7k@&=sUHnzldO@YV4T9PiTp91y7>@IqOJEb8 zU%+lTyl3sJFn7i16@|78jKEmfG9op?!G~TBWMN%zKm4?(@M15~+{Bk2^Lyt?*} z2^hD`0lfz$t1PDGp2#K3wj7npdNtwXuIQ|NEikhmi*;C=<_)2IA4c7dFI&m?V7%*S zPJb79{6nrn4)(s@$A#n1aA9!7t8(CDdaFl(qpQ16*@vd-*9q2OCS$*3g8D^98;J0( z7d7{Y8jhg)trN>Zgm;5*Tq+!UML9-52NB+lx&%fN6Rt7S^Kxp)i^F^?cYPNhiBAa0&4E0kGpWo24~KJGh54h>#?sbCN~wI zC{EiuzBvZxh)yl&*KOrPQck(g$(Cm1su!XW-~ivtg0|q~wN7y)x88E&(C@xGH;%Ul z-{NF!-f%*)lVHCGPUJK z`*~yeC0HxC z4~J1WUP->EWzB;?=+W?FzSQ*%2X2#AqaT{VcMVh>roS2j`&hfK8kdzu1gO zRj-AAy@_D(nt{Y;vS(CUq{?}sIoLa$Z1ooMz)pLz5x$X-t!{|pbXN$~2Yu|v+w7l(L(#YyL z4bBWZbJwZd#~GFFx9x@=8A(uw^zq4lokhj`F(BQWPs{gN5u2#R9dXuQo@2r8G8X99 z5p}fCubJuzOC_h;4lYHl`#9o6>ol-}HvUf#4zTh5sEu(dOp&8t{Sur58=itYy8C3f zbC-`^QCeOr(g81{eq>(kVvcz&%EiC#eTO)6s6G#wAv&h|8n2kW`Uw+|!qBTEw2lSg z54;+~D~?;$$-Lr-RlN`=R1R_csm>&h;Vj1@4zZ)EUP~&2y1Eak4Cm?!Ua^v@SCY!k zSkAc|Vm}P`%Y1AUe&;gAW&Tt99%eq?Y=8PAJo;Qrc)UB%*H?D*$(&15Uf1W>a4_gb zX}o*ErL%3F--JB-YzEKLVR@R7*C)kRo(P~h@ZO^6+aUHim4kf)t^HyCn6`~;WTWcX zmAb7CzU7%LgV4iudGCI|oc=Ts`7JtduSF^LLippn?zF9E%$hNG*0x(?m|<_ic;Dr- z#!Oyo%>DSiVm_`9TwPst%JDUFEJU@h8w=dh1I@S4kF*0fdH1Dz!pG((fbWKfCoej= zax|IohkJnbgS&5SZkhn#@2PDJ;)%JVHq7Jr|1bQgF_{G_}XqVzo zIZF~ZOa|*7)F*UY;w&*E=WXndUzUaPOi82k4_m*}nl(R@^p}$UUedQD?PzOi%bIQ4 zCL&$l_CBP?w2}XVlAa~$#ge`u>EGJP*;8b?M{!;;Yxe8l^~Ig1cV^AGU6j3|iKNI;GA0ZOV&N zvL-d{ms7K*L(-R~k@L2#m|pCW|4$z6sr4}ZelPLc&0xBE7SroyT{0_c9-T$%3zGg> z($?9;Op|m+Ne_{9jieuz^g&5qoBjRS$bD<3J8ey!DV?Z_%`mvR~eY*1on4%bT7<|7Odu8{Pce)3$}PpNAJ^TmGF)HA>r%*$;N*)JXwa37TQxF&q8|%w5^5q=K8AH6Oe)2VkyH?OWRL4S6S#l;ruV*oP-nN znZx-)n`Dj>=xTvxm~#cXPoUYjerZ7HB%qQ1T_G4cL1V`5M9tk6ys+CG3-hCz|r$NX5Jj{y2J)^dI(oSzbC zU-Mgmo&xj+)-qlZ=p_riD$tt(?PvZZ&=whTE-|kQ)DP&-_-5i80v!aX)htDfGxuWz zI@n}W^x$b2>qe&zHZ1~Oz>zPt+_VXV8(GknW3EolPYJXFBOkiQF!L7N(9i+X%EmXh)lx zaGqqL2LxIRXmRQ|^F`sj4A2rlUlQ827J5`@cLQ1u+E)bnyoJ6h(AO>Wb%CC-&^HA7 z6`&=lWN0-Y_iig{I_YX$nCc}<`@E%aB(?;${~_$E%5 zNH`-ECeF+KU3+Ykn%wUo7;ZKqH$kaQATTHNOyOnuUHX(DoMktw8%)=oNvE0Q7{p z*SsoF1<=FhKJym`fo(1X)MV~A{}9@L18Oy&0mKNoNjSe?S}*}`H}?Ws?R?R+3G^7C z(*YF)`mv>T2=tnTx&&%zQMoa0YGS*Y+%gMm%3s7NMQEOdx&_+JLR$)Sn1!agjI$2_ zGLZ9JT73baCP32#`Y52H`7$Bcc?+OcKz#z;0celZqh@iMw9gCeQFEw3U$)Rm0zGY^ zTLgOELbnO@TMIoU(4Q^zqCjpd^ZSbVd75_S02x4k5ZY)<`=dbP06pz|#f;0)mI;CWdM*uZpt~Vsm^#Z+22wFZNoUd5uZa~kaUNM&l?Mp)Yr@15J zqL&)K9rOFAc_0G)%X}u2HdnNH7$HA}G@E_CZGl-f^itc7NS|(D`m$XA9%;(_tLw}!DNa9m>nNcyc<04FLG9LN^t?w)smhr>6yiE z0CP4{-<}J=xoqeXNv{&An~J{8Df8Kp)b{AeiKve6j+~72rIC&8WEoTDuOpe74ssSG zRcl9ecxIA$T~gCY4aBHt{9IIO$4=svy0~*eDk{}!Ztk3zN}Jn}rp!IyoMayAT!8dZ zU?!Qb3;xN@qd zOQdcty$>z*w$dV`_m^l@Y4lQDmqwq6l%+^Znlj!vQs*E|o1MljfaUumO_{FoOs9-z z?$gK9t6I7R<5}vx$J3H!zlFpqx8P~faon#K5{9dpr`7|)ptU7a3uLPcH z7-=`jT;>K%WSpLjip~fXaxF z=d9d;BUa*0_YW3YHR4b}EnBKBXN|x!JTt{Y*N(t;3^U6@4}g|4dsyfjpykX#7J31+ zygAuIzXL6APPfoMMjVIn^a=|#wVwp&dJC1>=U}b!K?_Z8F9Z6LLgI;L^Me2?V_*Gm zEay7NVYPFzSS_3_rYnHTpm_@A$%(u5fX4aB-T_nwbd=@17o2VA0n`&;fGut2JPSPz z+6Z&Kg`NRzgt@~)%%R;pYN3swwVNju63dF_hXGVZ&-79N&BBxUR|2RE=#2n63u{T^ zr}*VNA9p;v2GFHgt2#v>jioW>ya2iqUz+%(a^~BMAHzDvpzQ=r{@Cb5woRvMWDwGbxt;y zY~|Z>vzcP<44@~m!uF#8`X1KY(jGZgu52C=h^^{5?DPCq0DaHQFcYWyIya*Io*qEI z!m7}30_YX2^z6gOE7CS^#+up@0aP~In^P6a-&34p7MP17v<2qc2=qR4R{+hz>f5Jd z&=+FRV=;(%qePi+7hi*%{ym;~4iGj3$lv3wKQI2>EHqDw+~X;7E;Qe^5IJ`;Pb<_! z&PC=I0%;vBGOq}9L7x4@BJ6Xe(hKr`DV71DJ0c|Uxic^E_jqe|WHuE-og~4M_ z(65_VhP})y7GfFp!WTMNz6;4v%oCQzzI7k-OG~4d_BH>sH1@6gn)W`mjD72V z#P4Q!MjZrTIr5p%d%t&p^iBg{Gr(St{rYb->aN1FRBM4d;P zhb_dIILiFlLX5hj3~q&)U!LAQ%1p5ky?d0IWg&WErP;$m^u$U$p;Eb}ojawDHtQ^O zbm#7XKBkbg)c2bkW6syrpt3pE z>>EIHv7UK?LV4E131-MbtcMe*5Py$nuIW4^b%MDjkedbCX9DO-K+gxz{aAZUZ%w&# z%`=_HrcN^L0$q^*DRMa3{Ln(b?<@oQnLv-H{?&PM>H`$Q-{YBH~+UHX4g8a1t zc@|nP(5VWUJ4by2oHqy1y{R+I(*nJex^L7WsWZ(R0$n-!^V|G0f2K*#qt3_0>NCwa zfwV6_(@Y7VL-Ew>bjwLE4VtGcL{F?WzY&O|#aB{inNE53O)cL_4Ve=JdfZU%93vmS zM}Cw$*BsxkxzmH^nbQUOnxW6mH#ZAJEk8`1ZyvUs)N-L2g%uH6O)VFhsRF6h7n^x8 zXmJcW#>!F4#paV1qLxd{7b2XOn#Tg@h18|yrxEBf^NN+Dmdnkyc%tvya)mj{LM+jh z=01UF*$b(Un1?NmavwE+ipc%98Mi&PXc<0crUlTII8o{UviC0VQPf=Hf0EhR*-I}J zdfDCpZK2#jC{R#@LV;Gfw;+lFOS{m8-so--6f8)gBA}vJK|w*Pf}nzeS3uONsHmu* zD5xN)sHmW*@QC_9C&^@|Ej&Np=lwnZ_x=3;Px)|8z9(mrOeV=Bnc3ZRPRq&Y*l+1Q zWGg38pDXYn_^Z>ei#_Jkn5}uEcYDLT7jqdfFL=Njo5})jd<2H~CPI%l1_9z+4 zNqBA~?^!%Ik?$>@kCCu`ct*nWangm8Nb?CYgp(-CW>O}|@muUTwwWvu1oi0!+OEjY zwvZEwX0RtoQYL}Fh46mkeD)N{;3V?fN>=p8IFa8ra)y)W4^NX@_|yk;U(TK;wk)2C zBPDJ%dzPefn#Zrhvt)>fBOT)c^m(#g(MkFOi5`f@)j0aZJ;b(?4uVKd+(w`*MNhFE zp>!gg6NM$$qO~oxEZ<2_?rsrnz7HK00YTnS^CfSN2wRcFNq9pBI zJP1~@m_u85UMlD{S{Uc1?<=}BuCo@Rnz)|YK2ojn>q7REO@bUR#6{Bm0(o3#&oJ!} zsg;xtai5a61VJiY$fx9pA|J$^<|OVGpApZM=Go5DJ|q1U-K>31iWDu@4wEHiAwj z>lJ0%PLX|*?u58gB`NqfU)*nT5370t1oA*&>P6<=jLOLj^6 z4d@@_n56F`7TbO&j$Bb{XToCJInqIrC*e-pA7q52i-7(lK}lgTD{X&~6_Pq7tb|vS zwoB@hu*OE|VM&7$9aOL*L-(KeFCCv3CX=nz4?kJ)K~Bh$Gm?40>96VjpwRu+gGEv5z@uswC`V4tkj+>|+j^ zCkWmxTn|*FXtU;|cSuj{IZnD>680P?-6aWoj*}jcggwVe&q%_a^V-FEeU&$lTMU`J;zCBO2VE4Wf4TM=RjE`Vb5{VU6Qcpxak2&*mJ_@NlDmq!l~mb zagDI&M9`L!u;)b53`y8?n$QuFu;)b4LPcF|P3aOz*mIiFT1A<*W^}hC>^aToVMUp? zXlffPa>t$%O_LOju*J}RlCbB*(6Ndp*kb8yN!W8@>2gWfbK>YGK@RLW9$F{ku;+N_ zAxYSC;^}Ecb8HDT>}pXK>^X@vRTB1`Bzl>o6A4weWI9n2_M_%>rX=h~E$AJReg|qv zw@SiZbrIbo347JW^q8cu#5-*%)Nzf-9s5`+Z7B)+SSy+#DKT-Stu?(?685+>8kB@R zt_@ux342^yS}O^ATsyi$5WnMfpt}V*CMCLQ2YOgidEzqCfu4|bGsJbIwsE{eOysAFl;&}-z za=EJOPDzRS z<#aQT6XonjpXDUZy&pX+jw9&VkDjx{^{1&5M1C08pZ4Q4&oMsf8k$AFlQcbP7`!F( z3nxr-85u~MOyuVWYrGEnAliYGSSb#oBPHQ#cQ7pwo-k|fs%O(GMZNVLTB~TVeg&;l zl&4=wk14uVA3`-Rfj`W>R3A!V^G4G3`f!@ZN#s6?9#b@v=F-|p=!tQaG>^{A7lb7n zO=~6L3VICP%1Nw&uA;|e9Il|RqQeV9$Bm^ECE;;b(-%02y1s_)<0NYE8rsHZ<{qH1 z!z2lFA4g|$631Oj=PFu8uBDp=LG3QkucLb zh#OCfBvo^|L(*NGwn|#X>42n%Ih~XAB&U{Bcn*%8oU$an%c)Qh`8atofQW^UQU-3iMXqpf3MG=1;v7jnxEBg zpoJw!%gEg34tphSQ!3)_0nd5#Sx#a&JY?!nhIk zWi;IqcPGu0ge6-}S8%E#aV<8J8fq)YR74IdXc#9B=$8n(R4}Jiyx!&EuN3l8jI%> zbgRX4GqukMrMZR1a}sGjNi!s2norSci|1B)uf=m4eb(anG<98XrrCu&W44~~M_a6B zA==(z4a6k~Px4NS8vC=Rr~Xch)%NEVeUUs&+hL*2@J=tLk1g_x!FF(uwm-YG!;-vtdhFcs4gq(hl=YN;7_@rxkTEex(Ph z%(!00S-NTgQVr}<^*7GZqYIHl+x?TCs(b zdPyH#)S4P>m!xkv9pLm8)mmI@80-wEc~FBzhKofn#j-3Tzh5-Vh+tbKC0{(xXu_gz z6LGySUSveEB2M$jwHM!RG-Jml&A9j;BZg()j-K<#%@;px#52zwf|g&r%}8crC9S>q z1)~KUu}sA6y7)~ag>9Gg-o@`5t=KJhVVtPJG*%$XGNgwqA&sq&^g<6$LK`-ldy2Ny zmaVcJ*Ot`^BKav_8g1DzOI&+)M$u+?&pUcK=Jyq?O!?mE$YyeSjZ~%tXeYK+(!!M0 ztTV$OG#2A-d(xSua#{%2=#0^Y^^^2+3evTl#N7}+kjVe)^!HP?8JDp2JWkA5y0K%N zmXl9X>g?Uv*n7}*Ir%!}Pa~bpl=Kr&Pj;MB6*&i~^ky?xpr<(Z%h)PTSZD3YWo$jC zI)eH2VefGg<6vL*y~VR1J7@9CWc^lRn!HhSI!(-NFge9Hw2#mdiNw9KyC+JcqIal5n;*j2*We2VWO)pGXsr8^Kmd z!r8@0_ADon!zi}b;+e~eR)xxv$8O;yJV&!NG7i%m!!BDL^1OSGthZazf88@OgqK6#1y1 zZ5PC!FivHMB;hl~sq7pl@!W7KOL`E~#HW_M98+0_qJfSgmZxZ>qlA@lT1GNcuXB{K zPUJT~#_za+b?1cV@Dja|4Uut`spXE@ ztbmi)m7c?@IDJKNXMGM^rH)%h=CIAu6Km-vwqFvqtV(v;5;vC>)?)6W2IsNsCE<0r znXTX?uETux1Se6u^I4tr#2n_cYaa@wQpKi8!c-QpC7eVm3)wnOB9(<~qoVd?A=@Pg z*By>(c8HT0d#YLN!=W5*VXZicR2H$0^(aevV#yYY!W`O@+gMP>VVbwILl)0FSo`&OobX)6GB}A+-^tcU!kWK}9kzHbXD2M4ce5@V zLb=zlGESK0Fzp^TTaY8J)!mL2Y`OHrvaDbu9u>#oQ~Z^zN)qOGFWV&vufu)Jvk^VT zby&r+If-(vVtW+Lq^sFqk}#F~S^OrE1E%r-8^}r2{2DfbQw=F1t zmytE>K1Gi@*0QaF91pa5(y@;1;WQ84g6l%ov82Z^zlDySt=x1SOP5rg{4980E9oXq zRg&)F^sJ;+oK8r3m{ZHgMVe1?%9FH{(=C$T<+NSW?pBeI`$wF_-Dw^BO~k=f83*Nb zJrSyxTGoye*2_5Z5X+Krc#R%r(02;& zT&sQLc$zikgt@mT&$8x<_Bx(p?Jb@!unZLk?;x@)MSC4P*+`4$E;e4pwI?sLsfzYG zUSZc;JYQv45~vAS`yO$;&dGe*`KBa%+S!HdQG`!BLsS#@lj9v$rPAy|-eq@is&Vve zea7)FdxFz4GNAQ2pq(NP=2DA{ciCH##~p+KSe{GKe73Wu5td#?pEY;o?+`1O?UpzzEf1`{EN|TW)9U(ro|~*>a=Mc72WC7 zwG2u3La7aHprTZ#QyZnIqccpKC~0T-DrXa|R?(x*Xl<9Gr=4-yVMQ-F;rpnc7G>EP z{*E(QYpLjCXG;yg-2$)e&hVqoi?uREKRR1!OB9`TrfHibt%2{DY@;1e6z*!Tk!M6I zYg)&;I%;hcz2xkqWh;8e*;Ol4^s%$Mc8j8;&Ys${ihgwV){ZMW>%2^hepcl0aO>u- zK3Xe9ZCw4d9*VlS`fFE8TA5Jk9H4m>RXYc1*DG4;%+{7lda8A$Ge=vesMPEN%upV!?iCJRXay%zbjhm%+sQt6Xkp!(j2X&DXMmk)%qw}>byqFmGpA!p0074 zUr}Gzc&$>=K-Wa=Zb@%~r&rsksIRL)dr8qi*JSM@Ny`&@x~6Ey74>yZ)y^s!=ql1& z&x>;IgEWh^L`8jFWm*SC16}1>A4vyWU*QU9xr#=)W@vszV_h?~N=4VXW@&dTn(CUZ zZB$g@x=DLU(&*SqSEcs8qH5R8+EGPu&MNJ+qNT0{n*M?)_2}3d*DYGCqSdZjwKPd5 zT35OjYkd?|yKd8R6~#I4(EN&)x|V5`ifUZTwYwFqcGYMbCH)3z-lJ_-RPDM~ds|VQ zbCvd)Bt5OtwOTu^sM@tgb8Q!;*3;sg4{9wX#ip%ut<$rritqV29t z+H^&)x}MOMDB9!NqCFxh4bps4+o|X=*VEd5McZ7@X(tqIcfFv6?GPnPOMBI|Q|q8; zk877UMAD^@=1bamMUS~&)yfoYbM4k{mXr;iZ)(dGJ?45xdsxvn*L&Kt>bUK$53~;y zz3Tc<`$5qj*8$DBQePLz9`C~wK(YdMQg9<3)dNKu%hFxe`xuN zPPzWnDixh^QQLir{)C^XdPb4qHf$d#ig3GZKPrlLhuPe_%-oaRO>Ak3Qr*pL0~ED$ z$Jiz)>h6xW-KgktcarTMMRsR%+rx?mxl?Rg6%BKz*(OH@Rh3v68_ElQi?uC`?5IgZ?hFjS_YnX z*eVq*bT7BnC?d{#Y>!D=1=nb$?F~f-U8`+hD*D0&@2*ORslilW_HZLcayc0X%7qA1n z>F$2X)?Lx%?mF8@MeE$J*@_iya=&R?r06O4+qQ=kEp@+Zdr47^`vcpjidMTnw4GJ- zocn;y{koa^Ywkm~WJT|}Keu(3v>EF2i0w*62VGyz(VwnwZ4W3i+&|b} zP!!=lW&23cao5kbpB0^Q{bq~YEy}Vv?TqUmw)Tpm-REqB6(zfgp06m?t?8AD+PQW8 zK1JQ#PW>50m%GFC4-~C)N9aE)+T?DkyWcQ#f65)Brzu+Mj?)Jys&Oak6BMm>H`nod z>TwL&oc5f%rM^_rYwlG20Y&e*)ATKpwn2Ti)!$Zh(A81@M$s3pF1r4vNOK#s&#wAK ziVSxTy^o>@cQ5^FMaNy2>J^Gkx%%qM6rFMP*B?_9?atEQP?YS>*1uGg>b_E^Z<)Eb za}U*%6?J!y)O#tq+?}V7RS2c ze^F6{d!Bw!(Q(&&{WnFYT-AEBw?$d%pncw|cUBbbUZP*ADA|37K1ETg`!0RHqIT}P z^#>Gncdyi6P;|L_mHv^Ub?*E1pA~I#Kd48(W9I&p`ysu(qNVOf^uda1+#B_LMXTM9 z>y?V0b8ps{DSFMlRbQv*J@+&EHc5NK4!WPyUsv>{dx!q9qVL_i^zS%{{g;>ZpE)fg z2hz^CU)JHvo!}3Ngw^TcikxAu>xqh@!`{+6Drz3~w%%7!+pxX*P(?k$_URK8WrlsI zPggWF>|?!B(YUZr^}7}2haJ{8Dr!%^&|gyI4?C*wk@R_5AnZ&1m>}3W=|aBJPjG_g zl(4h#m3~$d?kpVF?R&*_z%}}}dNW0-&J%h|MID_#>engCaQ>{9D(dh2MXypc)OkjK zNzpaVbNUC0e9k}hF)YgdkfQlv&FoJqS`rp(e?!urX{%ic_Ky|SxDxGODq8AF zwu=|sYe-a^)vlKIsQ1M=M761LU1U#IwA7Vi?<7fUaZgxl`{jxr2y0^>p=d)`d%IWB zlVP3grHXchb+yk^v^%Va{a#5aZSD!X)V@*ChOj>NXBF)T>t}yc(www=!m{k2D|#So zko}aR4PiNU;{$OHbJCs+8)A=9v?FYUy@R6NVR`l|BwYfzUu_?!XhYaId!eEoVdL$U zlJ@cdW?|DtF^ z*bF<{C(faNn;l`Z?D3LDfae^0J4GA9D(yWL?FhTso+D{=>{8c4`!$McT#M|J6|HtH zw$G4sqV-bO68jQGHLlz3D-^AEEwiteG_K83*PZs~6xF!yw!f-qwd)@Henmfot+1a^ zbT(|2{j4Gu{(#-JAJ0#;`L*_FPBp~W#udKS-a%4no2c*y?O7Jjb@m}L4tvKs`_+=L zcRXaD%t^c(^N4-AjMG|p!XL5ESCkUI(SC=b4&jg6YZax3Z??aws89G-`$vkZUC-E$ zOPZ7B34hN1m!g#L9rmyf%~sbTe3!kYqV({W?SmBc34hI=tEk%bhP^=2=-90Ax9k;) zhK9dmpQk7tE5ZjENs{o41{oQWp7iVi8X@Tg&-*}ylIlDMfaXei$MYG`8c7E|$AET8I_~)v z=zyeT&q<(@l1_Sl1#)~Y%JRGC98gP1P2*VvltmDHlE48pLQ<#r$cVv4p``Bdu@TwE zTuGVn$q_lm3Q1#tt}r%B8Xun;aiy_a(vCN~V5qU8Pk21yTB9Q; z(Xz%H-Rn_5>G^ruUlHStv6i?A#zaN#$O%SJ5PT*kDsrNcdX(qjINIin!)x>tME+=# z80j^t6s1N^GS+eux#t^O6v3zOja`C>yKRTa0^_uzu8}??{TSx3ki@p_9a(7jIf))V z&8Xxg=FroOC6aKAEH+k3+8dT0UTSPq)F(V(JgcbMHN$vA(usuh@R`P8MSa3&8{aFc zc2ydGO8Pz`JsjRE`%={I_Yr-<7Z}Nks$I7joh1DZY2IoKRMaQ@He-~cYS%I&Uy=tr z?=mVB^$EYnxLFbGr5kri3QJ56Uu8V1s89GB;~7QOu64$4Np0Jvhd*R|uBcD=2IGXH zYS$*?4@sAU=i^5FSK^E=Z`&vQNu#x*YS%WSr=<5&(!-xIauoFmf58}|sM@vDm?9|= z%DKz9Nl~BhI%Bb-YS-(=Do&zJykXQT+Cknh4k?0nLk;*SAGQKmJHh8+jV_9wCT|-P zIf?Hw*=x*{gx_Vd*SJFxenZJ#W4$E&-jTh=E=l-JBYTYllJI*#_8KQ8;WvitH5|t= z_phAzT_1ammXh$>J@y(IlJJ`<_8KENEp*`bT|j=4@SBD98ixcCZ`;9gbWk(~XoRE{Z7U)_HHs9C0b0sQ^tjKAl_CzV!~V$6j7^+s9DCay zjQrf#C*mAO+a3XG@*U655#97_pdpe@v`r_U8$n5ba=K3tPxEtQvy8*<`8sSIkaTG~ zB>0kLtTX;iO^1y%LHxMG#$_^YWV^p2j~E4##6Z&A5j(Yy>Uj; z?{K&H!ASZ6OI<@eaJTr;NS73rxH#gZG1jD*J0ngRWs(vT?~M4#xRaCUe?J@d)}zge zYV1E7r#Zdmz_-SKF~WYt{9be5TjReN9zpQd_-gyFM!6(>PyDR0K+$IS2ICcq9nQwHqvyQH=Yjdgr1+r z;xB@@{%Kgmdbm$3E_X%au_zgQM{51BMmlq!bc=sU6#4`~GBOjS2Hzxmev3%IS1Nj5 z4idi;(+q25C{OcWvxpoY;Q5Z?=?HlZ4>y*g-kxrXWthx;{`vVfuIK;0<(FodJK;5q zlEF9LqQzRaf1b-!Uh;A-L#dhRG(N94d0ryT+5D)7xn;g3EbKy7b9+bLin@ZN@Ey2V zP7x0BD|i=g&nOvuV=Vf#}tnf+YDT{t#jkSiYxm&|lACcOH zVnv-Sx18?-JS^-!UbYL#N5PYkP2B%+F2%7TM{61IT1E=8M3Pel8B+#=efh!tVs zW3^k474}%(#>80qXAGt$j!NKdQq=a}mm-A=$-ke@g*?CDXDVc4pU{Yh-yn?VVm+_M z{{P%^p|cS7e}3%07Hd7bzjKb(F)hx6=PRVRf)|paW~{NImc+4Q%(12>!q#!%LSa!J zaqiY$+_;5XEjW%b_@-AP`Ghwm?neolE!;6 z#@fiYyahJ2Q_|3KAFuuwbkC(-)gx~ zSfpT${X3RWE7Hgx{EQk~tS#Ic7H!OW#s4*nNK@~OwJK&};XI5MOSV$ z`eo0-1IMM$e>jhqEMiV#O~+b?;vQ`+gYax@7k6Zo41RGT)Z@gljaNOw z^3P+frD~i4j^~t!asF8z-U*VCSCswV6Kfq4#5nWM=k{;$QoYSfWewxi5qBSrybG~5 zelEJaLy7Ye_b=<2{#Pwnhm7p!xrf3U&r6IdB34*zGIzYbj2z}ig~H}h4K3zTq4XQ4 z+}L6s^(ExOczMjbbI3vohAH`x`-pz@ujPU@z<4_K&$OW(_MMa`{zA|Bk7{VQdYYxh zt7e{&C_h?6?BDZgn2T9s4ekG)+(TEvJd2RUye=WjzuyPHGrWE~30WxrMsXqk-}3pR zQF%fZ_zfz4twR>GenJ-0NAJ?`yh0Wj!623rF_XmhW2O_bh*;rS|J?t5>4Z`?%M-Gg zWwwrQSaP%VHndx3Q06FMJyX%&(IR54{`LFv|5VBi^ZlPb)BkUj=U+RE|EZ%I-@&aV z3B}fLy=ZT2sXr6=*V6g>JvT`kbr&NE><{WX=ggmj4`OtpRKJKXv$@ z+OXDuHT<8p@t@kT)_^tqpSJO@)<)=FR=*A#+O2aia}8qMZNRWd!5UjX&Csq0h2OBm zH68Asm`63Vm}>;Fy7}jM;f_T8yuJiW{k2}mVy?}_o`XnvR~wvXT6dqU;eTyMC3Hsr z_4CCuGHWt)c8x7&Errg`TyKUf=R05P*;&J4)hwR&hQj7GYG^TYN4s?mZVj8|`8z(L zR%dN*_>0I5R{=V&pOC-s5$l5b$D*fM&hz`5JBp#$#wj$mG)}X=&;RB!i|dH3+PqR2 zu78z77V}L1wWHw2%b_Pm^Ie)y*vzY;#mp;Yrz8~qKOH4Xh*#X&>clu;?gIVa^}(ww zN@bQ@q#v@IH7wdgGOvd;F0K8}8VeimI^J_aQ%Az-*c3;Em^}2+mG2|8``aH$r`SIzW@I`>OyZ=_28`+>qOMp z-;@8Hx2^upyHcXXin)z=E(|XjLkY#3wEcMaLT}qPek0e~maO51E#W`y%6w{hp}7az ztv$;c{`dDXY&qvEVM9A5A&WI!zl0$lVYhlx`Lwk0`=6oRF!P;o@t&vkop#Y;w?trF z#qf8V2SSTwq%(g@^Fm?kTkhgXw^a_~Dd1bC8W{s&8-L$eClh#Iu)ampIQ(~dH`a!z z0ZRHtVrj+mXp!2#`#r19s$Ged0wouE&uR)kU-6!mc;lj&TS~bU;psdq)<>aphqwCq zn^d6{8I|u`nWI@t_PL zqpO!>Qv9sc5$Z{p8g+!u_N-<{sIN_Fl%L=ymA>J}PA8kXZidgkJPrOw=;2L2tH0@oqvx^a>25lYwM&nL?{4m!-i0iJGSiqXJg+U>XA8HSqWJs6%Xs>J zGBrIbW+j`Eer3#Bu(T&@*`7Eb9EIiI!ppyftV~}+vLK!B*btC^uwML^JM&-#c9dZ` z+rvi<@b?W0$aQhQup&|j;SJm#6~s1kY~krFf$$~p4Y|A0qvFnz*V1D_zMGyLhqcj;%L#EGli8l4xKre_^wsPX z`8xe32+v5rJ8n4~JKnwu123!FUaxTBPrJ2Q|;5;+7+xZ=mEqg2b|YL%#0*3xt2|{s)h> z$A3fg9%$L!6{V*~c>FhTZ1Z?5PYTEdAalUdJ^l#DEN;)?_MG@rkngzovoy8GR7fYa zM=2be+M@#eQ+wP1{;54G!6&uHO>viiq%nTdsYgxxSymW#WlSpgZ;6j5V_PpWM$%uq zzZ~C|4e0R>NWI5CkiT~SEZz?#U)Yptq9$AQjHG_jvnST)h@P1cE&#a)&a16r~NfE*e( zEb$mgNOe0-Kp*iZ_R{ckl1J$G5jgUk=yppY_R98f?o-omPdp8uWa{WR4WDZ2=r{*y z;y3f7%;9zAqz`4hmguBUWV{U$?NK1dfkb;0w;!R$GrmalYVW6f4Y_aW=1IDmRD06N zEY_#jgt)88;9lvZEgRFTeNtOCflEJ^6CbZ4uNW6pBVUbIQ?XOmWHO?vN6@{;DgS2IfS8c~|k8%NX*y}tuH zwp%a!PWEryCn6awUErsZ&}Xey*1K~umbpDIIrg~9-jVba^mpv(IQro@kl*AijBEp% z<5^$X94&=SM#5DX(EJ-1s|Pe6DP!TcmYO?A6Ec7}VBE?E=^;ZwCXrDf%eXzr?K8Q( z4Moom6g|68^sHlO+0D?hhoNOJ!(&f!`)O`J!|l=90Jy(pYd1zlkRjTWkq$B&EDkbP z!(*#7JoXk1k6ohmZQ>wzXjveaYdIiSXv09R;r_MUe?9l#1pY9gAh~2n3)J}}!1Xi| zNJ378vZD@=DsI1#EakdAnbaKZ-K5`@WEtla$<4^MoG&HUb3K48Y(4<|=aT_Z`CQM5 zn$LA@)H<%;iaN^mPf;3t=xjcDD=J0me6CZP&X>H7>j6=(aQ#!%QK>bC$NdzQBJ}{S z^P1*MeN@^t4gC%`P2qY#)BvgTxi*^3=ekp~bzF~b_KLJ?Hau>2vlOn4W?7)!P(S&c zH#D0s^*XMPH+zL^quEiZH64#Pnx%04R@4Bg^QE3I^*XK-q6-`%{aUxsneZlDuAWW2 zQfu(JqIE_#ISTqMR+%&aKCAK;yDoVhX!LtU>b41JZ`S-G_*4_xGo|)QJx}VjQcrA; z{{GmxTrZB@)m89et{2Cq_7vr*l6r1Gj2{@cYq&`Nu+*vJq@UFItBqJ+S=UPYbwbyU z7rJhO(5VxJ#^3Nm|AI+ESLI7xAas^bXfm0QjmDKpsi4t6b&Al(q^>O#T;P}SQ)Rr= zwbNvLk&G{v@lw~8$oNtjUnb+FuAMI9%Vm5(#!EdhNXS!go#sltM(R4ySl+o6B7Tk3 zyQHoIjq$ZJgeKP$(hT}nOR4)wJyGhpQm>J^7Bn7THB+WDOQv&!Oh@W|QsZxMVfu5W zUL$oaXr9iEGM(8%Pn;wDrCuX-Eok&_d6S6mC-p?Bt3dPfs+8%>mFY;mM(R4yJe_$m z9jPZueGD|l+vdx3K=blTy+-PmRq}YLvq0l<6D8Lzki1YHFZCL!TUHBuDrh{epX7;B zXWb&~1&f5Px>csPShUMp(0E+k5@}y5?8iX!^4~6W>K#I7Efc!nPNA#r5_;}(nI34K z-rYhUs}b6^Lg>_$LQe#Z{UYmL!3FmTUA0Q++SNkW-7oa92ZXk*6}ly890&Sw4gLN> zVb5A8bV053dr0I{1scm$`>@b;j|hEiz0fxJ96H9QZWKCelh6f^30?KL(7Qn6ICWTR z@`T`)QumX3qSSMxUL$oaXv}AqGb5Fu5Ps>yjsOU6;Iu>(7(xK;v} z2^a6T$3Uaq_LR`6TZPWrCUn8mLRUQ_?axX3^V0r;(8r|C+9~5-l<~V{yws_$NS3;` zPH^pOLT9}$bir<^-xS*Rme8qtgwA?f#=j$U)w@F1?iJehp3rqtSG_N|-~*xYTk`O{ z@!RB3y6R7%;pfl!`4RZL83o*} z@ehUx_=7Evb=^IV=Ha*aEU9-K-K5TZR zS!8r{^cB(Lql=>}qUS~58ofOF-sm;ak4HZr{Z{lR(O*TMj{ZH`9n&<%6VooHN6h6h zqhg9;f-#jb^J5mpJQwp~%Kips`xwN z*Tg>)za#$J_;c~I5*8%fo$zqNwuF}w9EpjEtrPnsj!rC1yfJZQ;@ZSri60~$N<5kP zOQJ0)BB@1EtE65@eUtK%#wSflnw7LE>8YfhN$(~dNjjDEdy*|VIypHxCAn>KdUEgN z%;fCkVaZn|r!?=-gkEF;Nan3rD*v)wXs z9SM?&q=Mv=>tO;hi%cOmkQs25XTdd|4Oe(BSps`Ww~;%^9b_f^mf1nc^yi9hG*U3)uCV7$U0eX+TLf(g8c!F+3HbrEBe4ES8O{POQvk6+R z;&KX?fhIG+GKYunvB+{%cBI-Wyd@%}B_#p}^OG=S`QPXB%nbFh(a!%7Ekk%Y; zZyGAe3Ld+L%MILaJ@&0;p%gx8)&T)rMVh!Nt9yA@>5xV0ch z$9({jd9YL&Twd-e&_dw=geNCpI#anU=5jih17p!XBjGI@riOA34=>+jO~Cp7V+r4Yd^+JrkQts|Kt7-FJII$3s7}bf1Ow!;1T5#jmivD{-}e*o zDu2f1cZpb6|KL)zSgWNf32W)~SU;563`g1t+1ecC3taBz@@+2nbNLCEhq*k?*`Fbo~qt7lz`P0SN>TD?}Uys!tghZsG6j$85){DW?zSX@TGdw#% z?rVke<5qPbKWl|&_jdC)A-tQ*{ak*+Ke!yt%dj`?v>V&Q^WlUPb2**M zfw5?rk+2J7&p4EGcz6MqlP&(s6Lv&kt9S+E{RwY?tW9_qFcHc)5lG^%bkTaT|1=*q<_Mnbj ziYuPY!@_@ZJ9iVvy)K;Y`r4;MSooabqghdVyi%fm#MP{fz&a7NQQh%2@L$X2 zQ(V5?ad{I4%3SuaX_Tdn21~v-2ERhh7 zff)EU3XlwT-kX6;0vm%nL>$;#a(OYtFt}HsOo5#Ycm@WN!Tll`GPrXMhwu!L4DMhfAv_Z#gZo!5gl_=J$cp)h+c`$f-;syI6kPPmG`4C0}fiy?eBNJeVlY$&-0BqI;P*}x~I;XL4T#c&4jX=jk|oh)z$j6cg^ z`re7*@G?v*^}M{ zGK1a?vKPGvK=!9=K@OzrKn|i0fgDU90hvuVfXtyAL0&;0 z19>HV0^|_71>{ir6v$!lvuTXv(`P^i=yM>0^aYR=bO*>8^hJ=@)0aTrKwklQBm5Kz zBeUu2Am`9GK+c7qUx2GX-v)UzeHY|>`X0zC`T@uVbU(<2^dpefxVKDhp$9=OqMw4i zpMDPVDS8BIax0fl)1zS7#^p2gO9($pzXrL7egkqJ{SM@Q`aSr6N`Hj#Aud0M{ZB@I zrayx`Lw^Bzmi`9vAM`B9bM$wRf6zZb{z?A=`4{Y3<84&~Ntq6kF$1K=oFMx$H>IQ> zNazbJ9OP6M333{X0(%jcC9D}(in%OhF%T|eaUd75c#yZUM36gKGRPNM3y_D{MIcYI z6p+8ORv^!@G?0I>wjin29wgH`g4DFmAZ^+uAa$)9NW0b@q@nc$>Ck$CbZVD^bZLD+ zcGCKS{KA$A@~CY9$YZvFAiuN?26^0;1M(Z&l_0;h4F&m~Z8*qNwvixzvgLyO*)|&F zY1>sGf3aN+@>kn9kiXfk19`?a0pwYm7vw)|`5=F{`9PktO#vCD`$4wUr-2-%7lRzG zmx3IjPX{?t4}ct{SAfjbuLqf@&jLAGzY*jZeGbU0^h%Ip^?4w#*5`xt>kB|m)vG~H z(-(m((iej))|Y}T)o%w`rY{3IUB3%tK))MgP`?M{41FbBqw7J!w>IeaL3kEOXubMs z2;T@2TCe^9gy(={KKyK2X z0Qs1{g?1)0X*TrTxq3Er!8jjJE+Tcd%;=}1Z;!br=7E?;VjhioGUmOQZ)0fePq9zL zJrnn0-0N}g#(fs|Rb0D-K?&UwuSuMgxH0jm#G)kITzndChyM9}!2e+|3J-_>ei+xM!vAUTAD&ji zm{$m+cp;45r7+r+!Zc?!{!r=zQhy@# zA*oMG?V#c~kJQ7YzE0}brG7)|x266~>a$WuF_BI)sXI#DS?c*xFOqtT)Z3(fPU;;} zza;gSQvW4&nkMpTFLh_ByGh+s>U^nRm--E<-N!?xQo>KRcda+&j zFO~XssW(dfnAA^5y+i63rG823&W1?m5~;gMeW}!ar0y&AP^pJYJyPlkQhTM&m--=x zNdFP3H%R@u)Ne@rmedEG!av+4bd=OFQpZc3EOj@jC%A=wKIk4cdrSuWPlx|am_4Q` z{P)t#1Ru>$Xu@7dyv=Tpxt7{v9tHiT!ye;=o|*)+uN3%?EAOuGzZ?8dhyUH-e-HRS z9OB^bvZ18~6-BE1@_fM(_`pB@+ z=rzdnB3a&`x2)7(5)8R0Q@~>L1@g=NWkG*wNys?V7YKN#_=b9e`GsWQ%rako&{r^U zX1=e1A4C=T^Zk}Aa;B7&mis~}<&@+XRTTK(SX3eVh$3%ra%p*S$TFa!C|F@VbVPY+ znXf!(ImH2`#gqIc-e76D-&+(qa)j4ke!V|nNj=v$y~0-#tmie1u5=QHLNmixQ~A!mM-8=gbXC|{toXohb;x(e&H`zbaVo>XITuHB?T55 z*IKfH#brUr>pTa-$OQe7A9UX2z!-$uwpLXr9mvK%!&?O1`Mk&GR!oAbKX26V@&X@p zzw^fBd5el>!4)hn^OpMqF!mLA%U~#w7GJr^S-#0$7?}Q#juS6woY0sFws$ihBATkgVWmM84qX~$$}B2U;oQ<neY+ zP&w!NiYAL5=r5U~tauwxpgN4QK*uh?`q=`}56c=??A0v@|%NUJD9& z4=O742BE@uFCJD=jA;f4x8{@tq3gl0pH*5hsmM2^v}B6l!7vy?YtJk6TKl)fI=sB$ zSq*_^)xh60HFlQshpWor)>KZ02BwS-`ilZYm5$F<%+nKNtVwW|IXt>yEeN+p)`2B> z%3e6VQNH|&a%}q9z9Q%@FeaCZ0brDGGK>Qy`97Q|kP+TsVW`0qxSfN&zNunTLyL48 zUOu`6x})WA=qCmKe5lNj4bA|%ONa^dj)r3&c9Mp+VWnuX92e>@7Na>UI?v6eluwr| zzI=WXVknsCURYZpvt?))<*NwPkL2}}X&sqG56gvS2Ce*t2HsHDWO~m z??#QRc(;T0gtwALaX8dBOa%tO@?Zdm5o^*V1r1H3d{cbZJFgfvEXN1~T)4ve#mp-$ zg60K{2WI0wqKM!G&~iAxR*h_O!rZ`~149RP<8-wC)E3I*n;GQiWe(TS zMc{^S5+0J}gM!2Gg<)uKaDz5O6=>wg&kWWd^F(tZ#ew|N@*@8vk~=E^ojWu)Bsgvn zIb+NtLm^8TMldfq2jIoW_8|}LlrvnOj2u-(iZCHH>ly0B97N4yERmh$?Iz@eBP|Z6 zL2Pgc;%G^s3KvyNaFD|l=P(!xNhiD~5@-_>IC4=CT1oPlEDKx1Fqy0HO_%`dN|+A7 zhy)!I&dlt_ykikx!!>7P3(wQ^la)`3amC7Otpd7+X@%Qd0rX;CD$$%Qt62im#|e$C zcy5iXJkRs`^BC(fX5LnB(}sSdE#*TWD`Pxgd-F5F*bre{wmct z~ST|~9l_M71LJDQQQv-xI6gr-5L%e zLSBMU4la}eTf z%yQ1)05=I=fi#JhR?n2f?-*Eta_h`&Qxa$KBG$KUWK}@0(q<@#$xsJLdxqKg!>3wW6^-{AP!hg1u7u# zD{upY4HLKxlT2752eJK$dmmIW?vaqu!*U1a5g5W@wL=R0fihS>@!~-f$cMfJ>Jk)P z$t1am&GiM%^(>xImgN{Mik102P7YCdrGyVm(CN9^(mf!Gn_!k=E~3GdS1RuM*x5x0 zcIL``0XPL%DZy|yK^7Npb)>XxLVtgd?;n;FSZH`T!jRG_a9=Khc_HsLu%6@^C!9P0 zUc5v9vyGxojrWy0nYCy=X-u3a42k+=gT~83Cc#?XGVSxiX5AnduL_hGDe_GYl5+o) z!XTM!-PFPLHyMJFqj+RafKRPSK`F0NlF#=ij(%(15Un1QGmK4ZPX;}cO&)fwFkRq79ji?9|`a}!K35ZL~+gK*dQQ>ky2gnO; zX7DS5vtpb1*WHc!1Ip!4NVg9;At9UweEaV0SXi4x43jDUbJqY0zThC8g3 zBP>O^#`UL+hX%rDVz3=1@2T)c9~?QvS29I5a&xYL=A07PwNOJg?h}diFBFaE2kSQ; zz-%55hV`IO0~90`D+x6dQ#+*m#-A%?%cqVy^`HJTBui1H`h0VGYY2 z3h>Je4uN?LEFI)_h6-3+hL(Z{_PpVfp?N@!^TnDa$a^I$DqxVs>x-*3Tn9;nY+zn3 zH!ZPje2Ws&!U~d`l4Pi_coHsF%mpp3jYOXl%Othfl`e4oVW|h55?UZ%+)6tjT17g% zQ*)FX7MM5gWvFcqxq|`cBBn9eKA>%2yWnj?UUl<|H@MokI)}anS5{nAbw!7nR}=Q1 zVdDk2d&zmOV8g3tRz_B-F90QxOGKDwapb4W2SjOrbG4!v!f@y_dl4T2O~8l=Fz)C3 z3UKpB43AcWXyu`!@g{_0rI`T6*XyL{P|skd0KLG>MIB_ZiO$W(VKeP|$zY~dcO0rM z45LTUEMRzcphkQ#%$49;EQq%V?qd!g1a95doq1@NF#F^KyH{>X@?zHa;%8Ui1k(p= zIt92#no}~=Uj)OiFTWI8A}NFQC$u=2Bm2r>Wk)8%YCb>$6_X15Flm^3D-dVz!4f8V*8tN~B2e2ZXE2{-v>(vt) z^8ESJ@Uam-6M()i@BN}0u!#mtlc*?bgs2irJXDA^9v1KF6lA&~i`7v^Vm$?5!jTJG zCMw%{&w~d0g1p+qR#d~pLrX4e;<8ffRVc4Tvj%zXiJCKO&8)F{wIymQv)sq`d*Nv} z>{IhvBYa~eXEGlxz!LQ191a{ai;7{?=I%VlQ9gL6P`mv zOA3bi1I4(1Bkn3VH4Dfm23S6z^F8W7vwxc*q%O zz4i&SFJE~Hj&q`02I|eA1El}xL4yX4nvk1w%|OeNj}NAJ;pJiVlElk@K0EpkY?K{Z ztvwGO-oVfq%)!?T_=OAY(hZ+1dJ9%LHg&#rCpY$BNhep{VuC6XQC_@f1T2R)CI2WkPKAwc=dXJve+#oXq#9*m>7IQV?k)3|EtSBq*FX7drv z-Lm*odtR`A!MAxtoJpVyd6f|%2Ne49r>VzAaO;9gCJ9>fa^ivZk);LRl`AZ9Eunw6H|suIRtXujqXC=ANkTF7Y5 z*R1Klm?nn_ks0qDxSkUAF&Ss0!BX|i7&@71OJekK{bSGF|L9c~A6zC*od~)Ka>`V!UYHV!pG7Pj7}+z}qNrn=HLP^caV4yyN>k=0pV@ z)ssqP9pw{ydwdFTjjvp+rqGx0MkI2CnwA3=_Y;=`3v4dC`H}o65htr-)cGnFR*Uix z8&)&#QeqMSvn{x9sOJ_i#rMM_3BG{|^@Z8-$svScXSJLUA>#Rmm@}%Up}Zpor_!N{c z7+@F=g>VG{23RIwoP5~8J;cHl$9(k&5Ix1Ausp+Of?x=(v-q-$do;3HS8Z_jHMbyFlbOe1K;2=u*d2cQ2;XJ z0Za^=AC6OKG{cw4R4<=4VM2e{-hzua$nPsEfLC96NgCVDOd7{vMvbj9r$!Ox>B#b% z1%j>yV=>>;A-U81uxkgKcH&t%9}MATIWn-k95)nkPY4!81@L?cp28RKXi!-L2W5^P zk~d*U&ai0@{n8` z@vvA>3A3Dzt6YWEECVNVP8V7niCPNr057cNIAVJW4KzsNF&a*M^Z68~eylk)u5Sfz zn1ado!|J_6fhj^$z&Al)7aL!FIA6+*Q@wDCW@ka*uaFEgjQ{CmBH#AmtLd*-byJXumHq87F09wAuM0T7sEEKcZv_5Z_I$Q6w3u7 z-%KjQs{=!=TtF9_{R65I$KvuJmIyvC2MOY86_XT=R(3eCA%%VrBX>n)6g*o%JCwBE z3uVwEU{VF8hL5O#xP;5D1V%OMyE=Z{ActIG5H)WEUNQ+zvIw3y!%_h%1Yc6)LG&nq zJ#oN%K3Of1Z-jVdPx8us7T~vT*j9rF1Tcc){#roXw=s8k{3cgkkSZw_JIi?6)y4 z1yep~T?P2G1j-g_axf=@f)veyH(I>2a$yUyaTMGw`O81*<#Y2Gh`>@eK7ubBODrD= zFpq%SGdw`CydrK!3@9y|1v8Pt^F-y9dkcKU-tuXU^BDuD0#~JR1l}BRy#tZ(iqVC< zU?89DpHcy9#CnM|nC|1rz}%`FCi*jY6BP!2&?u<2nLK2vQn^mxl>i%Ge*TuJs=Njt z6A8U*G#a~*yk%+*=wRubqW->ZTdSpk3ZN^K87izq0- z4YF=xYn2Z`_`wQ3$iYIAPs6a~Wc3#df|B4RJ%~ITbP{t%Gjp8ROH2P*FlET)5^q=_11s~$z zCBA*}e&{SQh5BS{c8^Tj(cCSxw*HY3|A7D+Y`^Vz+4(3%+} zBYeJT@CqB;9pGYz+Lw59faDhW;GP5NVHf{@+B^RkxvJ}q-+42$^JaEtyz`8Usb}Ch z;MfT7X6<-MOm>MkwgCqlV^~a3NnpWiv-OX)cWuB`QFk_^0tu?5Z6w+{lGB2!L`aR4 zR3)jKMpc?0QmRlXO8f_rTotwXgSPxZEB`@%e7@(tH$QgPKvDi`$Gg72-nr+Vd+xdC zo_pTAcg=85ZQ1n83oQJj0!Xwj&XLF5^Ex74nupWBr%eWOAD{o=q;~T9BH40#dYF(r_x&X<;C*^}Xe@#l5Orf(|K zeI!M#?T2XszALitni5;qNA~&uu0#X5arOR6{=!=yd59a9XT{~i)4V6!dG8J5w{Cxk z?_?h3W%eY#sa=C-)m7CEpeZP-uInfZso{$7aq zunpawg~S7D14~akvKX^svliI)gUObsl(JUya=YS=#yyd!3MIAK>p*Aiu{iOmC0=E; ziDcW0tIedY)y(g2TU_zkoxIr+Ic9txLGboY>u{F7#%&d`x8TK_|BQe%n_Rv@u#-G0 zM$@QX%NeSSMw@AYdzEeL%+dX}^|mCtTrg?V)v92=$#gDu`!W$wKP5iNks!S2$+xI9 zu9wWW9h=6y`oVXi`|bSUf*Zf}(TCFSg?94c#ljZ0jPgg#EO==)E!x^Eu)Tfs zD62ift+mBoLfIl?uke&gUq&hIedLIPm3O@ARDpjn)#@NGpIQUViz4{b&L$nwJmD*x z6Q||(NfbY2ilTDuH?%PEKXZ57AkY5?`Ki%{>-e zhOqh}&UEkRZ1-K<0`h>nn;SXYx}9trjsrEzdG2W-*+h_@=9IUq-Az18{t3bb;aGDo z;VCfA0L=!#!)@m~0`jwzjBsXrp3>t$JYl$wQl^`zaC;{32d$QHxZ+*lI;OU+eh8@D z(6tj>dx`Jk4lB`@mfr{6%br~~NgpPGn6xZK9cH*?n0Hr`oA>LhUNRrxQT#Kz|{#wkfguO!_KzvjTtP1Dqwcdjzs(X!i^ zQWTrqoaUAQ(ceS)M|v^0DSd((3)D;df0!0EQimAHUR*J<>gCe+T~h2ej<3*ayM@*W z7N_WgN#o#c#xs-j!d;~Aa;_lG(`sJx!tI};H{xh#kGpw&99)vJm^tMkHFA59M@fUY ztoiYX@!YK%C$A9@&ycqDqFxL8}D{YPkrk5|YaMz?g9#J+5mxZ|Zk^T*wo&g*X8 zXynv4add{8d>FTnwINS}W6oy5JaA`u+9|^;)ZMUh&zI411^#qHX|&G5AJK(7hfp*o zT&s;kS6BZEf`Xm@+3p7iTPOnvoVW2^p37S&g+IlVY$4bClo;r(?$qH=<(EYig) zwgHh5AeFJ123J;In)(`oD>ESTTla%SLoHkq&N*X%I_HNk71wEmO3R-nhVY)C^AcmF zByy?Pw1ujBAzyhqxWY|bYcuRJ#Z*w-x>@?99;f}2kV*s*^=o3i;)$MdgO zDS9Cpac=Qhb;a9Vnk|wb&$N}uNSl-%l)b2K`4u=t_q)1EY73vUTdaDPI~dIL|bQDM&UI_m{uCAR69$U#Upp;@^zwn9hAkC zN~NZFTNMeP7k0^vRDs)arB+gf)ME**_L@{&Yf*GlZ`l>==YNeG16}?>?m|>JYT>kn zk64IRL^=H=#7ZP&MI+?K+uDP0S7UJtH!N<`I2J~j6U>Ua`R9WQxFCBp zRkL12OX2pm?TYDBH}MJTdR5iik`#Tn4Xp9>mhUXRajRu-wC$iNa_;zDP~sO0ui83o zzusMn#!~yiHlEa`PDgR&r{nAlvCAsE&7PLE4QGbC^@5*usRiXF`Vc%yY<6}U-Fo$% z>uYJ5f$y#Q*dggEuic<#&IjmCYu9+ST1>fry1hK{cY@NTOEQrxT3IA1Z}PNGyLCS% zk|)*l3omy6

SY8@bXRF_poz-(CXKndsKEvHN|PM#&AYRGN;!`=O$n_tNZ=({yj_ z8l6(ngFid&-1V~dHEUCAu)ebnC0d=IO8cU`V1e}H6G`yHQZ@5&rId(Bmzu2QPw zNg*j;FDdcbylu*OL&opyv}5gtaFsS5q;hrde#qT8jz;L-B?*hT#*0RiqQq}8cK0&4 zbd_nZ?CD5%?5*jS_uaS+y)Csdc&TL`ZIHf+6AhyMLhLpr(!Dv6?Hl3ILV{I#iJomt zy-l)~rD-Hf-j_7Xovy8!LT@`EuLP%kGp|w^%Xh$a{WyFQ%sXJYI+b>5*tXT~J~qi* zTG_L*T+>PBG#06O>26GMrn91rcNygMUJIq#-0ykPeZDVsH+I9QCFx)7u4GZQjZwFu z8?tjh+W~c5H&oAzI`UrhMz^jP2d3bjXxl}s73K(3O6pg#E+wz-8m&Nnwl3RYZuIj@ zQr`W-@@Cy@uEPk{{XchVd9xQY~*jCe}Ldt4%EvE4_Mo zspb^6*LBh=vLLlSrrJXmlBD4{KIE03izn`(NvkUjB=2>nT_D~*28=w^vb<7#>Brgg zveP2##N_=W=(jHgGPQO|4^!<-0I#sZZfr2dcDW8?&UF; zd}wv>{)y!)lzjU;6QBI;ynndI918bxz5KhqH%Rq}>^#}E(gIl4>(cUG*MnPkKd|%I zTPr+Uoz@${vzx4QEnIqY;on8Ho?X|5?_Nz4kIOY0O?g8#m-LoH+E`S&yc`EEuU(VN zk6Rc^ClzjoM<2mAh{UrG7)7pJ{&wzDcUk1vN)+GD8w8ahyJ(Pf-Th35i=uO1FIR+j zQG5bg+I#oJMKPGx2dbEkr5hA&KIaF;PLF zfWO<|vIEgr9{6Z17ds1TYn2Cjlk%HfZ7nd{^Kp==RxJ!Itf-Z`Ds30!c4fnXI1^1o zli7hrT|o8vK%6BclgTvd&@dGYR8&@}0GrK(p&<(`Q!17GBZDZH%V5hyOK&3-wWafU zC|NpBd*F$k{s**6W)qoBTroaS4+a9!vs_e!1iBd-8=9J3Kom7%ZaA)dkH2|NErX_jx=+o*ZR~SdlaT|r^UOyNYxUD#v zfyTYYg1y$Wy-6XXBW7I)#kyUY%h zSQE`!w?X(58_tUszGm(Iz`|FpmVa{WIu4;`>`RG$VdeBD?`zYt5 z&`0HJbu<&KiIzs`yM9bXG5YXzX`6BPCl+3`@HK_aA6WRRm0Ys)3l{oXJCt79HQ+QR zVm$HqAY+|QM-B3MG`(eW@%pNdYk(i71{SdH_l zhF+bBns0^NU|$Eqcyg{FKAevlNqoT1xbwcfR>l;CO+TK9Jf_?Mn{o#<Q9DJ5xGRQLmfod7VKHSM&E_igDVEDX=%oagJuA=4G`4 zr9m_njlpA<3>FRYQm82S^YwZa(C92b9@w(mqwPsn%C}mzLK{AhkizJx=qXSH8hNAT zP2_8_X+=OH*r0!#bu??U-$tcc4NUr-25q)AXi8Bp6C$RHtHjv>U#89_ixoO)Xk<3^E9!S3DOsW-+t-(-4+b3wS+iXqCpKNa&weY#3e~p%RKjmpePMxf(%PLAcI4hY?7>2 zhBC;c6$4bDazHFHf~r~#4D-^9RI9jLG)x>Vy$Hyl%eHbQ7o=(0Bsu0`pe4nQJLu$DW2(homO{Fg2JS43=6KFO)(>Di+=Kgzmc0ZCw!u)s>1BRmwoE zsV#nyJp7q{KH$vY`tLaU$DsD%){ewt1GwHcu0QMtP-4+G7DuWqY(kwnw{U zo608JpbNY;YGSQ*Zt1n?l!??tH0DPgds-Z3H5xODB>)TFE6#zhI$Lh#jcVn?BfqY6Ck^Ou!CQgdL~|J5UjJ zAd%UDM#httl^tl=Ma#+#wCvNCl^tl=XOuNNP%(C((J>^%OBjBNF#Hr@_$k8hQ-tBC z2*Zzw-eLHu^K@9@MGIe3NQV`^Y9*H}{ep!~Astp|jAM5qyvQP}&M9M}LS_p2Ew)fy ziWa|YK$oIP9yKb=oNR+RZZUcV3$C{G`T(_--l!KWqPrGXnPik!(^!*E`HC%GZ`}O; z{4Hy*qwcz*Wh#lQL9XTE=M{2zbs@mv4LfpB{66ncb6}{=;=&y=T=!XP&+7$2WcQKfd*wTPne;zx&dU4}AOh zJ-_(v5C3~``wwfAW!AuK(GVga4ZS>G!|>+|7T#{<@caNB-r589X%l z`%Y6qg)iUdo=9&-$V>&rJtsK%#!0h78Q2i8nF}yRvxQ8+|0*@*lK=xyav^eu{;(v*Ov--lfpWF3mh>l@D=h)m!jPm`ttk~a?CLqAinW5SGpZykkY2UBE712m-uU zg-jjkWSz?n6oP1XBYQ>4yQ*gx#4w;iwj|V8c@(>9ILt}Lu*xos@kdXy?_wL{a*C{s zO<1 zq)7yU5m1GI!1j0AR0d^g%Ik&pYEDXGPSx2LH7BFy?g6k&P)n#UBT->JSHcz+r71H)ZAAch}pnFW}#Ha3q?t&+5$I#168Ya zpc+6qkL?Kq73K?BcC^;rwQ|DV04<6)CGidH#Mr|4BJs9rb?iU9i6gys^{`G!@IH<|`MSCrVtne>O*}9J zPh0qmA%rPGvP9AeNO->o&jJIFuvil?DP--Tl3 z%07n=oyEI3tB5)61v~2_A(qGD0LnUKDTp&!vv`^Zs&%RG=7BI<4Jc#Y9sr;$a5@~S z(?H8hlS7)BAxvnQR)qoiY|Lp>(U!c-a)AM%=Y(;sBv|S^^wvGL+B1{sYt(^gTrFN!N$k)zPgg{gUgAgOO6bc0G;!?4YFSWBQ zS^?|?im+WA0>x^S;0m$)GGXluXv0ATB?VNXk2E}3DtgI&9rpzmRuwHg1e5R%kwY+| zF_R6POC}9(YPH>slcm;Vv-uT%5m?gfBCM#nCV9qVeiKa1^JEMFtq4lgDj{0m*&1w4 zAS_s|#nD)aZ1Z#Gs7fBJ!US(z>-hD~XH;i2R%}5~Uc{&g3YSYRxZV$cK$Q20XG{LTfkj4aoQczq~S%k5P-w+pH-A zS<@o+qT;OB#WKfQ*QgE^%0ZU*73=|nMmA*E;0VnMYGl1)wJ9lInj{aenHCW(3#smrPc<%hiE&{pCm+rHA$LlDn2Sn z4-RARF;S%qYR$h5y{W}(P4MA3Z(a;SQp5V8S^4SB7nGMl<_UjobH<@7XJXwsFn`)B z&qrHVsSWG;?n5!xOP}UMu`SSSztx4O7~iP*LtFNKNCJA%M?b7e$RE(!8=XpI$vSrl zdr^YHX3lza2~{jT!FH}uq1X9}Pw54c^iB?~gi=x;cU!pKGxLp{lb=aUc@u@me#@4C zrOSHEb_ipJy^nTLfGobWDdVoU6>TAYRA(*Y!*lcTg54Pqw|mKF3H(*_t3BWdXBIhM z$U)llT4NVy+`8l;=Rj8g_|=SC(^Z=jkp9Nw_L|Bi1co@d^w{;(u|uFb+2~efTq!}P zgS<|18m0zIR2VdsEy+#fnE6zdfhR%3uNM9yJns^Iy--KbG&c%(Z{A|j>S7i;;AR*Hpi34W}cjxjVDLq zgLCt6dtvVJmGF(y?&#L|?#H+?;$*yYetPx@VDKfjdx#g}dvtpD@tH$>_=&~5-g*(w zF2vI@N74Ny8S&iVxTCYULI$^v+&r>%WXsmA+i%9o&dAW_-?d`cRPZbJ&rhG^{`uDV zU%Ml2A#?hMz`zvzj?!@}+m%@Cfa8;zopbZMjvd=KJz*AnX$ivsw)4z!Nohe z>h?2z4)i(D=RltWeGc?F(C0v(1APwkIq=KkK*kM$YAw5*Zj65C%t^+ca>3of|4;1* z+{-!T{J)oT+ejRA_j1R|LART)xbNjV?)`j8{Sfh8d_BG20RJlYZ~vv2Ozh`fI2yF# zk0*G9vc0SDg}aC{VAWZc+xU)OXC(IU#kZZJ=h+QTwRE0A=K=WpP4=C2atDE-_*xFX z8#p@8v-D#6g+9RHtLyY<8)r7)0p~JHl($b4p5P1T)>q&>?|g5nuglp$axgxiPTGb} zy66@Now(?@9|5?S{~vYb4%mah&I8@1e=A>1-^_o-TL|^_H`_GE;VSBh6Z)!ro>(W< z+LY_8{pXs4xPl|)-1k}KS>`&?Ges6@J;;+Wie-0 zcDfts!B*qgR=)REN)*OC(bxa;VAI#|F*otd@uQI&aTWO4+s2jfjl%z!n~6O2I&E@4 zIAZ##JA{scU*GfVdvzVb*QrJ>=cFakAh;=@=Ir^Twa;JP0WRjmfu0`Zna+WThdRmk z_rH0kfC_4jVtm1Jss)v~xP?)l!TWl?mGm5HP3hktRdk$W7P4gu?c`asuMc&XN@ zZJo_fPjS!iuPt*r73k04=tPa$?S%GcV8kt*@6`#~5$myJ^lp=%{nQbqIz6M&Pi0m) zJG(>qdy}Kh%;pSO#m__3(W$t$G$;sEQ}x%1kt_y6@d(C0v(1APwkInd`op96gk W^f}PyK%WDB4)i(D=fM9-4*U=F(vzP6 diff --git a/Tools/NUnit/framework/nunit.framework.xml b/Tools/NUnit/framework/nunit.framework.xml deleted file mode 100644 index c0bd9cbbab..0000000000 --- a/Tools/NUnit/framework/nunit.framework.xml +++ /dev/null @@ -1,10899 +0,0 @@ - - - - nunit.framework - - - -

- Attribute used to apply a category to a test - - - - - The name of the category - - - - - Construct attribute for a given category based on - a name. The name may not contain the characters ',', - '+', '-' or '!'. However, this is not checked in the - constructor since it would cause an error to arise at - as the test was loaded without giving a clear indication - of where the problem is located. The error is handled - in NUnitFramework.cs by marking the test as not - runnable. - - The name of the category - - - - Protected constructor uses the Type name as the name - of the category. - - - - - The name of the category - - - - - Used to mark a field for use as a datapoint when executing a theory - within the same fixture that requires an argument of the field's Type. - - - - - Used to mark an array as containing a set of datapoints to be used - executing a theory within the same fixture that requires an argument - of the Type of the array elements. - - - - - Attribute used to provide descriptive text about a - test case or fixture. - - - - - Construct the attribute - - Text describing the test - - - - Gets the test description - - - - - Enumeration indicating how the expected message parameter is to be used - - - - Expect an exact match - - - Expect a message containing the parameter string - - - Match the regular expression provided as a parameter - - - Expect a message that starts with the parameter string - - - - ExpectedExceptionAttribute - - - - - - Constructor for a non-specific exception - - - - - Constructor for a given type of exception - - The type of the expected exception - - - - Constructor for a given exception name - - The full name of the expected exception - - - - Gets or sets the expected exception type - - - - - Gets or sets the full Type name of the expected exception - - - - - Gets or sets the expected message text - - - - - Gets or sets the user message displayed in case of failure - - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets the name of a method to be used as an exception handler - - - - - ExplicitAttribute marks a test or test fixture so that it will - only be run if explicitly executed from the gui or command line - or if it is included by use of a filter. The test will not be - run simply because an enclosing suite is run. - - - - - Default constructor - - - - - Constructor with a reason - - The reason test is marked explicit - - - - The reason test is marked explicit - - - - - Attribute used to mark a test that is to be ignored. - Ignored tests result in a warning message when the - tests are run. - - - - - Constructs the attribute without giving a reason - for ignoring the test. - - - - - Constructs the attribute giving a reason for ignoring the test - - The reason for ignoring the test - - - - The reason for ignoring a test - - - - - Abstract base for Attributes that are used to include tests - in the test run based on environmental settings. - - - - - Constructor with no included items specified, for use - with named property syntax. - - - - - Constructor taking one or more included items - - Comma-delimited list of included items - - - - Name of the item that is needed in order for - a test to run. Multiple itemss may be given, - separated by a comma. - - - - - Name of the item to be excluded. Multiple items - may be given, separated by a comma. - - - - - The reason for including or excluding the test - - - - - PlatformAttribute is used to mark a test fixture or an - individual method as applying to a particular platform only. - - - - - Constructor with no platforms specified, for use - with named property syntax. - - - - - Constructor taking one or more platforms - - Comma-deliminted list of platforms - - - - CultureAttribute is used to mark a test fixture or an - individual method as applying to a particular Culture only. - - - - - Constructor with no cultures specified, for use - with named property syntax. - - - - - Constructor taking one or more cultures - - Comma-deliminted list of cultures - - - - Marks a test to use a combinatorial join of any argument data - provided. NUnit will create a test case for every combination of - the arguments provided. This can result in a large number of test - cases and so should be used judiciously. This is the default join - type, so the attribute need not be used except as documentation. - - - - - PropertyAttribute is used to attach information to a test as a name/value pair.. - - - - - Construct a PropertyAttribute with a name and string value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and int value - - The name of the property - The property value - - - - Construct a PropertyAttribute with a name and double value - - The name of the property - The property value - - - - Constructor for derived classes that set the - property dictionary directly. - - - - - Constructor for use by derived classes that use the - name of the type as the property name. Derived classes - must ensure that the Type of the property value is - a standard type supported by the BCL. Any custom - types will cause a serialization Exception when - in the client. - - - - - Gets the property dictionary for this attribute - - - - - Default constructor - - - - - Marks a test to use pairwise join of any argument data provided. - NUnit will attempt too excercise every pair of argument values at - least once, using as small a number of test cases as it can. With - only two arguments, this is the same as a combinatorial join. - - - - - Default constructor - - - - - Marks a test to use a sequential join of any argument data - provided. NUnit will use arguements for each parameter in - sequence, generating test cases up to the largest number - of argument values provided and using null for any arguments - for which it runs out of values. Normally, this should be - used with the same number of arguments for each parameter. - - - - - Default constructor - - - - - Summary description for MaxTimeAttribute. - - - - - Construct a MaxTimeAttribute, given a time in milliseconds. - - The maximum elapsed time in milliseconds - - - - RandomAttribute is used to supply a set of random values - to a single parameter of a parameterized test. - - - - - ValuesAttribute is used to provide literal arguments for - an individual parameter of a test. - - - - - Abstract base class for attributes that apply to parameters - and supply data for the parameter. - - - - - Gets the data to be provided to the specified parameter - - - - - The collection of data to be returned. Must - be set by any derived attribute classes. - We use an object[] so that the individual - elements may have their type changed in GetData - if necessary. - - - - - Construct with one argument - - - - - - Construct with two arguments - - - - - - - Construct with three arguments - - - - - - - - Construct with an array of arguments - - - - - - Get the collection of values to be used as arguments - - - - - Construct a set of doubles from 0.0 to 1.0, - specifying only the count. - - - - - - Construct a set of doubles from min to max - - - - - - - - Construct a set of ints from min to max - - - - - - - - Get the collection of values to be used as arguments - - - - - RangeAttribute is used to supply a range of values to an - individual parameter of a parameterized test. - - - - - Construct a range of ints using default step of 1 - - - - - - - Construct a range of ints specifying the step size - - - - - - - - Construct a range of longs - - - - - - - - Construct a range of doubles - - - - - - - - Construct a range of floats - - - - - - - - RepeatAttribute may be applied to test case in order - to run it multiple times. - - - - - Construct a RepeatAttribute - - The number of times to run the test - - - - RequiredAddinAttribute may be used to indicate the names of any addins - that must be present in order to run some or all of the tests in an - assembly. If the addin is not loaded, the entire assembly is marked - as NotRunnable. - - - - - Initializes a new instance of the class. - - The required addin. - - - - Gets the name of required addin. - - The required addin name. - - - - Summary description for SetCultureAttribute. - - - - - Construct given the name of a culture - - - - - - Summary description for SetUICultureAttribute. - - - - - Construct given the name of a culture - - - - - - SetUpAttribute is used in a TestFixture to identify a method - that is called immediately before each test is run. It is - also used in a SetUpFixture to identify the method that is - called once, before any of the subordinate tests are run. - - - - - Attribute used to mark a class that contains one-time SetUp - and/or TearDown methods that apply to all the tests in a - namespace or an assembly. - - - - - Attribute used to mark a static (shared in VB) property - that returns a list of tests. - - - - - Attribute used in a TestFixture to identify a method that is - called immediately after each test is run. It is also used - in a SetUpFixture to identify the method that is called once, - after all subordinate tests have run. In either case, the method - is guaranteed to be called, even if an exception is thrown. - - - - - Provide actions to execute before and after tests. - - - - - When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. - - - - - Executed before each test is run - - Provides details about the test that is going to be run. - - - - Executed after each test is run - - Provides details about the test that has just been run. - - - - Provides the target for the action attribute - - The target for the action attribute - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - Descriptive text for this test - - - - - TestCaseAttribute is used to mark parameterized test cases - and provide them with their arguments. - - - - - The ITestCaseData interface is implemented by a class - that is able to return complete testcases for use by - a parameterized test method. - - NOTE: This interface is used in both the framework - and the core, even though that results in two different - types. However, sharing the source code guarantees that - the various implementations will be compatible and that - the core is able to reflect successfully over the - framework implementations of ITestCaseData. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Indicates whether a result has been specified. - This is necessary because the result may be - null, so it's value cannot be checked. - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets a value indicating whether this is explicit. - - true if explicit; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Construct a TestCaseAttribute with a list of arguments. - This constructor is not CLS-Compliant - - - - - - Construct a TestCaseAttribute with a single argument - - - - - - Construct a TestCaseAttribute with a two arguments - - - - - - - Construct a TestCaseAttribute with a three arguments - - - - - - - - Gets the list of arguments to a test case - - - - - Gets or sets the expected result. Use - ExpectedResult by preference. - - The result. - - - - Gets or sets the expected result. - - The result. - - - - Gets a flag indicating whether an expected - result has been set. - - - - - Gets a list of categories associated with this test; - - - - - Gets or sets the category associated with this test. - May be a single category or a comma-separated list. - - - - - Gets or sets the expected exception. - - The expected exception. - - - - Gets or sets the name the expected exception. - - The expected name of the exception. - - - - Gets or sets the expected message of the expected exception - - The expected message of the exception. - - - - Gets or sets the type of match to be performed on the expected message - - - - - Gets or sets the description. - - The description. - - - - Gets or sets the name of the test. - - The name of the test. - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the ignored status of the test - - - - - Gets or sets the explicit status of the test - - - - - Gets or sets the reason for not running the test - - - - - Gets or sets the reason for not running the test. - Set has the side effect of marking the test as ignored. - - The ignore reason. - - - - FactoryAttribute indicates the source to be used to - provide test cases for a test method. - - - - - Construct with the name of the data source, which must - be a property, field or method of the test class itself. - - An array of the names of the factories that will provide data - - - - Construct with a Type, which must implement IEnumerable - - The Type that will provide data - - - - Construct with a Type and name. - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - Gets or sets the category associated with this test. - May be a single category or a comma-separated list. - - - - - [TestFixture] - public class ExampleClass - {} - - - - - Default constructor - - - - - Construct with a object[] representing a set of arguments. - In .NET 2.0, the arguments may later be separated into - type arguments and constructor arguments. - - - - - - Descriptive text for this fixture - - - - - Gets and sets the category for this fixture. - May be a comma-separated list of categories. - - - - - Gets a list of categories for this fixture - - - - - The arguments originally provided to the attribute - - - - - Gets or sets a value indicating whether this should be ignored. - - true if ignore; otherwise, false. - - - - Gets or sets the ignore reason. May set Ignored as a side effect. - - The ignore reason. - - - - Get or set the type arguments. If not set - explicitly, any leading arguments that are - Types are taken as type arguments. - - - - - Attribute used to identify a method that is - called before any tests in a fixture are run. - - - - - Attribute used to identify a method that is called after - all the tests in a fixture have run. The method is - guaranteed to be called, even if an exception is thrown. - - - - - Adding this attribute to a method within a - class makes the method callable from the NUnit test runner. There is a property - called Description which is optional which you can provide a more detailed test - description. This class cannot be inherited. - - - - [TestFixture] - public class Fixture - { - [Test] - public void MethodToTest() - {} - - [Test(Description = "more detailed description")] - publc void TestDescriptionMethod() - {} - } - - - - - - Used on a method, marks the test with a timeout value in milliseconds. - The test will be run in a separate thread and is cancelled if the timeout - is exceeded. Used on a method or assembly, sets the default timeout - for all contained test methods. - - - - - Construct a TimeoutAttribute given a time in milliseconds - - The timeout value in milliseconds - - - - Marks a test that must run in the STA, causing it - to run in a separate thread if necessary. - - On methods, you may also use STAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresSTAAttribute - - - - - Marks a test that must run in the MTA, causing it - to run in a separate thread if necessary. - - On methods, you may also use MTAThreadAttribute - to serve the same purpose. - - - - - Construct a RequiresMTAAttribute - - - - - Marks a test that must run on a separate thread. - - - - - Construct a RequiresThreadAttribute - - - - - Construct a RequiresThreadAttribute, specifying the apartment - - - - - ValueSourceAttribute indicates the source to be used to - provide data for one parameter of a test method. - - - - - Construct with the name of the factory - for use with languages - that don't support params arrays. - - The name of the data source to be used - - - - Construct with a Type and name - for use with languages - that don't support params arrays. - - The Type that will provide data - The name of the method, property or field that will provide data - - - - The name of a the method, property or fiend to be used as a source - - - - - A Type to be used as a source - - - - - AttributeExistsConstraint tests for the presence of a - specified attribute on a Type. - - - - - The Constraint class is the base of all built-in constraints - within NUnit. It provides the operator overloads used to combine - constraints. - - - - - The IConstraintExpression interface is implemented by all - complete and resolvable constraints and expressions. - - - - - Return the top-level constraint for this expression - - - - - - Static UnsetObject used to detect derived constraints - failing to set the actual value. - - - - - The actual value being tested against a constraint - - - - - The display name of this Constraint for use by ToString() - - - - - Argument fields used by ToString(); - - - - - The builder holding this constraint - - - - - Construct a constraint with no arguments - - - - - Construct a constraint with one argument - - - - - Construct a constraint with two arguments - - - - - Sets the ConstraintBuilder holding this constraint - - - - - Write the failure message to the MessageWriter provided - as an argument. The default implementation simply passes - the constraint and the actual value to the writer, which - then displays the constraint description and the value. - - Constraints that need to provide additional details, - such as where the error occured can override this. - - The MessageWriter on which to display the message - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Test whether the constraint is satisfied by an - ActualValueDelegate that returns the value to be tested. - The default implementation simply evaluates the delegate - but derived classes may override it to provide for delayed - processing. - - An ActualValueDelegate - True for success, false for failure - - - - Test whether the constraint is satisfied by a given reference. - The default implementation simply dereferences the value but - derived classes may override it to provide for delayed processing. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Default override of ToString returns the constraint DisplayName - followed by any arguments within angle brackets. - - - - - - Returns the string representation of this constraint - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if the - argument constraint is not satisfied. - - - - - Returns a DelayedConstraint with the specified delay time. - - The delay in milliseconds. - - - - - Returns a DelayedConstraint with the specified delay time - and polling interval. - - The delay in milliseconds. - The interval at which to test the constraint. - - - - - The display name of this Constraint for use by ToString(). - The default value is the name of the constraint with - trailing "Constraint" removed. Derived classes may set - this to another name in their constructors. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending And - to the current constraint. - - - - - Returns a ConstraintExpression by appending Or - to the current constraint. - - - - - Class used to detect any derived constraints - that fail to set the actual value in their - Matches override. - - - - - Constructs an AttributeExistsConstraint for a specific attribute Type - - - - - - Tests whether the object provides the expected attribute. - - A Type, MethodInfo, or other ICustomAttributeProvider - True if the expected attribute is present, otherwise false - - - - Writes the description of the constraint to the specified writer - - - - - AttributeConstraint tests that a specified attribute is present - on a Type or other provider and that the value of the attribute - satisfies some other constraint. - - - - - Abstract base class used for prefixes - - - - - The base constraint - - - - - Construct given a base constraint - - - - - - Constructs an AttributeConstraint for a specified attriute - Type and base constraint. - - - - - - - Determines whether the Type or other provider has the - expected attribute and if its value matches the - additional constraint specified. - - - - - Writes a description of the attribute to the specified writer. - - - - - Writes the actual value supplied to the specified writer. - - - - - Returns a string representation of the constraint. - - - - - BasicConstraint is the abstract base for constraints that - perform a simple comparison to a constant value. - - - - - Initializes a new instance of the class. - - The expected. - The description. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullConstraint tests that the actual value is null - - - - - Initializes a new instance of the class. - - - - - TrueConstraint tests that the actual value is true - - - - - Initializes a new instance of the class. - - - - - FalseConstraint tests that the actual value is false - - - - - Initializes a new instance of the class. - - - - - NaNConstraint tests that the actual value is a double or float NaN - - - - - Test that the actual value is an NaN - - - - - - - Write the constraint description to a specified writer - - - - - - BinaryConstraint is the abstract base of all constraints - that combine two other constraints in some fashion. - - - - - The first constraint being combined - - - - - The second constraint being combined - - - - - Construct a BinaryConstraint from two other constraints - - The first constraint - The second constraint - - - - AndConstraint succeeds only if both members succeed. - - - - - Create an AndConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply both member constraints to an actual value, succeeding - succeeding only if both of them succeed. - - The actual value - True if the constraints both succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - OrConstraint succeeds if either member succeeds - - - - - Create an OrConstraint from two other constraints - - The first constraint - The second constraint - - - - Apply the member constraints to an actual value, succeeding - succeeding as soon as one of them succeeds. - - The actual value - True if either constraint succeeded - - - - Write a description for this contraint to a MessageWriter - - The MessageWriter to receive the description - - - - CollectionConstraint is the abstract base class for - constraints that operate on collections. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Determines whether the specified enumerable is empty. - - The enumerable. - - true if the specified enumerable is empty; otherwise, false. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Protected method to be implemented by derived classes - - - - - - - CollectionItemsEqualConstraint is the abstract base class for all - collection constraints that apply some notion of item equality - as a part of their operation. - - - - - Construct an empty CollectionConstraint - - - - - Construct a CollectionConstraint - - - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Compares two collection members for equality - - - - - Return a new CollectionTally for use in making tests - - The collection to be included in the tally - - - - Flag the constraint to ignore case and return self. - - - - - EmptyCollectionConstraint tests whether a collection is empty. - - - - - Check that the collection is empty - - - - - - - Write the constraint description to a MessageWriter - - - - - - UniqueItemsConstraint tests whether all the items in a - collection are unique. - - - - - Check that all items are unique. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionContainsConstraint is used to test whether a collection - contains an expected object as a member. - - - - - Construct a CollectionContainsConstraint - - - - - - Test whether the expected item is contained in the collection - - - - - - - Write a descripton of the constraint to a MessageWriter - - - - - - CollectionEquivalentCOnstraint is used to determine whether two - collections are equivalent. - - - - - Construct a CollectionEquivalentConstraint - - - - - - Test whether two collections are equivalent - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionSubsetConstraint is used to determine whether - one collection is a subset of another - - - - - Construct a CollectionSubsetConstraint - - The collection that the actual value is expected to be a subset of - - - - Test whether the actual collection is a subset of - the expected collection provided. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - CollectionOrderedConstraint is used to test whether a collection is ordered. - - - - - Construct a CollectionOrderedConstraint - - - - - Modifies the constraint to use an IComparer and returns self. - - - - - Modifies the constraint to use an IComparer<T> and returns self. - - - - - Modifies the constraint to use a Comparison<T> and returns self. - - - - - Modifies the constraint to test ordering by the value of - a specified property and returns self. - - - - - Test whether the collection is ordered - - - - - - - Write a description of the constraint to a MessageWriter - - - - - - Returns the string representation of the constraint. - - - - - - If used performs a reverse comparison - - - - - CollectionTally counts (tallies) the number of - occurences of each object in one or more enumerations. - - - - - Construct a CollectionTally object from a comparer and a collection - - - - - Try to remove an object from the tally - - The object to remove - True if successful, false if the object was not found - - - - Try to remove a set of objects from the tally - - The objects to remove - True if successful, false if any object was not found - - - - The number of objects remaining in the tally - - - - - ComparisonAdapter class centralizes all comparisons of - values in NUnit, adapting to the use of any provided - IComparer, IComparer<T> or Comparison<T> - - - - - Returns a ComparisonAdapter that wraps an IComparer - - - - - Returns a ComparisonAdapter that wraps an IComparer<T> - - - - - Returns a ComparisonAdapter that wraps a Comparison<T> - - - - - Compares two objects - - - - - Gets the default ComparisonAdapter, which wraps an - NUnitComparer object. - - - - - Construct a ComparisonAdapter for an IComparer - - - - - Compares two objects - - - - - - - - Construct a default ComparisonAdapter - - - - - ComparisonAdapter<T> extends ComparisonAdapter and - allows use of an IComparer<T> or Comparison<T> - to actually perform the comparison. - - - - - Construct a ComparisonAdapter for an IComparer<T> - - - - - Compare a Type T to an object - - - - - Construct a ComparisonAdapter for a Comparison<T> - - - - - Compare a Type T to an object - - - - - Abstract base class for constraints that compare values to - determine if one is greater than, equal to or less than - the other. This class supplies the Using modifiers. - - - - - ComparisonAdapter to be used in making the comparison - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - - - - Modifies the constraint to use an IComparer and returns self - - - - - Modifies the constraint to use an IComparer<T> and returns self - - - - - Modifies the constraint to use a Comparison<T> and returns self - - - - - Delegate used to delay evaluation of the actual value - to be used in evaluating a constraint - - - - - ConstraintBuilder maintains the stacks that are used in - processing a ConstraintExpression. An OperatorStack - is used to hold operators that are waiting for their - operands to be reognized. a ConstraintStack holds - input constraints as well as the results of each - operator applied. - - - - - Initializes a new instance of the class. - - - - - Appends the specified operator to the expression by first - reducing the operator stack and then pushing the new - operator on the stack. - - The operator to push. - - - - Appends the specified constraint to the expresson by pushing - it on the constraint stack. - - The constraint to push. - - - - Sets the top operator right context. - - The right context. - - - - Reduces the operator stack until the topmost item - precedence is greater than or equal to the target precedence. - - The target precedence. - - - - Resolves this instance, returning a Constraint. If the builder - is not currently in a resolvable state, an exception is thrown. - - The resolved constraint - - - - Gets a value indicating whether this instance is resolvable. - - - true if this instance is resolvable; otherwise, false. - - - - - OperatorStack is a type-safe stack for holding ConstraintOperators - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified operator onto the stack. - - The op. - - - - Pops the topmost operator from the stack. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost operator without modifying the stack. - - The top. - - - - ConstraintStack is a type-safe stack for holding Constraints - - - - - Initializes a new instance of the class. - - The builder. - - - - Pushes the specified constraint. As a side effect, - the constraint's builder field is set to the - ConstraintBuilder owning this stack. - - The constraint. - - - - Pops this topmost constrait from the stack. - As a side effect, the constraint's builder - field is set to null. - - - - - - Gets a value indicating whether this is empty. - - true if empty; otherwise, false. - - - - Gets the topmost constraint without modifying the stack. - - The topmost constraint - - - - ConstraintExpression represents a compound constraint in the - process of being constructed from a series of syntactic elements. - - Individual elements are appended to the expression as they are - reognized. Once an actual Constraint is appended, the expression - returns a resolvable Constraint. - - - - - ConstraintExpressionBase is the abstract base class for the - ConstraintExpression class, which represents a - compound constraint in the process of being constructed - from a series of syntactic elements. - - NOTE: ConstraintExpressionBase is separate because the - ConstraintExpression class was generated in earlier - versions of NUnit. The two classes may be combined - in a future version. - - - - - The ConstraintBuilder holding the elements recognized so far - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a string representation of the expression as it - currently stands. This should only be used for testing, - since it has the side-effect of resolving the expression. - - - - - - Appends an operator to the expression and returns the - resulting expression itself. - - - - - Appends a self-resolving operator to the expression and - returns a new ResolvableConstraintExpression. - - - - - Appends a constraint to the expression and returns that - constraint, which is associated with the current state - of the expression being built. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the - class passing in a ConstraintBuilder, which may be pre-populated. - - The builder. - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding only if a specified number of them succeed. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns the constraint provided as an argument - used to allow custom - custom constraints to easily participate in the syntax. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - With is currently a NOP - reserved for future use. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for a positive value - - - - - Returns a constraint that tests for a negative value - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding only if a specified number of them succeed. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a new ContainsConstraint. This constraint - will, in turn, make use of the appropriate second-level - constraint, depending on the type of the actual argument. - This overload is only used if the item sought is a string, - since any other type implies that we are looking for a - collection member. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for a positive value - - - - - Returns a constraint that tests for a negative value - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The ConstraintOperator class is used internally by a - ConstraintBuilder to represent an operator that - modifies or combines constraints. - - Constraint operators use left and right precedence - values to determine whether the top operator on the - stack should be reduced before pushing a new operator. - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - The syntax element preceding this operator - - - - - The syntax element folowing this operator - - - - - The precedence value used when the operator - is about to be pushed to the stack. - - - - - The precedence value used when the operator - is on the top of the stack. - - - - - PrefixOperator takes a single constraint and modifies - it's action in some way. - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Returns the constraint created by applying this - prefix to another constraint. - - - - - - - Negates the test of the constraint it wraps. - - - - - Constructs a new NotOperator - - - - - Returns a NotConstraint applied to its argument. - - - - - Abstract base for operators that indicate how to - apply a constraint to items in a collection. - - - - - Constructs a CollectionOperator - - - - - Represents a constraint that succeeds if all the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - they all succeed. - - - - - Represents a constraint that succeeds if any of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - any of them succeed. - - - - - Represents a constraint that succeeds if none of the - members of a collection match a base constraint. - - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - none of them succeed. - - - - - Represents a constraint that succeeds if the specified - count of members of a collection match a base constraint. - - - - - Construct an ExactCountOperator for a specified count - - The expected count - - - - Returns a constraint that will apply the argument - to the members of a collection, succeeding if - none of them succeed. - - - - - Represents a constraint that simply wraps the - constraint provided as an argument, without any - further functionality, but which modifes the - order of evaluation because of its precedence. - - - - - Constructor for the WithOperator - - - - - Returns a constraint that wraps its argument - - - - - Abstract base class for operators that are able to reduce to a - constraint whether or not another syntactic element follows. - - - - - Operator used to test for the presence of a named Property - on an object and optionally apply further tests to the - value of that property. - - - - - Constructs a PropOperator for a particular named property - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Gets the name of the property to which the operator applies - - - - - Operator that tests for the presence of a particular attribute - on a type and optionally applies further tests to the attribute. - - - - - Construct an AttributeOperator for a particular Type - - The Type of attribute tested - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Operator that tests that an exception is thrown and - optionally applies further tests to the exception. - - - - - Construct a ThrowsOperator - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - Abstract base class for all binary operators - - - - - Reduce produces a constraint from the operator and - any arguments. It takes the arguments from the constraint - stack and pushes the resulting constraint on it. - - - - - - Abstract method that produces a constraint by applying - the operator to its left and right constraint arguments. - - - - - Gets the left precedence of the operator - - - - - Gets the right precedence of the operator - - - - - Operator that requires both it's arguments to succeed - - - - - Construct an AndOperator - - - - - Apply the operator to produce an AndConstraint - - - - - Operator that requires at least one of it's arguments to succeed - - - - - Construct an OrOperator - - - - - Apply the operator to produce an OrConstraint - - - - - ContainsConstraint tests a whether a string contains a substring - or a collection contains an object. It postpones the decision of - which test to use until the type of the actual argument is known. - This allows testing whether a string is contained in a collection - or as a substring of another string using the same syntax. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to ignore case and return self. - - - - - Applies a delay to the match so that a match can be evaluated in the future. - - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - If the value of is less than 0 - - - - Creates a new DelayedConstraint - - The inner constraint two decorate - The time interval after which the match is performed - The time interval used for polling - If the value of is less than 0 - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a delegate - - The delegate whose value is to be tested - True for if the base constraint fails, false if it succeeds - - - - Test whether the constraint is satisfied by a given reference. - Overridden to wait for the specified delay period before - calling the base constraint with the dereferenced value. - - A reference to the value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - EmptyDirectoryConstraint is used to test that a directory is empty - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - EmptyConstraint tests a whether a string or collection is empty, - postponing the decision about which test is applied until the - type of the actual argument is known. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EqualConstraint is able to compare an actual value with the - expected value provided in its constructor. Two objects are - considered equal if both are null, or if both have the same - value. NUnit has special semantics for some object types. - - - - - If true, strings in error messages will be clipped - - - - - NUnitEqualityComparer used to test equality. - - - - - Initializes a new instance of the class. - - The expected value. - - - - Flag the constraint to use a tolerance when determining equality. - - Tolerance value to be used - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied Comparison object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Flag the constraint to use the supplied IEqualityComparer object. - - The IComparer object to use. - Self. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write a failure message. Overridden to provide custom - failure messages for EqualConstraint. - - The MessageWriter to write to - - - - Write description of this constraint - - The MessageWriter to write to - - - - Display the failure information for two collections that did not match. - - The MessageWriter on which to display - The expected collection. - The actual collection - The depth of this failure in a set of nested collections - - - - Displays a single line showing the types and sizes of the expected - and actual enumerations, collections or arrays. If both are identical, - the value is only shown once. - - The MessageWriter on which to display - The expected collection or array - The actual collection or array - The indentation level for the message line - - - - Displays a single line showing the point in the expected and actual - arrays at which the comparison failed. If the arrays have different - structures or dimensions, both values are shown. - - The MessageWriter on which to display - The expected array - The actual array - Index of the failure point in the underlying collections - The indentation level for the message line - - - - Display the failure information for two IEnumerables that did not match. - - The MessageWriter on which to display - The expected enumeration. - The actual enumeration - The depth of this failure in a set of nested collections - - - - Flag the constraint to ignore case and return self. - - - - - Flag the constraint to suppress string clipping - and return self. - - - - - Flag the constraint to compare arrays as collections - and return self. - - - - - Switches the .Within() modifier to interpret its tolerance as - a distance in representable values (see remarks). - - Self. - - Ulp stands for "unit in the last place" and describes the minimum - amount a given value can change. For any integers, an ulp is 1 whole - digit. For floating point values, the accuracy of which is better - for smaller numbers and worse for larger numbers, an ulp depends - on the size of the number. Using ulps for comparison of floating - point results instead of fixed tolerances is safer because it will - automatically compensate for the added inaccuracy of larger numbers. - - - - - Switches the .Within() modifier to interpret its tolerance as - a percentage that the actual values is allowed to deviate from - the expected value. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in days. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in hours. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in minutes. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in seconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in milliseconds. - - Self - - - - Causes the tolerance to be interpreted as a TimeSpan in clock ticks. - - Self - - - - EqualityAdapter class handles all equality comparisons - that use an IEqualityComparer, IEqualityComparer<T> - or a ComparisonAdapter. - - - - - Compares two objects, returning true if they are equal - - - - - Returns true if the two objects can be compared by this adapter. - The base adapter cannot handle IEnumerables except for strings. - - - - - Returns an EqualityAdapter that wraps an IComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer. - - - - - Returns an EqualityAdapter that wraps an IEqualityComparer<T>. - - - - - Returns an EqualityAdapter that wraps an IComparer<T>. - - - - - Returns an EqualityAdapter that wraps a Comparison<T>. - - - - - EqualityAdapter that wraps an IComparer. - - - - - Returns true if the two objects can be compared by this adapter. - Generic adapter requires objects of the specified type. - - - - - EqualityAdapter that wraps an IComparer. - - - - Helper routines for working with floating point numbers - - - The floating point comparison code is based on this excellent article: - http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm - - - "ULP" means Unit in the Last Place and in the context of this library refers to - the distance between two adjacent floating point numbers. IEEE floating point - numbers can only represent a finite subset of natural numbers, with greater - accuracy for smaller numbers and lower accuracy for very large numbers. - - - If a comparison is allowed "2 ulps" of deviation, that means the values are - allowed to deviate by up to 2 adjacent floating point values, which might be - as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. - - - - - Compares two floating point values for equality - First floating point value to be compared - Second floating point value t be compared - - Maximum number of representable floating point values that are allowed to - be between the left and the right floating point values - - True if both numbers are equal or close to being equal - - - Floating point values can only represent a finite subset of natural numbers. - For example, the values 2.00000000 and 2.00000024 can be stored in a float, - but nothing inbetween them. - - - This comparison will count how many possible floating point values are between - the left and the right number. If the number of possible values between both - numbers is less than or equal to maxUlps, then the numbers are considered as - being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - Compares two double precision floating point values for equality - First double precision floating point value to be compared - Second double precision floating point value t be compared - - Maximum number of representable double precision floating point values that are - allowed to be between the left and the right double precision floating point values - - True if both numbers are equal or close to being equal - - - Double precision floating point values can only represent a limited series of - natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 - can be stored in a double, but nothing inbetween them. - - - This comparison will count how many possible double precision floating point - values are between the left and the right number. If the number of possible - values between both numbers is less than or equal to maxUlps, then the numbers - are considered as being equal. - - - Implementation partially follows the code outlined here: - http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ - - - - - - Reinterprets the memory contents of a floating point value as an integer value - - - Floating point value whose memory contents to reinterpret - - - The memory contents of the floating point value interpreted as an integer - - - - - Reinterprets the memory contents of a double precision floating point - value as an integer value - - - Double precision floating point value whose memory contents to reinterpret - - - The memory contents of the double precision floating point value - interpreted as an integer - - - - - Reinterprets the memory contents of an integer as a floating point value - - Integer value whose memory contents to reinterpret - - The memory contents of the integer value interpreted as a floating point value - - - - - Reinterprets the memory contents of an integer value as a double precision - floating point value - - Integer whose memory contents to reinterpret - - The memory contents of the integer interpreted as a double precision - floating point value - - - - Union of a floating point variable and an integer - - - The union's value as a floating point variable - - - The union's value as an integer - - - The union's value as an unsigned integer - - - Union of a double precision floating point variable and a long - - - The union's value as a double precision floating point variable - - - The union's value as a long - - - The union's value as an unsigned long - - - - Tests whether a value is greater than the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is greater than or equal to the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is less than the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Tests whether a value is less than or equal to the value supplied to its constructor - - - - - The value against which a comparison is to be made - - - - - Initializes a new instance of the class. - - The expected value. - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - MessageWriter is the abstract base for classes that write - constraint descriptions and messages in some form. The - class has separate methods for writing various components - of a message, allowing implementations to tailor the - presentation as needed. - - - - - Construct a MessageWriter given a culture - - - - - Method to write single line message with optional args, usually - written to precede the general failure message. - - The message to be written - Any arguments used in formatting the message - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the Expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in locating the point where the strings differ - If true, the strings should be clipped to fit the line - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for a modifier - - The modifier. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Abstract method to get the max line length - - - - - Static methods used in creating messages - - - - - Static string used when strings are clipped - - - - - Returns the representation of a type as used in NUnitLite. - This is the same as Type.ToString() except for arrays, - which are displayed with their declared sizes. - - - - - - - Converts any control characters in a string - to their escaped representation. - - The string to be converted - The converted string - - - - Return the a string representation for a set of indices into an array - - Array of indices for which a string is needed - - - - Get an array of indices representing the point in a enumerable, - collection or array corresponding to a single int index into the - collection. - - The collection to which the indices apply - Index in the collection - Array of indices - - - - Clip a string to a given length, starting at a particular offset, returning the clipped - string with ellipses representing the removed parts - - The string to be clipped - The maximum permitted length of the result string - The point at which to start clipping - The clipped string - - - - Clip the expected and actual strings in a coordinated fashion, - so that they may be displayed together. - - - - - - - - - Shows the position two strings start to differ. Comparison - starts at the start index. - - The expected string - The actual string - The index in the strings at which comparison should start - Boolean indicating whether case should be ignored - -1 if no mismatch found, or the index where mismatch found - - - - The Numerics class contains common operations on numeric values. - - - - - Checks the type of the object, returning true if - the object is a numeric type. - - The object to check - true if the object is a numeric type - - - - Checks the type of the object, returning true if - the object is a floating point numeric type. - - The object to check - true if the object is a floating point numeric type - - - - Checks the type of the object, returning true if - the object is a fixed point numeric type. - - The object to check - true if the object is a fixed point numeric type - - - - Test two numeric values for equality, performing the usual numeric - conversions and using a provided or default tolerance. If the tolerance - provided is Empty, this method may set it to a default tolerance. - - The expected value - The actual value - A reference to the tolerance in effect - True if the values are equal - - - - Compare two numeric values, performing the usual numeric conversions. - - The expected value - The actual value - The relationship of the values to each other - - - - NUnitComparer encapsulates NUnit's default behavior - in comparing two objects. - - - - - Compares two objects - - - - - - - - Returns the default NUnitComparer. - - - - - Generic version of NUnitComparer - - - - - - Compare two objects of the same type - - - - - NUnitEqualityComparer encapsulates NUnit's handling of - equality tests between objects. - - - - - - - - - - Compares two objects for equality within a tolerance - - The first object to compare - The second object to compare - The tolerance to use in the comparison - - - - - If true, all string comparisons will ignore case - - - - - If true, arrays will be treated as collections, allowing - those of different dimensions to be compared - - - - - Comparison objects used in comparisons for some constraints. - - - - - Compares two objects for equality within a tolerance. - - - - - Helper method to compare two arrays - - - - - Method to compare two DirectoryInfo objects - - first directory to compare - second directory to compare - true if equivalent, false if not - - - - Returns the default NUnitEqualityComparer - - - - - Gets and sets a flag indicating whether case should - be ignored in determining equality. - - - - - Gets and sets a flag indicating that arrays should be - compared as collections, without regard to their shape. - - - - - Gets and sets an external comparer to be used to - test for equality. It is applied to members of - collections, in place of NUnit's own logic. - - - - - Gets the list of failure points for the last Match performed. - - - - - FailurePoint class represents one point of failure - in an equality test. - - - - - The location of the failure - - - - - The expected value - - - - - The actual value - - - - - Indicates whether the expected value is valid - - - - - Indicates whether the actual value is valid - - - - - PathConstraint serves as the abstract base of constraints - that operate on paths and provides several helper methods. - - - - - The expected path used in the constraint - - - - - The actual path being tested - - - - - Flag indicating whether a caseInsensitive comparison should be made - - - - - Construct a PathConstraint for a give expected path - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Returns true if the expected path and actual path match - - - - - Returns the string representation of this constraint - - - - - Canonicalize the provided path - - - The path in standardized form - - - - Test whether two paths are the same - - The first path - The second path - Indicates whether case should be ignored - - - - - Test whether one path is under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - Indicates whether case should be ignored - - - - - Test whether one path is the same as or under another path - - The first path - supposed to be the parent path - The second path - supposed to be the child path - - - - - Modifies the current instance to be case-insensitve - and returns it. - - - - - Modifies the current instance to be case-sensitve - and returns it. - - - - - Summary description for SamePathConstraint. - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubPathConstraint tests that the actual path is under the expected path - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SamePathOrUnderConstraint tests that one path is under another - - - - - Initializes a new instance of the class. - - The expected path - - - - Test whether the constraint is satisfied by a given value - - The expected path - The actual path - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Predicate constraint wraps a Predicate in a constraint, - returning success if the predicate is true. - - - - - Construct a PredicateConstraint from a predicate - - - - - Determines whether the predicate succeeds when applied - to the actual value. - - - - - Writes the description to a MessageWriter - - - - - NotConstraint negates the effect of some other constraint - - - - - Initializes a new instance of the class. - - The base constraint to be negated. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for if the base constraint fails, false if it succeeds - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a MessageWriter. - - The writer on which the actual value is displayed - - - - AllItemsConstraint applies another constraint to each - item in a collection, succeeding if they all succeed. - - - - - Construct an AllItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - SomeItemsConstraint applies another constraint to each - item in a collection, succeeding if any of them succeeds. - - - - - Construct a SomeItemsConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - succeeding if any item succeeds. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - NoItemConstraint applies another constraint to each - item in a collection, failing if any of them succeeds. - - - - - Construct a NoItemConstraint on top of an existing constraint - - - - - - Apply the item constraint to each item in the collection, - failing if any item fails. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - ExactCoutConstraint applies another constraint to each - item in a collection, succeeding only if a specified - number of items succeed. - - - - - Construct an ExactCountConstraint on top of an existing constraint - - - - - - - Apply the item constraint to each item in the collection, - succeeding only if the expected number of items pass. - - - - - - - Write a description of this constraint to a MessageWriter - - - - - - PropertyExistsConstraint tests that a named property - exists on the object provided through Match. - - Originally, PropertyConstraint provided this feature - in addition to making optional tests on the vaue - of the property. The two constraints are now separate. - - - - - Initializes a new instance of the class. - - The name of the property. - - - - Test whether the property exists for a given object - - The object to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - PropertyConstraint extracts a named property and uses - its value as the actual value for a chained constraint. - - - - - Initializes a new instance of the class. - - The name. - The constraint to apply to the property. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of the constraint. - - - - - - RangeConstraint tests whethe two values are within a - specified range. - - - - - Initializes a new instance of the class. - - From. - To. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - ResolvableConstraintExpression is used to represent a compound - constraint being constructed at a point where the last operator - may either terminate the expression or may have additional - qualifying constraints added to it. - - It is used, for example, for a Property element or for - an Exception element, either of which may be optionally - followed by constraints that apply to the property or - exception. - - - - - Create a new instance of ResolvableConstraintExpression - - - - - Create a new instance of ResolvableConstraintExpression, - passing in a pre-populated ConstraintBuilder. - - - - - Resolve the current expression to a Constraint - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied only if both - argument constraints are satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if either - of the argument constraints is satisfied. - - - - - This operator creates a constraint that is satisfied if the - argument constraint is not satisfied. - - - - - Appends an And Operator to the expression - - - - - Appends an Or operator to the expression. - - - - - ReusableConstraint wraps a resolved constraint so that it - may be saved and reused as needed. - - - - - Construct a ReusableConstraint - - The constraint or expression to be reused - - - - Conversion operator from a normal constraint to a ReusableConstraint. - - The original constraint to be wrapped as a ReusableConstraint - - - - - Returns the string representation of the constraint. - - A string representing the constraint - - - - Resolves the ReusableConstraint by returning the constraint - that it originally wrapped. - - A resolved constraint - - - - SameAsConstraint tests whether an object is identical to - the object passed to its constructor - - - - - Initializes a new instance of the class. - - The expected object. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation - - - - - BinarySerializableConstraint tests whether - an object is serializable in binary format. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - StringConstraint is the abstract base for constraints - that operate on strings. It supports the IgnoreCase - modifier for string operations. - - - - - The expected value - - - - - Indicates whether tests should be case-insensitive - - - - - Constructs a StringConstraint given an expected value - - The expected value - - - - Modify the constraint to ignore case in matching. - - - - - EmptyStringConstraint tests whether a string is empty. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - NullEmptyStringConstraint tests whether a string is either null or empty. - - - - - Constructs a new NullOrEmptyStringConstraint - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - SubstringConstraint can test whether a string contains - the expected substring. - - - - - Initializes a new instance of the class. - - The expected. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - StartsWithConstraint can test whether a string starts - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - EndsWithConstraint can test whether a string ends - with an expected substring. - - - - - Initializes a new instance of the class. - - The expected string - - - - Test whether the constraint is matched by the actual value. - This is a template method, which calls the IsMatch method - of the derived class. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - RegexConstraint can test whether a string matches - the pattern provided. - - - - - Initializes a new instance of the class. - - The pattern. - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True for success, false for failure - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - ThrowsConstraint is used to test the exception thrown by - a delegate by applying a constraint to it. - - - - - Initializes a new instance of the class, - using a constraint to be applied to the exception. - - A constraint to apply to the caught exception. - - - - Executes the code of the delegate and captures any exception. - If a non-null base constraint was provided, it applies that - constraint to the exception. - - A delegate representing the code to be tested - True if an exception is thrown and the constraint succeeds, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Returns the string representation of this constraint - - - - - Get the actual exception thrown - used by Assert.Throws. - - - - - ThrowsNothingConstraint tests that a delegate does not - throw an exception. - - - - - Test whether the constraint is satisfied by a given value - - The value to be tested - True if no exception is thrown, otherwise false - - - - Converts an ActualValueDelegate to a TestDelegate - before calling the primary overload. - - - - - - - Write the constraint description to a MessageWriter - - The writer on which the description is displayed - - - - Write the actual value for a failing constraint test to a - MessageWriter. The default implementation simply writes - the raw value of actual, leaving it to the writer to - perform any formatting. - - The writer on which the actual value is displayed - - - - Modes in which the tolerance value for a comparison can - be interpreted. - - - - - The tolerance was created with a value, without specifying - how the value would be used. This is used to prevent setting - the mode more than once and is generally changed to Linear - upon execution of the test. - - - - - The tolerance is used as a numeric range within which - two compared values are considered to be equal. - - - - - Interprets the tolerance as the percentage by which - the two compared values my deviate from each other. - - - - - Compares two values based in their distance in - representable numbers. - - - - - The Tolerance class generalizes the notion of a tolerance - within which an equality test succeeds. Normally, it is - used with numeric types, but it can be used with any - type that supports taking a difference between two - objects and comparing that difference to a value. - - - - - Constructs a linear tolerance of a specdified amount - - - - - Constructs a tolerance given an amount and ToleranceMode - - - - - Tests that the current Tolerance is linear with a - numeric value, throwing an exception if it is not. - - - - - Returns an empty Tolerance object, equivalent to - specifying no tolerance. In most cases, it results - in an exact match but for floats and doubles a - default tolerance may be used. - - - - - Returns a zero Tolerance object, equivalent to - specifying an exact match. - - - - - Gets the ToleranceMode for the current Tolerance - - - - - Gets the value of the current Tolerance instance. - - - - - Returns a new tolerance, using the current amount as a percentage. - - - - - Returns a new tolerance, using the current amount in Ulps. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of days. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of hours. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of minutes. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of seconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of milliseconds. - - - - - Returns a new tolerance with a TimeSpan as the amount, using - the current amount as a number of clock ticks. - - - - - Returns true if the current tolerance is empty. - - - - - TypeConstraint is the abstract base for constraints - that take a Type as their expected value. - - - - - The expected Type used by the constraint - - - - - Construct a TypeConstraint for a given Type - - - - - - Write the actual value for a failing constraint test to a - MessageWriter. TypeConstraints override this method to write - the name of the type. - - The writer on which the actual value is displayed - - - - ExactTypeConstraint is used to test that an object - is of the exact type provided in the constructor - - - - - Construct an ExactTypeConstraint for a given Type - - The expected Type. - - - - Test that an object is of the exact type specified - - The actual value. - True if the tested object is of the exact type provided, otherwise false. - - - - Write the description of this constraint to a MessageWriter - - The MessageWriter to use - - - - ExceptionTypeConstraint is a special version of ExactTypeConstraint - used to provided detailed info about the exception thrown in - an error message. - - - - - Constructs an ExceptionTypeConstraint - - - - - Write the actual value for a failing constraint test to a - MessageWriter. Overriden to write additional information - in the case of an Exception. - - The MessageWriter to use - - - - InstanceOfTypeConstraint is used to test that an object - is of the same type provided or derived from it. - - - - - Construct an InstanceOfTypeConstraint for the type provided - - The expected Type - - - - Test whether an object is of the specified type or a derived type - - The object to be tested - True if the object is of the provided type or derives from it, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableFromConstraint is used to test that an object - can be assigned from a given Type. - - - - - Construct an AssignableFromConstraint for the type provided - - - - - - Test whether an object can be assigned from the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - AssignableToConstraint is used to test that an object - can be assigned to a given Type. - - - - - Construct an AssignableToConstraint for the type provided - - - - - - Test whether an object can be assigned to the specified type - - The object to be tested - True if the object can be assigned a value of the expected Type, otherwise false. - - - - Write a description of this constraint to a MessageWriter - - The MessageWriter to use - - - - Thrown when an assertion failed. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when a test executes inconclusively. - - - - - The error message that explains - the reason for the exception - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - Thrown when an assertion failed. - - - - - - - The error message that explains - the reason for the exception - The exception that caused the - current exception - - - - Serialization Constructor - - - - - - - - - - - Compares two objects of a given Type for equality within a tolerance - - The first object to compare - The second object to compare - The tolerance to use in the comparison - - - - - The different targets a test action attribute can be applied to - - - - - Default target, which is determined by where the action attribute is attached - - - - - Target a individual test case - - - - - Target a suite of test cases - - - - - Delegate used by tests that execute code and - capture any thrown exception. - - - - - The Assert class contains a collection of static methods that - implement the most common assertions used in NUnit. - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Helper for Assert.AreEqual(double expected, double actual, ...) - allowing code generation to work consistently. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - The message to initialize the with. - - - - Throws a with the message and arguments - that are passed in. This allows a test to be cut short, with a result - of success returned to NUnit. - - - - - Throws an with the message and arguments - that are passed in. This is used by the other Assert functions. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This is used by the other Assert functions. - - The message to initialize the with. - - - - Throws an . - This is used by the other Assert functions. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as ignored. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as ignored. - - - - - Throws an with the message and arguments - that are passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - Arguments to be used in formatting the message - - - - Throws an with the message that is - passed in. This causes the test to be reported as inconclusive. - - The message to initialize the with. - - - - Throws an . - This causes the test to be reported as Inconclusive. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - Used as a synonym for That in rare cases where a private setter - causes a Visual Basic compilation error. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - Used as a synonym for That in rare cases where a private setter - causes a Visual Basic compilation error. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - Used as a synonym for That in rare cases where a private setter - causes a Visual Basic compilation error. - - - This method is provided for use by VB developers needing to test - the value of properties with private setters. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - A constraint to be satisfied by the exception - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - The exception Type expected - A TestSnippet delegate - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate throws a particular exception when called. - - Type of the expected exception - A TestSnippet delegate - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception when called - and returns it. - - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - The message that will be displayed on failure - - - - Verifies that a delegate throws an exception of a certain Type - or one derived from it when called and returns it. - - The expected Exception Type - A TestDelegate - - - - Verifies that a delegate does not throw an exception - - A TestSnippet delegate - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - The message that will be displayed on failure - - - - Verifies that a delegate does not throw an exception. - - A TestSnippet delegate - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - The message to display in case of failure - - - - Asserts that a condition is false. If the condition is true the method throws - an . - - The evaluated condition - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is not equal to null - If the object is null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - The message to display in case of failure - - - - Verifies that the object that is passed in is equal to null - If the object is not null then an - is thrown. - - The object that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - The message to display in case of failure - - - - Verifies that the double that is passed in is an NaN value. - If the object is not NaN then an - is thrown. - - The value that is to be tested - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is empty - that is equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not empty - that is not equal to string.Empty - - The string to be tested - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - The message to display in case of failure - - - - Assert that an array, list or other collection is not empty - - An array, list or other collection implementing ICollection - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is either null or equal to string.Empty - - The string to be tested - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Assert that a string is not null or empty - - The string to be tested - The message to display in case of failure - - - - Assert that a string is not null or empty - - The string to be tested - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - The message to display in case of failure - - - - Asserts that an object may not be assigned a value of a given Type. - - The expected Type. - The object under examination - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - The message to display in case of failure - - - - Asserts that an object is not an instance of a given type. - - The expected Type - The object being examined - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are equal. If they are not, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - The message to display in case of failure - - - - Verifies that two doubles are equal considering a delta. If the - expected value is infinity then the delta value is ignored. If - they are not equal then an is - thrown. - - The expected value - The actual value - The maximum acceptable difference between the - the expected and the actual - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are not equal an is thrown. - - The value that is expected - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - The message to display in case of failure - - - - Verifies that two values are not equal. If they are equal, then an - is thrown. - - The expected value - The actual value - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - The message to display in case of failure - - - - Verifies that two objects are not equal. Two objects are considered - equal if both are null, or if both have the same value. NUnit - has special semantics for some object types. - If they are equal an is thrown. - - The value that is expected - The actual value - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects refer to the same object. If they - are not the same an is thrown. - - The expected object - The actual object - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - The message to display in case of failure - - - - Asserts that two objects do not refer to the same object. If they - are the same an is thrown. - - The expected object - The actual object - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than the second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - The message to display in case of failure - - - - Verifies that the first value is greater than or equal tothe second - value. If it is not, then an - is thrown. - - The first value, expected to be greater - The second value, expected to be less - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - The message to display in case of failure - - - - Verifies that the first value is less than or equal to the second - value. If it is not, then an - is thrown. - - The first value, expected to be less - The second value, expected to be greater - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - Array of objects to be used in formatting the message - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - The message to display in case of failure - - - - Asserts that an object is contained in a list. - - The expected object - The list to be examined - - - - Gets the number of assertions executed so far and - resets the counter to zero. - - - - - AssertionHelper is an optional base class for user tests, - allowing the use of shorter names for constraints and - asserts and avoiding conflict with the definition of - , from which it inherits much of its - behavior, in certain mock object frameworks. - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. Works - identically to Assert.That - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an assertion exception on failure. - - A Constraint to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to Assert.That. - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically to Assert.That. - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the method throws - an . Works Identically Assert.That. - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - Returns a ListMapper based on a collection. - - The original collection - - - - - Provides static methods to express the assumptions - that must be met for a test to give a meaningful - result. If an assumption is not met, the test - should produce an inconclusive result. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - An ActualValueDelegate returning the value to be tested - The message that will be displayed on failure - - - - Apply a constraint to an actual value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - An ActualValueDelegate returning the value to be tested - A Constraint expression to be applied - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - - - - Apply a constraint to a referenced value, succeeding if the constraint - is satisfied and throwing an InconclusiveException on failure. - - A Constraint expression to be applied - The actual value to test - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - Arguments to be used in formatting the message - - - - Asserts that a condition is true. If the condition is false the method throws - an . - - The evaluated condition - The message to display if the condition is false - - - - Asserts that a condition is true. If the condition is false the - method throws an . - - The evaluated condition - - - - Asserts that the code represented by a delegate throws an exception - that satisfies the constraint provided. - - A TestDelegate to be executed - A ThrowsConstraint used in the test - - - - A set of Assert methods operationg on one or more collections - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - - - - Asserts that all items contained in collection are of the type specified by expectedType. - - IEnumerable containing objects to be considered - System.Type that all objects in collection must be instances of - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable containing objects to be considered - The message that will be displayed on failure - - - - Asserts that all items contained in collection are not equal to null. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Ensures that every object contained in collection exists within the collection - once and only once. - - IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are exactly equal. The collections must have the same count, - and contain the exact same objects in the same order. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - - - - Asserts that expected and actual are not exactly equal. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not exactly equal. - If comparer is not null then it will be used to compare the objects. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The IComparer to use in comparing objects from each IEnumerable - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - - - - Asserts that expected and actual are not equivalent. - - The first IEnumerable of objects to be considered - The second IEnumerable of objects to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - - - - Asserts that collection contains actual as an item. - - IEnumerable of objects to be considered - Object to be found within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - - - - Asserts that collection does not contain actual as an item. - - IEnumerable of objects to be considered - Object that cannot exist within collection - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is not a subject of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - - - - Asserts that superset is a subset of subset. - - The IEnumerable superset to be considered - The IEnumerable subset to be considered - The message that will be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is empty - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array,list or other collection is empty - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - Arguments to be used in formatting the message - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - The message to be displayed on failure - - - - Assert that an array, list or other collection is ordered - - An array, list or other collection implementing IEnumerable - A custom comparer to perform the comparisons - - - - Static helper class used in the constraint-based syntax - - - - - Creates a new SubstringConstraint - - The value of the substring - A SubstringConstraint - - - - Creates a new CollectionContainsConstraint. - - The item that should be found. - A new CollectionContainsConstraint - - - - Summary description for DirectoryAssert - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are not equal - - - - Verifies that two directories are equal. Two directories are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - The message to display if directories are not equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory containing the value that is expected - A directory containing the actual value - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - Arguments to be used in formatting the message - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - The message to display if directories are equal - - - - Asserts that two directories are not equal. If they are equal - an is thrown. - - A directory path string containing the value that is expected - A directory path string containing the actual value - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is empty. If it is not empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - Arguments to be used in formatting the message - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - The message to display if directories are not equal - - - - Asserts that the directory is not empty. If it is empty - an is thrown. - - A directory to search - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path contains actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - Arguments to be used in formatting the message - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - The message to display if directory is not within the path - - - - Asserts that path does not contain actual as a subdirectory or - an is thrown. - - A directory to search - sub-directory asserted to exist under directory - - - - Summary description for FileAssert. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - We don't actually want any instances of this object, but some people - like to inherit from it to add other static methods. Hence, the - protected constructor disallows any instances of this object. - - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - The message to display if objects are not equal - - - - Verifies that two Streams are equal. Two Streams are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The expected Stream - The actual Stream - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Verifies that two files are equal. Two files are considered - equal if both are null, or if both have the same value byte for byte. - If they are not equal an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the two Stream are the same. - Arguments to be used in formatting the message - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - The message to be displayed when the Streams are the same. - - - - Asserts that two Streams are not equal. If they are equal - an is thrown. - - The expected Stream - The actual Stream - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - A file containing the value that is expected - A file containing the actual value - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if Streams are not equal - Arguments to be used in formatting the message - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - The message to display if objects are not equal - - - - Asserts that two files are not equal. If they are equal - an is thrown. - - The path to a file containing the value that is expected - The path to a file containing the actual value - - - - GlobalSettings is a place for setting default values used - by the framework in performing asserts. - - - - - Default tolerance for floating point equality - - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding only if a specified number of them succeed. - - - - - Returns a new PropertyConstraintExpression, which will either - test for the existence of the named property on the object - being tested or apply any following constraint to that property. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new AttributeConstraint checking for the - presence of a particular attribute on an object. - - - - - Returns a new CollectionContainsConstraint checking for the - presence of a particular object in the collection. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if at least one of them succeeds. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them fail. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Length property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Count property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the Message property of the object being tested. - - - - - Returns a new ConstraintExpression, which will apply the following - constraint to the InnerException property of the object being tested. - - - - - Interface implemented by a user fixture in order to - validate any expected exceptions. It is only called - for test methods marked with the ExpectedException - attribute. - - - - - Method to handle an expected exception - - The exception to be handled - - - - Helper class with properties and methods that supply - a number of constraints used in Asserts. - - - - - Returns a constraint that tests two items for equality - - - - - Returns a constraint that tests that two references are the same object - - - - - Returns a constraint that tests whether the - actual value is greater than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is greater than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the - actual value is less than or equal to the suppled argument - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual - value is of the exact type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is of the type supplied as an argument or a derived type. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is assignable from the type supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a collection containing the same elements as the - collection supplied as an argument. - - - - - Returns a constraint that tests whether the actual value - is a subset of the collection supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that tests whether the path provided - is the same as an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the path provided - is the same path or under an expected path after canonicalization. - - - - - Returns a constraint that tests whether the actual value falls - within a specified range. - - - - - Returns a ConstraintExpression that negates any - following constraint. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - Returns a constraint that tests for null - - - - - Returns a constraint that tests for True - - - - - Returns a constraint that tests for False - - - - - Returns a constraint that tests for a positive value - - - - - Returns a constraint that tests for a negative value - - - - - Returns a constraint that tests for NaN - - - - - Returns a constraint that tests for empty - - - - - Returns a constraint that tests whether a collection - contains all unique items. - - - - - Returns a constraint that tests whether an object graph is serializable in binary format. - - - - - Returns a constraint that tests whether an object graph is serializable in xml format. - - - - - Returns a constraint that tests whether a collection is ordered - - - - - The Iz class is a synonym for Is intended for use in VB, - which regards Is as a keyword. - - - - - The List class is a helper class with properties and methods - that supply a number of constraints used with lists and collections. - - - - - List.Map returns a ListMapper, which can be used to map - the original collection to another collection. - - - - - - - ListMapper is used to transform a collection used as an actual argument - producing another collection to be used in the assertion. - - - - - Construct a ListMapper based on a collection - - The collection to be transformed - - - - Produces a collection containing all the values of a property - - The collection of property values - - - - - Randomizer returns a set of random values in a repeatable - way, to allow re-running of tests if necessary. - - - - - Get a randomizer for a particular member, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Get a randomizer for a particular parameter, returning - one that has already been created if it exists. - This ensures that the same values are generated - each time the tests are reloaded. - - - - - Construct a randomizer using a random seed - - - - - Construct a randomizer using a specified seed - - - - - Return an array of random doubles between 0.0 and 1.0. - - - - - - - Return an array of random doubles with values in a specified range. - - - - - Return an array of random ints with values in a specified range. - - - - - Get a random seed for use in creating a randomizer. - - - - - The SpecialValue enum is used to represent TestCase arguments - that cannot be used as arguments to an Attribute. - - - - - Null represents a null value, which cannot be used as an - argument to an attriute under .NET 1.x - - - - - Basic Asserts on strings. - - - - - The Equals method throws an AssertionException. This is done - to make sure there is no mistake by calling this function. - - - - - - - override the default ReferenceEquals to throw an AssertionException. This - implementation makes sure there is no mistake in calling this function - as part of Assert. - - - - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string is not found within another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string is found within another string. - - The expected string - The string to be examined - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string starts with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not start with another string. - - The expected string - The string to be examined - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string ends with another string. - - The expected string - The string to be examined - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - The message to display in case of failure - - - - Asserts that a string does not end with another string. - - The expected string - The string to be examined - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are equal, without regard to case. - - The expected string - The actual string - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that two strings are Notequal, without regard to case. - - The expected string - The actual string - The message to display in case of failure - - - - Asserts that two strings are not equal, without regard to case. - - The expected string - The actual string - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - The message to display in case of failure - - - - Asserts that a string matches an expected regular expression pattern. - - The regex pattern to be matched - The actual string - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - Arguments used in formatting the message - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - The message to display in case of failure - - - - Asserts that a string does not match an expected regular expression pattern. - - The regex pattern to be used - The actual string - - - - The TestCaseData class represents a set of arguments - and other parameter info to be used for a parameterized - test case. It provides a number of instance modifiers - for use in initializing the test case. - - Note: Instance modifiers are getters that return - the same instance after modifying it's state. - - - - - The argument list to be provided to the test - - - - - The expected result to be returned - - - - - Set to true if this has an expected result - - - - - The expected exception Type - - - - - The FullName of the expected exception - - - - - The name to be used for the test - - - - - The description of the test - - - - - A dictionary of properties, used to add information - to tests without requiring the class to change. - - - - - If true, indicates that the test case is to be ignored - - - - - If true, indicates that the test case is marked explicit - - - - - The reason for ignoring a test case - - - - - Initializes a new instance of the class. - - The arguments. - - - - Initializes a new instance of the class. - - The argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - - - - Initializes a new instance of the class. - - The first argument. - The second argument. - The third argument. - - - - Sets the expected result for the test - - The expected result - A modified TestCaseData - - - - Sets the expected exception type for the test - - Type of the expected exception. - The modified TestCaseData instance - - - - Sets the expected exception type for the test - - FullName of the expected exception. - The modified TestCaseData instance - - - - Sets the name of the test case - - The modified TestCaseData instance - - - - Sets the description for the test case - being constructed. - - The description. - The modified TestCaseData instance. - - - - Applies a category to the test - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Applies a named property to the test - - - - - - - - Ignores this TestCase. - - - - - - Ignores this TestCase, specifying the reason. - - The reason. - - - - - Marks this TestCase as Explicit - - - - - - Marks this TestCase as Explicit, specifying the reason. - - The reason. - - - - - Gets the argument list to be provided to the test - - - - - Gets the expected result - - - - - Returns true if the result has been set - - - - - Gets the expected exception Type - - - - - Gets the FullName of the expected exception - - - - - Gets the name to be used for the test - - - - - Gets the description of the test - - - - - Gets a value indicating whether this is ignored. - - true if ignored; otherwise, false. - - - - Gets a value indicating whether this is explicit. - - true if explicit; otherwise, false. - - - - Gets the ignore reason. - - The ignore reason. - - - - Gets a list of categories associated with this test. - - - - - Gets the property dictionary for this test - - - - - Provide the context information of the current test - - - - - Constructs a TestContext using the provided context dictionary - - A context dictionary - - - - Get the current test context. This is created - as needed. The user may save the context for - use within a test, but it should not be used - outside the test for which it is created. - - - - - Gets a TestAdapter representing the currently executing test in this context. - - - - - Gets a ResultAdapter representing the current result for the test - executing in this context. - - - - - Gets the directory containing the current test assembly. - - - - - Gets the directory to be used for outputing files created - by this test run. - - - - - TestAdapter adapts a Test for consumption by - the user test code. - - - - - Constructs a TestAdapter for this context - - The context dictionary - - - - The name of the test. - - - - - The FullName of the test - - - - - The properties of the test. - - - - - ResultAdapter adapts a TestResult for consumption by - the user test code. - - - - - Construct a ResultAdapter for a context - - The context holding the result - - - - The TestState of current test. This maps to the ResultState - used in nunit.core and is subject to change in the future. - - - - - The TestStatus of current test. This enum will be used - in future versions of NUnit and so is to be preferred - to the TestState value. - - - - - Provides details about a test - - - - - Creates an instance of TestDetails - - The fixture that the test is a member of, if available. - The method that implements the test, if available. - The full name of the test. - A string representing the type of test, e.g. "Test Case". - Indicates if the test represents a suite of tests. - - - - The fixture that the test is a member of, if available. - - - - - The method that implements the test, if available. - - - - - The full name of the test. - - - - - A string representing the type of test, e.g. "Test Case". - - - - - Indicates if the test represents a suite of tests. - - - - - The ResultState enum indicates the result of running a test - - - - - The result is inconclusive - - - - - The test was not runnable. - - - - - The test has been skipped. - - - - - The test has been ignored. - - - - - The test succeeded - - - - - The test failed - - - - - The test encountered an unexpected exception - - - - - The test was cancelled by the user - - - - - The TestStatus enum indicates the result of running a test - - - - - The test was inconclusive - - - - - The test has skipped - - - - - The test succeeded - - - - - The test failed - - - - - Helper class with static methods used to supply constraints - that operate on strings. - - - - - Returns a constraint that succeeds if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value contains the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value starts with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that fails if the actual - value ends with the substring supplied as an argument. - - - - - Returns a constraint that succeeds if the actual - value matches the Regex pattern supplied as an argument. - - - - - Returns a constraint that fails if the actual - value matches the pattern supplied as an argument. - - - - - Returns a ConstraintExpression, which will apply - the following constraint to all members of a collection, - succeeding if all of them succeed. - - - - - TextMessageWriter writes constraint descriptions and messages - in displayable form as a text stream. It tailors the display - of individual message components to form the standard message - format of NUnit assertion failure messages. - - - - - Prefix used for the expected value line of a message - - - - - Prefix used for the actual value line of a message - - - - - Length of a message prefix - - - - - Construct a TextMessageWriter - - - - - Construct a TextMessageWriter, specifying a user message - and optional formatting arguments. - - - - - - - Method to write single line message with optional args, usually - written to precede the general failure message, at a givel - indentation level. - - The indentation level of the message - The message to be written - Any arguments used in formatting the message - - - - Display Expected and Actual lines for a constraint. This - is called by MessageWriter's default implementation of - WriteMessageTo and provides the generic two-line display. - - The constraint that failed - - - - Display Expected and Actual lines for given values. This - method may be called by constraints that need more control over - the display of actual and expected values than is provided - by the default implementation. - - The expected value - The actual value causing the failure - - - - Display Expected and Actual lines for given values, including - a tolerance value on the expected line. - - The expected value - The actual value causing the failure - The tolerance within which the test was made - - - - Display the expected and actual string values on separate lines. - If the mismatch parameter is >=0, an additional line is displayed - line containing a caret that points to the mismatch point. - - The expected string value - The actual string value - The point at which the strings don't match or -1 - If true, case is ignored in string comparisons - If true, clip the strings to fit the max line length - - - - Writes the text for a connector. - - The connector. - - - - Writes the text for a predicate. - - The predicate. - - - - Write the text for a modifier. - - The modifier. - - - - Writes the text for an expected value. - - The expected value. - - - - Writes the text for an actual value. - - The actual value. - - - - Writes the text for a generalized value. - - The value. - - - - Writes the text for a collection value, - starting at a particular point, to a max length - - The collection containing elements to write. - The starting point of the elements to write - The maximum number of elements to write - - - - Write the generic 'Expected' line for a constraint - - The constraint that failed - - - - Write the generic 'Expected' line for a given value - - The expected value - - - - Write the generic 'Expected' line for a given value - and tolerance. - - The expected value - The tolerance within which the test was made - - - - Write the generic 'Actual' line for a constraint - - The constraint for which the actual value is to be written - - - - Write the generic 'Actual' line for a given value - - The actual value causing a failure - - - - Gets or sets the maximum line length for this writer - - - - - Helper class with properties and methods that supply - constraints that operate on exceptions. - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the exact type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying the type of exception expected - - - - - Creates a constraint specifying an expected exception - - - - - Creates a constraint specifying an exception with a given InnerException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying an expected TargetInvocationException - - - - - Creates a constraint specifying that no exception is thrown - - - - diff --git a/Tools/NUnit/framework/nunit.mocks.dll b/Tools/NUnit/framework/nunit.mocks.dll deleted file mode 100644 index dda3e9e92108eb1dcf82d26804ffd4d72d9e5286..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11264 zcmeHNdvsLwo&VlDckWCknP4U{7@5G0Am#yM2pCaO2nmt!2r-F)`hrPvNd{)-#(O7$ zfYEqZ*t!K@TWcF1wP+u-J*ytwrD9i)tHo|z6;G?ywYswIT4_Cc+}a*%Tinn0d+%h1 zfV=)*Z@Az4`#yf(*YEp#+&iqj;#Tqzk%s%zPlo;2BKR@X{+@O~|Lx^kHZlcrVU+(Fl zEQ{-V(A&k0O++7a5~g0`L`73+p9eQ4T^H#f@RfP}Vi|LL2Dk>g#KN({@BGVvS25eM z`#==mHld;8&L$5{zLw!%%r=u21jW~J5Ls6(?!0Rm(egZ0ns0Glaj|bI`DsH9QAasZ zflzax!yp>Zp`Y1$_{v-M4L$U{dS&RRH*ATXwSREhb(g4T-~Ga!bz7Dk+7rDu^LOjk zta`5F(b5-c&t3Y|L*W~@e0|mZ@7b>}+5XMP?=F1s&E1PGC_FmPQMid(JK|pm-BcU-rH>*p~L@In^ z5Z9+_Y_g>cGO9f47& zlmUiJx60Uu+D0hQ%KX)5iU!8Yv@CYTqzcW!h-JGF&8YX$E{qNWMIREW8rw4|kL`t}z?6?9#punmCi+%-7oE{6lgvyVr z<-)D9o8Z06DYs^@TIg0Jnrf&)45T2nDwR^zA_9;7Q|Vefp^ftksj3i z#hNn*ZOZ_VsaT4!IUlwHt}Q$?S3NR410lc%)Z$!-hg9hn8eEE_eV}zy$<@sumQQU<34v%oPiv!H3x2D3^OPVB~(_Z zLrH0%Byiy$5eJ9I;<{CX-nxa64_WA<7X{tCi{wKrsathm4kP&p-kOJYsaB#LLEP?$ z$b?|=`GNAiOf3QzF`k0UROTYwQ*fEeT*Nb#TU74MhvB`H3NBNb3x}q1gXLTHGMU-2Q?r@O>~l|M!!lEuTYpL} zQ<=NqWNvWQ(!ESBqF`BhneM<$sF2>AR_dn`zwSUUqX<1vs@GA8UfYEAm@lmK^lJ?B zr?^oNI3tnLh@GXZ8acw$#J0n`&LlRWmW^R!%HJ5Vg7O^0_QG=vTbDbx+%yH^3cK{)zpt#>|8wHaj^>7{M%Ij|%JB zJu}(8%Kk^*q^dEgFi~8E-U8|NWBr{LWBO?v5`q+8(=Qr>MfZZ<%_+>09v#%%m2+x)P+Fcnt zksfeZVljd#L-*O2chMTehlJAXOD}J0!SgEMAHkW~%ac|w3*$oGmG#s2D^NxBiL#Ke z-Lv&YxRFEbz(gn#x)^sMZbV7gEQROCGl&~$kUr2QnCrbx2WUS^;|M(jSfgz-t6<6L_n@0|K8B_#Xm47C2MmURP@uYdVby{I15@ z9@E&?(`bk2L+vQIVLwym2&@;l(a+pHe&#;nXFab9#n3ffr^Pz^wpyUAGk34R@93=m z9|S%k@G*f;3H+(R7X`j7@K*x=Q{XXy9|-(|z(0xpf&kl!0&))B400WO3)q?RLX*W} z9;OQKA`kOH_B3h&=0~eYuvTDY@N|Yqc8X+>W(u~!!)A%(Cg~TXD#3;XE5z#p>l_7E zfH^-`u$zT<8tPi1tCh8Yy-Ek*mz6HSTb1>I-&3vxd|z<@f2V9i&zb64z;gsPsCR+B zK|KiAt8N2Ks@!WteH?I?`ZGY5Jdyj9dL<_Y*J1y^W6azPF?N)Sb6EHtoY7F?avctT zKoxn|Csdik{C?#utU#V5uo`44ixmOG#FFc%ax_Df5c#H zPw)|CBQo}`i=FWkB?Ro_NvsB#QN@z)6tJHqwAjPg&l2kJF!r;Au5dAh{fyASBvykl z<-HnO6!!CUy351Z&vH88VeDrG9rQ5vGfGDUJFIX9XVTDFtmUx68N|_bHe)x^b4ouM zloV`FkklQhg9lv<5nT`Lxk>DA2&N;_Bpe z^F=^~-W8Znd4H0UmFxw@=gI#OZ50)tqqu!phG*2Nb+U}B?NmBl4WFem-?yACpZK78 zUcE1N*}95(%eLI;G#|HTiqG8FM-AeM%XQ%f;kq%h4_TcB(wDWVnANPOOem};KZ^Xe z>y?66T-OH;^G?HR=EuzOqwPmKD1T9mMiiJKlp?g7i04}yU?p7!SVLbD7#Eljc&)%u zfj0`gN#Jb)zXA9gtd6YbfKVQmc8$OSfsfJ8v?r9Ogj+?L|9Pc~D*QiJUZN%bUn;NB zD*q08je7hQbdkiXskd%!XOC!pWu|5PcVZ=%j3FF2J0b19;3|uO6d6`IiGO)K^QpOD%!*>#0P!LdP1SB=opiqKxUA)hgvqeU{p! za1^%zCRK(z&}%{9PPK*>2Y!Ruw3S}=#jvkGpvJH>d>^on{tcAbLaC!CL0L#I0A56| z0XEZD!R?~Q0k4EiGda-Sf;I5J(UaS|1l}+30ii!F?Y9N`un*j(%of-zutkx+(%vQT z0ipD(OxJu2`vv}&z&Sco9#;NIIi&nn(bTYdhFYthuYO70rQV}zs3t!uQ^#Krt2S2% z(PhdCz#gRy@O33Ug;Jt^Ws<^@D*F2XHE3dOezc3AOU1rd0C*arQm`iDI|6bR2Al2ceDYH08`927G4hP^5~RFq$y%#_IB8x&>EU!D6H8fr zTb)>cGD&Scrk&V4O6`|3eJ#_etvQ}du8gPqlcr5=Od|m;qv?1m(I;(@0n^M3TK(ic zx)KBFcxKo(MVysLqb;2=?alE%GpmvncpXztpJgW#z0@`8WXu$;>)m4ZWjrj_Ih@WU zQf92vOj#M6KVu!XwLM`v)M>_(+#V&*eK9s*W;V9RQzmhPPpr`7 z7imiOcbafK4Q8J?lu20JVrg)?2W@K`b(tAgq$i#nHc8BQCXf`99M_y1My%ONCea&u zkj)nOfmYlerIe)0p=8|29zr?WS1hH6O#C3Q_1B)@k!W73EWj$2!K5y=R#0~GJe49An=P|6vYtTS`7H(b=@IA*Fh zIoe_-AIptZ_YIC$Tku*=qV5289B!lVElNqSt{$W(vWB^$k&DPMUofsHA1*_YR z_nWD>z4hc?m<$do?PNw#EoJX6(&CN1i3EFs#Y0J${nPoDgQRpku!zt4iW7#%OIMlnxVT_lS z=3(15(-|yoBW64QSb{0;3|WqJb(`*#Yqqd}Nf$BfIz_GVM3Upk#1mK^FrV23Mm6mW z#aXYru&qTInl=xduz5Wtbqg;0uG2rKnBls=tQ|Tr`yId&l}GO%29UFg0*DfJhGMOyvr#~CT*u7 zz&^?V@*7Pb#qsqdiB<-Z2BkpH&>-5(rE@-CFIwFO?IWTqAwA=Sx}#yymxe~RWC3^E z2|Q1>y_4!`jOgrcNV>knAvc;Q>7ecUN$0mihV^Fs&-a|=wjmN5cg_w+Omt7H-h18I z7p)yPM?dsWEPa522X|c6Q?cl+n|uZ-x}ipkE2C%@<5o38QB=?r(70V3FnmgJv@#mx zXCz!1^)oZ-tA>0vsj6PA>Z(tVl;95IK3y{?5-u<_2(dWc#e`m=>TCqv6(v$379thU zzyzola#YhRBNbw)7!A=KzA^_wf&&+BnfyLDE$K;GJDf3;4aCKc~F7s_@D4R;TtAUGVE4FMFf#=$3{< z_l#V!Py5Rqw>>uBPP|d@FNd#rwr9!PfB(bpR+K*Rt&3mTA09}*`o^PK23mbkO-C$(=`N;V0AdgiTjnV)pyCdT-q4RAp9*$IUV2WDIPE#w$Fi|NIo8Oj^wq;|eS^_4h|P4!XvQi&0I{ZI(&*$vgJWPl$M$UY@3)WNL~a?Q{G8f;?uLqSe6t0qV-pv z0sc-bzY&d}mYx$S^MBPFXHZdclOO%rEIygN?!5vuNEK*wDOMKN(r0=a9F{L55EigfF8i`ebdiKoT!&VteQW-wenu#y5+cY!75@Nay@-fZj&j z{9FLofbXDKN@y8IPmxUUS;>YEeA38ymX_0u>sJb%@hQuJj($k-?@@b|N6~)``VL4> zj&KO48P3oEPFQ?EJDFzSi*Pf(j~VcT^VERvzT9HZ3~&aa%ZC00^cvIwofa??cEiZy z=hs({yc@L2%QK&s)D}6iMAywhI@?qe31wkTeMzB>ABfO%ND)7)hKM ztswV1XJ&`HB1PM2`X|VcbM8Hld(OG%-gEBE?2&sOCY^|4xLC+x4PW+>CZP0gnR`^y|x5&6pNjuHnX5Mu1{kBDQ>;w8nBR zTIwRbSEI4e^lz$0OPI@bqPAukF@c%*a=oaZ)b59eF+JG`|B_7rFx7QWB{i084#|5o zJ(ff`L?-1SDvK*Ty6dCb{jDG`V|T^0)@95!rs>HoB8dqy88abj>ecBXv>3U0y&>*a z3`w?Cj?>+3Kzmw(R-AR;1WN0bShw0zYu;R=Z4raI+b(1U+9oX!PhvmSQg>5`>MnAq zHo1d|AX$ubGQ!R^^(xsf*eaVzyN`XY?IyFUOlO}#=eY^}J6iKHf)+!AuvIK;$-v?U ztXK)vL<{&Uh$2U!3F~XN4t}*f)(hH9{ZQ zY%mCOt@G}P#&q3FS`zUx;V28;hpEL}Y%`O(ymeT5%*Eydll|$9(G*&_A}u^MZwUrM zg}i0;eFPK5I<{6AJ!fvw z&zW0eAI9!b=gc;vCvLciR&BQ-d+(f?M1rs5Rm^aaQITJNqJ9hdIbKb@2HlGmt9|tx z(%S2b7goot4de9}SB)`ca>*N_Ihl3cR0G30V)v)ANC4&7RfVuluQq>ms4A3JY!e-U zLXC(5b^7&dL5{>|X8l-Lv1(_owRcdKqF9{0_Lv|FoRcUOaJDk`vg5g|MS06IK|YrQ zBr?2-t7O*E!&Nwx(Fm2LoO`@Uk$XtI`e5bsAQ2FQ*OEiVBh@%oe3XZ|ysB?gs1NIa zypW`1ofD8nl2+_7nFE*eo^9d!F(O%zyb=2a#iU!cqMkGaZ0~D`XHfrxs=(sW+^(UY zkBLY>BOB=d5$l(8CD6~^NdI8uzc726LZA6842oFbY+MY~cDGgVb@wLB$HzgUMBnyi zsiIv6$L~C-ID)ufj85%I^`_p^yMNDqrWlk1oJY`h-B0vQv?sB^yT*ObDa;jFVjqli z;_f;&PW!L|DE74Lj$>)|brASVP`&G5&YcF%7xs|4yW^a~rXc!nwU=<(v31lUVj8MA zb>qh46TxFvEq=kY$YDI|i29gR=)FnL(oRfinV^1wJb9DS^)m{DD9+cvPFfF=LNmk|*#G^t*A^TOLin}k;ab{+Z+f_)HJ zJ^IapeNx6XBCjV`eoak)3B|Bo;7tN=1vC*2hTjl)N#Kj>%b>ihUI4rz6dq+#oyPRH zXkW*I9nzZM{i6b(&|*r_x3n7ozpK4jZKnUyZdRif;d=kpw0aDZ!FACXQIA((C)7Dv zN#~n?m{OmCwKA52795CjT{M=|g$nEe=tS`kc^_5J5mGY5{#<>Lczg17 z(fBlYc*K(HqVX(vjda{%l>Ph`;`FfyyCgM{c^8d7?Pp}s&m-RB)JgG9=JB|fX(#Q7 zu*-Nf?h)*ft^a0BsvGIHh*tybWP~MDk}d~W{BN}u)kV!aMQ8kY>Xa#!*VqJPvtyO&p~^pq||U#!=cs ze;HyNrM+|;Z%RmVly0T-A$D0ip!U=AA=aR`0DCFK+I8kNqiFItUg`aGAjEj3Z=;zA zJ5O(=heNCjS`N@lA$Gf9qn!BAGOG83_k>_UJo%+U(Yvrw6ir1?qb&M5IYRl0;tJtP z{}iA`_euXf0v{C0hX8f@ctlZjEqb8s8_=oKCBPWH2xuTf*oTd{oIiZtv;)SGKP>;a zSPbkk)aaa0n6A-hrT>idKQH|+SM&p!ZwmeYKCg{q_@8<|rLl%-fqx|MguskIN8q~! zE(v_Ezz+Zpt4E~&n7}6i?^1sa_!#OH!_Nxr6!;ANt1*h2!L}H_EbuZtL(dycI1|$9 z9@R$QHckSjl@0iPqeVSKKQR{2f7xgQ)Xm2sS!cGOzs+0(+-aTy>^9Fra-aDToHhO6 za{prjp8&km{0G%Zljd_Ofi-PKorohR5;$vy0UPL@fX#FYSyM-!S1D8nhHnzMOJKLa zy#n7Za9rR!1!e^<(3dc(NMBd)QSVa^s!yu(>eK3Je1pKIpf742Xuhg-Dh(d!*a2Ix zvtlc}Q;3EeA9)B3u7?fY9jlk3zY#=3jnpXK%SbJKbyeWN5qGAPvu~%xLaE^RsabqB zu}{0+LTVA8Df50si-JIQ@&DzBxr30aH+dJie5RPHFbYa#l zv-{`lf*dSErCeDmQkXAhT`%WM)A&-+xAQbIeXpJMX;nes zKZNX*Q}AtXHp6}dt`C4p>`awz@g_9DGbQfZ-ocFLIkrbbg_&{}!~BfrUxnH;BMW6x zD(kx*-R(KPeb_13L645QzB9WN8cidJp*Z5Tiog)uEh`$g3o}O$(afApV|LbdPT6HN zUCB#d#pKz^B>Ia*J3pOU5`?J}?pUcHvmec135zmKS)}pGN!^{Pa4!gQYQW9q5M``S zkq%{w^L}PJXVbBw?M-HKC4?86*#wOZO^ltG8ah5OG&+$UIT|if3T)rW+bIOr$>f}~ z8CmKoOtuG}675VL4~p1S@>ME7Qt}r|KILVXh>1Ddp9-nmU1fyCRYG2L=EDt2K(Ts- ztW9^=J`K#<*#!{*#)_-v9nvIrVLuF7h*gCwq*ZJbP@?D{nWsy$

J?Gn91^3i5)j zUEs}@&zzy@aI5*5Iq+n$y&@s!WceM=9H&sQz13Zw4Flwtm)i{j#dx^SAi{~62@-R` zUW!)3o()%%%9~`u@sYwl9@3{vz8#SV?PAt*Br(@A5!YE~uH?yLuE)+VW(rGd8KWLb zP1aw_7;qPtJZElx9oB@GnX&U3Z(*HLC=w-a9p@))uZSJHcEq5a%PfsMbL+6~vX_RP z^&$ZVZ-!N6VP=$f_JEsT#6XWrhvZa1kl2jD-Wll?SI36~Sq!XcC+GMTvAVhnbFK!N zgTz}^61-IrRwA46DV3GtGn8NSal%H)5_O{b!8>temgbN?>Ed`P*dXPWso34w1;iY= zGMsU82(JiFAcv_4zI29NFAuBfg1>hUO}L>i?&8$YyGuxN_#g(jNE3CA(GcFI$MA+S zh2C)*02~D+jc?vZ>1}xB%cEaFviOuinZN7K+mQDGJsCL%$}~oLf-{vRZ-FGe;{e_)53Hjh zhtV0F_iTBC@hcAoE*yb)5q}v7^VEuf1-Muqo`gHhds}GOf)loc!GRHWsVKZX;(i{K zRc$aEfy(R{ONp>kYzvEQr837LwCDOY_k8 zT6%-j-$3h@ag?tyniM#W;?NHaAM;vsKSEzwo8Mdsq6xf9!qb zfxqAJ3yNPj`^S@Q`!0PT{)w;s+4c*+yz{hXCbp(g5|7d`BmtMQeyJ2(rdroG*Swy! zZI!ZIbywZnd2QAZydI&uNViDEETs|#K!;vq>45RLX=y6aSZ{CxL`Cwg22ien*$}+)j&yO%jP!C)R@xPk&vc70o#1z$1Ai+v}R*7 z?(1>yX3OpEF`~xZF^f79FrHwbGzM{lG+5>rT`|=GnZ}HCGvLSJ032uK^(b4 zdIMQ~f!OaPE-k}IT7D)-%Ngb}8{hVL z)C9QvOj86uvwD_^#AjlcF(C!-@LCWSzO|aZEi%2Bcks6lPb>Tq-vf_SWO-0dtE}j$ zI5Qz<;qK$_z>(}EWciUIJXgWL1z#?Daqq+TyZ!k3mck>&t-#(2jIYDgg7G}N;JK-Q zx!}_PAeU$SatKZdHqbY>tFc=n;*jX*mq#$X!eKRX@ZNgE cdN9S`U*!m3L-X%Ry%n{x%=&%%yB~r71;(i8RR910 diff --git a/Tools/NUnit/lib/Images/Ellipsis.gif b/Tools/NUnit/lib/Images/Ellipsis.gif deleted file mode 100644 index e11f26b6ecf069fa39c7479c6d7ccfb905bc8ad1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmZ?wbhEHbKohta7+8cpob+71cLtL}`TaYOI}_99MX)ef0{|!jA?5%8 diff --git a/Tools/NUnit/lib/Images/Tree/Circles/Failure.jpg b/Tools/NUnit/lib/Images/Tree/Circles/Failure.jpg deleted file mode 100644 index c245548b91600f0e984c68b8c86a91b176de70cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 761 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3lv=asf&WCF+YYG-#?3t`0{nYJKOS$`>i>3iufO;9-@bbf=coAZ z>#6#9NBHG`hSwV($TPhP$S!#GYl(cCcY#mg#?!k6dnVrCnO}2##@zb+YuA59{H|QH T`nR@sarE=E`TOf9{=W$T56=@C diff --git a/Tools/NUnit/lib/Images/Tree/Circles/Ignored.jpg b/Tools/NUnit/lib/Images/Tree/Circles/Ignored.jpg deleted file mode 100644 index 0549b70588bccd8adb8fc04a81ba8de6316c9ca4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 688 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3>!guB^J!c9?e?D?>Wxj6uluj{<~#4|`j@%(?Y)R4wWl|;Jo(DP=f?l?y<7Xj rd)_OZO+I+?1e(3sam!QYvBb;Em-boeq+ff#?qB-CteW}C|8D{Sc2oyv diff --git a/Tools/NUnit/lib/Images/Tree/Circles/Skipped.jpg b/Tools/NUnit/lib/Images/Tree/Circles/Skipped.jpg deleted file mode 100644 index 3d84255ccfed9df405586367652c74f97502f1d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 689 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3#`Gk*DeytDS`p*NhTR=)COsQ-Tx0Pmadq5uE@ diff --git a/Tools/NUnit/lib/Images/Tree/Circles/Success.jpg b/Tools/NUnit/lib/Images/Tree/Circles/Success.jpg deleted file mode 100644 index 15ec1b7fbc9257d3638dff3c5819416078c6ff7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 731 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<c1}I=;VrF4wW9Q)H;sz?% zD!{d!pzFb!U9xX3zTPI5o8roG<0MW4oqZMDikqloVbuf*=gfJ(V&YTRE(2~ znmD<{#3dx9RMpfqG__1j&CD$#Lw@(3+VvIHN35nz&0ck`WdGLPx<|T}MVBQ{ zmdyY8Ok(cxRXv&(OiMn<_ms{Tu2}55#Qh}W$4?WO1uWO8y!stK|J42GfAeasBji_n*}CQS R{CRh)KHYy_|8D;On*d5cE201Z diff --git a/Tools/NUnit/lib/Images/Tree/Classic/Ignored.jpg b/Tools/NUnit/lib/Images/Tree/Classic/Ignored.jpg deleted file mode 100644 index 95b7fdbd142d9de0d244e866a43fb0aef35e43f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 789 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<c1}I=;VrF4wW9Q)H;sz?% zD!{d!pzFb!U9xX3zTPI5o8roG<0MW4oqZMDikqloVbuf*=gfJ(V&YTRE(2~ znmD<{#3dx9RMpfqG__1j&CD$#!+YsL^k~Nr0>4-Or~Wx3Z9y@GGnH*P{@PCDU%pwgy)&m z_~%#5;#;G8?S09#%MwdAIelI%YH?#hQ-s_MzhnOH(uCs#XGvATwdqxV(I_?CIF%499sYY diff --git a/Tools/NUnit/lib/Images/Tree/Classic/Inconclusive.jpg b/Tools/NUnit/lib/Images/Tree/Classic/Inconclusive.jpg deleted file mode 100644 index 32a0ff72f11713991a178d600e4e6a681a40d0e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 784 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<c1}I=;VrF4wW9Q)H;sz?% zD!{d!pzFb!U9xX3zTPI5o8roG<0MW4oqZMDikqloVbuf*=gfJ(V&YTRE(2~ znmD<{#3dx9RMpfqG__1j&CD$#!<#?Rk9ae`9^G`Q{1~&*p0^WaxR$V`aUIw! zRIqyDyyXm1-3RaKU%7oGe3sfu{rRd}R;<-YcsnsQ=Gf^S(}H`LmQ1ibX!+=R_ZRCI ziC30yY!bdrD+hWC!ca tgD3C!8Be|~`5^q1>!ZD!ch%gvm4CnNceHozl`pz{v0t`-{cQjLCIG3OA^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3#`Gk*DeytDS`p*NhTR=)COsQ-Tx0Pmadq5uE@ diff --git a/Tools/NUnit/lib/Images/Tree/Classic/Success.jpg b/Tools/NUnit/lib/Images/Tree/Classic/Success.jpg deleted file mode 100644 index 3d8e76092fbea18dda6339c414fbdd675f3386f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<c1}I=;VrF4wW9Q)H;sz?% zD!{d!pzFb!U9xX3zTPI5o8roG<0MW4oqZMDikqloVbuf*=gfJ(V&YTRE(2~ znmD<{#3dx9RMpfqG__1j&CD$#!@IBl8HDbhuK4zCO+uG(bA!2XMZ`M-{H@Y3`WLF{6BWJzx zMaTzN-v{=r-ivSFII5Fop>x^Z;NZlcrxPakO!Bi%+hb9inKV0h_ugHq_qW}uxj*r9 b!LLup%x;&LZNC|~@9(^6@#Z(>|K9`v$M_Y4 diff --git a/Tools/NUnit/lib/Images/Tree/Default/Failure.png b/Tools/NUnit/lib/Images/Tree/Default/Failure.png deleted file mode 100644 index 2e400b276fcd227a2f056b4a2c704a3a17776bf2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1445 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fHRz`)E9 z;1l8sRKUo{$jk&pOzh0e>?|xCtgIXy9AX@7f`WolBEl*>9IAX==Hfz@lA;O<3Z|x} z=H}*(GUDEnLVmJhVG{fi(t<7u(jH2(0Sb~Ks&cUk;@+wXk-8eO#(GKWa-pH2$ss|h zp~2Ke@2e>~Y_E0LUi+wv!C_DH6K+N)-Azt;nV<2oIOl71F3|2`ko~DZ zhsz<3S3;eyg}dH}_PiDAeIw52M!etQ;dFk&lg!9x zxiPQH(%x6+%xtKg)mS&HsqSDyX-iAX#EBDU&z?PJ&YbPrx9{1r=fZ^x*REXy2Gl4R zej%{GtG*hT1sF<#{DS|FY`_rwom~|e!<+>kk;T9Q2$?i7*PM82?WL(g zN`WPzD}+VwdMv!tclO`E`;B||X1=U6{T!X0cGlpZ__Dns(^Q{q33<@@B{==%nWLWe zk1k$d-u?gaXS02Y?em%@UT;|X`Le6Q9%a@~-wSg4Dw&gQuTA7S^0aqm1jFsXn`gLK zuT`(x(RJ!s_RG_k0(5hn3;4_C?KACI9eX3|FH6Gy)$UIicifXYyG!~|)yo?vi~jBW z6jT{=a3z2Dp~83PY7E{_76^TyV3HAkJ?rKPx#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy32;bRa{vGi!~g&e!~vBn4jTXf02p*dSaefwW^{L9a%BKeVQFr3 zE>1;MAa*k@Gd8K`;w1n80hLKaK~y+TrBh8y0zm+Mvum1}VRX>a5ECOUFbLEBLWhoa zi6A1VQ-uAUg6QhGTbB;`0YL_C&^3&pvb2=U)oEvKmR)!C(u0NB+4tVOH#%vZdKtPZD3)JARZMl>29Liu3|I&1kTfJPgq+%9OsiJ-toOPO!~H`OqK#nI?@(!6 zqwT>U@y?+aOKW2gMZn{+;qu}G$;FaJA8N3d@u76rQ2qizIPApD)t70VfdNS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fHRz`)E9 z;1l8s(!-;v$fu>mr>!iYtt6tUDypL{qOT^Vt0bYJBB8A!rKK*Rt0Qk@EN!c;ps%fD zpr>e}r)s39Zm6$mXsBy!qvh-)o9Lz!=xO8cZ4?%09~ER96Q+?FW|$Ufk(q2+7U~t1 z=2@KXSDY14R#9G2TT@$KU!QH+Sm7{nsr{u{5j$FQC(J5Yy}V@qDzB>xV-BnhxV}E< z#)i-v%af09O1ru(@y_;?I~y}E@65QjJNy2g{QDbfj%}(txux>_&a!K}Dy|)>dfd>^ z(9+z}+uPgU-#@iw?zFaf)22*=ZP=V$w$ot^OV-0Y|Km*2m- z@a@fIuWzh)|6=3yms@T*mXFhFlJ$A(H^yZVhQkhwqa=!#$zBDQ}POMF^Q*x%A)1RPa-{KM&m0#}=i4RPCS&+>>!C^t~!qAdQeH&7owuBmZcyF7% zZ)WnIu7;vLi+5U|2w1SyZCYPoRaxJ(g$ddJ|CjR_noWKjV8CD6W_kCvu1AyiFkkj&ff-?id-yQAc$CUKbKq=bO)z4*}Q$iB}HW4*& diff --git a/Tools/NUnit/lib/Images/Tree/Default/Skipped.png b/Tools/NUnit/lib/Images/Tree/Default/Skipped.png deleted file mode 100644 index 7c9fc64e3874e15f3f22a234083c1da3ce8d62b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1405 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fHRz`)E9 z;1l8sRN(9D>+kO$5D*X;7#I{36d4&A6B82~8=H`jker;HmX?;8nVFT9m6MZ`o12@T zpI=Z=P*_-4R8&-4TwGF8Qe9nLQ&Ur0TU%FGS6^S>(9qD>*x1z6)ZEoQeotUc4CddXRJaa_yUX@}NK6`G*Q rap=JLd&hddy85ua{(ro-{sHGx)snNf1MdKfN(Kf`S3j3^P6NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fHRz`)E9 z;1l8sRKUo{$iT$F$i&FP&cejS#KytK&dtus&&t8a!79qiDb2|%%gbWKB5xwEsi|pi zZ!hR5DCQ_8m>_8BYiS!{tB|drnWkx$Z|30O;F9a&R^cQtT|ji2DC;^_{!RSCn}wye zOUdq#Rq0dFZPT@#YOA+736d-j|;b5^fjy?y)kzB9co_gm(kXq|kyZOXm=d3UF- zxj1e8wK-eQ%-ni$?$wK1u3ftZ42n@O(n8?#y__;&7GNj|@(cbyvH?TzcXm}^{Bss~ zL>2=JAYg{zy~a2pzj6*xP@=>&q9iy!t)x7$D3u`~F*C13&(AePq0Cs%*lgwVM<9)7 zJY5_^G=h_V^s`AE_`@OZ??1oe|Np)J|Fd&fNJ?d7NlEPTHmYb~z2o!biRe_3R0~Oo zAC63MYDEjzm0f!k!^6X*pexu`^zUIJBcBZq&!IL!2S)kYxVsM~C}^^=74jO(FKAdU zz&yERfxa~J{Kb8}>K+cQQyU%qTN*E3I(bV>4OIj9Z-1nd_^+fC85L>3(lN5 zaNymeob{wrblmH;2j<40nnP d7?&t8Fes)~X?EOwb{gm}22WQ%mvv4FO#qjX@@4=4 diff --git a/Tools/NUnit/lib/Images/Tree/Visual Studio/Failure.png b/Tools/NUnit/lib/Images/Tree/Visual Studio/Failure.png deleted file mode 100644 index ba03e84853241e5fbd33f88b5b051a6d8f36e94e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 747 zcmV004R=004l4008;_004mL004C`008P>0026e000+nl3&F}00009 za7bBm000ie000ie0hKEb8vp(z8rx|(-Aij%PZ3fC*v`WbsjsTQ+uRD} zm5@urVhp~FL+l$fdL`kiX7=YbvoFow0nAIcem}f>9Zdmr6Kb>+vmf4-0HSua+W{#Bh(~d} zd4l8pNJ*%dgXn{I$SdbH^|ji{5uTbZ0i;#rb80EkVyfokf~r{o*G@jCHsh>(I%fzjgcqrdnC$tSjf(nu|JLTL~aTGUxWNoY%;t z)0q9Y?aSP?Q!HOOVxM>1cwm004R=004l4008;_004mL004C`008P>0026e000+nl3&F}00009 za7bBm000ie000ie0hKEb8vpBWP+6N|@Z-bX0jx}v`21Vk2Tn_;1*$4^RElW4v>V4{hJ_LD$v8P z$ScT0(XtuGIZ?AnS^g2u)MsS8PM+6IMR`X4$b;~2|V>^m$jBWxBg+f;5nvgmqe2PY_Li%cX&ahV%`L6Y{?JE*HmznK2^ z6pzP5iOaXo%|qHCl{R_SV$#udgFvsGfov){HELW(Bn&Q|HJSfCjS`vtB0hIsruvvc zu04a1G_Xw2oPwSKg^{r#5ak6 z?$Qri&W2`Ll2a*JYu3KbzD?lDKZ>&3IB#jUe<*(dgPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0;5SpK~y+Tb&^|5 z(s2~WdF|02>Y=oz4=%UtvQ}FoDqLRhf)p#8Y2>U?<_cdLx-RCee8@Hpofw%KmU2;y z*eJzmWXPXHb4jU~!MF(8pFe+;KmW@wMY7B0c{=Cpe9rlvokIhE8-)WL1sDvlpCAZR z7y=0Fp8^1Ak(eUZN_`g6+7X(l4VlVAhVr1X4xb-f#V9hgfrSBzpnO(*rgLSw(QOe= z=pKxz1T)I~1qIiyDO?_{!yG1xh%jpa<+tIpFVR`C8EUD#%R9wLpdZ|Mg_EGHW;naj zU_}qBU(?MaUT``$b?E-n*f#_x{Wu{|m-dTY$KE&Pnwad8T&V#6|aVC?Do z5E_NdQw}-iY5UN7E1$I|`Pc#R!)xj%`MF8E==)>TkJ-e)c~qX})84=w&>BFxMhVL! z%GGS|FOpVd$VDX!`pQqwIXAiS=du_>QUNhsfGV>VWgOJp8kXc9p(ZQ9bTv7`#|HQw z4ZpYQWG*v0nVwi*C0I1n5rYM&g5{B>`bI@zNlrZp3BhL}7|z2qoUtb6_3YRq`{HVE z7rBjM%2*cCa1j~H{UQ}!2MCuDHwb~L80aqrUS}H{nD;L3tu0}DKGp;14yipGRHb`6 zlWpy+C6gq)17gR_B0|TbhIoE8cd{i#e*d_lhGp;LQ#v00hV7H3+9eE|q7a#TAKn1~ z+zAEV6$jN^wC{|$iCLDHcr}LswO_{H@(_8tT|%F2KCuWr`+Wxh$bdI6(XrH%19!8$ z-I004R=004l4008;_004mL004C`008P>0026e000+nl3&F}00009 za7bBm000ie000ie0hKEb8vp_VHgsn*&y_qIu6`pEkx_u(|r zDxI_AeGJJFRj^5qIiHAm;Q3C`cVkGDHuLu`O1DyLpP zC+wC8^q#?#y*MKMkXj|bwv2P(J#$%&;N53LZ$ChCG`qJw*qxunSIiOUiJ)5&QhyX{ zEQS@Epu4=szW*er3o0u!Q|u`lwgMYaSXv;|=|$5`w4WKIQoebqQpD10)OJ)l3=>mX zVI%&f9Z*Rt_?(tV-bTx8fx6msc|Qx=Kd9xh)Lr1#tE5wEJHT|w)V?RErd6?0Y)rpG zntz8i`-bJk1bVrMWNS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fHRz`)E9 z;1l8sRN(9D>+kO$5D*X;7#I{36d4&A6B82~8=H`jker;HmX?;8nVFT9m6MZ`o12@T zpI=Z=P*_-4R8&-4TwGF8Qe9nLQ&Ur0TU%FGS6^S>(9qD>*x1z6)ZEoQeotUc4CddXRJaa_yUX@}NK6`G*Q rap=JLd&hddy85ua{(ro-{sHGx)snNf1MdKfN(Kf`S3j3^P6004&%004{+008|`004nN004b?008NW002DY000@xb3BE2000U( zX+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHz3$DNjUR8-d%htIutdZEoQ(iwV_E---f zE+8EQQ5a?h7|H;{3{7l^s6a#!5dlSzpnw6Rp-8NVVj(D~U=K(TP+~BOsHkK{)=GSN zdGF=r_s6~8+Gp=`_t|@&wJrc8PaiHX1(pIJnJ3@}dN|Wpg-6h_{Qw4dfB~ieFj?uT zzCrH6KqN0W7kawL3H*!R3;{^|zGdj?Pp5H0=h0sk8Wyh&7ga7GLtw0fuTQ>mB{3?=`JbBsZ3rr0E=h-EE#ca>7pWA znp#_08k!lIeo?6Zy7)IG?(HJI3i#YJh}QRq?XUb&>HuKOifXg#4_nNB06Mk;Ab0-{ zo8}<^Bt?B|zwyO+XySQ^7YI^qjEyrhGmW?$mXWxizw3WG{0)8aJtOgUzn6#Z%86wP zlLT~e-B>9}DMCIyJ(bDg&<+1Q#Q!+(uk%&0*raG}W_n!s* z`>t?__>spaFD&Aut10z!o?HH?RWufnX30 z)&drY2g!gBGC?lb3<^LI*ah~2N>BspK_h4ZCqM@{4K9Go;5xVo?tlki1dM~{UdPU)xj{ZqAQTQoLvauf5<ZgZNI6o6v>;tbFLDbRL8g&+C=7~%qN5B^ zwkS_j2#SSDLv276qbgBHQSGQ6)GgE~Y6kTQO-3uB4bV1dFZ3#O96A$SfG$Tjpxe-w z(09<|=rSYbRd;g|%>I!rO<0Hzgl9y5R$!^~o_Sb3}g)(-23Wnu-`0_=Y5 zG3+_)Aa)%47DvRX;>>XFxCk5%mxn9IHQ~!?W?(_!4|Qz6*Z? zKaQU#NE37jc7$L;0%0?ug3v;^M0iMeMI;i{iPppbBA2*{SV25ayh0o$z9Y$y^hqwH zNRp7WlXQf1o^+4&icBVJlO4$sWC3|6xsiO4{FwY!f+Arg;U&SA*eFpY(JnD4@j?SR-`K0DzX#{6;CMMSAv!Fl>(L4DIHeoQ<_y) zQT9+yRo<_BQF&U0rsAlQpi-uCR%J?+qH3?oRV`CJr}~U8OLw9t(JSaZ^cgiJHBU96 zTCG~Y+Pu1sdWd?SdaL>)4T1(kBUYnKqg!J}Q&rPfGgq@&^S%~di=h>-wNI;8Yff87 zJ4}0Dt zz%@8vFt8N8)OsmzY2DIcLz1DBVTNI|;iwVK$j2zpsKe-mv8Hi^@owW@<4-0QCP^ms zCJ#(yOjnrZnRc1}YNl_-GOIGXZB90KH{WR9Y5sDV!7|RWgUjw(P%L~cwpnyre6+N( zHrY-t*ICY4 zUcY?IPTh`aS8F$7Pq&Y@KV(1Rpyt4IsB?JYsNu+VY;c@#(sN31I_C7k*~FRe+~z#z zV&k&j<-9B6>fu`G+V3Xg7UEXv_SjwBJ8G6!a$8Ik+VFL5OaMFr+(FGBh%@F?24>HLNsjWR>x%^{cLj zD}-~yJ0q|Wp%D!cv#Z@!?_E6}X%SfvIkZM+P1c&LYZcZetvwSZ8O4k`8I6t(i*Abk z!1QC*F=u1EVya_iST3x6tmkY;b{Tt$W5+4wOvKv7mc~xT*~RUNn~HacFOQ$*x^OGG zFB3cyY7*uW{SuEPE+mB|wI<_|qmxhZWO#|Zo)ndotdxONgVci5ku;mMy=gOiZ+=5M zl)fgtQ$Q8{O!WzMgPUHd;& z##i2{a;|EvR;u1nJ$Hb8VDO;h!Im23nxdNbhq#CC)_T;o*J;<4AI2QcIQ+Cew7&Oi z#@CGv3JpaKACK^kj2sO-+S6#&*x01hRMHGL3!A5oMIO8Pjq5j^Eru<%t+dvnoA$o+&v?IGcZV;atwS+4HIAr!T}^80(JeesFQs#oIjrJ^h!wFI~Cpe)(drQ}4Me zc2`bcwYhrg8sl2Wb<6AReHMLfKUnZUby9Y>+)@{ z+t=@`yfZKqGIV!1a(Lt}`|jkuqXC)@%*Rcr{xo>6OEH*lc%TLr*1x5{cQYs>ht;Of}f>-u708W z;=5lQf9ac9H8cK_|8n8i;#cyoj=Wy>x_j1t_VJtKH}i9aZ{^<}eaCp$`#$Xb#C+xl z?1zevdLO$!d4GDiki4+)8~23s`{L#u!TY_%{^Yb<^L_ z7bS*a25DUgw(ce@nXZY6A-LPxIy0X6JTtSqojJBUY~BRDFazftp67kvGw*mxEbt%U z`CIUHErsOINi0c=5EK!`LJ=Wf2$5hjI+|iQ(s-;YU6o*P@dc9E1a{Z&L^!k;q1qsH zsw0!nBA3r$O%%}{iQ-m!Z$(lOIB;5+!J%*~8g}e~X_?S;6+|OY)OApsLLw3}E2}u% zbQHa(?s19Nc}?e2NUX#ee6RwmngU6Yu+G}hsD|+`pD?|YhCkrN$J7|czkP58$xNJ; zy^FyOpcaL!$qW`btWy;eGYP!vdB-0c21;8DjC>w)1>f@vXbgoxO$tRJtW<#s1O_XJ z&rWgBiMy|_Le&XMTPe~Dv#vl`&m&M90Aam88GVM~_y{yZL1Hddf%^u#St~N%w>%nz zoa72@YC~2DM3S$RIyFCCf$t1l;-IQC0jo+gRM^yV1p!|G%h?|gnBc*9KR+m!ef#Bk z4szI3_?_s4!tbwf1(9F`E7{CO7DGn=@C|<0^ZcBf)l^}yuVI)v=vomi%?DgTY=0+& zRl){E-~z=UxcT%9RHtWFvXhlEm^!dr0E9YppSR^X!eBM71)5L|?~%`s>!v?*G0>6UPJ$U!%k z_S^jr#HCG;rt|f^f5K<@!1LVQ``$mk-_7lfm6v;yn$)cZ$0V0RN~!v8CO3sCP1R*{ zxhq`hs_wRsha!}r>S0THDpHxM#y|+tVT~)2dlA>}64wW!0n+0c&W&3nFZ071)3=O*?fSIN_e|)e2e6J;F1* zS};5)M|!4L>xUNIQJ&@1cHkEF;0Fev7>Q^?1gxP6FNm-iXs`iens(|ua5AFWN))n~ zduCKSi(q(A&WdWIiG>_69;dMuFEJ0dum?Xd0L4gzG+3~PCcGfRW}v|ajA`1b^T4Uj z3@cH{V(!%ul0SiyFp-iWp^*}?kORi!G}huJcEFNh{J;PdBN5VI!5W(If(V;|1{*M@ zX{XKur+B5 zCvQG}{x`qzV`y>p=GWB1<_8V!E$=*geDd?*+vnr!N1g{u`>)0i&DVZUf4bV;I=epq HBE7x?g(GD~ diff --git a/Tools/NUnit/lib/Images/unpinned.gif b/Tools/NUnit/lib/Images/unpinned.gif deleted file mode 100644 index f25fbb53329a37087616ee4e09d933244446ac35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 881 zcmc(eKTFkN6vw}k;57;^h$7OUb#bz#gJ2|bm(&`ZENE=-fbYOj5R9hOrV|a)9Msq< zI4GQM#%)L57@+WW-CQ>paG*TiKa=>_;##+3@4p=gb9~gjQBtjZ2SVI$D5MeXWU<1Z9 z?bLbT^e^#0d{+KWPf5SEHrYM-PiU~GZ?g|}zh7RR4CWqAYrJxGdVl80=HU3(`sv)G zg|A1C&&D5??!3RZfBtIu_3E3$>zkh=ozJgtjczYS&p)jly!`y*lU&X^dZhM5UVL9A7rSC zcKB^gmyhwM%WKJ)M8Uo_FTTdRjjRpz)@*tD~-!4BCI|5Xj2*T zmbSYG*K`IF#6|n%PGEyG2>K3-`mA03tIFQfs2{1;QuvCZ&~HK_a%G2Rlnr-=l#5a% z9VL!}YlH7Cf(CM{r7s-vLeV%f^h)4gMAGoH_8t;X`at%fi>K(*l4M)=W2%q*ph>5f z{8E$7D*5FmO|bmcenXHX0!jF5{D!iEgbD>%?Z?O_Oz2t5U*b1JXmpz&BmQtgW5qot z^h-3FWqSv?axnr5gPmQY8v;K;wxIzMib8Ee2Pnv3$NN?l4T0{cpU|~d?_|*q1PSMx z>$LC^zoAruszhQF%r$|7#apQi{@dlKo&0Np>BYI+4QCQM9&9T+YxSB^U_&hZfupg+ z)jfJr#zUz|CzTK>-6SF2UP@jH=7cPT-w-e;m6PLC*l!3`NtAmgKXeO)&-SM=iB8dj zQu;%%Vv3ml)cxrtMP51pgT_&jf4V+-^R-p=`Z zQ$T!3x7xCajF-i$dcEgUj&{_7EtKwx276M*Ow=1D5RCf9_anPIL35-2Qq^y$T&+~9 zNXN!p8nG$p8IX>^RmNOCORmyA)hL$(0v&?m+sEgy@5tz$G|`J|*W;%sz}UkT%> zFXhSE9MKpC4~40vTg(=enn%;{0AsLK4O>oC8VJrlNB*d{#7{<4|H|}!=uFXo61@28 zV-Mx31?dXlQ7O!nU3!u0ds{!imafJKJYs+;SxU~MU=oWswA#2-5AKE*%`5p0r3RDx ztPLBiyn_W<$&4={kGAqLo;(SvO~_)mjQu7;ibgm14Z(ujo`T4dCkq6x4a+O+Tzoin zVdoewvU6xJ+^9_rRH!t%jA3gJz@VpWzaiY@+s0%6syW{I$L9@KVDDfc96U3sP!c={6#%=?C>R(u>MqTcBv$*fDfIL0ErTGEsD_y+TiSb z=$#B%{S5^1)5(~S4ICWxJ5ocVL87``jq4D;7Z~@h4e>Kn3`+*ov97B@QQ@qfvbPQd z{XKC#D1J1}5cbW7SerAm#XuV*EXQ|`cLKC%Y|U{Mg~L~OdEREn(xhZHIF8;i5>3u) zpnFyuNgU2V5+KQt9M5gt!bF%&=|eFm`vP^-o!ADI&6ylmqs}C&XpJ=! zx}IxhR8Ek-Ic8&%Ex@xIexaeZaW<3o8)7W4!vx_s#9R(~7Ib?2hWK>!6T}_%`VF-t zs8lsR!#=;E26Sige}?LA%kzDOEU+@jBBd!&b6C%QL$`E70F15dk+Y4Aty=mLlYP)U z4zY)&=0@H8=CRydIlADb>Vipi0o|JUWBseD9$a}0J!B}d$pK&t9+>H^104t`^24AM zpC)#}SKs3US%HJd6-<7cM9etNX&r0@9ojmci?aQzDjtPp+iOAc9jHcrIgHQXVS-7~ z^GjiTy6Vct-=yD=K#;WhcGO$O6H~=38_HaQX5fqIAxKX#RQY0Z@Zxh^vcu*sGknPa ztK`uY@bXNkUUR_&mX!_{Lh^Z(eO%+wkI#ifgj*7(e{#emhebBm<0D~m@B>0KKm(YZ zLm)L#Rly*>K==crljcXc^#$&ow*_j388p$4kb` zdRogCnU8(it{I&hcnOpk_&Rv5={4}<2hx|N#8>6Y_R@ffEb zl0e7sVI)HLnKv?d}saDYTn#ox?bfM z7(_!}<%8s8t`BL&-k?fyIS)1s&CAz7 zK~w1dPzLr^rf&g#$_lUc>!&hM;RP6@?@!MU3=TeM4QzzLon0mg{uRlkF%e<&; zMTbp|aw3NN4o9PZRb+BfJN){ivx=47a!_M3E37fmS)P8mQIzP{oV?5L7Q2Bj5p1DOcaW- zp?@krBu}o32vBgV9zwT3Nxt9)mE`)jVA{`#uHy-ZHAv17ahE{E_dvd#`b;}Tl~yNX z%iBPm!P2KEXHpacv@`rXc@g~vJP%yTeNN@hRXK*j zn34Ky0a^&im2CxDzeJNbabA#|ug8i#KA%T~ae9zkz|%xzzzcblQ5qcG9N4_kZnU#j z*s&n~H|nu~NIv?$tPY3dZO!`-qyuG1+vgil#G)Pg&R4*K@Ul@9qgm#TDlB$5`bTLx@ zdYH3XU{hlKVlYR8ts1VT74^#i1ZG1RBe)kRdSFpAOT-rgndpNCi(YO~{7otzm7PZ> z{lsQ4n;ymiUB~c8825x*##cBPE!!ssEHpOL}nA#SFNZa$mi%^UWrSdT8*qoWGvj(#GU8rz7gkD2 zF&^>QwmwmP2mR@ahFLhl^yTv|-lOKUur!62`AE*_l%SS1rLI+bWDnXl<4}W&51teg zp$`O8Fmt5_+MH5L1I8i)2)%U}i9C|_8&$Ifey0Srtau6fXMM89_id$=eAm_agWMNt zt_K-?I$XDM^9bEoE(#j|72GD1x~-%)aMyg*>zx5_`gER#?M z&sJBRtE9iEPFI)oAYUKJKCAoM7rn+s)wt;Et|YgCQtjlTYFtz^E-)^bP~SVi8-A|iV@K;a zs>}PVLVYO{NHis=Wlc#~qc%n~CV+eBH!-hn(ELSLFNYqEQhFpsZ&e~3vNdmd5nbc} z3tIa^qXV!oU0q-|HyVBES!BLgN%02{9jK*uW^#GH$wi3t#a)s@6YO{yeGxX4SxR0g zg`k}1w8!!$qfNY155X+~>?!I1rrN^5^iT}OcRSlfN#?*_SkkIaL`AcIRgcz8_Gj~u zi>zblY9OUIaoJX$pq*Y&c5~Z&Ko)Q5v+Da)yi2B`;WliND=1t)ADH<9=_VL}xRX<8HUcH8m3Gd5E=4l&#&C~c8jo?y zr^PU4_8B8ow1S)U%xx-hxh_LRob`5iMV-Yf@w4+t_8f8^slR@GFX2l+(_NJ zDnrw!&tTL+7u3I3U@Y|Gxv(4$aB;bd>dUKn`HW%L!N}w()M(;`c@wLO-CWtTeri!9 zehmUiSum+HFOy&A#{5^xcAV2T6!flMPdCk%1`D zhkEBQQlAPNE<_j*FkA*SG|wV^0gqWsI`WtpyjM|2DPApnCR~*IX=*{a{yFM!+YaH- z+K3#h)kW3B#LSw@@xIn#*B*`IO%$QSplt+QN0;jtcf-2zJ6f)PoW%dvIu@^*EBoa^ zt5!<3OGx9gn_+S_&pqY37vT_Bk`v)evO++WAYQK2>qzxhZMS7|Pl}Z5z2H{eX38QS zZU4j-3Z0#QkIgor+4*pmov(OjJ>S`R`IJnS9@W(_NGDU-^2uHRY`!hREN(dujf%q7 zNgevSA4uuz;b=-w%hCqTSc?ThVX#<{hv^%HB&cO+BpXlOnbkw)T zYQ>0+E!nvWsAX%3^nKuL3$|VchZc7Vw&-!xZ!lk%f_Ywo5pWwu1mW)#GEI^lx-cu$ zMLI_>CD(zi{rB{ZJTyha&10k4+|ymeSL(~uM>dvlwVz5OOS=RV$qTvC?6Sby6X^r%7}v7*m2;)+~EaKZueu)>|Fp(Z+du9gB6A56MDF z{*U_mAozl#TKY*F+2!VoHM0HYrFLrwGq4?w=2p$2%&ni&-1=rXir3JEws!$7wX;2^ zVw@B>Lr|lOTcOK^w8p^SuHIh9uWeXMFeTy^FDA~(f04rvED|ceXx9Mhc7VF0NF#0wR zy7sT?_9iKh7_=@_Rum@8YV1?65bGn$uax5Tz%85{n%ebN1v~;^cErQld3+FW0F-T< z2k}uP#M`UthoCB@Al{#jYinx#*bW6+LkM!5?42bWZr(kLNgfUXvmI_-SwG&9nV3Pw zagght{0XeMhcIjD7qeO8aw%0qSGU1H??tw8_$BGodq~B|KrT$yUycUCuciNy(RjJh z&~+A#FYlJd27em&!3FjPlRK!QGd_N%>8ZxSsnkg))zYt6Jwfvo)ZjOSfX;tav@sn~ zycYgiX93OiZ6mTt?;>kTP|J!B0Etf1vZtc)u1z7HHAa{tu`9cYucC13r0f0G+0bd8 z!zCX!&F3jmiW$sf&2xDM?+1QE&>;CO<%$jH_)PVbPhGY*zL`|awCKFIK^Mmiy@Sbr z7i|ra-%;4YfM=-{7}6-lAdIyz^hE>DR@VE~KtU}lhC&uA)L1vY2a~-%5s^7STn69p>xl3d$|Of`g16*nZ$m?aC{m>b7x-oU**_^)%^U9nxChd zKcJcgZRrxPgKcx9WMeAkKcErtEm7L0U`FVI4npUO(1%1w(3URoGet<}C;aXuHv1B89e z1+Klapn0K^$YqZ0Gk(x`mvUj7|H!S!G1D6)e;~yMx9}@fwzwZ9-Cqi8rCbP3&;RfH z2samsj)m3yl;~D&UZR^Hb96IoUc|H7sx_JH%E#1i@fNZshe@_xNPZEK_Zy<%V#mpc zC5{%h-pV`P8b&VP7ypFOx&&GQQ4rOd{#gz88{#KSK1>eVo^i@uJcz~`jP#30-_~%G z!pr@5E6E9UZ(tD>NQsO1Qk4o+j(CG0I%HRDQZVmWBYMeq*|z7WE%9RC_(#)duZxG* zH)DF2?i+tZ`lvQ_WIewlOX3*)sbAKlIc6cU`W0krVhp!&-a;GF8T{XS3OG|kBWvS9 zf%B!VxnOXo4>$d*`aB{H-lwG(#zk^BJTONw7NXXRs4usOO-Q()j-Zy+4(jwE&r2y$ zNiPPix0*=oeHoQ{2NlkNhAF)qO$pl4MO)-!F#7_t4cV5q*DH3kTa_!df~0B$>A=s}{ze;<>-#m~8jd+CAu>S_Y000ysgf z!t&rVdal;0$vr%{@te%=r8dfSH;YAf@-C1c;eHU%v;Tiocx#j6HA41o77_2D!XpAL$dY6upXhvB`EC$rhMM2g%pL>8mF9a_cXRKaDzAAb*3@7JLFbCflw3hiJqO z&-RCYElj3K$8Um4_PmWEi-4{8!b3K2OJ>XfVtS(o^Um$s6XM>*-ki(4p{GOJX9sEh zJ58kMXs@k}en|E6yx}PjwdWHJgxWlam6dl>e`** zH`SF;nvMH2;ohI&vX>^@Z|#EHqcd3EFNFJT!==w3gjn-RN;n;wp*Y_W1yh`3U>I?l zJXiazDZ~`NjdlsP%Xx)&FgD4!uzq4M%j1WrpnkWWux!zkiptmNwlhhOzzYXSIX)JJ z)2HSmbRfZz4!0=X6He17Zs2BMrF+vwVDxe5FYHeHc}%}#+;rMT_8)$v#=V>x3p07S zRWE-)VD=xrOB)lqN-?>TH%@#0Q}X$~$tP%TM>2lc&@Fy1RpcJN6-UTFkcb|pczmox znZl_G;;hE;xQe6$Yg_<)N#4ecP;>Q@T}8VR9J!;7;WT83x-48Ac^JSs0njl2y%X4+1%?vQshi7PLwSCPuK#o4XmYel)#m;&M z#{YF3?dj%6FR!^Gkg-BOZ0=il4Yq7;h*1b_RFde9hU zP=_HQcm?^Hq|$t-X8qWZt! zVwAIX0|PMwOhkDO@@M+%*OcP4<$se&fBlcc;VkB_fLna2^I5*(v*3rF9Q06Sa4b}& z$8E<439<{LigOF6ug`5{{0P)~+}nx0)xq%Q>QLq8s%!J2`d)Lz5#>cRS4tSQpE1M>NqlOB7Isz&~_z}7Xkpp5T^K=Mq-s)${4!GZ&Zq2-71KSvvp@;FmxY}U@N-)rAvEbSG54}U6r9TGUf_3}rVX#fBy&PL7 zx3H}?K}Ut|IJyk1vndrj2i9*gb{tP?RF|A^F-j)Q@d;p#m%$x@opPCwjmXiA%fTHz z zZBAyZvrrT|V&kUm7vG>E@7-?u0T>#hH=#{%Ip8(`GmgVC=GRWF9fTS~o4uEsp-6zDXH+qtwGnr6o61T2`|G83?H z_Nm52(-+UgSUmff3ni_ugQ|Msl?Kx+lC$uVhE0t?5 z7&=uifw=PuebsJfi=3O&`OZad8{6@Px6&2Zz8iHbH{Yfk{@&Z|UT(gFyW=&oy%bCf zwok}9jT1WikpUV2*xBfj9Q=mpCU?@q?r29OXg~XsIU7Zk%tJ4b{)${1#G$ zjTu4~Pc|8qWBdmN5j)YWZ%!)Nk<7JKaOsmi)usTU{J=qAoFKywe737Zjp76zgUy@= z^=(^6Zz9vhvX@Y9mGLN8wv4)zKCo92v5jvw)wTL}v~C3_AI9^kJ}qe&3u;;MJQKj8 z)-6VVi9clzZJ*(t!0CsZE!+4$hWa_M!@Jy2(pFc<>qy|`OP40UN8X)`>op!v2><~%)=%#{nR?t>`DNk%9~ z>;??2U95sP6$R@*(zv=v;|hVwGr0wiBlAb{v4VehJQ$P8TMmzhP_~G@Poo>Ivz@v1MS=jjm~ufGD1Rwkds?r>k&3ZJM2GN+*xdB8U^SCESRR1 zoq&w6%C-AL)A$k4b>|*Gqp^td4wQmL2()F7h>h zZ=jA1c^y&7-V9cv6h8`=uHq;6XoTc) zDVZH%&^Z31Af2~cJg2Xl!1LqtAQy$s^J8^m?YX%!6kkQB-(1ma0As~iDeHYqkFzO{ zUoMDQTDJ>!jt>r&JbpQQU1-<(G_E%9ww&bp#C)FiMCG1<&oiH>+-~{wy*coCPDi=q zqci(Odc}@n)-R}($vK@*_hfTO$rBD!Ob3qIm=5MRoJUY+C3id0=8yDK=7Nqg+dqYp zB%d`5$-X^jycb$7_VqAjULal*)9-W%*gfe7x%Q^7q4WAG>Fp%?IT64R?k`v5?S=gu z=H@oCwC`#kee18(Dub1qYn7oYmj&Hi7S>8!7uCvK7l&N-tm(Q}T7e7?ORC+qQmtHr zkOM63PTv4YvX(~aNcPl|UMK|u*1PcPNes1iSq8)O6F_fOx>g<1mQS8okbbnCpjdx* ztvh`h6_{LC8a2IG8;*V>egar3oG(Sr=`U?w37T(YCh;5U2u@#D$j!cPpf^hu zm3u@p44!?YH%eVRZ&B<0)^E(k_OLSL?cFfO>DRm%dM||v8$UHaT|l`eCZgoGKEO4f z<_{OQ3(1=j)Uwh=LcL3__SSTzk^XxUzmor?~f}E4cO(It%H< z^hl^S@1Ph>Eo|~}JnL@;FCPRc=jDik7eQOPJOMAPd0h?CW6l&=;=6uBZA|urZ#z|# zB2Kn8+fc%5AA(f}8AwwXk!mDDzD2LaQ3>y+e!f7(B;)P~9> zH^Fg_f|*CDW8ai{Jin4Y{zksb3uv+(8D_giq$^=VNStj)`E)8k^>D`gNu;_ZS7-M_ zk503{pmjGGxgs1RMG)aBK`qM#wPfyt*2g+fk1bFIwXFDs8XZ9kBT!I0u0RvivN|bZ zJPOo}1*)JeT{4PtvY6DxJ91Z(f`kQt`htC1y3GZY>_x%Hf#q?w{C-d7kCmFNpm+_w zxvy??%yQj>()Q2i_PU7yR2(JrRwIO0n|=sXd@(AxIUMpEDu)hUY&vMf8ls%+r_xUD zEmvpY!tbl*5nznT-Nt~Te_S2I)N!TNA&^=bUHv6kK`jIb2a_?~%!U#RHzd|KrtA2e z7z2B+-R=mc~cxkqj$Zt}1XZq_1o!&th7G#>(7hp$>F>=9>&S>OqDl%GsAzb>l zvS`zA3k}vY(ahLO>n#k{c$@fwJbm$nyf5s*V0oW5zL@9PgTqHPT;JJ42maaR@M#JPZ!ou;3ka%3@qOz_p zd)+tmNaImIoo3k%7+-wh_@v%jKP%f23zGj3)f!|Ur)Oh3UQKVNPvg@356P)` zkG-L!gCX-T=Q6Yh+BAv+4zM;B;#0b?k~B#xc$IHL4U%y+Q2N7(M+X{ACV;^O`)m?? zkg%xdxCG-cvh(dXAlqPI6Q|~AHCw*uq%-Jip97ugzC0Pak+>dUXm6goP+4eSa@aKf zWP@W*B8%pR2|CNcfXd)44CAg%fAcHKBT%#Gb&0iEuH?u|M?Tgm<8VJMpF8{3o50IU8FjKge9GY*~TSHQQ0 zYMrt07HYf&%BIgf<4=NO#q_z?uO^4X#8C2c_~~=aaG-fXaxbuv>}9(9cJneF zWZZjfrLMIHchRT%?9%k3xs{C{p!{u0N-q{#9RHoti%!8X7MyPJHh~jL1%4(Jm+43o z7TAYIW1*#ngcBX=zc6jQxN5TeAD**ES-j*MT%0bf_S1tTfvuUnW6#S09)v%X{u+P! z*E!G3d?7WAv=MGo9(J{6=aYmAKpN29H5D zc@gE^xx2Rd)>g);+8Q#=5P-~mW%+0u0Dl5H#VgT)*`N4l5S#0}jS^ZIKPKYCAa@F~ zATE8!`#7wVcG)A6;C%|(X`k76;<4DzU}72IAbBow(wBg=_Mao8xSqoCO8~?#)i7f& zb8VfgciugsHML+XD<-|}pNVkBhwwTEN7$YrayQ70?0`D$v~t!6r8(_z9c`nl^vZ|% z_^#f5PRV&5=Uj68@?YqVUJX40G`Fwfs0!XQuPZ)M#XBfZETDWx+MmaJ5E7%LjSpffMrIrvv*4Rd-rv;w>B3=4>=Jhm0w7=KqX;yXpeYM_NpM7IFL5aePh>ERi;cL-l0tWMUtCf-7!yRgseOqFlcUt0_$=daARL^*h|I6Lef3nIQJ;+~f24v`zrtC;N zeX2_<9)sEP9+7NJIVTP^{$xm!v*1C>J_ZP7{|Sxntp<4OXOl4@BT$+bSmQSh^_Q%7 zi&1c2X<*afXbo$mIR|@WgQ{(h^geRLwrcth_)N|rp#{~eGQ5E{6NZ;O4}=k0a(TbZ za8?+O2B<~E{PbLKno2uK@!2Z?rdfRUibw2&_A0d``K`708{kGvHhcq;>@6rySFeAW zpd7EcTq8ZKJnhG_r*7VKWq&uT?1ld?%KqNU-Z!(}6J5Q6Qt!(juiih*Dr@!rFJ-as z--4|9#r8m3PWR(7L({(Z3TMpXg-7QeW#+ z)?^v211X%m&^ptVcYBwAlWd&ly8H6!MU-&`RSrFqo9iNf?KTW3UXga;v(f3q;0-5& zh1S=Rgf$bClvjeoJlH<0nS^~jm^rab`DI_fa){|#UG>+xJwwi1Bfm=+~7pZ4fJ zMZm1L1QfkRg})wS_QoV4SJ2)B%ylsI>X7++C*3pJbWsP-PRF}?3gSyeJaNRYfOzZs zaFI{r!^(UEp3sz_meqcr-@VB1-W1Mx=rRB8pC)r_*;Q>0m|pbV@;wkyPsMM(hsmVF z4+tuky<2mbEx>lmEFUhPE1$WO*&lQ;yLZ8?pe10T3ozc&7cyS}M;1 zZSEUEGrrp3*Bf||aUX5U{mo_G@FC8oE9S+!pf)Apta+QKkD&vypt42ys0yRTdqo{S z!6?5+U`s1M!Gnny*DDEv5c#t)hddI##9{J4yH-HJw5#)ZQFKy?+Xv;|^8vEqZFC`ts+mzK%mc|qedp@5qaVRdA_55Yz zPfGAwJpYqvsxmG!5N_AAXi68(?krTgO<74(gvmeKce^UDr91LqKK`TSVHaCM+sryj zR)pQS2c;wB=0n_U4@7DC(gqOT%N*X19Nv#}Jf($a0PYVfExTb4@UbBaplEY8YT}W? zK@oROUtR!P4lmmax~|Q2;0i(83g>rZtaS1Uqo}jjE`7zU^ebnjUo|WJ>RIX6%t~LG zrP*gweL-@S1LXCw?_)A8^0&{-zj}85H8b;HH#?sf>O?T7&t8Pl=S;=5JSNx8O22Vd z`c1Ra*Uw77c~<%@SsEP{eL`?I7=%4yOD8)VLXm!}OSkcf48vj0-`iZa_9dOX-kz7w z((jm+zG+taowL$6yEL(Kqi4q%sjr}a>+F0YeVzHY&!YFPS?PDrN)sHDz}xk`*8uJG z9hT1f=T3)S^w;e4U0Hs?@B18}NWXtp`UA7lA9U$<{U0(wJN;ox7xX?dtNcf2rSEp> zod1uxWWoQ(vvfi46Ath@e}40mJaQvUq}!);GXt0n+P8HM+Ru=SX}*V>-dR#o?;%OF z6f+wm*eEv4@;*xUgy7P?PZJL8UrCtjS1$-^V=-nzVwD3?cr4p|GrCW2r@0NMwl;ST_o%RKM zJ3HM6t-1?_bn&iGbF{Q7s1;+@$FRZ0Wu=q&5%BuZp(?#yvjQO-v^e9!`sY}Q|bOX#btv` zThO87srLuKop<8K2PC|g=kR_KRG_lS54mJxNH|5GJO~^B?Qw$Q8M;mnO>&MwmC-jr zB>Mr{5DXsB!(;s}4Z4S*u`SckAaw6*b!225{0OWdTqm!>NuZ?n&)9e@)ZxdLG#Q|4 znGQS*knw`dr3XK;lw@9VhQMBIi~OOIUQ~-ltzUlXkhB(;%m*cNH`ItG9-y@qo1vkJ z1hRR3uFXHA?8vBhUM@FroiUjF+|k{(YhLmTp~b&6gxuad;?Tvn>4#*fHawcaNBjjD z*Czi`@++62Z%MFv@D{Xn<=5ooq3p~OI3@ZG8SeWwEEfyou!+)+>1y(yU~uqABd(hK zmTP~h!qGG{8QH?J+f;3ql$9>lkV!vGoL<{)I&PS1wI~Iryeq@;5G-4rq+7qmI4*Pj%Q**Aa2m)8=P)R&j@A_kj%2$$dd9&uAgsVjw5@MtV0#LfK4gGa(xrSP{P{A^f8Z9J=u5; zfOf>G&Vw#-DnW@Cz3TDeMJr~Ny^vPvn}1JS)}1w9*-_T*uVDyy%P7~q^D+hLlh_EE zFy}{E7h{W@@>t&B{26%|&k$5wb1F8e1aT(aY<(yHfoYn4639MnkYk;?JTg43W35Mq z(74dLO?IqeI;=UV^FLpE{$KC;8dYn}#n9%!F=Ii?R$s@R>4hMvau1t$B$+;+%@5Cs zSsM}d=y0UFvZcI!l=Z3m-6c*d(>^OQEcUY^J)lM5{IzW|{1l;zN{2)Tza^v7ZQtYE zUvyaf;#))$3N~d#B}4a^>_L{iFO4?`swQ)Raj=A|+k0C5OMVSR-0(S3Wo7ln{Un%K zWEWiAlMP4sW;X5A#eq9w#6Cx_S$d4t4{hQ z6V)v~C8zc~P0XTNsSmkK*1-a3?QIZZK}zGPD48&I$?prcE|jTWsFdgZIP^ICgamPiDS&|W-_GVnh+d|>p)`qJecg_9-ZZ9WB9yHvvb0E~C^<6)kr zRFz(^iKc`D51slb`+G352wG7WA+!@pI{UF#>(7|dQoPLJJ3AhlAMs4X?Ri4nvmLQL zd?OQM`q>eKu;fXe3hy>=jVm{hBa;?xkv=J10+p#hX+GFj?Gcv{)!t$XZT;orYB~AM z5iUej_OlyD3;vtpO)P&zaO6q4m73UZ`K*88%u6!Or8x#*T%(jQqivk~bFB++ut^>G8fhMTLupZ%yiD0bLvnyvvEjb#6j7+C>Q@$LJd zoqPCtQ-OAg#f&b$utj1*8yl`I@WSCTU{?D~+&~{fiAJ-cJy{hcBhFU8BW^97$0k@o zq|G~imv@BmZt~{)mADdmoECrP=p-2C3~2qKcT^=4z8+DCn)6^G?<3*UMI#mIo73Hj zeV_Pf(I3LU!sy_I$Jh_+8;4W2GoHr^XOI|7mhJNP(D!b=jpUWHz21ULd-2M#nu*E! z(z?uv+nP~|u{hDLP00F!2&39r*|j%H$w3s%&Ok6yIWiHj|6xs}fqDB5gufHuk3K5L z>p+`Rvb{9NQ)p^CZj+}8i?>A?$ytY&`GqnPS_T+B)4Tl*j)+Ue_IJBrPQxbj%22ft7*0iTn$H_$<$$GM*@jU=?h~#h*`o5m()0q-( zD;{;5)85X(<;X7IoHo|iv{mH*do&F>l2Vcx+x0%Zy=o z!_iDOz>nW(bG6hkWMsgQVaO0obzJ3Yqxs%d`;O9SMZ1`q%-|XCLqo}*VRiYWL=3}D z1w*5Ao3t_S8`-N3;G6-S@{5#XI2l(nX_oLE{sPr|G2Aoji)RW(QSlZKZT!UpM4>CPSLpMPR~l#;nb`-;@2A4k^He^0jk$xiEDRG& zQe=ma!sH|#9WB_>uV`HfBHsMol;rz6LR8#~;}|?9r_RJK*7VYKjr;R8W|H&alDR}L z9yrol8w{=NL>(_9a5VDUG@9FYxFr}6_UEz!mE<`jvyZS_2!VrH<_FhH9ZS<7ex-U| zDsY8U0pzv7do7i|zBxQ@p7w{HA72P9Kj-#~B>4W(bK$Z& zt07nny)m4e&V8g(N*MX{gtIB#7LQHZ^2y>1>hhc)1I^~-Oc4!9p?=rm@{`my!G!@t$q^g@!NzV70+VgVb$z$meh4?6JKJYIJwhiycH#iaP&@GS0Y6oZA(w_zB3&Ge$;^-r25BH)Cb$yG2E)S!Z#s<9-ElXx%6=Xb1c}j`Gdx3Ys70 zs70lBUXVcoULyt4-Cvr=TcSFKv7LQ_iRF}^SLy)B_GTD4{8ZJ)D@Q{d%`gXmlW%&? zgcySU5eR~=Tk;dMX~hoOp}xx3uq)GdKxL{6E=PZqFaGKhm=DO;n}SigMd?84QnRGn zP_wLC5Z^2oq~mJ$RkSzV3N9|gX=L<_OLz5a^0$zxB(~oB15WSlDwW$C_j^89o6d;1 zUIkbHf;(tVXh&nIx} zSOJFU3esV+jc10ac)|Vsq&mtsCha7C71*cLYa*R(Jbi7~wwTe$Aa{sTw1p;x6#0b@Pm0>sPNs;u=CVGx+e|pu~_0L zs)NyvKWsgl>r1bl_kNq?xiL9{tegc|neqUyfce43HqmZDTNU^sr)nJ*RN_xjPQUiz zC^%6N!t5(|+eA5F^;b4^+uS9eMtfE_n_R42!Hk+ao7&NMSM6HuY?Qa2&+vCYQtVn- z$@Uj2VQC=#khReDL1<@ZZ=)`~Q^Ise18D);$eJ}%;J|ZthN1RL*B@@yw%if94C8rJnv=pE~Q^mPVHl^~AnF1m+nhgD5dbA6loWV!1#$}BXAGOz6_ck8Q8U;y^R&0Z#1AJmm za_AjDLvrv<4t<1eR+2e85BU zk}Kxz)=Ku`RS)D%d~b2$^LGxm#aFTSfy=C|zKy%IiC*70l&IHr9KBY~=EVhG{ipNz0g_wLxJGn zyh@V6>nfC@uRD8ZY$*uycp=NAkYNnQBk&tms>!P0r`y|`f?pNS zrX9YUuaf7$Hm>0loa3#S><25jYBj4AO z;?)835AGsAv^gWj1&vZ%GW1<8QP`baLt>Ji(ldS)y6wlW=iVL~d`O;+bDUPwiT?7u za$631U&2ge4X4y9UAqss+4RD1C5yTZ#cqm8Q~3D^8|;uX9eB6Xfzk{eus6jfV?KRh zp3%%-`o#9_Nfq8D-r4s%9nkynKm9}QC%NB{`VMlc&&R3p?U&!}*OB>}Ca#`aYhT!Y zbA3u$km657Q*tMCUa-CCBl)j!=^)>KA-~w@$?}yh^0kMzo^sz453hxX`Wv`d2x&^Y zN%bGjgsHHh)PE+t_v-yX-rT;EdpOl=EM@+0k9`jb(tIE2TAC8$enx)l5^&+ukdTwqAjV^VgeIi}Lh-?>XGRFP%+3C>Dd{ z{r2{t3))y5;;BrC+k)gS;4X4$YiEAP2`cs@l)3xJpb{)d_&q`QimD%f4VHjkZ#BwZ z9U`AcXsk>2$as_=d;okr2p@i94$$S3Pa!?RVo~j|w|Y~&6`@J#^boH`^QFW_4W?r0+|NSBH$qTH^i;SrT3E3U@Q!`k z)qRyy0v8Li&eqvGiqMIr_}hA*j*`t0zfzk_XS8-=r4eQ8JnJY6S!ClZF#O*b{#^88 zxtULNEIktc86^@>u94v@#;yM~@!O$E{qNvLrq<8$Y<~+K_Mh@M{H>p21(f};96w|% zX7xJ!-#-!lkJ|X0gHyB#r_>Qq`jd>OAa+QcgZ?qtFm#hKMEYTuey64LvGhl4CkK0W zJC;}-%@|7}nce~rF{q3iOF6AS8!b+P?v~cAvuKH(lqHd9sf?p_kKYhs`!;Sisx@Hb z(Ayv_CAU+=I{0T082yspP+|K)&)wqN2UDy-IsUmyxV{;I=wBaK*2Y7~3YR4rVYW=y z)u$@=-;ZC;8bZ1Ebe7Zauz!cDli$(rR)5)k6B|<5-h39R`wb(&ZKY&O^?wwAAbzZD z%aEYiPkRaRC67X~IiN%k?@MNLzGXBAxtXme&M92QJB6mZP;@sO?N3A$geBf(vAkp{ zY3*S|#FP#iIU(d@CAe?>WUKknBCSfvCJkmsYpQduaTG+JJSN!%r^6bHr;o zVBUN$S#Br0GfQ&RT&g+hFv{t#Y)1`)t3F3s0Gf5P^p?h=8 z6xuoqJPUgCxe2slM~LVlQ>21SD{RJcz_jPd$~Wb$WF6jH=C=r){%GyyGQ&J`4y)b|a^{a?@)qd5#q?J1 zdA|?jxzt_W`UOgHWYZR%$qpUIcV;K%WW0X@StK_Mt^~tXOMc zjumruPH*HZO3vpa*oond{BEn)029;=Lfh&GxHJ>w$N|;=jAj7QW^I>rE~7NbhKI3a)rLbT6o;?`7VY z64bJ$7VyL#8$sxWD`nOJWvNnjmAMs8MsV6sVm1l8$KZDIQh-2ESqOh9KD~h()a%l+C*! zjlFnqVHSHFWjB}s$Ms@#Y(31`j8=-Tu|8!v z8=iasezRak4yIL`~6jJ z>;2S+PRgEzHg#G2F>}L~4&!I3g(~;e%$BU(S3Ji5g0S=5)+yxD{uW(gIU3wKZ5eT)=*mEi7&FbADL)47a8?g@~6*b%N5S%nK`Lp4+vVPH6sf zUFR_Uz!an@g;AZ0SM_^Wa-T3+eUSc)#?K}lCPc}j9y;N}+!^S{h>-PG)x6!lc_lIl zLr3vW_+M_z(vf+*3jjmpe3YE*!_ck=-Ab!g>aGsOCr~1rF|OaurW;kcxuN21X}B?a zp=*!T!f}S`7?tE>l8nX|S=D4Uyi}8?aUHbwW#9FCV7DeIYu`d| z^-->UKh4@_haTM2l+J~5>nJ}y5wZ@0=_CCBDcsq4n zuOl)+5J zi|AtBt2~9)Y*PDitmLx$>AT5qt|XrYzIpAk#%7Bn`!V{^Y%!-jgu@aX^lWlQLUQQ9dCjcM~gYiloB`l8*vd=VpB8O(?ptdm6*k%e$_wOnRV9>QkU( zJ|o{_=%!$h{Knb1BK@B(tr*%NIiK-Ws>9ZuE@rfJ=NT3>a>G4i{m}N9dstlw$H+5bI;eL;co0)pYiIVMQ$|4dsxjzAby&JtG;(* z@)Ya)Rn**$Lm%wMq<|e`vTAYb&EPL|W)cf%B(upUOwMp!;O4Jc<5Dpqg-)K^F2Cr^ z$D!bCMz{Ib>dK(Q(UtcJ>B7;qPGJPSLC(J$D;VrMXt0TuV}UlfN*m3KabIB8>`fo3 zMB!gwmGQgQ1ZQIoI(JHNIdyFMYDALTkQ>QMzb+dhsAWw(l_$5Jew9j6kNQxq{ppf3 zYq6d4Ph>kEck14DpGhf(GQeg+ir*lMQ*-y}R&HX0=v@2(frIp$mL#5vrlj|ih`%Ms zdOv1UJKCakudR2f{BQ1TUUtsdoyD48EZDLTa62YU&1>MFn)kP6SRJ-3E62B}ImC5^ zpu1t@>&!E=wj~FGwVQS3V*DvZj?NZd_73KEV7AE|%uk$rSC1^rOD)1-rOX1V8*&R+ zi93wnZa%&wIXnBepErDXX8+>Vrs$eWG;!+BZ>Yk+yxJgP2Nkzc^#-OJLGl0)qs9C^ znIV^w?;Dh~p_Y;#SbDR|Pku-$VZ$)meyUzIP(0u+$x8jsR*iQqZC*NX^)IQNZvfOe zfpAIvNG|P}CA}5=TZIq~)n8lW!?c@uI`S9PZz%Fn-(B(-*56a)bC`6O{6+N-7x{18 zP5$Egy+!_;c9Xwn{rg4!^}EU6tNzy_pEtXAseeiRUq$|#cay)gyFPy~7tmXFhY;15 z76>=&4xy*coRW!n$LxUHxZ`~b2U;Tsv;l|w|%&DIvgp0W77xZ>%<z^wS-myD`TK!uE!e;c!T#yb$SURu%+XCUH-BIYT|D!;7=WY;U^kZyF11>+W zTJ{dLQGz1c7@c7@DnogkCp*(Q!)&aD3})j1-O9}aMN~HYY;2UXADo-lo+NJK2Q)aS z2OFYNvLz~}yOk^AX<2Mh>tLPS;wWSuKV&}VEc~E;Jvsm0!5;Rl=?lO~*(ldpVv95i zv!~-lQ-aYJQw&PgF!>*5E21<%w&9%lokQLu)O8Vb2oY}C7r8|PJ#$L-#A_SG3?uuI z0nU6HAq6F~z%!9%em54HBOMj?hlBlUXgCqAEYQ#laQA z(+Ysss`Daym8)W2ONH;PR+689JiZbd`ueIqkrz!4lj;tWpORx@AXEr__SK_y5q|mW z6n%iyp&i`d#0#}(zo0Tf=Xi6fj_oRbeT`SWss9kvNCB9c>ea`RV8QZ^xNb{M> zfEVe&Vszk8p089}+f8GJ6;_yV-ogDI*nn+c<>3DW+_UR)hHpSvyL-JSJtJ>-+1^ju zF8UT8&q*^<6HY<6HqH1bW4lciZ(y;bqj_1!$gY7-`a6n6VSPEqE#Y7U5mkm+l>9-D zQ);IhAB9a~Ep(65hxYWnR@TV@ZI>Lk%67uDj~w*64k zvrrftFDuh;s2`pshB|p+ZF{V64q{8u{jN`PoYE`PZwdd<3||S`Z$H+t=}HahJH8RP z4+!_L40pM3S5E&`lK`Vd`41|8z4BQHX|Dr6@lO=R;Bz2D4pW3&PUnj>q#W(!FFbBP zO%Bn8EE0qbhqnoka3~^jY_d1DP#-%spG(jGl|9R^WY@s{_&7PoA)@quxbXaUJ>%;~ zDI4w4)RC|S^q+#VgD#AndVWk7eyJgv+Tbv{cuv_z7Dk|F_JX67ujfWnM>!0Bry@!# zT)?R6xm%Zr%hb^hgRRgg6zbPh|+~zrjBzMYz{^#-&7X{n`TkEmo9u$Hk#V#F!%&)l=7)pVek>v zC}qzpO8KdiXlj$g*jIq%T)-I7GdogI8grRC-eIua6s4nFz!=jrdqq*Yg3Hti4uegh zD18bSFjy-_=~H!KyCa%n1tY0HO@OC!;hAlTC|#oq8x7IavmM5`07T)1F{$UZx*Wh| z>LiEpGxRCtQ^3ObxtSTwpPJm}Rj6?LySBImNPQ@FYA6OE{Ie`Q-WGn3&kz+A5s2B zNzBHdtpDa#rwH~>G5RA4t>`-RoS-LQwn#=Pe0a2eB%Vr{FFdU)O@xc zgC>i96HGYLJng@fCT4%$TbNN0}cu)S&MPEE#on z-RA`9lFRewXL%d1%jb=Xw~l(>Lc2;^-lLf}OjwLZBOR?I$Y$&$XOLln>a|*D91i9^ zVw;l|c|%XlX;*D7zOhZ)Z>Zmbge9?F)G|4~yF(zAcGvCNt}r=EjJb2!R@bmMw7;vX zf7MFw>+)at^HJkJNDa>hJwAs^XP{EkMEpDh7Hi0s=7J1ZEF4?1o*D3D1mohIGME{# zSVFdBBQs#JE^NsxX24>x*ODd7fW-o?CF7R?i)Cj^_AUb!Ysr>OTm~!_h%H&Q3|OrB zS~6rAuvq7{WV6ljWaj z=}kp?qooIn^g2u5Risy0`h7)u*wV)r>A9AEex6>Z0G%JNlsE6YU%xZH&B68)UW(05 zKAYFVIW7?0QD}2jr&(_~Mzf!6w8D!JIbVGL3gbrh*!k_hCpCrWOQVXx4a9%8+E5lTr;KFIx3~i|7=^KIgx`+t>x6IQ>V65r%qLE(yEXHhq5PeyTIUai}ks) zs@eAh;&hOr&+ztyDRc8q{CZ1%UPxr%|7g5<`&*D~Sb}IT_3}64mQr7P_)j3e_lwVV z-^RqBL6l7JOxgMQsjLs`^w-n*axuzjd`4XkdMwV*p=TPf6?uhLiyr9b53~aj+Z`@l zAh&-}8MQC|LCf<3kQR4ycq32eL`!}~yz`?HX;}QQ!5#ywRYzfk;PKYlz>jkK2Nb~c%pcati z7Z74)TCn$m=n?RL!srsBe1f>iFRDaMTu7r9x(0W?mY=@yeSxQMT!^PXt)^8hQD268 zg~l4*q@?}(=FxX4(l~Q$)W|O)o+N0i>PtW4N5tp^chGR$qLX9xL~%6j$--UATJmu; zExQ!Q@;wz;&d@>mn`APSu`Dnbm5RpbFeBEFhQ!cIo>&htclrdzQlAEtyjVHj`P;T zPjI`JOTcT_PONL;0uOH`Ffi&a6T4-3Y<}}{%hT`Q)ILY^3I*sc?jh*@Jasm4BF!)^ zj>G*#!)$0b4)aC9JhCmAlG!4DSuo$;p?ErZ8ZvK#I+4fwUV__qesn$;>Na0)q;>LA z{MQu!%5BGgL-Df~Y$d(lRr!G8*AhSVHuz_AM1CbDDhRsLvkZC8G9mrjO7lm<+1y(E zgNna;N9Eac?iBsX(|=F#zuR{FCdEH*r){SHf#Scu?f8ck|BRitl0LQZ;Kz!;mH4=@ zi0qjgtl)i>f^e@3ud_##?omtE%c56^MZIv33Xby@;aTj0l|67?w~q;K61Xku*7@{H z#ec`*n^$e69)6{GBmwbxYw^EP{9YbEy&h8Ax3=a4}&7yh*oM((qHvn{bl-Y z-){5y_t)?gI*RO2MknOn)}l}i0sRb;}XMhRfuORhyB}5Jhv-=p=BW0 zw-^qW7qd$hC~<&2T)%@Y$=U{p4%_ldiSq-EaW?5FOwV#za0h%Qzp?|8tqbAkKP|lp zIV>2m8$Cj@#?!(1H`Sei)Z^?Klw$cVU8=vTQfjLr&Q8Q>ud%xk8W(Qc5ktSWDPH)G zwrT_|fZEQ4AG^t(DRj!1t4gwC@GSj>l~MZaeF*-i^0w;GO~MCJZO+n5{~=okmf~1P znA@u}VSUGEQF8pV90v@a@uv+|20LN`D*+}*rA&BSsw_z13e*CSc5d?Fce^ElKD~vsQ zZ+kjkh()j64W(is7+z6;oQG7E38cf-Q}Gy29|?JUMX^?8b_Y~}D>U_I_n@C=RVKOf zrhtFVrSR5nIm-mt$>g+<$t_7hS6m@wj4SSnD(;Y4@}SlOv(;jDGAL+ur|6@658-^b=ng|8@=7&&K6wqOd|qu{ z%x;CDAQYeb;)a!Cd=&6X4@(_B*s^VG%rUz!xconL%*Y)(#3xm>>NA;6)Xp?MvNKtb0ppMk>Aqqp;-zjC9x%xd%|2XY*K#d(^H+&F!qWWJ?n?7(@tiIX>QX$$ z-s}kkT;lsvl#~5PO=yjSZ5-W0abwfNG7Af5Yc29@5IAV|yC(NM#-=@u6=Pjy#9yk$&#Y+t2WAa3cCUr)+X{u+MUFIR9mTs&h9sePr$ zvHH>(OchywiESjXw160Ynk&g}00U2R1shZBum+>5V5RR)Jp+08E5h$E?~ zlavl#jSV|d5{OQVvr9p5qUFRdRfL_5PY1+V8;1ju?ktB3Ya=VtYawN9K5@%fx&WKM zP61?A`2Q>T#ph=buD@QixiE~ZRCfzp5(ZatI@g3@}pUJUD z6I6?G-5knM_}?(Y&wlT;a=&SYU+u1!FSpF_zj=nAeZOh&w*^1#L4`|lHlhT;9V_N9 zevnBQ&Gb2t6FrC)+dG`o;4NfsNxG9L|C>C=SAe z@UxB->8vC5*;EJ3XuP9U)MgDaRu6ola7`o$K$2BRsEL;>q<;RaoWRM+VJzlfgQLT2#i1)ae*-*Y?2O-+@!8 zMLC?_x;WCaC}`L2N-yosu98&&;cxDgsch`pl0gN{2Oj7&tNlsR=1!2o=20A?;imL9 zGFK@rwUK5@X}SF^KJmQ19r{zOl7O%>A(+2IW%2e{vbT{j1D_Bg8xv?ClMcKw}H!+PQ7LIS9n6j^)e?^>=sNYcyQ851rJKLc4X&q zu=(`BgKw+Ul=vA%iL-b0mUj{KJX`S34DjCx@W*T&{t3WybJt+=Spoh*F}KuakH@lE zH9cAA=T6s2N_T8X#~!LBIBt4^q8|1lAFPuHo5u(EhdiH6`jp$>52>F$J#{gzl|pcM0RJwCTyF)#q7CcX~+o^N`^A(-Rc@Swuc4u?L%H1o+1S{Fz(A>&#Nok4mNzh_g>Y zw9hLxtYg`#nZ(CE8_$bi8{0J;ZkJ?il-GR~iswCeY=He=^&{zZ&xYQ3^7@`J;PX)7 zL!m+~s-bgbZ)cy1TUo_e(iLUi8~3@w(P+Mx%0mP$s2kwe6fQ;p%%r}?STm4(42uWM|6R3IFp9(x|0*0(6oDfg(wc3^;j{s6RVki z*j8V@g`4)xV4rm5Vg7j5v%DQn`b4`RyuzpXZpW2EDeRAF*C652f`N<0P}w+d`(PQ<~m=Nbvr*_B_3ZbOO8g zQU=03cw+Wqw)zZZ_ELBf=J&n`Q>F;z++gfSGUoyow(}OQ$j=9o*CSVIg&7Y!Dd9Pi zksOPSdJz`q^zHgele8LXjxwN#;vnHk1{#O(P$2ckWtaUoMcll-n4>ykO~K9sN~rcN zVmW2*qn4tG-8b11Nn>QAUt`=mg`h%s{!ysGpvbM1b|g`{)0yeQ9bWMKxD~)m(aPON` z7|u$lY-&eumLFT{wmHa~uv?2Ta}cKbRx#K?)IItJ&^NA)86HB(t9Gbp=^tE9BmHef zdUF6p`w^WQLc6$)D*><8W|xrea+S-0Tyc39q=YMjl`?x16_{aRyu=C`^8FN))=k@% z=AXvhSFzR+?tJ*gmP4#_JG3V8+glT5WG;+36|nFGA74e+OQ7pYNM;cEqaR6K-=9(ZC9mUCw_R_{f%mdc7yQZ?ZzDB zk1pcx#H~?-SKFffDJoE#WJRAq7jYjGR?tQ4*d0of_B(`A_fg-kHE+_A-vhyi{ZgNr z@Uqy#b2JUs$LPa?OY({bbo_%e{BzyU{!bV`-$^oNu)Foi_7ZMrR-j$9Wld*fj8m;D zn};LYTb_kqn(y9tvy%Y+thgnt#T65tShi*W7iqbDeOlV1XW(K@IxSxJb1JXm{*nTZ z9VjE5a*OsP9M$UNvuXyOV`unT_f5-(^_KZN_)hkKB0pIX_m-Kv{-(oU=K-Dc*U#`D z@Ay^(dP~9Rv;+SfkMH<(-9?tl>g{B z+mp8Jo1$K zg!QFAGC7HUZHW>C^;Ajg-6U)4M`MP4sdwSZzd+KFlets4*H5(_?S6;Ou|P!8$+;{? z0(H{a9L4t<)zR*T)2dy_shke(gQQQ!p2Z+~!Vl44StLB!(As>d`qQ3!2SLb@afjm# z=@@d?mmr4O^IjDvn(qcl(Is5ah|Cg+UrzlMnASh1a49m-Uj{XB%(HF4RXFZgiRJ7_e|0NM={2#SUEm7zt<%g*XXa%U-M_WWX}4X7Wyh;%oCtF#K9yjc0i zlkcSxOWB(l{Q}z3s`Nk^3vi+BS%CDHR#lzs3fRLtSKMNQYQ*=kQ=U6|F;U6xIcg6{ z{Ae?H$pjQ?d*aJQxb+v0IEmT|q&Z<`TEF~%&=$n=E!@^irIF1Ih2?(&OI*4@?)Cb~ zUf3;NPq1BVISuZ)zy;>)FME6JX3rAe~W^#zCXv}F6LuNOYGiZgl$+p$YH!vyx_FX%>czW;Bba(eN+L3lvZ z1Bw2ZBg zSk{;b?JYYkO})$X_3C>~g+sK*OyUih8C5-)J-O|TrcMrazKhF26OliEE@vfCs-V9Q~B zCh;!Aqivl&ptbB<0-s;h!<-#FD=j+`GaTi0?mt)^sqT6p{myw}e@860NjQ+l=-IM$eVT|+5d>F@Kvps>HX!3p3Lb3C) z8lsz6cGuS_)S}j@mL}id19Y~4ekdS?TGTp?FwTehO%t=D`OPwLx~G*Z9#Nbk6t_QU zP*L<)Jj@GV=McZewqCG0)}fuCrr<3yk|FHM=Fje-l)w81vibBrYIp-#etZ4bt~b`) zZP`x5EsMb}y&jxD!da+aw6-maH_TxMr|BfThurbcV~z)|A~@Efz3(9#%#TT<{ww)T zc6N8s7K-X#tdB#yO2bl4qFmEInM|@1E+x`5I#0+md*+b54@gyu&jU$@Z zi*Xeh#@YX<2X_2FcfaP)vp{?g!$uMs0y@`jAFXX76q?fRc1zpv+& z&A40i%4win0Mb1fRunIcAN}@j*S%^ph0W?NAPx`Q%Ivv#1KSF9GTJHHW6wj_YI5Nr zY-uI@A?(2U$5c95Hj9_Kr;+wsi2CScbidodYSzej)89Il%&PLe54yN)a0;OR)qBN9 z7kutMRorRkm_=B96z%@38U7bf_h%=-RPR@_Bi8g0?}BoN_-rikdd86M%fMj_>569I z8maD4hEo0ul|y4`$uBA7;U6}R()Nd`DXx`57~!Bpx&2YTJR-|z%j|U`WGz>fFa?~1 z+mqxe)aAc`zs*B&wLe6X(8m}nt`q6U#jTGBp^Zc)LHQc*0PJ*Bm%$`NXBY(UQfx~! zE{YwSz}=L!r);;o#*p`WXk~*FtDNj*j>67BTol{^Uonhj z7l-f@LVAr{x*aNerAMfba;P`@klI0Z8-a04Y`61r?zH8dKj7*Cp)5KXk-do&ADT5$tZ&CHj zKFlL~q~{beP*|StPwf=I6{~BT>N;{o+3xKB7&Q1ImNSk65alaa6GWNnQ=cWXjo{?T zT&I7rGso)Y=w3$U9Jio;riVS%!cIVstTxF<6E0>S7K~mfG~aGFX|&a<$xCB|&S`u? z^%1xu4Yv2D-L3K4LRawQ>*ION_Ub-m<$9I%FdMVIpSccT3AJ^JcQz~p-wev}ovgal zgndNEzL4kM)lH_RLx+0CUd$M;wu)+V>? z9iXuX%6Sz*xp?T^3Kf~$QHhi6EL*cFI-B6nlV7-<%ce6E4bW|d=MX*_Jty@^$_dq8Yj;%RrM1klF;#Wpy5KS1gaK~FvRDAy6|tq|E<=#ME+2M=0a?mFfG_ak-=r}Mu}&J>!FK+M|9dJE{$}J8 z(u`#9B_lFyn4{$T-_HBlw#P69?~`1rdrb6PKoWP$zMsiOe`+AUIJDh{KC?Kg*p5ek z)p!$Ns}38U9N4sFqYC%&ERB|)(rrJ|Ieyb<_$%422*c0xrj+E0%U^=LQ0GMYuf;VV z|F$zZQ{|^~d_+aH(Yr@VSQ$nGn{H;b8`GBcv>VfsanZsyP%ZmVsH?(u{ezaF4VA%m zy%F6DE#I>C{9$5Ex~PXK*vz;>(^H$sE(4;oNnkBd%c;J(2n|NAnoPx?tgs;()r0nT z`8*(g{086^hmxNXSn?SQv!0}`mn((_8yI|6ZS1|#XSGnayL#jWDZUM_w1m@)+Rue@ zoBO&Wshf^-XK)a`I`ezBAH?d|0R1BE+>!r(kUfv-=n0W7KcSfb>GG5MW*;?ryiL^2 zrtd+k1GS@RqUVlkDn1*AMq;wHM9=oeK^5AS+iZSMI9dw!N7&5iQjxEllzC0f zrb$08=@!yYF;4W^xlmqfq_6+4k9yRNsA_xnnd$ZDv(o{O7U;2Ox4yunU z0v3r|y&%7jGcjXSJeZ%2s)_u^FS5YDYmTgqn!lwYvoDFu;Jq1no!zG`6eLW=pQfhR z8M>d(7;m+19WE?_&hECmr2Q!+EVVzQglEMqdBf(coVji5sRGfNC_uUsgDv)}encG@ zl}%B}-Echn>9-gabyc@FZGU2QbwA|O^F9kE-(lcctZ$Ic8W*QnzKNU91NtP{xBT;M zKA{~~A{iCwFUcPC*uNlh1!91J>L;w__g-X{`MnQ#zC$~%6|`DJ+gfa!D$79 z2o51u^FI(eP@7n%3OG-@EYcd(CO%jAZ2>Z(<7hVMB-MN|$cD=CVA(SB=eDm~z3d$w zen?Jx-160RP%Jyjr10b1ah~Ev?yK_=ouU1zk@%Y%R_4GEt`UAKW%cs(*jcyk6JJDV z-25Z-x8)yqPRg0&R^UGo<-&HT8B6DpNv2B5{|t!H%^L8}1b9_h@@$vxn3|X!C^s1o zHqS#>DH~=~#cYPPQB?9|x)rXBHE&LA^I&A|V`-o&o9f}25c*rvYCIk;+bWv*<%iVN za+yX`&uYeOma4jEml@dXv4c5D*;&H#h^6dTfb+$g{VOoFT<}gZ%~2rveZY^|qhmgR z!15|ve2|R0P`P6@U7jd(m}lN|-bdgB+_bDKR6lWw#rM#!ZTVX{M+`Z_b$wZun)k5<3)fP(#lxHE*_>Z&Z~;)&i*RA zEe#)Q*{>#E)#&$4N`H+t zDNW9U*6enz7ukM?aRUu*&pDA4wZYQOdV(=~1WIgNo7@xFp>z}GYAExvpDA3+{SkkF zil9e3LH)&(ql0B?`bUIwD3nXBbzGEAxS^x=_Rpmj07G zV}r#wHehy>WGfk*-SWvXA-EF+D`dbE0v9XrEeg~QUT@%A6}YM!xSJr~ra+zX43PUM z@Gb?8&Io+F0&QQ^b2rF$5XccLK#TSv`(x^aH!u+l7Tlqqdb(bppqrr5?ApqgGQ#~u3Vt5~3^RT6)pW$vtWb3<`CmsWK5cy@@cB2O4d|ILr0Ci5fc z6xmN1a6_aV5tXQwWouI&I>^ftkRr?zu!ZY7)vABTt|G8wP#T3 za2I-oLHhy?+FbNe&!dtSi_YJ=*?jVlDz~r_f&uEtftq5{d3F#m-QmERd=f*o{uu$G zCO&#j;$yAk)!{j_WO$;HbGupjml<x|R6d6kp9_I6pAH2pVd6f?EUKT1KXL_o1>W2L{WGoJ>>1&!=B5^>_HD z-IhC@dPB^pM;kzbh@)3T%RW%7l}mP49T$ENCe9A#9;;<`CjYD^X6puTAAQkN$@K|p zALux#uulDzyy&VuUD=`9vl)!@@(qRst1L}NRiAzH;_)QMyNLTz7_-ECGouTl_2nJT z2a)-jP5`p@x78_JvT1)o?zmZp-uAcT_Gh&okh8RwAz?wVSS>Y6aJ2mmB8GX>VYq*I zfG3%Uhswi4>F`ixc&M7>+f#_4T4Sg_{y8WftPR$09_kxp{hZwmkt-NoBYd;6cggo= z_r=*g^4;LRBzreL7vO8zb~N4bmw8MnVN=to5)?HJE7|*Iq^;zvB~w$KkQRlS;>G5;Ww@*PL&Oi(nJnviHR8I}hc4y)hwAdhf~n?L zQiaV_4EdrsRn4#J1bj)fmAwcf4)bNfB-!8SZ1zBTlKma0J&|d{!SL=YmVkG(VzHIH z0^(`0qD+S{Ra@EiaK#^m{hIJP%G3^mPfMi1eKc+f$icrN@QUd&D|wYXJoEO~9gTFH zshuPb;a^pF+){L5w%k%!dy1dIuz$;~eR`R!{T%_f{8uc@e?^}R^ABq-QLeR@*rl(y zq_0>b8#ANLu!r4i!mN0feF!VwWFwtOknO43W5&LY*+6n0cMi0~Ej3^A22P|X9}zaD zJwpAnKdN*|UV{n1-RJT4m>Tn=6~dD)thpT^4@4R&{AM}mvii|*Y+U`{uX~$(5Tsrd zn!GeaZj8S>V6m0Wj(Y|$aS|}o9GO+VPKWz^jTMA3Ogn14$D7qCRM^E-_1t=dL-!3$(`KI7kcA>RYH61^dAeG`iPEOWE2rZ2yTCV3wL zdB3yM=7blL1IK8X`vq1S5gw>jn;YpJ+>B(^NH^Ex zRX}YA)Y7kY?we$45BE(5J?4(l^5@vqhODDzM{gp3o;8)cqqgUwP9_c@>ZpBSe`L>- zne^=Y0%M6iBVq6K_Eq|e%Ph*E(xPH~B|nMZr))O#Nj40{xgkxmhzi#evMR+;Y2pJ6 zxd>`%1{tDiakeDMnMeu`_by=`Xeb}>hT4ZC$G~Dw%9k8h`MAL9NbpGy{_@z^mu`)Cl&zo=FJl{PZ={$wo+i+IH%F=Oph znfT4nEm_N46Wd9GWbILeN^n)4TAPjo`%KZ;90D=640gY*Ws=&Zv7TW%alA-TxRLKjs(NfnqrS>@tCy!Fa6yXRR%wpG zoiy8%Uzca^4mSTRy0RsNwvDyT zB|YD4_90c%PYu+veL!Yw^RzZ%FrBBIzgHS6HHOOLXF-{sjItC%Y0C7q2wcmbrf^q# z4OJRL)$u1Ppfc#Fhid6yjhCf%5h$|_q5;AU+rL9~%Vv;#hN^?SQN^>H*qMK)VV^p%#^W6rk*5UeP{g^heSV z=#R-s9K3Gz$jNP0oQc5b`$oazm6I*S$xftV15l{ry}wNZve@j2f@z8C`F-%eSbO+6 z-ZS8TB8}kjWSCZNMjMD!f;KQaUs504AtSk|#2B)77o#-q;U1Nn5s*1hxU2bRNat5c zRcqN^r0S>z-%{l1`nwma&9&4bm?`ro2#=POX)D7SXHOvMN=-7})f-Ufl5TYef4(Pi_3=XpWKLd+M{??3d<`{kLK$+IAj!P(i9}>{ z?lkQ7cFRR-2Gjb|5BWS5ZEi4{O`oUwqhn7k=Bb+57`zlZChljx@G8r%gh7e@X8Ym{ zx7}V6=8BTN$C!(DQ^+!AnL^fVc(r?)xwj z+|Pq0Guarhmp#9$ql5*d4vXc6BFC~LBIZ$|F0ag*Gk zH0TaRhP%B__`TfCUU;iB$8M081xe9)iVvPHHQUj(;%SntfCkEH-@eqyvw5WA&MFi! zaG{MAdqbcv#=R6+D<7z$8ScZfgH)u0`B`^}h3d>fBRdp#w$cL*Ak$v|XxvDOxSPUQ zS!zBR;Pzqs#K<)IHlL!9!}*~c$FL^newTXOQh)@~y1iK?JC-Lv@kJ_I>!}3qzJj%{ zEhh}}X#_QoQh2?s=rBez|5`MvTA{~QrWb#*o{?#R4rVFx3Jl@9c{_1Q&Iu{hna})p z={YQ=^wN8;AdgE#V{bN?VRDa0-7;eYScQAJv;!HZrs^`RJdUsK|M!Njx;%Rt0;jWN zDK(eHc1Pr;j;uUATjMpdV$pIBSlrTHlBhH$}=THY6 zf^r_F_U^(u(aao~KbLSxj^PXs=bno8a+=~K2TEqULO6DBDLT;+E;-Ug z>xel-GduU13EKOP&d{?mkFHc2N2#N~ou;L8Q%L&z0K&j|1|DueRqL(lz`a+kX>{BG z$Yy@Mwf7mi7YSYf%+mWhLjSMT>J||7P`dn3P^S3{0T{6D9Q36x!lQ+Qa%bidYeoq^ zi|^7OI+A2_<2M~7Dg#Q?m|MsWKh4MFm>s&YjqavBpwQv`bCSIn6l05vZcolfC+mL) zo|66gU=S_yFb4)^{^U!PjQ0&!^Id124o)*kwReYK$Z$7tauoK|py}wu4URnUMK&5T zzWz#MFY;d79N_03Fr^J93#Ex28C`9yVSQ>*bR{sn;Em1irMO&EnD;SV2Q6d%6h>l( z)aMaPko48V&8P6&S1C1HVD|S|LPEXA5}@*PC{GCfE5Q|eq@@Vy$sx6uSJJVv^)JcW z>PPz93N=SSO-E-2pR`vz#yPL0gfl{(OGaiZPa|+Xm;+qWN1kV~b{;>#pI^XJ-wtmM z;3dMG5 zYP6vcV>$`ijniWe(o@!#DPd2U1HN`qhTj)y%t0D-9hVYWD(V}%Qcu(V1E9>*e^d(Q z1-gTUv=oppQ+r;_Ug-zLT+dtSOwL}3Uw^)%Ri6A4Db}-)o|UtfsxRM_sO(&7-ooav zQ<#*t!K{nE)$l`+Y3!^es?;($>blPDE}irzOL9!5<*ONI@t7T zD}E1u*BAWwvr4DFU=9eQUj9;qnS-zedoPO0)a&)s^KiX+9qa18O46Rsg1WqdPQ(+g zD}KgjxIfOW0kdlW%{eC-e>yQd22Xf+*}c+I%GoH{v+D^(^u11rb_K5HS^;VC=ps*t z4J-NyF0atirATMHKT-*$V1FFYnm^N{8Lei|^!S^+#D0~a@`}&%>q^#ubomViIskhn z|4M0#RmE$dqxn*eF$%S)>=TH*zLQzmoL;Y8i}L_rVgE@YCjZux`Ua)Wm0F<|m3<1J z?9=>cA!Db$My^Fk8V|8zYIuQemwyn^pYcTs%38N7Es<0bS_I|4r*gGFtwG3><{yIz zLzVK{&(bPP?N(kRXMR3Z1m^`ft5zdbPgKs=z}MNO4m)k5BncR2G{Q|;16bLF|5H!Z(GryqSw== zny(3(ngz6r;XaO#@nVaH&nfuf$SOH2ecz9%j1Bi!{28Vk1j7T(8%VA_inP5W2-xdJ zVuy9OCP>uS2-K|hPDBlsr(RNE+&oKlU^P!L*gd0_Z-eTzB}(%5!QJJ%;0I2HoO&Lj zGg3FpuDZO>Exi3`aamZhN^2<_Z^Z1QMl~~17%Xj0Z&b@^!i$00P^C0=LXmXjT2ZG( zZzH6>T>*pD{2j>T3v4*m3(X^gl?}YQ{7wSbJcq=`jz2>gmV4e{)7p@L!#YLLIMGuS zFGHuKUWQJQ`m4*esILZsP}ff>u->7WVUDeu4e#wXxBV9YlYa;ANd7Xw z>gjc>t!AV;*&DoRb)(w-K&|9QK*1VSs!6Sp^AJb6!B**&>cp)SWrOKbK(Oo!-F@Z6 z^pbE$Hpw zqKxWB^|GlA%BE;Y^Hmga#ScWZccO2aQ+=kd($kt$tV*{r9k|H+oz@d7pLKHRH`f}P zZinly>h%qp`|>6+weGl(Urg}w(+HfpCJFs1G&=flqw4LyWX(+j;C$}`8Zb*62Gfx; zKl89!hXd=yE4(}O$WVB#mvm&MvdQ!Bfgj~nYc-&-zeq8nGDfvRlD(N99o4jTrtW8C zjELR`{7Aj|Dwx$5nL%c$ z>RLMIER9hipYgQ3v4iAfqFmrfVQiPd9(*Nt7x=u~mWTST1@lb{TFpUj@KZb)n?G4GN=D=Sf8fe> zt0Ah_y{vKVQ>m484rOmH?4M|GYgb8!>{|1JkcR@4r-h)CkUyWKj#bVp+@IK6klu0( z&;#5Sr~{+5&h7@prl`;*w)_zu>>h*{yNAO?zU0js^$k5-+X_eLFJkZaGU*Sh(b2&3 zT7AzLCCx=z_TgzS+;K~(Oj>rQ4`4ogSo1c3a(`hTNr% zgcacR0Of16&;$$I-xn?NgS%#SJ)bn(W-|+>7c&Ys4+Gt#HbF8y^p|d^Bj%2 zefWnS;AQ%ed2kPxGIuZ7drriXAo?`;L!-B?22&b_9WKpM6W^if+Czx;df6p$s~@fx zZ!Y(#Ix(ksIc2wztJ1&eR#I)Lpb6>p=rWHgZ!Mih)tbG!JX9*V@uuxDlPP0DYjpU3L#IDrB6J1{vM>j@? ze=9OsHIB}Y*8a4xKS}M~xG%z|IN|8I*vFHM<$PBg-PERJ-w(Rz%fL(=Fv`N}Dz$}# z{k&J==&MXzNML?7Zf(E*RF&cB2BWW$?rW-piF<)rGz-O9{wk%$9{1IJ)2R<=pk~Id z=hxu(nXs?Ym?FrhR+|tj{Zr$G_*Bib&Ks!p%$jkSHJj_fF;q?m%lWk(Y_{0wj_nT0 zx?$?8MHYhU)0>ZOU% zC-7F?vkFqv{5r_!D`h`}DgC8t_9$O#;R8vHZQWnt9V(ZXOLVN2^V8Ln?xQE=XW_!i zvTSyo+5H4*{lA2!GdVz`tYkkYC8d0g%In9f=cd^W@>NP$s@#Yxdkh#tUyFO`!>+f& z+>qfiD8EYi>y)56#W?0&bg(+H9|g$%i|{oH9jYblNAWC(k@h)AsO6`L%Fp8*#3H-a zoP!thmZ}wf(Yz{alHrkS#R6IFGzROp%RSha-vrXpLFPX?Ud#<`dj$R1(B1=fNB(1K zgNv?$6(f_|sTck~60o89dOm%X$^Yh)-^@>C@(o?*8*xs~7WA7e>Xss^XoGz=);=!W zR<=bqk-?M}o!06+r#F*|oNnbaJ*V3UNoJxBW9`u1bE6AE_8Y@}Bz*H-Z_}kLqT`~S zl7?$I??qqAHxOnbX=QRF&Qg9mzovVfR>(U#ah1tVsbW;J3A0OnC$Swm=GdJGzlV;* zL=K%$gvpfXEr6wginrp%RP=3pTt!hy7TpJx*)M4)X@1uh;g1vE$)hilrc{4Pw=d;y zC(&p!C9RitVh@;n2jQ{VAm;DHnM~fzuhm|$H+N{Ht!xZ}sTc9iEf$S;Wf$D1^R1G< z3luDU^%?LF-Jz2G0xBz>!pIpaPh;afMaGrMcXyrl;+&kLX7e6gmC5&Zqu$qbz8_~b z|A0aC1b>i#kl}|c?!)}n9Il#w#De~ZU;5`q&GRvSw@83W!!XxEijViCAkNWzq9?H1 z3b+R4lSFjtW`2Z@CHklFa@7o8(ib(9vZQhfZ1_v9Nn-A)7O!zhOssbMRUnqNw71mi zp(^=j2`<`48cBmN zD@8wYyXi-g_U?7L|PwpzKThw0Bdoma^bRr!OnGGY}K-m1zN^x<&mCsWd(Zy6iU~PFo@=%zLrP zO(kf@4(DA)ecawt8Bk?moi#gpBW^BM88kB}O^E#<agWfvo%sfcA|)32c@8i@5u%3y1SB;V}Du?QCQJzi|l}n|P6bnW$a^{)fZa&QEUh zZ08ZtQP;V=a7k?IC^w*Vck^=)<|_WN=)$=970|aOuf*9q5Qo|lsKO42Wcxe^eC&|P zxeCs|3b1ryLwoNK&7+<6!;kLZJaLL9qbXq4Y1Zq?3fTZ-U}GcG=B#xZ{5x%Y>X>5c z^>)5a6G;!k7YZSRe|?=ge^11vod`A4=GVv*eZbSnz{j<(6EIqtdQUNLu7VLKFI z=J2rjMVL7}Y(Wub4iDS02s4L=?No%B!^3ti!pz}e3yUywc-W#M%p8Pq&v=8d@bXZG ztSK=I;uWc6Btl1PW%Qn-c}+{n&jUkK>e4q0oxNCz#b5o{2mH`wO zy6aX;O*WSR4)j(x-mS`>B7Zk3TJ~6ye;X8q6%vQtzJqtIz;++76~f%8)|+6HD__$5 zLD4fgLe@TJ>dlE~kxfHmibhFh;O`3c_%4K+tul{uv+eK@fqZV{GtxYQ+RZoN45Pre zw;Tl+wOnQ!i1uCS(H{CCVaY*+2d?BC9fwuImI!H!HWFY7mPJI}@Y| z>w`yO@02e4X@w*rl4($s1zplTMp@O&!m2@oWaFvHlf%&|=Q(ZY1;o8|&KcJU9!-Y& z>-3qq6dQHRus-Fip$}bWNBfquo$Z@u^X*&7=GnK}UaWe~cEd-;p)c&J3Q%7#2YJvJ zb}Pcn;bFTMVdn6#(IU(o9`=MH%p4w;6=CM^usw<}a}Y+m+=Z~-b}7GyTD$Bwoi2wA z89NqG2&|uEY@cQ<)0S|Jh{lIB`#PTfifvlhQpJwaSIn5Jc{mUQJP7zAzN5acQmb}n z%F$Zji);YShbB${>+VLiZmH=i)s0ME3kDKz1~QZ~GdfPA*`82sy`uB^j9_+(DLiC* z-RkBKXb1JQmj95inLQTG#mwVA+_BJmlgs_+UPd61Yuz3Im)jp|)x4M5YfK#~w)rRG zurg4sruoBQ4r6S^?!TZL7kt8C%`7)68%1e<)zioM4j|~5oju$s`(U&^a~TKZDZ3tU z3u>S-)kdkkM4z~&PxsVDz8^E%_>}0Cwxpaxa3r00{~^;(hquqCG9un#0W7wDSES`w<+QYC7g_(CwCMkg_n)LJ!iOEd{7L>P z4_FpwODK&gk`=GG>cwVNClhp35b9O`;Kr{*#6j)m)HrK42q;Sz1(kSbu#EbO-g+1#D1L}yX1&xUf% zZ(ayDE|IOa;6e?s(@hO5i(RwuAefYv@vHd@Wr%wsJee$T(9U3Z>=e;OezZP?{LqDtr%o&cPG9WXMs4;CL1(KCo#l6SF$ffIA5P0} zVRT0)KOZY>8Sj}UUQ?nCdq^1tIC|gF$WHX|;}otPi8yKPM_JnX0e+Rjk9C-1uj&iiA=&$wA->*dx5KK;$7)Dh zjXTHdfH`tps5Eby1Du3$VAR9RL74iv#%=ENrk|@!yW2i4Zxl%I!m3PRh232XIy}8O z94A+PdYCypjBBJl%p4wea1mw>4?Cm?GY4S>J=_QgJ>u6)dKBjLAajach0OVox({VE z7BW}s>$g=grYsrrfb9F;$)?4#TiJ>K;a1`w?uq}=R^or$6R(9Vbu$hBPkQ3D@+H2o z*FV(CDN@-w+Ybh$9cgv3d_h`0fKI?xXCFbegk{|s3>tIdAmM&D$frYl4@YZ&I9xb6 zC|$~Qo^+1h14RoJjfNWn<}j{>3?)Q%Gdw`PkRgjQWw?+aGAv`Iu7+-hR%Vyc6r)4T zKhMV2oFou&Utv2|w>M3Xnn6P+OWTI&lrihcawC%-Sq>Ii<`*)~TElOQg-pJQXu-7y zUm=1GRiER^(XpgBhWz{}1GgIJ2()aFg(|*OWlgf5!gt$YP4nH@#FD_YJ<*lw%^U_= zdmDhZ9WvSxbbiWCPcawHj^2*@c$H~Yz}x%--9rYPf8-md$Bs4nwwtxN!5V2nem?Z^ zy78Zg8Nlf7&wSS_LL0OeseR|_L3HB?;b!-~+P)74L}P@n6pIkvEy+r;dd#6#sul~t zZQxzD8(T;@mNT>kKp{=r%m-hbDjm{Eo8!fX7C?YlFcZ+1QSTM^0le*LFDU79S z?xUh@pf`N1Z(;)0X$lceqdW?LZEeh{*(Ysfnn#!<8DkN{|78u!_!L&aK2 zW9O5J;jwbcE|O(PvSROPNHy4ZkvQLvNEACaOv*2u3?OSfw_<9-2 zX3xM2*|IgP6Wmvc+kJd1r8PCSaohb$(h?pU{wgg6bcFr^Jk8nsp!VO6k4Iy>$1MnT zzj0s?S5fY>5DSGWuhY)*xwyDKX~+SP^SFwjz8)ETK|$LSDAUE_kwwui6lwM(ynWY@ z#{@4Vfl(6z#4q;qCDh0UcY9@!v>TQI@~Rv;_YoL9z|E5rnIPLCgy{_C>&dgFJX`Y# zH9J3d<_qx0*^c}&x7(ut*-m(1k0A4%`RN;fDlw@JW7gLr3@*SLd{N;xgX=Ja_kgUG zQV)YLN#oUgEs`wa2s6r<4jyA%l=z*lXJ< zT6}0U8~mz^Q7|BfWLzU)-%MZed=EK*p)6xKi?S%Vy@VgiqHuJzv!gcvcZJcem{2Ej z=6eb<({HCvmg1pM7A<$*_)#RM6no)W&oHJ+>9~6GpbuUBc)nvdvB^GLcf{PvI6u1*&*o=UDcgYW*chiJ0_mNIjk|z* zG%3f~+lY-@LYH5UMm?OOZ(NIJT@#{Y=;sKz(c3a7a;B(|ys7-T6W-Be?*kWr8jI7}Ko)=DwMPnvWj`?rLijBGqKEIDe1w zLs=jO@x-z5$vj@5>sH&DV}~2R84U5X*h9{@AR**j;vtLiP27#Xwn)7mA!*jc7o@y@ zB4bS57Jn0u;19;5m=a82y>R}9%1FAQGH>GGJ>=fOxv`-#f1+st*#T5$f3^7&kYEI2 zRcC~36qDopKKO3Nz(r9`wxam^iY7lSiaxr@?JHiLOkrLhj2gHwww_GfPbP8mOpxT` z)@pPf^#%&FzQZr3CyCD!n*a^P*nJGAQ<@(EVfpF&m_=>~Tn;W1NGFKSZl5BfhXu|uwj8D7R2qp9D@j=UmwadfUT zKNRx8jqqfLV$-rK!T5&G$kfA7XCjRU%$xer^ni7us@s-*?pa*Q4}ro_h0~WmrB=Cf zDL<4j_3gsHve$nc!hEN%(ict%cxAgJ*++jdqWcuc3{agpyA59#*yq2NB|SQ}uQNY; zv|mhO4pf}s5N$eJCV}X6@E~kYd~?rYdxC|LI<*gwh+Wax#G^zO2RoIQc!-)Qy2;v= zP@B*bXYUnRp8pm|Ui8E+64Ls(xk6JOOM0t4#{5!56STkBcE{S!19?1odxEavR5_bZ zhI#GN%z2ocrI0and>hWjEoE8DpGH{NKKTAtwh!`oLUI&9+?1v| zWdU@wd}WN~^KTg<6$8)H2_|+vEqCdIelB39HS36wJwwS;N0#Q#l&@0a?7(*nnb?Ep z7$FPGl7P&2bqGWZ9f2De)W8yuA+-8Nh#T!9?8M^<_VN6+eAeK zn!mOsQE^LUv*P#LBa2ll{6L&w75+VvhH7|p%W8;Q;&D+8Lr~MH28`g!rR=*TFL?ix zt?@qCyY)xQk0|(YTC{jw;l4Q<{e<%aeWcng@99wk@KN^SN0Oob2t7%aRLYO%lVF8% z0^iN)E2nXQ=o6I^b^tMwOqb?zY;#+ty!2#opSmik;iKrQwq`34YXec;Jg!GwO> zO{wO`;vT?+`yL`fRrx!U(>C0!-`ae)Z?x!m=kFx>_YRIlmv6n z>=Cl{`!nqZzwD>@WfF=Fr8tn3CVsOIrirU4Q#$zqFc<3ipAp?W1uW|nYEfL2*}R)f z!XD6^=pBdo!N=Kr(?&ao46qjE73+twYPy>4j9}r1U$3CKpq{s^`w-a+bRt z6-dA{Sn}$8m<)$XDTXYT8^PUvb`EeKQQI+-W&qKqB-xK}U^wgb)u?Qv68d|aNOkgs zl(c9fkAlFPh(axjQ)AvltgOodFVBLP>K8}G6SJ3v)|M}XmjrGt44Z$ghv_b7ftc>{ zVm?-{exCH>R+e)1D=$j+OTOF&{5T(>41BIc(vE%-*ks$qbD>!7yyR*HlH2x<24$3{mnML+GmW0?AIb8nV_SbzldAh)I>#dw^3zBQ1@y6 z6i4(Dt8HF4iBeBHG5iA8YA`-xd9hB)gy3@>#%DbZKT&jx)ZKZjphi<)|M z>QzN)?4aPHS+nA(c_uLfwO%9#5z^BpH$cOerqhtC4`AGh);b&olHi1z$V5*mV0XgL zF(ytoF^tX1j}u)guQgxOZvnk*Q)P_L$VrwA0XuG~J`G0qukH#Gn(fF*2~*hC5EZ6a z!u73U|6F%v*qB;szeKG=a-qi3uTuub()+?#dW4UqPwg2?{ax>G0JrrqldO5x?mfADA^~h8oOQx=bUUB)%hXMFA1HQJE zVSt`ajv9vS2&fGN<*kgZPR_OlSlNL~a?|iM$N>qp@6#A0vfrpfmD^`i6m%LY(b&y_ zS<)Ue!Ne^^HfL+V)v&@|#qUTo7TwtCyXPo%sePV4<@UMyu*iQYU$uSNG#|$IA+@Sr6r5_75men{z>0jL{W)UxHUT2NP?#SNrgRJ|m@X62mFMAtx>$jntPopID;mIar{SMa( zHw$x*YVHGNmR)6JG9}*K^Wv7F)O6KsbU>^e{mA#?UbXoP&>E`-l6*gLOpL5K-!xeI zm{yIJLNgC@_Lf)Y7fw*YphLA-vN78*8U;OLZOQIF`DG`47;XdoouRga(fK^lX)8JC zX)EXJQ*N_iU~ObEa*i5=+6#3npc!>ru|EGR^3{pWtfIkupvCaXg$w$8lubUe!$`5N-eEsRWh624s|X_ zYr#K~S8t8N$#SE6cu@!Z~JBD zJXy|*%z28O7n}3Ba$X{5A#Jtr6nN2b3Xka>%mIb8E5YZ_Bc;xiO7GBGEE|-LWOq6WhW`wi5_C8*Puwz|q%><8+9gh6CZoaqPS;9NMRx(}N>> zJJYl4?>K*hi z*ENphXAnsNLu7bmHmqk8Te}W1c-~2Gm*DdV%0anYZS1@kV(d$p^icPZ>mEy=mo z4uz~*EC*F_+j>oJ0Wz>H5=+BHBo311tAVlc((~9U+I3bGaaaO5@oWuy`=~J4FexXV zvTt<$JlkYuOn1g^KoW3G@09>=Nb~;LtZljKbTJ7mYu+?oz6Kmgz8Z)X{NPkMryeeb zl>-r>d9viG6nBNT<&x}aavp>;uOu;C#St!CHg~o&mdOBGvLvVH^)P%BhGWej$ed5_w+@mc3b;8(raSr&ihY2k1 z_27JimI=0>HUwwrlFSQrTT_jS*V&I%Vr8hR8YyMFSXBigrO*$NNm9m^LIL1zzKK-A zB|5ZMw_Cuib;1s~`7BY8Y!`GAB>VrB*GQjotAt#X$C1et8~;8TWamNznJeEtLcWp# zm^h*()<#to*h*FiL&PM~8fjG+sWhG)_vv)6THfL40_TL?ijHMp>LEv3+@sfp9~3#UNU12o3mu9$S* z#HTwEJ4_7j&zOJFv@zeo=1<&Cl)D#9y}p3xLA2w<{s$BgJN4$U^Tf%Wi0o=I)_q#r zvxme6jrZZy?353IUTm%g7}oqq%&|NoLgl#4LxmE#!3gaw&6dFh3a|7FkXK$yESDN% zkMSfTuo*ZHzBO}xI4NlE^KoM=bOE1%@q+=!Hh%(-R5YdGyeTJ_&6IQpjDyS! zTBwkG4ImZPVV{8{60gO(^uwKN)Y#DoTh|S2!A5AY zD%T4qAAqtJaUIIK{MWkTSn)sHh$0gv*=?m2#^H(yLD{}AgYCzY`YKxD|FqMOhd87D zePDSg8GDMiT7_wne-2^ABww>R(|S+M<~z0tHBi^A0hMxWSn4AgHxbrN_NXOZ4JB7r z>`%@^rA^w<>vXp}xNM)(<&B|=9T^iB{A?J9pFJ}f3gFi4N^br5N}K^MXZs0Td61F} zRk+huh5016I;psW&~`jBaF6uISIn8iKZt;%dv zPS}mo=sKki=yGb6%zemC#w6USU0)R!Lue16xFkRH{J^=N6~NWptVl3 zUVdyo&f+|tnRoGgZ5vLHrBf%)fRrD|35hVC7Op7dxnTA?9H#ax(v0M9SE%-6u+hQk z_jPsNAD6xPQ;9qi+M1JOSXXP;fj+g4J&2j!I!tJ)x%{NeS^uibb!z-;v^XCx5?cqq zSY>9TmkAQfC0=3ik zGFjdn&_UQ_5oQj;v^Tn#?`oAlTSr0cKGt~c0QxGVC2LFh{S2^k%&x+DR4@bL)qVDlBdn3DV|ylMVQe)}gcg9^X!5Un0o1b#1sI!#ZUwT(lM1q_4yA z4{?Vm{muTk+}4-gng_FI!4qG0_bhR>hDmHq?(1CBwb^UE9_k5tmb?bgS)2FSS-VT1 zn>8=F%v|$AP(bfX-EA&>4K1<0^8JwaRmoai`LSZ{woP6$D&w&c4n{ zZIx2U*@B(UqZ+&6jQy6bD^`1Uum{;~YqIoJ(+8|DL|s`lL`JtQ$0JSP`aiN{ld$XT z)>9P1ioSY9u#9+xm|rL$u9TB{*E9MzLz*E#*% zVWji~NNX;=V%>C~kcO?x#OdUittC-ho>(jQg>q+Dk4m4`JOf3Jx8FOH}{Ce=3 zMs4C6;KOy~tj6mlzi@{#>7HZ>mRGAy`f53`L+ynzw+^*q`&hD^g9XA?jJd^AA75ri zyFAgyvICNy&J6(i|LhW|W!%VGqCLqj=3{dhd#KShqQN$er=H7zX?!vrJ=fjjzoHF; z!}?b;@i^s~;_lX9=p_aBShOL|UJAZ^CuWgQl!*o70CE{$0F=gmRJ2M4*^TeD$}^;+ z;?tyai)`FdTVb*NYvt_yW619M;DKJ|uyd4Eg@yQX4M0rS3uIxYl~eXgqU<>!hnm<2 zB06|`0P`z>CWj0xp=?8Y&yQX=D~fI)kKwu-xs<|!V)?Vk2+41`1eEf1t8t!WyN`W% z`l|!us&!rnJK03vp;ARVwi2(pTaUGolX#s)3736qoQX|n9EDz1P$y=wfW*G>6R<4* z3k=C`q!D!y6emAPx9poddm$YeoMxl%%xm2s%ALMYeb5MbLX0cDB%ahjku=vD|(DJ~pOi7Z8nW!85C2TSLtS zf_{k7hm8k=M!Y7(x5|3iVf}IEBtM#1>|A~Pvdu%vC;OhSLg1a0tt(pDI-s8P1ju~R zEh%5KoQ-Ky+V+iKP0G+Qcco|b!2cEsmrK#I_2@qkZT+x+;`b|}^Q$&dq`s*=zKmq0 z9$ekL4?C!vw*<(E#}DoVOuXih==_S^kJB867=Op%I3I@=a(|e{o$M$w*4VOO@1@b9 zaP%(9?c;O)Ptl|c%9zTtD*#4fJ-|w!VPs+o^se*kuQn<^EL2B)1PVUWyj2D^JxVG% zC8#uv22?AyhDu6;0vRjnUTlmDQXzuwzq=`y9a@Z1TC=k;r}58oM}Z)C?3k^fZDbH$9;tFyCEXG~~z3Wzvg ze~1nFCvzr6as;zhv=E-|&A;IEr!oA=?qsq%ixevm|8c%pPOa5~=24T2>m#k11zl=K zf5@f4BdRy=+qLLC-0z|8l8O5$2+P0sf{!)IBEsElqHF7c;gJF*-k8jWf^*`V-BeVw zQdL~(NkM$}w^WthR3bq6-zb^-Z1K0bn%`!Fiq6h6e%su(1Afse*t)8i%9TEA4+nRQ3v70k`DO>qzrK(ll=-5*4=UIJH4%lBIU3`8eS0QYyIAycUnn z+uKz4fb@m~%{Qpt*yOXu@kSL}(+KO1N_GL@akp==17Lzr(tMNB(57nnEw~2DmGC{5 zcKBvOI`owzE#r8^9Nx>ECuE~pyO04WjQFHJ_9EKCCsqErw9{9M@aBUwEfi+Af^@*1 z2CU_`DRa6)7%VhPSM#q?nDBt)CTn-ouJG#t&EF4X+;hoRC0|2M_8xYAkqS)TxYWPd z<%&^Ac8y$><_6_$j|$}*aSm2_g~*6wPLq(PRi3q}J>wUJb%x6X^z`-7rj{lltjc&UpVFjGhlZ zUU8>!nSEYjmJw#@Mjw%#T^}=<3|u&7q_L&Sri2+k9Rbh(ljUH4TB(|R&OMK`!>!qv z73&bm?^+XoM`g=i3*|_O1079q`&AIn;_%gcf~;<17FQ>m;Q$@EC6Me6DlGsLCxZb? z!)oRlqP;&TuQSL?e{oCUEF*3t%hKeXB)9v%;+C@V4JR$YOOtOQDun7PHrr_~O}=${ zXle2`;+z({jnCQwWyi+C3)Q|3ypY4Ll?t?;k6?6`U*q$4RsNP>O4)N^f61m@xwQsroI=)`U z?V|PM|9vZ?fUPOjU8G_pRf2H&KEo9!+Zr=Ww5ok^QYoj|Td6GF?s5ZI z!mox~LsKUsL`lZgcPJ8I*o$F&+!A@&+X$@bs{SRluwLF( zg6<$_RLc3Qk<Py zN3V=&(3^YcWFK?ZFz^|)Gd-2!0_&M6c+KS>Hx=_!|=I;hk;}FR$PIU7#u-fyd!g&Ot zoZkwAhU&vZZ1-G98N2$i10~(E=vAn5razRt-x<*tynTc99?5=usFNGvU7MD;T+KF+ z*B03v54@N0iY^bCJ9>;+SsQ&*EbsG$)-Q28YX_|8L$o2QlG#1^g#w!ei)q-3IeS6$ z1#;wNWoljgDHIOE(7dn1pHhA=k@fK=z#K4q4<5bc_FlgIeBZ|xlQSi9;@3g^JZ}J! zd8<7Qpfu8z)oNCfnw$7_3*zm)hkUYpKUpljvU9}qtnNOUW!wB*hgLd=>pgahuDYw( zD;uykDgUW{61Oyv=<&NZQUmJi+3h%Zdr#{$CL*mo-P60U(%f>D_f+d)41;E_=0S{q ze^SSdB5WtSe7FccgjJk1`%VjxE~#c`lV(+;!O1JTaNDVS2#$RpAu6n(yqLW;=<=!d zxHYCH;Bi{~nPeMN@;{3xAB`9pG`9}35A$ENV)O6}DUJGgvhibV#QU5**KD`S;GFm+ z!ZWj+rea&T;nteMmT&d4*(7tPDpX_AqUpU7=Wl|ar5^p4Y=fQv?kf0_iDfI%03kTJ zx#qbh{`gUER_>Z(6#pR-95fD%Xk|Dr~L9JO*M_Hs^ToxIJmt zuCb?|I&^P!2R`f)eT@7EEdN*kAM!VQ>dDKfUOTkVlX<5pjF!5F^4PwL?5ZhxEX6== zINyPwS~dSOA5;GPUy5VpIZ{TkcfnpA)O)+Jnfsm)@*3DvzQO(4Z_~!(T*}NHi3sN_ zCSd`VLlolJ1*X{0UWDdOQwVldQ5e^E>Y^uf-v7tkn}Eq#Rr&vK-nX`{?oQ|=bcY1! zfF!&$BtSq+0%AZ!iHd-Tfb6&cDlb;CnWD-lDvE%LE8xoFI&L7Kq6nzCfEriSF^mi7 zFpiGfxEueU?>YCa_pR;@I?M0*Pd`uBdzW+1J@?%G+;h(@gomZj?KVl$Jsrd1O=xqu zps@ryRqb_^`wlJ{E8D{^pz5>cUY|Ah`mDLvXU)C7q!3q@a@)QrRdy?bQz^>k`o+CB z(DHbvtf>8|gEu|I9B5_U=&@Qa%`M&>&9|Dq6KH*q7Uu%ya=5e4yjEj ziy_~aR@2AQ8|@ZL_l-t__vyOn(rrtq>&TOLB<1ktwH%PHZSTWN^FF9}rk zAEY(eIB&~#h~u389#+Q4DywX*Op>Ib(W&FXoZm{;xsw1Z#9vOW`L+JBAuZu_Ccttc z`z|DNqCb?~MS$H{D8M<$)(f@{guQRvo{+4yL0tPn-BDzH1TA*&{Jel{x9qT0VCTP%m8*7{r`GVSiinhRL4inR+y#utpPeu40gjE!EW&bMGLrJU=f zM82sq&Gj-Jf{%@2QKq?8rqx=Om)Hlm1b24q%XZg+NQb*(XCY&wC^xY97#l%!dx>rXaY+guK%WX?5>eGuUk?9%*(Zjs4c|r6r4_ULxAm*{4aYr6d2qS!-`|9YmOZ|N* z7#%O#IbKNRqNn6C3SP?nyD|!$dG7;dQ@|Etk;I>qf~Q;|mcX-!GRY@Lk$yT8;IUH<7O!NJ2DO}W49{f7(VZ{3{UnLC@tH4*_~>PAE&G2 zB9J@&H$@;`Jo=N#L0&{&|2uM!k3{SL>~fIBc8g*vy5BdH;Trj07(Cs|Z8%+=e^4HP zM!{9IS$3Ll=7Zd1p6QAop!)78Cf^hn`}kS*&y~Wecia)8Je6;y^Yu;B#{L7rou4VC zCo|3aGQ7$g%W7QcxvZq#$~UikQ>I?#OZynJke^ab+3Ma7H8@jQb+6}xU7PD}p=xcp zjcvm^-QKoftXGeT6N|%8S^7yZ*s6%|)8eGJp;(sM@>PdAL@{SIBj)MoVDZFOEXA~K z+aYZ2+S)ZqZ|@To)^vBrX5qVgjd$>63#VP(?*9_9i1RhnE`K_z_Dg?0^_JqAm6U1pBGJ^1Xnmcb%Eo6pxZMr zEF*@+XBJ*F5tbqL`~{Y9KiIJh+z*!M_&bc_qS?o=k!Z!5Tvm5fwBkkX&hN7w2K~t9 zz8hq7$GU9p_>yeS^%d3ww~+mT-2&bLzh`$OID)*;3Hd*C&rW>#uiUd+@69G`qCRD< z_@o(OwmD$DnQJ=BurYF(y9tmzt;vH7ZuZpek5eID7YD2H4dF#r_BQDCemg&UGI)=L zw{b_IboyanvXl9ld7&okKp*B-jSV-6wQu&vtK#{gTQ%$f>XQ@pdN$ z-3$erzK1!Wi!h7T_@Z;c6GUf{{y?Ruq(9Wh0Fw3|j6_`iG8EbKh(Ica{APs@P`=)E z94BuL2O1hTl5jef>?Q&!kmDFO`*f#m4M)38ai?Rb(y6lZi3sg^*w!4pIJ}jzTrvv| zx~!w<)1hktXKWS6OJ>1QY{qhAUZx?t8wWa$;7lQf1!~k17&gNcbu&yck~Fd> z($a&CdS_YP&S}G|tm41%Y>#N^lkz!cUUVU)IN$R9#A8|J_BZQg84OR~fVzltLO3V+ z2~@Qur1L9p-t$}c3lRgk@7YU;atTa(SK5#-ORPUE+3U!t!yV=q8Xa4doW|sW0KY{o z>B7!=kjr!?HgTC{HX%|AKQ1VK)ZS1ofvM;)-uj=h7`$ z!&%LceCKqdt0r2XTdd$`r|%AKS--%9{vX~ zkBp6sx7N>sd1S&hP;AOBkvsAaAeEHAbYETmk&;uHdd1T zj3(g`gYr!qAGV+KglGDmTK9Diryae5e(5)!lU`9V^hu7U#50mj?=3vTT9noAG?%Cf zbAjg6@5Oci-+ecwG1GtPgAkXvOhKX*3=rI)IIUfNM^yKEe3GH*SjqChR^&+ZJU}m< zK7MwTGFRF4p)~z1IR2MLR3A?djFz6{9=iI*n0EK>a9_`Dy7}8m{!Fzcuha&;F44xYr3m_6Bpq$cmYz@ zAS)wo#!@4{r$%x$vH~jm67+SXuRm`3`Un!F`yT+gT+A35ltRyvQ<_DsFVIwj#`p0A z4%gedzO#WHu-#owCih+F4Nn>ggX^Eh^z~1}6;ivZRj*sS;@f)up#yo0ax$(wv;bCn zKRmJPH-*t4H2O>S%HAt%mF|1^XdH7JJ0FBU$RvIgWD=*kOycyCOk$q(p$}OfQrg6I zcaF+AvQ>L!e-(4lE?`$-MrF3B`P*&BA_ceslwQev~}1*RR&Hypl^a!aayx9?vEU zWdm2aL`xCsQ7b@96)wBgv-cBZ=dQdqrG;!z%#cckHYSZB4<0Jis%>B~wT3*!s_**T zZsRGoE=*2m1~04!yUh-&-{{V5bg8i_Om{Ai;rnsbouot&RG7W6zlj-f$C+2(ihZ|1 zb79m_Lh?{UxoI%V_wGTvZo*2lmH4M`*R6jXyKchaN5FP9-psg3Im7k~ z|1G<2!uSu`b@N90XEj&JCM~4~HSu)1e{t{qAlCh~jple;?AKXV(>`1R-FqJZn=tC) zEAlwIN7W-;Ey+OcQr%?t5;Q-WKWBc-o#7^Iju+ z`14r$%<=2jgnS2JE4JNlUcDZ`Mh^IG0qXkm&`iLc0Bjva-34IF^|D`+!cCjlcnfJZ zJssDdo(7GhN|6ZkN1~W;H)TAs8g5k2#YU?IsQzqyzBKyC*ZdqqwE9q&s71M+MKKM6bF~%FU$w2JBBFkWFgmyo&-%cx$mjAqnE*aT; z@MQl9W3YITgN5?B?JAx-hjz5in@#IHHC`qEE)2CxtLUHXp`MvmKoi`3{#5PUf>+GK2D-J`SO zjsjf4GVUm}uQ|Csw&A+_L8b8Ptdf;#lT!)29p2ton=7aiYR;*Ny$bCLDJa&%cB6Ln5Qn{jf;n)d7-W1OW^SQ)!-rI^xVla7nh< z!?=6r{w2z$_s=jV?g&MuSAeHk z1%yOL2XEStH==Zzql#9Q(g^0RzWnV*;i`0R)`yw7M&xprzulxD^hH0)S7}zp$wFp4 zX&=M4hP@-oE7j}+gu~2nQy`_%`I}a7+#^zh8Ldt3Fl6z^9$Q>1|54l#X1mTXxkHWJ zp}YDGo1P-3sLp?k;06Lk$kdapIS~R5dGG87#;_U(O=J?@Clk zx+}qry$Y38b}OXQ#bfVd?cdo5m2|m)TdBp}9v@d`;RRuZl{8u8jXkt<*)piS_^k;` zQn5=HT#!V?`1hbME3v2_FWGDND5D;KB|f7CSk3l?u>b!L@cn86w}^FB0(}-csc-mg z1f*tzw-JU)C-rEfn6GqFA5J90N&TQA%D`oXCi*MQnU@uiocU#iI!YP3Cs7>A*JnGa zZ*Kj@!br@02D`B^!Z^yZR=bK7eY@1xMC%{)`EAKwkBpE?Mt@VgDBp!ide359EZ>8v zRoj1H1pWuqiV|x;XekHvA~vdJ^_uzu?$Q+MMITnDaQ`&*qM_9n5QmzAsTXl!2CkWU zk#6d;Z4Evx4p75smQ{amsE_j7?Fw*26p=DMHRoin2>OfDk71ay{e5~`_Y+iHe>(fL zJnfHDtKCnT^LjaNGv|47k`92+$$7guFP8J;=G-iFpTueBE^mudL=v^^M5YasO|<1z}9KHPz zH(KJlh_!s{M{hQt+uD6HTKX8z>vrdxv;D{?z;?T{DkBnB!yVO9`f3oTNAqLrIPKfE z7j4t4?M|ilYD?N3r&YC6%YFob%HGziUwOEMR-LimQZ^ixmVB#bW0eP=O&-vGsiRkW zs%1Ym^qNDp|D8w=5~uFCI#L*$_L&o%Z3$gG~1MQaABIP$iu(KUDAXtn)rr&8UbmOU7lAUd%Jx0L-9 zQu?fr>#hdNZ!wmny z)yZv6;RQ#DRstK0Uy|tvF@j#Hy7$7Y_lt-1-Q7rF?4n zN%n7!K=u3#67Z7nm~9sj<+Z?~75G}h^A-3|_A?UL={*PKLg5y`3{N%!v+N9?yH|4e zulV0l%l_Rm@^Uw$L%_LzDX%w%yf|#`=e3m#`bh5!NQF~lrVWs!*E!WQ`K}W$ve&DP zZ$1Y9aQbs-SS!A4SzOP4fv0sh?9Kk82zI@U0Mq&fu{_44Ap>##FO}fSPm-LMF44?> zg@0%R?M1c4-^fUG4Ew7&dN*cI*13-(f3I~L`qz#F;|(tRwQ|%JDNYZh1;rh;=Il3w zHeEiH{T4SH{R@e$XD?K{^x6BtnS*uQ(I}DqCn-iObtC&7ZYWmjAxjveKp1Pb;}(W!Pl~4#+pd#eP>$aQy;(+i{&8yAo@hEuz{IyJsq! zEO>05QCW`<`KV|Eyz0|h$YKV|T8|DS{fX1kYmNwx$JC`f*zN+kBiRH1|e0F;)EO~OXZ)Vy`Wx0Rc)8==R zu~DT%kfn2$Vz2ZJXiZNStFTdI;XIO81j<(Bd1Ue|l|Mw!t)O&qE=`XP+WQ4#U%JXD zw)LWcX^r&~GCxCnJ;E&iB}bHuApKCo*b&)FVUL^g;2s<&Vm9zqrgDlUs|dPcbx*7@ ztaaj(u>dkXZ79a3nd6g)cA4s$Xl>hR*4jm5{d1vjZq=UBW~M%XIk~UurPC02w+(}@ z*Vpp&(H;-J5B3-8pM@*o^77s0{4=9Y_j7VibU!bau~rt4zUDtFPR~|Vbp)T-?de#2 z)f}&_;Pb_^cGK4fLR8EC0!}qq8!vX|T}DHMU+eD;d^5F&j)1ej0^5Hsa|<5yBeNaI zkh_$B!@Ht*E)#KV{#>RJlSMU+;hIn8qauZ8lvky*JCSnYkMXbgsb9p5w~SxWPb~h@ z^5bYE+IgklyNr32 zf(B%VUlet!hi0@Ja2JZcT)j^qmGneV&=u@%-}dM&yosKXCkt!u&OJc-BS~>bsZ8N0 z?g)AIX5icBfTSy^*kIKzEa&{YvQUeISCvR@euMGKa8#kaS=;Vp8mg?od7IFg(Q4rI zhe<_pSi6UucDkND7k|)r)M>jJRPw0uLAlQZZi}nH<93Z4ntf8g7+D4;s|)y96F*h2 z+E;m6sYM2n^YFH;A-Vh3+%R`GA@obr~wVP6z?gpGl*tp$BoFb)Y0(r_3R(jg-0ad7wEdtLyq$ zS&bAw+uOT9YngdyyA&#tvYQN@$`03yg9V918VW@~4>$;g{@P5kXw zku-fHKaflNSNQOZaOrqSi{m1-Bew!}Jl;4P0hBu%^QbMBd$zddw2U_lOx4kO-{lAuS4o>CY?T?GlS_ zP9@2twqTQEx{&Z-P{}CL2G`?5s7BUYleu-*Qv#}hLfb9RZFDH)cHa>JB%~LJD|?pf zPh;h4-~;O)mAYE1*6d_KSB?9nw$+ae!Tq4BcB;Bx!u_h7abIaXd?UDJ#oF2$SJl%u zt4=s4y^OCEBQ6HC7F12QrKAfgjUlTkHU{JP<3=ryp1_;FfpiP1IZQQML}2g*xb#hc zY}T@9d59P{OnzUnK6D)ti#Z`C+m7UJvJbNo=gO>vmBaR4yGF;pC|Yn5(9(Nf3&N`? zlRwa4Lae3Tz;(#Js46?9bnN{sQtXD>&rF#_X6|Ga>B3{u?MA^W)Sqo`vuh%Qe zmZ@rE`5q%*YcAMp`zQfce{s45GUCGAb8mb6=?)h7bgRX|}+tW(N8gbQWuaoyf+{ka6#f zdn$bkZDT50-1|DCufAWi@A2)c3EwEsixjhE+dqR=@}!63>m!On6nx#K2rT$of-Lx2 zf-LyDtVmw)b$Jn3@O9TBu;6Q21QvYVtq3gmI#mP~eBHeWEcn{b{o(lf&cN4i2EKkH z@b&HDt2{4KOwL!@?H*)>{4QUJeaqlk=h-3*A>s;=a)V)wID6Mv`!0Mj`=*cBx02p$ zv9f`92JQas>O(nLlD>|}rta-90M%@Q8OC=IzL7>Py^`2bRwr>s8Q0R+;O~ALCpIMw zeciCfb<(ValA%U=3m~jjKguVpk2?2>=xgK7clf#-#_?tE(1P$>;Z&3ZXk1|}s7$mr zv;yZ}~dacm>ohi}8}m+p&mw2_WLs13k~ zmZU<%RB!x-Y(k~}D0+p-*kU-a%V{qE>GSiEWCTC;7Ado%{RP%? z%uie;dlbKH?|a{c*8H^YR_JQ;MtgIkLMY8{Nh*ysbQAAcc0CLw82cPXFSl~3YVmUYdlwdP2c-L}_9zDq@~ zSx;zEyv(`3CeQR*lA+4UFFjHNM*3*7v!@dLwp#1C;IWtPUClMFnN>BiI+%Xz%f8-$ zq)A*Sg}V?``^@mT_ZWaYZCHPG?luYuHHXEY>>Nt0OwS4o`zz3#W;Pd zkt?O7>>AOG;NS+uW}k7$E4K#8QXom!i2{RcpRYYqpALrL=tkqKaY}Z$LROXw+xde? zI$WRJ_PEDU{ZWU{<6msItBb$ z*&*&ykB+j($>XHOy+ivcDHEBh{=W#+&9m44o#Z)C|2Ivq|D#Dur~5H}@Q$G* zAhpXh!KRPI9bBs5aiIPSE#dJ{JzGmCg~z=ol!_M0R*Bw0M!eF49N@9!d+xiTg@xN; zfDYG38cU9QTmt|xUhBXm{2#!-gpuOC4)TuTfAz8aZ0b+)Q=9rT?$o9?sC0DA=F}!N znc(ct=u?~e6Y+pzvAouGtdx}FfXVa4sOZQ zCz8dvijmdw>f}E?k)Xv7e9(M7#F(%x%JDZ=r}*_UoJR`yT(NYB&!7xPf^> z1TqZy9$zpHNg~euDpglG{G!?(IPUM`n0M6Ha0tdB!6BKjCX3s}lRmn8)U*40O~!xG znq*HB7qR_X%Ez5SWY8~xljza|<$%sV?R)0)*<#) z_}3M_ZTcNS_WhVWkRP}o3Ld#z*BsEYIE-&vOLXwxVQua{z_(pzlf$D_KYl)*D!5te zk87$AnLE&4bM;>QB)zLBVi@&%*Oc5(rbhDc!%Oa`;EoNikG95}cX`MR0+QYl)4^q9 zGw6H%h@!!fAL~=?KA?g^()Z$yBAlfa+c(7>!B~EAM{v0rR`hZQbf~VvuST)s=Mr)iYFkQzyymdOs8$6qSA&WQ4D5eMG6&G8=EW-^(2o zRe!ESZnxmKY%v$Z{UD44=ES*Pt9X6ZLCr>gSewutq~Uz$r|w$oK1~10=N2W zxt~;eZ?TRflmj+YId4JK7RKO8`tPEcIuCv4=T5=D>r?IijF0ME_b8S#?CCG=D70TY z2H8=vbpqfdTp_*|Qgdb;vjBQi&x+7c>u zc&(#+74=l=dd-fctn`jn^Y(aY?K03P2VbyNdLJ_mS?;FO8%VXBbSP8l-DMD#zaR?6 zIigDX3$f4B4Fvg^r1O65#q?KNoO#Y+styt{ttUf%`C`tbTdL(G-ru92Mse~PKF*ND zG)>#6(kn#_j)lLVxZ1bRi>?C^1}|kFQi18Oq1={=FvSAy@S@0V%s2H2kMniqqeNl| zct700p6)04)Ur?UTj|}-Z-_Ns_l|*DkAy>p*3JpFmSFAuD`nR@k-GHA^es{mD{S3M zXZaa`enB*Qa>&BvBtHKWt|Rn6Ov*p?V&*m#1zsn&I5Seq@c^?>Rx ztk~zvSz58vWw=9-WG6#|<&e0h8OxbawRTJ0cL6%F;P^A2m%_OBA66G@H6V9XK+3^i?RvTT$K$!&u~>WjMl1&3+~{ty__DQKh4C2DagS>fq*Ziz zn%7q5ApW1szm`hR;{OHwufC9lTFHHS z$^FcdTQbtPBg(@v!rC(PZ($t*2~-u1z`l}Q?*AkOGuUtSsdj(INAd5AI||8{VFJq6 z56`lU1Q_mBFh7;@NE^z6wL_Sn{s18Of6oWRSH>N=a=ePn@jkm>81mP-sOEXm0)B5O znZ~g0ABAas(tD24A)gIrQxRbrz~ate*csEq*805`4rFyTQThya&n2<5tPrU6y7{XP zRLr-3Aw$aZXML*OKZzJa-o@n#m0NRK8j$Lae^e>hpaIpsbi!kTko0!>u+x6g?Yyu))vzv#-6sQkBWyU`c%6inzGhR?uE@t<|2ju1N`nNkF^u9h$+|bc7)b0 zeswK>hp;uxZDNv5e!1~`LF5ZJjd80gz2{OK9{@ng-d6L9_PFXBQ^c3W7SYP~B=xPS1YXV1854#2-tDBv^k%p7iD28jZ{NvlI5Nb;_2_k&S6hfaT z{%D$Cy%SL(&_rSyaR)$sh0@=i_=w)|B0c75oO_i?&Cmah-|#BT=S|~P;U5aTt6RSy zN7l-Mv3pVO^rEenj5+QI-sNuQ3@ZYoJ;^R$xGFRx_Gi}8;y|Ic`)sh8#Z2s^Cy zJB_F~E2UZb7^%CJe7zW1n5-CTFD6%6)(Aze^qya|?7{WxTqEMreB_WfG%js#dY8*@ zBN%=3;m)ScCW9GgepwON7hCm8kbS9DuLRkbU-ix@lJ_N2y%!XL#o1J=2)rg|S+89L z_9bQI-1{Q2a_)WMSULB;n5@YC;m)QcWz<>UHpbh7 z{Pov97n(PY5!;p!ZR31gi`wU@Am{Tlksb(&&1$R5$K9<|&|>Gu3%QyXjm()7aeiEj z4kPBrw5gtuENiA0fS@PTadsh2H(Z?ZAaQNjgVAg)KsMkU*(_a$TH3+={r)+%^t1L| z7byyR_Sr>5uF)pSovq!U7F3b*HTv7)-a>NC&nzB8hV7rJa0<1k^jMB7rh2jWRX4}R zzRS(cvnNRDowcdOy#*wY?#@PY92ggn%8PY}3k|a_B&8d)9J$mLj{IcFcFU&8G;oll zc~*iZETZ9SEe#idKycCow}yM}Ik@&J25o0rwI9{JbJP{we*7_;~J ze$Ae}*7%`5sQuTgasSNnt>H3(%*#1ByPb+-fo~SsW+_kO*Cyak$2R&y9P<N_qgcrvcFwTfYS)neldL(d!2E| zXh@GHtGFXVvd7TR0P)OJ#k5Yw{|@Oz3{7L7&>p!L3M_{g$?y zN91FI%Jfw7)8E6D$@!5uS6)Grvd%R=Wmhnrafz`n`!L-iM27qAKZ;wI94CRCH5Ddp zHi_c2^=7YkFa43mcq@dQqEUP7S89;Ky`257W=(m_jbuaaLrVsK-P)Zb#!0necJj2R zTw=O%P53;w^lS*Gl1i4*7<5{1g3M{gg`lYe5Ml10`^9QTGTXqRBpd|3>y0Ot5v-JL-wmh&VR*z^{TjdqDFk4 z?TtO|Rt7Z^e@I3$0iB5~GCu6U{fV{bk+j-7pUjJQWRl`G(*MinV=hpp{pVv!nf@Po zHOBkKVtW@+HZL!RW_tsOvo5z~4gZ3@f0Lp0E(BuM=cP2LNX^HeQnEgG@TN2JVSMAx zq*Fa&`@e6mCJUj(z2_K|bOYExMN6p1_K@|+qq9UlTOWqkFu6ql2dMf}k!IPW2_a?6 z9?rWZdrd_5LhFudb8&VqdCaZ0PgjR7KP!{Jr)qD{u(;I4s8L&S2Llfk*5qcZL9eJL z{xFPR7`%VxEpt@}yMZX``z?!ZyLW$}c3oVeK>$Js*BPUTxTS zHS>;V5oreP!nv*_S8>wXM0mPU?8`1?MeEzAq_w3Vj44wShWM2|?Ch%n1skaW$D(Hh z9C_Q{8DXcIp8UE4sk%K3T3Rm!5<_sl$aZqnS8_Wlwtm(#3?y9KJCky044fNDQSynT zpIhxMD|N`11L+-7p%yhuheSwwF^gL3VAe86>>hV`1g0LI{~8LTcevL6Lz^20uC-&q z!tb0uKHBXZAG??Al}0Dh$B$6mh9{qkLHhsMd)f1u3b?~>V}Bj1Ia?W?CCQ|B*(@;Q z4eWnxe4hP%sG;_&XeyW;lHsB2G%}#L-5;sPMtEne{9N|jvAI56k77ee;4<`6$4b%l zxKn>8sx)5H3-@QovS403HqQs_dDgDBSAUy~R)jYY;^?)}`Y>kC)_$7o^A`8c2yJMd zol~4jJr!$-D`-B0WB31JQweQlWwcwcJD@f63Toup(2!tX_42&&;=W97J@eB>!Z(ek zyic7}+E11qkm0F(`v1gkk2Mv8d z52{NpHoc5yUdi;kzoh!(Q;ch+0*LHD_i%&=!2S}mn&bE0k-FGD6G)UX9Dcv)AA}_iApD50{TC>dE9@C#P4b8076^=(6a*)BW5+{o)mbw~eN+ z2Ab{_O)F2zX-d!%n%ri~oMtk)^yJBukT4>_+0zajt?$Nt;>SEO?ulk!QmM z<9*GR=?p3gSvwcFx?Kxv5OgI7#wrNmkl^X(@0Na#3+4DPpP<|eI2w2}9^O#SuClM?lh@NRcFeF* z4E6&jRRauLu-CTHdh*j>&`K}?CQE_qU@1Y8U3I5aQM_iaAl`-5hdtwa>|0IWsc)Qq zfKU2%e!#2#hOBaT)8pp4tVAhKgH(Jhk*33#nK>!J{>Uv>}7>rPV zD@28%f6tGOhEDy(OMk-nXIzZa_X<|qz<62uHr#${;E^s~bgHCFV)YcLRF%1)(fH+K z-&pinFuep`I8<|T9Y)5_0@U7Z3rP)?9XN475!ILKl;9NLtie;KQGI)Pucn2$3Eia| z2_z`}0R*nu4i5&*MbC3J{r*samTWsEyGF_EBx}(r!>b=*z-IvLVM_>;E+S^`6=um6 zpMo_)<3pf_&nY}>uQFX5C*0W^VhTcrzAyDA8Tu-HE8Ts}TkG!4m*z-YXxjCPmuVcR zwhpK7hw+SEjT>Gsy-k!I#1f&2?PV=^eOw{G1$!MBtwyeWiFnvihA8k2lfBJ$3{{kP z%N)B^ZEITQdjVymC@GI$x13HfQi5Nz4`jJ+QXZbS!<*>fGNP%&Fp)797c|= zM)<3D_*&;cen4e)&4wzJK|_ISm^?wN9CY;eCyV#TG)V?(_jjGQjNTEHx2FAFsT*g$eLbo1mq@$0!I z>1{AzFdMXD16-g{9lNA2V(Z+Y9uHBK30S}r=E^(CKFIIbu)UF4dhW_@4~BviFR>?K z?B6E(0z7y%vy4_eK5 ziD|?-TL5i@Rg^v6QhIi&znHnt0joU@iNcdq=$+Kvg3~LI4G#I^0VQ$0k1>m)|Daq~ zsgD%`6*hG*A#?{bzru+_+)*D5^`AY13b|f5>k}raER9UW>;b`|Ho|?OS0nWviPG3Ry&~4s`wr5swj-mF}bUVO-wdzSZsl`i^(k zn77tlYv1~S{q5C+Y0MT+DT8_Ui#x)wFt=fYUzqy-^W)Be_+1*&)5`7vx-mDG6biEQ zp-NxhgSaj=^Z(1##fu5&jRdtHJs6=cTI;-fFHp2@m&wT>*3qO z(H9%P68kN0io#k=j7^Na<+U2m5|i5%XC|3{^Q~pmjhI`ktI0ToyUXaU@8xJ#eR(3# z+$ii6%{Exy|F>Q?)(#^6mfI})0_^@dP2Gz+By#bfRj*KIb9OWyl_1G(Pzsjn@8Y{gY7u=<%QQrc6Vdt#4Kuk+Xi8T$2Jjdy z+QS_I{JX4O8(HrLx$A+}viIN~o}EgK5ic*r$F-@?Y_I;f`11iJ0sm8#EO2^nHIqM z!r|%qu^KmVGkLHE-aYxBn!y~7GBiB1)>)_9_%s}y|6(7X4vn)90Ni`B$dnyZ7^k&) zfB)kfX*Jo{wgEPxdy#{xN$jlf$uig?DmEL|J&bPwJjga&;ZiI~|A|s>6rafZAJMfq zCblUZ+q94yw;l2gfh0WM@Fl)5=id{q(X9rL@+u+q^Zg?SYrrNGh$15BRN|$1Ee$u&= zZ=C*|wy=N$Lwn~eh)GV^M(Nl;HC@Q>8|sEEjNL?FQO26-HQq6kA8hf- z5J2_CW7;3Vvr&xlwxOycZpmItqvP5Ca)5>X1nfO0Fu zuFaWbUxtp6)vt$JjqEG9F>Xs0HeGEKd627aK9Bg4>ZT6JWQJHKXeAU|^JwB*H=h!n zL%>T(t_VrN92eD(wJ}30XL=Yvdh4+D?Nf8f772#38%Z%%RtCMyk0I8csz--N9}S#D z)Ot^(X!&mBcT|b%(<#)VvYSAt$6fa$X^j)KkK$hdaZMwRGqR5O#JdE%VM}r1j(Ei( z*JmLxf7`W|-At-gcc>1m9X~R9@BQA6nHQ8ky9EH%CF7wGXiQglk}U-(5o*J5CHkuB zXHXmMyq~kMY1S4NDr$NXMOd<1!CEVv`5Iw(^$JiqOg;M;K*m{zECmGkaLu8QanJMCNuso=j66F zO`c{vnj7u0Hjp~!@q%%o43r_w!EpKA9web_o2Vc%-^DErpBN7}dEeJWp-*XPrYz_kt# za`q$@yBzp!wT+Il)}H5+&|xOUEe-caErNS$#*-zK?FjIFhcxN!1hsxkN6J2pi+6Rj z;BD=98a?X{0yfmLJNcYBT)&)7J_lv+aZb7kS>70(Iam*cd2pL(?}NOJL+9b5leVs6 zrJo_G%CcZDs-5pB`6&U1SW&_eM@zx+FNVXS97k^@IMTDr zh=k{;#8pSr26Z#Vn5GZum%u~u^Eq)k<{%IM*P zGW)=fM?}1RsP&`erL_i+wNqaMSXIV=b=U8rFO)8I5+?JI6a7-3s2H3NHrs zAgbwS)^S?Jv${qkrfP9AY^nXNIfsz+b1=QOT@G0*AQPO~-NcS;UIXB0V#~9k?DGV* zz6oc_*4bOXBOp#SMB8-&I|*oi0niPNdVM_mA}&phQ=Z>Mb_rvEboPn+lHwS@eV%8A zjdnXaT5}LZ)R_jea`a2e)V>EW&b)n@)KS;)B6ZYjvU`bT9broEDJ?I5RioZ$f0?N4 zEBut!1Py!R5!4KX;zhphN#~H%jObtrS5E5;E1unN2M!<+Ej2$11kK0*Eoj_>Fxe8u zhK11w0OiSL>bjIqvc^=!4Vm}1k50=X`zi#Vi{cgv>7mjLI@?6JTmJWqJ^9?{6cmb_ zf#j-wgv%Cg$s6g{z_LayqLF?bCl}=B0>okXH}J9Ia{8BGyK4h(UKT=@{#Qo5?A?Gh z+usC=R-{2C`xfpIyMZ=8PQQ(3w9b2s_u=649X>WDXWvyooPLkbif{K#CBI+0J%)ki z_h*hJNj-fcGBfeg&a8Kg_C3ny1l`v;?pZ#*$X4bDp^=AEa~+LmiW$g;n;Vi%7v=l@ z@$8?;`rHqYp&8TMfi$i2flTbakG0z2ddt#YES2%v_;pI0t%ru}`=lMQiIXyH#xt5w zy8Cft|H6-5VzEUfp+6u1#hAarE`WcCZ^f7T1?EzID6q<9bKS|&y0?3|Bs<#~x{_h| z9d|SknH(os&9W;RPwQenCWf+C(tAQ1JEpbM8PPc#HHozjlS>;8;`WOt+JAtA^gid| zDtNDwjDUmat?mcD9=Cr4$=wq`6SsdX=ZSLK0x&MFi=<0I#6Yusz_%)HV-~2Ejt9SV zBwt59`g>TENvi|dn@-IuDtmxD&o!@bqg(Sb#s76M-n=_{{F@YiF+;1L2UvP}yU!5e zN$UpUvj@SNCamI(aGzH+?rSWrir<}+fL_bQp}V(A+5QFW>ne0JN8${6)ibdJVXsq| zW%gS8Cje{+^~ft0(fCf$A|JQr_s<%=cvuvL)@(KTdwJq?hax})@H_*AD2`L)!IRIiVV;TZG+s^lrEPgs?g;3i=gy0 za#r4qeRp6yHhyuf1TJBC!crrVRFvBmzMMVm9M+`@$?gVfD(bl}TxPWhEm+y@ z`-WfkW8MkPb=A$ZHSe!z3)9!U>2`3d<{G!g>{=$4mtW*_o+C-McjarDY9RLw!bu~r zmg#peTs49Wep+}*e_^5N1q_L1BgpIBI&rx4;SE6(r3nk0_AsI~h5)6mj%3=yMS{WQ z0m?f7s@6gy@uju(YpruuwkH7Fc)V)y+i~xDzTMOK37t6Uo^GDq0rHE+tsSZ1?b;ul zOM&+!l)B$<@)Wk3*qua1zepxH^~Oq>sYQ zyTI0KQf9Aw+}EB^W7j;&QnjX<{Zh5@6FL!dg!M%Z?bIb}!&PhRrj%HBw?$|{r1m0P z6M>fpke%x1=7RTfhWb(L4f0$4+)}{EN&Q&7+*90#DDnT%!m2qb)KTy+KsWupG=ljm z!x~O>qokU#5O-@i_FQJrwe(d^QCa_`x*2a)*Zio2{M)#z=|;w4tuk@`6rP+y+>b5*9i8m$g|_UF_zi|t zlciL@xsZHzoNWxqZ!`WwUH)M@aWy>!DwzxC(kaw~d9tI#LiM>@;!U3zuG?ZPVc8=crzDYt>;D0_;iszUQ%wfI_AFwSc_3^*S+ z<(X~Zq=BDmOqZ0VmOevVpIf#0Z7vtXU5STM|B5aabIAmanq$Qja#4M>;!U6I^H;M` zl0J>-8x$y*)8b8^%Hz={v^WJQu4r@VF+$lN=br8v9L%_9Y@`u}pr{|Vu+k4(>F+P+ zI4V`zPadgudpUXSG8+%W-1R?YVKqGwf}0v4(i3oD?%Vl?(U!o!O2I#_YkKjFf7*wA z82WY8iQ;Erc#_zmlPZ{nfuxdsW{NUO~w6diHDTV>uZ~TWT&DnLM`MTKhZ} z?H%?x%U3^{n0o6<1zf5$b1SkTus5NNp{s4{#q=r-6I)d+2ZVJtHF|a}I%h$ZD;l1x zZy4Z<^-MrXwS6E9lhQkJ^XErz8DkpQkoaWeSO2A*-`eK+=uzeN!z4eG#CoOGg%)g6 z+`5ETe_bd%%!FlEYp3C?@S)9+$AYV-U*Gdu+p|63+-RpgeLpL^d$RSiH@Izujm*Pm z@k%kvTP4)07S0n!RD;d!O#5;>ILOtmb6aWqh}Htb;5q>vpFWbhyYmHtuMbjMANLKo z^`xcTp>gh~eSX6icL(;vvTrJ+u$NukgIk!t}}5>t!)3Eu8Q!7QVt+Sc4`A=rU~PQmVHf?Y3^+U}LM_VRYmF%q&DD)&t8^kS9F+x$^+N0cVE z>7N)+e@jDC*(B3{I$xxEV{z*uk^eX3jTlxCE3?bAB4qgf!epsmPrFL&Y3tFuNqeBt zsN3bn;%033*UdeQ={Zoid|N}G>#KopWu?_eV*f%G<(e$$1MH z(rtWnXPo^$vZ&>#()-Wzg+XJ(v0QmqACGpuHR!ZpN_{j-V@+;8nXHWG-iOE23S+^hPY(=C zH^{5Jd|dS5Pv;F!BkXwc+{8uBIX3FFUVIM1k;|Fpv2Z_L=$^XWpou~x>H&)i8-yN^ zevxryV;kNTWoty|lg|mtXCbZA^V#y)=$u9Ue6*~$@I0S$@&c66o(tL%inl|mTQ)-f zbQ-C3C*(XQ#Cg0+gg`JlS#+F{kFt}yEL^g6DyEUOs8A+%vbLLE{KbVaK!;eEzDW!@ zUzC?K-N7;y-Gh0Q%@G)e`t(fe(=)A4&$Paz5Fk5_?F+)ql9Go8+AbKNt@UNNI=M^w zQ99hl3l()r&a2k1h)Qo!#0v)_7Q7&j*f1EeXFsB&h=+1ieYT^wJFVs#(;Hc1ItLol zInbESfkr6WMbk5NwxjkuEz_atnGQ|QbZB~}L(?-In$Gs2S=l}mXzLDg>M3w)a-p-m zHyCxYqISvt#(=T$MT1cn^!dASFybmAyl-gFFkYyaTh()7WBv5SgNeS}$MzCM^xLZm z^KuHi1zCh?tbBOcHXja*Dik|7-feDV zoUF`D<%5NK%wQ^d%=iGBdO-7XQA6IgFBmmjB)p(IwrS@+J&%N*VhpmC8I(1hn2F*= zG!Jl=T_WOULm|orQ9v0=6{T@43`(!q8VYrWK@>APgH!R!K@^Yg7eq~a5Cu(J>@G&v zAxClPAd2Ha;eGp6MD+Pqi#|y`K3{zMQjVo{rs{F1UyFnJVa4UX9MT!bBr#Aywe6-+ zR9if)eb$yt57>Tszz&=47@Q(@oF3rCyiBF>HqeO9rYt;II#%T0x};z3%f*mBtIRlD zF%ixvF>sN0npZmrZ*lplW72&MAr)JjCua4LRrhNJ zB!!+ibP)IT;`EIyV8SEY9VIeLkF4hnn)RN23%pm(#QVAdyygS%H6^@Cl;gGd#l6=n z5ql^9l8=RJU8(!iJ9;_TgS`zj8x1Ir%hTlF0`_{rzCnl=w{OK=;MqBz$lhxqI>(*J z-dA$JKe(l9x{|upU)*^kXi(GFCyU`%Fw}4U1iu|HPqc6I#NIZl(PKS%NS{@daA_ak ztcXm!;cN)Gwm)V_h4YF)fpVM$@D2g8zc#9r8SK;ky-#)7FC6l74%M#W?h1;lnZi-j z@0$n=?Ix=MMZ0-3L25TyU8&4R{eFUUdAm`ftRd)ekEcEjPV2)%$Wwp)rg;_6Ro5t; z=w6M7Jl>)_@_dIpUqxBIP33Do=X2fmq=vI|4M1xcN@2O2*%oJQwkpE&Fe-FjY={cJzLh-k@{M@; z-bRp>Z&c+oAAD5-a=t22HrENWc<|a68FY3JfPB8>pL_Yx-jmG4HX>U8JGzW$YC|}@ zE0mB)`BM5?_FYTY+gf}j`)2{53!Qz(AWaVJS>nwR15Tu#?sKry>-SFI!OHuk5#_Vn+IFH(5A5D2rJ z%2hQF*_M#>w}MLAXIc*Xg**4{vphrP9h}js*3HZcN&D%P;9$2mkLeI#Hxba)rsVxc7m zgAW~LH+6iRo(y>CpG%U3>9Z}9v!{h;+fkYjIXz7!qaF~DbH2-$f{EMdfCvyL@!`%FP2EB0hkl5e{?t^uu znFkuB;`mHHnt%3-O__U18YYF{PjWx=RzJ?>u>Cxt&e5Jt`WG^Wr`t2awCZig-q z2xaZrrz+n%|Ep;M7@uA=wOD;Z?O}26G7N-jZIgemFu(59&iId~tTU-Y{a^TJeWZIZ z?1!(V{x;g;O!l|h+^=t@@3ZzIor-FE?|#6c@?#BQRX@bbuGL{yi8ulFtrnVZ~_+i8g}vchxsr@2NQYV%6q zovQQ}@*KvblW4BD8Ah930ekl8M+sdcT~5OsusJLD2Xym;M76#O|2-*|Y=kGhiJ#Hc zyAV0#5fV5%GF=lHtBjcWpCJbvN;zq3?(t2}v*DF=0O&m+do<4MKzuSK@ zG!U)H=DE8eOhmKKDHA-$gX{P#2VgM(+_;bm`&jinc06-**~TtHq1R`3FSb%T4Lsqg zl&R>Tec>4a|IRrdS~8C(?5X@Kq5iaw68B!G{xP{SI|!0^)oy>O`o!b4 z>;;fEwb1KPWBe19h`-nidNAM<>sI#z#W`4o+-T>zCZ-J>mP_@O_`Y+6$V4G{C$+4>Jd0 zOBjbA#rGQMm?=t0@1l7p>7itkJ)WQR3H&rSi?rpH=4L)N-%EXun~B@6h#JV4=bRt6 z?jdlQfbZt>E15ow6W0HPL`5fiz~1OXH4 z)GTX5Mu?RnSbe>9Gow<}@WFXxM$#2f3Q(i!!t4+wgoz@9ciMl2om~pobJkkBFXn zek6i%-x%%xb05}Di>-{??cY>{xfinmVnnfaY3mo-g}(HrW5LPd;5a@2(5Doj{%0XC zcmHKyqQ$lTh3Ue>FS|#_HCQuI8jT;?H|Q_1>xjC@Ei{%aDV%mCWsR#)3B937EGNf^ z+JwK`qjqw(76Jt1HYJktzNlP}7k#p4q#^G^>PwbEb3PqIWZI>Z$sL?f454fp7qJ$4 z{ITMJk5|Js7l>wmy2|d-wSG(y7iZ5Pi(t}2Rx3P8SJXTTRtm@0W3zPAJ^|?N2m2#J z71IPE?DMl;5ATX^Eq)2} z;8URcqw4>;8qsekbapzJTy?IVJrnmx(nxX)%DSDhgjt@s z&~!}~L@UGHZ0%DPkk`kRSG+K5Q%%jy+IuYDvKU$gufMr-qht?e-LvA!h1tCfXBbHN zt$OZz;d@#^IY{pYW$z`%1>@Pfh`8cRzsaS&%7;`fycs!>Z6RI0{uZC|y}-eR1bw4J z&sg6p>BFw?ss9fvBh7E-fc8Vo?^_$OvFYJZS)6qX` zIjK3tosYmtQ?R?y9JbvhfpGjHv3s(;TZu6l`nY#?S@0}keD%N09OMxzVGEFAj_!qi z2DrP)H+1r+kZ~>w%Ju=MtGr`2E&3+ez67NU6fROcG#$r}{^WDiDbSysk9VZ8_7Py_ zFhVIN_hiL+2GJAQC($zVw0%GoJ>7)~r*%5H`^#jA0OF37);ITBwYLui)dta`h;&b(6@n?J~TWw&gQt)YA_6gIgx48EUR>0?@Z_`>kB})891t z8h9AC7n0dFbG&jWSW!7hi6$!j@&%DmsGEGv{SEPVa*ymBdLs3CfY#{ARFbc{L!0t- z-nR^P<>a2mFQBt+=*p9O?ypJ4^S`stCB!PVAW6}xMeSh;ZD}7szazTSGvRr2vluY! z9KNTYRwfCrZCFzpWoz_!@wPP1AP-r_a(vFA)`*g974f!^qinVw+nxa2$N06`xkF z@;M;q+mHU2_{N(=cR*yi%-JECp%*j+Xii)YEkCvVG~B_WTVMxW6*AA&!VmRKbt131 zuYj%pYG0De&l>Hsf!+|;x;Gnpt!#(J9r?1S(x>u5uWVg#K`xu%oYAOI`_z`}XVBnH z>;1rZCN}Pfo}x(yzPY^U(AIsx4z>&M?xNyqkFZB5_ZDB5h2iBv(SWWG<^XzVL29Oxb%@i!94OQm5lH0;rr?E{Y3cQ7QPHEvcWPDy@R#(&nZ(fxi<8< zZP)Ej9w-`EXF6e>_HoHX@a;cYirdpRn5`3`Ch=xvFHB4f7l|RfNW5+-KGY0EBp=Zj z_ddpNSLC5z|1v>i2r2aAb*GzuQQ!YmrO(F#OT+-Dw1&m@5{@;5ew-)|6(5qCjr`eO zF!NX&T(_CCT4VoAT5QiT!Yi3H7}I@zCSVvCe;xO7)*Oa=tU7su$pdigxlR*r+!1fr zYR|@%5~{8jM#P=%UM4vk2#zm8$!4m1r3ve*;US<*M=*0N=H` z(ss7Zyi9i`wT=Xe@@q59nT&C&pSv8 zUGFTTd;0*o6*JKF>Cza7m?HG)&%xEwTH+44YHNu*%~4)U(8m-wwIAw9aK!?lKOKHy9*|_#Qmj+&KxoTgL#MXoKqY;QA@=geb~YrE1McVaQO(5d z8XuClBxX2et=b!7ru00vnUkdJK+NbP%SK(56t~O}byXZ*$^we=c)s;Wwsd0n6gw(y zzkIBHF%%TTpy`ifZPJFZaJcSsjrc5F`CNCXwcx=q(dNoSoR7y;?B*VmBr->-T|COe zNxw*xY219Jtz>MDo%IdIVm`e~Ri(X`9QiQc-_zvtTHa2pl#~9mGPJMj$_?w^P;4EF8Ox9B&Sd5=!9%7j{qHRInrw3$))Dimi}oto zFn2$@@1|wfI{I}Z2v03ATFKX32Zil@tZyJ*RX;G!*r|fOOj2*3FRs6rsMV@lZgPor z&eZk=d0brY2qbGkP5q+x;oPz=AA3%l>fQ)jEYulm)6N?;)dU+>7By^v5x;KbHD z!f=@oWE+T^@?fqEP0M>U9I%!UpyH9 zlIigmdw_IuPZja}B@45c5}KY1m3G@WPTO)yq{>uibO@l-l`>UuzR&~B-t6PjA2GTw&&lgD+`Z| zI|YcfG}@GhJQnJXw37{ZSOk^u=p1kU*XyJ@n15{k1W*i7cy(~1|+k- z+z~O3DnNT43z5A6-G$pxW6>)~+^n@uXXx=$0L~f(ecAUU6h`p?d1~u|a;$J%_Rpo* z%ZpfBlB=xw{BscQN%iCNzE29CQCLMl`f5;kHZ{vEdkq2BRZ;|SL@AG&{bq>gT;v^a z*334}QgAN)z>{7))m*yU)1G!i?f4ST45=IDNb`sSV}^*12(3XyU%@YAcH$R8HZc-D zDM0+PkepvTmH73#qRb9`+2#^QK2(ksj?3;Z#r{2h?QHz|mlD4a1;P{&RkPoWElS`Q zI~SsqN6mgSwi~nX>k;DDF<&|4S$(z?I5T!FC4LncGxjkheu;18|I^~umno>9Pt~Z` zR<#qI<7ZS;v0dg!CXO=QT(&Np|DggV2SKJ+Fh_wT(>%#W$J|p|Vk^Sau^ews^#=C* zCz3}lQtYya(OE~$#v5MKKnA3sjQvjY@&_?P3U3s^c=JwuY+XdXeoX@*`F70#4ZQK( z261{VqgBcRR>X*|;PiLPS>-C6@$|!h5&I!NX0Iy!hyr-7Ljea%$>K%@R0BjGmrNX>!=l!_i;(fP z_U6|y-vs&%m2r=}$|B!C7&)WtmE?c~RLM4RoR~Dd`%w|!w1;w#AL6N*MPN1y3^N{r ztl|MgFp9)f0@`?Uwk+u0j4!TS{$p5!?-u#0-COxkU16N7N48iOZ)ay=QW>A%=v!>d zWz`ky2fIB?8WMa=34DC6nM%ae!@yU@)%qTU&RY8M5`8+Wr=em}A3kqc&`}YZ6jNnL zvQO|kf6javhe&V3?Zt0gy=>G*g<76se~GT||MbEIl{}<=op^!{j4IL5ja56JG_0TE zcg+=qSJ&*$Z+biaxfP;6jU&5*ADNxC_h4Axie`+pZ+-=!W0kdbs2T|6z!}$_B)DF= znShJufAc_UL~%Lh7Ymc8Uttr}dme&V>JCqOPbunJ$KHM3ub$R@cI6o%|B+4pm5 zreq11iUQ&xtIT~?@x zsiDA!(V-Pz?Nh0?Av-vjO^a4+ou*Pc5c# zdi{T4A=VFuyyEMtFYePmRxcBO0^w*k8THldGZfQIyak{Nmdrv~+Mgv3gJ(6{J2!^L z8eYqi@?h|+5vq4$!O&*$2_x{E5hO-qby`o3LwZze&!-v{EAN_r1N$OwzM-hXj~O zAj4&nKnQ{}lWo``0tRHs1VaKMnqj#xOw02dw#N&v+L z21Rk#=l0wl8h+pJIaRlBch3ay`Tqa;Bz^C#I#qS*)TvWdr%s(ph_)IgMebVB&MB~E zXWp?UFFRCLE-iTmmo)_=sg+_@Q(Q)9cWix}qbRL8%skMHvZ2RfXWe#-v+taU46xmu zpvP2LJPs@#Z_U)O2xQR4y0IuFWjj;#^eJ#nuk?4F!;jSRcy@^E`2$d%<*Xc3<+MdK z{i1b%J=IHH!#P1l*eWBORQ?(&bTLEWZeykk<`B8inpyN{?5*Z=EE9c#miRzi;+;l5r-Y6NHk8M`hqzw*NO?_F+Qur~ z(pbXdaS8Xtb#fi5R$s!lDnAI+Fm6>J!c*r;ybItw$bo~1L$b$PLgO-V_&oIBr9}EV zZW=9i!kAZ2P0Fa3y}2VDz8|w2VLuKO+U>u9ZjXIbk@vyC6+pts`?_v_Cc@K$N8UFBzxP5vUVtV{G>SO z9iW5d=F?VivQPpGW5|F28KiPUBeORfX`=R1&}e)EWU+Xb`YB}`=Maop93c4)M>o!L z{AX7D<9R_&YYt|+;939~)x~>k`J2d!Td(mvVsF5`6mZkdBT9B2(ImB%UJl1HF}S$tv;qYKQjF_PmTu7q}eP;5+tlbMFz z8B4mjiel>oKQl2psND4^5jlk|q-oKk3`8V(-0l+H?k|2Vjlu|;%(tmLBBzpfxtp1y$kQhy;6ch&N&S!mraYqKUJhw*cA0m zbI%{!cooW8jqA=2{6Q zlcAj$8=Swx>^UbGL7s;oPcv@URzKb*SrcjY?~k(=ilpApK_WNFP1inm>`(QvuJ?W> z^=;LqZ_&89b2X)_uGxXq zY&4Y}wyl^4?Pd9WsSZ|97;re>cMCWO_9P=|mf(&Zv(g zEk5J*8;(n0QTP-fJA#gkU4>+D1DCEO&5F^$AY5{(4e(eo)Q0wg-21iY7HfOJOHD81 zJW*HeSU|~QzFrpUnF`?Kkmwwb4#$7ia~bA+lu7&_fPPv2$2jv8n;YP)5CgZ+&A%DrH|JlXK2f{T zG*+-{PI^+*6saZOwriTK)3t}yqqxo<$mA%^Pehf;O{Oj;<*%$9rMx>2@JA~@prtrt zDE|OITzxD?l;sSa^0f_cDii4XH2NXn5^K?)>*B<)5-9%Vp!_sIrd$rh>w)!WC@C#2 z$JFEUqvyv(6bV0meq5e;!MJb&1bcq=o&MW#80jZSS^X(~VwF(!XYv)-wfb{>%eZ&} z2n1hzn0GS)Q!uJ-QR!Bgx=yQPg1}%cs-DUx)Kh_~r*tScy$b3nUvzpn7RQ2OxywQS zWh`H}kKE#D`4@LG7U6&t_=|=7*-)VWG zs4!gLQ|7N@xiy}kXu?6dG@7FXK-l)f=Rdk94rT`7EQHuQa44r(-_x0%`XYjtra&vM zy{&IX_7c}4oo)M4KHLqdb)H_Hjn`I7!nW)X*E}$uDfUBgUBd7<1K$PZ1MU&w9$<`# z-ZE0!1TXrbQp|j2g=E=bjwY$>2{_AG#ED5N4h_@UJ8**~|Ammb7y^g52NBF#JHThA zv}ZI2NaY94#!3PK+HRicM>e1yUM`&_M zL|(=6TxJG6^gKLaC$|?LI)}krisHY)CLlRxRQF~)Y;pLE=JNyjs+^pEvF%%L=DHW* zb`0Vk9MrAy=Z1Yqg^KUPM=A{YNQe6}E7J4Ov8nQ@^fMmxs>+MxU0Gnm^neyV8AC0uL`- zJ(G4M^=Ha zSY=RJ);O;sXLHs z&fjzjX5qMKj2$kBPC+9{8KwQ6(tQy0H`pEtlTqGm0@yhESc?)m zh>idT(UJI(!!vqKVEHI~)5;_Pax{X>;y$k8lF$08LKHtoewoa|t1Zpg(B^Oh>|EfX z8J3Sh9{B*bqv8ocvmUWQW#1l9}*IQh8R*PZoQX` zWOVYeG9-ppmzEXgTyl319gEP+;v3xriYo7UzV8jl_dL=&JPu%_4b^>mv_cHfs9jN4 zPdJ6>-;ybXlW31yGP8nhm@u{6lG&|}NSF&Ca`xD(K=4~Ka}2PYTxllWjdov2?Xk`W z9-IrTK_%I!V}6 zVN66(=!+$p1>{Ul!Qv?WGyq(^vAj`l6IsJX$aAeZ#R-+@>CCEj2m`zt=u)n7|E+x0k@I%Z3#Iui;O?kPadQ9>s1~L-56~0DS z0ZTXBgkR(=ktaxm-$q$=33Xx5u;GTvU))HY%}r^VQOh4t#2hZ&xN49@^}5{1qb?zLnI zooQHeFviMfl|7qS&Zf1fI%LmVYIIw{)zP1kf$^e`itdtm@weT1;23h z0`^`Oi1g6=+T2h$hN8hHiOxU*K}9k^4EwhPJS%8Iws#wxjfT90Pu3MYbA4l+XRh{b zK}NgP;O3$KU7=N@U9VKY3$KK7ZVf)jCa*(g_#DCKqMxgaB=~&U3$rTYwWq7f{6t~&C%#w$(u%=;L~D^;Ku8Uo z29{O>O&~N~IM|wZoD4zm@hk0VS#PMdp)|+P z0|>13&+$J3dL6V@SfRS*>rpE)I3&tLy8%+-x6ehrTHP%S#l0vQG_y1rzx`VoIYhPj z?DA=-k8C?g%r%U`T_xC#YlNr9Hi%vcaIn7bViPgE2xTkB4AI1=;P-dn`ZWZK*`OSk z4nhi#j*O0Ig$!I7;3@{}NM=n4?Fhk7ln=C(T!(^7!%HOkNUCKi zs=^6kVB2X5uJyue0AXa;9Nf`)0&;yL=-VZ0bk;c^h<&6Mv|D&OvhC}~eD5zP3N}w9 z2=<YAx(u&4 zDMSu2sezObcc=eWK$Xu#P6dD4X^NJ8$mtJLJV7XD8#ocoMFAS(!qy#n{sV86}BhpVqE*A zuT~1><59NEqv=17f7B3r z9uH(+a0~mlssy|@+qI61Ye6~j8Y>_uv6xh36UAWKFTEhRMkZB)6uYt_K`Sx=J;)UThzPOxIa{JZu=VhPdXLLS5 zS~E6yB(n~lf0lJ2s@T??7Y#|?h&Zfb*JRegZ$%|S@G#ze#A2D__cAL6@ku;Z>KS*v-Rx^mTR=BxSyWFM$yN z`Y=88$v}c(X3oFL4L^@0CiNF2HGQCcl!3+v_W7RP!>A=Z#u&~J+nFElY`H^HvA_6Y zdwL0I;uV)m4X&xxKnk+5%A$ciUfu5bKrA+&!Sn*hj|G0U79dx05R~h}A`ocgT>O;>*mT!7dxSRE1AloS3$O;(%UV5n= z0P1S8W~!Qe!tP07&sG{J{G=jGS{?~}_@_-|d4ij3mM1JTD06tSB2N$nYaU^Whcr*+ zwG{Ld@Z(Ls?PhCm6!OE*0i+LfAWXm8?b!g*g>#%s0goYcGuU?&{&7cPqlykK^&Z7N zu;A6LsJ6k&-$>gIW*kU9CST^oq3^O6mshGjj}$z%I?m<9ANJx&{85bQPZ@_wy|)0y z>(-uhO$|HY!x?UP0jlhVAHpxRvNHD+YGH!=sD#P9<7_f2IbD|QW1nU=mr!Mk!eEc{ zZRSy#gLv6Gcf+qC0P=$&{b$P=nceZ)3v4FB?;%cCdmxvaTu7CAdd^gs?*NANIECe! zq<>x6(;0qOBgSOENg`m^fA4y)r}NAWU;~CQ-HCBJL_0;B%z26?d4aQ%bGWf@TMm^l z(Jdyf(RCFx6jZpb`>Mg|P%BS+a^ZiPFt+Jx48bzF0=^}C3xCir19fRvGEMkJWP{_5Tvq4ZEo?YkMJUT^sE#labHRx1S%GWK z_)GU;s5tx^sbct`p&ji(UWc%&h)2m(^Gk>< z3azv{##gw0gj;}&lwh1*D*{l}Qzzt!PAHh)s`t+c6B=bMtChenqsKNtkQQtfx*UoZ zD}F9kal4v z!^)JaUtC_WLP=V6i+(x0`Gf)y{h zbt2461q)bvP#@ri_o7-W&&0CQ4IjYk40n7Fu$3FW1|OX`{KmdEzcVY`H!y*`Ob&r~ zM1Vi;?*kA!8`#IhJhn48c?F)ZRU*rm)`VZi!_-?eHuE)NL?TK6UrTT)B@%+sGd^(d`VcH@YrP{_IdNY$diQ z%Tevb(16WF#{T@go-H<-sw%s#bosz`T9qkBI31^IKfSi0K$(TyU}bDPTmeT{>>REo zj+@TV^^-K3DN<-#lQFhHEw9U&xwn?b{(cZpeLM0=&gWRYe2_YOy|)3HD}H6noJS3) z?DXw1q-Ed5Tz!2CYST`2eU~rEdEL>I3bBf#SXe%& zY)9Z`xawh?@)*bZFCoE=ns0awqOd@v%E=AiiVwIU!}N)T4cvghpfpTLYvZ;s!pt8A zU(bjnX>tQ+F-WLlM_m&?bqV_>a*+CC<|(L{R6?}2tky$1y&0)ZeNiWLZr3@>S^Wv^ zi*rR;XMwfIDaJAphWW88o|x;phGQG|9-UePfr$CB6gcI#b9; zyUvQi$YJo9`EHF@H4?s ziJFl91isS!?wdiM8iOluV4p(!clAc362C=!iEffF+KE-<`{su4cQ$;#%Y5JNUbsIh zyp2C{uxw}NcnHbUr{VqX_`3laLWR1Z|2^)72N0G&4X_NtHj=_o9&-KlPT=oF??w8Y zzikO1bRqk_n4Zso-tc$Jg%_iPunonaWPX^waIJS_Ls186QK|9w5wUh6hO#bcf_sU9 zOUE$eyAuHWF5s0~4K}77mk6{x=g*vPBam_-$oZykct?s)3pX9zg6NA6LZjz*G}|{ILCOFku!Dg1`ehv!`lEcxDpw-;roe0sr>JF z;I(KX@Hiw00;^*<0l$q7*SLA*WbmOq4tgc`qY^PTyt93KE& z_k9?V#snZC>%Hnn5Dq)vs>L0%gkMWQ5 zePkIVg9D!37vvo$jh7vWfUW!tKS3~tE$0eyD^p2W&X>eu3JPz_nyK3@FBI%{j{Zud zdLM8Z|0GgwM+>yTs%*y~C@;-%8$-0N`BLiuM<+is{wcr)@_Y5hb+-~k;B3%oY8x$C zF40}Tfu8;u1`mlutx9Zy z=nMEYWoMmBk@7Z_E$}p~iUILX4i)LIuhAFrE#8SKIY_2Jve!gXakJ4L6Cy!?VVP#F^7?>TJ1{j(u(iM2j+ONRvv&;F2h7=V zNPWQWI}WW6*ki|G^#ObCIJ`cfC%fZ_hLGHjBO5~UJC14yY29&jLrB|>V;Vx*cdTj% znX%(#^&u1NtKAcn3*~$8GeNOb6SvVAWbV})C)oQJJz@`Bpws?JzmEr_$m`+XgC8!0uRdH^MD8c%+jE^lH$Tk zt(b#{sP;WkeT`km{dI)TO91J8}8E>nsjO+^-5}5v` zI++iW4hfx1H;U;4ew53i=QRP`$6XD)J_Pt_buxk$^}OD;_ack21FxtqXr4> zFLO6?DR7QP{vZBVCSyUEu8I3A2tnnsTZI_tkTNJZ1vRIaB0q zQe zN1oT~+bC1_Lpp!Xy4ezDbg5LZs#=z_qS+=nw6da<#r__P zkwIdqZeH@cv_{P=a#eom_=i0L^F=*Xci0C^DYL2TJ_=cX9QeOr89nz(JE4`qC6>{W ztJMc(osT2mPat0_8M$9(Bx7R^qOlk|1Nn|^iZk!w89z!(QDC8eHw()Sn0||JJOpJ~ z%{YXgoPX|KN|AvtX%?}a?E=$sHsMpG?~#K%Qsxy;9Q$NUJUMkjSwMI?s!Haw z9+s>DRwxx-Y{Q2b zhYjBS!BwW7ZqW<(lTYBP@i z6uy*Qn3VtD5+)TB278Y}7{z&p1C_b+S>UV_0UF?VaxBJjkj?{KMJ0!58IlhmF)hE_ z)@;k7p+bNpnkQS@kd+3?N(04s3_x4!WP4%uvUUCV%g~NXb@|UG&CXh5(x_2{_Minf zddgYdOUYo^ZCOI<=n54MZvB3w(+p>w)~VKBup)$2S6jEu*5I*{rM1a$6mP>mW&xoi$S00Hq4vN*k~-B#cZU=I&>FScaU1q!*TOV0L$%^PG{?tW3P(zHP)F_iJs<5+-4gwE{1N!V{v{z*9` z(B0r4t~RZ212!UdF{E+LZQR;dXIX2P`u&mzk%#R=m*M?$3|PVhx*k6@?vCF; z^KG_#Xhf|A_T>~}f*0#VMcVcVPdb>_z2Ch?I4}G(rfuY{g||ZnDqd-)7kGUhcv;zN z_H3Z77}b57wL8V+i13`hy@VWzG?X{n@%#ePnqDLmqwrt=s7mI8adp1Q>X z5#klq@^^qr2IaW$VSx7yEMkB{i^|%{>;ZOWOAPD+$YhyKBNCFh5m)T%h?Eg6wUIr# zJe17`!j~wa@vr~;3aeN@7i0YlW+v#4O_LyMT@4wb6 zHy3rnjV*$sVh^X&Z;i?GFVii7$U^`3l z75tt4eE=*!f`%#fI+#_Luj|l*0Hz>m*t=0YY|;OY$K*}G3hs&1^s>y{dg{+<~{T5(5_0)4A7k!&wdAK!W#)W+JIKB}K z*_&JR!%5mo7u3TZ0wFBm%-Dct1auMrFp`(lgD(X|%zN}5!_+sbGfqf)> zVdkwYAo?1Rl35H;G(k_W`ZH1R%)(45_!0PU#wLX8{JaG-8L@?+=hoBT*>cldFu3FV z!=2aT&EX+g7w?Cz^jMa2wdskE#68jVq-&?T@E79hpauQU1B30o1^r(#E<$VhG<9+8 z#HVYSqU;xwMhe*#zFkE4dGJ-37lCgV5!Os!Fut0`;>&Y3>^c0Kjzmwyw6|A0{WcCU zt^ z|9v@H9Vutd;vVNBtO@SLxYU*F%9pG{#iDm-*~PZw&?Im)%B2*+5SxVZRm#8rvZb}MWk?NI#XfRGGcZ5IG+`dPl*T} zpG?3Z$U_ay5&>dyFALz#AmfgDqovV8P<}Uy`w>y=s{WXmnR8x=tUI$ESsgyPKu<>G zIH-0ql^Mp1YBzy4>lPI zl>sMNcD^I8NCharBO@BgOodgD6_37do;)3~ovq1)6x}izNF*$@iug=`8S&Yd2j!ycs>91v1a>=MN6SA$vg!uJ zYBgoc%G6k7G#4V~n*#dDY<~+Ekk0&;i~qf4DP^y`Ki#s|)gp)Iw>*<|i4pXoJS44sQwq8yWrF7$vD3SOp;HT^^|-XM_4|U zfFz&B0rh<9)wuL`M69d&d*T&yX`FE*m)0VZT>1wjZsyWIGUrT%Nn$SjZ$dV5sQ^~= zR|-gQDMJmH*271(Rh z%t4~dhxh*DRTc>++?0ntMEUK znvs5S()R9ze<|{9uxUKb^-T1D05W@6z+=Ops;*A3ymZ2~Wfl@EJLL zMEJnMw`P*?#D9{?uCosG z{YnFU^GKrfZN(eu+a}L+wOyW|?+krOS7+*rUoFT>g^+_(yA?qkCXYJslOSX#KBpoi zvz{Vhf}&ka*-TNQGF8GFX}fL0deRd0!Tp<1P13l?lqLKmXDvfh_(0SMwS> zcc{xVC%$G#tQSnH#9S$wGc9Q_`%y(tJ&*l=I8N8KN6xueS)#d~|C;$hwEM0|VYDm; zCF!?w7SD6wsnq$Z$lLNBNKT8+J@LeS@jZN`tG#?c!p@avx;jsueswQ-2GzagnW@g_ z)7=zcgst}B-HrCauXfLJefJD1EF#u>$4Z1mxQ^&SS=M&2jE~oUxLtc+e!{qk2c{B9 z#EFtDr>PuBMnF@c$^l%--H*g&Xp}i_s&W7(;?)HR#bY5K6=FZQka_5PvfqQwk%fDM-dNeKU=;yYa>Wb0Ktg4K zm#k$5s)w33Ath>vph9BF0#9Gf0xz3Ph*fD*LZb{%fY}9JBB--|O{qmf4RNc`pRJ|~ zyjG|oTId1@45eADWhBqua4%n^pZaJJl2U34gksSKBeM=9f1*9|`)g z4@V$robk1Ivzvy%sxEF#ecUv8jxkTz#Y&!6@B{fw1B;g6IceY72AKZ@Erl&|p74X< zGR{IbjGx9|oD#Sk3B&)>DI7 zfk~#*?`>fcxCNk5N^szJjcsVgc?)76_}AeUk+F%{fl170Dq=CS5Eie~6|V!)%E5u( z7rfwWBs>rKV9WCrh^3E_llbHwsJtM%Rc?iGaFhqY=oaM8qu^eSn+^r~UT;2saX!eYS# z%x{$|%p@!pUWS7D`e7%fTt+phgsGVRTLVMk?4Yn?#bDWkms8ZN@o5-6^~fXRM)Trkc~7y` z4n+5bi%PIrcRiHW_N(CEF zitUwY_xuFl9uq#2W1z+AxhM=Rd>$U{sS?iUz|Y;x6il#letT;4mH8k@pFRS+mQj&> z>AWAja$~C>oL(GV3eks43)Zv-ZEj{eTex}-a`EIA*?|iX3IAdUD5Ql43aKh7Sr^t- zWz*IL6{{o$F4~c6cJLfoiD@(pC{uFy9nMVaz>zDP#NN-4S#p)#gZ1R@)o-z`TUbds zx>p*})F3OkgVs zz!AgT#9I(BeieSKRY)IFmvIUrH^ESenz%w!{gtU+gDJtpl?Y&8vTaF2>u<+xl!ARR zjjP>W++O7PG_idX6Yv{GH}SVkpLNba1pjp8NcTLuULE;dc#So3YR7o+>~qhp*OT{e zL-^R8_)$|GIeDL+t%=|P19(<1Mu~2hXe`B|D*OmSYdGf|cHGB_GhC4|g;;47i(TP| z`SE$oOXYIyk1?6nGw1Xo&36)M;BXkb)((D<-RyQ>){g6Cg#)=EjNw6asD`_aFL+k@WXSrb1n=rNc_>xg%166j zoxrm_)$`Y8=1liKx1*jpX8@4|bGD~ut(QYP?P-GzJIL4xG1N0+en_Nj_i!sLUfeu0 z5oU4g#mH06yRbj?l2A2h)=TvF?J3(6Dh!K02@b}I9$5ibm}bjm2p(t85BHFv2{SGR zrK|HZP70v3w_}-mqs$?;;|y<{lEW3fK#nss!uw^IHs`8+NHjSQP#EK;MdDLHV&`n> zf2_IlS7&HR%RE%7g?CA=W)S{t&Vz?0J}N9A_A$YNC1eXmxSXuz&6S?X47vm>IsZqG zsJkz9zy(G*`bL zEl0t6OqprchAZ$b?B|Me`06DgV_jdEPnxkrcNr6j_Hj;ayq~$5XD%`8O>apmpbh;-%sFgbE)=(jj(C z+c-RSCICEd#TT)$WxH(QmyB9iPq0oW+B6y?roOE25?5vNXH5NRUwk9N`R9fYArwB^ z@T+UuH#PJUX&7Cde6l{usKTE{sJZSdyc5~zXQ=^eJtLeV*qeHySYI4LG(M&E!Cm}JMy`=Zwi zHo+9QWk{4c<&%)8)y;%Y0TM38p5ent1w7_~4T{n2=vJA{J7GWCe184}c^UO_ zT~;!7QP663X`7ob{kE2y_DRoK47`5IHmp>^DRLu9F}JmXcjH=N;UC;BjPi@J;)WFD zmysu)L&^9vq?f@N?g==%_Mw|`(AjwfO z_F`}e5V1#o;37O2G;D%)&kvkof}9qGnv)+m-ULk;sM+~}r6vehU`SrO<<&z3@@g?b zv+{BeFSB=Cg(~IcXk9UH>%Z0_2A~bjdi)MMw6&-Fq<;BV26qaaL3@OgAE-|+Xfn=8 zullPA|C4n$yW%`tNLtM;A)!#A|l z!bx9h5Pl6DiGGWWmCV3rMVuB?gg7Mgg+w+d6L7D98$QUUqi(coY*XBePr#&`=PGeO zfryaj9LzTG4V{$=OX;!d7Zz(|PFS#3jvhu{a^E__DCYWSk8@o>T4ux__-_m?FGc8( zjJYBP;Aruy=>2fC$Ot%!>7j6>nOhLiv8-Ht<;#k}$Z22V=+>5mWGch|@WzIy|4NjD zE9A9t~T|el7GFf9gN^^K>&|h6#L=lOU0)NVrblkLoTv}`U`~{R*(^D1T?zd z2I}mo20iy) z`q3SL=-2a&dJh{k558Pp7L;F(#_sO|fs!)%kEDZV#Ig$M@M+{v@BV~)RQVipcp8() zsG;-fVfLhCJ7?l{W*a2=7oJmNnUV~LXpY0@;9SrhNcZ35Co}N>1b7Ub#9~Z00pH58 z7JN#Fl9SXrCzNjL*Cuw!EGWM?{hV;{v!O+%pM5q@VgD|1Vr4nE<-FLT8WD_|N-5ZRaEBv-({89P+DSk!9{nD&@<|3(00xd7(7Mf7H zsjQ0J=x35HL)Pt*r6v7Q1~MN1nQaiss7OP!LjarX6PEsoRwNa0aXf2h`^yv>9N-tF-T0Q`k?HdsvG zoGAawWcksdD85xr-C%#`FnqLSwbI;|&T6H5`D(JpgPk7=v;uSo($z$IA@$)%z38** zBGlbkgc~SxzsywCh9yBErU(ktt>16={+pHeV3M&*I%Jl~fed zNFSSF5-6vmAP>a1UWb$4!|7GIiudJC8+fe+ZoweGvhf`sP?_k|7Bl5^^eA$cnXT|> z4nm0S+4!XVTZ3Z%2E5BpVp;@0RMq`JDV&DlBl-rinZ1E`jHdiv2cn?5fUm{sLO!~x zi}=8)v`L;y!{D9MkP5@Q^r{ESG`b=FGqUOf4(FTUQb^z#66k1zHF8ewY5yPghe7sO ztdx7%PV!?`%%XD#I-H`)h7AUOE=tWr&5gyPE8TsFoxl~TE{jHYD<|0DUx3d5CzK{? zAz$k{zLcPy9|wW8IPD%jIx&4!ux`{DtwY*piSueKuTF3))BwPLC54L{{*nbzLu%I2 z8cH@$@qqgl!OXJy2*#;d)%!GX{FckANfhCD{s~W_I5U2E&dF;W2BZD;KCHi!?>4DE zBVu_5H?H@&lk*S8%L>w5*rx-jUfX9P0#pSzzsTg#Uedw(!IuZw7i|+bha<0@tmh_f z;-i1lC{L*@rjoYv$Sm5I&HeCv41%UN1RN_d_HorHd^rTa89W>t!p|3(gLC|Yk>ztJ zV_M%Cq+h)s`&u5R-r_UKL;ZIYU1a!cmbrM+ASB!XF}% zZBE}+T&rTk7BuCw+D<;@1G7c0u5*)|F67OkIg58Q$>NHb&12TUZBA#eQ(}LfgTBb2 zx1}*(T+7K)hS^~}x0H(dB!A{%=65fsNL_QcIr}Zu^4QmoV;(HeO#6p89rU_~(b4G^ znkqvvF@QHl(85fQL@@(yaY{M4kJJsh`lvbNM~wE1Hs|lmPV(n6r3j}PxKgp!Q@JeM z2oS9XY(h9(X5A=61tIR(`}OQ3c2`vUpc^YXT@@MW4}~maa2`_*Qe0-Eek7MA6h+4{ zMaQA40n6)smO23s1}XX65I1`JW=hZqK0q1=y2V$AwJv=u_^Wh+gV{?>I%I^8GMfXV zgY0v5Tj|VUJKsF*Bv@9i7^=96?RVZYtuX3?Yjcp(4P_2;dQ$eyjAbAETedm$+L$8! zfjwstq93*&2-_Pa38A~tmv@pJ2GC5Z8wXP(VV%r+nTY5C`6D5{dMA)r&ev z0~3J#KcDShaSTARxTKtd8^@(J%b){>Qp~c08Ni+^&QjcHb_6C%d!4zWw&WgLTh0$i z3ga(sz)3IHIl)s#l|qr@^@2RQ7}XI&=8g>26?{Km!O>ioQdV-*NrU!gD+#_^z?LG3 ziWtXcfa`R=Pgu$dzY#VyHC&K@OHGp>%g!X=YGqUFTwit_Ed_O+zSxi(l2dnt+<(tsPs@n6{xxKBgG^BMD{=Kd`d~ z-GNI7nXdM9`9sLH&CT*SM+x9GMpHbLruhV}wR(|O^Dqalr)g^=tkAR>t}OvqqiH=H zY1*EEtCdZf*29vfGZL_drUImO(fgQZ0;aqQy@L17zYI@HQ@$%r|Mo&@dMuKFrpMt? zJ{~`^ax^4;Ildc6YG~>?)Cw1XM=wO3liMTT>!L40x4S+w%q{w{z21(!)|cTYv7O}x z{szEf0eZIC3?r1iS7yDRNV&B>rRN6gPeOlp9p@x%E6$xih=MwRgQthyA+;PBEOAEr zJ+O$GFpeX1TG?rYS^fHmeY(6Fb?*xIO0JKr%0PAA$-NDejUSzWRFkZKQUrE5murJbfCh$9$_zXz(9pM!1>3rLD+Z&gB2!?PC{ARKLlym znZ>;v19K5r$QE(|9BiD7s3=wf-$tMU4@$u!MuqGtgAXz72n|m z@ZG`WT5ukT@&$O}W?@U7cEeNf)cL!w9ye&5qcW`1`5oG_h_=*;z^MS0DV(L*FM(lK z&VI20W(oc|zl6XuFuN2?ao6Hqh=a!_j^E;&h+bc|Lg}r01EXy=k0k)`i*9f$Ybc3* zuNbaD!DNA67x)ZAv_KV%6udf0_8SbmSBypgX{PHaZon2N7V<1FYyH=e`eLg$irrq& z+4n|QXvSW_-#9X}#oqO}@(8rhz%Kv;zUUd2djehHw3a13DyT@rn$k$m@M)bv&#*RO z#yF^w>dL|BM14DPVmm)@6${S8_twbpESvv2z4w_#tuq<9g?!KO+CrvS$XvZKJUNYn zU>S>mLAiS=S1ejoYe%b)wvdbK+E!>w*0n8B*EZI*V7Q_XtUMRBEg9W@PV9k8X#cL9 zjD}zvcEVQagKYzQ6X|TtnTcvWGyoT;v#a!FOCz{5asTg15=<4zo6z=XqIe$?g4cv8 zm&Q}VZ`HA8jMq}+G7ETlrAW8Gb1Tj8zskzlhOM8hXif2Q^`A}L0N6CLZ$`p@8tvXs@ zfZ+Im{YPrC`_Ff~Xv|d#|BaomtGWT;FxNeUo$Pfk&gQ)j;hwDhU~6?IV@uUnF_vqO ztlVw9JNus}GXP!jz>@4NfHautnSPm-JCOINr4ci|UBT~#O6^&LmojLrwyQKfNYhhG zBW8Nj!{;1I!(M@Ju+w{Wb47G~ReQs^i8NxTw+ncdF)slx6``HpF4D|Jn!OTf)J|`T z1b|b#YC7kdot}`&Z4cB+&%#l|!as9$Q`Z1zR4_BOe#ilLFbJ>@AonCB3kZk4Gppvv#pik6U4{)mi;vsHLnIVLHw(y=@ydXu^$n6FWHa zX&-s6LTT{)Hg=C1I|o!-ltmlTvJInKvR+bX7-J+ossSCEF7Y_px#8a_fD}t8X+)u` z*!BNN5mEcE3oY*Ez9lalWxZs3|Ks&>9LH%(F^uOvtdFQfuxHV<&)o|Mw3}lwXKqFl zZc#Qq7H5y2Lo(4%r0@~<&rbt%$owz58gzuuZjx=&;i9n@O(!m4KNmqli2-Usp_dWT zUc+-Ul2LS?1@KkA!ub{8R3Kw_LHATUos}n&2U#!Gx9p2@r`BPeFL)}?sSc~Z5mxjq z&2S46a5a5PJ=`4NurL8vuWzY`rM_iR0@mnT1W55y9oBw;DMvt?`j!juwE7mlzepX{ zg-8N@%NQOi%909~=h0#9pTMZ3T z0GNH;eseoC`TeDaZ(8-KOz<6+dvJZZvxZ4jlXsnM8cxO}%O#S`=S#`l?%N8frYmigKhsq+$esE7boiE&RusbU&<4?Ry;OX`K0nnm5Sbin3|51h9GK; zF~H#|m5HukX7GO+;?rq$+IDj?gJOGz_qk3E^V${{;d?KZ;Zw#lj*P=`UD+VQ$l;a9 z3YEPI4>PCK@$8TUY#JAMCcq5c(+-!)hbG~KBP1(pvJZ3m<9yI5-s5z#omPP3v@OD$0NuZzaG<_({&NkW4_Er# zjClIucqg7l9dbZ|EDUZWR=Q-!k}kgs(bab|X^icA@Kt^)dLN#Blhn2WW5QW3 zH|(}^wg#JuXgyXrbI);RK~>Xoq~L98(kDZ?bFhTL532d*KL52S;0UeHEhvQbxfRbT z>cim1`fxEV?Tl%;*621SPQ_JvKR!*B($T-;Bd!twr>GKx>)Ym7XWsc*r{fL&rdIo~ zR%|alKo!b2ZD6iLosQHx{RgsRoj!=?6m?>7Q=M!hFGW#ZM6)~9p~(Qq1Nk^xDKXf*o45;%h5J8hr>)5_o!|_{f^T5-Hv=&zdP`p zqJ9i+s-JJ#Ojd2eh96^U(lM^#od~ftOhG%=>v-`vr?0H_<5?%p_l^e6 zdd8NUucbH>zx;6|wtCKtoKrXkusYYLY}C*1BgrzGGljqBmmx5}x2D}NdIk;Y%ab6OfR^7(13ES#T$ zyg~SPaBgb`ocmQ|RlXlThI1F9RodXg80#SFHb~Po3H+y|>7r)79cfBaqp1O}qv_fN zd?QWk;gzPRCEzVh>)|pE&r7@#aOJO|dZg*s@tl^XjC>(9CEHF(Q{~o}un!`?DF_Rk zNZZ<4^}Vpn5`Q#&i4tp0`A)1k&T#$%)sRpACb^6tW%oYTkm0qLpq@OQZtMs>@6EL}+OtGGfGU-RXoG$M(O zuC6wxDBlRyl=UIyKmVxLm1(OC%PCP76Iaraet!N9S@RofOL=VwyM@sVlNW`%)rQFn z!an3yzKF1%u9dVfzy)?dLXRTNmx$7uD&qy)E8#vvK1L)=Qx=zTc)+c2jOmBz8+CXg zc8_!YN4jIjV3H~t(eM_S*#KGKV_#t(jotZMHT=v*Sm1q+BsH+5znl*Y! zb}_5>0u(8}Bq?|X6<2yV>xC!oL)g$?fMfU&IsG?$`>Kx##5ef)6p^nmdGt+u=LV?U z!C3n+K48a6H|DS%SdG9;v<4ePu-!iek4SC>Nexg140YGli zi_F3M5E9hD0I;!YTobcEPfTEfWnTw+tN{SEw2U++^jDj zhQYcM_RFj}%qR}VXCbIO$~wz#qrX{9dF=Jx&LPL5z9{W<{9lCs+-;|cE&mw482{gb z|DVBsIV^xD!}%A0rt)7u(P!G7hw#1uboMrJMFX1&IRqmFg_$C484d)5x2b@-z*Mvr z8${f27DI)xU)kD?Ex#TsK(S9Lwhp`+DYd?t=n()%kAZGGu&LWZ3(wqA>YAG4Pl)4% zF~g6tTV+feKZpxEYEDa6Zc`;Qq;^J|eo&MGJ={)-3PS;S2VYwDLyBRi(VWp`a z3jq6?dRVNtKyGP@sVmbW^A)YjYn#)iUkD90Hm9pAbGmws)~Dmj64j~^L2*-k=Q;JT zsFx{1Sb=&vHWf(nEp#>Tj7>|u<+)914GSiceOr^&r8}=Fot7#3PE*|Db?H>!d47F5 z)Jyf9->HLDo{j2Z6YbSlvF}RiWP4rEoEB3+c8x^EzNdvI(_Pq{PAew*PE)b(C)26E zbF4m{XaZE<`9zEx^_>@k=4HTA-w8eElZc$;1g15Um)*0r>=a7QNkBCyIiErhRie#G z&L1FVdL?I9^h0K*XMaS`nQ~fZT0JM;XE_;;Hm;L$=FYcz&aAAS1|{3a?E`cudukpb8f_+`f2S9h`Jt$&N78b!IRky%(32bo-7Wm) z9?u8l=*#)6Fi>aPNo6NtG&HH~WC{(fDLd0f+1ZsYKMf*PU&dUa?fg6KU@{mL6H`}g zco@U->ahfq!jsxg4P`NP+D_(~iP(Bp+exgWI&J4aSYDI1lPM!Mt~vklVW)VX>N*eQ zWLDcFe9W{1b(~j#wr^0n?G(DDsyOy+o&!jRnTfei%PQjDZil`7WYI@`Ciey2sJQ%pRG>2nGJ;S7ef7|_QRa>R=`xWPQOK#tkduCoT5$) zZmLsY^_8^ukUIUIsZpo)TD$xKLAF+Y^hbQfwIXz)R{X4Qmwhg>bqXBr%WMIzHQl33 zvaAgHZzQhUm#HRTYoh8;1T!*C_hrVDa3ZSy9K-0IgUsLl!a%d<@K?TDJ-);qpmdG( z_)GM=rWY5e0~uOd!-g;6cT&eJPzPz+Ivw-D8pgAnC$nMk=gIDv3!hw3wl(c2AMr-HcwMpN6X`(Ju(iazR zTA4vzANBc{HKnQ1*MQg2_wodMBYo@PmA-FDz+3v(!>PXc3c!`qs1@~gKAzLkmys`s zzM^jq06isr8PT9`&LC(iA}c@U#5VQHxIU1`QxX~L^w_2+=j;g@U)7wZMq~vyG*y3abw+k&()%BoOT9hGXzLDI2V`Ni* zZ8C=SWcw{YBURgaONSx~6MGjk*ibXjDqL^F9yXeZcWhn&A4?+15}Bz$9C>fp65?@Pklx+LHdby==`RQdhilIfxK6Nu3SXRKz&&);W;h8GxCM-yY4GZ!S4w_B;jY7f0Iy!mY2nO(C!pbpXMK=3 z$J}@VdJlgCpr<4C|yzg_nis5c(MhGgrd$o5QzcJyPt?i|rM(Kr$ z$0^T7n(7=$2%WLK(1*{d!2g55-w4}Jqe$cbRA9VlcO-#<7SHx-G9AUBJA(7|o!z6@ z+>s+z@Weh3!(;+x;jhtxqL$z`qjLRt>MLoV}E_|WNKhO(b%*n8)EfK~f zjqGdq8PWQi+g=`?M~mGd&%u0{d@s$RC(F2(1jjO_fqMQ| z4aD|2*k;v>tiV@eZa8-rXaTRR_)Pl<@WP1&!J`*ArSP)>)<<9i@mOtehB2sR3-NxG z8~7)giMY;|R&K$cKr9m0QKM?Thv?bq<0@L|iSnh#rkiLAO-8^v8JM45Y&)j~XjYHr2>Tl)1v zm7TTY-#`-hu7XqBi!v!^&IG^vmeKxO@>i0L%ya|rNTJh%|{m7ucU)6{qAFy(BUir zR1ochueJ^^4DpOE#`)$=1eM(h?n(QZ`B2*wQnz4teld{kGxGUr&R@Gc3pWYD<r0>~T-d$FEZuQk%HM8z)2kQg*3ktKhfjO5jUUgJJ3C9Ga|J9)H(WLJZRAYj5 zMZhWs9LNAxk@hpcwQV0>f$opAw4X7rX!}~c7h<#pfY{3DtG#KoLATuJeRPF>Ikb-dE|NE?;l)XXmVE=g|^5mZmAzo2Tk~~SYg8KilHv%JX8 zWADUk`77Yf%`Pr`t1@>ODg1zslDKiMKFRl@zQdhhDkZbirfUnH60qvic-XeQE3JjX zWslcuYjaY&d^i*9g+}JI`-x0L{-Z6*J)lRbXXcsd4Ny-GvEz{#&cp_sj3k1%@{d=` zd2p3w=9Z9y0JxWQEQM!*5;@!*f(9CUg4KHlO}7~>Mw!pQwl=5rTvWbuaffpb_8aeG zy6{3I^GeGa33S*yErARLnTb$PGuMN~71n#O7g6dZ;bh?FN}%|>9lMjc2p;xwhT>@6 zwmIA-b$A`Aj&yhiaVVtLXj@HLQYKqSd20&k@JzrC-hvX93wX_S!Jjp{t~k20WtfIJ z1@*cBZ!n{4;BCeiJ0BdCVYY6C%_?5{2S(+aO{?E)nKmtzaVru`x6>w>d_RP5u}6Z7 z{DrmL1dN+8CU*g2JHQ-)>wLqXydUZO$(M_N865!*g*vC|zF^u`Q*s zEbDMdYoT=36R!^1nB{k&g`_dF-biK{Cun02GfY|yVLWD3T)}fv8Tc=t9CU*s!r@yE z$AP6ar0#`OcpfX}1{sOfD6kowQYjtI10C?K@=j&$msxl6#u^N#e)wAEz=UeW@O8airzfpZvOz6zLW{fY>W(@~PQ?Y$HN`@GxoxNFjEOoc2|+ln%U z<=)>=u0m)%<}5BcUqB`QlQ7bkj0Xt#Ws>6PW5mduL~$>^-%Qh#sv&tJDyLZH5&tq@lGU1ERrIj3wmsB?3njp_$hw^$H+DpEe9^R(XITD5{udBYk3XYdoxB< zv?nEm)7>(2eoGdra`+a_Iv+yF187^^4^iRhFnApT+?ucx!S7Z$3Jfw2eHGudx{K}N zuro@K8^Cx+@M|F<#i4`d=SDBVcnt?1L`$X==&SmH+?+|y@L@SfF^iG=eB?Au4W2a7 zKtlZ=w>j%Z)#ov0BTlqM%-k^6Xg^`*FvlfvAttMQdg>TJB_w5-k%GLRpx?Y}u*gse zmcIPc7a^J8==B0tB3!8UxLYF`vF|G*k#spKSyq2nj>mO5ik;-EgH1XI~ z_$k|~9=M*DL0rfRTHx-7gGk`Y!T81ZTJw!*$4e2?i()4@o?dCf!vTa2(xTO^4B|Cv z1#{9lCFXIfY+i9hKjuY}KVltczpYu(Q za)Yz^lo^9ROup4g%7d($Oj3+?<%S9ZV7!VYWONk>2qo$Y>D%+)iwOAf;&dkEhs&i9 z%Eg<_WJu*iExqe?YZeBUbCA=35C1ShUx5rTA0pA*BIZXc`BJ_NZBiYsy&i&Bn5s)> z>Z%@!FLiC3N{^J=K{p9<)A~-LS-Glq245Gs+FcXqhXDlgo_NFNv^y1Q0R0KOt?c+p@~cj zHf+l|i@Tj0A@jdUe5Cp9&L}A%f+wwl$5nQcCc2nSBr>`Lb|kUHL0wl~KZ;QoD26rL z0_2erO$~$}DI8q_vWIWOj{!{u5)^ea!Q|e6@0$*RvCqY&)@cf_L~c*|gWp109&Mwt zj}n+&qAlBtP)t)Pdf-rw(pj~fdhfA?6Q~1!IaaHeyM^ho*3Qa2HM^8j8#!OtBo8Bma147U4_gQ*M&9w0F zVKjIjR$?t&6kS4BP zhhv;<9|dHz_nZ)ysB;v;bLz9hz%a4m#Y=E)YJ!2lE&Lbt>->?v2*8?lE z-`BAsQ`EC!FCeF7#bWE^&4{1u!cQP}@yMHI>Oo|ERiqeZKeej=F{a&_2l5KHT%VXMO&AjAKu;pghG9KPCw z4WRuqa8mV{H6yFUa#3FAl1S^llD&6zx5crlYSs+xq0VZu6j^oIuBq+_p%l6R-FJN@ zx^s{CDuug4x>oFI9MfAI+-4@c*zJd!_|iR#y(PQqoT3=rj4&>zUOf{vv&zgK)X5-) z6Qq989#C6YFAj4jp1txKFavj6z?yS|G2fm9azWmDBtF<*9#Bt_ZPHv{yq5yFCDh$Z zsSk`%--Xm0LMhiPri5+0wMT%kFkA2DllIolD>auc#z7Xg#8QIIc7l~+xHk#((23j! z+Xmxh8*C5uSJz$w{@V9otat`3Te0nB)G@Z~vQ}LJE*!N1X2of2%HlRl2rAio37nlV ziRAKccdXaT!|*g0yf#L(uTn3GYI%5Ym@{6g<}&Wejct_`;Dg&d$XmeW#^QUi28Zjc z(!2iMJG^af^p0>k`VQ~%4Q7Z#^m4X$FZR7EPp(|uk5ph75f>es*stk76)NE8)+Q`J?6Fs!-HU-y2RBZuQw0y zMg~`Xp_=-B(scEOK6`z6v|d@g(bP(%2G?c#;(0Cl3}J}ztRJKv$1jYA>W>@^KAY(x zXK^K`2d0kes+gWM!F2wkpZexH;?QQNeW$dKL^Ys^g6_VEJs_gKh>}T1imor>W)vp$ zMTT7`pgbS!(+?|KFQmM5{CUOo!-L6udKybD0v7;D;@Oz@=+4{)_Zpd+z6b3=jJoH@ zzKG1Px6ckW3T}||h}cvQdR*9POQk+c+ENYifu;Q$b2ifsx3Jq|4t1HL!^DxzrAD8o zvk!vaLV6!~4|e2fy(>fIiaSOF>Gig2-vrvi71e|)&4v&QSA4d=J=EAwHJuGL7OuDq zw}rW?Z{dn(1h9x!7cN|}<>k)};2YhI)F`t0MqV#<45f>EGp~7E=HA(>Z=bmj@ap^0 zM>Cu^d-bPt68_AX_#(+YI1f^DJ!6d*SWZ?~=PIO>GBS6>NO zVyAX3_KIhqlitP1b`e#gs;5pSqUtHDBi9HTIJaB4IcRlP;%Qi_OKt=#)>eEEJU0R^ zjBj8hU8QS7S96~iD>nXn7T}F?>N%x%IxkTL7YrU_ zt*X5xxqjrXYX79UOA8a}+?Yn|VCq0TrgT%LiNsuhraU zJJh{RSxA?dQ{H@Uhn?K93)-ykL?UUD4RGR4WES>vTv&JF_8a{n<-3$PSFzL}2aCSF*KW(Y*s59qsY%1n&vc(fAC)ZM{f& z>a`i)a)l($#2cN3QE9ys(>{8?f_l75K8X#v8};7GqB}CCddtz-g!hf^00Lv0cjM6# zenxQ{bu*e7O{sW?rk3NH{iU_)aHW)?@E#~E`jR_wUs%^zk19Ofg*Co}4g=%xxqup6 z&P@j0H@n>1?^8L^)H-U+%@ zDcy?qvMsXm2yBr0r0BX2dt3GKSmdroAwlB)ko?ko62ggH*X}PTd{Y^o`!CwCgalT#wrPW zcp}y4eAsixSTkN#1S#EyH?*0ftGOY~Jv<}2;RQsh1t&)2!|Hq24zkDL{R9ke(ZmV6nnS2Ox4X)(K_`WaYbGFy_V%u6` zebz0A|EHW>YNML54qA$B6Jop&DYt7m+LhyjreCz*>i6zMj6ZkLP=!RTpZl_>*qWLl zEPAF*_IB$dYuu_`fq$8hS9No^9$CGDd${K?Esx*j`ilkLhvQ9C;>8~ZD<`Ly0e6Mk zYx8eGrS%aoqK{%!S|7utQvPk5=+8t{diWfDw2u=>eKgt8CGwEQ5oyPL(+#O;T*p1W z^f|&lk%nol;|SvaO>%U7{~U>x8}JQ{t3C5qZY<}f=G+h`EwUPgAo?Vf#^qe`OI31@ zX`{u8O+J-5{qQmnn(^f>LFG+lw-pioK6RRxF+itz)}V0332iz-xZ3Ef>Cic4GQ;5& z1UKSO8PZfTd3?Z)Q?q?0|CpKw<-5Hz@=8(jv;Ml9+xX{H@zRy4+r_k%LHP0p%MyC8 zX?+}icomd__-f(?T@Rx4X=!tt(n!wro3HAel@ zMqP5&x$0Ah|8HosW;?NTHJ`B@SAw`RXu>D#(qC-WNF^7A-@_&S$lI-gUtb;bWoO?y7c7UpiF zN|q!vPgWRmDb2cSa!S`Lr3IGK7c8YOT1t}hci3K~51`OkG7rm!W`*YR<-XfN@=q;< zTB#wUCsX}9rqGxo^h-u_UU-Aq-k<&aGy>2T`6%}cGCQv(FUZayv}a}81}?BS!}H_e^zi?W9ID} z-77E~~ zJn|FW2`-t6c0}J!Tu4(E|5&k~SKPZ4mwU2zYRCQQ^N#y7OSc)lsvY;9=NU#n;xb1v5bgquPR_Kt*HxCq_!o-Ex6WDt6~e16^0a!?iJR)-WjVztmg2RJnEDHv zoMW`g8>YZ?X788SK})7*e1sIC!jHjgHHzaf+xT9PNQgO<$6^orqY9dl0-96yB-?q*WT z=oP)~pj{BX-w`T$Ph$rynN!eX1yW*$!)HKrMbfk;i05B(VrFUE^90Fj2;3!h-hk4R=%wgdrbY#Ao>fK=U#%! zU-2=F9y_t%puN0g8vT{vp0%2$Vmn1&a}`s>Gc@bbsIHN-UX1skPXirMUvz7kNe-K- zv8B<#O=r0Iix3*jEX>@`D~#HFJ?>@RJW=tPdT5>L<|5JGp>TI6T(v_-iFf76NwL${ zPMf}a+uFDOzl!P0s2@F+{8TfO;>-;A1kbVJq9!isVU`~)_V-Zu?YQFA`&?--rr%CkErZoSZq{M2a zAo`aTj=E43POmE*p7yI)(NtZ@Fw9QZe7E)bcFkmu`*oc+$q!WK_)V9;hubnv`RThR z>kUlRv=21ZvuF&(|AxPC9fo+Y@2+NV-&Ur|ds?2`wn?YLcwvcaX6hOhGeUPv{6|c1 zb}ao)G(WNILx9tB8Gy2)(yW z%7Y)@KgjrGrbC!2yr%KXtm(slrTDX_5ARp}`t;#B9AvB<{bst?Uo)_^s@Z==iPd-_Y?}*&o^QTiGAg@mtxyvE#S0e^bZ* zW}M;C&Ob$7oBu@@n(=e%LNk7DU1-M7tqaZgxpko#KesM$?&>*pp&387E;Qrk)`e#L zUv%L`6Lo>puU)#pp{dMox^P^_Z@Tc7j^A|QtsTGVLe%k_E*#(Sn=YKt@tZEJ==e<+ z;*Q^R;Y8=3s$Tz@MEMezp{c@)`mEQVKAaV&Ae=vac%R~LFn###iofCX;r~?lM$?CX zN8uY!AO5Vu7fc`iRfR8{KKu!Vztn}dzx_Qr^{&YH|7Y!4$$5sRVXcM{1ESG9XVEv|MpKaW=kwL{q1{F6lXbe}?_i*b#V_tJl zHwJhzm+N3;d7Hl)2b8@>jeCeccW+L4lfo8mgFv7Qq(zN5} ze7}x4idUpOJRkglLNk74ihte|eAw1apAkqS-co4KhoItG-&~awc%jO6}suk@v-UPe9IHzbwP8u=O#IHx7-pA8bxfh2YO4DD zMRxYGbWj5(D`HPe&Gz?l7;Wv5LQY4zw`H-^7gyje*zOgpb@TeG^(uRYU!-a-XmZm8 zVV>IrT+ZMpBbWyqEa-wYhwBxMm+TC}8Q#8kXJa5Ls@ovPbIZE7tA(bdcuLEWq=F8FU zINkAt@N{U#dn%D~S|{&?r#G#W_m;cTXJ-ew1ZW?;(Y_cJH*fQlRn1kanycv^6zQPt z)j8aI$va%VZ2ekdg=e@7X#fB9@HBfW-qU6#H(eMXK-^Al)PAJAHlt+(xdWila-8CI zDdCmqKz#j0&UZ%#$yL&c?PBzL-1e>o6CeFSIxWSv|3*D<^HOCu`;q4FE7Ro9=A;hs zhEB@9G2EwkFLK}5Uf$lTUA{SgQw$F#$?#0exbED(1@7w4FW>IN=}eQB;zOY|jUWyq zC>6xvI3)-zl~_aN26YHq6oS~al_Q2@Mf4S zB5%EOGFjkWmC51=Z{Hg_I`Br44A07RpvQYJ49TaQOh zv}{^Q758XDOawu649>nPM@F=hv|Npj#UCAqQOy)rdz~geZqn&f9O%8|WLHmG8NP*> z;XBhZ?DalI-2Ugq_morJHicU&#Sv7=$%d12ay%hvPENp?&&dk>QH=3la^k+hF>yyqbhez@^L+xi1Il+Q@RNwoWU}?wL??(&2GZk>)TVIT zU9g`f=N{9^oV*>Sr{Oin z^aTY`0*n)dYL;8imbkg$Gys~+&I7}DBPCs1kOIT^;1Ay`(FKi0c#a%yF0<*~3faa~ zd{6FT7veKX3?Wa*$XP(g-Y%Xw>iFL?vWI2lof9+iuIHPPLYAxdDOcxq<%+VgIa*g9 z&8hN5dAxhdY`jO=c%kL--ig^b=lNzM{IzH0(VSc!bEo2as`7Z>lo>f!8F``Qv1(#Q z&U?NY=`N2|t~}CQb(hD`RQaMj&Yvy31p|sq#g6e0a)id_>uJq2=+>iP`wr^UX$h zL6;`w%i~2;@jX>}Try=wE>%WeXnA~MVn#msd^6Hr9`EnUl`D@kCyz@8;>)4mOeaIvr(p@8z_UHLL>0Z$lNqhOUKk~&Y2d!3ZO*0vU7bhdxCOv`8L{&R<@%VoTU>3oZ(t-_jWWh8arnZT|8a;!MGP< zUv>#GCj5$A8iQ+`wt>>pVLXNV*#`ZV_#RVV$~R}Ei%{}g^4oiq*GunMRGIGy{)VF0 zQs&@XSq%znlx-N65O`Nki}bz=3%?2ow?cBl37X3s>|m2p+K(xFZz1MJq95K!1RDkV z;nzf>BP>aUBvnNIsS=P_$bHH*racQ95CJL(A4_9emn;WA$MlaKUMDVTLPf>x@VR*`|$DB zm_m5A4|BDO>1ysFoh?A#%!j0jAAAX0xy_(EH z6uo1_48P*QUMWkQ^gap;PtqBY$yf{Q-h$$HvfEqQMy#sVv2ebNZily$XqmCGs2 zGmvVo5T@2#)3;P}^%-~@FNOX0Z?-VT&$)gNN@gm+-}`VEcYc1DEN_)Y)=&7fSF!!aU(>cw+q4Xm5N z7;7m05#bs#ML)(t+S1nz{lV}q=f&M@yVd^b%s@!G@lQa|>D!-T2jNAu1j*fUt_$wL zitoixeqH~?#e13J{hR>ByHCh2-u-f}3x0tWKY)?NJNvY?_{KHAz$U5(75qz#(*?C4 z5I5w|>O=SyhkHgPbFML}F+|jRvMqDWi&+w&!JKF_uKvDOT68z&&2GuX+ubLr50abs z5vYb2t8Kqfun!6Lm|!2q1>hqB{Hl#a`q2BeSjo~E@z31@QD3nShWK0J{44i0`4`X) z7rtK_KEmx-j3dL}hzR({oc07R`>5jI;yPVkgAEh*WIOCBg~@9$-A&bueuq~yq)+;P zi61{LP^Opeep18&&M@Vo?#v@KIL)S-d~Ec+WbXTV@kqcJxO9C7(2n zKRMh%Xwk1|C@K0|ft{t=guMAJ!3qaayO`r(4o($Ty@A~7cA3$wAXP7xw+pa?(Sl5_ zEh%xioZk}73b#*I;@!#D8pYu@MBVu7ZZ;{5+~VH;=KWPm-%@B8cKGKBeE!Ap`Bz!R z5~D=cd+hu6ZYgGmfdxmRNu2-ScNfWnvPTuPazXGN##V8(l6v_gmj zRF_xdzY~6WdO*x!2M)MKlyyi9ntheR$Qm}9sm#fP@n*?1EPnV8h)C9wr&e4RiO=ja z`zL|qMZeRf;epJSB z?g@?s)7iKAEd@r;@DYyp!jSVfqdx+G)~Bc^Dj<;Ms;t4JCd+Th$MJslaL!12aD#g* zbq}t=ZFCsWxih?_HXnCVdp^!@^}0Bc!?B=mX1bv0wP4V$K=d06YL-~gCX#kkT1qdt zV0?2+MvMfjwg-;DX5Q7U|x zSFDOr?ei_Y$_1Kw8&_LUosVks?jX5vy(YzMA9b2;QhQ`b(o%8ygaKy>!9&i20Ocy_6HTBUCS)ugFn9!FKm~vp-l{ zZKp#F1&{C5MNw;iF6;G@@}8q@nSCC)oc7^wtF?Fk*O6AcOd%Tiz ztcC;dmiVF2(_38Z;*0eMM!was8owzLTw-PAK;`7=zM-s2SG-3s zs>@eh!w218YS@*g?mT@xa0#opSj{T?DImIu-sKwMrxH;U!b*;a-NrRmO>*B~Y4leI z`)i|{Sn^dzNdxpcV~PG+y;iTd3s0;4l~L(^9lo?6Eh=}~(z4ZadO!W!1nZa9#XRT~ z#7|RAC38uM26spnugA`lT};-)DvqB|gwoJ9hhg!^383bZEkwh4c!fE-Tm6q06Oz0{ z5&f2tYsnL@FYtT}?Qn=TP`Cw0zgMJ>Q4L2MiUg8iXfb^bImnBEhXkBV8h~tCy!m_CP z@Q3g+Vs)`4!;FhZWzaLKBBLS}u)KOlD%)rn=dzl+Y|7vi*xF##O2TNrvwPEA6!cDU zD%EHcV$pz$P6~8{I;xn_x}`E4zZ^7egIFXxunRYJ19r42{%AANNcT59k#0?Jcb2s` z@<-gX!9L^J$k)5b+u%!XO)BdTsvmM0`FaKUjkf@kvkEp@SQytZu{gBN{#brALeSi> zkDU?YuM&Ljx*0uw^a`NOCHg1=|HOpcp-W{n@|D1oEip#7x3C5qyQQgHwc#%_xPxxp zhU&WxSa6(x9Ymv`s3|s`p+6|v5zFY-&!GQJvu)>v4bG*(2G8&or+$sQUjdC*s%%%O zwWL%F&84b5nmSaksuV~r53M$yeVzae#}uLZkUcT1z80+nVUTn3r(5=9fN zec{e;#kAsmBmH36;O@RxF51!e%4MqD1{`mXmFysQG1(Do_!Pfo7%f9+Sx`$M;Z6$X zUR#5;UWLzfe0DZCc^0n0B`@{gRFGSVU)O&_xQ>NgK!k-?%PJ)4CA$e8xX#Y&a_-%8?me6vfzC+w#GT2k>dqCxhu^YPjlSQqxGjs-GMX(*rKPxj z%Q$L@pKvb`lN=e(>@D}a_>6+acALig;5~g`!4A~^Z5(7~e_4ac0RpQ}CP&sMliP0z zgK3*deX?a1#rme2qu5$B^OCX1AwyC*k@ z4#b@(33Yh#jJ)FdMmo1wv@`#Zr;a}eOiJkWvWm&UvP#JzvM8uS%`PQ}nH?mDn_W(h zFuRhx0XwBR%lj1VDol_UQE4t+4t=$;7g4l2RC7MI-%>(zX7C8fkvPWmtrTeDm5{CW zJ7+mM3V==GX(sssVpife0y^V7oVq>4Z@mdGk4Pl*m;txzOk>cowTCP;h|OTLDxJ`+TK-f{c`p z>Y&A~rcom>6D2YFK1)qZ_$>+3E^72!Ccl=X7JZpko#;Y=7g>~}`BIt&OJmP;9Otpp zV2OIM=6I>?RVps$E?Rgz0OKcv3VXZ1aO)$(@3gMz^*F8WacL3dCh5VjuvT42E_)<= z6`Lk~RE%nFK2BowB5%|57uVnJ&~a(EZ&?cOrLmqbPvsp??otXPrK%Cw|R%nF@= z<F8(yq;Yy;_sfW1@ln$-3KXSJ#tms;bX(27L3ek#(%hk+d zF-^FEE3ouCDA`&JX^|Zjw|hX^M4KwOq@3!f8l!wd%5=K9QET;l)>o&UU}38OEf$a?q0VrzW3R7~@uaU2Ry zaim+as0dD#J^!z0N|NAobO^a_%6%-x7&b0&*6j(?m%3 z1{Kb|1deSOFl)xThCC57CpFuq(KysmK6pC1VlkyFXCZn=hwi0$y7EjYd}E^4 zT)HP|scu{iPku`Y&0+TH9Bfx5qH#(m&6k`(^gc{iB~qELA!0c`7f`NBT!pu{Vnbg) zJ`c}=zC^HUZ>4oU_MjV+h8N%-3Tv`V+`gZlKf~wKS^C48PuAZ$_ zaEU91hZVcsjUZR!UP6Qg{gunXaDYnTai?%5t{1kV13?CLQ(gQ`jkR)u&+W#B0Rem4+kC_(~ce@Leo}Tm`tN z3vx9OP39^meoK+7g=%ySwnM8HeU@qHlYbh}nop2|-Gb}_NA76zS@l9F=;s&1PcU>X ztfU9Eo^7^oy4pDW3?wvs3O|b@t>3El=Fqm}udwnksB;XY0+ArP7M$5L92Isde-U8O zCZ9P6@;Sm57FJ#he&1k!v1IkXt@~>Ru(?>X#Oe194`)W};e&f$W z#O9nwHDpZT@pWzJWi-YsV}yOy)35q}xnUhb8_>T|~pTxN!d%64TYiFnm0{tCgCfh^g=$Rq7> z;GlOV$lE!+`6`%JC{mjn@xYZ}t1d=@Cw>Vd`5Ima%+y8*Ddg)oH3D^2g-|PnN_0~j zp&}(gN4^1M%__**z|=(^xii&~g+2%6zX=BZB`C?aaMDtKTM&(XCDEngSB={uJ6Iom z$Dy0N*u&q*0Q5a99yk(M#MnNatvY;+6Gv4te#6W-ah zc`M+aataDRiS9<<6G>X^@cTG=d5!4@*mmhBXd6R$_KXzY=BBh+)b8olB1jr=sy2i= zs0QvS)V7JnU(jXU@omsN#Sd@CvPV+&f|dJHP-)WqApt~t3CY!qX?(1O_~SbW>o1{z z(Ve(TwunD4jQ2-)qaS0~_hmA>OFrEbu)y04`RpJWhuSqN@w^Ob?QO8^0as-@dFbPF zOxDZsPeq;nb@VeFSa-``g@HxzS+7EF8R(56AQF}nY04i~M_^10*V*JDDm5pmdqj${ ziX+tnDa~-Ek;30W?E$8R({=QXynn5qz0EPx?kL>R>6%hyr_fL^p_sze(=Hg&nv%}>=V$|G;i}-%I)9+j7CVqiGe85Q3 zUw8guxYhuA7g*~n`uT-I^dQiJJJa+_A*lY*ySI7RA^uSE5P?1w^uw|X$s@w$Tgz+( zYhBv#P$}llhbOIHXY0%pZQ@0biU9E@hE3;Z?(8u|(WaFQC)@A#DrDD)A17D~_rJn+ z_iSsuTXC{E#D5^0-vFRH{)DVj@>^MS$DcI2lssj2ko?ZK)w)g!0&yn0`xSI1=**tms*c+FI2)&w1O4!{%z$^mxe^ z%j2U)ODv4pEKq0HyWdg<+@2V7Mt{Wbj(D_`MfVtJ*SSc)rA%?X3nn+JXgk$^Iq2f< zSXm09w~;q@o9qk+?j_kBD|5YzKI8V>d)`;Q{vT#IxPRo%dGv2y@zm<>B0UfPOyXRx z`WLaNdDQr?xYB;WEKg&oSA$oG{$>c)U^U~v<5AnAWxcYRoqquED`|ab)o=VyK+(T2 z+=S@Jy*$sbhELCEXL=)D-P>=t%?#^Aq>%gvOZvFPZ^^mx-&~A0u&%%zsOB%kWKRgv zIkiu(fj{nerxGxw^Rf9NU3<>lrf7r(7lk-QZxh0HRo;y<-?%1ohlYcw2$J2Z8$=~J z1#b?|9UgM^gWCsD^3>qIR`FA|18^twlgfZ*&mb=q92qZsv*y*Bl{OOWCK?8^UKyP% zEj9%-GV`grRR33rU5sm@;SdXPk0YqMg1m`d)ayW+12Fn~=ZIR~G`|LA@xMFY9dCTn z^_hto&Qes(=Wjvy>%`AcG8-7Z0;`y86suOrPF;p|1r?GxvWiK+A`{Qev9<(Ny<}i) z(Xo2T9N?+`YxhUlF*+bJrDRZ+A2zU}CPp$>fT3^*E7ik3d;4^E@n?ASIpz_{KEU;` zQXhLfb)5D^ik9}}2E3z5S3f@#=`m};3IhY|z`#4p9o}>+Sy!N%wD5Tl6QG+6bJ5mR z=vPigze?z&<@%9>o+j4zfagLqpTug#j1E1Rt3mDIeCh@S48pWuzm zYP1nyoQT>O%Q5XDu_UknP_z(ZR7=}aBZKx*Fi!jl)uZ9sI3XDMNU0KCBX%9HJ+_y1 z&yIYfml3NFsK53zzoHQuuig zSwkyC<1ph#+hE3vF;v4!5v+#Y761*{5-jx5glGil;co{lT8d#c?aboHouzVgou%&5 zo@sNK`*!3Q?ErSWd`+0qjt07(XjZ;XJdV*$YT*}LrbJg|{u4iZ74fJPc9vC4c9B&| zUM-74e~sCtWLL9;%h1lzYfoWoT-`sDT3DP@zU`=7;C9m3-BC*XF-28 z5h|VV3fDyo&BYzx1Od;fts9&}p62wd8=Q?j>H!QEv<|hHy-d5wRqyT0QFY|m=Oi|# z79Ivp|4bZ*%Q34y%gI&ChH1uT&FM3FjvWe&#X<1K_EqqlJ`h{E>ICIz9? zXVzy&Z=6V61f;%mYIAy`H{lq6%I5u2wt|+WX5w$XnP4aS)lK-yaT>J5jB$%NC3R$J z77DNL4Z|gXUL+8JkxB} zBg_txcgps|cVR_mVBs8riUc^&|Y@_eDR zBn8?xaZe##fEB$TBQ2jF(Qo-$Cw_`fmGKyUUEH|u+x3C^Y=3H2)*pokW&JT(e)w^$=n@Qj z8N&}R&HOgQ)J#5sKjYEm?e)f^;*qycVv#q+N_}bGF3ZJh+8*J9txPU=5!%U)X)~hr zXT?xgsp>Q5S?P%#pPQ7usblC%@AWGaV|>E|;`$vmJ9}`5<)NL|F^zMrGb|?P{(O@d z^dR&GBff7bem>ax%6_5jg1>F#)4F5>??GrC+LqCjvK@PiG96t(V#VlFnBkQeXcxB{ zU4=`%tZhNDUe?vZqHm0qE3RBg`7LoBXzm?5`V2-q-0uJ4FF^j?$gL-DnQT0cd) z&Kintb+8n$m4v#2P6+YmMD6ni(@K1uS1w2HC{?5H=JV_7qQlzxEkxH5qpi257&(yD zMWP?xEGk)@wl`zIF90ouU&JhhU&3^Kvf19dVDxa&pK|Il;BVm+Pfm|shgeoR5+43Lu+qBSy<7JN z^2(gXoxnAb_9JZGt^2X8Tsc|>t()U`8@6+djJ@v?J^JQVdg&C{Pw-M;Kb1v`^E26{ zcb$|407tUNpwvfXL`lHekF45j`ZW4{s-2c9cg-|v|38a`kX6nXAl00 zhqV#k-jPpP*EtYBd<3jC>3Iko_oG16fwt9I$4Pr>Bm6l$a4t|d^blpaGF^{%Sv4>@ z%F=%fxSM30_37+74!$4BF`JrkLU3ZStFN*(gG71HXIpCrX=J};WzbR)aDqaZ(c>72 zq@Kp<=9R0ybqKbZh^2M&Y+op!l-GJc5%@&2xjdbX`V}aWrQT}$Aod%{3vX<&J?z(n z^sH@(6t@^xR_?Ej?Z@D)tlSl6Up3wAe=W-}ZjnKkdv#WX!nab^WAllShL+O%v~p`Y zaKqESxyy0f9my2H-yS2xYEHtx;f6{05%A)OD|ndey>yKXR=k_Lh}6sm`=WB+aGzf_{(O!pCwRROZn=(auEFy?>$_fCY@aL3|G1I z0q?rSC3`DrrnmkgPods$sX){ACrf32CWmoQfBZ#OG5M>3Is3zGFiyJyh89er`=)b@ z;_>ee4ILQrJ_pTX@;v^7K&HIK)3_#~3!R%|_G-lcB(!Jksld7R8naH+QC*q)9c61=Zk z3AskwO+{C^5y#5%(b4(snCdE2Law>4jcI|sUd)gls!W|TlsnDaJ1=y3+o42#ujDCt z?x;5XQaLJ*PS>hd2Ol>ne+_=kxCgwRQArV{6W3NUnc_V;wc>%D@$vHUyo|XqkW`gE z_uHlE4|$&g|1J6Sxs0tXUrm1G^=Kpf_Uo|&EJ4JrYpBu~FsaIHd=4g6l5bha9bcwK z+;5eJnHtG^Psrs_nHqf){ZR}og&lX$G(yhu_TCTW^TusV;If=9i4Sy%yKJodRF=wbR&QxpE}E3rPN8M>mvXf%Q=|VhSZcU_qU|!4tc9d_xOCec^%TyOJ0XI#P9X2JpuE7Rez41T7fdTo_$e1U)<_K zZlpilDIT5ph241q7xQ!}xR5K~9IbH6T|9y%b*%38p$ozI#H>%3B@8+4nTe>L7XV2|0M3 zuY(lhI4U6pPFD$Kc{}IB`Mhz;In^P~5le?YnCZ}kt&!nqB6KtYwhl2i}gOxpT+8vwJV(8q!p98CZ;q?x;5qTscV@|IjuY^rz=VmUE!Q@ zTUV5)te#m+$}1=3=l@3kXj4l?y2<(5G(D#uZ_B6m|D=9w-p(6mD%-Nu1j$MHyp0f8 zYaG+=Y;qXvzjijEk?G|8P4ha*=_*oEy|yJTbdoJ_u3q~9aZa9;ZmN^oOw*;4$7D(= zZcs{*=~7C;r&US?z7VC%^76KK=5$g?qLW)eOL{0BQJylLlpNnaDL?>)V=k>6N)yn6Q&AIKm zc|sl^wmh=CRZ~QwFu3%3K%;xM;pDRrvIVp@raoi6$PEwuy1sckKyw1KT(?{r2wbSZ zWgY4^3#Og%zO=`FmEFq_L`t;3+(o?HU#YThuHuMS9dYZ=8}W)GUY$(5+$LU~QiSbq z?dgBz^i%moKbOKtrk|3f)6bf>KN&i8k{t8>d`)T4&sR<~(&Fu zpM5i9>Aj$?T(>t4q_;b?c^UFPNlHncmwbOME7O~t-o6dov`;@ej$3-Ge!7F1-pZSH z^a)h&Jq?u3%G=e^{|1Gm7+4BB?x2`$h0m?4XT3jPr|kr~tJ7YE3tj!N)76)F+o7wc z<@2>O2x;SPXFc>iruiBKH;8rt0bLb^!KJ?-Txn=y!H6z)YCh5IJqmzfEG`w=u2cg|4&LtF7xQ3#aQd0D_K~iOLYJ-! zZo0lVj!f6h-L32U5PU3pZFZ*X!UHC2g02fKoR2Y~#?Exzl9jGcoorjzU9we|Y^Lj$ zY;|(71w+dv`~O|nB`hP>hza&0#&EW+cj`fovs+i zVJq;tD)nh~ot*$kSh~)-w{-oZPS@voGpK*wna>*w)01@l56q3z&$`#XbwzhtDnwq&&PdxUl(+R7Ol}~h(HSM;JN`_f|{2F+C*ChEdUQ6p? zNk#RrIBm~sQxEfiXl)wRY}Z%abBqUDs?yCv+UYypJUgHM|8u%|sO3hwc^EEq^J974 ze0M%?hl4P&9zKXS5Zk(W1PJJ+D0Jzj;HH~zz%fBLj|7Aw%F1+8Sb$_bw{99;>1Ky+ zTQ`kv)#zrrX>_ZT>Hbf3Q~5+UkAhF>qjWTs3#bN)v{DtVP4se9?`z@p066x>b7BMA5jP!=kV* zyqR|!_3b&9f357>=J|A$->sYO(^)sQ9rZd{Wfh+`pn#d}vNxC}zE@n5i=j18x3qYe z79KZnaV9`5)=zV>bihq&a4I*@*+v)A$u9gin8n!WGwl^!JGf?TnNG9W`X*6yn$5=2 z2DCVD$;Gk!3hK^Q*;%AC>l_rej4{fje@@Lfu0u;{ZryPd7hZ8sBy_T9y?+qfi@&2T zg|@%H>K-rXXQQNLFe9xDrljTU@9|v*dgt`IGkPft%2kSI8SJaGWtFqVJ@vl$rG)XZ zNq2X3`v-DQI%yxkJnuv@@;=IYPMU3((cDW9jy;!nD1sEYxGyAsKzCA4YPAH4&ZKBF zz_S3t_X9}&*ugF)f5PL|=kD&oVvS=-hQdyWFa4+H#!f<_;a9+FIz{(5% zM36OC;RX&VuP);nyUg(#@#plE?M4nka?%X3^q`HPx7fl39RyP!9ZYn56b(C_hj2va z+WT!5C(BF8&cUoAF9SM2rG5!Fh_4%5M!w40W&LtS92Fg8*RjuPT0knFon76~l9-}% z5E$ilgP$E+JDzHU5BdaIeoI!g0wak9C?-rWt1{v)3k9*L&I~O8?eow=`FWD91+Bcv z4&d3DyC7m-wH7e}$w3%)P%W`6C86!XYigh6js(rUP^D zQXxDGH@SbOEUucc5Upou%znP|oUP&00pW0=E`SLl8f^BGD9%!SLC)E;c4G^)mEd1Y zo@H@ZY^@r$H=)zD-pzOlnrO(`o&CB%X@<0D$_|YPeF2^QqB_m?HPk(A+%ecQwdwbciY0T0~aeR?hOs?QFB722bzf%+l#=q zQJj(ab>5u=ULOH4%;sCO0Z9+~H+Oq8VF($DEoAsnEC`A~>a)F>#qeXIkj86x_d$a^ zuvg^cz!w&xODtYXT#jitR-pcF=hQYt-j0wsuKEcu+&f4!w> zt6C(k_)%tx7ONkrf0AhIZ<7^XhGDO5`IhbYa`^*Y>$re8)X&_-Q;t?!jMNdY!53X2 zPm%AhFJ2)BDJY5B&Un-;MN}{9^GIw~Viy(Z?tVsmvUN$-1UN*j+S8UONc$orYf)MRtYC^24u+%#9e$u$LPE!>{2? z>(Q(Z;+rCGLL_fr$8veQNtiBg1NMd$pB8!hh7jB>3_U?}xm}3R%g*v|0{1PY_**z_ zyRB;abi3`h72Fb2^&)p>bX7^;0UCYRg4~|lVB`l}82h7~9v_i17~RsQ6aF|2*PblZ z?cY;SG5Nl%q3{P-(oa{<^7WI)+kmlS`*tklu@V1JNG^~4-kT&qetvid;IU2Rv@O@7 zm}fZDChhDryF0abmw1^5+m2#%#s7(Mp6QMD;!z7B+aDQYh3LoFL-Adh+PJ1UgOn## z2DU%?CxrPeG3KyK@lSC_Kf@SRw|W9nDZZN!cg#XK=_a?U(W#%dd2##Z18+X@sSY!F zMfVaR-P_D2Po)|DOp(O@^~n7`AjtiGS>Z1*qX#gWcH^XddTd!-3q<{ZtUN9?`a-5W z9>j7w_e-HUxyt3uIf;rs36R=jO*DSqef6rR=mE1L^RV#In*o;wofS#*Z;tJuOtbV=6!=+&}`cTc+ zT~9+5ReDC2AO0RI`U6JVg?JX{gu07%6Fn6odh|yur$>JhrqiPV+p|V{iXQzLFm3%` zgvZ77SYz5>Bz3a1{t86ubRR;XssB6PuBLv_-8vIkrN<_9Q>>x*AK=-Y!&bTLhSv(s z@IQh2EoB8=%YXjyzko&m#;B)P4hJK*aaB%qzqHG>nK}KkTx%}rKO$I6m~T)&dbYO= z*69&s{X*O9&5%#W#2NaQ1KWx$y~2^(TD| zq za{7fNBKp~#p{k=UMixDyQA~Pem6ASLOi|2~JrvHuLXH|IYCTdvb_)WG>KJwroVM0m zgMDlSUFjqh{iJ@HN#EMlzj*`9~PT=y}QcvPG!gUy%Cmcw>QR>;sxFw za7L#T{WQF2fw0pvWKN{o;7rriDe&+S5<0N~x5I6Chq>@kla~09zA*N0LQPu;3Xn==PYAfF%`WML%g7++)%Tn`83v614BO> zzP17uZ;f&8CS*Gv#l?NG>jrh}s-_u2pp^J>B2>8?udj3Nn5#I_bKFH5FjmHE;Wiip z8m|=Rl%mCW?B3kD@wPY(Ol`IV_d*`_oDpt^D_V--x3Nd} z9fed%cEVEMtu_9qv1`3`1dcOC5MO$BKzff}DFe|PFvRD$^vZ_8 zM;fGm^SW1|zr*kazK;SHzY)Wg&6{v_mCX`YHWyAVn>T~nDVw9^I|id&Hpk)_Q;o>s zVw~LR)p`qd^j3_<;zb1T&`Tna)rdTq)Qa#p?D%+`S#h3#o8oM(z@{`~tV(nurr%m= zAWHIWIK~gOyA%Vv*OrS4qLTpHEbhrTEPC{IT zk}l8j`jHodSmc!ei%-LF@_GlZE_vmuXp2NvI;YP4@M@h_u`hk&aq(S0;#@gW60I`$c?L&x=i?aPV}j@| z0BE9nKMtc5U5KkAx)0!!=&W7hx;J-DF1`rx-1vi-@x>U)hcNWUVRnek`FHhCl_UHx zMj`r$;q08kK8mmPF#|DA+QExH?qJ-5b%|WpwrO69*N;DenS9cmm&tj#oW*1{mhRLM z5`8cCrsU@-%SOBg5LJ6}1-8=xXn#t0Z}eNDREVy`^jjiTjIL6M+Ke7g!w~&kP;|9n zDMoY+24}*|{b>V>f$%Zci0k`YK_BR|3So{!Rx|mWtnl-gu3qV}`|_Ewpk2HUXmmXW z7;SetK+_>5qJM$Vrk>#YqEX1V!PmEG(D(b2sA!Hdyg`T#ZA6I@dSi?dn{+-n1Wmjez*;7&cbh0K)Vv7^Orv0b{~M!Qa4$zKPKp zp54#z>{sn}o3auI!^|5f@j~=%Ocy!)wG*Ss@H+w*lkduECO69pZ^4udFZRP*aYo<6 z=pM~}UwCuFA2`HpOv|hfvQ`x2bQ_k*DZX7;PEK>Y^P$Vc4|4jU5ExElwdG{V-2p^$ z`i+y*kMK?@C$Sa(7$bkOS#r7ynBP*Cy872Y0TBHZqa(9Bk=YY%nW-N$AO4tm%JLE2 z4Sr|rFPh8*PTPsY5H(=*6nLI*n4+??vmsst&088YTKqR*(;V*g^PuE<48@lznp<7>2jvfJH zD1H>vT_3tR+}9a}>7?*uK>e0-P^osw@Nq!VuQ0M(MKv#n$e+q&k{h>KPBp&OdWwF? z<~Jf7J|QZ<#TZX#x1YqV*=@5^*|_l(vvTD5DZP!0!Qc z@%je<(X$xoFyKD=*T2j7%yjlflf4*1_J6{1-}awzrLqq^^+Uhb!HfPPY}daI!ly;i zm8bg3s@Jp+Oh5AbS5VP~zsV{kf0sok=pVBE@Sj-Gzc6fqx8$BTOcxRUEtGH_rfVBS zcP~el`cj0(G@F}I`40g1i6%VvTN}0BcgSRJ`hZNDn9x!^6dDruvGlDwJ)3Fu7*n9g zyg&#_U`dTDsg|OQX_iCt1)?o&dxrc|o0af(eWhH;KxhDXIE|^AY+_7{*XLJ-`+G^! zb%Xz4LUlaN_6{cEO~z9Na@1v2EE`?lM5m z*w&(180nzv=d43K>xwXyLESry=*;pWgF1*Vp*grnxgU#RjHNb!TN<4wI~|_i5=!_dldel)5>EJMLQkB>EER?IoD@xk9mT&)M^QK-SNf+EO|I0HQXi`; z=PMKZ_�&jPGN8SuCStMH^s*8)CHc{W@@&Ql~sN0$hkT#`L2FnDIgkoivtK2IWFI zda1%%q8Eo4(aSLGMH?4+nLxxq9H`xQve@(!gjD5SKvs z_mqyld(BU6s-R-Bnc`&i3sd{hWwJ{3%NAI!Tt|fC(y!UwmdyT>zgHMSI;-|dJlS>6 zD799xY~5r_;C@S~RN}2LqpdMgb$$@t`iIyO?W`_#^-{^wfe3PMhFm5fURlCqeTlVM zCW!t?ykr{y?n>E`xp`5ku28?Fka#hM!Kpg7#hvD%>>UWw&Ez3o0#sK-Y==#+a4A-C zfnD^yF#H!O%=Sxmhj%gFo*-W0Hp0bt2YfxesJbI|yc0$*H@aa}%8htu?6i(WkHoY3 zqGG5mXO=~fvmzkpU9g;-Uo9Lb=Uz|i2)CM?Ujx_?@S|OE$FEfk^hm9V>CtY6p`_BB zzYb@#JBE87DdHf1ZRBTY)4xp%TpDGY%VixV<0aY)w5+XgtUG$)I*VpHsPegxaWkkI zH_Kw&EQ@ioERCD7rL)34g|R7KrsE8$C7gH}Mzq|pn6Ehy2eb~7RZLzltCSpUq1JCP zr}l1b1x;2oY+dpaMqPeOaSGg%a0qt#j5BBJMWS%R$H9oW%er>PrMR-Uq8TeIQgj%G zcsz%1;c(ofe1xo0@&;M#Ny7?{!caR|vbXbCr9xJ31QxvsBfSK*F&wyN%C5eqWBO*o z=$*Gj$ZpyW+|yTc8FHlGal`u}X|uw`_)_R&>UMCu@zJ=`6pq2EHtRpgo;`=h;qB@p zIb;^J#diD_jJ`@b)m^cV(l;jKw-Vy!ySF9{&3E&5OcViiQ5~NXXT6UnJURg*8~#;B zZq}?f=li?c0+#1enG~8)OaxaKorueHc`L_;ySN5{tFGA*Mp(=v?-G$+X74i1OaArdBWB36ytj%(SctZY)I;*~Oe50#>1-*nHm?&!^pb^^nMIieBp%xbE^OrkzL(b_cXQ2nl9yd5dnqhgTk_C@x?e*|7wlI>faA3tR(_n zefkdrh(3amw&@}?awoNLHOFVx_Ws0VF5YOlup960P_WTP@)^W=bMB#eJ9Dh2rLjl0S=nG5L#;W)IkjGYg(S5Uphu z%j$$8H{*C7%ii_V{wmaY@l|y$qGuF!Berm|HcJDEd%z2SO2BD<6S8*VEn@>-uwEg$ zc@7kX%e>BmqW&N+iQkVSX7pA&UBplOJBDp8B-2lK1@7X z+e^_MO5_u=*eCo+*`?$%^A?lK%?^^)W|xySW>=Cc%&sP%GP{=WE(;%xr>+8#4J z@8`%w1@dXliuUjh3mECsDPnE?*}auj?`9Q)UGid~pXORTbR^_zHw|NXP3L@}mV@{z zP|lD$tGX(SwKI()0fM> zY|#9cvbg$eNb}H-C3k|-iLL>hy@pl~M(*-kCL2S)U~I?;D4pnT<`iNGlXDm z*iG2%<*3J>B_iKlaxFGp+0V%;CZCs8O0JVdJ9xd>rQ{1{2gw)BE+=0yyOP`>J7_7g zUX`jPU%{Y?Q@12&DOUQ{(N}ScS_!oxY^l3pTJ75W`)PBD!3gsW^3u zz6QPYjn+PI$!pzra)iEZ`z}h!*Oed=yGe-fq&cCFV6%gz9)AO%Wc^KSg#0a8rR3YP z3ek74n#+^#nlESxC%hRWxkZq5!L3*wq4YS6vI(Uev_!-zI|k`GEgZBIt+M($^;J_Z8pu7tF;<QNlye zknz95u-_6|^e=S64%5@$T?T(WO-+z!w{JOO+z?cwR}sT1SzS3Wwgn-~=c%5xegDdn z%`~Mz$Bu2v3F+{*l(GK_}jaXEL_>yY9{2z&lg7yXkd?4_)Ocd2iln zvrT$>`{2#^*?Lv~@%1P~h#+g>4j5xQ1Mk2hhO4!R-f3;_(hUe{&ZpwYg@@Y^bWpe$ zvo@-RX8!3IwNWK!sNuFkNY_So4X-HcO1|*N08j7mqP`KEzv}UA(k{M-+od*z-QhOn{)m})hjc*A)QJ+hm=2IS0T0bUOY2AfQT0fD+?ToTY$`WUl6FeFiypH6(B)Y*D0+6($B~X6!tWA`9>yuY@;pDHV0eBs4HM4? zfy4ei*-!iHxdPr>tOKM~orWOa|+F#8y&j@id?Eqa)BA#B&DX!9(3DbI37 zzsBG#A31-6A)a^0)!|R1Fuhx{Az|z#G+u8_dHtU8DlC)IZ*eSo1|ll2T{Af;IC|13 zX$?`M8ulORe$l4@N>hG^jix*;EA68@JoY0B@0k?u_YUt5lknKGD7U ztKF~#^JmS^Gz7BunM=0*_N4K#F{f$ZW2N{gME`)_p0c|F_22CiUgh(SE^K3`zP9^p zc2cZhGa=3RpTtmGqKuTQtM5hu)Pgt?A8e!ZfFrFCxYjxpMt)Y|-Mt!dP_Fpjz_qQ@ z>E;L^2J!JappsqY|4-`Q)GutS4sT)DA8z=Cbv{UX>*^w=b3*EPMQV?~Ry_(s$qb-$ z$$bl?4K2vA&~FKD@712?V2tQHZ@9ySt-NZP93j>p!|Ma_sUmLQzR1r*jO zHW#caE*GrI^24G$wD4ky8N5z1Q3*(6u{tU#I3*AU7R8kz=MyYSK1{OuN0!cVmyRXc zSfcsNG={SrYnCs^o>AAh-n}o+URU}#N}^y$)CuNsRxuaR;KjhGxboB7!2Kl1*4TQ3 zh{|x!=*>Xb<~jGk=JH-TTz!@D;**RkNx+c}jI484%$*8jcMz-P#iJAO9gf4V=J96< zF{p-RNLOp4uQ6}Myp@`r-G|!v1Zw%zyQta3cbi&J-fl~_cOY!{O$VO1W5X`;vJzfi z8&&5;c|EAPoN?OJ87$`*UZP<>uOk|VY;tOB{_T{0wijf+M+LI#ap`hJ@@gbiEbAA_ zuYREcG@rUX#Mo{NKLXK-#60il?X2@OH}f7C*4lySj4&5SJLL!pYm}1o$>p)=sVl|S zVBVlqNJ=zlMEjRWAuyiWb1CXK>F3ffF3Xa1xy+!Jeu3Q`mLFrF815%>j+>(6C6&X5 z{y^9RYvSpK_S{FWvhd~JHySiRvs=U!;kGc>SX1ZK4c`85iDfV};dy>%fwN^P<9mGuEnf?u_x8IqTC;uLF zN1i3?8;NF0&dT2?GetEAdc%ct72WEiqB+OZ+&Ji%x+b$`IQY7TrLzl1Yljpp8VuNKZmagqep9CQ3aIIaSH78&o#Cz;g}! z#00S4Qn5R-Ra1fHaFy)lvY{mVs*S}JZPUuix$K>Syx2P5mX{MzM{3BbXY_Q-u!xoO zveGEvZ)DVbuv$%Q*1bz zL9UD(q>w1Td7OOq@^B~BD#A>QUdmIYMYxorNb8%D_jdT=@B($1*qHnC<~_B*zVn`7 zl~gn>&_;y{L>N|c&4BEZzwFP7yeFL6j}XVur|BnEjDkXL+! z610R*$yj+h*xUo-^#NL3N<`Rfh@Fo`TVeR@fmP%MdM-(hN@0!CcDhX-gsV0}VbpnU z-yX+5*tfR|&g>qp4bwg)Ti~FBIwC*iB(L3dVGa@lW?`E5F$b{D zywNLM>{lw58)qygoZ~g*L1EmYu%#^Csl$r4!l2795eBfYXkcvZFl0re7$%R-Uehsw z*x%5SgI0=Z{@PLSI1p}QA&hIBz7*U$SBrt#lat%x$QtP-&h1tBF1C|>_RZwZJW{S!rU30PTMB>6{9~1DG_EKI+%!sJmgd*yKa!l zXWF(7tA0yjaq+7rBG-s@Fj}ImMr@unV($AYds`!?byLg9iK!zkYtA$W>5ReB@8TsxrCcG~lXz!D0LSs*3zUHHh~oZhtvwE?GvLW`Cv8 zUme{ZXQRJn#|!GL2OVtdhMdc+*4guZsBSJffM|6}ydRUZ{n0Y~BR{QI<{rqagCwoP znDuhQ!N1Vx?-|u`k8-`oulGdDLFPq1o;dQO19AJ&K_bT{4IT@BJrrbA<$$v=(ki>;r}7-&Ew=Ms<`jY?QPaTXEHNcfC)=N zJ2D7Sv1hV^fPly*Y67w&NI(kG1eKc`6I4J9hzO!=A_2q=K@kuH6cGg!0TmR98@M8% zxNqV8{!Z1seS0#I=Xu{h-u`^LmQ$xrojP@DU+xj|#VXaog?_wtq(Q8}jK6h~w3V5@ zb8-pviqI=Hj{@(&D3%7ab^+~%MTH2u?bL}K#Znx*jdV1Q-r@n)f)|^|D0-*8IXj>= z9j-(5m2@9UTvY7(Me%?RcPwb71FG(A*yCu8Jiw>MB`l@jj>FKts_nT=D=a_Puf^+5 z$bZ2qiD!2_NH)^bCYf}sQmtO;cfr`4d7*Ot34;q?0k|Aa2H7}iK;WfC_jV%FG_+^9 zege=Sz{QJ|kWWN1(8`r&Qyrb9O6Nsx8JO1yZbL(e&i!>1x8&S$jR`u6tuC49E7wTt zqu6SZL5kN%|MSsu=@|ir`YoDPcJ4$HPV2nh7CMZ&UpD<~&kOmG-gzz3sZ-j4LPvFQ z>4r(YQAhnG!cHDy#1INOpbb+&I?yI((8?stR0`)s}^+ zJ#o^*2$*0umQ^KoMd0kpXlP+N|3S*=ah zqE26Jpl`}RU*ACA)W%oPo!XT4I#KJZ^~^tB0aI(e^Zkan8e7`7a;@*8b*ghTXq~mG z-tFE&;J|`c6Qk2+iM7pZQ@D?A$jX>$q%D@#HX}svD{FmJ#y)HCa*?_{)m9{pcr8+o zg)F(UHkEi&Yf~_%K&!TBA>)Tm`!H0kXJDb>cMQ}vAE@>C)fm&aQ204fH2CmtXase0 zUaerN4z0@JwV;0^ee;^Y)NQ=34W`=QW3pN$O%3|fH@#hTX4D4JgPEoiThwOOwph}) zWo=6?$)=a`}L_kcVPLC+25!i%I1;U?tKQ9{{nx+tdIuMLwAX+vuqy3 zaS4uY@xA+jMbeMRW?#B!+Hdpm+kxr#a2NI6_MjhD8)mM>+Id;Efc@&zE}$75&f$El z9f#q;#yFR@<1Cs8=dyMjmW4K^b7ecut{G0hl!S*WZQv(3-QC6=0>lS>IV zZ;(smn>WfOA~w%G#giy3D~4B&P6d!G7nFgm+3e}Wa%?s!Zpz{%H7s|UaFA<0%&idc zp!7kt)A2#&orY<1X>)R3S@vn?NT`T7_}#k#p7vwU0N#OqH*bPnP2UH)c-<Gz7B z)eaZM)O7}jd<1siJ}j zMRf1Q$av|o^|>y18DP%*4Kmzaow;<6BEr({mkxw!)5O2#;NC~nunEIa9+2(CiF?0+ z=Ym&UaW*F(?ZM2bc$(bqETwt2Vc5Qf#;Q}P8XX>(ttqARp?#wG9I%Vm4uIr7fKz)T zc1Ch|zv5|(*eCJDZM4mOkIFe`xHYdj*Kmn1NAcQeivK}_p$~$&ImD2DXuWF|b~pL< zK`R*CY7^InsYOTLE5oZ;W%cu?R{D&8NxD?;VIj-?Kv-#*_G=`9UTA962HN>2Y$$R5 zT^+(IYJQ1>!aFF64=t_RlQfI&#{!Wn+S8O4{Jw$s%~d`qgCEC$7&yC(`(rVwz^otU zkf?px{G=n#^`o>y^Qs%{Cp4b0-lndpf5S?T#Gv|+nuUr0ib>9YDtKQc;2j^+JTe7iFvCayE8iO0A z7VEE4@klxY^ieI};Be7M_}HYQI=&b*{r+b(M_G40JfHL1*6+_tX`g1G3pC8|I&AcZ zw<^{rYh`@c+qQB#clqEAg;R?4Lp+;>9YcZ&{J-R5!Nz%87F6F19k0^|zdSir1P7AkSdH^ZGirW8=`<}JZz{D! zQe$*zrjQfKj`rB%8{DM14vwkg!rM@}5lYQwNrmnKHwi$;-qoa5R+5uMV$ib3vUkYm z>{#Skl9t5?)J(BpWyYBcdqYL#6Y8y~WNop8O#5uGR$FKS%(aCo!PZ#j!YDpn^r_$K z&^d-*Dy?JOLGD)IcC)-HnLenUpFU0>K80+9K3tEpr4RC<4>~$H&|F8hr4QF&Co*tf zEBB|t%In5w@Y9!e6d2SLW|(e>5W1mGNIk}<_@Bi8D*lbDF_4|5weqtdZsl;OLt;8XHY3YLrE2j@CLEkr8hzTe3eI_U0_oZzJ_ ziqC9^tKEFB6zM*%NGU$;lm`9Ohed-AC1WuH#;i|^+UPAS z+EFA1ua=qy7j80!cunaj&leLMSk3Jze^hk&q8%2p(A7Eyl|sf|sMPSl^1Q$yEc{dq|nwcs6^6;z{1 zqtcq_G&$W)uqzqDvFgN%D-^D&Wpu5atDa$5rG7Kg5yn~33i3F~PDe$j$?3TI)@9Fi zrbN4fAZ5llGpT`PQ&6m$W3blDuC_=CihGRardxEAwl&H^;Qn)WR=c;LHw8N2`p4u zwqe~~_fMo6YzC<@dr|`Rdq%ZFeY7A<&HxUv@vHO?DOyPw(@T8uWkH-F^hGCqze=@3 zXDu!z7Mgt-7H?Cf_b4wHG?wZ9?d#Fp;Qf#H7FxJh7_Lm$S+oKN*SuZcOW98@ybnHi zLLO6@taXwRlD<+Ai|!Xtbd%5@_bO`2s;hyfBcSRu>dyk8s|B^7`e_V)R;|k+bqMLp zsQqd|EyynzL>nrd3OfJ-U6p!`Dwuo{6kiW1ISR8v-ai41E#j-NGEIIOrZz7k>usWX z5wtlt$%p?|*Ie?k>N{$T7NaSJsjJOhFM&5qCoFpP3Lf>yMm!enO1%s$sDnlK52{tmfgy5WyM=26(Y{kYaCD+uDW-r4^V!Oi`?ES z`_C}i^!MK_p0$Bp9A;;3VL6oi)As7*BFcFU{4)@fx$-*YWgD0~lKZr=d_~9M56w-} zIBMHJCA7pVa0=fK_@_lAzFwj1nQ44qwl{wkSpL3>40Gdqji(yNV=#785M|7l61v>I z7|ERi3?z49HISf2q6&;+LEL>pxmzfM7S+biMq{=iFm@K6$L3-k?zwl;mP<~IjTJK+ zXQ>^ao(Z0BjWNK`>IElX`r<#(eKHW66KFwP*W$6q*9d=<6 zc^-rXVY|aiTFmqfXSF^9ysn0II3avb!jqf9B%c=HKmp{++WlRkRUekZ_td6{C&^oDox7Wk3Bi_wbzsnY?gibuEv7HI zsm7G`0nqqN6n~|~^EZi*$nT-l*XC?^aQ6Y%7{}-`X0kZe_TMh#QgR2D{H5lrsf6YF z9C5C1JABoL-zlq{+$A*l?zX!=RyH)38<1#yVHrUVy0Wa2D`B}R23ZYx-OS#ZQJkXt z7W|AcpwYtZw{h2BuV_VgzufzJ_XD_%+;9|si*!S=JP0_E-$QvX4}dS@OFhVscf32Q zPoc?=rurE51B@f-784-*6{GrYO0TX=%q-QvBb9n9?odWsc?MZqGUjB9dGugQ`~J$F zD!Zclw?t4NZZRi~qFW4UJ@WnoLee}6rfW$*6fER50_H_mY>AFmZ$IEZZ{kOMvz)jw z--Dj-8Ap1~eOuwj>RnTZ(INg+yxo?M_7_fBzBh(d7?sV8`j+r<#{aRsV{>OzWA(SC z2xo3BR=B{r~sf;KVS?1E$L6joqX$$*X&-m^sw*rX%CgV6 zhk4Xg)u`6ZG-+IHL7?!GGl8=cfHs@()oO zNd76SKl!(;`rFkks~!IrUg}?LNb!FZ7#oVYmkus*r!sh>Y!3H0q(YC#p@cL98j5A( zoZDHI*rG64(@~_?udhk64J`wQPt-_w+!JjqoI|RN;;QBJ0 zl&|;-#XMXY+J5nS6*$y64!+Ie6DNR2L*1Uew2v(pB!V}pEN7cO@CbO9=?()Y>545N zEb=W|sy)&hw>jND>SArv!Zh+yi#mMf(5z^lrmRDq(LBu#m`~2r9?(!%T3%?}jDQvN)6cXGEuMqS-Ip~W+K+hJmXI2Zh7xzM{2o!SA523LO4;55v zJ1O1gUjbC(;#reeeo3J(J`R)+aR1qYevkYu)L47gA8|zsdT>Uw{`(?_&?CR(62_yF zmu3+9MW#e!hu|CH*>b8!>1{=8vnf8{`Uc@w(UT8xe2 zGALm^y@a#1o-SXup8jrhUu)#YnpU|88sh4vy(14V{a-A_bAXgo&jD2QRvEU!TUO>&Nb+A zEz{x{^a;q(&KbJ`;5K*!w);Fojbt-H2QBr+-HOh&JJGw9kwn7RITS^fd!?{@J;2h9 z<(Y@Rkz@;C3zMU&bSc|HGq!Exbs(868nMjL{d|I=pA-e2W{j}%ze*vVtu(Wi_Dg2g zbI*9AYiwuEd-1NFnk$ou`w7zUtOdZ6lC}iWc#2jk+b(z~QM3oYD}z>sCHDIarKGy4bro&mr5&zA) z8TDTiUt|4td&lK3XK%XsK8@yP?o=yGr+khu`Tqv|TwVJkOx?-9@eBraO~LeCzm>(w z7OGUdJBIrmfaLdr4jNA5L&A?%3RHhafqzio%4cQzc)JlViUro(=s9e6bOzE=*Ykjy zf5ceBF2PJ6x4u6pCSiX_ZqQh<8x-&(>dBuls1D+Euy_5g;=}V4xOstqv7=1G|18v4 znF*?(47npP271GG)n5pFvQzC-UZ*!lUi#;BTFGvt)5qpyx(S^Y4-@J%IwqQHm3gJ# z(m`cym^HLe946!q13RY6d?2T7zP|hN8sh55H?N4tC4t4;XTE`TEQ3#S^gqa9235p; zOY5>Vtd<;#<F*A1>DqMxG zpCtb3eL9NpJV^EJmLE zJ2EN+@XqRhxEoYz2a*KeQs#0j*!6Bwb^8nCmMU$w4`1$j0QTC7XQ$4h+HI0*#a#;r z{=;`8zp=Krb5tYZ@M*g!o(;iD{kuvvV|-2&Zv(i<`(RuzD!a*$8`X4&hf%cv-ltn9 zC&FXV%*8JwsOUZo!0#9O1@b9C^MtByJs897pv@p1*7Sd0*tU0)_9)Ql6}zwmKXpUV zwqa=(oFf~|0sUE-(dy%gL9WmH7f9*H~@`fXT}-^5eJb38YWy zDrnHM!rDJYrccq>P5-JIPX1Tn{yqOjgonn=(uiUabcm6!W8tFh7QFFo5Ggf*+(QZ+ zQD7`{#q9)*o+X57DG|X>6Wndb20=m<)0Asxtj2Dhl7V7DE=_h+a1_f*>T*vvI*g`P zv{4l{%k{FjplqhdP_y`W%uQrG?TD1Tr!*s_^m0-1nF-mjp;p~Gq8o{u4Wd4ehe1@n zzj*}`(m&VVh|gSqQ!4CF0`JPnoBl>aFk-d+Q5y+#<8zHtW}l1D^@%BZCO@W_RoMP@ zK6%DkmUe5bWd+w#qeNQd$66L*g%&zkD?dNh+9pUtZBpyoJDa1%6oo9uvszur6amaX z;QDY6({>wDtPl^%`a8`VSllbb$f4wD=`@y+&Pf?12{ug%OZa~jH$HkjL9Jk9H^53DPHEPKD zL!PI@f68H}&}i3EH2K|r99^bBCo%qy3Tp~mT;a!|5fy%mZMjX#FP%rO8Q1pk)_&Ud zyas2h?U65=N8X82s_kLdu$0KaJx^}7O4{0?TR@~8>MOjR;y%;rg$SV!suj`+$A2Dy zTk&tuOsWmCw9r3Mj*pHwNpU_)L$UT6zCc6rCnxQt%6C&Tq6S)T!xIlqGWOGd{ zAhEkhh_N@vvny!AH6;+dnP*oJ&+hb;U2C^IM}Ze>w~n!P>n?p)$6A<%nT!4Y5SUR3^+|rbNh=fupuyL>uqgWuXDSIg}ie)tqkVfn+KdRmD#Y}mK;6`Qq!CYQ9 zF&9z-n<`_Y*(zgWFIUDYC11uZ#zPsKSlY|@ym4jx24aUY-WO-9jOEM9_Ax5oG&joGsbPm&x|WLAFZ(CNhxiA#yL3J15&m zC0mUzRewHgvK68KQGYC*C>GIN{W%OT0#aaFe+2UN=THUmEe|YTf8HuU>`if$%36@* zO$wZ5q+0dIQjLvdT7RB^^{oCpj%QQ#M+CF-N!Q0N%H?$v^+yS8s{RbreP zKA~2Ne1cG?8EV>h3*b=?`~(alWi(Zg_xRTsmIf)+FCEbDaTV@!Ye za#kAb(053%emaBJ-p*>XznAkS+zo-CeX9oE z`Ui@E7g*M-#Q1EY6slGl-jxez`f2j7os-M?OAfpG;TEn!;Y{+Ne{Kw_gxmC3>n`hZ zWlQ_2-6mq${6%&;4izIgUEZQl-Z~ri7~PgGn=<5dS=#7z*+Q(`gD#s2wCnP<<8=9S zVh3GbfwQH{@@2aG7ub_7zYAdUPK>-RKT9CG+*5d#3|(jWRpeaXc`pH<;_r8~`V*tg zB^$8nTS`OUjf?V=<@GrcV9*d7oYIwI3gq?q438}8tr*pE| zL|>~Ea(XbWkltfqEM+uXdSEQ(^gt!)^`OOk&;t{l*MoGeoi*`QL}0}A9;}kvks7bO zr1O=}j?U6Is?**91Kxf`B_xt3|^~D7c(V5NdJ>$=rTtq0R zGdID^CHxzo!=MecbhtwUR&Km?4qo&`fsIpy$ki6yzIQxJfj&wU%j4eGL%Vjiz_B+) zF5h)~sJKo0YeACLiZacTX^q8wUvC6C*ok4}2uduOf&*ww(vJYCH zNnljp0<-ymNOER*oS4 zBoo&@#!6hGM3g7Zwb`$+&{-jkR0ixNeHb*Z4Pj2L^PQ>IouZ?;Mr2_ZnRzj$M}UVk z{^?xwvCvD*lso=X5kxN1=Vg63x8Dup1UuEVeG3$oVPUC6|U5Dvu96XN3H5PuYnb%>~4IxJ(&HLY?_%no;+|~%y z?jPCJqp%EkJwfrOFx)l-bHW~H6n|ELZG9oE%5>#(3gZK&z};+&+9;%J$vF;`4oX^ewgO2hpolkMUyfJP@JH?$F z)n6uoSVi-)GiD_FAWQS7vef;zhrzqWXb%&WJ|JDsIGupT%^0-*3Zj_4LuNMg#kXK3 zFBfPa*#WB&3yWQ!;Ga$nt6W^tqnAoZ&*YE+WENTd%r|J_$C#9=y^VE<6_WV`$cS ze*8dBX4Qouku~eW$4fI_HH@K)1W?D9Y`mt+$Am>3c>dx^6GKp2merY2~XR z!)uAWO9=va?jS!Q%x8z;yXnG0FIIiCM|t(UPio`6 zlIOkB;+^A2S$pt$a`08sXucYDyNcb7hO)$CLM@_E8&L_wq|*|J+r`VYyIR`$UKB|D z@1}f9)f&Ms?|Z2ZNdHbI&YjYw_%&j#)t+eksi9+$ zv?mIp!QdKOSHjn|x*Br@k7BuF(M-7Hs|G=c)*yr!hM?3envXDYp9( zwST3cl%LkvMkI%GelGFi-;)m+<8bpZnymLKU-Xsp6{!5F-M-86Cp5d;$=F3ZtrfeG zr!>S%E1d<3s&+>X>j#CSc6}=L-A2oT782ftzAaJ&(V#tFjC(D2HI4U_h950jTV@f{ z_I#LruD`ykq8IMU`nlck)6cyYtK7f1hcu&AyW>gr5F#C(+38z4b0fDW@U;aVtnz%8 zY@YBn7s_w-~RS+N4**PByta}F+@?^h`lINO7kBtoK$ z;|y&~jmKbD!zPij$PFyik&_%sS7TN?VA>&Ur+{fXnsG7PV)H1!@l1!jx;Ns#M!5ETVR7y=X*gM;$w!01E|NCacK1 zxP8fqIF%RWEv>u1R{O00-qXRfmn3cIA(#z4%rQ*SDm;To|Ec#U0n6$=?bkc-qhu#z zS^Fi2bLLa~7R%3N!&3~hPsC;8Q*rX`s=j2o!L*+7I(XDitTh!JpN2V~1;@hj-KjJ6 zs~PY&pGLvXNKux_AqpwLt-#Yf9mAJ5yuDMw#pGQEo5SK54*TX6e8~-8@3t`G>kOR6 zS8Onid-Hs)RB)VNZjvvd7+<0wz64nJR?g!!SK-R|3io#3W3W~qu+}<~mj68S&)jKJ zVFW>Z6a9Mli0p*mYZ1n^@^*1#nUUr4v(HZDbP@5+P?6iZ7gk}$j6#hgFq8J-K;CLn zZLYyseWs;Pza@UM`Tzf4e)`n+!chHv7^lti9m_5rR;<6@Sk)TCS-27*M)k7|IAhg0 zW^YwoZ4UUifHWU1dH#yY;4tqs6z!?T`;cd}Qn30i3=5k>6oE50RyYUfl4WS?yXc z>G?bJat#a=HfI<$NxGpj`Bsa@YoIZzH-tP*3V)vxbI*Nrq*BAyKk-t8FB9r4>mZi! ztBIs?5Va`8`m#h@7S$qYjrHjDsxDe+)cY*#!j?N0_F|QI(v0R@x`vh9wI$ul3hDqHTBEO4qcg1lKz0%vcLLR&K)p@O)J@yh{6rU%$SAs&erj+<1 z^yRo2MM}70fP-i}+*28~O@t|x4gJSaSqJ*6Q}wL)`5@$Q^<-*=Pe}8`9F-|T7nZvpU{bGM7Z@mZ>M*E-xsL_U06 zpjMu5^L}3>E%M(AGU_%N?QomDmkOsnjcr7}qt+9sN)|kK-obgp^5VG)5EG-VF`&Xxc{tybHDW8ov(Pz#6 z1pfu_1M$qltzTNd(eFzjlj--zm$MKqeuORM&dHueWkpBz)zD#uU`h6K$3_2?Y z&~Kgw&FS|EIsLvIgdA@3Jz!?~eT4$Oev42Dy5l23j2FY%4)->0GaO_4EuLt1LsJ-2@HOD@ zB96#P!LK%l==1pu^l;@w^zZZZsUDKj4!7DDr%l7P_+lFF$x0eQ!`I<74Tp4I#mBLJ zPaxgnNq_18T*a*jy^6QfoTp2xfov$(kLOg}klR%J8dz;taY0b=Yq4zqBd_C+pv${X zpyN*iKX?KiKbm)4pu;0Bn8kG`qFL^GoNE7%V}W^GSjm0H2cFEb^Z2mhGWR)!E@O>& zd|27tU=f!`@fXI26_=IWjTYLfd+>FW;e8Ra=)Q#MZVou`_2qG4C3lMtgs)r2hr!ov z3Wcw)j1Mcj+btq|-7!8)e0|kITYS+b+zBXa6Yi3y)h666^qD(tTX-H>e(b8{B@k+YNW_o1?{y@dq(j+Ewpb4P1~kEb&nRs_X_Oi&vLqNV({IZ zD83IzWdj#hrtlpOdGhu7TlhzJMjw2?yFyc5U6UB=0T#vI7W(}d2KxtzF2AaMVu0>F zpz!LHYW+buI&gePj?PZIqSHy$^;Pb>Ktt;!XRXscgypv1eOdF2DbT0UYx zVLetaZrv8K-s(SiaBHc4tcUTCUC#>wdj|tdHF#s&ffU8xhr0U#hQZXTju%+x=qG`8 z4lFaNG%gbDF84!4fvxc}>h>}kHR95hyo|boj97CbX=OaL<0gadR0csyvqpHaj($v- z-!7kDtwX_+<@ZSPn|8UT?4do{%F=vHX-dQ${)&DqK-E2tNo$n0MH0j3sRMV8Yl{T` z8nB1?i=KYFMT5*yx9(um$xo1g>7AVI1>u&5ta9=)EWLji;8Q((Ai#CzLPO#2Y78DL z=87{IdaxFFD^Rv>72S36@crl&0O({yHd)OGtTg&=ARc2D*(w}icM~e^W+@7KqI(R& z=2NuW^DP>GFVaKY)&SNY4^DS=1y>*@Sy{0W5Wg47P%CsCVc$KeHV+1~r_$km3RNg^ zE48wIM-X`5k9lQf{WiGgtlvVA0awxs{UmD{;S%Z0-p-;s$VT4`T!d6OsIcvdf=+M1 z;SGhJ+Y6QR$#6P$(YSjxArED3P{ncCk!PpI&LlFsE|LfLMzb950KgBSePDbhIiM{O zA{#ws${lm{4S)w56`lb>p2LRma!kjSQxfX19rX^k2W%r6?x-aq$+xtWUr(Xpxbat6 zucnQLQPese_ZBOiUYH%gD+7bN{93VzPQ`HpwPLULC0RE9UvSq)yJ(paM>KSNvCFiX zDnE{0)`uJyT7^<_+?B=QGr-DJBAM~cFe|O~8X4)^MxtA*S~iU5VP9Ss7i!lPX8ZCw zd{Xa;lcvg@me)Q}%q$YQz5+9pbS~^i)Gi)&!E{exwB}%%&uT97J<6GnhfTwYvcD1{ zm368Bi>YVKe8YoTf^(N@y~of3jpn(zbWWkHIMasde$ti>{5@$rtQQYIZ40BXKF{Kv zZ{~+F>pwFLz1dhQXe{xt)yt0}TfdG3#_3wx*HF z_)(MbzJ{9MQ_+{(zeu4z8gGWve2jLxSSCg1;pNX7lzQt)NeTK75%a<(=rhvRCLl@I$w=HE8> zwGO)ny8Q!aw+&hxw2z$w$7Ewmz^uyVuoKtc^kk)hNTg7rJq3C7aN2A4^1Bw zIk)epzQcc9us<=nQUdbkm4WhGHg^roGE&*ZUj z`FuN}A)m+NY~@qFET7wje4Yd_kwKTSOm1esZF$~OdDa@7PRBiNc^0AE`MLKJaDwu^ z3WNPlODBp&$o+?cOx}SD2?*ZMN_50ITm}ADfy{|$mu1?JVsws25a2X5u?fpfIuWPX ztrKyUhNq%I)yU_f`fM1@PQ-14hZAw>-JW&p3RURR7RMr&$veH9@S|M5HgO(K!q-8UG}g*G-hM$WK_tv@xQ&maj3|K5?t8jmcbDtF(Msd-j#z zP}Y|9a}iN~AO7RyEbm`!evLcckMy4u&$HtyLR>D~a5^<=jb# z?SP$$-}bxYu;m}LK}gAE!Zc?k=@Pn+T=Ji`=Q$t2;%>~PmK=wk9XUV5gti+PSnrU9R(o>y1(Dd)8t#m3j70=`H zm6i?tisa8fiMO{B=Vum2$#j)QcLM;2^2Or9CvX11p@OEGTv86jGeTFsIddf|pQ_)x zXp>Z{pWKhz%EEWOW=_V;_M-^f%%Gc_SsNEN#h`s=P8}E4Z_oiV2lHXtv(+-+&&jhk zXZ9?!IkQ%#t$>uwX?LOdI`}kVj%v}47ZJO;jScAM*ls%T`dfL?o5?o*#hMljmYNUY z9xk?zVReS-K!Ww-Q{+aG4ZK21{bjhL_z7YXD&iBQ@nfZ-WtG8zlchAizn`J3T0f_5 z^%o(JhmboSdm$`ZITLeA!EGT#-@e5H4O3rbuU!hRbQjqxg4+@U9W=t=7;Gy=0H-z1 z_=vUFgv()Xo-2I3KRqAwOVc-@Zu)#o8drT)p4KdDEm+cs>O*3!n6T%mS^34X%E?Eu zgfHEG6ZTV<)+IpwG`YWdYY$2-0E?cO@hr&j=|sv>B<5?{>q9Duf{Fwvi6sZC!x#A_ z2Zyt#k{{oKH)2W?o|t}%r)^}F5(Zd0F}fXA%F}V+>Bs9KK-+i{z=Mq^&OZU*Ow6k@ z^x1(~&sY>InKj2zV&p}!Lp-IIGMVzIVDX^0;OF3mJJt@mhIiwWg7Wi$L0Luj19Yxf1$P*t7VLZq*&Pj z(Ih862DBsWWu>>pwD`E85Gec_%3cZjcYXkmY>g}uM0rgf95G}R&WBJ30^!xTQIR6BFg?u3afn%vg z_0pb>pc6T%R4=fjjU5~5i2ru^+`FRsBC?`7%=!t3=L%cy<#i$LJNlCopxzqK^(P-P zzs}OD{eDKg)fYpAmS$J8&Oag9O%Bd1$|@(j%i_tgJ+LR2N{48KC5+0U!9L8m9JEEh zfhEbFgr#*w?U1Hoe=r%mju1XWsaH#)=3aPacPD~XyDGEey>al?YEL3ZM#xT-x*bkFle#bNiXksK7)=n*rG3`%faJ_IGID)~-V68>k)F+^Jv)8_5lE&xk)z6j zr`YXS+S@s>z&AAn>LgDOVS%X|7rsmY48J6^?E04_?$!SrP&V zED+uf04|-gex_JZEBCy~_&@^eNDCUG$bK*&D4znwOgmT})K%ZlqA_PPam*itM5(Is z6mQk`;`HhCSUP{q=i?x7x$^P_G&*^s+@*w7cd6`~WTCQe#!gjM7*biY$EoaF2($5; z>c8~$PnMr0fHQqviU+k3%=GmT9Hy^wps$Bw1$})h&QxCy!(EAmWBMwdOZ&LPu{Ncz zFXYmm9UlRv>8l*lSMfSdUzKb0Rk`*0s^nVwDtIFHOovQ19(PG1?t;EbE}6cHV$fGP zgT9Ie=Te23>8oJqgpoHHyzEl)b}ZG`nVchjH+}YBjjt1cX1ccw54tB9x)+~_-9uY(5;nTgo5<0r zZIVj-4xIC~U0CFdYpWs=axx(`8(#B90`A#;W$X6``WShOiTLNe=&fd3oTgg;Ja$7H zrW_Gs>4tFUFs@N6TVwR5{o+b|3LyWLbB|(+U*Baqt~)tKbubax4Kvi>i8*$j(Zz7Tqc+fwJD2h*0RdU3Rx8Y>DVf7eNRDyslTbbS1Po=4I@3~ zkM(T zx-|gi-WJZKv$m?}*}9t+9hvtEw)S3>SY?oolZuwau*&XC5iKU~mBsCCS>@#YvM9T= zuzlIFvqD|{hvo5Xpy_e@!9>0RCPW+h?;{mfqwvSikg?HSlyC3TgN4iQ{*2M^ z3T43G;qPv|idZ^3`E96a+H(h+M;zaUD(CBp?i?JU%^mFOSSze+m2meIM&TBx?Bh_+ z8=4l?Dm;GNR~cG#L^zeAOw}JpYxKn;OZX2YTxA3F1B7s7!P4SziKR7iw?FMytgcZq zjDRGZFlkr2hl~}$or@t^abM|!IFadES*7GWAJE4g_{GTZpQir;)}^}Af2l6%3V+3a zIj_>wF{a_kbQ|b&)QdDIz18|BI3e5FJRhXKQpf1KK;T-(hva3!7K7x_9f7Q9)ZYW*P zYSmq&_#L&5jS}y07ZWr=;+;P64vxxvRFQSg#5inAytCHTyo6w%xUM#I);dYNNEvOR zIxV@Q%O3{^IbVvUbt?ZYn17j$3g*vyq%&%RTn5-~QCyB=&EqOi9)?|NLyf zK=iV9E8P?NZ!Qm;*e?+MP3;$m=2{i7%HfP`FVDDai9V6!{eD4<|FB3z=A`@F1ja)T_| z-7lD3PHx2Z?eEmW*GcC^rL$6@6ZM^n?QX&deWy|L*sZ?vi-fE1G$QSNr&6nL75dI0 z-*?_Da-r|cqU8F{EROFxeXLlyDxxw9Za+;`9i z^t8GF(Y7wY6Ql{a8;JWF2E#ZpGKJ+o_jMd2_o@>TF?BHa(iz#}AV<&$^usnrmh{fE z@Yl+lPNUdLV^rhCA`5a#bxkh59X9AXBm}h{d*YnQPn9NnZ)Tg&the`R+-XKe*}kn6l1_PJBDN`Jk$ZwI#?_ zLGE`Lo?rKSoWoB<^=AYsCV!AsN}iQfZa#-)nwdN=0Mh-V+2!O<*cwap+gPoLj0d3j z0?@Im#Uv+#a5w*qkqD}BuQd*gSUKS{vvDF=8gX{Ds*PxxbYXpxWvKoaK%Q(T75=aI z>??3lEIvAznfwjg{T*Xqz9yw9u8-c){D*@7iNUEVOsjkU!ZGr`w32C{ryhTkyr?!w zxH(>|Mj102gcqqw{|3RNU&14v)+m#nn-JVoUfh2$SYzg@6%MOZrYvjx+A!rKHr;HH*FluBfFIVoa$-R~{zitd+8_e((SRt}{i%w`!Q5j5=_ zDsso7ZR2HCgYUzCT4;0*T9_W!IViDE8AOXBt75qhjL>j<$eNL$m7-4x6kI1LBRBa3 zT^Am<^DJYr@-_Ma(o$#gh*+RAk=}&PM2!Bg$}^rP9y%jNo+l5a z_?aZp+04WhIveHCI-4zUxGgaT<`0mh5PdxQnynNzguz#rFm3)i3&)sVzn;>$q5pBx zZJhfOoJxA0(=H#Q*45CYrq)^CnxMY!DO&!JJ_J^Kru1&aYWI}h`bMm#@oL?9R#k|w z+Ud4Y!bhuHth#M+ul*_PCMu06mYMGr&A%PMzR6Q2*JsPIS#io{^*OjqDNA_7z?vUI zM7?6@6D1h8JqE`!#R2C}Fh&kQNFm<-F}gAuaI$quq;B1X(ECp*gKoHmww zh1{_a9g9x>nTBL%Txvs3n`>^xExK1?x>sQ+p7fsC0AKiK z{KRIj;VD%cGPASqW@*SA^w*yatb*H`Z1B)H=wY7s8l0_po_yIn@1Zcy`<~``GMMu{ zEO!H}{G5-AQ=0QlDf|(>I;^gUQ0{Hf%Lr&_)s6X{r4hv<7~hJ)gC-!mF&XnPlKB|S z`SN(TweS`QZ=vuO36Ce;u^PLIb|Cr{LlzacSSYa&-L5hu#AG)Cc^DpxX`^ikdMdng zFCev&rNhcyedYe)F4bE~!Lvb4gzgojKVsmn_0G%}Mqj z=KUC=ZTw9O-5aspRL{hd!7Wz&ypy%lsL&{s7x?reZeNe=?cJ;+h?li|_i)@C)CAm8 zi$q%C=b#p1!U%IvlZ&5&o{<)f2`7Y`gnjsKdJ|z!NKsW@XB4HgWjmAAMgGt%RvgkzWyX`(UWP z7(cJa13&u)n9fU`L0C8Z4DcIlc27oM2bQt=C7hmt=D$&*UiFT@f=3Q5Fg$t#A){J0 z8PH0Xn)KW>Yd->wwMu7w195q}Y1w1lt%xJvEmo?{{lQxEEETvl9*18g=?=gUzeh)< z$));%_+a=TS>@!7Axv+cd<&c&(<24i!0&gkSYb@(4hAxMy*OmYN|E{(tN9AKv1Q0{ zgN!$U^>Q?^-hm)SwZB>HTq8h5gGD1ea&P1H88Lb`O+z+CjTb#UxlWPO8a``g zfnF)4caI4nl$kQ)-i(ozSrEZn0!(Fg5`=nHW>!3w_h(FngcMY02~J;1S;0=IORbz& ztiXakDf-BxA@gbfKp80ow-h7e?+`o`(V+n*9oM4dWcbtRI{SH*5=u`7Gp%|q)2g=; zII8ArBCR@%z@Sx2@*1T`BacX<4#&0Tw?U(VER~)+0;8o*N8*FoqhytnqeGbV=>d}7 z%=AftCes&EeL4on=x4B`xmn2~ydmR#22m8O3k3)hlJly$vHPvml1!0!(Fg z98@-MD>JoBe=)TZUQny!agNT5;RIN)k3|cjW>~YZ^y`Z3;J|IfQh#i zq*rU>&6+5o^k}YHFkSjvrc28Ru(Pf&p-U&VDU)K2JiL)IK|bh{(sL(bwDjpDeCX3V zWR;VXLzwjG9^y?geNv$5)4x)EazIAcfgpWSr2fVG;PY9TNS96lC+O0CL6>H=bm`4r zmqZm^+B>B*u^wfl(4+ml9_?2*VnL6fCOtB0?Run)xKlB*vI=^%Jit^|$B=v<`L@hh zw*O-~B%Gi_O`M|(z{^zrrF7_|REZRIn&TcN#{<*9tro%jp3ozLt^RRQMWL z<{Kl0v96}B?Zr%S-U)D%it{c4LnE~8v3x6}SYC17jcd(QxDYM%}nG%2qOOwPWvw0ONujEt8s zF8^?VX&>wT@G?`pWWzV#ZVAWEAAgf(My*#3F6rm2I&XS7&eARCM*Z!6gj`>QCmWzI z2?O*Cp*?a(+W@^fu&j0VnDL*IcOMCS`nK#Md?@h6vN)q3!n9_qudr=lx}reSmHt#$ zE&(z+2!eD)k@^=a%UY0A&Kk$#8P_U(3@p>=kQa3!oI5I>stA2$mT8qM)=@2UHiDlj zl03xi;j)gfWu<|1Y_F(Z>BP{;d5tp_gB=lLLR+&h!Gz|`wMt(#aG}>JjEfG>g$?|T zi>l|M!>p7GKP9NF@ocb<$qA~ZD$XacNs7ZkbO@W0K z6!es z5;}5s+rZANb>La)x=&z;XRp&&;e+W<$|@&Uhp;}r8{<&fA=7CEnoe(->hwAwqXz_? zR;2#LR~zda`jw@|8a(6F=^C(%^E7{lffKT-X{PD7BAb3IYbT-LX73u5TVeqwE2x#7 zC=8PDbA&LH6(O(fVs-2k784s+ibE9MIF$BplEaEG0rgHf4!!ali&B2iVu!b18#Lco z>}X?=BjZpJw&yUd37$pO1Y^;`Vt%Y4p}T7_GW`lgbzOjIe%yritWXz3Pjz9)>VmLB zUHBBvQHeOy!U?NFRzRu>VmBR%Dn6sW&gN?Yu2C|1K9!KW9wXy3)Pqk4nCgM_Ve5_S zfl#a-+#%kn2U~}Fpc7o1)_n^6AXu>{TGYh95s#nYq!r;a5FWW}f{Fm$P#2W8`)uIR z*M-mFqb_`27H1+tSXvjhvAUo@s|&N!y6^=cSzS=1R$WlGCaMcJf|b?<%ZaZG=FIAX zB3oTh_D)3a%}(oraDmAhR~Lll=Q*J+h>))fVzs?47>5(og%*buFKb^HG7f!RFcwu8 zJc}LPPV0iP*wMzKuL~^>)4JeUR9!F@$JYf3-Q9$d=~$=>UkotSg;S*Ap)QD?>caL` z7lak+!k2K4?gi#H{0lE#55#I(4-{AR;H3775cEljxSKID9>aM2%K@f(pf$+t;4z(> zDaa8Yv9f6|84lt z|F6j6JWL4F_+|&1`q`%c3N-y6N%j8@AfvsZFHofZ#jDAt#y84U<7hnNTH3FI6~;G~ zj|M2#{wsp%ymEwk%bK6I{^VG#KUO-Z2nw!PUctr7$c2qW>C@6%`p3R>`kEkmjW!0P z(Z)cBS?oPPu4*Z>_nc=S)nCtn^w&7JAU95sz}%e}nO+1j-xXle-4jV+PS9P^lJ363 zbXQnGckjkI`dTn2UMtUps`gv#r*k32v-VqWxvmlUeEY2g+}AKN{(|0qJ;0>5Ixw?+ zPHz=vdV46Zcc|gsIq0nhFdH@8dA&V`3T3<5YPgS8?a~56+HT(iT|a=?NNv-0TS>cb z1m3*f-ir^t{idvPa$g8b^|o$$t3cD+SEqXWEg+fRDpE^tm8*&L_S;|uy|sK~daDSg zx5^PpDl64nVFHphPHz><>#can>8+(df!>Z!zooavfb`ZF=rAkQTVtT3je%5eJqOZT z;~=lM5}3OmBh!l@<_7{SU7vqh&|A@x-oD24R#-uAAH+GjyYzPA`FoZtDX#cW6;}~W zaeu?z%{8K*t5-_EeFsDQJsQ=&ixVYyNLDHNo~&~6uq-xfA2GX}JZg3&`98MdNw;su z9yT3OsK1;MiQ8e#FuogBCB`gQqHg1(N{d(658{Zn(m8m5JBDqi{*;=j zO%#t$f(=#zISGd8DJ`B3RgdVebc7TRvKRHExQ&I8i>)fBbwgq9F%0F6v!joTYBBkd ztWxr0AE5ca*1%tGd42-m*iLwr+4+`9p%*z-@)K--DYa665_i}^XFE`lRMZO$Uv#x+ zv_8YH)_>Z<&z&a}W%n}-9^I1j=NQAcNA4Hcqq>|{^iFMm>T5=mOU+*jCAgoGn=7IOHH+2!QF zW>=C8W>=FJvAsMx3)ews#N;6w#gZ%Z(``iYB&@Lyipjx5?#h@}ZK7DT$24M(Vj~xe zn7frr=^o&?v5iwnhF1;5#o*G#{lr13#NwLYBWAkLU6Hb~=h6MuCp~yR$0rk>g;X-` z2B^-_fs8Pg6SFRYFXiK`s9wa097?iE%`#R}k-MB!u|QJWeLlE5l2=vy*OIm>v<@>x zaR*3aM-rSKXA_{Iqp&_K92nyvYdd`0(K_cO@}bm~AV=6bv0N8Mc7#okHGd?}I<+Sj z?Fd^pj*+X?^~eBmTdlVz2Y&199Dn`8NtzBOFQ6hSHKK5WkNY+iVZ zxUaDCoC;{{V|bNaJF`W0d6baHV;hG69@k`xf@Or=a7I(|^DF~?RE>}FuB-5VAXF&D)${aF-kvIhT5fE;mW0I>zG zcuNcu9*3IiTgjt5SgnvQoa+;FLxgw&;k<^?_UAP&jOw!#Tuio>RZ6yzRZg~*h48k+ zmdthT=um9Ls5cNb@EmuhQ<$N&71^4PF-0xy6UCxx&%N*h2u@$GRpd&Qnl&41Gj*Y+oAd6che|2(f9 zCW2VphxR5*rfQ!*DpuAg<0ah)@@FpTfuh1-;Y$zLw}EwTM(H}HcP7K-QGI8e$b7D> zQu0b!<>XZ%T;qoQ;A(DYGyV;AwHdGXm1sL zSBQHJhRQTOpPt$$XLo6i-c0KA+!}l}_fUYj z_LS>FKO(Ek11GPO6~%jDxxF!xeK14^x*1S@jlIs`ycWUn4anFB7v1Xt6pgQ8y+5=s zUh??{S*2t@S>-VX3hSZIz(zjTqvGw(4M<@cSlNyoMmFoV-OAZPgO9 z%gIt~;j69E3BX;9|3iT0+NxvWq2JCG%ViUNd$+unJ4`G>fpH}jS}Zv`+@S){5fnPQ zI=lVHmUu}3pq&AJD~^$yX+mBlfyLs`w`d%1OIx(^LJh=yU}(|GzC|m)@;jkfQkGiH zlCqFBOP1SMEQV$&OC)QSl(Wz*`S(-?3s-(QYm>yRI}AgzLgx?1iENLMRZ5QZ0e!qn z%|b@uH73KO0FJE`*Wqr~(L!z>gPAByoxm~@Rcm#CZ>_YWHmoZkKeAdy&cCIamP@4 zLZmW1{Ru)6>uFm~5mUFsf?I|mSy5+C#M!E|Cn><{>^tN-J=9rwsH`VrIfs#)qEKHq zX_w5$D;Em)zT(osrS4QiqHZo1oICfjxN|S7oUE`=)y>|*spxjY%H?#RV>hZ?n(xG! zyi3Tj%-Qj~WvW)nk*k%W6iUI8F!YsY0QE6f#yH(djBpv7oAP+#e_CrI+HngxHsl0g zH%G}=VJG4#MB&12_9TVCr@e(zNZw-z^82yaIpRMsy&5Pi%gWKP=ea0i<3mI}df>w- ztr591G1i<+8a9(Bf|7FYO`(*(u`iy3QwcTSCxkPIruN9FX&lFG3c0aFrST!2Re;ej z29)I7`xR^v!Wb}%Yi;aV3N9vR%PJ-3$SNlvz>+Sh9FLbQ~gTeh_D} zR>-l;+3|TYB@{Vw2c@f5% zH(A9E)I#A|R;DJR(zw(LFO;36*Ab}bOd>q^6E9jjfRNSSQYu;me<;RD!w(NSz@hE;Uyge!iOCT+|$ILY6&vP#Ky zvdYP)Lb&pI8+fd!pqtkN9i4@jud2wYC(RhN$;}4D`^jGDYW#650rbejVH8Q@trkt> zLmw(<)qO^QS6G($cpTYJ674PQS zwIH@YQ%RHuKJjYTx$l)bmJCL}PD+Z+!;Q1-{2De0rFmX=j-<*k|EuXfvy@_meaT(b->Rh-Nu{R}> z?kU|bEs~xoJzga00XLHN#9S{rR`@D1s2}cT5z$+N(}nOJ(jcTeul|mz|AaFd{;Z% z&ke?-G`eP>4Pg7$x)JuR_%DQDl}W{3t9C4Ujm1~ehS5>;pI@(4=c(>f7xl^Ym){Y^ z5|p(qzr->2vep`nWRp&YViQ!X9Hxzogp)QhPstrixTEU9qF8{?vIx&Tjgf0v6x>$h zs76Mw718|)96lA*QU5iLHIh3m%Y;aJHsCiP(XwQs?w>c32_VNvjx(Qts-JE}2E44Vf@sY93xP^S#_dwaknCjpUlkuV>0i zVv$zje96;>sN6ShLu!R*H)L~H>4^I+hUy4?^zW35V)A=grQ{h|<>U_`T;rIN!CPo` z=vkm+ww4&?umbp7j1H48FHBCW_d1+;xC); z7R=@g#M2{`0=Xx7d}>a3miRURb3f_VfLrNT?On6QKK-3YAKG^twXd1^P0Y%=o5*JK z&w=vS0ku*727tMIrBn9Cu|2#+qK8FUBk>b4H=dvF!kI9!tCiDV{vY1n2hOtWs_Q-J zWF{f}Gl676LXb!jhLCiodnPjzC!m5i?09@1WvE8~-U4doF)`{30AGdmaGZ zLg4T7$M^BKyq`ZB^Yi&_jQJzN5nX;Nzjr>3KZHMB;m=T5U6&rtI6sp(_nAM%?lLXgI8{;Y4Xf`a z^B>~hFPk zjV;Bn5_?-ikne5Ne4n41@0U?J=KFI9R`ab`p6{0v(Hy^m-#ffKrSK~i{yc?i^ZomY zGv6;Lew;pEu<@&++WqxEK|-2qYva^yRXFD1su$jQ6@QosgTI@%BzYcT3<5aXQWnih zJTvhH#6PMt6KKTJUJc-mN}%@O@%4Kz*Gg3H9=xCLFnko4vMR%!*YJl+>uQ9_H=C?C z`NiLq=UVmqT#Gn(;qAo}qlyteEMEL7C-LG(e>Bs8>TS?~{LEKsIH=uImqtll z#p{B$UaR&DkI}(Sc%_4!($p=Kgj3-uYtw5PrSFZ&0{K2d9Zc2lp4+;5=zKP(?L5crOXAtGwin zwejvZlHvDW@=ne7yC1UfMBxWK`L>!nWtlvAd9mdxFGyW$A!M7A^(mw8}FM{+x^SZUS(d;B2DwGB(1_1F%Mrt`0;m; zh)wBB75);1`CXsmyQ ze{$#k3;cWhFY$-2DhoY%Bb~VYTK`MQH2wn-U>9zKj%?H5U zTN(Rjzwop1V0bB6#y>@lPkX^D{4o;w8j8UilV=W8iRXLp4`3|3^V!5-7X^QfZ`Ql`jXwzoPZ7>Ic)L=Cp`&pyGY;XP>epD^sCBNw!O!z;Bj)DzpSqtf z1-U)w6~v$W;G1-GP)kHf5`6pzsR?=#zxY|`pl$2qD*@JYUpZEMJ^vn;63j|eGX41v z;uZf+yyEAm{LWVi`hX=q{#D9&>b5}Rf2zc<_9FV(f9N^IsqxpHDqi>lzw#WIW=Bc4 z_4j>>zZsQ9Wd*qNHA;J#)mgpwYR!Ay#!bpxtomkn!{yqT zkKqlf|47~dA6A{#^CllwFP%qJ{S6*rXsPs^Wd^MOvPr*3(NiyZN4drCoxUP3Ew>fk zQMi=h|IRfBUtmq%87Ta`JMZ8}ebAmp{(a}HR_eWdofNw(GWkzDwfx}seGA>CC{|HW_iM-~8 zen8+Uw$b}k`&bT+eD76vZts)JkN>tUen8wV3PM&l2!C^dC;1&gPu;$m|K5H(UEl)w z9sTm;ItefMR^{|emK=58BCR~+&(|saar0JwVEirs_NusjS?IZ6u6I3O@X{yjKow|KT6{sgRx_4>_uX}HO8tj9ypGpmUvY5Q% z_jqHK|J5G?kO}l_mHHMAvjx1ZSow7VN#^}w1zrm+JorZpB)#S9361}#NA1i~`+NO& z>h^nq9@F)2Ac<33{#w`H_71P;)a~hn@i&sE{NwydYoY4*H>r}eu->OE^zobZOaCqL zwxH#=2*lLT?{BrBzOnEp2cKzBL(ku=FGk$CPCB~ku73QJ3&cha ze5aND_RMJh7xm_OcfM0U_uctZ`eBuRSM=jO+*T)u$=UMVw)ERd9lu%!iB&y+S|y)% z=X>;X-<|jChkCx3UyVopX);VbWqj81-d5JzdM29ME&pxhF8>UFz>lT=Fsb*C|EyOc z-t#wdzrPP4?fp6Z(9rkm_r5zHu;_hv{ye{G_d8GBwj8&WKs#3Iwq?GpJmc5caVWa; zOWdQwj#P!~m$;Ka#9#M2zy5O{d+|@Kf7Y!J|KFp3{~O==jURjGm;KeR`>E%@@fDvq z^PgY!{(t-Tf8lR`^T*rm|N4W!|7+j*>i@L-qA&UzfBb*_W1s!h4}Z#k{DJ@4{@eZE z_o8ol@ozowE&uUf{^s|!{?^=2UfNpx-#+xtZ~Waq^9|2?&t&xAtKR=JZ~4fXKd|)= zp7Yl}_O2_>UEX@hXFT_%`@7HkYv260zUP-;{+^d#{^@sY!UUeLeafr(I(>Wotc*I^ z;{U_*|Kz9M^}+A{N5A+7zWO&l{*ONJHE;aVNALgecYWK}eATJH`vcwQ{pLUWiSjKU z_?|!cp<5fD_=VSQZywD3k;U$Xx1|H5DYw$J&4H+KGB zYwPd-onLwJXMOGOzVds|{qP&U{UiVU@_nE3=2w6C*FLd&q5I!H{<;qhe(Z}r?|=Wm zSN!s4{rHRi(_i=(FM8tJFRXszd0+XnzdiV>&w1n3uYB|;KlG{lZ}=DQ|B?UtBX1up zeCs>^)en8>OIP-OhkN)bFx%XcDw{QL*lOOu`Kltunf9)5({x^T{#fv|@{e%Db7oPu1U-?VL zD}H%ze*1&p_N`z4!QGE7zTvkfpE&h}m%n@M=l|`0c>DVQ^}9FU|4Yx``ruFgyTAI8 zAN}RU|9;_b{`9wf{cn8z#$UPq)#XoLUjMQuf3SATT*{r~ay+<*Dp@A#e9|LSYLZ>u}^rN4UnH};FgQ=?xie&e70n=kw6 z@3{P5o>=_iFZstG{(t`5&;7ou*Dr7Vz<>CLkN)?c`@-?+H+F_dNHtPyNnwKlt9C z{k1PX`@rw~?myo6t7pIND?aqW?>YCc=KkOlzxLB}-~Y1f5C6BXddo+D_T5*1sPo9p z@89aZ@`rAG-cS6c_PbX<{b&B}S3UaoRv)|hm%ioWKmIQ-{`T_i|MvO!KlY1%@%w(} z;dixO^5S3lcmMDO3+=Zon5hWTk_fwT_Vh!i-}KO9XLTfoUOwdSUqt$RL3@8P813k) zdGXn&P8EB9gL}4@+QrxZ$f@F0-}#*43l@gstIGS9=kZiJY3DDkEb;qyi2v3D_ZMIA z9wP0VgZQthEoWmivSKgZ+N7S!^!f=#Td2C$zD7xjQ@nwl?14@5TP^ z)&8W|obUDeWjQAFWdE?(T-opMQfS!UrC70fZZIkNY4>~M(N;0n+aFJ!ct@wRx!#== zb9>#%Zdr>?#(VwA{$T~#nT!wiG`pZ(AC&i``i0g7gY~- zuBEWRR>*)BI?NBP|o=H%Mkg?DCg;2ufGLeQy!Wmb*Vq>?^us7bVpl5Rld+I8NfpSTKC3)so9|L zK9q9R=F~>H-4zBGhuxBi1v4tOG8*ZJ89mrN7+Q^s-Ex0(T+r#^;9dQ#Vm;<)@mhDZ z!^|`RWLO=P`<6&}ert;?jH&1xjK){X{^Uk~YqMKkU%u7r@7d5V9Rp{??Y(~Qtp|N5 zuCvwe4Z9P{9_|s_>F+xwcFG*uCxtQ>56b<8{^EFdue(3EI_zH=>|ZN7T}N{Vdh70% zWIGUXs{X*lf$Aj8jqmOr_ENTHA30NF%xrZzhJJr5MZkR+<3Cv-4|jz z-J_Z;i^cY<=bm_Tr?c4YUF&bn)AZr)_@KPl-@i8AO0#dRKJHI!cPUmC;uJ))Ut|orP}iIx~50&>wD9`Ip~$&>faXqcQrj zc&*>N?iiSK4-;k@MaqnNo1Q)hTN!PS%X5?QZkh?o=3M2$-rjHkx{kzY&eok!$Yy4= z|1?wnPA9SywkvTRoi zr(B`NXSRVUQu`w>C$%e$tur_YWqcSS{DOa{?^J!wG{KC!=hSwYvb0Q=Pf$hX3ESBQpo`bqGj>y2-U zG23E*my$T?zw=;#uz2f17sjxUFiaE26qySr{PfO)K0wq>~n)dbJB3~Vm=9I_PJD5zQ^9WdU1|_^>a~!fZfP0~pT<8yBz$`c6 zz^1^MafiYC43@5W2pdl2hL;QD@pWourd=5j>8qMSX{wUxDlkMNRu-q}2_-yNc}xsA z{%BQPE=wjx(o;jm@gmZ;kxR;K4|Wbfc22FhDtRjVfY9Nu%ZHP}LX~I=6XkP|kF4u1))FJ<5v+*TE`8IaE(( z^DzRe{_w~ogtgk4MZk%e($>jXZvSN2wojJr%$rV_@9_dHSajEgV~vMfrkE6?{!I_` zY-$Tr0@vWtXud^vtGg%ty}Px=CMLmH;T|jxO3kTZyXe6ycT!5`N3kCpuqj@59;N9o ziI+v_2D`D3?n+azoy&wKeRrLs;zK+ANqhfr*e_P#0qSkB$YjGq3RO?7qwZdLZM;u+ zZw#~{hjHqsn>OeuA@EV#y?fAQ8PvGlCxvZ%v9Ar5Cl*MPe!0gsu`EW~@jGv!h6!U> zI9%B(a@bM0Z5tj?dTXCVw@kQ5gWmW1%alCaM3|1)G_ozeRjj2JE=>jnMK=1|6|9(y z$NM=)S)jevVz<`2``1|KrmNrRP6k@HWg%rmb6gg^q3g=G%7OKP&F28>eiyifQ&_RY z$A;Q_tL|#Z>d^Jk_@;^E(mIvrA|~?i+^~!2s?H=gHdmI z01c^EWfA+NoZDu{(TSPD12(-2hi{9KM07C*7?M!f6>W_)jtx*(Ku$gf3dK~z{1?XK zVZRGA9#7b(PxRYfI7Dg?fXvQ38i9w;M&Qv$6i8Vv`CWSm#8{P+nl7DG@z>HXk zZT2q44S<`2-F|z|8()GX6t^r9Zf$R~r5EJHngZ#&!xdRvqz=Vg zS(ccLOcVoS7~4h?F(WxGP2@!^A4b)-IWvN5(DJfF+UuN zzC+(jqQ7tx9hRm(OB2hD_}{kdhVA|S9@XoI#p663fb2u471=1(NJjNA<60dE%G@rn;vC1hyQGiS z=)RaF#SkH4Vx#RL((z(4R_1UP;g3a1G3uYZ32|T9pOCwC5 zgPl=-%XrP)(OodEFjH+30odr^V2lC14F1GkY9=dVH>)VKS!l49 z*@XJU&!octB`%>=|D8)zIFoa2Y+IS2@rt-5Gg0rwcm{dS#a;t=U|48Nv0o$v2k z7FnYg%_^3*FXPF&jI7C`1>49a5^fWS?Oq09CYeBS+5n;VXvU!3ld!Whj}&MnQoy&W z`Cw3chlogo&yGZ=)IQjPYYEI~Yq$mLwv{l0sJW%AOdgRIhSsCzH8{*{p?cf1sb*_M z2&E21w~wIsMN_u!l0NQpcyerdPsPz1=T;$?iGTYIWvSLhrzBFyoo?F>ozJ)2{h@og- zrF~s}Pj*DMT32Q}AUcJ^`udqkjwPL?+NDxF*0&t`ncvsC9os8H%V5D5?Up?6IwJh_7c9v{F!gv!F7vs*J z>KmRNH)=7xoKIwff+p@3J8B18>@d{LIk$fu%|zSR2bftx4`#9%jqigqM=8r|bd`_k| ztJt?~RU&gTnPB#b;k(GkzKjwYD1kcdoNaRqk={CD$r@Od&kzS}w={Og+TNtc) zG>{FnyWPEFj5WckxjdNcqi+;uvhc|WLl}c?+2N0rBu9=hWyj6tcmW-jqdqo0;_};2 zyu^e;`a%2hO``7u#TeLRVPm=~Qy%^FT@L*ew>M0QLT$s1c{}7hMq%q^(xu_bc_R8U zilg{(#$>GF)}d-)TbO!F7pWSd;?%_kqFdN5K%H4>2X;);OsF#6#oEhAObPuhJIoSm zDbWL@s7Q)$$AFe<(7Z5;aYmmX^i`^EZJvA!cGi$S=ounLeH6$o)8VcjptghGSV~GZ zNtkG)*4G(gnC28v|9I20m z>3s{)Nn2|vqKwPC13R~2W`o?FDMdtVy0B?%?V0}Aqq5YP^!m}h2ApbPHAX@BS%l`+ zLp7fny{|jp3wk(Z)sC-=nKcn8D;(0?H4afsbaG#8bC{^6oxJ>S>KGPfNs%7&%s#WK zre>4322%dHSYnIN%1kf)q#9Octyzs0DzQA&(G2&*NZucA7jTd95}hTygysEi!?zpVWxaG=d$dXm27+BSk4)(2FJV~ z1o!ON+9ysz1*4GV(P81BH`s4#5LF|^99oRmIn&uWukJW_Yjj*WV=G4*Z|9ia(N=fJ zHg%@j%I5F3pRj%Tit6D^Fy5{88-kSv47FxOc*F^~?R=cAndoZ5Od&Q@+1wSJCJsi4 zbXmfRmO@prw0v&<(&}dC+{)^5XKnuCa)!*e+shXhR-baHuliV*I+Lo1AUHy#vHnFJ zi84eb#m#>AdIR8jE*dAXU4nAdqWe&ylb#L2hT}a@Q0VC1=&xTpEb%cIrkahd!cyC| z!SdQ-s6{uk&CT)r79uC)Q&I&gu~9?4p~*P@oK9DX?C!9ftyzG>l&EJQCCu7`J?Gp`L``{DxI(`aBD-kHKVo&k z=VoJV=y#KiL&uGNtW}dO7*zsaPn*>UEM;EC31T9xe6SS*p#w=1G&N8COMp_5nhFRq zICmeI@%rhy^>kSq-2!jDzI!L#O1fve>W6m>KnP{$F;y=~srNEQW=Etgj!UYMdO>-n z_`%#64R9KGR(?;`WJk8vD#kQpFU^U;#i=3p&)6qoelY4YB-^a01%azZv8+p61-y{Q znQ@l+o*&;9wnT55nb3pXQor*Z>8y$ETrzT7=W)a13=Ad%}Y>hdVSyE~Fi)&-tdMS}e}5&o8cQK2_{? zt{%Xm8O3gA2nFc3r<2L`{=_Il(J;8~=Iw z{^Ii5W~aUK_GQ|<2Ho+q-^H%JFu(X@>)g4{#rd~&o?2O6U20pWvM=NuX1vmlhIN>> zjEaGNjQJf3n4!9Q-ud2ST$VZStR`cb*JPwKPsW+b5^@)w+FWjT)|WRrix)1fJxT8d za*NC^i$Y?Ug3FHk@F2&GELqX*YdZL4tUBk4wF8!8TVY%8UHl--al#O7pvC#Mwbo{5 zVYx$Sad~xlsZhKgSvmLA%G!B>J+#=mxW2l)xopl9umf+a11p_V9m7&>?4yu4@L))7Fp{@m zxQEy%*@|>l0VCsu81GOPX}kEPm{UMiCDn-3j113Bx;xt9)nRUsNF6Yi*hj!;fb;A& zYZs!m(>{k}CxQg_uHftnfmz@3r1_B!eRDII2Dv@yW6ALu)-fj_wy!t%F(=>dFeQcs zB}Hu`mDgu`ePylFUT?-Pu5+ZdgX)NPff#(hvoOFO&xz3#xP5J~%{j3;!7f!euX5tB zWhqk?G{LnB+Rc=U-CHh-)(&>Bbj4I{Yg9Eb4X;%-os{cx)&q(R2`mwUaGk5jI3Fma zF~jQeJg#3_SY271-&|>}by{m^z^#qW{OZQ?{L)jMm9>@4mHAb8%o2589pk0P?+qOg zrgNM`wC(P8-?&Khft1|NHil=3Cr3T(Yvtml zi=FeUt%dp3&SLA*+9sK{4t95K6C{EUB9QdPicxmDH(-ETg%IyR$LgC;tuJ?$R$!HF z#@8-VrGmFRtIKQWH!mbpG#afFZ)$vG}aD#8lNQvhH?oCE~luOs24; zfa5_>S7OxDX;I^=qQ7O_A)Js3W7nO{3mePr3$4|qqP@Djyxw`JvwV4Z#u1D4)pmzLE?Z#vZHvq6T8i_l7GKzCJ-NJQ z!S-freH{!ae->N2oz?MpuhGB|ufuYG0aft&N^V5tpwk8!$#y#m}Uz~&g~ zJ3L6yw)KC}-PUXogx>&6U_)Lw=itUASf#8naRZ8fkLraCDxeO2^-G(Wvshrx1cAWB zW`Q$xApY$nu?Tb<*WQFkn3ws@W&PdQ1UEI%5;Fe0(pJ_kgTrRpN_)N4Zo)F=TMKPg z#`4m_Q|t36fSdJ79q+5gEYY%{JQRuZ&5F#z&;;e_s`XFgsU-y0UA(Zexrk*VRGQZThGT-jZFSHDCC8}e2ePzp* zdN5;m!-V-+3e$(X2O^w6Dd`E5W2-<+>Dm^gCAMc~ND_J+QL>k%Qr8cnps$2FD(NL$ zqpcatgi1?Eaq3YXZ3nW6Et^g$yvNQ(vn+$pPUk&bjN`Vlvl70kRNacJG7E<+QmYsb zLfzn?-hMCF7qTwz>+%@HPl8QLuD# zOp~6(6^C8;GuXnP^ksy!29{vGE;`a2k0)!0kPXkmD2-&qcGkmoYu^|gJxG}4~@!1f?UL~&gy!UE>-OgI7Lxd zM&f8ys4MJB)Yifw&1nzHIp}_CG>s4gCS+J7qeu$RYypR+5+2J%Ts`Vbo5pQ?gqsaI zQz>c1F4|AJRz_(3bPs`;!?JX=6p5fc*O{& zmN#0~Zb#9Kk>(^ZBkGEW#Beyj1#J)@|@t&ojv8iEbR?hde6mjmVUUEH4 zyVJGK0y^&!Ofl_5JM&9RAv3JUQpx4c#)dM?0=|KA7ch{-HN!p5jZ=J3#(qY#NMA}$ zqbH>kVT~!}{TYj7>!5enEP)nGZaNL4L(+et(weuRZBJyiaWjSXyaZ*ch~N%4XuB3M zD;kL-OpRI##m36{3m7?Cmo^qL*t210R_0e%msh2bX<;rLZ0k^pn~>au%8_%Nryk}Q zy|P?XycZ+#w4~nm0u@c@mb~t&B8%7^#L80@7N4#mWlA+RGpUBQj;X3z5|N|=DV|zc zDT8-YCgrKa{AL~e)$bL8HjYlfzXW9VB15K)G}Su0Oj{f3yE)MuLLWczxaX4O zd|AX+xU+ES+&L^)W_LqlfqB#+VjT52{i)MsqC|Bx&G1r_%x0&%f;btAcWQc51(Ml_ z!AY^acIo2shVSIHR+3g+!%z~^8D$BnxE?mNoSY$y%ApCdO8~Vyct+riaEno--8*P= z7gP<6%5tY-gW%J=c4>9BgJN!`%M0`DLl;}@sxkr9N@4ACe+RS=PPe?)ndY6o!k9@O zGotfb>a4S!4#uh2Aqi>+W;_?qs4^Sm?%r(9ma#VMv;AKSF z_R@S`VR&3%H~oX!?07sylz{oQR+}X^LCTbQu%+jidzSk8s#Rjf?HMSBGyEk{OD~F| zb*Y~2G=Up-cF&Nxeg-4OKUG=DW{aRwJO{~OoRVCy;)@bX-V_5@L0pogb!`lx#X*ZX zPQVdxnbie2*hDZM`NBmlnRzjF;TC3di!O*;Nhq^)4v!$Im-YQEGT17mDQQXQjhOkU zcYnNRmh>d~wEL)mj~9M&4IraVA0R|s)Z}oDJ1e^M4s+zj9J?ReyLL4z1$OD}ZEthy zNDD(hUCV-;h2pVpXSLJ@A(5O_pYX;!#g0U{G52QIwaFh;L?}@Y!9f`_T=u(@-nF#D z4s|a@o6}FRCSVQPHnast&)P}EYcyxwuPs;>y)_~RVDt!46TBf~pjEP|708n%8FO8Dj>^_ELf2bxp=1E_<72RY z93?E{)jByUy|A@{?lpCY6pMB97{WsZu_NDc8Gc`+^FSZfL7P$G1 zjrph2*f1A!S0x?0mBTSdEj_b!>g*s?%3dgI_M3#BjG9S7llqy$=2Vq8*N~_wCR)>y z1$tdY6pQvHe$oqRd!`mXs|;o`V`k0noZ^YzEio?-&%5A;Z;5hQzS+a()#MOud8a_< zhU4yZHopfnl@Uh{yZe*DKKHFX-SX*~M_jUf!r{_Ez3#Evt!m^u+fHt_g~zIEa8fey z4|T=MPSWR|c%*|&9aO%p2Hvgi>i5{t6mw6U?W7$Pkux2)2M`=~Sf5xdxvuAvY;b z!eKq;_f=&5K8VPXkQAE))U9L-2NrIK`6|o}ktZJOn8yFG`II)tNxwBb{H)y7LaF%9 zBncE&ul(GAZya=4imS_scA(?@YK8N(xZ|*H4sIYNzhsjG*4N~Fe28xzN+0Xa!P?5p zOhS42X~^hzvYQAeyw`g6p<=u*BA+w%5hxotx>lShxd3Wc;|n;W-BIKm6jSyJ4n^nL zJzdkaHb3^gJeJ;rYLG1>C<*BbIw3nDtsp4zaU-&V$zj8;gX)4(1%9%+C7Io|*0~}D zr(X7@*o;*d#0oATS-ZV!_^;e#8^p~cWU2*RE)=G*-gHmNs_PnMzB*$AuVT3q%rb5o zm*Z-v$LtnGnf1LabUigkg-%K8(ax$4LFGO_+G=h4TTlagD$36H@vl=GP!h_5_%yo# zZi2;K7GHIejLwYEHJ#jH09??e=B*%pR+8OIQ}kgi%j$-xK#xEJe%Vv8Hx+XenA{EC zXi)UgYVACx`&z{uy5^FI(=6b&)M+qw(<;GgqwQS_MgX4JJ>j3&Tuu2z+R;~Y=Tfb3c`l6}FYaa68M6k%l3WkPf2GS4n}g*h}E zPs~JhwkUV^_ZAT>^5!Ua?B-qB>t7RvRpL-L*LCiJev*RDbZzsFI%AT9Ur7C$e9Q^f zIz*?<>q)}`n^BqLP3FFvDhZ=0%rB{)ex@*=AM`-E9dQ1Iy<(Z%t`cpqs$j_3NX_Y> zDQRIei+1WDlfe0Ka!XgDp-a>FwlKU>GdA>kfvl%-rI}{MUXnWAAH}l+Y*zf5G-Hvq zGK||=nz8Y(?Ny|Kk|QC^ti2bKKS9a95!#kHT1UeeEC<_%_=XL}TXyhX2jp{5QrNt} z;8*2$$Lj*(dgUTl>5TTIx22tVHi^GAviVqikn1pAUU{+WITN?qjJmq)!(qSOh&AQ^ z>Uaxvnm^|6sS-J6t5Tki+MCi73vu*|s&MGO{5h*Ng>Q$q->43#SCpXekjWuRBMP={ z3Nc#7#ouJeV;koXOP52(`b<)37gHA0`^pi74HPkEwRipeL3bjB-T21T{%xa=sIVI& zuF!KZ4vOnklM!3yxy&H;ig92@^}X83lD49C8%W(hi==U!<8cOV`pMBQIgvOM0`tz&*y3ni^PFOR-xvErDEPYCGpmcPVfn6u640bwR)fcK zz?s)~Sb?O0YWdeVXl{_gO-s5PHbNpN<}#2;BQvV#t0%(c#D~#y?X)G8NcP9An`R3c0iO*jhnr2bmFw2aY>ufMpREaibU$CmG8g7D_%H~@3 zoC;I}aMaCNktS4@4qqYXbn+O+RDVjsIX07GrjlUb*q{142cvdnJ{hsMwl$hNnJ`;* zF+nU#I^IZQsNzFr30pkNGR*ld_bisGaL}sk8T8%xi8B~iZhWSzQIaW)VQsUc8hX8w zbFu|3;;mpWIFZr8VaFj}QBImAlV3jPX6zHwo-7rk!6bdk z>VnF2p;`GAU=@pLPQk~R@$`tYk{&PEd1+DCSq2;x4%yd3kh`Fn=^sJX9%0$BYSw402of+%E zB(p>~fpo13upZY@d0jLaZJp~`w33)g%mON#a*>@!Y!1>AFySP{y8*DSnzR&u$s>@n zG@6+?gVy-2uaaDWr>u%!<^$+hKLR#$53hxw^H*F>SI;EeI#dLaPoTuFV1*NAdj~Uq zvO2dko`QrHce-Z>D5vc&`|ZwU+4^*IGD3o_aA6dqj&9s{mg+A&3qVDjE1Bhl2OMgt zX2aPWw|E+g!k1k!YHia;Yr|bJrId4*9d^i}ox!z#NZtkHo`-%$Rzoz=M(HiNe2!;T zf!B~(f8>m|vaJj&U@E;S9T)Pj37JJl)<~E<=LUKl_^NIp$coL`CU0nzwQ8TZYRe^6 zuIQumI?fvm3qFs+l7}2iCUJB9^xFY$%+mcZ$!fcA&EvOfo|gQOMJMspb>1MU?E;GNggs`PkUzI@e`*(_RR%qkfT!A@t6%DF1?c=2{# zgQ!oMroVX0crYqd1vM=6?O6k1m^J3cY^z<66eU`;>NKFug)`RQ%(!@yN7DM9$)kg zoD8>|mFo#j?PA$Na;zt8F_M@S!;d3yom2I6NnH=TYw&rHJd?*XP=#L6p#}{xAz(TU zJXBQ~cEBlv*Ya|ANjL;}mU|>`UMa+?5*Sv^jEcn3*kkl0sSAO=>Zq7FI3Z2E=Ocerq%g&+m@ZBy`T*Mo} zhh8#tHL^M8(HJA;9g#X)VB^ac@cX@V3C@M9mQ5%z-e;QFiv|`bHYYr;tBx0JQ01_a zNLyqtSB7CXF2T&Huy;>E;l!e7kwle%#Wg}0TxY9O7R;;lN(FjcY>#s6*tn!A9EdCp zJu^^m-l{Ib_RR+z@&BDC# zV-n7=s&x|(X;1xnKv(P6DKxGs8x;lR*FawFd>o7gb5LQYJ!5V0_>RJ!9h6Bfa3&(B zhkRZJ7#5;KtV1D^C>=s4wqHZ5_b6pD(L|SZ`o+4oXeL##U&aU&oZqIdDhC&By;{pQ z)o|5dYhnYKO81VbLy?}jH0(vpLZifjEBh6<^!5&6w%nl8QE`c2%ybbN3r2wiiuD2O z%5;&EYJ+iF6Te&0p+Pzf)w9>@-!$9Xbz%|_29IYRe*NXM=UZFRy zjk{cvI_24T$yKkOt5OS?vcdkf_NMz(tjjT&G#>^h=lA{j4f&kwF@UswYs0tKm~7?K zKUS(bR4qem)(C+Sq~0}v#vMdbLJ?bG`kH(XQ-15WjbE8PCWM6coM>DuHA}ywuFhAl z$2Zc;LNA#6X&-fosaa1LMAe8-vg|LQ!;9-#)p^T_5*JiyJ*rni5-7zqqKqmxlf!E^ znlz2qw@(%ivi1oNGdXSxdgG<)S;3}-gO)Y!vt%_a;h{W_B~t3`ifrvVmWiFj8~4%E5E>%2steU*FPkP3?w#v>-0VjCSZU8rv>ApWb{vgDmE} zd-u|yFHP&R-izb#+zzf7L3%r1r^L2GOcA$GA%`&xIiVld9+VSB*$g|UvI9ltw&EjJ z9+VmLsZwhAtWgNhc6Ic=j-DjqqRvz0p$-NQRMLmY@xY%@ufc zkeezu`iB453b_Wf(C>8*L^u8dhcYrxpx3rbq1W6!lcSI#wj6yC`lE#Og?XQ6n2rwd zl0=&j3XPeNW6KIZ-8n2S*{ky@2h=AK=mM}bJv*bxDBG03DG)7WiQZI2t?`O%wYrjA zVz~r6^|2@|m|gl+cTExtsm{dE7tzNc0*hv_$RuTLzT<^T&Y0i z4f0uxPZ9yKG3I@4gT*8^MlPh<$ucICXFirH*@2!H-8AFaj&Q}rR<@b(f?WkWvXFB* zd{#J@6Ai8<#$;S4JOZeaXb;DvplKhIf^Kn4%A-awE}M54MRIM?fvZ218Wa^y{>tOF zHrNulL)XGfGd9WDfyc=ZqHd=r>s2mAygVHWl-b6FXiB$un{}7~Eb8u7jx4c+azynS z`%obH0vZ0=hv?nAr+LQt^xMke=@tH<@0cT0%6D3YR{Y$tIC*{}7MLAcHVe}5m|(<>DyRpq?o^i1XL z&@)U=$_${WS*#Mbi1vk!{QV5;TNQIuNo}`1qXt)fPXlXPdY01jp_2?*>h=z;f3Fpm10rq^V_i ztXPoWX5|SgsmiH?(QfS|+gm!PZ|m6^na70+8J3LVq4c~ybWO*zq&p~hlWrME0Q=-Z z$mojwl&4psMfN$T&qGz&0YgTriii{YR|`D*&iFa4QUo2QiZ~S~5`gVnmibaICqrI# zn4v=KTgNx0{p5&Pevv^{2K7)0p(n$8x{%N+^hIb|ydt71(BLownc|8D@ID~Mf zEOJ+8gKQG1*FidG5HB*@T}WRKV=EmVs;z)pPy@BE#~Kcfn1?VjonEOXXKwR}(6I8P zA5m~cHQr;sil~mNuQ zKwfX3OeNJCeI~WoqJ1U>^Fn_ng`L8kIXsi{6+?L@rM-1yLSk!-1WFL^o%l|o0_4S% zlvAWb#aviTX^&Sih?GN1)VH0!Yn;uIg`D952ZLiu zUIu!6Vr;`5S$sm`*jhY?blm=atX0vV584kWekzS9lfI*XA4Q|U&6333w0CzbY8@eCxq`u)L}Bgy+IO0{_%E5 z;5L9%5$wLE`N~NMW6aSIlQy<%alLkVB$FZ(>YrN;tvPHwdcBzIp-C(s&ljOWS5Z!o z*IDO@vzyv=f@&*8=LDI(52n|gh!n!WI=89kw4ON4a8GV5ohlnm4=}slOVe;U$#dB> z@XYj}*p-ERr@qop_ou`;H$SS_1Gf?{qX*lpzfaDOptY=?Xd7Q&AOEUNJ7q!=d`372~99+eB z*$pc8!oP!21v$5gG;>kNy-w~|=_cDnR7dk&ItfAQOlPISw>v$bZcM>5sAet}t(_R{ z+J{Wte&M9>$<`>moPL}Bu61t=c66PqUVVK^oj&Dun(-x$o2SrMS)wnc=!&eZkz4?2 zr3&&y3Bhs_vSU4S8pL}9rw&fEMQxs(s-!bE8JPSJcvpa@6Cxo05o;^~@(N9Wyx4LX z=nv;np3~8<3sUC-hz$B}t^~fXAf~e~e;tCZc~Zbo&sy4J5n@2x=yU2HJZxE?w@%_QJB>zPGzTyff0e;| zwyY2(M8nfk1_f2)qDFGRZPv8V^mTZkNmwSL z6<4ovO4&0(GYu+dnyzw0Usmh_kt+dQ)JU(9&|yCC0=eafN-|_NPetI6mKGo^3>2n8 zvk+1c$I#GqgF-cA8&pgcIyU8!9VibhW}-?-9}W+(mTI+y8Ims7VnCt#$pNNw1yGu4 zx4nOGRqflaz|wlw$Z}t|Np0)Oe=@j76t| zKzZENIAadOWpbE2bl1-38A1w@BLzJ}a#959o=29!g0a*qT~#jVeqESA_NJlsiYIA6 zsmkmMWB?p5?2CnIWG36yvvQCdj^IiOP&*6t)18Q`qi1WIXUch@C=Rpz-mh+3qSu7=kZr#2IMRcd)pJo= zXZUcUFZe@5`VcG*rVN0;EuP1aW_Zi`7WmiWQB*yjKD(lJW{-UJ)o;H~wUj^GO-|}a zv_P@i4B?el;&aR`Cx22_k8nAFJE9Zr9tiDdt=c_TDYmCRGR2%L^lax5Wzv?ho`h5x z(YWdB<}7T2$DyLm89B>N0sT0UuS`Z6HS76oJ9q_8U8}A=Xs*1zI-q{T@TM^IN=# z#j!&CZjS9feA=;OsPfMMEo+6iM&=ptROu?+77k<65LrF*I2)LHu0iqHt5l9T3P@Gd z$L%tywViS{q0_mYB<(vcwnO70yCKP)by6K3tI9g7%c+{C{xPYhD|!B$BlIUzP*@|u zO<0NkJ}Go2+sqet$2W|N1v^MzykhKniAnUp1={rG zu_y&KXOME#GArn7NeTX~0)@1MY$bS&^SBU?Gnojs+&X8i#imA}YHe5ziC13QSV4B% zr$riz1xKGzsm*c)C8vr)(JluS!7ilNA`8jEb!VDr8v#_pNTo3L~!>aC7l}y1XG7a%sTb1Djsif~j`fb6u zHEtDR59d7|L!38&&-WO!PJcSVGqJge8;6t&>z8Kv(MKG-(Y@(`7+9m-MU%!IXWd3b9sWlEheI4@6F4-|R$Oc5ejSG8OPPF7W!a%~S? zS5NKS)qPD-6@1s1PAyfFp=!#$nO0bS`I5^dX8P2M(8ZDwm_SSu6CSI@jeLZkm;JX2 zWTsr%GK|1&aklkRCo+$Zgz|2S#nhIrP35GDL801BLbc#tIh?*OVpU5pCIu_Tq?iPe zKUMGcSB_2XgEC=ki}lyG=gKT1E@3K#O6Q3BMjJN+LKDCwc;P1kz&XD$LUZTUUBzv1?KFOGm>uuSJYTF8DfOaQMCgos$idWd7 zXLYtuG&YI4U8r?SK@61a(RTOrl&VdyO{#^g>lPAzOi+3bY@7D+Chhy9Py%^WmyK@i zO|)!Tt5#?_uE#sLu&Woxr;`l0Ikq=HrfONUSLCWL+QeD?j&%!WAATcL16c?TBQNS= zl^4xaFkjjri|&4~-->H2?SB7y6$YcQ0$1n~)U-RNW+~Zy(*4S{Aye3mS+hky(RCiX zk?owwx@{>=rVZX6dVd3k;d*2}wn9GES|{yNvMV-;k%>M`S(|su_DMF*wW}6hS-OFB zI_j=&8^rA$m{Phn<4;a;qo)QFzn54O^UC@BR+rXO1*|M#W?1O)_BS=ft|tvCMelVe z_#IUP(M6SetRU_3SwC#d2%*NF^F&7rNX*<`(3i#rQOs}(0&N7LmFniV*6%8&ytz3GuxYUSSQUTZxgtB&wPe37>^IeYz1T8668x|Y3#PTpgJ{-g z5313SBlf}6X7qet&zDgonU7tfRL}gYrYdHLjNLaylYHW}8Gpx3jY+q+4&*=x5(DP# zLpoYjHEF}vu7$HvUOmVWYrtOU%Ckhz750wv5MWnN2`Jx1o~TaYq!5NN?haHXP%_u z3GdCOG8E#|qE7Kf@dRXGN5YwcfRiI-t_=1i53ucZM~z!&#wsGKNDMv~Gfou@I4-?A z8P}?6ilM3klSNL>ToKEBLUd4%?+~v}8H~7UQA@4P8C1Ax+LwwW*VjsfRjQ_I@G+BV zfN~^8n7WqKc*}ikqDuM{Hu6t_ESFsaZRTo%JXhX81lDzxA(yg_^3f_h%+jq@WwWnU zHHK)A3j59-b;ctjmfLC!3r&!!PYS)GsfsC0WZGy(b<6;L@U@9a+KxRjTGi>U-^1sP4;W`i zg`E&{44#p~QjGTwt61x*6vAdVs8E2c152}R0L*_T?^JTWrvK(8`*KDUtwznV&INc{ zG@A&VU!6?*@QF5=t)00A3{6cr8)|eDC>I6)@>Ii(*JQvB_;>z%WG*O+SH3iD{vb@% zu2&@-30DlZH^Ca@Rn08-WQOmNvgps_;SfW-#G^%;D=53I{NWxsjBYcjUYX{X)4vI7mtipn!kLJqqJu)3<0bVS4dX2p=0yNAcVod zgcVL1HgbK*EtFH!={y`aErR%bF=UEOBvMRU1T(4bHt+w=&%9 zx?Fpu0Vjn_>nJ~iiJk->9%eSxuh?D?j@q=o2OV&r60h(jz2_EB*BXh`lB}ma_@ed* z(U)3~Nmxk(F>iz_7jO9KIWc9{)36ND*Po#`@fXVi6?8nqt<)2w^O%yXvSn@$;|W)6DI`u26Xz)>7)^p?Nr$2S=5F+``? zt|WavDyWvCR~h(n-K`>WJz13Zy1{IUG-h8$vxC+)^p?GIEOHh0D#Dy3D)O0e1;CM= z#%OEg7&-SQ5tQlLc4ANUvYRiW*}z5)1hXZS4vegQ8+c`=&wY^uN>VScCchT3fJC!5 z@T*!yvl4bSWhN<4kzx-iI=9obawh~E&b1Y)y1-;{?FhRXh-n4tP*)UOJLRbrkDRsgje){KWMo>-sNDinc3EyB^?20 zEuy%v`kQGrensz{t!5b|xl+$?+1{H)>!6z4VN|7hkM$u6e{4Bvz_eUbc|nN1pn6yF zdy-7iTNInQd&({v)<;RPdPmP{YMbwtj!a-48X29YY$>?zkCH9*msK8X6U49!Tp988 z-GO=Y)}*4J&FOnV87QSL-i<5l4N-lqov&7h+l^i!_fqhq1&)?IH(O2G5%+OryQS~F zRqR_z*c3>wTrwCLQ1GNqx8>~d%PM9psEXo}ol4Xw8fVnXQzTK3eL&>y9Pu$jf0jC$ z3sZFJw3e02I?!@f5;j?17_qBE##BTEb(@aYpXzm7x1EB9nm<1r zRwU>hfkt9rNt$Gd$D_?j8Blr1IC82Z6&h;23!N@-%EPy4mGdyEK{& z^b(om?C(-AXG30E`6H5Q^d@d6Qa0*#(dzd;YvxnHQCA(9M!RsBox$MjqeK6SP^Ick zAyJ+9O8sS2nd zfhuYc)O5#bB%!b(wcddk^6_;CBRtM{=_4{$RYbOcSGnCldMxLJl2cdhu+7k7I#7$R z7h<>&ntXT(L*T#GtgojUfMho(+E9tLnb9sEDc~d6^_bfRWYYC2i#rHDeNy*qDvbYJ zt&woG&gF!GHjzKx6+3h78*H0hkF!GEv~sA~p<%FSo)oTy>1^5-v4$^>oz`V4<*SG9 zcCt%aX~j4X<2r)H8MC=i;(!> z+5uTfBcs_$nA8)OJeEbPF!K6p z$$%_CRg`sw!MfsED2CTrKmOG&E_|BFm#XAVg%hDsMkSE8+@5kY)R>~$n91)4VtCkC z!7Kglb>*#BHU-O7O~I>*9A$BQ61_SCCOb{l9q!^vR5wZ~M`|VXk*E$VB++dB(bGT) zAcKfouhR*D?PfzWV7g)kUB|OY7G^H+?1*U;7BF04q>%HGL6a5R(3DtqT~rw_vaH9a zs@94N*@n3~mNJu~^T$fSRJpBTqoSp-`ZP((Vkkg1;__R zHk#Bsxz968RkqrA?w*mAhZOPE2xIjCZaV28NrWRM5)x+BlDlULvh_R1j%+t&ZDQhx zGHgi2FSr52A#t{i0+p3L9TSU}AT@@;zgnZJkFKp%akr7i;VRqDJQnLT@)AEEh8h?r zWIar74!!~!AW@LG)O^oBM#T4kb|!2h|H0k z3v+N>>Tt%u(E-g!3T9WCN&mDQEEq5^0h`lBcs8aRJQPA`@I(#jlin>rlCu@?6%hzo z>R&zBNlz5+7~1UcxCuH3d*Dn(7*Ckg2SA&UE8WQ`L1NYE&RO_?SVK&a{AjI(2wT+= zR-F-4Wf4@b&JV{|yF-v78W7dx0h%?Ot7s5&H}dUiMZDdo8~Z!DTZ zsz;?im_K@~xl5y7glt{zFcX!T!KZ_hcr0m3xd1cpOO^ik(e@w@-N$KG2Rd9IYBe^U z&a0L1cGTzLtlD)b)i7j%)X<0#Tk?F#M=30`$gYYh<0i`p`D&$8Snx|_zg_xzieOqP zxz(kyKHzO7BNzoIhC;PPQI9A^C*wEymZA4FMU;a2!GO2etK)-#ZrtSq$-0772OdF> zd81JIG^d9VUFg0(3c2Wef_Kba>6W4A*{BaS>{+QN_9o9pm;9ERGmU4XK2483Tl8#H zCX#s8DpSvx$h+UiIVokRGDF(ks|y+JvQiM-rqxjeA!Ls;W;F zRgh=YU|ItIf46!soA$eq+C8B51dFQr9?!Fc-SZ8pD5A3cp#po|2`?5}C>`D@vNIVU zxEq?p3vAp^apdx(V<$UA@sphMlCdtZoR~OJVb8YT*T+I_RbA{(uFqeU)`Cf0`l0Ua zc|c9UR`qo_Q~Ec}(^Knl7OK3av6eg~&M$^&=x}+Op)LlzNJbjxsu) zJ9!>|1(|teOK43_(BB#(s`umcJ&2G-x#Ow3uGAek;(WKANsasMt`!Zw!J^TFN{u%r3@UPqo*r@6K7ptc6Vs z=0}YtcWD2#{K>WsdVLnFJ(Iz2x|*u{r&Mwb9o$nL))C(J(90nV-~yDe$?IatLMe{L z=?b4JqrIhm4zBYcN1-n>ZrFQ!3fX%kpu)U|1>iwuOI;c5p^8!-K>TI1`a45m!Mo496u<0G0wEd}4$$KQwK80$#mqy+Uo-MQkNorOti+q1|4?g$9RNT8H zPnDkUO~yF3Rc(trYsF{MQ~5P*!ToiJRHO#dX#G9k#cKzn>-J?kVA_N6;4?Qy}zQmq?ebv929sOXXw6*z%R8XK=kO6z35^Ukg|ZmN%AFZ3Rk)VoO0#9&dN|j7&Gk` zhT5h#``Ln#4A?Tfu@hNdjKi<(qnq=Sv2EXM#{*znHGvZ&_H?JkNtnnBJs+dz@3`gQ zm1j3I!$M<#$=BJpD{h@wS&EP3j&_oDt!}(HKG~$L+L$S?&5l0a7sILz$n87Km+WqX zUJNKnpoBHOtjOt79al*&NL}=4kbJAnUrN-Pk^<3z53x&xBkW^Ti2Y{`U(vj#6+xd$ zbJ!6s;nR&qoQaPrQxT&VF%JufgIFNy7mil@qn&u2O3yG^G6uC9yzjq_CmT+Sy$~D9 z9S=&>^c2@UY5;88JiZ}+jG@{7$09%Hik?fOvL&krsl359N|`5WVO23TsqDI=qLdVN zwM`7)H3r|nZxyTEcO6#RP&jwh<{^mD-5cX`>1Js4fp)oK04hxlG_ZE~AQc(azBbt2 zw+EMw$`Dm)OW%U0LPp*%>0_Lc_>wkp#B`cDPoy{O`Y}(=Vb?ql`seg0c&zLIO%KrO z3cB&Iqof+Vlu|wCUV|7%$27O4iI$ZN?-&1Miz4PMSa<} zlVrjO0o)+@+PcS?L3f2>Wnd@7uo6qp$jzSrf#hC|nKMFB0n>8XIVXh(R1(LoekJnxR|4g~On9XGPXc zEPz&K{y;!aO zBNJ3-7Jyc$@V}~Zrkmn3GeG5J+qGw0!C$CzmXU#JS0V@gkoM8(^i;&reKWsA;Y&3I zoh3HUi?X&_Z)&RQVI0DeNWxDqCQ=jy1(e~TXsdk*&ksMbK1v)FR>b&YLtq$(;v#A= zDL-zv_dDllP!;0 zmI9B+^l?_+9fU2XsXsQs%IW)LMkr1}X&!@~(kV{7URRrb3iqy`KcEv|+oOc6wm(8gI5nV}O>XUe_(sexB&h3C+}&DXxihRhpHkS&o%Uxuiv! zXGkD{Q%W4x!%Kd&V-K(ddUU`QNtRg(E8k`ixY8!_L~u%rF*`GcBq9^Lm4p^)N#n?6 zB!_bZqrx?IpL)EYTAogs84|C(nNM_{@R?Mckh}79iymCMuIm@fhk_cB~F#p@lU)6dQ9;na;Ofe0R1gpud`v*3m=mdR<|iSN?UZt22$y? z2FN#C9k4zg55*L8(j>N9T*Fa)~b%q}M!-fJTkFU{zj!n7oq@`KY zgB$$F3Cr2pfr)CF<6M_g*Ev|!>!bE@lRDhh&x%#K@zKgzEs2BG%a~At#)D5#*!QXS zod&Es>9@T(&ys%hk@=e}HQrS(P0Le;<^qw))NjdR9$_&EZSu1Aqsa&V2Ef%gdt6Ke7_TJ?IVKk5q=ooCag<+hQs&jjq81WVi6RZwk`oc&m(aHf|DvT__sM93n`wZ?ogt1uFbt_W%q2l=YL`&So?}gPz&PE0*CliNxQK zE9@b{lV5y+oerEouELk@UiP?TyD(5*J1%(!nUG;x^U?v-&xGwsSx-z#bR!3kOeUqd z2}kR-8`8QPsku+;g3)-6ta4d_$jQ9CB>(=0kY*w(B! z;CZusJhF8DPo>scEu~VHLfc)xhRJd5VD~E9K1LtVO}&3s zxrYHs;)v_#m{~A-$e=Bi2_luX{Kzz_!4wL2Bhz$PFOiZ0iku1Y_C7P?VY4(@IeE~F z*LWRjC`D7}ysII5RRxp80@4%O*$f!qbadc;>z0Si)xl^|PO2k?>ezXu%BFJ$x?OV# z3UqKoEuBS#=V?kvrkWJLh^>VSEIl5OE>oH@)-cT2SzA&y5{g?BJ71vb(0bx@f`!Q) z)-5}%;4yUQ40L+{hUkHFD828(BWZ`_wVlIZIWnfLa~;qJdwVs&5Yy-^xDyHP2Hn+@phZ6C7tC&X-XMa+t+qQ(*e6f+>inIOU zOA$mRjToJ`gNvQ+p`>qt)F=?Tf$;fAlYO?*RafYXBX-kwnU#uu3vL7OJtsz?XV5w2 zvTsbnTj&puM8_36IcsWlwnnzL!{*Qrg^K+UUr+GA)mL~|RYrd*kQ=SwQaVnrz)=nR zL49?lh>I5U^w%HHny*zcH%%MPz2;_TMG5HuM<2ilZe}M!3us3D+GEXl4C=JUK7HY7 z@KTgR0poPf%GshYBPgdsR;d*+r+REAoHc2=#UY@_(_(1=Rk0Jl9T#e;fpQ&X#*fIt z0U{3F9kP13e;}7+U$BundnmT#na!ui3Z*t4Lgn?v)wN0Mdqdu;IN=TYv9e#ptK7$^nBF)aFSwmK1 zF4}_2*v-FwEYq5zu zB9Q!m);pQRj<^#k9B^=XS0W4RA21``nEGTZp!=ju(L-HSSt0A{s_x`wDW@}lm}lFj zn1D}}&zDxrXs3w=v&7P@14nBmJ_PoejLbL(Wne@K

UKpKlx)#5|pC(3K?StrTrIx39&Zka2+NIki?%W#z^>%BB_Zx`pDIPJqoqzWzR zNjh*oJBgZ@C2kcst?+pmpKyWAP;=z`o3UwTlAWm>oo3GI_VpQf?On1gjM1=kerWwM zUghKpIcjk@T_=fDQ%uYUy}58^I%sv)wK8A2>?s-s7l#^RjyXX)O5;=hrh=z>n-Jw` zsC>%O04Rrzk&kg(f+>!u2Du`Zq6;yXzV^`~$Cm3JW~s9w%scDAxMI9l*tdWmJc}J? zo_6F?_W4ZQ$!=6#;8pw3uj*`j#WYJq>)fV=V3)72u6=4uK<-NKm7tre3Z8H5N~Ceb z?nq2_mXrh9pBQgAn#lB)m(Hn?_eYL7B{oJED5&?bAvn#Zgf?h9hANkl8v{?OOOe_A zlW^;NsN{E zVqO*5nEz0$k6LinyiQ{!49DJ^^}!zJ+^D>knD$V}soJb)-lK^uW(|KFMYHLOO;OFw zN(H2LI+o{0Iw2Vu zWyS41ULRT4kess#zQ{4PZO*v>rq@(=QAAC9pnhM)xeDnZm-~~eJcq#!g<5n;%|p7Q z29bKipIl{~KgB&iS@Y%90fEV|RHLZO`h;_JrJ?oAu4UOE_?QG^(<&$;~@O9_OKl(IN3jVKG;Ue7~lO*i-NFMpsUr=c~S0 z{pJ%hRoC&REj@SBa$?EQ?A&H5Eo4pYWpLpw_r|3(jMHK6DdwKo?Qp3L4S9G-=W8)u zs&|{151LzR2zEa>l@&AgYyLcVF{dq!V^sN+Xio_#5J+?E+XJ{zK;%^#%~l8mn~;3E zH|!^&w5ELQ?~Y44ds5`C@f->EihXF8drI5}O)Wh`bl;`EBPO8IMrX}?HhKQuLz*@X zH~ARYQniOAg#6Y-&Lx4^sa!;{EH`r*g_|{2<4^7!X<|xC(Z`~jX_TTeH{vSqqp(6J zFOdS&QN^mR1pV2(@}VleT1kI5#vokZ8`0N8<~F)mAg$Uc=2BS^J{79riiannuLVAMm+^2v_LFNIUEu;BVW{oRnsadDj8{5?viqRUv3kE`0&Y zx%?O=JVZATlj9K#(xC`-q=uY7ghxzC6Tb1 zSXmVTW9|W9o10X%F!ZQ@UP6cAik^8?COuiF?Otnyt8bA8z&>i}QmlIZ$v@4C#==u^ z>D!{J6CPm~z3?s``l?LI# z9fL^odGrwj!I}-k*K#e+H#8b?5a*Rh`YXp-*oZ+um2TL;i$q!R-CWC&Mup&!L^2q> z+)7nn(KWDd#&kniGaM+~vbab=SU^nQgnTWCDsgSF-?vZ8LZ!OFX-JJk#Vu$CF1WNr zAG$QhKrrlNIF0Z5oUYx-5IHah(D%+Eh4zvNW3q7gizBLuA@SjpvdVmC{w`hMJAJ2D z_!A%Xv$r#zAt!z2&F$1AU0r}Ze%Fy!E89K;_l#fKL65qp3x>L1lz07i6Y4V^bnAu4 zN_T^*WLKl^R#i=VpTWpl|j&*?w9S zdmHrEim)4%B|i;Ra20mppIVwq45<+}{-zR7Oz?pkcR_fDR6JG3aij@vuVE1$RoNna zuy>iJWUxkyOKc)toYCv#EdTsST6sEN83|%Ra!#Eeo}e8mCb2m0rJdu34kOiLSQ_R- zcU_>>J}_MyMKI_oAndfKRmJK5m%X=p@$|a#{k9N;&=?_v5W*NEdBmXc@u;kBN!Hkw z?Nq->mFZTuRNa<6#?<_(>Q|*2)tl>ArS2Xxq%|Rg5QcEbMJ_@vLN3A(&eb6ohY;pE zs`k zA$d1iE=(9_@v7lG(xjvmE~-IKT^(^-p@7(aClUT2}@o2_$YkG=HJ3t z9hZJ+o==yhj^SHjNd)7LZ=d7)Wiw%p!yHr%u@2zDK z$+%EBGA@+9H7?YpIpacUMx(;3ZhQ5;UzPqdt|?YOE)=$p3pMz%5`(=3Ozx_P;=K3o zyp6Amqrz?9wU(~UB(@e%hArRF;+hm`bi*PvL$V4EO&QYchZQuAVG%kfmewksHe3?4 zje$QbVzdiBV2+Uqa zrX#6p?4X5CD?Bgl)Vc3o`LDTh*PLEcslH@PpKSJVn*{?Kb1qSJ7IQ(f8L=R{l^o1o7vXu)vF2092C!iuKy z?b;bv^8MOD1t0i@-g&0=L9|{U1f=>PNmU<27xh8Yt`8D@^+5zPa_e4lN^YjLuxL?p z6KkK~r;K==C_*Bn)Nz=mIeMHt?ESsjwg>TwGsP0AJPepOd0Iuf@}uYlyWDiRymDfc z`s@!6_YgvJ)?_|+bqCMAT-s-wTl+czO0joZ*B&OG!cmd8i`lb#=3-F!wiN&7mX1S} zKdXJXd%`Iyx;rh3^XcDF32$=#oez()`Izg~PHEIc@{4f4de0m zP+q=xF`T`FzUAywRErjbsGdWnnaxGc8R4>%9ku5H*4%sjIRBEI!O3`#$fJ88UWVnerK(pM5<0a!=`pInl(nyO@s)CAvP*fLQVTL>?i= zU0j9caJ08vd2-`uOHN1uSy7t4ioVhQqMf}*cXvPocay2GJZOiky|=NN&K{zO)}!Gl z^RbsMbb5&4Qcarx7@0WC4_eT7Lv6Y*!d7akf93_CQSzS_0`{MdKstz$TmGT& zg=OJ}2IRaSNQ_3A0LB^}YUMTwz$+dKqf}SIw)|j{u|A3_@{9T_gl9hF(7AQytwr2) zrTGwQxh4ukN)*{srNv+}to3W)EfV;V2Y%Lkj!jCY!O-o6i2|YmVtSg@+HFId8IQM> zwy`Tk+y7n>zMSTdGMg5>jyC_s8LD=+YcN}?yx7s1y0^Fa*SqlAcLgoG##J>=b*azk z{?V2i_bRt%o62{;z3pYUx3@Od-qlMa(wDj%GuOV7Yh2O(_8pz=INw;8w`TL`k#5;m zp2&$F*>%-4Hd7G`$S}Rf_1wlfY*`b|Q;~~=0{uT12;83i&e97_P$Azd#yCsSk;oifAxcBmpN+(Er9d+fFLQUxDAd&t;NIz> z{snXRb?rntAh?3TXqP3Fc_}tEUnm!&Qw6;!x9$&R{ysA=l*)MbQ+t!^#{HU9iZ4FV zb^=`%Ki@8V%A&_(2UTi8}TTC7(vggZSz}eD%P6LViV5B?pZ=Z-~q{%1Ls7dXkEI<$HQ` z#`hUgvA%MMJ4PEkZ*RjbeOR*QY~97&b)o9~bLq!A|OtSez57`JJtKN954P9TU zM_RLNE*Bt-UW6~-jQ+t*{|}0?yQ9V?1!(01j~C-@}v0ie*6IF3@87wQQ0VF8mABD)Xv`$!=Ig; zDF49;wi>K%cpD_wl@@EOo`1;G<0bFL55;b+M5~^E{Dmaqfw*rLjI>jOW+tN1_iWKx zg>GHD(lSvFakr>jyCMpm1fB0jI)qCA##p*+O@zh{0(pjhz1QfubO)yY}Fa15C(v%WwZ`esbg) zpoP}0dBupd0n85tQ&4w1SJx4PmUiQhap!@eU)+4@R}El*_63}ZQ{LLEi8~0&XH)NJ zVX~Z#%^JF`GsH?0wS*7rlSK9G^m8=#j6#NDdna}uiA(dmP+>0b3YAbTybVlo4^!p! zaEsJfe$KmG=!53x9mx=VRq#M5ySBt_IR`JED09Ws9}+;VGr>uLF`8S|{aChB%)azX z#57gu87^z=C+RR&JHKb(SQ2O(3)@MzM)GyGj`J+tyKT)Xa%Tn!W^mU3IKjmqg*ijS zXGUsQ_cSwDXVXl#L)t83C~)Q_p6NLZ z)eb{%N@ayK#N*@4L9RaERiH&8L^FAh?_gu{A z_l>mQkn=C}2f*=;SpqTSjg_|DZ89?(K!n(z`4ahA8 zI{>OrqtZfBXkX^r^z5RR0nOmM3=p;EE~7~qHTdl*=RyQ6jHo1fS|ssDH79?YM+NNB z(8GR}?E!M9h(&OMsO?;k=cdfez$srJ{vH{3yHZk4J{E6C$NOg|vwi!SwHe3QleygC znaj?~#glbNd%e#;*2SrrIo;i{hCb6lmV%l#1Y6iBeaQwAU);b*odfDwF67o|Y~3QI znWVe5BpuE!SXv}01M=330cgom{s<3I|Di~}FNtn=v1&v|Q+|b%jVLBTI}4`{O<2FU zz9y#Lby85M`&7%sa8iuGe%N{)>MX$Fu*%zRd~p-B4?|GlyG0VQ-+^jNK}pK~bpOarN=F4pnMT@qJwHWm8*$T zN4O+KM59(vN1KlHqrgVQU3UqXSYYWCWpE^Ss>!Q@@TwyKe)`%0C~;q5a-8!+^X6Ci zEatiu{1}h!o=)|0t|~_pUh*y3Mf)-^qgXsdtDS+Q&K8xGWOhWMK}y{~mk>y$CwnmL zGg@^_lyH|362r<<)AH)}u`@wLHlxVet7gc@Qg(cdUSLjuwft0+rx5eU88Mv(D&q6p zkVI)5<1ij<%s^4AzBt;KVrpM-6cWp#d6}pLEq&9y!vLXexTJ`NR&`qn^ZZ0wg8#Ux z+HqbD>X&^3yM-Ncybr88ua>p4r_&pSa)Np;bxIW0Xxkwij~fGM^z6W|5~E%^mCf@- z`ZCRvU&W1Dq2U}PZ4vom{y1xydxy$aJXVtY-$)k=b`kHi56<2u&_bHyq0F6C`}Z16 z_%M$4Wvf6BVrTwiS9F$zg`7%S%RFAI_2^(fr|>7qH9yrL=~l?JDF=q`(OQik*8~o? zdlFp8)S}smB?rLywzcumfFiZ|^lVe)x`^}&W@$h@I6F1>@1c(Uu^)Sj&<8bD+qEd< z-`YPD!rBL$?#nt!8YRYDGW*|NQ6g20H-4{{j!!vYhn;c(V78JG(o#6@WB1P;}JX`j{-PyDbzFE@xiTI|tPt&t15N@qzTXfE?r1Cd*EmNdECpS3FDbJnj> z&DeWGH{QjkYiVKIZtZ&Fyh;KGH3KTc0OPr({}GM1On>1G)QX%jF1_Rj0Z7tCBonmJN$+%^ihKcnv73v>@SMsf}%MIZ?>a(xHB` zr^`5HjKYje1=ub;-e$ci=c#FUE^zH5E%2kqx!0M@?JVqNF53++XgIRtkmR-$s$$7X zfe#1q!r`rWT|{8ZN=wS+T81$tdZRsz{;?Gsw~;6o)3DKKSxgvOxv6P*`J-Eddez;G z$$LUpqls8dFE6km0#vw2n`b&M&}Yol_SV86iQJrVtQ=Jfp_(NN zL(E?oe9CCaI6)i>H}f+31OrLrE?Qlz-k*yZKn}rVtdU*sAmD22pUc|!c@3I3#d^p{ zB6#jgByf?yLhND=XiN)!G{0$MMwr<=tgz(Z)rp64g<`Zc)zBORSj?q24@j+@d^ z{Ze|okehqT1AOcg*~5JUrapRXx}UVLVBltUWqkBjVoH_xO$)Qn<*@L&cDYBBc4qD! z_i@a0T$LOHdpgis+(-u+CTH(T%z>31uY*69(((?(@nT;XQt>ronyPf#4cUJ zI1_DiCf%{#Tcp4rr9j8wrNi6InpdmCtIBxS+&M8!j7fO+JhNnCn|_%85Wxw$CY47SzuHN_+tr{wCB<+zC{r{3(8 zzE7SI$dPVG)172_GFksNsFBzp>JU@V{a5oxa?{CUcrzE~ioSesETxLr%0>%jEiR;M zdhxbQdEAr0+`Gjua7`!sB}ZI--ob8`wEg^4Pj<&tZXa|a+0_GsAz_J*wGlsR$SEUs z>TyTz>_Tslny#C$BuRvE@}wvZFZ1?r%a|Zp8d9`D7aP7<2e&6izmj#fiNPDR+-ezf zeti-o!a1?JhT6wR(6SwyB?SwI`p~M}*aEt2p+{Ql@b}1AOgpG0xMKXU-*mjQKa*@; zC>E@gGx?4<<#!#px*!w$>`B@Y)`-8-2==$V_&Oh)td;g;gh~o0$sU8lr#vP}8pT!* z$ulhkF2D#R!iz%Yxnx{Rxyqw@lyx<`D(O&;HwjC_Cf_D1G)D3YDshsqqi4lV*8+rN zQ9*)AX1R`ucq|1~;MY<1O65#P0SiMcLBb*B&1(Y*_;slLt4cOh_JaG4v<`k9VHO_Q z@k3olS0Q~=k?JUoSI4Ql`Ik3iZYR0g_ie9T+PuGdb9EcP5zzC7Khi)XV7BvD0=zST z+@W|Owi06-z(E{>tZP|-LjW{yHl+sOZub1}!mo-MuXZisc@}pKlyOCs*exiRMLz#t z)|6e_1tQ_W+H^?h#NFKf;jZ1pDlsSNbk?t3Q)ZJo)d&`*dAPsUP~Rc5@JLVDh`eJr zNa!GI1@Rb*eZQyELN>)$BMnf?EfVPOYk>*Rx52sya^t=>4;~KSI%NqzO9#kW9%K7# zCUlsSs-~NjEC{|WACfTA=!of`&F8a(pB1U)C(t{CkOFgRhr5U4KD$oHbP$W?U%ALd z)p1FHg4KH36sr-6ltbRD-`AU!hQNju;ZWtwwT?*KB6p$}>4CW9MB?z@hPm38uo!%p zgpxfO#ObPG`->dTz&dIAENyx_geTnSx^616Ub7211|WCU?mQ^dyyD6Jl|f!s)WqmX{+bVaP+Al+Li~Xco?b{+;Hd2Ba zl7hru^ADyORChCr)`xPuE6Fx*MZ^NPfhf{ofe%pDb`$y_C3@vbziUSzdqo*sd!bEL zMa$IzIg~>4l8J%Vy(w!2_1APu(TQ17@-3b0J(8al6-RFIVdeBO6yD{FN} zoFJ)1E_G2g+vmKh<$YGMgC3kM*@EHsC6iCv#M=@HDhLy z>tB(4C%}>;3_fU&&3HLd9WM}Urwkr8;5OswFEe8!h_7=AV zU|-Il3!h>7rKFAB_}<~rVNJ+eF7Kafli4s52bi>$&VQve}hS2zjTQ5JSRZfPZx_C z`xTo2-o6r5KyqnB1XAPI)r=?_HK%swCw(424fgSna~{#%<$mZ6ML*WkNhQzCxNLBd zc(724m*pbLV9QBwfI#9x!NBa^GZ#Is1%qznOE{~ASS;QBSnA`EI0^AC;$9Yvy}s|R zn-XVSts%#2>CmFh*i-B(lL{uTmZRNr@_d@JRfehiwZ^jKet}UQC}|V8jg~djRa({( zQDHY+K9wFN5cq?m5pg|X0o*mN23LK5hs9|4bm+DL8lb<~H>-ptHeH4nrkDC1Qkc!5 ziP|g0UX|H_dk1c;%Lk=S@rhCe% z8bh8kOHfmU^?D^lkY1GYD&h?~S>|cjkwC^%;KLxzD!8}cTF>1`)bgs$2w~es>KzeR zX4@50S%WOp&+}bB^V!)+Jd{?0E7S%{iDC3D^jJ(Rfmn<)^IPYf`9T(fc&n(w5x{gb z2e=p9#xIs%`bJUZ1(EC^UC#{P$Vi5X0^<0L%cn|BV}VMpmbR8fh$-JUU8BlMHO%f_ zu&yF!(QWUZaLY>>q>_Jcv0pH4IH}%0@>rXOFg&fvhG_VTS>Ie7;C-$wYy+8gXDAe@ z#WZ)Uc)f&<{q$AVpeosM>T;V`)&9=;E_}M+f*o&z+>LNVlba)5eSMTQXL&jicmq0$vNWds4qOq(W&W;zKD`Pf(_{<{r+=h@(kNB0&J^a;zvkw>hYq ziAgVP53eZ=RzVf>d8K}6Xns(!1cf7G{y|t#P@L%?7$q5KgNUiio_($KKNDUy4m*u7 z31Js03maK1#mlI{@nE~3@9yV3n2+ZVt*Y*5xhCGC@!Fw)s{}aoj(drY9@=>Am(rY( z7BM9siH$r`VdIr{`$!jQ=g)c3JZnt)#c1?LJ`qum(pPx!%{K@ZJINp)Pbj8+priBz zU3X&X+&l{+uB_EUyWFDgw$JNb-|JpdS`$Jb8qAGwP93{Vo#2GR9m`@CCA-2_qR=V0NRy=Wt1pA0CJg>A_Yd{x^HnE=Hq`8U% z->8+0H(#fXf@@#r;|@Q+ZUYsk%koxC&PWL}{W|Se;{4iQL*rljUKza$@o%8sHEbdOREc_C) zU!-4o7GMg~KvFF`jC9&k$(WQpR6tIWn6r3Lev$T;=C{y(S!v??kHz@2=h?!Ymq9rs z`x??!H=@cR6^DPB!1s*EpRc&=`lhWhq?KRsZ#i8jnzqucR_IX&~wz5>rAo)E zxVJEB7IJW1^_qqV#7=A|DyhFWGtc%$dDF zZhvbYQpS&3fPLz|*876E@|fKu&3{I3HGb{L_o_CB+m?=$tKU8B8fj8iy;VUH@0d`W zJm5%(wKlD>A|?i@u~x%|-UT-Os&`B0lo4ndSh;BC86e_pIgw5vvs{5HXlw|b0I9+R z$e9_%sLb+({$;=DUM!VFs%#z+!bdDJN}D#Ls2~g1_UP2$Qw}FH26^|`T#gQ&s9so$ zO>I+2wK(i@QZh*dk}*mXh%B_#$Q4xSwI(A^QF21nd#BnRO9cExUGCZDJJ$(MvPR-C zGcD9@oVIa!)fxIZ{@=^?asP&s}X8 z(H&3R%S=dX&a;-r@^pO~6)ZU?FO5o!5J#o1_i<|XXY<(?)QJWL&-VGCtbY8F?h4kV za|8fE2lV6`D!kK4s7N%Cffh%{!+D0FyQJ{^xMyXyUu*h&E!d*f$dk9`0&{SDl^ih# z97S?@qEAg6HId)gl9iew!!PBgSIeGz$f1;*XSxTRMW-RV%Ar2ql6c*(kK|p|C$7?p zrw{j!Htkdo+!`=ecl)ZNzCd_I>W-%>nvj>~oQ1#?0yS5RNN!aR1&5cg1SW3^$0x`t zU??h0T}5;4a8%2^Ph?(*Hb0W2)j>qpdjGrew**NH{>w%c*f^F4JC-5}Lg5Q)a>7$omyM9eg^u=+8MkeN0!=p zKf;yJ(%hS^ykZ^mc!D=T1T75|Gvb_Aq8)|IxlvrKH=YM}!L3q|tIpNN#Vk zaMY`a@YqZz&&vy)eDY&EeJSIRt=z5>?|kuG#D@~jbRzpGdeqo49>|KyhG+h3y#B*8 z-7v~Ar5=fs%$}W|Rg|}xx5&J@MI2Vbh<%du5oJh&Ts+`4x(Tw%|q(E*jJqXI-^!z>_&4vvd@j*+H zFc@+$lBCTbhr(0SvJ{dpO-4a?o4c*525+%YyIVcGadJ|beQEl?siLU)L>JdpobA8aT}N+%;z3dEYgVJ*S#5!B%v_&lR9J=j(3gGAD#{db;;^Au^pgubCae_1)X$_WP6lk z(+;vZT-kJ<=9gf(+GZM@j(!X&VTnYO>~o3&^RQeG6yIGzoGk3$I;u;8qPi&pl9&C^ zx$x6>*xwVM>G+bJ=4wOssYUzqGLferkv^{<>4s%CD*U`Vj}3m6*23u+Nq9Q+dswuT z$;ly-w>x`c=3if_?U|1^vd`U@8Oh`E(K%Jhu(|_)h7DZ)r9_pkT3>U;XH%Eh`pHjn zcBrQd&osM4l`>!{Z3i>+=h;{A5uB?r=K!;JJAAujLK@(uYHEHK?YRE=+;Zjyj}GtQ zNaT+^k$x^UW$=d86riNV%nr)Y0w5Q3bN=hV@>oq_l=*t|YR2Q5n|F+~;+&ZCxtyBElvXEFdX_vNSqp7D@OJ*QvYuS)Yr&)G@45 zTKSIR)kmjd+IO`BOgn?aQVkrE4$nbTisYeq+cA-*anzd9Jr8xwxW%0ec>1)O^O!|? z?XfV-aDmktFqlXLa%kok@T|if`*iAqmD--LkneJi zreaRYx_e*=^U++qn&@~XzguVooLW}q3{fc6aP@E-=;DRbEkx>O5sfVwalAHYv-Cxx zRRStY(#^G0>`SLBmjn6=V!Em6a^lvtjD&|!JueOp^kd4N(Y59A!kt)l$ZEqts7j@BMY6^+wj}A zFKYW5?8IKiRWpwLDi$(ZiYBA3omcJKBFC8}I?l$rh;A)gyMWABqnn*UyDu@2bw#lf z3}Ny`H_h5zc!T(^qa@Agk%BX#BzG6_{8%iUKhatDE(*IEEluSXmD(X~p&O3FWLzH9 za^onYC!?%|pM5?*q(qx*#FM0M8AHwQ%ejw}g$BS}GX`$yqHS%DQ$yfe+RTPyCHh{~ zrp(c%oIXrt)|H;Q2)q3E+P zOJ1o)@FIs!Q{nhSRWax7FZbpT^(H$h@F2=pDT`vI2G?RkLX*0ki}YbpGD^rgS&Cq6 zIjF^#=wgMG$;gDMUp7I!$bm_9cu_Q2KNik$TB9Xhe{H9!D>TXb8RDgRZEKClNUS9q zWnOMMoc*LT0pEhR3fkxlka;bx}?NPg53Nl)Ly(Ub*Z z)mpiP_7BN-?C%SzG(lhzecZV43Hwr_tmXugW7)*B(l?Ey7MHWSP$a zyWFIIWkFCOaxQcfs^6$_dBWlg|0#Z{?e}w!pZcefhE+l-`eHPfU#Y|=By--fIleBsAtvE#Me*3z7zk0}xAAb(ISo z`t>ZbdQdE{$k9Pxmf@S7xGpiKkZAG6%!3lnH^img4Uz zLZ?zklvcpOEGJ@9xk7EoPZ3nH{7jXo8yNb)n*us$9zR=bYe&Xnn;jfnu9Ue!Q$vlH z^m8 zJd`K!tS_-Vb%vbxS}-c{iWsyZu?3}dt)V`yOpiD1V0g|wYi>MQXZGukpV{3u3J}Q9 z%4LlV2oC2N$(=ku=@PLu)KCTVQ&#;*=p)Hy_R_L0!2!EO>WIN%-VWw z0H!WNU!gHm#LEyHjW+|UzOtxN^#+|#h;O?Pc zfLBYL99?4=mcllMW$s+5rFb69;)-Mvl4Gcdl5Wi~Un>#>&Svf!BOarBt{CRtsD-63;=I!F+CvacX=vBJ zF{44L{6aj8nH!WVox}uUDX9 zXTK@9IlMl&)-^WaSx(K!r-o9QAH;!>$R~79fuqY$Ffqf%C(CN@zGO#-kmu23!XR#A z_`hwfwG6@|td^;vmG_I{&|!?Fxbo}LmmDe+9g%DZTQAi-l}N`t%-H7A4XT36tl8`_ z37FKk%q%doYoP3*p@xlhZ)>Weqf4DkjA{RIb%_n@xFxUDE0bsV~H* z;%K(RH+K*7cAfwd*@@g%?oGy8$coRnQbW<>cSV|)SMg&sj(A~^$m=TfF@9hh4%tnE7ZsU@WTo?+#AuZsx2%dmxR8?%vrdfx zTtCt!wu>$C*hrIWdM;HBVQlkCOGC>EzW&IeE1uUBytslQIbKN5-(4N>OCKv8s-E0483pDw_i` z!gm&)I9nLq4DCDUw29f2G`5J^)z{*elF!IOq62KbY6oJvh$m}8#ua$2;bus++7M)ezm?%>fcVymQGKUQt_ zls03^BxXumQ(S-6k8Oiu?MfNLdnXDg)RNm$6?9Ir_;vkU3ffG!WN1p+0W)}|ua~~v z;uOc&zU>QGC)Kp$uPnv4DV4F}Etf`XP!ag^G~p43HrQ@f24|BKcYC7r5C5=*=QuzA95QT&#H zD6ZvU>9T=)r=-A=K`3V5aPsAJ`zXM zj_{NAb}(fc_}b-NcEz1lUewOhnj7!o1z9uqopu}b#i7=m|F-`|dw{ldV;`=8(z@`J zBk|OK7UQPp94SK~XFJ{4o9Q$fY!ltg(te6eP)XDiPu8yDz6ucxS{Fzxk)wH1W}4Sk zPDegkB0u||N_FPN&?aSpJ%A8n%wLR#nDW?&w6)`sr@KI)39sPV3JNqgiH2PnNKs7t z((b9~%9VjJ#@a|z9!}%-HBR%czI;zL=#ZJicxaX&a8C!9$N_6en$e7)Kx}@18*EqA zFq~W@%lO&KZR@2l(5nqU`p2GMaB?W6EyF}RMz=TC;_xFsK;)9>>Y;2V4f?%?5Ydy!MS5ztpDD6QPbL4#t4eGm>O7C>U z$l;fJ(vVQyuI8F)&2xkA9Ubj+iY+m^XvE)WguV?#+mMZE$EPdheY&$ya?t+X=0=@G zO`9q8E3%heG1?59cjfy2v*!K^p{|a@-%%!i(iu0plI8Ry-K|O`k4%$ zXnjLOxTNt4CS^>h7*C@lm!*#amqR8-M*Hv8};&zMT5! zzNPjpsZ{J_hmC*%VaxX?7ep;feO*7Eoh;`2kMA8Fb7cVus4`iA!Q=~>d3?6?ecT76 z3bvtXTPKdW9-^{O`#t zNCBAb`@tL5ucSirqI6Nve4}~Wc1cM8_;Z2Jh8I|yl}Wbvo9d#46Qt+mT9|mYTz_7a z4d>$$T~ia)ORXQhJ1+BJ>Zqy}Pqkq$1`P??I$=PY?q`y#0)p*z^$U3HUq95fCN_qbZ64dWW%s1C@S;4kOnt-?+*X^~eMt+v{d@i`UzaJ%DV8@~<3Xa%#49W2 zpKxBsrddr zb-1Ne@Ixi*plFC&pb}9z_U@hN6vViUh4Rvg(Smt=99A&z{=@F6e3$Y8)k@#-t6)ZN z(zSi5*@9^0W8-zL?-m>5`em*3VP%2WX1nJ#w1F%0axBt_C?{JGD9(JHoqGiZx*gK1 z98UwJm70v=emLJRLs_v6e?c&6YocawSuK)$^4bCIl)X?R@u6+P?w|D5&-wE++BH&@ zSiRx_E~mFkI<<9W81Z%aFsJMiUcb)<68ShJuQEH)U%#C$X9Gp~=<_nX(VG}pGtoeP zqw@NJ^v7f6B-8?ZDhFmcI$n<^3i={@%HR0hCYEGeDeFsZTUTZLH@oN6ok>ZB>ZKNc zDYWe?4_@BeJD%?=s?t|Ok_=aUJQ%V|HTeK`Gn;n+tS>nkg< z+V4k++05-2zh#}-oJLhj`^{K5f}n64aT4^2>j=wG- zK!54=M_alvL#J?bxRdL*kU8m_641A1hr==jvPYf1lg~aG*0mV^e|WSvXyjdk{HVNH zulL+Tq?7+ohi#5N`|EcF2hsho;$Q6@_eJegb#4eIui+4c95q3_W*kUXVWX6%ti`FH z0_t~M6PkK;-gjN|I>=u~MDDN3hppVwiKb+cSPkcD=TulfJD7ZXbSAcTUi((zoaXKQ zlGbnOipKW;mUPuF=<Q`_v7X_KC<#W>FC@DmOPAK&NNmIoQ&wV#4L~?%DPgAk9l!qCv^kwzm^<|iEUpRoQ9^`r#kE5@D>EYz| z?T?T{>(@6_UP$ASH;n5>=A63HO;BIum)d@HGVkAsB`WqYEc>M zCk*ga1FlMLTT_%dsMo#Cn%(Wao%z<|Eg4m%KU+x5a~WDn($E1W>bo0+{BK9c+VlP4 z(V)pZlKG(6X>Cv#4k-z;3`PB_r{0CkRCG-yt8BPk3pmLWsKY}(J`x8}7R6Dvq~kI$ zd3uF+X0OeT1prOup#~qmDl~Ks+B`cJ9>NCgL^2b_xeyOJAsIPBP<}J+l@jT&b9OL* zB5o4)4_7^`kgdgJ;mErCGXI)Li_VlJP2NmhTMD%t&xPljXA3m2K#A|9{@~|Z8*;+h zv5}UraYbK_3dN`LAwVnBJL4jp>;o{quhqvbCgi09Hj{J5QI2@J8-*9Xp_yNv`8sOo9j%9rOY%{oorNUwmW*y5gv*{w(581s%C{Q!mxQ*y$YH$49=G%tqoG}y88j;w zbBH;|yqQ8uykSA)oM}hE9y`!p|Q-wQIqto|O0%N+b zX$Wyz&S(Tzf!kn(nBroCe@iT=t`(dxinpz1R&6{P#!5JzC&Ky0K;Nm6cGDYaL_l1e z9Y|DEzTho2YXCu*cI?J6`pReqlYsfr6tsRUhwA9_Efsb)k}0lxTb0Y`9wR&Pq?UBC zkTysGTkV1r6bN}Nwp4x;)gyH6J~B}INjWQrBdHYPu3V|9Vs8u~?ev?;I)HKMiwnN3 zugyY%Yc#!&{q)&Fm5v{Q8o?l=NDh`&WuatZtTfU=cROC-+phx<@-`g0TgMoP0eO(g zP#b7JZ%RK{l`H6X93iGXFxIS3fw)1gCM{vIzlktH48>V+_f_pvQ_1*nQ8iP8MiGRm zmM&3q9ARi0Dvp&4Y7HY2G2vw{=cWtPqYEMhQ?-}+kEbe6dmsCn7xN}cPN9yNK1L545;>2P)M z)#acz_~>Z{_cS+hUUOkYph&L}9; z)yQ&oGJ4Zh%>IW#9H&;1llNp0CTL$;T&EUD!ka@|{t~hyQk+?Tp+1y{@$(2+OoSC` zFXvPW@S83;-yZw=n^s2gkNQsYn2Lm4SYgoplCVi_Mji^HHlx5wt)Y>e3ybOZF^-8i zOxJY2MFr2RZX(HfGED$w3FChf@5cwZ#oK96D>)X6PFGu2tOt+Dw}c@`l3g>2aTFd#c(z#b6pn zV^(!ji`m!DIo4-!e6+x9@~*G?AB9hTr<`a-Mq*KDC6s29Jo1=I{S z6*+ty3OqGM4oyNjO`%!c&GYTq!RGd?DTqCmv9+-H{xUoxb6T!K-^C{gu-RB1xMr7z z7S^^e7UxTCCiX;Vv*N*?-y9Gg^FX$!vQq0P$J%$Cu?mU|wI>WYHs|*^iS{LAV!Kdn zq5)v(T7l47tX&w3&y{z!s6~0n^8K!U#FX|C=Z%ZLquuhE4gd1FuU?!Vgar}it1xIz zer(>Omo;^!$mLgyeLLqwC=@5K2GA6Y(skoH1da2KoYUB5(>w)x%`2UdR@xAy4`{MQ zOufwq^<*xUn}UAr@G6J3_C$dI9De0tI*Z&v9C^E8efD!h1HrAf)te~i4m4C9yO-3d zl>zh>@6{P5wnRCQq$GS)QAju8gx)nfGpqRV}<5hp4G66rmwC+0n+C0EjC9h zX&Ef_U%OefGhPR6&UAz<+ogQ9B5;PMkBk7n_ZELCC2gI6p0QwYoS43#QZOUR7AuZ3 zjv{`UntGpHp?WS=ZL<)~U0u(x|U!x1O?RQ+Zh>c82a0mXU*Yb zy9#do^sx>+i3#~8n=C8Rnln9t-7nF-F7-}(#|=A0U+m3ggQoK%6%ZiKX9nt5J!bFY z*_V6T{Uo`Wi)}Faowap}D-Y7cjiW8a-VSwcBoy3m>$YM8JQWjyFaB3sjVPfm1`c@{${@%`>mO(I-NXiE( zwsd1t0iEqQ%A$CnJE;Ngj;teBK~ykdd!~DAbJurwb{0C)QmfMKI&(qvS-n0M`ffMR zia|-s6mMb(kg>hD2j2-`w1McY8dD`Mr-u5Rku$DQvB&N#$~7-C?6)a`&D3!G=gGEl zYNl)2qkS^(CQqfVAg2}7vZ9K>c*7&!Dz>HSg9Vx81>3TGkBp~G!6EfQZ{@q46tSD<6ff+buP8bOX=P(AsSa*BT$oN1AvAS6uS} zkImO1uA%|k#uyK-tv0o9&o-sVtqo>TcrVyc*1LRWcdQ@ohNN-9P|z2g6X#oFOB?L8 zm9Sa)vvYT{x`V1IMa%96%|#s!Dt$=t-P4njl%^pSyCvq81+i~%j0KbMbd<^v)Lx2; zi=4tCVP3FpfQ@!a2U-)EgB&b~c@m4ac9-+Sv=^nQ=kX?xxd4L{u9Z@4vEtvk!m`5w zZHipd&1goY1%a~;d$3M7@KO!ROeASZT$Bx70$FXx%`e?prHokmfmTc;R6BD;CqTB) z_Q37615xylBL%JtRvhZc!k0$0tDK#=u}&zd^H|9;=ccx!cm+rEN?8|MU*rs>GwsDS z)YJjK!3!F8L1LWelr@D>ud>p-W8Ls%cCxoPIuv)lgSm9LYeZP9y1~{wtM|feEYG06 z6TVs&R2){TBh3Pc*s35>?nLZMIkk&&fJ z!WG+;%jiCr(10Lrd`9tH+4?5N=O?b!u|3+hPRDU5g*!2In*u*FWN+#ov27>{2S8Q} z)$&4Gh@+xT|L`Ba`7QST8Yz8vz0|o$79)eqOO~551okf_$Io=u&HBT=)2+|*gPl6E z@XTIAd~3lzLf(^B+bED-Iaz32M%@=mNF%yUdCAP%&a|)V!#vS?(1{JX@`IE<8()Y> zy%bpTOF^WbGE!=|O5ME^Z8SB_OlvSSzaQ;a46e$nWO%Ecd~5(WV%IT44f1;GaC8w$Egp=HTJ@#*CbNt3z2tBt zhixu}NQr_7X@5kCy?bJrUS+U;G6Z`=8x_~vU}JgJsU93^OP)>~s{IxQk9l9ZJvmLZ zR6Cd*He)qi9jXzKgSE}7Ah z404F`)t(Nj5I{ej@6R6Duf{!5)?5(Ay_ti%nYDXs% z{awGk&XD)_;U8m(7ag2;d^5jp+9vW#m8b)?YOHhfb%tSA$E8XIn!c_NbDoh5gYXMH<2!X(~ ztRcGAX24G=znzE%}Q^@A5cA)=N+-qU8Nt;eP#*+8JK+{IcIMT={X zfmL&4Y17%SsxSl>ixP#b+GUwkV5KloK8yV`B^$lkJIZZ z{n4NEubxlRZu(71&;2(2gpwD2pWaS?mwunF=->40AFJkD>1XMgKl*|GO|Saf*YkV+ zUZvhM>B)b7JsqX9w4b)s%%Ogt>hB`W?XP!pmJalMXeH6mpXH{$ui7)!e?9Hl`#t*| z?J(@ut$kWO(x6}0fAh4Xzr(gyQhM@l&l}8_`ea{2om*2haVnS`+q2JylB0>HnJ>_J zJ+;H$)R$Xo^US8px1U>E(JGT-ko32wiEOFu1NApk&Aqg#vCNYO{nazqRdlHTIqdl0 zRE?h4+z$=5`)Xn*&p(DT?7oHHO!eF8#*kK2zGl#Stk%x-^w9bSx<2*3_n6YQ#_0@~sURQlE;q~+4EMD zTtIgv{c*aZnqOGA3k|^GAJdIi=7z4Hs#bt{p|y2n+)>$F-_<@@yR^0)3)`#l7=Iyfd0Nl$L#v$n;HiY zi*Y#Q_BED;{s-}Zec&mx;Fpt_|I0jm?kx6}YQZhGtp1i@8ecfNIJO5wV_hzS5eUaf zjtspWQTH?&pvVgUQ2#n)8S9qHf!$pHf$%2=gBD6HGSV*Nsl>!Ll+hdbw5wjgh!#c= z-eG!6NZpSk%FiFqLL++StLHw>i#tRK5CM=LYSMdo(o83oogwe*jU%ih0D#}qa2Tc| zrBBL%wr`9)Cgw!p6LOFq2~dBdZvmYHgbB0kUJIHGgm#4N$GnnmX`I@Ek?yCT7os>c zkkJyz6m9i05hXwSuOv!7&}`up`}#h8>rXPR|4B+OIn{rVdB5I1`A=^OK=5FO>jMmo zL_)QqV~T&mz@Wg-1;)yDyc?L^sNtG9-OB zXn^rJD-7yT51-sOIs$~q1D58%0L?RB_`F#}N-ojgo%8zpV=dp1LRt7-wa)?uXY`T$ zSxWDGU)<$&>)97OU=(xk)v55-H_v`Qr90yltfHi%a+RS6)<0au(eNkg_xX$x>G|j_ zeJg$~geL#Pr-mYxE^2c@ro(2bfieSIUS4MiW|oCvZR=kK5J*|4{bu@C=}pyQ0(|XE z3f8m`i~dP^X01g!r&bodf+92}5P%*kD4cykIk1)V;bmG1ePG;{&;KW)LBNZ=m0I`0 z^9Jnv^cBY4 z9jkg7i28vf-c=j425LKKq$cZKdJ9T||3d6rS_|nYB6N||he3=fk ze9Kr^yW~M%zSz*6gU5A7P5JltY{^g;m|y6U=eJS8=*r^M?1OPTdt3-5kYjZL)%UCG z8V%@%(u4AGtmnsChX3;axn%&`0c}qW8thl!9}en#6a(SWCPR*9BsZ{Fq@ zP{vW8{9irVdWX&vsz?bW3Z@4NppLl-+nTG00EPh>I8SKJB-cBKBnf!$4TyINP0t_2 zrtwUs526Rps|?)DD`CfLpQ;X09NgtIz7c zc@KjgU0h|`7WlzSX4Kans*o%a$NtD33l$v=cb;+kblYMRLFH1>?i0!o-M zl-A>PtLf7g0_S2{OTT}hwy@w_YCHNckz=DDfA$drMi`%qg*vjT9|XI?mJUriS`H6H zsGUN=XTO)yi)*U;ON{^;-In6SB1w=u&oju7UPSMiX*|x?)3=y6vwM`%D~ug@AoN1} zNzVgQYNY35l<5WDvn)U^z2v=kzj(aTONiu$c_dbH7Bk(|NSwRj9J(PGRQHTKh=Rj` zPM`+k32w+}AxnqaSswd|=KEOfy5EHPf%byQ9~l(Z+`aV^wd39el-Gr9aQGQeVYS}U zEU^K9B1jyl+>aO9O{YdT~=<9ocN@DLoHYXRPVlKr*ll?eSW?`PM?PrZ3IrJHuM*_1$yy zp*pV)>#TXXFc8S>PV@yN?9I1!G`1r_L+!k zgZib`f_83W98#bEQS{l$*O1&{xP*4ptIRRKX=&Oz zc*p8s=rZZazm5TH8S`|eH3ill5g8gnwK7|R0F>aabWM*EM<2>qPIO&_XE5j(SWMWg zuf6FJ@m+P<*WOv^`n@kV|At>1k>IL;J8vKX2uZ-dR8MtI-=L?WMmdz>eGZx7tUz9b zYTH*&+VILt&aaSCzqWm!zKZb4zqMZb0LRyZZ7Pi6yq+CXn5iq+r&@a_tu=Yv91XzOKqndTUrO z-c_>#YaE41tJF+m3;n4hZ|ZM*XODdv8o;#)A$GLQhaEK6`E@2j#_4x zQi7lS$J3H}tX1^n?V`@@^}ki;vDi367luA~AJ$|^x6xt`+{RaP3!4f(o^!-V&j*mx z4*(Dh?nG^Yma%Y^6d&jvB#>TQ)i11`$LX$sn!b9r=abA7SSamBAGpt*zwReRPCDL? z`6%=nswQ7}D{l5U*RF{%_~2aCW!=V__Y|L|{qVBamOL6)xyF!Z^kWCx+)K7=KseUC z1k#^P;mPaf`vNx@4IqwX+%`8tQJG(Y7kLs6wV;L#{rBf79o$uaZyEMr(s~Hgc`F7R zEmucStBB$fp--njha^126E2+hfwOH?=9w29`t*c}{%1Dkkf`pCQS|La=Spv6|7Uv6 zO^fuLOUU$F#_R^pcoi8jya9O`j;l&d$QPH*?o1ogUit;t7F0V0^`1IcZN^Y0CWZ|0 zpFZ99PP;@V#C6_(x^Ig~`qTL368MhVa>rAYlilFC2|;*&E(rZjIG$eENE;fxf016| z>AI~8YXm2B=nG$-clh%wdPuK+XkXsb7dRKeE%XT@NwhdBH*YFV$aTGS*9PH9eeoTn z5Y9d%8x-ey4YZ@lT}II2|V(7K*D$-Af)tz z9@e33p|Sw4uI^X=8B9X(pGfFRdVIz5zNv+PNP`3!NAPr)UmgMScD*N;i!48!1rox` zhK&ffs#4q0n$fyMYk5ud0^@Mz5%U0f&Kvii87Z+$plhUFwkdq>S@5OwMXxDfATD2R zDKq7nm*I;K#U2{e`1{{~v*m7aCqUsKhA+OZr5bWK7X$&20CD?`yDQ)yJH~732p?(* z5Jk`t;DEb%dM#l0vR)-{zBlA#ZEr1t0xldjpcmBZDAAT+2zg(4n&8M7j_{pGeTdo~ z2Y6`tpe?GSzyKLIsec#fO#l8rt5f#xi&HCz9tVbIG`oB_IL1zD{~M*c5>}@~EUO zKlyibbSS}v2#5*@GEB?r>bj%GBHvrPT=njr2|BniLas-%Q_&-$*LAr{gkO)Zz;OWu zW@5O7q0%E3aH-BpTC4bAH~Ove*)QG{~GKtr&gO!n|X=7E+0;q=CevggUj zT?R>|2ERvgR*Y_0J<_&X;z(zenlYMD0SubMfSgIrHKv#_q}` zUNq0!Gs5}x)Ai~^3B1C^()Uie^BmHp&;(pf4@W~XYt2_M7Fx`A7VpD31MR{My>;wY z>>P&)Tnz+@wR5azmN1TRbCa{=HEbu}TaK3S%8Q|!UO`j#vE%tf(>bI~_z`EA3 z-l^t3(g$RJx5ErfAG=yZon&d44AW-%SWP$Og>mzqMGs=2&(rjgv5C)3Oz<7H)tVMR zsLQ#jFM>yhT);3H7KVvAh4v$$E%-BwjqMf)gg`+Y;U)D50zJVoP})yyzQM=i8|MSn zuNU4+Uk(qu9|+Xq;a|<}tJ$zH=U4gZIA>i0|CdB&b5=NfQfD~a{t~7c2YBeC-CU(BKr#5A)KC9LF zR`ia3{$GK2x%f1yL0GUQKC$d|I>(B=s;7-z@9Rm5F~J1B<4~ad6MB)21`m zWkwn_`}Bhg+H&py2EcQmDy9=7L8}UTsUCUI23&#(Mtgw5lZ;V*v5e5STCss4i68-- z9#W!LG|*5kc-I=0Fzw3QelvQD+FUWo+b3zih2njU0D7WqlzabbvW$D|!r>HSh%rJ-~ z>!5>lh58j)eMaY*Z|OVz7tzw1)-HXIcj(~YX?T}_;5Az##at~WOVrv%`_+Gk-~hoY zx`YNYmfxV}n!>9LZ%<8lB3yVOKrK%zd)@4$X#fpL3uh_F<^sXB9>|SguNyCrQ%`EK z+sicuxCUQ4;kez#@A3FyMEE+E&mr`t7}fbRnHp`h0Adn@f(n2UufYT%k=GK?v}Jc zUf?iT?QV{6Tuvh??7Vj|g4?|-MnHU-h3NCB(vv2@fL@6{86G040}P)!LJ^#Di31+> zLXr)Y<5Iq;iXki<3IS_ciZhvWguj;Lg~|Y6*Cgcii7+~4RwejSTO|U93$UxxlhMRB zat9;e3%_n!TN}-R(e`cBu}?3tjr_^Kp{X`!lFVf|P=w)nsJDTt@tS~b!z6XIT?cLu zSK9+7Qi~a_+iF+iaHRsA0MC;);KbJfJcEx2JdB>=$dS%k*v8|#`BDTAnBPNtrz!L(0Ckwwu_XsNKib`X?(LL>nzWdBoJ|D;AU9 zkpW{(4SHyIPk@7Ub!gWa7bA0rQ*|)?jm;mm3M2qA>I@wA4j0O4rG+N64|j047VER3 zTJAE7HKb2`IJClwL{MVfR(uhm!b)lW)kZ!z3i<^M}FtGR`o4#uKtJ?=LfY{>ppQX2|v!T^;nxw^;>&JjO)X;h4cEopq;P& z=(9rHNcZyy7xEtppc*ab>nTEZ7rzTj_eFz{!|9G&b_FuL*W>rFkzwcp(js)nD4l7x zECfZ%vq<~ir4M}d^1mDy#y}1pIt5_B0C$Fhhl^9c8v-J}XaN%3HojsJB8k}BZ!uOt znZZe?`W-KZFFoJ0EMp&ByD=sDR}WXNYeA}(;(KAC1$N_ps@4cWv`ND0L+`12#oOqP zqn~@pUBCzL1v!a(UC$CBz0>#X5owU-oW9?L##sYoMhmL}bz42Ox(n+4bX92DN-v+W z^Xmw2;POHftrixDoqo2a@>b0XsK$($DK^JxhGW|*sl&_Pa(*5%255{&lwN3O9w%Lj z1Af*+v|kG}7vOE#5>v8K~O>59%^SHJ2U3}mU=?QrMc1*+fGju{j z_gQ&_GmeI9our}L;k0r)I_%45%+eTAlj}p!p|2uX6cH?U7on;22WyQpUSat?ehW+9 zyeB<~U>$nlUkXy}{`cdp4t3;JjGo<{0o&?h>w0tX7kC)DWP0+yLS)N9TP+VJ z<#Gv-x4W5Ws!lEPT>2@x+8z-IpA5hWB@Y4{x=gByM_c2d$}pm!z27biz+SXU_jNdi z!&$IFktb8J#o&bh@0#$xzubf!x)2Bi;l|D~q8YDd?ERrHU&num)lA=Vm6L@_FS4Ye zwCefEzq_f&*7xB<3c6#$V|fG`{o2sI^>MhRGW7-ik+8hj(#!8QJLXOCOwPN&ZBRAc zeq_T;wP*5n9+Kw>Gp9Fjf3h%<2>?yIE22=brShGcp0lQz^%g;TinWa4rf;{k868a1l$0<0&Dcb&2JTb@V@eICMa<7-A}M|K-vs<4 zSX#mB6KE$pwmhr69Itrm_i(cWIUoL$mMz~Ewp11j&5$?P0)+{Lq^bS}muu7oJ=mb; zE~>Gfvy8bg9vHoA0q$!+oH(cc`tuzlVE8ef2Bn^P@?Rq^!8}|tE?iM;+z1JvjRmyh zDl)374J^UO2HIgMAYjsvvh(Cnqe+|R9slCCBH@0fU*@#5V|e^2&FT`4M{})f>t zq<^g@tk2b?cXMatXPE+@oJ4VtVp#9;gGj ztZN~-cA^O%5-Y<&WI(j~6&ZHxGKc`PyWDA$+PF#1Yt6MF+KKPa>s?&ndk{C-=6*6t z%irB>O@IHM6A+L*&nBvD3#3K(z|P#{bA!P>>lId27xBmdLNe4wG+2o6E&Ug90~D+vA$c7_mE%q9f8bjFmD&t*MFweDmAdVEoKj=CdBSXmh3NmYI z1YCi-tEWCg-cSP=dLX+(Y7En9=(E%1Ke;B5(HYHvg&55&;I0<6^#nk=PD%hAIrzn> zMxX1_8ef%es@pioQ^WW*y2<&yPqoeDFKGFJxBN6CzC^1p4N)OI`A4TeFsh!gIjq(S z7AS8RPKKi)N@AxbKzC&$VtX!Z9E08O6>-rp>BayCGs1%@V87W43l|ktAY7G5Ak9;U zs$5wnM({mNr8cGKQK(S{(@QWySSKDxs1r|Zq-aZEZG;UFcG4}Yg=p)o-a0aNsPsti ziKxYWV(!hU=d0-GZeI>3CRbL#Z)aSQpWm81&;Sgf9VRqUg_JWU>Un#0XbuqU2PbM4 z5eI)bHW#j={SLspZOuf7YOv$7FC!!AtThVt~Yn>ZY zq%+p|ruDM4(YJJ6D|JUB>Q8kVljfz{*I6H7QV$^ZBEjd16X|Ch8!=ti%@T}T7(G1B z`E#xR%qL(I3QxeUU28Y6Af>!xiW%fQKjA009gZ-cT8*D?$}VQBxfb zPP5Rr7^yBTiPcMQ)ZZKtOg&C8>S*K#W4vBk_ZOG1yJ9QUv(0qnyzhY|NAq^0(^12$ z0<@Z*{4XEsC#cuP!NNWaNfRt{+*J!qmd_R504Ul$`VwG9@o;t;2v-k5tD0x@gaUk` zA!2oc+K$fro=yN1@;&*V?yD0juP?2(ruAe}XdpeWa`g%-W0I}YZfeplU7XUEO*WJ^ zru(|QD7{mdDTiB_!T;NTp22^;fz~PaEPgQP?_Sqxpdf;hH}oGYA`*VnTL??tM5}-M zHFKeiV=m%Y(i7geDX@oD{7bcodw@ge8qxDTZ*f)awef4OZRan42hu(jsE2jb!)x*G zQ>z1h9kwT@zvv>58Dj;cS1asV*LM0IGddmh(2U|8ufb?N@ellGzF;@T=G5pG_I|@6 zvT=k;)26viP}mxpWh+mdv{=n zYB-#ynzmntMTe>x0zRC(LvKC89ifK{G3J_)EtC-6&gnCE|(zd`Ap_I+HoRm>M_^T|IBK|n||$bSfq%Pbk1AdCwM8Tt+=&5|N* zdFT4+RXxFE+|@yS1POik&K2||m(F~bUH}vzlQE_z|NZ&OBm5B?Gpyh?VZpm$AT;bM zCj1I1(VA*5zvvFig@RZQA{4$N?F4Df^%YD66j6GSGWZUXiau&sr`KzGoVQi^0dqt3 zU`)eB=y4LT)Vk?Uhj_*o8*m*+xC$X|`N>U<5R(HHclZU%F#cw!jk&>!e6bNfSW_Qg zYSu1?IY<~O&RAWcsdsz;P1>g>Mzt%buG58&ju~mmpYt0w(({bmmi?Vu`PcbSajMOf z`qFTQNhN-C?mb&e-G5XlYN+U8ln%ci!=hqJ`u4DP>Erzv`(>yUwbP-It~?Mlwl2Vf zZpJ?xLZ_7}VKf3^ZyERkkptb#f=-@Z1Sji8vGi&$5AJLA>>iaD`||Yi@6~2_cJk$b zub|btdC0*Bx%7`-7w=2op}y-)RYS-%zRP!<6b2lQwdy!J%J=WD>WQ~igCw`DmrNVx z2VNJ3fs1^fK69??T>LFLD&Nx8QrvX|{<`+XAr!-wUQZmq>enH%ddPp5{#nw!0(Dn@ zgBGf2!W%eydiReT=Zq747FT}-`bCnr{ECb9paDPmjafp$HzxYnkj4yz{Gew43iFNm z>K1W>9h4Sw#KQuTpWk!7(e|*VG2d2S&XCjY<;O6t*|&8^0|Zc{e7%H+{(!PDY1xLFm~&wwafPehQPNT30D@< zCkL&{?Q+=_L!bBleU!H~7SH}cR5zbN6G_!3XdE6pHZ; zlk-M*AJn>Y`4KzTtO`rPMS3S*9%pYD9&5|_W#_-9l|eW1RvntI&8EATZzU{21 z_0SDs4rS5098xY#WKsQksyBEf^v3~h1QFR01f3qMCzLg88xBH_R_>|}du4Z;_vsZV z985knZtAr1P5Sdu(cWZ#lWTjqnXnpFTdDI(>qu*Qbp8ZJ!@oC1q4QxaI077JVkOS* zss*3{&AT^aSufZn91}fmeM85{A`4lIj|Khkg|G%w_0yfpNyw1a%n++Rtm`{^sy1W# z?w)#fSd67(dhNWo!oLSkI~LYwS#Qi9%1F=CD|%9T?Y#QxfBka(0|D%Y-v1Of1l$uX z6j>{&^)h-3lvZVHdj12`DBeoXm`r1o#Iv9)PsMvq)j_rhdjwJtpTBvn;b#&JykD$%4*H6bu9HrI=UydHcYF)R(_cNN@Y-q%k|~0fG@*Vdg)eL`mm09 zYCIRWbVq9~-@uEkH)Do};@QIX0TWmwbU$dD69Mk`_2e}Tt~>5OeM0N_f`H)}99s+7)p9m&JUmyg9)z-za{gcUD?bF6diH~r@8^s+u`XOfHm^zvx^rURc+p!D_Tx zXp7bLqiAZ~^hs@@ZM)WRneIH@eU`p9SO{?B>l!cm$SwQ#em5qUeqh>`$zaxX!+zEI zk8P6l{ri&lq1oM5yIVH;2@Z01Syk@26! z2plWXPw%U)??i)lhDL?uaZ;}+f4 zf|kPqfL{5YYu&0Y5&cZG`m=GXSY96)9{J6(*G;#94*<)S($iZ`C1^K}?*pC@ zI{@zY1^p`B(Gyzw1kM9~@+xo$A1d}#9_!2KJlkE?O?s6`8ClzheffHfs`a110j4BV zg*Nb7>R;2nTfRc$Ha^lU$QFU0xuo>~x@YK2^;+R}nbvAv-MDt~QNK2qjnqfix-6%H zVH;WxmsP6;(i@5@v0B8kp*YssaJu19Q(wWAfEhD)?;AN-ZUxslZfJD^_XCPOg;o9z zRYv4H>f+T}fUgbbeVP_W)K=E==|%<~Gv5KP5oQh{@5kBpt0AtS3w0fbdc1cnyY&o0 zk8VXdRgTxa@{sYnH2=f)b2LFWnvL?Od^YPNsqVVkmf;lKfYo!G#U(ONRU`A6G7tAk z@HX0p@1U=PRY_MgFYj^s`_?PJ{A+HWU*2+Hes6u9Z|4Pm&owJFDC9=}eR{CG&+(eJ zQsG=a_0BcTgjg8Ks3#U90{ZtPrv?`W zv`Xv%bYHfwJ0HF$IlG$DV%Qo|AO9&MS`MjiG=txKy*@9s7N32+wl9KV`efMdx^R{q zq(By3W&8hT?|opbKCXPv-@V-pmv(o%`!+a`xlOJ!B!M?T8XIEB;5RtN8PMR2W8)cH z0~@!Y9r{fh2s8;Elb!pwn{FCtEN6u!XXVj4Pxi_g`K{~~*(Gn8U1#Ne@~oVdBatUZ zOLpxivT`KPK9A(AoXvi|=T!afz1{H@x{~E21AW zUKyXSSmnhgXsquWT`T5>71P@W&EMjlEZiKbH(eWU=dS#5dCbP~YwWLEy|}jY9e7a` zt!=X}?6AonUK>pjb9@JCRQ>U_)pc#~>&o@+Fy3Lf)$|9R-+yg*G@q%y_iwhe{asHy z6VpDzepac{acKP59%8fG#7p^;Yi;EK8tk`-`E0E-`Lj+CT{Fea zxMT$y@AB?4t@zK7DmG`ODu`OL~9jr?r0fZN;@klU#pi{ffITO>NzIZ9Lp*x)R@P zx6Uugr>+G@a@(~)&7LP1<@27p)9mt9vlDTjbhby);Om^V)x4*%8W@|$-bcVXB&)7b zq0=MLCSM!Y`8?h@CpX@rB!A*QT=f4&6a5NW^Rh-q!@rX^>^ALC*x_%y>xl2tlDn>k zt5v>tU~3u}G%v`aYOE%FYfmF(eu`SLxRI8F+UmpX#Ll_9JhM%_o5bQE!B#@wbZY!_q+3wZmkbB zFUYS;1~dxd{+sq8^!8v@pV?y*58}C|Ips?|2VBXSG%AGE&P5O8x^%YWx6 z4=_rJcd0ke_Im%+@ab)_-@K|5l{?UpFJX_|bBim7R*6PS-MWk6zLHK=YQ*c^k9nSa z&Z&8UgWmK}?>tYPz`cOX3Ry?Ju~N5LSQ*zkaL9(=*0Axn zakK4N{PmOU_YjtR4R!o#M1Jj7{vV|Fs;WWhx3=lEqR5GiZv4{kPK0}}ee|RCsDrAtofSnCv1|Hhd|OP0P{hU`wY3gD{~?+#uawDC_vB`XE}!c46TjKt;E9a! z3!RkGPs$p%yzR6;>MM%++Kb;`5`P9L{Mvxi1x>Rro6>9QcvXQ|t_u~MUt;QPy8R`f zxHcb!V_???OuRWx#ztIFFLjNVe)y=LE9sgX{gitpEqM)HlCY9e{S0*#|30IiD-Il_ ze(M4FCUyObx$3EYx_Op-_n47yc5*dHU4?YWNUw9m6Maw6w;r_&wjY!I(d?n1S4o0x z9LtFVbGEq_R2-nqLt3;o45?fb<%o-_(Rj%*w^!*)p`p2DABMGY08jLO_(A=T-a_QV z+?q*gVs7SqB9bpEe?t54E+GHy!F;T3yh~~JaJNxUx5oR$cdhd+{#}x^cV?C+olElF znI-u?q6^aC0a6`H^2;&>VDd{SSVm5+6F`eB$q!_gC(ARP$_ddW`J3C6w>;aW+%&Ny z|EYG*U*6WEl16gjlKk`qZ)#PhKr2f#{Rx?+x5!lCs~)b)U4g38NF7cI%(-A0(pT1j?6r@*oRct($B^pMd5=DXVpxt{jU zY(a>=Y&7*jQ_7@%G3fzvtigf^0NAN}Q0+xRvLG8#Mwd~xTdd6=p|S$Xp!P^s%vIhx zy6HiNmhKL0^qlMs@Zp`1Ma9Xd1CP!T0+3KA9x^+a6|Na$Uc^17V5(lb^H zC(0`wYF`ii-k$9-?B$hURqN%I&W(LSzORSMrSBlj^1F&XA7fGpI&N}~{V#7eJuM#$ zviP>kVx1?;V;-I?5{8a_*E{xI?{7I~pU(y+C;8HOFDsolW-G&3s%$#CFAG)B0x3P{ z6iPirl>gQ7eY9e9sw;*3zJ;9**x8waIcpHq%idz?<$URTp~aVj3}3beUkj{5Oz3bfzHNCwv**w4`49H|N1!Sz8BAa%%$I(ljMZ*L$Z(-$ zJd_%1$Wz{rRw_l8wr7pVa*{8XC_E`k=)LR6mlN?xp;JDT?~pu9R8=K9B zp$r}#Bovk97uDz}DbvY#0^=M75=$S>{~= ztGYs_l%`q;xj{=SK`pCYo?n(_Gw4qlMh!aTQwx^1Vk5eu5nWvjq}uDF;fvn+`VJ{1 zdY~M#YOkqGS>MU_Ec^1)NtM731X}FahmhYlZ(xtwWV~$NRRozY})?vFfjSghs!V&!l^N^i3|L`mWd_U9SAH;)yFrsuK<#Dq9cF0= zyk>cWvB{rnXskRGNbV~STa0q+LSK2r(!v?zR`+guemUTGm9K{pP~U2^5P>>O&#l0i zCI~UqG`I3DVqjz;c1JFuSSvOYkSzoPH;n__bZjJudy$9L_K^OYkj{nlcL>p?FMIOj z451ONd8G0pDRgiXtTJsNuPXBt2^l?{U*$pe;OlZBFaCt4!rHEmCK)enpo{s zEab_jX^Dm<;7y3`8S245kHC2%l&lLOGg)<8fP7Xg{}BbxLOPHp03lqI#=xb~aPny( zMVu#}rmhsM$1P`HZC}2;tP!ttTU+_+SyBHYjUC5E*A~mxRHxO2>J}iX&(cw0`nGpi z3gT5>V(6_?T}3uTB zDIkXE@cA^Q1EBeTd$ui1@NJ%{V0*SbWVU;zg6-J_A#;IeD%hUQh0L61D%hUw44Ivt zsbG7yBV=}Xrh@I+g&}jHXDZm9T@*4Gd8UHx*&9OU4W6lBd$ucNc6p|P?b+^-+3lI# z*89H7*8&@ekwgDIvOU{Z`DR-5%~+&}iXKag9*aeasOWFfqQ8knim2#FTBJGK+B#y= z8R!U78qmx~!9a%tARHoyzCUr-Em#9|Im8g9l$vTxHPtPyH2Lag;ti$Q;scgE`5LH= z1Gw6FoY7YKJMyS~d{fVW1qG9_W-1-qv*eaAykv>HLL`7>y z$&f16j;coOXviKTWMtHAT3V!t6)S1bim2I|05yLq1Yh}WuULLt4N=iDRs{fsM-lBR z#%96&sk(cjBLtR&26j~8IM+UEJW%nh(HNL zb$LeNOSFj3=m|2h`Ql9EUhNsE!fHwV=r)cwX5d@)G*_$gjK$62s@o!~V*IKXE&rIF z^%V=j`J+&~_5$Lp{G%-x@t3p~gpN~-DP}S=J7G!rhvXLerF||`sg(ixJeTjt*>Wmo zit{ovIkaRQlZb)#bQ6?~WaHTL zrwWE0&Qv=DAu;~Q340B~^5P;(L7eR_g#-B^xRl1NxH(;V>PBZ`3et9@g z4N)p(BV>63jHub+jx#CYUqO!q_y#EgEHZ?h51t`vk2 ztMo{{(-y)Uq8*JM7WE=4kmroEXT@BMnp_}p#u;CgrN6r^SI`P?StduSu6+-}Q=2`k zKNP~fA>2o3JTb7k79(y4JbloM>jzCqWf7$g3Mb_FSY%g>OcR-SIuuz%MHUH@NBs>l zL~#8L@6&|pC}Sc(OsI-w>z?Af>8YBV|-KLHG#!Bjk&a-Q?GCZpM$r$ay5k zNJoPpSDH=yNPc2hi0<}QrR2K>`Fs;3@d!yYK%#u5@47GPT1iIrK_3nI@iA?_sELkz z{aMrMpJ|;xq-g2iPq&7&9g$LKVyqE>kF+ z)$e)Bx%|XpA8{du4O0wQ*fk;X!ljOsxCw2Id5aVB)J%wq7?;%);11-Sxnx;=)xQhj z54=)e^#|4j1zwp*in)HtNc?+|h|K_BG#b@!#hA6OM$1bKk%u&%ig^4LHT4~2nns?E zIbxC(osW^%i3r_z8i|Y?S1l_#PfKue98bb#yEIatiM01se-4G)*(4YUvQmgeQkq`z z^j_tw-;V2PVj!+{XYy-8sBvOUE+`^K+PR zMiy``P&VY<<1~3_{^{ERE$kv-xI3@3ePO#O67h|4K$T{_DDA`6xPex!M zq&xJE5Z*)BmzG(#I&E_zc9N9DFp?!g-vc{H;CYB)DL2T1j8neU&!3X-Vphi1x|8?d zpsF~$5jgc;NM8=&2O+#jh-~DMm+DlI^c12O7NTRNIsh_I7D25`bqzEiCLd4{9*dDNMGO`Y8KcT~T*pYV)iVIBf!O;Hj{;47XPR%k330z%@4)Z0__%|e z&V{hc!^!E8?xkSQ!j&Oh9m2s7 zt`FhH5C;7@9rWh3^hNlk9SV1ZP#Qsc@)<%KpjpJeN)95My~c8nIFDkU3~8xuK1L@j zA7HkbJa3UsBKTYNRqe`R)u62}Qp#6KZ67tx$SQOyd5k1mu*(x|!RoaXpbQtiic$>b zvD}g?4I0bhZ54hq)8O(9zE^!shXX1b45v%BSZN|6`Sz>;!+I!|FV~tDOq5tX zt45-sG!j}vt*k$%W!0f=awEd*kTX-xWb#vk5Q$wkM#pJJ<-wUCW?T88Rsa?s;qKHH z!YQ|1eKTE%jWlDY^1Ow8lMfNj^m_i3Y#ZcaamfsZG=@_ zf>WdPfc&ZBA(R>^T?(NjOZtRwz~raiG`W)$y(eCxRBFP8)%3X#nR-An8MWr7o(yOX z1~i)fsJIBW{q%wRn)X@=4k+=ZCht&`oflF$O3*P1*{335e%Y(|nbM$D{C8PS49r42Lzc6ACHrGPPvB9e8T zx~zuy=jEa_<6CfP4ope`-7=ggI)_dasGO5_pV-xu)2VryvRqEvZeo=5H1{#f^my~r zl{VDr?Cfl+)7eyq1%qaBe|nuRZ>OuftEmo~;{xnzs;U=45278G@5S0Qhca!NLuq$+ zcN2#0rm9{kJOQSTw%Dx}5&vK68G31(?P`Yz77pCjDyi8aT+=|wnLFaUmguyq=GcLZ z(E!zHP@Pfp1qG)flpF-%>N2RVW~i#kUzaTf}-nPrMq!*FBut#T*Oq4~F?zYa3d@s*1sQQMS1B z=uI-jjrL%8T3}`!ye9r6%j@typ5DEi5XP@yxv-> zQ&R^We(ES8%$gb#p<@1wui<52lqW|UWSZ&m53Hm31v0c0=Tr(iEm;Z}pY(9X{g?dI z*^vKM2%jbt(l>2|i2Go*wGtE3X9-2mg-FlTa~4zC3#zHE*k-}hxh7DXO01G$lXEUC zs%ttnrA-wBLMaElFx_XF-fB28Lk}{>;chO9j0g?S$crMJ-s0hm94BTxIAGu+DCgrz zQRc6yS8UfKhaOCq9A{v!Guo!$oxU@o_>|TL?2N`dXt>H03^9x{-vzUD)VC=0EN=>Js zYZYm6Q^Q1AU_v_`BkE`BebCyFdZS_zn|LVQVCtMX%F;^}%^Gn+&S-fj&~Pk-8U|pV znf4Gxww5&Hto8R=IqaUDdSb$}Qfz{H`92t+cV3-w}pI)<_=h}G2cS?ZO|HLDwq z#$l%@RS0ZVATHt%whoYhEp}Q}z;+_(kn~lxUn@yE)uw$fyqdH#K}p(uTt);*KMkfN zw>29CP({j!y5iEE{&oz4Hbku%lHQ*5R4f#VnWrJgiRo{T86i?&{Y9P-9~#) zYf_4ZD(b+l>E(%bv`iv>HWltO7K>!jFtTIG6B`D@i7qP5Q9|2}l8roZ0cMKRG3KJw zi-A-_SA#tJJrCrMpGiNq(_5*w8-czEJjLZNsuz$*Sy zBaTbxIKqTxBi=G|rt!XCBg89wICGB5JUn>`8gcTFkeYmmn1o6O69ulGK_3KYR#8q6 zt$~0nHT$L_u0zV9u^F8tS13n{_4&GtoZ#3bzF(ukZY@V>uG=hB9K__Rx?B--h>Es~ zcr$}DYQR<+{H_@}D%OZrDPZXGw&m}5Wu4-IO7oB@w#s3ZKBL9IRo22FQrOu{p)ImN zn`@zvTv2$5>I&Zq;pK=fbgR>g-ys_gnP57#`AJI(ph`;$uy>lc-Zjk?!uJ9~IgwCi zd-mp?$8qSsx}*O9AavZw_k39^i8S@-jkBH-;b#)Ze@4zK0uT7RRZjv35{U>>}A* zh#zPUtN8#n(BL+wZ@el6778S9<7CoOxOGI8wz4^O-i(z`^`sf5bvi~oJ_!?!`*QevQUDfT>du_L_uEKMD? zsq@U_NDX)=AAUPtQG5-(X>Rh8mVQils1(#;e*O6;G?7oA1O)m1M}7T zlPlo%I;mLAee^nQ{b7&ORJe&UlwJH_h#G$*e>675Qy--gFSy0KqwY^Al>Z>?=66ws zDK{$591M9{bdm)sId3@|@Y6{|dgf>v(@MgYBnD^gw1<&;%){wi7^x*d%~DOzpy8lC zQ;RugjysIo4S&}Y{cTujxTVHMI9tw6ICJ~-G;UdNk^6o1NZL1}h)4`GLC8#MvTryz z6o?0rKfk z;%6dgaQYc*kQm&OKMdZfhm89CnMTg8kn>7#w)1CRjj`zmB8KT*Y3w13iN@ghoss9K zR>oqzGjF7^ix!hds1|j&#=xWuQ*sSc>ay~v!eUg!hLw%^@swN)?+2PD2^HCEhN;&> zAxPn)Gma4_F`aocCHz=Q_$6l*yLgfV3LA|zDH`AuOPtln5GOTgyy*GnB34Q|xZwv` z-K-nftPEyA`E6$29pRa`3}Kw$(RATgOXwRhbp)-H**$YPbm++to+ZS`U@4c{AhXT( zdhQ*X(fds4&J%Jf#b>!#bSu2AYyj{}Q{xpsE_I&0N+_*;r=gz^p6}A}tnd@UlMes` zq3oV=5VL^K%Ii{2WO5kQk7kky+jSD%V>;o=lvy+pw8XM#^@fKXX4ZEG4(ybi6D>_AG%Q}te@>b(G| zGxc6!-bgJ%&cIZ^9}249clhe}-5=CR(bMg=eMrzrpHICJg>&kn*MA~Vcq-MhQivL1rH{R#76exi!%#@5e zCQA1@cS4= zyNzpjn_;q~;*u8s$@dq%s!!KgQ9DQ}hqa{^gFKixpIyO47iXS{U9`QXe%r-Non`hI zeP>#mJtA5YhFD>%EMY1P6!JxL3D1CeQl_^GWZ;pUyooIa+2 zpq8S5$?gpkqY;0W55Q?nH_P!*izqrIrDrRT4?7Sy%$K+NOmkc4GRSgUG;*8 zQuHN@(fv)Xm(qQa;J2lM-%*cyh3%QO_RyX}h#BH(;tTWTUnrAv(d zHd+uqMj2uZ%K=+Poq5{mQLel8X5~}bBKE}gbY4n(fi(zpzmmpYwU~tPS`dPUg!=YI z3Ukq7^v+DHF9LOzl68hQ840ulN}xj+1pEk5o{1d;V@C6t%#67d6;Rv`c{EQ*w?J#| zhsnys&jDZypOA9F5%WCUX;4aZHCzY{HKCHS$qTteDK3Pf0wgL9ZwVZZZaI9=1d`_S z>Vh>Y&UWdUWCgdSl#=90ZcSN`HQy{|I+)v_w;{wde>uHUwikz z-theY{#Tu=KKXzB=Qnje_r&S7KX@|vi+}&f=l6ek@x7D($B%YhzVPS&_P?AiP5B)_ z`V58Nqof;)bS0cZ-51pS@wUdTNxEG~HzutzD8KhfHFRZv1COqv(G5$wmQSH>OwtWO zj}Xqry*4TRH&>(O>voxq-$14NjdZV4ydTN$ZHhN7&Bi=G)%pa8ZdB6sZ+@$lUyK#8 z`mIc&R=x5|zjV#A-*)9UORY`HcFB&e8uYuK1RpOJ6CeEEs$#essX@u?)^%T1}ar>Q3svmE+immBhF6YcA zXJKgEEcHq5m8$&P`K0!U@k~0U-o%@$=BM)!bV64au1z|*JIb$umJa&ocpJTqSaeZf z(LP8MIenPhu3Qu2C&C(S#@n*|rY>oqFh9)G@00Q?Ba2{&ywI&x`aGv!)U8X`9!1mc zvs!BjMXPSPlBE3;Xli}!9Eut;)E!*vU90rwqeDH5bU5d9#iKqBs*xkz^ZU(QVm`k7 zsebwudXlv+BVA1$|7@17Q;#)VTU;|DN26Rmj7RatHeCznlKnbz)}3PhncC0NvU66n z>M}|3P8VNF-wzoN?lrziw!+cik$Nb48e>Uyl&99DPqIYP@Ma!q-09}G*>uGGtJ8BB zipmSV6l6PFBmDL(_-kuGXHc z)r7=U^{Zd~>W}pJYdwC|zL31^(PW#8>+>}43Z<_h9)|7eoJi0eh`KFM)5Yf*K97>K z#)ReH_z@Gun)Zwu>Cl6}kkqu;>2<{F&+h}_7^Cm=$!GcZ4g0s2=dJMAoA_*U3wPV; z-)BQ(s`%ODrU$I$J7`O-Y1pVjk7xUc9g4}FVfx5@12BDZX-jLvy4+CT`O|fNnsCNw zUds5W5#?1rORi5sYJR~{!!!%e)jF__S`T1KcA$a{&KjPP`9=OV0`moGD!!F}UnKqo{@ntEXugde+)Dg5!?>QB>#4sUX!ZU!>*0Dr z)&Cr&cM;x7OnK|Ua|bQlMU6Yi-AE1bLS5ar5Ha={iH;)i| z1l}rt2v{Fej}Ut}q*S(tn$pvCR=xoY;@ZR17^1Duk+0GE2!DHc?jhxRsq$N?_b`9L z_z3yZezkd2CG`!Lu-4;QA?W)&pO~V@-@;n z042yF@*XBfH0!y6)NR(1@*g&8rH2oL=V53X2E#i0lMW4ncQ0x2Y%frs1D_~ST2K9{ zHE~NVs&^_;|7ARfj4q|5m*S5&Ek55unfM?}A+D&WDiue?E7_-Ea%8hK`ztmKwEDA` zJTDmzt!=ax#Y^#jgSCF!>$s?-doKVd5H*}A z!hoO=YoIbW!?0Kn7OUFe5gvOLTd9YYHX5?J|F66g3X}F;J%05o9$_AX1xoP9>Cvl4 zQI9Qpl=Mh4dSvymKIar`p82eUR%}!)P^sLY*>DD8brYii+S;9Al(a(tkKz@p*|ggr zcY)A%=+UMJ)EhUFM2^^BJC>5i%rB$eQf28*TMYPe-Q8q4dj4ezZcFQfwT@?5#>ax~?Ov zLwe;UOe;n?6|?WAmaE?S6^XShr&{l{^+mb2rNy#e;;f~^QBrc-eS6{{y_Ku&H+O59 z6qmZbyecw*9G=q~cjrHBQ4p6>E)RWyP0J&1T~g51)L(@XP|J~%dVVE@j2hYoz>aK?Dhp-v~g87^+W z@5sZ4$417Ej14DAS0-7wZteQDx2_#bl2w^x#UtxB+_rB0=WboI@zxFN*R0=k>z*|a zf9|$DYxeBjv}btFrlGx$+_n*GkP+AU?=zX?lXo6C_}HP5ukITw{*TWWZy6liRBURZ zxN~@jPdm+Ncta)`yrXz{|bmm~YXT72Zt(4)iO zIB@7M53j`@SudKOE?|>r>jM(SsVK76!YkHl6f8ouwvP=%dn51vhggFQI#e=ES>_Rm zy!(#P(F5PO`^f0n2z<<_gdWc=Y3jq3Yg_NGSS*>lrd}E3>ilVRr2*H-Ys4C*7Q2Rm zFJzM2?;JWjHafia&I6AgJg|Rw|JdQRTSxY26bv1D?2f%d2gimFt=%zlcJ@T_{dlPY-IQw53O_Ezw^M6{bR-3i;r96o2!eVp0Yxe@5(pGyCP)`kl!TsJ4XMJ zNJIDX7P{t&R_$~vYJ5X{wap;pO3kI{GDMh}HYQ7RP3zS|j#{ndEbiGxQG*9~ygX?bhKv zqeF+7UFM)zn*z;3dJUt+rzIGvkur}iTmy<(ARo^pOCCQo{K)X3;r)AtzgZkQTzq_t zUenV?*BY_@Ow#lC!$(F&_hRcrf8>avU7Sg796I#XBadPnop}`Blu7zN{rKpCJwv1S zrtP>}@c7q3U0m6k`9(p9q2F8;@&4&I_75Lw#@m-kx~#F3 z08u}-Z$#gg`tS+28;|GlyNAd29oXB_wOMRyBoT?UR|5Gbdt5_5jFxMK`;7^|hK8;I zrX!^N);A3Ds8et2#1{=>t}&U;5}f*-wOZ0yj;!#K3fSoa?u8y?!bw)o(I zBgH*K`-?|ZB?8_*HZoeo2pm3K96R7{=*T0F755w(9vYL^dFPSCV+S5h!N1^x3Q`V_ z4KWlCo1ePpz@v{I*bnlAuGx>QS7O(NXt74zK;=VaCYFp0#%$ z-gDs4=*YugX}B#72ZdEagOM7@vs{(v8P6i&Dv*0K$yer~=FS8A_Z&HdxfxsQrA?$Z z%D#dn-Fsxu@FB7eV^9cVhZ;2FRL$G|KS|3gGRY@W9&O(bi_=xnVc3tK7Y&G8?Twk_ z*6oMylx#;wQGo;d?;ZZykzu5@SKi+hiooI38^ZacO!E2d`_apx(W13;`{N<$t*%D3 zjK8roBqL3Z&*bRQd?x9>Z`j<@?T3j(x{qa&Z?M2a#qS$>WO(ecyASLgzWs4Maa^|_ z{xccxJEhLUdm*7E-2nLF5KD(9fRF~j>fipj1z$XH$i%vJai9Lu#Pkyn={F6p@!4WSPP1lroZB`9h#F`aLLPW?Z`YGyE@%Q$)_?&s}LmN zN52yEzEu#KAGaUg#?0nwpjg`fEt%vG=l15{$bM-5%RlgvMz`(@1!}fQ84K#b%JYz^p_;w#iltE*8XRu2GHKImcMct9`8RvH$#1ar*NoktN$$Bq|HXy-_Us$pdt`L@&}?OC$R-6znd08r zc8%)P3wj{Kr!R*Njg9OXIXHxS7c5UxRS^f&P>3FA{s&Xp6_dD_g=-!V7JZ0D7`cJAZM!|vNS0lM)-~2jvW(o8< zcdqNsZ#uHB52~vTs^77_zmEQ&aB}@;%k1kz^lC%&I(M$Xo$HLb0%PVg1lO5$1!i4m z%oP}8T6CQ|*SYiSE@!VR(0rQ|aZP)DWL<4!%{PVpbIj9`-Fv?Hz|MQ`xbvt`TAn-pUwNN(%-JlluBWH?Y?17KaTLrh+4CpEkL^70m&5ySfB3fB zhBoZk@VRxHZe2e-xN*~}?9S|s_dT|M4?k7hKk`?0d<2*w;h0uAUq#i2BC=}iJda9Fv1bEWrON{RK#wQ&7}TQ|1igwp zaD(G5FQpAKcegDVD0D0s;KF6q=Z50)Qe7WN(?j{v3(8wY-e%R^q7=lPv=6Akff5Z2 zG3}>gB+K(#!eM_f+<*9((oJ z#-sF-?oH(SRPI3Blqo3tLL_bFfb~(|(LT9VBu#FGxRtU98-=ak`En_AeaQ84UB*Z#oulD*)mdUeZmMW0 zcv6N`^+VtPHlYgjMLq6mTfpUv6meIw@wci=L@B8}X##nktF15QgsXfPmBom@lVc*H zyqz}J0D02-dAG2A*$NhM(e+l6^^Jkp`i^YuMnI4bk_{F^?mgao`ELRpl`*HI{9Pe_ zO4M_CX1=QXPsu6$Qsh;aW_4XAeaIMzTuUDF#8iE8D$~B8ul&DIqq79Y{qp$^UGr{CwzN$#7@5W7GURm$E_O12`V0^f_EpN-D?x*$=Ehr4 zaWTDg@{|t@b)lw9W5tal{f0MRdJ0R`#ijaB4djPBuPK9UCV{r>f;OybUm2Clmsjzq zE^GAE`ccxrEFt~@H|DYj9YMmix3X$l+ILCDxpFSBCP$t64m}2K6fy2SU3rPj+Os?= zZ>b^Fq`r|ssM@s`p{U0#2+(E=YnN{V3e(Q@|Fz4|-)mn2s9o-}%1s#>d({DvBlZ*` zT@qpCmrC8;mMetWT{H3$NsrGgnpNE7ysIA-9mfX+&IP+B(Frs!f80$WSrcc~cNI?T zN@LT)HIm8i26Vg~AyiKio0wKotQg;?hon<|D&pR4>i!+%^Ieb{(@7iwZH(^*0~|rE z`l|m%_|EC^icl3p_v$mG>K8)u9kFIde!^@XBuylZ%=#rk>oNW&99Sd7BTC8ij6ah~ zY64307+$OdK^7GYi zn^M-gGx;?lOc7xnN9+2kKNPI`H(?ghMrA?#>jO&Qnxl|eUv;-qOvlwts{FcAh@Ec< z3P@L5YuxU}aPF2K7$V8Ky1^L!d^SHm<`|Jed5NkMF=P|!e_fh6@t$z+P*NN#P1115 zbms$-$3Fsq*Wo7g#cP1J+Aj6xa>Q0^ouT6E1R&8PPONZl*+Rs7&G@)@f!^ zDnEHpWKSOD0_uYcg(F}2PIqW+a!k1$N|~A4lp)g5KY2_5V5v)b^+nPo zS0gn;V&2wwENX*)^0*P(H#sBe;<8yQr+0d8zjO2^`)GXmjlr?4^PjC&{dhdM^LND%YfDUjQ;m%-XiZf9aA|Z zKGn-(@_oh3t;U`j9hDA=YH}k}X@^agVeDdb;)-SoyFDS19V3p`T*!bih~2EFDOX#Xkgz7n=tJ=%Oc%Aw2b-KpepM^ zH>R!RElcI6ci7ZtpOe-oovdNT%w5;_9(3=yW=1{}7 z>P8r76w~!BEaNBNIuopB`>bpY{fM2Tq2A^k?n!5ydR={!wFM99h^I}pTE54c)}pnh zxLHp7IyG#YUa!%M=A$I)1>&*Z=xa0C1@Zx`aQd8@kq0=NTyV?tY5J&~Anj{zmf!fC z8?KOS4gGup3i{XP$>WzK5&ZdNx4?3x_a67-0-M_Ge4>gc8-4DH4%z!oJ zg4<^_wVioa4^0YZFbDZF%mRJRU;BO%S*4O5XIToFEEs>*8?BqsVPBS>)WW}u)XBv} z#+3b#se;y8k|ajyh;sMwsI1UqhaUGR?^8TZjw<=4I-z-uPb*1Bn4s+=OhSc;s&4a0 z-$^qyasoG~t|qtYYl>aagNdi_l+4HzqNw(qN^Pa_puWJQaiT9KRnLkp=GOv^#%V|G zv+8n-VY#@yQaip5K@3c%Z2v%$9Ha>sH0l#gj@9OY`U7+t(E1yCyr73{cl`rVucmEw zIj1bKd|b2TxJVs8tH)M7cJZiR`HB;W3#D-C%dar(d6+HOQg6g-gs4Zh;!pxR@7a zbeov4@uK}yI%UVHVV$Gmn;^DK37GYX5Ww|usu1!qTO&imAM)yt3f*aq6ofnZq812C z#E*0uJ$(?c)1&H&IUa8ln=&t9Ae-Y0Pin5|b5XwW)+rQB7L9U6>73d0@Wm);1h>WfZg!k6EuIB50k0IK3Pwp*w!huck*%??>qgZ_2i;_5_NN# zip5d%Yw~h`Vzb(1O$p27IA}6gZ?u7932&8;q8Y0yYeLn^8lN%vrj(&ETVNlWQZJgn zG}VkPkPbFeXlSXdkxa-i1GX$9Y$-0A@5u|Ks3SlEA@;9VZ*XcSrRJ07RA>xL3Ul8~ z7flIZM!PQ-k;edJ^;1?}AQk2qx~;iCox41(35oiActqARf4j(J+A!-n^%9vf){T!$ z30L#nt-3O(X7TOwQ_8XLPg!I=7{p5doTPtN+2-*!o4GHC30|;Ml8HrdO6;R3@$>K5 zyo%FFRUdQ8w9d2ohPa-E zlYW-zlUHmy1yR4#kBe(q&@n#7{WqF6SIXPjh)0OD#12BFzV#+sU9Nfhk;b1=>tHfJg=ewro?&A>%8@PIdYfH5(7+ zR=0I<7UG;BX z`txJG?d?nQpK1?zv8>G-87K(favU~cT$C8L!e1w3@6m}QHY0E$Y}-G;%r&lk%a32$70xS^QIkA-SE z_>|L247!~YgL1}~eMSr%Nhn%Ww50*D8;c7v`5pN}etrI-{NDUl(2@?Q78Tn9vtW+4 zbj4zdJH@t@`P~DBf?>jcDKDi6O02Ejopf0*oz`V~ZZxWy=19s-gylW?BfJ%%tWyG3 zW`6f4Ojp+NZB&&=19(z;chHapiLqi)q8BPu?dgDRYL4zq8-vQzM%<9(UwSFWebEG+ z$S7cx7&i*(*ox~Ils)NTWFZq&qAT0W$CeS1v!javZ_))aL7BQFkq&}hgvbY736!J^9*L>t z%`o)_DG{vbA}*>sp#Nj)lc*MpR)zp|=oL9>e!lcK^n`J@l03t@59Ve~=nSBD=`GK~ zP3g#P;kAisw~1&)es4OWBxEXY?lMKAlX?@$&BxYZ#i0>jvb@tc%kHK(wX$Ja5;%tHou@!A?+Da80y?r8BVnB2Ez(LG<~Bgl z5=gaX^gv5^6^i(TXx~DH8=YC&naB?0hj`o|6NTvES84O?fXk>v@%FbxUG z&Z(2~kt^BIGo#QDG0fqijp0hWvE~Eb8aoN^V@-OC9kN~m;=KdA`)YII71)emphajY zwF;G>+Y4otgOTa7nUbojJc3vq~Z>Q1owGcjJMDMWHl8KF7^YgD@})g zfd!LHpR!4rNp*#Fs`LvDnu4mT^p}PR$1$NLHY7C+XkLTHB-`8@`s{Rk$@%zN|`&7Ilp=1G`O|E}OBv~Xe`Gt_V9O7=h4SqNCzn{|%% zwpo}wK(vAs||HQTL!Ca=wdQl^~e2+RW4ee8} zD}10rP0J+qx*@Zf#-nzqfMLO2gBe(RxgUzOwzN!pjfr+^xqxD^iXg}mP?2}$dX@*! z1@!V}671(N<>`1rPj7);9x0=g%9N(^q%(xvK%>}Rsq8mKdN%k1i_hx0-8Y2FKQpmW?zfuJKR21UNOB5O;#>0N=SDh; zI|a%f+-OXwtQNDhmN^LrdS1yz1U=W9co&{K+0=8 zxZ8s-2Pj^!dP4@??oEd-N0tbNTWamuC5lS%>l&%6-Pyc9*M>omp`e*69_m{ydtD?ji|!PpBqp zZ7?i%aUKwg_O7Jp6o_X^;%zbLHVB?%#?kvp7&wztKHC2^)lS1+s>xiPp}?DdS#W*j zzta?yrC1V9&&BXMLP``)&cG}-K>#CXg)NWaaF#9HUTe(uaz#>go7zMYrcQ-kn9>IS zvtnCyn_1uLHVuVp$+Gt1Fly+sTxy4l)om6<1b*%Yea28!x7h%y?I=Jb8jxpm4lh#F z?L?(0a1!nGwZa@eT$#szz9Sj>9^fkg=LO^sF7kI;p63kOLcD zO5Fl!6_zS`8Jg@ZiMpXpF8+AK#Y#^PtAtFfaTK+1G`L3xBvq+Y-x(&WUMz)t|FRZo!rCbvMksD<82vrCN zvm8F+e~g30C`j=rPZ%jy2MEkg0grc4dk*0!k3`l0iJCA?0VwE2e2%`Ox3Dk)70q+*6LmfuT;+wa42A#LDqK2|5g&2NrMiW4eldi={f@s*AJgq0}^AZ>2x`Zj*Kd=R>yc5SGUup5q|$9zE5{u93iZbiTE$qUyE`=H`OT?HH?)GRr$;*p zmF}J%9epuWt|(Qu6%3!2=w^beXMJzNh^tQb$X|oe8UlN>*%iDx z{+7~5OqwC36Kr{VJYQKQCSz7AJ~LI;8IH;Z6cqexbSecAz+#cDrOo z1GgK*D@_pfA`s%GmAvL9CLtL*6Ngzm>53aXY;;gaHUms^JB*!MWV7655!W>o?4_5? zQ0(_2l!P4*T47+}ZlB5ZflKo>d{7`!F!K1MHv!Kcr8rtgptE*vVFcZufo{E%mLYzCmd zxra4~CLS5{e08hlVQu$dZm24eVlIWWx{ZV(4Ys4YEvroe?J6w7w^fMqn#eN$yhpub ztp0#~oFek7#Aw`T_+yW$Ki8k35sxPzz%x3i?W97-Jb)!^gLI^qKU&OH& zrxTc#<&2>W3HX^EY=J@3KZS0K|3ezLZV84;nn=77cHvvWjGHyrlMrX9yg>!%ve#|ry_bPv6)$vOh~w;ugGxb zNXia4l)72|g<2+1qIT30A#i`b=C-XiW>W%tkul>1hdq`v0c(zwMn=fTWpf=-Me9gM;0gbS%~jQ7pAAsoiN7UfQ}2fMY4(7=U98 zUR6V0zsQAXM9NETYKeOOm+FP*QS*}Ihcx_*w`ImgZ9NO4n|u@v(0t{`J}rZ({F6>Z zDV*h>WV zWiKAgb{LSQ7{@QNliNF(VJBCxo`ETWtQVLIVYs{z>>|dazJrNQzUs@KGQK~@EW`Zv zTp>#cW?xt-WDtp5O{~o9iK%LKp$0M;l5F*o7V>iOq=J~We}HJ4mpHX66H$<`49g&h zfZ?2NPrjGUh27y8XmBk@XY`;Rw z56l;9UUsAgcxSFNyq2axb}El$Hz2h(1g) zGi$+~SY--1uqxgF?uUHE5<6_@%Z){Pg;~UVk0&D_P==l3K*0*8C2~g_2lsNe9~Eoa z8sE+dBPVpB8#ziW5;Fv426}q%CYTB(*xr17r|t2iXNcJuB7-MyuHw032w^b}3f^9{ zEnxdGzX9vy>SSE3?-08Z`B|pI<(swP^tQ>ctc9o9j8!IW&K~=o3kCHZVfoCNUSB>F zf!|s(|1{*3e=4m+{X6hVETmc^y19GMcU!bRT%OT_8==KzVK*M2s#1lJfzG*B4bz(& z(G4jKMG$122W(M-dXQCmswR&Dq4 ziw$WGTetkMNwVx6 z40?iq$&+K+k~X2O5yc+heCskK%*^`cZRI5;YR?*m+Ot;jmL)20nR>EOQMu$9m--k% z;MJcU5~|b|t9Jow8u`6MTLa#1Q)CmEYM&|Qe7LcHR(sJg1yK6o`xiPgZe6Lp=v}G3 zs1dIwZBVNwDu$++;4~(rrGe9&B&WYDRZ--4o?I-gU1n>)IkN{>rU`~VYPf({0X3}C z=p~9#X9AU`YVT4ThD0#CVisbQAWGj=qPi?)8TOb_Ze5OfHE@$BhEB&=?U@*>oQtvA zi!zf?T&ZdQH^aV(Ixf?wYHZ-#kKEhd*AO_ATOC?)&8bN4ci1@uU9gh$>OwmH%%8(tV@J7O+}g49iB0o1-c99G;x-Mb{FceaUS0>ahBf(V^f-~2^+Wg zGo0HWmF3_Rete-#6f4ZpQD_R zbm|2P^`gKiWq>Q^+iL|MBopZ%;a3@9;7sf?PSxe@Xwc>BXg{$dL?Bs|>?W$k zH1D{XHEK5X?>4zqA5^Q=O`O-4$cV82U++$MF+i-mgcn**^(E~}p}KlW!8E<3kyCxp zbC?!F4XEwZqD!@TJDaqr){q{u?o9i5xe23U=mwcdi~%L&$RW^E3j_3}{+4ZjfJOe7 z_A(i(9GOT4*r$LO?5pI*$9ir|=xB9ans(JcZyb}bviy!jJQzRU!&H>t9oE$r*SgwR zex8N3IxpU%ojnMxvc{q*NHKySazL!wKJr|5&za+%kK^qXnZ1c~Z1PH7>d%_Fw^%Q7 zX{0E!`uf#`=>?uD^B}emi$K5lRjI)%!xtdq(>^HBQE)?ve(5y9NefS5X!!9KE0JaEK|$H~2=5a+u(32W^Dz+li1$JMrgir?Rh&!b)oU;w>(wx1q}F6S=%Pdn`wagChYwP8?r0lm6vy^#1k3Wntjf6C2@pla zdDB{U`#ui)Nb`Tqgn*jJzN^0XQ{~Q^0EvA@gB(nhRqq#(OlMjl)-N%)q6?QanJSdy zfRU+wpV6;(k0Y7B>JNY^5PUq*1iOx$zcX8dqexhNkkD)e-J$B5rudL;c~mzof|)X1 zynuH6qEy4{v@xO_}$nnM`$(LYlU9hj^Ig;Jc@B ztQ*!y6>RXT4NcmftbWV5-;uV{RP8wlLKMjz9*}Os7k+gtdzI)VEticKi%F@hg=)fA`}kAT85&5@}#9x_OI$oq<-`iPJ5Zt zez#~>C+_CGHdBxR?6%5HqeM2%r&)F>G=J{Pp~a4UA2Ayj6N?+tcQe5(S~PgEmS|#= zJcPKqgnHEnt$Ot?>!v?F3+tcI*hT*LfpZb9zbGqB^Ozt8F2(OyTyuePohap549Z0V zJsdx;s5=ADY$-R+`y}>pKlmgYpo9>O20CaGRxkq@n$b_82l~WDn}+h%5~!7{$I8lfDF$9X-7^7x(5Te4ci*;nTAY4+aj|T27N8 z8^`(GP&dF(?|@Bkn<)PiM-&BOol@4_I7?ZXCVW)y{K#Unb1V{24^}){EYvR`bei_5 zc4E}E<~+5>_i%JXSHx|0Q{fNo9CbfmeuxVOt0DgD;`W3Ufuhw75Xe(6(DT(bIw)c<(@FU2vg)@Pw%7{}XH-wB z2J0Z66YqJ)-ZO^_U#Gkz#;ThPz|Gva?JAA$;6RHVQBqggU(?}Vki4QK_*vW-6HqBd zLxHE@tCgh(;9@b3u@*vMNzZ{eW?_&XA6#S+p=RGzM`yepCMb}r+#*(PP18an5rCOT z0j4BPLzYu!)L?6s)=4!)SzO@2Mw(?|G09S8OQL9kuy|iQ$(NQouysa2X~#m_?9_Uh z_XEAq{B7pw98xH7c$smG^?U-?lp?jKh+E{_ zM67Y!>OB4oWJ@PHts8jV$7KU}>Sb8|_;YxKFzPv5sVkJlJbqT2)GAiQnk)a5ttJG1 z{6%{~%kXD#@haQ)07~DDZoHQN2JhR2wU>pi_A(u@M$g+ouiY%+uqqF0b~;*FVD7wHN1Hk8rnCKPhX-6qdsQKCtQwG#* z9?I8#tPN_vas z|H#3bY@x66&4mdsn{vIp4wD|S6Ra29UF?0N?>wX&lMe|8feD$=b)ZxyihHZy7xYc8 zmkrJ3dJR+f-J`I5jBMHa6eHczTbiZl5$|N?7Ras0#kV!IXf&Z}{!)gQ?I^kB@k2mx z5A@Z3&fdIsq1lz|uo7N(_h+yHdNJ=W`3+Xd{tOK_=lf5Z$;q&d;t-9jZhE7aRQ~Hw zoe9eI^3Tqg>3EkY?d2T-t#CU-Jef&Mrvx%s8583sN}>r=EN2rC7@fJ-`*A#h z#i|;LO<4M&lxb9u5$QgA5iofVvxZ=o^HQpj!wz?rHw9n`0D42%QbQRzEqcT2Iz~K) z3d8|ImiOT&51cGeyeX5}vQ*b7lx=cmTMaeFf$&n@4DjRwI1Bw8r$LPTTC%^rzqpXm z+em9r(_FufyqMBHB%GD!B?NBOporh3=9kdAg)Dm&(F>yj1FbEMXPIXk2|G#0P*}vE zBGCVE6ntE<5pU@5vb|KIEg@CIlLs+Jz_FHWpv%{BBNyScQQ+7X84&kk*f6A)#ym{6 zJ3Mk)t~!NYlWL}qew_z0)g2+QfbF_a3$ZHB5HlEt7&)eA{Jim-7$^m_rm>eJH0LO{ zAmLC1nvXN>&rZ`_?f_w8gMw8wf*pxb^66ZGz%0m&(R4ZoPg+txko9PGy=(L6XT3bK=manL0 zmnQ*2h*Jpt>bn84qBp~D%;|)YmIAe+2|%Io6sQ%`x?aw#q?q7{IwL%@=<@2KF4SnS zC3fFxG_W^n=%7Ar$a2LlEEf{= z^&h0Fo3knBNB+&tdgs)gFF8iN%ydQm&CsO;jzHIM1!I4dBlp2X1xaNa@v@4^)!gLqlT3IKi(Y`CFAxyiO>Q*B=Q1D) z7=4E2iX`3}HKl>}H&vBxtfWQgHOJukRh+#0L<%a z9=y)smrjg1S3_w!lFudgho2~9vYlG)=)S02r{=2O&R!2G*4e+#PBY(qlb0yPYE0qH z@OB$wh;khiJ_8MDw&zK1h)gj%GJPutIHp5-5gdRJqeM=sX9MF-m|(n4fm0S<$S=}8 zi{_X{dU2B%+dK7H1=^a5wH*{+BqMOmo>RGxCot$T{~HjPyaxifDOnhc(tI3cHN8#NU^O>h$&Vqt{IMd}S6ogzkYY91%bEiz7XO(lb>5O& zy5K%w1rWeyPDu+w2ncwi)=0pNmNb=G(o|l;9$8x1nAZ!`GIqk!Tu~(9^s4{;Y+c~V zyknysUvTpB^5mvLJ8IIBM~(Ti!8Knt$P0rRepuX!IHjjJm|=UbwXlV(o`fZ|D4fdi z*JXR9NKle%{I(0u!A;#T(uq@|5Jw~zqB-)cj7D!r+N@aan8z#6E8YVLO98#xu2UOq zxq!_=uz|#*=y!c&%2<^=d9ZH{icT#$d0C|020a7ldoNS)(pBeCyyS^$wNQ*Mf;q( zWCP8~pw<#8R5}zs);bgd{mYY&w+@FipPE-H0`HZIpaku29vaOEoz4}l!y^S~Avd_~ zc9{(9n_5ZNWNuLiu*j%JRZ!Q>5R!{7m{@{JXrr$wO^y8Qtf`!Bu(v|dh=^%|brCPt z7HI%Yg+5OvHo52)z_%Er_D(KnZ%UXzDr;^g4z@)@L+3sO7(zbV`_bU-b(v`h1BQ*Zz(Gv`(mjR!$;VSwXwBE? zzfuuHJk{??eSqH|%tY;HpN+1}1_0NG z!%X$AYUtS&@i^UUSnftX&EH~k2X30fRO2c4B}5#7*Om>jS1Ot6{lpxO#yU>e@6TbV zmp7C1iTU{%`q7_!a(;HECEyv6hl{ClJ2R+|9_U4iMRBccri{KiSo&>(j2S*txPN3R?}lRiwW+)2*u%gW!``e}|Z5&;ttW{-?0}9|8iRPh-Um zYOYaEQDMJVVZW~d41`T<2xAuuk;nI#51=r(yba};RRZ4`=CRt`*%wYR zh8zA@6Q@I~1@NyJ%mxq~rdEDC6ne|-9A?wT-c`#)#?*!yPUTh(w)w29E2(U6X!fkT zT(7D%>xS9!!vI0Lda&IM@pAQb{>gE<-g+~?GLyFZOnNQAAlF_3K{n2izPK_&;M0{~ z?1*EBe4BF^bn|3R_2TW#g>);(FKuTRHQPP;(JBvCQDZK~2axj>ilF0arBl7kibl~q zXsPRz;Z+%F^T9NexU^x9nkVz+36>@*Vrv0ST)AwjS3@~8I;WnK_Nl=z4fC54SPn;*2mV~s*bq;L#{b9K*}z#)34R2~%+EqjQe}B(fd!2n? z^mad=Kg`+t*}wIyXRYcWq_UNX#WS_H26MUmXQq)oP|9U3wrUJhP4-Tk2`WuBd74+++VllALumf0 z`-+kgBuz^OG~Y#k(m3d7YF`&vZ0Z zN}#;d;^UJ%ydEj@W-%*5f`@6MMXLj#$FPDhq&U5YXqh2(U!kQe;g!B=$xjs8F$jL6 z1cGH_4I~=ot;k3^;Fy?^fhRslWTlrmPV^j-FM*tD>D8v>j*}7uBJXQ4=LE<8r$W;bMNMSZ#+S_>GfgiuL`M1*))1Q5;Lf(SzM`w!v83w=EwhqS7b_IDqt!dT=KOtQ{v;4^!w_gd!?ydv9| z0G{W{SP8W*aNY%b>wY~3ugqLbXUbPASUxIN7~HsoDL%$!gz>*I2EnhV=ui?7Lxv-F z-&Aga$zS;JkR#Iz)H)Xdw@sHk;arvPN#T)U5V8${4$>>x$@Bg#LXz>6U zSBTZtIMr|pQhBa7_Cxs78}lJxM2#k&GNNjdcB>Dg=76X1=q#!$Rj7hbYp#7-^TpR; zu$WqXh#IKm(0`59riGA_CMQrC_F*(;wBu%LYJF1Ln@J*P7G*@|ln&0U2=g9TwiR|K z@HS-|72xXmS+M6_{iAJT(1>f3F|*^mclD3v+JtMfxw1XIclD3v+T6@y-tG&{o%=3< zBZZ8Ihn>???oj(>ku%TALs^f9#9yDl#>iif8-JtteVkJ{O_9GIH~uE^`&6X-&5^$z zH~wZBUz(=W2hZbyjbTT(6x8mo;6w^>S+WLESJ-Fq>PU8FhB9B-<%6vZ7J z)F-MzVp5r}Ato<`r}csqGFH1HYG68@rwpUKzCpY!!n@-mMkq+m1~6_2_l#Ur;`hZd zKfb4Vhy`l^H4pLT^YI~?l|8Ik8QLvWoqJl#=~-&&udj2dpJ+_pm?wzyvFSVG^X!7PI#?Wv0| z%$>E!8q#x;2ytgL93B{Jq#R{F!^#m5OdQdo@qDg2a6BvGb(2?}y~P+w%RqWr@1xAv zsN`z>&K!-12Bw!O9?ZGgiDki=-0{wd+!QP!z+gwAV@q&1?g zNX8QAW^ue2x>%3WkYY#LaNY=^stNUvHuGV8mOtxRfRXyd>h!q+UhS&|mW-80t%dPW#inj<10~eeUu*xhvvLaoP9dN8F(asNx^IaMkJGJ`Wit*QdMLlB(2*Nh#4~R zv7x$IhS>@^;a9(1xq&njXW0Xm!J2a-?Y|VTUG2zrxz{1dD6JEyhY~z{RR&2^(2N7G zT!-AKk~00fD>n>RiCMhW927mjP+XKI15!85_yo2@S(efWuzWEAzWA&k&5I8)c*R3- zWD6!siSqJzbZ@cjP$MLnZ}fuaMFX{!!*pW%9}mOmYUrgaW`hOIA0UrX*FIq~#!A*lS_nW_Cs5y+TY`gsjAmpnX&f zYRbt=IYY%KCM6%@6B3&iNMBWF)11%FGqFJS^jSV`@%Sh{;ZV%eXB~j$Bd7BiGtsms zMN>k2y;-2%e9OO>)J!sYAy%)(5ko|qK=ismQQJt5&}yL})vfgH|N5L6uW1I!2a7WF z=yOP!5YkL8>{crtaLA}?Zqa!#zNGLJwVhr|Gl^Oj3zOiUMNLl~hc7bhu+e>Cg|BM5FBH4xw~fnE4%nD_ zgZ7erWnljFiqx~?x)USOB=P&_nu$xZg!6JaBfL3^ZuWvP3(sGs4)Ki5snEcZiflq; z(;JCwsu$T*6WNrC3@kf`6&%vA^iDhzZB{G?MV9NsDA&S(!|OV*q@o&MPgJ89MXDO> zGA)LsMoih7>Zq|6SmX&pSbt|~OvgO>rp%fTpTmB+S6X7TIh=C&ko@*U_Fb7Bjm8W4 zs0M#nTAIjufBGIzxo&8)njr;l`LFk(HRGz~zvuA5s;^P=&T@k2MN;a53^q|0Agg$N zfMy+U7+}cex&WJY2rwFpMKSnzqc{bYx;T~Vqfs*;6BgSOe32XLh=9v%CRzTEr>> z9pS}uYVhJYEWXkTQ=ckKJ!SXz#d9b`RGa(}bFRGgp^wR#yu8)ok-8PTv3gQmRtr-z zJKtv7XKy$^VLg$AH?2GNQLHyal_=Y@PXxWZS|jW6xqm6mJ{s6MTqozvRv)s zeHX8W(NtD_zSJ;QUifx4?RY3FLPtp5LElYJl*zR~VwZ6&;{br3k_#9m?b-g#=ofga+VPLGJnlU&#oI34=dz&*T znYx1&S}`Gs=9+yVr<0)yij`nWb}%xvm}XrZBhDz>n~MsqT4qX#P(K#PTE2#rzJS)s zf|cCFFSY1?ITjO%$B7be^`FzaF|Op3FERRa>A9~WRl7Qth(_-aT+sSH(a=}IZt5hBhbZ6eTf z5s)GcT5%+ZuXYBek23eVnZ3ZEMHnzJ`K5Wvjd;brB&eKB=Y4}=rhmzl>4`-zEK*?< zVNF8orpO(*lP7z-@xS;QrdDFT|0CAnK}`!m%Cs2RYj*~j7o}BA@i}Ijenp8YLpX>A zWdRZn=x~60++#Zhe5o<1UU-hLCRia6=6WLG2N=eOX<&bv<$C((VNvtcoay_x&8&Oa>4?;;(^NxRD4YO^6NBtOB6Tx8*Q?u^2BS&{kL&&n?iJ z`zD`R-HUbe`Iza{&ap=u?Akw?&Jw5hmFX;1ITn?hK&sZHda*qWJm+uPl!)29m+aQL z&2DyzC0`}|4h}M^ZE&4FU}G<#?xKC&57n~)U+jo?pdyLGfg0;ndmiM#031ZAdgNRc{s79{ zJTQ~vDm{4srqx!V6@6ibO{h)dd*?oM4-ObrXYHnLEyH?q*OLi5-Z_n|=SUmjt?)ogn z)OLp0SefmGnWQSq1-)PY2&+%v6`BL>ea5G)&$b4uF0!KRH=jwns`ee9iV3wq*dWCh z?L{-J7+G#C*@$hcBd!fgL^q>mYSQpTZ`-D}!y_F_U!=->UMQ8;b{_Hj%AhS%FK@_H z|ER`Z%7?yM1eVgQL-JVwPgq@+df`~?(AQH+aMvCtn#QXOiF$#OYSW&nM@_P;<+l+@ zSm?A=Erm4Jw&+&riizoauxZo*F(N03f~jw60aUKAb~gXTlNDiYxf4j7y#Z0YHE}~g zzU)VP2>yE}QN`iQKGfxnfWpwKDaL1-9`>DPG;E!((1li)SCuD9Pw)C9XeTgr^jR3% zLke)NdW80eVO*&4MhAy%SAD$fSViC8eC^}UpeIAwoF?=MWb&vJ&)S44)nD1~Z?0Y( zy3i<#?OC~DN4nPaauz>kwxnK82!-BNj*kqG<|C<=F&<7&(&H!ka= zd2Z?oS<0;fKnifuifsg#sUPwk9BT~kG&CE;PU+s8cNYT{a?;A9|DKp+u<}4S1tEBB zZsao`?@exUw9uNP7nU*zjcj_3Y)z4kUP8U(#+qcg$uTlhJwy>THlc#qgE!52KVRj! zgY7CWA}n@Fl@jAIzAwo54awyLoE<>H()%ywxsP~noyylDV zpt3OxnyB}cDx&7Aaa=kGlucl68nnnzRl-RNwN=7aK749qlPT$F#h2n_53PL7*c>%O zc)Ic)Us98f9g8YF(b4x3!^BCPAlW?|CDk@o1Zr{eAD;Ut5Q-*NRR!_BjtKJ&ZJH(N z9KQ-yTD*50tB2xUD`fWWC~7TAmoCPog&Z^}DjRYbP^Kyx9P_V4)RE0ov-{|o z3>(1F|I}x@X*CuGiY`{6bye#?4Of}Ym7`791S+n6MknZq=iSmEYFRYU6tXC!HUyla zI$b(c7E*9)TD$7|JGK9zoR|5eIx=d)CCh0qcT-MY1Z7fRdo}8ZxU`AMP4CgoyA5*ioa+v}!Fh4b=p>#HRNS&qV-f69#wU97M z_fhgjn#r^nWirW*E(l{RMgp|Jx;APPm2y*)uFcJ8tISb%{Q1sSI=V==3bO{9ju>go z^t&cm#6sh(&X;w;)P(au_FmOay6`3ARDUV$p|O`m`Vh=eEjec4TX@Zw_<0GNKVePy zvS221VQ*cr;sdqD<{5IM^3>iqX5Ps&CTd_vQEclyh3(3;ooiSrVnb(EU@M-YSv80} zD1_@-^B@ea$K}E@B#&t@o$Rs`s~=-)(HFZRdH*GaHnyegcz!o&FS$IY<96ugPswEy z?IOFP*|yP1^|I<^^tH!wenuvKe(;_&xPts>4@d50$5g;_hE{YG*%oglTls30S{mz2 zJe9hDo9ww-N?3~@5oytJ&Sjl;*TP0RJ4j)>7~8y(QBvnx+uM>G0|R2IvvwFF6}9V& zZS_r0i=Ezy3e^V$qnc{xy&cRJR6Fm}n4_6OjSEHOB&|}eDe#%I! z^DbO&*SPXBOXTgiY3r`~q$z>c*Y4AyWsI0!w7nIf*evg5jYv8gtDTG3jIxE($6{{E zn~hRAyn=05m57znhZkNwkW8&DjRj5DYZ4S2lIN`ub)8|=h9B6SZL}gv-c>In^RX9p zrPF`)#u*HDar{p(2Muv`hA;;U%O1Pfe-tL3TKF!J!{gez9$;5i+XIqgSbxg9hHBTt z8aB0cZN_?x_j$knaMz0@k`o)rJte4%(-NO2mW21R#*SUD@}L79&GB(QHn1Nm`O@JRU$I}M9p|Lnlxa0OhRhJ0jcI>Y}@mZU-usz&-=h0@WPPz9_g(Iw9%udPm73S0_Cm7q#Sm7&T;H9|ESRfOWiaeOpz zX)vk+RWWK9)G(u(pqh+ohH94i5seGEaScyb*wYo^X{|l24Nn)_)5SVXvxSYFS-GSG z2$;BO>$l^b+q&-y8Bf}!QT{AP9@h!CV9EliT=~M0nk|$(Dhe|OucBY+Yo)T^f3%Ko1)Ru++xm+QgxNF3?=jrDHcu(`N8_-S^#rA)XMeV_ZtJg*ziex5 z8`<_u(caZ&037_ntOom8&t?N}j(@07rZ1z|6QM2o_BXSuGrf~)&vEP}&Qyh! zHb%xhcFZ$3%AHL=ybu0!Y`#IoSPng>n6lW6Tng&ZnGe;Tv#p@Wy~WV;6%%pK4c^*% zB1E}XNasg^XGuy#g`Zi}aS7#@scn^LYNfHV z37t2@n?NcX%gnZZij^k#e8|6Ta=crl*yyJMNQItOinc9j&uU6u!cO!>+h1J@r6S@a zGwpeA2OhE^H~EFfo>TBy=Ibm@_U#`@P7<;v&M09#s{Hj%Q1ZBS6iT*}J6gZJ+}87a zi%y}kmVx}x{7_r}7}Tcj3a6k`V|A`nb-U6}HK9qAcU>PH%t>?F9ACHr_oF0M!6K7OcJ=+|g@>+U|{NcnF<-gp{Ft_JN z(PJ`mP=xslKeH7xL4zx(j|}C{e7z_Q@W9d!yKB=oJ=3irGA{=MW&d}3KFY%Hdj_pi zE>NQ_8@499x7oK3=n=IulEDhVI6IR1vS&3O(K80X=W`qc%Oq1QDimNI4&)Sd!WQB8 zPV1ef!bLezG4DMD15ty?9`h=fmWu9+p(w1QJCf39s@(Eu#=aM~j#l9x&HOC-T}#EP zdX+8!7J=1}Ann*b%?u6`@g?*WD|&nlY)x=2&n>zAW7YPM+6is_la!j?3z4Em2D7#2 zi|uq=-@#y7k_Z#yE@_gZ;ulE>X;+!zhHsm#HHsPvaXL&!yL+pJ>s?(YN}lk?^C3cI z4!?HjOz&DA%GKT*xN)VXL%owEhvrU+!!T+7B==@@OLPb?@gNJ(R0rJ^H-_>iw;_*gV_HVYPpXq<5~RuVf9Gdb|i!^Vrt=Dg~Bp{xyZgk*_*ngw1m8T0z@< zVOlPi9J3mlS{n&LPZU79pPD051p6wAVBh|BJrHfMB$vJ2s5qENqixl`Z+dQV z^mLAZto9w!p;ZxihJrRF!_*o(9UD19mAeis)cl zYr@w>eC7AAc|}O-O)sXpFZ6%d2LxZYP*oUKX2?LcCPi#0Q5PX;Qm;N6eKrc*0rBy1 zlWciDlh2w{^~?8(9QC2^^Lwt`G+TXN;_JM22m5OWzRP3m-35oGa6-i)T_A zxR%SdES;BFBb@(qG=6eWi=E=?6O8d;j&7I(VdL(ed&5auo@M})P$X3Bw2vqG#u?1# zW2qSI`Bpde(U$wwFe9u7rR_h^f5M)uitIoGzXYrM?0h#RJGdPZAQ zttjWj)^n^~&$8=zy7pe6YuDp;ebSJHy7mm%bw1a&-d3Ym*mb5|*O!Pgq3EIOS6p>; zx?=E@knWL&|JLx$M!&3U@1=H~Z?PonID%W^Pm?w^k(o3o(mGpOF?h@;rV>>Jm17f9 z8q^2DNYq&6Ouhtx%H*eON-9d)EFLmNOe-ieXP>zF>+lfYBZL#jT#vV56%86{co`9_CG=qJf9@j8gT^k}& zrf>6%nUPdaBRNJktJ|&$`QH8iAUl#C30A+kaG-q zC}gHt>B4qlJqPN_(KYh@f+Yzn=o*<)yrYzhWeZ2vl%ekwvT&x%y#<@o0VRgavFim~ zb^M2TECw9^A*L0cX_FOGJMlv5)63K*6pO9-#RT%b=ycLkCM-5IX%rWOSe8f_aJmF{ z->B=N3oMehyS;fc^(>y8+FK)**eHj^R6*XFC6xDYy0T5KWGK>Yi(WEhydkCv-qqp7 zZ~7^e&?TtVhxoLLnPf~B$_EVMwakK26^V9}O zCcFVlc)HjT9T>TI4xtjBDMizk6h7S4%8W=9VyZ>8W{gpv>oigM)l6=7Z_1&U^&L7LP?hf9P)fu+}2R49!OhCEW1WmkLak*W>>G- zEe$k$Y>LGi2o^Rx*ocJiB;OB~8|YDWjiwtci4O^T2#M91_?=m3V2qG&U^9yb{MzR3 zjI%^F6!2uNMCY37eBWG*R_sVY=Ngl>MVwnic8xBP3~mx!wA85Vj5fBdV%yrF03NGe ztcS-4`eJi?LXS@vxlQD@X4Aye%rdD_H`xQF24%40feNZw$nV)O&r* zljpAIOoX&C*g>$^sMI#7UQ7cC?7W%b4Y@TqQKNQoO|;nFY~bV+oQx8ygHu@%BbKQM z8jCm1DwZ9TM>jA~v+j^g4?k-xDl!zNlBO!~uBp2>RBWPjL$zy-5x2vr`O&-V@23{* z2C=R&@^-u41<+}ipYAGE@8=~?uD>Z#`vt@3nmneVp*lFdda-zzdoX=58 zuXdjZ)_uA;A1mi$jXYlD@gln>+qH8TW=*uL)R>AUQz@{I?Pw18lCru-lbbreOFwzx zKw31(G?Qh+Np#^P^Q3YEla!q=GjxU^rQ8??TG{7dD59o$7tkU@y+d`aae6gDPOgAR(8hSL<@Y2KVy3h6GRJ>pUAnn$;v@-oh0z5q0C7lf+K z2vr4L&-n_eyRdshBVMarv#MQBS37U5c0Ez;y1Lpm-K=ICtIEj!S-L!}7~LvLwMN%; zGlp#zm(u|TPjAEKy0%uk+pAsct6dn?N#fherMq3!dR@$%PHK|jkVDT=qbP*Ivyejv zSkhR>#g)2+Yv1w1)6!)Nwy4}fVQ29c$EPH8At zXGb32Ns(|xlco% z-mWxnH{HFvQMDFzW8bVqnc}G$XceJ>EwmZIy`?%hAZ-sAq)M}I7Jo5QWoUh~2$?9_ z=%-wSW;|#$ zbgis*>Cc!~(h8RoYxxc#Nj-X@NVz2}D^Z=VR_#x`ov$h;Z9NYuCghY6)E$BH(d#)@ zcQhtqq#Sv@5;(%GS-BiR*(eE+mU>R206ZS&E^NcRfTQZ)p zgvq7a^`hVx1@|6r9$v*TpBMP5W#!`pVp-*-!`L=>waRbrd2NF$;-4&Vg|&g|j;*Qo z9IqPPXk_(R4LZ0Aa&Q$*Ggh=(Y~mbT74nn^Nm-+OD*`7KimMTc6<{FL-_bFgzSZC= z=E|6IUJs?>3%43qX^PGue;o)7PZGLrjA}&dDN=M(7x7uorI+*ksQk>GBDaoX=r}U( zc(P@`20k?JI*zix$|8-|bEqJAN(oPA!wvky36W$*#!$xOS?ccdeMuFs7Ip53h$h!9 zCsf5Sh&Mxn0kYaPCi~RgObk7&tQr%Zx|@0GZmu+xv|6>;(Lpul)6vl}k|w-|6QQd; zoj^(TKk6`f$XML5 zzOIJGuverbmMwf7%O-FLbssDLKs}H z%wnLgKnHJ)6@zgKV`4xl>9y-jYw&tjSP&~3F{mJ;-VVHlVsB6#(Ze=D? zaqnDieSY&!o}@Aa)O`(FkO}slL<>S3OeNjdG^0q)>8vhf z^tqjUfcXX}UU(SE67B`tt*)Y6`N4z{G!jfvdsTKl|CR<{0izz(4QEqPunc&nf8;G- zz|S$l9G(abgj||@1L6J1`ht&Oh+-inJx^eL922U7{UgiVSE&G+h(0eCi^8bzVts=r zE=&s&A_B9s5mM9O22Cq6P<@va{C zY$>aM4L)S#qaq(QQp2CYEk3LLa}Umt$o*${i3e zX%NY{Ik!7?d+!D&l%++P{0>+7@77^X4`x8L#F% z;FqC|2~jrBng@zRtGqF-76CP#+2^1+qQ#jWT{>hGMeE#m{3KPJ z$DyJ{={F8o%=l{GNhpO;7mIE%h}mrfQ_n;ymMF*iPExbcy=4N;#FB~1D(%3FD2DBC@u@qx^pw5m5g!wSveV~GgGs^_TCf`}!wAR?uwzQa`_ zdyZq4*ogN9f@6()&S1`OcSqxlpjiuX>gb3m?IoqXYTkOc)MIPv9=kP^>K;&sx|@NzudTMxk@nGK*u;wn z)!2Ocqj>Sa&x$~AY?Hcs!O|MCySF|7{Bgb{xk9zWU`lTjjW#>K7|A^sYl@-kM(UTt z84`hX-KZS0C!5|NV;BUf6x$Fj)QY@aWEThWSTt;COK-$3~>zyF>wVsnk zjgRu@Eoi|2FB<}RT6Mu`fm~7Ll?gGCk@Y>AQoK+J*n-oD?1Izc;|e{l*i*`rm#kEY z$^@YK#l8ot{r7mR=MYLFp8Fn5Wic~NKO-${ zYIiMyLK?49NKDsA;x@LWWe;DviC(SPLt7J0jn{c|2Ol?DWzcyu86EJB1~Q=Ml$w`X z1R_6iQ4GtwHdL~yr@@MvU zZl>l=L3NXiZLHcvnIh|~=%M5?zql~Rpm?jt^4Qzg1#y z_xVNB!xX=Mh@zqCXKc>0UPLh|MO&tD)N0x~B!$N7ZrSquJ$y|B&_Acz-@zZTynzl# zwQrpzw{Km_L2&(ZhA9=nJ?Oe`-P;?6TkgvXMt~iLo?hQN#84Cz^99c2Wo}mNjbi~r zH6kg2`0rasPzz$0&>s8Nh0qq*{Ns{iHJDp)rN3_6>El?@s6B1TzYy2U2N znF%d;^wl^qvjN+ZlcbcnbfkQ>)_;%K%9vQTs-o)PU4lBe%O?*}NyXZSw6l29{vHSk z;X!>eyF6goFvqT^+2Dd9gTkjcKBhX9d?kA5MER>qr++@n)9ApR4u!6loPICjL^F{!KEmO=gU%?7EIC{b8k;4z;fe`X7=Lizv8KG0KV7o;SW& zIrgtg!1s)ZbI<0M>H-azdNhTxU}Nm7^gmSX5B-OJDy)=TRU_|#j1hY%QtKj>PNq_h zm2)x@f8Xlw3-&8(4x6`r1>Z9D&!d(1WZ$xC-!ddwi`73brTUf;%f4l*>R4sHk}AZ~ z|6AD$^Dza|RqeTkKc(mz`hk{K>NC1O=u>^@o@;3PuA#BLMk6IuK}%v22aK8ow)H#( zDuGYM?xtmrwYcT1AgNN_8Crb^)tf!HXY$jc_6+)GNeX`{@uFnEsNqxhY8K-1M`XKK z3$-beCG)CF&H`F8PnWZ-6O8ImpJnLTUWZ#Sdz#j>!MDKIzon}3r(Q#~|7l-tCxS1S zNLAC3B=$mz%Pt3^sSx~3@iwpDvc-^0l5 zZPSHb2yfRJ`Ej9nrQYXFyXrJWKtIKJ$$2utB^QM9c)T9ntD9 zJv#+4lvvtJisMeL=>MtyR{2cOI>BpBB}$aMl%A$qzx&MAYa7XNA%#1)ilhb=HPN zh7(jLykU)EvF#rself=6MW|sUe?cdIQNDuhl5_7_Of^VC7xb$BWG(kOdohy~jfRFo*|x75`g zu|{hYeZHP)l>PmyT}5sO#%YVLqUsXOV@w-c)C^|N{_0heBint@^jQ6blSV^6exm60 z*&J0$YYs{@^*eJA&qY5F-ie;46x8=z=nui&lIjFf8N*sKu3d~-HM+7Eqa(b=BK?f& zcWJ0FO?w1O;YW`q{f4QVtE3)bgP(;O#QL@rzi zxlpf_stZ+}FI;8}U1I2>%4T6by>d;zK;gt{I0h`18!gq|#v|uZi z5E^1XoU)=sEyd&ys$96Kx}+CLOM25MrEST=^hr}4O9q&0tM;sBv_`T3_|T=Hpzj~a z^aM<0sAo0fI-J#`f|XbE)!uvI?Y&oTAiEyNiR@&h7WtVk=TrGo-;!nN)75&qI(<@N zm#j#iR_Tc@14BBSpjXV-2wRhKtkcsvvaY&heRau(YVX6<-d_pZ5Su|k52qUFW!Vcx z#iXVb<>^+Vn`jiw?B$?5Su}mOP-#Rs5+ibZG8$#>zMRQFR6+4k3&R7; z0S%2j=$*TEEP5ju(KQ*4R5 zl1=6>1QVXs=}TRVL2(x&gT0irNyZcm&Se&5A)l$n7kBVq9h!Xxw5{Zjl++w$QP9w6o88S)F}0mSB6aMRROj9Q7dB?&*N0&+5uWbBHjn zw{YPHt7aO?wo-|;xSA3iNtNEV=&WiVqn658b$1tC%973tcDw`8_Uwr6_&kxkc^v_? zgI=zLdM%8nuqOA;&imtbXdI zOWJ({eGA@o-N0X4!>~sCEMLBfU_d_CF6z5B98hNl?E(z1oSR9i0C zpx=PDMa!sk3}gXf-~zO5(Y1D&Kcs36fjZMnky+DM?ZXt+F$)WQY`LxvMhkb5qnpiP z88yPOpt6z3c%`mq?P$X6oYb_AcD^7dqRdq~v>gYOOphv^`bUUL@Or%A(0E`&TXpGq zXv+VUt4lAaE}dUpY_VQ6$4uNOK*w3aM8?l4AE5p#XG&K`63I(>H_*1|QC4|#4zxHd z%Y#6;gXB6tm;Y;iuseJ+|E}UO&K)i*8ly^zT@l&-sdne&T>&iKr6|@tEbX-SvE}li zs*wJ#o_o#nei}}YToSv`087%NF`ae}b}gm6i^JqHs;e%VEVW~h>*-xlf1H9<>b0d& za%x+&wGq>3#3ma`!-lbggzTOGRQ?uiQx$L-#!K_vS6w^ok8Y^{G<7iFI?UI*P+E|1eR z8H7rJzvwYOF_~;>ma_3zep5r6y+!0S&g#;2z8oP;B|<_;0egBd4v}bIQRxE(YfW%a zNuI*BYKd4671L#H*wPJj40cGFQnP3}vbFY}X!Jgb|K2AdH4v}%G3&GRR>|z_ql~cs z9M8A$%>Gj86BsJU#8x%QNaEIeN<-A!U}CrFncI^+@|rUHVd1BY5|!+K%@fb%CRG z83>Z{ow};~;0;`*nhL}k7)y9YLvp|!Yt<_c>M4IR>`2)$`tqiln(G7&x7edQ_GQ?= zu|pZa2owq@6;!_4<;v&7T$dH>O1#u_(pKVpTG&v67D>yfn$1wE9j2wF_P#dsZ;J#L z&66t&Ad8g5c{q=6Xe4=yXJIeYiL_QaaMcPN1xQW4l@!w0%?noQ2AUMqKtrkWr5-WO z&FNHpn3T7JWvz(vO7l{2Yh=1fS!HLQT3S^)%xnz8Owwag6YH57$_TlHRUe`@#`~0A zD!pp`4bd8+gf-i|MGOcJbU?K5ObcftA6`=0ddB8k`m_G2Jy}8X9Znxwb(vP-S}Yf< zph)kFd;Rl5|E$lCFiHApXF=LJ%4OrD<Rr^SX*0@!%sCgL20D!Xt$ED2$4beEpw4`gXqGJBU@T#+R zzioi&M*mf?uEsM^enTD#2phRQ1P^C=$@&95F4&v4UdFcBUe}#0TNvtet}JRBbx{W6 zUCTbg9+)a?YWHl*$QtO2-+rlyFPjdf3hA$06p4>5PuuwkI6>`B^g@gZl^e@m+dQ(#UdHG`rSMz zJST;Z|1%_=Uj`u21!)7BZ~93#yCkdn$fD)34Mkj39Ou*|reyhOt#ykoJ4p187Na2~ zTQ~%{H;v8ECw8?5mPE&Q5fO5hvMb%3!&S;KO`Fz8dIV@iYMX@`oiK;Mk?TXA3&tF( z@6K{UnO=aaXB%wP?BEH)qSlrLs)jp)C0uD$up_U&-Xu0eOrE%{N&)kVlUj2%V3wu6 zHri^eoIRV?@$;dW^|KukWdvz`Fe0tWd}X5`unE}}dz?|zdlQv{j9PSJN}1B^qetn@ zBJIb7X*4B@ddrJ4n@hWWG^|!-P?hYfsHl>bLbT-tzew*)j0)^< zW&bplEGZG2m=)XH*ld!T8|!bZS2thmchcOP#tCu<&rS8d!c*$GN&jk|o9a9_hL9V5 z$nlnXR#mIlA{Gs{kw|gK#>T^>`mAbv36_3T>fcaLC#y$bepA-}KX)5tWaL^b>P5df z8*Ql^XY}u{Wb%%=@V0DJBV*Rn|4#FzXf3(TbwY-U4mpa%@m71tIpufbD8oKAp*( zOu$B~-&V^7|Gb9hNDj3K1%hMgG0PVyGd@eS2;)(%l~ zW8@43Wmnqp*H?&ioR}L^-M7wK7oW179@CoDx>4HF)9O`9I^t46K`iwdNZ6z|)WWnv z^cy{+<_&z`OzoL}fslr(cm*%z@{F{lPt}Aj*j*vp4%XA8PkqN^B7M1?QcxeEa=BeK zrNU#_=&NzAwf3AS?w%&i`rf=sp+_&dPgt8UF1ME@RLzij^yW_UjHXB*Y|nW%8g}Z! zxSeH&A#~cI$Fn71pdT^70c&kL$5uk z+@y#5;30GFP~F4(q|R&{Q$~8ML&h}Y{yIV6^L3@hKF1E}Nu{c1^12bXW_$Ssq1k2- z%-J8j7~k0*WODYo^6R)^0Q7kAm$6Nz7&=pc9<3~YhhpQIDU;IJ03DAY!0SndZ&P77 zr6tL`P?Bt|uiOjO9kj3Rv(DJQT zc2zl|6)U#k=En%jA0uMC9+eVRbC63u4o?`(v}BO8P5NXGxk-cEfi*!Yhvn$;QVMz9 z5jl#3y`!lvo@q14nGB{#S`~{{W>WbUk0J4r8RTYq*ZOG#8kPPoR)e=B?F@5NADe-vgkqV}TA-rY zQZAZp;bse>G+m(wKaRFzQ)qKA5h7-OdE=~xGNrZhkv@$kPwJV-LzO$+@4IzM3K{J%QB|d#y;a z9#H03v<|+R$2x0>mFEt9Kfq?`Q_*g?X(A~lNihFBi)N+3bqg#;dKT9C;HK%SaI@mX z29f2dR58+WI@zHNQdc<4C)7W&j7nV$4Ym1|Phj51xM8=620K10ZK`%yZU9f6DFkO? zYYuwz<8wWP?RJVsjr=*?a#5Gn^yBi zswGkfU3febV1$`i!OI)-pyjl4mL@vuMGBA4aa2OJutO86xy=%TTFs}=*L(zdV`snE zJDwC$6=D+*s;}f+$BkK+801O-r=jRT6noL>A9-qS<{3D0WIS-@iHBGNz-<^?06uE;q0;D6E>ekq#MzKrF2W7(tNJFoi4)EOBE3IZK zq81+Bn|BOLIiRq(*M|j=hV{Qp7^GoIR8$oYO$saIsD+`-Q&`Hpx^w}gVR_xY?llcd zqGDK*w_{k!WrfAPJ}iJVtp8#C5wvehAMq4E$< ztvrLPn5v23btr_Q1Bxz7S%`reVm?TfpLWA-_cnDa=w8X~ zQA?LKbb$6Tti4DNeE>R=yQoQyn7u|<7yl*u(17BOl&fZju`Wk~=#MS`6W(AVn)Rn- zSf2Jb8C%S=G>E0;3-{wwM&1uk<2P3es=)f5D~yHWO>^4uDvV{dBre31bGkUqWCW*a zij`FsbfK(*2pPr!I6ENaWUP97+O?d@goe+uSPPIuG?<;D2^yN&u;_lAXAS3CRN(NZ zTHwa!D8|!sYq)FH1`c}2URt&1Ht#zeL4aF0fB@gNbvjnVGAD6scAswr`=({y1@LZQ z(P?Ida%J1ci;8TSA||5|8qvmY)#7^0z*9 z+WW^$e{50t)+0ao*|yD%hdSqe{q^Nf7FynP%zr$x=tV>&YjXqyrH?d0sMUg ze=~9aKD1<=HO${dm-y-aAua`YCLxm``8Vy*oVkdHD%HL1&Ky+hpK?Yux?P|q@+-N+ zBX(?{O72||n-i%sBK6ToT@x|U0K$YBDC@=YLC?ER=BDEFD>t$P{lK;-Rar~<8P_FOg zS8^W-SjqK8Y8BLfnCs8DdMR5X^<<=8h*as%Y0BH7ypMe%_VIu7b~?(v73{tIM!7S& ze!{4pfR)@*C~sG51J&YghPszui+dze&qV6gNR50t<(nF*!=RK$jqYuMYH=q-*N;Z3 zAL{e`O70G>KKAzo>L&LCDE<3T?iYb7xyPY=?mq|h8Nz6B+o2TGk{kIqe7c51{v9luod}wzEs^tC? zN`6PV-$m@HfR)@oB2{@Vsakw|R~REv8uP@~*aP|{1uy#gi6DY@a#d%GIt z#z6V>?h~oQ0#$OyLHV@3Gg5P*R2I;|r&H=<0mH7Klt(RYd8ED=sFJ%0O7?tHw5F1~ z9n9Bj4?_9e+6v_@;*%dwb9L_vQtHpq_0>o<|26foTcjpI`LxZ5)Nz3-xw%jZtX`M3~%4>2D zD6hY(=jYrMo=R>eS6|DY0Ohf{kvcb0-B4fPS8}&-^*+86UGIqUeiE@?M(V$#>+hrA zry{jI@-@AX#$XJT4`ZK*?H8~XcN~;Y@9BXmxr?BDUUotG^sbE5hDd!E%1i!P#5P0u zls_L`UyD@3i>dDSfI5I*$-RT?9HY+U`U#`fa`lqG0p;c059QC z2SE9@@tBCcAIeMl7?jV2Pe#`PD23MIRz}zBqwBYWYsuXgvCR>C0?JE%21;!=J;VP= zEo@|@_J;D7^JXaTd8<*Qk@i(aLV4G{BegG-&¥dRKHk3Cc@8 zH&T~JYH6gdhw_r|fKu();x+}>M)#Y@_t%IG-|l@hx>12Dxv@|_v?-CA5vk)Nbw;Gl zgYw}nh}fD)-5g!-j?^!p)J8SBKR~JGXY3NFl6xt*ayI3wX|HNGC?CeYP`*UHGf<80 zyoh}k%9o?-BK6HkJp|?T{5vRLgZwqRHounoofxU3B6WJCE`#z?2BEx^_0jda5&Jci zkMnbZYH|OB^1av5|4d!?jnqsi->RJo!6h%JEf<@}40x&!JFekJ!mTzwtJ zNmqeljwDbALV3T(N9u!t8s#p6QaNgI%bh?X;&j3^m$uS%7mV2GM7d}p=Vt!yPzJA7&W(gd#4!gkD>V6OMSK}$V(S|fH zOcCl{^EECYj^flVO%aD6A$cg4_YxFhRon%Pv$}|T@yZ0M1F(TvK97Em~kqPc}L#8lGczmFKt!VJ&3#q z^;pK&XAJp!MD}rA7S^xky4)h#k#Q!>ah^L0c-rn##v^y32J+cbS~ugFMHN zxkY!s@f4Qi+ys6VkWI#O6i?m~4st&*o_B(r6L@}TNPk2Qb`KbGM??;BKQUx8h_|uB z-A@hqJ&3P=-s=9-!g@X+&b`$=YCPqoHJ)D^&$xg%H_L4^o+Bd9EccZ0{5yz`^D*ve z<9YL>H1uQKUybLC$aB1V)p$M@kcvCr<#N*b<(#SQ<9wnk8}g~h^KLgRr`oS4%6XsL z&3LYkJnwTI#G&S3E6+=cE^ zz`u#jAb&EaXY^wM#%ICfB$> z8!{~-pLc&XWEO~z&r0_XL(T;8wsD<%)sRm_p6lE{4e5qu0(o32Sy`ZYJskXy?L+yNHW;SssX9cny3IV$*TV6l$lQ0`yrdK4evn`D6LOC6B-eU5LOyPC+5;jv7nrZf8J|kTll$E#jpu^Mv&ntdcs?DFWyvPjX~oH_q2I)2Au7E5|e&`k@ouvJt zfK=QM-IW&B(*bcH1BSeqL6#ZfKJQa1p3fOFF@s!VVI39_g>|j*d?3T~1=Gf*0a55{ zjAv!!dBFXLAva}^+YPxpgWO}tPcz7UhCH4@erRF65ReM}hRw#)xFSu(Z`>Yv<@+8P zWKTm5&ma@?%J-84QgOd=lk&2S3j^|W@*8(hURq^ge6Xmk?r`I|As`p#wz?w>*%*+n z-0$2>3u|jYoO|5OHsmiEQ7y3U9^<5~;S*b)$x0_UE0qmAcF0jYqDGoE{bFXvux zdl|AN`g*}l;XQJz`&0Dwg4@S_l-8RYDO za`32tR2W5n*mzEeJpXhTT73RJASdSk=`J$l!vUF-ce&3Sa(R@K%YD(1Wf4hoYYVc3 zbrC7&zH4FK7!cm3=Qf$Idjm2d*PQ!-@jMuLM&$m>kS!VHSwo)8Ab&UHl??KdrL^q} zUSk!OE4*T1jSWa|espe3QQDXmd3Mc>GvvsC4CHss>2P&yK7&jvu5r$t7Z68J^eu*5 zkwK;xmGT`Y!|0o8K+>)*{_y_oskNN_Nk^-+XP4zIM-@ zYB6kDwGMSB>X|46@#khSh0)9hSS*koJHK zv6Tn724A#*ZFz9h?>8RzhZ*vQBt2jg4xlI9Com`cB(878sAQiVVApey?9xlmNUkJ$T zWM%FVle|6htjhh~kf!TXJzt;uqanLSIJ=Yd|i@Z{Rd4A;(2u zH|N?6IXNJ|N^Z>^X~>%MeOME6-^d-;puD&+`ub+>-G+2!kdw{V(twcU;Q0Yf%KerR)-63-^=~Pkbee*enRdg^EGTu zD(Ba^F^tn&-CiKd<%P+wbGwz5ibFx(#joPF<|dRK$XOX=FGD^ZkYe)3+(9O%C-OXz zJIs)4BJy9kqsnf4tGf~8`}`{O@8=lL!;$Cd+y^c6KSbo&-05Yd{do|d_Gfcvn6HMl z9$A*8xT>~;Q_m|v94LL9(&*jcHWL89;&s}K9d!wAc<}Nnm^oaZ|_bEdzipUGO z&l)lik-z7<3|W^!dJMTeBL9=?H{^#A`A6<5Lw*~P*K*ex@_a=8nOkFNZ}?K0c9+~> zJbMLXA*=7cV#w?avfhx>0x~k^lCK%^2@vJ-$Xp@$X1SAm?}|u6a+mR}2)>?XV~qO@ z`DQ>Wt}*$M#pi*5Fq51-Xgq(6Jj0S-7_vPgBa^=yGK%#xzNa@KX|2fWrbc9+WKu=B zJS!lM@y`t7IVB)ZCkG^l8=`eMUe5I7=!$H00f@KNBa?GY&b3j_%w)d#S|5GQOfEK_ z`y$UV$)$$;X9l^fBK`b6`Z^~0l*xHEAm1q;lYGXI;yNFny$WwnIt|$^AU`f2mn<}7 zpMdls5D(4 zc}_|0GM-yN?&8NP$Yi6X;?DtLUMsoJ;`3ramK9G;?l&a4!TS>OeM3fMkRMjM(8j(X zv-oww^MHkQ22Y>h=iI+14_jED3rGdz5tFkaAnS`~B)>CXKL`1}`8qp!%6MLjzRphm z+mQCJc**OF^OENbIV>P|7C)N2U~)bJ;^my1{M~r^0}nG)$t#AekI2W9q)~bLaPU=e zpGYdK6K!>m2c8Fu^OF|iDSp+5UU3&EBaCNMKprh#kxVpXYCyJt?A5pi9UKSZbMT5} zYNK-JbP&a`;;u-h8FESBDdw(7-fD8z1f;@9_-%%K4dgz4BXgfkjy2?uJW0J1iiRlAh%KhP)?(utpZ1k7bY#n4Co*iu0qzp5#nJz7&uO zDa))dR=>)4ssR~aT9jOE$drf- zB-a{pXhfDKD@@LNLA+L%C0{U}a|5zp>6+wbLzV=jy>xBz4MR3WIV+O88dY!nG|IUy zx!ZVt1LEU+U9!=Trvvg}@r%iWmdmBDrMY~4@-yRU4@kvbpZvmNI2lB8m?KJ_G@hdZ za#Cqs@{A!L49NQ8`s5{x&!<6DzAEl(NrCrDt!@#BG`6g`A!#2b>wV@p7j$?_GRkmpCT4&wFm^2j* zxQCOa@U*%;0`k_zhm-3JIXEJZB-fj-cLrosu#HYYb2a(+M>8-J7BWk^pz zE-(Ei`L^lj+UV;y$#;xrZ9sO#*Y^#%Bg69pLw*3Fd>>!>ee#gW`C~xll^#oeZamKi zWJ~GsWV0dpn^SA~L$cM7(Ghtv`JEw?1G1&`r{pn14vxsS^0kPR^AinuFv_Xq_cCPNzxk3ouQV*bk0DzlPgDNQ zhWt6oY02;3BwPI_h)T*^8;9o)XzIkmNBu`yD%`MJjP2@us|CzZzKPdDW1fUGZ$%YUdz zCHJ=Ai`mBfM~&ycfb3V=BY(ajPXwgBv}gVzLrS;$_{?vZlRt5Z&&r?KENi(nAQg9Z{vzYKKO!H^&o`beAlvv=+(r3?hUCAI zBJ=Z$4C#o-CHcjM>>H83{FR2xjL3rgfFY+uWFS9i$axVN%r9w{ja>@jdsa*HOO0nR z@+{3SGoIBT8U^qbP=2`~H)fElOdA^mQi11cLw+8StMZ>WxUqzC(mp02lDwt46RSHogZ#nLbwWT+EMK4BW^zu?$a%(Mcu~gJUkvGv zzSiVlG~^2rS(|^!kgsKsf0*R&1jMy+GDzN#KW31rEh;;I3rHVw z-rS;ehCC9GRpkx&pIBJi zK#F&$7K_0Uho&xeAe$M?z{>2uRf=dHZ z0eKl;&MgYaq~z9oZn$_pACQgZTl2-?($6gc`BC}n`C-GAJKqfmZApF?<9R3`6_8yG z*%sy8mLF%xKO=H`eosSMzU5;`4>rHga5tgVP0S$s8qdA~`B8ae{$N86i#*@UA2nQ- z@UDRLx$os?8_yX5*;xKw{y0NE8RgucKf#cmDChh6_glKI1^F^RzA4O~YCN|EqyjQ` zxb*x35T6%6$zN>96Xrv2$sf#LWymWL`B{F&aOGF)ojEs#U&TF?|DquW@uXFlLcV07 z{~J#q;O9WTY@uJwlh#;@=LVC!lqapP6|%w7{s2#s^JL-S{4FN=NuIo~pXa}2anr`>gc9Kf&QexASA;`8o+P#W{E8qdcg&u{Vw!B#@9`krK#AK|9~MA;8EIVC;y$FkFR$3+Ef>`@l5`5cv{_& zk!O4U8kRS-y0ZgPaj)gCHRLl9$ro0dug^zc#lmXi`BvmTe!@SzeePJh0hvNx+j%tu}Wo}{6kb@%ffx=b9kQyK$vy%@NK5sl{Mmc8`RvOQ_k>||9b%tCLkq?6?UER^w zxrNmr1vjQMjnBsl*MqdXrGaN#WuUNkRlcr`zLpnG0BLvkM&zo(`>L|up9Exea&2LW z`T9lVxjrB-2V`4iP2n2jX}{NpzOAyhu%hZFIQOQ2tWMSy));bRL~abodn597A;j?9 zfK=SQLdLhcO9Jv_;k$)(#xoFkHWt1H((cwoD-RDohxm z8sPrGGr93U3y1TCHSg8~^0Irl@HXQqf5-cp-1tc0?IRSQ@d4>`n+xwT6Yov5| zS3npq6sMT4Uk2nequy2A$Bw`uF0|hI}$06*sr|4og>mK$2bN7C&H;zZ#I=jXJA%mhpTqB4-!RH95Zs z$R~FBf3&>|oK0o>|9`EuX0N^XM46mVvCWXmX>v#+=aPhpCPE~lo|1&dq3m&rLZ&o1 zhg3p2BuR>dgi0kTD#WCyRFtIpf3E93tUa5j=lMRr*Wc^=eLbJv_jO(O`Cj*0>t1{A z2n`aOW18fbzB4pTi2JrG^X}4jg+@u_@|rX%GaxihY?^42UwTMrf{<+MH8eCu$X(WE zcxalCQJM@YJt8zqB0sK46z?MD3t4K(!=Z&z=FOV8rKg6LNSuS3R4Y3*^s?Cesmaii zQ$wr8CS#MT#meH3hh7tMjV9-VtP|4Dk|#pzg^bf=aq%ZY8-+Zl$zK;f5!x(dizU-S zTZMeB$=u@8LfeISn^o=uK;9QpMU#RHpA3B{Scy<3yVi_Z+D2zgwS_hAzj@~S1XLa9PN(`07xS)rmrXsgQW%L`|PiV3M^34Sge zKmUOf0-CHWIXhGeHbkv+mDe2i=}?7IyqD;%ZCbkvLAZo>nK-2uhiXZj(U!azswXxx zG`YO|ve1=6mTQt|m=LUV;&uw9jBWyQ}z&j`6h6Swpip(R3^YVut9 zFGI_P++@jDp;x4YcbYgQ4}{(jGFFrJr4ENSh}Qz^btJS&$T~}ohPDaWYsrtHof79= zJ?f%#JoJgQ>TzuorIVr0gq+r-VUg3J1LAew4ppzlAcuw2wIt+!TZ(reS(-#C>>m@G zUJ2v}u^DX1dHx9@qby1De-p1snlvtw=ARa_(30Z*pF&=@q@+)!Irp75PAT6LQjkDW zgq%(w(b94^`kty+YqyktK7RS97**9IN`}<4q^w^~Y+71U!LKZ&qa`uFhLG--RP`^H zy!crP@8Vj!)%`2QrmwZR)W2HDU`uNF&4i4%q^93O2;X0*-QeZ^b)|VWO|mw1{kCE= zLzC4P)%Dv+-Ji2IP5hgLyqrL~O9|I#g1arhr;v@7wDfyPb;z++} zGRJN0_mjxc_s!0{4G7<`mjU5_QEKDgC8VY$*ZFss_E3vvmbCQ;B-vc=4-(SX+O+cr z3(2wM27hQ0Y47JGkt~0>kRbO?{zxH@+Bi4)4+)uTNwyysvci&^{n1k9H#AvAz5Pi- zwp(($|Ade)6Ua=76O{ROf4}rwR$$@Oi(eke1eKk$-`Z zn=M)Fr-2atJV@m=$6e-^F2g1Km$t!P0)%Jozs8yJtoAF24WB*Wf34lMeuj_-t=Brg zYMB%`OweSGyWYQ8;yk9wQtzF!$X36WlyJ7TiPBa-Q@mc#WQX^z-=t8S9o{y-sd&9+ zy|($yg}i6UcE7chC#dNT|2nZLur|9i`Q4IF{p-c1$cLuxd;A-ORI=nVzk`svmhAPj zgj{RMKEIQYZkBxI-z4N-OAh)s3mId{*M3(aPgzpncN4P2l5hMTLe^XIt>06~$CiBO z-v&Z7XoRZ89QUYyyR_jq*5(uw^n0*s{pAl35{xkl4;1o~_42}lghW0v?Ncl~LL!@A z;fdnUM2-}jVAK^4KP)5|tL4H|gaj>LK0H-O(DD_+c@nvz&FiA@6JiteV3qJfA(_^u zdU%m|U2DnZ;gw<&%=dcXRYGpFHVwk7g^ahPMR>iCC6-(t-YO($u}ssraTbQ_2npKo`S9gJf_`5Vu3I*Q z)_B_1YiYQ?)RdnC^S>x94__r@g|%4~ZX$7l@%&1-mDp^tHm`@mHHp&h@I>({`H9NCeeARFV?wUdtW*^>R? z*<$mtB?rQDh3rlsPYd}hfy@)KFM-S#@>K#^Amm^Ic}B?L1hP=bkp%LrkfRCYIUzqJ zkmrT`lt2~kWgeC`z90;!v za*-tm!>c4t&=+5aUzM3s%f>kzUQ@Ox`l6#It=)p~I*AipFTM@GDI{1Ej)vC@xy8mg z7TzG_9!rjg-xf03lGEWWLZ(}i5_wn1OO~WYJ`l3Wl46lhWVC#4$wiSpQj2dasSLuk zIHO5x_u|NB5+_(CE{*IH64au0l1ZAr_>PeOtnNbATiLUOFlwULuTf*r_p zk>7+&u{LcZzY7UUczxs#AwdZ{M*b2Kl<>v~mE-G9P{Pg;S4dF8>`01`poCo_zK~## zbPImCo8v6B<>?+t6%y=`ZjBTX66}$BM$Q+q)_V1d6e|}(oSl~37P(Mt&REhrQc_5X zJ*H3Zh*Si@mj{~6aR)@IiA{5Bb00_ut5$Hm7#68rj;|@VTAPuPI>;R-t8JWdkp>cH zq_vr-NuDK-L>h|CbCx_BX(Z%zOD07c3kj}qlOtCP3FhEqk!I!iioer(31UcNc&`fT!H_O()P%`;?-N*R4MyGWQdT-nyf6jE0QDRMNNj5+#MM%WQQf6 zMjn*N2Q`V(o=9A5PTM$NL?%jkD(+R~`L)bfkw?X*p(aC19*RsB(nXU2CBKVI6%w@J z@yHWGMp>_4Bh!Q|uwG{(PYKy!ZQSTgAxAa2F+CccBjrikXUdZnotIRL($Qzd>k@7A zPPx>CqUP3ES@qOS;f!IJdo8X+HRvNAm*`nnMO7=-KrHl|mNzA2=J zB^O8E5^|F!E7Pk-HwnqroL6cw8>qK`8$uzZloVjkzdMa74?K!>ee ztS0YgToa87S#3$1Xb~ZYH944ZUGxGW{y`P_#`F%+3x!nEWI^d0qa}qj*Ca|eMav24 zq{+dIo1+zk4Ao>n$sW;4Lgs2Rv}E6C6(Jj}&7IMzLcX;&1EST1q<*c+GqmKO=w(7K zwj?K7OGq#WM?^D|$b-?#%cr2l8fh{fRax}+XzY5WM%mo(d&gY)ue6JnbD3y z`fGAy)p^lQLMCZ)N7d(|*+Q0T(xUXDXjdWcXoB@QdaKl{jD703EP9*Re4}lmv?6-D zkUy>0s%T#!l@6;iuPnbV+F!`knhY)ZX7nB*eKi?S@}1~F$t&1_Y>(bAB)IB*5*;FB ztoDl1=g|j*%&_Fk=rAEKS#mHsLde^e9F9IHWTz!RM#l^J#*$Of$AowVsuodlQm2>a zJ!Bb8TDxBAOtA^>5W{DYBB}F|ywXyim%3Nfab7A_LX(=B9IRR*^##>pniPO65z-2Z)lQQt#<0xB%6Av?-#NuRjonlheZd}2IoL4u^CZ$Zb#D@B zmbyx6tx^` zhN!hr^F(d3sRu0k7V3FPEs9?#St6<))UrY>6W;*fB&@LBP-~#lXgJhcqUJ-rE2&$d zK88{rdxY%)`$E)LQ2Rxlg!)<(4xs7ORH&n1I7bR~TvF>m{UWL})Ne_w57-~VCP4iy z>Ln;|8n?zLP+?JlFMckQ&Jz}fDv^|06pU-$fJ#ACL}~-#U*}*IqXt%81I6`7qnk8K zqmefC87S2YE1@ofFTQSosx49Ymm%tj+6$%Hg@3`J30Nkbf@%hp6?c7=N1`fo4wj)= zjOswOmdGuk+KTE5)j`xfP+dfgu&GZ%^$@lUsy9>vS_jon)caax(nnC-mzlH=N{yy( zpj0jS*9-2JC}v!x(eKu-GQRj9h*ZUfK;ioouv}3cp~i{o2Bli#cBqNMc&t4JrF^GD zWzzjfeFiEVzLvrFv(}@zs7K(zGcS!+K(!UN2kIvA{Tu3bs0MUVRJC{mYOPg_`dRe= zRDbap1EqS^^gN7QeA8G_?^v}DYND`UgdGK&BJ58n9$_*3 z!84*KgqiUdqjF%=h2eW;dR9~msKtd?DY^+vttG)YxD)IZu^R-n9x9WDLGcL7q%lxD znqoL{XjZtOq`~~igWbFEb?9lR_eJp+ygWl=v=QoK$s_Ri2yBnAgHT^UsS$fnSol1w zYobg$V}%1#GoF8~^|++ghf*`33DikpZJ@aHD&A>f-N3wjE=zx?NRkTX{{7Z2=!Kx2 z%}O1k@vti@QJ#Xj5Gsw9K$RB7b0$z1i`}{6@!VH4FX-Rxh>|HD!P>-MiZ&F+X zgJ2z@(&%p}UV&A8dkN$5$11Vk_*=<)gk1)u#^04tgT#YZ0dD&=+yNWK^IS1rvsKUB z0FMVGN>`{6qD<-W3kn#gYF6|_>KLSE$N6hQzA|OUAF^tiRt`OH)jLp=;DO)2hT<9J z&@m|PbBDtCB1w&=bf`SB!C(3!&6?pTDp<56qz|nmNQ@%cyp_(yD8$ z>IB6#PovwRN{DZJv_@G`gTO8ll>v4cRE%=K>WCTzbrn=5jfZL~>Pe^$P+9SXP+g!J z&LpFuq+YCqIyQQty6Eb0W*BvIJBQyx?b6@gMK za2k}dD+84;sp(L&pzyazpyolTQauY5qgr5#MKywYMbvdr8=xHO2*vG}NjF1r9+}h| zihC~PlZ$i`vdj;wXVH=?i zirNA7BUFrbL#bMR3B`HDr~vAW*!=|MOy}0%TKZ6R>368}pw!C1O4Yn1ltT{QmT~EE zX2_~CQ00(XkJ6zkL1o43KxK%!TB{h{2z3dV%A*#P%7c|+4J~7(SPRQoITEFvsGf+I zW$kXUcC1vH`-t6Lu)9;#y-)*0JqUHbC@vK%m0J#!Diy10^0b%7Mm2gIcD#mFqv=p; zMg?sewDWwVj)rfHmP0)T)qvJR%@X!Ll!EIa;&RhzYn(N3r{ zNX0G#?d;58^(okSP4_5uI)ww)^nf!lG&5oxOSGhHizc8rQ zhzr431(9P^3ap&egGb%PqAmebtB;wNnN%OFE>hLH)=*SyFm*NHncPHtuLtA#i@$%T z*YSFk1*T^AZBQ-5ZU7XwMvO*k<?YC!ixskv%ay_j9~ z8qhGLa!WR#T&-d>35r_?-}9m+dq|C*1nXU>ZkhBnSU+LULvi~huB~0OR!SnyF>id4A&gLoB{Q!MCk~n+SH8atoY4fJT`)MiP3FfZ;Qvj ztQu-nFxp3hsd4{=RnJ=WvQ?X)wo6&?Ee3rokoM%>POg>gOhi!xWM;A*PI+F?mG z@zB5U_)geys1u^_r3861x#p%XGs!EZT1fRHXMq3w}+ov51HE|W5$I)i1$8$odkWyi18%Awv?4Ts{j$swG)*FA%?^ZFUZ zJJxQWR%*YiTAcU0tTKtum-mno_@zy}3Q#;E)LnFMq^f)Np-`Dr7paek$2CwK1t*)W z8V)rjDfLM(HFB0%waI#z8pY@!81FLBGg{%V4rq@CRHO_>CnCqFIMh?3%3DeCUt^(5e&OXsFkAr1@)?^aZvn>CzGaIwFGJ%QdJvl7PTIX@5UVZ28v7I z&}pa-Buca_?yQBCf%;NZeJEv@1yvyI9;lU}8uVG!i;15`+q z$u~ylmm^9Q7W7*wFf}3?K=Hk}LqTpq9$82&CBCKvF}h!S;Hie)=?@310J|7XfKvBr z=B`bRh{{M!!!JJI?nD&dxn3)Z@5}hkD@N1d+Z9Y*FI8)BJ#Ga{p=XfV4=R&hg;HhS z48^^LUzveYBPST+Zh6BhSk)3r`Syb1aga%)pa#z35t7y?hw>Bg*;+( z6pZas=x-?1&KFc9Iwp2ipg3}j0$)?+7@2%ybS}Hv@ck(%-=<){3Nv|R#oL4Z0T$F8 zztRMTKf8l`xecPCxD85);x?!Pm0|CC)&7c~GU0bK;Hzd{u2z{e8;Vz&7%hUTB~jjj zx?I#|D6V-%LXCEVU4hiZQtbn4EFPxjYUXkK#poBLsyz4)bMrWe(FIV=#iOKEm8_}; zrCO*C)HSfnu8c;_l)kj^ScqFC~KW9~?8Um(D@Ss&elnG#+ zrF>JMx{ER+0;NZd)Hpc1H4@ABBz)Dij7PDW3-iI$XnI2{{0<|OYN79;`b%zSkK#=F z3#s=ZHI0hkucALFb}^{YqD(zfq;*yM1ubcwgJcrlPpi7|6Pt&{Hz?nwh^P9}c&Mj- zYR+7a)JMgm71UHwJpP^(#cefH6pzGbMPPVDdpz4c4aNS#+ zn<{e@OqGTAwvEKD448_1b}H^VklGY>8MdTqwNO_aUTHX!4t*9i;Sz@#>y;fU8kQb$3lHDVG};r3Hw ztuyQr$J$KTbrtp!l-dKo2F2rEt@rA=Jilq^13Psea1T@l?YDUxg;LkNpR5Y%_B+^6 zcsRsQvef?Bse)(vV6lWNVnr}6a~kokiq}N-4wqMpU@i#%O+H6zzYlSy}7!iDh2(IyJC!9BucyySYFVT%7Ii6_cXj>svXaEC@x9K< zzR9X_s1diRx;N!(5B~NOQn{q*G!W_si8mGMH>g~C7K-Mw-7=_7EURu+6RU2ts+U#wS~be5306(D>S?Q1ShZd&^(>cL z5`PB|OpPIazFU|zkl$@gm;U__cGab4*sf+Fl^lgr1Ln|f_+BpTK%v}{?M@)|3fN`E zPeZA7k{RDU1+zPsqSbM|gq>RJu93(Wf?W@lNjz&i3M&iN4JszPv|ggBg7uZuT2Lwv ze)_=*s~MPj=h_yE-@2)LgS+5?XSvqnHmLh0$^gqoST#Yb80A6bNWL?n_}y5Hmg>|7 zw8pBfR_)dbzZGiLk5=(>F5NC*YTTc;%DKd_B2daMC`-w+7|xAYc9HgtQFY5Qq14@H z11R-;<7#Wy8tOr*8^2$D3Ns2PNWfJ4^@39EH_);%nmMxT8x7xFdJ1eZR91X36z7%| ze^;wq`W)(Uu{#9C_xrhY3~D|Y{&G7MKXb$T+Dq}&R9JZ^RpzU-%8GZ=Dwldet&({C zv{Jqsz_Q{43fXOzcpRBi9m<9JP}CGC)%I(x`bMj)c=$3?f=W=Ii$^BZA*eKJ1T{~_ zS|`o${1ob2q{e6<)DKWu@i9=UHS(=`#;O;!%B1yB966IdwCa1E>d>!Hr;zGUN)4>? zPqV57b-t*Jt!f3OYSaO$1X45U4k#|EL!+T8f_an=RaMktC@x<*y{_%jX%iH$AnEi8 zRBhO$(>GA{MDZ^Ha!F&-3s-_U#J$i$6t|FKrD~eU7eR5`dvpmDm)WEGQ0(DRW3BM( zeNd{;Z`5`U-3HZOB6Hn3L1o47)OK0%VOCAFYMxbVt=eYQ0jvJ7s(3BaN0(W3jaClz zgi`D29Z+4REcZciJ<=!_id#30=0K_EO`D-^MQSd+r`dek2gOm;E`#l2bPTKy>=K_m z@jIJ)z_R1NAXO=^wo++S9*QFur>am~g5p#kid!v>+CuT}D~)cptRK`M*x`;!v*PrK zRycbEH5{qf)98}o?-uCP7_EomQ-oRZt=7ZzOpHFZ>`N#vi$mW*skS-+#ch>FP94=k zo#K~3aY;MHue2&#D~ImaDl0xht2BDrs^w5)5HBmf)7tH~>V#F%Ow*S!s~T8!y;WVb za;Ptq>dSj9dk|`Z)M%n*3!r#~>l9zDS#jFNOlrw@sgH}t*I@HR{Rs7}sMO03?rE!D zf?6wf+o05Xuor5hux~Z<=r1Vc>(^B(oyu4hc+>>rD1k>-ysc)P;@MW+Y1KHZW?1#6 zRR^s)X;rkI%A-@fx>c>M>TA_lt%}nEtE)K=8Zp>>*hv>A%Wu1D`%wGWENK{_3S zdQV#8BowcN9);_hIamUU>+8^EP#;NZ6R6Ljic@DOUL%UrolpnC(r6siQBg~wPKe@r zD`xn$elRtU-i6{Tu}2?4skQxpPEDg9p?(*S-=W-j?2GM`j8lioL#a_*3+g;cy%wq% zRN|V`2dpGmcKmLua;=(TRlZd(TlKb8JG63$%ffAiXLw+092|vGt?OK2R0SxuODqeo ze_Yb+czvWQ)yk@lS|xjw6OY@Fs?-pxMqBlSRZm;BOsnL0+(N1ZN^uF4;u0ve-l|LqSsWS#rFuVT-T$tqRe$io4uYyuFdL2sbkhj~^{gxfKEY#Tera`G*h*^~hrSfQP zmAP^{)D`S0ltsOHd|FC%8`v^oL!efPibK5tg*SjuTSW2BQYmKJz!F=7*Nuw4@r}PVr4(T$WDpJyw0E6`lY=agAccrHa8fX7i2FX)w+=M$xNrvQ<)xLvbzf zKF_LpR$T+d_jzg58LE+#h1)7c)Y>BPeMrM0r8je=hSH*riYxc&N7T549Q0Aya1DX@aTy^9QWmM6Dc}4)wlxya@HV zsMnziMD2h&F6wirQ&2HF0>yJHMn6JvZg>t1k$tidVfDapa|9 zcR84v-R+@Nl-`=fXgJhrvCD%}*B&!JQpmJbj9%8h|Nkk6c|HFrHi4@sF(f+^WM`CAQxWVCo5#X+J#kXn}8KBsbGm@Ib4n7Ak>M)oQ`~xCo5% z#otiUqd0NST#nR_5idqpYu|JAevH~9RXqjk0;Oiz?bhRNn;ML;;pbrHIS5vC>l>6{ zre!Oj)Yl=wTK5*1npDnmfcbzqSy=$_l3XBWR6s z@Xdlfydo%}%=d?#}K=E@1k3O~R zBoxp66iRKSJW{9>6koB^C>=^YgKA+F-%B#fir=I?60h-QSAh3mNS*u)mo&I`2iNo9 z8gEvb#2vs0`10;G*dJgOK%1(a#{{H4g~$#)3H9F7tmZ)#ULAv(+$p{csoV?Lt7yAU z_9<+q_#w;w)T%gL(AvZ^{e}}(VDlv3!t8}4W}ZqW?)rGVtb|=wyrGSJJ(Sx2ncjD( z6WHq#uN%~QQMXx-epZ>&q#g|fQ&Dnk>Nu$F;+tpH9H?Ew%&OwhLa+ibk6we~ndi}4 zP`n~Jv<-^OjQ2B8YUY`GB$xCjvHRzenkPkSmFKyDdkCy5s^82waP0VV=pgd_L+pNr zqJ`}7H&mX?t@E$J8Yax_T5v8B@wlXER0*jik(x%CP~}9mf~q8{3si=vd!R0X^6a-L ziSG@@B6Tz3CEgJXD}l3H@W_r&Mk*_x=0for>)W$=Fxv5QqwQ7+&)>3&Svoki;D4gED7AJM!i@ysBrP{fyR=&K; zlDi$M1*R0g)oLrbT?wXCYbf5`_|)F2?ofOW;nN_f8{rY7iBOz}Z_mRylm}KDWscDS zSAAjW(?ZRB;*xfg++G7yb=wBT`+J{0gz6=!2cT5xxki1#&RwG*-q)~Gk-vxHXV*Uc zuA}%AYJVc_mxjA2TWja?&wuGH(zfM;5hhh((a;)OW4@l&( zV5iQ$Z4lJsG1zhY`840EU>pQ?fm#i_IP$=|MU+{!{RXfJl5b!asGUfiEU8?+ z$3^V{Q@z0KDPiA$@t3wf1*ztgg-^dBmB(|8Ob@CrH)g|Ey@#C-<=C_F)hKeEI{)lb z8kAb^`K0l4uv2G_lT{_{fp?JF!=VOHOW=`4*FmYTJ@12B4W?!aNAYO}7=Nwk6OU)M z^U0jL^2tOFJk;zd+~+Elzoqr*X~a{beTh*CUrN0U#@{z)$6vSVZLNI!{hLqkfbrKb zKJ9?wZ&7^tZc#<%Uqw^j_waWZ8&MCe$|(JIsA|?O@q4;v;4XbEXJ+1Ht3+3B|vXqiwa*A$6i6 z6D)5QN4^58gZQ?DQmc11l&ah9Q2e!tdO~^&?9@qP{*FbpxOxU}YJ^{TKrPh_7zkgr ze;IDoL@4&~X}VPlq54P(mO-f!tc6nTw*`vJ5~GixTv_!3#l3nrd{tS7h&oqU*lxJw z@g<`0X*8d{w(5JRQIh%>lfKSu=G#G85R2*u(ihI&sTbD#hFJl=;L z{{j+rJXU=JrSdohrSgchH+fWmQh8ho#d)Ze;ZsrOq~d?mTl>W0Tw}a&Z}Eu5RZWjI zmD>Sf=CrUcU-j@FSY49~kgC*CtBym(s6NVk63U@wP^Y0(JnuPH=B(PenK?(6oT{#f zJZmH8h?2|-M^UM5P?qE<0W0iL^c;C4v%upfM7~fwdO(#Hbq`bpQ8`fj9i&fjs2G^q zl~#koUp)l7Owe@ILiq}MsmO!cd=@n3XKdnwC)rAM{w!zd@auZZ@iSqBRDOpIx zy%6lWi?X{-`Uyz@N`J5KfKZ>zXh$AZP=+2LfXWX+UBN@w@1rC_!=B0AF<`YcJGhL`kEAP}`sqeZK=!=b%nOeT>wsxYtp&OIEy$ zR(N`;l}}eg?SY+7ZJ{RP>6TBoKz$*M?_9qT#dog9MD^9a>RSLlE9BFCV0=Qzr!i1J ziQQDFUqwxW`a@KZ#~d*J=Fz7GQ1m>j6sx_3_ zPj-cxC;Pv9ptyW^7G%{3s1=fLz@~t$74{6&W>GIgxe}Q@wkI+6*dy#ssBc7Vgi^U} zf;uj2C)7z%pF{CE6rTc*Aoc%+9YSPPW-b*i;yjoY5yh;ORjQWEstMzK>x=q#rEems zg-fqIxb!MDi1NR&Yb1{!5KryugBo$$x0h6AT|_bKEsFCUXqoC&(_1n7E?@0wxM$A2 zUz2@1qWmYjQ^;+UH??~OuDC#B+(#;iO!xy(wPTvn_PqNr<+dCrfg z_F&u#9z6*4g7{8=;<@F~G^mxr7C^CYVlDYZ%Bx7tj&psL;`*}kX(`l(bEut`DaCIP z_6vI*9%@9K%^cc*RQ0U>6DZY^UqO8fU;F}6W95rq3#en%FFGE6RSNC$z1W$PFo||< zXXW8gF(|f6r%IZoQ#G5)CsIyIlzL!)iE0VO*M%5$h2nD~_=*Wiwci6!s&ywp6?uW% zl=D#RT&c5>TA`4gI1)wo`9Qt0G=v6tgdh(R+mYHUm4? zyU%mYL3Nk#sm#0@h|E2sc9GXhJsN^#i!$$p@cY1-YKA&=9a6cc9Wv)j67#(osk{Sq zh?P3&boP!mc@?-Fx%qUL^*GX0UE_nuDKrA9T;>#d0_tw5FTeF2BI@k7z7ExFhAXzD z^4XLpMFsEQmLkgY!h*WJ2F7#YKlyHloq8wt1=R9FQ9L>h#&Z?tq@mRP#|7C$J7DKg z3`&jmE1=Y@;CxyAr+ojnGJh@Q3(Cw zg5^bVTU{pVM$}x5pS06I9opeB`0jd?@vXXf>32!xp@EX4OsV5h!y$N8Kp}sr{^-QpQfrw;=UC zYo}CUyC8K0?3Axkh3%NB5{$EU>iWSYW#%NDBnlX-$E>eXg(C;4^Q@gxh3$gWW!6rq z!gfLGo7PS#W2fp7q`qhElrnazHJB--&Uu(q8;PfZ%y^E`4)m%zb!EnyLtlcawmJsY zSFUP*K&f#Wy_smAl%NEZnyXc!TjRhDeTQzbAS ziSO-)w=lbcey~$3*KjC4D~XfAP&}ShORAOdpJsBh-C?P(d8_YGKH{Ae7PK0dluw%A z?s$ER$Cf7*WnVxazMZ{BeTMwm5zZ*)G-sF+klIAp35ZRNpDRl|2tOf8@>nYc= zQW86b)JDR*E<{&DookIy*T(CS>eKnK<9K*O3Dred9nDm!)ES%LL{vkh_K?Ue&tbw{@$nIQ0kr1cqnz3KMji83g;uBR359KK13V% z6y)|tNp*V6r@%Kz<+A)PCD;I!BDwu%yTjt~&vqvDTzlZe9Vq`&p?ae9E=r)(xpoD? zse?~or|wA2S(5)HkFODh&l3A|(kinD#yOr_%-a6X`)4jaUn_j#(kpeY$fb2WpQ=Fd zuGFW?p?D7BEuJocXU~Xu#P2@UK9teD=+!dWfvllIs#Z_{3ZA zj6!*QA>*YfJUA66ouH0@C6bi;aLWsd*Ju%*>Qg7uT)?7D)oR>6SX>5@2foc*Cc(K3Ol~L^JylO8adBH@%!4C zJfT;2O2PB?l}Ig#@;S6c`zC%V^)VPfzmM5x_4rB`tRg&OWPD@R7vJ@24}5hFRbA}( z&479uZ}L@TQ70M=^T_L_deD>i2Hg7|m9VU)RsWq`I<&tH>ROH(&d%&s* zTB#L1Q`&`BbamHj&iMv+i^{H%*zwubmZJXI?kVKa(MDExm1lc+w9J<3T_`mszqIT( ztIlP|_k(H=V(i*fCj84M{);KyR4Fw{?@n}^kdX=GP7s%-YElh0!$3S*lRzF4aw>s5 z0+K?lVuXMB#9lK&aC#ttyaW=Z6Pnb7%@&ZNRHlmZY7Fu|$obS=NFFr>`5fc|nxIIT z&LD?CiqUK#133CGiXkW{hB(BvIWO3E(?vCUphN>Mwp$)l4X#o$$%gW%tmP)ZN{7f2cTwGwzq zEh>PNrNQF0g)W3m6_9c?Nl1ZXyvosRmAiOVgH3r_stA>b7uU3c$_ja9g4BjhMcS$3 z7*dJ$C&Xz88|fM;A=@+-awNf~4M>LkA68Pw*i@q$fTk85VRH#JR)iWN&dnf~QkMkM z2c!n&B#`?+Y7+k{5r5UlUc*3Y@qgmqme92zqd{sbpzHN8NF7?E;z(=E0;x+|g{Ts; zO+D+?3329wTtV%sGE^=9Jjj*QT}aT*jp&Gwpf9eXjB4yv;Fvg9QGX%1#AGGnG@PWpX#q2uxU=q#YWYFNlV%(M3tHQtF>~1*Mo?> zSIC|On}Z|; z@@hx@le})AkwSvVc)%|IR84t|6(+xd;1yPaP0C9++fQQ?@+t<>nHDM%c^Gvs3vx3p z6_Ojt1F0xvjkcKu!t=cg?NEfC2jThEMNUeiHE0bJcy*EA=s{ly;d$DX&Q#|DZK3tB z;k<4k{)HRUhSi1eFWn^03oO*~FR1CQmTX5H?yuV{`AC!7E!hWB3z7R;atNfJkWC4B zaf`v`QZ@_5Mn8%qkgMUauNuyKci@ZBE)Od{qTy@Rw23c0P=bWWDFMu|F(p3K_&>$nE+i)RO z77~cV(gaO-AJs(2I!%TnFJ4!lqfMGj2I1Y;bF@Q9KFtAX z39sj9mnP4FTqk6okX&2B=jm7i;cL_Ll!7-yi6a~jW8~kK(2I!E5pfn#F|i5iwU{a= zkS?%UOf?cn50E9)P>5=uz927Bs|1^SL6%XUB%2j9Fu`UhY+j~?Nj9r#d4dhM{2E%5 zK)5_>Xj1~=^1Mbnlj6Ki`x0z;%)db=l5F0@kLz)B1a;p)#e@X)+CUYOY&KGjB%6)Y zFv(^UHA}MDq#7P$jCTd2Q06U`yn(*p74jWRM&U}!>*`i&CvgfKWAiR`*2LIsqdrNw zZ>PJHytdQGB(EJbHp%Nfnv_7sp@i?z?4&sF)7GRoAJ7>gxwKQ)Vkb4O%N5C`zcu-g zax^L5OV#uvTBS)%kV(kvW7?%ja}ZwnchNCTI%x6|%>4m;R zUWbT(5y<4ubLX)99uV6s(l&?L0RMtJsR9LX-FdB-x)Ob3NN6+2$A}z|Lm<4i9I-aM z8|3nQYsn9=Ve%dAPbkk`#5qdG6Uf&f-&3(G*fH2GAEz#wn8-iTY)wq$pJ~4$QB&q$ z=!lSDxBLs8(q5((zfg&WDlb!u6OO=N;^?)LE0V*m82cexqqZ zg8n*1TNR;tusM!;o#Kq}Pwik&g8WW9#72#c3zp;hP5XqX9U9yGMRl%ZuRLmwIHh3Y zI{e=pr#%So6Ff`0gH(b|K=_weGYXNki`6wHu(=CfmlU!Y3Bvn2&uJ#Ps}j}`o16sF z3?%Fv5fbbM&vW<}fq0DNBhC%5InUwW`Qbh_c@=TmXkzjz;&jx+)T@ZoOA}MCB2Irz zOudRY12r-AD&ph_$)lynJsY_faX4>oF+K%!D@f5og!f1nSh5vfcf+QbC0~Nv50d7@ zC9-Ob2SJKEvvuw!atUX70^!J|oUNLeIHjG&S8;g?9FtdBXOoa%{FHN!DIz=1vB;~O z!@vKNIG4*i9UH4SW|v#u>8y#__QlmpM6_#5JkmOw!~LkZ)mA z)0w8pGax^K)Uv(IcQ?O*)OKczjhcf@>Np#;*J^mt3Vh+?91@~hmDknFonzW&J8X); z=5iak0Hg#+UFU?3Y{(T(mu6gd{1Pi{YQW|yXO$)%ZeE#O?UZS*Y)Wg=+*zv06(CJu z)5@vWf^CBGT;ntrl1FV}b1iJHaaw6|JID9+!vCaKXv1>VU9&JRNqOck4lo6u5 z_`YC>lOZJ7y$`i{@vgfBymBnz_9+iC%#sffneVBGTk;b~71#tMwJ+8ukP%Lugxu?c zjC8sPQ9BvV>mg^VCdO-&vtLNCONl%DEj{Sj1VKc!Q ztH~meJ|K@c(-g7KGbh;=+X&laXLE8hPbA9fjo5UX+LTNHd&i$|mx?C9_o=dFS#Nyk5ET_ozs-5eC@csL2r?Mt3EorPtHxRy$o9(m`5?t};*cKZC zn+1qG#~CR$1&$%}oi#en7}zX_&9lx{O(ub?0eQ|j(Jp8)Zo@^+86kNz6E?gfTI8hM zz&3gG63AQddci59$wrWOK^8kTgs7JP2xN)F-_!BPH062GnW~7rw_4%sOYq{{S2%|f z$Uekb;go2v;_!UuyRFp@f8Awz`A68i>g-CgS>qg0#OC#yQ?End#d*DE+mQETzamaR zcB5WQUbi-1fSdt&!)YvW3LNA0rqfOnHyzOijy!yyNWAkxgs7>#XU>Ho2725BnO}Y;z)6f!F0A+nq8(g1g8a zPL7aVDh;nIVe_7|Mw4o#**j{VX z7lf|``|u+>K^)$hf8kURQs9_4UpjR(F>&@gIhvR_2b`@!a_L^3*Fl@tC=k9c_}Y@O zAdkL`yKHBlj$>>NIma|HHiw-Gowt+barGvK}x&Flnr$P;WC$T z`7|i*-<`f7*TANXTfGaDV5XFH`K%|#q}_p(bsG!Gr#s=*0bXU@b_t{hNO`w=0=WyM zg4;)v`{6Z2$lVDfE`)Q!S{@n(o5>&*T}_HU4pIeWzR2a%me^s@b0AN`<|22GkUZJ| zG6$rRdql`I+70q7NM*NjSMjpX@MCUuA)6v5a?GtGB&d7LZJa=sB2LV0lR#busp9q$ zk{>yMyj};%aPLkaTS2P2IYKs(saG|3haxuji``v9RPH2ilABN4P?mkVz|H8Tga+%wu8++wa4CGgkn(iV^t_JxVq_$hEJKN+@ZxH_# z+?%_Vg{blr0m*dh2nlAvr=c>*bpICb3(Npb4AyOQG6cXP0& zB#y)SZd^!#V^-1n?mQv6Gzn!chsX_Feml-J<-4R9$QABZ?PXTlhHhg#ZA^@OrQ0fj zTneu%-N8bzZ^633SBIYSn{ipX=N{LV{Lp>rN9A%(&~_bwctZ-y=>>#JS$xq--K|H}3O<>=2?Nj|OSy z9ulH<1$@0|@3!j2CCrm&r;}jQ!EGm`z%l!%j_x8Mxl|mHXTYYDdrXrU$O|CZZpLj0 zgPPU?Sq0M7?Jq>-&i#IiJ5Wd-HG|DM*xcggB-p$S(#@SGB&d5&cb|}a>H;r5dDY7; z(VO#9;v5I*>mErUXF&S9r!?uKZSHa-xZCH* zOxWfgw~UZH;y6WCoF6vYntMg(ZuYU9&_7hVs=fBxm|?h(Ibfb6zVnA?WIY+CH;k{TFe)lsXC6? zYfW=gu;TL^TmY{Xu*rA%`p4xlyRWC*okH?xHEj4S#B}$NCOb8m;hxguJ56S~gjI%n zIc0$In&n1>sPepqyk@%%6(K$kxgBJlJ2Js$H^_W5a$5M0(XZd)j_@y!a4C9 zgnA%9C6b~|LC%0Y<7%6t?LhckQ$S8*weVj}B>bek2*^U?70QMeKht~8622Sd_rd|` z0h{9RdfwXb{VAW$dchKNH?i1~J{yvt_9e8u@;W3$-9;9PQ*R5HSs!;l>3XO%td>`hU;!gXb?zEc)jSJIm@dURuG=2fmazJ<0B8ii~Hh5 zH$%u4$HaNbcHXwq8S zyyfoFq_ehp%iXVtZLy8+5g`SRY1NG`uLY(Jxy)PKB0}=%cEss{ytbH{7QIL3^^PH- z91!-hq-Y%E4tND*vL;&#do9CLGfU>c<{o$j+<~IRu;0!F=hVA&CoUrw9N^(jPTQDz{pEHMl1ohn;b|FcTyLZ%*MfWo;(3#V5mgq*fv+It!#eNSd)Jx)9{5L=t)tqxiw*skXNqG<+hm{JE z9N1L0qzY_!99AhrcpO&oN?`Q!4$Z_#_bMk4j+5a{LeH^{iBrv6m_RsAHLo(t$~I=q zU+i&T8p1Xgd(9FEkNN5z_nfieF@K4-GlB4!zs%d8KzPj8@JgUQW@URAq?W0d?ZMjK zbg?OjnjWm}%@dLvxdi{qUbVfY%EmE$TE{ykWQ$|^G}CJ{M3vC=U|laq6VuD}ymdmh zIHphQd%cD#FVm-2c#AYKecH%Nc|h5iK5gu^6B3-CzuMcRi8(*t)N7T)USo-`7d$JQ zdS`^>(d8)n6x6G!H*lClj+!;0xi?A3_((I@@Z4$cEz&k-m1yDZ)Wob3ExbLNm{p>M zcSw_Vh{Ln8rMGans>LlJT%MNR9!>gKvTCHVx!02E4=VD2CG#{HXUQT>%!<^~Tds*& zky?5iG%+huOK+!;vGfGu@ce4&HGGKk8cWZD%m8Wa_0nV|$O4cy-dIgGfh-1T>unHH z5Zw*30_1w{j3!4lY3DT@CAElp=>IjaxxpK(Noh^md&@O3D`W?6jgaw?TCm~1=-_SA zHfGK2=7W=?~o>D&Ftu%(8R2n9lew|muDk7-&Tm0_dLuR2scm|B(}d*GA&_5TbDOtN+nfUV6QsAdO4}5{3{H6s zPjb8snp6Tg52TN`LwnT$;qx|qy*-*V*W?b5%g4I{zEijmUi~cLb+szUU6y3Qi%(wN z?H!Uh>V0J`*xchOMkfOkUM+zC<-UiW%u6p20n!o72^@hbYTB`IUM zgay%jkVfKFL=lJYJ^573y}wN@SQK0`980Lj>A`(W+3-_89I)+ zgC6455V9q@SeIvrS4WdKK=^F@5U-w)1I{*(Hi$FCYb+$#c@FVf2~l??H;7GV6(?e9 zI@If<2$>ce>W$PkrWOx)>ohU7$no|F$s@jAbVcOh-U%W3^c%`^E651%j1ZOkeIO&f z663g4$481_E$3Q{@+xRj){+cG}MtO~syheMilDtNH?KG)|INYbBz0R6sg7Dfh z+V)OkkQ_uFV@Z4M6_9Rckvq>K!_Fep&mu3KMK+#AJ^*>BP}?ftAbKObxKAg0do+2}k|UbD zY{@B2_E{1c&!g@@^!#CJ)J^uv2q}n~exK}B7cxH52sS)gCVLIFjTs43yf)hAT5U7M z>!NMU*m%tAuWfG9HjjBZn)C(XT1@pOXcE^pQ@!az4n${Zn>=rkCWkFqqe(;TDL77^ zw^ftTmh91Fn(v`5-)6^1L#dd;r3u4YJTHBShUP>;-w&tFCPxfDNze&wCBE4PSS@ z26@42qixKJ{ess;+nA@IFL?bmnS(g;gwxB>XM2-jkjT}f(yaO77k;XUd1XrI-Vv;yIJt+Av7$Vu3|X2~re zXFy)Jq_4Jl(~^5ZLTmAy%@R}Qw=C(S?;Qg20K7Q&!sI-}+2~bQ^^(=EILIcikC1|> zS+zEMgEcWL+h#9Ec}2`~_03*f6Y~^(vo~AFf#?|I&a->7H&2tzmMql7$8J~IEYifR z5}UoHnwV8$v$tFmvr26CR%v2ZiOt>`P0T8>*;}WHStT}m8#HNabKj)N2urqVvc!@d zntW-=PE9JuO)Yk5($$hZn(z)?)pVaG8$kG4x!K#V$q5i%$2NP1G%>5_X77k5=IXH7 zJEn=bf^7DVYhtc4o4pg7m@CL;@02Fy3bNTdBV>zRNj7^$9wGcYU{{hYUIigIi-ozv zE6F=vFKuI1lC9oAZNs}kUP<2dmTDWbl5F?ZX&bYWyyxxHHfAMx&pV`SqGpAB&pV-s zSs~x|QXZ8O+7)uAS3(oBLVoCF2pLa2clbQ^$6g&}<6MF}7@keLyj4OrIcDa5;;qp( z|AGzA81;o&v+m|-X(iPE1ztw3Ob*c|7T+`6_aCKTXOO25W*$%a@PMgBg z7177T{5S;3=nrY55_9woYT18G8l96B*;OCiJ0Xq;Rs}cxllxpK+?>9md?m|C{=(`rs>>Cd8&*8j+$aWYb(@4)VJ4Ey-E@`e1ISMf}uG_@y5z*ti&CFhr%Mn9M zx|!L}5?*_5W)7zaJr&x_r2fKHfA9nXI9ewMU_ zSt&7}Nz9gJHOo+hpJZVzXPUzjGZCX*YGJ0--Wfd+auU{8rnz2~a`n@$t<2m8YR{0X zpLT6+Rg^t9`0l-l0R`46=x{ANg&SGmWk|U&g9y|86AH!D_QVm7{pNRe=`?~=-MZlJtDgHJtmpJvZZIbFPS>$^3M%~=D=J4Dc7ZoW?TXu1A~iM9gJosmM{derjTw z#nR>Keeg1~K}7F^mzfJh^!|03*(##QY1hV7v? z-(gN+2}db+m{U_?x=`v4lYW1hYCjNl(O9eATq<$|qz5r~n&}U#m?Fq(NP}4_axUa6 zNTW%=3Q2kX1^F2=&rCc*Qe)f+q4Cc>=2Q_HOQbEuollaatkY>o6W|7FH5So|!wpk%^oy2sTy(0CH7L@w0 znLs4<{C$umkRCG+M^4Jz0$B=q&n!_A%#mJcRmmjE~laQYw17@kj&>bBbT@0Aj zBKqjJ#%y63is&|fVP-x+3U zW)UrQ%V_f;`??5E_dnv_$^}nTMEAu7%vcf!qOE1o47W&5&myejvJk zl7Z;{Ne@J~XA>=+9&2qH$n(hDj?AHSL8yhHtc1{74rO3tiPH7XE2*WTbiMNqWJ_IF zbR9~44%s#k`*y5r$aaCy+}-t%9RtZkjQI-Yh6S<*#E0w_?c<(Td*ybJ-J=E1QO^&# zdP(<;7P8bhdepRMv`Av~vhNu!5z))OXS9r^+Bpn$?TXBMMrTT%;~>-<5<(d+bp zD9u!)ePUW3!3 z3s|a+b;w+Rn4)MoT1CsHx0ZiKXR%Zp_8n^bDUP;COg4nJjp@CsLWbyTOV<;*CJC=g@lo-Wo}g(}9-?YTT!EJ9lXwdcxcIg8p7 zNUn=&Ri9(714RBqdhEP&)*!hS?|lC z=>0vEYAja`+7n2W#(s5wk-H(cM*Fy~Mq@5YJpj2)*A;Dov_kF(VMgP3|P z9@YK=TJEw;&Bs+J^O2ByE|E(Mc(?3jf^{t!5btt_SBwn^*?i4%9{WWadYk zRVgPj7kdi+dw#TCV$vbhp83(GEJG3M4QkK)Xm5&8d+v>{XX%Wbj8cR6@B5?qukt!I zP8Vs8E*805)w8qSdb%`0FzC@vt@8%u;1+SFetctG3iCmXDM$vkIIaK{gXQ-u1k zH#*4DW$3y-jpi(;CG9eFU7tnsMD+P$b+nWvtbHI_tAuN>MC}9729~gY2BXa^s(-2x z^HtRBQg!Jqb2vIlM4u~%qZJ~$f4++@5YcV^KDt6gw|QN(mt`nI$EaIT*N@SD5jsYZ ztd9Zh|!|@+pLl^AoHQmMUkb zJJlI>f@Q9t<*IV>0?B1jYv&Ox=>)4iMd*qn&03Knbj4v>y)5DW6}2Y4sn)3;M@6jy z5j~EwtTL7=;~3OVquiKPEpn!aZ!Hv|J3>#OJ)2s+l1Gn(H?xelR9(8CGp$?^-OpQD zr6RhYx3Ol5=ziYTYGzSKemW0sZ>7IYnU&Caa0e@oC0rLfStUw%n{Pu4ce2V^)HY9d zX?C&dQltYhyIM^wYWsN;vYWM7#Tfs>vcC_RWObyJqNhu{TRkj8!PBK&YcM5dHA>}L z+1=D;RXd$=_O|j^@Vx0JwQcNcO%c(ff_<$57Il6fMX7zQij+JwX4~KDXBlwy7PY@M ztYQqhNAw#??Qdnh6ZRPO;bbc}MW_!CwDLu0Udn_H+_krgS;9HVQ>;>!u%D+`={@0c zd0eV2MYe(*YRzE@#{dOZt%zRs0&A{_UiJd3i6tDJ7Ff+J;drdTS}3B&hXq!Pl3+Ag zV0DY=G28!H8Shb>y9_;MJH|?^B&j#5u$Fh~!1&n8RTA9WInkQJ61L|=tAHhJ&xzJl z5#62>twJS1drq`wi|F*l2UJ(sV;5U_ zEMex0t;tG)%okhbB0BR-tCc0pe1+A{5@x=_>QJSEvHBHOr;;G^6;`*1&Rl8rv4okg zwT4;3%-33@s#K8qT5G-J(QEKp%lUA_UY%oQu!MQ$SQA;g9DU_7$IAIjsXP|7F8qe`ZrQW#hPK?ly=N4H&eCX1xC_^L$a9Z1F-2-2_gb?=Hb)G-W%GblE3yORZp1ujHH+*HX@)#x zwTT=6c?|NfwL+u-@-*ZTt6$^<$cvCg)_RdsrPQOA({JFf(Kr{bcg&I zE0ZPMFP^og{zWQT8ja6UY6N+nwYo*VhWrF+v$EDu=0=0&=KKkH&YCRpJH&boPY0}- zEMZ+QSSuvPZou^pVqUOTi6kLgKwh-^Md&$N7G$ZF`Gu-$OT_F3dDSWs*$I*h>9FRA zOp=(_tPYm&==Zuc&NAdyW8_KKp3AJfLCRdi=hFj_XPMO?vLEu$S$Mg%@JotOV-mVP zU2e6d2wk7PVRf?97)PVjVaW5Q)hjV{&Yj9K$`YP)-?W?|${hC3n^qRfUB-#Xa}t-z z5jjKTEh|^#Qpl-@dE1&Sa(y8AB6mosx2>rn_la~{6(Wm8-m&J2tb~*z^M9>&k+l-@ zuGK5@r$~=ACX(?V)#mrC%&%yhO# z(c`*)YqE%*A<%D?iRjT_zf~)uX9)CLEh5+5q%(Jm+!4s2h@K(PZ><;6GXw^#^lwy~ z^$dXlYodsrA+W~EQ)1}n-D|8umhh?c7gh^PmGOcs=@-@t5xV7}_?5tuc{H0xAEV>cY_vZB{Y8B6?dL zwnka1j2nVd=BR4nyg(+3JRL|OOP8Z(ybN2lB6`Nl*H$M>IIDB5HK@eU-$GeyOA5;rJ6ZzI!%A&poK&8I3GJaGs-y-G# z^z--DOp)J2)>%tM;!QY{Bj!gdW4$W1E#!H~PgaGL1^CB1bZP%m-7|mYt%Kt?hyG2velC$JtBWXzUP>J7QDwg zPuDeNj9S>`WCcBtwa9;imr^!=$Qtt zoguO{GSikBv$I8V0-3_1wnI8I#_ST7aI1^ktt|Mm;ytM0bv)g+S1EC(Kxp2eXFI=9 z?N!dPflLuO4MIKU*;7R>4Wvlq-+`2}bUAep2X%RNof2a{g!Tf@Zb%VYF5g}#@+4w> zl=AI%k(VG_KsL4W#<_*YJCJQ5o7>GST`ZJm3wwpgXNXZUDy7yza!_guyXbey(}hPX zD)Ux$lSl@HN=>wTS*na(AXL{xyZ8@P>PQGZ8QIpZ6*&=d0AjYY+eOZT90J+i9u>J- zO6_20{i*WY3@Jd&j&`X?1EdhLv)wF0bCapA9J?n)sMKzDx)DL5D&tYaPzxv7#VlRM z%Tj80yH;ccgyy&GVRwjpAu+l3sK}_uUUpVQWi}Szc`q{WZ8x)Y83_pW&%XAc$fkj0 zPoPp=hTbywwaZ2HJehs%ewHd@Cn>d`ZKSEXX!dkD>e|oFNRdk*``dXUbcUsv1MC78 z{K^taT?IMNE)@Bv$U%0I$fY7v>=KciMGm&hL>fg7u`5KL6gkwM#nNcJ1et@n^6hGo z<&aw-hud>SJ`_2^ULf+dNP*oV^1H~9cAJQQFRpr!=P0{Vgx;!~51DG$nbbdO@1`|) zjJ-gKqmRag_Ck?uk%x|lg?1}T`2Izq-NB;1NcJ!?7uu^NhThtsH;9k3M_C%3J&>mr zF~{3RlxlBu4iuSYXRy>5G-viX#Qej~W(j{0<0QLMl`^Iy=4Hg3WRJ0gXU`(rv3R}n z{f$n<6xo?9LlOE;&fAca?Me}9;Y!FUb|*`ir`R53xgoeuQf!Z~)HpN)xeuj^?e!|g zDMNeKuoyP?s&g^qYshrlVY$J%2J$^ihQ!<~F{j%3BKiz_sy$UoH6n)IN;uUnl9*-) z9Wzg}%T$c97()BbY4$7;{k-WkyH1tjc_9Bo?WfsoEa8%t*eg`2U`b2t9#zWGXX+BW zSH(E5p)NXZl-Pq3qqmmR?GcITmYCD+F^SPv9B0^uL;Z7u^9jY^h<%2gV5xD|LTI_p zv@=Ei2qag8&gRtfXWCOG4_$*$&!1@*Nlg4c%nO5*+9eW`2}xTOU(a4VkmXC-NI636ho+mXWQc?)kIr5fPe!Lp^`CJu^lz zVb7mqSF?oM*g19`OSp}lV>hUnU>iHfZkCv8)K1%2nZ1~0*#uoznY}{A@H)-FQk-iK zv#7hN+d$5<@pEiw58lAKP0boQ-*%L^diL7+cBaHMBZfvP=i50V*FtFaTDd)0M9*Hk zz@EyYjx9T)t_$rlB~Crs{C7x&JzJG>^?d#cyG}%3)mGRGMD$f{h21KmuZ1h@6(afy zy29=i(O13|_OOWF4lC?25q;%bVLJ)#4Od_JR@mtxdJK87oh72Ld@r_hMf8>L3_D*$ zzsoSgo+hH-Wtd@?is<(OX4o^81T*Sq*mFemJ2jWsb4BzO*(G+f$Uu+@*{4MqNh?1EBP+UflBdEpiP zRrX{NeGPk+T_B>bVXv~MiRi22tL!onJ*)g`d!dM)tADlKCZgx+Ut@QQ=(+m;wpWSh zS@-|8heh;Vi0kb!5j~&(2HWw~UZCgm-(Y8o==uCN*f}iWmG2Gq6p7JygsSZV5q(GK zMtiD=p3h%n7mMgC%^JHzL|={8*rhCL-`NX$N{!vjBG0WLH`yI5UCw;$O?2f_Yp)Q| zZ{F3~y(*9M6k_P8RcjAR41Kej-ZZJT$5o7>*G{eNB&j#L4E^pvtzE`~`STbf(OIU} zu9O%$ZXAmC)Y@}Y3?FUiSXXP$RWZ&>sGUX*H``58N?(KAY`05{o=bd-y+UI2T;f~o zUJ*T)_*Q#ZWJlCaGj(sX$3!-T&}`nhwv$dv(P;Fb_9M~4JMCqQ#u zA`$0)j1ds?AG=y)OOZyqS!4&u8Hl;tULleTITzAoPuzrRuQw(`Dj@Uha*@L!S3>67 z{UU{sYRG+d`KGGWsgVCb9*!d+Jhp$N}eTl!RD%z*NnNuh8sr6g zj>z_qw;?atbCm>7mtM9b+g*$m)T_^`VFjQ_H33e9@o)3bj$2&CBcllW%fc5eI{CFw~FYq%rbka zh(60Kv%5v~S!S8NN<^P!mf8Ix`Yh9FkBaECOsAc-B`sC ztM}{%iP6XK_v~g7eGFe|w~FXv_y_h<5q%8*z+TT1zB%==?QG4x5z)u+PwY$)eGLD^ z&Joea@K5Z?BKm0ji9MA?Z9l(a`}xEkQ!&Ba_|>+t4b>IijbCkNitN^`j;pKf9F{Ie zk4aYBg(7++v)V2f(c8~zyG}%JKdbFl5xxDawtGbM_Osd^7SY?!YI{sXZ$JHZ#zgKP zM{hs}^P?reW$&tVDA?_b#qSi(Eo!*-8|KI4CFC$dy;&>QHq z6l?7Ukt<~>*4nE?t_`Gc2UV&DLifkk+La;;Ae*CC*V?TjbZ3cV#O@b)L}I?PGj>#Y zUJx0zr-{4+*&d~SuvdwEDltFV89S*`LlCo^adv!>$m~hCDQG`NJL+i9MiY z$}TF89z*_Nw~Od)>`%LoC0wU}+Jh3K*P!8yi0Cm}#91$*mwkdWE}}N1#;PXP&{t3x&x<#%N z+1x4EO_jO}LSL5N!l@K#fzbERwsaPVER|B3&NxfG(E~XHnYVH>{}w^*1CiAb`rhf* zPLW8~gQ^d=b=pMq?-%Uor2m~t)f<-}=3M02#mQm8FDOCiJ^CDHj>wIHtPr^iaxqHf zIFlw(9{d&w%b$iYqq%RofGrGAK$#WECpiRBQdL_{Ci4t1JX!XsP0)6P<5 zxDR2x)`mNZPKU@uNGIBJxRc0LOEC%ZF62n3f@L6b2!y^FaG8m&&$)DSuEkZ71N#Bl1JYaneJ4J9E3J+!gV!>oDA8DWub_EvuwK4Dx&Xr zOn2H?23-A)#&oA$M9)N>?krWM41EV?y3;LkKI+;Yb)D)M`>A!R-`Y6MDM=A}|Dwbx zX9;K5obFVo2+giJ(`il-n&WzwvnoYsj_WzjC<}f85Vhx^_H&(y`>WckA#`Lr&so4y zW9WNC=Q)Lw)mql~h|YIru~ZrJQEE@*DRXdHE&(4t&amW}@Ce?9N1p4PDF^X7<)v5%sdCDd80m<40&;^hX9~v{RO)5Ojn1&hwh;Q| zni{9%U=_0)q!TeWIZH+MgV5G;vr}-0ilO)NX+FTsP9;mdQ3|2ibhkK*CFXL-+sJdP z(;+dlA-#|~r&r_-$Xdv4PQQ|%=WlmLSkzhgC&b+DjI(s{x2ouCEpr|7P-;(?^C0rj z8EvkUuEd}x2-Ju5PNs-{#!>I&u&B(xA@iNiR3*j}$YXWko`X{+@(d&aX>b}?)U$~X zaUT4S(=9@oH$_aNlao*F3GW*>Ia64|u|$(om?HGNpvfso5o*sor#wY6k@+5HE=%~m zrUlMImI3z#w2-!q1x|~^(09MHQEGwHFG64W-h*XSi=SA4QurJ^56tWCN_JT}Co@S>>V(x|<33XVrZmC?P+o5N{rc}+ViN>Au;-z@iAu= zOO^5VvFf?ZV~%qK)m3AZQz`V=1$ zguWR0q>~}?DTKb3x!B2OX>_)H6kiiZsi&PuEaA5Cv@@9{+%}$e@>MA#8>MdKQm6=j zUHp3`b&zMAsj8H-2V!WwFL6pl4ua5?!V+huh<+;coKq>Hp9($aRI?03rlJ&Oe%@&o z(c`)ooxCH}+R?w(^r}2&H+O3}Jl z?lh$cEyZ%DMe;m>QnaL9&SJ^)JcMGpoTVwH=m_wJGn^uHWLx2kNuJkGioVAGrehpM z%T?vP4WXDfodkcS{`sJQiRsd8fUf= zC-RuuHokDGS*n~Egi3wk%#|3rPeRA}L8nP#=spSM8FUu13`KOCzjRg{O>M3>HbWjd z6RmZ|M0SMSi#7O-Gk&a!*&EUd`OZlcDmfbRGUR(FgGFr#)T^V;6eUh6Vraep;1sY_ zITt}_4gTOvlb9E0l;50bEMZ;aPU-QKIsA>eh&z|%E@K%=eTqC$H{%3~ zsR@?Ub|;GHCAHlgmN1Xw=CfcXA@Zz2o`kztl?t{W-$h#dsb6DUix}T+=NPqRlBBzx z8!=5D4E=L@uljvHILSt274I&N&~P7eSMX1da z-BHQ2DKgWY?d{w#k?jI8PE>2>ZxCwpcCI6`KeY$TwVj*6626JEz3%zo_ZdSeK&dR0 z+TNYWrMldcAU|SVZ0}}^ltO46wY{4wQW1z=r}RGcuUu*h$Am|T9o<3}we?zWVE=K; zlsJ{hlMcytD@3XTnZ?o-{L)9ZTdgGcrH^d4MPg_qL%&zDv)e5~BN_U=l3m+0v)Xzh~Z$a*%`!ISZT1dZmwV}{2UhTO-%(kd&uMK23 zNZtmrH)P)pwi&-#x7A>rWoaD|aqC8c`G6*fjDegj+dgDV#BV@YUCo&9q z0CJk!ak47)E2I^2x@-QEq~1v24D%wS)GZa+8L|v=mb+9WAMy_59JioYl{yLX3FJJt zMdSj=Af((K6S)rZ9ppl{;8a!WZjl*o=4ncvg8YG)%iL8W^lR0duD}(mJ0|iWWP8Y! z?&1|<|=ngWD6Wc=v;ZV>zvMcg7eNbZtfW*D$ju^ zb&cD`a)YxcN*x2a&Rr^UDC8uT6{?hT0)+PNIc^V2m2(E44nimWWJ-bg`6+91D2| zQtQrEVw?f_h^0+pW7a=reyW1U>n0FvF#%^*) zCFWBIjj@~Daf#9Ebe?OTO)bP%%aDWC={z@`rN+_g>mD~#V)XjD$IX_QuaWs^EX90x zlEnN0nZ`0%V)VALz|EH!y=^RT3nfPP^Sy3`5@R!*rD@B&*X?DgH?kqc$b7F`d=77Q zhCXWD@0N=kgqRBu)9f~|;Hv@<8e>1`u2L~P2DltC54z)Jln2+{SKx^}=ItzWC!ecC z|LWYs?ko}gdu@-n)gt=$+8%KmMD*{qEpiu%=-+EwW%4G(%D$9$J|h8RTy!A*x}uLl=yzS8 z4diLaOUT@|fxHe`5(xe396cF%-W})6YQN}4OuL&npL#4DfxO_RD+xv*FSwH=Mvp*V zbn`{@2;?QVlBLmj5$$;&nO}D2u!P6wSKNja=|jvb?r@6GzSH5F<Py7D<}PIk zM>5OY4i)2cpf0*jS?2bMya%B@cbPjTvIg=k@+@FSu4~jyTuLnrk1eBaMvBlc+>N?fEVz?AOYMW}+!acK-$q&I4vXmDMp@^M ziRj-(S?A8YO!bfcZIpFxrHKA*ly&YLmaskR+}aeO-{@KAHb^P`%Pc>*ZAyX`{@|8g zuIke5`N5qjqTBO>+bp8n^Ml(WqTBO>yOvemghwOr97pNyp0(Yu>zJF zV;Fh%z}YGq!$yd|E>HK56^LGnP;~!Tv1yzKa{`f>`q_#Vi|8J+Vx=OwpRHKAl89b* zD^@9@m)(jrNGaXVR&0TY?q@63BBIy39a}7UbpP0~r6RiL-Pj5d-K(+Ksw>pC`qa*N z!h-!YCd=L#{Q%2FJ)ek;aZI(5iQ|Tn1y`zGU5l6<(5ngEW6|HGloyEqEY2y231xRk zE+iRS%6YmXS~iKT649kLi}i}=%$vvhlo!;36HB= z1T8!Q?U{`B{8chzrCcgJvTYqJXX!F@sjXwPHmYl4Z1zSm6JymI#cUU=+bCwcSi?p! zS+NBys`kUt!mL~XutnpoAk6jEo54GcCj9$d`~7$iYG8pCL;i`LTl8l&8vw;dt-{q#)MGqPCxpAX8&~ES-jK&#^J{ zS}N6P=sbn7CYCB=YvdV1scA9e-zqa5Y1TtdisgwMEHNj?dPI&BDURh|r%Ig(p%$JN zTPkuLz=C;t$V`1$8Jl@SnCEolxh7W2688MRgC$L(_6reneIPqP=p0ua$UcyN zAtsa)Ah$qjV~bPjYJ%Jn>tz{==*+jrCRM8*)0yYS@w`1hCBtiJGM~d1nh$^L*~W$SX3XbfZP)sX9?SLZ_KILus!$3CW`3x+#f3t z(d~ICHkGByxC6DXLgt5KZ6fm_^yRumvBXW3Ssi~yA&y`!+gRcqTph>SS=4fE18IwOvveA|)bp{4wW@!HkS7N*FU875Mj?Aa zmc}|oeuf+Xc{!GKbJ%7&CcGM}WT^>`KOM0-BKr8#5vvn%F{(NOd0vYx5TScJ$Fa1E zY>t?JvMgokiey2~VoAS6wVCdDlDr-(64_5;mc^Px3Pd_%eIh48%28^0Y{9K6&zX?R zAaBGn>Xej2u7SKM+jD31GLi0BCC5}7HISPS^KPv5HY!zb+y$wJtc>-DyZ~8>UVA^* z%c9l=_1LP|AWNsAGk*}vyPficF}<;TmM%jt`^T|qEMcinVofa7#@ndtZq)u+tX0KC z21P!PwX;+i>mk%*tAqV?0SreNwS1l=h%kvq? zU~INXE~EqURcundia8vz67o%KsmO_tLCE*9aS<9dt%Lj!8@W@Jx(G4jke^~jcPW_z ziTxL&;aH`}ZIDeMzs52eR7^8uOUQ4r3X$g^J3+={ts*^;-5`I&+F8`^p6m%R;+-sA z!DuHE&-f2z4&RlY5YJ{&YllW?6XKInWIyDY5HC>T^rJ2snMdP=ELF}r2(9;MyjWr; z;0_kWSn*PcNrzC36|Z1vG`52rip+MrS!5r`PzUBj#>YeoAT(Rmji)zKn;Q-K?mOMX zkHxcD!Zyd_lTxGrnd9*(N}OVpItG%67br1iK~7+4U}-e!Ag8eycXQ7NPY3*XK8vc0 zj$?kjkR?3Yq{rJ?sth`kT!cIs@ysU56K?Zc#Isq#Equ#(aZ1b;D7AHb=0-8w#(P+* zj0UujM$1|8^m&xI%6J5F`;*W({%NFs|9M9d_5J7TkU2Y$E9-Fw9kOd6^!?}gkV${Z zvwILj&pj6+X3sz<&r^`S0--#wK=%Dhp8bLt%JT+dCI_PP92f}YS&5iK;!}7@!#+GT zK9wcx!~FOhmT(I{BEC>WkLL^GZ7f3(eHBm;Zx_*53I*|{BKm6LsCW-cxQ$JX_p+!n z+NWsY)cClH3C<43#Latny*v8sa7;X%rP}Gn`Wi&3W8=9ZUqRNgOcR-a`xfgUh4Eq~ zMgsCP%S@3iA+dL{1;?vJ_Li6v<8ws{Alo3ODBjG{894!x4LK#=D=}w5_JK@~oAas7 z)y8#@10koyOGWO390@r+K9i+0@*JcPaz?yXVwQ=V8E+S%Ur44=N@=`D0mpNcsdau($Lc(urdkQtB*<5TZfF}Fgl zhFlzsTOpUk^P5$vJ_sG7E{zw9{0O-hF_*iBMq|^?tBV& z4C5IOD#?VMFp>5;J_);ateu$ytVP$-jr89B_ZUidJ@sLb7vYvUy>;Yj$pc(sTg3D1eIVhKmW)$xKyC{MjXzko+${+oD@ zqkDt;YV_uKF~@{gthdHXSyb&Gp!Qqi-7MiX>>cs^MPUmE5mO&8WeH;%;%zF%_z!Ad zhnU8A=SDGi$BmXS51onT#WPq`d&W>|p0v3$`XKVyJvhe)@;rq4`GG)|LAFH91MvdR z6JDo05btN{jL;}|Tf{7k=RQiccSb%$sl6eO#%DfGg3$%!aL5z!;#MU|l==tcsd#gW zlt7-2cZ$$&c3l8@Ha;SyYK~YL-qz_u-rI?!{E9)6jj` z9bYA)`>;FS&l27P>5i{wQJH&?xjSC+H07x=UP0}&E_&k4Ea5ia6VGc?E!5lm%6O^B zyC_9Rr1#?sMf6_qLA>ZWDpha%iWu5@KZ=*IsM=Sf_K)KYEa6u7X?&EW(byVqV1JF6 z&*H_;t2}!{et`_cXNepHvERcnI$kG2S5lipzKXYq9D|r0AYaD^Syb)2L%xY;w)3(( z7b0d~$hYwvCB_vHI<|ZppUl!_=(`Z##m88}eR(vV^#bJyuTR&-=de^6HzCiV$ox~h zL!=pUB#ZeXl?wOwpX0qEPa}rTxxdCoMBakX*?c^1zNAWhE%HaakVP#QU0WH6QkHPE zla_$uuglZ-Wb8onSuYd^?`O~%&CxN@Ovp5}Ih5T+;z3Ly9Nje+N(I~L-tM#a!glnH*B9o$*WXX zwULFGxro^}F(`5{gwE9aCuT3Bn9fKM zB@kMQqJ;B?ig``s4`d)aL+ACw2A1m z@ac)Xw^SZ|Pw%Wmi^wL(ycTtpB}(5`F}pzM?%er_nIgwR=nh_aqE|%U39LvYx>YHC zCvZlhMMU5Gx-`)yLU;LSf1j1;6uAnSNv=$+Vrg`qfc%X1R3`dFx*)%^3@R~JL(G*p zVl67YasuRrL>WuHu{&aD3$IQr6)6Y=*s;x<=6Y7?a_ z^~P1ma|Pt)!~!M3)!!|NHWszsuSLu)iEftgEK`>lW(h}4wyu<`45C*?g)--EszGt+(2FxsSo5GkvkKUIFH(wsnlJGT#-J+%!f22CX4(K zNWQ9_@3cR_F$+|Tp=)nUw2J83?@n}!=-QhSeJtUqU|wQ93(mPGVU7$k&r4*ij9}T7 zEQZ{Z$Pp>MQmxZ_5|dd}KQBSd{6s~HEQ8#isALK6T|Af=7tv319!zw+Pj#t0G!B0# zF{s4&6U+WC@;saF7kMXmSWQR?YL$;VWx#+if|8vi_#s1~8Q>gM|-bu3lR@sJoxlf;|@*#z=zqFH1X zWJ{J75&8n(b}WlU{sYNoX;)&<7w_mw>e)oaC)A#<$O{l^Pg|mwrN&qW`5Q{LC7e&W z%?6EWb0JF-g(6=dhR&zYCFY2XLk>jDbBPuaXBlQ{Mg3#FS<3xu@1LPUR ze4H2+xfk*R~gy=n#1WG4Db?OLVhT8~u=vAfG1+S5uzO z$TtvLU#k;K`$-y&81A2~M$GEOxX7N6wUGYAlmQh(vK}&!m?Lrwqy62iY0&Ria&FDP#}G*NOEk;W2Ys`)M z$D+O^_%S5utzhYLPeh(U$R^&nYL9akWG##N6)o40tJ|}Qmk`nI*~H6asd6e&issjC z;^nh+MRW@{@oGhM3peqWvZyVJ+PsO^nIfZHd-m{#wQug_i0Ilk_i|ZkjC#~gN2JZY zGLZ*FGQB2MDrnC(-eM8mo^812Q}5hrQFm^CM|-xF81>72)(1HH2SRsBH-+rr<$g_V zZZz6Z`$Wi&-qaM?3$n9UD)J^`j)LTPV|(?o`g*Hvc6SvKID1GfnF&~xGoOz%2~p9 zR1flIe@CTi_%~=?MX7_lCYDC05_#T$O!1mUwtN)l0hSh)a7;4A>tG2pPw`fLzhUMn z-Y83$`CxBMgfhR6%m;hMC@)1YK0MgVWC@qzU@wbB?FAomsazJd7xY68@usH8H;}`; zvK09Za+KG{QsdAp9p^(l!|(=K)V`BsNnfXyLXQ)U@iIkf(LbAWOcqPHHyz{Ui0JM4 z7;iF5xHlc+m8v|3J~JNU%@nx@ndv&@Sg)BS+~W$pQ4zg`7kZgLPz$S!7L@uEr3$^p zA}>Jb%J(?0L*xy}HfZzlUcryt&&DdqZjgU?g(6>xoa7a;ggsy6m88gCC{^UmN|8e# z#a>;C91l6&Tgal$1;vmvy>^yHe$(qhNSRl=p4!uBWWIrGbI5sK`cF#shfqwp*Di9J z$c0|R|I|`k4WVD{sqhMZR&pnVu4OLv%2~qm;0$jjOSoJ!yvh{026fHwj4{d+uG7ms zQ$(-R%e@Si8sl-)bt_6;?oCY*I%@sPD;9Z4Vy^b;QiNju?JXA3TSArB!7>ya*{=6S zMf7^V-YfZqTBw$Su5PaPDp)Oal_Pw>`8t+!YSpJk|2 zt=Ewv_h3nH_Ig-uaNfpp(K~&&dc7jO5c(Fut==F@S8%;k=Z%QG`kK1_y3MQnm6oE* z(APV+dkb0Aay@{$?(jM#M&Cuh(;H8TX+=zfm+_m*qhlJqd={1GIm9%1#S+sZwa@d) zMRa@a@hU}hd**v{Qu5GTtOZ`T#L&8+Gyc6^kBH8EpVup*GvDtGi|EYF-g*|*!k5v) z2fRt+8!p8|UNwt~S%H{`y`~g-53->B4M-sta?r{4Gy>!J@atzP*bBq|TB)2F;j zmT+rX>`nTUVycY)p%g9GGhUO3f%jMF{@AnLdKQ)ED`al-Ok)DCLEZC9ybKl<^BrQI z_wrNZCrGKQDM~BDz;!^ae$AufF7EM5sNgb_aQu zdc`bZo|nB65uN81uR=uUdDWZE(rE0B_9T&~!)r>BOvr0qFN>;+w)xk+VacO=W0}`6 zA#Bf1D7D<{O_ALpE4(q5a9zCZWv7Lu4nWL1-sBWH4DzlwjU_Dgo>!R?Lu>hcuUcaC zwz|q|64Bf02VSd)?u`$<4iViOA9<@-)RG>H+Izjh6ge64i8q!arI0?)F~g;p0a@+k zC~*!!uhOV;jh8EOJcQl{S>sJ%376{&Z*fW)t44$Sa73bzSller?AqVF~lB z_2#6+&>lD9HKoWkXyJEW`$nbKc~dOP9On7aD`ZivjCeEMW^>zl0?mXU6@RF)kI1VB>xrOE}I<_zfa7&YX)rO!x~}!WJg{w!erI zr_7DU8Q3x#xztP+e2GrP^BW|l3UV)Ee1B<*EP^EcJ|)imh@mUrP5eO-de`$=#BAb^ zu+$sxLulNxsXxx5#^z~PUpU2W@&|Q&sE{66aA8;%Jb^3 zn5zZJ@>^KyjZ+Xa2HC+M6QP(1y_jp|Pfn*&^~Pn0@gdoMp~$t6Eg-x2r7Yn{CdZ%2 za)VQg7&?;d<|7IImf4FSv={8=*Kv&6>b66k-TYA{P8VWwA$$5`B0Z4(Sd2}mJyp(X z$P|_YOO5j#3xKsqa>1vB`rftfuAoi`nk-JekV)#wDf4d zX>-a`Z_v}y3Y04JTSWFk9=hLqysW`4?-=Cvq!<-km(tZ&0Q94mmxUJ=4$65>nwC+bE&?>d!+i_ML5&e2SPJ$fbS}3%>u1IYL8_EB)Cb{fMC>ZKXdh zvL5n1Vy^O??I=%`;b5K95&If{5=*_YErizBwSFE;*c;dR`7E7|UiK<~suDvlX_Y@H zLQe;1xoZ51EUK&CI9f8_;?H6UGuQcZSUMfu&$s*4BD${I{W>K^e!gF)VvHM6Y8){O{Jb5ht{P*3 z$bEj3NGs&rC$Y5t2#ea^snmmh(N0uKeI?BN7%lKCSgH*Ay>yCs*q_6q+CxXSMSd+y zxMeQ#8(12Rw^1sFJd6CCY}Km+kj){F`W+%aKz4vU?&s{xZRTq|%G~PbvV@si{i!K2 zIVjcYFI3{tF>@ct(|#+9I%Xcg(k?M+*ivY}c*gIL7<$)%MtaZq-4dhUzJhxeF~ReveFQU*e~;)Hu^6 z<~cu8V#+1vIX|04tuK0Z{Jh`I5+0x1{oGwSGrzS!z0vNQIbpBnv*fZ=8@0%MGUOG1 z7E3tm<28Tj-&CH55pxb=mirBVSF#Lp31o%eFi8o$6L15h+g~g)2&sqs*B@c2H~t5q zvBbOndX{ke>G7T2IS;RQdJm|_&t@5N^|ALof0B}jKK8!nSBvOl?@GUpMP;6c+E@C+ zO8BlCy?OVsKPs~IJ8Db#*f;i|+H0I$0!bI4Gwd_S^Rb^RvJYbDU51bSX(ER~=$!kp zUo27>#8ir$8pO;|Vw?-1`3WEUnR`<0;d%KJzg$G0mp}E}S=4%OM|(c?D{`q+xZeBx zZkF&nihX_`%Yb_|>Y{DF&+k_;{7u4xabE88i}#{DLlJs1OJ5-T%Uw=Zet#4qcEne!d93CGigA3xArD;Mg+g&t_4h zxK)T5^czy-3&_`g2TND*#@wjCLZsjswIz)DeIojexltcoioZ@%zZW^`4{}T+&)fMG znMeJ^KD6wO##!hw8qcru+ga+3t0BfGc$>iQmKd55M5TW8bMvTFcsyM1Pi0ZPO5?Hh zeo>0hcHX_Y^y69Ke}*4t4F5ShnOu5$9c;9gx{cPGYGyZn;>E=iOw! ziV3!jc(O1>=9rrpRuPQxLOF zGD`{fGtFDxCRre|H~kC$pO`FSX*3SUze-SQyJUytISz6b%Ld;g;~)r?+CDih zG8Hldl9envSgo&O2(@{K%zXCI>SoQs&NAv-3s4ppVDgj7LxN{)!sL24n{ z$*g>e3HOv;lapD(x62lo;BZc1@P02<=Td$(bo~);ky(BwJF1j*x#( zwzH@^1GLBeJy~*?YIEKUbrjt_*~T&y(eG35o=iWSW1PFO6n9}M_Dp7qG()JaJ(JlY zk3!}lCO0`rAavf@CppFv?z#IUTaTb64d?dcCG!e4Twi&~ zd=|C7I#7FFvXZ6B_?KkfH(8q!Lp{H5vMEJq&)qlKsw8-8W4~mZh@K0&U$R@rAoClj zYyadbCB}V_cUZ0wI;EIl$dqJGiu?#UG&wm%BA?=lHCf2g6`@i|$p0lX zkD@%)#>z~Q)6ruKKBxHIhlXFDs>yg?Zb12WVMK%BmH`^K}64p zUY=|b(KDjoOty>Y8PVOz6(V|O^}ESl7PY@0if6|wlfx>8&&zZaeLtCg0<~u-qQ6}6 zK{883f4SnLWUi9nYa6}Ee2LNDvgl1tlNkN|joxIbNcJ=8izU6unId{z*PEOpqQ9ik zo180h07}tyL2t5IN$}N<-sED5(Idv*WQWA)?|Aekdn87G$D=pdFQUKW(VHBVQu=)H zaWZ2X^+tG(`!qR~rO{}``WnRX`O{>P$n%g)tiex{GnMd+sqGA%2H!QQG(vyT%BzB2j!_TCPJuGe{zte%GeV^ zBeecx{z(*5Z5#=qbIL%ngk>mF1lbuaT$3yl(aZitvRveBDfMM?Axo7(^9t!)FqE8H zq?V#Cki{YoN~xjbm`E#R66*RYnSZh>bsg>rpNORxPL{HS{rq*Z;xDr5FH&*}-@NWo$H4XhVCtdFoYrZ zLI@!iLTDCZp;0RdahEb7gb;@AiSH0%ncZ{~LI};;gpdg#d|&VP=X0*}X}8D2AD-Sn zKIe0OpX*##Tj%z&xHG?X?!f=l8T_9*Lo&u0;nuk$iqHtR&K+ZMd;K(bg2nCilQZ)( zMljE(BFhze%aUf^m6`YiW~xwD{*)NXqVD7I%9KU&^W4OX%iIhli^lWI+%hGLy8k-2SIHuom^;Q&PIwk8e zWc@LBXq&9R=4KU$?b%t&f6dKRgqGs3xz$4AmH(bw$0F7{jpy&VT{6qrFA}_i+hiqp zoqh0hEa^4Kipz|p5IWYmQY~eglQrYmi*fzfiT6(9vI;SD6itjvJEQ`Y6TQQ7JWf`k zcao(if!-CRIy1b9=g_j_%~&bhc|B6zlY&1u%;Ik0o_Md%5pyGYxv~ZFL2iu6KEufDKS)eFK?+5L-G%A1&h12EO5rN!|&&aYXDcKpNpf&8r)-eYq!bT z$6K$+XQ;f7w~b{BuR)rPeZ8HE&kx1DHd%*xbCnp%I?P+D2xVn@S8tPbM101w@nnGBUW>~N z=Wo8aQhlL#PU6b-kYQAg3(x#FkR#)jGq6tSNV_O5i~mQ?{vWyQf23+#nQ;e%mNZ^@ z#?N7Vo`P%jqnutWKO*MnDMHUuj)}{osPj8wj-4V2pW(gJDKZ;!{1ov)PK?WD+5MC$ zLfucDBGmn~xI81fpFTyX`j zUou6g`=wKax?dKTG1>jfDMH<^nj+MFd0gI--LIY^)cx8iLfx;MBGkPyF5k-TH%t-g zUNc3g`;Bq=PD*=?yu;h2 z2yMN0csD3QV_xO$XL0Y6n!Q7c(6!dx-f=~!&fQ*bAsuZ*79H8{@un&=ALD89E@WAs z8NmqY{C=Oa6!HD*K5r(+)Ohws%>Kx_-b`* zb{_E7D?&^9ptoI$vsboxdljLz^N4p$5n4NsdA;Y;l5R<$ELuCOy=hXMEwjU$r3iKZ zx3^Fc>b}NXF2&h0JH4%nQ1|D&J&I8G=e@&ox;ss(n&X(EjjVMChU-f1vLfv2U z=16h2%pPy4BGi4ow^H&qeZ zPk;Aju=H?c>OSf1U|Fv@=Rr;PT>uj(0vbgs< z9(|CdhwsGc$+kyNyo7qWKbM#~> z&M|Y2K2M5s%$%dANpaTc96eo%v%co&8B(0}HAi14#aZuj^h_zvdY_{&5|ZG|;T%0n zigVPOt7j`hTd!BoQG~W$UC))`9JNe6PZ8RBeR{qkwDkt{0!3)+4eNzcoIQ6(y+{%2 zo~#!uLfv=LOQbk^?k;+%BGi3Xy-X46K2I-Kgu3sgS4eU8+y#2IBGf%iuT_M)@2%HK zarWGO^?F69`+j8*-T_e{M_5$b-p-Y&&CVjromR)o4A zrFSSo-Lv#gMX38?eXSJdh<$?Ir3iJ;(YqC)?kDO!Qk*09$@&IGsQW2;uOievPw!KN zx}T}{v$#izCHf$X`)p^4KBC0rBWsC1p-3U*9Nn|jJpwF)6zUO{9?jV+i}Y+3ckeFJ z^F>U2?=I4-S;UpYwWxEE-XiNbN54z-l%I0 zWg_Nr$jy*z^>!)GLmDCF`lyuuKw2Ox^t8)4EB+S2bvhd1pY{CLzUY%;SLj#br^=_O z^DyeTG4yWO6ROOhr@Q}VS;)QC&varc^hHvfIu&|0%a)nWl~skF%TnzbK`)x;3cWza zIOD0*i)0M_bw7%!)Js{`Cpg_#>KjB%{MlEvKEmQ|ht>L+5<{PZRO^%5#MJ1CSI~@! zthHFK8r>^|-$h>sxlu1uVrV?IdbJ{SZn{Ztky*}C+@iNhahBp1y@N$Ob$k<*>-4oE zMqBnzT-QKu)i+4_5%cpg&QC6N@`ztMnE{X1{=Fy;F$i0Ayug*_-t)DfIo7D-qMI_prEs zt)N*SVG(a${f1u6dgfKs-Tf^4E)0dhU0R9$Zd! z-1oIw^m$Sqze?P#x9F)-UV_klL5rR)<;HkSh7@|tua`-ozn?3lmSyA2Gcjg*R&c*wFJky@F{*RF-Yms=F7bfgDuv!3qrW}4W-ODfC8J7V12t_pxkDSiS=16P5ufH=}zxpfg~ z{YC*e891bamysWofOO-3N(;zjFZhce=eQ#hMdcCTrm5Z2bAoPa+ zIz3-Xt&|?Ujio_b1*t=w*W+8l!;nVE`nc?k5#9}XV~RWk*`SYeoh=DY)|pahK~|J@qHdM7Zt zlJaR>TBKZD>%_FNRBFSBq3)mRxs|kB?!G*zm$Ha;O0znscPT>q#b&KG*F zB6RK^(%V?v^VgU9kPwe^)cR5%kulE9f2mKf;CC-ELfTU{>A6+Z3*WZ*SnN%k^@rXsX*8lU`v!N} zsn@T1z9O_PCiG&K_3@eiT`v_9KaTyb*Gh4=`9Jg?7I$6zp%>IpFL&nu)LU8HBfwvJ zJBvH>f9V}koSFYyU#kesyk_8E{Ih<>Kd?^cyoTozQ)CTdwwof)L$)`1w(0IMh7_UM z@ED0V^89%AL1p?xW2TWLj2>m(V)QtD-$B%_RFOMHEVxD;k z^Jvscxfnv9(Ah@4lr=IYVl+$n6GFeS9yPj!%slQ>@k!r~MxT_sAyg;X7?AQ6!`l;(6eCB<=Mak7&B&8-68=m3 z0`Kk`1uQl3ziha>Q6j}YSzH^>Gb&iNBskZ!dm8mJ#<_ys(`XgKcT#kXy_eA;#ks~# zHM*rZ*VyxoJ}J&M_IzWAWy?(G>V3X3CS#W4+L+ehd_$|_eMbwIifiNfhL^>?Q%EzC zMU2O}FGw@eq&W8uX-1~VN^q{a(~KMu!&g>xPn2d9$*lik#xk(2?qifl`4B?)MEe+J zEbcjFA7e<$T3p-EHUB?w~5M5ul*W37~F_%Dh%(CCsf3qo(o z9b|M%2}9`K^C0)=2cdJ^!EreR;={iO8-p_ISo~K6|1LB}q?~~NqQ7Wxs4=Dp#T;f# zDzXdYaKrO2TGB?1vi88gM;ewQdqa*gl3Cm%f0i+iMSL&&K*VGjSwcLqOYw;-i$ROdKjgCYfxUn-VcS7jMc8ZZCM0*lKYw#4q zVsYo^6eA+DoNA!i!h zES1_D_%Et+wvpRFOCd)1I%J6vxt&ED!hgMof6p~?ShghW`l$FWRiRNKW4^-wKMKEy zbiUEWQmOq2`2_!7Xn2~a&X$Bbkwr0=7%eO{+VmkfVwM^k?hrA~v982OSw*rjVF$!4 zK~{+|z*3_f+a$K1%Z;o%DF)95Wz6M9hm;kNF;p%!lAA@$Es)#UUc&#U?l&8W_fpozgr6bw zy|y|dnPtmNI?ktHxo$P)NulHXe3mqs^$^y@r7T%e_J(9YZZoQd%zXY4apeD(Q7dB- z+eOU3jD9K3cj)SkK`Ch)#rdn=$h}XD@MH)bjc+$9q&Uw~8jV^Z@n<`YMxB&vkwxd7 zMx$QJV-R{G)MzxzI`2a0Nlv5DFJpd{F-^vxl%2j5PoJ8Ml>2!+GmnMPQ=>bKdLi+r zJ$D*yts-WyOmx4?XqPhQYVoA&E~ASDTOI10h}pl(@IFXcmD;tCC6K#~RF($MZ4f$2 z+-GFSn8zU(A?7|KTgnTNWsv)g7AbE)Xn%ju=#|nBS&o=CBk!SU8uc24RI&_9p|cEK zi?$gfQnnz5o)tW7j7ixFp*`UdBhn`7Xq$vQ8b5>3`JKKy*&Y`<0?;=0cwFWp>tt+) zPsD}x%8k$Ad6dz@mEB|AYNJo~qN5G{1=7_<(ZkeT#E?8`)Us4+&Iq3}nx!}+eA?(> zai7k07=1!!I_qnV(J#eWUu%pJndNM&Ym6}|0W1YA*BWC|%9(Pxo-sU+@Cf7kV5d>S zvL(S;(oUm-rBZ7}*6o$BYeRqm(n9g_@dD*;^R|i<5k0AahK~=V-d^7__}!2$dcl$i&u?&QAcx*^RF63A|}2MzG~F6Y>Cg$ zI-^}?(Hmtn8?PJVQa-}6KZAK*Z&*+82sM%yAa59LES1_u$U4ZI#;BBUWK6G7yqdB$ zCOBKdJ4P8xjpod1pV1*Daae5g?;4&bMX%YA4^a6%W1b>|koS!umP#!kvpzIh71@lK zkBp+Hs7|G}Gh((vJ~rA|HYPaR;b%q%i@Vi*Zgk5mXRG_%n3OTj_Vc-s^t7l)y?bAbFou{RqnKmX&paGL$LEbkiI9XP zkbfX%qfyP`K40Bv)G4w*$6&$n&-xjq$T|cvY^;@aZh@Qx*=+Q()Oa3~y*3;DER~)O z5IWXvHil%(S2AXcF(PBO-z;Lb7~?W#cLk}6`vX93s_y=E3mgVv9%F{~ZkED|wV z`FXgnLY86HDRKZ@f%wcmMe-p5bC9J<`xccc#x_S-D!KASkce6Mf758p{P*>i zLz2yY7WdP@oy;*Q&i(1mrnQ!`R(a;%i|bir?QAAXIY>&1nZ|-|PHho)n!A~~ELGah zaj9mh)H34I#Ns|l-pyC1X1Wt2x4ON} zMN*utZf~#n0?G- z7I&WaHTzkrwBKabzUDYfqc-y^yp4eF`3=3ejFb9h!}!%_5ct?M(=+_oK}wC5zVJF=met&nCodk86c2 zvscP!Tn2>jUzgB1rntxL9)%ohmJ9LxEVCAy)lzQ6mPy;jVzW-oVrf=n57fyvyJZ&L zjc$i|KHlt;qK$|;Czyj$WT(&>GA&o26VVvvSQgC5DzF*X&VZsLmaxF3Iq&y&F3d}YsPs*4Ab5PWY zA6w2bM--u6=a`dr96+yw7xDdJEXh|p{?ZtGxaSoV+SvB zVlr6piyRQ@b%8k`W1RJMp{ez{^Gua5G*c9zwR54FrUOMG^^K` z1Bxs|Rtsqx$&mqk+Oy)RLxg{4wk6R%wUKGngu z!Xfu?<G^=VuhM!ko@Y_H%1l?}Wk|J|&(ffMju?^}vt5b#FQnG&Q{)rKE#|nAMe;AR@WZJ~ z+GrO2kCd^vTT7!krU-2mtHwj`^3gp$vRK4A{SHgI%1rr0#5mi= zDzlWu-Nsg#11#=!!YVUokh6Gu{*~(#2#K%dJIxX)&Uo%LE2KE*!8^@5DM2jPK40Q* zft!h+xs~Zid#7nBLi>BO*(5}B&M9}BYZalR*4<{0B6QTc$4vR0D{~edwOY(_Md+w? zpV_Ji9kuQ^gF}>6sik3r({MlhfLX#)qh&$p?9gVGD?-mN+RTcLl;y7Fhs}Bx_gMF^ z*~QYJIY*>N%)~D#t3k^_WjfZio7pUt+EoxbK0js_%NXZ#tH;bzA@RNPakG}C#^XFi zf84B>QiVFSMLlk|3(@Y9l^-{AHi`Lh&JK^8`7Eon2NC1Nay@PqDH4J_VRkFBE96PD zdYJ0CpXNMm4oGo6&3W1!W^uQur_Bi#u{Y6i^=UJCvltJ3*0unZJIrn=^r;!izs+7n z_Jgc3Q?`gKia8Y0X%4VdYOApnB+r?_uPLTddr2<)TC+&X+mNFWv)0tUp_m5kN62xI z7tJ)58a$8?>*6JIp&~Tqm&`#So*9Utd4AdSe9PnUc;k{OWzV?evbeMHvRNQv;#UqY zo3%1)F|tm^cwRQ^rJMyhou!4P%Ck(yykf4EF*ieKTYbgsmhv!!_ODmWVJXfhhTZ0< z6z3DeZgYaA%F`|DylO5QrR7?s(O>;8K=)V8TtzN~yk;hiiI}`%yoV0yG1C;e4)TVX zs|Y=%def{`0_ zzd$_JfFen_OPp;b|K?`Vvw$6}Qbi7ic&#o)PJ$Sg_jfm|7~-?a6lsKntT9Dig2b%6 zKisU%ke#hQmIm!tEQJ^MSG!yJlN2N5Tu7SL^`|TUh8$?6{_WP8j%%_btWre+kVRIP zB6RdW+KS+56m35=KSx8dtZGFrg=AZv1UKeRNRE}S$WxG$tqw&tKu)!ir@2|1Ag5c+ zip;?|^=vD3I>q44nNi$5L(a4Ewj*iOVvt)Q#nv!OgLV+)9>}HEsF3)P_EKwtMLflN zgkwD0Q=N6Qk3kk40hU=2mKx8caY>PKYg{s=+!L34S?5W}lc>DRDv>d7$E8e&_7#NA z4$G`sku`lZE-fpSay<^A(vSLEMmFVL$0t!gm|>?#F3=b8k6FK z(2=Cnnq*lw%USj-E$>X8jakl8Txlf>ndXe}N-Ld3^!hJ)U1=>6!oB(-S6SIosMi2X zo~RS=wcIL};`CZ>l?#dYT5i?LI(y2cSZ=il(GG!phRVyWE=4v$uC|h9(Na`tCnJXD zx!g*Y;>>)xl_iCq5z%@txAIxs>%(%Zl*K*Hms|BB%R}pwj?d**i;;kf$KiaNe!9 zI)!kZS&$m5b*_l%LW}{q*&1YVXZ2<)&&x5KMOT(LTg{3jL+Y#~eY)n6PiYoF8mvr3 z_JiDRl_+v3q{(VixQ4eTm~VtU zZ1pPA26@s-F~zdKjb(ox(rGnYLcWC1midB}=p$*+622GLkS|y%ER`M$LT@d;Xyvg~ zX$L~yLY)__5+R-($or5kt3t-)LukL~vRW0P{o-Y7Ov)9WYS0cr%x;|JWvPn4!S%kCF6Fd%ootpZ zGo5|#eXCH$TosS0lj1yAf8S~o5`RASzSYB0ewK|h+aPpD_P#a3vTk-S zWMVbR7|WKKo8mGdv$jISl1{Qzd3G8T*Q=PH2rcO<&n=jVR9?~~mMYIe#O%XT%2KJF z0HN*YeXB*r*OO^H- zvgiuG-ztkyoht2p2t9lMz_NBEsnmub8CZ%BtqPVZ?R%N^k<~6G;YYDt1J;lb&yEmU zt^sR8%3*QwCW~IDK&bnGH7F%t*7?}V+evi4BrZ)XRa!aZFpTG8Ythc4PNR(Z#7f>p z$dix*KfzmNRz6Fm_PUH2wE9@qP5&>1MmT8oOZg0PG%62TlR{?y0HJN;OG`_k%Ijt) zZ58wLrIjdU4+zCY*(ztjZe1xKu=(AFM2vO6_{|qIL13)v8Dt#`B})oi|;}#0VP^Ls>srB@o(HTOqXUKU=kX z2zeSp%k_)ZA?4k;46syc-^681%68*UR{CC|jt!|m!wd6!%s>>mP2N9U-%P z3l-TPlH@B=yVv%Ws1dV=OdNpW`sJt06&zF-f zM%XTU?d2Ph(h2zyF{!@v{ls|QgU}WHd|!?t9>@Y;lOiT$Z(pk-G048Y4n=l{?B^@V z5aXdI!23cnd}S=+O6DNQfxae1vLJ`}Iw8*07d^o=NT5@HVb1rKy%mOzg5Wh+t) zIm%bANI4|S*P%!)(0!$^gJs<;=WM>x zx0auF99M$Ssg+U$r9lLu!1h6?q0y>l;wy4am*DNeCU0 zXkXq4xy@I7nA?l4t{QzEiUfYZRkv?Ik$oVmd|IZPbsVJGm#Rn+=1V=C>eP6gtDQFALMhHwQ=2ba3SAA-dpm8ud@0U# zW}B~AN*3msj^S;-HYv^(W1Fv&rP5P?7<$Ur=IaxpT?u&})!Td%B8%@7=otR6&vOKi zkcG}E5Bn@tQ0Ea}iXyL}&ZE9`MQCey%vT~Le&zY3uT08Kay(D^Dx^5e{-m!~%AJTA zM4cyn^$We_?S^djpU z$UDB4qj}~vsxu4MK>fbeitGXT$hVe7WG#k#>MK0P%~}fi!dIrq?T}5rS{9M@0%XLO zk>zH63Hi>Kt;lR#@oe?wvxuw%AQL|Cv2NCRkiUHM6sdCaKbhie6&ze15TNYLM*$YMy?KLDXQq&mfrWPkZ$w{inyH-CpB zYasLdLyCL|*~{m@{tb#81IhJ|L7d7ZkkkG3 zCy97mHu``Xbmp+_prEcewO+B zM2x2p-RXYk8vg)`m_y3C#y`&Des+AVKmTN!jVgXWitatH^=IUgRBB7*a+UjYS*o-Z z5V~h9_m@h!1wzNE75)y96+g>d@9&j$oU_dJ{&5y}HY)syr|{MiKg(43y{h0WQ|V7u zgw8T6{b`EOS*F@w%+jbmfbr0gwANoOV&dnWoBVZBob%32{w68THh+`9MT&FYxyj!K zan3vMqw-DuAw@og-0TmY>c(t=)cJE1`4MuPznrCt&tKCp%G>?zN{k0PWI$uGa^`}9cGvoAM@%+#~B4cPv2|!-*2hR{$B)dai@n5acy~ zA%wO=iphbj_t&1uTMNs@khlCTic~?~_AknJWA2B%=g(8*Wyptq?JPHD2=b{vsL1pQ ze2VAqQDhIu7XPRsIgn9*^V#lFTm$*Z-=jza5EZ&?R26-k3^AIMQ850VrpRHPE32TB!r5)ug1De?&<8fax{)SkoIoAo>1$qsl5 zXoNU-Lk!4nfjS871$2hp5wd%rTampXdj!T5IU150NIu8SIuo)WkOiS_gX&xbNe_%F zF?T=?3M8NFW_3Uo267a68**5nLXlC(5rKAyQ`!3m-VP1qoaffbfE*X7R^&v;34u;U zmO@Sn3@dUI--53Pt>r_;zBTLy?0ZMS%f` zQ@IebG%&&|%93F>U8R%2wMac4ic7Yr74&<6Z znj)JZD*|~C>P~h3gscpVD>30eaTE>AyU?w(FXZMxo+8IXZVl8bauK9H&;fBO-we4U z(5=Kg4Y?;UuE;x(djly&Zm+G7)(5CRn!Q;ZM`@>(Exi4Yw}k$I4H zfjSoV9M=cYNpYS7^ah5c9Dkv>>;G?HOiCu|(6!Cm0q>=vayEpn zf8GwDHU4>h#+eYhx^Sdt#`%ylFrIg0OwWvKAm>8f4b*X+^)u@r^j!VjKoiTl>Fp4D zmium?nWaj59#YI%xyz`#5USiCC}ep(p=T5J0LX`dB9?X2*CUI@{86A-$n4J`H0F;2 zB`oeYo<0iHvA9=69|gKtR(Y!bg)1FY{wUBR<=mx?j0w^HMr9E*!BP|d4CtdkMhT6% zTH6UnbQNp-XRY!qmGVhoNXku8J`JQ^MwJ`2cF1k0 zGZ-jisnXtntb%+V7?3f;kb7COE*Dt|IO?~t6iEq4`65uq;y%q73be6^Ye<^ap}-K! z>zcFPhXUg)J({!LHwL^{P_G`%S?`+y7R!2%v)(raf-DW%0(7TmM4JK`LgMd236q^GTEDhQzvis&hD~r2a zTLQx}<`Nn6RUolcESIySBY{ko*EMH5{3ftS#yHFVZJ>yyQmaCpHCT#o1NAKHra9Z{ zXrM{REN5FC4K%a3>tZy}#o``YMgx6{(7nTGU{Db{0(=)3Q-tm&z7I^Yxc3fY0ne4R zTyEv90ZS38vo(;c2=)3Ykg5n(9uH)(xRrki#%$Kq+gt{jN^R5;#bX`L+GlFG`(DShw!D>Yg*@U;Vg6)bd zf@~k0RD?d4nHfyJ#;trjVrB&=uO+F}a?vaA|8QLw>?;>iAZ3SO$_f(qbH+Kr0v7jk z#yP=y7WcjPxxo%8%TR~TJ9C5GEH$1=2(2A&uulqIi_zZX4UR~0J{R@|ldj|LGo5!q zy}@J__dCVjV5$`7JH_5$28+9md4pMs&^&vCd5V06wW9~S6`^mxn!ynk@m+?W5Mu>% zucz_U@I5R&wGIT!6v1+6!Cw&rN>_G4%&x&KDRVdB8SD$Vq7LRMvKL}@50)viA7qbUy&{J| z_6oMKRBG$dJqt1)3r4+GXYk6B4vjg7s1s$e6rfiz0r+oDm#SWFF+KVB{t-8+H%wgG*Fn5#K zQ?3l=v$)^%zbaV7g1-)v44DfZPkYI+)TRI(wUO%nD>R>*L z`@R0^U?Ge9-JI%RsTAxu{Ocb#1cybP_>s0In05zMu8IHNMNP1k#Xa`c1ly!I$KIM? z2TP?^jOC)Y+-rjUQm%r~S?0#zxRl57h7PUe+F;fy>Q$+&M2wI+DRgftWJpRIgw7zf z!Qh=Ds})Oe`w&Sni`d5K7+xE!6B6IXZVI-rtkRxEonFlRO~JK_dgJ!n6dfE?6(+O&N1*utN$}o`sm(g1u5cgcy*21rzV0I*l6L8SetA59YG0 z(td_yKyD9qNZA4Rri&p>!Q8t=_ZXxAvMSgiB@J>Vq&XP8N5mWsxfybIFk8wokUJnP z!6GSFSh&Z9+!rj7LU-6tv9wA#1=0;^4fZPXG33GEgj1&$S7(s6U`mVVeg$NQ=?U5+ z!5k?coQ*qHNPDnek;RZFf-O?MLCjLfQ^D1Wv_hT~@ce?~_ zEI28pLB{+P%xD#rNhs#$V5yV`A$vn6f)$FK1o=JKp~y9mKZ9M0JOt4~lZw0#NepE@ zAbL^dKOozOnibh|`vh%vXhe}SAag?*4^mcx_BgT{AXcbY%1e-^A$BPJAyN4g$bTTQ zP$moBPk;7P8vhItw6shT0U#fy@tiA9iD|h3p$@k}`~5 zk3%v-BZ@o+IWUy`h{*beMhH1LRI11akcFYuQpOQ80y#9)tH@T!VWCk)wwsxtWrmU- z6_qK=3pqTLsz?gth)}j7^C3ruiWNBmvM5xiNH*lC&}u~rAV-IK6}c30OlVY*8c0@X zQjxnL{|qIyyCZxKk{yaD@*l|Yp;Se-KypG075NQvQYc#y|EvTpH3rwGmbvQUO1H1n5*vJ|12zao^U2+jPJp&~_S=9h=c6rq{FI#jF3Es$$N z%~B@ix>ylfs|c-&>p}yH(7L!jG@%Hsi;7V239+P9ht@@9C_@oi7b`<~iqN{K3Y95B z>!Lc;tO%`(8$xRpp>AR#f_nHMQB~rh7wo1ta=?R1sPi&7o>VXkFYLYEp#OMN6nniiRi6t&sad zJ&HUIxj!_l$jgw{P~wwfNhxas^?as7(=C z7mtK`6rpwTXlPiGL3D2qjVtm4tnouOPsXy%^_6)HkAzcy5=2+jNpp=v2_Z->v3(7h|PR*@4RFNZRo7Gw5cRw?F{ zP_Y#Hn-ph4UJaEgauH-*s96f%_2XJ=eW+VX66(+u+J?}WB6NlJW+=Hs^ztKyt}1&& zi=>2Q*4v>{MJTH;)Fx$D#9W8&?}hplxf9YK8kCZXn5Q8hhCKfky+~ez41_F2`XQf$ zO4d*ezK@2O?;)RsI$7|yQ6PUpz6fiihWQH1LJ6e?GQ>iiO_m2$qU^IND% z5vub?s8tcF^Jl165vrrv15%1nhwc=n+e1?5Uhh)GB-$yRV!2v3;j;k947*Rt)yTRP zvYkDo$YT(Xz2RArMKQgQ+4g`UV~{y^|8pXy1~K6s5;VgeR^$MPW!L?m8*>IEV7Dl8 z9mKYC*NT{bp$@IVm|Y^}PRL`3+0m|(a-WoByNLzw#zX!OF+15Q&x<-QLFj0lVh<{^ z9x=PxoiB)(buwmmyZA*{C}y6$s7uIuGG>z`K1;JFq#TBrbMVCV5POnEd=fEW>*Zeyv`?ncZrL-<~;owAN% zDz!&t)=_qal(li`XQ|>(J?MGnQFeBZ$odarcEC~`Z5OhL7$4*qdq{~%h8$}bzAmyp zMixCoTWk-q;Cn8z*J68w#eEjH*v?$fOTkZ{Xh|2_Swgf=-xSNf*v^yEwMl%Yx!5j} zGI$nZ@SHZ=E|cQSPqtky#d(64ZPy8j|L(!@b_+{`HVscMQ?V4s+mkH#4K7FqB**r= zK_hI$58??q(Y9FdR~R5iBIYDJTgpPnS&)o=}}?53{&Ws7|#6hK=FjpLN@};TcFT$8>RwyG7;O z8(7?@yZLr6%ev{#FISvp_pwxIn=u|*inHti7WdQSv+N;}HH~_Gh+b#e!z^27(r3rC z)h)5L|ImzWocSB-(C6Jt>_irf2U)bgFR?u$CLsk!BU;iWb`p#G>B$n?Vi9X+2KK=v zc8bh$o)Q<>sVw3*w7To!i?o@*Dfh*_mN=h|gT7CrAh z*RB)dITmC72cGhsXE!NXG-K!4ZAupX?#g*~H_Mg;8qd$De7>FbCe4rNl`t3gUv@T& zSkj+S=K{NkMP$)Z6xriS7WKL)zNF5#&s=e~4Of<6%yj&@$o9TP-Nii5Lida892WeJ zG-Bves!Qx*mMsZRZPR+GqxjoEwwXQ)_a^@%j{Ain$v5UJ;qY0RbWYJ zJ6vX$ze9BzH2RLueAHQHxAeJ{_lK0&CGV1KOlUwBZL3$=6H@*Ip>=VUt-VJvTN0ev zxXK=3arfn`>@gO6(-!ZcACJmc*=_Grmizs|6?P|!dyHCPcd>{qoO-RWds(V9r`HO5 zkfl-E9#?ReqVftmxt}UGYRQlaNQIrpB4(@(Qfb$+xXX2e-7dvht{d!b7I(RBu=|uc zt*CQ@o%?~9AG+SB`MKF{m2wG$#(cBg&f?a&+3sL*KmEVi?qU%m>_p|8?S2+_oz~f& z52@Gs_&Tk#D_BIQNBUqY* z@cBK9Wmt$tzlqw18GFE9_$iNvN7g#ITnLValr1PJt9b-nJLARB7i!=m_~vd_0v9 z`n)nOa~mPltIvs<>#Wm0yLK~GZqyz_%$2CzXK#@58suM)4{XmCcYf%c@}V762qpWZ3KAE-uN^#x$ zojoAsZPcOT&-eC_l)oVKyZYbTBU1Lpry2A&1%9x{Slr)@|IwZhF*8pp6IUre+LJQt zTx3z5AMM1iXbrlbTyM2gq&U|kTkTX9_o`{Doz5cmuNg*yw$&~b!k;N*K>n~hMyT?- zX|xv{!ZIMmSv!B)>0gT&-ZBxB5MC%`ma}C}3um&3UZ){uS~yRLrx8m*YjAqFNY-)o zxar|CDb6-OBitfnmb3kA7hcVR?;xPgxv0EdctplH-M0^qvWV`qg>N68_YIA?#`7Gq z=&H#RPGb>EO8dJfTqecYb7zHXr8whB3fBvXk7tK)yA-GU4&l`-qWdz8aEEZWB9)N2 z;lyugJXM}oFdo`d^l*}t|3VrOqlYaPci+*&5fe0d0R=`^XcK?Oct4ip`U zH1jkY=Y~DMa7?`WdEq1$ce&0B=ZYAfdD@;Y2-mT=%T*K({wkKsgU>22LieTNGAVmO z8X=d5izdW)ob|puyjn=Sds(=HMRb21S!Ll3EaH4I1i3a`@SD3_laTAe*}uD$XZdh7 z7%mkO-2G)DZ$_Pm!$B6&>kh~x;bAG%>wd_i;V~uaHOOjIPQrm8rH{7OV9RqnU zT$t$gIsx*2xP(RYx)d@Hu8=X*i?TimXU%Z4${?SH^I1d|^%@En$rvYVW4KqzYCz1F z;Q=MGp2cAYy(D*RqH# z>h(*wNya!?zlKM*$(jgHC|N%v>(6kaM^vUP8sT5z4N_>^_zN+Ahx=JXFWPexBST77 zG=R??A`54_Bit3TT_lS|WE}>X9m$h1)Qhrqha|B?gN$*q_KYmtVQSW1kt`OGwGmlqkz5%=SwBGbj(F#|S(A``A`upml^n!p0g+T0 z<76EeX`1V1EkMjck#-ih*I|)P8RKMSMpC>}vks4>v52gbQ0M5#LK#C@1(0JRlSrY4$qG)*s*2>Yh^!6Bs*RMgtefWCSKbn75;DuVudItSOL6WZ z>muzk%em96i>zg-(r&|;`%(GUNWTydy(#tu%b=9!A)8r7q%6j_xab!`Zi|dbaefE* zw#cNEcaZhZ4fs9tNMeYVtIG2g-4`jB z;#{w`M(TvbuYVqhv`BI8A|Hsfv50LW594_tG9v3ZccTwQCZsr(AC7opG{SZ9>(xgh zUMbG?>LZb47E$>ERDL9qA%w5}=+5`C$ZC7MAnkvu6>If|Hf zB7;(#wfuf$LP)%Fe`JzHRNfz1{Shl=YUK|j3#B-f2O^y;;$H6WYbeqtW1MyRWu#Y%(`z_Vyqg%0vlJtdQX%nPUq{MW@Y@J@qm16? z|2opSJ7tMpm!sFWkx>?RkNYlS%@dWKUOz;7r8vEQiu4PK_Zp83vWUu6s5~AS6%zkl z&|f0Cdx*-;a{Ur1m*VuAhzv?`dQC=#g~WUP85v;_y&BQ$&xm(Vcg&rTglIF1SQq_} z8PR!rQB0-Qg>ChBh$q_1B9=Wlf~&abxD@KXA7qDUZYo!fcb^l@V-e5UvJf*TS|(!n zxx@t!J&H#7r)S0&=(QYTM#nkEeNtgY6aPV##Zugg7%S>!>Cq_b2}mH?rNq3-(x=2w z<#4omKGhN9`HH2JMLdnC@gz?fj}^tYtD@NpD9ats&e41pF`hKU>=G@OF*KgDAoHTt zY3`V>W@%v&W2VaUquqPEG4!pm`OzUook*#F#(en1XHU>>Djo>U@cqeWSJ8)Y&&$FY54kMmc7+ zlmc|8v(7PnVsv`l6>dsAk#Rf@AW9TCmkk9)4= zAnG{1PKoA9agG3|MJt5FE9XV4Sw!U!<|i*Y$Wn>l>J#fLKbn~#DpRkc5tAS7XQ|Zc z5wiqR5M6X2#Z+n?kmZo`qMa;a4boGr3!;NkXgu^3t0>xX5Lb?m=b~sEix|(XsB=-Y zU&KtK?zG-7iKZXyE-5`}Ulz@m!b=LdELtWcUitE9Ig7h?E|1nJb?6*d8ts(g%<5H9 z??TbbnZs+MK_T(V*G3~OqVoM1^R>}3mW>Jj#cVtexjs59Vmt=k9_@#$jE+iiK4)AR z9cOXRASg)90sm zMki$*XSwc-b|2=hQ(71IL`Q_gm+Ri>gp6^P{oZJHraR`{F`oOPWh|B2L9*9_(SDY7 zy#3I1%Y)IT!>9IoB-$m#soWkdID%v1-5-k576R-S4)N|z2%1=krq&SuT z9W4+Nue>H&$WrCW!Iil{H*s5gpT1aMvFMc z{q+CEXsZzZt60?Q#b^hMJD#p+7fX-k)Ok5xxnEX(Ia+uWjj$(SV_b?@#LSih(ywNj`~ou!s?UiaMW0Hwf|Ug&4YX`7GKm#ktS@EIKH~ zxr_WPIxIvx6j}6(C7(sdq#O&O_Z&WtrYxorHfkq9uE4hOMKo24^H+esh_1iGEkV}SXrYX8*2T}!=54Zmj;>~D)Si3<-{?iw z&(VGAN$B^eBe@2^G8niDV|AqV=P0kTn z-$6ctB*eOc>vF!9ox)Dn} zk$MR!MvNIt77~BY(-)g3!_s_plVPShAEmAH_Su>oqMomMX+UZ!FAy0l!up%VxnZDxep=3y~6QmGT1Q zJIJoF#8XA(4=)h2x_d1BG%;o$-bN_H8k`sF&J*$mvS@^2&xL99q*#lPR37HgJ5BfJ~E(qa=r66o6~^p?fmv4v;yczA>lBW9miEsN;B2C{Fg zoyG0GZ>)nwJjJ4!-#6AR#B;z$;@#B!VjHBqjX9)kb-!4@l*18oC9?L94N4h64BZp$ z9~%+E%e4;O4~S{`G{P+jn-KE>ijulE-DWxD*B!#}wLUqoK zl_~P%=OlHC%*7GlyjY8r`;m1UdYvEZkkSTegj^6SznDhoo=-1`b+EYW;(}P0BD5u3 z7#m>Ol0bhw{65qvij7O5w*)&N7sou8P-Rhv-WIzgmMp~cf9Ou{w-m?bN!b8-5n08t z3>NqOy5d+C%PMUR&V#RWOur)ULzc!0ig_ut&r#wq3|;$` z#5_wW%Z<4#<`ts-B4aL#r6@7Kq4MRibe1g%iC9wlRrV`lSuF0~?ktVv$(Umhvl20- zv09}Ljpxc(y%0^ur|5~h;LW^P+cq)FW2# zbn0?l6Y~nu_CcKxVy=m$ZWD8DEM3MNhL~i;TpP>XCZ;@=FJn%SG3BxHZDLl$s%1>R zj9C$D+9u|@Sc{CgNXA?jTg|dD;VK9{fw?{wSw>6Y9!0N@rATq!n!Y}kRKhVcJCQ~2 zs$Czmgd{j`@1u^CF^a*=Umt6hS#=EdrPQYuW(f~+dUavF zAV~e1!iOxCrhZLfV+9hQ#rfKWN@su4d`+PZBUb99dGy_ZLMP!dEw{~mw5BTb5TxTU znhgUO;;|+zH-g++Xvv7WgHmtz zfKs;>>OG#H6*>sdv%>SULRXJxcA zFO2b|?kJ2alQRAM9fesQ&z!;>;rW0pG(2+(i#(n?3rmD&OWOA`Ja-mWc|3O&)(X$A z!gE()LmAHmy4&#Qh1Ta+PtXH!6I%}xv0>EdDQzPHH~(A78QnCWU<=vO!7J* zj};~f(q53og@uCbM#v+?^HgEIMJA}2=8rGY`t+GX|8XYu32Hk+jOL|Y_1mo)#r(90rD^NK=$=21tI&1Ro%MPZ&r=yu8!>H1^N`?m;rbb;X+EXY}e zd`!qIg;^Gvs;(g9H9}Sv77B6$ArDdNe<~~zsXIjK)xuJXxSs9Lh2@N>`NXq`r2br3 zFNk^1V+kRv3u?T}m+94CE7UTgo+F;;iRZOKTaV{2g+zGP63-S?rhh4PwaDu9t;{ur zC5+UeS6@?DCOnwwttqS!1ikv2!b*`sufC?R&LXZ?UsKq~Nc!H^UkeQr*sB}J9^?7H z7RC!=z7NaD6hUH|b-qOT`fFjnAlngQcwR5W7dmfDr}g{mg|=nLpMOPfniLusQLkS@ zUp*q8Hw*m*DUzN)k>Fn$+JdG?XDm&wGXLWk_8IdPZLuScYs%$lnVSE%JIWc`Du7{wUoCTUcw6 zC)Isd@>`JqD72nv?0HhPB_w`?z71FCVUgE^=~pRLPkJ^M`UrBHApa`#7vup#b|Rin z3xh4f<@FKi`K++mA}%eZmk5Hil>X2nydQ4rVW>A+AbLzZll#*1$j-7 zTHQmCmnSRLi=ZlPb|?R|)Z;ATywOU}DdXuzJgxM4 z;dzfNe3dkBr8io{`KPsxFJW((d3Xt85VDP4ZxLtDwtAyQoStoUe5uoO zBuQjg1-zCp-#x{F1ep6zuHi@4rqd)28jL5~z3bHd&5?4ZYb zJZ<%O;W<%w+UhAD&)4*H;Wr$QMX}4Ju5sr>JA=HL3a|KKM7Ak_w#tP9wc}uy(}_SolD5+l={wkgdmp)(os*FY^0{D>jc?Fx4gopp3XcQbQ?z0EyQC+ zy$0RIflpC!bS9j0KGsEtYvoBiv+=1W_LZ~DwF!^x-;mM z!6nrD?XG7tlCEWT*K-BIsJFXbFH#uwcGnv$!gb8-RP3(XPBEG%(3fJ_Kb>@Ui!hIQ z)4!7*ScZ(HTT?WNXo47_tj&|cy1y+`|3Fsc|90#0l%re zpI#t{c_L=sQQcoJ6Xb2;F*Tv5Uc*TGX6pg^LqYIn>w&uEG?Rpp^@Ob^zB8A+eH^wlE-xs+xprvCKRBSi{N5c=wgf}s8!qNiKL z?F}BH=UQZfGViaL-sTXUTx)Em8+4^C4%K}u;>zMs-JcOPop?U@EseXn_Ie{VmA<7! zD`WC%KiyUk^KQyMbk_PXomgab@Gc?dMvlYvSV7R157*-bL9IJnubOT&uddsNPQjZJ zJY273B&~Ia>-B=5)*Y^g{gkCp>kii=EaGb2;d-J)CeYVtxYiw^XA5#sip(pMnoq6! z2))uGZpG1GuP@^t7?FnurXf=Zo4Lz*qx396VBt}E+|5}FkJ1wvNi94|PZk6g9;KIw6f8VSuds--@F=~(B5v1cpl&;h zJq8~R)Z+w!g#-0OL15uPU4Ki~!hyO2BdLW0btge!;XvI*q+sDd-Q6P2!hw2d8Dh%) zXg!<}^&|4?d(RtW4C_g~dW>En2y8w^uMz|{AEOuEnzi{Dy_k{I=413yL16PSy7kXk z3N|03+gilge2ngH5$DxGdMHb!77o%21%ZWw^kP9^;UGQuwycGN^e{$J3kT^Dg22K- zdX7lJ!a;hTMVy6$^fHUMnmJgn7d@AeS0ANTFj)7y-KL(7gM;-zL15uvT|b8{e21i- zwo)A!Ni7_#I|%{{2kS8+1q%o3aTakF4%Ra)GC>_hZ-;*+DH1a zZYhYFCwxphx8rqdi*Q;-&xN|JMci8NLft{6aDL-L-M~nIxx|IKlOPjm2iU9&F4SEF z`7t4DRvM(MAb7HWk?vs;m-(mUqJBbp4y3357waw+Jl%!oOqvZb&)^E4VZt+sa=|>~DtIOek4tMt1~RHSB6>iun* zPA}sbOvt5rfkoVXag+20L2xJ7Bwag?TM9~fl1?nLy6%3`d;;m2q`NXtde6Wl-NPb$ zUgF!9r(YTJJwh(mqsx%-gj}U3vYtBB!zp^HAgG5^^aept52xr3zsOoRMR#Q+t%p-| zA3>0>DSEI)+^#H1-DmWyuER=ditfQk+DDNdLC{A{(fvdUebf{^)FNEUW>qppkF*GT zV+DOZYO0>aNUb>ub_M1AYCTtwduQ_6;cC5*5!H#_1~coFtMvv!_9etfU86hPZ*0Cu z9Yo0W78xqYA%y&lkZF3kAaDGco)Hmpot{0PrJnx_-)S&i*FM0=EJ79$&rkITMrsF= z9iI7 z4BgKn&Z{%@&@$v1viT-G(jxBc+)O==^`vu>nR=q|pr@Uw=auPsh4jqSi@-C9%i?Ce zjFI&A#hdkq7I8Oe+^pk=OitYzXR(5x@6q+YG!`zdg`e-$-35W4@6|mlLO0`0=e>e?x|c=dY#6OZ=jr|| zMfcXx{vze#7kY3RkGUQ9K0UmQXJ6vEUyrniI}j;xBdPg%jFobpe^7r| zrpKHCen|AVy791X`zw=ES63g_^@5$U;5eB76g(slAWtmJ5xAtl4<%QC)8lr+JZXU?kPNNOv!j z`Xxy{uKQcWY5t9#UB+X2t>5VR9`dAKT!xsh7CxnyTV$$QO`gAvddVd^`L(gowTmUX zt3}-SzC`z^K>Ac5{VR~c709p(WJCorssb5PfsCs_CRQMmE0Adw$czePb_FuG0wH(N zzbCf(2l?q8(h^&;P)a$ln7TPfEHeybN+>g8Qp=A+SYH=Eo*dwbg3RGNGr;Pxzk{&o+C&N@tD4D zsa{Z~$IJ?r>NSk0grp45v--m_9<$PI~0RMoS(L6D)M=Q+Ld@oZYp={1a~ks|e+u6=^_oG(((>qWoGNN2gKWIYQ6c|q3;@+=|aiD$X)F34+w{6P<8Bz>asvK}rx zedb%J*LH?xY3$iaECapi~Wr7?b$ZL8%BWYTH)fb^oWc-gsRPw+Q!aH>@)}W6O{`2zgUaVMNU$J(rU`Z|UjJWc94m zvlvmcCG~Z>-?Lescl1C;=vD%@@EtwEhOnIt^sed}w;p1X}zo0dOYj(df}<1(cZiTK({$Om$iAlZpnzMCm!R~^}0b2^Op8NTIar} zM|)Bq=&{1nhj?xv3qR14J)RHsG~pR4JRj;g9?wU5p74wko{#imkLP2(RCvY<&&PU| z$Mbi+R(P%@o?FPCzw3=2&juYoZ}YC^3eN`JmXWlMeWDZLd4hQ6lAcd=SC8i(x`*(* zEIj|vBR!sf>e0gU9`P8j{!>pDB%rrQjaN77<(|~1dZqAeO+3b{pX&7<&u4mr@DzpT zGu?7owoFyhh7o$_g!QPT!Q%;%F2Zw=@B~R8k0(s}3(qmcW8S@;7@jzp?eWwkbA@Muq*aqF^mv*ji-qT>#PbB{X_l<;c$z1xglC@c zG*4Ro&iUuKH8hGO^^Bxn{jN(o3Gx(4o$?ud;Wz1Fk=4P=ggj4a)g{ve!JcqkGD8r| z-s_UJjMR0acLz@*kJTmXg$HMi>XHqDVEt8>Y!oT1zv`0s1!uGASL>1v7IF5pNG1sa zds-w@1c5y*lA$jeJ*!iDS|r06N!Nodl97VIo)*bmk%B!flKB>K>%kVua*Mbf;4P95 zMGwy0ZjlUKZc|U!gIgrS1%ZWIBt3r57GlM^Mbd|n)WR*2{(`{5Es`lB1q-)GW?95p zxJ9zaBJLc1%Vbp9sn z@w7{(3(u>>(?C4!l8qK&A0A9debVxeCUv*dwPVtqk#t4BW75kaZgoR1l0r(>dOIc~ z1i>n4$7GB}IIV${){e@q2H%Vo!;{uR~(sfMJ%A}nQA zkqt?Ai}1U6-zGh~CH*bp%Cu85xJ>FC;^~ykvxvJ}zH_pQk@SpW=cMJIOzIO<2YNTx z%$hnU^90$KkPAsq=Va}x%+pVhJ(I3~Hi%n^@0HB62-|G*?3FC4K$evuQ%Lh(N%vKp zchdtHZ*)uMTVz7|{erJ23sxH*)@;_5Ur*Y;mX+Es8E+Bhxq&qINY;8hy^;}sF;Y%* z?_}f}r`fE9dnZdR!ewgg>6>)@tK+$YG#{Fbu!!U7pVYo#c-##S1CmY_VS9cS7r9LES{iaEsa}hTL>bRuSTiINkko2$!OKnL!!;--kad+IEl+1qHNHLGu!TV-1 z-y+UG!;_5`asD|aX}QixwI|KrO6o1*q(&tDEaIfTlMJ=UYI{qM`R2l@$viYbV_ z5Cmh&smZ8!Oj@h!PBb-~`uS6nF^r^R%BjgXLEzO>lSLv0ub!GLvxxKRsmXeaOi(vS z+Zma({+r8JN6Od8q`@N2W2Ys<%Xs!7p3{>lWjuok8J&!H*Xj8tA!jC&E#mxhb~1Ur z;c@;sCz)*#E{iKkYHYIHA}nRTn{z=j`2DQZkCRaraXrcSWQ;{vk4b%eGQ%P+^@+*6 z53+hLNtRf|rG9CmJ~TWo^~uS=kFru%CL=AvQj00AtCHy!acNCU)_t6nx-O~zyFpm$ zBa*s48E+Am>b5KGBqt+3$x6*i##@A?4k4afl2sOYq6O|_yggYf2=0NoJz2*{Xl`g6 zK~lFTZT?|2bD5g*x+Cdjk=4N*stM+;!#T-pK~OX2By$Bp&76}g_@~jcy6$yTf9Txg zoMaIrY0aFIED;1Xb57D{BTJ!X&PfJa#MR6>$ry{c+0LEGG(qsr(VfYBi?BCNqkP?& zEV0O9W$s%(pOCpp*MDVwcz4prA}lq5cetD1i?Gx}()>s=w@hj&A&(_p zRSkLGwVlV4J{DoA6~yyIGF*6!g>Mq_RMI2JN-atHTg0XH+hn-#Kx%2S!jpP7Sz9Lc zE@^%)*;poJEc{(EG0dj*LNd)FoYrT=^I|ejcuZQYcQZF`OpLNpE0SpzVJVZ=ACo!4 z0}EFs^>J3}Pe~_>u+;XX`PHPC@EEC%gse^$dQz_?OUtD8CZ4|}Ys;iejd~-QQIkz; zZ8Fy)F0D6{MZ#m!GE(c3hGto*carWFVX1>Dt-mGxg$EYCmn`w5-cMGPNtrtTL9(t) zY7pu9I2qPFo7UfxQ5NB}jw7B8$t2-1X&I@FNw3W*| zStfNFX^x8P%cM;EYF3<7mrbjAak@n~tqCMmTbwUECas?m(z3X*MOJFdV#_TI!cr!! zR>j03+yfY?t&4L6LHpXKxS&kxcH-H#xU@{l)ZXoj!&+w3+MzhgBAnK*NUCjdlJFP{ ze@94tv9?uKYR6(*i?EbQt5EDDJdi3D=Xp}4;-WICl_a%Oae0}Pv9M!t>@Q`A%T~_MQVi$|B)QKe3uh?IBjMQ0#^e;}@J}Y%( zak@oZS_6u6g$Ghc7aMlSN*z<|ZV{IH5osP&9BmPv1KdQ&am5~Ovr;D%`&)#iZX=#y z#Ss>9Gl!FkD?O><#SblVohs42Bflc4lZzd`W;F8~E3Xpro#F_KJdxh^e0p)DAedd8 zUL4DaolBUn|D0Z&V-dE;+`BTWxX2>B*83-E{$8n*~mzeB0tS?p>N z&X-x){k%BVB5t;GcX5(MxITxSX%<(UV-c>;2_g3tm$9C7Zv0?zl^~cKKUiGDh^^1v zN$SC3ypt=P0|*)m;RY;6(F`w&X& zH^l~va9XB@KUM71F)Q`kVh@XO-oH&!PZx(-g!4XukmriyEaKYo3&rt*pe?^poWw}l zmR~5&vIyIAJ?VL|xJY=+oc|Yuyj1MdkhNz;aim39Y7z1Lu{g;hoQqcoSy@!OWu;y% zcCZLby-hrSF7~hpOQ}6*hE^Q!N&Tfb#Uh;d7R0lrIL{)S_Xa}N7FV*Kv>#hnTqOwd zzOJ~Ik+j^`731BFg=|kR((_KSgGF4quP?5%h%5K^iyJNC+SdogxRcRyiRw&!;qj#B zgJOe4So26iJ}maLi2EYX--{#4cz#Sg8;Ub5;!^*#ICjsh4^?TBMc5lZC8?k^$0F>F z2MDPtEwhNL33a7ag1{Sfr7m5J<|opcP*)mh5w`gm($k_eM|iN)wRLIXK3RLVEiJVO zOMO66ZA$Ab!nrW@d56-du34$CmBv}b`LJDSA|v)rHM1AjuC%d&C+=qST%snDpP6Se zBkA+6cBN^;WA001o`!v`R2fefMyS^V&*Tc8X~Oex%G3JmMvvRcX;&H}2-eH(O5+5< zdbwR`Sa&Ox?&P#9jbJ2QFSjd=5(K?yyV5+7LND5`w8$cEz1*&}$|CM0bNiC|pR9%L zOCtnd%fP)zhSY3H5Pwi`XKA46}$ED+{GI2e5@}jUL*sE0pRPNi8gtItT&_ z3#A5;f`x@rcZ)a+3#EP{1#jq5uLC))UFk-y7JCLtm-;c1rlm^*1wmT6G)<(CmM+b( zh)YYC=32y+S5jJPktdb8Pj7olD=DoglQRA(l~$GU)Dussw9ez{Q2MZpr$js*N~)Lj zYT7D0mTE1+X*Cc}$5I=Qr=e6|#8a?h@WzSM_h(*$Kl?Rl%2!eB!2b6kQ#GTVS zur!vD^rYp1r5P6CwC04@BfizSgBg&9FD6PJw$rf>QlEX@K%Xl6op2JJaJ)Qxj`omo6ez#QB zQ-n_u{ol7VQe%Z5_Oxux{CTu!&&bl9)FOxQOQ5Pcm3-0u?5`ax4HeSoF!dY~uZ6?Ej;sk)%s|;No}CJ`L=z!!3*};Aij5 zcEj(dSUgP2@AKm$H9AL6Q`5UVN8V4jTA1r2JrStVFZ=P=O8P#Y7oM>r`!QRO=ozZi zU(}O3L@&Y%Z8%iVd-zJhKe9AZtq$PwhaB1&`b&&|un*}X|LsH`VW09i6Q=!sHXNnn zgD;10HT~d&UAtI&Ts!9RBv#$T&I5&3ukRet5ZZzUOcCZe!-O&w>vj3o+En3 z3!QD-cc?Ct@Jyk;9NMqXk8;e~PiI6$FZ!o@L@$pkH20G61?`&s8VVkz^P;C(n$a^% z!|2c6+K%ff(rqe*y*`CJ^1aa78>y!)jnyljU#i8kT%_KYd6KW!$Ja@Ez}dbq?Kfc` z=y}qweIjlMn+)uXMf{!qqO`f{jE*RS_)Xz`rN*CWCVvh`{;G|eT+c#!0&Ln{q|o2Me$eBN z=XQzy8*(#j`jMJrX{>%N_Ed}i{Xo`Nvg1;yP~YJPpT1!AhU&E@>i<~yF+Rn;OglpV zU6ZzZl$$?(ZD;vIr7fkiy^V(Ra9<95)V@T|8@4?}YK63meFX0(>A|k!CCu^uye?ED zY<#57_v9dt`tlQrN4@atJ=R;G=+{v0S$%Y(%j-Au_fA1cP9w0%Gyk4KIl^$qyfE-9JRJ3l`9sC? z;YiJ}e6iyGq$Zv3Hnkq2J^A$$IOdfcrkh8+c{%1&+;4>H9di=jK@}bIxp@;VKWqpVK6@JG$7v+1cth3+;)C;s{P}uADTj-x!_BQ=N zqzabCYIjTN>9yCdaoE|3dXz_@pVOy(8oSTn>cIh$&Npd(Z}vZbC;I`I@A&Hj4a*h{)S?GLHkCskA-yJuL$#gQIytW z;Oys3$1k+@#i_onbISGKZHKSFT7G=HeLplFkMf~snp7`MxiO#H_j$7w*GJSZgs+wI z=5VMG_UqeO?O6T>;h&wMq56e{xt-9LC%ky*mJ18$VyjH}Gu!-TuSo<{SIuC?DvDUqDUzcE3aXUXfm-INbvwIP_Gb z(EFjSPm%hU)T=xke#whRdVdf*{CdW6bPi}2u79ryALttre#fKlN*J`k?)!wYU+(s& zO@C$T9qI@B*OeRm-8gl8yxznvZ9{Oqq#`Totr;Xj|k-_Q>~W-0AUh@ZBU zaTL_o=Z7~{zc25Hv*WSzYaaeju^W2)uwNd2IIEX#4Htc&93Q55K`7+-ygaT$1J82ts>Kf;(tejW{Jeu#PtdqMd* zrmM%`!}y2s-{8g{>R_|}V10hraFoYahMgT>wm!_)Fz!WUr?GEKvDbu+J?$-x)UJZR zDdW(GmPTrowC69jzCk}4seL3Jv;+39ThCZ6Wv_a-M~0D0rmKIELk5$4k=hwY74zuWZASIzsx((**y%rIEzPUOc^#WaUET zuM1$WAJ6Gyo&dcr|B!>7dHMD855A`Q;mgWD=NtaZwg=O$_LF+rOX>}mL#PfD|0AF9 zOCUJ6JL)$Y4Mz%mpnm&+zC&!fm|wIJ&Az?p zIZE<9RMH2Ym2>HxEPSIZb$Y-**5dSbc80oo#PudtKdKUseuDKl|3a@x&-61UZ2Z!( z!0iV7JRZ1q3mo+p^IsqL^MQUi+rK)0_&EBFEROc=M!1q=az1YuVKe*?%XeaNB{6B^MP|gz|p3|ZA zAI3`=&waa_>NlT{{Tio!%}WRQhh3ZMfAF&(BGs%9&$sf@gWnL(`E~sb$`cfPetG1D z{qjIL_~mQ<(M#?S;>$9SApaojg4VvwvJW$}69JtLQmE^!wDvnfVIW4|=Q1_P1_c z`A%Z`UpFr}T=+4+{-(?qj}jbq!%pKT(|@!6SRE&P-?Eg>1IjsR@cZ?yaXeQ0+wr+Z zu^xJRS!~c>Q_Hq-=BVZ2y?$!eH=pn>HDMF_=8D64*H0#PxP&3p?}!MjDO@edG5;;<7pN*^8oBmf-f(Oa^iaG*2CDpZXBm` zP_mES__Gf9Ro@x{i6!W=!Vc!vcfW4rIN0`gO)h}+p2!ql&cS_&vgPQRk z)Xh&EAFt=4bbk!}I?_RSSK0UCc}tkiPs}{&^X6qZUjX`|_yzlxpywtZ{IUi-?QZ$sS9Pj`G)92dKmxCJ)GO?YI#2H z$G>orLo%9Qn#PL<6xwaKHjHe8me|8zjG7i z#z{UV2%TtYs3uDo`MOqc-gl1F$$i=WJbZ@8=f%Trqz}I$40?;`G5oDthiXsCSL@c1 z>M8kyA5j1LT0B(!B_8-72{)DUK6j`v&&R%Z9`*Nev(Le?Uc&svoufei#^t+&$gG!{dAwt5BqWmzvcA@uoLYZ`&-=Z+kHDU4&olD+L-c>>r+nH@`U}u+NIAkjCu!lj-7M?d=S44Zx7#?#H>X1ql`fIa1MCLZ+$@p!)Q z8(UvPg>j7ig6A_)`kadOx%m=5r>bl>NXM_AjfdTS3F<{&y+wYST5qd8hvV`K73Y`6 zdpoa<<@sDq`rHnF1x3B#dQIour2e5@fe#e+f})+kpBVQxH4OV%K2p4&gmIP5Ps(_D zx!8w&9>^iz?5E0nBR{a$r+D7X^X*9CITX*2YtnOh*>g@&I*&$qBHz4k>*g<}-ke!dyJk7TA%5zyrr&_*zK2FD-&&4_f>xFDMQd6m1%=162@3Zk# zj&|Kc@7vh(zLDbn&pduVzD8x&PfibTl&8P1iZJ{J>Yoo`Je2dfQF<;J`0o-kABrU2 z`2~K%Jl}r~n|DqD^8%)!x<%?W>wz6O|LMZ0CyS+D$2f`lhkaeN&uZ(JYWpZyA3-0+ zdlNSOFy;q{2SvY${Gq*ad4=jO$uG(W&mR$w`i*!#4;8A1MGj%iGZDtU3x0Ts$Z{DD+gb zAADz4@n>HCA&+!8eODhYwR%Ifi|pIw+2_k~IlFo6)uIRGzwr-|Lwl(`)RcRu+E^N-^+Zb;<1G6plznLAH%{k|dF^IX@uH-Q zc{l9ju$zwqNB;J(a&)ha?N4IW(}wB!wGB6u{;;{&TdP`0JJ?kFzz_Qdh`nqF-m3^x zKl1w`w7)3lWg+j=YVVhz-#bpyLw^s7c{leznBUU3Y=oct6O419nC~MTD6}{3xAXfc z@WHOrBpp!r=ZAv(`E6?0?+4LNd>s8F$Gdf<&&TP;Y58Ct{4-l0sGpX85cLZb{RQ4* z07bd`6!TZ`fx;f-e@1)L572vUmPYDUOJg<1Qp$&=C?7XY_~reW@J$qdPxdI%!}({X zP9N@7`KQ$rse|nNAx`hpLi{rpj}-I8!dD}F&E&ne=IVM$pWlNEB^)W1r*A@d^Aq15 z*y-QXfb%S9_jgG;2;+X0yfFANPv&w7)#xL+KmMX&tVh^id48hvwsQXN^Z6?M`GDm2 zQK7He{w-8XCH#V=q1sK(M_%mt+2`kQpnSO%qVJO;*U#5%I7;;b=l1V#E}u~J0gu&z zG7eUY=lT(FP55#|dIP2#~ zA%Cz3?IVwm{f_*&a)TbuC*7YQ`TI!h*i`>c9yde9_5_Ocy7W2SNbM>4{-Wu^56E{% zoBxpRA2NQ3R4+?oHAwt|`hj+Y_Q&-E<>dU5SAVj4Tsc_0ZRnW#0(xD^EZ2k(GyC&W?8y9xp(_ zk9|E*o(F^q_ZT5;;>~;<>-P)EZnIy+>-I?f#O5Pb*GRq*f2H+%Wqi3_Q-4q{KK`7H zb9_%&sAh`4elF?oxEQJjBn*Dm6R7Mxnw4S9lQ6#G{;fwPo!^RH)Duv=$L>><$4esj zH%mkHsf1CEO>Gyb=kO24Iq32073LAYvF$#Rb8~K-@cCH};%WYE=aZG^aCzS|Qq2$J zeh<&RvUvVETwgERJJQdFBRS6-SDfelvh<*w^8ASU0Dod0hA`%BFJ=0Bw?Bz`!sSKJ z9j)IY)j|B%$0WM;>o5AI%6tiSeM9u~y^Ntkc!c0wpQwMa^Q3%= z`55Zo*^(Z&XUK($p94h7$1fKCtGslvPMc+M+>1ruJrurQ36AGE*pEPY!QW<_HRrt+ z3qR%)$QSA-aLm&XM*oNM_s1o)PsFocj9ZoSCVw7|`P){~|0zpjb+*iNeSUtwjMlfp zzn!Ilyoc`Q`@a)E`SQpg+w0oTXSROOeaxco74et3cg*zXT&`|j#^vtjc^LPxPx!W# zk7eFblg@*{$NdyNU$^}o_~`kk^n?Ep`@xTThA`$am}h`;yt9+*J?xC-9%j1N%FfR) z&PQTrtk`ZBk9iaLx%{1e#vvcbIuQM$^KUi3qQ3Gt5~<^)9+-T8Uj0RT#`813KKt`@ z%x})lsW)|pn|?bK|IoeJwqC?(KfvePsQy_#cP};MIG&y}*m!!MJ)_U{2Ph}Z=ehm` z3gZ^~d6auo+acu84^(THIIrjX$qz#hxA&&cFVVkqxzagN>vz{b6 zemwk?hjaaM<4#_>dAP6li`v8c1oU+isV4~g6#W(2@wHNK(SM`7k$;RsM~GhVohbhN zzNK!Tn(yxo6~{;F0vqq@JJ&n64*`3yj%T}Kb)}b{Z&zOWC)oLRe)`$?KxMN2cp7{1}?l{N!bM+X0=lM>gt`&c9yTQEC-XJLpFdAe$j`a6vPl!kR1CDtw#x1T_fyldkI*dn< zM}0G4<7b|iVSIMapD>>J<;c&CoL_J+>R-gK*ndU38!aBC_e=o~j>xW0I85jMb8yx} z3cgez#wZ^z-b8ohWD2Kdk3jK2QV2 zjuApf3;mH$)DJv&$)l)uH;NqApILso7e>|*h@WZsaW0e2x!L|Hmij~Y5PxpGJD=Dz zzGmt!u@ChJ{Ug`Qrl#lgJSF|<0?`Y9VZIH2ARX{yox;@JlaBa*SiNC-4?V)D*SpAg z!R3f^k8xVRe=UAPy}~;DnH=0-C$E(JFb!pW9aXHaxxK;8NF6Qy$isQxB~1C=5_=%` znWVdAf1ZD`9%^4U9IL%8rLUda_8dx>&euu&a4(+q(z#5*FR_&Fot7}mp}%ny_xW@G z>*^=_Gf<7=bbi#<@0zq9$m2shNBg`_>_NN0J|t5bKWseqy<)|FbNBc1IjKOQo}ga% z?a7bl{Lp({w%lscb_YJR6NI5RPmaeMxBq}J#$ANbPWUeMk-KQup)@AIJikssjr-Vn|gXZ;hT&+DM?4)MeN zmb!Z#kS_WejMI7ZiN~#crGBJS%?|Kk9fbZJb|4<}%U2~mgx84uz z`TTx-UcNEzeNZL;uSoraUZ0}8aZVfl^6kR&-a6YKV19sm^Frn0pD*vrRn8OPAKzX- z?3bG#Mtx;GlJj1!zw`0D{4-yro!_?p2o=7Y=I0yZA?g+C^IOvY0r%yqg;8!kU!Fej z=hY|QuLw_;{QcO{%KW38d^>>uQ|ccmzL$gf1Li64JI*h0|Ln#u$U!et8pmXvg8gWp zf-gQYQ06&HD@)__y_$jzV}0r7El97UjSp3W@cH3Y;urMCN7^v0A0?f)ZMa6gXKAza zeGcTehv>z+1J7gd-3vUA$@`8N_5siz9cJ}my_2`DcKZPIRbBcQD&D7Z>lN%vVc!bv zD!V>*>)giUtFK>=m;9q$pgr<^Cb8I6eg78wn0foJSkECp$T!w+SpVU<1jk2;_vz_; zk6rK9q|dS8cRY^(KkIYPb<5X<#?OY&tiO4E==h8tvuOJJ(2mieN zriRfjeL46S@5wF^|NTMy{f1Dq3*I-P?+@7Li?Mpg#@DF73m^J}rc(41(2sLq+zx2J zU!Hpe0|IK_&C=%|S^v5Aj(X*{Z}_v7)#LX6>uuOQFJQh%b+UM@c;DQ`W1RETv}c~iuW==@m|MaVn1*`&wzb6+*j+K zd*B>Vx7I*7qwD-Jn!MN$4gY?6B?Htd;;b+(b|3MDr&Gpfp zPvmh7=NJQp=NrtQkF#7X=R}Gsw0?8@?2&sR13kng7E&$pky zQ$_E0$$4Flr+aB6jC_C(VLu*r`Z(*WEEn+mb~n{O{_`%DbLEG4-#@&s>dMdOciWH~szF&y>2+q6s=U-57eET?@?<@UovH8z!;lFIY@t!!o z-|6mo#Qp>NKb$v5*zaHQT-e7kE<7Xs{U3$0e`uU+&Eu9Y$LIIaAG!X3=PPc!<#F59 zlQp7$nZ5Ul=1)0c;G0W7Uw@?5OS;hS^CSPDILAq$cE$BFR9sIZ#q}{x-#<89>M{5@K1$<{k$BX5rlA53xjg;o z-%k)dOliMc?o~nfTQ;7)n>$##c!a&D&m(DzEEo{#@r zJXV)UJnBF6;eM{BwmZMw`t1bmrJ6qILHmRrpJHA+P3*_K6V#9Q*FoSzdRgk;Pi~yg z#plW49uCMO4C=qngne-Amto$FbqwaQ{ye+!uzPjao|g^I96n z{DkVcgd4oQKb{AHq95>|7v;%kar7rH zUFbuhpKyqFI4+V z`9crJN2xyeANIi>zrN#MQs91=*K_VWYyP;?-`Yhd)#W~%^u7$a4~oO?-Z$_w9;Nre zK@Rb(&&9LZEtC)cD0o5A#W59l;5tfKMd-Zm+3dmdu`}HP~Siy2l{#PM$bQ} zeVhDrBm2y`k^L-+!?L58o$A_hrd_C`VX3+&$^WUSqMb z*Uazp_~0ks&d<|t{DJ#3&Asf#FULwcNSE_R-|w_|tWG9cULMTn{4q-8&$l#G*I62= z`vgZk>ZeZ;&)>NY)ng(D{~?TdIa9iKQ~2`w%a5|?! zOXHOZt*Qj;E2mSFN_FrqEsMna+@VVGP z;e2dc;X^!AI&UU;XQ5aZ?I&TM;(H7`4dU{_{Ddjp2P!z`F-#o}fBWIRX!Q{pjx|5m~;W$;h|XFmEqfyak& z;1$8Ke#SZ%`t!o8tX!nlW#sAmIT<`wzMi~z@WEdwua87O>I+kPuUqiVEf>@i_AA}P zFZHNqFxPX~;rkusxQ*~(zJU2T>IcH8m)i?}7muPI1BYGJ!uwf0kpdrw>AUfw|5%~$ zqfbwj_`?U9b`>gw{dv+&Ha<{I#aUmh^5m+;=gH;a)$~=1f5hew_SUE+Ir(iWAJSv~ z8u3H3T)msi&;F>P_GQYinVM&5bH(Y_R!y&|^62N`e}viYC@p8;Up61-2kFFVzK|a5 z$SWW4eOY>t9_Q2aZ^r*MwBF%zcu&fq`Ozj^E9Fs_+KqYQ7uAFL=NHuj|M=xrEnLl? z)#9^uyL)3d7q3?S(A!kLA-4QBy?noK`_)igApPrjp_d3gB`18n;OM9Q@H~-!SopHx zNIfO^GLJ&vDv^J~(nx(o)UJ~(4b@gdI9#+eR9`1*=EFx=O6NW-WjRIPyEs+ic|ISi z^CjHS+SL0{T`v5L$7+TR*QmL|hwm3Kb@MfZp$}mmpQAJ#;GABdvSBx#`?#-{<-s54 z=*RbSVwoq@2wyYFS9A5U{oX;XdN`9m+UK+WXsUc(K44dkq}NQ+3)B;m9@549@;8EK z!*ni3aJDx{^`v1NABsQe`LDI#<(v7M$^9+O#U7XMmviJ@aY*=51oUQ zeXNIs|9PR92f~g&3y%38=98HJVO|IPealZfJm28_`SI-q$9c^2#U7@vy&#P8LwFyN zM;Psg@i;Aa#Iw9>2h3NK*5@lFeWosbgpoeNNFU+6^bubzeWTCp|Csh`_QkkAp?jBY zK10cmJ8#bIK2Sr&4@}+uHo_<$gi$^Sb3FVKsFNf;A7}nRohI>k-vv1Ip?)CTczUoK z`|~b+=;d~aazMV(&jt$pGVhG4#eZ8%zsdR#@ArSr)B3q-axNX%$LYC#j_q~*6xUDJ&mp}{lgD{ydai8C!Owqw z{@6Yz$LTiRUhJcypF{t8k+cu)2Lgru0Og1<+Bd>z-w30gF#f-XbtKk##TJAJ5kzFy$Ie&EdS+7t3OUE19; z+s{Yp5$W$2TN*0H>Hf(~*!3%o<1QbcAMeJQ8J-=;cjGwn5vWa#=l$$h<~Nn{*?7$N zzBnK6v)5EjH_O*7otOIggq@qq&-?w&nru&&zj>4G%9BHT!g$E@0XP0}82w}=-ncyY zV`-N)>3k=fj%&BvF2L6;9apmamFc7XW%-~tkN+#X{%`vW{rlkqO+W9}H|TFMpWM{- z!>01jk?{rNuut=z55j)`xgKzg=LkFTnT&K8y$1Fxq?N`q{Um+Bo>txNX*>u6+J)kJ}i}P|kVd9miK6m$Tzy{`j5c zYx;Pb9oMSs&+@zRGwbKgpJ)00%JU=R`SYj$U(12}i%|Vl`pq>m55{=K>m4_)bJ+Di zS-#47K$bs$9soY9E2_;;{#)((YCdP?8>k0vz0TvBn`dGk`@f~WeO0baE7xp)@ZZ*N zz@9+XNwohX`|cPwm|~xU?(ONt`_;V9SsBJY6Da1VOzAyk=~uI1y4QFp>&@bU%F4U< zIQ@Au!ual9JJF{-n$_p*!G1pShcNiFVJC<94Khw({*L!magGmRfBp^}a@F`tk{_m_ z+DF0%6E*wez3ll>`fia8$LiR!c(d*?@uojA@n)Wf_^e(!f4iCIt%gZ@pm?r>?-QIR z@qBJGRM{}jX#$VbdBTtLs7$e*aOZA;V}BiC?C)p8ZoJOJP5yC?6x1L_e|gyG_ru1& z8^}5O>JXSAIyg7gV7vcNZQkU;fZJ6$NK92M0pQ|$VnfhDq2N%xz!QpJT3rFeu3t4?x zKa}$$pQ!JsuQ;cH^NW5M{O~LLBS_O{y{ONX6#2wC4ulOg^~v;~J~c=?@t-D&_;TFn zGx_8GH%j?Aok02d@WXf>3);n=7YNdGW;jpI=SFaDV^e7;&toA+-*vUmXI&Wn#rc%o zCEp1DkA(L>!t`gM!Z}espX$Qk=luewALpSF?}z!jsE!}u?E8q3nk)Te9)5_mlfHXJ z?~|B*p}!5&`D#n)JcP)9xqQvi_g|W(cT@QT)ik|L<=fQs9Y4ws<&ziwp7pmYFYx8z z6D+?ge-69%h9LjHgD+B7~`LnpY2MhV~n zJItTU=j_e)Th(yHe^E;3j1M*a8T9iGGaN(Us#I=2zg$>Zkjd`(^usrt)X!O_krP-L!aT_q%pIMJtlydA*U< zi;w*nPyPUqPTps@4r!VUV_yaUln>Nqc-1&x|p7S5-9p)dKHlKlBN4K{1 zB2-_ql)h6d^(5;Dzg|QBKZoNU7x)9~Q$LLTs(mD%SWof$@3e0u`38>lXHW4%F9Q zJ=OT1v3$)G%Qa8s*iL-E&h4MTe(2?M(UHii5>ZSo)6| zwMOjy*wW_eQ%h^p{YJmswmE_OZ{(-F4M%Dh!QpqNZamxD#)qo6@DH+-zOOBET&}oh zAW&xszPa{aY~|~6^MQJKz2&3t$XgnztX(y!yl=<-IrcS<2MXz+zhu85|1KT0FRn+S zLYQf&9+h;l-@=scN6+A)S}Xba*wR?3VO(yYxc{S-#p!&$eb1Zrr))S@oR69`eYDR8 z(ZiJXzcOL!k40Y=2Va!xLw$i?_ONnvzlGR~d^3*k6}kOo)GzdN*?I?lSO35V>i3Jl zVL#S~y#90R-R{=TX6gt_o6CL?okO1esbmQ$Im#N=XZWO zetm%4x2)b!ogw=DFv?@B@Lg$Xq;9h`mU40RA^U#4n-}=@JRtfORnfOp`22J+9wHxp zy03_RZ(EA}yJm{pSEV1ns6E_HTziFG8^!+SCz^H^sckK#^Q@NEh&|2H{>1NB(I5Hw zn=JS1_T+*n`(z&5B>6lzj{bHqW=4Qu(QAA3)L{;$NrIT zKk&T#o*{a;{YJ7MA4~sA&vCqY$XU|gkMra(4xpd@iH)yp2i5u`^shYs!o8!h`kB>N zS^xd?nkvup5%>JiZxXkUpJP6|dGec^?&ivc={)=^d(AjkS?@NtzWwj4 z4`0=zYW>g`s}EoK_bdPMeEN&kqyIp^ZSMnj>o=@F{dE)0V^yQP|A6QJ?mP)U@2^oj zKMB-5GOt)5^N$r0M*sSbg#GzW-ueXVYv!+cs^Z{a&o;*qZ-MJ{jN-_(3TAND6V*FPwi&9&z^ z$tTxGx9hHt(`9*%P zk94>7Q=}GI8mH%|s`N zy%zBsa6f<5@_}-A-|7if{7v3}Vm;WmqkB_qy>rjYU>CQOK;^bWsjrwH;=E%uyZn5> z&a8hU)!f=k`y6)vw6fecx7;?@KAfwCy$H9pc7|$CyAR{;`QiCeke;6`Sw0u<%k3(9 z_&H6a`dWRl8Y0hezAgJayf4yR{lJE6)jn3PPSR_k06&bdElLE{ErCmHDa`4?FyP z@c0m`??}3v7w_5)>IKFf&Zmn<_y;zjK>e!~uao%w0Xl~u{1`_slJMn{|LY`-`D5evjl1VG zjmHP-7SVUR=)*V;{-0Z%&KuhM>ErZ%b<8VqA1?BdwZ}boyjS#R&y8R{;OGLe=W*fp zzrPIqdHCnA!$QURap|FaQ9tk;m)m8HT59cRCeLA;%kzd>^|Hn5)L$)aq23pJ@jMy* zS;O``9zBh7gqd)pg5jp#1ZrEM{{A-0$Leb~zD5;=ud}6L`W?Y)VZ3*h$@ac?!wk^H;)k&mnFIWpYO5U7pzJLZ8Je*oKk&VgA9xjc$|vtL7n z_mF_+$!#hQyN{Rh^zHWb;k!%x9d>-L-R0Nk_ru(7Tz~ob?c3GkL+$$#bZ?rxH^JW> z!99OX$1k+!>)ic0NdFY6$9PW!-!=KJ_yyr#%KJ|3>~{qM)i}lXmdL)txE2JTb7KMZy|{w=m2!M*ocZi2lud zf5*(z8pmU`NY0a>zQR7#OW1+$$DsZ2_iyn1mr%ZogD`zBM8>cFQhv|_{g`io4zzrs zI#Kwu;VAt+%Xd9}m%6FZ>S z$I&hu$3yuZPL%55_D%OW+jDnLKiWOxjvxL6<@KYRM*s)CSnR!0DDEW&#k>paINUGr z`Qb?2Ec&v1J|4)t4)-lr3;Xhrb2#kgd3^r;vbS0LLUq5`X-d_UE9TA5363!0nTAY= zf4ba@kVpS0dO$hdK!I+qUdTf)DDIg>JSgttLOb&*>ci_|FOMUkdY{4}I`=N|{(R5A`HIvzmeT&2rF7oV?(f6kRBU(K(1a+{kj%9HcG>2|NT`Hj^^$v5l4 zIo#$|&%M@t%k&R)PTW$w=N!wqbXQ)Or=Z+W4^TfjAMQCbmz#SJWpnxX{GeYSzPR3O zIp^#9Dt$Ae{^$JvRXG{|qrd*Do??9S`;-6I+G+NjRV?q1)u>LkpLXXe^2Wy=(y#Zk z6!oX_{lKP<*FN76tG9Ao$2j4iv-0PMD8KBvt4+@*^zeBr_nsZE7i-i>;;-*p+B|(e zlIJ(*<8jm<&no@r^W(ftw%^K^V}C_bu6{q8FURL3=$>FHhbfj;pFhA}K37#ee|!!n zR5PvqC_Sg+kN>y_BhRnZ=DpS8QLkV>^50ZHga3BVU&Z0PKFYHj=~YXon*G({kw45Y ze<}X1mhPtVBR~JC@_N?hE5AR&`_26RkAJQvP=6MAy zDG&dA56TVppq^#V*VL$JgsErE#IC0IL(o^P9-uw?6#ExG?)S%EG>rWnGg~q96@<63 z`F7#F_%^}^JF$O=eE@`c-!f7~%TM!8-8r7P1=<8Jr)j_pVT`6S# z_fXrYKB|rCuePJm_VjD7hN*%YuCyAh5;aB@)d-T9tU9V`YBx1Y?M}Z=YPQ;6ttIKT zswe#pR2$SmR8YO?cQF0>Qp};MZE%=Mf+JKzaHQ%I3?TWVRj*)>>K6=A1A}i+c&Hj0 zoS;Sq!{~P+{Z1n6WHmk*p(Y34QPYCc)a>AN`i&y}XOQ0S(eL~8_nB%@a2EYNhJNR$ z6~Vb`RdBvqOTQ7pMQVL8k?@O2?h@6db~62a1<71V^eUoL)P`WH+8A6-;cIBII!!GJ zuBE@Ht3~RkDh_W@wc*X`Yr(B*V)!%q%~q4?H!-}E=$%C8s=47kMDJDe>9>G>=I=wI zU#Lal{i<_tzuJp_-Gce*f9TgUct9N#JgAn24^rHN6!##-J*bvZ_w_AcpoC(hluwf%d?!q2L-=UyVCD$`gK!}scquNR6F`T5qfuU6o0n)n`ApiOVly(67tb+RqyDx>Xi5y)et?W zO7!a*EmJ+B7gR6$8QO<_bHf)^zvxB6UL@>A!d@h7Inm`re^2x!ihqgXU!wSz2zyE0 z9>1jSqFrHl1Y( zIrp?$*&kc8>IQm7qP~0vQw+qGXLUFrLTthH1+$~r@zgh8a!DON)Je&Sr zMYKz_8}aNGbd7c=x!p-_cgpYX!F2k~h&mB(=U`skndn}@dCm6@E}`Gm^t*w6-PAt8 z&cQyx9?`xO|Mg%+{B=s>>y*aVDZD?0_b1weXb+-2iS{IV0NHW?(F2M1K%%{f_9A)^ z(SwNgCfb{H^rpWLCVDW@KJ@Dww65t(^bpc>2+_lWEyE*-_Xzs?$e>Hjz+ibeFgPd} z81$rHUp0vM22uPV(lLm5jtvIa3=M|W92Y!TdmPadf^Fgxf_C(KBshWcazfCV=w9aU zU>N;9jQ$=*f1eoKM8C7?*G&x%#?=fDE{IMECf1AyCfA%6%&s{j*thP?U{TEv=yz7I zU){OEs+x%uKZ)WeQ{1$mf3s_e?~Y)4vpeZ`Fa74z?+?K#EmjBLY4Mlfhb{gZjB5UR z@RJsAkUejZJ#SE2?@>A*PaiJD%{vyg?&{(G$0y=)TzW%EoM_(z9!v}+zgv|_ls++@^^y{W(hd`?g;PNZVtuIq4+rze;0*+PI5mdp1Jh*-Sm4n+$MfFY)8LGf` zl6jJ3J`FqW_-T0T4xduoXJPLhKMPN5`x*V+JSr8MM~?)}qi!l8nh-5U59(s{IQ_b* zouapNhv+Bm8=}6dQ?z%ochp+#9d%LrN2j&jpW^qAPTFz*s3+0BG-~}YIE1i6qVtkN z2s?zZex$P>Vf~^9iS{H){)?uCC(!RC`um&o8&1Cw6hDIEN6_D=M}?ZxqwA70qA}4K z(Wq#2G&4Cfx;2>?y&q2`T@#~LH4}+{`OEi%NCZ5q4eFk!Vk%ebx1ZT~FBc zgk4YA^@QC>vNsZTBgx)K*o}nU6b-GN8I7V}Uv+adx^`A{K`@Kr=0@MyVlH8G>F;|8 zyNBq#l>d7z?W^u1f8Ixb-$y+6lMn7Ez4z1K^9i4CX;1Y)^ywB4(BBUb-$MF(A^p9O z{tn`ft%JB5(I1q8*o3Lg6BZH{5*88`5*Ejg1TkT8{2od|skVx@54WPf zx1zXh;}=RhQrwR8_l|^>NVY_>CBjOCl?dw`pVqcBVV&cXcI-@8XTpw-uWUbz!ow&$ zjKbfITkUWb$(}`gXOZk#gr7zD7{bO7Hiob}F=@h z_qp-Q`ds?^T>5(=;S=faiS+lyakG{elibDh_oejrrS$h@L@y(HC8d8A{ieh%cBoS~ z@1j(TE_6e`>VBe9XWp%7CVav$rQW2!82bkOwb)|a?O!wLtmOIE8SI^wbdqqcqPeY+ zC_Spw)+ygo)se97_nKJqS5Nw@PMuAE1*Bzbb?{C!1E;_0)DiSo3;WkF!H!caX<}O< zY}a7tPnFt+>|3r@(_`#eG(lyn&ZXFmHnmSmf$9(#3ygi=Rp0%gQvDuQ>Rffo8A@#+ z`zEL@K2xeKY3UHO8^pGpt7cDPTP{WYZ8EaWKHi^I_D8usRhe3YWH$OD|7!;)tQ8XYwf`A6uu*im0s6=28 zV1uF*BJ!gm!>9~`I1N9hMI03PKF@jOoZCU=Z?mk= z3=sM%?!Hi|ZL6!fU2H+D`kxW)%dqKt+X$WYHOrdAyho$88&I#-N}_cCr)WG#0~0_C(cugFzJUa}ALb5*tCrt%XT2(<%!x{uHiK-b<%KKWy`RtH^nTlWG@2HIx5 zkFg|=^|2K4wLsNV6EI)UE1T8|y?s?DktZ_xG7$ScYj8YhUPh+?*_u8FO}*AorRR+f z>iKr2{kB5G9d{sme*9f&9{|0KdSTYZ_S0kDx2!T~_INnkNb;m0?py;!wce0b4;tBd z$U0Ebrxbl!(XkbjP~KjP?Cgg;+t(Tx(HJ#7MOI5xIFOrMY*`0!>3N`qfV|cvK)2lm zzgKxlMLmkPSka%@cE$=zmV~C6Dw(xet=CsY^ZXUenf@x8=VbA;mgW@=Dk>(R=b-e&y+r6-`YUrYNG4J*nk8dS8{@mtK= zUqY9H(zaOdL*AFT-I@a&)|o&@IWPMXdj50rVxpZ7T1h#|iq3J=qx52wp5xdLD8*K({c80Nnv}6G!wdK-+XxJIApCr4NDTbIC~eTBo4DzXI(v$FUWE3An`X1Fq+x zA4UFvOQNXXbpSlVrimZ;T~7EU`G(*1?n(Ce`ne7A$)HQdJmOGKbcrYKvOWW?zDqW6 zd;#c>I}pp+pZ@@@HZv*#c^$HL52&}-GJ1nc?>qqQLetHTGa=<2=Diq*Gze>dBV!P0 zMLLI7zb%f-!C@_MSTWT;=E}cf$J4m-_FCVC)m*5TaDDw$yENf)l`QLM$lJzR9SdC& zYPEz*)}Dk)wp?vkHMZT29KrP?NcjO!uk|b>Q>;sBYcKg|JnniHe$TYKbAtL6alBH= zSw?eEx{KH8w=rkh9MoU7vvnuv_}qaQ(StzX;dcOAT!W&Png#5&h9Ad*sW ztp@rA)}Dgv^)oE%RkTrXReu?40Ha2re=<4*=tD*{&);RJ~$ z_dZt_G5{a40vpu>^;(qm(Ol?e4$3!@jBWtB&-D~IjzhhdoHAO2T)G7`gG$<3nGtF4 za*GBdOrsThR7=YfWbH0bkhObMX`@OTQJT*!Gjv2tgYM7x5cR%?`Q}~+M7eU%{l3?- zPKDKi?(>08!zcvYSxL+KJyyDqd(N4b^%{EF#2nP4 zh6xkSwyY!XB_G;?aicY$*SZ1r3&Of~6eTb2bJuN#F26+f#Wr~FF?f^vmh&vD6|_OO z#DlzB;z5S>I|VC5)-91H%l)OfnsrM=id2hDd#x9dgUm;}8MX6f)%3mzG|T=9O>N}4 z&%!CY*r4An>)YBYid;7%4y~=CXx56JudSliXs?md*6f^>vb1z{&rNnNpRSe>OmjW5 zZj>O0d8AZL;4=a`oDa|*AS7Oe(sszS}WY`OZUUqv6_8!pd@piz&CYJ;NMAmAbI{0!1ee(Y20Z3c6n&O@HC{fI|)6{@+9i*tRmFGG>K9%&*u;c z$#Y_!o54ZZX3TSY1$B8ODz|g4Y|A?y9JW@3Y+e4Q95Pedof2ufJTjAG9{<CWqXuidHF_3AEP@$kE+lw6^OWLgH6Z_j1riK}&h$3?Sqd8-(2A&tumB z;Rw0a&Tct1Fe^lsJ)88)dT4dFR}!&WRC%Lr8Kck`v?*oxGUS$?hdAET+zPqxK`D7+ z$h{agpwo(w`(KyYD_F?=vZ5sF9gY|gavz6!qo@~k%V>qhp!t_t)@-gPqY%~BPSUv= za?7Yj-861f;a4F>G?pQE2yNK<9SQU{Yb9eDQ17R`Wtnpfap{s>i!-O`FPZQo1$L;k(8+WH;NvqAlRT1V?%CPAwuq> z;Tv1ON3BhQE)-8Ua@3=J{Q4^AxmY3ZBUD#GA@}#x_CcU#wpuIDrxM3A89^JF2##hqRjwxxWYv{P528PTF~WANAHbDKgy397j~4zbI|vJ>uD@ zVau~ewH>_V_c@KCIh}8L&sR`78@zeX&B#ms8@9^n?9O>)r1PHJDy4bP+RN>1J*ROu zr?DjEKEEq-yW&Q@eG#ht-*XI>~iRrxbc`2F=lAn4dQw@0~Z}NF%p2u`f2fdHOE@W|g6lgcG z&Do5Rx$yx)pSsDO72BMhiaxy2vfkWArAtwd=FB$d8X(FZwmCmvp?%ApK#$yz67&8y ze3JSW^GXI9S6WwMwE6UT5NOvw1Rdx9|5`zTJ3Z`S3yJ03(@Y`pba@+1MNIU|5Eh1 zvn=ZkZsX}8L{T7zOZ;lL6OYQR_dwh2r12oM%~=E5wUDySIa^UHP}Qf9VS6q@e0UB! zhi%R!mC`Pq0o`7iJqf1KP9&+NU0%s!yV%ER*7m5kr+M`0)Gwu@pHPm3SN17gUReVY zDkZC))2F;%*Qtmql({98qffmltKM{hrv`IqIy@q)b1SQJCaW_b!EGGzOXTv}M$Ri4 zd|rD#s68L_%4$Ezno=CkvA#Uk`C9+aT>8#oh=yH}PV_wvD%gjqF;s{%u_Mu+u80a#9 zyvcq>FdJHJbDjd)e_@U4bp1Eb4%BORQIwws$pt;<@=ug#;hOl1@8SuQH^U;b1y{>10CO!q< z)p~XW9)fkvx?m#z*j0miM3Fkk}pgKT$?H zr>K9T?1={_%AUB<@dxO9AS_<5r!(~vXs;Uvt9kfQhjR?|+m!0h_t95;g&Ra)#L9Jiu0uBDx>v6UKEiPzO4C}}=_-Ju1+&#$@laW%wo*nK`y0eQSwn% z@4#wY^8F5_dodbBc1^Q;&?oT^yr6Z{jQ7!LXp+$@pb;AMNpxJptdBZ-58|x-4J;Ba9%i5z6j@0W=Z$wvTuk{|J*!L~`O}4!C8d=v?$w|!Bo<^KZ zpN3qZ*Lw8>tPVIi-sYTx-q4!o+nfB4@-;sr>bY-k$+>)cOE3LO^DE7_x8#!n=AD5Y z$+x#e{@~sc`9pilX=q??u|`0pg!Yz9KfoNTF&<&&xD?SlvbUU&M)sDRE36zomFHJv zKOv%iIP_VO{Un64Yx^vcBKj5fcmQ3a=q5$mocqG2ap>Z3g@8^3+U<-0oyLfAQ9FYt z8r9qBd>#3H5@>*T>ZHMdQ?j`xe(p!P*?^PorjQ?OuUZ4%i<#p!&~{>s2AppL(aFSs zQ+6x^&IXJY`OAQg+kozI26T@zpu3I%=M~D41+wMcSsC*I=a7~Lzb%rVQratu-T|Uh z_5mj$%Dx7i)mTk!T^_?aP4`d+oP_MY5uzI@15U|G2b?o2>o2sgpe<^lEozM|V@lJg z=fNtz#rcB@M|^LZA9S7*XJ4Z%vTJX7M$pAxvKXaZTuSw}I3*k2;{1cQ>;HkB3v6-v zvVx{4x*R*IZ(%&PII|mU)a0Ps4%Ewb7o8ehjnZAtUtMKc*8`<>&SZ2hr1qAbdO!O! z?QHtkpGm&~ouPT<9hgA#gLbY%&hxLd(cs>a6Any}`7x+%oa$WCPeO@^kd9Tc65= zCdp1IJc;5xotGTz{cRt-8j(N9G@3KpC;S1tWasUgQ->$XZZ^X8$Rl=4kUdUhlK5$4 zlAPj1wYBIZ@m<`TgXH_5)t0Iepa+4%%uBmtTPu>>=;*r*XNS;gynUW|w%F*Pv(58S zuhDTYI4%cDO_Fo2)TAd5w@)(0tZ%tVvgYL`$r_dAdSu;xMZMP9 z@537)Z})`BbM1Mwd&2ArN-J+hHOQz|7kIz=W87qers+x2Zknw|YhHn^Mr+4(jpP=Q8p)eRC;b#UyU}i>Mr<0Xk+BTbi2Wip zGOFf$H&i3Jh080?U6R}yX_c&@r!CF!tym3tHk|-<*T_7I)R5oP{x_y5QX?l+!5Wz} zF{Q<7=*xa|${wlF6U~~_HrcCCoZEN<{q4~<%y{(F$UF+TWR|70UP?=Ac`VovEq4&loxg#8taChrSx33!PS4P zOOLFSu5}*`lm%_`7^6SFQZA~{*1CIvegWD#2c0!P2(;FH z^+A~3XnUPw=CAF%WS!%{3cAU?H{!^nEaiK9NPd!OS*7&>J;$`WDzuI6`xI@{dermn zT<-}jeOA$nd(?ZG>y`GPm6`U2(*6PTHq+i$8nrRXGg zY?xT}W8^fj_zpMaFL7vKBg$kpOr%}b#VFk{@o=mP3q41s8>_t@=%(uk-Kw-rKwsn10ibUHb=8WWcGc3_*p0QZtCqgs z%C~K5e*q0%g$8RiD>XMwx@xbf!!0C4y_iQb)m`pWp&w-^vD$ml20hd4sg*3ZM_WtP zZbRu6&>+aSm1tzleIFaqEuX$xdMbDg>Sb!hPtDDrE)PXu_Rd;aL(L86ezkpnt;FKK z+Gi?SWmp#)Uvq=R+(_xGl^X$lwQ?iC<{&>Xyg8MZ8%NWOYBioNnOeyiGPM#9a@uZA z+Z|M^*@$$up8=hYF|T!e3sIR?uv*8g@8C8mR?Z>4W9ZM}=3^a<$H@P1HqF&zQ9K>8sw+QJjzXx6~b#Bjdt^>H>mOk-1Ov!a=1a&eo#4@9Q1_pm*8lha6EW_ z!)=J|oA@oO=RsRj{Uww>j9s+X3Ss9?c3I2*9DNEgQSU6StET5Ye*}kJO1`_Unx6c; z$~4mS)8IJCE!o_VwH}gb%ulNRCeZ7scT)9@6=Z8bXJo@_@nP-g%O^&kmv>tV<#RuHiR_Z0xR`%N~OQ9*e z38hh>v}(1!`X10?pslYS0{R@Imw`?M>Q`I!vG#84g|6WH)O0`Mit4|k9$CYljWic> zs#RXK>aBLpb68Jcud&XW0`w(F?yYVF>IOCU7@qKs3TZZ{Yqm-a1r#Qaf?h6e;%kl0<;Wz>2(|r zL}S$CATOcW?RDHU0dEcd3Q>jMT%#N80l#=+ShbI;_Cck^lon80TxlVtbtx_3m${nI zz9qOG-ID6odfk5U>;T)8N|Rce)Ka{qTUoaPDtX8{9liVtMlh(fweHJ7y8yIp)z<>i zE@oTx#tK^Nz8mO$SZK2%uk|Eo^n9VDcJ^8?fJT00qZH)XqfhHci9Oqnj(PDa*OqQl>QiKv-us~% zggmm^HftizA_%3pU5db)-M>P;0r2`&7r%PlTK56qcpRnMtLd%K-vMoOF9gkw_mK+f z<){C2^0d8r6=*xS-tm=Ed;j|yXf}FN(K}r46qVPl=qnY}KA{KbL(~hae)ieOgvIbv zwa`ZQx0ILO+_Uw&QPBoPKdvA<-=(Oxy_%j<*nJz&diN^YRzU-9vU3gE-RP!M9lMR+ zD0*HIyUa}P?%&b6L3nB#9@hmrBi zEX(M;%;$O+Q`?_o04?@ac5q$=y$cmlQ*7AOd0(rmWG@1BU;fUtDBbx6PSp!-xiz=_EQi{6b6uFmlK3?+6TNOiA4Q_ytenZy2 z6*QtfI@>GHNqo~}b#YCTwc9m~)>?{=u4!UP`_?n9gMn#u7vet5k+9zA4(ko^z%+$ zPX#&xXbqn_)84t$L$}t3cM_uK?8l&Vt*00DcA$;5o+~S;)BQsrI*GPVosUO7uj4Mz z$OiU}h2tU5K8Zd9r8fF1kbPp!dl&a#u%DrJ*Rck?+i^b(DHjokNA`Iqd7i9DKHc*& z5Zy96-Ln(ur&xJUaxcU4P?A#6okN^Qi?ZvkX_S#scAc0e*>z%?WY-1V?Q~6(Y^1$f zPOS>OuOKN&mC~cU?bY<&@fKwIJt{e=QqnpK8AY|c)4UXYt985u?de3$-lfuPTvPon zXjh z;9foIjcDIS*vIKP?8r39N;i7W0PpkEhLyp-@g<-EH$4NV4AiE*#-;R*`!1kb&yk3+ z`{Um>&q0Wm6c4s}Rx0uIStDm`*$4#o*oOJPeZQ-3x7hAYaM1c^|GE@TLYSnj#6|S&`#y8_r3^Tx?R-h z{R_}3C~fjCgp@A>HG2O6+Bu9q0J;z;I9=9&Ms6d;G+7NAy&jx4q?uzX&~-qadWXJ~ zZ&uTnc{=%y`b{Wpax|jeLC9-5^$vX}-}l~t(luWB4p5NCocgxL-2#r=snks)_){SJ zhV$J(?fis|>e-0CLl9D48`0bkO_y`2$aL93My5+d3Qd>2rp~2o|rBxQ)0S2+fGcE%qYPYL}vwQ?b|u(5jG-^Xs}48x_7&c*q24nny+&zGjw?WW9<)x!^+1%hY;n*TA+2Sn zdmaG#JxXu#N|v^nd1r9G*%7nJsDg*M=Q32nT?ZL9~4dNkmD3pBo&Sw-Wq zWD8rRgUEkssJkuRlN==6*y<-##<<56rEDl)i`N z^6G7j>1S6Yk50d=BKdzK&t4a39kfvsRtQ(!ryH=c{}3l|dIuv|qxmF{5m|SL5oIGb zqB*$5k%EM;;$OJ#s+R>(9KRSeqiMK~XpeC{LK#Ko4M;xd{`ly9km`KpTO&pB!P2uelRrMlet}fKnQBGnRq6gIn+x=Z`6_eE`2IVYN5! z9tPMN^c9tG-5qG-bhOdP-_DwV-{}q4{R%X)U%2iZl$?N_c}Q|lnB>RjHR0};W~*@U98I`+#}gJgzGK_-&-vCJ3zY`-4A(Z;eUa;EwCEhgfaVo zj6SJ}u{?U7mt;i!NY+X8j%#VSj&h_`EZIHRvNrMf&H^II;ku<2lwpn+cH&)`x>G^R zpCrbJ5h&LoJ`$bf3a9zrdBe%Y~Ags_XF@|>PX5~v}T?enx}o4x}%^A?KCrW z$10i*U%T@b&}wDYn&*g_x>cz6Ba&A~<2%6pFuMGvqF+w?Hl8*5*nX6o^|5DP1YgUs z{T@TFa%zp7S|i8(AZr+{a&V5}wKcl}YlCN&`@r6 zIf(Wuqy2#X4z$JL!`TqUp`AQGXjbg>&ID~b&JS~S^5r07@$tMa$DUoa1Gk^Jza%Bk zb1Q}Z=Ih>t$5PJ+>v}Qf&!Fci?Rk+o$WP04k3%b3Ny>HAuL@eC=qm8iQ|@xz{fb^w zlmzcGXyBhAtIJ5;yC>Oirw3+G?EF1Ouw3^Y)cY*z1)26FXi-KqXJU%F7~KsEB@}I% zLT@Ns2i|U`ojQy575lY-GblElvK9Wq^2m~z88YMZO3RO-NgH`>!|R|o zswgXHvUo=TWbL|Al;C=NpTI55%dg@0l-hTwhS6{AZ z;HsB*-CXt3w|afI&pVOwp%vh8)%&3z>Fnn=$X0%CgJx)>a@0=T5WsJCf+MK9gzG8( z9g1iXuBZ6d4iv1X)rx4r`X-=Bj6|1U{cO-E!bNN;Xg63NQ4Z>56KIk8wq{#iq@E%Y zMPR#KDm7BZwqc}*2D@Edu=wZLLObBq#{t!P=m`bwkJe522BHE*(Os^KKsySc5+_^x79Y_-3|6|4U>5ZyG1)!(d0 z_Mx%*TfjjY#OfbI>3_jiUGwcVz6=c#&|s`qXN=Qs8Z^>5RloH} zTi%?he+2Cz$TRo!KU(_Y9;LbZZ_l$w)mJrAk>{&&{}o!{Otp=5J`Lm1Hj$p=kWc!m zZUM)I(64RcEf^2Vf`+-5b}9A4Mq+VamAn_@tJj$uj)cA{WK7Llg)g|bFlv1nGWl9>Sg_3kF+)QRnZvPG`UG$RGkOwU5J)n z!u$1R1oK+zn0OD`Js0gJW@SFlzxb+TWb91!BGhYVtC0fe9{fC?;+dQ_PC>7$V6 zK-0p^n}O&aSz+d_K-TSq?gE;~=pi8T@xsiVz_Ony`QOESVME zv*_2ADeiX9BKwhDx@VF7+M#LptltAg8SMf(ic$4i%Q_LL(c#4@AZ1LAj=Bo!o^=(p zqV*`sH?cT^%=!^%7r>vh>IdDk?yJzcXZ;%J5|s9^RyN1W66sm?joIX8>EYLRGyOS=t zS>(m!Ik{QlySZ5>LTB>b+^jj^cmiuhZq^c@E8)eF8Isra%{l>6THqVGS>oflS(kv9 zd_1i)G^IXn=N4CEo^P+BXAU<4m1ao{D|63jR+N>too_Mx5cNiMd`A_z0_2Ir;R=Y9 zT~<5pXwfsY+KKe6jBZN!0t;Jp*PYutwe z{Q@Wu5RV81Bnx_a>Vgr=Is07YBsrL8^ZYpQ`yHSl`B0R1RFuW_FO^Z+znJKk);BKHQ_-;DzcEz74RJ%>{NtKWZbX7U~YnT8MWtp|f4DfY!PL7HC&eoD8%A?FEkRz+pg>8J&y%Zb7|d z;6?Ok4%>>*;Xs4h-{C;)9edUe2b#gL`a|R@fy6&8>kvj_weG-)C_Nf;vpY}#`s-Wh zhw5Am48ksNp})nz(?D-CqF+5Hork&JJjg2s9s=z(E)BpM6c364`qeS=;&rZTF=iA& z*167yuPwltNii@V^^Phc#_-BcKGZw$J1G4P?{i6ow~Kilu#oNTt6{nB!0Q;9?tdU-R4Ms= zC|X#Xh*ko647TqMyoh>lp|$)z*F)Y$SfjukWR1anXaANW>+rt; zFY&{=MV9OXt+-ErMP7G+=J|u*9aY{@=B3Cry3eDi*N=96v&qiXu4}ewmw3;{zW|p~ zWDU%wejJE40<&MN@NRL?6HAK4o$iN#$a6BhLeO2X&}@mjq1h65GrI52n7y-i7`zlg zB05w46GZdKuJ`XybhgCU*ld|)vDq@qVzXtI#b(Pai*bL+V>|qhp#KkHZg#5;x@VIo zE`traXOkx$%&2j;?a#&&ZC>ZUU=8KXC~ro2Gqc+&yv7r4-lM=OzyR*V; zJh3!eBE!E&G*|6XLcV>8gXWt-QKr#6GAPY7njZ%B?<+Gj$a9~3sDEFvX`V}sKT|~S z@YDR5{2uzIyoG%!wx0}37WSq2aV(=V(6=q{PMhN=;3&q6$&=o1^pg{ekQ`%QD6z8 z!0?#$gM5v?NIEvQ6YWTN*w_`Z0W``5%xVyAAm6Q8D%lO4bNK>tZX0QkTqV*Vr{eJj znQvVUa#Ot$BYF_UcZsmMTW^cvZ!fxdeB4@PnZnryfnyhpRV>wrpFiIWZYC_1AeIoa@& zcX5J-U%5;+yaG=;2j?`&hJOIjiA}1G?813TLk;YN-}XW2FTt^zk*tWRIx3|T^<=|m zz-#yIZ>V=Y*Lw%(c1BO2^z+@x_ z#;D=oqwS2xoYnU=>|A1(CRLXLj~01sj-^m*g@zAM?<2KOP-TgTNN7SK?-H1dA7z5%*KM+rO?m>-s{0zXoy!(zJcD5{tN2m z8|X{gG?uvrIbSO@R72h+&@azAzsT~YRA_~Um5{QDb-5V2Y(|vIHOM#J^9>o$eh%8O z_BY>fYenZ_)hgdWC!ZTA!ZjQRc|V7|VV=LVUKVx!78_)}EHr!(^|o=l)Q>k=t8Soq z$OH=w^5n-n>nJpwhfg$8;mXph#lpxNls3d%Qp z3q2x>n`aoM204K=&(KN@bf!wZEH}tpH6G?`q^L~3;b-*uDY${tc-;g$dk8l^;>5k{ zTHK}M(q8~Yl@?Rlc=ddZYhWkZxth{AbI=p3@o1a;a}ZJJ_ZP-1O)xJ-v++v1Ke05$ zrSzSIbR&J8@{viHQB1oGXARlLA0VERb@NR73TVTOsctq{0gL}{XtDht z_hFZc-_YvWe+t%$Eqh4*|F3kD|5n)Gvu@08?#FeosZIM4Xl11ZgJc)7eK6P$f8Gi| zwd=K^UNG2;$nXwkS(xil{<6tW-)s3t6?{^8Bgz{Ie)nS>Nv)UUdQWQ`7ov@1@MdsK zz&8NX+D1k>GRlz&{^VozHu;ysV^6|LTu|O&MiVfPhJ!D{28)44IjYco2J@ZDQjjtV z+GTC>Q@xj}2|WmOC!;%nu3{P=pgCXbVqTi@ z-O9VkProj;6*e8ObUZ0Zm6B2^b ztm=y~&o}w$wEJrlak_QjRHf0AOrrS@63IbDAw^+D5k)aYaYbE<5{iG^fT?Blc|?KU3r1?JcU$(#Hk`bjkGhn*CCXaS zZ9ZGdA$yFaky31wSsR^0c_Q6q|ERpTATRkpmKW1_kQ`U?<qDbPsy{C+ZquC#`Kq@d<{}YRf@k!q!d(2ph={Rs+3?8jW5~xX+Qm9%_hvor~UMc zD};>gjjf{0LF;e0@w&>mB^u{q-J)~RM5EjXjy2JW`!p;bZtMl34EgaHKgG%U*$tr2 zxCt}+GN4WVAEC8-q5XK0$CL8(jP2mP2fY6&$A4NcIZofk)8Id?Xa9l~{VL*r&ha}~ zgMahtKh&kyA`WUJs~n$TWFO;p;zr59GD_~z0~Aq@g^*FoM5=&x_CJZbgKEgp|j%mCk9xjW;V zD?7;O+pQ;{u2n1eF1ZsqM(-frdSp8H2|%mGJCIihnnIxXuK z^fEg4ENE~QGze;GXm024?C-E7=Wa#m-6&0IX>#t9pgjOuW(@6xkJU4K*d*8c0XTAV z&xLh!Xg9|+vUqOpC7?YB+Mv>kb7e1HV%iF5U)Iu5MkLQjb~RrQDNjJkn09&RK=lI6 zuR=e{{|rZ@`A^`WCpwYlug%YevBvduJ)-ey`1H0sf4liYXAHeZ4^?0F>KKH4O+C)?ZtjyJ(O z+C&z&=OFP;gVnOl^jxhK?T$9Rftf<3MnC(h+l-}H-&E&(^YM_k8}jna#jyRfCEt8A zXtYo6Ykmy9rk(X*b2ZSJkeqKm1EsIB_GJ5gnRW$e^!t~6Y}0*^M?5`a6V`?AHH?i9jQkVlv7;(6yIbYuLUc3k6v)ekz7EMWdvc+x6>S8f zFH7e_cLJ^8dfS1{X7nh~k&I*o%ZBJ&s(_hd?sg}+HH!DS&@13L7aaYnL4WA{xU|~` z-=$vmhti<=a4OOtnp`Q(ge1OXLT9hE<4Yz)_m!`1goTcYAR}wQ%u9zJJ|0gCFh6WW zzoV1k*7&S6BW`|1;Z%TgdkJfy3WIvyANQZxP#vTg3MM7O}m*<&$jhZ^>e00vID-%g4vV*CHd+ zts|3UbQmmN(lN5po@3-={q`I!UyF=ew~kwq(b0R1V5CLjX{6-^@+KZF>hEfx0!INF z-=1TL#&3csinP#bMUgek8k`4I=Ga7Io@j9+tEYXft65JG^=;!G=C~SjHO1)umk`Go zeIK+8qvLR9R8|i&Q6;2mx`5~p3$K^xT7CEqd^l4qkd(Yz1p(K_AD zqc9OY>eki3WD0}21`KlP5vW(>)*i2iueIEZjFI+bWv0>IFW(~Bh^v+SfKD`RM5oC{ zdz-e6OC<`7uoSYXtMxQk@-d7;qPYc{(%agJ=EXp?o`+a6d2y(fo{mtCWb9{4<`b{h zvmu4v(dlk20KEly-L2XGT|4>W%1FCR=6K8*8OqKAq+z z7*Vz!XGG_9u2$Kv8jGh`=f~i6X2ni3jb^~GW*&V^qhC5nw>nS8{X~@dTR*^jI}ONq zU9R;-==U#ZI>;P*<0evp5!t1{cKISANUn7wPWMm7KA>E;xpG6TTqpPDj65^*$}N9^ zWXf&R)v^~iV?NAn9EjG8#m$(Hn9-j{qu+~mUGrpoOU%pTJMT@jLF4P1_a2brR*WTc zoCS`^Jb70uH1A<(PabAG$IPC6h=?gPzaXQt2wJb8P zjM8^e`oatcXn#X))-_M!TGu>@Yr`6wy5>pbN-D~-78o;HGP~{H z13wY*v|oE!p6BVnU0C$IJZ~ltd0lxP`JbO@v$OEaopMq3+I+TeVNG^P1(frIv2 zrTHHKQCur%X<9WfIRj{w>}-<=lH=015r_KPByO09X>!6m*BeB=vc_0r1N-aRH2UMMJtgLS37Xm~4xP!A+GNEk zwaJQ8V&AwHzF}6E5zVhktrBDNEfNz;ZRa8)QHD1%hW70W%~;aJ-Tzl^CTB8cg&kq- zDVytQm27ULO|rSsHsNqBpgBW%n2*sad@b0|h%x~G0?LezxP#F55Qpfd>~Ko~n*I>| z9d6lB(RsLK04TkIXj_#gd-ma$KZABVa}I^3SnYq4eT5cW3@M+1l<~5!7+aTGOL9(4`F*fia>6byJp-d) z&JMd5$nLXyfvj8I3$`GJ)BTqOKP4l1=>@W1*x{lc(Fmp%h~(~rWCh#d>S)Jz65#jU z2R(%~iuNBs&iCz4t$EV%A<`@ecBxQl-MQsDY3?O z*H@v{G-wcEju*fYQ{IT`l4RPOC@pG#Q!1}V#PX)kg@wxmC~hclvx*Q zV}wh8jCww8!*#IqV^rHHA0Ta%50Eze2a^pR0B?{HNr`D2MQtO-rA3sMw2dxpBYv>h zs;F%gwT*7(-9@}=zaEtr)Ykf#Hl-P73R*9xZS-p!gIw<*)Eicguu2(a+G>>MRf=z+ zSi`kYHJvHeD9#jX1QwDtjt6gu5lKn#j)fv-kx#+sy{w|1f)!ituf)z`%TvoArF`iHMwUn0Djiv>RV2yGpa_jwdg{7UGz_@Q{jr$%PAmp1Tz>RxRG67Edhv z`0hQ!Quf@v_c3kH-FrXNzJ~GWTPWF0cA@NwOqMp@zIOcFOfrxBLdiVx3nkweZ~t3Z zxF7bp4?u(Qo)P3*He=;H7weYsgL1RvaHWNk!XMaKfsKE=1_i$LTXzD4A__ajdXGI|u+nlTD5>aOsP`HIXU*{A%cBV$feBHTu8 z2+@KO`9asB3oC8J7MYP2JI59kVWB+R&~!AsEkAy%s$` z-xq6-(XU7QYjhc_smv{-mC0Uv7SSH;uv!24sYaSL{qH?A%`)u>(8kx9ZuzwBp>y9N zdG~*;ref2+MORct-^^8`z1eG+evI#@ONP7Oi>05#Ow)x-m&1gEjXaKsp#>_H_?SaL4>=xgJ zp9U6_#|{HU7Rw$xvREQgY_W`aWbwNv*-sFfzr|#jz7UJ=c6B`#r-(rnfMbb{qyH5=Sb~(j?_-pxD2r~*iIJu88j^} z)-xWat%j74w%f%tIvI;83aKv1knAD+TuS*`tX3*`*ZN|_c2;|wOXD>(ETIi&#XO-dA^-S(2w!Rw$ljiixJGW%LoqY2oCB9 z4!6^DA$l{m(C$1IPmRD)X#W?+dl)grg?8Z223at|jDQe?&YORXe+uh^EF5d`rkT%H)Y^N#h5j+F$923ei5`2G zKdN@gYcB&!#9z!PnEnoGf6aJ|*WW?yuNgsO-E{lM`&(ei)ZanvuNfKBU*lm>?YZ$G z<6+~CbX0q8JffTJO!Fwoh~`^@5uGsiEO`a~Hx0g)Q2QmhUE)YAk$29zm&mv!m(cn~ zw~+c<1?85!2`QADWmz(LY;MWBpv{HkzA-fC3Op?UEw_aH{;G{Q_ff3|m(bbL;qcDk z`64;1y7Y}fm&2R*dudAyk{D)xdpjGE=YzDSl$O+>-3Zzp(PycpC10+1$=H(}Sz${{ zB)4$2emrw4FQII>s)h0}SzSIk%P{A9=INZtH%8b7ufsRSJ0CLZf?1t?ODT^y3_UU@ zuD+$xqp|C>^vJhVdSvoHvkLv+1>yk-sD(E%+^)0yUf7-Y4dKBg!J^BCak(p(tN4=I0rysN;+Ng|^gkEcw z(g+dF^nAQAG9wsKyO_~3ad+HRh_(L*v>*R$>EkiNXde%q6~(ha*gmfJcjFcqSLu+r9CS+|Z5iT%eq_tll0D$=eNKy=!WJqmjN! zo!}nP3`i`Sx6Zzgo>;a7s1b1}v1}y}-R?~+J4VqdioOEW%=In=qIvkPWx*hv&M>a-cnf{JCdYs?u(HnY7!zjDFFCvSxEnIMI+4;kLkrf*buN1Hw_C8SaehiM~vh(x{UAw#g=6R<(_5P4P}*V4F_#t(TL_2_AM zkCyguDaHF9ElqJL^(b}7g5&HgBX!6t72eb#+hMCywxYlM#t5y5!NyOO@O6YqI5l8i z%Br%5NcNCp8r_dAGkO}xwVbpk6lBy5nZf1q&DP*@TE%}3t%A#CB?&G+5B^75`4`Eq zH@N(a3N5(&6d?Zo`0~SHaeBujti0jnH=>kgN}OAxbENokdP|7Ds2*Q_G&mkWYbXVJ zn9->~G|S@4r(J-reLz2Rd)s_bJ-+-WkW9CfBg>~uw>cuq_mA1T)cErIQTjTUZbfS( zFS7i8AbP40Uw)Fd@hjA$zL{^P$J^!ZbiDlnsn>oD(37Me@AA1v?cb=-65KbA2g@m^ zp?c<)V}@-?{mrTkGRtoU?=b51Eth?5W_cfIe+JF;GQC{R($dQhz!#wCizhMNv!|ES z$q7ZwylRkV4gP=_ky||&QB-8Fa8QKO!HYhHC0*FSsxcqsbs}Kdu8HE{Xb2gIK zGoBIk5>wCLL4HN!Yo5UPJ7lE&9Wv6Wht_tXU4Ms+w7-K!`hz`2+SMVW>gu3zBkhe{ zTpcp1{tg*Se}{}^utUx=x-|}^HNK>m$sPanGPz}uUN#+(`X$Wd^s<+s-+Rz6y-c1I zrk7D3Mixph`#ValK0+S?UBeucFy<3MGts-ej;ukmqP%YD2{`FR#@OgskNXGol}+=$ zP@le!)2Gjc(ya3Y#QX9(dV^vuc+ndC^s}I)mreB{3NUI0BHuM{1ethc&ScEFig`E4 zL^Jcd*L`}{l3w;XNM4UNGPQJGOt+}*Zl(M$wn??605Q{RY})|Kr%%aUx=8 z6~4BRVH(v-b;vj9QXP+?UyJ73K@PO=rk-zEaF5->#-KmC=@&PQuG#D zBU+k&i=FJ^b5cLZ_Gzc|GVPRJrkyKRS8kF!uYJ!xi%dID1C63U+L;0(P1DW`ltvoZ zrJ_OFDebOv(C=fDO-DN@K3@w>M>}2sFJ*l@UGzI$^m|_ZPSL8@qWAZ|2ru?^lGo8M z>I6FJZUz0OS+G-1O@p0sCLQRc9U8qEk@ZMFvYuPk*dv(r{6vvxn( z{?#L%Z~99}8SmdNws%=s<;W_>=`IKE>d~(;p6YwpL;88?_eh zq*a4j+u~gL1AKLe(ORJPM~HS3&>@U2)KdE1a+GNqpctbKT1v<+eNbtS1JM`rw>V!> z+FKPAQ(a=6lAFakWgU!l$~$pgof5~pI-fk;wq&$s&U8G7y$$Gbsrnnwwi z%qwvxjr1C55hG5W4*v?h2CO4j@aZBWi1VGjNUx|;Vv>p*Ks9sOiY z3ABYotNA-n15memM7Mf`$taRFH0D$FK0Q<|Sk; zJ)H*uU4?%1bncvl-2{+{_dT6$D7^-D?diM#@@OnGwMW2T`2DTg-;x?vxjEO}0Fvg9=VozJ3gRmfFho>SJ_UfkdLOVDVHVxCJtqc3Ki z?z|q7>HVHAy@eF1mDtqJy5!JWmq&UT-kp)uY^{Es#RXKvP*A5X>PjA_#FSn z96fbgZ_%#{(2RO!;;qntejj_IS9W6q-n&4f->B;2U+fD061k&8RH~Q-H*{4D^L1iZV|d>$gCLDHii$C{biA9_fsyal8anQem|aMBX8tTSyNmqcA&p| z{zisth5X{haQ*MmqsJg`jk^E~-3<$^aSsFC&!`CW2+&}?%o*Q`m%;G_I3g?L_Xr{@ zW#a%~XH*q^jkzW@uU)+wYkl#kg^6x%S+z73p zSV!Mdj;xShL@*g>oOQVa;}%z4;;Ktrb&0Dkan^-?=^)O!&@Uat$I&Iuy3lVUWLOuP zd3~x?RJDqaqg9%DDOXOfkl!sZI;U9!`rU#AOQBw-SLiPoFzs>JKD|PIAt0%(rB}#r z1*Dip--*s>Ync`D+XKeeOuLzJ+Rcp9Zf2ZzGvlI&S$D@=F5w74o|PCgzNdyRw3r2%KLbzhz)-U@YFPb~e^EHqEb)-y<;5 z(d-iPJm&OE2mLICd}DZpe1U&>g?xd3gulmq%2w>q_>15iy}2HJ1-`sOz8ha;DO9gJ zaOc}NqkRic`d7#o#z$7j?#>kznky=_fYJg=%W1puC}~As=8i|{OUCp)?pRcIXs+4v zwSA*$f;s4$+Fe>N$!*X#rjy(TePcSMw3O1aO3Ny(e_z=_=Jus_$p(W_`M&ZXYenBz z&U0&2I;tGQT#vr7Z|s-QuLzc-vchH?WS5m~kc=YRus`+z^nOpaL3UZ$h8Sq{K2EkF z{uz5mm2HsKKHDIBx@?2wtoa5xCoDBkBqaUv4fLx~^exd+L!`w<`G&J0nO1TCO8J80 z;9~K~QSKYP7ajV<(k?EgFEhH7H@Z@Cy`E1j4b7FCXNkFTj#-+!6{v3o8#1vo|ZeIJ$XrwzJt)CU*hO#k^HZxPMjNF3zMq1@o`oCaH$*rVJ(3U4(7|N||(NbpxrBs7di)16ImS0!eNby%UXx!3V zkMf+fYMNF})2eA&HBGCgY5v+rD>Tikrg_ygubQS?MAN)#YF4ZKO3^u^x@1)6jOv_G zo%{H`4*pJ2%bVyCJ%8&PQ)(S!`($5BJrKQ>*TEOykVJjM=!IfXESZz>s z9$a~Tg=W@(!Iej8y>C@e55LLJp3^E%%~P%P)Vu?&rCQ~wd8$>Onvdu=FUc zt9*~5z?$BU%-lR(54B3H3$=#OH}V7X{i{%`#5MDstSG;mM*5Xj(mvpDXjNLd7`&fj zBK0ZZl#fNt-1)3>Ar<) z)pbDK7#Y_p@}YAXiA`Or#D_|)a-YA{DmOXC+%9SpAM&rFX#4OUK4feaTGi5l^FOo^ zTD1h|dPZ`d9a<$G5n4s}cW>uXdRL#~hIu-Ym?x`{zk^OXC<15ZiRT1XjX@R9L1_gQ z^($IY)g`LBL|2I}(N#~P-K(%dL{+Qksy~2s7qsf;b8mhU$NeSb?~pSdbDK22O3q}) zdj^!$r}gnwbgn`bT8(G>r0SPc{fteMtm!MTb5chksX8ZF=Upg`tL^`9EN*NXUp1yj zAG2;owa>8j9-JO$R!LmTsGT#ab4KlKyf~v4AJ3o1vt&v=8>pgHAKQSVt!hi@WxZV)t)sUsi7~u99~e z23JX*SY%%E@$xv{-oNTL$fMH})625XfP&6|VVwcRRT2e^uNk|TSm#@C7WzxE&bQ!F zAc}Rq1#;)pw?Lj``W8s6GizB-tK@LL1(KtiuOjud%J-4Xa~u;B{R>R)g$ zPP=Kp;9sx_ah#qXnHxf87wBKG5t>ruH!HSzrsQ964@&>tGbR55T9fHX5;UkhKk_e- zU59^xtQw;{9`t2F*I~3y^SwE}H8iSzU^4i?VHDemBg`CMfNum3(`b8`MDK2X)0RdW zr4>JoC~s7GqlewyX=fBhN<^g?-nep@dZsj?l6$z`spPS$RYK)ORV$QMv`Q&&T6xo| zm64KCDTX(z9HyQr&2#BF(4}8>0jjh+sO=WCUP0S69D~}f;VmkMsb@;dD%rJ~M)e|S zFrpfiRbD`?fzparKIQPOmXR^Mrd~knjaM4s(r=*M&}#7wph_Fj)#5`juD7SxMOTXt z8LvyIyo72sp5&y~8?Q9OrQd~CDb)(7qE%M4>eG6C+M40Ws(ywyryQo9DIMn04QO{z z+Xbq$Thw+-TCb$-8jhm2Yj{VL!_+gS{xvlEccNX_8W{zkO1ptIG73Sh7hEG_Za4yK zWIPOSSUF5RQyS;ehtO_R+Xbq$+okO$v|d8nH5^^quHj88hpA^uGhF&>8eeS}NXA#& z?bCXF+OFZqYP*IvryQo9DIH|VwEh;j9{F=&jlAt%SR*%Y3u`1lD6AZviU}+`6^+7-!=bZ z^VqMr6&89w5BadJ`4V7Zp&vBb4;B_4P(jgovak66XnXTOtH%ESd+oJ$IVFupp=9TT z%u}X{PEM$Ek|~6+(?JMPk%XO&A@dNTuyeYR%vy=UP8rKQ6HZR%jAeH7yxyO^uC?~l z_uQWQ`~05gk9VKf^|?ORu&#BjYYls?Q*xHN&mDr@4AToaGvnkGgvc_${>-sI{(UG2_!>FNo47oS?CtKB|ISG%i% zboGh!RQDgmL8Iw&y82Q`XYpjj)76LJi}pe^>yqp7a%)ZZJ<0W7d9}O8DX(@%S$Va) z3jc4f36m}AAGguJ+P!O)T)B0x))BA!l>XN4r#eF8cKcV~Nbi5bmt4(tuXgt?$)4$6 z{Xg$hx>v{dDb?|PO0~P|P2N%JQ|<0ulIyi(gy!z1{h_y`=f>Z&&)v-(DRXyoBb2JSu5a0H_eJ|HIr9FwjUn;O8B*=O{vHyK zWb!LOGB=X>*WbQjdyA{SCB57=AvCmj94+a!2{d#L=ZaoC#6EX5mpoTl)60$3n)sW& zq|eKGxo5e_2qj1ND(gXpcX{gUIg-BMS=DQIT05F{>*6O$$#K4_S5?%PTuP$W|aAlhGFR8EAMpyHow%VX*_u$01mWkE+-w#GI1{14Kh*}$K$BfqYGRq2etA6h z%X?43r@Mq1B_;Hv_e$bsRR0n^Pn=Qx0;H$*Gpav|e93I8>+NP!a{sZs_ifZ%XSF;K zm1ydnwuQaidhn)guig8_@A%J(d$pum+o9)#ORC*=EQ$Bbl4`dd3rk99J8q!|3*+rr z7;neIYWAmaeP5-xZW?UcD=vXYF7V}r;W?v)|T6Rv2$&;`*JNguO@#H zys5Kk7yDwV$9AR1TbDkrmZpxkE`9##cv~6I-Iek2v9kL4XvVILkA;=h3-IZDl&ovX zj7{d`nrin2S+X5#s@?Zx$#>R$;=k3oq|cYsJe$#75`U|;B>q-w&~88QH(XY<)6uOn zj*gykdv93tw0uuDpUdO#kIL{)$_j` zt7JwbtMb6+-|#lZ>HN~4j9SlOzUZ%~_p!2{(nh&`39=t$`^06Fc88RdbzfW$iEB>!vW?YpEVT@YYZ+VP zo*9j;an}c9ZMN%u%&|4@TbZ#nJ=QP2VKuhKeKj+-#ywjaTjPE~7+d4so=u)DjjeI- z{wBXOjjef$@zXhAY>oRxhrUElkH*%xXGV2#|LWrY)y4g*i~Cm>_ph$TeYaCr6Muyh z_b=&HU5)##qpqgak;T5$#qB0Nt&96tSL2>(&4_z7Bkt9VxK}f*SGs4KVZADn>(z|7 zS2N;X&8X=V^5kDE55%+3F+?N?OOZk0SYhALk&aH9ZA0;d6+_<&czHa~4 z_U%a<`rf6suX`)8wy)a@3*)#e`rdvP|3}NSob&n)ro@U8n&x_LXy{K(|vb@wy`DmS0r;A}N0u5VCW-=LqV zuZP+g-}YH$B=l7wlSaH*6bPgFL}4IXWZI0gWUT9 zJ>%ArU+a^ejx$B(reO02DMtooW&pTB{u0;91u0);n>OK0G{B7Y`gIw8J zgWRvLvj(}cvj*M7)%AhYH*1iqCB41cy_LVBzoMn)pUw+k8tJJ0A*SDq^e%g9UB!u7 z#MCaP4UJZCOm~ZYTgJ3wOnb!CFQ$P-V&?Q)M{TGF!&8n9vfMAI`G~m0aHB57ozvX) z>Ll~2>=`kgWAq(mCmCsWPAL-GacvxTb4)X1njObI6#E{FX_3*-)V!nrJ6AkW}}LjwukcO+XK?} z_9;6mu5WNmC&l#tzAr5TS96QN)!ZU*HTNvLgf&OoJE-~Y=W{(tuLdRA@QLsjPf2fv+{dYX~jk7wsXJ4~Ax-;>;R@UCFD0Z<+h5qsB|mcI|QX;;CfZpse!l7v={0+wP`H=9qXoiN2J?F^Et^K68{e~ zrQ~|ml&^c4`v#_anfnH&dzt(4C7BzgBkp?Nvt;buzD)K)^7U<9{2gxpKJNd_PX4Y{ z^88?x?Kh3zno4)Ylbp*+_r9AiNoz^}mUVPx2gUDqu8iOBOzKN0xjt>GS4sbpxTI`C zt-XS`lrKtJdrQ2-_mzF#TbJKxTYJmA^#;hk>b+F$d1c<8{#!M&Uhuxzbnvm+O9Oo` zRpu=TzQnfnGU;#4c2ECc{)y>cgOs03_cc4QS^r|X*+8>(%?4vzd()a7Vs=KeW6b88 z-E4MNvj@%I-Rvo|_cnXk?1RnTF+0E62K%f0!e*P8UD7OT_W5QfnqAiHaqPNYS@Xr% zGFF5)%pTbMU9&@)e`t1S^H0nUYyP>}Z1YuSyRY+u*=g(ijBV{bxXvGD=dLq{H~GuF z9a@az7%lU9wwPdc_ZAnJ?bD*pY-NinX8X6e%Iwq@*PDH_#Wb_aTi$B6Y~4G|&T4fR zwzZdQt@milya8?AFgvKtyJknV`OxgdHlLWC*5-4wbK9&kJHO2jW*4^k*=(WBA7=Zs z^@gav%C^nS_HWzL?0~jy%noW>ZuY>o8=4)`wyW8pZ7a+UYum$Yw(YiNYuoN*c52(* z%uZ|D$Lx%@{mj1Fc3-or+SZu;zU_f#*R(ygntii7 z{XS+J+E<%h+5P~tU$h@$c2)Z$%zoeg7_)2Ik1#u=!$`A3JDh5EScfysW;>j1_RaS`x^XfW&VfNCFUzxq4<0@>KSLpPu z*)KY+#`@ki8|bfGavX2)yV;%_{B3sk4bns9@3TP*v$Y%Ow~#V#gAF^F?XuwpW(yl_ zY<9^;o0@%oqbm17j~Xxw$S-vvr9T(Zua@k z*O*<_`3AGEcD}{zo1Jer`)=o1W|w!KjrF~kx-4VeYwx|*5wkNk znQwMswSKNBgmTCU}K-eBy z0o8|{p+=}G%s{DT@@)oHHWzILWsSCnhI7iT5A_^orqLcy!Duh2!Kg}cEfhBZT4A(5 z)CesI4~F`+RPHdv84ZUf8Jz&lG&%)ZWHcIDVKffvwyw%fP_EGhP$N_o)+x7@a;GTQ z=qhN1(e+SjJ>^bQoYAeK*7Dr}RT}9jNI#={p{&tE&~T%9P!6gJ7eINV0#q=121>P8 zeJ?_dP*wPfd>!O_6RL+6gzrI%p^6@jiZfaT1?BQJ=U#R=R3B!bNk*GNlPz~EXr}r4 zLyhJe2nFk_tlpNdFd79_K~>?!&L28NCfvK?}kUph@QY6q;%D6|~6cJE+m( z)8{41iRVL$GiQyZ%0Q=m!E8{ueZF|;5Y2X)&>xfekFjOw7Q(G+O7(N)kSqwArW zM$@20Mz=yMjP8I^omJmmP&cD{p?*dWK~+#yI1g&*qPPW6u(5mvC=1nx&p?e`<$Dpz zZ6e<*P<=*yeiLed>cfwqpqt_vp$elfpemzppbJ^Nd zLk&jjLXFS|VOz+nP~7@Z09Az>K^gOH0(CR$4pmt0mQbbnwu2gsc7}#`S1r3kBcQ5q zPiUt3_EwzHe$Wb|L6EnZN*n|YH#!Vj3{{0kMbsE(p?;ey?j)!RS`eNFWz9Dps)wq= z^PonkqQ`|$u!U$gRAKZgRAuxPG{Pu-4D-}zYpCAnV5k7qhvz_x&38W3XfzE9dZ^}y zp$emAP?gbYXoS&5$5Mk)KWMShQBb4Ng;21i%Flo*jOIa=P*wOUR0S;v--5E{`xwd@ zt%Mq(rQw&5x0QOjPL}$h1z{_w%BUkW0$Lhopvh2GI1HM!wMqb5J*Gt(F$k;v^4w-O7E$2@*1cLstSLD7D4slU(gDp;5bHOFZs%#Zbs`t{fyc} zRnXUAC#XL(C)^ksZn>L6D~z^)Qhim+Hc&UC9id92U7>zPy`f1)mC#J1eV|1~)zAu~ z1E5r;>Kg*3p*i6ZP&e}(1NAc+0Sz}A2`w@@70T?bvS&h-MrT9AjV3~qj3z;Oql=-% z(1P%CC{?AhH$dHtZh`t4-411qWlIw`PM*-jDCYw82tsUgyw|7 z2+#BOQ5$7Y3gU_k%9yV`)XjXIpbBU~*afPz+|8k^(biDTXa^{7vIE%^7KDAF z2J;PsRzUUPV9487JvanPLG|HKC}X~(p>F0o4(exgqT=>b+$iN5odH!EouxRVbD^wJ z4jOKB5j4r@GH9mJ)zBiNsgVBm(t_}2XarOr)yu8WjlxdSIJ3cbO+Q3Ee`LBXlb|-T4^P=7)iU_VJ!`}iD-IwFf`eGLnETKh-eL}BX>?X4{Efy z1yJ|F^8F5Fq5AM|C})&DiJl&y9<+#PX*d8HVZNIpVtb)U`0B&MPG&Y49R)2i%0d~Q zfz^k{LzPA+LsifR;pxx_qp?uVa?gSEH!(g4&xi8nn+z3U2qq48d2i1okKv|;( zXtw2k3e7xLx!*$htY|e+e2EZxSNIYMteXrjrM{HMpaOQ(Ez9sS`h9Jd8{J! z;o(rqXc&|+8V+?cIsvMH7KEojlgu{`nrSov8qSKr9gA{}>Xd6V1zKcu6|}8ew!VG}-7OXr|FTsNQG+wAiQsH5xqw1swm}!$K8CuRv8s zZ$cxC-h*;bRrnF~0`y4O2sK*nDyV`ZygvK^sxtZ+8e#MYG}*{IjTob5&|;&OP@_>B zDB!5C56htnqYa@dqpr|!qY7w*Q4eUc(Y8>%(N54}quroJqdri;QCc7NgQ|@7g+>_F zK=nokLW_+Kg&K{HgaVG&`tVq&!l)LigXV-MK`YF68kAxt*N0=EZbsvw3ZwI&Dx(Xb z5k{9llZ~!WE~E58crElL^hkK4;!u5fJO55Lnx%h@X7lf2qx<={(dZHW4Ng~y`A~(? z6Ht}W)6fW`=b*_(%bIGF9^@TBE>M+GFKC2OUud#Xf2iJQAhg(MFw|&t2o#*J z`i4RkMn^+cM#n)Tj823m8;yeMjn04;8=VC;8l4LT7pT4*RAF=xRAqD-G{Wd=XtL2% zsNU#iXtB|4P@|EKgNmH$yBn%9x(}Lc^e_}mQtqRQGg_!PqeajNqi3PXMoXc3qgO?f zRrW2YU!CZEsLJSLjM_nyjXFa0MxCL>Mj0r$TD5EjRTyn0-!<}WFP~9QsLE&$XtL2>P`_*W`X;P` zhC@6>5S^#x}>caw5X})KmtkH{5&gc~=Z}cWqFnSMaF!~7c3aVM_X2$3XsM6>g zC~x#5R51DlYB2f}@)oIViZ!wl3g$J3vPSDdIm>Me<&D;d3Pu}24Mv+l{od4ebcco; zZK=3-<=akiMms~^d-ClLWsLTODvkDrvPSzsIjAZe1m%qmf(k~5K@CPnLEig{%R(8W z7RsHay#l}6V={r=SR=bNBKyl3`C zI0IT?G!x3CQ?zy`RB1E^${IZg<%~ioZ}hlwo2O{wDdie1fjr(0tqNa=Xx(`)D;HmV z_y&|WdKb#_rFnh$p>mBrff|fHhdka+t`Ao!&gcil8U3s{qdyeaMsXhJyPQ!oC~wpf z%J8K^eb@%7G%AO(MjJvoqppz08+Y|#1(Y%Bp*W*$6=$>)lsDQ9Dj4-qTnClyr#Pd1 zA+KD%8Yp9QpyK#@y7l3qiZePA${QUE6^v@32BVW8kH1J;AD#wfjK)BfM&lJ{be`fm zDegijy&-?8GQ0%J@_+W!hgU#3qidlCqZ=WQx9aP|=}^Wf4^iZhXY%2O5 zsx`ev=5Xws)hW21XO8s43sq*0p*NFLItB! zp$4NfA&>trU~~i2U~~(VW^w{n+34g8NjJgI~{-pi~H z--fdNMIR`4KT(5n2Z%m}GDcrPl}6vmcd&BTDDH64Z}J@>`b%*}0auz?qcW&6tK9YE zGiomyuI=aq<&3&OnG+P(O+KT|p}f)7(2`Nwjvb)xr;2ug8qQLQUXXXTsIPnzME&JE zS2PgHUMLz2<%|x2GMA_aL!nBeqoF)hA07u4j823aj7BN$Qk6IZ${C#n<&DmT3Pw4o z!RR8$o1zkzK^dc~p*&O{PK63aH$%D05b=v%1LXf>3-QMtcD zvmld{4ouS&9Dw~1QcZfDqT)lF)f^tUN zLwTc~P{C*qsKID2NUt%}hq}L+b+>9604=#+w7+~0hz^GO&lMdGbzdMF2Gtr3hn5(f zpxlMZJq4QeglIIBeo{0J>i?8zf^wf0T>yFSst0vY#%KyuX>=8oHM$;3f36bKpjx9_ zp(RFlK>fc^?p^X3-K)4S<$DO~{*`E+d`1ftXH`C*+>f9oMvYMSZ{_;}nq~A2w9@EDsQ-7${RLWL^e0sNy?m*&i8E>r_5VS>b)h9j zZK28^Q(PUc57k0*!i}K3`8I(HM%|$Xqb(tCwMuLUb%*AJJ45}Ac89W-yC;-0+8e5~ z-2I@u`36A+sKdO2pa!F1&`OIt5%Sh3cNCN{Ivc8m=7bkQON=go(m%;}g>sFqg;pBf z2-W?p-04u}Z`GHFvQX!FbD$hlG4DZ<=i>{ZJXA67aVQhW_Y_nKRm@ug71r^YO)o$V zMlVBNnS5_R8KZZhN}~^{}w)d`5c;MvkM1)fts5Zaw)nRGd*)#kH1CZ{*h*^-x?J`Lx+(sYK>~4l}0BiuA_2KQ(Py}7{wWl zSDev#irYZB7b8`NO59kkNodPDuUP>D)tiP1h# zT@U%H6=!sS;x({A|eERWwn# zyNM=2`QD<7q1;}Y*_X>_bPZI1-aqdKsKI=p9~a-UP2(K0A&^cs|h-aqecs9^K~)L_&AdB>~lr%>hu z(N|E;=sPHHv<7N0`VI0LcQ}W2j)hg*?q{Fj^GR>hM{}J5O!A&$G#l(Z><34p%~z=KGZ=jaj3A zN3=Th&!=7Ub-aLfq19pMi1e~*=80`#I8to2cjrN3cMtehfqy3$J*jLw0)i&fwGP{wF7RB3c6lr_2%${Ae; z<&AEF3Pv-a2BVpfcZuq|6UrFPfhvt2gtA5S0_BZ9hYCikpa!EKAa9E5`x(j@{Q*@Pc^6WjQ8OrK)Dp@YwSfvo zgx(+j4Gf?qaIM!Xj>>}v=fv!+6^ig^?@3U`a$01s&8K?V^jlG8XX8_ zjShu!Mn^(z${Sq*6^yQc8jP-m zyen1TjZnsDI#g+thq6Zhf^tUpKzXAFpn}m{sKMy5h*pPBLf%!X`E`E3$QZp7(duwH zRB68N`6VLP3GYp7t<0ctSX0P?O@%^OFwI@}b>m~Yohs2N%v_Kv73 zJm6Bc!*Yi}Im(bJv*YR@bb%O*K)6cyld3%4H2ylZ-FxAyPw}& zDxuZkBN0`F&s{;gmb(nf8NCMOjoyX|Mjt>8Mh%d6t=jk$${2kGRT_N+r`i#mT?>g1D9#m=69?BYZf^tS(puABxs9>}?)L^tV=YA^~R?`!2QmT#5H zz9!!{qPL-p(FaiF_dfT!4N%tTQz&or6;v?#4)T6b+!`oj^cz(9vwVL+S)+j8)bd7U zP{C+D$ooZc?V*fOCn#ss1qn4io05IMpG4MbhF}&Zi5O&`gO9w=x+Hss_cF889fYTI?4AaRB5yj${8(! z@4Ms~LZv&Nh6{<9P3(6Y359N(Mh6+Y2A#X#K_!7z(eG6rcRzo?XU!j80zo7;r zpI=WaH&WSkpsZ0VC~wpbDj0Qyyv~a23}uWmP}XQOC}*@4R502eYB1^vWxA;B9#Eyx zUQo`c3d$P|fEtYUhrEqd;$W!K=x``&Gz`ic4TlOwCqQ0Tl{f{;7>$OqM&qEI(FDb1 z6nBB*jOr9;G(~YnS3w1%>!AjtX;8k0%HFD6qdOpPOZo1CGDi2xx3zo^$!9bV${HGEBvIHT(nH(I`%6lXL8${Njtaz=MT1*17o zgVBRf<_wh$p-Q92p`6iEP~K<>)L`@i& z(JJK{{Qxx>{S0NsD((-c(#X4(5=PCSyirT2aJJ&wKn+IaP-eV*8$y*vU7=Y^1I~FB z&`P5oQ1@l>Z3{K`c5kth*~-ZFkL;kx9vImnkn{UWV-H0;-spKpV!y^W8hhF-&zldQ17CpZqP)wn zs{dN-4dma5y_){yv3H_5=n*s@EksYF=g>>&b>zx5z}r*qGpzp3lk^Sz=q)_5$ENm4 zdF!CIXhY=ky20C{11PJ%6y@saiBH?*?Cw#zA9euJ-*g&;JqR5drRNgw`g0UMZSV2e zQ_yHM30;h?K{ue;=zipUkHC+k0(urLMaMI4ZlAqM`aQG)y+-?8rhDGE@M3rk_IKp% z%m0DO_G(`^+YDbhI*PiqOhSjCR}Yjak;`-a+>*R1q~`UncHFtlHIB zydC9fyFY|KM}1}#=jbZDn8ZI5~)H)q{ixd*;|k+wtY zo%WZDsll(mpXSmBk)FXg9FEl(AC3JC>(+`9q{l=)?fdg!S=D`p(}3kyw|ZGkuPbUenMJf z_%3NlzQ6FfZ3(JV-evf;7AbFC(t9Ft6;|gxwL1Vl1RWD;1XeLht8datu;LYaeUyJY zwzR%`NIw(hDNg0Jjjv&)4#(ySK4}r!kbU?ZR((>LWpGz~uI=|pt3KE76{Mwa(ALDc^~l-P`2UTX4=P%fZ4X~U ztgFZM!`aRy`L4XP73A#^)m6%Fto9>Mb3t{x`u4|{MJJ=N=zKI8X)RtmeQA{M>{TW4 zx4^ff^XU7(un!=OgX)@#rsJ2MfYsjfC{Oxj?9Ml{_G3%+Dd`{4AIOcbw?AWroLv|0 zf;L~vzcpzc|BBUq>bX{0zP(C(`@-%xsex5aX?Gs^gSAJ#qoO>OcYSbuJC3|F(78xu zoj*rJl@FHUaEZJv_n#=z~L3-L`uio1}um9Mh8FDShqxRscCbaxc1bAc z9b-sOK<+*u2VaiV_iO3*HSnAgxpCCkD_`5<_K&Qa*UmmjSHCFjxw7F09TE8m|Xo9c!9X%F|p@xhL@JJfSgK3hTV2 zGOiAHthsZnYvau*R&{EhsazvIwI!BMth#=}ulg1H7hGDVJ*$(7ueUiGsacFUX}^|km#fe1BWEw8Og(j!UN^aO*)`VRx>1m^}4M~Q(pu1y^Ga3 zQtj$k)Oe_E<$XrpD_k?K!v2WdIp!Bw=NhfMf5AHU>7206A;n{7J*@IokEHXi>Q}t{ zUC7rtvI4sWI-jwqr~OGEhK@p6bRtsyqp&)^sIR&&(>AD`iTHKSk?&Uc zPV`_Dt9UmSAwHE+oXR~#TIZY<*w4_{NY_{2V}C-wqrXw<9Q)AZI^gEz>=P^cntv^yx=zZ?^dtY;Y*s zb|+8D+3tY9O1WnH^}ldtQ?^kK#Mr{|cZ z*Pw0jtBgDMcO;!bZoX{^>zYKznB=Zw`r&_y=VtEM+?Vvh=y3EQ`*~QDuf9mye%Z&_ z?oyw&OTG(;e-iCNS;cBhwY>+Bw;2D+NZZtsc=h8w(jTJ_>BB4N3%D6&*XAGa>p5D6 zyx&V=+VEwIQ(yARNvmJ3jtuD@NPXBAyED?UG9}t?dPb|csk-+kPh}UPBjFS2V=ZSdmf1LOMTjI#lJ&dN9xhMQ$6y3gG~=*-QszcVzdq^M%)U&TLas{ zrT#9YcS3pw;+~JVQDYL)HN8Z{;N*uXwt{6<5I_SvW%I^>R6dd zT77o)$v$1m{mhW-&JQBZ-O8X(7o1-gWZM()?^=V$L!l!X5^|@p6SMvTs0pBaN zMe8GXuhA9O|4XqGR?lC0W5rr0_KVo%9YtEtVD;UTjzMjw?1@oYTucdJVZe=W{VXk=No#u6>yIt+6_OHo&^^=?d>gp2lJuSmU!} ziLcbZca(ns@roNn`V;tIY)g)dVc6kFWz^ouu*Se`>sZp~ApI8O#@^XW@Vh=;3A;Wi zUvhn$NuFyfN1OMP-U|Bz<1#r2wxv9H~ByW_HS-@3NzDWiR% z^RPSryW`%)%qGU22SQl$(ycYlF2JvSt9hw0kTi#6bxeuhCr0~0KE-`ZTED+Y@@fBl zi%(W%eu3R_r~UgEX`PS7+BRp!ic`AX(aGG}0M;?r726LDL^Eh#8Vnza-1dxs=OF!7 zG#C3AT8wnOt1sH-=SfR0Pd-WQzJ}lJ$9G^I`|fym{!j4h9Q+0LTeKQ!?A`jHbx8H4 zk0~CLIxg3P6{BOhAMD0eZR&WJe-M6I#mlEWmp+KR)6h9lSy!fxw8pt5@!Gy?N#BIr zzAwG+nt@+yN9nqF2R`*%em4#e;ZuE*8~cU$+}KZG+$D|uERMlBu;k{}b+Dv*wVm3I z(tYHPh5yri<@Q7B*y5bkn5eyVNsHTIU7wuY9N#u*75!Gfdcq&Vu2288-uEI_>$F>I z_aprd+bJCg9}(#o>@znH zG*4cQ%DHinuT<{5vv&Q?|32ka*43$bsPawOzoUM*IlXQ+<*7eXOUh_2s;ujit7k{z zR7S_SwnMfzK6h;Oi}IUMc3{Msn<}q;yY_j%scVMAD7W@`Lu*Uv+I}K2T6^W!^ViX& z-MK^O2Av~r##fK-M)#pd&|^qtbWi7gGj(p!hq+YV2T&j*=zk~=>C=@@m#g^o{m3{0f1X-MZ^t@Cak-hoeje;B(E zEkfGQ&tcDE|Gb3Nz0ez2-4AIFyEVtz<>Wnr{}b$sjMEobwc+fyQCj8Qn*Iwu-NTfQ zUsJy3#})h69;f(8wMe*^?qW2J7b6xo}I`)_y7F$@q2L%U`;0OZjqQ zlrOn+aOrVg%I=)()~ahLI~!?zc?A0edKziG|G=j;-ktwn!v6+(7pX19tc0a6ksBwS ztChC~-#v`=5~O&=m5oT^*6wq=C{Nc{u1xpHw zoV$K-b&MqM56YbuS@GEs=ddpSBKTT#W2EWWS!gzLbIXnS{rKGe>_>f%k=DJkTVtLg zJuuqG|EY{Sf398Eb5UK|me=67k;Ys5rx$gq-7oQdi?qJDHGK_ftt%QIUCX9xi}_u! zZhtASl->T`Jc?1iv;%3)39Uo@;C+$aNvgpfgbqV$SAA5xtH*8Y(d6scR9~f2NV~E5 zr}JOwb-@{wnSiv0U4UKA@g-@kachdRGs$;rny$mtw)$0ieWrC}?X^uYD=4dLiO;cG z&)l_!+L3f^=h{)6S` zBe{C-Bz-S>2x`GK!Z^Z7XK&x#Q-Pv!&~U z^X)}FdRC!l6Kbo5w66cfhr_Z*M?P(zbRy|-NUXoPqJF6VO7BG9)gNth=@{G;m8r+- zd~q55)jN9{QzZ4(4L)6$i`~7g>u;wh zUTfv{u-a39^bA6M+6|wq`l*;o(#mr-UQhA6d38VuJD=>nCH~|$J9&WwX*in7r@N?~(q-Ham&mQX<Rm#GhkVMf?-i)%iQ@+VM^<*3kmnI^s@P7we9v(lTAh@5FCPTVvZ}yPzH5y`r>x zhuhVm_sj>7r!f-`i8zZr6^)6~`rXRuYJ88NrBR;VOZ*$&@RUS5zr1uKdw-A06eT{xY!6>#9bw~YCH97_(vLNfzZlOU*;$*(qY*elR=Xd2Qu$bUP0XQX?v^U)%-6upKN^C|XcwEmgQAEfQ=j#b^;Vs}Ft zAGImjy(PXH)KtHZ`w#vz@L!6iMpB)(!i!J?Qs31d`M)RKRNbY%E@N18k;X-R+8i#; zcf9L=@DIeVxudZ<4t7#G$FfSFvQ{1Ek-iemK=+{ndJDNWoo#5s_e&GLwqyTi*=_Nu zZ>sA+cpRFH*6y3~*Y^ECrLUwO*GJh~NzXfzs5JlMwbIJ_rU~DlP54Ud5w{t~ zZ%Sxw|K?5j){a>_-J3E)Q5KCt40a zofq7^{FQY2tm1yrzR_HjZG$g^6sL5lw#2V_ChbyE*2VP2mqlZc)~JbC=^~`HNZ(Xk z4&Q)gBAplS!ak1F&n4Jbqx1*Z)ktfE@}$2=tBz)8bBv>n(B??xcf{_62BIuF8I490 zBIQc>a`j=`rV44C_s1TM6gMiexg2lkdb9w&hkirl6M5eh?TvEiN^~2#8$E+wLCeu+=zH`#(m1v_kL^Xfqy3QD z8;Tu^CZp2))ua`pJo($6&zwO=AeC2rb?`k%`*uEd5pwOn2d_jOF5npz>W#AKR5Tvl zita%ndLJoX{5kqDvVUWH=h%KU4}FHVn#6ewjYE&2H&OaR`hdhEuy>)S(Mw4E+-@@G zXLK4GkJQHtvD&VwSY1bHU%9;3qL{|W{*EoHE0$}A-6rDWv6n@BJN90*EJ`bWHEMSe z*AD0m6ry!6=2{4yj?|BFk-Zk{+PDu^o647ODe2FUe@W5TIkL*{0r!s5Ctww??NR+> zBENjoVD(pJwEt$7L`Nds(~QNQ zk1j>J_M3{$quEGf`xaKmjq1?xqCUzeEl1xXZ%Q%0C01pm4I-b5?M}KU%A%2IJgP%i zA=Ujh_G9!Z`VP5oRW(O-@9`_X((iB7C*6lgYlu-DVtxNv8t44YFH3o?kj6&$&hDLW z_a0YieeH--UG9A@vF-sodUvp??Y*4%n~;01RS&D4U3umpsV}aM`Q+(cHFuAw zINfV5!LR!?ZI|B3Y$W{+Qd;-BdVj05?b0#)kvP4Zsc|T~Jh2-b`F}6t`k;4OO6zid z{od_Zzl}B(qu=M6^6NLTcC@YS(K9A@&snk*%bl`cY;Ass7u>;p)#^RZ8(56~L4*%ci3NO?LJ9t6wkx>eT~^6MHy zeHH6G@AxQUOQp7S{OTQa#X22N+yqpIZbbh=%DWf)B+~VZTLWGpy`seTBi!oBV*DQ1 z0Z7}b^O)<$jri_DZ=&xbd+1esSB~yOL$5BLj})(VMvxwdu0VI7`RE1o9{Ljfj#^&B z+(uiY-lzr*L#Lth(N*XHv<8)5%X2hz0?MK3=ykLTt#cjMFK8$lgYH2~(6Y#Cf4>1Y zB8^GQ>x=nfji+n}d|lBVk>sy}YtW5IF&|?;L*FB@>>o(?j>>N~m1{sG?o`4Rkfh4Kq}KH|Pqp&4 zO0DM|m}>1^=C|SDPIvxB!@sfHV)tiJ-wS&Xb};s4?2*{nC28k(<^Egi>aC@|P22Ko zwAp|@Z$w{v(ATZ#=hoi3-ge%4-u7N=Z!fQ{*Vk+3?d!Go_VYS;2YBV)NN;^_l-JQa z-RtB{@;30McpG|`QN!h4XYWd{i+8oRv3I@K)w|i-#GB!D^KSJjyxXaLrnilEhqtXa zi`ws`_Pf0u7_XhYhrFG=N4%ciTyHlo^!D)Pd3_key}SipjknM{#Cy^^)O*T1+$(rT zGOkB4uC-b=LdGOfHq&974P>)u_A_k-SB)b=(tEvM9n-eT_~Z;7{p z5{*QxB;r%=9q%*mUGH=L6OFID54^95{E@#3wVJ4($o-kzU%fB9-@Grq-@R4dAKtg# zpWgTEsUN(*i2R#KFSW)?rGE1K)X!eC)GuDU)UWL4-@NrxL8@b_Lu#YchN&*8&Z&)4 znN-)*mZ?orTSMEVx}|!hHcjo7+ALL>+B{X0+A4JzIY*?nO`Vw9J~cA6L+X^&PN`9; zol|F|c1xX^+C4QkwMS|krOrzAPMw|VlNwLSb5i|M=ce{fotLUgouAq-bwO%CYI15| z>f%&&>T+tmIyE?TP3nNu^wfc=`qaUxyHkgx?nw zDw}$dmS0buoO&xYCiOP0y_=elTArGi`Y3f#>f_Y4sZUbZry5gJQ=g`$r9MyHlKLWb zd+N*7%+zfY2JsryoYr5;G7{JE(ze_pDk|7dDmzmRI> zKbvapzn*I2zmaP1zn$vfzmqEWKS*uhf0)|P|0vbj|2WmfZ%lRdKTU1sf0o+Z|2(yw z|3zvC|I5_Q{x_*z{clsd`#+>A{U1~N`Kwa{{hv|?`G2Pl_EY{LzV8q51OHGz?H}eh z_Ye2i@sIS&{GCtj} z^btL3phqj|(HH)4{wjZj|AT*`|C2w`|CQeT?w{=c>7U~N<&WYInw{zg!RdZkFxqb& zoZ+_%&h*QJG5-3&Sie&+&fhSY;CBwr_4@=9{eHoD{(#^DfB#^Te@Jk#e^_v-e|Rv( z9~NBZA01ro9~WHVj|i^xj}NZ#PYAB{PYSN{PYJnml;Eby-l7Wz|zC;Xd& zC;eN3r~K)`B7a8kw0~=`*uO1U;@=)Tda>0nXNEOm{I5GGlI5qexm=t^+)CJ!L z7YE-5mjpismj`QtD}!HxYl7c`YlA<6>w z)2F0|q{pNWOOH(tO^-_-nI2EXIYiW@v+0Y8x-?yzzKlrT;A_XpYA;Sm-XXQzOBx*o zl^KnUX$-WU`3~i8JQd^4iE|&T{onf3Zab^*5^5>dcOz8n%NpmBQBvQZN;crsraM zEvENkYK-akn9?V>KDUc$_5*I8Z;bCO>vIn%SKJQh;{WLT=XQ6B+xTyL@M&k>f49~& z&Q};Ez3LO!Hz1}%pldB|XiO@5llhYUc5GbYG^jW`lUkAzXUDmEkD(aXl<&vS+^9_< zZicm{HyVmFLjT)Lk?x6UUQDmW)ELw1nEr(Bu=;eDcDGR{=zgQ5wPf4$ra`f_!(y5c z)9o?61QoaFpL_aKT%y%TSM$L!&5Y^unDpCku?HieV((`|#oi~!%-8se$9dBGWQ&?Q z^7Kn+vF80^s*CCWq*qJgT7HOWW9~nStqqFlvY4KV>BpG5j&j>O7%FaWGHS_QNcK#! zx0>2BO^sD@99=*g#r`F$K)WsY9>nIxmE-}IztqX>81FJ^a@n$-`mhz)~gjzadzt0*bmH?Y-Q3~Q)Qbf zk(`;5nt!3@6;|^;r}C86C|R?UZTsJEQJ(s~vHI?VilZ?fDsFGm`xo)8wz#*T-;6$t zOMDSiQX=V9Q)Lh2f6Obkwk9r{)c05HOKNVxZy z^F3o<_MInM*C-j&ZKUUL5xeRIE?GSQq;@Af_whncY-hlCnt; znu<%d=%2?RiTiJ}+IJRj2-o=OyF@hp5rx<96A?2lrJQQ z;~Q*kjEN}+4KZKRmn-oV`;x2&gE!`HlErbwwXUgsp3I13zWnd!K~pPcvL@b0|BCx4 zIWOFaueeurtz29u@5fi%`^gHI)RL^H$r_ui%1v$C|9(4?F-VS?r{bO_WA*=aYss3E zoI{h=bd6qX`%>5FMbc_pq^A0ktcl5tc!TXY)oS??8fTQ8A(D|y*3M+DOUnL2+2WcV zoZ3jJQl|-fo`)}lH51qHAiQhVr$7Nko4+h z$`+5Uw`2MUDwat0%;)%u_iCFR=XrNnYd_*E9u>dG(}i(XRNG7-`Fw8dc$Y$7mSzq0uQ&qtOKDOQR`Ju~*5M&cIh3-8oQk zFC?ucZG_~mwpx-NB=t3QkND4bX#YGK&(d0P9=s9vuZ;EOck6-PSt{-|?E!T+>IZFSq%qjtNaM1%QF0a8 z6eU;Y3F$qk;)ovt4YFElq2e4L2X(i3KQX53!_o8%Zrm8%cdh zuaf$bT9TS)(eA<4=Q(lz9*-%>U5an0#c4JjXY>ZXQAY1W#om7&(+|*DmYdYlVk~Qp z`7+QXqs^g9){4`+TgBX@Y~tI4+-t4GVCW{J1G~EQ+zaFu=Xg`OT5aF3vL6xmfsxkT z6-NIl_jAkD{{6;CeOY6aY~@$@em7rJ?f!GGl2zqbYALRX{1CxMDLUT1;rMNC)LQRy z+06b=J#A%i8xhyuXot8&4b;(mgIUqL7#)OfQ==o|+~H6U^PLJ6Te|=%t||#Nm8+V! zv$9vlWs@T%ne93+6zjVwj++@%(gTfn@#wxc&Yc^Rdf(GpYqOa<;-A1*+{z_TaTRzu z_9f@!x9}CWEjgl^I^JsOL2*@S>PT+KZ{NjduicCLBIi@$mH`a2S zTGx{8P1dVqT}$?5G8)PHr(=48)x1;O?te>t;}U~o8X40+*D{{CoVBZ?;$ov@Ps?|? z`7Vv?yD6qSV+vzh9MfyibyoJ1m{vp6%;)h|;B7|9d`{YEs=lV${pU84`kE@+R2xZO zbT%!{wdVA6mi1Ie=sjyulG{{Sjo*V-BB}3*zuYepZK!#Ptw_m;|F_S9n|iL?k@|`= zwjWgNeL{orJ!*Y9Dvlc-)5w^{K*h2XV$${f+Vv$hUqD=O-K~pDTnQEXa#Ngpd+fV2 zj=L|Wc`-c|$Gr>{=VT||_wL&wIV^d#>yIxxefF4ePhoUVE=`@6&`UK+fw?wr%8<$>!5G zoa@vyl9PKeJDm|MVJ!O{w;uP4$dVFYXX-WP5gy;i>UOI;qfVZ> z{li%=^?67A?YKmqxDB_xRb4gQl^aUyX=(K8QAcv&?e8gE`1QD1FM}zy8p=_@^SBtt zO;I;fUGyHLY+>DCx@;ll8-6{aTSRFc%gx>a`C3|6-QDW? z;WC|N8=>wcTzEZ4-&;#H_XRGz_RqV=S-tkdFV zrQNix^yhACxad5>ZJ*NI6kK>z(Gkog7ycCe1Xt0S+j!2g!~K0mu8NcU8duwK2XPG? zcNW*wasT03IgST-+<8RbJ<+umucgtkl+j%D-BX8Lcr2}O;n%kxE_~!BPoIa~6kK?T z*5bmio1C+^cgC`dTqnmJ(t3ZX^NxtDwKQC~m$K@rsB5k6AzXOAL)6X2b#dnLJ}$f_ zqw91hx$t{NM%BZq7hR5MX>^IAOD=2oNvB2h_4uCt!Xu5Y@!!dXmprZNm8lBsx>UOJ(_V*LHNzOWu zGu&yqHo{xjIZDG@XT~U=Q2pPQ%K8hph&tJ)yy>)%Z&`%beNEhQCnw*!Sm(HoxbS-E zp)OiFh}@ zUby7sqVtH3FY2PD|NpsUMit(gqVE5jxz(p<9th>gD7qy^dycMCDUEmPMN4nyTGC(m zIIKG^ycI`Zh3MLiZj=3~7v5qAZD$d zQ+l&=uqn(fycNHSyUnThKCYqTqTAXra!qf@RT>i+bF|*ga&mvBrPEgKVcg@m=sgxW zdVR>rJxqV${af@{v?sanedp*rqRaLTrQ!7~-$Q!D=_Ok4W}gDl^P?wd5&krbwpc>$ zsT+Fv|2mg2j&By-Fprz%ZZ=<8qW}HXir)16tkbjH+X*k59QlTwe1hEQtizN45zz3?Y%^yoi&^iZ7ArA{xEaN*;Z=vH^r+?fCMy%pW= zZ?@K={YAIzXuX@Q`)3%-jeGX!J~aCIw~~4{ejY?iqb;Pr8|y_&qb;KDW~Kjg?q*~D zKh2%G$?}#T&-I}jwy+W8Zd@)g3nnqtw1vuK1 z11EU$;CfGGc+683p7d0Q=RNuGil-*@n6+WZtV0jU&@^h9_3*W!Y1A_tz`M;xu!Gqc zb~Ky9d(Gysli7lr_d(O>YPNz8n{D7@W;@v1Y!4qdJHRK*jCodtg`V2l%kHm-%*srqSKnhwlMR;}Posz9%$|Ue?d}M_)Jj-5A!lo5Ch`bJ)~w0h`&a z;GK3G*uriHTiWeu+Y0h3+a2(2plP(VJHmE$CwP~AKfKp|06u7Ufj#Z6u$SEpK5F-X zkJ&w8Z~IZ$&+ZMMvY&th>?h$syB{26_lJY+0dR;t2oAM}z+v_<_>4WAxete?@vJ=p zKLYZJYL9|@>@o0rdmKDwkB6u2iSUd)37)kl!*li&c;21{FWEETWqTI9V$X(G?K$*$ z4f54Q?_B8d&V#0RKD4|GpzU1-0k zSHjxf)v&&I4Q$|D2OE0V!$#hXaHMw=9Pix%CwRBQiQWSEymvc%!@C16@_q&1^6rH1 zcz3}My}RKG?;iM(_XoJjyBDtZ?t>e=2jE8U&v2{vF#N)M1n%@6h2MFP!@b@U@PPLu zJmftEPk7I;9)5>xUA}X$uI~b@=er2&`~HRveE-6RzDux??+U!bcMUf7c}%{|3fZE3 z7QPwe)5GV5&-ncCSzins;fsSKeF<=sF9=8bLU4>P1&;Nl!g0QI_?#~jPV{BL=Y2)s zBwsds!B-qk_LYP$`bxw3zB2H2UpctIR{_4^%Yh4hdGJkNW%!-1D%|6%4uAFKGs2^g zZN^sn-ywTIUp;uv*MQ71u z_^+=8`Tro>o39oAGGu%6wZUJ7rg6>J4*LA<$@rmZ1pFOfg1;k7_IH9Q{`+Ae{{t}9 z-vy@myTWvTH<;n?0Wfe-@nVpABF1&w*3?bKz9~JUGoiA5Ql#fHV9H;Y|M`ILp779$tc` zG28zR{$*$ybNox-*Z!q&r+*pz#=ji?>t6x?^RI-L{Hx(*{~CD3zYbpYuZP$C8=(={ z1U-Q*&|7&2a1#V2lAQ*O5*>6yrzND z_{)&jG*AYA74n(}%HfTea(GWn1-uD)O=EKKHsm#p$;0~~M_)0O@d0QWF)>wPTugNs zipeLR40+$h)WjEpyzgRaaT})$G zHl`_=a*$)WnC7rTObb{srWMSMX#?xTw1f3x+EcSWWQ&UF0Gq~igw0|)!R9gdQ+g+4 zA06`mz9r;HET#)=9n+Oe8^}I7rW?K;WFH;V1K%EUWFFHK-vOG&Ju#2sJ3{v0F}-1@ zm?z+UF;Bw#WBS3)G5z5KF$3U(F@s>2m?3aT%rH1CW;h%XGXjo|83iZBjDgc*#=#je zu!3Vb^blZ+QK-?&})Ovuqf+-_JcZV#F2&@^hq{Q&dh_QKoZ z_Q9HQ2Vjr5pW$P1hhguyBXD5cQ8*~>ID97V1RNfB5?*KQ&cZ8ecJHajS_rvY+55O21pnWOC(H$B@-sWTN5V3+=MCA$%Cd*DPbCXBw+^Zl`soFnlKwamM{nQ zPM8ZHPnZY$B+Q3>6Bf|6A7q>8g5Ql1GglsgQpVK)AMP_emr3#G!r*LD{%|76SqQdVgd9eZioKF9k62J zS1>1WC(KRU1#2emrk`4nWAem3uuI|(@S()LuxsKz_;BI@*e&sAI56=r9F%wj4o*A@ zha?_{LlaNHVTmW=MkQ?L&~Y6s!y%4pt@84RRzCtd8#i*;<16_@0n$BUlsv1Y`>d*2X^x*-nCW@ckf1 zIKg^wXs`j9VUYD1Yy^h~8^iIzrsO9;-pj$}@cCd1I4Rf)z7T8!UktW`Q-bZ`)L;iV zBiIqn40eKZg7?E$f)Bu@!7lLqU|0HF26-IYa0EOX90e}~$3TD5I2cG8 z595<2!la~0Fe_;?yd`N0ERr-07EPJ~Yb4Erwd77bb0iZzgSpi;@c9+ezEuJ4rj>yGdWcB}qHs z`lMZOL(*>MyAkqUNZNzn1bHtc{ea&B*{YNF!edGM;PIpb@VBI&;fbWf@J!MXcsA)M zJePDFo=-XftE@h8~8=29o!LW55Ed^fM16?!kwW`@SD*6a98L7_-&{Q+#Tu)zYBGP--mj@ zA3{ChkD*85-cWD&Q|Jl!OXx{>B-9U{3iW5HPeWec&;a~d$m<&#gg*~?Es}@8+meUD zTFJx7*M__n$s=Ih(OGlsd4n-# z`H*)(@>2Lg@-p~w@^ZK)c?DdXyb`WUUJWx+*1%FJ>tOkm^)M%8Bg{?N1S_R%f%Q|i z!p12Dut~~x*fwPc?40ryd>~~fd@yAf?4Pn5KAo}$4oLX{4ouk#2c_(TgHsN`r71td zEh&fLXDLVE)|8|0^OWOoXUYlqR-uz{aiLT2?LueZCxyMuvBUcES(w$Z%a*pbyI_|UTO$7 zO-+H#Qd42e)O6T7H51;InngeDA?GZqMPR4YY}hTeIP8&H681_h4IfJ_10PQ<2m7X0 zfc;W);M1vja6oEhI54#;d^WW@9GjXCUr4P9XQbAKucX$2^Hb}=*Hat71*whTqSVH4 zacWceVQO=jk=6ocrnQ2%q_ts$MIfKyY3=aYkWZVm_W0tEz$Ikk%1j8gdMl z)(KWjyB}6bdjM8V>jLxBy29Jiy1}|>Jz%4>p0HKgqwub@-mqiZ6YznwCt z{;+S_05~>n5S)-U1WrpE247Aa4(FwffN!LYg72n{fy>gy!H?3$!_{dM;m2u{;3sL5 z;fAy+a8ueexGil4+?h5DewQ{I?n#>i&!o+TXVd1vb7}KoQu+cIN?!<*(-*<4^u_R& z^mkbHQt3%}%PbCSW|o9?GfTsI znPp)8%yO_nW(C+dGY2-y%!4g5E5nwVRpH&4)nSLse0XnWO?ZE1ZP+cd4(y&;4?dRJ zfbsN(yc07U!6!2t!vUF1;n2+H@R`gO@Y&2()EoghKh10dpU-RuU(9R|r)GA5Gcr5E zS(%;S%bEAX_cI@$)iTKbF0%{%L&(;f*%iMMvd%NR!L^w^;JVD7Fs1OLuu$RNFr)Aj zFstyBuvp=Kuw>!>uw3B*uwvmsuzKMk@Q%X6VB^BWVe`Tx;GKm>!Fvmjfqe^)gZ&GS zhhqv)gwGY81Q!&Z4Bsd`1-@N)8eCF%229VI1v9c{!|GXc;B8rRVZE$*uzuEj*eYuQ zY@M|b-k-GycFtN1AIo|N_Rd-YM`kUBW3raPiCN3x3t21R^sJR|R@Q1bH){=iEo&WI zkhLDZnY9sa$l3%qWo?09WNl@Q?SNcM$tr-~W^ISNvv$BAv%Z3RvvvmN8$a5UbLJaA z*;8`fH2$&wu$OVaqr7*y(b8KBw)Nf)@AlU9t}}Z1a*WN!T3?K{+4#g42RHZ<;HSPI z-0Ta%?|dcU_r7U4n~fiRGvH6YS#ZB^HazH?0}uJ;!e4yz;IF><@R)A_{LQxz{_a}@ zx#~_oTyKY5U5BQ>J@olI!dSnIq>#TGKEvM=a#fuBmQDPNa|(=R{&(P={w1)be<^J3 zUk2Oym&3dKE8yM!mGB<_YIv`I4ZP344tDmhhY$M8(Az`)a`0h)1=!u610V6{!CwB# z@G*Z$__#j-_VLHTzW$B0eaauiKkW~}!TvVz8Ae`UjAY~m##lyPU_9?{j(@@50#5Z; z@fUD~d=qV7_HTi&`nSTj`~~oBma)Kik7X<{KJafR^O1iC{McFE4gMOm-R%F0%;)}{ z@VtK){L^2Z`hWR%U9Q+&*cHj(st3(s(X*VC)4WF|IpIit82ok8zj7 z&T%>Xf@P)n9HX>nf8uhxwC7;rQoFq8jo{2+dC!}{^4{{EkAipj%6nD?r<3_O_y?um z1`Crv6l@tN@A)Oz8vYt=8>ry98hjDPCJl_O;E7M_6`SL!l~g4u$8&p9wWKPZ7m|L? zsp5G#X?38A=e499ql)Lvq{C$1PCAlP)$>u(>WWo8tCEi5KTbNHlkfR5X>(G(=j){D z!P=hl_}e{~VI6MUZ%%69$qh{pHuThTczfs%?yuefn|Rt%+R5{0^4a9$o|%~^a*lgm z%{&QT%RB{N&pZR)$jmWP%#X8P&q^`ZX1xJF$$ArR$a*U)*Zj6fYB1M4SfrzsYaS|c zE~laSN6`!LbkU3OY|+2r`J(^AKZ{<1e-*s~|0&wMR73N>qSx@3i+XY!npcZjklU8f z%=SY&J0`ca`Eqs~T$Q~v*xLL!I|08TI|x6`4#CaYDe$xGRQP#z4!;PyE&E7ZYx9fj zUB1@lm)YlXTAN>Ir_%PD>??uR=C|2F{CC-t`1Q%}vqShFv&Z9q%AN@KXLqz(n+LOl z@KAQhYHP+9>j)Ez1z}P#$s`xcG1{7iilyhaHPeb^=C(6yQQFSDoziw@ed@O}TNleB z|6s8quov}*ny;3ukTTSKqhxmOQ1iEvO|plYzn5&5JE&{a*UYu$^5BMY4NA>7KO^(D z`45?Q&DioKbKf=N%io`|#7rxnW4vdUC|^4FJ+oB#GPz65^5x6HisdWht}$OLp95bn zp9kM4Um3n#zAAjTe0BI<`F!|(`I_*<^0nbdJ}1YxW+vq{$h~GJ=d{YcW)>pjw;s=Flv~VtI5)>AZuNz=EjzDqZf(n# zCq9r@9meK0B@>_5pj2%uF)yD?QeK|X#Oj{cJhzGU2sN8ny{Os5dMvL6na8Qw#Og!M zCRSf+HnRrj)$=s7hElVc^$azeS-S1elKF$0{K_RY$69Bp`J8pRQk&f8 zEVFVB-dDLDK2W(mjIG=ucf6HYxw{6^$InoTdz`cru8N@XIgJjbEfq+HD_AyQgf#D9yMoL?^AQ8^#L_! zS*xfy%lep_v#hn$oMnAN%~{q4YRICgCF?tC&bEG{=4@*}HD_A~sX5y^M9taOFVviE{YuT*)-h_%wTvngW4R|& zB?oU;sSbTrCXoqLX;5me6AP zu`5=~!RJ=14l7l=pG=i%4N7_JYSr?|)Towcn075{n)dC~H0`?7H0}D-H0_4eH0?X6 zY1&PwY1=KU?I>j1t*L3-ZK-M7cU5~J*S7DbrfuItP20Ygnu+%FFlbMAIJ4S3Ptbme z(xCk^t%CL|)GuNm#22v-RqK*l#Qw#}{7Ri7_Ay$Ou#M_nb4%D}^&Griy*l(&uUDpo z9jM-*R0%t_dOn%>>UliDb7%E#xjA-AYUbFjshMN9t=@yoUDV96@1|yseGfG|+r4U3 zhmY0hncLZZyhejko$Wp~^2zkAk!SR`|Ep25Vt@N`jU4<{YWBB{{4!+B{061^+jf3F z8DD;$@w6SE-=N~tc4B@GJ}JLCOwMmkrVursw$rHjw4FiC0d~>+M{@_*#i%*JE0rA?{u8-_?b|3FY}cZ6uzfqFL+tvL4zU~NkE%Gt zzJt;sb`wg6*v%*%YY(M#to=;>j*?^TXDJespe>JU%X9`Y+x6w$*q3~*>wJHvTi-A}klZ6~PWl;*e;!RmLztEv|H8qE^W7-9 z#dv;llwSeoe>|Ws(H?XZok2X5W;{c^5V0sKg`~d<#2Sd>3!@e4fF4ATAo(E#zVvF0 zM>3BWiLwl{h%)xqiHp$+Bz>(TZgKq=#NFsHI)N^t%ZS?!9D^7}aa0}ELmkiqs0ZqU zoU3QlneN7P?;CQF zx;MrlH`E)&^aL~wy@r;ejY!73jkpsXaHo$FPoazM^cAA?AL5OYiKI;#Vjj8;H9#%U z-RMEo6ZJ(mj%o09xsmuOXbyS@^hi0O=Xfcw0ml0Q^&yb8sa$n;2px@D-=qmEY@C{y+hO$u^ zl!x+BebfeZLJy_5d z7bBdq05OO%P&Vp}B4d3FANh=mE|Hv9J+#%_%?QB6d9+)u1r6U zo_6!Yi8n6KbL6I?m(g431GEkwkLbsq&s49~AG$1xZ9Z?rF0F6TO zU9eT?SM(Q>x=G2=F-~Oq`tfE{RtDuDS-$FStmDSU#8$5F;Kt6x?&xuM`f1`YGzPtZ zW}(;6V)Ox8gEpZr(6?wGI)eT{f1)eM%dZk9qEsZ~C_=my<)PZB32KKrp&qC&8ivN8 z7tl=f8k$VowZyIHEA$=u868Jw(LacP+hQc53{(PDMAcAj)C9Fd_o3onAxSgtoiW zQfC+bC-e*Y9i2z($X_DbnbGC`l-w5dIogimDN98~Q5jST)kO~?8Sf*+KCU0<#>vE4 zXr4PQ^IwF&*=xR({6}b=TXzd_2ilGHp(E%dx_~Yrt1zF_CeR3` zNcy;iSPE4{)lhxZ3`v`N-1rbt>h^NuQ^cWYG*J@CeR*AZ zIScgqWiJ5i+VUi@LV>;&=pwilSbPtwr0>&*(ThgQU*i#B0dU z#eyJ8N0QGbR&;$e;_av*YL40=sndxl^Xf``)b;(`ID|L~O+-`CY$SE(6W>P5-RX~s zpSpgV8^3YmkHkZ+KS4a_dRg}W@MbYS$C30axiow+B(Fi)>+;oHFZnunsoR7ouSGjz zcO+$x6C-^|*-&>{{KV_Zq^{&6^oASie&J4k>(<-v#$Vn1AH+*;PUi0| z9_}xJDASq5vTjc1UB%7IJY~A>b!DyGvQET7H`E*B)|0VMcgv*x>-Y^f)Rj74y15^S zhmg$g4>u>{imWTiN5&%YDs`mam=fXfi& z@1j*`J=%lzqa)}K^bblZ$uT-Ai)x^H=m8{S?Cr)eZk*=EcigzzjXT|Vz>OE(=r0xS zrzEkW>+c}SGDX(GWTsz5Z=&_+OLP?di7unm(!8fp9dsA!jE14edXzYZ=}BmYo1g2( zg>GEp#t(^WT))YU+ugX!jgfx$G94M`5w}dHe|Pip+C-K?{GZp=zj~by+{$MIx)n)# zsaxqfUkl$H-HRggmiQ3Uy>7@!e(+6lBX5$Ex)a>|)a%OS^XFxz<+{b|M44VpT!uEd z(*?wX=oqrf@EV{Zs5Ht!(xy65=F!-V;zh08@(ym4W5);ZJyAb5H^>l(i*F zyZeaUQ9n07lsFna?@muAzTtYQ{~mrd`W(q|-Z#Yk=r<(gXWcwsp64q^;dx0u6)*K~ zCFWk2uZ3@d?s9WdXBXCAuUl_?e>4n@L6gvQbcC{3i0>jEwjsq%YwwhNXAi;SRU0tbx{-47Ii|hZo3itp}|P{9Z8&krn=KF z6Q!Tmi8BAU-TX&Hd0%WGe(vVJCH{ntAt^gcG%JMXlTN(N_4SE&p>8sb1|gZZ^e@NU zW0;nCzCfId7NX^74cdghLVM6LB+KwGF{UD)ho~ZwTn%DV)DiVW&muXNmw8OU&p|Rz zncqVE3MBJfPuzxnKnKw=^cUhm7vmOG0o{hAZGEE5>rUd`ZZ5J6U6_{so^bO6h_X(` z6JJ8oPNrYSFGpL@K6D&K)`he`&-7K~%jNhQrJW2CvsXN$>BZ-q-KZm#gEk$e4=Sb>)?M7J#-{U17 zbmK8Mo+18?t|D(0jw4Yjx&@U&(oZf?+SVY}MUBy2=sxr)k}}!GhU3ShDd;sf|2FXh zB>k*)bDt5vMBlslLvH>zcltc>vYWH3GA1PRC`7!)^`(f;*xc!QL>Yr@_s#JgPdHRU!(m<>YO58MX}Y`c2PNW8)}X^q8?~4lFx;S#8*&cxn-VjGrbCZ zfxbn@&{=eSovTbISLby{CD8R{(k~B0IQ`#tLs=81??!#lGw3CBecLyg-hjSDKce&K z`f};psKI(fk$f7yJgS0fp*xV2$+EP@--Bd*K1h5FJ%z@hNc$=HIcOnT>gHDwH=xhm z>92{hZhv&+Avga!@x1G0ewXnv`5advnP*9&w5v$G9W_P|qDRmGG#t%9^H5|wi}BKC zIdMHIaLabO`MvJ+VWQ0AB=G{egruGSHqQG{CMt)jqB~G)B<1%JBlGHhotN?Vb*Bdt zN1*X&ikq8FobUR@MCnWVS&m=h<~I>#Ogr52J#Lh3_GkQYbk5EFOO(7-Gu)T>1bk#{ z>DT$<*ZB%={i<%P?M7+e7~kf)=}xYHnAjWjcc;tmH5YX`M>aXEk1itHmZc0ppNJf6j{E$_z~AlPjvk>H_mb60yj## zKam_~$^0Yh{~gL#xpg)WcOWU-P2A`DKZs6yH(n;n>uuMLjwcCU%$+Vvtb&@NcIbZ8 z9X*AHp|ME%dx1C;y@nQ}50KDI(E)S}okoA5Ysi0lcsofXrlMPrw7b=fxkOpU z8t%0C`mVpzjrS5Ca(!=Nf7eUh;jSO&#u>!9u3zZJ_lc`qFZ15u`p=19Bk4!hk$mRt zcgub!o_D=bCp_i=F&Py>(xxKucGLt(zmjX~mUVP~&uHyUcV<-Eh5-8#9R|Pz6*KMV7lEUiy=Etz9o= z_qlasJda*iN2Ui|S5MlFV|p@r1uaI)&}y_1ZAa2(H}Nn!f&M~QQEWYqy-+ric~&OY zM)#n{-P}Op3+N4Z`aL(UBFenCxzpbfkGfv+XYf~1vHF~Aq1Na=GziT^bCJw*5pgN{ z1j%|RAnrszy3>c;_#5$}>#q`h4LBx3(k9i7McjBRF&9;Lr|Y<}G4U?f-%sr3`rdBr z@5X0{W6>leW1K~thh$!h+_=<@>xo;@Zg+a08;`j09PwY|Z5VE!;Ko!pmLyg{`R;T* zH#T)+2jTrO9p;}YTuB;#N2MtNPfyMDJD54iET8~-B4He$bq zN}?)A`ncVVO^A29{z2j+XaE|8rXktZULn4XRw0?^r^GLj^z*%&`-ON0{p04%JHqQn z>cn5?)2{Qf{)@TOWv|Ouy3W_a-+|hr`%qWZ3k^bJk@O+=mS4cnKy%T%=tHy?ZA0Iq zgXkDKhva-)&b8$nTh4psy>pqoeE!Ea4li>dq8w+)a?A5Ga(_$iLCHNExpyM>1=6#_ z*MQ}@E!kJdb2l=c$g@{d4f-V?xu<*MIh;I8;EbO(k>^kT#!D{pT-fXGH5}RJtYAL! zY?nMQC3PatPhEfC{i@qu*1J4o6?v{Iz{6sZdCC1XxvwVAH_0vUXK3U( z8F^+#o=uYb-F4_!o)c(HlxHkj5#{-k4#dbaJzem!50&Q*3x&Z&L14N}1e?l>3l!|55HwUVq;) za*t8AHQ7(fHYWQ<*%wFd_sKm#x&J5k{UZ1LWIrkQ@Z^4;+{crBqwEu9-#5k`o4j`N zK9l#J><6daq#wD)A^XJzlzEDT_k;C` zvLBRvpzQx-zbE@S*~iHL{)pTUk$WF=WhsR1SSEV*eo5 zGURhxu4BqMtDINLakm_2%lWAs@5yeWdIkW#1_KL)jO~eo*#(vfq<^ zp6usjA1C`a*{{j91=+93bpzR_$^K0CS+YNqYXEZYFZ-_VSub+#{0mXebLG5S&c)>% zR*vW8oL0`4_JMLw-B`SwH_3U@_2=z!E+pqTa=!B)?TWDNNn6<${z*>GE987a&K>0Z zK#tGlyg<$gTvRWH=Snc=~ z)^>d3rXBnBd-*=i1N{1G7k+!S3%|VDmET=`f?r+j&u^|i&Hn#se#!W0qn$OxxC^yM zcU$9(4%S5W_cM%+)=cAG>t&;p^$Nev`X;~4`WC;;x{TjtUClGrtNBgV)%+ssYJQJ( zHNVEXn%`nw%{O!k_#M_Cc>elFeuH%{zrebe-(TJ9{Q7Ed>omW-dXC>+J8VhM=Kn7+c;;Cp&DYR;^g7?JTVPc+-#`n|n^rAz z5qb+PMsHhn&3DkdRs(Yhde3TTF6CQn@1tet1HQSooNuOmh*ns4n;)T-RtIwxT8%zN zYtUM>4t;{wqYY>y`V?(Ko2`e&_VPwI)o0RU(gY2sQD{8ijJY<=r?o%{ca62 zPoh7p;pQoH8l6FB(K&P;T|j@Li`E45FZ4J12mOowLzmEHbOl{S*N|a9Z+h&>rim; z-Ck*CpiER4WuaT_kIf?X8ndXq*37oonZ;0XR05T>KQT+$>&?>k2J==_#{SeSYi}~k zq4M??vjVDUe`e;OTzi|DXMbT?3A#`&aW$`>5H%K4!MGkDIOR-^|wbX|s)e#%zn)*=NnW>~m&&`@DI# zeZlO2?y>(gJK7h`d+oo>PWC_MefA~ue$?5%Wq$Fg^|e#2e&{LG-_Eq2whLPW z&_FcE&b9{I#jGKAacihu+8Sn;x1K@6(X(g-8foWQqtIykK5L9U${K4wXN|L0S@?q*N7yW8@4Y#Fym;LoehuP#nq zyt)Kq4YlPHJ;C@y8uAy^T+qqMz9MLBbjmm`*3yuchMZE_--P&{dH65I_|)BPr0U!% zs%x&Ug}PSi+NkTS?kRO2t6Qt?gdsa5nc)ee8T0L%G%QA?*frIMVk^`>jRSGC@| z>b_O?qlW_#=kF)Y{ig1Bb+#E<@>sJO^*J6fV$D`=+mc#ZT3s1+dFm>wtLi%2c-ZNW zBPXM~+cQUsW@HULqAlK2_kp?()qSLHmAa4B{iyD!x{K-_wK}@n+7NY9)NSI3B>cBU z-BxwmE%|ns{C#b;4;y|>Jlvmc)Um^B&E|K*!|xPvpE&hwqk-lcI5|Gh$wl5Njor3f z3s=`%T?=)s)U|P)&993`=G$If2X!4?$C0evnX$+M+-u8rFRwx;t#`k=2h?>@*Hv9N z*KvnW-E($tdXt`?vxi8>{7tYYK*>$8Uy%fV)9s~Da?|-OjPT#9c6bZpDJVO#9lWMJ zzpm~Lb#JPB%U~S8byd{W@J80lZJMj)l`U3gSj#JGT>fs?()#M|PYy0+@>(iV3+ zIhn`Z-UDund$iuYT6(XJ;6CqfZoSUh%Y$0)LGM{g<@5PL?XQd0dq|h)A?@#BZTqmc zec1c2JCAPKw!70-(vN71N3_Kw+M=hn=%w{~X}w-r?@_Jyn7YTc#pBxIab1o+y5xQ3 zhoYTVrmyCn(q5j{(x<(#)RVRGwALG_%Q0BpP;Z9Y-%xK!x5ZFx@r*MnS@LJK-m_Zo zS!YekJLOqzF;eS|^yaz!jdWT_y^+qc$vbMKwivDR7^`i^>O98kJjQB^=d{HHZ81Sx zOwfAIt9wD+i_X^0z>F7l4ZWz_?o@p*Om|ADX3TNdu5B#V_58kD&o-86ZiTwl>ei`S zuWpCBZ`J*%^ZiNPe&@B65ggRqA!nV+=nr{slfd6ETJKk_cTCsNZ<_mE-5=WGw3CyL zPJ0^?WP3TS+s0WfJ*%Z>ol>dD%;s-=c6^3F4SkKfGRSBi=8s zn=D?uKfGRSBT;jSZjM*bZNZgCbw$uDiNN{E;oY zm%7IsCu4rh-^+bv9@o-7TH41y&@Jt&xxU)sDQ)qzx`A46ptc>Xr9;&{qwZOCBh`&o zH&&P9Idv1%J+JNsbuX%$s&2Zvnd)9r_p-WI)V-?iHFdA6dqdru>fTcKwz_xKy{GPd z$H{7a-!Jb9+5X=5%Mr4CD!=a^?XK|;w8ba>v2JdIx=)=oBZ1wcj~@(ob>m-f08@5AGP!+b^Ep6em|Fhoxg*cJLu$Oi4OW-bxRLv=^-sW!oSE3>{Trb+O>Z+-$q3*UoWIuhIj-Zy7-may$2O>wvw>$M@UEQwBR@Yfx zQbv7s4b|PDu8F#4fymyzSs=2vZ>A%-Q?+!$cBJa`Cd$jZ(ExlJqb+0bly*h&XwDdkL zy-!O!>sHrU*Y1Pr9#Z$Py6);8QP)e|W9lAP*GFAnbx)~#THQc(gLPDcH8)hwTp4KGJ$0X}wiiZ6y^ozz8Oz5`PTp@H z>w9{wj&!YV&!1@S6U}XKmYk->r#jzHb=fv+ZnNe-b8^z+bA9)GuJ4}DwdZYGx=l;B zIi<2*wmGk$^zwy{>I@S-vs2WLwflpuvS(Nf8T29 zw@#_#zSDic_v(IBw^z64pS0~yI=B5gmV;V)P)iSK?vU;)e$m`7n)_9AziRH7zJkB0 z``vM}D8FmHKb-MN?vFs^4CAyj0?C~YM9x#rI`bf9oY&Ix+Vh|4%$V>V+vdMu$zEJ~ z3CKe!&R=Xyt)D>2DOHAY)bxTZSPh2!6vOg*s6WJdX z)zV^GT1-oeIi<2)6^n`Nqe^JK5?Zf>_EJhqOKE8-?WL6VGCwvl`b%*Uml_{&>FQdj zYnm7-U71+PS#aAZ2<~Nt$~r9wM(#~)cb#qIB}G~^a-7s_loWnFcv?+Mo2qNBu7|og z^794G-+Xlo)h$)G!f`T>6`>;%_*y)$LPvK;2Q-aW^gP zs57@De*He|crq+4GUhp2I#=C1*V#t5!e^bfw$Vdfe{}=Y4Ocfp-6(aF3tw`3nWApK zx&^Ldq*;;Wo$orH(<>Hv2TV~nP2CK2vs`Bz$BRdLIic>P>v&d7-5GV~)XgaoIq#XP zZl1dN>K3S5sBTe-$VeBfdq>?8bxYMPQ@7l4vXYi-e=9V%LUSuMw^DPfHMd%GYc#h; zbL%v>PIK!uw_bA_ot$i)o78Plw^dtg)fNSsE706_ZLve$SL$|Zi=EnHm*#e9Znx%k zYp!^y$UC&8y3*>(s4J(gg1X72B4?UY)J;=2L)|QOv(+6g6*>DnqVA}=oUMm$joAs2AI7^*Z zonKvwx>R-P>N3@3shdQa4-O9Ch!Mj;!Y;>XtfA*6z~Mk+r)_ zbIUZhTyx8voUF;^r6X%{g_f?+(iK{|Qb({_-5Pc4)U8*yQTyAdxlNkeq`57c+oJQ` zqNQ84bgPzb)zShjEzr^eXUwwKEzo+~wcd8Ew_WRP*Lr*Pb=#-zfV!X69aeWl+a6VS zT-^zEC)J&D+RCeSN^@s4cSdvPGXxZnu5N|8mFiZjTUREs*4C@rsHL0KZBe(?akAF7YKsER6=-gInaQGVsr7bgy%B$-CA$A*4wT1_GrC5T5pfm+oSb<(0V^;y&tsR4_a@p*4wM~_G-PoT5q4$+o$#R zX}x_~?|{A@2Q>Gy=6=@PVa**bBUjmFJs;N6BU*YyOOI&jQ7t{{jDV)bam^jq+zHK{ z(A-JQoz&bZ&7IQR8O@#1+&Rsi)7%BkUC`V`&0W;o-(aZg#dMvmb9+QMHpNxJ1P#>t6`Q_0%;`*GOGsb@!`#KwTGgUDb6{*F#-T zb&sm+t?mhRPpa$ZIC=H^>Dm~tr4!XnQa4%M6m`?o%}_T>-E4Jp)Xh~l&v7z>c{+j> zTDnr*YISSWty8yN-9~kr)NN6>Rb7F)?do=@`%2wTb-UE({OV%V#i>hh zoV=XUE{(_ndYA&R?kdt%X)8!(cdMR3(qNOQXnyRI#+F!cn(lwW-AmP?w`FPhDkoRn=8jm#?m-y4vdMsH>;0 zfx1TO8mntsF7o+2x!f)8r}7kav(?Q}H(%WXbqm#{l#jf=?bVG^H%r|Xb?3^<6*<{9 z&Xtecv-w+de{1ev&Hbx6t3sr$RUy*Wt2wXcQZ<*Vxpd8?Yc5-J*_tb^x#F73(Oiz^ z@-&yHxyqWWthuHYB5SCNx~}Sas~ea>K3S5tZu2g73$Wg+o*1< zx*h6vsry0Q0d+^zoltj1-9>em)OjjK)`nkQg1QuSnd-9Dl~z|l-4JzSDn_=AF%=`* z#%wKJpl*q}rRr9z+oEo#x*yc-ttj_;W!v4Wxqa%2=R}q*M_svn`U~dD+$0ywjofocadM=LRBe%(8@X4Ws%_J?G+j&6b0hc4*X2gmStGV02ytFA6z-S!%hp4aC`+@}1<>#;Roww#vEGBqL? zp)7Z6r)Fj6yB#%+ePn7HKf^l4McBZ&3>zE#t6!t3k>D^~nu%|0G=YPh`h$$o_-PKe z8vF1C4!0U|ox6dNWA zuZ6iL9UG+_R&u!2_?moy!&{xqUdJbRBwxkJG<7nCJ%2hig*6RfV?dtBc8|U+c@R%edW9PV}4%ld)*W!uZIAzZfOU{|v^?B;NYxd*?M|Axu; zbNS!qd}H5XSM$7+7xF(G;UFWx_iY;+Mc_iSA{=B0n;KOdwshDT?lybx;@L4%{U5R;)?prCH^7ADG;jj2X7&SD+xv{_&qBdz<%j&pp5A zd4A9Dd4KQw-Zi=3D|UhF%#Xk@o-B#)^C){9teeNdqwgN$ zHaj)smfX@@$_=1f+%u8#lQw3)&_N!_Va@9e?cEN_9$c?UOU}+&7s=a~>Er zO<Vo%<;}uYQ|71BFVxny}e0h4pzD%+G&Kr2h8FHj5u zp*UZP=M?QL@dJ6C5mzhVs z%xaf>{~)HNKmIMYx-?#YG37bMj6bKCGiq^hd?v4@^xY)=&xA#YGN=c@YeKi;hA54hqQ4W+a=UFA}cb4>vOL&YLOS-Y@%8Jq-e-HK4 zDjyG*Do^|`7@0^jAkB_a=Jtj(hom_vd4Cr5c3labKKeQ(`+dz=d&TeD1Rk`rmsvi> zob980i{utrhSk@7@*UJs8`Ql0m5)d8d0CFi@-MP!RFC=M1YNzIe)fC4pP5V(y<)L= zvuyCG8?9-JF{{VE3$Q*Th76mjxA0!`9^|#t=Rn?)8v~E&UL4W=blC9z7_kmQKVry; zH3~lEV`P^y|5R7+qJ;z(zgSsQQb?u|x6?Xj4Q zFO;v}*?7tAvJX~NS#U!W8*l?RcVpj-c$=Sanx)Nk%`GE24|P11AAao4bMMqXurQCK zZu@>~d-VR+j?P4DSG;d^JkgoxOGH~6`w~5UiPojjSTqukwk`=TtGT&#N%LicadN1q zeKjIoz2RwIP~juNLszz7%(g&bUn(6@A}{qSMLeP30V7-XD?nus6!Ze`ry%x6%5vlWkL() z&e-eF(uJ{!`td-0)mQDwq8$UGaz;_`?x&x>{9J67|*=Uc1#HX%+o#?Xh_CdQ5S zKlx*oIMww^zpJZzb!}_qa~tX(M{a8|Q(~x$4>SA9qjI$$hVjj9{Z5QHvwGS$7xe#; I{#PpSZ)s*e^Z)<= diff --git a/Tools/NUnit/lib/NSubstitute.xml b/Tools/NUnit/lib/NSubstitute.xml deleted file mode 100644 index 4bd55c1c2d..0000000000 --- a/Tools/NUnit/lib/NSubstitute.xml +++ /dev/null @@ -1,259 +0,0 @@ - - - - NSubstitute - - - -

- Argument matchers used for specifying calls to substitutes. - - - - - Match any argument value compatible with type . - - - - - - - Match argument that is equal to . - - - - - - - - Match argument that satisfies . - If the throws an exception for an argument it will be treated as non-matching. - - - - - - - - Invoke any argument as soon as a matching call is made to the substitute. - - - - - - Invoke any argument with specified argument as soon as a matching call is made to the substitute. - - - - - - - - Invoke any argument with specified arguments as soon as a matching call is made to the substitute. - - - - - - - - - - Invoke any argument with specified arguments as soon as a matching call is made to the substitute. - - - - - - - - - - - - Invoke any argument with specified arguments as soon as a matching call is made to the substitute. - - - - - - - - - - - - - - Invoke any argument with specified arguments as soon as a matching call is made to the substitute. - - - Arguments to pass to delegate. - - - - - Capture any argument compatible with type and use it to call the function - as soon as a matching call is made to the substitute. - - - - - - - - Provides a specification for arguments for use with . - Can additionally implement to give descriptions when arguments do not match. - - - - - Checks whether the satisfies the condition of the matcher. - If this throws an exception the argument will be treated as non-matching. - - - - - - - Describes how the does not match the condition specified by this class, or - if a detailed description can not be provided for the argument. - - - Description of the non-match, or if no description can be provided. - - - - Combines two enumerables into a new enumerable using the given selector. - - - - - - - - - - This implementation was sanity-checked against the - Edulinq implementation and - Eric Lippert's implementation. - - - - - Checks if the instance can be used when a is expected. - - - - - - - - Join the using . - - - - - - - - Delegates to ThreadLocal<T>, but wraps Value property access in try/catch to swallow ObjectDisposedExceptions. - These can occur if the Value property is accessed from the finalizer thread. Because we can't detect this, we'll - just swallow the exception (the finalizer thread won't be using any of the values from thread local storage anyway). - - - - - - Provides a specification for arguments for use with . - Can additionally implement to give descriptions when arguments do not match. - - Matches arguments of type or compatible type. - - - - Checks whether the satisfies the condition of the matcher. - If this throws an exception the argument will be treated as non-matching. - - - - - - - Raise an event for an EventHandler<TEventArgs> event with the provided and . - - - - - Raise an event for an EventHandler<TEventArgs> event with the substitute as the sender and the provided . - - - - - Raise an event for an EventHandler<EventArgsT> event with the substitute as the sender - and with a default instance of . - - - - - Raise an event for an EventHandler or EventHandler<EventArgs> event with the substitute - as the sender and with empty EventArgs. - - - - - Raise an event of type with the provided arguments. If no arguments are provided - NSubstitute will try and provide reasonble defaults. - - - - - Create a substitute for one or more types. For example: Substitute.For<ISomeType>() - - - - - Substitute for an interface or class. - Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members - can be recorded or have return values specified. - - The type of interface or class to substitute. - Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. - A substitute for the interface or class. - - - - Substitute for multiple interfaces or a class that implements an interface. At most one class can be specified. - Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members - can be recorded or have return values specified. - - The type of interface or class to substitute. - An additional interface or class (maximum of one class) the substitute should implement. - Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. - A substitute of type T1, that also implements T2. - - - - Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. - If additional interfaces are required use the overload. - Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members - can be recorded or have return values specified. - - The type of interface or class to substitute. - An additional interface or class (maximum of one class) the substitute should implement. - An additional interface or class (maximum of one class) the substitute should implement. - Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. - A substitute of type T1, that also implements T2 and T3. - - - - Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified. - Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members - can be recorded or have return values specified. - - The types of interfaces or a type of class and multiple interfaces the substitute should implement. - Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors. - A substitute implementing the specified types. - - - diff --git a/Tools/NUnit/lib/Rhino.Mocks.dll b/Tools/NUnit/lib/Rhino.Mocks.dll deleted file mode 100644 index 3fc4b2ae43749290088c7502237fcfd2bc436cb5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 315904 zcmd44d7Pb9k^leXdG3Ag?c3c+Ivu(L0TQj1bkmYE zzIxC@9{+^i+AF&GW!+1jy!J7dJmo3*m1`gU*tOlQPg(nfr>wp2gU?<2(nSZV@VP{{cbm$UetC+wDh3SCG9Bs0#xy%f8C$+yjD+5{@>!yvD2+o(Qp5@ zkWczMp4t>&BrmuBs^9P$zz+rQ8TQU=(qMndMz2gK2N(6fc#ZS?|+JWp<15*&p;@&+V zG#eGQE27=|&=9NB(HRwOtp^6O1izGb9w(w6r8*tUPiy)6k`KG!TNG8m6-TRqg?3<* zYgAn}uChHis1O(R?guQi0qda1Y#4NaMo>W`SSwTm`O7T-Ltq)^A&JDpg#OFmv=d*` zg0`IIsi6wE8qwW>ofPaG@@TBwy<}?ll1{prBGJ_73^|^WBa_b5?zj}F_&Pf30oU24 zl87*RT$E95>Lub{w;iQ9`q+uc9Ll@0o_F~`xun;tWv<>h8ogA+7(a%-hs-;jKv#$7 z(V3HhSg}Mc))|Xd#Qi@mi5k-@1<&of{)f-3PGg6;L_D(AxL$t0k z)PYvf@F&p#G&EEs>{^5bc&d|7(y-w)r(tsAGLy`~6%BDtGj=-Zbx*jKR*XljrL93p z+TEbR$J(1SG0;UmSCDuOq%5hx>@`~nlHNZ2xvI($g1C<0j3svk!PNN7PSux=Y|m*} z6iXzSTn+a~K255(qGj<4bqB@K6(ddzLJY)2Gur|t)V`C`&-R24J)kB>_je1Uy9elo zsc-_l*!_})s2G_(Z+yh$3I0R=`q#g%FKkX6tp(%Z^ZS^Y&8i1Q>(!?Yj5EwiXZ_^H zSffaEHiGHGOJIx409Jr`$)Uiy{H(mxwB{?;8;=WMj2kBl?%uV zMUcEOK9U#K#^f~`y$YH(FDS2Ba^k+ql`Id)OQ`aL2IOUx^p%0UphNQ71Zz<{KZG|o zjg{rs*w#)~=7*Ap>_pTaWp|Rv4$6_8DhaYvxw{}cNS!acQdp>^IcnCKVJMEeM^SaBJHy{JgC7PlQq5H{y?R=~bJ9Is zMDC1{5PjPGGTxou9l+in7{0xDzLEE-Yw=>1WM?Pz z5t;3(feJf>l0*+SJV_Iwm>>$Dtlk!keW5Md5$zD2Z8DDgN>4H@OIqnKjf%{blVip@ z(?-Ntdn(z{&W|SHM(n_nc|46q_o3WFg;zZbbjVO<2;`lq{8;|xv~H(icF6<`3_gx| zOZGcmA$9(e2-^{zXS6y&Qi6iZVSR(Fz~fZZrtL0JxnwIt57a=?XlwItR9(6iSuWWm zV;J{U$lh1(P8h1Z&4E;#r&kIvr>(G~0<7K*o0-b7nKueFzb8=ic7fURB%Pk-=u9>z z8vc;Z90O!Dl5ZlJME&F#sSeczROed$P_byDxk>pGsau-S)`pKwG&f_|Nh)Zbs*p%0 zrpIOiN?xM2jgPB0jzv3od$i=zJAsNjX?GO0$?wJUx~b714kLeT2F=C5iOBJ&MKzO+ ziN*bB z4nCQJLVVG$-A6n)y6@v6AsetQ=!Lbl{KhAece!|iex)1zof!-x%_90oqoiemc3(t- znI7LIQv-lV9&2y-_AbUqRKo~{0|>?&F>)IPx%gfx6O9!9>(c1BQzDhae|6bjQJ3w> zC37a*lD7ZHWxG#Jw$F#RXNV{7N8U;3x0i|OD7jLd%j7*egB6TgChsvCLP*+$(1UG3 z=(2l2N$8z)!%h==t1k3l6X+hOv8E18I!dWmIXd ztn@-Q5d#qHMKeN8qHWISDrzb0g|%(m7i4O7z+7l^goZj8<=tjAjGpHiJw2mGrF|er zsfXx!bTL*jJ|Ro_GSqKmF;2Im$Ab3-P8V)PN!J5NM#w5LbrSf)v(sqvlG2cgg}5)I zj4UdU<8O2V3vPbLOhj#{3p_NFT^)edMN^Ya(>jDA3Q#mmb~@Rd zku1nGSzx2QkIRc(cX8Cg8C|0GI2NGmt!=-dw!K>Q?4D9ZX1+`uj(EQ7CjIEfJ%-=T zEchC=rl)Pa%?ms7YSmHL=zpWCnvGW39G*M>589E{8&^crOQMJ|ah}ciZ)7K36tlr* zyqSc;W=xIO?Fq4h!^jN7 zGwlT(l4Co+A0}Bb!*Wr)ZV%rrxbD7I znSi}AEKaR5!Pog;3mp6(6sp7?I{)wWI+g8pZu0gNV2%HBX6|%2|L?ELI{$|lNh-Q1 z|K)swSiS&6)T87DBPN#qj8cAZ6wIVEJOZ4N{+fyR++|NZ+#5= zu*vA|Mv!oKPvmiMiZ!o24lQX&EgpGOjRs9@yz;m&xcm%A*hhiL7CD3{MWgf)xfkQ; z$Bl-QjRuvuD>TqgOF2kCKUt%J0jH!vaQTDgi=kfs%~t=zt$xAZmHO$U1NDD;k@^Lf zpSkDyKWp_9;iFRs{;t$dmkIU9#C4bhzU`gg?sz$^>CgV!(Nx`P8^*>{a$z(DST?E!!ofhTi(AI%x z0pv{Z^sMv{Ja`Bx`9m$)X8xo<5$QAIw89S~XI;H;r7+I>5({46=JnD28f9a8{%C~C zN4HxWnQs+l;G=2Fra1I+TBQ3IgplSUre%LEo-r$Y_}|uONh5y}gt<4)6e#HHKGCBX z@9z};#%3g87O-qs6hPSX79A>Ma+D@D#G^BZQM8I^-b274cn}KSS{7^!6#R`qXMU)^ z$)M()WN8hXdeFqsDFRMumjqZR@~)IU9Dbe2(V5o?a^@xc8Jg>$zM$~APQzwAS*{kU zq8E=6#0**!nmNhO12F(6D#KeZ@wF1-oB5LmORp6S$xj(fmMrNNgZ5!HYZPB5`DY8X z=bDxI`BY1Aa(oK+=^DUBCK}t#cgpFIok={F>z+W@;=jq(L~HY-Rf8)Ulk!RvakfJI za)zpG3;5pG;2YW7_E4bkfeu7A z_jCMj-vjs_WqZ2HFCbg|;nm2yTvukH9=N23i&E|&aXJz*qUcP|Z}isI07!QjUzFz%E9LpUB{Fe?|O<6(|tEukshfA@BJ~g6UmaM^V}x)$tVNuUwqYE2{hj>ktmMpomT;iu37QMgEn_ z-#Lu|u$9gMz&gKAb38bQgEmHEn(BFm=bx}pJ<7kz^9e7^r$hNyd;W2Y<KPTirrp7>>zvnsr`_+mM^vxH9^28rX2E4rY?-zM~qldd&0>D?D zh8G7M2h~98IIbyh99#n!!f~C!tn4jD$IBeY%EjnV|9(Xc$AIFLb$S23zK&}Mur9k- z8(i=4b*k(6ul0N!u1YfX{Oz94JZ0hhH+cTT7R!I5=QE8SEI&N{$!5J-uu1klV12M% zSq_QWY={jj<8nI`&}+SUP7Cv*x`E6tgc%hGPwSx z`7w|EK!m{Tn4Mu8tkVXcH=PY_GFsv7GN!e%=nGX{n=F#l7i0SlhyO-r zsHUj-bGZC-YURfQo>Bju6);U^b487dI~@nzW{`&aR5)gp z>1ERBMU=V4%SiteHtg)o7>8_lKjEP!2o>0Tx;?7C&EC3VVKar0)V=h0H+!^ZIYHB) z*qUg+6DG>%)wNx~m9V8U>{iFn!*v zG{N~^9X*vwZ&jHv$IlxGlyIgkk*-;*SWahM+WiMQwy&C|L1EysV=46wEZr{`aB)Ud zF;#S~Lkz&N*gU@q1>3ms=s5152t7$g#IAECBlzlBy^FpoFQ1n;xpBGTcF`{5cWPFW zkF!5eCjw<65OrCiz9Keuy8p_ft^N2EFm7ZmQ=7h8(ajgWh5EvXxDOQd-oi_M1yvL6 znCUCOFAeYlYAt`iD$agEz4SpJGw@^-p87>on(oZiP$l`#$nfxd68EL}`Oo(ZDty{d z;5yNWFelNEjPE2*pwX+9*2~c0DmE}3W*k=9Td7n4IF43ym7w_-Pnl)p$0Rt1quAIy zMaIhA={UH1C`f0UQo+mC5ItD~74ey*`|#0XUtp5|7*4uuwXHS^%38;sF{_@%!Uy!* z8jsVmpV>7b2W%IDoSyD=skHYo%vSbS5-jH{JeZjP>N|RN%aMOx&%#Lh7xipLHOarJ zXLUl-zout39nU||vpNmW-_^5pfahEFtRai%AM082@V(H5UHXa1+&cOEekgG3hpFvH z{F%XK{|TnjnUKmPqci*R(|rjtiY?oN_+#zDk``^$iQW$2ue?qXR^n-rZn5>L(W$Yx zZ}w^uiH%1ilMU^b@I!d++aFGgdqX znpbaZ*t*UiL^DLG2bID$zviOxq6pchFa~5hI7fFOd(IxU^DC+UswnnO$8IY-?;}2= zwb81XXoSZlakM1ba4*pO8XG1EnfM+=qjo1{_IF|&i^|M}wCc*{2~BfFvi-HIKS z*fWlfbmOHgYPI6*=cu%k8g|s4qaC%hQaA`vtbvb4&!PBk@s`*ITy3xD6kO_gwEG-z zj)Q!7-Xol)5>t{k>5$ zhNhadYls7-YJ*}|?OIB7e*>Yl5+)N{B5-1zXYIf;zu%3Px`g@tG&wd*YrMXW+*1AX z){#fdZj2}o+q+V>S38&k+YGxuL-4gt%%gEDOM$8e)WWu7^`dd%Nw(60vF*R3RjW;{ z(*QWWG#6G|-y6o$wEe;pCM&BuzeMe4!$7eQ#@D_l1=D@lvf;JwGvlOL81Tj{&XTR^ z`u_EO3~yhFN%jr2us{rH&c~?9V_I;?gIN1Q@`$rlWZ0(e#pK~W%*#MZkx z>L+bcTii*&|@M+y=2i$lAW+-D?!Jr1*=TTQ=W(9PrR{zj|z zb^AWK@d)iHi#7;H*mD?~9G9!(>%#Zqsrww-)S4k=KSbHe!QFmAk=K23@#N&VAsxg7 ze1*%1cBm3z_dNxYb+IqDnc*lMj>2x>cSjuel5N}q>yAaHa3|Kf7*z_D{17;UJMG|^ zO~p(m%uO^mJ_me93tzI89`wKLSE3+wI`G!QxIWyk!a9!8oc%YJY@ly%uiCoN{SW93 zr&k)YC!12R{$)z>>QZ0!2nJ6L?TwFSjHm9{@&aRW-4kq=th^!ZQnEhFhT9+@{BKR9 z5v%HLZBJU;ZL1-W8t|sZ{4AL~s}`uNkKMu!9+j#5ejgw1WxVcAGiYC6eDEsvXb;n< z3*Ie;#|VOWw@Dh4>l|ED=YWx<;-KuZQzUken~1JxRZHit73L`7W{Bm$)6FP{>zc<& zPpN2Nh+kQ6z5wU8`Banl)?@$II;6T&qhJrV*>&gvM$3F1Dt!M3I<5BstOO3ivNqWNzP$B6u~~&_|E$@%jSJ}-+5%w4U@q$RT|Hu?)PYh z#P=JmqDb#*{#?Zgz}}fM__Mr~J-%oMk9nSB^pOGg#s}!r*7krN%!gnQ-FE{*>uf9^0DSnGM z&!tv2I|X45&|1I|7oUaQ&=);EL=TG|=XFXprV>SA@0TwB$2-hv!*VcPSE}?k@KXG0 z%zYlr(MKDz4*-Upji>V?0T=SU-0>>8s5bQTmUcTuPqO?Z+0^C*L+HL#BY!@48@(6s zw=5RQEsqFSMNd(=Wb54}y)fGjzV6DgnV*6y&CW$m?gC5jQJiKh=%&|bTx0IS!&k`EyD@kN}vy5c&!jf<{#O&=LgF=%7EKK^)F{X$`k+$K%{~ zAVsz|PJ1U&ev$yO#EF;neMO1*J)LBJw(yf?XYscfDZCBa5p%-mN|Qy%QjX^El*qKLp(AdDB>!JsEi zozaZ0uF-PXg0xtGVNbLy#O^>H+iG>3`2TwyX>=icJkQ(qC2G;_LmH1WfxE=nJ6a>S z&h!P19-P2bTAbe#m66jSe>yfJklG32LXFBksUGkm<7eemV!bdK=!JEg@nVDPKXABj zZ`O?E!PGdbto7x%$9dY-&<_R4>>1>^ooMTRg6JCK&try3emiQPDaJtPK#<)BBi1y( zMx~4P^>Wwkx!iN-mm7&P>U-Iq%Y8)U8u_(WVV&n!IM0OB2JIQK_NiGEPJ@s#*HcGf z1F!cogdqmY=uF8YfqS**tF-r4#c`wV7olOa75we&@yN3ru1A&s+kFaKANL=mn&bYN z`Z3Vnb&y`Ru8%9lII`X9(*-TnqN8|}Y)?ajvL{Ge;%VatMh?c(J%c1nMsz!Dijkrz zlkTpm!X<8We_1{=A{b4{tZ0hXYv1i>DE|i4jS4>9s&KlE?Ac3%)e^Q{%wxvHs~+WM zX|+$8(a4W1*)<2xv;;4df0P%OK%`(a*eaGSXbL!O=Whh@+0&EhuD2^;V7oDM|4)hrP-#PUt}|RBK}QFJ z0d5rs!`Od2bEz<(9#4lo{rgF0q-?f>y~~N#UAr-z)sn8 zYr)z5E8WMtZ~i$lhu5%-U+B?18~-SJzwplCn<&DnZe|KnXaz$6rW34(OtY0iC(dg? zbLRkFtoh7AdGA%A*``#JuH|PIevyw;CnQIA;q~+G8&-e$FFEB3x|u2bofD5D;2z!C>0A zV`pMmm)LIip4b%^wqtcismXRZ4#)n#kc1{?F-~<+lsVTZl6p{Cr;Ar*_IIYa_k=+jBWdpa6tzy z;0Uj2YrBlnc2I9JH_aaFo|HJNA_{nD-SeOchvNw~wgX0>E&gnXU{V)KB9hwSlP}$=#g&y%R^&;h0yK8qZEsfCZ z=-Vd$!O@#;71=sR=<6~BKK@wF8nWGf`k3a{;6ok_J@GT$LTb`2T%+p&3q?f8kycsB!ty%+^S5cT!GI5gZQbxezo{+RJ#}|lv>1l#h%8Xv`xND`TJQIPoESa) zdcUu2u#J6O`?d2Z!d-$3j%!P7u>BXoc0UcJHX4*lr?$}EHw~mP!y4FVbQur-I@B&@ zv;68Vw*8?X33}1J&ng6Tv}&k(YNbNBJ~&VRK98qulq<=#KB9J(o_DC>4+cM&KZiSv zb!qT(p8uS$pD>|`*59(neDui*H@t9jR)wiiV|mMTmW_$hSwXoP$mB%Hya~~$O@&%E zAZuek^adO4c>d&gMB`rYXlk@Do=w#J7sn$y9giky3(}*hQp*n)76bw5@*lPP9=Mp4 zv2q?Oo!EGB(>vOlN_VufH>g45><0Y=z7oTc7>-7EqZB{xUjSWhD<(ykC#3n?B@l}S zq}ku<*>GIWT&DMTyjo`n%c)kA+T3YO7o|~h+8d3`N}yt7Q5=%dD!T~8`J8Sn#A^`~ ztB)&<>&TXjq zS5T(+4mCg;&%RUQO?Rj7;bH(fg*>wJEnGCO)6c#{8)Gw@B{2 zN5$Lq;^nxddRM9Zdx25;_wlQO@8`Go0To=J-iGa+T`eAW(lWkZzq$wo1urf_iL-a1 zYc~q07y?4wjc5yXA80r>7X?<8m#LgkBypw7&U;la0ijA12n$8^p^Gf=t>j6ZS+%CLNPWUvG4GED_#; z21qtV@Uvvr!1{t3&Q6rA40PqT0f`Qc5lN(B3I`e`rnc7|I-D zWlk;1RI)s+NZP>`4nrZJg7pDe9&b4AR}`pZdH*6w`t^Y7B_LFZ0%0Lb>DMO7lC#9t z*G9#DGCQUp?s()!J?HiTX%t8(Ti{WjyO;2MB+koG9D3{qXZDfi{|GD_QmL1FRb)U= z7I`ya{FIu?+Qj294UJK0L?4eHA{an^2Z%cl`;rAgvb_v~oybAzG*5?UDc!yb*C;A}i=v0o-E(T+@V8f&|&5<{Ld$ zFuEboh0Q?9x}@yi@?=ox+zfk1O~ge#qUZ60^n77HJ*i!`bh*PJj#~k-rVLo;()nH>Ua+Ed+$M#5EYy2;Juauk$IXWyWZ;`u8h;@Hu1R9BcHw0MuRA1I&M zAG_7<_cr@A+)4f=G3XT$f`2qw`Il80p)`y6DqfzyoD^TGYFp@gJc>seUN7+`Y>uYB zKd~sZ)+R#~x?N0v!#ww)(Yn6JgpY=tHOsPZiV*R#dgH#)zw!G*Z#Sp3F@4c=(Sz`= z`R8^yspjvaGiq%%9q$lO)M$S?ULUQ4RACpo3 zn8igiZdP-|L_-uIo@g|jH}>rY;r!TyGg1j>q!bPuc+7l5bmaLS2Z*B&McHjGtJUmJ zR=Z+9r28(Lf2mPs$qyP^)jio8&b#l?JgLp0K z7?8pxl@xAcE=OD_j*f~BJJ)H|*BdTP2EoPcoD?SvuzE#U+%R|g9iM>_N^2#F%y~J-jr0`KG5&ycHf|~Njwm-al7F8 zZw&dLf|A1G)$`vR@;^N zE917$jKxY@^;5g4%<7HP(E&@M=!B@4nc{uakCFGuX*SFpsgDL^E>1 z!r^c8F$IemV##(sf>v>Zid)UiB=OvZeE7g!wMPCMh--}O)P%x;z5&pc>mVrZ%bQ!; zn7;N7FnHjan05YEoIb7v+I0^o=e$MtkI*)e_HGe%M5((M?#H|D8MV8x!gKGN0w9=u zr3fNE-9{O1kX|GcZMVYQP9rPKr7k0GhS|LPElN=+T=%2fe!LGytR6q;ozZfbMQS{M zEINoT!n)U#ov-axM{< z$N0!pi|aw(AYn9;iH33IY%~KKFcR2kRF}QDek_j=SM)K_xN~_S`bPF$h^UQ@FGrGL z3ET%X0w@GejC?k!S#ytyj8l7)*dDQv8D@8|Ci^EZ2(I>2i_`&ENC`%&BVGDS|ec>qhA-8KBR zo#n12wIzYj21!ISM&B?zTcv1)MeUHxDD(paPI6q^cutUET$!N zY%>XNk=b)5_;#@_)3mwSx1Cp;Ti!-3)5TF-MKFBsr^9b{7F~TpaW?@cJ{Me%zlGcK zb83;lHEMSSez%feemi9$$a_l@oHOT%3YTvFLvnj}@W-yY^?MVGt77AJ5?qF2VIO~L zKg#-5(&Gzz4!(YHT(s^&TLQOxhp(p)U#%$GbOD;S0BIS77 z7J_zWae#6s!iLZ9mEeNjQ=U=KyGnOwL_ZR}a~C7&xR4$WO|){GB^enez5GY>1iXdf zy&sdTyWZ9Rhr~QK!*l{Cl?Wq8^BiQvSz^GfShCiVF~GGAp3*Kkm-us9@3~XW_7ncB z3-`fQe(ziD2Hk;+;c-(WqUu`sR{m4U4ywirfbjIv&6SR~rgR#}qBE&4Vlkez@}HB& z{b~CMZ7ctU-rB5yV(Wg%^ExH|iU<7gJ9ZstKz?H|7S)~3L4r7WcsIa{btq%}MbWa? zMAJA-#AeQmF8fEnzc-E!TeAMaON0}f;W3_HyM7_S;WhBs?(_YZvOTHWdxN|S+%fvK zH?+APh0EpRPa4rk(eJG6Mb_(nZ5(Z$BsrS1q~6~!w&lMey-3Obg_i;maE_~Gxc=Sf z^fBV)@}W{wk=X1UX2Tj?*o*Wpfh)-$XC1u6n&5vBD)aZ;N^NWD_j5o1h!Ho_La8&K{^z*KNHX3L_cbj6{pl(|M68pLf z+j(gXCYkKfw7=zz!j;^_%U=x7`HS;XX4S(EHs!xjSp_c(f(`KE(1X0Vya|okdCd72LT|?}aNJbiv^p4v(K#G|=Y-ulEJvQ-^wO-)T!yyO z+t6pjN`gsueQZW+dG0t)G&#`V5w;tZP#~?t^UXbEu=C;?yrM8SDq$h`r4D~d4PLR2 z8yu9)$#Eq%M?6ThXDn>hceK!{kcmL^UxvC}#?)%O;>CTnWu$7qLu%iBI#Tt<*E~`BtLPT11sWDcTb`EWAtL3nNTZE#b9XQE zqy@?-E&mI62%ty+t<;xB%5`$--Z5VO$;0JMRHdGcN7n&+yu&^P*mB_1h-sSHeT}sI zvG96Te2qYih0&I=FxK`oBWFCkOgTSEod20p>$ErS2u+#u|IzD+_YdU8^#q1+Dz{ML zM57*PbXj;CoCtlrzfictBGztxtquOlLyrk>M_)M{XamW8E%>(>UrEM{$tDO+J1*4a&Ehr*7e5t?QvrWAziiu*Q94m%Pa(Yp7>goa4ZctmIWNkg=4~TG_tawWIj)p zG=OBedgIdQS>Qf<4{|(-{Ke(CmfY@lQScyu&mn;BA7p@Vo`Rc7@gUicEGk*%dqH03 zUOp(Vhl$t8z$*v)O*gvsTa7Z;tjv^!~GK4g%i?v4ZL;Yhr5RV&SyeH@YIY|l?^llF}&J)Vr@`>Wp8 zh&CJ@!LMP})ePRX*O0qTYwy@3jg7=h8u?lkL44ZZ7Yh6Yyt=?4KZrb(kpDu7?uBa# zDu~A92a`XUa?iGJR)4d~wR(34lfq>aE$yuBn;RfQ;u=;tnx2SZ6G%IbgV!cR1-&T)2!j@{fRu+aurG{$y+G`tXwG7I`mq zqG^-g+~5*@nBa(z6*kYWG_+CB6|o6SyW!F0+o^t37M<8456}Jf9LdkDnwv6trWp?0x4j%UKuOdBO4a zh*UffF%B#Vj5>@IYxJU?(6MlM_62Aq=Go4;PNG^}@cNgUe4gv_c{+d{3;GhoC`EFX z;nuz0L~{Mgf>5#D?QMQ-tIQG!9#D>K-A7T2#A*(yHHoPFhPQFOm?+HY%5-p(k4|tD z@?p*py+ri&nDn#5FFQ&F>asg&)iD&IIl@7n&$|o6y=7{`wD%R1! zAv>@d*o%R^!RyMY;INJsi$z*ruf8;OCBq2(dtbwxucD0B4DYU{3xGuToICrzL8_Rk zK1$arzJlT7=d$ReGyU`Ny5sGGpxI${U;Sh%%UG_~o==?6#&rI8+MRhE{as2#5p2ymD2N9nMKxT9hzM|e;$Gt58&q{cq zm9_UYwln7MHeN0MT$}sgSa7)}jCQZ!kFN`)N$*&MTWXc-a-}zo*(+2*GK;-)y;;pS z*Ukmg`@Jod9`^;5zZOJADEwF;82C3Lp(MMfX$^pBq(-mes;lgHWfs?7X-p8A zMB$d55bc8!vi6kPJn$b>-_AqSHX2yF&w+Z`8GQa{C@BXyk~AMf5oJ$^4m_*(Z$D$*>(J7n)ZYBFp3 zFB>A--2#4?30D9+EV7v~0Xvv(w`f+Grxg3pue%2&P0ti6yRT~!6Pa#ze@K$C5;86} z%JAuq=Kid#BPO(Fs{8aq`6A#%ds;eY=goOp)qSa_?mN-qb-(WG{B?Cn1*zEUTf+y7*3;Cq$%W*~b<*sGjo z$En$AuFzgy@n;Nn(1-XK=R@yDc4^9%HfHay_vY*a^pnh@ zfWwy&UDrpC34X=klk7pDEV!)ae{C=MJNJ@*%U<%owU_+w>?Qwud&&R)Uh;3-OaAS9 z$-iR{`C9DwvE^HoK)mNVN=pJ?F%;Gf^mv-{eNF7=-SBwX)fRrMdcs zvip~EJs57S*SO~2LiPD8)f3~sdQmv?tUlwLki0MKmw!uiMs`#RQ04C%(r`G1*6+-k z=XTvI{x7DvCeM@Z7Pa| zF%L?!4oB^^g;0{yvLfES&mFX8yWXaCGP#yRUyfc-B%Y`YN4#BJDJYROD?Q8hU|1FMD5YZ|@!_ofEUQpE^LGlRMN5jliDwbDRe#bw ziJHPKU%{4qf1!Rlq3`3eaZ)r_I*wvfp3=usxfuU?iF7;pS~e+)`%Kk7i8>2f!#;T14s{a zKY&LMYEiDk89+RxN%n5O7P==)eii?IkyLk(|B$#K|Hb^h#(!c)gNfS>R9ED`3L;!S ziQPNX6*fogt(_r;j=Sq&;C4DE?HgwMIGvJ1P!9V_X=l_v1+4kJ*~$@{fDF@1_jT#W z3G`r#9J6+7B=~#x2kknauG;0Hg4^(cnu-|7X?vmlVfn+&MzA-ln$Z?IIua>}aKKP| z=I2qu4g6tJoi8JrdR^Aos}CP+Gyq*5%c9ruyvA|L&9d7dyu97}iQDAdBKi!_sQXB8 zg$m3MwF-21plL;UzewGB4h=b8nvIS&@+9ug_2s_>yiZUJj`NQqsM2TOGk9>t|Eg8h z9nXpd)Q9`PpO-nbDpNmHzi1gb>+5P|EZV=U0?FTyVca1oOt~ARdm%4zOCPlor15u9L?E^#IHlIuCmUq(X|69dQJi9SvaR)O+%t}GlQEBla5 zFGpuyBV5BV#pjS1;6pfXpV1kn{ecv={@#gJjJFN3c2t$72=F#=Yj%4)dhmiRqLu2o zp+JRMK2qCw7_q;d^}f8z!K&Rn3pe1!1XdX+A4JPI5Nfdu-;qc`z< zmY2V}UVp8;(zyxeB2~{XB|6*&uhf>&gu0BYwvc31_)B|!emf8Ovy|Vozm?NtD;#9` z2(6G`OjXt$7-oU6yN_sl#Ry-_>q8fyH*}gO3EV5U?{<#O$WZ&)YKJnQ4^JdvM%Y4plI*7H$vgaaqKtSqX7UAD2bn<(EL5`hwkh zU9Zlr0Q6h=+*la?z`>g-$bB)?;(kj#?|GI-r|gWmH!@DVSwX|%JPK4@42bwgAK~Dr=8&jbT~zX==H|+e6J*>aXjM#UGVE z?B=;RE)|W~3N<>xThjw;d<&1+H?Zh4FE~n_C5QMRdjy(XBDVa@rg0 zS)M+BJM%T8#VZ`~C~>uoHuQ5qrPM-f15n5B#oyCoE8(B+iDyX_f1%#t;IxN<%|9j<&5$KS?-TYcx5MS>tvP z`^0gpy&cWxo2}4hPN~KMPFwA|AHTi^v1vk&BX+%iZQK}uMuSi)KF`pu+}5|P40|c? z?TfV)w~IaJN%nWZ?yZyURVp$l_FHas*ykeGGW1{dhTN^g*?I&W&5AQ>(!1!HaiYs19#*l_qe~Uj@ym2C0P~urC=?AR7E3y ztdhz$UmCp=G;>~uTGsb2uF^+$OGTFh;q9*NnnEZ`?vVQ}0I6KGLlBBTsGPK$Eq`-e&}4yb#=mrBezv(E*w zq1ZpT%q?EK8(h?N`-p8AF1)p(e|DmKQuu}9*E_n$5txXm;Znco_k7s_ZX{u?MQ05y zCoDr1dgXXtT;VB$4h!I6`DS4})w)YE%Wxp~<@x-W&rGa6f*&5>&n*0@OjLy^bMsx48*w!JQ{2r=TD}N97 zP-zWmKXAUz@MN=^TiJbrz52;D*NMewc)ioW^=88~IPM$f;jW*0bKDEvVe}>|SKTf3 ze|3k^*O2&Kyu*kSXPR3*ly(UBGR>F8AiXQ18Gju^COt=H5!FqkPRTmF7-|uXC$2@-Lw-5cVoIViSQ~$e;pV0rZh;`%W zU5-cTdH3WP2v5qCzxj5K46H(glEHcYl?dd7H;h_fYAaUPo zxLq~emwx6~=gfQ@m?G~^<#B&(aCZkPd*v|Pt4g@zt(rO#zaQ5wrYk-pX6zdc`Cru` zed7XmE{UM*t719s3n&QTy8z)UiKH>EN3)z(J0SiJnc?c6&?YV06Z>A1Ws-fZq>Y$j z#h--P$X}znio2V}IMc-1v&scg4ti&{t)`wc6wxfrN1$WOe5((FZ@+69i7#lE#27O?OniTM1t$;mrXas>BBFvb_Zb_uKk{SB_mv75i{Zl7ihUV2Q>k*w8RW4dVmnRr zNyBSlh7hDE{T9(eK!FXLQM}0_B2K1{=hcMbSHQ(Ns>V!5f9q3|uUQ@guVy;>8J~GI zNns|(jtV>N#4ev|#-X_+LwYHaCa*J>@Q1kzt|H!mj-;e$>G)6{A_wD@eiRh#c^J+V$9Qq060^M~y_2=S_u&)?DeN}7s2-J104qtzkL+tDE9+&%?aCH9! zMK+NuPz1g6dpLGlJ@vhZvF!{kgj~$2G`IbxV6$IiSxTkQG@$#e^~KV_+{Msq5Vo7C zKmt&KXC=?yF+4FQJIIhh$)c)~9>HK= z;Y)Spc@0eoBbx6hVd5NjX+fGXo&issKXo3A`&B;?Oq~4@6&j+&^SQ@ukNLmYOa8C+ zlK-2%7gpkbA&wURd;_KMCHl;=DJnP5iFC z|Ea;ShiP8hN=J5=FoTpIJzS=P060X)*9xCZmI1z=QHqlD3Y*CjcokG~H=$d>~a z9$%%$soB@)r`mjod2jGZ!&msvEBP^>>U2J$%Kd{3@5BtQ_f+}na`;l!8~0U&4vu{` zg6&%8~LY3TgL41$E_RB+RO^`Bi9O5+~Go z5WI}V8J8TgozCXRakiiME5GikcGmfA401FkKK0$lzywaU9Kle7ZIEV@RDQ6KhTCuz z0#RV-EjIKX!gFWZ>01`OBbH6=O&bdd6!{*^dqp!> z`h75y>=`^0Y@7t9O}YM}nPig?ynDA`5hm@Uk6}?0NNvb)kZu|6KRzY zEaa-+>h6K@Xe;lljUU68&ru?O7JsgNGIfN?Ej69Ww+S7ZM8HloSisIk`jMRb=GYmj z;T{?-9_P&`B1iIPQ*hmIQ0`{f4tzJPuN>rbRBAi{fNMbhbJJi8H|5;%SbBUew=r9@ zJXGbI_O)Ax;J@rSA~glb@K!ogcXF@TSqPVbFENaym6bB-pv@D-A#y)wkcDc z{v#ok+u8^Fy4u0DA@Pk!c0dm`K1^uJ{e|)a*6*q8FCZ)IC#Uc_6~@v?tIYnm3>wiE z@EkdS2N{IEhli&g;?(57^mZ!xrJFQ7MIdkj9bYRtfw#LGzLlZ7%eYw>%=UsjcmPUt5zZ{0Mi`DF`#1%lCCm?bxjYv6ixmrQEJ z*SihH`EH->#Ty)koCMi#j|mpvo?T8ky7956n5yXvRl$^C6JPSt-m`|?34W~0(eoaO zMo5$T-7CA1tbxJ5L}9M!Rz&xqujIuYbHn?<)Isurzi*u7a?n={dD=AWg1 zQ5AZrX#q)oo{isclH;LAGVi6#?i-HaI-REN{N(5J0Pyoge*6P;5693=vOU(0uxSTw zEBhCem`e(-nrM#glAEpC-5zefl6ioeM8aoxSNIIKUdu>f^+CHv>8~coP0_2rUf9Hy z(Yr}M$>m^1x5EJi4@A@ZX@^^&$am9huHGL4@+$CZ6W#!6ITtOouV}2fNij9QtbU40 zR`b@q4JkDI!w~<&V{KPYJ?p3=2eOL3dnRh|T8Pwg@VGh_UGelXEez}EvGhVhKgIa0 zjmM4Jc--tR+dwTlrTVCF@7^H9glgzagMxYA8nOA+slpX&u*_BqGE4#BOAFmatmtr1 zdN3>u83zD6)@XZMwyzqTU#;exz;7sg`kv@CJEsu5D6^^S=*-m=Dy|%9Z+#LfYbQC( zl%Fbcf}!Uk(_rZBs-4D2c6U+=OTbveZlYy^XPM??a>BS9**Em~EUTOcJDHMjod<%- zpC@yxy6IiEBYpE$X(G|5aO;Xx7z0r*@^HE>XlCvBitFW((X0N+wlvdTe&_wUCgc3s z;Kn$Juq59CS=?~qUmy3^{P|E3+h1h>7VMzTRDO-OhYibfAsI4cE-J%ggmaz@k=x=D zJ3vJWiA^;9#yvj-I8SIBURak{YeG}>N@CTK*U7dqH=)k#GFuxx_pL57-RJ*ps=RoZ z*Fhb>q||Zz&u5h{b#>~@JO(_e1wi;ntf`ZIFO743_ZL?th<096CNbN#rfF=^xZgJI zY1UTxD66S)q|3p$7FS)BDx@`>@_nVPho^qqim!)m0bs7aWud zuSIh!B^NHV-_q!5&nwpS{e03>#0z(dShp?AkNNlN)^;$7pv}QT)G{e2CS}sxXLEb? z0`Hd`!QfzuTZ-e6_3p-4d&4`-M_9e_z-ZSJEbyN7rTR9kqv_qD&Nw{^>!0_;rvt=d%;|k^bgmpp`9&ANZcs$w*Ap$tOG<0kKT&MuT_V&n2BHoG6V! zHN&*?mw0^jO4!uY$X3T{#rwVUh2aUS0(w% z@XWzODc$cD2)w+5wYxv8l7Cl}UUQUx4IQHLxH(CjTFx2B!VfEr!C8x3tfXfd!--2I?^?Y@ocOqTcqB883Teh^xO z;0j%#%9wi|j5%WaxH_a~SbsZ*%x3MQFwM3(f=*T?QIh2y=O;o*C6IL_%Ud={Ro@L? zr%9FQ^RuGj0jH4vwT`Ge%Jn+A@u29BH0~=zJGSl{8LBhv}Y76{d?!EsyP$Ly(1esjN?s!9;U>=Fuvw4ynz@%Ja1wMy}20 zVNUBdk|dj^joS?)chNMKD;k9!FOO!a>~(j|CNRGVHlf`eIjXRV?KnRW!4%fuvLd52 z7OvCJF4Fk|_2T_%dGuZ?xk2<4_V@W^!J0_?93;K$5rCJvRJsc0vXSd{I5<3YJ8YI9 z$k;=O*8XOb3rjG=_(Vf=Zzu`iW!T`B5_P-Kh%}JuUlDyB{GR6QXfe&IPq~PRypG0Z zxqG{QnzLx9A|#H}*8+BU8wswM&JX0j&GUs|!Th&-zAz8uGpZ$4ABIA)-^W7x-w8G` zho&~Sle!T=J59{>RZnVvw`gcKHz)3ky43#W+M;Yb4dcG*Ozm$GcA2+Fplx^3{C&lP zZ6&H<&9ztgJjZ2u^h@fExN*RB`O|w7IBdQFLJ;x|{Fq%V_Vm2R>s5A%wJ!VjdA`aG z<)?Pu?gK6_W>N8cc^y}XC+%DP_O}vG+85f`{tk=BX-MsR8Xs02K_J3o0`X!C%HzX@ zJYe{Zsv((u6F+=*?WYQ*#C;_;bBoYP7?+163$d+>`vT5?B2dK;Vq4q1Ni@v8nH=}i z7*b_nyWgaT`1VlCEJsVx&zj^ml~6k!)#HMKbQ^J-2IElE;#D6vzVOhF$Y01vnZJlX zg^-%neV!jl8!Co$07$-QZNNoG=VI`C zf1o;oPiOO7G#D`6X3HWukY6_V{2B0-?51nDwmgcuMrVExEHU9{k~h}gIzhqmg!uEw z!bw)zxV4gIRckJE&yQ)r%n1UR;L8ThOq2wkn5LyCyr`}ONqXn@%@ycxPLp^ zOwKJPpW%BVR3^K;wS3;OZ*kgg(8_qateesODDfS`m1GCgF_u#vRqfbhGTup0 z&NtN5CRd2Z+y^Hy&faWXgQw_E#kb4U_X(Xww+g?1&xg%>=fRP$1FS|j5R?Clvj-`I zP}QGM4ygF03`n%AqwJL-lZ*d(^Z7|T+UEd^qM>6x&i%mn=_NBveE5$9pY+}bJdsk>nda9CzHDiDgl@*yDWe6Z3m$*sw1~n1S`@Rp7FvF$ ze5erC{G}l6*xr;Ck-p%`O~ozN2u;qUyqpxg<~uzC9_^m`O)UZ*ILTiD(74@@$x0(0 zKjBLAUh@|?nk2j4(cDq4E&fXljkOm_7)MK^!;ka$c^sV+t-sozwT^s|VPcf|JBUW^ z%&p^$kISSPU!p-*9!77Uy0#CJ-m8>)34e50M(K^L$%m{4)3s)~30eHcWhJc4uwDh3 zZq%f`sqLrltT}cpZLjo;KUe0jHeSiq$rf*e$FY)D()SK9F($s#$t>IC-@G0r541_q z57__1XKGMpSbSF~`vT;v=ln`?8X0^`ca*}at$@W}JogDk4}?P2kJRJ-e>kbBvSP10@LNgY3RyxEK`1k_su^$J{29nXFMv^cpQsxS)#uf zZ1!wWux5-dV9CZvkGhvIUiPkJ@VzRw?9tY#^uMUd|C&-A&i`^5XYR|NWbQSnN&Z^? zL^G#b!t1I8>0L6ny-L7>lJNQ}VcHVjK!Vqm-@v1xSL3-|ZrL~GBEE5q-?B$~lesqz zVRE15z^M0J?DAEG4$g7Els8E-%REVH{676OXW!3HwEnkfpVEUWHs;y48lkY;%T~#IS4*&%25AtKW_$lxzZBWmZU7+&(M&1|R^^am;pW`WL0gCz| zL#23|o*4EGZulL3-vUKf=^LI8K*BMy1C@rqfXZL;9YERUy`&hTJw#gS!VQ%!B(wiu zm4i?1B3-{XA64lqHM>AvcKy*&_XjHQR#gsMA$R#bQjUh`2;!+ujhgGL37u~Z9rB6g zXnF?he;6DH^do@~*N-$h1Kg?fqft{wWF$C!Tta~ozlE@n^WcqzcQ)qU2FY<>`12ci z^fCE@IN6!NuI-|2WUrO5)vM8;(uRG^N&2XMnzJ|Yqu9{$h)qV(sOfB9iABY6-yr)c zR&+Zdjb=Dp4#~>R_d~qiBSpDFw3hsK2%FUta4Nq5oFyBao(eemFplpz3U-chv9uc> zSKE<(ADGi~p*$pE>;2ny%d9VTO%U{qPY5i3FBPp>uESLH;N?K;_JL25#e%j*K9twx z;^W1H>!->Nj2H45hyg|Vt~?|Nfur14D3iJOQB9n^k-GEu^H?->GWUVujG`SJ-#&}r z``~afSDj?;L&F(^_@)=Z_YcFx3Va_P&M5GWnvb+E_+rim$mZtiMPVQhDf`ilkSi`F zqa=62UD17)y3F@UzDmtij#r2AyxM4UR4QnPz2X`5^|-f#3QCC=NZ?{z&!8^|IS_AM8_73y7b@ zXZ|b19qckyawpyA{8MS&c|*U(lneO(iTr;x|I62wPcidO{xs%3g5-irz>rD8O;rNn z5E4FGC0u6-AFC2(E#c!;!jmlF6IH^6mhj0c;dD#*RF$yF68^DDkmJ#qySYk`<57(3 z;&s6BP#Bb7EbR_-> z3gW&X-K4CK7-MSnWbX;pMEDWq81rf1spm8Nn4ayR4!x9h2%xOv(8)Zt#Kg*-lqx8=$lK%Mx(ob_=oO#Gi1sm{ZetVLih5FSp z@QWLk)~tZ*vi&@i!1HJI)13VrKN?rvZXN16`UMipUZgfNKUb+RB|AyLBwFXNLKh^2 z@PzIzIRFdx!iA`1n5}(UtsTEeA^fnbFbA_=;@SJ% zNTi|X2+`S?`;uW7pkt5w0xUx!K2m>CW`|4W(yNLB0&Gj+z;{6jT3FhlHn4@~11!UVdK()SZYi|)9>wUdk&p{yv zV7?h(Cixa8jTjwcda;us#c$%ap4%x*m!PkELcLWgXUSWpVLdqYPR(%gKI9C!>h2-Y zad9yfNk~a3TieIlfw*=xgn2hWfmpt>`BcaY4qVXyjXC*DA#bO|;vQB=30@e`!DFgH zJ79f26-GOwN<$vS?#=G70S2s}X>GQ!bFyCgznFi}R_5k9>wW#6|}K&tTk=nC_Z}F&YwnIJ4Sjp^P^yM!F*%x zmO3-CIrV;VYarqlxOM}mltO%N9AYlj)#tU2usyDJqo%Jo8gVjMHVnh!^w zvp=*)E-FrEZ?ng7J^sKRFV^EOdpt~!x7*`4sde@a9+8gd)!7#{>lT-fauQuAUoNtc zSBJY#9q!u;!TERV?khOEbeuab?Iv&Su0IuQejP?JBeA`FYe?3_><(%lu`2~~q1N7p z4ywxkWRHZ`;qCVC^$%QD#~T8@9b0>Q-~b)Z0iozP7=%X0qLmI^v~kODC6dW%zCn9` zFrA}1;Bt=OQvMy2iM-o1|1Qt=ZQS3ZI7*nIetEa{feCH?49oQ8M!0Y`V`+5QG5&oC zt-D!!PF?#fw4lc~lG6Np;HCZ4b`ssgtW6Tj!wnO7fT@DbMH?On{P_mo>w{`B@F2rR zv=;bBIQ~ZO{$4_=mgcvLh_V95pW2$;MFGC)G1u%Da9=ny1>7Ovy`+F!+UPxCanykp z{~r0JD$~qj15eiC@j#2!P%bN$@T<(4h0&`Az-JcY4>McF4+A!jswQuKy!hy zfH@R=PqzBkEWemk`RvdlU! zBU6&*w=G;IvGty3sZ5fsR)K2&cN1(g_53h6_KN`ki^8}?LP_0|t6Is5hg7q=n9mJ294kA-0(;m0J z+0h6+`yXl#i8)&=sr0bUojEwYvQ zXJ+-Zfg5i}?pAI0cKPvGU-vsGI`mYxf2%hh5Iu4Udw!e`*|z*g;Kyn6*v$xt7#;5v zVbUwLT>fLDMw8)IerKR&0?r_6xqbpstndD?BnpRRfGBXOm9@!%#WCR;(cTE-YyemJ z6?Vt9(6>~HJ8YLiYm)*p_@D*qvlnU!pX53lq2%B0?olhQn zveIDOZ3lXB9 z6#h#qIvK!sTK(Z$51M2hP!yjI#VyukUjI<6>DJ*`lj8cvQT)9HPK~^SF{|FQ;A05S zyqJ|_vl%=e8pfmbCL;GRr}Oijg^=A*BdV~CqUoaruKqll+)Ld{9F2J%!(wOsIgBf8 z=UuyGExWV$xTHFd+EMWf(w8=;vXLTH_m*Ey-lwR$$X=Red~Pz$c3HoRmnF*@Ip32^ z8Ef6n97O?rURv&!bwu5Q#$k5gNA%I34m%&p%godfLuNDowPiw#^X=!2KO?@EHf>Hp z*y@>7g{E1QdaA=W&L5BOm9RbeUKFm6+nPT)jf%6hqNhUC=Y%UcOW%PHfpc}psJr@T z?zKD1Hc@0$-|?@{M~$<@!##iqu4`3Jj78noP;O*iu>tNr3qIoq`Tq;mLQBWKW&35x zv^t4>C!M-fF*T=4J z?IC{>T;EZCHIE#?fiIlzL&HO2Nmu?@=t6U~CU`vMzi0RjEWea2H%Ic4L*e`~6>vm7 zq6%qlTMeZA(l>oSB?tKXj%R=5%rTJ_OS1i`cr0B(pz#2nCL8IBW}F?U$CPjO>2th% zA*Rh;kNUh!@85WxZ0#bvLG-RWd5rGoUI#AQjcvPvvbU)TR{|v3I9!1}Tdt=pI`FiJ zgS3%-TSYUbJ4K7%(b?h3wcmq#YWvxZv+T<$qud4vlT0Mc9`ojx$ndSxR>qe;>DV<> z5_DkP&Nlu+czgd2I)?EzEA#WANUDBM>I|xmN_6aC?1)|PU357=4u=MUd?f!5Fz{3< zye4%UKAEKXAILd7IV;fQJJQTBCui~56n!3rt!S;r%KT93*-?JkL?w1N49mB|oQyU2jtH zYVV*xH#`?Lb4pGj^Da|Tdh0YNCxQ-A1+8J+@Ao5lI*j8KwT37%e?QF*G4k+4_{WF9 z+_o=`=6G%Jsd3IGbuNKHU!n0H=KbL1lE`b%#qSbNQf=&KEqBib(vH@ysM;DMXMRl5*(SxXUAE!A` zLp%AL>H}E$a0_nSm$2-c7;#^MGJk?A^%-wwRnF_Jnjy%<@vn0Hfu$1vZS(Mt+s6ck z@vEG3I)tC`(?pm*q$Uh|*7(`Bv)ik!?)=XXT6O@l1M+{+DrIPlkjG?W1fL9*ks8Ul zN1{XDsrz)d7e2c00bL93UOb|RKr*{JmMhWVBg+XXy$z6*9m}5~n&pe%jk*p|*+wY4 ze_6JZ3~FX5TvWplr#lpUR8H}q!8_F^)&Db;$O=G<>;&?l78N_A*GWd{qoHNjWE=+%&>5rV5v+A~ZcWK#8c)QR?Xy2NpyU@)aA z>>H}~oiMoifk;gArbxu!pn1WfcH||LnrsQCm8S+1?a~}<9q!HcDd#M5XCD@BinZjspL1~mVc5m+#M5#lgHKF zF{z!=xu?}%n@{3#Q@>V_Y=9q6TU=&-Pm^>tFEy9tR*r2tf90LbE229oeQ)QfjgXwD z>kVfedBQ(U4Hv z|Do>9!`Afq5C8bv@{@dfuae4po>s(b5p_au4s{r&OFC)4-ds#B*< zojO%@>eQ*K1cRLe(QdI2JU&c#hSSK8u_Z|uRkW5Np=YwHfW-KT)9J4i1 z+aapSynGkf5Zi`WX;%cfvDu(oehPhk(Hs^6w_M_Sd0IIj)EU}%@*ZZq-l>qsLW!Y(`Y{wZFh5^36Y7l|69HAEt=OK zfhg7ssh81S#Hum&BIN;pBV2J^YMe!dmx(|GAF;G)Idl$imf|LnEp?;uZ%xYC60c`6 zMoGNfoMD07JkCpCY_#x_Ixz`DF=DD+n-Yh^hNO)S0aqNG5@%T$DH+;$0L4^0k_ku| zmXwY_>hFBwYFihBFvkmHBqJB$I&4`O)3jx8835kSv|d2-21P+!zm@DlgcIIM{mTo{ z7I+rKU=W3P#qtY{=2iuKOy)6Yi(4XY_%b!-hR2}@#z-1Oe??KCW+7e-!mNK7!MvvO zfELMMwvPc6%br^S$TCyu?DlR4?1fTB>w2#vhbXE381`kN89{JL(L%{$k!6w)EpihQhKrDyO_(Qo_4Kjx6WwojvC!>I zoTn4gH;+)YC5o$cE+2#^lG)nN0aWZpzOBF{x@jjE!<22wYejAOJK5_7 z&F|hIPsERR1helBJh^t$d2%?34;$b{5Y>ezt4|^8R^VOVw);Qf4({dND0fmYhC8@f zIpGcnlm0y8JqoI?B!6_T<%(`Z!IKTwZ)3peDhwV6MOr-z;<70iNTdIDXtx80zTXye{ACY|TNca`WH=E`-a&G&HY0aj+#s-G&@$dJr$aE~ zEQ~yq<=)4e5*ol3w0G?w9$;gb$_@gCXtY>uw2R09jAG=ZoImJ~k~1=SRO^$t?+ERl z+}W^UXg@p~gsEeWCh~Bs&F*4q|?!btz4^U*I#{J+}bk8hj@q^p?lLdM$p=pcOa-vGQ{mUOQnW?m_T zVg)Xbq584RdNMw+%rGczFMJ!YbZJaMR%@akqV>kW7vkeK>Z0B2I8Nunr9|~(v&Vc2 zS|(=AdmrI3Qs!^l;d!6%B-#s=p-pxg0)6?eFM_Z~dm{$DyDlt2>t|wfo(b2fPsHbc z69*FQ1JIIKLvi{b-m&r+%>xbL1th$n7SaB0JsdZ7M168XM^tnBqZB}WvWnhL%hVT$ z_96Bz4=Vj}HhPs=_;%!IR8*ljK7;3&#(tn|71`SWTT83Rb~Fs^71HrKdL80J96mrb zLf0e^?LDmdaOvNfe}UU9I72(E?EIKUgn>`6PJ za1~3+a_ZRdL@N%%K9%zf&O*?C*!);zMvViJQL`+s2l2Hld9BFn!3>4D6R?NywaVAT zc_hcrOmi|GNqhA@suJH7o{vIpPgF8hKaPQ9nq@ADj>XcnM_**)sZ{z{cX=#H95jiX z^~>^I0KKX{e@E}!@p06u^pw$Wp!+p@6sWqmOYjN@;IhbI@dFhFCz=Tc_xa%^6p=$w zQWnS1lNY~`r%6vBt_*>7{4qkB(?yW_QOF&qkOPzGOBvk(2}GoizTWIFejs?XxgMs( zn1hD<@udeouHX>Wg;k^){SNC^^kljv)qPI30}-yHvWRznJQ6wMum;iFoYD6d1 zX!ur;J@(IU1SdG5`e%vEP?dH{fEv6KIAN-5TNG!W;TpEJIGekhDSlmq}T%e;Rp}va0juWU;l3OF-41ttZ!$?5xZ#eUf1|Q|rZILijo2Y#a`DcH^3b438i>5+u?UXbrrB z{7SATn+-of?8QpX&jvku)KOMuHzI`@z~saOvJZ0|q|Noi!|p>!5*@*6!b%HP^WbDr z5$6-E1LhZg*k-oc$qWm8$DrF^vV$Oz#^Ibs&H)AxM?uEx)OMpo@P_&m8fw}eh+8P} z8;4~0CPaZdukC&-nPlxh!h?E!AWbRw>&Yl7}P77c;MXH~?JZ1*=0uFB3&KTw|j@;;j}PkNlzv8VJ=#lj=&(OxZ+N zol==n>&dH!a%DDx#HgrP8<(rPtMsY;*#oz)Fs4;2F~zD&_Ec zwq!Ilu8CC2W3$pV)VMjugV<~)`~bnTvSgE3S&Y!XPS{x<|EARj>qoFP?TWF@t@Ns9 zmWd8$mes}$$fEJRI3IJ=t^&EUgiN(hlHW|vrm&6Lu_!=opI0_dQY2OC60Kb{Wj|g&kQV8*> zvP(GMcUV#fOVonKCRa=HUyI|2&jhQgxLkoWKylFBtnArpc{u`XE!>pZaGYw1dC`Zd ztLM#8UZ9#wSaSlUL#z~f_CSv)*@X)@5m95ox%VkLpUER4i-?i;<0q>O!mQD3_m-Xy z{ji8iCK$`K$V!SsA`Bh!#RSZvh9eezv3NoV&K_@kngtVKNDz5x0zV^T)3z9p`fvsk zm}K@{Z~c)6^=cHyJD z2=|!TjKL9~#pBjgv!D(8amYTi6pMSZm$UMUOepKIPnzrMkzNtW{Z_(yq=o{xMu(<1 zpe42-K@vgnG@OQB1P7`)UaYVM3BVA>nKF|D%Nprf9WjKms&rTs-!UcMMyNNWRPzPI zSMoIw8=i>#En2t-M`s{I)b?a2H}$o*Ku-I!>p}zG69C853THUzj+UuhE;>p3BUNBg4YU3|j2-P!9 zcXK}_DruAojeRF9wSIIcU!RBG!rPwZ8(M~qrQugm2M`+&3Y{KeF&h>G?(z(xleHkW z2)P*&dP*E>;8!6PW5R==AuNF|fTSzg8pR58AOc;f6mI0E392{7s3^W(ZUCXOt0jou z)DktwsG8t@a~!3(rVFn01VXegy`MdqYgjUPoslgoOfN{DntyR_%V^x>Cg;ryX~R1I zt1h1E!8+`r`C-rRJn3fU^O(ow90i1noIK+mrzi24-mMeA`p3{K;wmkuNRa7y)l8Fb zm5eH9yMb5e6)PCD=#0z$5SAZNL35&RDqhUM*=Tdofv7N1_C(gHqoOT{Zjq<&OkcF5WF?1@28g_!)Q3 zi#q~1EQ*=IPGoy>HJLfavuU*v40$-e&f9k*IOdJ!g>Owhv;mZQ^2!uS8}2I>>qenA z{!`md))pX;^%p@1HegXS{C6_7+#etI;X4_!a*gFEU3U?H7gK8g#pYA2V~5ANSyg3m zd={aChx7e&F+XoP4*7^k=CT4WO2xRR> zKP69jt(#Q=1m+6DsB|OdV`!o}y~&#}Z1#~*(RUMxsGoykiC$+k6x=OSD>gokJl0kU z+C17StFf9S6!W+=Ms*o%yvj$Xg8`@!G;!G2aQgGVnbTSrBKnti7iB1vqJ0K)bxg1> zLg7)x5(H_$q$~?Th<--qaXvUDi)mUuWFz#Fqh1R6!>L)@!BkE=!>! zvPtIzyO5Ao)}F>Ct2)^*Y_iKR4RiV)j(=hU{=EOe!vfK$xW92ZNO>dsf?$Hap#D7& zrW*yr+fdzQ#XOEeXup|n{E)&bJ09C})p25mcNO}aQzakiXB}&Ue3zZs47Wjdjbjvc z`sMDvY9=|@$#m5Tdo&<7{w+IvXh7bvX}lHHrJ=AkqQ$Y%p{eT`MM-Yc8>^5#mW%97 z^a6APYplhL!o>S9JTprN2sF+bgr(G<$Ik#}bh^)icl5V+g8+!;A}Jwqr?aoJG3x66R(z}m|1jUlyk8_Ke3{d4+O6Orl=v~A`* zvcE2Evlg9$X2K(QFf-p8!Po?|Vo$V0Y_l(hUooRSbO4=&a|(;YmGmT{WS16|goW6h z?&5#@e}MmJ(P}n~f9yZNA8io-WRF_NCB&Z@+CGXB2E9cY#5-y^(^|SazKaoOH*)QC zQRYBPx0KLx5h_!w;zUy`oock!X4Zz2~3?*!0)Gil%qF8m^E4@aegQyBM9gk^}v zI{o_G7ZB5^gGqf+1HWc-ITbhE(v1}xo8H-_jk7hLv*qpat_Sq3%*)N8!5kVZh%>LV z$nYNI6`d~?(w;L8_vxl(X%3QMvIe`Bhjh5+8N!z&jBQFqPJThgQ_zj03xM-*Z$u{8 zJy|EW!$nS2W@mbD!X)P7Qm4_|kU}}Z***k#f5fQ)q>Bp~V38=V9Sk8LG?fyb4%lc; z`$rJH9ca~j2Lv)yD1xM-ckUNJnpeglW7-t0%@2vDBO2l+P6sPtdGSZ-NfAT~@h*h^ zm!y~ehO7#-zag3qe@f&qx(3xR2cfY_xxQ_I6}C&xmA;d(4SJs71Qtl%rvZm8*%>TwXTr}U zAKCCOe&EVvfLcVLOL3`8-ql$qS2Bf_$u9v*G>VW;tzknlnI!BilkWu1Hko81S0;Pp zOz3-5CZ$g23jbvcfkhW}N)wyjJ77&}I#57Xq|R_zJyo<;K{Z|}ln7K_ED1J=kq9L8 z>>c(w?<9PERcW~(?kO<(6ZHCpj$wjr6-PH|zFQ zOz^E<0E9^JP3G4h4_l`Gy1d&E_aNhjwlCqZx<7z%CVS|#N%p24%i$F=r{SfE_fj&9 zyM%f!uz8r1FY50?XDU7l$`nb8riDp9+Y{1f!#jZhT$3m^k8ohZDn7=mjxPA)J<{wRu(8=KAJUS(I$Fxymu;KublE z$?20Ida$}x3NDKZtt?^^;crkWD1Z9lctZ=-EuD~l7=d(LDY{6Z!WmgImF6HVTBK-; z@ZDgGtQa3hAy;K`e^U)NlfC7n8p@#KL&!3Eh1JjnV_c;x{3w8c1ohDcgJQAq8WVNr zD&5h$I@Aeic?ec0%oSKCJ;L`&kF68k5BM_q9)$l5OgadVPV_lCPQX-M8o$(zCH>JQ zK-7iCp`dJa7%bPUAVhaDx)ibMcM1fIGk&MsUr9H^3GBVj(8epIhHP9J8 z9;MgjyT>sy=#X8%8a-H1*J3kCur-Rzvv9^J64XBo_{79Jpi_C+uWOu-=KDFf%tybX z9KkFmTBS2f5Q81;(`xK4_9apEd=(ed2_4hass@RwjejFnm$yP?$hpU&)?xzO-!B?_ zDr}(E9;O!BWC~()&nBg<--|-ICSK+ZubB%_4CK_h3LRspWQ+xn@byQ5Bt=cX`t)?b z;AN}j8tjjpkD$}*S_A82XRK&$9|9F(T1_KI%mnm#l`eFbU1+yuquAbTkdMPF)m`82 zv6=Stz-=$tvCz8oSgTGR5sPgMUzv>VWAd6PT`kV~BmBic#AL!5BEDf0V~yA4+ppUA zR_U3jXcM3ac5Y=oZtx@9(&Tlhi3t!+YeQ%}dM98x`hS&a-edVS={YqZH5cR;km4CG9zGwQJG-P23N2%6&XKjQ2GX$OZ`9;*7y}e-NNx4@K0Eb?scU7=zZ*xsquYybBnDf+FY9|gg}n0hF0G5fU^}uCW^i%8w+j61 zB~0e9#$_PB)K~6Q{{+3FLfAN-wg!RRLs5$6AYE^azwz^Uoz^CSAo__4XC2}9g-}(tAZsP zz4}>Dpb9aZD1#(GI{xfojVpi)8Y+ennc-p>PNkdAbOk4!=#@Pv`IShB0SrPY(-4*t zgQF5$=F-Acq~rmxk{$USdv=RE9}6Z#!0DQkp~Hndhc-JuX6_PfvMz`&hUtioadW-b zHrMl42N(Bw|Al;pST~KUfD_E@R4ZlK+nJYI>4NCrz6) ziXJC}@(+haig6%mA5SBJW9KM~-~J+@FR)9#bl3cGD>{_0!5o#2$_6G)@74cdX@By0zPlcmQPf^GhJXN7jrZf5viMK7&ngGT)T zM$AExqW6NvRrJUt9iMTwm`p{OpP46qIrGK8r&(iAw%Lyd?)~)X0~~&vEJRn)9FS1< zO9i=qX(ufQ(L|>pC!7Mu^bi2}m28L1kV-cEQg96aG=Z7qry?Glpds5ZrnpAo zifdX>(G;PqQ4ShC;t^#{K^WAM#1xMS&3xcuTwjZ^7AFB_!gpyUx(+HL>w}9w!n6Lp zy~r!vO$+HoRo73T^vKQ>V>rt+C&_UTbFa^ZUrC)~s&KW%K}Gd;mS@G~ycmOF8vQ8+#5DH(MDqt?hR&v_drQ6L@UzSxQ{O^wmweyP z6q$%-(`bpqauCrJ(sfcngX6hs58OqEqF? zcFWQrK?il?N@alW(VC8&U)lqm4m*~rGgx()?0A(Kth$+AWv1P|1ag`r2b9coHZOr3 z{nXtxv+yOGmu9(}mxe4*XTpaJ3Wt8PuSZc=hV15>nRZuGikf6olTedvYHFiKHZ{#A zHM(!96B}pS*o2!gHIiz!p(betGgN@Za)pU_bq?A1Dw#EhY}|}Y+sxVRw7G9Sm1%SF z^$e=AGFNvy&9gN+&wzn3n^$1RQyeZ6QPqYx6F1LPH#1E3Kw*QJerkqW;7c;xLia$0 zHp9?>A;bBap=^F~#Ldl6;zCtNLQIxraruqXI zY%4fY1f_wWStak})n-Y`^e2Oxtf+$yF-lc2^C7vJBtBUkgmWTYyWAz}Y_(Xcmc;E1 z)m!2=$8^^4?C5B2%Jkb9@#^OWkeG%pr2%#|MlqRbICpu#uQIbL9y@u+*+b&$Vy~n`=MB0-BeKXtj%~J+g}Z zy|KlLRa}1>b>|x6vi-h{-O}%yU8-${$ZV?_QPW`95XZl>A=5_t6B}z%hL}>GBZA@C zmO-pOPyl1uA#K*=nC(|TVu)Si3zP!K-*99B+6YeUfT5U?J1Im<)r8z zzp5?yY$V5EOIyi@VtYrXIS0WoZfwR!(A=C49GQ<}h+*rn=Qv!;e%2plWIXs1kBxty z#uHU4em)H(3`M>c_WcUW{Mum|>cDErOWoYX&QKG3Df_vy*^ z*L<0nH0L9!-?$k<+T4P#t|{PbRD?MNV|Z}!o!&cOJin22WMezPWibf$wj@RY9P+_A zHja>Z6hrX;$|}%@Og3f}cm>^opZzzj0yr>T4FC_58?+oj@isPsjGiNto{{rN7=ZMG zi|sRYqh)qBB#8af?Ht1L4iQUzWOc-e1g`c|Q)UC3~HDKW6XA zUKFeO7L5_0*wF}3!Ww%0W2nDC?8QxNLd#I|am)Zvmq!`w1jV>3CAAy?i&E2DhO@qy z3cA%z3sx>W@#B2F#E~`AcnDm_HuelpPna_DV={GeWy+dr1yhfBl?UMWA_m%Zu~O;n z?X4=}zDh5)FkJCYsx?%o`g(mm=U1Mq>D~vKpjQV zsi25Od>U&?QLQi2D$~^ZGQBb#%PwMlsZ7_(G`1L|DpaOBMwgD2wl_1jm4z-Qt}H7D z6^cw{z>i)4S>bi~X)pT1ZzHU`I>-v=vRY-36+T01cSaDsm`*fkEGIuy69(q%CMl*( zani~R$AmGXqY1-=wwN$XXp0HMgmyGx%$UH0@p_QskFx&+F>=bvEX$M`V9Klt8rY1= zG-bM&HK4z-j|Dh1q>>)N0yDx4YYV8%Z&pvsap$FXV5@&U&4S#-9%8NS4(v6*Yr*xVLia|3M4p-DRy#$+NTGShYgy}6x5 z&v7gqY5Ec?htQW;IojwGE5}?*-(1iqb_>I2^VNyj8l@bM>65f`W1EL%^=vcEU(54d zVD+0vRzq>|D)Y!{jNw|}^Bud#7JfxPm9Zhd#0(Lt-D68j@|Fe+EZu^lp@}-O)S!1+ zYM{4Nl4CLwYsfG$@>9v!%962_T0<6CG8PyxkTI-eh{dB5=M-Oxa~f1xU~ASgZk}P> zQ(zqX>{4Y~#@a^)T>A*FnxTDUpp}gSJ&c;s zS^#si&HjkX^EyjC_($(X2{D&vHOVq~77!zJ3@!SWw-Qdt;xc*@nDExJP38_${9WnF z7(~#>6RWo*$NUD#v7mk;Uv&8yXFPO`EWu|52V}szBFDugN>20-N54S32qZtGt-%oeP=#vBp{Dd=xY^EO$u|F zhG$-|g@nHVXB-M|V5D__6;BdzfgX7qf|V-G7zJbicQx}&6?wuF7#7ABg!>8{Z}frb zNN)ClqaMx&ND(@R*yMUaKS)IgQ(}ipcTV_{@Lx3P)ZC5pK#I~Y8Q<1l!O;Wk{k7KJ zSyBP~Z6*3SAkfP#x_sH^-VIjJcu1bxilQ=2cS~B8g`Z|`IoYbO9T{>7!CN`}b-gyD zn)l@x0I~=QGx_i4xIa=d$3=o7Pe*JjoOr;riMc}y>qVe#PDCi1P9BQcY1;Ne?+4(? zpUIPCvcF|Azfak8U2loLS^3Nno098lX9kIOmyaGiNrA3n!bTPv158MQPaxY=HJ%|XV%#L zgr*zXaYnyIlWQ~AcEXf%F+JXnNvGVcK8J0XOuwb=;x*QD%Q}YGF@6TBAXn_h=r6br zWsLvKXr5^q&2@e{;gH@}bCyzx)3#l<%}F@z&>M)Gt;Ds{p!5cWZK2n;@hsz}rSb3_ z;MK?@&$wXd(UY{lf+v(${|#7JzkDy$^0R34E5{Z>IOdh@DaWu<Q( zB*@3cNse^kA32EJhBq4%eGDHf&|wdDd2-Bg-X3#Y2!RE&)uM{qn+<%)gLCxnESvGTjQ=#vQ7IXkw{ z-hmHTx1&!Hm}^08V|vlM3%T?upPn#$qPLG%e?NFs|8vZ!U}(xoLsOt`1w*q>8k!AX zGh7|m_%twMYptH|c_@dONl|^+gFk1{oJXh1G0a(a# z&i2FrbX!rp1FLy01YB)IW~_bun8s(2-zwIYo}t2bH4w$ng`m%>?e4j{jzNJVySYT*EJ)~*#R#Q=?{BEh6*W z|BeqWbG(DVwu{N$V@Nt%=!`CsEcl!1{XZqh8LT4Bor}orVgz*Q=`o!~Dd-9^W{B!2 zCtZCCWXl-EmsAc105%2@+niMsqGync)|$hT)Bt0Zg*Ei|B58JSR>324=WE%pCRPIf z_$Wim;-Ey&MP+jL$m;+Zk8n66Ob1eqbTXobvX>Gw)r z178c6zuw~)h}M=W`H_HdFZmN4$&c=YSOxN%g2t)<)Rh7L!sn5!ahM`SiCJL!y@G7O z*jjl&5sFU1kE$5goN-Fhg{9OpgB1mKuzXgV~lZ^H*{>f6dQ z+r*Wej%|G#DfcLo#JSkMnDdD3G@iIR#_yo<%%o%dP8!e5JI2F{h_-zam5SfdYrLM8 zlN^1Wq^Cgt!)$xK;PkG=rd<}UaYI{Z3MwZ-ri^sp!>r>|aK2~)=u^-EFO0*}4T zF{CXx|7s+R@BL!?G+}=9MUV>V&@_7f`EsonN{ksW$e4`R)DU=r>UaO#dbhMc8D zkwq@iLbO9{S%>3|vhrfQqnI!$JV**`aN@O1$Mmid3`N-P!OIo8J#n8ePUt?5i-AW; zrZ|wp5gEI%F>jPDY?_gDruCOm(Una7?fXEMwg5=uOF+J|fg$R>zG^Dg5J=Pus zptI+_6x_@zw>NOB0KTz!fk?2P+u|TO(z;-=Bc`yMr8WNd$9OmX&icpay-Sho6y+IP zg$}jsaKHtT8?NpotxHJ3B}`#2F?wPOQ8_{9wTqLC4gkrzy7mK*l0lsIK%oo2Og1WY z#X@)wzHlf5(rbO^y=8bmEvau|q|A7Pm(J;s=%LVLE(Z&hdk|z6IWX4%xcJU!#YX|@ zjBlTPH-K-EbmiJL|J|S3+z0u^{cWbXD?fwgZhT~$yYqqJYMDH<%{}CqYwnFFO3b?) zk7g0@?>|A+Q}B7d{bAuWRLtQ%-X!Okr{_RvgQI;mAdnLa?L%32=;rj{fsnB z1lCgo(w<_RK{3fdd0g=JK>D-EW1~|-B-j;tFwsfr!y#nskCG$N0eGD!LOZ{9^>fG< z>shV$Dam^GzJP{c*!Av6>yV+TKETGGr}3ISwSG<$p_$^^*!LxgJQmdz6blE?%NMu{Ed$TD!P{;!ke78H!{4O zWeM!j*T@TTB!fbzg$pmn$On*1@z8KN5KuQz2WeR-c$`{YMVz`Gko2xQZ;coexB&bV z0(a)L!vwy^1}3w*7MmXl=U)~3CNQLUR}1Y+sFvtun&TMbwB%-9njo+;M%C#(Qh(tL zuu^n)Tg`;A^U%S?B{{q1y@YLi6Zy@J{;^>?BTrrK-jrdk1ESqy&jY%mOTDrYy^X(X_=PP{} zc*h^ItWErm;7DdYs=~)W^eS=!@Iu{?_s3Bi|K>t z0g6O!3B(>B58^{+WI^;0UZH$Lzn9+{&USy8u|)*Mi&8Zx%IKuL{E{h>eje&OeZh_SL9qoq)TJ*twj#t{;%r*sAodZE_fJ_eObz- zL)Biyj;yK9mPbg2-45y(RB+7BPMDy6E^UDOI?>;;4aB=TtsXhmo3~Wkz~JJ^-tPhO zRp!;}jU52tGyAs24#c}3eH%Hd;@b;2&xAgT(5`jxvOyxIAF#O11a&9YUWILoH`-vFjzf<4Gt%SatpDX zp?<&8f)46CNDO0Nm-^m&Y2W(-+cK(~_q%=XIbBAkKD9jvcu-_gPkI_6*>XUT>=pOZ z2L!1I*oN))vBxwPU~k(hvQ%$RBSVqr|He;maPe&KY6$PcpvP}OWJ}G1SS^hwP_pL1 zd^H^pH>{z)-$+T94RB>KHDVbl8V79m$Zd!yM&HFdcn#jj_;52Y%6Y&%Z$3Y=0x&$- zWDV|1!OB;J=2e27tsu5$9jtc;h*$p!#23NnzDkUybvfB_Ympy?SiL_5o4xC=?T_(Y ztl3BbknbT4a)TLyhdk>-CZu;2h~zv8WjVyolejJ0$a1_XJ3n>^N^kFYI37*4@gy*= zVyJYN5+6OqT>ANwNJS$N=2LSB%H4g_A9!K!e_!%%akCj(;IL+nqN_C`p9A6X7 zf-`4qUcSu9|KY&=nlQQgAqT=-#Ko9|N#Ks*6{(UjN%{fh z|7(ha6>YPK>xXpUOeWf_S#=ZA5jZgadpa_rqvnYt&=G*sH9tH9l4)km;hFMI`t5qx zAmnv_eB;Os(nmRrFKP8h$=0|^rQP^`e|Q$Kh-4!HA-dA{v8wz?dzF0+I)IC z=0mo%=2O#r7=?WJ*pz&@&b%7s>6Ltf@NCdp3Pi*7!_)8~PGWxeCUU}tpPq!j8LzOP zu>pdKn48QYx5D2*EOOHd(Qomja+uHeM=$d|s~7etK!5Z*8{Z%Ok47_j?B|p7xMntu zv^8EqJQQXnZIo?WNgHLWk6uNr)FYaO_;rP+kTPS4l&Z)T8ovir^ap~X5!)pyBX?!* z5`@lDezQDgVD2lAycH3C_(mX9MJYTLui(E?k<1dwVQ2&95>kN$08r4t02w$3Dax{4 z+qbE0WX(iMmy(``^m#8K`J7HPJ%I=#w+G?X(5FHH%+jAc6H{cOqd%hTE3Rep(kkuN zVnu&KIJ75kWIx4a3aITuaBXvtEgf(%I)#gp0$dVqap5GzKLf4e;F25y{zBeEvyT9e zV=IwtyFw|8n?-v_bI4duaGNSdj#I;?v)S@$aXjFmw$9XFGN`N+SFC0KxK z3Q+{=Hz7$Nw=TBja*(T>9PobnsJ}9Bv@aA=V;6lV_P`KJNRBL=P~uY5BAPo#nHTeHs3gd z!9cgC-{0VvA6ml!h~hcV?8~>;dfbyFzZE~W!{>PG&Kd6V6SGtEB;fTMIS|)8nXk!U ze*!*bY=y02duDk)evl1pfn6T-e)+dasOld=3C15_<5_^}(G>xHHkk)j4nNNLZ>8h; z*?fb>e}(aA9%fJFXCYrJ_}RqqSxo;3;$_89RwkuPlp~be_U}7t+dc*GvCwRxD{G8&^(pvma6BYtTfI_FvFkDvlv;cE&I-#s z+hG~%!0xKB6oC{h?Y;|9uH8HEPx`C-z$DWfkCJ<~V?`RP=N*RkJ()gfuU%wS{oKuM zgH=AnHN(!_Gt*U84ob{Npi?R+uFT2kN`c;wr1TLg#==bWMhvxh7-nOTN=_nH8gsnQ z+uJX}v4o4U2A=Z}?KWf_YPFfFp0&TGW!~^4k*4 zAvB&YnR=e=U5?O0rEE&1QYVJ4njHFVT7(!5I9V#`VM`>^KvASjE794MK!ma!>jVf* zsU*^96e49~T-3M#rCarS)_`kcg_%P-H}q}GSp3WJgS_K?nn!4T5-e4pw7F7Nj$-^o zcZ!Sn*0(+sF6j0maqWwW-r-1ljHHE_V!YTJ->7tBm*eP>*yS?eRYFzX*fSQsxB+syBaUI~Ngm6YqE_%Q(EEwf_uO^L30o$%NM;i`)1e7t_>d&YJ_ACurKO;vp4uA?zN{d`iD4aK zd%fQx?>7^+wV$~HHKB?D50cgKUwa^4KBh5p<(C_EN1RBv(V?;`$iS;Vh={tN6g45p z>g*rAByCPKAA9xkVJYjZTymzOfYFL+wQ8~H^=Lqbt69&A2e+1I@+jkN2W>uAAjU_wxS7DXn{WZARQoTDR=q>&eu!x*BlEQ2y*E*$sJw(nz|z18s8 z)Y@wsZYrOODg&BT?F3l-M3YvQzEru}z| zUU(7VCaz)UG-efxO>JotHywH|gtxPdzIes<;FFD}bIoX(vff}JXXhuLSl&$le_<~)T=GWSGe&xLZ;9IS5ecJXi;YS=m%l|6i zt}$>ZTt{5A`(A7E%;MJe6e7eau3phW-bc9BI=UKtQRja0_BclOCdHlMmk?2xbkZ53 ziulo?catjmC`yK_-DNnBd#J7gE?|?csV5_D$voB=J#lK*@8LGEsDS=EiPO(+RXuzyrF|Y zOGhcNe*Gq+gM2ax6IX=spCQ_rDe=<+)Aq@9K_>bsaLfG6+WbE(d24j^oSU;Pi>@Es zn!rUrbHG@Rr3QcWOT})_2>ytZ=0`1QEX-{V%#SC4x!r+THv!Bi9GIU>0CR@}^ZW!b zpLSqgm;mNZ2j;~IU_R%-{ConKyB(O9T3~o?zSLRt3&eQCo9ct&`Z~PX$cmlYeL?eM zaNPN@{$#$vP|P>5&!jKBk6G%Rbw{+pTKKg%;53|pagTgK7*9hQnD$R?$>&R&4}(+r zSUT>}c&1LpyR@I)g7aQY!{Ah!Ve8ugskZp&FBhv#%V6Txg#uc=ax|#{_Tq7bHpH<@&p*;HW`#qJKg>wqkPJ z2%Q)%5iV(lgv2Nf=E*Oo|uB_>BsQdWTCC5Hl}^A+O#f zFI^{pUh|UZsLH&|LL4$8e<6EZ2*nrsq(J{-*;CoCBrG z2lsTAt2ruVeY-@D^26r8bcuvHV9H%zpoCaS?0nm#3!gl%(-7csXsaF5p%u+ZDg+i|(Q;|4d_0Nvk&-+te`k}yQ& z2U}fKI&5F1K4Jez>ZT+oC19<9k{VcAv95<~(1tV75No}^Yh*ecawnd zi!^+?0$;CfkWW*wrX-x|8rgzLBh)chldzL0C|U}@fg%y-?X5t%?*VHkPYAmT=R+3d z(l3Wy@vT5p&GLL|eSWUD^GTLxljSbA9Bze?bv>;fSXRK>OyrB8kGuh2Xn16xwHH~4 z01)%_>UYRW<;l%tYzArZqt_fjLf3Axl`xblMcreuMhp)O51M?db>=5 zDM@J1u117#7=dnA77GYa(Rgg)v^7~Ku@{7Oo(;^jZ*6C6>6Qb>iClUkj|dKFizxvF zevvEFPRZ9k<)v-94AMMIM`%%=pU@@wmPd|dNIos$HUq6E?eX8O{FJ_n^rE_ zYG!QB1KxtY#k?gtCD$M~Q(9T!joF~b65NSDa|PBySXoy7%x7E+?=XMq>kBy!A|s6J zV|HwYirb`wWtwArWSbY_k=XJ>rHOHIW~4{-d4>X)<@K<_5;xGHddbrpk)9S~1;GH#XvLGLE+V(kp@QbS5DRZK7J&5AR=}WWOAX=o zCH(HEd<{#yd=IpIPiy&}-ts-z@;yVpkML`anRsmyso^W>pw53Sp4$m88h?keHd?6)A6r@jjn|v7V;NKeYH3V6K>&G zi_s7;U;T4%wpxUXYAu>gN-IUUiy{lSewum46mKm)cPD*;KM;vp4A;5ryaVRJJM^er zv|bctKYE2!V_;nja5)qK!=ghSR0O52Xtruu>RL`ncp%$`9G=*(0eMy*>odA-r3b-t zKr@v7X-XCtDs5HyJB+zO(7aUYJtQL_DwpAF7_vLc;Ajg8?blG1%LO2QAC*hO>IkcQ zc{I(iu+$*fiXXx!k+FA6UV_!i7=t27LmfOTI{1FV%UI+^AM57W_A16xUe7Zh&uCBJ zP6S!oO-|+*2W(1uxQx39G=1PvKRQ^-7espiAl)uC{!kN73exfLokse@H9iyV3X<z0k&f zy5cwr5|(K^?jS*&;_*dB&JegX2;&o8`{K8A7UAmsklvv2T?d`w3ZPeDeXbP-`uRJvIrR| z;m03@Y57~E4Y;%(6#j|{;WI7pdGY_gsvVw93>L)@f`!9ow!|aJ%H*YKuiju)@95v{DDtH&O>5Zcit5FnuF+aBF+IO(>_< z!ACUhH(Tpq+5~lQ+l26)>)`fwc%g0DCe*xd&x2Kajn6{BR zxU)UoCX`d_;B%Vxfz~=0n4k{so)Ers9ekl3UT7QGggW@r2Gef14(@4BD|Ilikvh1y zJ)P9Sz((rezV>vRP)@CbuWQ-|TkD{If;zZ=Lio;g@XdC3p{;)t>fpf*rrmHIJlvjE z>Y#rkb?~kBbW#WX8>xdw+tY1AIkgTRZ%->@@)^ZX@S8weMtu67)U-E3 zJ_gsz)K6x@&iT3u_x%KJ`i9`1N#Le!2=0do+`xw5ew4uVZwPMPM&W#KbLay5#9+vI1n@zfvSEQ6hPC_@jGQ5P zeUhe%y&UHw?axS0I1I(7eg-ELtILyM*Um;;A;c5UE2wdY0?+_m0iZ!SoS~erDRi_Y z2*T-JnYH-=c)Bb=N|`UM%}>K8-Qm~fr{irQB5*h9|BvOW)FabCD zMw{5qc>WT3LxEJ)ITLOT0#Rr-5ty$+EaKr6OKscWrFj(<_)-35qHRq{tUk+~%D*PA z@O_d=78kNAF0Q(G*`TpKKFj$`v;$M-!yN?yJ)Igm;Z=}>GUDSt1WCn|el7aGV3ZAN zemKH(KUN;XxWM(e$&+<|+P>J-q`-do6qrUJmUDZ+yevG{X+M`!p!2gJFp8kKY_TRF zT0;D=%QF_N(()C>4)Q<5q3NQf05h*UC$GEUwedZW+cH0x?A?zXUQN=+#u%9;+>Xc~ z`~lLH9f!XiNR`(6n^1exq~38)oGW<+NM2zeyS5+#(5;s}nnc$l(ToiyqKr~x*A^(F zBCUl%E3Fo#ma>?Sb_JyJ9gN{#hwVV$pQTKtoO84ri^R4q=bORvom1xlJ>q40Yycr& z-SuK(p6JicD_m6)w-M{|Lbg%uJ=_d7TxO}!eK?gV+mt~wEi=Uat z>3N8G#*NLy0aBggiyMhAOZ-q<`bCW&Lv&ZsaDsgUL8h@ABqbb#RRA@QHh6%v^4(K` zM=-1>(^!@YZEyS21`OFl|LWGZ&wywTN;uj+KTO-ld0>N~jvZJs zVML}s+LLfxGwGExoF)^$KWcDlA0zF0CCabi&Hy7rM(ZeZ7$7a^|Jg9ZHnuI6-q8;< zp5P#YJgV5MzlfRPA1o!;N!RL!n~}{}@^}x~uosFK?ahjrhu~05XRJr<3(L|MYWj?2 z%_bqx^f_-H688$vWPq<(j=*~#(>a|a98SnM(hU?Kx0a1? z$Rw&~geHh|R6KNMF>3Z;%#QZen$$c77Z1w$AN|Z@>>8kqw^7TN4!Hh1g-QD%C8`=O z0IceD*!+p*dXB&0d{EKlD{!IlI>0rVLWvCLl1524lk~ZWmHYdXq;+}Vs~>(O4m%eN z*vCp;DBK*Wv1q?Flj5XHiIdYU6ST5QRl$AtT*kuoR!zdU11!l4zp2C&wW<$fj;8Jp z!h3Wu18_8md>n!gtOLyxe1FvL}G(LWDg2L;e**SY?Hbu|d1A{on`YGTGm!$T^lR5Ao!#T*TKp58MR2jfG z?ep|mnXK7Lgko!iGk)0kUqeY#&s@F$B}+Z(3P= zrZ6s(b0C3~fFS&O_FMsu@oaNj8Co#LlL%rV3TjRCyI|PJJp2p|>2C6&$(qMZ%>!9& zJdZ``JT?P57Nie{h4#6_6z^%^-bQ6&YqUq_kWFF5R}h_xj-hafq*wL?c| zRJ(z29~j@)7O3_u1P-G$8m!BSRmN-E-*RrU6U&**+5XeH36}~|a}%!La}9K7=F=A* z2O?Yt8Mp~@1yRDI;}L0VmNd>9T*bPi&+F?g@$TMjsk=XNwFjp5+~Z{$v^B8~Zc1fjLvD>_;acKh!P`GFt-#>U2 z^tcV1>-|iRhtPT|-W>`a+XM=LXfGhjMW-=s1vf4VgDZ0O3VIQGn7{Q#^*8e|uiI_< zBpDakch5#~50JW%p-WHMh)xG0=||%g9hKL-M;;y|@WRJwkSW#-c{)AbBIDFA*6q;8 zl;VA?he+DdHIOMQ2BLe&S`b5rIi~2k(P0XEb4OT)I`kq(7S~Z4e`9O>AkH`1 z8$~#V@ktw0yGgRZ483Cyus8_cf`Ue8;3qs2Kjn4Q1m?q&dL5qZ4e1lfZgu8}SH!qD zX{F!T4+)#h*cbV3lE&Cu1nuf9AVQj9Z98Y%FNFBvTkRLy+&SihXF;8e6vvTfP!=J) zG{P|qXV;yJkFpo!Be>njErLSp<-6ArjBs_tK*Ar7Pm)`L-DTFtvrl&o#y*}! zZ`XbG90;`czL4?_EMUKPrXTJrU!ZRpU$91as065gGKY*4h4;e1RGkk~JKmGPI*%mm z$pYIr2%#xhuKx`n{*4kZ4F~Si4HP1oiK&ccMQ3?4;R40uo8}>{yUjl!D-L6)3w%bJ zZfSx9#Q(f*=xg39mH4W<$pp<$@-x%CgO6)GPeP3RKhjYLm%ZE^F~@3Oit_Pw_l&%R^Mf#F@W=Ns2prm7WVMJ$G*k zJt-ii=N*tPAZ1J^dKf+tJ(h-*mWI!73JobBrD0rYU`!_(7(NjVR*uHB4!;D@_WEY1 zQ-`Z8ybGGSrdJ%M_MvryZ7|4(#O$``M1L z40T|yRM^jTgk`A1v(*9%k^VBmH_EdVkn-%K$}`4v;u*sy;+d7RYb_05+!Pv8KuW{C zN&{m$(ZKMH(eQpt!(E#~LkdV~xKwFiOeY!`zA+kZv^3naDKw;jlm^oWF{Tp@44;^W zvYeInLDGQn_GA<%Iv;&nY2ClITHpE{W{z7m-T_*$_5NJuY;5idf1AJyVbO(%9pBCFK8NMr(dAs<;je;U81U{R zJJDofo$YqPHOgq4G`5d&eE)>TGhIu3SoEz=Dw363scPKT2{}qwP;BB(E)iiv=()Mj~)F)~4o%-=IS4*`w^zD30!1CE3JV z#U9#}vwt@C_CDR7%UzK5;BT=GT8KJXiMnXhh}!kvA_`(__K3{z_CDF3N0gCsO&=G2 zaheL=#C*^x;3#u@6;Ug(AL3C|CED-fc(Bt`*-{)&Yyijg367e@@mLCn_95RTZ~Re4 zrP`itn@?&yv+o%HeT^rT9pj&oc-a=-G5&`d&+XxD@tk}8i1Fil+rgpX0@`+V8Q|6t zE@7mxdY*$Af0V?n9zk{49=ecvchXo`lS0X>C4_p0C_>uCv;19W6lgCxl1`IuE}P7twjM?ZXif;3W5O! zBFT|_I40I#<#3z+x<*`OwvZ&E^84e4H@ig#oBuU6GXye zbF^!UGqx}Ah0lLQnp$H{5g2oRb2F^vrt9|*zX9Ion&hQ51YI2K2YM*}lZ?~Xr|@cY ztep5L|3hgah#VI#=4g0IFaWCM#q6k)94&2{cD<%0&Qw|kOq@0&XMj(dEd5iQZ)-(c zzD)<;0)>t9nF#hEz-9@XsC&?)z51u)K9h^el&9QM$_+%2`P;+nWk~{I%*Tcq-8L&a zMSc@;tBxtSYnkX>GS-P%+#rtwO~0SWb53;bVheASBw_LLv|Op5K$-Ak-vik;*4C5C zZ8ziFC&zI=a_@@yckCv=7HS{zY?vL`fC4cC`mw>`ycOLN!fiuk?;2|>JA?}AZ&eGSf z`7>z?ecC5X(|F?S7(b}-#G8u$fU)iU2oZjGsmOpIUWRAm-S}xfi*OQoJebe-0B#sx zM28n$PEee&;)H+631@%9HZfE4m82`+)HW%)0tsUhQvIZruZfoV@iN}?dAG6Lf&2^@VVp(3Kco^MA18Kx{F>Fgrmx`w@%`tyl#zQU8 z>Hb`V*y%n@?2n_8rE@ZiLbR`M1rWes^rLzGd-1XT0HJCUAKRap*o|I_JB;>Fy%g=_ zJt%FwXKE+XF!mFdL@EEi^u>D?G=RRRsJ%iq`GfSb=CWt9(QXw}Bf8D+Pm-%aWP^Tx zw(TuZe*M%XhIJwHLxxH}qII~lz=qGWDf|RKyx`ptcQa1sq;2fl0vj~mn*tUY^ur$k z%`n!G!}lRJ{3Xk->kyCy#!-)JJ_j-&3qQkyEP*VPy)is@SK1jJO)0?B^+ z2Dc~96*$nF^?31RU%u+)q{W5d^i>0Tdk7T|5K+$1}Z=S)oB{1YO&EXWQk@^vb{*! zp{?P&vj%Ye(a{(+6p2aUB}o=BiOSvpC{jNQ3OpDm{K85)%{#PYYO^4Tj0yit+Frz4 zz9_e#B!@R>*#q%|c{9u2htsjR>zujCu5(3E91Q;g+EgEm&x7!aCAFir>^Xl3R}#0j zyMnh3P@a|4{RJpQT=xO0Jrgsc#ZZNGN@w2V1oa%LqoGAZTMO49Inm81_t4hjjv`)D zDqWYvY=Wan&NNZz=Pl>5+P2;x-v6Vv4%?6#HP8!E?&gp-gr zLfMyVUu**qNIN#oyB7kt)2+WmK@UF&F0c3k2z6Y7I4m2f{GiM3Anp+xw;lD9yaVaA z!AL*D;&hg=PW5&b@zieviVfA9(sZ@bgay=An$#EPJ&eZ~T5teJ^J!LIf)LlGL8}PD zUOve$JN~~{(vH3i;#QQ`1cT($s$5ST`M0=$v%)vrzZgq`WrVdK!iN01(VaCyC4 zqkcClMHK-UnoBGDyDaPp%edwf* zWgVJ}hq@qcadb_hi{e++BoNLsS&RJO9fe-^Z0Nf1>EgW8E5ZXxzj2HTuHVDpQ^A?N zygPB}TX5%|uSmj=Aa#=>Vb7ZKaTcHF-6paU4~tzySuZY+2VB_^W!+2B&!K|`z}5gz zsAoY6j<1qFWvqS?!dFops9(W1)~NKitH^NZ^s3j~jy$1%ZE5tHMJc^zVOp;l-hf_1 zeAK@_sra@s_#lYXzqU!C-8zkS!31bi`q!rw??QujyA;B0(+C$$fYA1br1P_iZ)<~Z z2Vel5JEqWXpGJ$BSV#3Urjz>I-N0-5+3Udecue<4Ujf@ipLdq;&OVVh!p8&1Y9dtdJ`h;6ij6|*Qu$Re9hZe+vc8q^g zdGH7DpshX9p7#ADUS+hg5IADcRR8b{VO0-%HzdyKAN~mR(mybtHigW#>(3y+XNezDiJt%-*pEI*bnJI*d44POj56AiYh+BvkKbuL z)3wA0G8cFyNx%A7nCI*FW@$_!{OaXgRo#t*TTa@#%ZRV<@0m7{J@Mv+g93+CUnmlc zLGmigqDy8=e4InzWQL(!eZ1oxDOxvrrtqJH*1)+CSF*(J53^W$3<Cim98$?N4OsNj7|SjAifEMf?b1i*sCgFav4t`SL)!5&7r;s zUL7SmdZDsnN3RH`HQIbcMCTx)f}?&Tv@jS#{88qCeFsP3vyzQIjclQ^_Al=)iqjV) z^~;GZjs0473hG*u1)}{%pFx^LFtj{+_CmfD7WVr)0X>oZ-i{geNqau66{Q4E^jV}| zeLSkBu>-pEbiQm6b`7A*N%J{}LMulc$9f!?yV_uMePRk>lBH;=e@mZz+B|z5e0O)i zN1J|M0uvLjG--Y{#<#79C?5urv>W6D#%}EoVQ>B`>Q~2ZJ;Qst;$UzPos2wVDzr`8 zGTA4`@1>x72GeEw4);fsq-v>?sSu2M8h#u|FVt9?J2(lF%GzyuS}P(@#hr6_NX zz=!9cE54dbQ!tA&v*`2SF>G6hp|j|qcWTR}igy zaX!4ITh0!=rq6btNoNh>_G?6q8y4s|?J8h3Eg?dXVzOXE%s z%snl*ZCRH%FkhJf1~wG-X~K4_X{5@EGd*j~zd_p2mj2F1UlS&p4A1%;NQGxK{2ZE1 z3_Jm`Zx;(|l62UvebFxkowBzp@(sqZ{HNC`VZQmAFzE0Y()o6n9 zYdH>9*!u~KJ|_k1&hrw!sUOp!NC#Q^2GRx5H}UHnJecOQ!XK{i4+#8&6T>fsv!=j2 zjNkdmIx4~+k??P|g@0SZA8iYNOu`@6aNCz1sdUu9M_au{*HQiPXpQfmDE?TDA83vL zB$@+}q7^Z%Gcrx%r=0xsM@|mV*9|V7?mY1gKRk2Hc94Ssu9*@x7D6 zwfKNzXf^^oow{(z_nC;{(ecct5IxN0?0bDLw_Nj`H%ih>_*W5L&EUM^Gk``+8cqV) z35~e_$KJcg$#qp{qPtpe$(F4a!ZvQnZEUa|?6z7@3uHm7)shP&wNSTg2srKPs_Isu z>Z*2~YDtX{bW3u836LQ%H!v}|B#=uUCb`_e4FnwWAP@3m@&Xc=KoXc_2J)QCB@hUi zneSU`ue0|#RV~?ICijnvQP(;9x%S%Ywbx#Ip9Fa?JI`8ZltWnE`~(_(nG8pOcsEL* z;~9AIzChhhtMP6u5$vQI<(b;@*SU9oK+mYfy7^gXRCV(TIRH7qaW89ri|FV%$J{17 zba+l@M0NCy*n>ELwo8g9Dfki6zEyVV&OV%st57oC+0QgjF<O6~ecxejGh^=Nz;#k+?V`<6;+CTs$keh*n<>{$3`w z~sJhv5f3=NOsLbB=)tnTq*(&q2M5T8~i%J?A9y;2fXNaTELYuXgT<8a>i}xC!+i z(fah}_nf1LUt)M}?~B|W9b+WCuh)8X*Y}*GC%@+$9r>Axd3f318?_$2@;&G1sn`DK zF}^H*en{)l?cQ^a9{HYgbjXXV*(!GH@6B3|p2ePX^fqdL+pg5#4{JTT4tvhgtJrgn zPQ}~fitI0z<9ks+<+$1oZd=l0$B zoBVN9QfZLuGxGh9Dcl6b`}J*3>H(2dB> zl|m~&-W85FK^ulhYL4ySMcREII>5fbr_oaLGx&43u-c2*PR}`M?i^p5)0o2ZLwM@Aw1hBl3{pECLywH%UD}^CcaF7_KSlFzA~KAO zyuH&S_VrJ7EuR*Zvayc%t^X@ocHNFU|LXNaU%Gw82fy)m@B2by-?eY~^?mRAzB@ns zS3mi9@qe2ueg9vc|JJQ9+`03wFaE^Fx9nej&!^XZedKpuvEuo!de6Ok&OUtS_MiCW zw_Ww6fA}x2`{mzz{kg0E=6q}M|Ni2wpZ(3ZeCbytmwPD|n+;{jJ%U}6B z->f}&!`+jw-1QqDTi3qpQ;&V%?>_MTwf#T*@Mj+X*b9oYANajHKe_GxYu8(#f_AHDm}c26(7``_Ka z`nv!6?Q?(nNa^S|fAvp)t$oWK=Zk;##NU4K%Ma}R!6W}^&%d-D|I43y%|AT%wmZM} zbG^gwoBFv=d~Vg}U-@}=;}>U#rk;4~4_|s>=5L4Z`sda+dTzV_9Y_DKe(B?Hz4X;f$A96}42-74Ke@5K;rCy>y7sE;R^9ye);rd|_D`Pq_Q$vV z@H_k7y70NJD<1v&4}4+dvA;UE_bYvme(TOJKj&SQ(%u(*`P^6AZn&rMH}0!{@Y#Dm z{^v7);#?BjX(Iqw=Z7!{OCU~|In-6 zzxM7=e)T_GeB*o8fBon7e5?P5p82s4|Ndu>3_o<}q1P^Z?#sWm?1>-zoxgeBw(Gw2 zub(*ni`y1o^sy&?{NQKyzGC0se0=XuU4Lr(KR)>4FZ|AHCLf>JaptEg<;{iuIc z-cLH>|ELE~ZyVS;uygC~Z4CZ{%C6(@vG?Lqps{wV)|iIT?A%B3-uL}TJ2B=yTPV0^ z!FkW7TrAQE}tPtL?c~6-brYwm^R9ie znpE9PElJS1D-XKzHaA;p18EJ{s!pR=tHvmD=ebNpnhdB)8MjsbE?Kx5T5UT3SNc4@L+9hK5- zT`G;7t(ND2t(j8044RwkiRV*1!O?0*#uF^m<0Ep9KA?Tj2u#kKw3(r zAU;fNZkmb^0i_0nRGD0XiJWOx=IYh4GUP!DM-I%yRVm#>Rw(k6fTL#&z7FYF@gRfS zeK(V(q*W3`#NIt5Wk6nXApNyZ`pS(}-y zS4r#WU+HhWITZNcv&CE)lLdZJuE1DlA%;+i69rU7)0N_Arq%#!pM{Wa%|J{Y1sWh{ z8}q41CLw2D_Rr5k-a`_wRfyo(aj37MR$)hi-4rmAQj^w&HC z{&7N`6o$|S;EbVGs{~~t&&McVm?f&xCyHKzNM(8*g0v1v>l-X z6xE+~UrWX)ZOfofs;&~d3oWQflv>iZ)jC~knKE%n?bTJSC*@Qf3Tdh21n8c?qAZsZ zz*x0D6-h2C-fF7_A>!3U8!6Up)ByE}DF28ZlqnO}s3s)*2K4tf5dpQbfF^UJ&t4Z< z!!tAi*mcwc*>b<1B<79G)Tq6sS?$SkOO=WeFnE2YdAjOfo|Npq=gH}}Jy2A&GOUd% zscdvsWCkUOjX>#`!!$TSJRXoFeQH$C9H>s!8r5Uo+R+ll##9sYINgALO_J)&WPM(= zEeYzBS`iMW3#>1w_QX93)gs-8#aI-|HsXU+K2@8w{*Khn)*4bzj0GCU+ayie4P2Gx!ZH%;N%h-2#T0ur zIM}Tm=(j z^hz=ZA-?W|1zd-%*ClbAt9t&_>B|s8K$cC_j0lg>hLUVV(ejv%Ey_qu6qwgyi7HrR zon-&K%o{ALlwHcD#_?*Y0-|k*CFLfRq+v&b*SKhCSI>f~x|CTRx7rm%7Y{B zqDcx3@I)ImOEM7VkW^}{CSFf?##7q!FI5=pMUnf$AGNZk2a{mJ7@%4afdI>H7CIbi zjU8YG1{Hf?z9B#y#^Af9V+{nhNQy8?^wHE97A7MHhfW+GpEy`NJTh@~=*UQ#GBh?e za%BJEmusq8WM13~;RIEj$%E3Rjy54C3i?d7bSjgeWsZoIcdP^(fF+{WHh56QpG@@e z2V`X04<8|llG5qwv6J%&R)%$J+d;CHusU`po6S>@9A1*?=u_r6lMwu`x>Zw6vdXB_|Yw?naSPed1WNSs$bJKTQ;!^)ha9&eQzNsXo{5sVVUb4j~7|Sb)PkhD4mIP0x9-v^ALMvLcbHEsO`oc_QplD+eK! z%s0x%u^NnxH$gHMS3@(CXcQ}ogVi(Du+|v{`PC|1OieA3KIZvK3`Iide99iMb9Lg1eND9Lu$;Q;jnzsh zCgJBwi)o4?^e7jXKr#Ge#K|_uInc1?DS^?h#Ke~1w}5~V51L>v48!<<)`$qqvbX`p z+W48lh!S=3m20l#tw*6_%aAJ6b6QvC8GcE2D$phVneMhRu+&WTK($_jHV4vAv}&4k zuvV{zw^ZgPQXV1~NSmcBuO%lMSj>R0QNEU>1*hF=Uc1}zTB4_u+#F3GU2R~MCGHnj zs+4AlJm`dxkm`jVY0N+B{13x5Q?Cv{jhAL>WzhnB(TAjQ3ep{}Jd6=${6sM!QivaU z6%Q!W$0=Qr$!9n>_E)Qo6A2|!y;_2UpaS9pCS@JSH^p!Is(98{*miKvsqaq!Ola;Q zNiko7bWGeZ9h_>cjA7YQf^V{lsS~vXg{1P)FKh>7K{0X~oJr_xUD=$S*k5a(sU_7R z%s<{B(y7j&d-&$_Mq7M22txD&naTVLcXiGiD zQ6Wpx3=CHv#>jqnlV2hVULDXPv@u_f&cUrC56yP^%yEoPIjJwRM7Nf#Op7p3-Drck zx+=Vv5d^#Px{0(ypOiKIs@jaz*NV=u^zJ)dkBpM7DlvMa@;7?CzF1nFM zMIWqxcer+{>V`{nRzW2v>e2+ka*U#^jZP%N-0fINPh^V1(#ks3SsdDBs7!N-?I)!7 zP)s_As2c`cdm?_<{#YCG(VXzwZ!S@5jbi5Mr)NFdeUMLM(B;Wg&5uUe#P^%?+H2>z z#4uv939_wWiu2HFuj6nOtLvYQ=F`}wN?1{-i440VA;!7w@dQ5tVGlwySi1sQw><_yUbl<`&4@O<_dE7ZjbU447UP(O!e~^$;i*j5mJHOhvw{t}%Ywls zwRO^hz#b16T07mpgQ7eQUm0)&NQH8Aiw~5}-9^8%rr9RZJ~q#VBnT zv18N4iZvHg6^WBw#Az%SM&b8K$6ND8VF8B+0KSYx+3**$(91rMgzhuy+Xn zn7a)topuKX4>SW_Y+OYQhd9u=6*t#mtW=#m4eJ_PYhjXQZxGAAxykfJI5p(7un@^4 zL6*|bkV*4qD$^*1jLXwDNuAnECR-my3dbQelwl6@N%LSYT1?>4xO1d24v%#S?Al0Byl7=8qYI$Oio5OaaIM3RE; zSVH~G6pldzsk|`;AbNDVHN^v^xQsJAByk2f6uUlHIty|clcCE4!lJzp1`Q9mM_Xc79&5rc;wS&uTmr)KFR`qGV)G)5 zPb%2>q@+Vuz^aQcg5IbTb}B>k)DB-zR+jDOngttxsW=3PS=K`bY6*k|18uxj3BQ+u06RuAxq49xMS;Qm z?T2GjB6d{t7%sEeHpRp^3l@hBfjMt@GY9?nHcZmViW-Z8Hc&D*8;YSnUlQ1hWF2&n zS1$*#X*o1IivcrOK@?v)DRBkDIl>M5<0Y*3T26j^Mf$bP4*X>6HRA(B(Ymg>qV zRh!fz-1v}K3^4&l&ceT!s1zw@^!ha9#!bSR>Xh>HM)q*9-tf3>l$QXu2UTS&1M&V=}|ApXs|(g498RLiItqg|kt9 z;b=4~9hMr9O$iU=`8rtpNwe%lA0WyY5_7s5s7f=&N>f@S2_~NiSojtcZGhfu%FIGe zlFh9UF(RjBs9uj!I9{O`@S~sArOWuiqXlRjAMn+!Ex`jwFwUbJCROT3z|-SRGuqSS z?xXP*0y4Ed?uAmT`2ZE)R!QTCyb*xTxWF+Wb!23FN|OjIwSZKaV>?U(S-UQF(Y*z+ zVL>7_$}kSBhq%oH*h1_!Eq)+ey3n|BOO?}%CFTj4zVo=tX^{7UW*+4%nji21ZgQp= z_aXwy19qVVX&El!5MWpWqZ)1N5$X8?x*z*P6q+_OGV?KD35E5V}JJfs`or+QqH%k?aL(@ZJOb%~j*p3FhT5KAj5rc^j z77-x*r!NGOn-j&Uqlg6Y?vK#I1K18JPRZ7_4CVefCJl|o?{sxwpkddLg6PUgDvT=? z-B%q75m0{dqZ|G)_PteRmLVoM7=)eWyui~U6sSHn-B;2W7R^nSoW80o$1G#Lor8`v z+nGxGCaNPKR9%~Bl6laj12<~gq@&Nt?r*s=_<-?RDh4u zaK6%hdqv#Sws?nLqF-Z|B^siw|5gl1o{7Nxs zIcULh70f9HwmPOg7PSOAisdDVQ{jXd$uNcL51)iJx0yX5zzg^*!Xv z9;}42a)+1>JiqmLOwIt<z(;MD7uzCt!la0kClWVdY5uEFg-FD$}i=T<@nwf1Qa6 zinrEOhzG`r#Ju0#g>~cUh-i_C(=cz@B3>$2g~yo0$;zaQj$-tn zajffAbVsD>F`6-JEG;cohZPbDA#eBiE`p|3a|lq0Ppm_Q(~_sF!Vgan8Qe9h^@O^0 zPKzN=t*Nu++fOixNEo{O)Fe6DL^u)IDhr~$dOJx;O1QOHm3oj^e~s;Ug9%o2>3pXl9rnX-)0}Mpdy*UB(6udRG-MG%MW)Mmz+4taQ88j~DaB=zMR{tH3U*Tr)Q0Gvwmw7(EAC+Q|gjyVv_W{g`zo^VMc*w2Cb>^X{yb= zUoOb5v(cyWYucz*K!jJr>wTpY@H0YE{P|lggWV;G_Jz#^2TOe(hmeVNW0Cw(0H7oq zHR2ro5dqbR5n{axrALyxdV(KP0DbZ~dhb@GX$Oo_uIN@u8%k%{JNHGn2!p6+K7F?t zNYTVe;r<%h#_vc+JM{%XVI7wBz5;g8Z09-s)w{vrRAqrvJe!ir#Yqbk}570 zf96Ahd{2o;r4b=nI+ra;Ia~I1U~SgC6UYY48m z;o|*mp61dMFf4;m@XULP4Bf!e<+R!XVZG5sfl&2&B!Np1){kfmp@u`LzQI!jQNpcY zl#r8k5KUYo$}^!Fs=NwPxglpQFuZhUPiCWNXLMK+Yc@Tn!xvu;Vl#TVi9IF1IIQ(K066Vk9eu#jy!sju6IjR`CO9?|85LZ8I^!Cu2@oLWUIBh*O* z9@_(_^i4yq(pP_OiSYoT+}RrK7hef4Q60Q>t1{LEM(?lTthw{qK%pGk!43(pD1nz} z7OO`&HUL*ybpUaj*y)%aDDt7&Itb4i^vi%s6(SGX4~Ki?Oop6%f}F#Cik|^V8IfRl z9>kbxW^$QenLIz0$z+0MO4N2HS5hon&S7P;B_)$B6^t%;ZY$G*4riEWwsf2T)=nId zh1($BSd!@(FwUnwarQ-bp|(@@mRFeaSo?qg5t`9Rc*R2~e+YN~$VDV{UzlGW!5ElP z@NQ=!CWt#v@RT}6F>wpNh2t*L58{O6ppH%kyvr4s@v}M zUB{{kE^KUm22El&JPrrT$5!{jo@V(aGg))wte%OB5Y9SXl4UrVb8IYV_ztj;TB1{M ztd{BkK{KmmQ&`5^^V1E`-&lMsG`_#EaA`Nin%lhQ*<&`f| zIiQQr=#U~SYZ(;_d4D^hQWGoyj=ZNP$N&cM$gu$@YY9 zKtk<{m=+0$@oTCyqux%hpm@%awWI$YT(0pu}G!XR0ku=p4^(C`RWupDMAuKhFS7Z0T8R&zAlrLcEQ4MdeJI1U4Y>2jy9q|Tjvh_BP- zI(hNwXb(L5w6vpE^wZK5R5@lwS?lQ-B4Prt+&l zs?f`T_7tWQtQV~)_on+0K2U$F>qy!jk{Dj*Lk+B=CG82NNJx4VhGol3WlV((r~x~0 z!zzO~ZEo!^ar#7x?F_|2pL7cmu{@F|rS8G*jGRB@8^&j65-=`mtyVid8NdRFqUe%} z(WR-dfas*JR#+UP>z<*`1Q@kA*(Rz+VSvBWhs&n#2%ANFWxZohQvtdUL&Q_D!K2Y~ zcI9#r9vGQy;djKG5X|kDWu`z7Pr^>4P_y90E+knDjSZ+H!54xG4fs+a?~PZNX1K!e$$rAfvK0AH3j zgZyr9YIYZKtrP5GnlF-uUybE}V8nh2)6KS&jRAG_`cRo^%+5ianHM82wXS9NOE)mF z??J;!J$|SU>P7g8ofv^ zufiJ|-oj3?GKj9{Ws2W?k#k>wKzt&z7+XUFTBJiAJ&kzZzwf|f1=V~)Smm>6xH@>l z1EmI)8(kMDN(&PKE-Ccdh)f)Ad?+^HH-LLau6Bg$R(4R+4NU1Cogi{dZhu6xG}p0% z>RybSj37MZvhiMYd;v}gS z(0qyb)iODn1G1)weNHhH9eH(5+-gKmS$i&|YUcqs9%>LY@Ji-Bf zxROlOEBN8xv9`R7wKa(^CC%awVVgL@F~}1KB@bx|hb1W-mptsShn@DY%N};y!##N5 zc>RwI`)~#EssM+7<+()NT0e~tZM?U6QzPz)O+K!bz7hJ#$!R&iAWCDNAxE+pX3G(ED4oV6fGH~;mg(S)YMj9+SGl>E zP<=5=1ST%FlMrlin{uNAP}wyQd{uihP2q&+r#tn0iVV-^DgdP#w^`6$K0B%m!BC+z z;xCJ)$jLQfTZ|#uV=3MLkO#Q6PQgtb7LF7Hk|Pr&R6}|wPaId$InFoqJy9f;$pfiO z9#}#itc=uQN?PlL)jDCdPV7)o%l>5WSy{}puyEa!{S2gx?cbw-J}^$Zg@aPS$aXeP zB2;+Dx7gyq`xuN@Kog7rk(N5SsqP0>@qaIhWH!vd@+-&#dG<~$yHCdv8#8{G^$syur&e35?d&V@PwR{IrFscuyLo?tTKSsPL z*Z6l1Ov=SurcCsalYaY+iqhZU3VW9fs`V9uJl~|j8Ystw3=|Qblt7q-<30!qPWOEL zT_P;ApZD+KhJKccI@-7m>D^I!JOWK+xO4w$#x)KU>j({uqbdOQLTCu|%UxnBCgp18xu z-#C}=zM|~G>Y6A)>d;)fd9cpyIw^CeMw32lyy>F^mgwbJxWP-TP1YUL($XnU*23mV z=>!+F{vAoelJr>ustl1 zxjrn))$5ERl`2@m;5!^RZ(!&jLogw%0UY4zMs7r?0R!i>a+Y4QCw;)J-Fn$f9ReIX zskqpYyY$3|U(jIvUc%Qh8n8H;4cemjvvZ&T9}mGAN~l-~FfRm>_**Ii73fY_fR5Ur zoZjW9>{?6TgBQ%cvJoz9LruVlP~rk(X$6j2h^g4kH+#iqC|xa=1zGjRJ< zVc%eBfOGFvf0>hRHNle(`x4?(Kdyn^N;6yaUQr*70`~P^v_Q0uC`Q~ZTb^+<$u!z> zu$^b|hgua&3c1XNshWAK3LoAS9f0k*?(CcihMZ z9EB^o`NFv%lDQ8j)9o)&0O8EZI;het%Y!syQ>53^mKyV1KgQjhb$S!0t5>HGJd%Fa z!P6Ftr<0GDknEcE%qeW(E^Zfss*Xc){)BSN9%_1h2=pD}_+2vTrZhTZM%KEt+Zp~1 zDZ$yrmF4oq2FGu}B#@-?odeu3Du>u``|dPMdmFf*Y6@-+H%V6t{$GUw4%%(m6K!dc(a| z;YbJ#^MqY^7QjPF$&>+=L_-ahlo6ESrs^fk5zttM!9c$bI2oNwF9J?<^DXx!bFXd^ zdRHAg!p91oCngn)NQY3fz;wemZ|6$Syb0y#@i+bWgrY4SN}Q+{@v0PBp)B$(6IuY@34$s%ZqbnmdYg!6 z^ANH*W5Qz?!u zs$vNGp=n57Y%aH85|2(v5|x%;l>3XjSwV)_y%bsn@IkiYV_Ino9N*b_^=e5IMkt|# zC>)Ksb%|`IOF=4AFsg_(gj8sF^=SmUP1fk(J1AVM+0vGUwy1Cu9F#myq;p^q$0k2=mOxJv{pJ_MF!a@4O*7SR1% zsX);*VTevcXiY)yNQh@eR|9Il*%kdzX`ru`jz`Sq7%izLLA%x2oKLCc14Sf=0{T#B z?W`CIiJL>9gr!BX6|jOV%!1#rlBytS4Tb){PMRlGaLXV%)19Bq!0JDZXq(SOYV$hmt$*qy3 z3?H54uR=h$u>^|n!%TK8*`lFz?H@{r3Zw31Gm)mdT&tNnOEoOwNiLp-ZIa$NEg_p` zW9jfPc-;V$!E0o1?vCD6)Yy%?r~m{+SLq%Rv|{~hH?AmHet%E|e7GqW0I3bAl%|b^ z8*;Jg1X+nD4j(fNs)?5wcYX)Y#xg|v4}VloLBpW53=HdR|0%mP7t5xcnG)2IN>Hcc z>PQA_!YYrXER8?AGtXarr|W}oah764m!A<~`7R>l1BrG~Woq0bP4CZ>_TtVIu;io8$OU?V$vWAR~44sLB@SOaY!UU31kw!0|Cae z&diZ(GtWFvXzF(Y1slg=w0@-)n-x*t)~JN_$e{d}rxYa19y7NZLG1EbCEV&ytJn;g z;ML2x^dfJe(0}G2WQtwEo}CsPQjI z(~%n7O?Gg}8pyp%^;}x0EQgW8*O$_BqTP=h$soid1Y-3AvzZs0)0+j##q!rCD-A1_ zP2(;nY`PwzL1NcKGMLNG12U2EfINJV-U1L21JAd7j)xCb3h9Tb!Jm;tz(7l4PNnPUX# zy5rn{nl3W^9pU^Pq5PTv$;zd+_~9U3f>hImgoR3XNcWM>P<60#^j#IAJc>L|XF%8r zk}&_37ggqIG5>`by0fyBgLwwYnZYaqhblizlf-~)Yc_M56eOKnD!v;ue#O}Cv{8-g z4zF-0Ln50EfjuxeYNleuhQTtaAeJn2nHdq@G3ZPjG?F^wnibn(GMi#eKf0oMY7wAE zISP+2^q5?qPf5Cr_-`1>WN5Jt)d>yBL$kIhA2{(rzu}S-ei$wU`}#m%3G$UD{IDSj z)Xvm^TmNm}KJ|fDx-mBVjAC1U|2Kkr&j+7cDe#kVw@7N4F3%gL$07gSQ z<0KEsAm;Fe?T{R&;v+GjLb;74F5r_S*MD(4WCO~>rJ2b}DI`IA*_XH__9J>%1D~q{ zA8Nr5FI6j10@@oz<1U{QiMj^Y3Fg?MKB+;EXZh4Nnvc-n zxI{q~*jvBmK#LN6D;37;hb~U-=)3L%=^6!V2Jyk75gM|LBg@`-otAXP*i?-h6X_;y zoAi^COBIdM!A_n2YK$$BIfx2MxCbxR$)t&_C;7w%b_N5oSXFl!RWMHpavd5E|a)dpK4Ilqiv3x;9Mn>O^h+k5B6M7+PN>^C0@hvs1o6;od zGy4`VHxB8g!z2pX285R@-C^+KDYCpSu5@`6-WfETPt%oCz6@7WAx(Dsmg+CcWYn%0 zACeY0^cHi2P*%Fhi8eMN;)!MgY*enA0;bis85i?2j^&h0ppGD} z5j3HekO_(si>jtOD*D4RPdXj;I~G)PxQ<@7S4?W?Qaoi_>5Pj_Sql1l&Ew~ycIamW zA_+`E*9D&PIYgx`?Uj=mNhefj$vWh8sjPdBIy31GewJnmC61Gin!{gSa_NA!S&mVbT=+=MMpVCbRUYwP>BBFHj>4cK5h>y7Xi;}#xtv+mCC*kmXv%P4cmoLCXMsdQct~LAw@_{_FNHXf{ix`49F*j zcL`bwwPmciSM|aKIUg#cG=qI3=)z+tCA&GHP575!6}>J zT?(a1+3+~wX_4K*s8tuARY34|ou4bGsb!i@Y9Z88U2;jJi6o4%GuaE3)Nb}XY<;LR zQN|a65v5u|ZCSbpYx_G0qAEUd-pWgeV<$MllO|1ZY9d)}D9Qbrcnk+%}6RQ3bu3J@HK)JlbxHi76R?|Y55SJN_))opuu(g>xs zYVWkDx=Uz&rzH@Svt*&P9tm8yRAjOoi^e2SDVL`F z*cHj;;CcaPjd=hTAn$qapRD zN*ZF)5^qxiKwdW}o>LHAaFB&LJVrucK%JgDvF3B2N9Ch2*#dz9XAv$^H(D4^u!r0Fdvp8p?b1}(5+U;m!;+dP&pwfLQqIl?=C(r9g?sFfNc!~gd`wE z9h8}*@UiJAS-wae-gAz`kWo~NNWfP*Hky&EWg=i?S~^{F8oDFA~+ zjitAXLP0cem_s8G)KTe*kOnvg#E*;neQr&FFcWzYZn!Z5!d!4?8@8I0Z_TtzGqZfb z`4yPZvLneyaR7$2;7G!1#^1#=hEE*x1>fqHunW1>XS_L!_T`ikZ{ZoLPdEJ?JR~J4 zBBkXC7{Iy)bo^>&(!Qr>SD!K3mRuj}vUl=iaLeT;7Rg*)>kTKm{ybRHus!4E?zs`= z4)}%!v?iBYRyW%s6#v!%NggMzhzcMTJMzadS`u)LsK?A3P9})A);Avk>ryBY`pTdO-5t>9 zAWab3nvqMY8E)f=*O7o}&_w1U^6}rj#_%cr#5!O}~ ziwQKsR2>UK*g>>O@$Ef%F16-|{Ab)T5s=bqjdkW?Ng$CR63s4qu^`^mA1zt_OT@ur z0H?pX4pJ||c1znH%I&bU9U*O}rR@x9yDV*2NZV~`yF=PNmUd4_+hb{aLfRm{U914& zDTQ!w&|GP$=V$M}^27ukhj1Z@)jkOKR!1VvrsvD;?pChUS+3Hp9DwR*a1hrRq~4DOjL40SN;|sMDRoO6+=^8Ah{{-HgMg|PY-Rv$-0gx75uS4)4St;-1Xosn z9_$;v;RokUz!csK)d9pHHY*Ua$JL3*mx`raqr9TZlz`XW)4iqgwEM6`-ifg!2333^&mXDaj(}4}?xF=20fC&m9L`w&sjM{wUQPsV#>tAjx1n9KFLY%bv%TSn;RcrnN+*%P4E zy$k2N!>K(^m7JX8Mwh>bW9bxf9lv~C1|bI#l_2bkw8`CQR~+Ii>_47dijVb!J`%sq z5DwfApBcuWX9B$Qk`V)G0C-H2ny=E*hA5&lT|XfxmS;^Y(@S((0I7hsyntDbM<^p| z#^i96q%&jQBJ9{?z01}vJImLyJP%I_OH^)b|2)o+U}gq)Idu{td;vioRVNuIG>1P> zC;Y(-c55e1vpzjXvguI_gHyNYOQ=tP1jm{6DYeQ>d0d5w_7`dlR{;i(>3IWf(`a*8vwre+zK zB4sbnb~?@eG9aHuIPH3%yeqaC`~jl2Q~FN9rKk+D1IVMM*w33Lz0fztHZ((D;jAXa z1cS^#{aApc;2LY2kjV5hkQPe@v>vBaKA({A7HP}{Jobj)d{g9Rtn30tl)Y<7vjOt= z;Fy@q9Z3)4GkxP%r9o^-)FpOL{7H1Q=RckRq98qZxg-n9ROVv!gxyDeh9&eM6vQbJ z4_@rFqa!c!{{iaY_@f^X30%7hneoAoX~d4F6cvA9Yz@ux=c8jgK*L7i=Mx1;Q3d-- zsTbN%AI9`ja*<&nC*7r$i$Ic*ER%?KY3>iYWu85#MRxD(92L8uQNr37%7`iU47e5)L`B z8QfpZ>S-~@oV@xfCilx(V!BYNV?<3W?TOg&`iE8p?OAN3C>H&T`4TLC4w@cb_<+V-dBLhkV4G3L~H$UjPL&Uh&h(yW8=8sZT;ll6F#SbLqB(m8_A zQh{QP@xqfV;5dktuCa zc zv2Qek(~7NnZPGcnSbV^p#KHcC>vwYwhgR`4jprd8u$y*!-MHK5?!<}e!C?07uQnQVxNu>6>3jR(>OE_YQ_odn$a7EN->v3-b=(Fl@PeYfS!)O&J>AU0{ zmp=O)4+iGj8wCVyH-PkWZmTJQob(j;${ex z<`8jVhD_A=eo&9-V8VD*dobA16u^mRXTT}p+%9-+2yx+ntYBBk?8$-mqu)7rfjfw+EO3|S zkM7iNJmNOb0)LahXAOhv7mmawCqiDgxx$LukXG0<3%oal?s4E5nC^GT+sG&K0(&6J z&N;X2ymMW`-p=%l*!6WJ}~5_Eth$Rm|GOV;zaCP{x0_BL;;6F-@Xr zzRx0`Gr-2#2-%rTADB@&q71&U9Nb1Cb;%nu(n1?`ICKDUQ#TlH_oCnq=TR|~ zuj(EK3?#sQwARF5w#VVBP^jUJeESOLR!}&&We)-oObduY-c3X}g_PE(kW_l&7?6KU z_g0xYhqhSH-NK22oW?&*AwoIY1`td^#oqC618%fI&IAN0aW#Y9yVpF0Tu!dr9H5&K zID^OsY-^09IMs?%w~jN$eo^~s)@ED%?%99<|27fs>===H9pSFXteMP{8aEOzoL^NO znY@ji_;(xF^E^tc%$#=a#%ZA_B{0$k^H>VdZ6eNa@kuuI22}}NT7P&XC-T{v5&mtS zLdYf+jFBxjz#N>18T8l&b&vwX7)aL?WJW=8OH?CZtXgM}LF5HyQzfNTPdKzTX)fDG zTvtmQgMKGHS=}eoPk^d$>U%vV_O(s%x9$~wR={}+ZzLnc8oM78M2$f!gruReiz=6_ zL9$TA+noW;Hn=j{LkSPoxdXxkN*t8uWRQ_moFve4cOXTDN^Ccnh#*@8wWBssXFJ*o z$H4Mc5JSZkZc>s^;WQ37I2{yN6sHh>#c`0S%4w3P2{DC*7z||z4Oz)pU#&SK3%Brk zRoPT4jNezZFCyOI5;`cOiRWQ%*XQj%QjC4gJ_!Vr+eStXiq z!vvnn=wb>8Wk=IUJ&rV{6I}x^JgZ{2wuA!7*z*8l4!_x%&bGzLS{fm2<;kESi@2Cd zjT6{Ppgy2g3%vG2j<+>JTfDLg_lpM;}oj}mgQ5GRbvV7;->kLYejANywt1j)! zfF(MNWdbV!#Mg}jKIV`?l;EzU@~lnv8(1c*I#p!_rp}@$66rNgI?*+WUtJ1y8z=3` z3b59xfDM{#51nlkYU6(5Ix(FcNvu{A)FH>H-K-Lk0*%Bt4R}g`TM2Rs^FZ?xhR7!=@rbxKa4YU`FL3UKd5lqng|%3AETpkXz(qrrQlSCk zOii}D&T(rLXNhxjM=|2O9?fI)@@A3EN;i$%iG{@7>s|W1geRx9kLEJ8=WE4se$N^ zVAw4Tg8IJh_M@faC^Lm+K37*1^KDnSdID>eA(X@ARn9%gl^Jy+ErE&`gW3K{82T*Q z(?zARnu*c;D9oEeRJ!M}|9F%~q_0zeKrQOMUfk_-?wUg=i#Q1{3fJ*0-_M`lTULW~Gv!W)ojqBrDr5P845 z7hcVNJTaXz8=JA{EB1rX|HR2O{dT+Cfkg=AFX1&@m(f2pxsBFDNhjW@zc?>s12t(B zPto2VyqxLY{wL_LX-lbCM}YXR3|9VuUS zl1pLXBXQ%3P&THhwm}*f(BLCQ8H10aW7UB=Af-wUmQQg`Rs@j2NnOEQH#(&VQ}3GT zSZV>nLy^IS8EKZiVO?2_Vb3DQNQ%9v_+%|2NFgobi5$(;#1%?$OS)M@QYCsxZsrN6 zm{o3xJzc^7Wq9I*WVeM1J4Ya3^J`_6U#bU^jYC8j@nN{IQ3b(x0PttmYFs#QR4k)Q z88FAyMYO>cH@%f^gs`ZKC6rQb=gbn@Dm82ii*RP;4D6MwNzmE~-WJ|Gyab{;kwKn` z*AX^6T~AO;%u<-P!9wz=uOLU7>{gta}DAk)O+_6MQuo;u%yC z#`((%Llr=VDpIB)BVUqYRgDrNv@QdtGelJ^bG5B*IsmkC14U?O|B(ILxfEU+4wC^v zgo8)d7?kd&%hhGSM+DNQm>TN)uZcEuFU%Skh68I^`7|s7NDeB=8p3gIGwIz-JB2df z$SwRlnK`U#t$C$J6HKf|Uyp6fP;IiFT3mG25o8LDtXo92kg08JO_`0(KSeaDm>}`Z zhSd$7ZsC`+62WAc%53dgg?*NK!g#auM_grPy#heM29R?A^UXn-4WnL3-Dfe1vO$@< zO>OrfP+r}yVqkqNUTtJWv0;-zGBwAc;gV!Y9CR+K3_~m#Tf*I2B#v!+hcl->lQ5J# z*ybf10!rpn!27WbGKR^b&g2xO3WX!lr05(1`B4Nj{Q;p6P8!j{Qe4ft#f?WXM0Fi@ zB7>j@-N>eBRLmk(d00u42;!1}`pU?YOXADfnM<1-F$s1vow`|}w?mxXBF_A~0h>-) zOJKq^(O?x0xE}+)A1h#WzqX}xcPQNA<}9NtFX{TgOb&vPb$xc9edEI`&jo42S|_T_ zAHz8f=02xHk$>eDNe5i98Pkwn)l;D@go&f;pM7cyX=G`VaHajQBM-@{hsw&la3-&^ zW(yfujT~E!6Mpk;+U7!bBHZ)108qzA-msvXfJVQ$3*7KAj4Ho19sF)eqOqFllxJ>3 zhp66J6ikt@b*n&^B+5<1676e}C%#7}z0;&}3r`r~=wdpaIPKO%hoV|1L${c;>DZpL zvRrUeqEdHKyX0MfMktCzf=o{fx4MFW)85VDWy-@uo%$`@b=^>j9UJUFtH`15w7OZ- zNzv@ib&j9JL{VxxO!20M%8RV!X;B^|bR!R9LLrC=g=35&2H+^I;J*p1D!XCCtx;`( z{58Zi_vhWI!+=XI&A8>jZb7vgdDF^{)ujpowx^aU8J-(KOxGSY-R)MQ4o(+pIJ0vV ze}<>KA$8Ts0;0MmRz!gLc~k_Xtgu#J3U>FBPWV+T$MmOo>vxo$abJXwCfIkf z_1Z~IPi0S3#iu*Lnb4N3w=B*m>dXet@{3WE&O1kAYS}G(B1Rb}#JpWfRPjEDF~}?i z82ic0XVHl)cAVWvH6fr(!9LV}G_-b3`{iLW=?^pO#IW76yz>i<~P+Kf{K=N*<=Q*qRzf|Su|Dl$4G z7Ao{UyBC@g?NqO~z&7CyE3q^r;>Oln%wbdt>fgi(CbWc^qoM~ns5&4!e2bqD*ZXfy7|Ejk@=2E9dsrV08V9yuF4CC{U{M{Bv1g+xTMCUZ&-&*1SuhO zqj4f8M1p`#5VsaAnXpuId!Cv*la>+1WDD_j+<2{IETpL2&2*BUSt|F&PQN0>%{lyY zEBZ0X?z(Qa7wo82{q8Q5Ds1XTAZ{bIUpCUjJ=ob-mL!Adxfv}RX~p=`84C|G4+KpWCsfuw|tBO?Ls9Uxd+xpm9e8CV} zk3FNu(e4!fX`i}-K}U)%@5v7;ph1oI=7pmvJX@Fr4_;@h?gf|2)eSLHD9(9xK;#}6 z&fu<$F;YwuYKjnYXIs|mDtgsZts8Z;eX?rbpoY)%1)ZWyt;8a59`=k?WM#4BHj}>< z)-Dh~$oa}H|HjkBpHhNahJ;;LH?)I-ION=_=F%M^3RH8|6q=V`eky*{`inj0N(;Kd zr=~%-H3?;5Od-J2ExO}uBRGf>+}^uSW(A+M!Wi7du*@Ez#0P)zkFtd7r3{(NHscs- z<-{yUsD@V$x$-*ciV|0rnCFJk57#WX2~Z5Gu$Ep8__xK z-Ij@g^vHxE$U)hNb|j~k3krs^YcwZNbH|XN)s|9O;YeXfBBls)cMYKpwr#$}yg<*C z9?Y^l#TxtQ&#+}!5up8bhBiQTh=RG(L!-==6(6c5bYVlmI*PHAy~x0Bdlm|gM1|C4 z;CK$lsS98#HZrmXd}hWcrPP|aOsUNW(1OlnXH0;*?HJ~PBA+bs5|qSQL-fThrUv%e z%^~mR0>uQz4B~_%Hqk;Ql3$$L`iR(5r9yV$o7tP3RizAFUUPHMz5J>5s=`1Qzv^++ z*|Od#@+k<=@?Eo_BlVJ9c|5KZ=prj{w0+KbUMRFvQB5jP{HsDF6dmHhyIqL&C}`)# zPWC?RxxsDHV+Tql2A|tBAsEey1b1E5???Y1Eo!&ysB<@4Ug(QB;(U@$!4)@Y9}}7A zk^8|*dalWBACtKYcqA>w6qz>|&?ev{CaJJ2N)qmw+u|`Dl>UprNJp6QE!|RW9Nr;! zb=;P_YgkNcsw|up?$YKsprO(t6}mgD1oLbqqMhP{>{b)vVqQGKCX^{uIq9)5yUnk4 zSf1&$dChG?7&zP@oNQ&I7N}9jYOi17UL7dy@q2FAL)i6V6B3^ zlayI*)Via9++qk1AeVS@*C?r^%)FVgg#jbEUT(SZQm6EdP|m-om>{ zc(Gv8JX8m?+$b6|lW;u*3Uf%roE93-_hp`ra4+axMv z0(_x$4L>$d4t+diRvW%9g2U2QM`~>TWT5DzM-^nOtL-p2m{_Cupm&jh!37+?Q&!E( zXRy%*(lS}u0*2hCPDoI0T@V)ThFIVc54Kz9o~L69HURM$3uVJFdsYsK#Kz4e7m^y` zu|pjcYx^-0lApUv>nz28)MB>zg&rhqnO-{;JURjs^X@ini*<-I+MZn(Y#1#uT1*9@ zjlta%Wd|9FfyAX9#f!F~cr^^gI0-$4nZ>eg6I&o;v5x|Gkx37FXFSq_zzr4Xlpk{@l1HLAFDpRamLV zvZ5;SW6A3GEC$qNLrWk?U7CtIHYIiO*e?8NzFQ6`RHT<9aEEQvaY(_&BhNgoKrN#N=N%cgUQ)Bn&naai*@9AgW_?pYz|X zg>JK>rm`CFYUf67F$UWV#r8XpWe7DWBl^~VPVy6p1kwL?V^h8BLSrF(eI~3cbRu4ak!QiEi zQG>`}^)bML}m-ILMEYA6s9jC^JILB2$` zdEI;GE*vF=g*^loGr%yfFF%St$xKW4-mPsS^9n7W(3YPH#80Bt4IQXl_*v5_4BFzL zISct>y1ZbN=55IB+?L8RHtRFeS(ixa*itrA<3degi_SKKqZ7eFj?s22+!oVuo)xyC z1UKw(XVPGn>H-5DlF<$2sA(HqV_Z$r?Z*3-a;s}x9$}0OR-LeIHIu>zQ4eC`y=VFVDsn=#Fx1D3Z9Iy5a*7-AstGQ$>eGz=^vdl*k%3Ze%QHs#3m~WoNTx zRsdO`n{HvWV!Sr&WTsB-*R35Gx4XMJZ#YBQ@!`tV+z7)NwOr0MT#OhcfZXrB4FcVE zr?X`#2=W_hoRLtzuuhG4UNh&`5vx=fXTffUGnZp&Zb?~0(P6+mjsHlUZp{Fo;Jdqq zEAk-U-8HnA&IAU!DcoF?^@;dZ{ov*E)n3>RK}Wk`2mJuJ?J7W$GU~&`21lz-M`Bzl zQdju8rjKiep#6X~TLi16O6-w(NH?~{$tN!wuFj*H~uc)}<`I3V$>(G`56dx27iwq8Y#HCpmDR)~7rg{7wnj~a>!OTIOhHRq zmtkhv7V_gHA;oOPXOaspQrnoflOYNpRCQ0$k!{zaNrP4WWMM4}76sa?b##93dClE^ zwC-w_;Up7>ZsEPd7^0ctHu&I&B$aTp!RRZjuDa19-8wYpxflr4qD}#JXG5h&fO}J< zH0seX;ha9DVd_R2i=15O?(HM^C4vPT##{W{?uZlS5NS;>iIYgayK+7XGf-e`$7M7d8{ZodlKG|hu$HDrZYYX zC3AT)Vz$^`qXgtE=j(Su9Vo@!kT0F~vD;vOGE5O>!3~}Oe##xf=`u`vcOE<4tR9LU zZQ0$OU3}!lMX)o~_ICW=+D*MH3Y&V@6gIk*`m<_N@4_X#^7l>t_YMB{Qeg{=t;P?s zHxxEp`t}O`_O05qVH4kwxuMW|J$`m*i!Uwop1|8NeOp*8tY5xXpVw$xJM`z6{w!7s zeJH;85S!%B7Kid%+-iC0edJ{;))w#=uM6)e^e*lU}h9trj%?2^B;{`WQhcLBfbonWjnFxCK8;B1ghZ0PChUHCSi zZk8wZup#XfLk^g@#17to1eW=9&lcDF$fZ?l^_LAWX-ffxh{OVs$d^anTl_%p;$Ad@dEerMl-Bd@A*DB@3Rym~y3m7~k6hJ*zA@fMp0P|o zz6y_h%jI!P&w9MvO5nB>w)AXSb}e4-T$#RZS>B6;9jl^*Ei0aZq`j*%Nn2Jv6Nv}b zcEP_!kEZD<) z?BPT9@FqO4)`iC{g%6U#GV+j?VLOuY9;MoQmC*(X^q^7ehQ&uP7!XYFAb-)eC+^=K^-Ruir`0RQ-asDs}t46_d0U~Y?@M63q zcMR9s7+k%ALZr|4eBrYkB4O{f$2Iz>BSI>=*lF9#A|1ybFt{^e7)5;e+O_@4fJTZST@O$l?rLx<|>0zr;WvS$hrA|2+#} z>g0hm6dovkC8c7G$O8-W;lelZU{Y2e*pZ~L3?HPr5#^;f=pfej$`hdA6S?J!1;K}A z5HoyYr;y+Jzy>9SUAzIXV^AWN0Q(k)HUQ10-b;Viv(arVpd0_BgI$loaz6M=e$!vb zC%yyQ>-!*KQXr%-K#;_*c*tbRzgVEcK|#s-Ys*3-&=aCbp%V0W*8jf7|1Rh+B(COr zO$#}_k*WgHcB4sKE%2x>_;&yM7=D%P1ct8^)-Sxv-Rj)(1?L`xf?wH#KX^YrHZv1i=4Wn$>-@9ug0;a7k7^iBWAFWkBBFMo6VH||>d z(Bm)v^Pz9u{@?=xulaxXZd?1_|MB|QKJWZb&fopXSH0(N*B!a==uds)@cWM}`tl{-*eTjPyL5~-v6t+e`xx(jibNtV=t`SJ6pZ= zS)Xlua?{M>&jSnqSl}N*x18_GSM$#`{DXf!H#|wXWz3MmEAVvTceD0R-oDA(Kigz; zAl^dPwdlQAhHXXM#SZ!9^Hx0H6TR)p14N zqx2598`dGc1KaV$Ai;{;ga68aq=L6?(k8tw+wgCfq?b@uA(_I{q<>>x88z?0zd_00 zi53VU9mpm0wM$^yfp&JFcO4feTPAlio7{7)g~DB0UK zl-~_In`O3%z0H$7TcyV`dMhKHJ?)Wp22qaq9z-iUQHmu?NSj0oVdmeRc-t*KF?|xH zIqDsFD&yZhsIv{__-{Mjwj#HJXX31aQoGO|A>lj!@*jI6w%8*_#~hBI{)dvl#W&78 z@k30r$8E?X9(JKTvBHruml!3kIIC5p5DqTd`BX(|j;De&&8hm{?vWmeOVZd*=^f8c zm5?JA30x%H(S>84OBcGWxDNoh;J7=C<&!x&qc*!R+ZA$Gk~6#X{p}KCo+G>%dkA8xUe{yyuw@v`Vu_ zqmReovr)}6Nnr)E9sXXfjhhPYS!@>H+vz{p!pFAGG+U?o@$sepfukeiIG9;*z4z57 z`Ej^5%LpKF4{k5GfzI^)=k^cHSMlkf{^O;SwQ8e(+t#f+`tRb;9_OwqxK%0enHL3e zHSz^oJWx=YfMl8q()39y+)$ADAQG+~s@I!mos z{6+rKtuL8VSTg4_tzonafaWqCen-uIC!l;MbpnFJ9EG&-B)KHF6G^qdm>k4s+v@)7 z?EN)-$`fB|i)TxU-&}Bg=h6>&%BQ)`_ut)r&VP*&XIZY);Fa=o@JX*BEj)#>{Tn=W z1EX8ozX51Zcb7L7+%ria{4iKqzIGmno2$)qxSeAT8hHZ z&=m_jjibNZz^@3$6$?C#fPObkoh-OAG0v}_j^fjQ_-HAw#w}CS)Vm@%x63Ndgxc*QY#)nkX&#Z>Z-wiyW?h+s@k^EF4TcVjIlAmhp zVHE%WQwNj(e*`6q*9{aFF8Qxi+NU?;?{VU*(@TDj^Ui+zq~)Fc{>!HKZlkq7u=UP< z|DEA`8`ZgXt5mS! z1_{6Z`LqJDLO;lUt#hm4!P&t5lb)5Um#y6JjAbi(2YXho$ItaWEBjUU#?|je79v0!|%1UXdZ~4mJ#k2Uc@Mh$1UcPd};w3x`EnB&nSr;#H&p|g( zmap90dp%2jlrYF93g4dKpAWO_0{*}$jn~id=~k)w1#XilSiLv1`M!0m4gVzfM_6v0 zHGZ8>@><~2WBl_X{JHp|o|S9)yMrl?f9im5hQJJ7<6APnxO6BRH|S7ydsqyE!cGbQ ze3sQ8Rt&;R?jIJv#^jgsk39Vyo-Rmtb1P7Nk?)IdWa71adMlp}OU^&@@gXK2;S z4a)pGR{9YBEW8!D3o?d_3!sh_NW1tUR`!nWwBBmsRb1UDvN&RW(UHwMMB+uI4cXk{ z>sJ0je;Y0x#uMDWXhB@rNV@pgRlXB(Vq1^!ShLdO_;cYrYu?GHpJa9RaN&J^Ty$jf zoqsO9h<`w38!jDNweqG5{{*_z-%BU`?<@W9qyG0b{ug+o16(RyYI9C5RhaZLHuezz z)bV=pXZUp1!$=P_X!Tx}lfv)f)34#rg?I4JXTY5W4wdx5(LW+2DGpx2rg(HwauLn; zKJsz?`Cb0`B>r4#qv7k3TL z4Cn^#N@nz4f3@pD0{zLo*Kc&|5LBjb8=V%V#~JR_-i7z9y0!qHId)5(>%qUm3Rl2h z?sEL?Tj_f6*au(D<~|gL%#h5@%lchmd4Hj&4-e~CyPn?b`5$`b4~igRWq(g$eedV@vwsLeXI1fZ$&@)7(^3=zBTxxf(}*I_l~TVydqwDdW%}{K}nJ(SNC4O3N3L| z{AGV^WxX_fzNZJ>a5ICIAMAZ_Wj{-vM|HTCH5|^uTfvuCp(+T8d(B($O%i=Z3H+a(F5XA1^k7E%9ppVmgS4|4SP%Y5 z;=-FHapBFY`>~&V@e;&8if%@EXar{AhbcpX*C9Nzu>v+H+2qAb>+lS6c?a62hhKT|D%^4yrWV4d_sSo(8N!y0Y#t!vjHeH<66Q3 zv}{(yEqr_J)&j;NGq;+f!jl5FI13#L)S!WnUfTzB5Jg&ZEnC$Wf$LUK6n4t-x2N}J zLBrxK#v@%Wx|P6WPfriHqp%+P?1bauCFNl3T{=wnAbzjy0qyX2nf$JG#2Fgd+;@#I zJ0SBB3?zdaq~FJYXsx}K@&Hj4`i|X8LAg}dwBAQvNzC>M7=0U_u?{u-u>02aFDFj= zh!oBNngOc54SZkCoJU^i0g-w1Z_+BCrN|%(NoP9b$4HqQp0UDl&Q_tZiwCg5?9hGh z!vBe1Xg9#BFay@D1?%5qc3e?qa+FSrfFNQEiCgCou)~L(tqF8+M5Sqjq|wcyB^h~HvuiG zu-+N20;MW%YIo}X2Z3G<)K$_@J^J7-~cPKd%=p( z>ye2(t3Tuuq4VuMU^~~C?Tp?=&C>**r5g400gF*YBB>yLNX*wsM$MoO8ZYXKq~nS z_j&#R>fD(N3p8438je`qBAV?YR4~ndgrIzHDqd9GTu#STGzEU^!X17VspM8vrZ- zcr$~S0g;w(fGkxQ7&2aD^;N!se1*WE%9g6(sXP|;Y`uQwV?B_S0%hXU%VSC>^$kqG zkaP461~1uir-6)6-5L6$+T?+nW1Z61IcV@sMr|y{Ck8Fnpln=5K)m(f6={rbj3mZO zU0APC540I;n_lN-X~dcek|1)$+fWE12?sjDSvpB1)q0dArdTY*rEm{684~pCy&Yd^ zFb(jKNE_$?UaOOxA8Roi5+cdrtVmGL1*`%l=g3q@!8Jr@)jku_a6NJ3+=+ zw)j70fa^0J?tI-D>3R;!VZ?KKM-r;gLjyOV z>v>bmJv<=}0}27z9`W=*CQVXcK6V~FV-hLGi_Z7eHS?IobzBHRY<+mI%2#aY#ky`S zR%TA*t6S?3wv_7;mg_Wj&MF1V5w5wu&_wKrLlZFm5e1TQ8k#J#dNN+tQPqc|J(N#g39!&$WTC)n^Gbvwy~&{!+><(l)L2*| zVdTP_OCWEvLTy-hqjaG*UTeYuei4(cIFKB|wbO(xiQR+(RvC-A2tORze8y|91n_zq zyEi;dr zTZIE1X+)JY;*iJjrTn#;Fdxn!JXhkoIYVu=51GK zQ5x#U=3Mg7Ka3sr2eEFHFWi7O@krDivM8A>2?bpfl*oFQ;Tmm$e#S8uw+2IFDI`e3 zO?nm%lW8jrTp@j@gHn_%3pl{iPCu+iPMaPv!H8qT(n~SisYom6;r53n^Ge8{7^#@* zs9q$EjAZH0W~oKE89Nm1S=1U;M%Yw&E0XeCo)~X@a)K8Ndm~rAyD;NFT-CvNgQL)C zu!zBBSV`?`uv&6KH5Iy`DKgow!30MfmN87RDX6n=qRcT4nhM}F?||gMhiY8{c)=Al z!o?vx1qXVVqgaD*F6hfn;_;5Ai6Ve?A(;n!bcB^1h}Wr+#s6l2f~C38ly$=EBN!+r zd65S<>v=E*!GNr7D4f@J97Rf^DO_wodUyr4P~6k2d;@r;2@T`=U|*FIz$qB&%cflY zY*acm;Q608E1BCNjl;a)_UY9w+=6wC+arxeV(|&LHZnMxB`^R-m?&7XfD6L`nJU$= z)9F#N0h^~#8h3Cp32t6#bZ!RR7#IDB&UuC`6t?~fEXo+N} z^8oP$iGA7I>d2><;usJnyR1E&SNH_ZO~fWSG#$;wBAYGK6BprZM4<@YYw=x!!yBwv zoSIXn6qHwZ4;{PiqVw)I1b&+8WZboXVrFzKQ4D#way^s%-WtHCu=h2CCd0awcJIEa`PVxCg zarU|N1z+`z@3?DZQ1d#&-Ke`XfJ=dC0Y0%_!6CYvp~tZd-(Mjhcg~VRe1%1fuSW1S zb}?82*>hg}BkS0v7(#_O7#f5UA#ntRAvVUsX2#25z(Dy3VSKZPlO&;*`8q1U{oYPC z5;eVaJnsC^8Cf_@;;&U;^H5Wr*h|^?-U%AWgjEz(laA3RMG=K23=z>`rGy!iN!KZW z^B8Yg+47phVeK8&;_9*kcOkosaFjzAUYc^8XGAMCQD2U;hO4fKF*W0Qb#Or z?S@hyHx3U&&^Sm;dOqFb-6uYDG#--3K_wqd<8}7oa`~&N)*lPCZ(h|LH~V4Eo`{2E`QYWw0T5#n_~r+ix~Q7IBrn1>)Ac9|($ z+gGa8my7Y$4(6Kihpy;gFW*J-jzVu`Uy!b=enIjYC32xi&V&mUm;s3gW*mhNiJBsk z7ieGYcrF}IVC9=2F*wXte6);G8)SpPTY}oLGXD63vmGhvMka{=N25A;0)rAp>k>vs zHO3?uFZwEJ(j>2kTQ&&;1N$fhkP3zABU?NcseJ?ICwUP z*5OVXy-9NNf`@fj;4s7opuQYAK&m;`!~M{psRsKtj9d)5MilF-T`Egl_;Mb#p^3cB zWY?s;(IuhSG!$$DSWwCmTII%3|3TcHjhGHM|Bgo z%ZOMCEf-hI0WU@r`jZb^Wnp$tXr{xUMzAVSxbePNHZ?>RmDGH}^xJa6BxUjw^ zh@oV8lgt|biNa9f#U5W&k?Vtgnuwrf9xQf5cG)KEc*WNJHjAtj8GM?7R!)Qi`S^fO z4Y+))f&e~8n2?1vn8S$GzLT%sq*x|erNFCv=VD936brWi#$0PK-8gNEm0}x}ggFsU zzlaW-UN>0^3ZKA>LqwSpW7Lu~1@+--#kz@8Vp6ap)s^Iew1qbi+nzy6tT8cJq@b1) zvUo!fZIgy=dUQ703U{ENw!xWD(jmk0w zEt-&(f-TB_+hzt5{wG^)of>fd+c?EB=D*821?`-Wm4;o-|JrvAbohhpb&B*r{Qo9M zi8o39tB4e|egZaG{0(6}0?<*hDRC*D6elGl5cTNSuYlxD(gs zYB-4FJX&xf$NRO=clu}rTN9s*<90OF2z`g7IXoQ1G&%I6Y-Est|13#H<6 zijx&A3fY{cuVx-MHo2w|8%sy>Q=Bp?uFbj$4-P<>z-$ zVMXO<`|Lr!py1}s(gtR&yvE&&OZ$~?j6*hR(mM-hIY=A|$_mLFXFR9IqFMqU;51Ld zIG%jKy>qGD2!6 z$>HaE4%&g|pJK%dI2+$9#N_}Ve38N6aAI&>;wQaut%Dm<91Q%fgLrW9SASuR4~MUd zd=3wCASAH`;6on_; zPUR=AQHWZhBa%`SySX<4CFf&K3(CHWONeZf5BZY8iGcKrX~;$PO!!davUBV{0&xK`gAy6!l++% z7T(t2vmNdw)RY|*PQ<`QTsRqVD4dTl`Ar$jQ@Ds-gFM-Q@0@uy!`&WKsJGX`Lkq-L z<6JL+Y`%f2t~1Zh!k1$rV#|YG;t`)ETV~$6;&m||pcv773y5eh-b+cq3p!4AtRoNl z!sB@T4G+YPV{*+hj7vCbkk^ajXY8g;EUL+o=ALo_TxDTVvA7#CU9j1cyQSnB9EEe4 zbtp51WY3;lvnsjfVXi>9QRFf>7u$EflVGlX&%^t9S#;#~0OQ*i)`t?fL6AWv+d!^6 z^59H$Nakty8SXLc^%0#M-sZ?13kS4cyin;Z*v=Q`eL2qbc4D48Sd%O-Ua4cR?9`sv zCr0l{mLE#^6RGoe66Tuo2{9@!vA^h>^-u8VhP&3AZ70{PL-MMa1IIPn4qh@U zCT~nJ%wmht#nXTe{^#f{j;WppCC*)nF?wq`I1mDkM+gs0*3`G7G#*{V0I z@Jk$Q(B`lKKeLp`e34DD4jV{X`GE-3#gVwG1d|^>p+!(0;W`dyf#;uMqO+JR84VM8 zLgXBlc#gqxrO1sU>qV|*iRTzxNxbn1sIC)5l_(C0+~6se^{zJ;gmZ5P?XHt>ljslY z0QK zDXF&4JCTpjNR&7;UFv>i8dTxLDW z=X*F#r46OCY7ZkCH$kXdmi7_f>WGhUtHYVp6mT>3o+r+u2RA=nmch+$YwA%hQS#M$ zj^aSPMDf5EE13Zv>=K*t4km;L7k)bqKT_ktyI83n{bM-hw{ZA%Zfq{_(x&`04!=a& zmaa|kKA?^i8@$1Y;?M;d2_75)2l0U3!h5g?*&bz~3>bJ~aBSHx3$KRuL!?*pfGm`Y zEsMwI7Y{mmJicpSHO@EAvKS^fzHwQWFO%ORpAhefWdb4uBUT`xZ;WL@J%)o5@z$gV z8F@Q;P&f`H5zev_J&raXm*vZZfo(Y=amnz=$)jbZdpf`zm%jn{&tZw5ugS8w2?J6i zx_-DIJ7@yxAew%iJRMAB9S4iBt}>P~uj9p%6_@QrLmlxyRsifx;3ElifUhNp*C6GM z+R^;hq~pP50=xLZ=oknO78Ukfb}R(e8xQ6tODt3g>@K}HpaiiR$QryX2`5az#uWxx zc%8#zIgWHk&_P$k;UzpSS-%*50#BPta+rtCQk(j+YX0KFvs~(@cgtA2z zERaFk{Rsb z4|G}wB(ug`D-zr2{0l?Jb2>fmUGJ7W@3!xt8Jla7-T+mN#t_VZ9E zj}@fEn0L4ftNE1)sa!rJlBanROeXly!wbU_V?cKV`cu5J74Lsa@~k8t-V>mfpKn5L zdIloE9zy3@xcu|HL5on;I{kJnk1h#vE_Gx173;dO+JJw}Ne@5$!%mnYzTS9ckPWNE zuu2>9&pjDK`Q;}b0aGlom?GBGBs@)9^N&IqYYytj>h?$uq6cyN$#y)JGsQ1WENd!w z6w9K~8!eXU8p5NxhAdn)xs=cp77fYLFKrR;qen8}o_60vDZCzjS25CYR)WXEi!svM zJPtTt83$Q8n6|oLzwEy)V-@0e4J1%|Znb)$2J_ z0(Wy7`H(N9)Kqd0gz|ZX!;YTEOx-BmH>0$d(LjqAfZn)Sk%7TKu4UGlS{WW3;Vw9} zkp(AT*Ol|eI?knXP`eIS81|t4J^%+gNzVKuT%zHtgHL{w%U$PSg4e_LOIPsAWU^-L zXFK#wHu{>!EdTTtBINhLI0t4i;TUbgzsePD!mKs?J6+KlX0730?uynh=X-EYB28i) z&vpG06YM@geNa{W$38EY3UFKpw;y@!z)FDcQ}C-(7gB;@ckr>7E2sd??>R1$9nh;SQ{k zJOnVXCi^_`FmWsgi(4|b4OkuYx2U|jPxw_*Zkp^h6M0Fk-YbqU(W9a7$V<;26C3GD z6TQPkV?yasfwLo+4=~ZVwDV@0pBb7M^MUb-&Ae1I8|HjX$hLSY;w(EG7YBGP=$ndb z^8i-D%T?T>&?L)&7jOlV^*2GbFY@xFEYY~L!^}oMV3&~X%S2Ccm+(c)i9;$}hIxMY z2I5*4<$hgt>F;BHYZ=iz$qOOS9m=!1k9S1cAFJIo|B99jp(Kk{jzLfAZ zk#-{5xCJ9vt}587%T)!R=qz(ZNJo7_{-ELK{2r&+zAw3Cnru39U!5 zO;~l_XI*G^mQeSyC0q~ zI@$!ngmhsHe4eR%Y80A^{cvcyLVp=TUg`f}1mstwM7^ViiF5AQG+$Nb*g1+du+yec`!s zIa(*9cAZ#H6S-34Mv?U**RsUTC+~(ri_kn?9r-%V@5i)YQHyM@!u)-)a7!VkoH0Ow zGfZ%<`K&gd&2B3G9$;QQ)$ z^Sx&ho2!A)IwE6T6np_I^Ocme;xA6kzXURc>dr~tkk%OSq>a1>D9qCo$lv5UBP zJ{;hov=lNDZc60&A?q>ct$lV__k0^1%gZ!;!YfiA92Md}+06IhHhm+DW!+X^9e)?G zZYzuJQo>fO?0nOO%ys9Z(zuz>I|}Yfc_%_wREos=rf>|d5WV%5v!)EA7WKiKLdX^G zP4T*cw}yChufQC@e?vW;vB5(H!-ui_V`ax%Du5OM-nxM`#%eQL;6FDJTg!hfkth@3 zRl6pJW%w{ktcl@b51;8tgR4*KiejE&YU90CeBiM17haAehG%|=UlN77(ig_FcKnCC zb=Yt&eX+ferj*Gz=1WzmRW>X^3?Af?=HYujG#Bs4a{uYqZe^jxI*nIvrPVx?q~q}2 zR6Kr3!xaFn3=KoHgA+zH6|0wcza>X*V6^|>g#a?<%*6=V^P~;6o#ja~sl<2u6=s&8{*g@d8w&9jc<>yp?f?2uT8?(I zPvqGMRz`hQ#a16D>G)q?Ri{ex;1Be=bTTd+Twmh`Qgg(X~?QWL{-1dEO@oW{x1 zI$&eOn<`9=%%1q(ovt4wQi``tr<)E%;rxbY0O&|10%r9<4&L4#{O%+>#8gE-_{~6G z_T`|(ooc4dU5wwt0oMqbqY@}Zdz<^k+~D#2=WR|FcDR`5=#tP0R9_|pcMtCrF;WiT z3<|P(v8NOt$u--NjGw;zqTS2O0kV&p_A*zv2B^Bciipf2OF?KDY8t&VV6sGXyn?jw z7UKV5iNIkozD2%0@;!7ocUXHk++6Cx%D`h>d%YSTSQB`}pcdi2?cVQe1w0+2`$`rB zS-g0E!*!N%KDYV-PtQMg!~Z%$JYa@rlz(&(1@N+mDn+>}+BM>h|0h?Zn!9Zr*hOZ6 zFB^MYsYhg5L;$^?j63M|3B)~~iJN-F$c=y=Vd5*;X7GB*p#Nis=tYy~3tqm&Siyyw z3&GKk=~0g0Wgj0|yor#jK^FGTxC%w8!3NM{nQ^P4mtkIgExmSb!lj$9wmy#sMRC3O zBixF|V>~o@-S&kK@&y5J{2<~WRt-40+U$Q|@AdW5HAIzgW)CeSmcf451arAH)z~=u z!h?L_3$n4^Vdud+vhW}l7w{ostPdAk(d%a5)l18)wipfAEMuae2J(5F2c<83TmY4n zPh77!@}!3wihnQ*+p7ncU=VXf!b3%1Nf;{2f&BKwP%PEjVP+on#yuj|0Dk;thL;y} zjORYb%KZ~R9*_urqf_qw`YYI^aF1$LRTcdV)4t)+~~nk<}I z!aMqiA`6G^(n07KyjIHl$%q1-&%=wI%5QthXzR^|;lT@UUy4)&KWvotXTl4jkbBxh^YN$Ss6^`4gA?c0(zkwj)ex zJBoMP*c$s+R3?m@Bl*>pIl3Bcd_Po+HnL5voB-Db4Dn4Azd?y~n3*+gk|O*t48sre zg$s{p@vH*lB)kr}$a|M^Csmuud8LZ4d0D8<%H~@LIX((+K(ftvQxgMm11{I$o%~Z9 zh~iv#@@)>D%ObO|yt`>~-5kk&8=G#!h1wT>4Rw;k{qSqLUav`ceKW8VtgYl5Ze;#8 zjsa>1`@&!1y+p1EKbr`DDTb9IE0VA$=No0b6I$CBp6F}tm+>AW50$~UvJr83!467ZBlW&t1 zw+zKMNR{ONx<Ya^C4CX~VA`lzG(~)eO)$zP`g?i&D1$tVFS?R0W4^7?v z2pwQL5TS!i2lZ&U9Ope)7<*^qJt4eAfwu^-J=9OO@aWFVgGZ{f6lrRgN}AfG7}OXu ztn1+6Yo%{Ow(ZzfoE<6Q5SMT$LVRmfcQ`^vnT|%Nm8q5Qe4{FVoFk7%OinPJ;J)Gd zxtFELLkaYPJatInM-M3qcKnWsgGYl{;`Gfm-*EGRA=a)SdwvYovTSS)aZo5f4#l4w z#TP9+hn1m*Pp@2+-1kZo_0>xjaJ*=SeClesYPIQ@XVIr~=82D3@Lf|~3qKpk#Gq*r zUuGb#HbdsH92&_L3r~LeN>ad=LjCv`hpl)3fLh^O5xp%x-tWN!0sK7){2dAW^$7gM z2>gu*{7neFN26k}L+OqC7VIdpz4)xILmF&rVi67xWkrUSg40{uN{O*j@D@&-m4b)M zj+KJcyi4F$G4YWsADHJt{8kMAzI;eN`S4UTzlXu`Uz$&T`HX)U|3iLU&A(kQKL)Qu z$!?r}d5rCTapU$&h<9WBv-0|{3+O!91ssA--p=7qT@RnUPUigmj!`2r%MQ(P)}MXt z%;dKd`V%FdIb!41?^g|e_MFK#z5a>+1O7c;3;$nn?Xw-?`3Kv7R;N)q|7I{zEB>E} zz(5!bj3*k}f$-zg_$P+wbbOo#9owzJkDhTJ{C^|fayV{P4%1xpg>u_ez!ZWFm<$*W6J=*SZMSsVIJVt!fTEKQ&;OIa3+JZ&l4 z_Y>K28;AcS;gO=fPUI~TGYvA1?q15J+$S+hmbNU7qgN3VM=#WJ{KrebM$W&AOjyR@ z^kwhN;BbV%PXx0}3_+hjK-&}mI)LSEIx{<*%1Z6-Exuie#Dhxo-JS2wLk z_+@C};oCSoX$s5NB<8&)F7Y#wKQ?jw<5#d{SCJ(mPhY|I=d9pTE)#jJ#M~g-nG&8Q z@_x~-k??wvdseg{)q4{EmB?R2CO*h{=0C`J4w3qtCNUKfbM=EX`?DwoXfc(Ef*h@dI;&J$^$n@1b4vSZ3Af^w(UK%L!Vv$#iyisIW zWCLV6J-qtq)#9J%Ujpb{&?dPxI)(sbV z{Tgo9%_8qy!+y9I;V!gv%@b?7(2I~*8ASW7*#EYM$7)(L%YtV1!CPcq#U6qMc0vnLN9>wsS_0leV@VUI#H3(xk5=)Dzrz^CF5^!a|xdc z`S2GSn0^pSL4BAONxD@0EeNItp)@*E$i9n9NT;)eQiM9=D#eyLLYY)4v`*4>rSpYO z606ywi7a6b$a>W05|$hw6#uD`q}8#OP(uCE*pg&zKh38FWMrOPZ`=uDv(55?t1U8dC)yCbllK( zv7DT*)4fQm(5B403-2aa?v$}K;O=2}bDp0`2{(ea)7j+3pi82=45bMz5UQXop+|%U zQXWQU5^cMiOE`zRDK6oVlu$|dswi|n-2E#`sHD@>O6WSxESgE6GbG(05bOF1U2Ujb zXtK~CI$Nj~v>AWv^kSg}qPvJjN(oQTP$`e;IH8>-n8 ze`XzMmC&{Hh?KBiXaZSQwMwELLN^lsWuGKEXeid=mEl{Vo5&+%hmt~x`12q^i}NfD zoe_EwR46nQbeVM%6$#w}8li5YVrvzAT^r(h-b5v$TM^zXt(Iz1Z|*s z^s0F9Gf*Nm&|cBC8hTr5_N&yakq(Kaw}$(#k-oD+@O9^!(i*0YHhca&P_tS}r9yuO ztyRmYpU@PsTt;UJEf8v=K|-sA9;6Fx?%StpxP+B7L};_nD!N!`hfp(JBDA-L`@NZl zNiH87x?FU}jO7(J`{e{^oNA`4#PYWq{v#O8^k=&owf5B()^aY_;tMTFbT#OpT1$Ts zx>aZ$-DLCJtgXGTmgsSsDCu4RC4z1i%RQi0^*Buu-E+6Gu7z$D`VzVm>Is@5mOp_` zswZit=;G_x@+q1nx)cyuPf@*4vCz|Wk5FIGNwtyY3Y{(h8x+KquAnv|4DZqn5Lx@^C8283?W3JS_X)j8yM@*Wy+!{N+6g+T z_R}7rk3nSZr@cbQKqu5Yv|s2K(Y;IW33Z&!^?Z*$5YGo@m(5P3_vu5SQ9_@}{bdr} z2&%F^B@ga4ljyIYUG}Gx7{jAr9*F2ud}V=kO(vaB=qaJksjJXSpf~N$sX*v0qbtO> zCvXh_jZbV>AY(7)_&s9eZf&vc9iie&-lpZ0fjp3v!_MEZ`-7perk zZ~sJB2werLvVNkGF+9pAisesqmFT8{UWesqp?O9(M#@_O`j_2ClVf-l-YB|X>2|Sv z2~=&7x>NFeUv#AIiV2}bpViZxL~Pz>O8au=&>ZZ5RE=1k3QD9H5CxKGkWiZXr{sAt zXup-IUKh*jMAt>_7hRQ5P`xARW`O2Vf%-^v_er_}^@-31P^(p}zLC=30rjC`bzF4c zh_1V#jC;5)-PI4GD-i0bP6`bWIz{~^iY@?31YIO~ z_5#hLA?gy*9iPg&A?h+A61qfPE%YZ?2JEZVtwJ|Sx~tU`$)$b@r@LBB6V|he=B)S{a3qn5&jaM%Tb(zcQZc_gg z>S5?rp>se(>?-xT(B+2S5E^f2uh5-__6aR8^rp~ip-Jjp@!6KSug@i#tlo=VMMOso zy)X2Gp%29JH$z{F&O1-1`%2oL2ikyKTE+5=d7JO$Jdca+Y!K_dL+SWa(DN>z*N1LX zKWp!T5^0*DDMHiLFOn`Kbce!`62`<_p}SNDj-PNJAXKdaaSr_X7-+gxqw+=fH__Fq z!Z_}S-9mM$hgcpI%R1Fd=xd?b>a@6(MD(N7x?c4WikZ)Cs8^>8B^f$HsO$XF`K;?F zbe5q3Qr_kBZ=1gXx`A=ksC6TBOczNT9yK&f=vmMqyIzeDdP8WAx>D#PL!+cc-y6DC zbg}nwx;g4PDLoxTG)Ik-^8BC;pao)iD(hnIRsR&KFtk_FT_)+~s`sRXAMP%lpGb4n zLD5|&x_LM)X1`1|lq6JRDAmKgvVbXOo=Wp@uRJ6)U-^X|7iv%?9`5&NKz*>=#rGDG z?gh|1TFQiU`|kVpzC=(TDWPLS*9HRh_pk^1fLM37q`L_8jn$;i7pek%6w{RF+;K!vgIt1UvUqC2Se2%QA|E9N8hhWOLFAY%d1M{1vk z=R*%rBIs?Y%UPgt>SOhx=!SrrVm?-%NUvNkbVz+6bO)$8=2P{JabWNZ{ z(0_zBO1jV0Z$dAL?h6&?u;<@1l;Ci`e+FufIj+)#j*ISlmE&-)#N3~;U><$1@W$Q4b2m}(omz&b%quRO*FJj=ypRZghGZ^ z3EgApVWCBa)(Jgm=n0{9hBgR2ZRi=HZH6`r?J~4Y=uJZ}2pu%EQz+u4SDYC5?5NSb z27e~eNf35H);^)cMNG-e0mOZSJD9clLe zRS&u`=ejY9E)|>0)oT2q$*a`Euo@`2h3c?43?F^T`T*jUzX#CWZ} znQ`Q|xDNRi*Q$^8F63Djx8*|XAmr87Cy>`!oWo@6bI7pu732czTgZn*wpi?+jn?;w zd08ws(odPmbkO<<@wUyDNj9g-v{e@_B@VK{?f}`}<{JK6r6OEuuSR&7or&-$qzck? zw!ce|Zn5(a!!k&B*~JLg+C31yPvVeeH>5iE1Gka5A%mrOiXhBSmE;g+~KE3Jb zn9Gs#zL={ZKZ&^(mS4t7_$Fk3LOPgY=5yRTvv?jI=t!s&GKr6I%Gs22qjJ*do2Sk1& zdHxC+q@=j{kXdo}L)$Bk`(jYs8ia?(aZM(~aoUM-Pq-eK9QQfK|1^!8P& zZgq6baM_9B*=8S)AJAH5caT_?(ytEc%kPN$Ok-cB2}}8XRek{ zcs@YP7SAEnYA0k+=B%PuQ4>Y`5u@mkgpYYXhxSLYX_K(W`3f<|JUlYfonr|9gHAyD zozIaf-&ukjeneS{w0#ffXK4F7JjRY8&mf)a{Dznd94>bx?4x7wrz4%1uKD7De91Xq zYN%+Ed@qzfP4gXJDr|(;=AgWay`9Wm9$#d?R47W zq(Zx0>hQY5b5^fiA2^wa|HAP@o^bLY@%s&sp7z70)Aia{Lw0-W@**vK}&-7R8T&+zQ#7K8v3K`DOgg628rZIcM%E zopX~j4Qc-se>WtTi(ku^I`oaNLD)**(o+*Se?MezDo*$Wv-Pw1dN=3FgsU)LMkcJz z#NRqknAbHj$8Szp)OAGlOvq%qUs7#=4AQ;?o{#S)u%AB{`J+hc@Bm8b)Zrn>Ub4+}$La$jV-kNtOsaUp51CAB67NK9 zA4_aQ{Q5+dh59FQTV6`!w!DFSg7i)zd*fT=fEn%O+;|rAJYt#TjYBH!fow1PxfC*T zm1%N#MLNUFJ|F0v-=(*VWXu$AN2KB&Nv6s8A-rUo<4r@%3h!RzfZyUm%t5O(>va0N zcRAYf3Z$Zsy{Ba<`VVA~;ydvO&l1@~Q3C=t(`8;3emw%Ba!Mzr)!}7p%Y*4E>+hd=4Y|7lDNdUB<|Vl zB=$xhkryVhudYqHA*(mtoYa6(IukNTb450ZTq~)zB~>BkU67Hn`bN^!tP#}*MSd#s z3rI!ZB;6r$HrFI+0VE}}OiX4^c1`AWHCJMaMQWR#5bTia|(}v{wer1fr znU1D#?|+}dqt{C1`I4H-b8^C4P~})sR7YJoRE|w;_y~DDpj#UqCAQw@6CkaIDCLH1{+#wLZ1@TlM>-rGb9>r+i1#xYI}?hKNw}%9*$UY%)j7yPSqZcXxBugZ4c|dv(wk2w%2%`Kp%P2 zpG7!5eG6oMI`{r5>8mpb2lzg9Fk{F3yznUr?KJLwBWn{Bbl&6U|Cb1l0@O@61V0!?ELTO|&dM6Li4PL+RO| z6Na8h&+|K!l*=XDPg~QA{qfY@(5vaE_&d-6Lm#D=fkx$N%j4<&L9O{rjTGBC)8CP@ z3YcbPWOc3p>3?>`=60@Zr^KSp7x)t?Uo00pr*$3*sx&mP^9X+@8f)kh=#r?`(5TMW z_VEM^E`!iXp%g8QO8oQS%@Zf zUhMBh-Gw;a3je88A*9otMoW!lsPh_s8MSJi~@<{wD=wNCOpmuB>Cx2&Y?Lb^qjbSO$U zh*q8|mXdA|9XgGPEqD6Qqc$PkqQTU+tUb>QXo`?-(FIhmb&|`4v_8u6B0A(+?(|KA)X?joanwA3bs>7c^CABYly$bIudwz^peCUj zsr3X}D>RGRIv<7ZfFUR2sQ*TCDmdLNN(S9TeGLUcRW#mES;jH{L|SU7Kj>!KZRlLk zEp*b*V9+Eg9!U6SmUC&wkN(Lt($F~Keg?AH=K{wpcqKsetw^6O3GSC#-XlQvxY|d0VY-m+R$DG?K^<1eZt%Kz> zsua?tPp9FAxb!<{inbJg-a#{j7Sl5ssX2F0lS^H5X3%y+TQc%S?K=w$7C~_s~{DPDW+Uy>!S>GH5Qv4ALb8 zLG!5CP+7)BIrC|-q5h!zsLIf}paz<2XfUXe)*CvQF)U{R?KSkd&~Zaw38kK=%lkfK z1T4#3x+dp-8fEC;8P|hm7-~QX3#rM_qKsQ|7SUEiWuV1$(9rUX5&k9AW@uH$?Kw*+ z>wI0_s*JmH9-wkV>yWOAMj7H>SwS;g>YDQqtu(~FvYNKL)IFz}4jbZLd6Z%X>k?kg zD9>3-#fG?79-~WLD$jYGrWvv_FUom>mKsXSJU!=0+GHpIdWsGhDgmvhlZH+OZJ>+` zxI8_spQe1FS(KJppYt>gF%$s(jiwkX0d1rvL#KkCp&dec>^@8T4e{9hJDt#$GIsw? zZ9KT{-PEK66hLP0jq-zr(e> zC-bcwmtt3BRz&F@&wRICm$)T!c9ibb%nx#Qy15+6{G^>?f6P3Zv&+@lUEa#s?NUaU z@1iKL%fF(iZ! zEsEagk{Q?|x&Zunq)Sc|{Rnz3k}lTM^#cFv5lSrT+AYvd6JVKX_w+sr7~-CO zlPU~xPrpemhSpZ#N-=>v@*z<4Gc0=s>w`q^iF5)@%4z+5X;xYIR(It|LVqd>QwV(j}$-VLptu(~F z@-A&PmOSbX(8f!3I-VWx(@7zof4u@9Q0*|*G4&68NX3_lWjy!TM>NCEBv34GhEa9 zuJ7i2M%9L%?>Za0QJ1r>miBdZ0*C3iP>4=|KBr4Zu&$93vIYi@&~PDMUwQ?;ps_CX z4}3|Jgmw_u`YW0%w9Da@;cMEjN%jR_Q`Qxnr}lg+RR}dwde-1TD~%T75-tgROH+h& zp5IZEPA7SOPlvUolb7WUd`~eWb)M{(?`gat?%N+|u23VDp@bjkz?E#tC0rf&kxsZY zHt-WAUBx2EH&*KUEW`^7K2s_>GEP!%%54OJs7L<>YcG^rc2KLbrObZ7Q=IoYb&&^)0QlkTbPccI&8h}X|-wcpSVu{>zfeVkq4 z&sMEQ_l2ZO8bkQ!NIb86*{YWzUiq?BxhC~p_R)Y}RT`b;|27a%Lxk89KY+$-a+3YO z1@ctAP$T8~V}p5WyU;G`=}!(8s{Pk-c_He92gyZh)b&h_G{_$e7OSI%hJ#Afkg-}f z-d`LnRqKVYqWDh=ZSlor0&R24l&i zrV;|?E3hOuSgkemMfPuj!D_d$Ob)Do?x>+& zfi=Mklrxd@)a|=al?jFD;=sD#5Hhjc*B7fYp;5t6qk1L=(mp%^O zrRrV!B6znt;L@?+Ocj`}(|w9`VKvf_6?`LDqZ))7DH!}YSgUpm&7!hkLT;TpYUoTM z=MK)L#;FW;g04(R`?^l;)7S#+gPUqjai(~xeIp_@Uo)p|qIL37l8Lk*yN z@gjxJWqL3>cb*CuY5>hwqYOP7EXci2RU7&{s8OwTbv<+MS9@Gt&)mf-=`Nk;%dlLg z`nuFJcexsG=m1K8P;E7I7_?FybtyY{waUL+=h6n<8a2d_lUtDcu$tmh&)i4VL7@<3 z=Jv~dOqI{n>DKyZ`&-mtp*kweJty}Gb;9VLg6=65Q>`tZ@(<2kuL2=WjnF-<4hYpy z@7zmr|E5yItgE3}{;P90s-=c1a&O4pr1lGiXiRQZ?q+qu&~2dSRB8>U3(;KA7FA~G z;oJ)URyE$xrrg<}CPOdhPR-q>4%g~*`*Le?Ur_aRnm*3GFL#Hkn#EL0t+`8ccd2Q! zweA<>@=vu^Xc1-Q?Fqc9jvML@+M~wSvt%H*VQJM zp2&S&4VlB~X3sHvZU()jD(7*!MtU>vmE8SmuFxzzo6638MXeFFW_J+V4_Y?&qqwLFe*qUZwvF)g-ite#v_|a8w-?s-u|v&vU<2 z9UIv)L^=6YxnHU7LX8>S@-zKkt4blB@2$CCtC2!S)T#Lu{#G?t=zi*-p9VS*W!b7) zqb$EsfdyQ`Vw#-)L+&?fq@kz$PTny!)}>B)$JJ6pYoYsI9WXR4KO^r46?18pYz((XhRR@-<9{9nkLjp&*a~mr>q&S zZc(0P^;)EJc{u;cyjW|BOWX21R*RuM$R)wr;nJeKj@IbKI^7tr>%v@I{$Iw;gg zALqZDmuekd!j_HnQ~vjPovqzVb-ILtJb#9D+)$w4KY5u})-tU-rJzH8SF6IM?ED;S ztWYEMDd>@(Ywb6>KNXyjpKnchK&QK*U_gF>bwa3-ZYwxHzsOp+oOO+KPr-=%63c1Q zw60)meyKG>NU!tVtlHnv+}{zW;=S-0nN|7StR`1CJ-@rPNobd1T~F(1l!K^9><)3P;6bjJ~pwq0e4~kCq8f6xTxx7;fQUcLbpWnxtE0&9?b74dN z8P37ujJGwhA+R`byvamg!Q#7t{q?^k$SYByW>VA*s9=p;SEyOcmQsI?WgBcUtf7e(i z3~~Sc*~(w7#|!u0wN|A|u?3^8u`Xp4jInB6>QQi=)$CGb!S&V-m#!%oYaMoJTERFg zW=*7oMFoGc@?F|kaD!Fp(%S{&t+6hhESO-`8sh%D(P}Zo{dbeK-w==MDhprumNC!c zdZJZqh{yFr>rz8Ju5Y%g4ROEUY|VA)l){^>jt}cxxZiKFCK=*>zr`B;h}Lnx-(poh zs)_r3lC{GS_xmL4q)>>wMHT+Z*3z|X8KMC~G3zvqDXK1^aZ7Av=xXl{>IO~om9z9d6CPO@WrdWFo@#vXiIW5|f$HWw?-Vl$$Db{*JJhG-* zfhV*jkF2TIaF@mv{?)1%TI}p7nqN50YBBV7(E`vOV_BQA6x8uaoy(_1D+;Gu2ZTbh z*4=3xHoChq-uK^WIZv_WC+e%B_x*QS-3|39URpTQ8X}~x+W1DY{Ie@@YVn%FcB(J_ z+22llm+VsP;^HUUEo0XeZ!8Q&a*6$C@pFY?myW=)#-*Q%w-?sB6j!plaF$EHlD&oX zE)|x%Q#i+^GfJMwy(dD6=ahUHxYwmCO1x1tsU#(e=9IjfGuO3TT{7G6QtXzJ4-4l- zbU2&YT{zzwEq>uy{AFQ-wMpnmJo{yVb-)n&Wr20l5c_3;m9d^(cto*Z7FZ(elMtY;552(i*Qxv0qkNEr!@HtE{AFb?Mv> zYpgv&*p-z0r?A=D`ghia=<5=@=n*Sslct|QYpo$d?9UEGk6Gh2IaKh4gHE-Wu{eTP~(IGtMu1-kM^l zTj|iE?bbp=eM&DcdePb=)JSKQUR|`q>bRZLHPRK(?Xt!Tab2!2+HK7cIwB`ZuUPe( z6rUlzV(l=*=Qew+y@vSAYL9hLXqVy>o;?=5K=?!vm@||2B)6f#jzEtRl;xQOwHyGkE=&{+3 z?-+R0b+D)HVmhLD)Fs;aFKgm)=Cx~uLiBC7D@uI!38Ui?nQqV6Etc^-20PnZH7OoF zo$c~hbS^x4y4ceU@%Zd&Z#Tr_Gs{l;r?%uVm}QSL#G^IKK5mFdU5;C89(4hicqHc= z+7avR9xiI99^G#&DspwFcb`&J>e40M7Z>$(sjB;mqEjN280!93&S?>fUDCaOpq(D? z{zz__?YzphuBFZ0$CmW5dkGy;Jf}~$`|e>~i1v5CsidEMQixZnp(W*Z$JbcLbY96> zwtiJ$2XQ^mwyQ+9gSejO*t>;x5%8!oZS-qgfiy3{V;uZdgqCwqv{E@FQUw~OCq-7aEZ54Weh!xW;Q zy3Z^bX{Wx+q+4{go$u0lCD+)!gmw^@@MpXHJ+{=jjIs9^;u6N$bKj5Ta%0gr`;aDw zpSg{<=>yR@d@4QO#shi$Gs{WnF*`8ct}xW4M}N=|A^og%g1y5KKij?0b`C~Ls4uzE zF4rU_RN12p$+@>ZLrCXRWgjxcxlFV(K8)mYU&%y!u#i6QnPiU@TI`heXeyaxuN1o9 zIlaefP>Ybh;!UG5L844XdDmNh+IF1gDdDa5@};h$-bHoAr$drM~8)h@kTQf=>c z>64PMjB;Cg^Q)2?L%UQ@|M8MKmlpTOuXU-sw9($~(z&Gz>;pnI)S>6ar3>x+!;xHugDQkV zPJYkPrTkl1{Lik~UOh|xi2iC9&@SS1P4-GxSK)uq-sI9> zN*}ZjXma}WoLKshebUh2o__(wd@iM{t9#y7y3)=!G+wCEP-~A4&`C8>&%1keC|%{! zBG77=)_~U7gC!l0iIBh99_iBb(ueITP0rIjzYRQU&vkVn|D*Owm%^oM?X5yJ&X%4( z`yaCp8rt1+PU&OzQK4PLr9W;jJtA!&F1^J*Xo%~{zX~Qg@$QrMVbN)SuD4r-xSsP% z*V`Sx(7CWb|7H&sV%@URXY8?2y1&~CUEP|}&322?ae2?#TMco|w%B_Nam}{c``vW2 z{oCwbM|FAZ-RJExL!9m(cBLUsx7{9Yh)a0E9wo#zd#vZ*i50%3`UP69D3*|*L@md*wV1O~<+0m2dp z3L2fLQ9+|27*^LG0cEOSwsf}As`@NP|&FVbI!e8sTg5= z-@*MteZ@pXRQYfTZR3+^@OnD{C#b06NK}3!Rmd1 zw*^~$(HbHMTYbrzNrWv64*tfPZ%}OTWowB+&fxE?l?IIp{@z;4Nn_#r{eHAI3i1pO z_W#kkmx%Z1Cu{yiSKsS`m^_<^+a$TouuTlM%6%^JcH)>RvXcl~_TpfhTwu_&U|lXV zd3KTeeA8a8t2~eh%Q@|yas(0IW1e!7$t~YFt1P_+sBWUn%0rL-^9~>-a3yKO~5*#9z2+9gy791*HF=$0_m|Sp$ zmn#Tg9ULw<2r3D8+9Tv6f)ETE)%pDY(wSM26YX|mJb?a2^k@4Kkz6= z!uy1bl9L2|6&@HeMlKQbU3f%Dp1etrM?_r6ShdGEUaoD2f&rF$`#+pp1x- zK-q$RA8|9#OhJ<(#se)9G&5of(0Zarwb>Ep{m02o!Ztr*2H4JWVyhyGfvyOuizp4r zmz_Ui?K`C=C^ueiAZnC8iGXjO$WwntTQ$2J@leQkxkga8$oU}?<)eZ^BcBMFB*)-` zz`!#-az)5wxy+z7AyedCf+j_73YjW<;$ueX)tS>?DEA@4b+$F6P{!x{@?&IU$P78t zpyrU<F0ttEYDQC=zJ}MZr&t=uobiXg-j4=tJ@aUW0Zj(jNM-?1>NKVLSEK$UvZ( zL<=-IYB10uqLVt-{;<4W5Z3;%+{DXCSo_0riy*B1VL3v^nAPmYs0b)mPqdsxMkRzk zB6}-nTh4|>4GXQ1n+1)J8XHh+&D+FQxR><2pQU6xRxo%kB z0=6US`Op>eCPDjwR?1!6(RNb8zW<44%ylL1BD@lRF|N1*ZS6@6paCOM)jQZ@|585g(;Gc`wm&c6W4KV4ZwH&=Wwf%buQCj^Dd~ zLyqx6f=?Gk=Y_o?ml9QL9}g%9+bUNHs*9cmR7b>**IVT#A|7R{e4%@Ll&x|EeN+{r z%naKmj~0Ycw#g+#JjynC5fN|oHhCEluIszNa|;o!`TN4&l=m7mH>_U1z{|15=nDIG znZd_ju@88Bc~8a5G{aDT|Ea>FNnoV z9sIt0gy^J>tLJ^0^}=#|WxX%^6YZq6^uC-V2-nN|@*<)I43D($%Z)@8tb5E~!gk8u zy{To;Bd7fX+1H?#!ak6lM0iAbE9^tLn5dfdkJ%me4>_<8mV@J2%)YRFa*3c@f%eOl zKHOFb^s!uf1JZJ~Hs)~H0eS9?Nc_xvP+mmD$NHeW%%Edo2jvJ~^jx659dkbHh&)=* z?wD4f0zn7B_L*EJ=u5DDCNJW|z5(0ka-Bgx08Q;nF_|^?eArQWsX?~zqjJ4LKZG5V zi|y#iNB6kANDz+vad{Ib8tdcoKtJ-Ny?I=oO~l9gxLilXSJnx+z#l#N`aB`e4WPEr zDnB7N5aIgl7XGDtR1mJuFJ;ybJ$aNbfnp= zdO=UbP71#y?-KNUY=s@3vl~QhVcTLK2yT_L1$`1*6#lK;$Vs~#dq?;c`2+ei^6}B>je#WEDQfx-YaOVV`aFc z_z&c5ndPVp*OeH9-Vg7pR0eZfh2ucDw=ysSse-L=Tn_K6#6%)3XKy&92!91XAdUA2 z|L*XL2vi~r@{I^mYNEOA3&-GyK}uN+Cu^J|B1Bmoi&VjGh)anGRqBZt77?e^$8(w%R~C_?>`LM^FYbwm3?(9&(+hD=M`S8ZPEL(+wGr7$ zNScdYiWsgeHRz3qT;;5wlW~8I7^N&q=bk^rHARe3)(h$x|8d0c6_&wmvGFG&Zc&m1 z4U4}RF<#j#=%M%@BMOwGf}V<(BPS`onY`Tkc(=&O%4$LH$M=dXRJvqw+o$pUBa4(e zL09ABBWEcChjE*lkQ#Z1l4np}Q}v`y-brtwfb>l;3QX}YGqHol5$^}8+C%zoCM(Hz-*QX7M3tX$jbE40?)heY#cq|W&s#R7S z6c_b^vW&OLFIUQ;&BK;p-&H`5wb~)~MAa*Sf?gXk8z_Pk^ly*- z9VN-2@~C%}T!X6o8k7QqMuoqpEae0vu`sGpiMWUQr@uF3zuyN+E+^^WkgBK;lubmH z?9!0uqW-4Dl%nTyrYCKP+M_t{L#k%pNpD2`Lut65qR@EmQ;rJ4@!Y4h5iMsoC4CdL zPw|}1J#jquD_7G4VLMt!1qKZwL<>=PxBsF7h?4k~4wH1zybSz+@0R9P=<*oV)Q zMw91f%2A?fHaw{@>N920Ls-LdHZ|!VQU6r5GER3VeG+w4X(Hm+3|}bC+(v8g3*{`) zN$KG}UqpSOR6UI4D%iZFFQQH;C691g33O7qK(w4~fN^P2O3Tr9QmX88ChCk*OT=sV zO4&rjSI<|MNy%llD&1e!mL}JU$o4McYj@P|$=SKSo_pvIV^za}hje3OYcv zh^U%};eV>@@8GTtfA!t@|mEX5Yi=YR<^NQj- zpVzlI*=fJ3)CqbHY*!U|0k>^P?j8NTl1IeH><48k5w_Yd`UhpTLE+KxXyk>|7O)MA z*403R#z%XqGl?qLo5}Y^`>6Fqa1EVY8giq$i|C|I-}O>k1mU|vzN)r}dZgp`xqQ`u zg7Di`zG}80d_Tumt>h%(x59kYO~QuX_3~AlgblwV=Bu^}8-C-#SM^@ZYrtDJz zLWih%M0^K?s0BpTEI;Ls(IINHVOtX&rnYd>rlzcq4p+6M7-az~OL+-sDiL1=;jVUi zoJqPP+#sbYjTI>w+~V2d~CJkSuehSvwH$7xSdHyQL%bc)(Q zbW+FqQq`kGJ0+|yRqgXQA9<`VP0bgCHDs!*1!3*O)T4s1z7eYb6Ic$ex>76bqtq*c z2B#j1{+-dXA*m;#N2^6oqGvT5mD)4>X0;T5EE4Fp)Ni8m)NMq3bjPX~*50L>25~ z@VrAExDss@>DLUp*@*F>MCW6+szk_ryG)_IZw?Xrt3+0|g42 zlvW-yTg?RP^Ilk&1Qsp&Be9RtFJ&AD4mc=}z1{&nFm#HzFv@2=P#FVLdL>2T( zu}obi=#yAA>JgQ#rIs;0{m(IT)g*&9#LQDm4B8qqUtM9)dohdD27~s-ELG1M^m)uO zwWStgR`T58beG0&-$f8m}p(|?YsRqG7WV%MoB z4C)^H7uEL#m*(y+7Zi;3i(PCdwM;mlw?5pZ*gKmngQ&$_5 z9=lcDWzeYDx74!+Ma90OdT(&WoEW=Zy+BmSmZUF?+Nt(=5p9(WkC?mFOhM;?_Nc{z z@YuRfts=tt+ZE8PuIDydyC18~MDRId_>S}ewM7t~HxH?v8?gp{wm+=KaFXyWdRWaA zHazzqR%Z&rbN^v=sUSS}A6B;r!t?ZDwOJ5e2^?0haH1=L!>aElULRfw99Es2B)k$h ztQH9yUI`pl7YV{Efy3$w;fZJTPt^t@JYL@!`30ILmuPgs zbC3O>s;5B@#vWDu4XTL!LQUeNy`6sE|4X$%&NcWAX;9{_fN#}$K`}tzsSSJtX%$>? zMe%TEu8X~*?&@G`COWBeTPwG*(V3gT(|-%jUxhX)^R?Kk>Qq6u6Rjp%pgoZJ4%kiz znol(F6`FTe1yQc5PNE977U+9*G`B&^8e@M@YlP=(nN6{6>J~v;Ge3#_NxfirI_*EJ z+N(U~Uo-z1`?KmRXjkT`Sjm>jiF#|Xjpn5N14htdTSl}~I+(f8Zn2#ebS!g4kkwZ5 z8phlyO^96)B-=9UkWNa2d@}8d?WmxYy_|N{*5!5Xc{=kjP%#l4BO!`r^L~Tdu4cCQ z>$cTI6^vz_k9D`T2-30^5AI?M+{!(BWi7OO*h;o>>I=56w%J4{^`NZ%e%)+Uf?|ob z2-+BZ+`pS`o1m<$7JpA$gP>7a-`l&}juI_k`B|4^yW5K2#2QXYQ?uG)d)Sr^K)OVw8wxADTByO}-a)SDN9KN>IL?@+>v*76-wr!mB!J+Ux z58Dx8`xM&Q*OvP>wFS!gJNnwD67kRa*=;4<#!f&KyKSzZOGL{ANkh@LTF?zdTLcXt zY7i7lw3idDGrO&YsG5x&I>2GKEvm=1EN8zT8s+e_CB1`$=NzZ~CR-*Ej;FulCR+g~ zmJcz5Y^6lJ)j_r`CeI*SqscbF1_9yUP6e+j+i5C9X{VVT=&labJ1E!D?%6vi&oR)5 z**j>W1AZk-)X+QVR!6XjN*tjkn(YWPQMn`BL`xizwq|PePN{cLi6h!%o9&3PdB2O} zg0^x;tjV^-5ogOI+cD|hp}CF(Td6^Ljzn9PK@%NAY}*XF)sbvFLR7{6JhaM@Y76;m z`^Y3-=NN7C z-A*G2t7{^(N0-Y>kF3&vA?Ggh97D#@Xceum&D; zysZlnZ|8Vhh(WhHCfIUKo(0ATzT&mVZl?06NhaI&fGGxT9J)QA&_t^o(@nI_ajS_o zJ7&4aW9!iUes{V^*#z~OsXXc~lWluIi9vsZ`tC8&Do3e_);S(9(Pjty;u`(i>G3ht z_lS#>7oa{fl}DAEY}*4W3_1n%J!+y=j`=29=YU^o<25L!hHiE|<|2VcP?$Oti{TZK8FKl_uKksBw{p=dk^Lt6ik5g8Ix<9`(G*wmo32 zLH(h=btYQnc)>*L950$^v*RTfd4xlKueeA_AGXJCrt+v)O}6a;buRK43FY9o=fs%J z7?$UF!`bFx?wr?cWg;SCna3-@7RhBf_D{cHG*)JH`opuw94_G&ASm} zo|HBYUFUe;mTS;v$1Yo?pjW)M2Q=9l1mPM zLF*i!*!CK<*>T9G?d0V)K@FeTG6mtf{->?fpz^4rwpu~BlE1JWHE5ONgw6K@9_1AD z;gl`Upv{gmwxxnzfEv!*b_v3je8G0bpz^4Twt>5N6kNOC*oq8V<+yBHZO}T$7283B zHamW>dG6-ro`)KKw&e=KwJT|529-y_*I@cMX16k>)RbSb0@lAmF!h$%Z=JHq6+r%u+JR6S}hSj zdi!bH461kdX-x+0vHNRB4BFuc(9RMyLX>@u{#xlCY|BoDdu)Jqga~8qu@BTP7}Vkz zq$T|wJ<)dF5v(mGYGm&WbK1kSMk0P~6Q&*HHhA_%uz#55`;Yb-!nFb-UVDTVu@`O2 z+0J2?9WkQsa1(`b25k?B*Om&x zotmgEGia3~Nvkqwog-CSVbEqrx>m!9W_qZ$P1ta!4%O-nDvuhbH5jx#AV+Hyg!^`c zw#%SZj*(iELF*i&wY>&ycHFErbJB4wjngg&8}8e2TB||jQTf^xgSH1u(AosyE-uj6 zJ{((#A&^kwUgUX{G)MgsAJ)lf07KA(e z5v|0aRgSq@sX^-;@TpUSHaiw*Wt?coEzwp88}9HWT8%;FQIBb>4cZ>?xK=C5;of{w zYY;ZvD^F@igbi2gGObMzuGVFm??*K9I5*`;)ea zi0|TOwFV--i=Wk+xs7)5vs$11*dsjq4vBkCiy`8>_<8Lh5kH2k(^`o5G2}1Wz-BCm zw8Qa&Hj{{ZZqQZ}@hC59^2g{|!SGej%Ubg%NXwZ|c1GOGn)d-tH)UtXZPpeEiqHOC z+!oFIAh!+6&X0RVn=NQuc46GB+7V9lZuM(g3lTqRyrx|-sNV6KCLh8myw!DDAA@!{ zUe^W^@pf+2JP)HM@59^LY@$YKR`%_2^;#VfpXqw7o`~01ukA8ukG)=NHmE%69qj}W zj&7CTU$s_lV~=E)#BJBSKgIg0*^=xzaqnr%j&OPw#$|`rAn2v+d2x+eD-o~neb?&o z!0VTG+MZ>mZP|8p9ix1p`F@7AS89LH-UBp{=%kJ@cWK$e z_F>i@pgf|TI@YjTD;0z_?AEF{Nm#>ft(BL9zB}z7YTln?4ZIH@YW_rgTt3tyOtw8* zl0h|bd$ep$@aewwaevnu4ci|3KeT3pS{!?|3&Imy{gLMRPpVJDR)3`V65&&MHplJP zlDLf>$bKWPSt}BBEc@NKPqZq7-iSM(HFAPJydQT+V@G*R9J3>uzaSj5BU*?cyr2A; zmMiF7c7^>jEnm>p?DPJgYqJG)$*Hh^u2l;1%YpBeYqf%sa)SN;scjK7KIiXoN41z^ zy!MiuW+11apomZ7j%kg8G9r!vWq-jv7v`J-nki^y&N-k`K^t>gx5Q0E+pN+tv>Md)!HF8z=VGa38QuJxMm8o8nJt z%ZQe<9m59$HEi1@Fx zWg1$L1Vx(u!XlXXhcE$*IK5agb~w#MhnUvkz>E0l?a+V0vJ0GyCp&9-XQ(aI&Tq7- z2F;59Mr-55o)~doe5@!pbGo9TA#DLN6(Bn@Bf_^FX#p6!*^P~plu_{ z;=j{o6IHXnjhF|tLeRbui{r0o+YDMBe^on5gr6r`0W|v@?*q2_du^K_{Pyn;+Q9Q@ zI|+AmpNs!Nix-4v$~G-q&>)``@oid(pu4jE691z%TTrj874bi7tBK%QUYXCuGkuGo zV?dJLAn0o5=6H+V%t<>0BQNW1!iINPWnKQ7+M?rGTh#{&!uz|bo=dbq!@IAlUMvXj zzN-2n?n!rTReck;v2!Dyi&yodM8_mc?$&slu3ez9rWv#8z8%QPiH*TlD_1Qio) zq8@qZbBXxb&_iEJgh%#saUS|=PTDKEr{cQm4T2hS{|>~yY42@UT{Eb~ z(NzyL=x_0!x|5TJN80ZCR6%%T@2<}k^fA=XU0-dKbAoLbC+K^Nqq~08pufd?>sJKf zy92%Sz*g5NeH7nY4-tgx%twzAgm?LU^dwH&m$?VyZ_qOZohQl_glpmky+jb+^S?n~ zDrjT$XHc%56T^|eQEwDBTv>hf7D2d{`s&(cYMF*3-&YUh#PA(}zWQiRFxDsH`|8EQ z^J?z7ct3rqAa&#=piQD&&yiPv27cQ<^8PwZGyL1>F>qv#-5@1lBug-pYNDKx-4X)y z2#T^($8!B#QK+1m)P#1za{cwuRE}SN2I@sbjdcAPsLv$gcYkiuONjW&x`}FVeLu%V z`2Cz-2?K-;zn|l4qBWsG34`=XUIV>`9jwPhLWo{qP)0(iKHDhA62f)uN_&)WeV`y5i3mM{XgPaujMAG8%1emWL$11JY>z!wFC*H?Fp5L36ok(;iqm%yRj|b)3lidV|L?I}1zSC` zC?P@j{ejaPBkxKWqR$nyV`OPUlHMrj(8xu8sk(0)dh(Vzjk!HF@}Yz@gL((eOGr1- zV+k3036ma#{L%L0E36-ek~Y3Bz>xM_2!x_8i^YprnKxeV{>m?8EhC zM0}1$==BDv2_y6-K{zhC`dL9ZE+h4UKeg8|Qja0xEgPv%6@)DtrO!3!v4r30tBrDd z>|^wLPTKjA`~7~e9}#qgs7;V{6xw`$ruww*qjK!O*8>IhC(0BQMpPsyj;NBTf;mU+ zfpW_v3(dpmQBNn_te@aSuXFNr*@8B{Uh?!jgYpu_>YEILdkK1*K`oAaJPACu#!;)36u0zqUCHpv}}r=skqwWv`^JX z6YAkj`5rF-;j zPPG5-(Mtv4I=ffjM#RVLUVXNPG5ILnr`Hql-EqIZi-?cX{d$Wa9Hj?zO~-Qhp44Lr zv-N>Q)$Hj}e@b}J*m1w_@lryWL4O`qm+-KQJl2nT3#f+5VSNoi+c;_Uqb}Ra^@DDA6&=<9G9eAJ?_6So<+)((mrIKcRaHS_ige zdLKa-es?rsxn9IccaC<8drDs_=<(6_+N<;`L5D}5N~qTN3K}rx0#KK3yoUS7Tm|wL zbZU&8_>Ar=XwvVyC9co|1?~I2ocJd_L{QevzKN^!T%rXG=V+B)DhTJHMqfm9Qo?z7 zR$n1(IP%Zx>p8*e@Z0)5r|%Vnv$jjnlOI~Qm;D{J%+BL1m}HTq~_!&zCQ zmvW+OqBZ&=;fb?St8WsXI4iaKUO_l3wR$V}q^r?dy^j~w2eYyT%0(CyoVZTUHfW*! z1==gF>xuP(@Or{&f6*Yko@l2vp;3vOI+T0K@C>tGwr@5F%eB**(1gTSI+T0W@C>u3 zCDs{K9h#l^x+_%&>*o zUrs!3P<7~AiKh(0`p$JIciymt*_#qC7*rj4D6!Qbtnd2{<$f@1VfL>Qe>A8%^lGBT z4Hm9=;!;$iE(rJgnL%!bEzIsQq>Di???b!{!utAjDCc9?!t4=4ZZxPm)CoUsV6Jaa zhjN1rTbTWpAt44;hu$_M${?&Su|v5bhAqtg@Q`GKszaX~l4%f*=g1D_Mj5s+`wK%x z8wB$(WSl`*-_#D}3JqJB{i7k%4XO@3Iphw5u)g~`l)K-sh1prsY=f#pdnU~_2hT4758+mCL|CfiSLM}%!W#Qe#P^=NO)&u$tg_+7W&$v?Y=5b^JhGxvCt zCv$fS&%fjaB{TP#CY$75B5beag(XYwD@-+i1InXF)J}yb+06< zV8g}^O?GqVM;m@T^ALpRziN9ogQ`P+m+WQGn$Uveo*l~dGHkd$`xu1lvz>5#-as~Z z-JvYEPfxzleP&N=HGWh6Y(HQ3GNJ`+%-GwL`?_xuG!e+|-lZ3Mo`m0Nnx5?E9!P|( zhVOd0hj3ygV_yvQch57~0^AFP?QyULbZB)yqn%;)dy@kVst%o(JkX#up-(4=bto5Z z*uw13CPx}n9r|u^qCr?L%e|6nhuOV;1TX;i7MFb;F;?l;*memUukT6+8@rKe7xhJO zf^qpGIoCat=%oHZ`T@U@?lT49r)x*LFBMdC%jx8i?%O!gtc-M*eK98gbnQrYZ%*{- z+L7*=L^!%%L%Es46K8Xj`z}+tQSJv#@-rhKS#<8wIOeViVxj zhQ#6xX<;c)KoWA&jCL#6qo>PfB6${)&-0|Or8tOnP&^ z)THM<s&);xwh0w3GWwiQ-lyJxIvt}$<6i+ZB z*d7bxb@5V||Fu%w>SMCsg4};m1814lN>jNWW zWlvHYc#Yi3Wgu8BjF-Ya?ix?N-+9|Q$3eY?g;C^q8u=uWJbx|8OK~f&{b6d=Z|M>D z!SkS1tN|z0$Xm$s*hdSiG{rRg;~jO^`LuJic8$a`DDqH}=9oO6P5MzJ+e^7x)mg*a zb}jz`h+|tb`YL4*l z_{^jJnp^T)^5*tDPJPEVNbJ}1uJ*TEJ8R5kUDj*0#N2mtp0}a%xN%K2^_1^Elos}E zC(WC5mB@V@bPVLPi95y0a3#xP<-ba0`HnVAUiLj26Rg+D_CsD4Gx$rr#M(8kV+FRe zV<~fcc&iRm?Yy;E3;d^Z$4SzgXNULQtl^{d>(V0HiPnFWH^(&BBH!j}kHpr}81nJq z#{@3X$HFRT&2WFN;XP{CNbHxM=2F+sTbWKRF-K^R&&&RrPrLtr*6NCO1GOs9kQNsH zi@cSkfyTAc(3AVPj&Iqd8AYY?>3qS*AJ?jD72Qf!uHlkjhw$SkUq#o_+)ZV<6f)TmllbB!d|;K*B8F}yb; zF}%vPu#?oDi!=^DQr@gLzq;IIM7Gd+aP575CByd}_SY&_EY?V;C(xkYb@VWM@*Uc) z;b#rAbk${>i4l5%lvth(WqT=COUxR+Yq-3LN?ofx{K&(1fq5_dXLlT58~kWsJ_0a0 zYW)mj3qwTt&b_!+%iBHw)rj$Rh@)p^d?c~#uaz>7+qK5|`s3N&s%y{7^?KBCX3g`? z+s0cJO>^40t`B?QNTR2eC6P~uvHdqjn2%wGQSZNMXXm!@mS3;$uGK!`H?*AZo!=6T zj~hRB@ndg$+gx{|_|XGfXl49bj{EPMf$N0dCE#_9g0^+s(Ol2>K5rFD*K2Bi57T@- zFqV49uNm6&5-SEh9|4KoOFk(1t86P-C3YX_m(UTQjPe*+Vin}Mh%~ieh5KFP^A`=R zDB-M1d2YpT+**YXFZ&pkHRtiWudc}4`aWs+$Z$<(`6R_bPYb=)mKfKdw6G7a8^K(A zGetNG(kkxEnEQB{tZfv{T*^j$?A)sBx0$bPK6mD5BjMGDh4J$v&j&($tI(J|Yp8eF zDl6l)cWztgHQM$(l$97C?JbnQR{PC0@_P|E5Yx)|HD_ndulvJmc_?LJShnN*^0m~t zcCImxk~z=k+PwZdYxww^+k^fcYcHc#Rdi|Isvw_seLy z^l$dz^T>~=yj~}?#C4?Q`FPMsqNi&iGWOa6t)1_U`n8a^ur``0J{nxJ5j?HGD1{mv z6PdjVRxIlpLo3@(8k80`3?f_EKS;x`cn?vYufwT2`tT9MnUcl4@EI5L4&(1S6CJ0r zD1YrtbdmHuA*RG|2I1W$$XnUzDO*MYT0OW7ViG zOX9tCvlZ_u!|o%iXIEDq1`Y1CSQ%<$I(oxCg1jnTjq>aH>-pH&AG_i4e+2dP`u>9< zvh6oTZuitEzAoZpT^5n&SKxg8nBV!uyu{3X=R1+l5ze^lp8sTO^R@JR7G{Buh0P() zc_jZt8h*!&=U)JgYc=j5E7#y&bL}Rxo|o;c;dA=i<9Cj8{Tlh~H&ZWoulcUw>)|Nr z`B+_lKb|1ZZ#qdnV&+v{0`ny?loqCgw6ai;GV=wguoRH|dZXi2hk6(4y-l(|<@q%v zziQ$we4HYf=h~b%A7}VGYh1(I$)oXcxCf5U5;I>f@s(`eDLC4Er$~&?9s2y520dlk zQ!Y=w9?<{VdMu@gQth>OTvz|S8qJaWz%`-Np>15ld&K)|UYVUW=H78DU$N#q@2^>d zc`J*cyY%fV+%a52Iu2K4>wc}`CYcE_&kNuL^H=R~g=VJ?BMdp=;tH||P z1@l$(_r?mhFw9$7IIU!ruC&eTljq-s`@<4TAfKi5*}od{Tu%~bUt)Ma({+!Cm*Ph} zo;Uk&PcCyP<|vZmNS>pZg^;(fTSs1&Z zz56Jd*&icY*h8SVvboeAb6q^o`{ne)md__2)L7UuD)kIVc+CP*VR-LdWxQY9pG#gl zzT$SB7jC6!sDY88{QpUx_0Zam*Qo97aoy+P8nfs1+t01$9{r~@<}(FztYSj{O_#o|5wZZy+=j!RU*HV;j_v0{7mgZ z>#aR+W!}H4fxAPb=j)UE^G_*XYnAdfY~CY$-ClofbAP@&xW8F;-gj8LL`VBy+rPXn z^BV4a=Z9b2acREZ!|O2%8%Vu2UlW@3=Ie9r)81d#b(FbmyVZ4F`s*6km3$(7QqCOV zznYJw_VdqdtMti`8j8uU!+BpyL2soyGcub;uMRrb!e7twvRv}l5wDUzUs3#(NGjFH z{oAkh;d2Xg+{@xtnl-Z(ugT#%O{6zprH>|m-p(1F@@7wOdN&Qn(>%7<&U63Hd!$|C zYBPVmfbXeUSRU1a^A2|ps6Deun)70h&^0Q**MXmlOO!?tEwu+^eSilhii6n*pB)f>KtY$GpUN#7u z<~!=&p$O)7Udw+a#ot7d=XveC&AhH}skJCwwV3<0mA4RTv@o9My}MS8*Wd5KRF}Es z|GoBHzYX}x*Y#QG25Nr{^)8WWH}4T#+pfE&=Cy};*XsRczT?VFqPb`7xFZDnQSPuG|C6Px?Bh-~q6Y3bLA}avsP{h=L1v#`qa~<^dtA^SxL;v9F8%sA z@b>&qL{r$Y>$VWBDz(%0Uu@_9bYzvC`VB2d9~-q_`){@X|70yTcJ4R#2t76Gm;P_` z>;JDBHTKPav8U*-Q-9t5?f(96s9k4Q|63z~rQB#7-2X%4@V~7kZtUlOV`Q+bJB?45 z|LFMq&$sIOXJr0;G5+lg^z8U)WTgbJVYqao{BM!%pKx}4a-g#Y-z#ywgN)bGuDi96 z0X=_jk-tJWpSe)u`t)^s{$HKI;5OTVjEf=aTDry`5|4uR+>B11XEoYyG4u6@D&w{_<%!lQ|-_0yr8prab3G6P* z1a^;QA{#GFWRu`;fproqk&4({>#b037ORo&0{@3ti!>MhRDq*oV8AuXQivKLXuHke+~;Cs~#C47-z^VTJHFiJfIL*g1%Q z0sbz+-?yyU`W-t6f6dk_@OKsdnAB#qNIuL8sVsGoWk@yPZc@DLD|J=+O1woo5X^^K0sO_4}dgO+9HR;UljZ~;4eYyYaJrpq9jY(Su*%1gMW&2zmg(72!He7 zZxSn(HYs;Y-ts+CANccO_e#EUsbp75r5UUg_z@|<`UvF9r6-hf;Bv?ZGJKX%2+0_d zxok$SkNRe^m_A?I^B6t}D3A1c@FeS) z>M6zKSxnYq(&R9|aotjKq|k9aQ^tdJk3EgWjN9**$2La$lD=O`8cP{>-oKEI2E7kO z@L>g{DH=C0rH~bk3ro41y`OzszZ~h#adDt29hXWnD`gIQCkcM*1+1e$Gk093y^t** z2Tv;k&#@^!?AdW+2lz02QYvZ+QcB@jGV6Q_*~{amfq%oe@CNr5u6?$Ne$?$CN7eg!H;k6?;f}7Fu$C+=`SOXv3(K(^U2}MLtbW z$UF@rxgzK^)p(Ic?;^W0ZhmkM{Br0DO=6?@8x|+Ec z@>eqtqzsfU^_c`c#b>cLLoG|~CqTYqKg(vTZwGowzP(!>u~nrPo1I$UXq;ENa8u(t-Q~ev74yh`+~G zNciN?<-f+7SAwV0emBSp`*Nw@_$w(JApcX!-BQB%^Zv`F?D4pA z#*Ocix?Gwu{(#?dY0mhr{;x=t{`cBZc2CU(|B@hPski3`6iK*uO5w?%KB>hL?vx_< zC4rda9BJP8RX$1Jd1laJwrG6+)Ew!l@s89?p;<9LIkk|@j==Um2d%;x8Id}N?WVQ; z60~Fvdw2Yp)I-vTunAr=1B+FqK!%7Q|iA0`~#XB3Gau4~*so9og0e$<`LViYS zE&0@1a2;-fd_%$}%f{#ngEm>RvKkVuNI2S?EdLyjtM{w%`~7epq1W*H5+$jpVf9{) z9RzX8qi`LTM@3q$jPGy9$WD+?jFVg!H%32}nq!%owJddvWpHQ? z?4bS=%2UQz@MyVI!Zt6Juop{VO7ez=eJ*aNND+Cn%IR;P}) zgiUxND3dgq){34p`es`3DS^45IWuUclUNuNvlTp6D-=qmMH z;HCaC(2JPlnU>g_LIblck^O$xua#ksnn+(syQ~sM&o`wA;^1tiPQW9>hzT{RGcBk4 z$MtVzw}F2v^S>!6Xr{&grXTtj(ta;w`4e*NRWi;(m5k$GC7;h-0}<|-@N#MuwW>ME zPn%k%s5i8!Ozsb|(i#e~Mwtupl>v$VZR!(2rvuy6KLv#cwW-Snz;BeOT}eJTU?FG< z2h0sRBI7u;smY+vk#>(7D%#?`hJMcL5JuZG>2WB zFa~xCKDXK1hNFig?}R*#p|=f3tbqDbLC+36MCY9`bmm>mE@moD>~%M1j`Y)nE~&CK zJZLk_4wr>N??WC(wUx~aIsy{=)yn=91ix+$GCZi2Jwuu=g3=*>I%pI~MS451654Zn zN+lg*YiUkvX-+HQ{Mg4?3G-ri*2=hZV{ACWF}Az1ZURlOtlLvgOKuZGA&FUTv$9x;^^gJ7Cib+#UnnD&b z5m)K(i3!fDmhltsy78DLA}km3g^<5$nMLw$l5>RhX0TR}W+BNZKuWZ)3)xDDhWS1A ztFSV8w23gz8z!Fj*RA8m&w#SqM4UfB{#}Z&3uGZ{g0fdF$0>hqVtM4NneuvNrsYikW3|+O>zv$2_&bJEGBs$$wx@e2YJl$LFhuLYZ>Ju z!k&bDHCby&t`+)~px;EAI*>SqYe4fhY2G8blk|HE&ih}roFq+Q&|No{(oB`oiY=wJ zS_$*wlUhdevXthoisVYmnSzbZ8p_uS&9?+P_`pkcj^@mA%8vOn$U5)rm_DoyM0w(*X4YCGJE)5xEO_^L_FSX$wDP(z* zam7xZ3|BR_J12)jggKM(DrL^(__VWB<5`M-)v|Chu9hcAJ`M6Ljrmy`^Q)E`(yt@= zGRdtZ8%XXZ`4P!aNuB^%C3>`GLQ2~6md0otw{w%9xZ!!rmC4zlxfER*lEaiK`~9A` z;OISX!I?^9Z-;$vPlNS51$??snUPjUaq7gJ_M1|YcGVI+h3}X0wB6Q(DGSqd>rWGA zIPn?)cT*ZzuUdwI#H;$T1Fl-ekY*gnS*&o%(zF`UwmYZXn~YZxe@r`OEt_&z*fHy3 zlGqYh$yDk&lIuynLh>z=J3tm%_^Xvca1Gx^t3}r6Y^&kXb)}_g%HYry%7oaQ@LCHV z>wHNcLo$$L2+6zI7gIip-%ii6Pa;i{hR5V2cw+vALC5G==d0my+m|#6?5im?X;-a3 zPN@ayId~DQMm(RwYMl6DS`Hnl?qxtnnTprUK_sI|W{{jn@*a>9oe^@W z_FSqxSDTvEkd_BMYDz26K1hdGj@tIDT?u&_9w7@^ImFkc$EO~Ib#=$2&!HClEfZf2 zSF8_2J2R+|JwLT2t%zb4X?T<_(r_2#uq{+?J;)f+6q8Re`4p2T2I9md7qY)iy_6Op zH%}dt8XzAdc@gR@CTkH%Y(rbxAXzQMXm~{tNMjX9y};UMq+YpKRU7FGDYJpg_?(KkIn`d#57Xn(=D{*WJE2v@f9w8AGs1Ehxw=LgS{A4pzk zzZ-hA$DSiEDhy7~k)JD!0ngV9Dx$ zu-<%9Wq2CxWqU1+SS#qy463z^96Aoh6UXf=>1*j){Va{fS&Dg<;up{>{Q`Q$T>!7d zS&BDB^VV_2=144mV~Veid(&6PP|1d2h?oIh2kh|rj(;iCSEk8T00>+_k+7pz2hVpCEx6_Dim+?0p_tE%lmv>Fu zn0`pcE89bIGxYbEykh*T>Br=+rahfdAzzxd$KFJJ_tkN)1ww0^(n8>=zL)JG@C%x| z5}Igy0;&B?v>%hmCzGs&mV$9hf-}iKiF|UYcX-cdMrr}Po`N;6<31`QeVLBCuT004 zxs)`OGy;`69$PBm8P696)sVi5^i`xeO=Gf{eK>w=`eHaz{Wblnd?L$fzbaoMDGkN^ z4I~GUj3o)bdzoHK(Q4^e;%aree$x+THo>TVH|^DQF9p}(Zdsn5V}DZ~nO~6N1Db>B z0ZOmw$I~N~e$!8<c0%C(Zcj9^`Z0;X}Xim8LA1?gY=J5G_rqB3Vmv^K|cw z@le*6WPg&O8Lvp_KVErjda!??vTJ&L#w=y|u#}8KW&iX{ke^QD&@cE_DER9z6>yFy&d8Cv72OMR=Y-i{#bZT%mMawhlX+3P9m>ZPZALfJJs|P8>VtWEq2;Zjkuaw{eLl`8wEVT`Gnlp0nO}fBSk#gc zpng$wE@KdRZcxs_Na7tooLRghmm_^&bSYyWQ)et5yuso%BO~sZ95Um(j7Sx)C6-cq zYN)^bb#$FuOwZSS>f920-rTp&4S!>)iF()MhR3cZ>Rl7{s|m_Bq&2zWIid-Aw+1Aw zA_;$6r$WNt)Txm07kMfq9E}PIe@SOM!(YkS&hXc9&UVE+LTx0oEeGMwMwf1=@g3qATNV^cR=3ANpDCA7f^G$f1xAJ~Z`3u&}xQT}d_!TxhdR*-%% z$>k(hl6;=z29mFU4EBE$q?WlI-Lo`PXWj5fdzNPKEUm*~(q%?IhrmVoqUPl7Cwsz8=XD^YKG z7WJ03AOkJyK@POM1Tw_(D#!@SR;??mwA6!KWLe;@F-_hIvWr{~vR2*>a=pA0Sr>zELrtNumoP{_w7*5^ ze*0f3{nUPt(&P5;DE-R*Bct6vhO?tXcc_V8Oo>5YC*Q`+Be4W+?; z>nV-)d&Ofdlpo^vmdAD*V;O#b^;ip^W&F_I=#d8B!_Dy9?Sa3Cli~Mwj~!hZJ8s`k z=?K3=9y{RkUpM=G<8hqQA3cu4yK*=C*}CrN!`KKvFG`QwgS+;>0n0^poet>;zqqcC zQaYyVT1xNex`WdBU5``xTvzLj=(oOWe@fr$nnCH2uG1;~w(FymdUjh&>ELcVD9!Aa z(HHBV+^rDO48NJ(Dk#0P+gg9r-_z|lrDfe#!$4>FE$FrZ(usbLb?e^`?HjvQK$_wA zdbhQZPWOAO+XhG{`W@-EyFaFF-KGbkpRecfARM0{Pk8`iclZT+u7&hwzX;DAlqP!0 z15uypSvv^R9MA2LX84Wr3>=Jnv!^u}Ip4ECrIS1}D4pgxozmMpAEmU|b1kKJd+wn0 ze$V5SKICZ)!SZuGGbo+!Ii1oao{v)cq~}^nt2}p5y3(@|(mVW~^*m0z)^lwrmS68# z3+WwxFL~}De%12?@m5b67StVn^`8A9z1eTOXCU#1o|%;H^_))nk3AoSG{f(oo@*&R z;aN-e)1Ets&wDl!f8%+a_=@KV;vYS&;aJY%B}00LpUta3aTl))O1-?MQ`*a`i0n6d zJxc8FRY`o4*IMGiUbV#GUJb-CUX8>FUPp;jyaFRIeuh^jrP*FZl#cXjr1bY*awOWv zd1X>s;8jU!p;s-Xw|X^FdWV-Bg?=SonUvn=RZHoEUUD?*%e^uwt@Ns;bg|b7N}uow zj6wTTUYV4x@T#Qr&t8p`uJHwBOr3kkZ-RGbw$zdnKjwx;Ij~u)CaueoMP& zQo6i*5vA4LD=A&oy^+$@-5ZjzJ?pwVQ!w4$y@Ap%x-%!vqqWCTNI$e|Jy;s19zFai z?cM`!n*jIjF_lu^9&;%T=&_p8pdJmB2KP8hX+#frvmX3od-zkD*kdZCsXgXWn%QGD zr8zwsC>_<~D5W>|U>R60zlT4ilX}dhbXt$ql-|~(fzsk0M=8C#M_?xQ`~Du4Lot1* zN6|1$=k_Sd#&mv<)j8PDB|R#KBY)GQb_AwZddQJ(+9m*Pes3S@1lEAV|vcJ@)1lgc{ft}op)e4a+`N0rBYA10$J@@ zM5%kv+Ih&HJ^#P0Zyxf5A*VmgQtB)dfS2{b`$+9xR%qs!QRh_|0cMG z(}Tg`dx$?8JdM*6!P*zZ{~R37=`X=vPJa)s<@9oJ_+Bd4LZ)#V7_t#`NQ*`x2ROYw z1Yh|8-z`J~9nm5;q=wU>AxjUCd}PQ*PN#+(;IuMC`-${6hD2~$7gEFNCn4HNlJ5wa z#_8uF;q}CS719&5Pm6CuyqrH2Qp@QNA>pT}{A5TCr)NSUekT4x$TUv>2szBD;)pm+ za=W9J(*_Rj8RCN+HJk=Jw6nxJ9bQgbI1Y0f?wEFtX6X`IG74s$xd;l&617-vTfr$ZbOzZ0MBsNvM-&@K``+%b*Q(T-Y9 z3mx7+NIua~%jx5e@Jqx`b<}YBwBsGg5fMoIF~>Ace{vk=^t2=5CX%0b)N*>!;cY-X3$5W)57inHe^aQJ)5f8P zIlU!x+RY?4Lu)y09va?=_*S9QIK4AeYfOCG&>Bwf3q8zfr_hKXl6MQO;j~vMzT5!5 zUuZ3-F`>0##P<&kcN0wsUD^uYPirwabR(x(p)8zuZ)i(ShlSeNAm<~Y=lZQP*O?dl z=^l}5&!UMPBYgt0{MD#jOQtj$Sck{o=T76tTRi^ zB`90wdG1Ogp3(}WI`dUewYk<)WxmC^j&8wGIZ26b1g$bfZ6u>q$F=MIq@Q}$z+0VJ z<}Py+{mOIHQwpvc`EqxadE6uN#9d!@4&E$H^8Tksk0c+I4~%>Ut*A4DBI^-FNMwog zAh>#y{8IV#zFNUj_#!MvEdFgF3yZ(nqW?@z^nzvE9<`Jrf=-~<_D=W63bO(wb+T{z zaXuq5BeK-&=&nRdt9k6XTs}T>JmfS6)E@eKl*cdnuoQJvN&VT8M?DK87eX7ok0j>B ze;*gaG{v1|H*k8W&cF6)5!fJ^2Nxt=--WzpG3BD?vDHtbBg4Y_D3ExzmGg) z{t$V@tdHDl@_vDCow?e1PSVSf)ut`#xET=jjo-{C%|=m2QD>DI93{qA%qa3}%@7w# zXgn*iE=$e3quPOA?d;6;dqnk#s^YVz!i=qfWb z+8s@8DRKTYdV9236=X;D{$onfP|vr4k1F%U$WGBcqa%^GJ83NqKyGMsD`$z5da=$N z8@<74C5m)B>aR1uF`tO06=`=W(4$c=jcKA|Z{_?Bcr^AzY+LxEo;U*@J&tHa&g#j3MSqQD zanx?H+vss^(K0dD$yehzaUG(3NZg%q?c=(}wQ^!qIo6qii-!l2V!gx-jT;m9WL(ea znaI&fr!+5aS=@@adbD;;+@`p#ai7N>0bZ5X$6W>=5O2nBjk_&gc#81!jP}Iaow4!D zV4V_g^RI=36MQ^sGnh#CLR4e~O*tU&Ts$=jMdz&TR?Q zBcm3YfrV= z6uILPL;H)d5F~l~Viu;*7(uTV_{q$0brsz51_qiZ;?Zzq<2U ztKWZr_0LD6j%q}0)iR*}I?N@D8{D7fcs6vz8J2c{5&fw@NFsJFs)2U!agg_n{yTJE zjHFpd*B&bs_n+V2%Kuj=tqgxVitjnpMAxMi{XJM8o_N{~J-oNx@4ppgo_HGno&68s zuhb-o7^|bQ)N13^5&W5ZB>4rdL;lEX751y91E|GyX6S(C16mEBtJ(HgyYt=wo_N~N znxk}>v)t{87vB0_BlpBpNyY$6v)n!GN?zDa98k)AOc}5qby#|K=PL($)gwnQ78cA_3)Dp>y*m=YmoK7Cso~N26(#)umGlSNLEAiIEI}&T1e@nbC zu~Xu4=W#x_dL|A`JOIs{#Nmmf6KUp8PCVs&GI5`C2IR97kMJ}XB@~@Fd0FE{v?B2w zcCRDw;4fX4`1_TaYspt8zLK~$v5|}BLL(P>yVm}LL|V01{cTRvp!*7>r1x23iSv~6 zvh$qtNFwnR(ecEq`)`T!TJBO}!=#X;I@6UDjz58SC8fL4UH1V+u5(g}Gur6}XaMA_W1=rZ5O|DI@Nl8;sB5+1hbJy&oR<5~8ce)lNwRJt0 zbf2px$#hY4tCD)VDAF}a6=rSHcGy&yyMezaX~}`f&63^8RN6Y3MiAqhEUp42&d$jb zcppu0UCs4Pre4N==1fesMm`-m({+`neJU?G&NU43MAw+)NY}XJN0TWMs%J`ag?Y+Z zZ)RXu8;>+4X+d&5_GUUIE=%5!oPqHWXGWs+<|dTVogbBNLyQ;!c(CphX{YMwK8%`Z zUl+TNK&#FZ$!Ab{0V&-j@K5A>qh&XxG)^&7db^sZ+zD)pM0btY6H@5fS%F%6yW&zr zE9sg$5OTUBp}AS&9EuW>-jqV=+A?Y)elbPd6V;hCw!+`ldIY~NWmC#W_^U9t!rPvduTyBA zSxNK&abmU!-s&qWZc!VJqwx7%%F{gNBPrJ1x7gEuO8Fi2P~TgYw$x%5^^U~{rPi4R zS2zc_GIs^`t6NhiJ6orgIPXn;0J3{isjb~o&m_~jh)kWIx+ry>^HbM4^fz5Swu>LDuRltMh52?qU#GL}tT0NP1GBw?G26Z0iGnn2V zIp?&e(afV!KkjVG^EBsal*5xIxb93lh5aNv>Ap0YLuZn^rS(qpq)|lsoM$i>t1zc% zJ!GV9Ps&Rxfo_R&JJ#&fvNY^>14=jV9g~+eIq9Mlp4L=WJ>}v;3PF&}-YW;lRYVd3j8&qoA z2Z<9Y|v4bm6yV9g&?Hn0fs&`cHc%8K&iL5BvBv=TFR`kzfh)5&a4^ji>uMJ~m?CNpS*yX#2fsa-W?%(oT@}va_oh~2zS0~H zPnwQegw4jm>k##)u6@o=2X9Y0fF1vz&*=)2u6neJz8oyt8J=`bw)fI5x`tDtUcYJkX?Oo!Uvm8-StcP6d(<>0md+DEm(mWP-#dN0Hk!}yewHNcQ z3Rks5Jmz|{KK)!eUE>7)4yiqiMvyEhQ61u3VvQ$JDzWYkC@P^rIZ712n$avHG^1e{ zU1#e|H*&Xe$paa9XAAzR9X&HBN`a9X{WB`elnjbLBg2RMaA;b8`N&h`Ph`B!XaBR{ zpUuF^%iwi_D|Y?hs>`UpGPYId%?fi{#upjiX8e$0^(e)Cn)@9XR%-qZ5B5yDvXt_e zZ_W$~YnCb2lPj}zCdnIyH4OV(W`{63U*4A~?s~50J43TWSP$;$D)nThLZ2*#z&;yX z9lWJxiaVo`;HpqU8sjo6GatxUlKCQJZz6pT>DQS@5DC@#Gb9%>|HzC8Q?sJN0Ok&McbOZL>1Cj@5V8dllBm672vBnm0Q!PkLqT1hq=z zc?roayTMuXuFH+fEvY}f>VabOPo#DI9JAgzyMC7CX61&FE%gLZYmPmP_)46kvxbJz z*ixd>qO3=={*IE7VFHVhFV7NKg|brf1xQ{(D&lrx^^nikA)6aE7qg<&d>?tD{-1i( zWz7xSibOrUo0rp_Q7Ntr-%86LP)hssT;A(vxzvi5;`=>ocGT6+TV_WEWS6^FR+L?oJqh$7iI&V? z&&p59e&#w4bFvp)Cm~&mbaD0~zAmg*{{KY9%2|e9sYkz1 zN~sV!lX5nOi8=mcP8oFSOrckqGdzdVQX~tl6=tonm8h-S9PC`f>H3`aIQ@v%zm?~A z=g{i>GUpS%Ldou1E}!i_%4vPhSxztJSiV?pi`=_%+vS#;opbBVUdU0zvAL(5iMb8k z*18*%+mydgmX+&pTTzjo_=HjHZa&!8nO)qYKp)M$O06-XXvlU(ZkU^P2`h<}B~W;> zEQtDFCy1vtN_2K^W$u#PmASZHngac;EK6%OznZ%fBSYh~0nrV<@~H?({Ovx-{RDqh zr)5d??a1xu{v0j(n)g+mc~>sArl<;W9~u)Icj-|*RT zXI>9?`@D|89(fVKxIEEoiFvrw&Kv}61WS4cwF>;OyejkRCze9905UQ2u6m`YC+AJc zn*sYNdBu70ZlOWZkX%?=S|ssrC&h22iaeV4^qEUDXDQvuItB@WWpzncD#3C z19(MM!$rQ%gqjGH->Kc#6PEi@f6fL;6hfb?A{j&PnHVJbZBO>NR|bSTsDyT*kJY$8^VU7WEh?_Ga98u zkc@|9B72xkf^;$)&K_eU+2eR3%@k-%Md>t@&VckONS|g;Fg#ZRy-~tuu_`v3En&~H zrEET125vc9%w7Pu65PwcSJ-N{j=jp(v)9<$><#t~dyBmX?gMa}*hcmtav!lRY%}|W zeayD9Pw}^nZD%{#9=40^W1q2a*lu>1ea?(hK$jW5+^hm?Djp-Ow@ z5#<48w9-WxqjXiqD&3U=1m0jLisXj_(`( zGUiU;?_=%*ULMmK_~RYj{s-bWp*<1R5st?>p5fSFEJYhSwlDD3u`$5=#wGx7Yn}w` zH8u^H$R&AWGmsxXHWxUVOG-H|8T&9KuZ$f96m5TJY(DZkc&U&JP2oY53O|3XS9lh+ z3(x*B2>-&fh}<6!^BDXkp<^c?lG9@!2io(gU5)c8PBZ^$;NAJuMiEuld}>`Hmx$U2 z=9f@u{=6$VCVwIFkLE7{mgJM?=klq?ghZ6SlD`6yL~i9T7p0BipTFS>9?q{t{fLh@ypcdU*KyCS}j(@4p@5?474QpFES|+{(BZa1WDukk-#y96u+oTc&kq< zfc)`7!W;RY2)Xe8bm0@oFDaZ3e77M4M>qmX+0U||LF0{tbYc z&lfI+PJJ4Ac$|A+Mav)&b6AXmn8|X+@^vcavzTLI)-^0z2`g4aQ3(t$dKvjPMQ;MT z7JUHhU9=gPTts`qaE{Ztq@3qha@fC`xZ{xg zvk3iHfq$HB#{CSd#Af7Sc{7UP0q!k!9C^;+IB^`!`I2$xp;Tl6*2>l|6ZB0>=!FBREdtIFsYz@hxDxY&^C4Kcl~5{O!!@$lHXx#fvcm(-D6Ub^9$G=Y~gk;WyNx;epPXb@yel|>)!6mbS zA5EAC{B{D3jyiE6@=YdE-;QI9@wvRzd#PIrHwsHIRQa@eSZE9-+W*C%yy82_C~~ zj=yrWO`_HXaddDD!eMvZ9j>w_?;$wjC@w%HsC*t?XOWiIEiM(Q_&nO4Vb9NTgH>rCr1nO56mI|n@u%W+-T>GfCwLXlF>DOH3#WIL{S9Y#6({mw;Qcta zt9Z(!3G9M1yNVOI8`u-4cNM4aTY>#pD_|tM9T>}60~6p$#c90_Fom@R4un5EKNRPC z6=(7ez#N?I@mt97t>Se4Z@}R=<*PWOcLz?!DId?!XT5-rp&k{d=)SjdO?0P)MCYyj{x+%>2;XQx2^IZ(w}I}P{+KB!XJUc{x~ z)I9|GuW;9(u&;qCPUl(3e*;u;9?wDkAmUZo_Z$!5ZUeuS3siAJ9|}B*y9*U(_z}P# zaCf1wAAu^)?W2)D0aS6S9}7Im3V`*vH^EarasQ#@4~~VdsD< z`vrZV;yIa5Kym?yJ2Yhq@+uI&ma9w!Hc_Sn9m-R{P-P~tg)$3xhf)k|qs)Q+-+(Hf zjai0#JD|$CDf56mm2zM&r2^PjSqSW>Q~^E8VqlcA1Q@OS16DCW{L-qj449xi4;-kx z0L)QV0)5Jhz=xI9&>RNDm@2OTM=EQ8qm|czk1Feck11~gXDI7|PbqH$%awP5)yn(8 zWy%M@8s$Uyc^;^;^-3M^xUv~|LfHcBu5JaUtJ{Dx)E&U5)LpTY1Ex(8UM?gdt< zUjY}X``~RcP-V}l`;lJ)L|y84z#8=+@OkwR@D=q4N?!%4Y>j#h`PYCddtLnz__lfi z_>OuK_=S23_>FoRcuYMDyrBL9492rev8HUl0q?V21op690`|0B2KKTk_z#cXK=iZC z2K3l;V64r6JPxR`Y+E4EYij@;X}cL%XlsnpBB071w>1Gyu{DF_??AN377Sc(b3n2I zh~Id&nZRFcF5r2a8+gHnhw-srZMOn{v$X>LZo3_L(bgK+NW&uqS!1mY@D{BtFc?oz zRauDE9_Y|I07JD0fUUJoz&r6wRg8kx75JcrM-Z|eS`T1vtrxJ5)(04&^##Ug9$>r{ z1x(Olfc>>N-~cTFn5Yc^=4wfZJP(LgYbnV4fGQiIr2$83gMj(k5MY6p0W8$AfYY=b z;4@ktaIfYAeyI(G?N>mReXR{cejgBHq>Vs+KM=oVu8jizq>Toi(#8T$YX!hFS`m=x zVCHrHnYTj;ZZx9Y{fR{9*&7!Fj~ z?RpuolRgjFMK1^T)+>NX`a)o`UIon57Xx$kCBQuWA3(3Z4CvFJ2R@{~0352X1WwXl zgy+dXtR{Um@{a*AEA&@@Pv~oaf7f3JPSw|;bQ%!7q`wJ#Nna0qS$`Y&ivBL}RsDV7 z8vO&{Yx;-4wR#=!4Sh3g-vp{`gT4j%w}JQ-Kz%E4qrMHeN#6mi)pwz^4v1Y^-;Mlc zpvpeh_aMIosIqPPUf}2YSHL~`KH!)7e&9a+JK#6^LEwJ<5b#_52=JhO4EVkNBk-_( z0(ewE32(=M_%$#66!46G8hB1W3;ad@1$bV+0KB0822|`9fsO2!fQ{{!fkAc!|4G#Z zsIsPZ8!*JK108k)=(Go-)CI)I+8ZG624ZCGHzVHysIuGaje#TWO@M{=X23`7!N6&D z2XMCC1eV%ezy)?UtQG?Cd(ZY3zz^)V0yo)P0Y9|g4y?7e2G-f{0)Av~1N_R~7WlRO z9^gKEd*ESv2jEZk2Y~17oq&JX{|%@aU4a2cci>G%4`2hM7qFqx2iVByi`p9l(Q3m3 zyv2wDb}?drU5z+kHzNVq-53DuVI)DnClI@nk%D}0AXc%F28=KU0b`6Iz<47Ar3pY> z*^MmZQ-LZ=Gjfn02vpf1BMKz=9?R~DlP`C&j@S&Z?>j{sssjETTe#$@0l#$&+I#uLCoV+ydy zmtV(l2kz$cA4kW2w$)fi>KS;jozY@-}lWmEtc z8w-KY8CAd~#$w=7V+nAD@ekliV;OL@@jUQl;|1U=#!BGp#*4tU#%kbO#w)<}#v0%T z<8|OBV;%5A<4s_#u^w1wybb)wco+Dw@jh^i@d5A?<3r#!qYk*;*bLldYys{uwgSI5 zwjusQK+KAO9l(YGyMQ+b>;^Up*aK`FuooB<@D;F0z&@ZeU_bDlfbW1^0}cYa2OI)E z7;psGFW?w_dVsi21^ft%3pfFc4>$=-2si~C5O5lp7;qMt6z~ghaKHsv4FTdx9q=14 zBj6%%Xuu`N9|o#ySioiA@Bqbz-9Equ92uYk9|r`I1f2!G6Z8x4y`T%gjX}QwHw9e;)&^ZN3YE@H$Ku%_ zU7B7-zFX55fDblxL(;Qp0iH4bWK#ui^)_T@z0Gj`ZpF@f+u;1%h4sdXyFX5`XT6z7 zKD?uS)=Piq@$c5>y-y&`V8wXn`n#2^WJ8vuxz2WM(!T9Gq9(WMS}K68mMMV3F!`1$EXt}KV2}zHd{bBb7`WpHg`*n?X?}S{b)O5yJ*w2 zo3#+Fg?6XbUhAUu(&Dt{zJXe{_OOOg)uw92+5&Bf*2=d^TdTdNeXQ-&?(}`B9nel_ zZG7i7rr+xe)SK!qy_J5yudUw6*GccGN9qZBs-C6$^fCHmy_;`_UaD8>S4XB=U!}jH zZ_+>2ztF$af6&k9zw0)81A8;O%N}k&?`>=EXzyW#$eP^$?Q|o@UGb6wVGD3}(MqA?nqqh-d^f#!4W~j^O^7WFrUOXRh zg^Q59$4}z9B8$F88to^KyRIbenzH_XDeZqlJ~Fl$VvVQ!@?byQm&VuqSmb?d0>VV#(Ty$kRJBc^Ri!o z?4h&XdV2s+dy;-}#Ev&Y>6a!L`yBsaP7<92{1x<2mlr5QpB!4RpojY1K=wujm0zp3 ztNMDG`Os@OkgZ;3`KJ22g)r7b(Qvn_;a>G_)*Go0QUp?8q<%;qq)4PFq-dlVq*$al zqhT86yh6ZV<(WAf+Q^AY~$DA!Q@wC~+(o zDG$ku0Y#v@I@CvFpwCLv8mdK90&J%;o+cIYSY$s6^FhIeh~)kIRKq<2c%Tha(g`$_t$ zq_0W3R?_33AzC?uay2PVMpt;Qraz&^(>P0ERyvs zlJzW-^(=xu*)38BP<41GM2y#SvcBhJeb34Io|E-GC+m9-_6D~T_Df~GOJ%)FWxY#f zy-Q`iOJ%)FQ7_pqRnw??RxRtVmi1T5`m1IA)w2F-S%0;xzZ!l5xV`XGBjc!%an#5- zYGfQWGL9Mw^j}e0( z;ctbEYlVz!g^X*3jBACAYlVz!g^X*3jB5q_kiQjb9)-tN$@o^u_*TjIR>}BQ$@o^u z_*TjIR>}BQ$@o^m?@inv`PJ}l7p-@Vt>u)lwuYR;v>PSqR7s~xS|RC+lJ1xEJ5DurNb*M{JtpaolAe(C zq@<@LJuT^3PBpxLC-&hBl5eaDzKNvGBn_6-!KubfQ0h-pqy1cCE-80Qxtq%wYr*CC zZiA$)ByBC}U6Qtuw5_D~NZMY~4w60~X(vuK)>WIw>+ddU4^HvT38|MPX_}-%B%P|Y zg&kwlL8%?nHF5oTO7c&Er+M*|Cax1RrF^E8&xG8D@|l{r4$P9}vt;=!Sw0Kpw7<{N z#Qt6^^@^olvD7P;dd1MA{km8a`}G{DKS%1%k@|C_{v4@42l}+{&e6oaStjkuq+OY` zE0cC*(ymO}mBEho%`#2wck`tEJZV2q+Ru~r^Q8SeX+KZe&x1Yfck?u{Kb1>A<CG<(k-^K7>Dd)k(i~@Jp}FlHV-r*^GMVwMELeNck37 z{}$9wudT9tt1RCt%eTt-wjw@yZIgQ2q~12Ew@vD8lkM1scF=2w)ZZcXcS!vmQh$fk z-yz$*Lyp@nX}3$-?UHu8q}?uQw@cdXlKr(yj@xc&zgybxmiD`){cdT$TiWlI_Pb?& z@0R1XNBY?#{p^u`_DDZ_q@O*~&mQS#kMy%gj@uqNZg1*hUpXS_F-b4zVmyBXrFHn5 zF2?hsABG?G4z|IyCHJ9R^B2fznT)^b;uk1WG@F(odlD6Da)z z!Vj&(K)YCnOYCAiZGl9w|2J3)%9vZydn9eoDfa0GFQOFJtwyhLdW2J49~uikV}pdB zBG7J10p62ehO`EsfE~lF+cJDsbqv4!w~T$PE@R(<9!0803e~nNO*OLl z0l%vECw^g1Q(J<+AL$OHc1RtOdLpfY4<~3Bo?pgNIW1tj)p@qV`Y~o`ky;?qZZ%R< z1M{`Rjh3WfXzpmhJBn1gqRCg}S$#(5M~oa9mow}UHmV?R zbiU8m&O34>SH67vlgA>im|eADZ2Vn|@w`NFhuaOb2L5WcXe==)BI%Xl`O!1qJl1#p zy2bCjebZ}wX$AG^lAbm?e?Lh-glpFYg%8qI5`xNd#OzV{NEBX)cBEfRuGZVmuikddixHx=F%94BQ1HDEA6l0K z3H9(8Hj%erDB4=c`|4l!MN4)ETGI=bG&Xp{miJW-?=6zF#P`B!Oz%go?G;X3bs~8i z5@ek;k`#&6r^L~C;=6NK`u@gkiR5F^AAUw7f+CDVp - - - Rhino.Mocks - - - - - Defines constraints and return values for arguments of a mock. - Only use Arg inside a method call on a mock that is recording. - Example: - ExpectCall( - mock.foo( - Arg<int>.Is.GreaterThan(2), - Arg<string>.Is.Anything - )); - Use Arg.Text for string specific constraints - Use Arg<ListClass>.List for list specific constraints - - - - - - Register the predicate as a constraint for the current call. - - The predicate. - default(T) - - Allow you to use code to create constraints - - demo.AssertWasCalled(x => x.Bar(Arg{string}.Matches(a => a.StartsWith("b") && a.Contains("ba")))); - - - - - - Define a complex constraint for this argument by passing several constraints - combined with operators. (Use Is in simple cases.) - Example: Arg<string>.Matches(Is.Equal("Hello") || Text.EndsWith("u")); - - Constraints using Is, Text and List - Dummy to satisfy the compiler - - - - Define a Ref argument. - - Constraints for this argument - value returned by the mock - - - - - Define a out parameter. Use it together with the keyword out and use the - Dummy field available by the return value. - Example: mock.foo( out Arg<string>.Out("hello").Dummy ); - - - - - - - Define a simple constraint for this argument. (Use Matches in simple cases.) - Example: - Arg<int>.Is.Anthing - Arg<string>.Is.Equal("hello") - - - - - Define Constraints on list arguments. - - - - - Use the Arg class (without generic) to define Text constraints - - - - - Evaluate an equal constraint for . - - The object the parameter should equal to - - - - Define constraints on text arguments. - - - - - Used to manage the static state of the Arg<T> class"/> - - - - - Resets the static state - - - - - Returns return values for the out and ref parameters - Note: the array returned has the size of the number of out and ref - argument definitions - - - - - - Returns the constraints for all arguments. - Out arguments have an Is.Anything constraint and are also in the list. - - - - - - What should BackToRecord clear - - - - - Retain all expectations and behaviors and return to mock - - - - - All expectations - - - - - Event subscribers for this instance - - - - - Methods that should be forwarded to the base class implementation - - - - - Properties that should behave like properties - - - - - Remove all the behavior of the object - - - - - Interface for constraints - - - - - Determines if the object pass the constraints - - - - - And operator for constraints - - - - - Not operator for constraints - - - - - Or operator for constraints - - - - - Allow overriding of || or && - - - - - - - Allow overriding of || or && - - - - - - - Gets the message for this constraint - - - - - - Constrain that the public field has a specified value - - - - - Constrain that the public field matches another constraint. - - - - - Creates a new instance. - - Name of the public field. - Constraint to place on the public field value. - - - - Creates a new instance, specifying a disambiguating - for the public field. - - The type that declares the public field, used to disambiguate between public fields. - Name of the public field. - Constraint to place on the public field value. - - - - Determines if the object passes the constraint. - - - - - Gets the message for this constraint - - - - - - Creates a new instance. - - Name of the public field. - Expected value. - - - - Creates a new instance, specifying a disambiguating - for the public field. - - The type that declares the public field, used to disambiguate between public fields. - Name of the public field. - Expected value. - - - - Constrain that the property has a specified value - - - - - Constrain that the property matches another constraint. - - - - - Creates a new instance. - - Name of the property. - Constraint to place on the property value. - - - - Creates a new instance, specifying a disambiguating - for the property. - - The type that declares the property, used to disambiguate between properties. - Name of the property. - Constraint to place on the property value. - - - - Determines if the object passes the constraint. - - - - - Gets the message for this constraint - - - - - - Creates a new instance. - - Name of the property. - Expected value. - - - - Creates a new instance, specifying a disambiguating - for the property. - - The type that declares the property, used to disambiguate between properties. - Name of the property. - Expected value. - - - - Constrain that the parameter must be of the specified type - - - - - Creates a new instance. - - Type. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constraint that determines whether an object is the same object as another. - - - - - Creates a new instance. - - Obj. - - - - Determines if the object passes the constraints. - - - - - Gets the message for this constraint. - - - - - Evaluate a parameter using constraints - - - - - Create new instance - - - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - A constraint based on lambda expression, we are using Expression{T} - because we want to be able to get good error reporting on that. - - - - - Initializes a new instance of the class. - - The expr. - - - - Determines if the object pass the constraints - - - - - - - Gets the message for this constraint - - - - - - Constrain that the list contains the same items as the parameter list - - - - - Creates a new instance. - - In list. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constrain that the parameter is one of the items in the list - - - - - Creates a new instance. - - In list. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constrain that the object is inside the parameter list - - - - - Creates a new instance. - - In list. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Applies another AbstractConstraint to the collection count. - - - - - Creates a new instance. - - The constraint that should be applied to the collection count. - - - - Determines if the parameter conforms to this constraint. - - - - - Gets the message for this constraint. - - - - - Applies another AbstractConstraint to a specific list element. - - - - - Creates a new instance. - - The zero-based index of the list element. - The constraint that should be applied to the list element. - - - - Determines if the parameter conforms to this constraint. - - - - - Gets the message for this constraint - - - - - - Applies another AbstractConstraint to a specific generic keyed list element. - - - - - Creates a new instance. - - The key of the list element. - The constraint that should be applied to the list element. - - - - Determines if the parameter conforms to this constraint. - - - - - Gets the message for this constraint - - - - - - Constrains that all elements are in the parameter list - - - - - Initializes a new instance of the class. - - The these. - - - - Determines if the object pass the constraints - - - - - - - Gets the message for this constraint - - - - - - Combines two constraints, constraint pass if either is fine. - - - - - Creates a new instance. - - C1. - C2. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Negate a constraint - - - - - Creates a new instance. - - C1. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Combines two constraints - - - - - - Creates a new instance. - - C1. - C2. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constrain the argument to validate according to regex pattern - - - - - Creates a new instance. - - Pattern. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constraint that evaluate whatever an argument contains the specified string. - - - - - Creates a new instance. - - Inner string. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constraint that evaluate whatever an argument ends with the specified string - - - - - Creates a new instance. - - End. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constraint that evaluate whatever an argument start with the specified string - - - - - Creates a new instance. - - Start. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constraint that evaluate whatever an object equals another - - - - - Creates a new instance. - - Obj. - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constraint that always returns true - - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Constraint that evaluate whatever a comparable is greater than another - - - - - Creates a new instance. - - - - - Determines if the object pass the constraints - - - - - Gets the message for this constraint - - - - - - Initializes a new constraint object. - - The expected object, The actual object is passed in as a parameter to the method - - - - Evaluate this constraint. - - The actual object that was passed in the method call to the mock. - True when the constraint is met, else false. - - - - Checks if the properties of the object - are the same as the properies of the object. - - The expected object - The actual object - True when both objects have the same values, else False. - - - - - - - - - This is the real heart of the beast. - - - - Used by CheckReferenceType to check all properties of the reference type. - - The expected object - The actual object - True when both objects have the same values, else False. - - - - Used by CheckReferenceType to check all fields of the reference type. - - The expected object - The actual object - True when both objects have the same values, else False. - - - - Checks the items of both collections - - The expected collection - - True if both collections contain the same items in the same order. - - - - Builds a propertyname from the Stack _properties like 'Order.Product.Price' - to be used in the error message. - - A nested property name. - - - - Rhino.Mocks uses this property to generate an error message. - - - A message telling the tester why the constraint failed. - - - - - Provides access to the constraintes defined in the class to be used in context - with the syntax. - - The type of the argument - - - - Evaluate a greater than constraint for . - - The object the parameter should be greater than - - - - Evaluate a less than constraint for . - - The object the parameter should be less than - - - - Evaluate a less than or equal constraint for . - - The object the parameter should be less than or equal to - - - - Evaluate a greater than or equal constraint for . - - The object the parameter should be greater than or equal to - - - - Evaluate an equal constraint for . - - The object the parameter should equal to - - - - Evaluate a not equal constraint for . - - The object the parameter should not equal to - - - - Evaluate a same as constraint. - - The object the parameter should the same as. - - - - Evaluate a not same as constraint. - - The object the parameter should not be the same as. - - - - Throws NotSupportedException. Don't use Equals to define constraints. Use Equal instead. - - - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - A constraints that accept anything - - - - - - A constraint that accept only nulls - - - - - - A constraint that accept only non null values - - - - - - A constraint that accept only value of the specified type. - The check is performed on the type that has been defined - as the argument type. - - - - - Provides access to the constraints defined in the class to be used in context - with the syntax. - - - - - Determines whether the specified object is in the parameter. - The parameter must be IEnumerable. - - Obj. - - - - - Determines whatever the parameter is in the collection. - - - - - Determines that the parameter collection is identical to the specified collection - - - - - Determines that the parameter collection has the specified number of elements. - - The constraint that should be applied to the collection count. - - - - Determines that an element of the parameter collections conforms to another AbstractConstraint. - - The zero-based index of the list element. - The constraint which should be applied to the list element. - - - - Determines that all elements of the specified collection are in the the parameter collection - - The collection to compare against - The constraint which should be applied to the list parameter. - - - - Throws NotSupportedException. Don't use Equals to define constraints. Use Equal instead. - - - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - Provides a dummy field to pass as out or ref argument. - - - - - - Dummy field to satisfy the compiler. Used for out and ref arguments. - - - - - Central location for constraints for object's public fields - - - - - Constrains the parameter to have a public field with the specified value - - Name of the public field. - Expected value. - - - - - Constrains the parameter to have a public field with the specified value. - - The type that declares the public field, used to disambiguate between public fields. - Name of the public field. - Expected value. - - - - - Constrains the parameter to have a public field satisfying a specified constraint. - - Name of the public field. - Constraint for the public field. - - - - Constrains the parameter to have a public field satisfying a specified constraint. - - The type that declares the public field, used to disambiguate between public fields. - Name of the public field. - Constraint for the public field. - - - - Determines whether the parameter has the specified public field and that it is null. - - Name of the public field. - - - - - Determines whether the parameter has the specified public field and that it is null. - - The type that declares the public field, used to disambiguate between public fields. - Name of the public field. - - - - - Determines whether the parameter has the specified public field and that it is not null. - - Name of the public field. - - - - - Determines whether the parameter has the specified public field and that it is not null. - - The type that declares the public field, used to disambiguate between public fields. - Name of the public field. - - - - - Central location for constraints - - - - - Evaluate a greater than constraint for . - - The object the parameter should be greater than - - - - Evaluate a less than constraint for . - - The object the parameter should be less than - - - - Evaluate a less than or equal constraint for . - - The object the parameter should be less than or equal to - - - - Evaluate a greater than or equal constraint for . - - The object the parameter should be greater than or equal to - - - - Evaluate an equal constraint for . - - The object the parameter should equal to - - - - Evaluate a not equal constraint for . - - The object the parameter should not equal to - - - - Evaluate a same as constraint. - - The object the parameter should the same as. - - - - Evaluate a not same as constraint. - - The object the parameter should not be the same as. - - - - A constraints that accept anything - - - - - - A constraint that accept only nulls - - - - - - A constraint that accept only non null values - - - - - - A constraint that accept only value of the specified type - - - - - A constraint that accept only value of the specified type - - - - - Evaluate a parameter using a predicate - - The predicate to use - - - - Central location for constraints about lists and collections - - - - - Determines whether the specified obj is in the parameter. - The parameter must be IEnumerable. - - Obj. - - - - - Determines whatever the parameter is in the collection. - - - - - Determines that the parameter collection is identical to the specified collection - - - - - Determines that the parameter collection has the specified number of elements. - - The constraint that should be applied to the collection count. - - - - Determines that an element of the parameter collections conforms to another AbstractConstraint. - - The zero-based index of the list element. - The constraint which should be applied to the list element. - - - - Determines that an element of the parameter collections conforms to another AbstractConstraint. - - The key of the element. - The constraint which should be applied to the element. - - - - Determines that all elements of the specified collection are in the the parameter collection - - The collection to compare against - The constraint which should be applied to the list parameter. - - - - Central location for constraints for object's properties - - - - - Constrains the parameter to have property with the specified value - - Name of the property. - Expected value. - - - - - Constrains the parameter to have property with the specified value. - - The type that declares the property, used to disambiguate between properties. - Name of the property. - Expected value. - - - - - Constrains the parameter to have a property satisfying a specified constraint. - - Name of the property. - Constraint for the property. - - - - Constrains the parameter to have a property satisfying a specified constraint. - - The type that declares the property, used to disambiguate between properties. - Name of the property. - Constraint for the property. - - - - Determines whether the parameter has the specified property and that it is null. - - Name of the property. - - - - - Determines whether the parameter has the specified property and that it is null. - - The type that declares the property, used to disambiguate between properties. - Name of the property. - - - - - Determines whether the parameter has the specified property and that it is not null. - - Name of the property. - - - - - Determines whether the parameter has the specified property and that it is not null. - - The type that declares the property, used to disambiguate between properties. - Name of the property. - - - - - constraints the parameter to have the exact same property values as the expected object. - - An object, of the same type as the parameter, whose properties are set with the expected values. - An instance of the constraint that will do the actual check. - - The parameter's public property values and public field values will be matched against the expected object's - public property values and public field values. The first mismatch will be reported and no further matching is done. - The matching is recursive for any property or field that has properties or fields of it's own. - Collections are supported through IEnumerable, which means the constraint will check if the actual and expected - collection contain the same values in the same order, where the values contained by the collection can have properties - and fields of their own that will be checked as well because of the recursive nature of this constraint. - - - - - Central location for all text related constraints - - - - - Constrain the argument to starts with the specified string - - - - - Constrain the argument to end with the specified string - - - - - Constrain the argument to contain the specified string - - - - - Constrain the argument to validate according to regex pattern - - - - - Provides access to the constraintes defined in the class to be used in context - with the syntax. - - - - - Constrain the argument to starts with the specified string - - - - - - Constrain the argument to end with the specified string - - - - - Constrain the argument to contain the specified string - - - - - Constrain the argument to validate according to regex pattern - - - - - Throws NotSupportedException. Don't use Equals to define constraints. Use Equal instead. - - - - - - - Serves as a hash function for a particular type. - - - A hash code for the current . - - - - - This class defines a lot of method signatures, which we will use - to allow compatability on net-2.0 - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - dummy - - - - - Allows expectations to be set on methods that should never be called. - For methods with void return value, you need to use LastCall or - DoNotExpect.Call() with a delegate. - - - - - Sets LastCall.Repeat.Never() on /any/ proxy on /any/ repository on the current thread. - This method if not safe for multi threading scenarios. - - - - - Accepts a delegate that will execute inside the method which - LastCall.Repeat.Never() will be applied to. - It is expected to be used with anonymous delegates / lambda expressions and only one - method should be called. - - - IService mockSrv = mocks.CreateMock(typeof(IService)) as IService; - DoNotExpect.Call(delegate{ mockSrv.Stop(); }); - ... - - - - - An expectaton violation was detected. - - - - - Creates a new instance. - - Message. - - - - Serialization constructor - - - - - Signals that an object was call on a mock repository which doesn't - belong to this mock repository or not a mock - - - - - Creates a new instance. - - Message. - - - - Serialization constructor - - - - - Allows to set expectation on methods that has return values. - For methods with void return value, you need to use LastCall - - - - - The method options for the last call on /any/ proxy on /any/ repository on the current thread. - This method if not safe for multi threading scenarios, use . - - - - - Accepts a delegate that will execute inside the method, and then return the resulting - instance. - It is expected to be used with anonymous delegates / lambda expressions and only one - method should be called. - - - IService mockSrv = mocks.CreateMock(typeof(IService)) as IService; - Expect.Call(delegate{ mockSrv.Start(); }).Throw(new NetworkException()); - ... - - - - - Get the method options for the last method call on the mockInstance. - - - - - A delegate that can be used to get better syntax on Expect.Call(delegate { foo.DoSomething(); }); - - - - - Abstract class that holds common information for - expectations. - - - - - Interface to validate that a method call is correct. - - - - - Validate the arguments for the method. - This method can be called numerous times, so be careful about side effects - - The arguments with which the method was called - - - - Add an actual method call to this expectation - - - - - Returns the return value or throw the exception and setup any output / ref parameters - that has been set. - - - - - Builds the verification failure message. - - - - - - Gets the error message. - - - - - - Range of expected calls - - - - - Number of call actually made for this method - - - - - If this expectation is still waiting for calls. - - - - - The return value for a method matching this expectation - - - - - Gets or sets the exception to throw on a method matching this expectation. - - - - - Gets a value indicating whether this instance's action is staisfied. - A staisfied instance means that there are no more requirements from - this method. A method with non void return value must register either - a return value or an exception to throw. - - - - - Gets the method this expectation is for. - - - - - Gets or sets what special condtions there are for this method - repeating. - - - - - Gets a value indicating whether this expectation was satisfied - - - - - Specify whatever this expectation has a return value set - You can't check ReturnValue for this because a valid return value include null. - - - - - An action to execute when the method is matched. - - - - - Set the out / ref parameters for the method call. - The indexing is zero based and ignores any non out/ref parameter. - It is possible not to pass all the parameters. This method can be called only once. - - - - - Documentation Message - - - - - Gets the invocation for this expectation - - The invocation. - - - - Occurs when the exceptation is match on a method call - - - - - Allow to set the return value in the future, if it was already set. - - - - - Number of actuall calls made that passed this expectation - - - - - Range of expected calls that should pass this expectation. - - - - - The return value for a method matching this expectation - - - - - The exception to throw on a method matching this expectation. - - - - - The method this expectation is for. - - - - - The return value for this method was set - - - - - Whether this method will repeat - unlimited number of times. - - - - - A delegate that will be run when the - expectation is matched. - - - - - The arguments that matched this expectation. - - - - - Documentation message - - - - - The method originalInvocation - - - - - Get the hash code - - - - - Add an actual actualMethodCall call to this expectation - - - - - Builds the verification failure message. - - - - - - Returns the return value or throw the exception and setup output / ref parameters - - - - - Validate the arguments for the method on the child methods - - The arguments with which the method was called - - - - Creates a new instance. - - The originalInvocation for this method, required because it contains the generic type infromation - Number of method calls for this expectations - - - - Creates a new instance. - - Expectation. - - - - Validate the arguments for the method on the child methods - - The arguments with which the method was called - - - - Determines if this object equal to obj - - - - - The error message for these arguments - - - - - Asserts that the delegate has the same parameters as the expectation's method call - - - - - Setter for the outpur / ref parameters for this expecataion. - Can only be set once. - - - - - Specify whether this expectation has a return value set - You can't check ReturnValue for this because a valid return value include null. - - - - - Gets the method this expectation is for. - - - - - Gets the originalInvocation for this expectation - - The originalInvocation. - - - - Gets or sets what special condtions there are for this method - - - - - Range of expected calls - - - - - Number of call actually made for this method - - - - - If this expectation is still waiting for calls. - - - - - Gets a value indicating whether this expectation was satisfied - - - - - The return value for a method matching this expectation - - - - - An action to execute when the method is matched. - - - - - Gets or sets the exception to throw on a method matching this expectation. - - - - - Gets a value indicating whether this instance's action is staisfied. - A staisfied instance means that there are no more requirements from - this method. A method with non void return value must register either - a return value or an exception to throw or an action to execute. - - - - - Documentation message - - - - - Occurs when the exceptation is match on a method call - - - - - Allow to set the return value in the future, if it was already set. - - - - - Gets the error message. - - - - - - Expectation that matches any arguments for the method. - - - - - Creates a new instance. - - Invocation for this expectation - Number of method calls for this expectations - - - - Creates a new instance. - - Expectation. - - - - Validate the arguments for the method. - - The arguments with which the method was called - - - - Determines if the object equal to expectation - - - - - Get the hash code - - - - - Gets the error message. - - - - - - Summary description for ArgsEqualExpectation. - - - - - Creates a new instance. - - Expected args. - The invocation for this expectation - Number of method calls for this expectations - - - - Validate the arguments for the method. - - The arguments with which the method was called - - - - Determines if the object equal to expectation - - - - - Get the hash code - - - - - Gets the error message. - - - - - - Get the expected args. - - - - - Call a specified callback to verify the expectation - - - - - Creates a new instance. - - Expectation. - Callback. - - - - Creates a new instance. - - Invocation for this expectation - Callback. - Number of method calls for this expectations - - - - Validate the arguments for the method on the child methods - - The arguments with which the method was called - - - - Determines if the object equal to expectation - - - - - Get the hash code - - - - - Gets the error message. - - - - - - Expect the method's arguments to match the contraints - - - - - Creates a new instance. - - Invocation for this expectation - Constraints. - Number of method calls for this expectations - - - - Creates a new instance. - - Expectation. - Constraints. - - - - Validate the arguments for the method. - - The arguments with which the method was called - - - - Determines if the object equal to expectation - - - - - Get the hash code - - - - - Gets the error message. - - - - - - Doesn't log anything, just makes happy noises - - - - - Log expectations - allows to see what is going on inside Rhino Mocks - - - - - Logs the expectation as is was recorded - - The invocation. - The expectation. - - - - Logs the expectation as it was recorded - - The invocation. - The expectation. - - - - Logs the unexpected method call. - - The invocation. - The message. - - - - Logs the expectation as is was recorded - - The invocation. - The expectation. - - - - Logs the expectation as it was recorded - - The invocation. - The expectation. - - - - Logs the unexpected method call. - - The invocation. - The message. - - - - Operation on a remoting proxy - - - It is not possible to directly communicate to a real proxy via transparent proxy. - Transparent proxy impersonates a user type and only methods of that user type are callable. - The only methods that are guaranteed to exist on any transparent proxy are methods defined - in Object: namely ToString(), GetHashCode(), and Equals()). - - These three methods are the only way to tell the real proxy to do something. - Equals() is the most suitable of all, since it accepts an arbitrary object parameter. - The RemotingProxy code is built so that if it is compared to an IRemotingProxyOperation, - transparentProxy.Equals(operation) will call operation.Process(realProxy). - This way we can retrieve a real proxy from transparent proxy and perform - arbitrary operation on it. - - - - - Generates remoting proxies and provides utility functions - - - - - Create the proxy using remoting - - - - - Check whether an object is a transparent proxy with a RemotingProxy behind it - - Object to check - true if the object is a transparent proxy with a RemotingProxy instance behind it, false otherwise - We use Equals() method to communicate with the real proxy behind the object. - See IRemotingProxyOperation for more details - - - - Retrieve a mocked object from a transparent proxy - - Transparent proxy with a RemotingProxy instance behind it - Mocked object associated with the proxy - We use Equals() method to communicate with the real proxy behind the object. - See IRemotingProxyOperation for more details - - - - Implementation of IInvocation based on remoting proxy - - Some methods are marked NotSupported since they either don't make sense - for remoting proxies, or they are never called by Rhino Mocks - - - - Rudimetry implementation that simply logs methods calls as text. - - - - - Initializes a new instance of the class. - - The writer. - - - - Logs the expectation as it was recorded - - The invocation. - The expectation. - - - - Logs the expectation as it was recorded - - The invocation. - The expectation. - - - - Logs the unexpected method call. - - The invocation. - The message. - - - - Behave like a stub, all properties and events acts normally, methods calls - return default values by default (but can use expectations to set them up), etc. - - - - - Records all the expectations for a mock - - - - - Different actions on this mock - - - - - Add a method call for this state' mock. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Verify that this mock expectations have passed. - - - - - Verify that we can move to replay state and move - to the reply state. - - - - - Gets a mock state that match the original mock state of the object. - - - - - Get the options for the last method call - - - - - Set the exception to throw when Verify is called. - This is used to report exception that may have happened but where caught in the code. - This way, they are reported anyway when Verify() is called. - - - - - This method is called to indicate that a property behavior call. - This is done so we generate good error message in the common case of people using - Stubbed properties with Return(). - - - - - Gets the matching verify state for this state - - - - - Get the options for the last method call - - - - - Get the options for the last method call - - - - - Set the exception to throw when Verify is called. - This is used to report exception that may have happened but where caught in the code. - This way, they are reported anyway when Verify() is called. - - - - - This method is called to indicate that a property behavior call. - This is done so we generate good error message in the common case of people using - Stubbed properties with Return(). - - - - - Creates a new instance. - - Repository. - The proxy that generates the method calls - - - - Add a method call for this state' mock. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Verify that we can move to replay state and move - to the reply state. - - - - - Verify that we can move to replay state and move - to the reply state. - - - - - Verify that this mock expectations have passed. - - - - - Gets a mock state that match the original mock state of the object. - - - - - Asserts the previous method is closed (had an expectation set on it so we can replay it correctly) - - - - - Get the default call count range expectation - - - - - - Gets the last expectation. - - - - - Gets the total method calls count. - - - - - Get the options for the last method call - - - - - Gets the matching verify state for this state - - - - - Initializes a new instance of the class. - - The proxy that generates the method calls - Repository. - - - - We don't care much about expectations here, so we will remove the expectation if - it is not closed. - - - - - Verify that we can move to replay state and move - to the reply state. - - - - - - Get the default call count range expectation - - - - - - Validate expectations on recorded methods, but in general completely ignoring them. - Similar to except that it would return a - when BackToRecord is called. - - - - - Validate all expectations on a mock - - - - - The repository for this state - - - - - The proxy object for this state - - - - - Get the options for the last method call - - - - - Creates a new instance. - - The previous state for this method - - - - Add a method call for this state' mock. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Add a method call for this state' mock. - This allows derived method to cleanly get a the setupresult behavior while adding - their own. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Set the exception to throw when Verify is called. - This is used to report exception that may have happened but where caught in the code. - This way, they are reported anyway when Verify() is called. - - - - - not relevant - - - - - Verify that this mock expectations have passed. - - - - - Verify that we can move to replay state and move - to the reply state. - - - - - Gets a mock state that match the original mock state of the object. - - - - - Get the options for the last method call - - - - - Gets the matching verify state for this state - - - - - Initializes a new instance of the class. - - The previous state for this method - - - - Add a method call for this state' mock. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Gets a mock state that matches the original mock state of the object. - - - - - Write rhino mocks log info to the trace - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - if set to true [log recorded]. - if set to true [log replayed]. - if set to true [log unexpected]. - - - - Logs the expectation as is was recorded - - The invocation. - The expectation. - - - - Logs the expectation as it was recorded - - The invocation. - The expectation. - - - - Logs the unexpected method call. - - The invocation. - The message. - - - - Writes log information as stack traces about rhino mocks activity - - - - - Allows to redirect output to a different location. - - - - - Logs the expectation as is was recorded - - The invocation. - The expectation. - - - - Logs the expectation as it was recorded - - The invocation. - The expectation. - - - - Logs the unexpected method call. - - The invocation. - The message. - - - - Marker interface used to indicate that this is a partial mock. - - - - - Options for CallOriginalMethod - - - - - No expectation is created, the method will be called directly - - - - - Normal expectation is created, but when the method is later called, it will also call the original method - - - - - This is a data structure that is used by - to pass - the current method to the relevant delegate - - - - - Initializes a new instance of the class. - - The invocation. - - - - Gets the args for this method invocation - - - - - Get the method that was caused this invocation - - - - - Gets or sets the return value for this method invocation - - The return value. - - - - Adds optional new usage: - using(mockRepository.Record()) { - Expect.Call(mock.Method()).Return(retVal); - } - using(mockRepository.Playback()) { - // Execute code - } - N.B. mockRepository.ReplayAll() and mockRepository.VerifyAll() - calls are taken care of by Record/Playback - - - Creates proxied instances of types. - - - - Generates a stub without needing a - Arguments for 's constructor - The of stub to create. - The stub - - - - Generates a stub without needing a - The of stub. - Arguments for the 's constructor. - The stub - - - - Generate a mock object without needing a - type of mock object to create. - Arguments for 's constructor - the mock object - - - - Generate a multi-mock object without needing a - The typeof object to generate a mock for. - A second interface to generate a multi-mock for. - Arguments for 's constructor - the multi-mock object - - - - Generate a multi-mock object without without needing a - The typeof object to generate a mock for. - An interface to generate a multi-mock for. - A second interface to generate a multi-mock for. - Arguments for 's constructor - the multi-mock object - - - - Creates a multi-mock without without needing a - The type of mock to create, this can be a class - Any extra interfaces to add to the multi-mock, these can only be interfaces. - Arguments for 's constructor - the multi-mock object - - - - Creates a strict mock without without needing a - Any arguments required for the 's constructor - The type of mock object to create. - The mock object with strict replay semantics - - - - Creates a strict multi-mock without needing a - Any arguments required for the 's constructor - The type of mock object to create, this can be a class. - An interface to generate a multi-mock for, this must be an interface! - The multi-mock object with strict replay semantics - - - - Creates a strict multi-mock without needing a - Any arguments required for the 's constructor - The type of mock object to create, this can be a class. - An interface to generate a multi-mock for, this must be an interface! - A second interface to generate a multi-mock for, this must be an interface! - The multi-mock object with strict replay semantics - - - - Creates a strict multi-mock without needing a - The type of mock object to create, this can be a class - Any extra interfaces to generate a multi-mock for, these must be interaces! - Any arguments for the 's constructor - The strict multi-mock object - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Generate a mock object with dynamic replay semantics and remoting without needing the mock repository - - - - - Generate a mock object with strict replay semantics and remoting without needing the mock repository - - - - Helper method to create a mock object without a repository instance and put the object back into replay mode. - The type of mock object to create - A delegate that uses a mock repository instance to create the underlying mock - The mock object in the replay mode. - - - - - - - - - - - - - - This is a map of types to ProxyGenerators. - - - - - This is used to record the last repository that has a method called on it. - - - - - this is used to get to the last proxy on this repository. - - - - - For mock delegates, maps the proxy instance from intercepted invocations - back to the delegate that was originally returned to client code, if any. - - - - - All the proxies in the mock repositories - - - - - This is here because we can't put it in any of the recorders, since repeatable methods - have no orderring, and if we try to handle them using the usual manner, we would get into - wierd situations where repeatable method that was defined in an orderring block doesn't - exists until we enter this block. - - - - - Creates a new instance. - - - - - Move the repository to ordered mode - - - - - Move the repository to un-ordered mode - - - - - Creates a mock for the specified type. - - Type. - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a strict mock for the specified type. - - Type. - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a remoting mock for the specified type. - - Type. - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a strict remoting mock for the specified type. - - Type. - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a remoting mock for the specified type. - - - Arguments for the class' constructor, if mocking a concrete class - - - - - Creates a strict remoting mock for the specified type. - - - Arguments for the class' constructor, if mocking a concrete class - - - - - Creates a mock from several types, with strict semantics. - Only may be a class. - - - - - Creates a strict mock from several types, with strict semantics. - Only may be a class. - - - - - Creates a mock from several types, with strict semantics. - Only may be a class. - - The main type to mock. - Extra interface types to mock. - Arguments for the class' constructor, if mocking a concrete class. - - - - Creates a strict mock from several types, with strict semantics. - Only may be a class. - - The main type to mock. - Extra interface types to mock. - Arguments for the class' constructor, if mocking a concrete class. - - - - Creates a mock from several types, with dynamic semantics. - Only may be a class. - - The main type to mock. - Extra interface types to mock. - - - - Creates a mock from several types, with dynamic semantics. - Only may be a class. - - The main type to mock. - Extra interface types to mock. - Arguments for the class' constructor, if mocking a concrete class. - - - Creates a dynamic mock for the specified type. - Type. - Arguments for the class' constructor, if mocking a concrete class - - - Creates a dynamic mock for the specified type. - Type. - Arguments for the class' constructor, if mocking a concrete class - - - Creates a dynamic mock for the specified type. - - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a mock object that defaults to calling the class methods if no expectation is set on the method. - Type. - Arguments for the class' constructor. - - - Creates a mock object that defaults to calling the class methods. - Type. - Extra interface types to mock. - - - Creates a mock object that defaults to calling the class methods. - Type. - Extra interface types to mock. - Arguments for the class' constructor. - - - Creates a mock object using remoting proxies - Type to mock - must be MarshalByRefObject - Mock object - Proxy mock can mock non-virtual methods, but not static methods - Creates the mock state for this proxy - - - - Cause the mock state to change to replay, any further call is compared to the - ones that were called in the record state. - - This method *cannot* be called from inside an ordering. - the object to move to replay state - - - - Cause the mock state to change to replay, any further call is compared to the - ones that were called in the record state. - - the object to move to replay state - - - - Move the mocked object back to record state.You can (and it's recommended) to run {Verify()} before you use this method. - Will delete all current expectations! - - - - Move the mocked object back to record state. - Optionally, can delete all current expectations, but allows more granularity about how - it would behave with regard to the object state. - - - - - Verify that all the expectations for this object were fulfilled. - - the object to verify the expectations for - - - - Get the method options for the last call on - mockedInstance. - - The mock object - Method options for the last call - - - - Maps an invocation proxy back to the mock object instance that was originally - returned to client code which might have been a delegate to this proxy. - - The mock object proxy from the intercepted invocation - The mock object - - - This is provided to allow advance extention functionality, where Rhino Mocks standard functionality is not enough. - The type to mock - Delegate that create the first state of the mocked object (usualy the record state). - Additional types to be implemented, this can be only interfaces - optional arguments for the constructor - - - - - Method: GetMockedObject - Get an IProxy from a mocked object instance, or throws if the - object is not a mock object. - - - - - Method: GetMockedObjectOrNull - Get an IProxy from a mocked object instance, or null if the - object is not a mock object. - - - - Pops the recorder. - - - Pushes the recorder. - New recorder. - - - - All the mock objects in this repository will be moved - to record state. - - - - - All the mock objects in this repository will be moved - to record state. - - - - - Replay all the mocks from this repository - - - - - Verify all the mocks from this repository - - - - - Gets the proxy generator for a specific type. Having a single ProxyGenerator - with multiple types linearly degrades the performance so this implementation - keeps one ProxyGenerator per type. - - - - Set the exception to be thrown when verified is called. - - - - Creates a mock for the spesified type with strict mocking semantics. - Strict semantics means that any call that wasn't explicitly recorded is considered an error and would cause an exception to be thrown. - - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a mock for the spesified type with strict mocking semantics. - Strict semantics means that any call that wasn't explicitly recorded is considered an error and would cause an exception to be thrown. - - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a dynamic mock for the specified type. - - Arguments for the class' constructor, if mocking a concrete class - - - - Creates a mock object from several types. - - - - - Creates a strict mock object from several types. - - - - - Create a mock object from several types with dynamic semantics. - - - - - Create a mock object from several types with partial semantics. - - - - - Create a mock object from several types with strict semantics. - - Extra interface types to mock. - Arguments for the class' constructor, if mocking a concrete class - - - - Create a strict mock object from several types with strict semantics. - - Extra interface types to mock. - Arguments for the class' constructor, if mocking a concrete class - - - - Create a mock object from several types with dynamic semantics. - - Extra interface types to mock. - Arguments for the class' constructor, if mocking a concrete class - - - - Create a mock object from several types with partial semantics. - - Extra interface types to mock. - Arguments for the class' constructor, if mocking a concrete class - - - - Create a mock object with from a class that defaults to calling the class methods - - Arguments for the class' constructor, if mocking a concrete class - - - - Create a stub object, one that has properties and events ready for use, and - can have methods called on it. It requires an explicit step in order to create - an expectation for a stub. - - The arguments for constructor. - - - - Create a stub object, one that has properties and events ready for use, and - can have methods called on it. It requires an explicit step in order to create - an expectation for a stub. - - The type. - The arguments for constructor. - The stub - - - - Returns true if the passed mock is currently in replay mode. - - The mock to test. - True if the mock is in replay mode, false otherwise. - - - - Determines whether the specified proxy is a stub. - - The proxy. - - - - Register a call on a prperty behavior - - - - - - Gets the recorder. - - - - - - Gets the replayer for this repository. - - - - - - Gets the last proxy which had a method call. - - - - - Delegate: CreateMockState - This is used internally to cleanly handle the creation of different - RecordMockStates. - - - - - A set of extension methods that adds Arrange Act Assert mode to Rhino Mocks - - - - - Create an expectation on this mock for this action to occur - - - The mock. - The action. - - - - - Reset all expectations on this mock object - - - The mock. - - - - Reset the selected expectation on this mock object - - - The mock. - The options to reset the expectations on this mock. - - - - Cause the mock state to change to replay, any further call is compared to the - ones that were called in the record state. - - the mocked object to move to replay state - - - - Gets the mock repository for this specificied mock object - - - The mock. - - - - - Create an expectation on this mock for this action to occur - - - - The mock. - The action. - - - - - Tell the mock object to perform a certain action when a matching - method is called. - Does not create an expectation for this method. - - - The mock. - The action. - - - - - Tell the mock object to perform a certain action when a matching - method is called. - Does not create an expectation for this method. - - - - The mock. - The action. - - - - - Gets the arguments for calls made on this mock object and the method that was called - in the action. - - - The mock. - The action. - - - Here we will get all the arguments for all the calls made to DoSomething(int) - - var argsForCalls = foo54.GetArgumentsForCallsMadeOn(x => x.DoSomething(0)) - - - - - - Gets the arguments for calls made on this mock object and the method that was called - in the action and matches the given constraints - - - The mock. - The action. - The setup constraints. - - - Here we will get all the arguments for all the calls made to DoSomething(int) - - var argsForCalls = foo54.GetArgumentsForCallsMadeOn(x => x.DoSomething(0)) - - - - - - Asserts that a particular method was called on this mock object - - - The mock. - The action. - - - - Asserts that a particular method was called on this mock object that match - a particular constraint set. - - - The mock. - The action. - The setup constraints. - - - - Asserts that a particular method was called on this mock object that match - a particular constraint set. - - - The mock. - The action. - - - - Asserts that a particular method was called on this mock object that match - a particular constraint set. - - - The mock. - The action. - The setup constraints. - - - - Asserts that a particular method was NOT called on this mock object - - - The mock. - The action. - - - - Asserts that a particular method was NOT called on this mock object that match - a particular constraint set. - - - The mock. - The action. - The setup constraints. - - - - Asserts that a particular method was NOT called on this mock object - - - The mock. - The action. - - - - Asserts that a particular method was NOT called on this mock object - - - The mock. - The action. - The setup constraints. - - - - Finds the approprite implementation type of this item. - This is the class or an interface outside of the rhino mocks. - - The mocked obj. - - - - - Verifies all expectations on this mock object - - The mock object. - - - - Gets the event raiser for the event that was called in the action passed - - The type of the event source. - The mock object. - The event subscription. - - - - - Raise the specified event using the passed arguments. - The even is extracted from the passed labmda - - The type of the event source. - The mock object. - The event subscription. - The sender. - The instance containing the event data. - - - - Raise the specified event using the passed arguments. - The even is extracted from the passed labmda - - The type of the event source. - The mock object. - The event subscription. - The args. - - - TODO: Make this better! It currently breaks down when mocking classes or - ABC's that call other virtual methods which are getting intercepted too. I wish - we could just walk Expression{Action{Action{T}} to assert only a single - method is being made. - - The workaround is to not call foo.AssertWasCalled .. rather foo.VerifyAllExpectations() - The type of mock object - The mock repository - The actual mock object to assert expectations on. - - - - Fake type that disallow creating it. - Should have been System.Type, but we can't use it. - - - - - Utility class for dealing with messing generics scenarios. - - - - - There are issues with trying to get this to work correctly with open generic types, since this is an edge case, - I am letting the runtime handle it. - - - - - Gets the real type, including de-constructing and constructing the type of generic - methods parameters. - - The type. - The invocation. - - - - - Because we need to support complex types here (simple generics were handled above) we - need to be aware of the following scenarios: - List[T] and List[Foo[T]] - - - - - ExpectationsList - - - - - Dictionary - - - - - Dictionary class - - - - - Create a new instance of ProxyStateDictionary - - - - - Allows to call a method and immediately get it's options. - - - - - Interface to allow calling a method and immediately get it's options. - - - - - Get the method options for the call - - The method call should go here, the return value is ignored - - - - Creates a new instance. - - - - - Get the method options for the call - - The method call should go here, the return value is ignored - - - - Allows to call a method and immediately get it's options. - Set the expected number for the call to Any() - - - - - Creates a new instance. - - Proxy. - Mocked instance. - - - - Get the method options for the call - - The method call should go here, the return value is ignored - - - - This class is reponsible for taking a delegate and creating a wrapper - interface around it, so it can be mocked. - - - - - The scope for all the delegate interfaces create by this mock repository. - - - - - Gets a type with an "Invoke" method suitable for use as a target of the - specified delegate type. - - - - - - - Raise events for all subscribers for an event - - - - - Raise events for all subscribers for an event - - - - - Raise the event - - - - - The most common form for the event handler signature - - - - - Create an event raiser for the specified event on this instance. - - - - - Creates a new instance of EventRaiser - - - - - Raise the event - - - - - The most common signature for events - Here to allow intellisense to make better guesses about how - it should suggest parameters. - - - - - Allows to define what would happen when a method - is called. - - - - - Allows to define what would happen when a method - is called. - - - - - Set the return value for the method. - - The object the method will return - IRepeat that defines how many times the method will return this value - - - - Allow to override this return value in the future - - IRepeat that defines how many times the method will return this value - - - - Throws the specified exception when the method is called. - - Exception to throw - - - - Ignores the arguments for this method. Any argument will be matched - againt this method. - - - - - Add constraints for the method's arguments. - - - - - Set a callback method for the last call - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched - and allow to optionally modify the invocation as needed - - - - - Call the original method on the class, bypassing the mocking layers. - - - - - - Call the original method on the class, optionally bypassing the mocking layers. - - - - - - Use the property as a simple property, getting/setting the values without - causing mock expectations. - - - - - Expect last (property) call as property setting, ignore the argument given - - - - - - Expect last (property) call as property setting with a given argument. - - - - - - - Get an event raiser for the last subscribed event. - - - - - Set the parameter values for out and ref parameters. - This is done using zero based indexing, and _ignoring_ any non out/ref parameter. - - - - - Documentation message for the expectation - - Message - - - - Better syntax to define repeats. - - - - - Allows to specify the number of time for method calls - - - - - Repeat the method twice. - - - - - Repeat the method once. - - - - - Repeat the method at least once, then repeat as many time as it would like. - - - - - Repeat the method any number of times. - This has special affects in that this method would now ignore orderring. - - - - - Set the range to repeat an action. - - Min. - Max. - - - - Set the amount of times to repeat an action. - - - - - This method must not appear in the replay state. - This has special affects in that this method would now ignore orderring. - - - - - Creates a new instance. - - the repository for this expectation - the recorder for this proxy - the proxy for this expectation - Expectation. - - - - Add constraints for the method's arguments. - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Set the return value for the method. - - The object the method will return - IRepeat that defines how many times the method will return this value - - - - Set the return value for the method, but allow to override this return value in the future - - IRepeat that defines how many times the method will return this value - - - - Throws the specified exception when the method is called. - - Exception to throw - - - - Ignores the arguments for this method. Any argument will be matched - againt this method. - - - - - Call the original method on the class, bypassing the mocking layers. - - - - - - Call the original method on the class, optionally bypassing the mocking layers - - - - - - Use the property as a simple property, getting/setting the values without - causing mock expectations. - - - - - Expect last (property) call as property setting, ignore the argument given - - - - - - Expect last (property) call as property setting with a given argument. - - - - - - - Gets the event raiser for the last event - - - - - Set the parameter values for out and ref parameters. - This is done using zero based indexing, and _ignoring_ any non out/ref parameter. - - - - - Repeat the method twice. - - - - - Repeat the method once. - - - - - Repeat the method at least once, then repeat as many time as it would like. - - - - - This method must not appear in the replay state. - - - - - Documentation message for the expectation - - Message - - - - Repeat the method any number of times. - - - - - Set the range to repeat an action. - - Min. - Max. - - - - Set the amount of times to repeat an action. - - - - - Better syntax to define repeats. - - - - - This class will provide hash code for hashtables without needing - to call the GetHashCode() on the object, which may very well be mocked. - This class has no state so it is a singelton to avoid creating a lot of objects - that does the exact same thing. See flyweight patterns. - - - - - Get the hash code for a proxy object without calling GetHashCode() - on the object. - - - - - Compares two instances of mocked objects - - - - - Compare two mocked objects - - - - - The next hash code value for a mock object. - This is safe for multi threading. - - - - - The sole instance of - - - - - This is a dummy type that is used merely to give DynamicProxy the proxy instance that - it needs to create IProxy's types. - - - - - Interface to find the repository of a mocked object - - - - - Return true if it should call the original method on the object - instead of pass it to the message chain. - - The method to call - - - - Register a method to be called on the object directly - - - - - Register a property on the object that will behave as a simple property - - - - - Check if the method was registered as a property method. - - - - - Do get/set on the property, according to need. - - - - - Do add/remove on the event - - - - - Get the subscribers of a spesific event - - - - - Gets the declaring type of the method, taking into acccount the possible generic - parameters that it was created with. - - - - - Clears the state of the object, remove original calls, property behavior, subscribed events, etc. - - - - - Get all the method calls arguments that were made against this object with the specificed - method. - - - Only method calls in replay mode are counted - - - - - Records the method call - - - - - Mocks that are tied to this mock lifestyle - - - - - The unique hash code of this mock, which is not related - to the value of the GetHashCode() call on the object. - - - - - Gets the repository. - - - - - Gets the implemented types by this mocked object - - The implemented. - - - - Gets or sets the constructor arguments. - - The constructor arguments. - - - - The mocked instance that this is representing - - - - - Create a new instance of - - - - - Return true if it should call the original method on the object - instead of pass it to the message chain. - - The method to call - - - - Register a method to be called on the object directly - - - - - Register a property on the object that will behave as a simple property - Return true if there is already a value for the property - - - - - Check if the method was registered as a property method. - - - - - Do get/set on the property, according to need. - - - - - Do add/remove on the event - - - - - Get the subscribers of a spesific event - - - - - Gets the declaring type of the method, taking into acccount the possible generic - parameters that it was created with. - - - - - Get all the method calls arguments that were made against this object with the specificed - method. - - - - - Only method calls in replay mode are counted - - - - - Records the method call - - - - - - - Clears the state of the object, remove original calls, property behavior, subscribed events, etc. - - - - - Mocks that are tied to this mock lifestyle - - - - - The unique hash code of this proxy, which is not related - to the value of the GetHashCode() call on the object. - - - - - Gets the repository. - - - - - Gets or sets the constructor arguments. - - The constructor arguments. - - - - The mocked instance that this is representing - - - - - Gets the implemented types by this mocked object - - The implemented. - - - - Range for expected method calls - - - - - Creates a new instance. - - Min. - Max. - - - - Return the string representation of this range. - - - - - Gets or sets the min. - - - - - - Gets or sets the max. - - - - - - Records all the expectations for a mock and - return a ReplayDynamicMockState when Replay() - is called. - - - - - Creates a new instance. - - Repository. - The proxy that generates the method calls - - - - Verify that we can move to replay state and move - to the reply state. - - - - - Get the default call count range expectation - - - - - - Gets a mock state that match the original mock state of the object. - - - - - Records all the expectations for a mock and - return a ReplayPartialMockState when Replay() - is called. - - - - - Creates a new instance. - - Repository. - The proxy that generates the method calls - - - - Verify that we can move to replay state and move - to the reply state. - - - - - Gets a mock state that matches the original mock state of the object. - - - - - Options for special repeat option - - - - - This method can be called only as many times as the IMethodOptions.Expect allows. - - - - - This method should never be called - - - - - This method can be call any number of times - - - - - This method will call the original method - - - - - This method will call the original method, bypassing the mocking layer - - - - - This method will simulate simple property behavior - - - - - Validate all expectations on a mock and ignores calls to - any method that was not setup properly. - - - - - Creates a new instance. - - The previous state for this method - - - - Add a method call for this state' mock. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Gets a mock state that match the original mock state of the object. - - - - - Validate all expectations on a mock and ignores calls to - any method that was not setup properly. - - - - - Creates a new instance. - - The previous state for this method - - - - Add a method call for this state' mock. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Gets a mock state that match the original mock state of the object. - - - - - Summary description for RhinoInterceptor. - - - - - Creates a new instance. - - - - - Intercept a method call and direct it to the repository. - - - - - Validate arguments for methods - - - - - Validate that the passed argument is not null. - - The object to validate - The name of the argument - - If the obj is null, an ArgumentNullException with the passed name - is thrown. - - - - - Validate that the arguments are equal. - - Expected args. - Actual Args. - - - - Validate that the two arguments are equals, including validation for - when the arguments are collections, in which case it will validate their values. - - - - - This method is safe for use even if any of the objects is a mocked object - that override equals. - - - - - Throw an object already verified when accessed - - - - - Create a new instance of VerifiedMockState - - The previous mock state, used to get the initial record state - - - - Add a method call for this state' mock. - - The invocation for this method - The method that was called - The arguments this method was called with - - - - Verify that this mock expectations have passed. - - - - - Verify that we can move to replay state and move - to the reply state. - - - - - Gets a mock state that match the original mock state of the object. - - - - - Get the options for the last method call - - - - - Set the exception to throw when Verify is called. - This is used to report exception that may have happened but where caught in the code. - This way, they are reported anyway when Verify() is called. - - - - - not relevant - - - - - Gets the matching verify state for this state - - - - - Get the options for the last method call - - - - - Records the actions on all the mocks created by a repository. - - - - - Records the specified call with the specified args on the mocked object. - - - - - Get the expectation for this method on this object with this arguments - - - - - This check the methods that were setup using the SetupResult.For() - or LastCall.Repeat.Any() and that bypass the whole expectation model. - - - - - Gets the all expectations for a mocked object and method combination, - regardless of the expected arguments / callbacks / contraints. - - Mocked object. - Method. - List of all relevant expectation - - - - Gets the all expectations for proxy. - - Mocked object. - List of all relevant expectation - - - - Removes all the repeatable expectations for proxy. - - Mocked object. - - - - Replaces the old expectation with the new expectation for the specified proxy/method pair. - This replace ALL expectations that equal to old expectations. - - Proxy. - Method. - Old expectation. - New expectation. - - - - Adds the recorder and turn it into the active recorder. - - Recorder. - - - - Moves to previous recorder. - - - - - Gets the recorded expectation or null. - - - - - Gets the next expected calls string. - - - - - Moves to parent recorder. - - - - - Set the expectation so it can repeat any number of times. - - - - - Removes the expectation from the recorder - - - - - Clear the replayer to call (and all its chain of replayers) - This also removes it from the list of expectations, so it will never be considered again - - - - - Get the expectation for this method on this object with this arguments - - - - - Gets a value indicating whether this instance has expectations that weren't satisfied yet. - - - true if this instance has expectations; otherwise, false. - - - - - Allows to set various options for the last method call on - a specified object. - If the method has a return value, it's recommended to use Expect - - - - - Allows to get an interface to work on the last call. - - The mocked object - Interface that allows to set options for the last method call on this object - - - - Set the return value for the method. - - The object the method will return - IRepeat that defines how many times the method will return this value - - - - Set the return value for the method. This overload is needed for LastCall.Return(null) - - The object the method will return - IRepeat that defines how many times the method will return this value - - - - Throws the specified exception when the method is called. - - Exception to throw - - - - Ignores the arguments for this method. Any argument will be matched - againt this method. - - - - - Add constraints for the method's arguments. - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Set a callback method for the last call - - - - - Call the original method on the class, bypassing the mocking layers, for the last call. - - - - - Call the original method on the class, optionally bypassing the mocking layers, for the last call. - - - - - Set a delegate to be called when the expectation is matched. - The delegate return value will be returned from the expectation. - - - - - Gets an interface that will raise the last event when called. - - - - - Set the parameter values for out and ref parameters. - This is done using zero based indexing, and _ignoring_ any non out/ref parameter. - - - - - Documentation message for the expectation - - Message - - - - Use the property as a simple property, getting/setting the values without - causing mock expectations. - - - - - Better syntax to define repeats. - - - - - Base class for method recorders, handle delegating to inner recorder if needed. - - - - - List of the expected actions on for this recorder - The legal values are: - * Expectations - * Method Recorders - - - - - The current recorder. - - - - - The current replayer; - - - - - The parent recorder of this one, may be null. - - - - - This contains a list of all the replayers that should be ignored - for a spesific method call. A replayer gets into this list by calling - ClearReplayerToCall() on its parent. This list is Clear()ed on each new invocation. - - - - - All the repeatable methods calls. - - - - - Counts the recursion depth of the current expectation search stack - - - - - Creates a new instance. - - - - - Creates a new instance. - - Parent recorder. - Repeatable methods - - - - Records the specified call with the specified args on the mocked object. - - - - - Get the expectation for this method on this object with this arguments - - - - - Gets the all expectations for a mocked object and method combination, - regardless of the expected arguments / callbacks / contraints. - - Mocked object. - Method. - List of all relevant expectation - - - - Gets the all expectations for proxy. - - Mocked object. - List of all relevant expectation - - - - Replaces the old expectation with the new expectation for the specified proxy/method pair. - This replace ALL expectations that equal to old expectations. - - Proxy. - Method. - Old expectation. - New expectation. - - - - Remove the all repeatable expectations for proxy. - - Mocked object. - - - - Set the expectation so it can repeat any number of times. - - - - - Removes the expectation from the recorder - - - - - Adds the recorder and turn it into the active recorder. - - Recorder. - - - - Moves to previous recorder. - - - - - Moves to parent recorder. - - - - - Gets the recorded expectation or null. - - - - - Clear the replayer to call (and all its chain of replayers). - This also removes it from the list of expectations, so it will never be considered again - - - - - Get the expectation for this method on this object with this arguments - - - - - Gets the next expected calls string. - - - - - Handles the real getting of the recorded expectation or null. - - - - - Handle the real execution of this method for the derived class - - - - - Handle the real execution of this method for the derived class - - - - - Handle the real execution of this method for the derived class - - - - - Handle the real execution of this method for the derived class - - - - - Handle the real execution of this method for the derived class - - - - - Handle the real execution of this method for the derived class - - - - - Should this replayer be considered valid for this call? - - - - - This check the methods that were setup using the SetupResult.For() - or LastCall.Repeat.Any() and that bypass the whole expectation model. - - - - - Gets a value indicating whether this instance has expectations that weren't satisfied yet. - - - true if this instance has expectations; otherwise, false. - - - - - Handle the real execution of this method for the derived class - - - - - Ordered collection of methods, methods must arrive in specified order - in order to pass. - - - - - Unordered collection of method records, any expectation that exist - will be matched. - - - - - The parent recorder we have redirected to. - Useful for certain edge cases in orderring. - See: FieldProblem_Entropy for the details. - - - - - Creates a new instance. - - Parent recorder. - Repeatable methods - - - - Creates a new instance. - - - - - Records the specified call with the specified args on the mocked object. - - Mocked object. - Method. - Expectation. - - - - Get the expectation for this method on this object with this arguments - - Invocation for this method - Mocked object. - Method. - Args. - True is the call was recorded, false otherwise - - - - Gets the all expectations for a mocked object and method combination, - regardless of the expected arguments / callbacks / contraints. - - Mocked object. - Method. - List of all relevant expectation - - - - Gets the all expectations for proxy. - - Mocked object. - List of all relevant expectation - - - - Replaces the old expectation with the new expectation for the specified proxy/method pair. - This replace ALL expectations that equal to old expectations. - - Proxy. - Method. - Old expectation. - New expectation. - - - - Handle the real execution of this method for the derived class - - - - - Handles the real getting of the recorded expectation or null. - - - - - Handle the real execution of this method for the derived class - - - - - Gets the next expected calls string. - - - - - Create an exception for an unexpected method call. - - - - - Gets a value indicating whether this instance has expectations that weren't satisfied yet. - - - true if this instance has expectations; otherwise, false. - - - - - Creates a new instance. - - Parent recorder. - Repetable methods - - - - Creates a new instance. - - - - - Handles the real getting of the recorded expectation or null. - - - - - Get the expectation for this method on this object with this arguments - - - - - Gets the next expected calls string. - - - - - Hold an expectation for a method call on an object - - - - - Creates a new instance. - - Proxy. - Method. - Expectation. - - - - Determines if the object equal to this instance - - Obj. - - - - - Gets the hash code. - - - - - - Gets the proxy. - - - - - - Gets the method. - - - - - - Gets the expectation. - - - - - - Holds a pair of mocked object and a method - and allows to compare them against each other. - This allows us to have a distinction between mockOne.MyMethod() and - mockTwo.MyMethod()... - - - - - Creates a new instance. - - Proxy. - Method. - - - - Determines whatever obj equals to this instance. - ProxyMethodPairs are equal when they point to the same /instance/ of - an object, and to the same method. - - Obj. - - - - - Gets the hash code. - - - - - - Gets the proxy. - - - - - - Gets the method. - - - - - - Change the recorder from ordered to unordered and vice versa - - - - - Creates a new instance. - - - - - Disposes this instance. - - - - - Accessor for the current mocker - - - - - The current mocker - - - - - Used for [assembly: InternalsVisibleTo(RhinoMocks.StrongName)] - Used for [assembly: InternalsVisibleTo(RhinoMocks.NormalName)] - - - - - Strong name for the Dynamic Proxy assemblies. Used for InternalsVisibleTo specification. - - - - - Normal name for dynamic proxy assemblies. Used for InternalsVisibleTo specification. - - - - - Logs all method calls for methods - - - - - Setup method calls to repeat any number of times. - - - - - Get the method options and set the last method call to repeat - any number of times. - This also means that the method would transcend ordering - - - - - Get the method options for the last method call on the mockInstance and set it - to repeat any number of times. - This also means that the method would transcend ordering - - - - - Utility class for working with method calls. - - - - - Return the string representation of a method call and its arguments. - - The method - The method arguments - Invocation of the method, used to get the generics arguments - Delegate to format the parameter - The string representation of this method call - - - - Return the string representation of a method call and its arguments. - - The invocation of the method, used to get the generic parameters - The method - The method arguments - The string representation of this method call - - - - Delegate to format the argument for the string representation of - the method call. - - - - - Utility to get the default value for a type - - - - - The default value for a type. - Null for reference types and void - 0 for value types. - First element for enums - Note that we need to get the value even for opened generic types, such as those from - generic methods. - - Type. - The invocation. - the default value - - - - Allows easier access to MockRepository, works closely with Mocker.Current to - allow access to a context where the mock repository is automatially verified at - the end of the code block. - - - - - Initialize a code block where Mocker.Current is initialized. - At the end of the code block, all the expectation will be verified. - This overload will create a new MockRepository. - - The code that will be executed under the mock context - - - - Initialize a code block where Mocker.Current is initialized. - At the end of the code block, all the expectation will be verified. - This overload will create a new MockRepository. - - The mock repository to use, at the end of the code block, VerifyAll() will be called on the repository. - The code that will be executed under the mock context - - - - Create a FluentMocker - - The mock repository to use. - - - - A method with no arguments and no return value that will be called under the mock context. - - - - - FluentMocker implements some kind of fluent interface attempt - for saying "With the Mocks [mocks], Expecting (in same order) [things] verify [that]." - - - - - Interface to verify previously defined expectations - - - - - Verifies if a piece of code - - - - - Defines unordered expectations - - A delegate describing the expectations - an IMockVerifier - - - - Defines ordered expectations - - A delegate describing the expectations - an IMockVerifier - - - - Verifies previously defined expectations - - - - - This delegate is compatible with the System.Func{T,R} signature - We have to define our own to get compatability with 2.0 - - - - - This attribute is here so we can get better Pex integration - Using this means that Pex will not try to inspect the work of - the actual proxies being generated by Rhino Mocks - - - - diff --git a/Tools/NUnit/lib/log4net.dll b/Tools/NUnit/lib/log4net.dll deleted file mode 100644 index 20a2e1c47dea6ee52dc38cfd4eee0cfde7894faa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 258048 zcmeFad4L>8bwA$Q-P1GEvny-0yED3Xb*OXf@R&(C9P zySwVut5@&6diCm6b@gc%JYYGNWx4qG``=sEW4Q9SN&Y_dpWVowHU8mQ*89s}S@PJx zsb5)g&UM?SCvJ|yYop6=oVfDxn{EnsOk8pGM6~m!iETGcJnM|JCvFU{x_Z^nkiXoZ zKJ$3XI(5LYe)X05v*OymZ_Qd#8SpIY6QFEDQ{VZ7x&JJ-+j0B{joLIo%{HG zqZhpGq?eBTWKU)KuU`AL;cxAI@8=G>YuT6F*T3%-?>~FXsc&BW;3exX*tYhKXWet_ z&E7XQzkBMFFZl49?>+d7m#zNs`42sR)i3|*l+S+TKQ6uJthZfq<>S{Df4#Z=OqZdtx<2Mt`pCjLxc=viJH;Rbi5Wi7~- zZ?SlDA{wx)o9z}R)oye#Zi7`Q6&!_9b}(XD-b~RBRwL;NlpnzSoP1ol(kgcIXk^WR z1rjWv8@5}R(7S%!@>W_SYwRReU^{JQtc+oS3$P?kVHW^401ilP*k0iWYf!J#9Au2( z=HM8RR4)Pr;b)3oFeOweO(kpYM1PvlIMf4@6PlD(5QB8omZW#k$_&sdZIb4K1!#|! z1r;buw&k{y87tYI1H0N|E8mCga6Y(e*F=hGa}1A5R&BhuJqy;j)~kRIEdhTj!XL%g zSZashz88HjN1EYnHspA<-J+&6?3oKuD{pNltfEZg06Sd7E0`NDz|G8ozQK0nfOWGM zK9|KuCQaIvNK=f~Ov$L<6EnqPERTc9sw1o=7h9t%gmt*T#TtQL4A@9N`EFGQa{8VJ zdfUj-`}&a&KL$`q_%M{^!-{?J;k)leLBoo|ci+qh<%VPVr!XxJSt zJY2Dh%A}H44A&uha=1|2GEx{W47>MlTl*a^M0@?})H1`v1-7^M3g8S5L2`H~{_H@@ z7laFiuY-oV_kf3`F24SKK3~fnd_C5>{v9!2asSDfug6-i_BjUtjGx;oFflSQ^`UJo<>31n856E@9P&0XjPB*UMh` z4gj%pH2=C*sar+b0v8$p%>#a?S&25-*3Hw0fk(G%?`+PoZD)nwhFo2*&Hh>+v0Hp{ z!gm50IzJ!KCtYjU;IZw|juP5OZEGp=K@|EZP0ncW5R|w%%hAW+<#?(O)U@k@uI@f= zTM!uS*|1Zo4%QDSmLB$PPkKkGwq>wXgzSGRbZkuOp}A-_>~I2{Xe>99-iao5TUY5l zRln}0^*h$dz@s(=wYtsOcCa1|nEo)$H&g5u|4xv16Ew2nM`@xp)d|K?SntCPD3-L# zv93w*3VoI6pU8AjO{Oy`oachx^=^1D#pN}|z3_14R;Q|(@3`R@ARI4*==}OnM{3t2 zm{0piMIi6dMh*c;%h=Ug0MU5hoo&?t$Dchx9cn|pIG$mUaqWrU|Ni#}wCC_PfFe-z z7>zK9#rBu@?G|CRl8!nYL4rEeRwHfQ^EEp2Qs{&uJPwIhHS|VF$jD0igH07k~(JzePm2-TbLnrqNB*qu7=QV4`Y#I z{WVh10E`{6%>*`g!+Vfyw|E;mP^#)tZ9=@ChR9UpkzU#JgC~Jd4$P@UlLnJ^j(lj z4g2_Kd+i==#RVXrKRW;*`UzXs2vo|=3DZ-D9rV-ygnQ9}xD`K0da7zpZE6I)jjA&J zJ2bsbcEKGPm75+NSDv%(1?a1&4?4vXjk3YE=2AmOL&<2&(yJp(YohN7w-45(6L36!qqg2wfi{WREkw+PcbCh*1r{P?EsOwo$$X!W{vB$>gEA9cp+jZL+fXm zIzb8R_LLHP)Hf6^%2EiYp`-Aa*O-%1;u%Wn%S_n?9c4Qu$v$1M&IHY^ zzHPW)E{1-1KD?j{y7u(ZDBK?7ZMD4^7m;h$-@|B_-|v`_^ij3rtRT0KGNTI?ZdX1m zGZI*IZs-w7&Be=%1Xk@MTbB#Vj06@+1-$SD^I@5hz$#ucCl{}9Ew;O(g16QWmKnh7 zSf{9XAfGA9$8NFJjoEtD(dbFLK2U7~AqGOy(;T*gmr?t}hw!(}Bs(~brGqmlcFc8b z>q6j#Gyw_?fV$2l+NF98F(~*mv;62~E_~eJSXh`D3*DJ8c8jDDlGkvPKvtqT1?%Qw z3Mu4U17f^qSwjn~S?ceuw}y_7?@hzHF0{p;MH;9E-^sGZxu#BZKB@B<)LC0~bo6S} zX|igWta~qq)eDXVP`was^kA-z!@ZfdrED-IFUypytwTSj^c%;rXG>+zLRq*sP6$DG zUU)nnXO>pHM#T$H;Jq^m*694=B-B+@&(*4z>`^U)exiJMomG0X=yf-qeBJokw*pCP7nwlQSck?1E30T!*1L<4Gc6CmlK`{D&3Jnb;PS* z4$s_!vnJ@mlaMh|tj`}Vl6-#$MnzakE#`%npt;C-HgcNZof#W0?u6$%Fj5*WHHyO} z(U2#Mwww%@$zcz!zc=g+7vTQ=Y5fMnK5)$+bQ;A{2O%4UkRiJqo{DNl+~@(YZrF|f zn$lW@A|kC43?B0RQrKI=$7lRf!!vY%CBkFd+GHJgE!7%Lu^zR~`wd--{y+9F=!OMG z4cj5O?KS5bS^h03kr6Jc7Ok5r^(E?ZLVchO0t%I&@8^kAsXjdCUS9z|7(B@3kKdzg zJ3Jjk2KeLefTbL0Q$>~2c8g{hCewU(WxMxtL>$HsJ4;K%W_=Od7b)Bn9t_> z7tBa}5e&W1@re#t%x~m}2_rLrpH-*$G4!DfDaiF-n33RDSdy6w%ZvmT?ga3%ExEAL z$k;E!h!0puBp;R;z-wE#pe1PVuoEIGfNvX==X!w>z$chQbEJ!SdYj zKnxL;V$<7&N56tN*+sZ24x8hI{2+*fP?qmD zN}61W84%71(d~U-^1YgjTmi;&AM=Kq)P%{IR!Q00)=*4Gi*-BUDv+UdJJ!D;59~zD zD}ZP`v{Ydv0Ja){J5d^bLu05ILMEOk-WIrZI4Z17-Q-1|0F~jTtbWLgJ{vzYsu(&6 zGk0tBWhP#Rd%u2!7kxbjA^f-FhXlUX0YB(TX|1%r#;b;x1JAg>suJH0t(zqvhOl}^ z3A;s(Him*LP|D*zI=_x4T!kx|Nu2~gB|eeHqXsO@HRKo1naPoGjWUg85R@_bbwL#C z_5k_VIs(wS{eT(JZ830CUS*(jENCst9@(!fGm`$Mut)WSWkv!E%?IA2`@u2;u#WXx zP=p?V`NB3xdHNbO%=e-hisxF~PkQ5vmAozCb^3gG2uNlin!qYehE`U)v^oVz{5UDE z$#XUN=UvJ3HTmDWk{4_8Z@QAlXKOlQwT3uFK0cx8UU&K?O&?6sz405Bc+9i6qY>>* zWP|7f#!(ZCWLhf6L?^^ylmd1DF2ylE_H`JqVH>gCIjG3QcBlUWAZZ`g*epOTbkO5a z0WQztMTdv++4tGVY9A})NZ*C5<(CWZJk|y8SgW5BKD-^|WC|hDeLqrQ^=Ky=Pg(Z< zZJh;QDg~)K`>68r^FLNcr4^XM};t>Z$|3j$jf&QC`eOd0+YtA;J((QYrbwyva20=4>8j zYh3rDJ$*UI(F&Z0O<9Lyn*8GY6)noYwnf!I$Z^~~q`{H6P$2b)sz~Pj+t$rOlz<7f zEx|)c6`F+DPbb0^0=c4s3Rt9=(6KD0qZ2->fkx#>OF`yQu%)mi#527U6=SRr?sC!ec$yoVi*Fn+_uk_o4q9Q281-S@DrV#ykcmLpH{ z$^m_6xv{vMXGL*)om%h;;TlnE&AmLuS_!jPBksp0;!!TOEt>9Z6-_azE}2en!{km8 zpplei6ZMP!I^he*JFmLB5^YZvu~Q6Qcn^S7mp$uhl*LGs=#;5#tMIp*RMKc@CQXLa znivYys+ro1nzo{&YOOOJ7t?i&yfji^Ufq23x)t=Y}M8>l!OI`J>9Wk#3+!3Q^xPssX zW7)zPO_x68#41c;v)M6+G6mFbcQ8#$n7&o8uI#M;{%vXHv*XHaI56>9F^#-N*O^V|#S&^zCAR@)AkXIe(xh7&En?xu7NF=7)y ztBxa1cxT*s*uGgY4#!oo>{iB+r^Co&8*L|*SlYKVAF@sIpC2PexxDgXjC83|XzHo^ z?zHZqgf6Z7g_TY+f84Qch0b9mbP&+-(V9i*PAd)dpi6GGjVR+5#zw+h~1R_KFU$?fgZbB{LyX|Mn!EwB)7d!BfXm`kb(@4jVc;by&xwJiJduUoU(* z-eu>8o}n$9MxHfNe!e8-S&tm<&E`E7J^lFAo1UGIqKiRu7%RA%4Z<(LVCXk4mP-h) z%@3c$gj02k%dVvZu&&$@(pa2=IN=g5FKI*|ycO{Eh5d4$i(J*!e13r<`RV$ju1(dE zvWEOJ``qF+s#BqH4Xk_f8h!%{wmEyl7A#Aq-v+bVHTHl0v@|vo2o@*&TcDW)fm{{&Oy+1Y6;h&Ev8VTPk()%sNWPXwOVwI(ST8NChx4H+X>h*M;#y&5MfbUt|AGn z6%ctUkeJqm%kybP`?+5;*{kO?5c4JqtezV>zbSMMB^qQg7KOA^YXppAbgw!~mRn8}X-4z1rfd(nLenGcM(!)`UY4m{s8?7|EX z1@7iXAJwFJMLf-qzOGN$FGCDSS}3bnxCwRxo2(hvPw<+@Ey!T~SufVphoqu;37+}A zct!_1TIn@T?jZb#j&@>J1Z~uYlQdhK|5I|Qn;(PqhSxkOPTnVUmV0)KB9=gNwuM({ zbFzGUm1$u~_{LTB4koc5a!-Pd(QetG7MJg79s3BHDjRl_a& z^#x|#@Y_IBN;lr?hBLKK)EFr{VL|hz4uJm1UHB&;2@8*AgYM5EfssO1k|Pi!1;x#H zUI53@pBWr3VwJOKRyofYfo7wldWOZ=@KBAG&LRg(V6kdmX>N3xCP9f*TT8JLl|&h_ zYARd9b?sbu{fIT^edaZN>r(5APg-ZJ02}i7%(Q%aW?Ls9?-1$J+TUdf1_OtU-iLj~ zzX0Wx`lPdKN#eLMTsG#YC&!(>4R>y(?#?%pbk>9Ba@`%{&Us)>Y->8~1T(}grT*GA zs7mL-iG8fKv0j!P58QOTblhq9;ePP%QVi|WeZ*`l#)`CDGA@R{CS*(>6ch9jESElJ zB(R4GESB>OEcFw%jblOTQ-(GM45u;I#%@5$d-~^a3EC`Vhc2>GS0?ehmLbYWdb2XNw!M= zJS}kW0oe_hs4CeiEo1x=Lmc8rtTNvIO#aYyW?FbR$YsA}e}*old%4GCFSkN@vT-`u z(fuQ3eh&`%vvYx?m$xYcV}GqQJCA=lA47NvV-E$P@+ICQy72OSmkZeZV_+&^CY)dp z@JcRYFVf)fU%|NEx*G@Q)t%=vXlxQyBi@DW126{z_#4}~jY!{+=vQOPu=ItrB*`X~ zZ-Yq9(0vvWax(^j{4jfIdiJPv_?RK=g9q1|4FdtpL*42_$R?!58q<2Lv59D@HBA^$ zbV)Cqi^XS{1;ZI#-c-3iJv_C(cv1tVc-5AGN9e1hC%3OkYuJ{xWCMQa|62i!hGJlV z`M3w{YG0@+=pR@ZKN);zUm}_RhL#y#oTkN}e)-hK43fcxU=}YS#3FKLpY~(ij#~@L z$d)>@{vK(~Z67ldTLe7d1)G-(%Zvo}aDipRb77g0z^Y$&Q9oE_B(Ug5pn>em#mfxw z0pE!>A4yo_0}@G>56C1%#ffk#7Qt?Z&mtcK_yWc~#QSzFvO_i`1PCU0BH|fnC6@ou zdwpyoBtT=-Kq{}o#Q?1@j|OM=8cON?(M`yaJIF=t%PH2}D-*F9>1m%y#;1Tb->8|$ z)3Lxu`Sn(>v4~}Hev6tIt_Om~7%b0kper-zS(3T|sZYf7^C7ETjmLRY7#G^Jez<=7 zv~dks2X)ZZm@t%(zDYZv-Rh<;=F_NET9`-QfcPpztGF6VGB_chKt{!`CL7+5S*1n! zIG>tMTGppWC;fqV5VplWQckW#TW}P07w_bZ6YH^N$KZnd;A0Ko6@ci!pfY=kHM|Ni zHyRq|{XF;HX=Lsx&X0yAA$Soj_5AQw_(^8pqu6Ss`qr`C{u=8Y0(QiWhJ)kizHY2y z=TEBs6(@Kxi_ZAP2KN4lzI)BFXf-NxqC4?dce_3dW$hJ%`m&xlCQ9{Cxf*?egq1;c zd2X~|4)0^C%f{s_3)Q;8*-;bfszD9#Y9V@}_DbG!m4Rj?JenDJixrpYW%$z;J1g4E zF)h*cN%RZNVzKF$pfw>}%PyhC9#hG@kOx@|1kfWy-OJc9Np;%uIgj&ILt~%KVJo4!!|q$9B-6y^|lT!lh^-E|>8#*1nvV zYWoUaf_u?!r#U;Cf&ii$@n`xzq}+}uJ)vPrP=_b`BQ}ZsJPh^PEh2Q>!Yp@If!ips za~MlOFU5@@kJqa_#?!5SAB%RG}U4~l1O>8LBhk*-v1{D~ zmV;c7&!5tq-OH5H9KH;diG5VQ3%-c5h%@P1(l0zFLyPhwd?9gd*yrvhXyWQby_XFm2oiO=rcs+o0-Zct(`BP0p&>AlV-aLI2RN;0R&re3) zvC_uGxU{Ix7}Jf~90OR@dl4_*D_J2BSll9D4dG|gr(@mIvDUZN9hsP6p@Dz+UcyFP zkE6`vsJTJ7ReO@wk1)|?mq?;7v(-cD@@N9``5Cjj=8W|LICl9P51+w#^LGmx+sxN}4WBq8}}QZMYS9 z5Z*_>JPxSCbc`5sf=5Av?{PuUZ{p?sKf`s>Z8~%70}Cs*Q=D6yehZS?SD~J4JZR=1 z1gQiYr%lo05WW-r9)C;Wp94Pl3;dB;B}X!i_sp?YACvk>r=4aU)IFww%;ZO(1>_r_ zu#0X)yhu>UZkhGxP(bB3#~L!WKS78a%8xufL3m0GF;BZ~QwKi@Xa~nrD%!sfFi2s7 zuV$Xxz6KZei%vY`{aXQhqSSXSU^c==;dQF6<{)U)BBESj*exQDC8B_dScnrd7(yVH zP$|K{G$t%g~JA+o9FOu4V)^(_rAp~B#SMXxJ zDOqES^7_5nUecrGxrRqPPWXQ?>76usLHo>KH%#|BAL;71&PS}tIv*e6ivECgzGqAO z<8?m4oLT4NbNC0X^PSv-H?z)1w140_-$}jlg0&Vpx#9}V;eBeYV_W@H>wH;SWu1>G zxX#C`6aGJ~^X&uoAH2@DT-AuNg>9hH-t|_R;Olv-+w^bXttxwL(>(I7wH+C;P3ssZ zn32rMPZ3z6&V^-$j44Ag9W7RvUEgu6O~{iv&3v5@vOHjj@S0xm8G5_67rZSYzr{u% zl+7xFYjm7*W&h!+2~BYT{VHS!SL2Uw*54{#R2bo_p4X}=mU-=}n8si}2nw!4mcAD$ zRSD;Ux1)acd{!R30}m^;zq19!AGo}z8yqosQ(Z0p5HJ5A_Ren|X#68&A{ z-`h~CQs3_ELIA;RTwwfrtFsG}!Z-o(?~^(r+ju`r~w8#R9p)XGp z79xheD2bulVlW3u*WwGDEh^GvtUF!kh2x(uYi5XE6cavP1GcD-w&>)VS_{ku1`X&Ycez zzLMp+GG<27hO-0~bGUq1W+bp@3oKl+d{|}x*0Y+JxKb`AHW}=M0%68;Czx$sr3h|C zQg!W+EjKE<%cCCwKvQH-XDYwK=pRRZ!ELCvajPv?sh$aO^+%%?&FZTD;y+ULws1mQ zIQ?F#)oxU8hcCci+Jyz!b9xu9=OpqomOOkPfW!CW4?i-heC`ii8cKNKg; zY>3}2cE)01b@W?liUjKLP8lPEraB1_#_b6LYeR2)bWa({haZ99L+m^tU;xvF z!nUys@438@MPbAZ%Iqc8vFeqFL){bRJ`#c!jFPtL^?ml%lJ|9Xtzid-929M+WbN+ zC*d_bCv0GgfV^|(MK3_hi|*x`cF*x^El$_^Kd&JGtuX|WR}*4kLck33>s&@1C?4DER!&2Ev4>HC1{ zvuqVvD1XIgX(T?&17zO+zR%)VheNh923FS=?D5*v?C2+8ShS=X$2VnD{34{ULsE2o zlAdvLV&C@yY2U}u@?2eGhUjIlkCXZZ2)BL`aCU7P;C}m4yq9BXV94Tn#NTZ_-me~J zpdOcN0X*Xbs~$&Z3ra8e1d?|!wT(MER>XA- zaPemcucmyT^j?F@G)VQG07UvtthhYP9Em(fZvlR@y8jj2rl%#*9uwb2!A5**Y0p}0 z=){_x*z6vDn&>8a5nWX4LPUPdi}47C@UKvI(!PT%3_inqtTdWbAGope_Q>966T{0fSEfzzbiCrp;j6m$vTfpd>!!ga=@<;avMdyn?^6F+GFN z#(h0!zk~ppKeRp5<{lGEv>m(fX3xdeJ2Zu%c(ejDug`bwFZ0@8;icC8YrXu9UiR`5lqjO<&)~0AmD*I*Db|^*yUa*zs`Qr@tImaG zMgj}HfnQ8&b77eQSlu%zG~B@?^(Ju_hn+=dsxhCi{z0hP_AS8`nA-_6An3S%D1Br` zZk^0X=(||xBgazMn^2FWJIczIWP8WENT*Dxa|hwy2K=j^2q_4st8L+QRTk3gYvSaZ zB-bZmfhbsgcKmGe8Dxy<_k|`3ETt(kmtY3y?^q8Ky`26JL?@EmX z4^+4NZew+Jg>ldcp#MIOJ)4GT{Q%P9a$|ZnPQ9rslasb6EeLRekCBqGC_qnhq7UG2 zW)-qU4mWw0taLud4KQ&AbqUp8_*;;jY{~{pO{{XcRo$p@Lq|~GrsEH7lI1AMN=Stw!Er^ z_XSml$kS_4*Jb2swN0o|*~glR!rQI?!%EP4hT?JGxpNf}l=p)VgErPf9>Y!aEwC+9 zVY<&p)?wql0CTOert&0dIBw#(tn~Tul|p>*x2#z=xRc&JfV&*@%DHP@#Ez64A#|`L z(dtT3mJS-Hl!Wdfoc{MdkQjUw7`aihv6g4Hu8{Kw1%l@^mBX(g8(RjkQxSH*>+IIA zB9fgs=qWm89*n-WaTS22jUEn>mUZAss56EBaOz@gFVnc#qAx#MOZl^jwSQOjQVJ^JJ;c6(Fwdf-ts~8O|i0uOp zzOFAc$$#FFY!`!106mO>#)H>bIU;VbzF1!Z z-T@bXpkjN)6eRc{gl=93{&vpmz==Lot(BYd-T~IJ?i$p+3--?)apz#iYGUYpyw`uH zEjdLQSiABE7u^Su59nO)$HJ;YttbNkW_@#`<%?zdH_yY<{Aj&CEx@MuLj2}{PW9BB zHD;F@Luie3Y_~XslZ|UzD#Zmy-H!8i$IP;v#8Wn))+0f)8K<_XQZ+6|PfK(y@eM@Z zJ_J6s=^xnQC5)|G5S9|LuzW9!(n!T(A0gHab#AjMQa|2L+OYm-%6%d&<_4m>L0^j zsD-f;k6X)s&}%37p7e>}F~;n8%=mBVWaMRY%uGaPk7F8l8^ST`5$m_|>&F~M+!!HI zPXJOwbFv~aoBXBcT?KsXd0GT_bED^I(mZVj9|c)X18iM{W?`M-D1|f* ziK?RbBA9KFklu_TyHpN7iqfKN+Rvvx6f;!{Nw)D@;*9=|k&HP!Em_TeRkl*<9y#=C z>pJpOUBC?wlc{d-an!Di;4ZmcY_r)V_hGr8=W>Ib43x!ScWiO8sx$~U5gu*FNHTL| zvH?#F2T*^0->6N5ZN{pvO-b@5@<}>J(v>7`2^YP>Jk*9oD_m6wEYv1aHMWK}mL05goXMQw6F(Ix@~2GlW>(cLCfOH(fFW zSoUZ^4VTud(Yv}bOwAD3z`>N)W~+Qb>^mN39k^ZPWm_MxN*{~U-(qd}zIDtB6zO32 zemrpP3B6B#+Et@vOKCcjNsUa!?tKApYa=7HN=Aj~Rsza!EfVU^{*q)TgL8NG_%fE} zJSDHR>CECf8HWYdM`ty&uoH`Du@j4zuHMW!glC-xPFycG@{0i3fZf<|M5Oo;uSH|k zm>7SgVW-n1LJK`&nxy~7wQbefq-q}%c}KL=OQB;d@QBhxu~1%ZtMAoTe>p~F2zQ+5 zdT>ET0)bo4sZEx)wK(saBvq%*%O-EdYO%O{E={8Y3(BYFyi)2NVt?$~a;aLD*S-er zQm=W{#wng=4`qEOjzT7MlXKL=ZOgg=Ja&9{uyj0TY*qpPF#20};~#bL0{nyDZLOaL z&^h=on1S|OeFI+>^?gbBz9#&=CM;t?%lg-&gMVPc`mdw#{*(jeA1ERzHz(dt4n#i` zL^Lpe5Tf8mC_g^9dTfq0K8R}gxb+6bT3;$CnS?e;McJDFQEJ9M;yejUWAl?(uN7q^~?V_cro+j3$bLF;GJXDf}fBpn9S=20qW5lk-25vNk4buy+xef zTnqjgV4`OOGFUP06#Uc_HR%A9U%Z)+v4cf%TD1*%xc2zGHX6o|DCkH-=1EM=6C3e; z@KBZ0k1U@4zmSY}|)t}Ew|g@Dbjx9Qtld1YnRmZ3(Aap6h^-%f7rx%iXnY>ZU zi1=^veIhX2{1~5&Ws}{HgN1+YnHZk_8TA&6djEneqMB5c@aKB}ect~<@2M2wzv?|3 z9sUycc8l`D?&Gk6h+y=0AWQsfyG0(3&s!Deymon#Lyc)*V$7>~jTi$4pMrlQ`r!ZK zug3U`rVa68QXFeWdoaHM!TB;_Mj}6jMT7ETnb8G{2Is>vqYD-c$%kb|0y`q~f?@fv z%n%(q0@nBzz-o~5pCCAWSs$-Lw}>#n>E_;uH^+-EUV)MM-@&NhSNH>_{Rb|UPUo-K zTx#TUIiNG{-Kf4NvmT4Z?t@9b^q8!C3=!)tykRUWJ`@VNIUN?@|8O*WN z=nco5O23q24_4>#ZzKMpzsry5H{su3;9m{Aj?*O*e^wxk|Ej!)`C^Rj4BW$OFzb|nOisw5q6>2Mc`)t2=VeIq_s_|MI zy$8gg=U~DU_ZPGi{e?NP4SO2=|J5WgQj$-sKS#yoSG_+K;w* zACDW|yr5i81iN4vA(z=SJsT#e!mL5O+b(||0%6wlzf%^(%#UQe3q`yDuA%qje3b_f zS!>tF=ay&Xkv)S&s2w-d{u&r#(&G&}zd{T9Fr+gA`=5NaOc?O1`C&k_KD^K>udrsbPjD4(>ge8> zV9G6hXL2nPrb$!07SL%CRcVu|U4~Af>>sRG#E$SC?yni>~b_yJY=Y+opj2{gh2%X~F zjXqyK_f-v7AxlG*)4v7FG1>_$h;^_uKDv6U7+sBWcx7L8_dz_!3{NBmLH!2>RW^b{ zh-J7KeHt*5tyyEOz6>b6>ddeny$;i4UrR|ldr-(zS4-l(|?Nrs#5gi z{IQ~(dH~~K5RhjF0rzv+7k9o7N-P`eo$yes`q#&z7I4|oNAOpJM{(Sha!q7cZDVXn zcqI?YD_g$ravO0w>s(A>8e_h*^C%fu8VieeNU;|GiU|vRG~V}`_L%Pt)~yndbksB2 z#^}Y3LKqHAb#Xllg?m7p1B1;CEGN9DE~)I8lq#J}E@ZszgHv@l_qVrWozFDv+C+~Ly;~jl@|3n|&A2eDK?pJ1J4GQ;5 zhI_?ExhUE&RQA`uHYvSNVSulcCiprVe0>tk1RqtP;NyA2t{|Nrf{JlhPdJM=IL$1L zk@J&n)wP)PR`J=kKY<{aoe?1(`Jp##yzx}%H^Q`iVbq--!|7Df!fu|w=>{z=@6s+I)%emqtbX4Ov<$}9k4o1v6@_1Q@_JKygZW(b9KS1mnJ@+NCtj!Op=gJXVP}m$XNWqRQQsJXJ~nRa8q>Id2d~sGi0(rIzTFJKF1ls9r8)A|y`9&9LO3K# zqViNyq=`9)BxoOu4rY=xy@-8{r=TCqoL(u02xa-v z>kfghh`q8tUS*0thX)-$>h$gLtrs_k+*3791i+ zYXSXj^Zz%72keRRGcZBR~EX z$s{8uFU5R(v$gtb)`I=@Usyxlk9_|dWZczdGfIbNrAnSoGDUd02k_H)pV>#O5V2~1 zdJ=!I|0g^USG=$n;DVK=gK(LdJs7l}Ly*^CL z&N#Pzgr?P|mPCgh$>kNTFcIj$NZE7{rYD- zzaU?B0{o~%AGyIvw6Pc~BhCVo{#k@7VwY3xC}?6atB8Zq8Awxexe611>KrbovNJ9A zqklxE=|stBr_o?pQZsR#)2#A&*5YnCb6ptzy@hU%vnU3mJCBYly57d)tWELbMbVpZ zZ$^To8nt#i->*YbE&5NwMC*=;nMyaRzC?svDHfet*aUCGRrs@mL%|^SIv$2eJ;$i* znK;v@p=pz9Z$0aspzryhFNtL#TEf#-5J7RLR|6Lp`}hzdkl}|@_!B44K80(UFupll zCmBzArvv%)!OS_NC*{zdl*3HQ87zfez{r8p#LCB3KEtKJ0w3k0DQ()qWowP@T${lARq0MLboH;O?x?u`d zsA#a>@Hp&e8xbftxeQJ5z?6@HS^CEH-uD2rc#w{IkP9W#iGBhQCp!ArSP|nF-4V@k zqrFJBTXHL!OcO1dta>;Hb>B^W!&Yqq1(!g=>gq{s^>pMTpebj!9C}<#N_xH(iFLwb z(5Rgx5B^RyItOr0bQAt&UD`@=wpI2WhSkT%w%ITN7y4u;n0oP<1|sCki8Y+##%zeC6t~`$#yxyIKv=ZT;fl z3|@|z!rc>$CC2zyG<)%P^pzF+(Vt?Np8n)YzkCVl6f}%-U<8?d0oWGag+HDBazzW% z=Z?P1=X{v7E(24by_28my9f;6opb5N2o1!ynC$;?dNjfXZuA(`$8O1OcaNqI?TEbD zr)fSGAD{GD^l%mmwzGTi%_sIV_V0TQY+nCngZ|k4n`^9COEh*zdvYzfJ|;_IaW8`Y z+}G0v>5ps#t-*+Aw2++cpm8G%u@yZFO*flp6QftCxP!BJB$hL0056x^f;!Dh4T#cI zqfem7o?-6B9)_bbc!E4}D=%D?L-mR8GZf?Z88V)W-6E@s9Tw?WzP@$?+l4yU*^U?B zLtW5CFPJvh2-lf;L(w%rUW{h&S4?Ic1gzg+HX6&Z_|+3hPpJla@T%1{`ZUiA8|Yv% zkw$v#+-F{~LftFkI>o8(sw{D;?Ury-4Gj+RpD7J{+Ixo!^iQ})gTF7~-+cW05&kj0 z7yDT!vd`mrGp-9vI@czb;@?F`+l7B|?0~-FtMGh(kM4EISPczrZjU1Nv$=MQ-7TXJ zmEwj^fr6s&$z6AbVJSC;M;{g@x)eCxKUjDY8SKt0nu!xWg25if-Ql~@G#NIFF)hlb z`u6d1=JOY4DTe;|KBWK)H1Yw=3nQG)$|@Eqfku$-;?Am{MbE!^S@yIA8B#FK6N$5z1mk;p<4?iV>ODlVC(-f-gafGhWZ`xKl}Vz}b5= z7%UEMH8??>ibes4(CGYC-V}sLEo9fG#!UXiDRI8^mg>Vhi4dQIuNi=! zbO6-PE{1cU^NkYBHg7f;!%;pTo_gAvBJOs>FX+=|#Bz>574}-7qc`9-omF!o!Z|IT zyqh_x1hQvYN1Yn4JDp*Dt~xL)wwucR&c7U+w}a0w@8L7`_I}i$TzB?jw%x_Fi@}xZ z)cJ_$gNfcqxjN$4j~Olx`w#CRFt({SvHTKZ|GYP|Y%qEh$TGGkvQIaoP`sEjj1M)B z_{07%4uM(wK~+0(wdHM;4W9+&QGy zm|BvBs!^<{xQ$`6#!{ALjS;Nh=~~B#hq0>|U5jGnGzvEyN1KMd#xaq5Ce~}b@FX-l z1re+5VkBdjac1F2Df*FsDFi)(;kcpnQL(+p!WVJ+lUpHExmFUK*Xf40WU115fS z+<<@Dz{01JAu;9sC|k^_tXJ$)wwMKV$@W~4?HS$>Hd5A)DG$33?>L?^#TG3XgJL*^ zMuwlp?aX3Gb~7bA(7}$lt#~793*T0!OdpH)(Vb+CT-X~oA-xQhKD1AI5AUIOv(S5r z(tD)POQ4Ef3=1ID4MIutxY3-Ot*!$tz$1pvja*Cb@^FwUoGHieewi+2)-e<6Pyg}?I!OF?NwR@ z{P>PtuzfvIuUoKD?G91rDyTjayI2FDeIl*LR7vt8oUyf zH_%q%_2lo91C=`W<=le)V~%A^XzQiHk#CRuX)jL9XM;Zl@(NyBI}@yNqFwka=2TzK z<=mZdN6r`ETN)Z1rNNHd(kDM@YvvqrDQU{P)hG1}xLQXww~kJji5R9a>cku|*nkS> zco>YN`G6SK3HTwX1QGL2MxOAA`*QsHCY*65AB!4t%negl#;NX@Utg5u;C+DEDhsW7 ztFi%na;$SPX7Gmt@qT}2^kHh-i%|D&EN8eApZMB<6@4m6L%`6Tc=tPy_VpwU3mNXj z8}CNiKO||0^t%%eT#B@xCu!qM+l>%m1Y>FHm|)t?@Ef98N!k*oUG~oyA?7D(2>rVg zXMP%K%agQaOxyHYq^(WT5H8nqnxZ3;H25AS?W81al4%o|$wp@-X$K~0mn3P3vAYwq z4+PxyB<-Li?e-*XCDXve-O)Ws8lvdz`l5@R^I%l8PrA3sKw6R~|$8$!0leLNd8uZDYoR^?HU zbF_pHEy6q1@J85*+7@@~R3%zS`P_u(+wB%vUF9b^2qxb!S6*=MpD(tB5Fx^`dNK_8 z#JtHg@8)dYDDu$V_rGIH^LDoIQBIGK+A9K(45u0v0JIbSx7pKu0HhRs)TSk{11L z`>PXLreA}KG3gcVd3wpP5Y1+7QYG$5khCv(7tgj3%I1+%e8+6A;_)7K!ux@?!NY=w z@op;@F^Fc}_izS<1*1>ivmAMnR}Sbq%Z?i>5nUMN>?wOQsXtFu9YZXe8y14GPA#hi@bAyz1&ov^`bCPBD1lI{~D+?8$ec zvHqLrl&Nj2@VA>((nztGbVF)Q3@EHk4cw41IO{+}XdjmwOHp2-aTf9~>s;`y6 z4&RsPbcfxR{-}DV zc7}G|Z9?qidTndn*a2UT!t|ylqj^5OLS4UJl-};etxmdSu}kd*Ms_0$iuV3({1Ttu z&Ap%w-NCynt8Ir%C`ujmb4;iP-KrH`ql5Nm(5Pd86TUfCeD?EMaaqSzmj0PGn*11! zX>n3+r~N|n+2?GN|JE2W%H@?8L!!r(iH+&0`|WAni7X86cW9R2jpMHvnZ@jIyyX~& zaUExqzXy;z5aLs>m~^Y}-s9pe=XHTPIGHolP~@8HRp*b=}N;Zm+C zKc5Ah()Jch+5#zMna^#=-D=a6}8T+7l+E&SX zQ%p=;PJIi>do;~+M1PczN=u@6sEcJQYy^JMXUVW>F!c5$owVeo=fP7?Q~I2+uO1qn zbn4+#(~(zSKHcdUl)menpGIEG7$o$F!glaFBZv2<{CsLU`|&F;9cl8jcX37){E#X_ zc_hBOF5H_*TqSydGl;_|9;g~NQ)J@@Dqkk5WgwnJmkl)2mZL_>i0gTeCiwI`XuHMo z!OOF4<(fW!cJNIE5^0=wP9lx?ds!`Q)r(QekrnndSgvE*f_AC$}MfxnYOvTiZ`df>}4C|>&>S&)azk+V79&_U}J8CuP!3Ny6II-`mK@fisn zz`N*fi&L4YbZiwca$0C@JTH$9*LoS0@{Meh+WY7ZP|?OlADk2{x7f%N-(pWre2ewg z_!e?6h$n(Q9@W)wa*N5aBE-yS2&uhP#Kn|4~ zv&$LCRo#%-SIHtrd>t|{*cr`~U^Lz;XC2%OiMQ@>ZWA0PzfBr(&x-M?p1G6NHfGu-yy_kA0Azt@x3GEzD zv+oMAirB_w)5(;)bn+!Hot(`}C%@8kI56^49o92`zl)Sdz? zxUf08=6s}b8N>HBV2KN{bVRHD>QQ&&ezf9Mbu)iuX5L`*T7YJ@gU7MzV&me`p`z^K z8N$mPZnSKREEPeU(!h4IHnQc=hxRvI>v%@g)5i?nQJ7aBuqXclFkIyv?-M5u=+Sf^(@X zj}vT^yOU|d{6Csv?;t6DMi_zAh!{|->iv~_%=#>kMo*g zaC-qBi2;K1sf1hjhX}>K%N?+MG6CAk{0m|rWPK^ln)Jf$C}&=^MqiZoyFfMUt%tV5 zkmjdl*Cr7q<=P}Rhi2y%V((f^jCIA9SQT;Oov*8rftc?#ywuv)@)A$*ui(S1Li_nVti5+*G5&5 z*)6K-^uNMBWVqELs1nEe>1#|9PmB88nGXF#Iu*M!{ccHT7m3r;_<_^lw;Gs7d+%6p z1O7}Ks0JHff;1&{!*01{)y+9dwH%VwCS3g*C2HpdU|(Zy+$aJ|k^&urZ`dNGu`JH# zQ}{dC7f#S{J8l&;;ftgXP}NwE7Hsi0ZjU4H!GJcLnT-*A03vyk6Hn?FD2a`; zvZMk|xG7XB+*(5=Ho$e!=Y-dTz&aNI60)R>`sMEc4cH?T>jyi`#`}b66!nI?5)uPY z=7*QDQE9Jg@fNc=C7TZ#5jb5_f=@$HJH9O@WoK4TM(=>Gi_32y1^eZ|PH+Sc^!tJe z9y5vfm4gr%l^)TH@tdsG>Syy=e~djm7q@Rs+r@s{ywK?H*#Q(6Tjm=J@HsBrHAa*O zeQFaH3;fb1)fT4AESik&y0C-jOlC|XAthw5^o?1Eo?d?TcQNOGHaI%#JLX}|oU9NHx_rkxMM-kA2YuI;6rehg+k zS=wpBnwYeTZ7_V3@36L0m7|_W0tn5#RtER2`=Ns8O2_ znv~*E`+`_J>N~7IVP1h)TDBZF{$jr zCY581NfotM3>;%jDlKieP4IGzF{w0;1_K8blS-{IsT@>HDn}KQ%0b1Xk~t=oqlif* zdrc}w5tB-ZN~-$C>@sgBujKQm!CLS|SV?}(iSwLbHPY=C4Uu7VY{$jU1_#H*#QyF^ zxs3fK&G<@)>H_*3jeFy`r!b)eP!r0c^~8i~I@s5i^x4`X?Qu*oE#z&|h9owuP72#0 zvEg{%15b(9rZX%4wyU&P^n<7R!XEPc5%tMnGpSXVJD1``%A+ufTgCa8HpcAWK=J?! zB+Q+EnT*lJ#gcPSCTFq98J~SA#>`-8CTo0loHrqPE3Br1T{;MN&-Yt^5dQRO?SKhxjF9IB16 zz;sA%#7dvSCy*N;yotl@52dH#aUqcTo@Q;3tRHf0D8^Yu$x^W3No0i${vj%fjei1l zzl(M2P{UrZ5zp~Bk7*}vSw|CJCs@zs$W!=TAn>PYKyVqF$WXb6&6MGbfEd`G4Q$Q7 zm>C=P^oTYDCvikuQ4g$Fl8fR1${9E|B8V5hK3Vz%>H4FM+JxK5&UWGmk+jiHcn_+? zZnV7CI^lQNTzZD=v-@RZ`|&JU>vUxw2r0xqni@Fkgm;1ocp3G6JWRh3HHJg@gB4At zhgTz2eKYvc8vhTUgbRXo-(4#ppzs%T7-1P*BrH!7wrj%DBmwdu#F8Wd0%5|UB;iKf z#dDN-BoIG4oQwK*!5l+3S&1_m-hm4D4d-Uyis}BW@I}A}@2?xLI4O=h{Vj;YR57xq zBykjp0c*KceahADLpQ|f6jgVRmqh`aS`yzogJW$U9CI@`YK0s;o4}6@9(>BAi#OVa zd0lws&gvp+WKB`dgjN0uKkx;FE?k%!W*fq_rCga%&if-1f$Jxe7x&79@cWdBlO;PMHwb{>p@1ZGU7UaQ$TRl3tk*exEXta-A|s z%k8I31V^V#QXEf1CW5C^CMlk$DHFlfDHGz_UzyO_?T<_ZuAfZq?Uf1P_bC%8*C~^< z+T1;cK+ zFBq!HzFc zyKVwh((Y{hof-7MGHDW8)-;wM0X@48vpdSeAC}+rE1;gcV;mXZPhYAJfjo&+-^>U2 zfp0{S={w;9wr`QT8GpGG*bw)?UKV$Bu>Kr-Mf_?hF&Izr7&K=GVm&;i>mb38eTZqk zz8Gt~%@$FIWmE$HlLdEf2E*`f;cWPwuLl7Y&ne3OkX zzbzFjLpdK_g!K1HI$O!Fx%29TuR>LR9p6(m{xSEV(6@XaVUs;A+6Zvb#}ra1_d$8O zvjuI&WSmio`AhTY()oCg-n;>oqcYNWBkFuV>O5dTzFvbfXZ+P=cYIB_4O5Xx%(SkP z>-a`Z0N4+ZP$_nT6??(H4=^0B-GQy7U~DI4i!~j5sY>cbLw(@pWn%X$UuA8-c&oo_ zCphJ;I%U^$a5Zu_X{#iy8iJQtGm(dI4;rO++l9j2x3c(dB1ulKaCb2=yb=KJcq9BM zuBdfJNxf=yi4A8W=}sQpQur~X#qZqKt@T&t@jCsUeRaFkD$7;7NxbknuODU3rU~8* z`fd4$WBa*r8JFKylRb$b^T!~fuY4wq!0Z+a0~*@mhY|m9No&#_k0FpZ&1553lgz_a z$wA7dv(J+*orm3oya4hd`YeiOq8qHVFNrA_ThdpBdI_SQCi`UL<*nON9>wzm&}Fxn zo_-2bM6GQ?UjhC6#cgDtb=luqx1&(nXG;Qwe&w{8(btBicJ+ORN4nSXFM$&;dL?}< zp}p3=6Zq^v!G+JH!512sl}iINga*Q*4WM^-KUih}*1-w$7EVvoJ%H(6LoI3E16-<4 zy8lqOp20k^wx%;yAHWVyzPpB2bnw5{ejXtDw1HWwHF)er*#`^}}$2-Js5lc4^(}D+MAiSr?Cg44ngez)4GqQa?0Q&HS zS-E^+M$%S^f3{xG50)9y)>Heml>m)3wqTI;lg2VVx7{Rt4XVbokXfm;q=e?@%lK}9 zWZL4&IUuMO!LfT-dJf(X;LYOc9q97y7vWa@f>fW0BDc-V=xXx|`@u4!3zpU9;$?>L z=U&kH!5-arLW#EWOve_{HW5rD-Axxe8!yrO#({eELJS*z2;1#T_R)5WRLg5l>+psW zzT!$0jb+d#-pI+HV|W9!QXkELmH^5$t0-+q?Zp=pdqIAw++Pelx$R=pr<#p>XCE(XC-;B&YURrpT00vB0j#1;hv&k!i>ZT?_)^NStLAFQX%AFQt%8%&#z z1CcwLkGE5j<`33O0OeuzJb=D)O!=y5e|G$1njM{VF_xG9PO?!(_Y|=d;BB@2ATOhB>~)2*a|VQqqAMfgz=hQ7*F1=ITw zeh?4)g0p~;Sn*9QbUbsrRZ~I?roIfJ^>dNKcCX%K3x^s2mQ62`4W(mdacl4oprk&( z^EnGyAIv^cJ}%Fh6d$KPV(+>SXcj!INXI9(;{CGmiPb-z@7EVNHE(?U(km{-;)_6e z3MHS0x-r^?C6{rnkPz0 z3_tjxDC7kl8JNELl3`xBdZ!&-5(7Y%>3g+K;{bf|2R+WUb>V!W+Z?ik&p{l@&_Uak z6CLDPA-pH_ly*u9559=mxpYi=HFb`O!UcT@bxhuDi)R;X}q> zsMbdVqE1(~Z^qv%Ki!-uypH^4Hql^jqVnndOz}96)Dw z2>A8vYm;qYDdAlD5bVWd#o-pxF*RRfH^$Fm}?BwOdvK z`7A~0@c+X5iG`G3Z*Q6Z*pD*kjPgT0b=Je_7)V7Q$j*`Cwsq7&2QIvKKkA@Or+WH{Icl zQzVLl2%mrXC&@qjvTQ#3SHVKK#`*;H0tdgKZ3tYj>gt*@BtyQ`pRH9^a3(bz7G@6B z7kT5WO0}&aW+#|qkF8697nW;VadOj|?>XEkTP$q_(4PQ{vbaM}OdCaAjGn~4h&qk2 zUC7Gh_aKqBDjmlV$_SXaAF>mj`qe(=pl4TsEtDPI7gwADacIQ!_Nl8N`$<^N2yT8{ z-UyH$kszqgiF3lknf3!V0Oj)A;L7_!$3R9nE1Tp<-wi5Uio_>u5uEaaFLdyD32=Q9 z@R%mIAfW>+xdeCMp1YFTxNcYO_N%kQR&p!AKKh8hpU6J$XxIHWuvx0;Y*Q@14*VW+bqv6YVD3VX&sD(Q0Cq@rqI=w)$n<$BesjN<7#v<2B59K~9M`^vie`Gw#kQ@xFc;pJc}Ka!T;+ z%iN65u*5w%CBD!v<2(H_e#wj%<)Hdizl`z~DDmQ)5<~qm7BJ(5IVHyXWgN(iyav|$ zWvpXHE2oab`emHLjNLgU&ghqMIWypB_bA*g{W6}{FXKUGAb!$=>Y?5Yv31E_x#%r` z2pY6>v{&$T&;M<`5R_^-OE=Zxa(R7S|;C*q++QtUV`SuH9t@>cl&* zs1e3%*qPo2&rB^>xEnSMN9@(%{lea7_G)1t*YyB1vprlmx0970fIb_b%`e+6(%m1$ zph2OVzRX^)P88ly-6|V9eFEr%4IQ>IAt%w{YH%yu4kFrbz@y#bU%$T8+j%=AfKUx~ ze*F`Mfo9o^A$9nl-$nwaLfnKVYU(PrAtRsE5n{MWx z4=P_l%&}lO>&W_;9N#nz@{%#$ZapH5QF=PYa%P|nswdzY#^*i#V3{GhIR?BwVE5i1 z)2s*at9EfrwYhiB`Yd&6CxI~UEql`eID+Gf_CA;t3*Ld{xZCw?yZkn!F~7Way{R9q z%n(|6t^;V{wtJ>&STEUAmse+c)|Dfk>b(tk9n!RXKI=D9KgT)*KKAOe<$8P??Zl#k z-9C-JuMe_&eVWeMn-e_`x*{?0lg#}5&}N5K<& zbo#yQLvQB2zTN(3yv=%FFgFBE^@{ShTTIKfDFPhpl_#*onG4Gd(A>=jv;;J=Z1f_u z(8h%UY?JOjrqq}V2Bqy4!95@f7pb( znIXkTrMSq&wh)<-pDkaSX@3;x?dUb2rTsCvrLWNbxZJ*lsgKJohvfDr{?2wR8BvJW+|6(U-u<;5b+ym4ZqAR+1_LF{wXIQbiyp z)wwFhAQCgF2PCN?F_XF?Nu}`ku1>-FhHY7xvC^hc5kiFU@zw(UayMMUX$MwPkU&q% zOm?wO;+s@Df37T~X&gpj>0`N}%v7160lvn#3G`{qWY~$00W~H~!5IG`n8bk+FnT&B zO~E)tC74WA6EONDCQYcYTjZTI#}3YiIGUpvW4P*L2dCjN_%*sr{h;8*LLt+`m*5s% z3y0eV_u{tV6f>Ysh=3~E!XUw5DSQ~Et4IAOLYy7jy~T*lV(vTi+(Il)OOzn9rq ziOuRNhY7Th3a2d`jtL~IwUiy40=gSlXi#ya2zaWZ;mF}oGPpU6R~QB3d;}>HC=#(o zoM|CN!jYQ7c@a`1s3$4X5UnrXr*YcA=f`Xg^&P*?F;I;c$D5LY!rpX_H)018`+Ww~ zHnHF7w@{sk83Cqxexnkdk9$3#66ROVc*7=l>x;DW(cd6XhVDk-M!$?7n)rGEbxTq* zK=L+#8;x9T3N;(1KP~U*PgPTza3+JV5opJ0Om%dsWp1=0K^GTfihuH%7cn?XXJ)PX> zYZ^F&Gkrv+M-^o;6vx;cSTbt7*oj`3;4Aep0{Bjw8iChB!cO#_xIkHLK)HT7I!vbl zV2}H142PrdX#m{R0Eo_K2t!`d)kg}Zvlg8a!R z!c;;@|BiZj(ov)GHHldN=lbbS25ve(ub;Zfdc>Vnnu+(qmBvR{{~5gv9jvn-$G){| zeHW7X62~^qPC$MUED!Q z#!7NLV{@nwok)(r&++TGyE|cA26(`c?UZGKu@GDfEcMH5>>%_3W1i1+cY^c*dD~~u zc7|P(zTV{*+z0R;nB%5Pl7-+pB7tcbK#v$H@bDv?cT~^NkLIKO4!^Uk`>{eSzWTLQ zvkI9d#rjovg6r?gsY%gkAUvSgq5gLG07_usn_B0%)esBUenFNgag6JtLb@30;EM`r zrXKOM_Irh{HBaoIlwToTb9Ebs=_I~(kXOROd+Zh=A&H*~n zR#b&3S(;@AyNzbRc4y9U)BUEOg9e%Xrjii64B+k0B2{$Bk@s}IOudm;x1biTH&|bo zMpW^op<=){po<|w8+z0O*C?TD{FW*7ZMK`yFl;}u5>$iOMoFDn{|Hhs$);3-8-a^U z_gCWjU4)dZN^~}4q`CheZ*Kx$WpTZa&-=c2&kf{~0!g@d6Cea7EXpDZ2r4Kd zD7XO%ioSS*3dCTnh`6KThC42`F11=~tyOC)Qmq^AOKn_hU8}WjwO0Snb7tQ6-Xs^a z{r*1x`+<`=GiT16Idf)TUU^w1yOpYU9Ocqt+`)t8!l5CaLmLld9!Bg)HjbniZm7j0 zM()wbY@vLc1Kq$;{P4nfK-sC%=8!oUxHx4mQx@T`P|+K_?_3N~6_eEZI#??N&HJOy z%MtRF=z`~3d*|jiWqK1F?wAt8`aGO<3b-a(J93oH`CFLW$UE zJoSNt3^=gR_&zp+*F1_CUPOJ!7iEUSCQN4r(%FV|>^2s17rs)oO^&;fTH)sxD)~7B ze96E|2u0tC&sSu>tMEFG9t&T@FnQF8duRMCRR(|lbb9g@pU#qgmQU<>XH5bc=2ZgN zOtnMzUNcpYxzxvu=-w)cZu3x;X= z5gD_&C-_I7s>DmuFj2exPr_FC4)kQsM~}yTyV7URKY(#h{*K!YadINTL@t0&z0L#b zh5YizgG)uH5y!m5X?1|a(=7e3|#C1;r zTirJ2zGY7O?Z0JCRm)rEB$Ic9wJvb1Th^%THd1WwEprK54oXwMY*m7I&r(i&s{rEY z==t9=m+-namOmb66*G{;^1Nj(MJa*i-EDf{E%QtLBPL{x}ulS(WQZYCi4+wNQD-m;>ZZTkD3?gmI`YrS4b8Jc%YS}zVt-Gj{(a4-5YME4B zq^bjTHvG5DbCT9+X5Wm}Cy;g9hqWH56Inm~p34iAt@TD`OIkYC*FrD9BFuS9vu&V$ z%bfY~M8{j^6jk0br|3CvnX}dK?F_<`PQUgYlD0v=W$w2vwAI|V%tZsz=ozh?r{6Nq z@s~Q}h?HHFquWaFW$~N{dCFMJW!iw;x6CD)yk)NQHG*%Md!9Pwu8C&fGWV!y*KT8oEcHa* zGG{FPmN{Mj$G6ON3Gkf)?dtxPxt5M?owsPADZBR$dQ6PEtnc?b?oT|!XJ6P0{`_HR zxk6NWn$8@@2;581ZGaAx$&hT@y8Z<(mperHtQpQcqd(WpQVFj zjFDY?(ajF)FZ)0A>p1&&9w>j{E%T>QIyfM_jei{7+&=@iE>r!Mx%7!`LfA&Stk$$X zCnLQW(`#c)TPTH7_qWU$84azZC7d*^RPy|9nUhrJBpkcdGmX?uzGhi2z2VOv-ZDQK z0obc}mQh4EzTVpC=eTQpz2)dzhXuR=2zgR}QdSZs(wX)l_bqesbUQp@ym%s`j(2J{ zOuuEW^{8d>4G(ECt~WN#_hva|$>+~}clW2A>ax)3Y}XErPP*FRj^)UgUVgc=ebA42 z%Ut>(tuq>I7hUI+!}+;k`P0?%Z%<$O{41C#{LEhab0}2*Zsqf0N%{;b_s#Im@^;?^ zXGAkoVjazW_S)Pt%>OR9_lEXMwC%bA^EF>`({E_EG1Hylu>J;Z$h=(=QQLb%`>-52 zf96kzFh}gd+i_dLSKr|jaqTvp0eX8+fO}~+V9y)NIU#iU)QGzRZX-vzO7GtDJ|EA# zH9?M-jlQySWN&9?lXH*5%rN&_rmwH!Aw7AsuK4Y=cc1MAT~OX!L+@+RQ@7BJlWiy4 zg}R&Hi{y}RACh*qj%CwElDzy(T>Z8v$d#S>H8h`kgnDAX;@eo}d-yxDlq8{OtzOom zqYcPCuR-6uX$d*?I|1onF@HT_1WuUHJ~ZqIYV2%aV&Wfrm0KF1P2Qxh16rrp>DsjWr8DuJY)BY&KUJP7!07t zgo8U(e3G_Io}^`OPNI+-!a)H4ZQ8flcI)0GZ>pvk}R)<)B(Q(V#-=L0Ke}%>O_BZJ?R-`{c_-8G)UmoObxBUgaSzbA| z!~m3W?j9-G=cQ$U&~jbiRq~CcOG9n1!5d4afiT|c4e69ZjqmAI6Y5s;{^5q}y%+ki+g^tgCyZLRL96XVw3p*P506fi zpwRvXw6A%4M-{4O47<;+Kc+VdUML6XQ)1ndO(C*o53DN3I&nLPiMTJY5PkN)CVLo~ zzOP-N1`OFgf7n`2{tXVVz{fiKdeXo6Kk*-FveZLExYDQPehGY0JD3MwdaWE!_I`u& z%Z|Ftdg94W?K=%+nk{d>lcnRnEOPhh%G;|VzJC61X}t13r{USEZhu*mwEc14d>ry8 z?Nz}25EYXP_l@B-uYx9R;hBkE0ryjQclM2CZp}7Nc%q(IYBIEe#Z}8JI8|3?+p6lJ zsu1>$fBAoGD|azzJ4{t?zl#ib#nk=B52gy{Cf&-)Y`T@HA5M2~r287m6yM&s1beg% zHFg{8spHOsig9_WpmVr`^YxHGzFkt#S+m3Z>&uYf>B-a3kd>!l%#P*p%0~BP*>;5M z@PnW|?ET2tCVTQN8M6!0)52nT4a39PI%~XohqS|SpFwu!qPiLysjlHRHg}C&ca}B{ z>&|!U?7O>xe9T?QM`+A#fcl%+@klcBSCsYUNSW=v2bFA&lxLE`v@MceCa!4 zK1Ux(bzq>YKUlCBWZLzd?;3qH{2qec=-!qe%g(gXZ+~=8?#YbH9UUF*0YBg}gk}R| z*Eo?d_EWbwDI!iKuw_(tTZcQF4!$mWOi&yN$W%>VK8^ zGfSSot%f7*H|XyUK&=xs?EWj6a+|6*{cpoP&VfT8##t-chcZAlb{;noPx7#R# zyBq{|8`-<>Lw81BNp~>SR^m1@nm-oP^K0rgD@)FpkO5uGyY5HWs7JFS8?9^mVH@>m zc4VVmPX^zuFavXfh=!# zqorYhHjYZmq}=sBeQvwpj-+>&Hny(q9~4}-!*{UVBc7i|Y$}%~x7~XY8BdM#`1@;k zPOAj$>dTY8hi6M$>7=q@w(`g7$@Whn2d2qvN_lGdo~*6|?H@BN=TyVrwanVabvtHe^?hD8nKJx3n&c-Ix&cM!aM6c}FZAA6z zyq+r*sk)v0DX-WKf!A*TRnjBhtZYd`Mf>7OMZGbO2AO2WmWF@^gNW|ySZ&O>)4BvY z(yK!3x;1C6f7z-P@!pj*N$KK-TjdLnG_h{t3a3ltVBOqc0%To}8M2~0HXV)ZOm zZ%$vm*;!%^U*Tb29KH(Z!&jl~Xu-vRJ+{I|!utISt&f3f&>pfyYjUao&<3mF%#$aq zS25$M{g5fi3g-f#Q-4D~GS9*cY_|eo*>fNIG5pj7YT@rJB*~liY?@m`MtFHRSsYB4 zC2+84(+cLWAS}d*APzm?#8Co!U?bkNHJ87FOV1cM5X*qBG5m+N?9?D6g!0n)9-)rd z*wYSJCfIRR@3BlIE&Z_Xn-p96dAA?9m>igOMVE|i$wxd{nC=^i>Kw%IdM+b|%G}rR zCt5bQFd9KFUiTLs?NlwJmgtI)bhT_LHFADW*;po+%gT?oSidZ5i*iUhr(hiS1Ek2l z)lqX0<9+0(bvz9VoiGa`HQkq44xE(nz=_s-C@g`wr%m1pZG+vI8(3mSj&DXtLw{H5 z1M19iuYk!mR=^?F>BvYMO&=Zy6t;Q~f$K&eg5GhrVCd~~bY6gOD!JFefeQtxy&xS1 z8yuE@fFhGLvTa0aZv>+a%-&VinR48>SWac$_(Gb~?s50^;`RsMk0^8Na(LkjzV7k( z+dZ~U8>2&6|EJz_zVztUBL>zH+`jnh$lFYKzQ`=jvrX|9Y)o~Y4&BI`-_L>H$IL(Y zb-lmT;+Lv!H%v=VR~#~n*lZVcYZ8w%4#TvU?H?XY(e0m9EvRl1Qo`|}+00Sc-5-C# z#lg=~;NyoNY~UBoS$d zm&F|%Jbx7lrl%u7RKqjp1&OG!=5%#tD#{1vR~ujtnGJBuMY7g0SX!0GG9VxxJkSD0 zlj9cP0DGh{?wEFqyru8n3!;CD{NdcdI6SLxB_#D4y;ndZQ}uvA7pjOg7UR^T1du~G zAVSKw?Hw0ga%{wJQAs!_Jqvs-V^^EAmgLSy_F-!G=6D?huhQm8wp#^M0i>zYRJEp&&44Kact$Q%y=5lacvUS`;0A2rEtO5V-CGGvUV5R#| z$2|gc@OsJjvQtBa0RtR&5!vuOw{8Qv%sqd2T%--mN%a^P>2V0^CT#FC7(}+O&$cn` z3_w|FTD|u6&+XANpd0Py+oNTG*uZ`$tA9X-{^z2^aJ)B}`8U+CIgI5=rhU#a@ZB6P z&)_>S@WtnEn9AmGWoDRoVEjW?o5TI&t6!VLsWVYLW^lo_5lbra!!|VeVF8s4@Q2aN zVt?2CeSv_yx?q5xzk1Qzm)oOdfaGtS$zNYTe|wAI$RGJJYq*@Cv&Klw8oytbn-k{4 zKYLKp&UnZGslD9_-9A@&dF`_6@D=GC_bSw`_OId2&NX$}(=VG}j^RFI-kjzD4jorH zC)|ss0qqm4gq%VGzq9-Y)Id-9{JruNJ6Nyd)BRkrCs*clWL4H?K)^wP4lh7B>#Lo5 z1AbXqw&y?4@bkVqoXDIHzS-sn54<=j&0b`y@Y46zH;V8!uGy6B4JYdr$8Uc^_x?}F z;WXgn5osEOEx&;u9-xKt@VrrNGsHgy`D^H%`JP$f;&BVsUsY-}Tw^W(BPX-o#hKk} z5ThWo5zcUCfilg8i~+;uW<%d_<|71ae!aqFsl&k{H3lFZ%Y4ZYE-X5kLzWwM7}mdZ2V!#{eCM4SZgZrO{LHJ57bxg6GIj>&jAaj%6=-0J{} zqjJ>WT*_F1F_Oj6t-BdvWfQK278Ai0*yXj@af$Nf7F_BtNDdEOp`Tp=*6Gz=;FnCJ zTi^mOP;4$6cmiWi@B(?NHz(#v3>@SIMq0fTIP}fe4~cgD_)8>$_QbZ+ytN z$+gzQnM&|VgmaY1!bK0P%V7?Jvc@pg&VCp#5l*!uJ^3^qJ7}}qk6jxYD0*s+#M8;l zYR$j*3WzL)#l;&*3gjP~WBD-L^2w1x;4$wMb)S=5RRuNR93;}Lv56$3aYr*gzw&lu8XpR(2Z=L;O{av$2_ z-q$T~f7#8BGRc*cwriK5D|5&l2>r@XydZ2A2As^3pck{#O?q4pB-oB8GjAhoGp49v zy{nZ7lxNbb#H%85PAjB9pjVUu85wCajL1|RH)oQm6Op99I>7b<8!R@yP;=Dgo^x;J ziF5C-kSEi`a~2&7dFOweP?=$9&i8oppb}M3m7iZDboMpPR#q)?t3j{@ds^rSvef`H zAYBa}K|n~V0oF&@H)s4x&~O4Ke6-VeI9m}4BMnoGDWD-qX7&{&h03Cv6QT0VFEv)7 zryB6`R2IrwKi(SWtQtEHPlGy|sax%}vtq-ej2N61OI>X2V|>PwPk7N2dyiq$^?R<0>RF&xVT_|C5Sm)PDcNZ_?$ zuIKjJFfpUE;Y%|@&4&fOtufY&9OLQm+OW{Jt6?E>?58AkB&ym9;+Tb(WeVE5nzpEB zq_LF#$avVae-T-M?yM-xoQfzp10-GbvhOzjMD@MO`?flBrhl9pkAvNOBX%Qm<6r~6 zD~u5tZm)86GPj-P?(f@32D`tq@jK*Xx{*C>_p%yp&fV^vg}|^bui?RlcxEwh8TX|7 z2@|w7?Ow^Vox#d02bwLvfMj?*QnoBPl?=-)Qo;f*N3~`;IZ~S;W!ejjAQR*$&ukWV z1?1~0lW6cjJvYMpfjS>ibF?z^k@(`4qWE%ps;5xVemb+! zY%_p0n6UaA4C>!vCpmqcu2bKEm5fds@f<7qDGpT{!)7q7?=TjW#7nUD5eSE>c6M(- zMZ}^ChDJBS)ew!kH{owQT~$(OheN58p%xi__J$e%6d}n??#(2KH12LHXP-o$WG1!- z`AYPmHTJ>Fsv1K!EzrWt>sI?@yO0*V@~f}{W6J(#AjB)LSwp~*>PpAGh2EISXGfvM z>4}NrZ1W<6O*Sx&;_~a5~Oj_ekh#t-vUT~B*Iu7$j|0biu-M)u$ zB_gKo_??<4>x@%!mGzv)Do_L^NUf)~q-#WIF+v-UOhhB8MG&YV5<#zyk=K6x<%Qc~ zVg0>fon?kY6CIKq43!13Kx2I)UTXa^w`#9!*`ysX?wn8@%Pr!9Q?=BIh?H?xuI$L+ zt^4Abd3@E5K!Y3zbJW!^4?~axav2`uF)YYltrgbxPqe@otu(@XMeN)Jqy!QL7-cVJ z$$c7fjVQv=FQ*&8fsWro9Wcw^J{DsyyX@WzyjGQ;MJWu(HdquYKF%aqNn)_f) zVKoe}F)H_ci+iOjONx8r^#u4eIFVvpt4#o1LmTat=+#)7vDczI)CYdpj<=j5hQ&d; z8N*2tYs2bN#HS-7%8IrCHN~o_|R6yv9KRa*bnNu~`o6S_ym;-F|uI$x0$OD;ST?<@ojswa@O}xam-< z$h8X5fune?wSIS~J%QtQrH*&X);n{b5cghz`sIQBwfnYU*~3BOe^jXc+|WGj5AFOv z{&63UbBk}G{+xa*o*t;5vyp`pGbk<}8a1P1uG@81nRn1%>@@Gjpkof1M`N;Q{bZ~k zS3}3h6{IfGb4_myeEx&9ZTAS`Bv0-G@)4LI+%7q>O_H4HPZbR=;M*%P_j6jp2<1oCQNnjA(L^sp~Zxv zg(J^H02)fPAC}5|zef0REWv@rc}vThWk;ttffo@tPfg(cpb;Vo~jNQo_D91Xh;u-dqIV(pIGd+#`r3}=` z!eGPU!I19J=iCgjZh3V<0gT&@dGV^yNwK;*2qv@(Ke%x)HcvWa&5LlU6t-Yk{ zl~FHcx)Yhg5Kk{!6bCx%ii4TwL8w_}_B#U$TS0lsAoVjA6&2KpHPdTREPAysmL7~} zP-NMMs~P?{tE{;i{yvPJG!EXc;kkR6|9dke&W555 zaX#H4{dXiCN(71{C~kb(0xdU0$BevSZ&ju1^b0EXx~iiax9Y5sdw6XC>2~~MeSiq^ zbL8vi@+^bw2ZW8k_n1Fz;d=O?!Tc}Y$S=X#+K%4Hm+&3DkuTx?8~Mb3=#6}#`4MmA z4@6!@GcRq7k@^rNk$qaa>l691en52;7iZ586X%cnEIoCl&#z*1Z*OfIUPA?ON!JY$kH%E{@p3}4=W(`&ET78aTW zcu*Wc+MwY_Tj$;jf0;KSuioy=TYi*-XDj&AY%&YZ>i&_3%tH~($tg*CxFK5HljudC zsKC~*C^81>ao6&=6sCK7D?yo`do& zJ_mZ1&!We2zI=|hJ&dXTYmg|F{pdMfCJN&?HGM{Lddm@r{EdTa?nwn6tSoa~oi`vyt-`ZQv6? zzSfk25Y4)rt-xmdWbvq~b?<{l@jbZ8VZEy+hUY#LcOvo?zI0W%s&-hPs^JKlH}{!B zJhOz|pjbNMRLvEaY|7hhOn<~LaV{dL&qZ_=6$dhS7aY4vUiCC*-V4?Khh@)69DTGZ z((N@%x988>uVqNd1?9#}sd zel6YSoc!kF+fPl+kFy`zX}9+Cek7D_KaV|(vjja!W1nT(fgf%^&zE|@y4nZ%ioqV7 z>~!Tj{j#jC%V~sT-8%b*Qm;_z0SF;W#C$lHOT{wFar}pKyVf~yz)E;mziW+O?%B=M zb@Zf-Mv*3exbL3YER>X`t3UckSzq_sqA+B%v8nrW7 zj%5%%(0Z#7Ptj8!o*!^Qf%60U5hm`h-zXjx4!72SBksO74-CjUfIcwbvC(U*UGwSX z-B!q){Nzk$M;UA`tGR8DBd_{0-k5_RirCMsEqbq1I`rSwn%%7fi*CJ@`qmg6#EJz4qTnVRGqp z(>lX|v@@^2Kv!}P@|e04z)Nc?Xrd@1or*rAs#DQtKA(n!csi=Do%$7GouJW%xF#`= zL>2faR>S7rNnACL?FRA1Sj@!ML;F74sInZNh9S0WBNlY-7R#(Yj|Wb<=9l>lPHE@8MkS4LeKvUZ z`MKRdi3|sHn=?v9C#V74+ua}2zSJWhUD}suDD@CzVbkK*gKX2%tsTkMuN}2xEc3IG zP9gN=Kj3zp*Y7P3ttp3fyT3=Odae}@rS5};6m}k5-w9Lw1H}n9q_AlTS3|Y_%VI0l z&g7;B>?JWUxv8+TzOy*K&97cgM4F`4IX=3b!~^nrf4xpchbm`1>LY53+HbKc?yg6O z-sLwOqqh-wF?*!i8FvUrsTPc|568>U3)LdESRJV*V&1a5nhd+!6Z?*H)lkgF!Bg79 za>J>r@406n$+~SzkoVLU$lgIMbeog>IQ_Dm^OR$212z{}j(+R(Bg&B*QtXei-BJE` z+SG5|52MQ9L3j6L)R}^G1SkG;-f{ooelDNJdC#%>%|Z0y_s3WFA6O6p|AM+2s}eq9Qil@snLAPesT1~hgQ-6ZsQ79?O0M90Z&zmD zvqt=WED^c8(B7X;ImyU!pgtDkFLv~xTaxicKmR)JdTIM+*lmpBPKCW=GuA8}e*XIJg#Nd>th(N7@5bQGUAz> ztJrX5qsXc57+V)+z#I^#;OMDi$PG?(4acScnzx+K$Kc%va==GljzMcGuep04fZ-Wx z(97AfKVpS3pjR0Al5ZGGn6ko%&z9E3lEco?T=Zy7=XW=?Yn$IJLtOpK*JiS=7MpPW z{oB+dkOi&x07$0iQEZd(W(D$3zr1a-5R(_DgjftSwC+~$GB%{cN=1((cmLQuOtLTh$_?h=@w_5j*~NIFzIliK&KP% z`DtdnGX5u#f_d&P-$Fm0t!h2pCflo#Y1E!KQG0m*?sLDj$7teHc#7QAH98&Wud0i# zlZFr5M4lS)@3fH&LNd>c3tK~6CZ)@X>$_}=WlhvceaMEt4yPj-Ez|1)To*Wp<1&57 zD}(sB`*adcVr0*?V6GI^>(E97`9r=nK3}Y9e?-ou9_JC@oWsd$qcATiP^D;x(cWc$ zK?lCt>JaC%hfK<1Ab{zusq>w48<+jy}TCv^(EvWIU+L&P#?_!k8ZHh}vyTxjBsFB%L-UqdkWeftn~@0OX%^HE_x#vFXT-EyCu; z4wMvh7GSL5U6{p(qjZ~}R2y!}zy5GEbjN&o_i_1BHd9VE?d6FwPek!D#YD4NBv!&K z(y?73yNYCFil}*q=aVU*R!JzB)XGSqJt?bJgnS;miy2<-uV;r*KdmdX1T@ev}V_@ef`> zeF`-uuf1iLvHUdB&D&3-Qqs_OSDoaDC@%Ce>m&G-Q+0069lV&z{4Lm&`&6Ev#!e&h zrJ>(8>zk8?X3~X)&m)@nu{RiPV0ufgD=)r~I`B;NL+3y00szrKk6J;30>^n$-XQ zax(AywLXo!U>Hw%w&#bucF_m(J^*s3rghExj^cOMF?r_tktZIlNTh;Yd2Y|2Y1M;= z_kh>-%zgEDLWWZPCGEqc6m$zgI!E690~=+x zk;HM2!i?M99d(u$7IVCggIBJHI6_rY?sBlSwT;&}# ze50bEvzNcP@`gVr=9ubq@EIh0n6SKKaqqbYKsJ-I@qy{um_P~5HVA<)2x92&(M*O< zSo?&+`~X@>>KXA0qxXB3E?G@Wa5W8UBTFG!?qb<{*!QLMUcCxaIr!z;ZeQSHo5|EJ zVu;xV0PIlc69Uw2Z;6SxWkP4nRkshE-`-05_j!b|h(O!Y;auD38jhDBGt>=+4{ zIhwp*M54*;<;u)u-8{!3oKKf-g}=9FqU#=8q=uHBXGLhcXj7zbT*Ksy;nLsNx5zxQ@fpV}3oHxy;gy$HKM`k?8a)G%pKN9Ct! z26U&v6yDKiwj_qGbF7bSE4@T>>!Y9M1fAw}*)*s0NKz@y$I6#_5pH>t&ntV#SL}UfN7EB_iH{l3e;dDxjhIzD z&qiv|cC6XCtBr(^CfnQY;}Dipb_|w(?3OQHKEFDoo6EnzWVdxH^xi>%v>p4l-A(R# z%Dv0~8@c_oXEALu?Vk1pawv#8qi%ME9&*Pxe*6O&f0T)z)1Q>Jx4=`6UTita-9B2V zv_1N3mtE+b9GU>vyya)74y9rC%lw&!*+w>**Wq;JAf!IyqTAvBEsnp=rPJw~KOH%6 zDRn*#sc08=8?%T-x}@Y4!^ouEPj4tljfKECpo{le{PrZL%`)Z6@e8gz%KM@=xJ%BL$uPW0}7)$C-kSW;5AqH}PR8rT6aHc1BC{-Q9B3Z^3&o`^m$Q^2xX>#zl#}dtS(+Uv`@7PC@bdr6+|ldv~M2T4^ptbttoc zE=5r_(wdM%5o%}*Nz$!$@p-_6ucc-O<=+m40{(9P#v_w)-+N zjzVD3<2Fpg?9Ccp-F*dks!zI-UX?mA0c)!oVMZWCu`Z&6H z{q&Xe!!sbz5avPNF~(lr1e^xs^&ot1C!TJ`vehrOu!ZQ}?}JnP`#O>bBv^phP9TX+_xkJRjOkggc_ z&a`GCwoAQ)+JafT&cfS@7NkI%H5bvzl zN2cSQ{R=WrBiPQa>3Q3nft>wJyiqkTUwsLxw;*2wZalH41H2soy|B>Zv&KPnvp6TxL|w?DB$wct4~t3jzzn?I#ND2ZbzaKojks^iES5* z2xIaQKR)$i0n8U; zW%HWxWLU_38Sd0^5LA1|T2Q%_gF6lG;Rva!YwioGaA+PpPV-2^<#S^#cY;m_0Ws``C6RE22HBVh5QR#o<0-efOdh z*-QO`iN6llTp>44F)=5@dYKrhHxS%-lb3XFFX^Gp0ZDU8#2ti`WObpL>DKCW>G@;Q zCHeN#-K-TDn#Uc;PGK07s4CF46-<+vE2Mq~%Gm0cXP(g* zZwsOw{F}!52Bn})1rGGf1TU2)vwu(u!}A}INofD7Xwa>L?B0_CRWZLsg--R;7P>Mx za@cPLkHBCiSC$z922N%bVD{*7dTvR9c>!Y;%(b9%P&{)hD9nA5#AP_W-{U$-IOx8H zaUUN2;+gQU+yc>8nlK1NbC+5U`8d|ndn9+MUJt23J@>Bysu485kueh6fW|)9d#{VN zPk=krPMgAczO`9Qhc{m zzxPrIBN5XQO{Z{-QGd6TY53#Ul)B^Oh(8Wg3PER)bec) zL6dU4NtQKqz;xKmw%_LoSO^tw`$L|9eaY(KJOMPnZCmmLBpC2Wo`7SR#@0Lmk1@s{ z^8}p27?0)&xR_EsmM7qF2K*^c!13D)IJIX03YYU`u2=A9`jsirtbfRY;n}r8-0F$7 zXT!0oxd(~eRbqi&8Nw{lZ!pB`Pjb&mOB9URbKi2))Tz~A;~ovrz9%AsCZH~aTu^?( zXL_x?s24sCKIRJq_%Rnh+;hlYW!fvDd+h>8Be8NJXq417R zOadRD1qNb@<0s~U^@DYa`{<8B!)717jTylAW_Ow0JOzUs1`y1lYy0LoF< zZEPjLE~agdmH{%C>t>I8!QZz>w*7}8-4Ps{==ITTxFbhn3UG(eg={$oW3a|?Hq?a= zyYpZS{`htg)<P&>?L=48=xW9sB%GhiEx0rUxd)6l)=dhde%kdVHDM;6a-M8V$ zrv47F)L*p-@8XXrIPCrn&c^4YPSBoY+$92=RZ~6W(mouCc|$H^B(%c>;?+~XLZ$nn z+_9tAwr0*nQ`6eYQkJ^Uc(I&#dw_j5UhepiYWC{0qcCMvBbj$C6>DT+de81(ny0F% zaosZ*y~o21{UZ&P5&c}jdkAhQ#D}ckha=)H0W=R9-$h-p{oxrP?kVM@C4w;Qf6LeQ z-S{Y)IBU~WA4Y@!?@>Z@&NXpoVjZ(+*@LM zlG`7oxB(=#AB7(HV4L%=1+?zYEA#-qB%YCZnw z^mFvr&HjF*ZRVHTKR@N=^S`jk|K9Gp*ccDVN#7DNWq`$Fk}f-T1cAM$c0B6W^wC&kr)p{ZyBI?wLLv=O5dT^O+YXN7lVjpCErvSvfYV zWxaDxLNxXa%kekl{u9t?3gb@y=VT|g)N>8nk@tdkM%$yGHR#v}LZ?1NVjcU#m1%@+ z#xi383o-`+%7zlU$ZGF7&a%uZct^6UJ96(d63aa2QDdf39hDJ(vZ*W++{72e(0Q0i z(Qc^b(SmTten>6UF$++143Uwq5b~A!0&Zi(Y&WF%a(}*;BpoHB%6(WQvdm3 zqSzW{SvW~lubx_5e8x^%9Q!XXNpZuSROUNK4JzKEoI}MQ?y;Uf>=P|;sxtEv#&4NW;D&1=>*@6G&JrRMp@ro6FqErf4V`mNhO^bM73Nb!Xjo zYyPxtDH_91&mm;|EeY}v=rb%pImkrW*yb@jg@qNI)(+$Z%X-Tf2ycNrjuE7E!mIGX z<&mIkK`yN5heL%eum)99ppD6G`_i$C9!F!fdSPs21m*qhktI%o{mOs&6 z!m`zY(5rD#v49#10P*fD>a~?xRoK+iMm?Jv4gI8o)P{FHEFkAR#;_cnKx-%)BsxV? zr?6z4aFVm_{xT872sr{G-pNiy;h2r*Y@(t=@8KFPhoc76cxcBMWr zT>j}*-t1KNB4hGhIc$q0!>t7(7f!S*?97+62C%xC7l zLeM7RZ46HR*{fLGOJshjJANp$pz{FS8FLCc_hAL=C2HI~mbnvZaI)9HLa9l#Yp(y} zFFsya-DdYkw7EdBn&c-awMBKgxF-ymo_pnc}Na7`>?s zyP+bKX$C5L6t;Ua)T_5E((zEH)eEQ(W$y6Ya`q^edDz1d_LA?$&ck1rqs(7@uTbV- zJU*SfH52a~T#)$!1bTZYbHX)hdAzf@Ui@TN$#`LpP4^v2opzck@$!1wrMw2T{k*dO zKLvS3y9(Ru<)r=ykxZ_RwcYb!U}ZylWB<>B%lIGQWM-m`)|l;Xpb>_WO(X22djZ@| zsuMi$;8TA`+Hyk|&I!c6ML{?;;&r@a?laQwckByUu+Gy%mR%u25lW%Hvl%ZbC9gHf zhq9%R8SZ)3clNG#G9$An-?O1%Vl^PvSJi6Wz&)N<7xz2xy;+0DpancEULi$AWengWOUOnSL~Pd@o^1gvq?35pl*-R}u$3Gh-#2 zibHN094pXH+3r7}99->{#?BiDvG1LPxD#^XVuf5{4|ht^SkWx^7_@#01}^Tg#-Jlo zl+A1XC%n%265Rc@AY0~#`DO80xu1zF-ibHPYxG*r#H<`+#T5?vv`npVadsSm-) z8%JpWdg`u=fA&lk4l*9>>l^FG^N0l655k`SZVNgRiuSBa8f~QV(!l$-(3hm$MplhO z>^4TnXJEBM@|HOQ70#B3GO*IAN(57udM*K07{#>D2Lp()0DrWNG&2A{yN!Oy5lDnI z4K-<8vZG7NwcfZ{7@BhUn>v1Wu8SU-*WV5i*3$1^3%;0QOQ2V{bss8kBRJjL50;NVw)W3N1$k~p;RtF1z0<##m#TPK zD6=opOnn1%?m-3UTMqQlkhEncq!OKi7jV$rcqBYLZiif4C5^S51*V#doQT1Jgke#H z;gWSMeLS`|(=%-x1jVUPv*phKT&3r3Y{k6hQtc`Z*dmCqOb@g(haxpWqUG3>)cmo= z|0QLcaXoA<3vl!K8ZX6qM3NsCP6w=3NyPX$jsKS_ncrqN-0 zO`R|dYdYWIs$r_$3xt2S@b7zu>${!PJl?6OADgnUFJPFRQrN&r4fX=NhFRUhddM5k z#_J-l&4@dY*XbGV$VJ?&F60FNcHnnDmFvj46{>xx8vWH{>Sn9 z7UtshJGyVvY5XV0UzfEn7ryA{3E+(-@`vT}izAQu(#iGL>&lY8lj`L~U>X>!=)7;= zzi2!3IsUpn-$?x?JZfEkO2MD@wq`NvsO?^f&=t6o>|J?+{sS`R*o*b#yruV^D}k7? z;#1~!c$3&SUZp~FhR_io;y51$@!(0>S#Ec++*%j;iL(9l&MB9C7fL~&t(PLS^$LIv z3enx}(rBCMhj}shVZl8iZ_?pA+UP;ib8?)64uSoqKTgWN0jOym(+X<2s8jw7pSRFN z`Qskn-+i0jVt-kC&B{^%LXIO-V~~T)RL%gtLqB^@z(K_)*u7M|T$T4y zcM1FuFr)@oEKGBelqm+p)oaLcsdnQ*AFL$H-fa^l8`NfqCNd_J5)n$feK8Xi&?&m!ft*+XWBRG(r>a_2$xc~Icd^XWc+KIvy3 zLi(iw*9yE!;BN&!FYq4%iw-5_s6z+iK>mV5$>G97Tj9P*{C_X-HGy9U>~k3DTLjKJ zjQTuJ+?OB5xIaCNQr#!+zY4Ste`0({4LO{l8v%Q%n+|7*3^{^s9GgNJEf;tSAUME3 zq@EJ^hQLpbV2WcF(toMI)qs7}hK0`$?W3*)jH$=#Daqd!GWEYBG^UCd(dTE280*eO z)OKt!-G?ludx^kx0xuA_N#KnF?-0u0E~Xyd7I*AOy2l^MyqtX`Q@KpwuLM3S@E=E# z|0jdU|0{8?IEp?G3tY5>GH+V)I%K{BFs5E#Lc97{;MW49OKERom(qWhz-6PDi$j-^ z&q;u=C4p;>9uthIs{upmouirJzW`$@cnmod39J@48!)NX95cEpsm>C3nZVlw-Xrj3 zf!_nh)TCwPbG*O}0v`tqDd$*PZ}G8oFFcm=v>zv>UrczxaV(=(j-wUzcNzMdDTLF- zz1*et)(QO5eGP{>6Uzyk1Rl72?DCLm75Izg%;S{fH%^SH*#Zv&L^&S6NF`M;!(0># zYy}LdQzkK$rq+tqkeURDTC;-w>sC;niv&IZm{cE%|HKpMzewQafH75j;-;FI+HfNE zwh=I-f+w+lm7GM*SD$q9Nsw(N+l2E4Mpse7j#aGn|AITD(yN)fmeq8RU(Nd4wtD{R zn7Rg#EhpPiLQ7qTze!b{gEbi}C}HE(J`xsEr=o?>WBuwFJP_g2peHbAhM>J`Bn1e>K^7ddxDe>EI0Cx0Sg2T0g~ z`0^&xTLNr}nuj+}DcOaftbrZ|SypwC`jx#8#+eJ%7|TZ39}u<^>T(HF$7cvFqP|hW4reMW_Ema4BCvN6A)XTAIsbISZb|Nvv+XL8e zbv`h1*thZ2*EB?D+D_Z*tP01yosOXd8OKr!}CUBKF|6Dn zN=m%1CEj-ga0E<|bH595YQp!6AAgI5PpZ>=Vwyd7bU zz(xr6fN*iFF_J>3#0yxv*|a*m--Fx+tQo>39HPxftXYymUtmFC^90*ju(-7tT$I`u zSQM|boh0$*NxVvf9c8f95_Xco+5|hrU>(BcT41A9rFE*L@HDVpft@at{}9T)))|tA zf-q(2YpoZ`gkZz0%WYagjZ8?Itw-!IB-8c1*?Ls+r|bL91{(*;xmJtyq;Q!nTt-`O zi(VEAHpY5SG`~!+vDT*|=PJP_T3<n6c|CfF+LX2Bj5%2n1a!sXe>tKhQQ zx=mzxA6O9B9Z0=MeGTk>tIfJwWC=xIjYL(Ob&qf<1$Mu6ioxmyJJq^h!bS~p~;80<^I<{1p_1yXPg_Knkl z6wWc&w-UA)Slqr8-%2LsZzSwe%NFbzg9QZp)L~G=&W#3}CSjX_Ewg`W?JwAEf<0m_kko%4e+H>cS zOxQ*Vvx|P#yT~cEFB7a17~^dcEKs1aD+L>A!eA%J?a>m3JCDNiG++Uz%)UXeSw;O} zXJz(HL8}_$9$-U&{Y>)k6BBlaP;L~g-2Sy_{w81wJvgqrB1d@cUw{<~nyfGu)r>@NjdEAa-}-v+IkB6WdagY7_w*zJO)?0AUQ^MGJO?5YqY zdji;er@;SRKfNXY!`c$UK@rGwcV1a;9Lj z?N`?nF zU}(vTzX=D`5%#wd_L5)=?e7KqNU+7&Qe&xnCD@VnPJ;d0V8aCa-e4^8TSi;cG>rEhs)Tg6_=5+ueck^qE?L>1)qSLUqN_$#T?MAsW=F5L&c$h zw^S?yyr+VxKPK>1f$vou1^+J*%Tkd_!dPF@RQA0U{)76`XIS4m;2tY*_r5wWcUf~f zjs@kMj+KD3I!>2ZzY_XC^$pvh&>Ntf)A3&4xIL%i6M_E}_?^H&Kl;Z776W?pHT|05 zKUiQ|V3WWWfx8OaL*QP3mRi)0np`ICl>*m-o24%3N2zw{Pid$0Uk;yr#eE>)E~uL) z`zbb6*E=<8boI%g*|VDTr15+nub$}S=G0O;kC7T`=7}2W>P3O?31r?q%~uXwgogb2 zfgCSt`nv`(*6#-~))Rw1g}*MNmj-${!YNIn)ySJnjySK;LQSmF7O_K4+wl5Fsqr{K>sp$&guAzz_$c`AnvOvoF;Ilzyk#yB5<+5Wq{Po9{^VkVda(aKH@>)YXjw?-TfVLo@teZJ@pV zRp6%r1C1Brdkn>m^`Vfd?`JeNhvsxF=}UNyxGw#^9 z{B#6EUjdxe5o;#@Pnt$z$Xwq%8gO*;Zs;i%kGv3V&gmoX3)iSkBT0YP$lrDIU%xX$ zuM?Q12^r1*dgqVAb2_#Pd`{pS0zVe`AAtqCd}PwyMa>v>Fj`Iy`*Lw#BXExR z+$`<|;=V`RM~M4zaUUh_Wdbt-R|@P9cm`mNI(rn`(#u9McQ*iL+vGzcxoxtSi>B%a zBW!ygMrha8m_EASd~DQx(2UbUo-+ipMXgbD#l2Wy1~8#Ejy@||qwXJlWfZ$iqc6l7 zZ9({Az-{7wS>W5FVZCZu_&U&hEI#dMKSSzEafimxT{z~Zs3&3hm?-+bege0Rru$`q z%ffVjEbfqmw%60=s5-(z@!2|z?lVRaR*O#x{O5Fx7PuFnrJfsmatw8C?5TjCj=c%; z+v6S&)u_60>tZ!(*tj#{uPsNneiO&tfI9fluC$qFcV%z*y1)+wekCxl+r`jE|J~jM zhtAz-MIZ0hP*9@+7|)vLK;;3!fVG`S^CwM<-Ci zT_#+EBe}YN-*v*-;4n$xUVxUGHG!6Y_ykI#-Oq^owH%+ui5Fs&!q9+n#eIsv-%Q*9 z4nroP0i$mfCePQ<*G2x_0aOOQ|eXy~hpE#;`qp zkK^T2_n@3B1)d`COo0~*yg}f70v{ImjKEHT9|-)Hz`&m5QzWpTz?}rP2;5!Zz5?e7 zTqy8ZKudit@IL}0Q|MDFuu9-Cfx8KuF@<@b52#ygY=}=~uFC)us%mOuuWa2sqF4U9 z`C>2D%|9cwYu)@a{LciR8e^GSZ`w+qo%#*vUztiPqK~%K8Z#2s$Ks3 zdL;AfY1H!{rtJ)$&m>gy>^J>-`0O5JdmrYvV;`n<#y+IqyiXnc*+yB?Mp@EEX$!Q}9{aM!G2I%q_rB~M z=IzUpI!541fu{?+MBudoZx?u&jv#4k4%BzE?&$=Wrr{iouZTU^=%2_uj(1Xv~3AX($=$lmSexJfe_eYoR$Fc5B z`*Bo!&wkX;ANFHU_lw~bxGbS(C3+?@c7Kis7Vm!m{Eyq8S~^i+yTJ8;P3ounFX=;g zCTM!r&DpbW>{Fwb&R&OB>w?+T|JAd9-^Z&pH_v9?e+igSH3!@PI2@4NMi&##EZ#-k zwg17GR-Ficv_fL}=N!OTmmRRUcvi>t2e4dzDKI@}F(`HYJ!cMUv98e<&ABg3J`WfF zxSIYO&|7N6ycfWK^gO0D9dH*l;^4zd5^C3jDeY8&2MJs(aOJ`Ep&B)O{;?%BYV3U4 z%;fo*k|xzY|B4bzT|EC<_}7i2|K@2A!l!rvOLN+SYvG==fW73z8PAo>>R1T>Sslj$ zCe)S%8w#4#GYd*e3Dbb@FBlG3bjW?;^S1FRw*GPAZ*X{szpcT-k{CGa-_~GpNv|wc z*sr8i&VvYLVO>c@76T8H{-ds}7A>%zH#_GZ^z8Q7;c-dhc4yUsMgRBeunQtAu;G8wA^G{k`NE zoF{wPU|)kvTzzdQgQXc@sd^o+Z)wc`%Ep%9pweEzT1?oW(t$YFaG1e%DqV#;r#B0> zR*f!g=MB`sk>kalK!m8Aj273cx)#`48eTuMZ^{Bzh%LiCB>J5XX$_D}a++Z!` zt6;`hP^2u88Rbs`t2WqSNU{%7+1)VX*axSF08o>?*{oRVxKs8+oXF7pqQf zFxb=OV}acunATan`c^QlvwC&eP^P{`Q7`rCS~;q0hMkep(rRG>*H zt#8WP)lO=*V5j1Mdkkj-HuA_F>O(`tEGw-(7wl9uNy1K+<7`^jX?2^%BCVCBh_}UH zr&m@0d)Z)DSGHLV>QjULtg-`Gd>5v$E^>F}I;&CD8tf01X8~(5*fxX>RWl9tD#C`U zMFxAP@>!fiJK10#SH1{rgTbCCIo}$tZZ_CUB^Lv`U$Cv#mz7sqO={dIroPqsu5zn*-P zD3~szQEIMWy2Tu&mI<~lGPB<(P_8xDLH%|GcA1VRty_z_*@Ru!Z>HU%9x~V+{SE;3 zyulto*l6{U!5&8#oMS}J$SeI0w#TS)gT2@9FklUWY01W_k+_k7n{Sb?`jz6H^%;U` zO^j8`1iM5X-v0!9tlF3pHcoBvu@`Y(nzs{bhzV)%o?MZ4J4vw;aXzRa9O;&Rac3%JM?8$0{ z!LI0kBe0DIyP^NB_8yo6Nj&TJ{&(3^RKMLcc4z+>&Zo>U*ssB5s=Cr(5A?qm*z*S4 zig?phe7uhL6nO5X&N0{v{U5Yvs7DRp^W|&a_*yM8teOCKO(VnF`Ch4%92gKBV z>Pmx681S0CpL$uaQ`J=P+)sV#V{h5}s|mX^-l=L1!VXX?1bfpuX25&)9CfY6q8AMK z#Gb3}HP|l)d~VNE&l}1Y27F^5tUfo`X9K>s=PPvU_`PYBRDEMFP$LbtbJgeeA!??< z4yXz^hpA--JE7`Db-3y<*riob=LmJBU>B5csp)lphuxR2>6$ zzr;HYmepY&p*|Aq-6-QNR7HD`&$|}mEmVgYjPVw#6@tAP-KY9Gd!af>NT ziWa#@ZSk?o?ZxU19Zz(2l=@bOMQF)ORr#JwZ)=3sx>Suc7_D`wnrSdv>r%DcV6@hw z)q0I7TI(`(t-)xm$Ete`M*BQgy=*Yr=W*(5gV8=+RWwCXSG3RLRmxzr&y1R&u?X$6 zRn0aS?Xy)aF_g5=R<+iI(LP(%wFaYowyJv#CGB&C+U8?V+b5{^1k-KEiRxRybQ^i1 zT0WJM={E8tI`P{YTvh#`?PGaTiR%$HD)Z5iI6UNlrRcbFy$<)`VlMTky*Ql3$ zY?yP38abVmI`s}U)5jL54zvc@8*no@P9ns2a?H5I^?8*Bo?&Qj|QHXC7QsVfb(1Yu{ZyA8GyVP~r?8bdF- zk8_TC!-R2!bguf^U>qTxtK$1m7Ts5!r$){sc7a-7Gut^&%@9oI=mK@^EQV<RhC%4K{9|3v8suB<~y5)GpW}A3NFEs5*S?bmtOvv&KZ% zm#K#gMqOW~o)>IubiaY;IhU)C47On4MZl)+FLEl*12(DW4aO0~CKZ^i!#HEOLQORo z$HG^t^@44UaPD-ay4GNvJ6)*)2S_|A&8t+o#;hd+V>lH$(qKOk>@tI~<-1DVZLsqs z>|29v5^VAu;c49@*lfYpM(!SXxpS3TX0R;-uL0H}n6}8P)k8jZk8`!^cObbi?03#} zYNTLWqaP0}RoAN-2K#bg1+c?3W#s#Tt8i{~rNN2@Jqhd_gY7ctkIs$i27~QB=t*Gr z8jRL+liFr5TF*`D9fQpr^t|&^^{v4UAM^^aqPdhzTh`6$J;7j0(96v#Fpptd6!U(w zsx=tP=w`Lt#|Gj=>-`3!25(VC2kCg!;4NyA!KnFL)V+eORhdD=p3q^|$%9^ZZc&pD zmUz~gz;08w&DYq4gZ}FLTs`4q7ddyRj|AJOt{wCtUhoMlASJc?igTyJ(*pQyRr}P& z19z$Q2Ad1)*Xn+QaVC7fdfs3QYbyiytIrK~Ol?iz0TnnzbKzX=K~-z86}73rgKDzD zR@FYMeyNQ3=Nu(<~NympVkqv~XXeJ|Lx28-9VAnYN*PQ?S@F`OlS zL$GzKzHSw;*@rQOb!vo!-K#OF{g0_9e5``;d~EN)pVZfaaRh%r;0aZ9xWbQ`uTW3X ziQm@XnS&Mvp4JF3mh`heR$sR)kj0q#v#M5eiCj~6Ji^8q?3Z;X0-GtAo-sV9mI=01 z{eSGedstS**Z4iN_nw>kzClicoCQ2^2Jw*M8I%+i4FwgG3KbO%kD)?ZLXv4wX_{$T zL6K=$nQ2+tH!LD6EzCn6s5H$mwKS=ysNS{K4BPEvb@lw-=Y6l=9}iylaz3-xtU2zz zXYbhu%;6yGKvSPu8cRo5ks{3D2wR~Db2!2(h~&0;gzZ*3^m2q9RfOd{#u^l%mt*YE zB&rd$(lM5pha|lmW9iorJkkMw^6c{%+o}k+74TwGJ9eBk5!KT1_5{nFjOl9Wcw5hQ zO5%9Dt!JK7NXPMb`#H-~gvZ;@S+z->^eO`;w(gvY+qh3wMU+DQfB%092$% zM3fpQ*$PG85%&RANrL0iL&hmqO(gdWUop3Q%t0PyzG7*LaG!jdRY;=!?rFAN5)X}d z)Hu!3r(wF4EH>gv;|vB_30oO9Iby4E)}$E`Zy4uHDvWT~FR(mHx72=jq?fqB7Abll z(hq2bBpR(3S=BXEM^wuzBRhzTtXUFWskz94r(-6y4!lxxk)dJ-97TAg<~uf< zNY?gywpQvm&Oa})twge|FR?mF_WhBu;u336^krmcpk_svBR^%A8C*nzzom8-bp&XI zB9Ev~*$-@!q7cyi0B=#1mbjn4!jcu?e*Ox}A}X_|MJ0(wR-h;|svl5^qG?e#iXYip zMT??_0c|0Yz4;Ssn1MOS`u)UK&m^M$`7bJ8gBRG7{?_Q zq)8d+W?;BkbH~zAV}6G2a5MP_#Fu7~T-S zNzoTE`+;^7)v!m}uhN~oUJ>s3TzQj8a6ORwEI^+%yfFr@67#i^U|;^F-invdsZJSl zjlC>9_ywX;79I=FZ1F|Km~JKO8+%^&^`Ex zMN+pqwpn;{``wbBkJW5Gyi8FwJipwACoM*u>~}xDp#-Un9gKx5y8Ke9q?6#qpSvxQ zbS~D@7Ra*|HO2CQSNRT0VY63Ta8LuVw}8{^>`E^k)!TRdFD<(~Ir4omG?0$ju8QHop>;2JLP zqsRwz;XF%G80f-zzM?qLwc{m2{#iL~^^0=85H)gFGXO;i-~%n@$1nEtv))*}Ad3SrWBpEcba(mJHi7mPaYV z_Kf4nim*N7c$Ok;&v;&-2-`EBmnb^Y$rs)~y;ji~$UT8?QG|2$PP|4D&e=QhqeQX} ziM-%pEQ=hUo%tCeS)VT6?AU@`c&Z|7!7jX-NX}Tg@=KEF z7|@j)E3f9)l@}7pJ#<&Ti3r>52)wD<^AXCAjY+NaE$I(ef;R9p=eBdG@17n8TB{o_vcW%ApspBa)WAdC{5{ zOL#hzuQurxpq-NF%(M@$Q-o)xefSw7S);z(^D*=y+p{00C4Mc0$8;S0E3g2ncv$hm|)T9?|1GxWM%pEPa*#`0qBAo9Y z!S}_`U#)l}ahGinFC^VrelGD>EsgIal4ExWuQw?G-m7A)!-Pwz)I)i&A}sY#o~Yrzx^^e$O_H=SZSDr1RM(1;8`xWkj-m!}(ewS-;_YyGbwDhV#899kPw!4JMti z-Nc(s`r0;<2S1MGL@yU?qj(>aez0Zo43nB|qj{d9?9N}?#_}?gez0ZpwM4QdZss+T z?9)5@!qbQKii$f209{hF40PkUeZ6d@3eb(`!HRZvE@nBro1%9*?*~dFs)cgyvfaWf zh)UVM&bw^4@x~441xdI};K5Hw`T}&5c;l0l1GVR5Zhy*3!9-_yW)}~a$!1UA+{ND| zpC_7@0q_i0wn^{VrtuO<_NiS)^67l7qS;;EvrXq)6cu;zWw-MhMN7K`039Vd%Q1%n zo?L-tsb#CcvVfNpVGF)zE8trt*1$gdH=b#+Z0jkRi z+0mt#?|Zg|nr#bt%|=N$Uhd*&O!~ogH!ph*bt~B~T~63axZ5VARm{KZ54L-F2O_MI za4F*_C9%<62f8ffX`9iqlr8T%%w-whs%T4BL%-kbzv`};E)Q5J$EDn)kGoECdC)>L zT^=^+%dVcbl_p*4y1?ZTqA*t5O7C{Jg*pJO;&qUF7%R0O09wr(6*U4q%Ke|ma?0LZ z!&eiXcRc%L|EaxkHFHtEQ za>GfNZ9MTc)RnTF8+O@taJQY3W&^#>cPm;1^ajs=<7z+b;^m64A9kC)xhdkZ%Uc#2 zZd6++fW2c$zQA`pE-J4yk&4*LftjqC2KNT)Fo zZc;6*B1hUkB1;|C)o$M7q1AHsgNRFi%mrwaVN%m66;b2P+;<@g5>>xj5 zTK0wKEfe2tNtbH>jHgMWjcK=g5#?L4^ z4(X2bW+HhsJkI;l=g#Q>e=mlSme z`kK4#CZ8;|N0$8?o<}6-?C1F2x1?@DNS^&1zeFUDK;QDP|DX=(2>X_2m^8zFo|l_c zXurT~OnMNWmxD*t;Sbk@7umn#QABc0_(fW{b`w#q*qN2Sq% zhTT&;Lxk(TJ>WS>`}>$uuKRjv*@`fomsUU|*L}UTG9u~4ORFHlb>Bj}x3=4)CHB_Z zQAxDY>#H>?!ZGNpdG5vhYV9}%eYH46I0k*SbVWD@+h}=`V5N7x-CtXz2*+T6wptO6 zx&UpvA{=#r+95?a>VmWjig470XvPPWJHt`eRtuIyE4`swq9Po1p<1f4#8DTjDpb1lA$#o|wPvMzG2|0_gy!=Rs*dC?LHmNU* z)#@bKkM*dx$7#X)q~$j~z5=R}1o^#Zi`Q~LCLPdk_5|&cB)cuimvzzXpODV(LlmYc zoG3|AB2k8-{zUmia(387TSO%HpIx-=b?9>?dpXHn@1k8ITEpH?(jAcB0n{Nm9bL6B zMb%w(M>j3qB&XvBtw_;{q}Gn^+D?;#97$S}qOX!VI(lhvnU#Egl@#yjtz|1}gmith zwI&5Q`e{c^>fuP%f)C1cjY-Ll0a~u2KcLj9TDc;Zp2Hle+D?-)95-rb6a|8Akmh+v zdI{{A;TWv-Q54@(ccf`qiav(=4be(W-B`y^ZLO&r>qyrQnYvuZ2ebs&(LeB3mmV!Z9D>%+@ZMl;FHoOZp6bqOPxVqLyXS5a(pAfJm+%P0^~4qU9R< z_+A;#eC;TaydNxIYg9C?*Famo=6Q^K+86Zlg{Mj56fNyF2GSKOda_rgmamm7+S)4z zbXAIQPL!|hCR)O3deyk(YloEXF!-FNl^>@Z*tuS-^l6&U37Ov?pqs8;P}Hh7QhB}9 z;rhySE$wqjfl{ZaWABO1>DnPhxW)ip6yX}fbd7z1>1tED^&V~9uEEj_{4HezdgnW5 zXu&4U1nQ$`4CF9V%ThFr=%k`Wy`7+IGHE|h*h%zR#uoMdj?L1NPa&1Ea^AqioN$)s6)%twhlI}z25pA|2981TvwI*$J9@nZB;aIBInoQc^{6gzzUJI+Qe&!i8XP1;&TIF^3Xs!iJHY}OhS;aK`Z3p*#h)b-inWO|-SyWq{}TTFV# zDfA|jK6EY)y8^m3Cv zbO!3xk{mdeLi96=a4d!B_6wBGfnzB|k5hzWDMZgugkvd0FC;2u>-!#ZhUlw_)T)V& zK482EuYM<-q54+R$@>Jt^ctcy_D=oII>YpOMFaa?0J>zc4A+f|Zugt!z zUxaI{9!FHe*MTlp&sMaxUyVzgzJ;iiz1#1QGv2Ii`~H1gJL&tB<>LM`T|4V(-^)6n zuB+~U2}#!B20e*L&P{L7)32cdq8f%?ZqUzIbUpMYi>`-Wco}`7mjKpNUqMvMF~44B z$^4V=aqZJWtwNJWvc4uoCEpITQ>DXa9Qw8B1g7h!?ZlIG^hTw_ zei)_)|9G`V!}M;7Fo$7!nxegsL%N=;=s4t%t`{o00J`CNxuV}eH(akElDUu2lYY8d zqnq?}N%l?yeA!KUo}wND0)UE$WV#GJ>F2BIM(XL;Pyvw~6C?GlM71z_9(5h5?^QH# zz~_u8Hz+zXV6W@VdhoAOcXq%**IV>#BDpo@>QzLt)VX>!QLW>b0mUp= zKdQ)m;C>+V0aquXEM;thet~qbr9$qL^rYWN2UNx;>sdr{3!kdz6P=~!CZ_7$ny*?; z)k}z^Dr%AKZJ3mNg7(bRXRJcs1QJy~dJmnSRouyI*g#=R^+GevN=+qOua_&rlC9V4h?c@LAWynIpS5^wo-RrLa=pq6k+CE6uv^O5Ni2v`HVPZgYD^ zuO`d09CcOt8AYgjR`-Wzm0NP(sK;GH$&zT#zERIsgnRaldI3=_wdZqsxh35uy~3i~ zr0=%qHtTg3-DbVfqI+KVgr}IH->C(k*TWQH3qG&s5y=s`MK3XFKii^L6D_sleJn5P zM-}0HEHCO86di&7dr3FoO$Ja~`(^0Amvnz3ncvHLlq5Tj4lEIuj>A-T3T>FdsSa1$zC+bmu=T86fGGP0JL4vLxYOh4t<}Zjf3_BomBK6 z(7mQNDLMwa*K{{{r$9@)yslRh)i5jzkXK9YPWFa=$fW&14U+7YgMHbXI^0f0b$@Yi z08kW>^s-CO_eGuD9^NuX&z`~XHbH$E>E!lTt#2SY%TZUYFKdJ8O4-MQUESZ+J^dsd zAKb>hR-ditx544=ALvy?(#t;mkR;YQt&96U-OZm$2GqlSzwRF(sef8O_fPabCf(>> zr&ke`vVmzgx*yP+rOrM+ZMgfVx=)}?hgVoX)sqy>O3MV@A|hG8LoM~A^*EEn9ceW# zSLu%=Cp)aKrgZqEV7~ideYf;U{eDEhVA2tGL=VQ7O4E#bj{9eNwn;_qNA(pZJ*XYi z_YvW$P>K6-y^%<+3Z2m1g3(JYtO^ympU^v)bf0^@o+pW(6#POjQG{3IztA@*S|75) z{R@4!qNoLL(yCB{UZe=G&o}7hlHf_f?d}bFmD1t$ z`3AjO5ni8f(8I!HesOKzbU&w8n6$_JTir9fMR!CyuWwR>t3ns_8X~zWbV08-=_~D` z9@h@j$!7z<*K>*Fs?a69OcJdM{h)79gsVbV^qtBQSA~Amk1E1dp`Y|7MYt;Tvks3< zLk_1nt_n5j-4x-f(64%iB3u>vP0v$=t3vQjSo*_NA%7Q>XjSMc;p$GaUP9?`J!g)4 zv%ZxGSB3mte%B94qNf3W*E@8;vYh3Z?sq+jNUjR~u4fQQFTd*rM7Szcm4)G`b2Z{5*>Tjl z8fl7f)VUhD$`VJNn^9!a9`{zp3L@Nt)wsADJ0;oIhn#fxFnl60ho$yA)4p-{G;$?D zZC?axP=uxSGE$?^5|3j6%-hH%s-?F)v^I(q;nBXeQ7(z&e#ytEP=xy>Ut=p#jRV*1 zeT}_}o&`%^qn=3aY1gyYRLU*>0YQ&gK40F)+)VSfI`Rz;X!fN_*a z);+*zBs$CS4(LE5Dn_>M`Ls$c$e@7?S8>FUKiz|jKBU8O26xaJ8AN9}>Vl0TBH0ol z#un+t;XTCW(blL@6f(pO=%}KoA+W}0TvF6y$bKLrR@P|HkRB||=%#4gkk%eyM!KS@ zLjr(u72(tA;YN`nd^$bcD3?UfaI`a;l@6boY;WYmQ4aJBM|)$pB7BCUgW(@9b@&WN z2V;>*o%D{zNlDbV5k`~J;awjQMqz?Xm(bmv#TXY9;awlG#-dKBJL|v|jyPjAQ4OCr z#GS<%P4J~P+zT%m;$-ngVdoYvVIJ|uTA~`hc1W{JqETa#JL_hgA(F?x8w|Kv6ue-s zz&)PSV=Y(3x+}t~VuL)AS_rO+jqvDY65dJD&+s8HI40aY`WuOo?BlxIJd(*0%1KAq ztAykFDm4ws@klW(?L#M8sLjxP3*kFgu3F++t4ZQS(oBy5EndV|N%K4gn$!rotAryt z)zk&{v=a7%scY4KXfeC7#j;hGq5BnuL5)&|F7g;eI;2dX!6xMoUE+~u(qfo9?Le4D#9MiHZBmIbzqN;Gdyp=a-MZykKJr^Q-nP>-pE#jJ(goE zQiMHri&3End+b)DMiKVdZDv`p$8Iy~Nmt57q&wMdMl;+l4SmaROV4z_&FIzxsfOR4 z{;tOaBUjOUpovDgq6dH`8M}#=vZsOa%pBfG{Es%-LLYccG3unHeRq1D$5f+H(Ltbm z!yi6D-*Q$r%}6w9x5qRi-K5VvrW^Stec^Gtu}PBsVtO%~VN@$}4&M)SNKxc)o5xHe zwI}6ZPaNI=l%r_C@Xvrsh-w-3^ekhiBJAneMpiFs7lu7O+bB_lJw3-r?=5xM({qdl zMcC7GjNm>}hiyIAC?Q(OvW9=>G1u6tC~x>r9)-pkqEmd{@c(G@jV2;EhXYz*g!M%) zr}*CCA9xfQ-H6H<8}Wfhv5`x(l=+RA%kDJRD#AI+LSw6<#-u+y78+anp_dxoZiJi1 zT}B;IDN6#n+t}J4b){_32)pNE!=8+^gpD5I?OAG6D7tk-fag6%0}yWEuaBtnSYo)P zNU8%WGZKMtK7n`C-D{*NioNLwP>v$JgMFz{s0g>zrN%Nvc<`BYiOH;CfX?rq@a%Eltu!pht`qLnUp`_`qY8 zkvB|IHPC8fyP^*>#(O<#xDA)OZ$P)!xS;4q(5*AN-6VBv{KP0Ck|q1ZsJ}*c$&&69BlXs+WjSDE6G@*3 zj6)XPL8F04`aEbP-gdRN2aO9vat?ObFmkW@JZyv!NuP&}GK=mrW35H^nQ_LVJ7zQy z$t!!u4F3t}^DM_Jd&i9oB3auLM&314WKsY-VU(LR+^9FIh;WuL+W5lQO|*t(c6rh3 zq;b@w*Sx+m(kEhm@_w+dja(vGzpo9?NvK-`S3KYG0-Z@8czt6mQuNZu177Eh3yOA) zJmGcT$jQTWE7^x5PkUW3wkkRUbkWG3EbE8YF~2j46k%<@H?|PT+FqjZ38O%?8nwmk zDg}-@=XKerws^T>oV0jpG#aK*?(~kH9}TyuNYdwzMi`N7>mQ9|MVR|fMxn*>XJeVt zVeUU0TNGjLO~y$@SchK?co+n7kUjRB(Tzyv*KDLI9a=UU`4-FHjSUvdKa8!{&_0s_ z*dN9vlisuaY4}g08rhRZ`NC`b6BUgZ6#$efiT2)HWJ_Z6M>TqJVV_RvfPVAR#7Ux+ ztbCO2t&8B>WgYN+GeXRkM9;t5#0I6q=ihCjK@pxixrl-SnGVmLT*OwBI_Y*%Mw2{oNl6MCZ?0KUw2V% z(kk6uY>{NgH=B5f8b$bK6Ay8esMd~8Z+nVHMW2rf@%9v+v(RU){SvgNr-)P34DIPD z(j+l_H-(qTC8}Ysci0cKNa^rx6y9RBqPIJ=_x2WBO^WhvE%uoN=kKC{2uDbFZ$IHb zn_7b2of04t72&&60z{Ug(9B{MC<=&b8RifuYD|jq4icVos1Bfm_XvtSMOf-kQ9>m1 z3l$ZnWqa>%5j?jgU6gk_vCJfR3RJK=WXYz7+-O7ye?^@$lYrtRK^@?^PqA7Oylbw% zca$h7q;&8$nKbWc!RARCmDxc=iyB2ZBa0SM^JNa}Lq>pQxuS8IpRyQHr>GI$=Mf`( z7NDivOT~yNqBZu%Gbeh-h-9L(aJ{ubixC-;=n89`$Ww%GzKRn?itt)joG4f6jJ9y^ zji@4$d%ifan@HvtC+dhWzdO9+M1x9)`NfGQNt9oLa4W)co~3ujC5SLZm|ueEMs$kf z)xrdkE_HB4x7a&DO-U|6sOBBl#8EqGPcNP_j4u=?eXR%!pU8n6L_A0_F zW?e+RqFtF~-d#kaq8cK%Vp-1hA=})#h%iM}P?oNu8?fedlEfiJr!$WLH7Gg{x}NwkF=&^i_A8+4DSQsJf3cNl2`kKc(YwFcCv~(}>@OOX<%=P& zf-Y&1Om~0Q8{WyHgh(FyQ-sf5sFP($5m7|4EGZ&G5te0uC?Hx&Wl0s~im*3t6kCXv zu=je`dfzA-h~&r`B$|n2TMrTicVm8Q>~ClJw;m+Q6dleA23o7=Jm?0Ct%`mD-C$9p zsG*O4>on0I3BEEr%#kMC7L!k)@YX{_vLt(}zW%L;i5#W7rN=PGFi~Psc(=Q5e1o1*N|UBPD>k!;UQkxSH)dm$0# zJ`^m=RXUk_g(Q{xc11Gx8lo1T^+YW`FA>!;yx%QT823<1(99!C1QW?ECrhN76u`1X zKG9i@Poa$#8%!E*WQ#hJ;OSVwmY~m4d;aKRHeMu2qLDmaq!X=S?~J~^^?0#K(Z11h zTHhjOmti`X^Nn24`Zm$+UP+&gzPt4VQLd~AMTF(?46x}*z z3((&CF=jvBH1eo zMEy0?=OHQ?rCT6!ObTEN#4<^AFF=u~P=xma6p8IbwRE3Ou{cUp%J9yBVo~(4tnI@C zR_S+&ttR=hg`!^3hSZN+FBHutJ?pke*X9OPWTRO}^M%HD&PUn1BesDrm!!~S!L2vdantTK^A zw3NLS;%QqdvWd#<`=S5t6SJiy-3Nc4s3$tbPmWpay<9XYYBd(F9th7>n8PXFb?l$o z{UVX5mfp(qfJjri@neg<9}u~c9Cwc`W)F%&MO(&hb9+!!DLMp}4~gB1n#Y!TuMkHS zMPws2DjJbp%vK1`)iQT{H|PoxC&_Ua=pGSiMDketh{#jAm$NIiM?{HAhsWYa#0Da{ zr9L9In$*hs5m7^g+xuu^m8d6@$ACvgvm$KIHNyWq_tQFmeWSgxM8H%vY)`UL2J~ZT5t?pa|RS3DIE<)!l(@_N2&Ggl$$K3Ke0SRfrXe zu+1t&l_YvMXoaX&I&8D2MZF?yrKd%cvcy(;TKGIh^@EmJ1r#L-R+?7n&xk%mwKPwz z66vO;lU0cVW%+G3(lSNOL=}qM$DwYwqA;REk|4k1t*b->k(_%!E1HyL`><23H;N8x zv1D?eyh$Vx$vwj+QAe}}X7`I7n?!@6DdUigb(n6AeF;$qMU_O!igu0j@Yy7?6@5aw z#K&d2dZGqJP2)10n*>`gb**m39Q+jp-aHH_PEjQ2Hj7k6eL%NaWJ_WrZ*J}Lyr@z% z<>o-27et++MWEXvj180ndkE-75vJ&=o5Orw63HgT_-qroCUx=IAxfT*>0Z0Jug@D| zt)k;M4+Pq-sQKn}pWVX#q_k|lIn(DqB1e%Je_pQ^n-t+&{`QE(r=(@;@i+UtBhrX) zJNnT1j+jj(uPeSM))K8`!*b^PyeE<>Fx^U)om1koS9GY9^zq>PeLfOf73~?k%4few zej0Uh4)%%2B9hzRCt{Hz-2UpsS|YjqeJXY;!a3MMag<2T!43+aXDB~9P9G9+L^6j% zBAsX{t(6}V`I2bcJS0jKJ(1(f4vF20Ds!IoIV9YwsGMvg=njiiN%kE%FZdi5If~xT zc?D=Tk!+VEVj0mXek`X_J0dEiCA8qXK1akMl`i}iUv^YnP!vzp?b()g`N-#}$RLt$ zU^y;Un7X4r$Hf++r7(y7(&vOI+=%Jqwo)&a5v^hO-tvo2y_o$R>ejIJw`jg!iWNjF z+4fuPzNbWkBxOw(RuIP(fIs#P@ zwRqWgO}dlP5>_Kpz_Qt-G~Y8Kc(W|^iKGnQv!aipuaa)|Z4lWeO#mu1X`1gju|iQJ z`21FEF)7XWyx3<_hVMmj!K6EUzZag*%lsOX7W!Tii6)i#{va|G;j@U1B2SS^PozaA z4RbV#6((gkeiT)T0>SbpvD>6!j-N!GNg0lx#TiBKCq3-jB-jhGEclFOlkhjm>G(w? zDyr`KuG(}7QWW3wQQu~Gerf#eQ-sZJMmMp$!uEVg!Df+l;E_|0NRS`ZHX}9GN!J9vBdBWFjD^Xg#3OM} zP0mF*mt>J8EMu%vT1p!k{(|g(BYC~H-2`|vU-=&n;g(#iKCchoN|w^wEb>rFF%SN0 z4_2Qt)hSAQp1jGJu!;Y+JcG#+WlLS8|5qtqmeZP}HEf%Nxww+_A=!qcKgnQ{VW!kr z1clR0si}S$MKM;1HX8e{F)b}Tmh7dJd5xnOlo}gP;aMax_m+IEHnJ90KQep=*<0f= z2ENWjQr7qS8vRe@a($^}`@c%L?M`^!;{I9ckz?f@2SW9@l&kC^D znDk%`ze|2(c|NA_L6W!)YU~7rb@mlVgEfE@?DD_R{!BJf{#QSod}>Uee6{@7+gR%o zMwTcw7DeG66z*fjbB3)UYp1hRikBX)kH0=f_O)#JzZ*H$@>ur+vX`5vJbVh)s2xZs zCrF)PJZGIKCW&HXU98?@c=A8)hpqP4TmEx-tZC)eA$w4Ut=fMM%Ml`Tmu+PoMHuGH zXDZ5Yl9?bimSYK*QTQ>E&yaixq{d#SupE0wBEi%D#)4hJK`!BYY^uNbU9e5V?<%-mLqp^^^*w#^fFh#|eB{j$(F@ww9#TgVm4p z@FCeqKQjC&#e8mwmod^t##>`#`1+Qymc$yyvT01Fvc^YE$M{Ylb=DUod{>a<2$EL+ zb1X4d5C2@FLs=RTt{mw$?)~q>}9#1MA^$}Ok05o1M<0W+Sr{+JkKD5UYgl74 zFS&im@V~XunA{)Av@-l()5@*5r3_MwvSpjKhOchp*KYf=Wv*@`oLR%usE%^$LvK1; z2{8t3iGsF7o7xhsHXF#M^18Gb58qrRX`P$NlFONcERR+Dz-&ylnq(!(=Sa#ugWOlh zy#dahH1+~%Ww_?Qgmw18U&a{hV~RfrQe$!sCjIijMi<{TKgd0m4C6T|Xa5{8ZE&x0 zt))C3S&vQEhyO0-@8YdKrOox0*V|x?G$eLT)gH1?>a1!UTP@4=d*Y#*z%YNbzkhA6|IQNGe%hOPErl2*=P zu0MymNLoBY;mjJA-mJB_zAjCaR$5AF&DR>f-tu~TtBp17#<|$GwKTiHcsRHHn;5)W zsME-7vDpQd*T&RZV$dfi&zedlV`M8y*+_ZuJJ3=dP5yTt{{O{1T(+&813Rg;rIayp zv`8Bn_97c=ywu98G%}S{O3Ulz-(9KuH)oV`i;(Alcr4Send@TwU!9H0Qdy5X)+5N( z@L!#cPP5cn*2P-Kf4??yeLMVJ%#8oh9Oc%8Urpjno_$|0Og?Jf_2Olfu@rS;PO{QeK0VdC9RV z_kQvkK5j=E`{%U}c~&mBVi`u+GWM{wuf0myW5LxJxw3<6mvR-U#ZvZBip5fv?cdv9 zZ#mxL?KTR_n#$`=az#?Ev|7W~x?HUtXIH~5HO2K)jZFp5I=kJHmn^xI*Qb&(ID6rA zb>*)-OPhJu`LvEkbzPKJlrUavxl;NMFv58WWA_& zzJ##G&QpwaWUeU2UXaHT8J4md;x$^S(b;|o8>)A3zoAh~OMe~z8%x(a(J}y}oHcRQ z@lFk5A|dA5u&k+CWu|?I^@`l}*XUj*&sH1R!t%TukHs33;j3+UZSTl!N^VE8HRM)+ zYgL>bCjTd?oYwuD+&i6zc%3zp7Q=9^u@F_L&R|=P%YS!G_@6Chzeqna z{O_+1qh-rEjtt8+DJkXb`l|fzTtk*KsGd|)8UDL=P9YoF&Vv`~%no-7xWNzq_k@rq zb7!sK=LJ7s_ys^H1b%&(H%M=Y^JN(?R)|sWU8`vP`!-ugb zo({j!5H|+=je)ddAmteFHxB%bgRgsyXBqr9mdYox8`&iIKaZ8eFO^ScReT2gWO{~uwg+8UOnJqG`;h2J{(J;jQ&ry;MWA+M()ucsleXCbd= zS-G}}m1*!5YzE)A)?S2izsQpLHddqUVEf=#r|kis@4*kg0nI)FzaPV|4t@vV2j524 zKZXAf!tXGotq1@0;QwFf$KvF>NXG17FlH@p&6G%=YIfrC1NGB@=xt}d3xsu}7 zk*p-SndB=Z-ypdMr|Tuh807M zHt|#N;63pvzjN%8UjW+!K99Hd(z{MP?R9`X3o!@SfQgtk3SK;Rj{Ovf;oOP8`GxEE z2Ex}r_054LJV1XZ@P3fTNnQ**0yb+Wa{p)@pX}(Yzuu#jf4GkCb2y;AG!fe;wMT&e z0d3brPul_QvdE_Z{eefVcM@N^&Gf z{1)91YK?Ge&tF*Fq#6DrDdra%55LfOa4>ui1h&j3{|Tg>rn`r2_n)S3p7f^w937uu znxo&+qgl*>e49lv$hUoq^}}u4^-{fQQhva4UCYC_iU#M+3|Og0=Rpf=-Fw^-fIf>M zrhneszAN=*;aO0}g1qGrGe7U)fMO{5*Lo$xr*JE&ryRU2FEkKSeHmD(zXsmW=3-z9 z^(L0QS)|aH=u;SeWj=-Bcj!|Xeq%m`{G>4arhE#+Z^@@H{DyoA!*9o@kpC2Dy}l5} zZ^WlC{2F`;!>_=nF#P&^3d66yr!f55`)0_?$wtb2K?YEGxPdXFjY@s^e z;1zxT8=)QDr zWK4N3Xq>*P%ZouHp{BJ#2egS(J`Qs5nNto14dJ5_j|Zj5e&qN>@DS>2lt)+!?=j{_ zuv{=DG!REcdvBCS*f`McXM4!fOD~<$G1y_u_6fIp8P81V5*%PuPw5prj<<&q9&Q|( zk{ldvd;xMC54p9NP2devB5ctHmS+No41zlwSjUy%4c-&Wv6YVTj488%CqSv@1y}0L zQ_ky^x_#<-=-Gu6cYLE|4tpm^h znfkWx5aW}n9zLCo&!-M^9MEE5%uL{aO#Ku};+`KGGJ&_v$8a=-yOHcqF+(YwN#Ps{ z&&-bi`$ZH}mLCV<**^V2HpFK*$3Y7?**IfkJ{+YC{L1V&1HVH%&cLtAjx+E(w-bz= z`NJF&j8Ta>ApzQ|E|*26{(ipZ+u8Uee?!O|@b-F03K!Exi8I_zE7(f)Z3?>y~$u$dOs6yl&g&m4H4lD+L5>c^E(o+oYV4BU>^8Mqx) zLQLDX<7m8<@@3OX+m6%myQG!W@|FDCX~panu&E7w#bDEYA?%nQ0MdK<{!p|z2r>}j zPqEDDTii~uJP4O^ly4ZTr>BSQF?K-sfL0r_E4Y-uH@&p&2L@_a@&Oaahkan+p1D-N zGX1FUF(b3f{IF9-{Oyawjv1-9-wQJL_VTdHM#1d`#$^M?;V;ylT;TTW0Qqc~L%etU z7LecE{%Y7S#;>Jd-7-zRoC@m#nn4e@LZTuE)%Js@-zE7sw$-<>0RER|?uE8{=p7Y`>1em0&rfeP{l{tjnS^-!W@G zg#R<^uJ)z+hqLYniT&cBxAwduY_lJ2|B8@36+HXt_HT&u9XGY#LopwKpY4$Lp4mH` zC`U&`Q(Z1|eDd}($0u%&fsGUP3^;$7z+L9tXdK{PbB@6F6+8#O92haD8n)|x5IzO% z`BlUzo;By&h|3~(PBGiV?waEkc>wkRa7+Zx%VFQ1Keb!r1io(0K-&bqZB9z$FJjM} z;gNeF?GeZYXC`~#O{0rpzcdhzu-t}EpK)8;xvxcXTm0Pp>>TeiHvlA#sB=7>!ne+C z7GAbhUEYm!@Vn=R2I8LZ!^i;JeRJy~&+#>L;av`({XX&+wr%dGaKy**{K9t3`X2gp z-`wD+Q|#E>k^B@pJ9ki2xNXeJqmtnpH1KE=_&1|@Go%W8XJeRFC0ra z!^CapnYdq=5j-|-o$dJr>0#?^+ZMbX*HeFUL4yA}W8ehbw|}{yF8CBXzX0pIVdj@{ zxGxHdN7*gX3!X&Y&>H>pi0?^9pK(x^GzfPo$^e_x9;4$s!&rJazS8C%_GtWO8*T+& zwx^5E>zi#jwkvHoXFJ7SEGmZhYKY&%ao)R!-Yv0*8C*SiIOV#K;d{>?q~yi?JlH7FSd4YU4}!(%b{_%k}fc$KvJdcGhr&ch>MZy3X1Y@RV9-t?o{gl{tofj=L_z zt1~v%f1vU(% z!O=r7@1emvGdbp)#6O1|cR~#0!ZF`!j``Mb^s|>^?)y0UspIJ95Jx}tWPg(E&yals z*58IEo8ry?6;HsP7Q0Zn`%)_wWy(5?4?@lqgvEaEe=sF zj#4e^sTL=x7H6my4OEK@REtYg3;4n&ls`kq@@K&}H0>-~$MWaE*8uD+Pw!{5vwYGP zkajj{3rSm~W9=5{Si4PRvxRK7l1-hCE#_%-a&d>Z$KDGv5u}}^8<D%^>%R8(rPmJ~0Mlow&`_&MpaT zfksN(M7hV=&}X8p3v59Jwm-pgwk^yJwj*0D$O_wGkX5#mAUD~*2f4*&v~p)#ZIK|i z+Y&+Uv<(Eg+m-{e+BOYjjcpOgy|(*6?z621S!b&RdC0a6VhqhXdFB*?w?-$6Fmb6e}|f<3=Av@m?<6j~T8;fW4= zRcr9(_y%M*Mzz@NM81+Uj2ExMSPX z6tme${+;CC73C6=?cFfsrzcE^9O#4EcS)WmnHzY8AM`H)=^wBpu($o= z*mncb<}}IVAkY9_0&3KpsXR8 zIts&QNakf>*cgqnYz)c{V^LORQ_MJ&#(0V$+2Ixp*N{xU?F!%6F7-By$))fa8J=*3 zH@3^0fbkU+K1tG;h%sf8$bQNdJ}IIC=F8E#c`_a$E-`l^de^38@{@MQd{&W53 z`!Dn_@n7oyfd5MWHU3ZezwBS_|DOLo|HT380$vDsHNX+*9@siCAn=pG!-2;GzYhE< zkOet{S_Sz81qAgD8XS}!baPN{P=3(tpoKvX1g#EwJg72gd(fLf)j?;1z6)v&(t_>5 zZGuCC zQukFKapKQCa?dzc@LVJe|3L6K<4@Eo{u_ag;8Zu4@Ol*JsD(CBW_gQCYo zkB^=hogaO7bXoMe=!)o#(Qib57JV+-9^)I+Hl|BV|CpsQJ7f06d>->-Omj?|*s$16 zvAtu{Vn@Vg#*T}f5IZBbG`2kUrP%jlKZ`vRdpY*kSR>9OE-WrCu20;MxZC0;$IXnJ z7q>93G;V3!196YUt&Mv*?!CB=;ts@p7I!YLDNc*`j1Q0R6rU15F@9G3-SPLvuaB>a ze<^-f{73O85*{rHFy+>#?w6 z5yx7?I)xAG2G`ne0L$*o57sRFSua>0=+6RKG7Ew$^1*BsmGr&MR+bkF)V`7L^0*6}PY|$Z0dXjXe*!ya1~r zZ?Zi2JpB}yFXzMh#7uZ&>MZs?n+r4NJJ^S;knLyl*e6hePvLC!AiI+t0q>u|D#;19 z3O;SS8s^ZCv9H*AIDTz_HHjzSnsNoKNmRm->}i-yKLf|RXJP$eBm0p($C}wD_6Ow7 z_=}A5t<1q+VNO^j@!~s}KYtC5Y_GGn{7n|d53zRqFdPAounzn)){!4&5&Rg7;m27V zKf&U8Jxk=D!`%D})|Y1G|ZT3oAh9*+_l?j=>k% z7=D?JMHVN?09@B+@?*>wH~yB$VVf=^o*Vf%fzfc(sN8^|-h zJ3)T$`yY@}`;%`CgopZ}%x`WXZ3FT;$6 z2i;(-Uq_4|L~;blu^sWf`?r#OzvChZ%M#udfqs@oR6~sPzc#Y1V9eTU7o#RX%x_WH zGPY=xGDpwosSxiMJp-gndsoD35MCOw8|2!^Lm*E?qyM(?C}ZL=ZQpn-$qJ~9B~U!s_XE*O^fBf5LQDeU*H zfpgH} z%F@bm=8eL-$kLt*_3_3%KT5fGm3uRLW+KG+Wum3r-^OHOjvs~M{_0%lc+ftQiCga2 zjwrWf&VU$sG?A?>k15+SANtF9Ykz%`xf*N^kvtc=4#Iv}=rf39Xcp#cEoYz6(XC-C zBY9(A3{NCEo8-34eh?EKhPCcL0Hth!iK9~?ep}{fQ+v;7^!(fy+;*-Xr8378*{GE@ zk}-anlYJO_U_8nylK&xjX#6yYIYZ%#B;n5;t z=vjzq)hoakzZs+k zvr++bRrr1u#7xp~zB&;khncDiXk9_t*<`q8;mM|e)L{1NfS7rj6Jq9rtQg?M+6 zp3EuSKVP4w`;=Mq^T{{Bjz^))Q76vKc9vPvm3MJw&L+=aW=`j1}a9+?K!Ua$+&SsFD1trp829I(MoNs6_TOSPa zE;a<@-EERua+(9-FW_85gSCix5c3sC4bCPOK==$ujeQMg9vsdsP@ZE8A*O-kMW`8Pm*9*@ zW8ahf5zdS_`-x-|+|8x2pFwgs=eQTbzmxnE&Y0l5jxUFJ7m{xL0f=!W*@{01@$Mu& z`NI(JLDK90q3&Ja3*)h(f z)zc$2>ggVJ_edHDOG|={9pDF9;1_ZeE`fvu7TCZBHn6}2f*nF~3CjXEn+GA;z$RJN zo6RoSyf^p%Kd0)e`o8|=p}{0sjH>Ia=c!Yt&Z{1i`7xyTBh11J_ZGxofDm4k%-ay& zmicjnw`YC=;T@TuMDAUgcOZTzLQqTQorn)fcqH>K#GlCg4ANhYFl(O7ya(|gM3^<@ z%+DkKip={EuS!_YydNnIgjusltI3>_@O0)Ekg|j@W6r{g%9=A0E@yrbDX*09hhbG^ z&8rY*%s+=^1xi4O+0T3&@z+RrA@d2OJeBzrQho$s#{6jJ(}+KfFoRw3&m#V23E!Ie z98%sU;X5-+imhjz~FCgV-Bz#Zi*OC6S2yv1%^F_pe4q?W;FY_hD z-z(w2%6u6q??;$5pUZp&;WM!MGT2Y~O~gNsFk^lVc3;+fLBd~$?U%tm3&Y=l{Rirj z@Jp}(GuU}y_#a>kX0ac|@GGzfGuVsyL&U$9`4-~;pM?K0^G8VeO$mPs=cO{{w-IKs zU-NB*-+-l^R z_egksb}Q0fD&gMjHl*Jm;hot_k$wll4EDNqAbyvG_h&Ch$^!^N3E3+Uz9xGm!cO)o zg#RLYHNqdw?n3zb>@^7Akll^&r?b}~{F&??gg=|T9^rekH=v!LLkK>Qy%FJuvNt3A zH`!Z|{)-5+=GpA62)~fM9pS&v-iZ*WZxH^6?7axTlD!`#zlsoe&OV6n>)D48ej{5z z`tM8lpR+?q`IdzLB|C!nf6E?3_&>5mg#R=92*U4V#}NK`b^_u5${t48pPNPtmm|!Y z7v+v1{Jz{#gxBOAM>vps0^#o5lL)WP%_6)GXAZLFCAl)fJ-G_P>vP8u-jJ&z{QlfY zgg53E5Z;t)AiOzu3hm#LYau=;;cRXR@gK^aL0HNyBRrOS6~c1v)d-)?y$0cr=FTB} zeeMFnH{@Q2@Qt}2K|62BJ&pLkl<*z7*CYPH+#8YpuO<99xi=x@!xH{d?#Gb+F$w=& z?k!0FxP+g|y$$LAkA$De{W#J;jWA<=87Bka-Ieg!+)pCqS0wz^+&hr|d4w7B#oRj) z|9=r?%$IWSLi{%*{P($^LCTjA;x)9~dl3H`!mRo2+|MKYo!tA7^1BlLUhe%!`8q;S ze(r;a|B-|*?D+-6uk86S!WZ@YBEqYBK8kQx&o80mH9a3k{QD#v==lUvc1w6&&!>=n zEka21o=+owvxIl{d=@EpA%ryV`5fZ+NceEivq*VJ!bf^OkMvQ5Su@u21;ob@;&x5X zuOmFt^F^dQiV!ll=Szq`h7d9rXH6h;CH$eDuOMYs!bZ>65O4MTCc;J%5AnS9<;qxu2Kt*L(gR zDZhpgv(}S=KKL65!L@pFi2s&^zthu;l;1^&+3DGY@b`K)BjpAU+;s6ml0;M zbNUeC6@*#5FJC~s(L02AUBch!9YM;M5JDpK9z^&%y+wq-*ZT<4zkx7o{!{N5;(v%R zYrfe#f$&?shY|kg-f5)&5klx2y+;uL?+9_DzL$FXU-v$al)pg;-*Ns4gxUO)2y^*a zguVF^!cF-y!oGY3;pY5tgxm5}gqP+|BD^fWfN)2?f$&B7QwXohw-CNKzl8AW{27Eh z^ULUEmxR~mUxk$25?+^oHPT;#5Iima8pL0U5O2@r&mn#TLTD-Z3y9y25IS)Fb%@`G z5PEO^M-YDiA@tt-(+D5VzaHUG{*4HW`8Of_XZasPIF^44!twmu5KiQO9N|>{ClF5O ze-hzr{v8NU=HH3%O#WSH^DIKFqx{bxehwj4Q2srLUqF~OPvw6e@uv}jPv+l;@c+uc zAK_2uKZx{qAp~d3{{q6#Ua|2V>D^PfQYEBQ|${Cxh? zsQar3A&K&zMf}$gg7Wj9L;MdAf?wsIMfhLypGV4b2r+~CFChFM`Cmu)zw%#1_`maC zLTEO98DVDAR}k*o^fiR{Zu(7x_ig$u>=fUW$-!zG%=9AMm*FnKZJEso@5pRLcvpsZ z9PY_nitxS+?>an?xg6okGB_^;uk@9$uO34SJI%|pSHVK~=e=7Ip6%^L_{!c*2!FVD zGs4roIfR{F-f%eIdnv-#_VT8~zv#Uj;Zwa=Ktq3f@0IYj@88TD3Ab(TMR>>NO$hJW zycyv=o3|poZ!_;LJh1svgfH97`wI_mz8vAc%{l1$Q=6~EzRKIT)V6%o{M45Emam(a zTyh2c_us$m2827e?Lzo{+pa-)?Y7+rU$X5wgfHE;2jSjr*CTxKwyP1|wCzTOgWGOK zxNjSF&CPAwZb5k0wp$V2vyFEX4xr?7<`CL^&ipg9`J5R?o6ng^wD}x7CwmaipiTJe z(ff1eF|_%d`2n=~oOwCge9rtJ+I-IZ5ZZjs97CJmF~7I%J3YJRfBS`(+_3)!llfw{ z^3sgSX1|nOz^}=CIornXhvs2HWqUeEfc^!O9l!7&`BBIi+=pO3Qg^V9s7L8yaoF)@5T<$yD{VM#-7Z(u?zG*Sa%;V{}!|VOZfLm^9k5ke~jIm|AHNx z@4%M&4iNJ91pk4t#@te^@-kCv9KWMpX%EiTYNl9NT&&dRD$OW0N+|AMs-5&-6N~L? zqkgDVpQ{C>hZ@a_S!k6T&06)CnO<(SD+^}g*efdKwsCc*PgZJ`cB5|gFU`+an$`O8 zuAIVLW4zLK$tM0eS!$LRDsA*ysJE&^jas8QQ)w<#>!n&$W2C+WBO2L-cDq?Uw$!e) zd}%XUIbErZl@=G#_ej0nT#iP2q+P9PwzS)_Lm0$Y4P(HFTc$W#ZM99&Cz&Fg~~nPY?v&=8^@4Gs}w=GgCR+ zKH98eZX!qyRD))fAO?#QX1d+1lom{JxY}B5v;@Ap=RxOu^@{zOUicp&Y z4Bw+h1x`46mbNspkk)FP%*=m`O;FY9eqzPv^^y9vD7|+8MWv&Oq#5gPcAJE zSN+7zRBGS~(Fmr2z)IV#cl{cwRnd%zlU}sqOrcgSwWcbV-zuni*=GQS!f`-#^VQ>8 zZn&{fs@8oOOkcIE1(up6t_G~Qg+;7=uCg%0*GcOu+3xVfSXkLSwonVdePfA&J_EA| zt_GGs;0YT@l)wd_)5Ea-Qta%!pCtjvLVg1EuD?eEcM2?D2S#z3zi$5wk7KpY1lbE%`8?`a79LYM)0 zk!xKzP@#FewR&+WQJiU3*(9KmY9pshwIv}eS;Z08w|pKDV$p*(9OF-6#)%TzM50}Y z833n@tXQ9KSV+f8^%C)*!?b89E-co}qX4TS+?06^S}f+00WJ^JN*Jvr!Ko!I;)TlK zG)7gbRbOdIG5X|62^$ftJKAE7bO>S%iOD3s9dQ{8q?-sg2R51G6cz-=x=?CUJlE_p zCnNHyg=3I35XfXz@f^pn;;F?}P0Zguv`17KatWgT&XV?YPDGA zaHU*raTUvij&Xh1d`Xxp)sI(Pf{ukSUM@`?Guf;72yT$yQ;W}>dKg^)G+GPLZe-o zGbg}`y20g=E>U0%#wxji9KlLXfPl@ zX-sst=!-I1)2GWPDhnkrt~*{~ifUF&iMbMRn?!OXvS`(ym@6;*Dkfe%t2b5}`;-*s zuXTM9E2P=3W<@g<*Xk-wpxJgjR%*6Rlxq8zrz-Q-N{SbT3Mf3Cpanybi=Lt;V=(B)k;OUi zP*JYChH_%5J=Zu>PeE21?2sr^l~$#_{^CO?C~D?n6>3(B%38F{MP*L309&vWPgk3b z`T}@z7ylWhJyxo9rH@z6jDjn7r2}zg@YrHEi-RDXYbiF#8r78^a$QDKuRMhIn zyV94-uyNHcHzNy+ROp?$Nz+&y4kaRndBL~UrqHDD?t`_)u@cRgIG|3Q5kCi)J~Zr_ zO0Sf%jpHa0_8RcKacBa*`$R_KGod~jdMzgEA+FbssyvdhAK^UUqFpGX*<^hbh9LG3Wdlfsva(L zpi#}$=`kyzI+hL*DP18vK);qLEVUbxjYUbq<#)gN? zIR3@jG=d5<+|Wf~j#t{V)L0Cdmqz5P0D3$P-l&t;GUeH(2wx@O>FO&hiKMa8*`X3l zNxDh~#k4#?FC7cA3&PMk(WuQyKmLn(F=`_V-o%#?aO&YT*1dH0J77$(v58|BF z!H2-4ni_{IuT^M?`=(N8`Ti&BiVus8$)@#-4V|c9s#JjhN+a7$`nMKt%XYpnTN72@ zEX>x4$%WZ=G}?vP3aw=)Z5L)wU=S8Olq*%8b+Ry9CXLRac9TXL9a#sL;JT9pDm0c3 zJ?t?wX`6x~3swTk;gJJ{Bcn63`;QzrFfuheUHpL&MP{SbT9#QEl^F3I%rcQ2e9C-9 z*0fAk^u;`B!<)r2MQqk5u@w0P3|z2)HjG)BHfYBsfnudR)}z|wZ9&`h1q#$d9yr(?ATJPy&pE=SxkBs=!yxD!3ix4NJx9t%WL#Z|@si>xAWD5XNzzga3lQ1lakeS{ZCwb0VsKU|M;C5b zkKfvKJRcT~@EBJeobI7=UXIR;USz=a~AEDb}l`IB+E*;~3n=K{tX+XmO3&=^$BB)9MMHKvYXD zs1TLK5?o#uxk$vPLe#=XE8%rnn4JrUCxdmZF~`L%rhs=#BOv35Yy>VQ=zMYB{TF9b zAPbN|NWfa+*!RP?UHAm)z>y1^PfmN+togb!Wznoe@+F>vsd7|kqa>Oj6==228fN$} zp*QF^O0m-tlQc>jAv{Lxq!^XZ;%Wm1qKOfpI1?6;)jBq)Y<5${r(<-$+ zL<)nj8X$q&D-%m?s*{W=oliDeY8}vX+7blKl$rorAhuD^GK@;@RRPp9++CSzNOjB( z_fWvDz>{jOjIBkkR+*hO`{DIG(Kf@?1#^TFgL`uovmcuZ6lKt@u}gBOItOo#=sWQ7 zpJ+Cgj-NmgDkf84a0iP2W+4NF z&{VK|uv3TlF|_OAaD%z+IU&?zFi5asSdf#4X|mNggZ_(o`=e%<=f9X2srkyAf=}jx zeuI8|tGazU-HGzAPn9{Qo^Z13{+(w@Z zjnmi^lAnTYsU>1c=umr(AUg=#RCg}v_7~JRb&Xv|x*NI|A1JiW>cUJznwn{dsZDov zl?Jmw0t>FSgeh~aXb~%FylvAO40cbkks?@0D@8+oP=F>DRxAAC81; zHJ8$IN$!Ax&%heAiCDMZm>0TPfM>Z1@>I=G2qm6`5yTUU@lUn_bs-X0F3xm-;P$Aa z{A3!-jR7bywx~?_Ee^PfsJqjRrDnO}a5-Ep9j`+^RLgMh*bVp*`o2US9put=A5>Ts zLP13griIyspmzs-63P%FsJKzfguc6TqOm)bWvxBJ0yZi?2f)^_Jz1Xi9YU z-wQk*Cn#z{fN7M}l%_ai>N!K9R-_e#ol94-@x_3p7KpPCt|~r&mv*U!_G)NG#d)#N zqKK-ruvv>!Cx{P~YBh>;vmY)zI6GmBOHAem!eCC4@T&>(#bEz3G=}L)<>UmklPWY1 zL=m*r(c@M?a5!X8&xzn{gPa$s=p<_>jd4DQN(zFFOQSZf{qw_i!6>vZX#Nn@oXF^- z&>|}*b|9AvORUEz0BAnI=f=ck}kmf^w2 zc`~TU=!ou0ql)s;QnOA47@p)RSR~QMU1m%kipXIl^GKyxuheLe;5Y$%C}y|>H3&Kq z9BL;3x7{7bvL*x=3vk{vaDunYk)`q?H7iVVtnh8-Kzq@Q<6mKEt_q-7XLx1knpS$$uZm!J=)-=6goZbk(M11rSMKA-xV`-wHTD{$pZ4JwoaGb<@ z#HBgiID&MAQ%%+0cnZ7Jlu0<^g${yG=E}IDO#kJ(9Mp3^z}VcPJ^aIpHY)U~M}mrz zSoC@>$@d#2v7q)HC3$078^e;Yt`H2rDW|90(A>8`>OP`|gkfQ~gJXnJuHa~Au7P0K zevozy39zivqeLTZayW7_OJ-i7wdx}^kt;YJvBTe#F#<1^)*r}z; z5-cCfPt{zoc&Br(#BC9fb$zLXZ8CH%q=9;88qJf3Sy#3QG*!TZq_^Zlh~e3A8$B}f z;WzW)sijuWlV!AmmKK$QQj%?H$`i2zhz1mkzHNSWVQC>svt?pwEGNUnnKSiyDSx9C z<&#*-9(S8=FIxc~OJE85a;jyFm_0^XR(EP)?iKLcvC#es7>IT2Qtza`3+sGwNphu$ zVfv16sAGx63(xdshP&@kKV!n;U55ZC} zhe|cj)Uu{Tk)u?lv;wq>6CxVMfqDMpT7mz8%h9?aHHI91=YQ zb3|(M#Hf5Qhdh*$SacdzizToGg(?J?J8#M|i6oYy} zEb*=C2*b9$hNhiD35-SiG~oucF-p4RXdtT^Uf_aZ| zC}$}FY#W;ZlBQ8P#3A3TjZJ+y?i{rnOCVJQ`LR4=B8D2yBBdM-U5-`3s6oYTY(UDm zD4wZaI%1H5B*Zo@z|qN3pm)8afxP>CNTpgfMfMhQIGQkt8iYYS(hqGTv0oIC~3Q13onS-s4v4Md0U z91dj;vEEN$qYZ08H^*;lMmXl_Ip`I7fx$y1Gc8`Om4W4G)+l1fvqq_j`l@3p#BVil zBDnCO00u0_vM4_S*nl`QDrfw8SiLkS&0rEBMl7f5LIae5QY(=vws^IC0Kx?8R2?Ah zLwua>L%mJ57-?1fO!j-MD%z(#6kzQlY{WqsvL!Go**37J5`hsom`CcIwK)tm!An8a zZiXdC5lBU*aT4;0&LJCzb!215v67RB24>>qh)%KRz%;BzwQg7sn-188VvPPEoU{$uB+slgXj zHi#B8F+Xn(VDGpF83W1X)=zIgSf`$)HaX~TIS@-m(AzZKZS)ATQ^RfU%A7-p=#P-3u|xq%{3?PL zep1zrK7y$ZaC5NI)}CP=mdN-y633WaS_C9e4A9ggU@tIQtb?;Y+TaZXxx!Mi6AEb>_!6+f|!3oo{DPHnLz?OE|9R8nklImT1iT0BJ>jVDRlE-BG)ywPGSY!K3u zhyHxcSVP!b06U0yc3cR?c#+d1XHHZxs`zAy7*TJy6&;p6ONIy~o337U`yr4R9DoL& zfB_Nh2#7<^fNVog##3G6mH*f!hI zo-85Er6tY_EVeD)g~KgQPKz7@;3P{#0`=&@kyu~G*2z*E_X@B_M(ze=mLxJ!m%DKI z7OIwoU&EUG%FsR&j;s2)0*V)d*i zv)~1?^rI6=uMn5K*Guua*aR-SZ;cQK;;v6Nx&j!JQzHk8kC~CtvDuMFN5*F)Ha0Rn zT{t)*@yV%)$&sm6#85##3NtfPv!fFS z4~|S3iO&?#$4p^tQa?x0_o&S|G&NEf);QigC=|yvUK|E=JmM(zk4%qDjTgp7^lNCe zFg>l&v5}cW6Sn$+;;1b!S{%1AU+K}p=#dd&8aUN6Z%^&pDCdp$s_wc&PS;eN^3F+1 zOHY=EPT~xhWR)O`lPEo7N4>V7?gWXt?&Jf4lS(v7#HzA}(^@s#sk!*#KGI!x_-6Dw zsBg!aHkL3gsKFsx%TboKi@RS{nIr9p_KhC5)QsR@r{{+wa(7Y-BvZwYfT4(1?=?Uz zOpOI6{h;gUH~AcRH!qx$b0NLR;}kd+0=7Y)8)gQ;FGx{;Oo2@RS|VTDn$27rM&;*{=Pf9gCkx%4l`cCo=bEh zQk2ee1=rZ=dtOu!z-^<;z0k507@A~yzNgXzA)chcPIv?05`c*kBjCANp|_PIP{g}0 ztMzCWn5$gU#aSp0J@^D1k-n`<$+}ma60V6X=4y#EMcgaSwVaaERl!+2w)t2Umv_(~ z9hIYV4(2#4v8oD3EXlP-6-)dDP2vReAbwko*I-8TtUZ#;9yi{S@S{$qMc!v;bZAlE zjz>?}i0dVp8#T95fkeZ0a4R+)%TI4SRzxJCW4fR^S~k!Fg?e!4YR+;BaE^((n+DzV z^Uvn!9LP?fPjs^|RjSHWobDWwh%Q=Pz-ikRu^d^Z3sopDbK~}sBks=GGi9Xfk(Dx8 zGdh&7ed5fTywSsY@f3T)-K}t_E^<)XeYaAs%MY%0D;`JV-CiezL={Iboek_WYW8}# z&l_C%E`87-bR1vBHwTYKRqnacHyPj_2i)Q;Op=Q~^iBG+XM(B=pgd*|CXX3xkfh zIDT-}!)38B93&OT4~<}0Bg3j(*hBpC8ira*6lyJdObd)ezI1LhE|Vpxjsz#>HQ(*a zOQw@|wt)&bIFuK>l;Ca%V!sH=iM@%0eIMP_=lx)6H&`7o-j^Wbxo4@n6JqUBB?>-K z4wg#W+0s_KPz{ZiikcNpXz#~ke`7rKYIr>C3=cOLeP98~7jAdY$-xtxq{7vAs#~^o zoMZ4GV*mJ0JokZaqLD;?WdRFE(5$hB_S+cNZDns`MHUsB_Z^8{Q(VMihOyiNUv8>$ zXG`eSI5BX!FuGH_QH66zI%& z9gCTw)Tk+kO!XR*k;AFTZ6?uVTs%?CC9}BbXS{d?HO;9%ddI8GQ;Ixy-ZHqVKLL*( zw(<~z>MDK1rDPACf!1(x7qHG(ntL#!i4DKE+S<|s z{4Y8e!kAk0$F%h6Fim#uF6Ze&<1%divV+mcmBOj>Uo6iuKE*nv+*@PZrNF*L)2h&1 zBW^DPV}X}do~aDx1Zt4G*mjU-7P<=Po(3udQ%(3?Rk^YsW@Ks##;@4SM+;NqF0M$T zGon-zk2m*WWQ1af#8O#SZiC39E*!7_q8z}%PazA&#WAi#0sZExzyp2(c;)F%=4)k&{ahf#PL)%!-sxq{WKUrIx`?u?_T%YGLY$Ix(OwT<(Ik7DzOyE!0ivR+z|W@H-I z9Y4w6O^)E#^ghD({ zL5j*+JwI}=(vB8F5l74Lrh+?KV#zjk>Cl_JiHme=6rPfEFz#B)N=*XBm9G&7U4xyj z)szyATPy1-z0w8Apkq?L+y-1@xa{4sm35Sq30OzD@CssDagSEL@fp7$yN(+E#$%ik z>>VCr)0)cmCQp!J%cvJn%xPODNTJ#ZJKJ3W9zQY)m1^WME?Ip=V;tI6;n6~Iw6K44 zM6-xW$T@c-kFFj)x6DUAnF*rt_6=8Y2wD3)VSHt5}eqFx|&TlLa#(CYzk zRb0%`Lo#gEu1CLN%S68M6TK7>eMnBDT{w*eO1|JrBomWhiiYG8mI*ofda<~Au z$@H{lbR6U$9#8_yqCTVglsULmo#S;K`NhdOytrH^>zg&IC1#pLP{Bd|#x!=zKka}>E@L7;FqV)leR7J(=fmKcUx5bh3@IP{*x9UaN! zh93LDRK*EoW#ULDj3iM+1QGNQ1GS3~qIt(ftN5IYxv#1ecN=799@-h-UeyUwMJo28 zyUe898l9@sFqy~bhe z6^AL9r-4%tmh;CDQ34TZwMCrD$yWYw58T>NKFVTe^etYhUsw^sMC>^D=75f`SUE(4cOO3TyOQR~hc!i7?vI(8;l#15<%8GC+#ffnV0dgox3 zrB!Q{n^oB$?9PlWs_yKWYCDA9${ly0f#>xaXTUu8VoYs$riuGRdTk5y;~N_qou-}) zu z)=He<)5y4?dN^0hvi1iwBed5$+IqCoj9Zb`Z@yVR8tPg;fYbzJv<@k8yIllESR(S zBZ=S)jWcp&7?6T~+PB|k7GPJyd28A@U77kC=Am|b5u=cM;FzT{y-xB$+LQ!?;mfv! zsRPHRUO5A?t_k3*I6|Zp8-E-~6-57FG{+JgZj5OIGT)$4-1Ol?6!y{}66oR)O-$0o z;iFdxrG|aBqNT4_fNrEf`07L?vaG-p^BBnB(Cow*tk{Z-OGhc+(vUN9VF{jq&CDOV z{os*d6>tl_fds?x1V~n%UoegNd8h@LNjhtI#!=P-rV`7h6g**oOW|0KkY)Du^cd?} zfQnXvbFNBbBAjX*>Mq->o7oa9JEH8yo`z{_HuM=%$rb{q$70>U`ZSR8nRdT$}2*1A^3D z#wjmM4;70fM7w!?v{Y@=1t`;`1UrexWbuLr?ltpR?onKF7Q>Y#Er(|mH)M&JN|Q4W zf+*I@*ajffIK^gTP*cQ~Wx>1dFa(KRQ-c$VVjKvUSvv;Rzw09`Wv>S*_d(53IP*jb zh(pI!H@LJKHNzrBY$o!RCPkN@3*j*=*@6pav~dP(a}Gp`9x}rdv zN8acGAB-OTm8CR;>wTgkV)zszgaf-W{ttopySK+N4SEPk4;aEH5q#>(v}X^Ir7_vm zgMSb*Bl0owMk)&MKB}h4%~Yh|J}Q`ZX?bE^E~K)*t}oVvd~ctC7gSf<{>I$0Jl^0G zZ>sl_$P1FZ!zogXA5@ztX7nvDD{jO(mHU=xnm+3TrG+Z)0P0;u(KMhmwi{sb@=?Gs zM(}98WxF42+|cU`v8H$W^ z9j7AP0aT_6X%oc~VG55;@K+2oNrf801*I(xS;p70H}>1m!DQty0_F@rq2N;oq_~il zxX`2stP_804-I*@2aE~Y---*#z_bSWe!&p5{Q$_3$3fno5`aX~i2PLsVUlP-mP;aux6jxO?`+B@ z3$bW-y!J2SZ&1l}5!K|md|XbXgIw`cjYBru0_^JTM7<*v$u?<)0Ad!X5JD7H=k4Fb zfVqi`FePYBlnUkYO}V28p3PU$H4br4*pjzYp4f>j#q143%?3VJ2_6Ft<4Dy!Z5s6+?d zz+kY}!Jm2a3z+1w81yMmK#3hC1D^|S;fX-TRXc+}0AuLp(I=iQ4)l0{I1^N<1-Sak zwQi)+0mdQdm(>u%TMnd4si2aM)v?NHh1rX0&Q$lS9M$awHywt6436t+uu1DWv#N0y z2|{X6Art#kNKgJ+mAk~HrXk*+(7$)b_9mvSflNaR=Mku^!B?R-E~Du*`uzwckCsz( z@&qDINLC<5^`a4Kb2VeMs>~pQEPbFO0N-l+38%#%o(rg#tBW|Re-u46&fsl-@N^z$ zLpyflcugoO6}0FRi&3Sn=J`&FJ)`chKN+R@!MZ$Jlz4RuB3cK7k?Nl{nuo5mADeLv zY`7Y1^g<+@#NrSqqu7L^O!@|qv5&d8GPun+2}5Dk0&i`avT%#Utq-tPY>cTc7U@mO zk?iYT9KR?g#82Vav1a8ocg$2-kr`r%$N3(o9F^CTnaq5y4x z?~3G8HA1)!RAo6yCh1o6hzjfOq=+kA__la~qEC*y1w$EJQOe7+uacnOSkp}>M>Hjx zC`-NQ4Lpxv3EGd$9JmLg<%+-S4qHT8hNflZ5jc%MhsOcK)qm1duqjDr3|tZ*V|XsO z^AmeYm2JvsfoS1JuzCP@8$5lc0kNP=Oq(`(y3ar`=&4ct^KQ;d$Gtznfr~``I#@4w zZ-Ot<0onA@D7RX!L+30B2 zk>cWV-DD{Tb6-5(<>DYY7p=DB(2i=d+zKXQ)HtRB4lbv>0Pwm@>Dqk=T#&XYl5H#lZ4zW9-mR1Ynnm0JR;d?A36~=9>#igIs1x57;t?49aR;&{=|owMGI&t1 zG9%BH9LRFqpQ3G;uNhBr$4coK!{Nt%ziSD3L6c6_!~+%qP)${Hm5%i~OY3FkB`;AF z?mK(ezJ2@dJXX2+R-~!)57X=-KUArK3R}j09;jAobE<&CYv3N=Qbz_g9Xt*LfJL3s zQsPmde?xT=^bKF7JpqKXG_~lgjmjgppPytggKE~WacZTQB5?o$6QTxy(&U%8$G#`l zz1(F01t^y7MC%8n2tAgjjdy%yvRZPKLuV!8J*_2_Q7T--N^A*hm8sF2Peatk7DO%P zL7!px%i2bOil$VUi#mnKCS^fJJP8cXpFhA-3I0qW3kG)-VtGmd@Zo?DN&7m2s0=iD znB&a#{7pdsecC1Fo@~!CaYM}2gw=0 zft{8v#R!qeXXIMdO0_a<(jzI_l2w<4=Lie&W~@uk>i=qz685OCru!3hw7j8aH_o^} zp5St#qUhGfDS$Y=Gy#3ri;j5;uEB$FcTK6N#Z4OnVvATN{z%Lc(XYz3Jh+A?8xXQ^ za?3BAY*s<^Uj5eK^djz+!mj0G=j=w>_XPxXm6!o!DR>mINy+r<#6KOO%dj)vzT#B&8Ry4GaBFZjhN4Pe_Rlu2K&A zqV8C`T~PBx!7SoGIOfe9LP!P!RRuN>rU%wg-Q0)20)7D719j{&)bRUCi62L5DN%Dk z$}FJf9CGp3%X^>1UkEp^T2Bv;qpu~@I)PSCqlE$V-b7E@79klhSm#J(zwBuV(9{qk z%uTV|ZkE~{2cd7G@63}0)PN0X;A@v(LZ+>S(7UuUYT}_elxMlH1l#Kx-<|^~Q2WhxOBFZX9(7fZLM6`!#5h z?KldUM+$pwW5(I?nlp7np{p$qr9!7|n=6vA2_?VgNz})^Erg@!8_Nh#aa;-)sg`*h z?|>Nr1#_(|AtbGl5(mtTg_U*Y@t@-Dj9`&;Tt^BipX2fn)zQLkV>*8_jSh)alJX#k zj7^sin-KCFMwKu=gl_B7WEtg@cy2<&>8&v5QR%v6%RXpsMSJ`3?{@sRPh$HF%MAg1 zI7kq}j4=;NA4CEtza}Lnk#`L7Dv0+Hl)+PvfQC$^j`GLM-T1F$?nLgL<}UPeFM7BG zx%Auh8t>LKm09x0HsV75Jg(#nKiW(;ltCz(}zR?eXPDr(2!OhRKGTx--^ ze%R`bV4=8Cs3CB2PZ~2+!0MPtr5t4`qZmcVQYieeZHOhQ;szosgTLj6emFYPhht+6 zP!)S4jm5F3H080aD^6HPAwwP_kY`z*w$3Cp zv>laXWL$A_q})-quX2H`jPjLeWllE;l#bLTIIRTT%gMCXiCk(@%KmhS05?|!$R93B zGgL%;H*B2UHn3s_1P>gqa*{Ctjk!+b6B{?<9}c+yaNz&6>23 z4yT(7k{0pr`q4Q|LT|3*Y@X@ju;xmY)++h^m`n~3PE#pTPOTg~O|lPR6pD2xB~&F+ z{!YF?t%EAD@Wrb**YilBG}o0!Sr1Nf1#>*7wW+1`!N7&7(7Sc)Ag2Nv!Z02CLcf=@ zUtMzK1MJt_xt?CTTDnzR;<_L_$7Obv>xL$g>jiyZ>ia1|0-A$IFpre;Twx9y%8`|M zgt%o5D)Gc684x@$LN93d!L)XqH1{ostp!l+<~Yc%+>FLCi1ts8qff3eQuCsO#4|NY z&I4ywm3=ih*rTfIocoJ314brR>BY5H0u(Ce)gb12ARLidyN6?PDnHkV>I9+jNS-i* z^s^YpQH(@cIG%_}v`tOwdu00F%C(-v9@?OZin~d3Y z19~PSRPVw(V$Qv{y-+tp4l4J0_wR^W~w>xjuRv%BBRWcaWX*r+AMI?3$Xm9?KE;&lFYPtfb zl$y&O4bVNnu_J9EjZu=i)m+t;rfMih%NCDd7VxK+FjlTVRZq%jvD*MtiVJ$X{8pGC zcVi~#T;V^OC1OxN`TUNW9x6QD0jNX`xm#U7`c0FRCNJSvL9gPM*oiCkW(PT7Sk}Z^ zn#TC49;qmylDcwBoWZcH0bQz@tGr9s$EYn;gDG~vay_%hQ>OBrB>xrO)OjN%bI7ut z-a|sZ(A1X?38s_Pm(-^&ShV#}3EgOVmG z1s%OXWX$HuK}?DMce5G8e>V%u$#h;nB}gO15D_|K>8iq7axk1b#|H>7PRU}Z9IzUg z6Y{Gnq3ciP`8pz&<=vE$?x<{$$KjeDrq&!^KfEesrcs-#+|}D}QL==U&S_xFG$PqP zdnfOp`s&KBjTcS;TPO<`;Y2&>>tWYcyo~ZhhQ4lIe_tqlDY0}~upy8hU4QK&=Gb#T znjq>U;Of>D>=qXKIkWzD*N15wA_I0+R=S=iqJAUH_j4(Fy}?f> zhq_gCH^oU}b!C#1s3}XI7IekJ`eAhNd(%&7>DA<)av9=9gikM3W?a!n93A~RQ?WNYUsHG5cjVih8ZiA2e4Zsb>Y>ZtZ71B z=}x=Vr{Q)?9jGB=Rxg?BlM)Fl{Ij5BqGn8 zbmY^>Uj_u6{?JlYrcHdVY_p>0=`r+7WGDe2v~{L)5SV{WE2 z*O7nP@}>xUp5h{||pYoncq)`HLX-3=q^x7H8G#rMSVl1xM9 zf%d|pJG^eL<@dM^&n_30sK^O5zB-H&h>i;N51Z@tTy;cI}c zR~|tg@kFf98{%aMsU=*p&P;HWP{DF1Hb_s7iRq>SWu@CffW6;&b{YlgO-)b_+s{TBihzVWm^j;4NpkzXmW!4%BhyWbSRqr5vG> z&w=1}hLok*smAFY=$nhrbUwY>FsMy8Bdw4kM(ugk68=dHAUBRp*SIOBd?vnms}{3! zeS602tb?SY2)f)ngYk;jVA}zVo8m>jE}sTk{b2@4J3`}^VrMO1mg_Hx%T&+L(hSZrZWWsjZ9ANA>_~mX4_l|iWiC}+F2w`5)ea2da{O|T&vf$vAr@B z=IC0j7i7J<6InVcuKRAkkJnN$TQ{!OF6TuL+wkm_xs}?xat>;l$~lwmx1d;X<6Abr zAL59}Q)mU>jDMsJZmE!0)Fm|yMq0_NpEuhab~+S(vMbMEB#3gya^NNpinl?w2;i;?bRw9?c@5Pq?J zcytypaYVubxHSc>L-;rl&ULfa#H@{aas!ox5wbg<{ilTNG>S^w_MqLwMJxhfjEmkM znpB0|?G=+2sYL0C98xah$Lt!>(-Q1K+avXje6J7^4$g73e`*WfamElvEm|r zCW@-C|G~RU0m4=MGXa6xVSFG3a>v?1glUYjc2%7QMMKEYU54o`Aqt zm>vZBeuR3l+7!CCqqEB<$*d>QusRYrXdXyN6KUP4>ARoG^10kXUM36mc1IJsblp+W zfi4If@R<8oJs+@l>z%rjO6Q4=nVKcdjo4InKJk2Xz8>}SVx~v;Zd5I!XOMy+1^DUJ z*9_IDa0QSdIn9JZFjc*}mlGJC+!>6u5w0RmzBhKw6Kg}0E;!>*hCQetgVNV}{@dn? z3{?bVBPJxOea{#;iahAbdf5(cHrIav% zWH)h5=X$J3n&n|%9;MWFc-)Q?$9p4s=7yHoN;O!Qnv&P3A4ot(SEN%HABgpL>6Qj5m zy0ckY&ki3>M)J<)U_4}6Wbv%;@s-mfIJ_lpAI_R_ymjqa1N2OI^0j7 zY^1T{RKK*95tp{+$lBxHK&zckuifn0z@<6=bf$SwM^z-+acOEwTzsyzR12V1qEr0~ zFjUr|;jRb%IJ8vPpy75dkO!;{v}#Nf;2yeBL(PNySB0KfqPguxro zj$)h!=miBghunD!oT2T!ZS9%uUMK}&m`5>d-d=xRg-GYe*9I$%ZE@WG9F)6^q|-(m zcyG1S-aTeK_S8GxjXO^E8`lP`8((hAN9)pRS{qw&ieG`bbl&n01x}jTxdKq@Fm975 za`ZX{>Q6Op?_YbIE7lbk zv@JEaPeV@PPxq*IooyxCFs0!bRB0nl!*jQDE^Rc5V~!~FKRKgZaw{9_U&pbY1tY!e zNrNuAbz@$&F<91%3nw^I-K>vntncI)WVAOVF`hPhDR~P^l2T~TrFoT;1L<3jE01eB@Xw z)rnzI4iPBdbS6A0OeF|M>+a8bM@Ba;Vl7^ih8d4_vpX$+1~WoANzrVIq?UAE?lGbx z)Y(aEQP$~0iW}d%?#8d1%P*`&x1I~6wRw@y?nrVta}E0+#eDcZI;Z=}_)5(0R>kO4 z(Ze&e|4120C2)NkT-=WQJiB0nG|#BIP}8cSL3NbHg>}+9yxy*p11DP37!&W1I(si< z7qmK>vOKATg=Y$N(}*T(IF5@!i@S|OJE$AkyXnY%d}B*K4LjTe2sT*Dg!+4_Fmj5Y z-Wd3F&a3-QkFlv+zWWq5`Rsr>C~LbYva5mP9@IPwm@;l>xI-Z3inNt%p4=FGJR*`j z5$-HS$NRzMMe4^1mrfwcRW%j3y&}%ZU8@nh>3sS515+8H7dGkJg{zrlGSk_{3~Cj$Ea1@8DO|_YUiPCV`!qPXt$EXgY!jgbw3m|-$bEHNo9E-r zRl2I(9pn+23!V}(o830Hxjh~4E zu8J>t-=@jo8II0hkc&_(IbPvJB;7Jx_u*M4y`z{EY9T|UF}Dno(zDsB9;-A7-K5+Z zQS#E$59BxM8RIet_fLvY$~jC8%ZSfEQZF zxo@)}K4U=t)))$KuJkK?=xN+&FX)U+kHh9UU}cxXi0efWuBA~y2mS&udeS4|b2vU8 z-x^9o8;2aeJH+WY0e;aIja#264fP-0ZgShbq+{w3-4GGQE02A!s~6s)Q!c4bvc##* zX*6mN(X+!zcN5`q=?5d3=t<|5VRM&Y^%6O!mP)Uuc%^jLs`jbJ%lOC#NvOMLOm@Pj zr_XRCZ4weY*NyW_;w8$J(L@qSBZzPzn^;ci7tp@X$LPUzsv-yIZQ`Z-=>H>DQi`i2H5&9!zdN`wn9-OK#f_0Oc=jLjT)0?`-Q7u9&d` zhy6!2E}yY|a7UVCy$CVHw$nJZ*>MEzk&Q+5uj!^uw&ac-nk)1iYW$jj*%mS`v!e)z z^!O~93dBn1D{gp7N?sDCbIeML1r#ojG_L1`1+5@1AtGE4z441^B3~Gm10Ji3iV;B^ zK~L5vujdrf{QUYq-k@mP(22`^V%kP}LRKk^V6QC=!y(cmK`QXd0*Cjlf4t#2T}tPS ze44}MV>YyZ_yWvY!af{c5;?J9ZW;$g3}F$z3eWja+cG(v#?HMO{}9J^9YQQs{m<-h zG52eByVy#K)($19@sZ|l^X-pk?5yhnILtQB< zc6Bo_G^xNLvH76&sUp+BVgGfjI3=M87j)c{#$_KekFxMxS6>+t{bSk}D1X{&&zZ7xGJIHI8~j*jo{}UmTPfS@mlol zW{hxhcA!4^Y# zYH~0D<@sUl83)fUrH}}ub#4rhFpaEDUNy-u$XS(ScLIPaDoLwPsv?#P4EhPxmz2$o14jRIyZ8s}3WytA9x;i>a1#tQn_ z>Yo8~v{kasfRJj6zyz&Nv+X{Nfc%JS-|VD*;E?4 zQWauyddAdo0SxuN%0ShDngjKxF@+rRjd+>$TCA=nXXQBNKm6kio@#tKzzF-f?s1M%pn; z8>z*=BBWk0<+JLW8$%j*F6l_3&cJc&xZJ$xK?OWbc(0CgJ#?g4cMeliau_0JSf8Fb z>Q3>8o@oJ5UN~)3`9688p6K^S)Lr{*Pbfr=j}vyUi_srQ!w>RgA=y9Yg{CBDL-i!; zAUx_oy@Pjr)L;xbqf!vLqyIxN@msp&iqJbN$==jJ7{Vw*gSOi-=cJ{RL<(8AXOkE- zh4fyuua$S^G=J?DxXn-bL~g)wIsWa8owZvSMlI#(ycgGf-(Onjyd@k4$vQcKX@8oC z$^|Fe`{>oVoIE+_7Mqf~y8=tAlZ(`EOLDSFkaiDXH`{h>kR(==h3j`ij1?NH-g8+w zpCQz~=|h4zGAVs(a#={e+jmO_PmiiDM|C1~*A)V`BGLO>%%$AK3wk}+U6TkV%b`M{ zY8DBLW>lP|J0_?-se_IVtrNfs$Qj~H#bphwoWh^WisGz0m5ws?tC(Ac5cBgvj8Y&` z%_BrqI9z?{xAS3k%oR_xsQyX%C$EfeP=(EKFl^AT*3qb0a<)YbK;L6g>&SQS^&Ss~ zd$~llo3s-C1s@>h>bUe@4$*Vn%6WtKk20C-JggqEdxJB+a9~_YSB66>zIXAPYpHwd z54n3LF*#np3?bTUdqt@oY{PE_B4smcQI=76&{()ENk|)iBtM*JU1qK~;IQ)}x_{eE zy>v^s&15o88t`Q41V-y5@6$O#p*kO$#Yy#q*JR_T@nN8EC0X&P&2eLnZUiP@Kke|4 z&^UGrDcWFK*bB@TH)_8X=0x-AeFD8#s`*8-$Dc~|BXswvE)D>)T`t{gu}1ym_-5&k zP(KT0hkK&OO$&kLs?Zg#tOy`3Zv@$@-TPI4tuPmzzLlX+pO(6i(et+O?u=R52pkj) z$`fdJ^9ZTGjgyWG&q0JF?CU!hHxFq`!+EUY5KxmN-j&7LOLWg)XDWkLp(X29RfXL# zhhAStsUg7t^*hwKp@U4-G_xbA44T=EOi1_G^isP*N|%lPMKLIa?ygODl{EZ1)dIazliuZz{kSnxEC8ab zl4PXUHResmUS+*FJQOesYIkyO)gDgv(1n#7smZ9MTeIxO!@{2)~6+-j>?em7MgHJsh0jrwYm$qh;gnuu=o@mxReTsTb%rAaK(8 z=tfozJJCH}>a?CLs2}r7{Uq@NUC9Y_fRaP0!bO{w>(Tk%SFysc;F=}Vr!7qgxH`?j zjf^E}pgC@n)`MGZC}UqMxY$*$P_J`+%Nqf@z7>0F1`5g9``Q=Ve|({Iag?h_T#gvM zKZJsm8Wm+fL&3J3i*QR$X@Gy4!tRq?&Bf_*xpacO4XM4P7uTMnxX?e3Il*%nv^c_& zx@Z&SHl%@3RwtKhNbBm=p|+_?iGwxr9F;agooT(QZAreYSl(Yxyw0v>gh@m#I))BC zy81)-kdfJOEf#`T_+WT%)iJP)*&rc?v*AfF=?Df+L6B%=O>jCAJZr|<>TJ7 z)pk)SOG57vL!K1sFVkWi zcAfp`{QO4HF#(473akRoX~?#m(%j9CDG=g&6sw^x#j?W#t863r_i7#$Uce_hxbi6y zW-Jqhn3;G!$A-yCy}!dlI`sE;JE~&r5VubVzdCiFS4RHojf^s#pvhZlwl<;U>)gf( zG-Y0d!%)aOx0$YSA@t6lkD$SBeS(sl43w;XrIU$dB>#tMH=XxveAuB%wUGmv>s8>e zIyzrTp6mICo0s(+J0}CD3P7$!9=i4sX1=LRx3jlV)q*2qaDA$^Muw5x|8(T7`!4RU z`49&3WTKX*I>=^tR*S4pby0gZanrC|b~BrgK=&Je5kz z5pSE@dGPMl-wjmZcrSjf$qLe)F@FyOz7dYFA|MY3zAdroeQyAveS@In8o3%#1Jccb-YbVlo_i4n9l1%zcp#l z4}=9tM{y@@+}je@P)O}zX*$_f?%Zv|Is}0}ANZZ5h$=Py~14(Lv%eO~)xA*X@$H5r=7{3o+)SGe^qh zMq~+)@8H?TN1P+NJ5SAXx+!=V&flbTOF%t%JoIPp4wt^$5z(cre+ij=`_V-sxr#A$ z(;PwxG6(wHaLDqyGz|HJ<${M>)+)ne0Ks2@#u5JT57?P|$r9sk8_rF<6zRun^2`VS zm%lbaQBLWgl+AW12e{*<4kn6Z9w6lS*1j5|PHFDtsb>_1)={0yw8QM`f7EB@YofX9 zDxe#ml*`rN|HuTXiu+CWnEB1gcFAp=%B!l(FlyK{FzYCNSfHkLZ#vH^Xc`h-Y0Epj zz2g8^f?e%()VKk!e!d~`aIgR6eD#5?`5=09-doRlavbicpPP>R@Ghi2OMtw@gDm%9 z)KmCx0{@Vk1IhGK4w*fnDiLQQoFYqJDaIVJ6F*~09g!!r$R3?j3WC4)5nKl|y<-v{ zWGGLb#eIL;ntJY3ROoqBHLU10<1*w4S9b=MXI)7oTtMgr_fxoZRMMNRx{z9^V;+o) ziL#KRm(lzqSvwsIIaXIxl@L88n%hKXmIHVi@C{aoy3+w!b$RS6>7(;)xEi zAgOXbJ8r2w0hUXMxD9fXWxt4Dd6Q5f{{nddF`WgZPpl42($f^DK&~>st11xTkK}rV z!;5{lC!pI)-Y0;$t*j0~npj$0VRJ&n>4yTBJct)ML3Mk|J(;QNR;k4~MN}n9i6;QcQQBDXM^U9X0 z7H-w4QH1*u;xg>+ zq_7*e^=8l~MWlIr8hvxkQS~7=AvYzy7}paF6pG}8Zrvo?h}#}&3t-*c+TAx-dG{+M z5iHe>z_NOqE5OD->6$+5@2wFSUQ*NjkMMGVUz*gSMnF!g9d>WxnHvvcQpmhHIXsI) zF9xSj|BRp7D|&s++(~tW#OST~NtC6tgyij)I`tk-x@?x;z7mGm8W#dfB}9{W2E6g8 z0wjbAWFcbbm=HW6=Av9d2i6m})>8k5`5b1!x49aO=KeG&*H_`#%>U9x-A)2IbG2xZl^rU%`6qkDd|6VHg*OSoPo-jXXUXJ$n znS1ST!Tt`*?`_DrSz>(B?&VlZ`|uy*Oy$?z^2PXwc^fhyDy5;?yPny18dgaR>z3PtNe>#T?=J|n4rvKbih;HvebbD^E*}e&pT}aI4 z`+CrT>A`=dcfjqm)}w8L6a3}{jG@hSK0WoG`<+t4SC;(G5~|A}T?au?zy!zY7D(0INHD_p(DK^>M2D zFyx2%MR5E3wqt(!0Ryv0p%-QdEJ>H3_s```F0+06_P&A4j?OuuWc&gcghGJ$04h4? zWM82;ldm{nPYc{Io}uN`UZ0BZ+q5uyq%>xuanZ9*Rho! zmR1mEGusuc-8}|Sp{362fcQoH`(ZYQ;s}2jpS!mW^!9h2-qqXJ*WY>LPBez!r?t(e zHx1`#B^?Si>C19O{AwhzfWI&a4E?7TIbe^DQB`y!?h$$i_m3nt&n+&A}Z zCjD(;u$93j47M@Y&fro8I~epcxSYWY7+k^Ng$%AlAn?4Iqehd`IzB*0=bjQAzf1A) zF8O$me!NFM-lre$BZl9_Kw|F^9KTCKjlZuai{-^C=SQW=`B8lA=zM@5_NTw|A;H0W zBOH8SN9Vm9Q^h4*R;?-i&~y1(-=1|O8n&uHdnFmb>d2zU%3rVGT( zNgG42APn!R*Bz#!nU)8R@ z+V`P{W?!@8Yg_J<)Q@WFM_K)=3_dDVzA7P7`#ZnS;NvXT-}xrvpVIipdkvDvH9+*w z^ck+TXZrh;%07#@kQ15iDU#GFDcE@y#3Kbe&uYRKq?z4O@)ul7yQL*G+4%x!b?45V z{hcoY{bgdE+AbZqBFx1o>D(>wdmjVg=K zHHad8+kqs?bxW}t>jk$zH`8YzZ6Cw`b-0gh!VEK=pF7U|5Rf9DVDKn6Lly(hBiZ~B zU|xx2dBSA?T4PlIZ!W7Rv#_15Sv<^82%4Z+Kt2#Yo)7vr0 z81r^QDbu#eU>px`=Ya4FhD#=pj zyw{-ry;APnUI-jiA^kkaVeIYglT086%`-)UHewe(($gW2!h*ZBXB71Y;zZN^j7?Vo z9;BcXfvyH_Ja!dGZp>dckSBp~AW9_Lm1536v*TO`>X8r^^YMuZz+`qXIYw8ESK$kb>~SN9@vioA9b#&AfPbI zJ9o-7V$p6EO8?gOUC0oGlF991yXW36IDfn1{Ov+2Z`~=Vrl{#ZHw-*qGLQphBSONq zsaE=(`zaZTEViFQd*{C+u>AoE7lZ9Td|C3LyFT~M-S+sCcw{uJ(fJb&SAypRC(lrG z1UiJH{F$Kdn+z|UC0^wR%vIq2BYfNJ^d2D>8bWG!aSxWZ7Sp{YN3&}W z>_va|gJ0o=EH=z%!t^PtwYudTUHEA#T3D3O;VGg{VM4Q5W`G=%4Rmz=T(H)E;bYt5 zYhjCmK}z4Qkh|f%Aa41oo9No(0;~G#ZcZ47TBOgtk6~%*Hn#Y?JeRNoHpMH|eQvj`&plMv z7gg~lsVtlGot^!MDH;0DcluxLqr3VK%Njr5+0pr{{==mGv%o*s9+%i*PSg3bSc3fF z1VMV7<+32xI7`Aq2pMqxwZdJW>OcRKPU%yq0$vIUOSW_u!iw!{{AP*7&-AJFW#Zo#Cl~KDxvWNooEoDRkoX2wOKmT6o?jxH05yH}c zo~)|>yy!6a5u_;dV}*|}fcDaV;gizSM!E=yTud6hBz%WpXE-i(!SRfUdX--sX42j4v-(*!ewB@@0hZIVLOPvi zfl@WoI?rO+fP;0Og(3<@2Ac2h{9XSkYT!HZgYr__kW?R#BvXp2VDbGI9$+Jz45)bqtI}YpLgUOrv4xVnD+ef`OWBok z?kUs&z))~>ZC?0L&t3>;Xw!#DG@Wl@!Dn(}>gD=meRaOYeynPEMjZ==sK?qb0 zWpXx||G&NSk8SI^?)W1m`8~-JExuWawURB8j)}|MW#kx*e>*Pk;&w z*#Jv3<}v^R1kl*M#bVHk+=fXWmXnE;^pSX?o$|W12p=*~(hyzXCHP5GDSZG1 zrchC6Lb{rJn&S!l;-Nt+62@T!X-DM_T{;=@u*<3Qoz^X)BpN$OjZFB04!aYlR-z{z zCUgs<%Lxg7-JIvOQ8zgf&>*mdg=}5rO%Q1wRRu?F43ApGF}q3>M$9Z>^sc2Hv+KKH zD=g1yBz1E}!>o)3Q}@fWzS#`3Rog)+#E=#KcSWi;gi^$-vcHrAO^zIvvpmq^Dv=Rl zaZ*@;r2Haa%bcfFxf4jp-pROuEYYrGy^8|*q5*qR#1M~{Ui9w9lE9pJ9*bgyoPC6M z?H=s)8gYQ}cmA7C{msd*eff?2xrL6mI`;nEAARrarOf-MUq7+))bCz@gtA({g$ug2obabdu z5-sWDiREq?6cIH0Q0p6URBg(}TNFBO35LWOA_Hq+Cs$0I(3c5&+*PusS_4CEWm>!@ zITiT^3BN&!wO>cfYu_`K%RDlABr{paPv#0m-ZB9Ac!1TZ=hc(Zz(H;{QnGCRv2pcg z9B`reSUBF8@xtjl{APiW3FQS&7z|-L>}n!sHqquYOUzZjT~%BhTJ8JQs7&=v0X44< zHW}_VBgew>3A@f2P$xuE-&#SntkHwL7XDEYn8D-@EcQs z`Ur-I<1325$Wv~Ln9F(@9)WrlMHveRS5 z%>FzHh3Wmpd?Aya7|u-Pik7}DJCmO-E*YvFG4Cs%u#$T+L)pRz6;}s-G{^2&gZXWU zI4)6x#F2PSCz|~xiTbWI(hV#JU>$yzZ#d~U2PyE*vqq2{8rxxl;EC(c1>jc;qs3fd z8Gu6Muj_KqhR!G=8Wz~4XMZE+J^sm%u@(*(%VqA#3{FnwCWeRd7F>#$?J@7sPgXaz zeylcw{aJP6s4iWG<&@(JrWnLuco!XN_8a42S2#u#NX6_geFL&=S>ZP@A5W^JUB*nf zzn4I*k0p}j50d4DWcfoMhq68^{YFLF=%~nDZGKZN;x4f#9B^Ds_f_vGg~x61o`(+B zBt-N^3~Sa%xUDfzPRi@70e)_U*a5{#)tu5eRATU!rcHPTEx;1KYu8tNb*ywsD;B2S zrJK?X7Or>fnZR#o2}^HjJfNo!0T-f2jRb?Zo)sO3 zyHOm{;B^(^Zaa7SXo*0J!va=mkn03S&@jO>k|q*MiJ--25rRd5GxGg_qVkNZ8397S zjEOE-YQP8~)x>vrd*;&A0x}_mcHb97lB4OAYoigNE@?)=He^k*a-RzXD-95$afh!k z1yy5#Q`@euLR*Ms@Q!AV2(PRon(O+Qw@x#Hq|w9E2M**4qZ1>JD{_V1U(1c)ow47*Uc2;i;4Y~GlxJeaIF)2}kvoN=UlA_ZlF)zZ8q zs0fhf_a$hz$EB~A-h|vGJt-nI5S&*>sc=ieZ*nDxrLc?L(SEy9<6y7f03tuKN#W2JW8QkT^)s6JSPS>Zyl$1-J3h84KXG7mWV(=* z{9gjv<{jIYCh@|LnD_84%5>LqE$i4#r57`?Q9kDFx@|p!6T@H47WW^#4K$1O)iUEW zhOD8m+E3#Ymab?}OIMsQxRU7fR}ykm?QWGP#8RcXEirH47Es+7mD>PwBag>&9|i%= z6}}p_@=2sv%5fG(Z#I#@qguXpLu`sD%hzz(j7rysCD3xNm|UAS@GH|slQU>smNpkw zW+bd7w$#1KHykydaJN6;7FOn*+Hnc}i^Y#;!pgH0Ali8066-jQ;`IdEhLy|8FVXRQp9+$XOpz( zPHR^YnZ!MHK|jKVs7IF+>sf=evy}n?F4)P|lTIO;ga@n7Mai)(Syk@2snQ-X4`mW~ z1=8Ua_FAa)Ll-iIa47C> zh8vb!)Z|_O(j4V9^d~iGXrX1&Iyq@UR(&SbTU&tP*#_;+z()F9hYvNp%J0qE_gs)p zwIZXTtI`~>;_%nVzr8W$^@w1>Kx7`e zWM!dpvY&IY^1&_NE2_O++AzQ97S@}6mhKqU|Ib@~P+b3n;-}U0S+C7&p}yPwEq~3U z+Uw=_t4m7uv)AlaZTuqO)Pb9udvvR|*3yS@yytQa7Vz%r1+a>H-1=VIYx@wece6L9 zo71xQ+eRvdluxfm*EUjZW6W_VKuaasXCtTPnB~|>Si5|+_59aJonf0`o*ixSnLb3y z7x~M28%f>hJwQ7T(!vH(d-$(O4}!6ujcIL~)<`Wv>u~))DftMHX_;pVSVR%3XYqyd zi+hkCG5omW+HQB?XW0$tMpOF&Z-rY&buN!)APko?kSi;EpNn~)t}^eIBl~lc#nJr4 zZuEnRks8B^!Qv^bZOIJW)zR72hz5JWv6etE^-CL(j4xfY<+{!CeZUMQV~O%+<4j`k zP_jp*u|>+#f;E4^0aN)G6FvWq@)$=+zkp_u(%lNq>lz&qkChh0cG$6~tf;U*4xf!uB!VINEzd0L1t4SJ5~dtz+#&yQ@F$Q8StmD#;3 zd)PgpP5c&~fgGm_rJiL|?WkYTi!`g2qZh*`Oo+~h<$n-Vl|Ib?DJnH#6EzvwG1Npu zc80w;_@Nq5;)CE0zl9Ju6aw{BE((QA(TNrm10X~Ixm2Z5r;=p_JQH?=$#74I`Ykiz z8ebIdgmhYZO!u8%rgFq2Dyu$P0TLd9Diyjw@tj-Ah<8Hoi>Oy5!eUtX^ zf;}AP!ScSqQf3%+gj*4iOkDABt3{u+N%O3mNi60aRa%;hGg8bUXMq?&LOB*(T7F!Nk0_l;Mt9lbRwUCQ zjPAn^>4kf=k06yIEsWMl&6ru0X<8QU_3zM}e~2nr60sf~swn|cZy5FB2j|MyL7Pss zNETd*3v}5u(MBjv2#+?#n_&cMp}9M;obZ>i$WpqV4x=u+m9E3O(o|BNek(*P5|XN+ zjCQqgOyH^8Lk~v zE|!Rn;l!5DJQ;1ZuD_hZa9RzUcYS;@QN{Sw*NbT0~%xwLy9&gRZq8Lattne!kHdOmV{jN)Rz5`&5`}N&0!*qO zGYpxU7!~C?k&F$K)`znWeWwLePuRoS4iZ*gR@D~%CX6P9lW3P_{%==gmRf<^>VD3L zNLzxI7PAAcLjz7Yf%xn2_95t11KH0|#KrIsm!27YwQI_!dF1c_w21|n4xl8+927ty z<$3w(97I43{Udk9z$}&_u^L)E2#>#jZqKy(6lQjjJE1`$k{ws`!h5?Ede{fApF9db zHgv<`k=EUk(H^kIl^`AkN%2(pgyl#6Di=tT8J zftFcb&;txFOqJW@yI|Eu2rDOB+4Kwdj?;zqHaZcsQGJ`1z*^dj^o_d^{?4<4T`3Hf zP<^W=*n;R5-tGVsRM?SHsd9$~wcKgG%W|h9r*fyLGrFt^=(60J_+&%#O&!YuS%o&{3Zjp(xFyokSIb$9oZ?pvFDrzZISKus~@j+p0H zqdo7TnAbOiQ)X~7yPwE>*UR{&t^ib7-4D_sK=ees_ltW#=EVQ4t?rK z=advtF;j(c2HS$!XCfcE?Q@_h{D+%GLgVoJzU9P1-#v z_X3jxpQpUf+<--`PT&%FjJr1K=`&P?;*-Fn@<+WdP=5`}+UF$qhRpiK4T{RQe5cFe zVY*G6UffEboy$Wm4!usuog|fe#Jz3f<9!o8H+aoU+FtHNQJboBJ-=Q?MJ^P5`n*=k zh#Hn2J6y!bayYvg10D9&m~NolHu^UL_Qnj(NpPv2j)21=c?A3NxD4%!HhMWD=bj#* zuRjmYnRvbDZi2;8vNo2$-b@3Fxb4A?h~d=H zPCK1l)msx5N95*m9*!>5!khBnJo;|zJ&uuzMh3yil;Nj#1pe0fm(z+Nv3{vzppJn$ z2I?57W1xd80m8p6`BzAA*3wvByxNgx zSGI*>BPBo@FeFYwQfO#^1RC;#mO>K@BmtU)(u6|#N*dDO#BE4Il1EEvQj%B9`<`=W zc2|}m{=B?D-ltD%@0okgJ@?#m&OP_sGk0d~_3!!!1&An!@0)KDJ&Y@VRttQ4Fox#% z+(+W{Q1qF34{Ph5nb*5FledOkXTVJlT7BtU&M8>CZOa|bS(%*Gv9ZS*bo%X<%1U#A z$9hvI(K;>kFwGFYWuMhBNQ-M{9T1AFccPK$#_%ostR`AhR-GzNSzyWn zQx=%Az?221EHGt(DGN+lV9Ekh7MQZY|3?@)$M<6t^KKK zJAd7r`Si?hzUPDAc=FRHF8ue^^Pgx9-_iNdhs}mZU+8%7jn7^Djjng@9X|5cwIh)? z6PE{HdH32`hgVF2*c@6IECcjL6Xuf4l%@Ak}bXBtpp#9 zC_(xt#y4wEX|YIiu-0r`q^D|1h&r=zx}KT_MBS+%QvktK6kbf=6QE}B(S?tqS~e#& z9n^ZNmYFzpfQ3aE%7J=jqvm&|z!HtTDJ4olX_H*YGn9hjrjJ;AI^r`$gd5dPBW^Du z^c2iiWU{r0cfVOIsu34=!H_uN3F@hO?g7)zUJ@b)hcp4vDKH9T@bI}zGRm-Ny1E|0 zjF_o&0AM+&RWl_ot8<&u-NK=-N^Xl_Z7y1ehF&~IUlmdU#4285qR^5q5l?z^*2k2>J{c z6&W&FiD6AB5%O3jLX`v;M0>aItEm*vsENxY*Hp>m)Ks$&u|!2}t+O0#Ybxo) zItn`%@(@vVDNcDL>|Dh7(ws%29wwf;SX!!5E96?8!s3SC{?J=SN8n$DpQ~d*CZ2_`Aa}wQxh140gEnCMTw+ZjC3*98amXZV(5UYgV<}kho{+&ngk_c4nk+xmtGJEoni83fD(zCI`Cyz z6LAf=na4L#x0u@2Ni3x_Tn3D&fGbe)L6Ke!;2ay*H*p1D`7r*6n4VD-wj*x&_}NQ> z1n=kb<^%bNImSSFe{ zEMxN6`^^e6oNinz8|PEB*0}=3x#z;1EVdDjDlt3~iZ;cf&RUSb?>I;^(bIGyY48Ma zC1UvYrxWcpL9DJ}tRW5l8XU$V(x#mXD1Q~|x#a%mndGajiM;q8%)zNyhz6`|rKc=k z&!lYgRUT0u(`%;I1Js1v^MVLgA!h@lN;VH{ayE(vO5$)J5!&21Cotn?#3!vLmWb5` zHr<_w)g?lJ`Ar~Y3E(DTZoZyLf|Va+b1S-%5c$n4N!aaSNy5KhlJMrnw!o%ggagk~ zVx~l3Q-M+7um$|+jM9cn(t-oRNI8c%I54Wt>0t(SH4#MnL}W2U*6MkUJVPA`4N;dr zkJG?;T02rBtp+~-Je(R4AVIaU+KOqF0S61hym=9~25W0Vjq?-1L@3~Jb^==$)0311 z#NF8JcJP*`dclFCiD>iR1vnp&Rn65aNfI2y;oF^FbgBslM$sO`HWy*HVj65MiHNfm ztpp=%!`0aiz&p+kTq|(hiEGSnd>1N})VMqmyd_howjpMN{Q;xoujH;XV$?XDrX_;; zcXKsd=e!43ni)gHL&Am0R@X_B&5WuDLNb+e6?Z}x=r3LPdd4nw&{z$Du1w|Z^14=` z;wxGa80Bi}y=X(Ofk}}4gU5`hDkzY5mSedZ15+%Rpp#~%Wyypgo4B*P49)pLL^gGW zj{1Wqy?&eyL{(d)%z8;m^?^;QAHcDhp+C^IaPPnm=NVZcvIGyLYv&3`S; z@SNb$j?=rIM4L*@CUAU1y6|pTHd=ra@8As2W$Ha;riWNIZaIov!WXQ@KuTh;|8wrX z0M{`4czzGmGQ;@+T=IJX^i+lwRZBP4NRh?7CcX%IY>^3amx252o3TVRGhC}XSA$rT zxI0{@%dY0tX6UlBd$pOmv#&%sOLwwdLp0Xz4yOirK=*rKJgdaGtwavSt4lR7&XsCl z?38MXm6w^{NM360ULN-I1Eimbs9`UySxmEGi)Wx4423<;83HRzXe_ewQ6PcXUqnc> z3rK3x91BRUqT)JkX%++=7ld^!aaF*K6x$4S(*R~07 z;T!-C4FCB=oiV%|O_l7bKp<0tlS%f_IR7oAFgdx#`oU1d^Q@t)QD zN$MH^C^?D?BB5MQ4{H@hbHe?a48>&XrXb+F&+Ee1GjwV6<_mH&Md~nvE`Ub(kzkH6 zW)=V~zOi-;w}ipzW1RcXJvCU>kIk4?MgXI6Z$YdLKTYi>WbY z#J->6YT$4KUxJ5W<)9uqjBPNeiW~AvpKv5>fYJ%D*b3&Hr#>mRcTs1BwL#l#vMfD+G#q{xpx4Y$m9~ zGAveqQD)z|S0jSHyyn@Lm`^8S0O3f1R+oLbj$EMlz1Ri3-vU~90mOAT zuo53ewbE1K-9SWBA1O)#OGc3QAb&}OC2eQr@1n+)6HV2)7G-%)mN@m(0*3^&*5qo5DEIq=d)*~QfjcX2Gx#N786M_Mer zZSbxTKVCS>%Vr_&LS+4L(uThXSC^BXKL(8t^E6_0$=uf}J!%j0+`Bh0*N=jR+<68E zB%V?CG89uELrFDBY@Q8$*20x4%f_tRiMYgr^Bp_>Rv0TAK|=0kW*}^p`JIo0nNNev z%>7l7fEs(q{b1Cm_ngkT6&)%YtE0{*P{8KyNfLEFi8`X%PfyH>%6{W5D4@y~RJjE1 ze3R|U%8UP|{umrQowrC6Pwb?o_e&ESX;RZ)N>edB{U+%A3A#C-0(cI2x0bpCC2^W*q^rgP_Dn4`M>bKok;ID2 zagED7NxV`{sdV;2@gH`sgU&&$tPS3-Q!e;(% z@QFp->mXz8(GV1MJ_F1>T&f6M~$cSD}=D7KLzNsGsHR)xbIZtzc z3}#UkFwn}`nDl-A#GHhw76@*a{ksPPr!`(y=BvuPHdNh@p;Pyvcf|QTOD5&~7kKcp z`WH{Df9bUP{ioIcd}7`C3)ERDxQyvs4*;buFINi35#F7qoSoxrEtq-$bbNHi(>#mZ zMU}Wu52{Q?oi`dUJ_u*xZ!lWi5eI9yz0p?l zDyq}Y@6zClT>h1|vs0HcQJ+5Tpgwa2rd!G%(a+)Kt^>dJetjj=^FC9L)+Dc`)I%7_ z3_E{?i}Pg$8vtT1qQOvwTMt+neh&Vu0!gj&6|`~yy(Oa#DS1ESbD-MW3ryuajCS;} zeov2;a?f61GUqt6gjwC|tFR)Fy^8xY-l-DC?g_CgtB^6UA)I5 zf5lvo5Wyp{i}5+lzcA(zlocCkbEDNjJ_;lz@G)-V9J-v*;%(0%YUmO`Q(r~n7zc;N z=ctDui`kAkrP-crM@df2+E`;V=}C=GOT!gLQ}x8OgMAXV!wHK zeva3v4C#CgLl!Vivnv}Zis2+quf=s5kEaK&NP#wt8`M)l63NnR5R zgzI+nQsWG6avm?C)tJ2$sc0nJEwdh2u{53e)|wX|MHyY>(6GXoJHMsVn48+!31dil zvK7}Wy>A_^#@tJHb|M1Fv$8H+SL55*;UyIiEf|P3ZfsoENCDiHRBLMV^Q*lP=FazT zBtiOOV+CY38^htcoe1*iP_0qGw^3zuW&fLRzByg)*h}-Urss+^8oN6_2=H`ZY0Hw9 zC0{WWy4}}JPpFQhaE%hOLQ;bLx6GmIlYM0xS#_3_eFg*)Qm|h1oX?;b1FiE#nFz3Imc%Z_hH!4`# zP$k2<%2=gI3oDt=(n_X31bmzxtmM)Esgf=HGr&02##!dUIMW=BbKlPa)>30tMO7`W zt6BlLrAp?did(O%x=%CdHk9M^)hgz80_8BhTE((y)y$`=`d-Y`+-l~$3Yahr1IFo? zVD1sjg90BHcmmL*|5eR1H8a7mCBb7I5O_Zzf7t&R@}FvW>{586U+Y3GO6OoaZrg-f zB`t&uT-zmWOURPi9;vnB#4Sv}K|Bo8DS^7iWm8~6;0&!6m~#a-31*qViv(UO__Q_? zGy{Th1RfN43%0v3-L1_7d|F!w_&03j%)>7)0xT1@;4mgACUMhXL0HYXN(M z%waq@g3$W0(C3LaMxq;LwCYX3SI+ZmOA#5?sTy6RufX%DkE@!oT58Wp?OU`(Uxl`9 z^ZkBY+pB7Hzut-35)M7|F?vE@i@99D8wZWk2_4~{jApJKqu=UR;`HlcueLCd#ytO< z)W+%JzyQ2t8WI-nw-vP*5uzg3vZz(i0YL)awuXYD&ak__tA03-TL-i#P( zc(w1Nt(G2JrrKT!ehi0dGcHiI-=Q{xj(W97Xnx6Vp_{3m z{>ZEC4Bbg{==)Op7WIejh4=qTYM-D_hVDmgfn-p}=u@GGXfEx(gt@SOt591fHKqGp z%1Z4M^o7vFX#1gRqX$A?Ba1G$l=~f{uZF%!^XV5-Q(Tb!z%Tw5TY^Ua0;qfCA7O*l z=tlt^m|sh)!Xz}tH(}e+NR{6TGQAEz#ThO9l<6-(FP&DD^=+5(dVxF2U|Pz9fI1bV ztSFmgbS3Qp!86q9+6iSmFQog3ZS;V^lsRe`@1sA)_e z1^fXtWo|PCM$y^?|80evM5)=R1-!^u0l3C^*qEmc8c!He8Z(|UM(D%FcZ>$@)5dp= z7221Lhlt@1(8{YS0S>FEReRj10sNNnBcn|_VZ3B?Yp)wG8=JLw^cBE!qpzXwvgq%O zR_&7LkI>p3ebY#bY-#PP=yTwiMeAmIe>4=$XdjNo7#h{l{n~xe=}{hWw!rz(5s`mf zdn1~Pen_h@mjKq87Xn)5D$3B8jZ0DPFxNygbh%(Q0Jdqp<_{o4#@qxxLx5>WK7dSg z#C+ID({+G5>6p2KcG4YyY5IcT9|g?Nx6SA2KJ7*D>88hx4@Msl8Ctby>`mhVtvdER z9T#1m(3)a5MO(Gyu@3{jGxo6Yg5Y1!Zi#(7nxNaz+D&)IR?tb{Z;QSRcvti!INXKu zld^)v&%yImEnM+*^tajx{aIk@D*gd5Rq+Ba7gwB!Zif8N6T_dN+*9!! z%6%1#83Np|eIfKK;6H$JM*B#`Ytg9wxr*OL=V>ogyovHJD?(<2E^`Ms-&_IM0Jx@- zZL+zNZE}@Br}9FR?Z47Y)3t)R32-NUvXX7}S%F`#>@s)Kvz6=2&H8JVTg;uhhMjw- zUKwYa`SE_URa+Xr8Z;~7H_1HiN4X2-owNn8O-sjLGBWy+_{;D&@lt{N^-sjFHAf)Z z_2z#4srXIi2%U&O3>qF~h4yXC=}zL=Kc@XW{-@@Lg#Ui3j(r9r{yP3SK&|RafZ?hK zrF>I#TyL#<1m&giC(Qja%7=9JXP(VRfMNdo!T+DkW67xd=prr2F{arN_b zQeRvBka#RsD809Oo%ynUUG=iq%lhrrD`F?5R|7m`6?PtmT7Y3x;LG~AtFih5Kd*kp z7#B;ffbYFz%nSq*SH@-r7A4ZLd4UTP11PUa48~5$h>Y#XEXgg?0{X^)t%@0g(5OLmowEw)W)^cy-PN^m>xK?gcl2)EQjXcWp>xNk&i3BUj$NHwwrt!Y=I+S2)OpD68^)+SURNdy zV^cfqQLxJpB1^h&AKPwydY?3H^6K2SMNOvaw_`B7QO&Ay>#gjQilS#2{^(||!5G`! zOu<%l_}q}=78I(J&697-^>?K+S@=`_Z5vge4Nd`z!XtErS$D4AJ~XkF{Vnf}i^$x;MgfhYF&POPG4EB=hW*JyLHC z^OA4r8M6B_nDJ}ueo|*WrB)h*!@|~icHRNlAWwb6t_#0pWAmc-UANRHPi?N79^vIk z!@0d!^;x^W^H87dNy|=kc{*Q)5!uS>umRlOEkGa?yE3^2G(2M%>K6-U3PRq|5A*VNveE!gkXfYSSzoXwrjX+_nM^<#zL8NoTXp z!7j%=n0EVn5Nh{|<9N%*n{618;6fY>*=X`Ailp~U2d?%W>7 z9Za)^>FirlVc)?loDz{EF_H&d(()OU+hr4Z6-3#@iXO8Jry-V}=w3Yp!RY^G3V ziZkv0r1s$wi%h;dcYq_mg#8VUEC^n#;&wK|vGRzbOx~X0yStF8ZDIn7otAs&)po*L zy$Unbp3bdv(*6G4;%~_k4meYw&cUI=2suN$I`l?Z{gOFj<|4hG0pK7{bnzr`Pe801pO(h@W$+ zq0$~^r%G(?US~*Uo07%&tEGJ9!0v5uxdTWQB+d0`yc&-&p_vh$2dT`I5#?Da*C+XC zx9sRF5Ig;vOiq>;*ViBeEmk(EEVR6x=TU7JAnxV>(2lgG^AOT?HjFa#<0euY`4!Gw1r?S_l9zz94$Bu94vn`#!8vI2BWS_GN~KkjO9> zFWFTUWD074JbCM(2m7jW7?t)F>pop~XAYaJD=Wb-bE0q=mY{0k8js{HR$A{Ius5*! ziiNtdV1n{GG6`&9YGg!EnKh^4K#I?5fO1%5P~ zO}nMFiI8j$AXh==p5;3_Z#(YDq>+K=3z@z=SV@CC3_Z=l#l+ORU+oh#U8|dCZI1AOeAGHU0+d*DrG&+~Tp= zJdlUwl~KB(Ma@rSQN+%u=4O35hk17ixf(X{9=Z4A#7WjW%j6{u$QC5&L-1AUuiuer zJXD^#eZjDJ%ZgcC*mk^JumS&e*GBx7tCK9c66c9I z{L@&&RG>X5XOV;F={?fo0FOkRaO*EPZTl9`aoNI|uZ1g;eOw*%w7_*M+A@N{Q3zTK zLb-=m6DLP8<25m#gIsHHK_VTN?%`Jg966laV?x(=0sE02J$5~POtf1lrv0E`I@US^S##8cGE2{P%Ho^D zD@Nry4WYG9MnI}5{cK2+hIT9g%kNvdd5L(W}5ADE@IkQ#Qquh@& z-s`CAK$+!dYi>nb8gkl1^OQfZj|`&TB@%GyAn09Kf!4ki&y^T`6z^~x##Q|}^B9V* z6?D|xNr%9@5BBoC(xQnHl(^Cg_QtgMg|Y}+imlmKv=Yz%A@CZ8tW2Zip?$rmvG-cQ zv%g!=hdqsFh%G*ZKRA6uJq??(#n~&Fo9p#s4BOK6=92sJ7(CaCH}{9l=lEl75&SSD zWRE)pd&2Gudw}H?$^NQF&0&Kv$Ko(wjQ8r-hGSVj4^UqFy<}UP&-O#iTJceb~ zSv%iS1EPsqU5b`x;w)+B_F&bg!P9{i+r@e#@DxAN;B_F#jGYctY$2v(O_ff(>Rni= z1J^xhQ}*daZ}u{d83nw#wO!=fM;$T)%35su5qNG7D0s#;Lc31j)U42)HgClggi{Vw zOsUonjosx>i<&rg0#;l(2rthPtGw63F3K%kV8Y5Nr}A5udacUHyrh-+c*!4tDvJ9u zkIGk2VJ`qy1zQz3`(ZHJ&x>XQR4cjZL zqg-6Iv0T(puCoeX>?D)*Ejcw?&zDh6C_-nIzwAfxIyLytQS}DUDvVVo5ml<-;4RHY zc4~H~9OP!#WeIF?Mh<~~SYWGD;&i?g=)z(-9m}IpLknJiwxBmJ_7oQ2Vp&|gpw!0W z&^zfb@ReeAY#@x<#7`C}D#aSN-Z6aLzZ zuk{DT^PO%-)?-@;mbm9!Pgh?t%W-a(ata5SSM~X>;mO~I3CdX z6XVB3hbgC4E1AysW5nC@=AMfG*{*V*zE|R)N}@Oh@a8a44!6E~C{ELm-NDfvE~vIW$fHmT%=lSH-K7@WMz0a3z<0>^BlGL1&gg&$(9b8tv)t{M$qxGN{so5K-jkk5)c(WLZ zrBNF+&r=Q~s{o{KPuLgBZwxpg0f)}F=D-@2_CVgVaH;{V*gx3*Jc>6%t$s?v-t6B7 zumrrn?h{$?*mOdVv-6LYrTt-riGMIk-5_1+Nx&MvLq@R0nku1JbFJoy6Gpn^Z01+_ zlbT1isW;2B%lmQyR`Mcke1H)=kuJywFpaEk3h|G(?Z9(*9$5~ z+S|lo*~v3#ZIjk*Xk%C6Y34<90NAsWZ;7WbYtH(q#my-ZkIc)IEv2~e$Slzo!LjvN z50%UF)bc{+JYU00sBBk1`JlO~#CKp!$7vwT>Zd@|toGzmFzZC?0Z=KOd6$(#9)RL{-HQ5{pCk=d;dX_2p{^Z?0JJv&UAy7(03O(nsz% z@Q#~%G5X}Uu6kU(!r4&?sv#itg%-t}KU-Aj)K zx&!IkXMcW6)vncOKIes|v7FZO77XQwwF>e-89!5}|`>5a!a?0lb_k*DO#_~gs- zUSzQx*UI5pMt%qfs@&xu=#|Z9lZtG-rYkYQTbkEurj=uSM7S5=ww8gL4ln<5n_%vB~)5OA& z7$|b~J0^2&^qy8QyV9dkD`mF~w5+r`?A^lyA``2;soZV>yv8$8-&SA19qZRwuDlAO zB!!*iS=vgA4XX~kThP5>a=unr@7nlmXp=* zKMb|-@Y*95ljWNxcbU14--)v9bl+Yj5&mm~e4&5iaAD(Q;!APLjQ{&UoiJPSqLd}C zt*o>*?%C61$wR;!6YZ+TS%zO9h z>^tCv27Xy<#pDqd6(7A?2h>A;o&qek;XIZa+lQA>zH4&NW!}>?`A;6QCDN5v4|L1g zO_uj22TJSlNH>G0lO2=Uv=*O{Sn_sQIin3&MPTEx^O?x6xhDF~`E5hqt7Fm~D_It( zh`!QV-`mDcEQV0&f_Y%%hi|Ca4!O zik|NI4W@O-b#`N7C$KEBYbr|HZ|xpIWiZo+m*{f&w#nnPu&?tIeXKT7s^JjhwR}g&E|{t~1SG4_*|s(tEIoh2x%#i!~@4iT64hZypk8&J;*HT~;11 z;|z2p4O(*SODGfa4o)EAA@m;mEACm(JnDt# zas2ClTAV9LP3j}aX~w>pY(PGuGen1{C26Uzw1UazWFk5CjGh?#ZV00$moJITOfJ`x zV-I++Au%&CCpmVUSs+15Hpe;XG2+QqJq{}TgE!&iLa4+^O8_cRav=uP(B&BVpw&PCdp+ zj4$NT#x;S>u?VaJ+UDfg^U~T1bH-uL2nE@y^`S^0ZpiG7uMml5sDW0+A|V)N9G%CW zXLUMZ69a~!IRVHJM>1+5^}~hvVeWVa>*En4j(jkl7;j~}z%#&`#p&ku`g$hDpx})` zfmKo^$JZNhhVk`@@vS^cJ^Y3ZnHb+0ifDkS*GDaM$UvfuXq=cXHXBybj?BWm7|HQ; zVtPED#1y@hY~uk$ZMN;rBE>O*w;Gl{ryj#8wQmzfw^l{a|7OTOrykRLT#rDa%`6!_ zZu}0Wo)eEoLdjLEA(YbN20MA&2uFfO9H}}kMnDg7_Dj<=s%mLDAAi-G()k=7+r%}B zs@EwT7tat)jY3kzIp%SV#vUv_!L(BC4c5{nOO`e-UDCSL;)mzijBRb=*C$#k%`?(1 zxxl)DGg51Ni-qU^`!eo6>};97y=mkJ?JZXCLG0yiS^JQkvD#X!Z4TbqD&(C5XX3X6 z<1SfhZQ6^M)`qNhH=P*(Sz9)1ZQ(Z~^A^%IJW{s%aRj?aqj{o*h5v3T%~^$dO^>&i zGG(hZiY;xquw`jW>(Zqw@Ut{S^Zrkwb0l=?wcFkF5Vq9f6L~yHcMj&+nyas2ld8{E zT(-Q*X&3+Bk1nBi;k}iPY*yaxl$YCWTVAneiZ>UMwYo$)RhqKElm(_NFlB-NM=Zd< z)F=EBn#Lvy#M_1ZI~9}gOvnEg)DEKLFsz z3nS1-o&GZa(lK=l#^i%~!s#ymO3ojH-vYpINM!8N!(Q%d;d?QDGhd>ec)rOrOK}c+ zA-;U&v+Sj`0(I7SCi<}@${)y-BzxJl4*$1K-U-&9KVdG^qc(oagx_f5XAJVs)0FuiKXl@Ae0~Ru zJzc$%;#2z%#Lnce?-pO$C>}Z>D}-m?_g{Y0$0zp$k72*zM?t4Qu6t{rYQk#Q@H~Q_ z0Q93jzY|pQ((?5~bg8U`iL|G$h__k~tEF!nEKqv0j^D{U+y1furofa1rYtaJfhh}2 zSzyWnQx=%Az?234J6T{z{TrA=cz1Z}Gi8A(3rtyH$^ugsn6ki>1*R-8Wq~OROj%&c O0#g>4vcP{&3;b`r+Y1r^ diff --git a/Tools/NUnit/lib/nunit-gui-runner.dll b/Tools/NUnit/lib/nunit-gui-runner.dll deleted file mode 100644 index 2a22088c1cecbf055650dba01aba68faa52830bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 155648 zcmeEv31Ah~_4m9b^IkR}1d;%O_t?TS2?zuM5tU64R6qd*aSIS28ZtO9Y{nq&*5cl} z)}^RbX{~j)E*00h)w=KEQnhNUt^3kezTfZMJL?Nd{nvi{zb_9mbI-Zwo_p@O=bpRH z%svO6X~Yb}h~sa|7Q?s=cmBr7_1iD&5Zx(tdne3G=4PuUy`Uj&uV_v;Hm4`en3Y~;EovB2TwE|fv!1z!VeB1=8H0PCG}FoLbtBrh zFp@Nkp;5y~E9{5UboembDIM`$l-vl3{Ja~NAs+Y#H%3veaVH7@*t<)J2>D$GzI!nQ zzR3cG3tZPljiLZz8-cW8pakwO33yKzGK?WD4XaxKe_E}}#j=W=9ublpHpI@_3xN{Z zAfwQX!`=5AXBgv#*bPk<2t`)NEOaw-=qC7*bp$&!(4m124RmOrLjxTe=+Hoi20Ap* zp@9w!bZFrJBMm&kc{P5Vn?{X18Lz)};z!8`?~1Oy?{B|(=*(Add;4Ei^R4=)UYNQ# zKb<(?vGwOpTlc|RS6uwqqf2k8I`i?<|8#5L^Uqm7?=LOm?MKJMhu8Jan^JK0XUF_{>09On%dgw?uT|&HTC?Xf8%u}AjNTE$!2gnH zx3*4L8Hi?z4FgmAXa)-%rjY@zpun^`<7Q#TU0{{qQfNLg1*tM!5iYYzaV<)o-dOfc zwCtNmXPj!KLtz#%HC z%cc-r5Y47>YeR|S(QID^LEr=_sm8{=V4ei~k=FFE$iSgZdO_HxgN0B|kcHNKQQuCG zg^y|l(awktoa+xnrsy2NE zIOnowl>Iv&d!hXqXhS&=U*Y5+sb28qz#4<}XNILG-WEcwF(F(W(io9F9Nv=T9UpI+ zfRa9kJ)`Vze9{YT3OY^=4d{pXo=y&uswnE!2`#HE)jd0y^)W=%2XT^XYI&eOh_^pt zVqGF3EMS&h0$CE@%gK^JxrIhWn-CU>STKLs1mrTaLn*^BMMyJGr9uJ_Y1c8e7C@*L zhjJ&f(#c(tjQ3^8MuX~lC|q5{+w*o{ zeawY$2Uhy*0Dt0B1rC2n_LYx69T4>11qlPf6K^NtUY!czF`*_X$U=v?r0L5v+OyE5 zDaGgTXOum~$6shGDSyz95T7b?vXErUyeyQb%nTRn)Igm8>G#1aeIUz~0U|R(u$i53 zi?))DHPVlv>_H4w6~wS|f*2Y?5JTe&Vrc3?3|m_e!}cG<(B}j(^l(88y=oAH(mI&( z%qS_JX}3~cqXD$cXIH(mpvy92^nDk(+h>6)Gf3mc%Drc1R~2`;r|`1OZp2krp&Q*@ zLWdjn9ZWk8P?d5e<<@wKT7Yp4Mhm`i4b+3uS8uI9C$ZO`6KcOd-$eCDe-5qa{(J(m zM1MXJw>FH5(5+5l5Mv-Gh~W)_dl1`2f_)jpI0o1>gBVgFC|C@C99j%|ypEZiQ=P5J zAcx;1WKBW1;xurK6eh}|t;}#kqCDEl>^3B^YmRWmw@%F2% z0#!YdYkCvvI(-WLSq5ZIPp=YIdkM>}y*&UP9hR?q`F#R-Si8ngS9lh~{))NI@DS<4 zkgGLQAy_^;FVCYOA~ny6rixRY98D4GlfI4e4n%Ti{6ciOwXb4Gz%C_2T~Hz_to^)L zDRpXepva1aF0!zIjIIk}?N&NM5a^S>EGz`kfdLH>GS&)pVZ^&54oS5$rPbb!)>GkR zMIgNiIi=@9oIsfwWzX^zlL&XPA+i4984;+s0=I%{l|E>pZpjGrNgLs;hz<;Ph-j~5 z#JfWSNwv^dGPVG(Dhc&TSA_E-+O0|g_9|Z)iEyiuKzmh5ygMcm7QU)XKLH@Un%UCg zgASb{2VEhP2QgG+5W^}AVrV}>j5P6)qVlb{Qv0VUXUKKh*Lvzh<)NQYtt&H2I5}Rl z7v_LZ!bsr%OW?<5Bhs3KOB<$qarhVBto?x~s+pFw4nUw~Df~=7(eOlvN% z8}iFdYaRmY8-bQ-;)eX}fj|^$Ck5AEkgyKIwaQ3Z2jgCfiPzwbn=6wmnvjMwM|fUA zCQI_HLqK7?;vg?=8Qaqi8$6TZBm*n*<2(F`UH@moRICyvRtj*7(SJ8W||gOjub& zS}nL#m6aw(UygA^!s>?@VK&yVj|ZP(q0P^%0GV7=vdl`RUB$E_T)wp$VWR?k=95n= zO6tm$(sEtr%9U9|YUVmvay<&5ugqFRnAS0jmT-0*$$jv#A^5lud_3Un2_fW(A^4;ae6kBGfu;lnvQ9y~ zVQk*9G_GpI&Vm5TAU^_Lsnxz-VNN9_l>6#8UhzI~xn+Nh=+eCGdfrU5+S3qt0wSyB zo)XhKo#~YjHAzP+iR=JYcA_M&Bw?LF3QaP@B`HZ{&h(NV>*9^gE1*3u*!>r!_ ziMTUn%$x`0I<~RuKGDqi0IC56brHhW&u~$G6RTFmQHd$DE+$zu_^}Uo2Y1v0*0!um5GqQR&)WmO$=Jj9 zcL>7B+x@FKD3-kx#Bhg_*JWg(!_3zg6cJ48=RS%J4A=C~<+vPBEQ9fzXa!4@#cqfH%{>J=FElFD6PlO+BzBL(tiDFPLw#s{(? z(mvUj4H4zmuT-7{(!WA)mA)QA26ASUJ6aVkpl}DlEPtxl83hYen#vF4Or(9WFJ~gs zmm{;(kU&nvJHzet!xUx^l?5LV8vRj<;HZsBgBa>aW9(~@xgN0D&r=XIAk+#5YN&oa zP*c+*px_?b9lO1QYGgLiXloj`40xED5tp9n4=9%t4LjG-uz&ieMwn6&?LB)faxaJ# z*6e8{V$$G>O#2@c>(_{=LVtZ7?lP#;7`wQ@7yBE=3Msnr>j4xdV9%=QUTaD^X(Gsv z;~q9RjDnneqh>4v-I$QBglTJx1lP=C1_q$kXY z>~=furSY!u%pEH7PTc0fn=d~bFJUurYmQlb+^K8^5cYVo}#Os7A6{WU%BTcw`{{ur*Yueo2bEKCfJ zgX73(CXEWKEsSRR;w~AL>$slL%uyg7+$oxQ0QYj)6{?ApyK<=dN8gBkaR*dLG{eE5 zeOMt{#DfSaLi)Rz$e+KcJ*vo9-ZqpvkghcId(Z)&siN7y!`3k>^ANCYLnQbxgF7-9 zjb_kX&1@?!Z6ko$`r6MPJz9gFX7l>snARI5#~e6Cz6y06TAXvTjx>n7M=mjTx!6{yFZ!b923r_Na=$sv9s4FM9$_rws>|jxTC%D=R z?&$^h@`CU@4(&l+@GviUs24oK3pRPd4kMx3=NjT!bRGeUo z7hK^5mwCa1z2I~&2%~a1?CS;Bdcgy|;C^0kh8Jw`f{VT25-+&a3tCqW$4Kx= z2HU*gZW2rrJJt*CBEhGK-Bp55Gq^j0+W4O#V!XsX%izuulsqx)!lo>9w&0HF7@4&b zW~>fpbTk`Px%Hf)B~X?=4B~hdx_HTM$z9_1p0en=B)G!3t3(4 zsZz1+S}!16dD;#fcXF+jjab%N*-$nlup~iS+mOJxmUgls(KFi0>fVs(6>VjuU_JIl z#g0kKtd~4Mc&9pf%;^?{Ih}$qr%Mp#bO^$n?m(E+8Ei;YMqB9$HY9pSTUSY-PqcNV z1XB6YR(gRAi4=OU)hdLA3;F=yilVJ_0SKYHq6Y{{YR{oEU-qQMz+^BTYYkA=D+*76 z-69c4Pe%`Kz3Ro<^*%PF0GlB$o6U-l#VvO|SRWfAz-GrV8!D^9VMD;a z+?R?7q(ZNv%b+u-W_viP2-w&AQc>MKomc|tSw7K-ux}2LBa>m_OjudH95w{(dwi*g zK&s*4RIJ%bCl!H!XsqtuPAq}+-agTYuwV3LLIg5Fml!NRjirynhCq5h9~&aq<#d5wx0*h_q35dpDAxnjMdS_5+}w_fuAw}q*g*S#1!>*L2*@Ehy$(*{oA-C`<0 zvmjuf>|;R$Siq+TE0@J~TNZ(U`l$=I1rZ3uQbBGDA|P7smH@QO zp@Mil4ir39l8b$jPj0eswM4+aE) z6Aqy~g)*_d#g`>hx(X!_P$&@)Xku6(X5%W9KtQ2HAl0OBD$3+4lt4hC6x3BHfq-g= z08cp3phDROUC&7%z>^KrZD9mlH%h=R@8tO{B9Ou8a0b(XcZDV(y7vtfW&$U=-&X># z>a`MpRUaq;_>TP~fPumc2{;1>jVOlP!q0A6R@xJ z@gxE~;n0IT8-RBuArSU4i-D8cSRw(`1_$lZ5-bUzHX0@1R06r!H~aD?3s=7cQZ3Fv zhmd_=h!%1}+@PGy-K_-zsTB?nLiV#h9z=i#YBI=!f|pruDq|qvRvdxUN{1mK`y(Gi zBES%pA7n@cxXL3Cs1Rz!tu6v~erKpWWEH@ zJdTzCDrAiW&^%^K07KnFB!I4!Gat`=F$24|Pb?xJ7H(QB-A0(JTZaVf8eb|Rkm>+8 z)n=t+is;rF0ehA&6%j}U8G|ZddEBZYU?1;GMFdhIaWEAN?^Xr@`#N7LB9LlcI2ASJ zRuX|g6;gd}n<8Mp>f=cScX8LY=qz{^R~vcNReMO%MTwncd&Zvmu?cGTlm`%z8^D z7!4rvHc8*{5Y|oz>xuQq9Q5u;qF1J69^T9PvqzKu+%Sxw)Xc)hd2m-qBGMm6us$vm zalfF9au@5zFe4>O8-rRDA9}a;(PP_3@6tYc*ATkgDGxI$3zmf_`$S(^h>)_RRtMGw zB(1YHpn!LkmRJ;T$AM6}^_~}%J_`!ON!o!xIj4?DWMAORm5B5K&|v8Bq2gApxKTM? zMugmq2=qzK3uHo^eXTDOBGRujlkS0{5$~S8p{mQR_f?JrQhVVLl3#ct?Yn(^g=$n5I)Sig42m2TcjrFM#jDWboTt}hkw51b3bzwMRWhDgK!v*10jjyK#1<) zG;#tVp@_0~_X$PBR^(umW4E$Kn7+==Rxw`IY!#>4 z-q8#ih-pPof=m>bVBP~u<0>O`P6{jX7rqNsN_8Ze3Kg zWdcyUdOVdk=2xg7G(Mqw0m`)!h{sW@QnRcyQFBa*S(3Q02#5MA5tmIOt~lRJTKNd5 zWvl$8g@-{3jC|N(9pqPQ#+yNn12SrVE@>5#yoeVO-Pl}QW#nsh8ld&%pKld|uF5FE zIXE05N|czVH+~ZrQI~JQn|ailwp%NXE?7zG`7}@rW}z3YW_hd^0K3&N4uAXpjba6q>kk0enEY$H!d_VuCWQINvsO>yE(N zOW=qFY4t_6&@8=WxzeWs+)infKZZSrOUBx80SFYg`hi)w(>NugA0s2ImiK4jqAKs} zJXB%VsF}#HcQ>NR%poX~SUHX(qzY06Zo~j3qcD6DsiT>Jz?7O@O*wHY+_Ci|@m~bv z?_k|C_tJR2^hn>x2}?ffX$o9i5>KT)Bmg{UnO_o@ek)Vu%Q@8*M@_9kz`!C!&SbPA zlMxD?`92_#nzryXkz*35XWHj7ubx;nZauN`-Fi9_4AgM}Up*1I)p~MAG^{5))2ak! zJ-Gnu$pzeca+l#mZLP>7R8N%##bg%}&eivSF!R`lY1jH=J4#q_{;%`qie=Dh^o=sx~?r7UMV-d54fF~Lk8gx8n zQ35`>3Ymt;3N>a??Ryc~zWOUW^*xM!r4Oe9b1DY5~03PRP0+3OqhL5}}M@ zM|(F7*rTI|HcHff5$(FIltj*aH^P2;P?u%U2v>q-l|^^rx_27I(vQXkrz_Vurz@|5 zI`N$K3^FgDyZ&l`32SGHI0l!ZB;5L*D7tj#*40xwmtS(=0JDmQ?-%r;6d^)WZQTAGJoa8`<~@Y1cz`h&j~} z)7m{uaipS{7N$55iqehZc#tTc<#^?_j8y%)Xl|U8GOD{@)R{V8I>3B2L2Vc=xQ~D`vXhDCbiy7uBM8nEkR!9DN<<@u`kn_F<>w63D1#o1 zw$2d?lCgiO7GYm-Q4=QLJYv4kiNO20@!HN@#hfO&vd+dMLl_+E%uSQUfDTV@{ac0s zrD~h#YV_Vw*#yh?6Uk|$k^Kb%8L=xo%M#%^K|E!He6ui56PBlxx?sK)+}LI19h4YJ5?JKMXWwRz0pQaHkQ4Z5<%eGGS|9raq3sjJ`{hB!ivu zZjSV|7&Zza#-MSW^@KKm3OcHjrMDJPl7+aSbD86GE;k`7_@>%Y(^`b6TAZoJ`&1~P za2Sk6D;~nM76bilLe&&G9S4eb*|#742UC$0-7Oa|ZmG7lq#Jq5L*`l=#7X8kQFmoxnJr}m0uiBqdVUDCA6EDRe^zRf*+ zY?3}Ucs37H=Lk9oy!auq=$Qz*B8FdyPU#=(!7#@!7!MjSANV6}^WL24aPZfo^r6VG zFi|@sA+sqpO6#2P4cQ87aJCu)K+~w{CevR83hfh7*6a~ra}-a`*CSenBAF&iPSgSy zwGVUyC5qu*iDXgPG_f$9(9wOle0068sW zPDhfPEqI+3$7P}6olI(EET?FYxPghYOx(i6^t~J}U}x5Vot9vsEvAP1nH7vLD>O1I z5h#t9mFCs-DT$ZlVfiJ|6)P~SfX=MO1;?pN@~}FBDOyQfR!3mdgP%zh*BJSVf84;_ z-GGU@eZ?B2E8tumgKsl?6d(()fl<@MYe@1QIfb%KMkUDSyVYPpL#$w6gZ)X5IYV}A-!)%U_+c12z5 z21)f;KVpntLQy@epih+qy525XV_g$&#=ePpK^HeV=zEl#(#{@ zmOGZpd4Dvs9&xn9({PtTxYLfsnz<0*(VX5cjZC_IZC4eb+&Tl)$RFqVnSX_oKRSBV zQkbqhCtaCNH~KaRzctZ0752nxUv$omJ(~7Kf0_O)M}+Sdo$0nNdX0L9B4*r=BB0k| z8}O>2z#MZO@VfrIszdEy;DS??N;}>nN@3TCtfA!Aj<=9P8qU;xG)B!dhZiUMs*P`* zmpAQikC#z>y2C8w;CwmCdoN)69Fwukdfgf}Hv-U^FakTjJJw0gLa4y(?HEJ>7Fy1x zt+?aka|pp*{si~Iz4Y=l9zYpEBv(b1F~MhochX6&p6kIlg!=>~p!_M4%QBiXPXzT$ zrx@%iR1>n;SHLw%dvab32GV}McBPsQmXlRCffYau-!K@hIY?*I#)6#-Mz!5F=3-*b z0|sf8q@0QUJ0q){DFK>}I|txAWiMCP&bY8WonP0U&ZFgOBpK4V(&1>Dr&otC%UY+Ypq=dM5wcF6!<}SCkxssS6vL*v&dtSmt8NqU*te zFI7){7S~ket7kqz3MXk@iWoC<8Lp54&*>)=3Tp`mLrfr^*xWN;Jp+oD1z@ZPR1$;F zLs$sDSAauPC6Sr^IkVY-3wHz5d||RN;wVnn4P%25?dI2vyXF_tO!b>i8`^^Uj9ZtJ z=@qzOMZ(L>x{}#oR{(4OrkXQUH*?ycrVmkjU>Qa=zW`C&Fi2Qk?ZySkb_tR}PR^Bn zgF6_r?_p{+-|wy=>nh2*n=m$DUn)zncsOE^Rfy4T-*Q=Z+ygiDN`pdWB`fZRO1pi-_X>i|QZrTL zyj>%K7i-|J!d`|n8}fS~+!KGj>@NkbM7THp`q&3mFg}$JAXUIip?z!*qB7S~6KqsH ztY0$-{i;Wq@q8maz8SDoStx-Jg?P>~!=aQ>lXNVFOPt!rutDppacV=mE2T7_!+q&0#ffc58qYvz1S~vN?o~CuP5A0=HxA?$H)4J6M_BO5C z2;Pf~kx}Ni0JLgk-ORcj2zziZ%mnU0s8F}8gmot%V=cPixV;x*%RSK(;A7pzXk+t` zB2AM8O+}EVJSmUNlKOXw8m&OvsZx+U&EIQCUmsLC1lz<^p2Vp>UdjjXO`s7o!WueXZJe{}051=!$ofh|{$9f6)BlhV(gKX$)unzYJV9~;v80#~N$sWMfM7qi2+3XJSWcTAtY}(5xfJn;MZg8a( z@m&ycG9yH6qoxz!!_zK|&EY?))G|6yMadBte7L(yNi)ZTwNd>PY$>%U`vfp;$5HRC za{b1HHqGplKwD3dufkhTGmPR%`G(>iRk~*)_zgJfz7FX#zGTlzxSQml`iMi27E`7Y zqf)#pp5Ke%$g#Xy21iTvy@#Fc3%8l*so`Gs9|aaSs`Y7!+mt~v%uwkHRS&!1^0ds| zVfF@O4cJI6R-V^`#y>R98_m(Ms!lwu{+ud6(5%L60EuI4-@ts)`HljiH4Yc#u57PD zYo4;%v3{tf=Mk!^Sz=l*AOKCZLwBf0x4WXVUIg*CaK70~f&P(#=20(gVa|)NRI9odXSatdE_7CoNk$uoV0u=Ng`?(*z>}ENi7ck z3O!3NWsg~}AZZPj!aO{SSs->_n6QicI|hy2j#m+5ZDwAMb(bbfl7l-X?C~TM^R6jM z*wd>VD4}gTp*k|LZB((pDGH0c(F-Gdd6Ag+YsdjgmWT?pS*lV+S+6tm(Wo_t_6?7A zOd4p7&%OzKQLMHkY5fVInDv&T!}LV6wa-+>7A8X+*5*6lGQP zk6f3=^5^%nsV2yzoMgbJ{!P1qg`fp=%{34DINJS>aYs=dA8y(wx%ry*?F@^-ZkzkX z7-~FeG)FpaY#}~UC)zP%S zqSk7M`7%;ynK)wWBt(4{&PZA(-xY_G>Cg6L%>f>U@A<*kcmaiNmTbB){ynhD^`WL?ZZj51%s>PehtWGQ% z^Ttl5+wPM+q}dmks(+FcP~)joqhabrVA|S4$ZM2em)C-+Gh}&fzwn#l7_Laik9UK!z)+Q)t}sSiszD8jG9m&@Abd5{{+|aHvWKE;R_{2l}_TfrU*2+a*EX ze6N@ZON)Z199cNhkkLd@Zy9*V_L6-bMBh+imM3wk;01HL60;{my?Ciq`#GOcsh@&T zEjCAn$n^1A+&~~B5@%#bXP>WT)1&{1^6E39Y;hvNj)C^Q_m14U`wWq)KM<09B$5Wl zH8bBCQ;95eBWuQ)t|9UO*suWS`k}^hWqUlBSuvzbNuqK{v<7-sZ8=&~@0YE%i!USP z10=h#M)q@x4okPbKp?@Fw3*hI2y(BFD4kI7Uupc;xL4`1VvOe)m48y2^iFZ;!^QMr zl@3i*ou`F9{{bfDhiZq!_qCA@ZNwPEdJff!?3fntTm=%K5qHV_6Ul9idDLvLKn-qW zOh|d)M)BU8eu$3B)%VI9(Bv7Hg9Z~P*i)+TG_+L=Z_Df|kY{g!0ydcC_HG2;6rjRB zjKC`b^stX3@GoS)!R%>oAaJk5^s*l!@Pq)BHr^|+Jd3qCaO-XFM&J3Nb(n^jV4Iv-RSjC6g2o3A1pQGn!EAevLDQ3YG z3M{;%ub{$;;;Ly+ha!@DXzl+%hK8nuc4@KV@!xd^4!2a!i}-3JCwRJlINA%O2l zRXJxa!e{~Xr1!l?V+=yeJphVnxe4`(WdJFCE&Tc-(22cqBexzAEaYHBH25Q?7jm(-`GMGmf!Vw?VO9JwP@^dDmxFC6-lV8h%a75(TbCNstuhkss-ISbw3ii$2vW1 z!LCN(oOKhERbXKPz%G-3vxyp4XXNymz*r_pl1x6Xa0mss70Q6U2=4?e1Z3fp1_f%p zq8Cb>`8hK-UDFb{klYUgMe0dT&iML8E(o{ z<{5U`2xEC6Ui?U;K1G4^ev%sf z>s)rXC3)NfhY3Cfx}y;lvnoKQ@>NAvZ=Z9@LEC&5=rTZR<}$q`pSl9qqII@A!}$wSoyqC-`4NYI2ISvCIH6QMTPP zVes4~zT;C&wp>wkUij7*;kJ{RExX!+Hh6pl2O@3Tk0dArr%JGjSWId_um@>R^9Zm) z=51SJbhWk7&;QWmsf$m!5xNQ5r9Klq|36v%y?lR)T2|3n2o7ehp9 zYN|N!2q2N}qlS{?aG0R>)~zh5_YftaH0Q9vFA5NCAIDUKlw?A;Q-pLGV5}WHwEJFB z(v(^6su*g~Es7|wl_=9bms~T@g0%xKC^XTj3OqJ9kc_LmC0BhPt&m@qackgJP|6_;QLmE@Cp*@3h>gq<(IUq6MRX=Un#^p4@I`pLfv{Gkg85i z2o#XW!1s8BYC_1Uh;*OWl_XD4I@x88w$k|BTnMBp(!WQ|1TrGte%DtfBGS+0R-iC& zKXN0^!zS+L zM4(R^1BYPIi4J@?h=|nmP)0<$-zAbHNBQ!h|L__vAu*iX%or7TN?vGl8!yrBM~Voz zjhFtZ+#0MjOh8^u-9z@Xuo7?o3}Rt5-hN!}74|!Fw}yBLlxR5$Coem>vuD;sq(7nw z>=CeG;_*(gYUK^+BwZB~fDs2q#IUIbF>G2v3|&bOL!TbR(Deo}baNVG?};+H&mdzWz;6E^ zyg|L3$6^|S2^YupGGT7p5%sA2G7e86Y_A0aefAk$GMzRB*OB)lQZ2mm;E&%UL|dsj zO_m(vY}gMhP#cY=rJ4DtW|M0D^BC_~!;sUJ61v!xH74UcC95ZzlGPfH1cAe6qFoM$ zL_BA_k6{B|vnb`F=&CGg)YKORFltJCu~wZbuaL6{%Gc%QB^E&mFgHXF{WTAkN2$RY zLGh$K!E8vPvO#sAK4Qktai1jh;gwOTAJyUt?&%zBa;|*(II%DLusX4DCdNTw&AJi3 z@+U+^gZui*n5@GZuh>7u&(|9gc&mR6Cdl$otFi=_qpDhoQPt`y#)-jr4>NNAc<=h} z81IqX8}AXy9q(~G+!%x6_|xMs>>ps5^#lx{?OX}U`0hL}h?Nfz2=)RA%24k@2Av@p zdAP2JK%bt0PK~I5;~^q7H{^JTbUnKyxsbK4dru1Id3HkSn^B5jMnng^y3obY{Rf9+ zM7zTf02*@BQB$F_7J1ODxCOP?J!hq+d(11sG zOjK*IBVeI|7_tmvXpun-4M$__s@=BUec;)txc}KH^47lRAS4TR8Wc`PUWQ2hl%DPc zD5s9}9*a;t1pOkR21SM9!v@BW}rRT zNW*@UDj5gIQYG`(t0}uTf4%KH{29qTe@3W%e|8g=zf^hEyz*zvM)@;ziOviXX6;}v z^{|&oQ0A-XP8`||5)_ArF)FY-!K=4nEy)R9DM4|Azwl_UV$ku3l)`Nk1o{MD(nM6i zBNCAs8}f)mx*k!IjNIKbau(0?h=kG@^n~7QMRdR;3f;~*9+7C*BNA{uB30)Wg+QN> zvm-7r`6D6~o*N0$ov%om>Au3SR`7P+$sEN*TM0>FLRk@SFJ&_ASA{UQG(@|jb^>l` zSmkbM2&7@yM(ABa#0QoTh)9hO)s7(DTqMoWz7mOPw9>BZ^NH53kO+KDIQa4+q3Six zE0>qp?Jp!@CNzx|q-!FC;P&ox-QGx8F4U>uJuToy;vCSjoFIaY*fjJvgeRStA&VEI{ly#niLA*Jvo{o+SLq!^gT!!>LiFy zrJT-`ko}QQEVk&7SVY;ojQ7MM0!pa}bX-F97OAuqsxm2ly5k~{em++w#n6#SI2BCr zR7KYkl8Gq$Fw$sM5doP-2V@eeEu;#_r1)u>2&AzR7}k?8?CZ!RoCZ$xWV*^P69Lo{ z+Ej4zPP{#zsdWBCq<@>6nK0<*WG2aeoRgVax6s`+X@VUuMGRu7$ROsj91L4QkcO5T z#L!5B7(9A$u1SJ3pnFt6nrrS4$|@)C(c}qr83>8yg+6%yJ)M_ZD>^C%QD(36%r!A zK3mLq9eGbyc}vCKLcew&E^4C_JJ&nsl)kuYEKqt$I2O`SV`p<-YmCMkqG5D%yrxWf zGrNMMFtK(w+=dq?*6xnG{t8SP^66{XU!aO5S~j1Az}tob*Ug1hhCO8x^ud!~++0Vx z{#rguB#36lfvu@dJhh2KN8dIi*n$aZ0G{B4mNoG+wm;R&oRh%D|%w zn9Wj;WxDRTn{W;5)*Fq%dzv_r_C7?q)~j{jR}^KT0reeGUs;Q`!fxa8l)Ew|*$b(K zTze|H$VF!Jjs=jHxn4NP)ZWZYppbGFp$6$tHlAU_G@YVBL+bPtH!q0LgTLV3#i22S z-;cwZj2ioG1fd@L{ZfK`VGnJ;lHf$-)+S|Bv{(!U?UN*6QQVOmdAJ^!Kq|jiz|#^J z7#s*ucz;2Vog6nOX--D{JME6*d1E(1X}A?5m=n=~4F;j>6$#H~HM44z1==Fy4tH2~ zw=@J&rT8M)Ku|iH2t)=(qCzz>)WZw1vr`;NbEU61)T_G|DpfxT>aLWvP@ea=8?-#? z@khB=*w4$ohy5qH_q0EedoTN6a<}%NWhhHbp9Hm}Y62oN1G{(+udg8@H81oIP(gNa zL}qoniXZ?*91!42WMHTxRN;CRWLG~|yN;6Rp$<(ceLO`DGAG{N*C(0a ze5zFQ*Bu~n!S01p1TmuYkzxTl6)P!7Ln{noXe%0HuYh#zcT@BiSbp;Ri-(lIKtZ|x zcnI!;RJ-SlaqVx&mPfq2!$j~xeNd&hB1U&k(N;{)@pzqR&ZtQv7Ct-}YePX=w`v_$ zy>muPQEvAJ>KRZ3 zk?!k~2|&CDUGZvF*;GS#-vd(JQiB57lfu5sml+Z1^)S%T#Ef`%^I7rTOUWxNJ|YY4 zP*tqn$5f3^i$DM(1ovr)wEIu-YDB2!h4LrT-KQl`Zt46b{Q*p`^H;Gd|9*zCX&f#y z$7lD3xS4%K=JL#Rxofw}1VJauA_Os1aS%hB2x4gCK@2TaW9%a#V*Ac|h|L4G>*#`I z*$q=LzvF&fIqtPERxA_f;r&`H#z6;z=v-v%ub#X|u_Q*3hF1sC7U}zg{)f2*{0|X1 z{)g+KI1Q_Q+R5BbY1FzM)+rE_1vrs0D@$#65$mk4k=pIf34}*!#05raLUeFwSR+Vx zlqPAe^i@6u@mv6*G{&N#Q5w;KQJT&_tQlfn z5}oRwsthzalGwASdiL(Ia+gO)lWw867#e8x!rmRz38$0Dsi$hRl7PK)*&8zI?b3+6<0 zz_AJ4zfjWPW~wlASM&(Ej*ZR5Ee!#zTP_UPHj(yQJ`EF*{u?q0sZ&x9a7rY}x=r`= zNd)xytZNGUDw}32btNDG34%igBJF0f(t|i6(vRgzAgKpB5=gQud=e1Ro&F$Q{K94}4oyD`$bz>Aa};i@|LNkV)+EN1CWsAY@d)U zbgG&iqOD}&5;B#`(N74OFl8}&pqq}ivZSVyFBQSZBOREk68Nub;6Yfg0Y3z-_;PH zr%N`wdf7N>8R4WAfmo8LbopBuN6+!fBvvVF=~!?OgCxN9&}geD&pDE!)ap|kUyL9m zA}ik|A(2p^)!%*TKzT zBJIKZf@+X*UtVH&h)A0Bub{Nhm_``7gLC1uFF9#xS$nRuiY-z0S)|c25rN}p!OdWy zn!8_ECdE&WzX_y&lq-`kbWeK;r`6=7Wuh5{WFpGGnlxG_A|TV;z$ikfCe8}Wr1)u> zB;ksXk_71<^%6GqWTOS5F}ngOKv$^(0#!Le=t9?Ou-=evUN$MX+cq<=9a%RgoRZS%$P+`6)#{wyNuCVS zw=s7mPI!RelR$~I6#_~TZ52(0Hq3pJL|a91Ap*$6@ni-vsXkm6U6oNPh$*~7>3^lK zla-rySW>UEd&}wUw$|5?-s|fK<@R-y<%uHaxwP&ODtCY48Ro0{K1}+YAeI6Ul)c{P zB`AF#2FJik5Mxp&_>u&r!^7wVSlP?KOx_8;DnSe?3fj*oi z?w;NQKOp7Jk3)de8}1^FbbX(2r2pm0GHOI;8G=?%FCAUxfbB9%n1C=;-ML$3?N$qCO zxYUwR_C(r;`?43RaP~yH*$c%mCwoF}_UyY&`-FD0XPk`5LlO{gZ}dq(L@F!+k*)+n zG2D@WkShU445od5yAm)?9fA*50rB>yJ_(4(k$^~70->mLBp~EUz;TLcR~*uw1u!ms zy@3uTC;{>IZcL($fQTFkh;$_oiV=ksyZtHi)5z3S!`BLl} zt942WuBT@=AiuKp;G!SvmC(hiS7m85*^_1A$tDY?BR>X@;2f6P(~-4@23OP9!jR(f z^{TxCn|M&ax5o2n*JXNm>h(cBKbai}>e*g)WR9HPC>f ztztBK&0noq%ltL>xo2uLDkFLIV6kXa_5*ynjJArYgl5D(eMVcwa@r@LPNS`2qB#Uo zVm=aF_DvjT74%_5o0`$;Scu5LsdyIIS3uvB+9;x|aSz44v$7qfD!(@TYxvZax6LBw zvj-t<)VDtFDcF~%tiyZj-TjdU>9DS^YLFtYn8}57{q4OZzOwK>XZ`AZGRr{Uh4f-c zF?mBcKEz(&sRk^4#L9ubUsG)*l8&fDpH%pQC4CY-S z)?A!lW{(3Y-Z*bhlRIo$ePd{(d}9bNV~Qu_g+3x?QPTO61K+STxX{Q;T8n6vHQn3$ z_RyWssai9EI!ZE~&@@!OJn=l6`QgO#0=Z`zz-Aqro2;39gn)0&8=1snkFdC=}#%BHy|dIJ`dF#T+JXlu$m!s10&(p z45HoD3b*gVm)M;#lSW=a5}INOLsuT* zbTT>Vp#%}=?mu?B`x+W!w3Suk%1R(r8yd+FY2V`$iiq?U=q)6Hq;?;XlVo4`Bp|{$ z1J+72NHwSC1;$K729{rlNKb&~Q%46zGLqU|qabA32P{BgYp;KM8{vDjg@@;=5n(M%E zd?7^tqGE8m-|=4UsSaeSN>?PZ{OfE1Q$U^OTIA&K`>W-7@JSwjS!X6^A0J;2<71<; z3$HWFX>Z-W{6G{KEM{>a~chuSyJB0OtNwxwa&ko_96)(U%JL)H!L*HFKx z!LCg&%PzF+rp5)e>HQn*Y@^k@>+m5%`L8xTaYa+h3cF#~=7tq5c70QAdgh7+O^plp zYFIPdI-;R@*9D_S)$g=$r;)>Ut{c%Xbo9>sb2D4f+|szL!O4AALkl`TgTnD|v8JD7 z*RN`9UNU6rLaVtp9YlT~v4++y-f8iu#lwaz+G%KgUHyc^FS-!98GN-+w*f|ru@tYF z&f=2>Q;mg&Wi&I+7$*|p)sIKEGa?e?si7QRS^_T-37ET-wmMWN8a>NHUr8>&)aM?w(jjiy zqHee%h(98K*dOcp+kPAILp&}Q;KzW5zao68hQHppk&!}h9mok^x@F5(Oh6ckz6}O> zAU+Il-1xOW9?>EAx&XX!V;J7@HHD?fkO#>_@O2OvQp#`Rbx7`qrNF-UTo@&E;}MJG z>PmhLsVnu63k&jlTz*)q@VL{?X~${&Id;AdVdwXsvh&5EUsxs3B24hoEnlPhzS{DY z@4ivP*Qq<|?}AG&xb$n>$%Ce%G#};|gq`wy-+STU^#6kXrZ0*Y$KT=F>rS*5HB7RW z4cVt**@6apd`pYnxL`#~L)PhgzE7VM>I%bM8-2FJeu(bxzE3uxt}UF+57dJ$(~6tY zWG$#~YCNjG1>=MvdU!Ckd9n2$9Y)mc{g)HX$9{D38w<}oZ>jzDdF;PG{N|zyZ`>(% zUDdn)xS`9erkf_-eDy8H&mX#F-U_uh1&iML zviF8r@#vNF^Y`y|b$-#seG7W+dqbyv4m`c|vtxc*_LJThmfv&sq#fREJF)K1QyM2$ z4S0NFVgKSObNdh5_k}x8IOrhQO948)+4x(DjxP)I!K}|n>(1_J#AEHs_!;0~xX%I2 zCeXf%dm4WO^9Vx0Z#+`0q$>u->-pV2ft6g zVbuD^E0geQp~XhMvBGG=C}tmwT^3;^vlxF3hAko*MrAO84f0iZQr!m8BI9D@7$9&W zW+D10aJdu&?GBM9LbgE4y}`KISOQtev_I7>+)d@C}e*35I%xOu{^ev#2FPviw$FJJ;b7tn{f(~gT@wPf7~0O(;;~G-M3dq91Jqw#z3h^ zmHp=+9`bF(xz&9+l8p0`ILev`oiw3dmO<$67IIuCd=TlonB?aDDw0j|lFfo*>hZS% zD*E^GKdLhZpxeSISB7%*!b2Az&lddSIDXhRl=mhisthOcSH!+0Fyt^nZsxN& zAPXyJ>sk&W8byrRz^(=~0nqAg5b5t=HGJDx`2{_#E8dl{ZOL-QKLd$}G@;HGK-i{j z(p+sR-t`wu;uq&(M5lw%x!FDnB44({w?R8gy9Kgk5`VUN-2>S&Iyc({h<2kR$>N{# zSO0D$T>%!=-_F7>)_5%c4gGfVTrnpi(N^Z6Q&kWAeTEF7k%`PdQ{OQXg10vkE9;w9 zG#q-Up=OLT4ZQs%GTvYm2a&w<_urf*J2T&Q=d?)(!@t4_|5s(?5DcAn$5g&!D(@`? z-SRIzwh4oDh&5P=7bJ?NI^~)LxmK}=d z`l(pEE?IWyifqH2Y=b>xWrJ-uE^5HCJ%5lc8QF?>UcSBCox9G~!VGLTcKQk~3{1A{ zW%VNRpmwRSPAl?zbnWLgQ5P*4IR>hVb=!PQ^!S1~%>4}G5nkeq`_3X^UTNfG z#k_9#-V>)zN@(3{%^`5%9FI?lHN|rZZtE0Ka!xSyIvW+c`D;s7tE@>`mZdig9 z307JwP~1`MH%^n9WbA)^2x}=1j2|6G|O>|y}9l;`4tH8N4LU1=jROG2@_8kjWp7k zA`?i`XLP3QE>uEhEQ8sD=%FUIa*fC^vlnl}%}UF#GVflbPaeq?zVzl-ZZJ z(Pls1b}oz}=SboBMT;7nCpFeLSxcgkBqkZaj+0DtCK=nw9BBI%Z@boAhj7OCoOyR> z?)z$PJ9j7Bb;Wk*4*k*hY_T1>>(JfzJxKLGTBF^*$0slf{_ev_b-O>OhMk9wa|8d@ zfxyu5g#Yfjfpb3kaGi5*z&SI(^8!38z;gl{SMGVoqP2~86ux`+TX&r?;8UIt;F$oP z1>iY=59hDmdF4mnOuuZ*hco{8+_MdMfw6lAAPZCYh=z+F_x*?A?c2NJCq4 z-@QFvj6{{eeZ1iQ<34$ZTO#5WH;tT-s_C5IR*zEM5 zqV71iys6{dvYcxUpHmLQ9h;rOL$-i0BKWWTIyO7EP0byfo!&8Cwe8_;Vs>nHc5HTH z`?q7W)7jPx>@m8VnxTD47a!WF?AYw=*z9yRJG6 z!-K~i&s%Tni&R2A=zn+LbcsIQ?!1O&rq$To@&i1q&i&aP)_;5)_h_r`GETX&+rB?4 z`DoLre9qh1uig2m?{d z^-tg0dBMpacR9JfxjXlLKUq`P>zwXS_3Hap|DoIizIE+;yK)bBzm@efPQ2oS8K;*# zI&+VQW*_*>>Ol+N+WV3t-u}(wNAbDt_1M$p^Wo!Q=l3AYgZ6w@+}S6-7JI#|I6iw4 z4%A-Hwt%0rZ@dt3RdM(){Jn=Xrvi?E?j_J&1KcL?UxIKH_dLX1i?r7u{&e8DzdRXy z`GTLG$QQ4ll>O$X5dSay9g08hJ5gY|Fd!Q|2ua6KLW`%?ficN z!qMFKUmy?XH={Vz)wVtMeI_0~$ZS1v@C6ft@nphQiNi0O*b&47w#M0S98ZI=dTWHa z8h;k#wOb=^@68c54tfn&31&h|G{bGNo)#qQ*Iu%qPD=3PcspcaZIptnPcApV9&QDR zR+wMTTn+pdgjKn`+AI71IEWW2`?frlKNrbDg;L3aW&f;wvT)hI09mN);phA>!ZR(Q zvbX=N|HU8-m7Rp`m3<7JXbF|QZW~a{l)gl!exIMWTCQ?o4?+V!2>s; zvXdmY-j4-gsO%(cuk3yB^voEviA zd$^sv@37+~3GVCvI?fGsyd=T*E(Ygi10CmvI?fIG-jjf}NB__Nj)Y{#OA@f~yA3Z% zD4rpQhO!;6NeH}dzT?2q_kUIY|FgQA)c(6eexUdGcWZC!3|lfrWOZZ>-l8I}PQ>af zK8S-C6K>bb7TdLO9S_sPe!k}!wf`M2?cC05I2zf$+sFTkHOG!R{-1Qa9qsr(a8SIX z9Xnq|YIj|J+g`BT(T@K|?Rfj%zQRBQzrW+0&~|^$5HiYd=J-kcf5_X{?M65O{A8Y8 zaXvaR3!i@A_NIl;Ht_2N%kfc&iNH0;ix8aG^zR9n2T5kh@d$qMVTo{$yc3zaIK6Ob z!@?sP7S*Pw&%xU{)2r|T&2&R^{eq^3^g?U-8hpMiZ7oi>ENw{FXS4XOOjBb+Hr-+g zCcCtLk+n+b(hKXsDZOBgL`>X!zai<_OB=Ik{Ab!l4U6mXCfyS zfjKQ|%ra+415uE)*=kAS{h`@Lii1p-)gJ+|mg3#3o)A8b`%WxMjs8i+u%AEh<76yq?85iycC`N=@_U_BFn|9K_}e{kW^cRqTR7+af5UG* z^!l)KYo6%-;I1z%k6$#cOP5>c9^de5sd#n9{6vIzz+W#of&u&vStG_vE8xo-e10qJ z!v^rnTg~GB=n6dt=O=s=C)0;;#HGH+x={FL!GGmec^{8M>;tlRj}^bXv>aqx<2@4o z0fZ~Sn=iZK7l7Iq;#8a_-mX1v23m@4d11@zMwe-mr%uM}y6K$p+wwAovv{?B!puwJ zHRbvF$%3M8#YKgMMLoKfcJ9`@XR1%{o|Tp90Ye6*`_=ZZtjvtsp?2u75hF&V2JO7- z=;33B)QuQUCXxL7{G!65isIsm;e9Ln4*$1*TQ(UbNqjl8ODxjQh?YcRC6O)n8!4D` zp4t;s0t1f5;(2BwnO{%{f}6V-(MT*7jmPrx;&H^bA>N3W|I1!d(GJ$eqT8kE_gdc;m6M~&Wj%*081OrEmm)M>M3 z&)NTgx$_QOh#~corHzMYTUM-GwR+7_$DeTGNhhE3qf^g5=O;fs_q_8jxNyVeS6umv ztFFFg;|(|7bn`8@-uBzu@4fH-2Oj+WLk~al)YH#A``q&{y!g@^Z~p16x8M2myYIdK z(Z`>B`q}4SeEHSaELX%pucd#gWTA4Epj^>-9N)NSxgyb3EO<#gukSFk>-c>W^+%TW z8-8rE+k~@ze*Hc9{prRTTzu8W^*fA?Uh((T z`W2U!uD*Pqo1Xn_uX}!R`Az3O+H1`|N2U)cx^np+`qZ89&5*)HM)lq6$L9a~FKhcg zbMyRVRj)Vh-n3$`RlmPzmmTgo^Vi2bdv0RsH+_#=-M?;i=X<{X{mEnJ{NmvEUut;c zsh1|7{_0b8HS-@j;O(wgzcuCI$VVTa8SAq1uLr#Uk3%ng zFTLc|qdtD^&&Pat>6RC_w%M|M44%4oH06$_yj36d!!+ej?=E@&_D^p;_uMg+HMhSx z`PEhFs=}pDoc7oY=^IBbzdHHH0cUo5)=GYP)yzu|dbXwa0gs;j#XgseICtszl1I+I zX6XeJyUu>S{wHTgDoZaJar6vp^@W{&HTb!|wVeBO#T7S9_~i2LqhGk}xVe4K@BcHq z`nuyrbie+Io1WQg{wb@fUp;v0$`c1&^2Sff*F{nzjLeBnl zM}Gc!*L{{{qo>_kch@7`E}VBt-UatO{L1vYb6)Q8`T>vZ@#bAO-hT8eFIlgx{Kx#g zmOb<7;7$jBdh2JO?7qD>+3PV|36Gjr#L8h{`~V_9d>Hn@#{vF&fA>)=z-6# zd~@)`89&Q!`Ep>{lY76m<`>2Vk;g};GVlFy(4ZSuKfUSsQP1yw#EnA+9x(jngD32^ zx^jJ=U9Nd|_TTr|=k?w5_PYG#7apixJi7Mj-G|n@ncFy{c?UM6zZ zZ{IAv^|zG$dHj`mU+m^nvd&kr869~gB3qN$hL#p?I%bzzE1DKzuMuCxY-(DQUcfCz z*%VDTE>7=1E1k8Pw!`|w0+d8~qVM~yvd12FvMIdTymfcddgQ+QNvGJN-g}+5sa|0>xvCu4DwV36; ztV7vo+1wu;K4hfqcH$vatTv&j26h(Gcu*g|cQIb5!o5ou1!thWPVjepwQ?GN zE@)uOmcXmG!f?l{xEvc@_r2}>fBUPr3}eEqX%p0!Z4CpjeKA&I7jwu?Lq`oCMeXEa z6T>jB9%dN**BVAQyc6rOaR|?9vEfX!qh;}u0kJjP3k6ahyY8u(-;}O$1Uar5y zwaloDnXv+6R_r6-kBE`Ojj_vOCf;B~%0J2VYg~I8H^(=|yBZI~$>)nWV+->hkMuEi z%G($>jYAMNjbm^vFfPga2-h$2{*u?ph$p_nmr?uU+SS-IQ5WrJ9GkEcWyX~W6S@2* z!Bm@Y?P|P%Skw4K!o8A|e9z>lWLM)b39rP}G)_&D{zAF_3fE4?^F`!eQv4OZNqTFE zoiL5Et}NHYu4b&0(a@Fo-rBV;+R69?;ZDY)ZeN+E@yBkI{I;@<@jk}OxSB?)oSYAo z>(O$3yMmZqd+_=gu6>L%dXfHmTutNkN|v-!>YsfIj2+}UL9X-V+9KD}{!e>v0v}g( zq>I<>Zb_}hG7{Lv*oKzn-Lh%U)0WzH$Fd~4B`-+`lF6nlGkCH( z2?Gwp8kpdOOhSev5VCoO1f0MSGFfmkSv(;NlZC*L$NRpjd-~q)mW-1(^M3Pxe;aiA z)LHA)sZ&*_&bjw$c!!1$Yxq44BMH`OPShnTB&p#In)3G=KAa%+p4RXu8eU$<**Q?h zaebn$G&))SRF^5MkaH(9eePspxJko<2ru)#G@1PH6T~azy!!I`$+EDXlQASf zFI@=1OH?`X<18or=m*$n2+ zn?XKVF@q!Rnz3QVSb6gda@r75D&)=?&w|r_4j$ehzkoSVDla1ad^v9>ds#e_ys>uX zH@(U7rJ0$s$?^*gN6*TXRm;X%6=-=cxUN)gANx&jL*%hpY@uW}%fD(i%kM;3DsM+h zt(=@q9$wS1ATm}CH*l3b)9|AP@bDbAP~OO}4dG_u@rtXY(S)cP(Pw zfkmS+UpH&Y*u_klwU{G))nbk@t>J%YSha*LFI>Xb(i+~O;a4>LK0-WfxRhmTmp+eA zAvZ6bymYK=*6jH-z3|sMvy)}{ zMVyN(E+P(BYxp*VljSx|e;o0#@~ex;8dOe^~Qis+E^#iKGm6<6D zU8nU1?(*4op2)`b^7@@WN zuTl2$Omro}vKUU&Wt@iA*UT78vTlt$5W51jekt}^gy)oONBZ6p*0q-3RYFRCpoG}o zQF0yTa!u(65w6$pN)2DDVXE}QNbl0HSHm}H_!i9_()b~S)}tpsELG~4eF`nlDf8_&SZhO2Zu*zCptw4R6x$(;9wJ!^aSo%Fi_XorZtX@T>~9f4+tb zG+e9U77cf5_(l!irQt_3{Cf?*q~VhqKBM99HH=lV&2u%JrQvc7*J`*;!;FS+)$oHF z-l^gJ8ve6}Khf|d4a=+8=41^QYq(a!D>Zz*h6gqL8x22R^&8Ot(;EL#)p*o>Rqa&F8Ys_i1>ChSqX%N$WQ{o^2XdqsFse!(r-pw$nO3 z9`WQg8d^I&nr^LG7#@*f^2GR2sAcW^eEe_lPPP}ulmD%};b|pX&ts3TK99VeIgfq4 z8)1{&c3x0E-2Q{-5i7&wDUCm?waO>3uBC^|Cp3MjhHV;#M_r7MOl14D8cx=*NkgMj zc&3W$T5jh=j{S{V>jn+)(9m%E;zZ*4h=zuzwQTeIi;3qW_m3KuOk%uN!zmhCk4Dv| zNw0;pX`VzXg=hcoCI$3)P~(P`^~Dw*OHix5?cAnlJ?g$#N9fD4Bsv|?Qdp28gK`P- zBJx+fG6v}CXak@R`Or{wfyCrf3Rx?#lNGX7N+k~a$hA@?kE_3CP?p9Tq)fg%H)yk5 z9`m7A@3-l%iDpH0|w#Uuienj-%)5#HUK(XzPCu*#QR(Ou-`g=F(I~jJv8m53fcI^ z%9|82DvgsHma^oae6plL#>pc-^hn7N^zQ0qmiJvi=Si0jm6ZOqOpr%>Xl!YNOp@>T z(EQSR*arKSvmSfD5zxC88jOFS^cG3T13q-CLeE%9xlf_h7qZ@0<@2StqhyytY^B;u z$k!FJG1N)yB9^ok%QHUoEkIYw+N72IEudG*b{`sbR)f4s_WRHbK(CQ^_|VF;>gBca zTOWEg@?I;E?bb>!pw~%_54{u6c1ifq#{hLogAaWc&<;7|Lth89OK$d|p8$Hj;KnEZ z4dNzY1H3U6J~RPPx18%k%K-JtLLb@$C?h+3s25P5^!d>BfcDDQedvRL_Vb;!+QV%% z_3{Sk+GWt^Yvy@xkVkyz8_0X3{3dOAKUQc8kRxV)Kr3&Q$95Z3QrjTc%FT2fA#XOGdXul6zzGNs#~ccb20Wr`1d6wupco)6tqTQ5WM4j+1=c7r!0 zkNA*x_Ep}yq@l-J83X7&@<$(P0QA>V*K2tz0UeT8`OsB>-Ya{3==Ff!FM~dG9iR`& z%|3Jkpu^I2jkR(kppVFheCTdKH%c5{Fpl|j2p&>@xHcgSN3QG&hMyF;EaD1O~JZ};w!*j~2s zHhIT6^>UZo>_hKW=<_3}xny4Il4 z3cbaLCMeYTX66mb%rWovJ}HkW^ftLj^X|LO>b*jtvjz;>s?gnogbu}1V-B;PL2~Vw z8v*^%hYrE}_$j&Qpq7-|#@q(zbqakz9vX9>cb|;Do_T|yb-jFA&Qpk#|D5+}S#41K zr7^e2XXG_LboSWkfOh%N^s%?dXJx>LE=AsF<=sBCb?n35{qlD{w0-O`K#vKJ?P*akow75cIq9s88`fc)LtEbrLZA9|mc2XoL*y)Vd=w_Dyb$a_eh@u5Ef z`jR~T4$C`h+&1rFxpc^&rQ?3>eOZnu#PQWbU*4I6ws~KbFDqo4@@sg>yVavj^mUnW zh|pK%d*cW_?n5UP`t09mUi`Unw;(U|UaL3e+y+3``OpeL|0IVMV(;6$N8~<*tiNx_ zZ~T(%@0+sggF%1al*fFC{e4rKKV&_85p8}`UaioV<+ta0k;f#hko9m}-s0!c%KMf) z=+|Qp-~*kV-$6`~D&5@5l0v&k!1v z*H36b-ZMUQEuf#s<)77(%2_{?k18}MADvJe`I$W8L!X~;E}$2E=(y(1yWiS8sd;S* z8J<6rUWE+LpUd5TNz&}3{O$|dpK|$0+5bg@NSBjR^`N!6YGMPROBJ#q|u#z$&p(4|9bjmr%kKkks5aurx&k||H)-GDh0NN z!dITdHGVZhPhO|#T^jZyjL1QRQF%`;#nTiQen8VdqT!7i9vj12-$dxiEt+ECof;2Q z#_0A5O}`IeL_Ui!Di3RlrCaz7O$pcimZqFq3XN3eU$pK>xg+&r<-@t*xM31*GaL_> z497<*Gg5lE?)P;RKSdakUn7jlA4eS5^IjAEUJ=@1y#I9|g#4QFcDq~S6Rn>B1j z*bv!-upVbW47WxOC%zro8u`b>Q;}rkpA$cf)X0;G+vS?bbBUiIy}a&Mk!6udb+=1% zWHG|Q$cDP-B7>2u>;8nWvo0E~i|j`FP-L)fn|G)8&bspGo!(7I*#!R_d!hYy2t8g9 zU8X%YYuKvcP~_`%^|DOl9{|ES}unszXsvQH2jpd@c878=tGeclha85{p8;0 z@yM+DeTXlse-px$_0xgvW(~J%__q4%(btDGerrAKh{#v#Z-}$9g%S;ZXGL(^kd~M{l0C zHZ~+5pSI0AqUqz+t9J;ywf5MZ(MP9!%p=ddI(A6@by_=0{wqozjsALCM{K;rrr&~d zv+2`!#vVf5ZQlLSS54m&I~INO^ge{|oBoE_QEl@n4NquzQo~K)oWa=h8uwz#+ZrB= z*3PJxLo#*7JG8Guu^LSuuVGE>&C@>=tBbvF`rpPj$%)Cg#hPO8pK+geEP5EVmc@?F zxF@zO_K!0@hOuz=4IXwjovAo*`sJ5 zYf3m5N44br+G9=hEie-GrUV}AS)A)xvoNzUhC>=3iY%Jd5E+VGswtN< zZZt&iH$ob`4(a1%_pA@gco#$`i@!OD65NpXx6vNHYv7En5lYcM)+h| ztHwPIpV!7Uc;FhE<^ZaS-HlWygO$>p2QwPcsTasS>G=^5*s(=$7t4al+QNQOI`F=RkPxoJbJG;dGuOu^60JJ zXFk9$9B*8Zgi8Eo%2TYo7K8+Mms|h((0tn z_{rG&=P-WzoLSz<80mI0cJCa94`}*v4NqwJtcEYmxh(o@Y;5CuQJ(xZ6sc<*ia#Yy zjeixN>8)sd*n3LeKJ9&=24#M^T+uiqRxXtGO#d*_I~s3B`L|EIJ$_Q&-1vEf?`eD( z;T?@%L)aAk1}H{+ypm5gen(S&7_TXLy7A}n!N@NgpNl*ceZKM8`1q2kbDxWQC5z_9 z%UP?se5<#8?%49C5|yPTqyRPA#B$|HCCxp#8j z!`@Kj52!U1`A-c?o9bnzH>!!fOm3Qv_~lJU(AsO7ZZ97%Z*2Pe@*!Y8A$DADZo04h zuu|Yi$+uDdNXZX0e7=d)D4YK|oQ98@{}94O^QH@D;k)JcV=UXySr zl?cm)n!@w8&u@r4gfh)YADaJk`7w<@CHKz%S@|{KqUXwwmpnY*t2kcrt@-mHe||JS zUI9LzpQt!tB}>LHm{##r$xIEGY4{2alN#>T@SPfdSi?Itd_co*YWPD9pVbhmt75!2 zZsCH8CJoD_ZsGEZa%oz4X+_ezc;Rnhb*x5sD0aod=~5?8#I{r%lC2BdW7l|BBW07f zYhk@y?^4?J7iba@f@9IVO0f)}I&sC%&PbQ9eL*Dxry`{Xolv<{|^ynhY zNa+I_9@Fq~4S%BH?=|!mv&^W)Uq?Gv*F93P)tj{Vb{StfcX1SQ;G!{@Wm&TL+Z98y z0%5tdEUriH`o*_-b?5~=R@%3Cn>Vxc%?RtFLyLb=aU%Lrv@o;uUQPeJhL0=;RZD+> zkaFPJikYP^q0A=l9q?l>({?tMOjzPo&Mcj>q#<$$@~XD78R^Z@L*Bjf&#gSe?NkiqblD$jjS8`2lgFJjIN^)(sBAp|eS^C~3NH6{5 zk{i9&(i4-nd0R^#MSLrIVSM}Cjg`sL=awXO-mk3O>YbSUI;3nLyR-6|(!EQ%D-V>e zn%Y-6Sh|T)qLen(_|lH0Xu<1U3d_ptUwWIy(V923l&kS=xMd&n4l9O7N*@~YV&$C{k74Cj zwR+UxgOTjAW8QJ0L^>S1cG-feW^ZWOvZ|SKXxZgeHPIWFVeP9g`efv;W$UU=MjluO z3o!EVGFtmh;M*hK<4CEA{%9GjHSd?pZkL+qi_7L9CAu8;j90UqWfIF*#E*CvB7RIZ zEKgM(@m}M{yAbcuGL)a=OW(TuHZK`Df|UE^@0ZW=YN8J!UK2gO95$Z!qvf~#pATap@eSU$62 zQ~a=eeZ_ZipL+LLu93Nm4~}Y-SIcLs8*!BR5JH?iA*E7oKzO!%0O16UFOaVwK3hJA z@Io0t$ydnj2-}d`;r-|6%Blyw-O&}Wt}9DlSJI5|`jRBV`(S5Qmj0yV2*R32%&5Z0G9BYb6965)HxMn@+^-x+-{`oE%y*uvN+WB(NUJ>G6oS2C+) zW69^sj+IS_PmRyR-RsWy!T2ZQk@D5$SC{WCzqWj+{IAPDQvUVwUzLxpm{YN)VtvJ{ zDt1)dP;q<3gB9Pc_-Vxp74gaoDwkGXQu&6;4^|$jyr=Thl@C{bqw@Qef2b^}8dEj7 z>f)-ls=lhhszX(usrq8ov8pGleo*!ARez}Z&#Kv@=8sxB>h+`gN4;wlUb7-)*tN%T zzoZ=ZiYsw9e-v(QoQ<0Fum!V9>iB@ z{0a?!?0p<5_l&t0;lZ&i^EVpuHm}ItV;@J@c`nm~FoIhqQQ(rmozDog8S&ztHi8=p zl?Z17vk2}dj7B&c_(gC#;cSF&0;UnU0XIP+@Dp9& zd(RG2?xvXa5pM4Sc%bw9{i0;xQ?`F>aySw)g{x|Iv>>kNCYf*=Cv9m*ACvIG<*GC*ps^2{hxkAbxMw;y+>; zoHsLl!lk08&5XAr-iwnx#@~+kymwjrONi^gi`MmY_IIT&mhOJMCv?uv{`4HaUo(|y z?Ck22=IuTGeJgwRi$0Lncv*j1nmaqw-S%YF&$GHIeE|rn@$$vUnM2R$BIV zr1T3QmYiLKNALu7{m+6}W16VVZp@^zsqVfMzU3JHZisA7bs%{S-u<~Q)!lzNp0w*i znf6q+ui0K%dZ4v?M~}AC+_^W|-I3~C+mq}}W!mfs!0g84&QySTV>mf0u8qy9E>sHV z5!F1nmB@7`yV^6!j#OUGMtkb7r8A9hE9K>E?(gnP??LGy_zjf3mBsufH?hlULGzBjQ!*ZoI!W+ep%6MG3Sg+tHKhN^ch{A{(~zX+@j# zMmz=CC98TmQ`@_e**?Vf>;bXYrn^&a#*{f4`_sGAeLg|Aq+j9U>|kXwo07JUOix!A z9v5m)?eANi&h~aC4`}asNUrSf>+9*34ZHow+T`|Bmvk{~68|B{P}+RUS|Gq@x1a7} zO_sONeiqr!V*6Ple9vtry%Wo#v!`!;s_#mBz|z|2=*qMo=uH{m(+vaf#lx80eOMDf zX;n`*xEf0VE%_N)Y3#sE3kTPO5w~K^q?7o>SSnXnTK1xa<_w;h+O8vQ+P11I-LX5s zp99gPRA*2YWV6vVZ42f5)77{NbTvN0+u+uwF-b`-!z@(cmCa%~xyD0MU>i9(zwvFx z_NmU+?#|TyRr+Gz!XjXFkWHHV`+E2m?=|U6w$J+7up@`0@f}##t>aaUuI<^m6G(UU z?38twAZcA^$oVWMJ5znz3X%#yc0jS#hZW}wDQU+tQ##@8#8|xq{q@2A8`Bg5J0Ji^ zbhl2G5y0h6@0?nb`8dXRI4OFfH9Z6tM!m!oRGF#8fA9@n|((VvYAcOGj5K+1=kO zyHZ`fI)Rrbv#ow}oKJwjN?W}W3$8QSmy*j;eV3!Sjwn<-R5YV1#Fx_9uo^LiwuO=} z&@)-F3e-8-wp3bRSh`AC-gy zRO(p)@~W~jSzRNSWqSI1$^1M0NE2tp7slDXo?bu7nxNcHppjjf%t&u2zG`D*zLII# z-wTz20hvHWgR6R=0YO`u1ntS~ByBEgl7)?e=^ zpT^qokp#J@VhKwM_JPlYxqMq2IWSZ_gvD^F^OZz8P|5n1POcde;gx%wC6-I(s>%bD zL@qVdVUh-4t|XMqm2HKH=R}b&fO4hxLdg&aCN-DENmYzFzWvtz4NM{asyo zFjj`Cj$9G{b@N;)p|p-n3f4znA_P%!B3A&bk=>iSx^gW5bowfswgwh$sxz0um9e=$ zU?Ww)G(dAD-1u{2ggN7rB$qV5IB9|G@W+!YrFx0&1}P8>c_Yk;j9mA*F*{+B%jrz{ z)F{f?gFeU#5CI?#)ZCh)A{n)hDGY+OWodD(-It<`LR-UG@3~y+h+rc@bj`q)ZJc&L&O)Iqf~{G97+R#$tXn@x z^$^R4;nr-fg-$JC31AHh|D2H6wy~!d>MSIMd^0dCi~OWKDdMMvMO!E-5O98?Prfx7 z5N2ObX161V%huT|n5n!xjwUy=eok1B`ALqG{c+{wc0qq+<@`nK*Jp<98n?mRz(wL= z*0L*_F9`h90&(G|IxTEfoKjwAqJ{QIkr;3l-I@r=5Q z9l5$xuufz6RL<8Cu2yF!>;c$S{bptq%m8&wUVh=^4zqfKmW#x_pEZmI^K-avHe_rU zOz4+*7RuTnCtu?F=>>AvPt7S5$B)D6J-_fs8q4)iphW%T5d@aY z<^C%y{{8fk#FwA#R4#?CYbmU9{WP^sY0sNwPZ|@-S)vqyp$!I( zO9?b-p?(Ze3;ajON47u>f?KgcSLXtEQ&%PX@IEcwL{P>#kQ$hbC+k!Dd@{lbm~tc) zE$1>er}lv1T-ChUa6~Z;11`pfv%Mz-I0J(I%$(4ZHi!{dC=_qbhI3kX zz&PnUph;`tF!Q^!nRK=35_EBnGS6q%-`m@h0fNcyt1>WZ{Bood_q0C97J4!plYP5n zQ$Ieh)G5QY;kK1~)UeHYOtYe|FVl@|%YHhH@H(`8>wCH}?K=IMqxQ=xz7#E75ZD%` zaRhC{HGmDs@ENQ@&15DLcWvYotb$;-ZEmr`u7>SKTcXTF1KJK5&rKnvuF9sa z6pWOHWzI74i>&V9hB8!Vm}XY?bV0PhPXa~S2X7u7I*^MYcb)IF*;Y^>x2IkpIxcRr z?Wa7pGe=(_;Id(-s6P%${536sSyaIrM!-|q|t0t}jTZ?bD+4?K!NLj~#1 zxkW-b(aXVi9mqkP9k@ws*w^+kT9r{xbDbn8=9Oz(R@2DL zJ7&pIbWbX?6Ye1QX}erH4U(>u34w6ud!RAWBP9D$C0smfo+65Fb@+xjA&Z^ZFv)#z zT6ejOE%c?skHe&OLC@mXv-1b20_vd7yhKCM>bnAkX})okSC3`=^lSKKbtimN1c$RVXQe=UjBp_J~JI0DY%;2{MVS;rZ1q)DXJCD5O>jLs^cJ*+6X=t9$N@+qgZgS~1Mi2qs34b+sUhLSMBWWaZFHR3WT$141ortXJ&t$;3 zfyv55UpDAiNk%=PhTQDw&vc~LCA%SyGT8cOd4{((c>w-$g#)V+PaVMY9G z;~!4I=W4tA6m7pEj*i_bR!SOqam}N%Q|DnN6d2gH?*R5#Y?5;mPIG+j(>2SJt2_#W zW&BGMtsS_&z&3J`b;6?umkIRyT<`A*BWi@OM;Zq?QIw+m>cG2g+90Slozd(3qAT>W$TnX7A3PIY0gV#w9Q{2t`PEY$ZZI% z4la>slkO^kjwx7i1Z{TO+MC;VK^%1Egl5jympeTV-<{GuNv?<K~Kc6=#dgW|5sVn$$_RX@cqc^O`J3}OEUbHJ{GEemT?F(tS9@_b9H zpMjyP+H~l!=Nyybo`GFB0H3&M;4H~qN5Gn=2hEiLL1=I4_Ldys``Ly|%jax`93m{< zyff9^aUewT9A<0qIo&QJC)@}WxJkVh)x2jr#V|0!m4`ljK-|fwoSM>&Oe6RTwiGW? z=m3KTaIwMHXX>9w`$i=6HAGrZFAiyQIJntXhnddrX7HUx8awn(7I?_N7_<`WxqC~m z-Vtf(?(}0Oy+ezNYmK-#H5^(JFf}QGyLf*F#vkV?43k_2>!NMNofgPnx}15vC)9

W1)-)38))TqOk94kJC)iJ&~n#$z#@GR)euT7 z3!fThBtOkrIM}}JqSjEWXCFFYg`Dl72VT^uYh)eH)4|5hgwp$2Hh`2~rz66bTU48X z+GkQbe(mx~AP$(nHr2foqC5?^9Bg?Q?@Zj7q}h(8Zudl(6k>KQvISIa^Ur3q1K$!N z^}%y`F~tNP)T`chfp~<=k#kZo2QJxkg_$@>s0llyg?i5P!PIn(1%U3eph|U$xX0H7 z1*v7J3YgWRdt@sH-LH0u2?*eU{WX=Q(+wepTZu`uoYg%Yy94D(NZaM*xE9=~?9HZq z4esBT)7(`_?EdTs$ixqccsXXMD>q9pHOP+WTSG@Ro&peWwOb&5HBOtwkGG|EQk?n& zZ|h6h1j8GJofr$#pmBRpF8h&=W5Pz?aD}XAx`{(5m{}K`Duo+yM@k!U7Y}BXZy+i6 z_y_RHTqYw`y8D8suT1ew^X)Aa#LbN!jkuCySy4jU5Rd5^lfK>b-$ z5-|=D*|YCTh=869^K-Tku7YM&p19d+*|7tq{Cv!w`h(R1vlt}t9$r~X@>V6M*N+nG z)u|mx$U;Sc9;r58RojTR>jATlMbV;pYnQ`JcoKs!%x2ak_oN~0*gyfuCR)4oe3Ms~ zVdSgH&XN{u&FXJ%@^p*mEEh03#U`ZsUPxr@i!Mu1#QOktXDx1T#s(>mGU+64ESTPw zR#pz$qH>_A<+qUARI=`6DG23s$GRTa;`BGs7N=fDS-3N>+6s0fNK`T4C#yl5R|Sf< zZ^3*eNi%MY@8uwzW5kf90|cZG=hDQqa{k8MpS3`*wzj2x1(u7Tg0H~ys+!wX5opcQ zepXAD5#?1ohSVq+8+^wown@Q(elCFrlK$DOHpdK8b_&v!9;h?5&GQhkLLrAW++i7I zaXe_?VrpZpg6-Lt%B5*VI`_9^x-@Qv2aON~si3I|l)pi5)kf6szJ;J<&hiQ_Oh32s z$-X$-%ul4DfikoOv%7Fuq|N)%6nSRnvSv}i=1eAefR=|=$!S6EH$#UHdECeLf3iiz+<64He5q8o z(vg;;LMFlCt=^5Q&0r5ME8P31?7J!rE2Ndos7+c?KblJo<3rwd2lE^);M{?_S`W75 zxkMnq3sP(mgj0i?1fin2(|x893$_N_wW5Rl)*TpXno0TX1}ULhrgOs0T1rt7zvl?pbpmJu(*8}I2_Ej4o($Y zONw8>=yvZw6NyF0TEPA#w^HForZ5l|p@@cCM=`PJ%A}niP&p<;($992c+4sjN@P7> zUfNGvKc2|RKr@^ilGVi^nu!`R=~brrtvmA;LvzG z2!u^@KTTWWK@p>J!h{8m7`eAzo!Z{N6Sp%mdgoC!66NS+slcyKLxJ<*Yot(=5uz|uAjEaS@{CoRnNiIwZ)stxBWYCDPyM8D6X6zsNu zT~&71>W<8u-Xrz-umaprS;ySOLpO=R{gvEp9p*_c-PCJ{S$z|L`z3v>2aZegu4W4> z1zUQ@>Dk7%-c*M@^@NK>`hBQS)0RN54kr%=8E^vfn|t&M3%SCXN=)WnRB`3}w`QTr z;WuYoSDKq>@KsL9=Y&8&2p&wr1L54EDzkGdKY&PBczJ*r4Q2M4+oxv9x*>=ds9;&i zXC2)naId_fzpuC7IjigmLz)#_Cb`QNKFj;8xh}P5dn%J_TyNtw!h=jL+N!PsRs4=EG~F+QY;!2&w)y4{QzF`i%y*==_pC~0aPr8J z!(hTAp*ccBY+@n$!ZRoRv?TWqzSl-=5$nu^oR3F(FP1RKsPcoY=h=EX_Z+)F)zr~A z!N78+m)4h|bU-UMB#2>+EZvT#RZ z`g?z8ZP@zIQ4$R}C$LY{$1vev4|ej*v+>h-2^o=U%ed9lhLbJGqyvo`-IX3NZ{Fn| zSbMzf1{7IQY3YU)xG$WvGvmXDTydDAq^jGU!$cC8n|Nr^S!O7Z+ehXK6Mr*bNjS2N z@4hknB)AP?XVWZhv5hFeu9>n9r^k3M&zCav@dRErec-PnNyUJLs9(IahX9$TraD{5 zmC_W}$D(b9W5fKsxo$N{`(zFC&S)6yJwsrtzk&C~E6*U*S4bGx+Vz=`9|n%i)i{I> zQs`O=dA@ut5g1hPx4Ff}Uvk_kS&ulV>wMdK|Cx1tfo!u5dH82mC&TH^ zCFf%$=}&_~tmvDip*cI9is0-&6GJ+T;7G_7Xl)N_XA!>&Z6stppnb9%?Pm}+AY~om9ojD*g$2Ay%eA9a zkLEXP|F}nratUeH+$)in!CyBPrIN+UrYwVdA zZPqkWkK@>^<4K|ay@++9tXH!EV_At0yW!&#ij|aXzzbbuRPeRtCXq?&@maWTw8dGt z5_RE(2El0kCkBFV*Pv7a-z(wd@)8znkIa%XhHTmm(g(x> znP+pN`aqiHG8g~t)BhS#t{;EwyHVR`uVJDs#1yom#175f159v%3UQsB5OEiYjA{4B zgDpN<;gsi3z+#aFuK@mJ&jc6)Pl5x>gwmiBzbzP@F?~WVL+T#^vqfx3MKY#M4SM3H5{ zbqdOIDd7bX_=XK}#EV>Nn!&=H;Xcry2VY;2aX|`2fm;qzmp^C4b0rg!;E_)B(2WtX zAL2$KwNIq7IhQA++K|J!!;y*z#zNuKq4dVH)u=(t+-K8$tj2Rm6_*0FM{if`ZBc`_ z&Zf9x*)00li5SXEG6CmO3fjhq9p0u%GfDch zRbB6O!>3c;;p!^N$*NPgz&YB5-nptxS|$+RuQSu@dZ{N~91&BDXY%QYIh@W>+d5_M zZcR8IV4I3hy~E74G|W1v4AP`#Gg`&%KOOIK;3zdcg{prHsY(N`-Odoi_m5r=l3lB+eHM0S&#McOF*w;AQgIGi3XOQPWxX+S6vn&dZ&X$K~w z2P|dN%cYnvHfR@aMTvg=QW0`tXVEv+W*RshK)+@_ko4@64Bn;XOwND!0c?5hXm*dEg;;Ysd*yy1x>AsqS1 z^Ta8@5K^do4KSghD`y+$n(kbwElcGzaH7d9xnLTY#@41u6-R92GO3%UWTV`nMaW(Y zN{pHYdyZox?h>6N9@=k1Pc&#{oQoy!eZXdv@!P$Ct8SXsOR5gZZ(AlzQ=^>iT0V8K zF`v{YfJ+--N?po18t~IFV#v3;&Ev)85-;0}3G*@8O0%mBtY%j0ZP$EcUn zn@Ho9hB_ojGo6~yRXt7n5tM61jJAo%6kvihuI#+DF{GK<&$Kvvn$*~sIZE;fsmFOD zmZq60KR6y4M+%cWZC+`Ql4k@h6wnd#YkGl8hxUeXmPvO|!PlIW|M|<%$En^lD{acQ zkvL#<3ucgf=+^;9gl0=e#kpZ0%99gJ;E*H2v&b>ZxFBy0#^f}soZW`frXx7pY)?kD zBh5Cm)DJ0>uH;7+&kGn;~|$OOkLG23h1Xl74SU3Y3}?YBLLBF5IrG_*i_ zj&hwFW8+lL>jBsDcpHCU-{e-u*?~QiO9PKyj#j$RL;kiiNcXY8oDXl4`}yN(A*AqM z8``4ACkC{bWK7^x*a%v5YkzV!p47uwXuFwpO{+Nzm^JaJJxc1DtI6oRkl$=Ait0^D zuDp%3$_JZEIos;w<(G3E=nRkR)t=eEX?~y2fhS>`w|4Zu9gx%z8?GK&$Q+-XO$o6B zDdEusDlO2*X2Ue*NTT7FcR8LTxU}6%B%xSS>SRT)edJbQa5s$cC>|=n>uod ztI%pETEQnPr;l8UJm4HZGH2v+#FEmDR`?rG2W#sTBj8w6vXnbH7cOm*@6_WhEK@w* z!V<%ex3E;+ctay7ESDR>1V0j*?;CEu70?csJXOe%<<}X-8>ovV&Tgdj@)zxSLF1<(lD%_d_aI z2iBF-AY5f;U75r%8;)ah`v|;z_5wF9QVTCuge63S+L@G6!+ElGV|IpYp!aL!{<*WF zbwDZymR8p4srmEBJw5$63Dqsedsx?F+$3~Cs6~^0x0c(7Fu>dTG8;ADGX=|Z!|8D%ElOHY8Sr2r>9d#t za%I4!QtvpKoSrYe9`9&>{TG8@alv31NS-;-=Twbd(EM=duEt#9MVr?wQ zD;F@N%WX#TJ8X>vy+8#&& zw-e1vt^7a@uY>IJ?!gEkQm@2Q%?X(@9g*$4w zCMX@A*g`EZ1MjO3J3MCMZT0ynZ}RtAoMC4_@R*RLX5pyN%Fn_sIB=WDc*^GCcKUMt ziF_0&v!>y%*=H``R6V1k-IBgh{fIipR><@86jRxqsy#g`pirV&;lVN(>5{*xd-gZ z9UjY==|=;RzF6*&D2D8mE0E~0CKjA}e~@pT(p116;MLB$w_Y4Om_Nz6-R+FQocPqJ zE}huzRGWwPoGmQwk_aV5ww$_cH)?BwlS$9Qc#lnik3gAAP}?r&^rfl{p0v}hLUB9X zCLk;gCD*Cs>OU`=C; zHSmOlYi4Pw;&xFn9m2jC($DN@J7JZp>~}aXg?Vk9Ibl$+v3ArPVMfY)pU=#~-W~ST zNQQ~;^_erA*C!ZHemipYaHZ)8w!2g2H!@!(-3y%0@J^v{c3MDr@&G+yxP91M=p)ZB zA1>XPJFQ|}diuy2(to9Lhh4Oxc;+0_@#s!Q2%8;GE1NmSQM__vZ8)Ls(#ahTN7H`h zMYJIh9B=*k8FqNoEcHL_2iPUUz$X& z15!MHsgne!D5`9x`1=$pnkxDj&r=|WLz3?2X%PeFEHnn zkY9r1cy}SdE@N;>+5vyKMBqgaT*JH|)5%?ZmeJ11?jPh|5a63n zQ{Q<|qSquRxLPxSuhry^T=N#$fe3pbRYtx}@6@T*n#o%3sLJFYT|nG4*wF+JTeRfa z3|ZQ62>N8&@Yig4-Gu_Wpe5~-wa9aH$dFg?+#llIIVHe4Qe%DDNCSLX_vQYR3tfp- zIvN@p#jYf$hzl^prF#1>G*-Q~=hB_3DyY}u^7-3}d9W+_?#frdv8SZ;_;4#*l!A7I zC3!jFQoN{0HPDH%@}e@w%9U6^XjUEONKOmWU= za7ojj+m1|a3H8i1Gc3*n$MQ3{2e!NQSybSjGdRe$`%ScSDSS)=h0!uC)C$qcQXwlh}PfpyPrDTAmMP5GMD z!0S$w(P0!UpX-Q*GP|Uvvtw*C*qme3Tmh!i%~Ya^&9%j2@Dc2a*(9pt9LE8UzbTcd zHT=g?#!($pn^Nk!GBEk((oi5*&`_iah6kH5QKtG2fE!sO;3wI{O##PY5+GcUX+ceM zakx>K1~OSg4bJt&UZLkkhid_&x|eHNn#>5ME+lr8)$ZW|YU<+pGHyNk945VvSHb9n z;o8G1V2fxWb9#%?!uYO5eU8nia?Mp37qy11GmK_Yp}q-gVWTCn=c;7?CUvBx&=7Yz zCS02zcrTuRCl^84ReyOajzi=Xr`ra(qL_YRTAl8wUZxdX91gqaDLnFQkAY8{%rIsr z>yjyG0Xr$d1#Aq-1;!Y6b7mNths<{0CX;A3&dKE_)dVvJc5LTl7;k`(9qrjDV|`n2 z?2lp~xa~yj-0s(|Rwlj-3a9D^BqMc6MP_O9iTTXl1jYkv^e0jUhwsmY|mi9P+H6i<~&Z?^5o&S{}O z4yQPoALs*4YhXRPi-1nqaQ|oza&Ql_L-D5cq`W8lgszVj@ie=#T*9t>|;~p zh)6nMOEsr(0>Zd6o+rsyL9>w&`rw^rDK4XX598tQRrd$fQRk$RIT@}Mi zNVYNjqQZOYbl%*fy}^F35gf(^J{PW~URi;7_!{nN%nh|9uh>sR+beKmsu6dr8U+vY z`uoA6-QIZO;V#{VoleD8-h7b>w0ND{kGg?I3anxtY*l0(CosyK@BQ0Q_LKw@1 z+b;H(6tg`S2Nx7;Q}yz=kyZBAvNZE5S2FMa!XeEplm0k+P?U%?LdY+-}3< zigk8hp`@Y_YD&hLsW!Cy>2bBl1MZfl*$RO&qkTeNB;mLgDNsoW62=~qwWA)pJj{Cb z&;m#_)nQ>cY}Vn^BF%d!VoUg;Bwnrz4w2jhovL@k%Z}QD-r=%)c_PuIrYSWCPZ6_Y z>ToVinvKSdju^)6%*j75;V(f)tx}l*{ORV_nMG7afH%+BW&y5$7V7spKPCJK-naDep)rE*E_t z!6ZtM;h(z#M)jsLs6NOM+ziqsc>s8GK~hxEp_M<{V0nW_9d);jx3N*p8;mWK86>R%OM-nk3Wx655 z12>G!`EzQ@0((9-*owD=a2r9)VN=Pu&fmbFa>RZw8-Op@Grk4-^1Y0Ay;#c>oOJqu zKNjTo6>e+9xyO4SoFO@)J9ThqIHenC2U@CBpW(xz4y2gX6j-7rEXlfj*x0sBoD>S> zfY5f;fJ36dVJW7#jY6?K>2wrD8kf0U`e!W@BTk7s7Z4|wEpwTBzS0m7QfNUS@40dcB6Iu=3nU_iDJfzYM(ddV;Ww#<_8J{y)RM*-Wx8& z%|%$M6?a)UbeaO>YFag1Q>K9Nf>5NvA*#nJ$Q}_DR@a# zQ}Q%BgIf7}BRdT!n&AuA<$7T|0lr)_6pUum<*yw7WMSYvBim4RY#B6JIFHsuvA4r5 zIO7>3nqzo+T}{puJMuX6Fj2xzz7ZsDtCNMr1TAhqSjL4TgQIKUuSX_CAblKl3rRr_ zQsLYWM+QT)@HGj=sDc!8g3D#6L5Nr66XNB2pxsU0EWD74Q-j(0hL1A{+%r6U@J@8bH9IgY(gtM3iN^-TlF8F#@g0@8~HLcX5Nr;W@koVPIFB=Ck6 zVn?wpbJ`Ko1Ye7p?ll?tIFHIPEka0}hWlG~zKW7$IdL zwK~sYDg5!!h z0BAi2bpms2BYl)ju8WxT~`TasNUcgNm^{kP<9W4;=cEuZ_d~R5|b88YVZCCB{$`2eK zi7a81skNv`Z3%JC3khV0?o{-=7ncMPDPjqm(&v?SzU#r6zcdEySS~!L+-;lLi=j@U z%g)&;S7DgEwR4rOrV$0(B@WMUX~U9^`+U5@Yt72Yrc>81 zuEF;&+bTC^|G~ zH_+25HFU|)g6Hz(QkAnW2Zq#;0b9zPe7y4+rO2ss%}9%oebREI9_O})))+s8QV?yw&j-+=jujrF!ePYfK+;mh`Ixp5bfe^r}5Mq6D0t%5p^ zR>3ADpIWEo1`iO<7v3auhprzUa?=q>ryW!6wj)m&IXq{ygb8cB#-k3m18@()^l2L; z47da~F>Ql=MfX71PZ2>b;C%#li-{Z_+#6we8FOGAWbP|nI@AJqBe4?7Ssk;5fSUgQg{X)(-E-XrIBA%|R)K^yeeT1)0% z=M^10Tygw1+y))z2;&`wP5|Z3!WOI<5qDRXrvu?J{KW($KTs~(+&GlowS5{e=G-2B zz|JA$CMdiZ9Z6Y}2O!2hB&|tk-t(cV;cX{kKytem(y=VXgH2$tM7a2E0>FXOT}$gx z&dfN6ZCj{EojBD4? zP$~s=Asa48=cwBT47t0dg2>&hs&n-$mpnyn8FDV>j3u{xTn)R=OWrh-$ED|Mep%)W z!s7Z)&=0Q|L|?wg)=6o~O(zEnC8SEh6(jf4j1|IFVTWCe1vIj8%W1w8%&msv6_B@T zMiUA+Tt?^bw`6o{9tYY>%}pHVbCjT^@Qh1&BczJjGl;z&aacB^g3(~c%iTQ4gfLwT z?rV>{?H#$2bL}{r#7r@h*LKC7qQXs=-K3ykvJ*{S_n=AYY!^F951uEr{h(PhWKgF{ zIbDQ{dxscXvKQqjC@2QoP-^(Mv=uUpEDP@lhO;wVJ0x5961*%jG@$) z_%^y-xHt>xAprf~qMz zv-z|d;ankgdhV%_+HF+#8sADuH5u?mKCMKKj=uTpUwz}zRiF6ls*PWMNUA0NnK!)V z%JB=I9*Te9u@9gBncrQpFIrkV34e9?n~J}gQM^4lmhiktX(HlHtes;&O~_h=zh(Ga zfxl+_wUme#pHv+ascntL5g=_H{x+4NX6?G#O(kfic1x*vwOebqAmeKMB{h*@b!}1$ zrfQRs(&|WQggKL{(SHPg)zKOFEv;?9UmAaV@OMr8-b=P!SMx;0asd7Kn~1+D_&b2V zYh$Ig1A`3S%3z4Wdl(#I@O}n|8QjR=2!mS{m5H&0)J`FMX9;3{c#r1wmnOVO&A?IO zIk9%&)Bf-M{_p4g--rC)uaIulu^DKu1Ob|2cn^?Eu>E6k(j|d(c9|$mM7`?jYIIsN z@QtWQBqm;@8WB(w8EhsIjY|Yn_G(MC?!c|JX+`o@^i&e_)Pe7v4w@84%|!b<#v@skXGsog)T;qRI7JS$hD^79-_eBfr8A`%-Ad7p@sMi2nr z+}7MAF@ABylSi+p{Nkcl?0HYsvY$P0>Gvy7yng=YZrpqEdt!fj|DpTmWYXU+|I$}q z`?V`C`tf`3zJ2`JUpTVjUp_W!XZMre|Jt-au6gmNyW}6Etz{18@>kJ+`P!%6 zz4&XB#cBrX+bbiL&PyNPgItbqHgu1 ziPhDSXc<`^^c!5pAIwP!rYjyd;Hdr#u4CH7bFJJaOWR`5R{ObHaY!1_VkJ@_<-}@B z+G9!Al$4>TR<4b~e$A>GJfKytWr0bx%~o#Ee%@+7?}?X1Y6sKE)lt7chEXrlS~p_J zOhl|^5L^vX+!Ifri7%wY}#!&=I5iMb` zUTt$cUKWeT0YzdSX1_dvddI5qS0)j!x@PbpG!9}_mq`rVTulb{6ua*e=i0#&3jD-? zllB89!?OAYBmkugeu&4x8nP?MKT!)E9D`-xRgWvHs2%)#EvE4}%GDk$uRS=bHW81+ zK)=>9kgo+bwE9#ceGr_0StBWG4}vsayml*xeXyx^3o?QGjTm;kEDDi?|2V=FmmnG; zF_RcF-iD=Ei=IYx1_~^0{M2}q#7iJl#a4ty)mzP-!R_#j+Ye`o6SE2Q?1 zSi%3&RH8$_D(!zQnw@mvtCb6iQA+SrY4~DTRtw<6ZbYvOUv5tH+E;Iv6xW%;Z?Nsb zr-tzg=^csgp6*lv-z!YG za#s|$y2QQ?%@Jqu8RJA}I@{ZoJdoId#`dOD`#7d#_kl!z_nu@oK7G}hz=sF%ZO4Vh zP1UVUcJJ&*84|2No6bZ^_`JklIC8YDXVF=9j_zcA(Y{ewGgz zor%=`bl*%*B4C*ke0(s|=UtM|JXQWz;1av=S;AOZBoZl=sIIayC>oL4G=n{0W3N`l z$3ZAxijRR?xrk~GZo%rSIe4`J{tp%%iXTkt&%hCb_LNh!w6Z3b))cPVfjdi)IB+Kx z1JuerTqXlgl;W6xKhTW$p_1TwMcqaCiKF`1GK5dCjQ)RXB*M7LQT(#SgZ;!D}H1YWuOiMwOL8^b8!0$0Jx=?El~(7Go7+H3#2X0ZoO3Dny9^ zepE^JGs4yS9!duEGk5|et7{J)LTn<3a_~J&J~*iI1`TM#?^nuBoXA9oHySZ<4hKym ztft(<4>D?iRPDhVp(1aEG{L~B8;}rJV%=&=#He-fo)~aGpkqb`hki7|q%9OL=c*8^ zQpxi9YNo_h@E)W{#oRrlczs2~V@R4*4MPpsL39I$+Jnat@detXDCh^iV8z;lC+z1Z zl-!We>mooNGWsZ@I(r8xhC#1oXO)#91Xd?8M+Z-8_q7LqY1N-qQu)9ymE_klggI0e z1quU4F(A$h2h@r(duWtqe5gpBpRAS^> z26-SeP_B-Qf|9`)2JT@c;D8b}tXqyD11S(hyJ)H5!n+4t0FweVLSe90&GoHdEy#>W zTu9qVwc|0b2+KW*@q3mcy1IQnkDpam3hq7*=JuzAZNpwhSi-Kk1`^7{S1X14$%=#h zG&hgumIGBM7E+Wy6RS`l#aW9^s)oWW1prgcZ@mI63Kk@jf_18^$se_YE$$a1gEX61 z2J%BTO~i=7SvA*R4T*#y#bW{%ieNd&@asKZEu|(Sw$Tz@L*~v_k}9L*Ydx zR+N>)U=}d^IoLJH9qy_|&SN-UFHR&Ru)tG4C*VB+_?n>=Xr4!AKi7R_D z_ylXVXYX+B%|pNQ<|j7pN_VAu6RR@G^iCAR_hu8DiC#8=uSKRZdsCfoDopdF&Xi^v z8Zgn9Np`08Bs05dU4#aEmM4|-8y7duZ)}=Be;Ga}7xyGiO3C@EXd`3!&FA$!-MR0R z;zQ~^`?B8GuZU+p-8(7ynV&KMz!ge0EnvW>__?^>jKS zlSB2-O-AItSdegEY#{)8k+&gi!JVcy9E5DZao#rkuE(XY4O;l~v0wi$;se`N;`1W8 zU%b9Y|FOvs8k)8mp@&v^8H4AmJZx-Lk2pViOn)3}@o0iK3i!%rJHVvZ-2UAgI|oHP z;M9jw=JPIY={J}hPd|#x49K&!-*D}%G|_?8e4@CE6o&r1zh)t-MHyc6|!6C>ctFy0~;Dev1QWLLIu1&qZ1 zmulVo%g;O$Jl*=FA!N6%!AtRr{UAd83ke{~bN<=C0h7c71A-X-@E;-%KKLMhnevkU zFE72s82<1dlNkIr|3e?A{C5}rp#Xxz_{WG3KTr53AAaGkyO^m3K7rzdZ+hva=UIU; zDxC^O@x1&(_^!KN2D1P}(6`tPn!pn4eA0f+L7 zVT>@Bk6cu@knJ&MA?Z*IYvNxJ{5P{ju6gn~`8a_;$L9lxyMO;xe7>XLUm;0AMX=ya zFTH^2d;X>8L%(KCH?9B+WgCaW!11by%2n0EB?~Ds= zx8sJ2fQoCzeH8cLh6XWFjK&=ucTKdT#+ayyafykEarnMJPu02i+@1!>_m%JOpC9v@ zzUNfcQ%^nh)KgDAwLRyIi(eK*K@b%9d*Fc}xQD0y9cRA}{j-zgfw6lBg1gK2?{`nn z>G$t<{?*sC#&2k*PibEE)bS@@cK!9~_VLTF9B=Npe*Bv2$4@%zyz!@|S6n&W-(T6^ zqdxoOAUM4z3dUC5e0Ema4}x&NYELN$#zX#G?7Cz8`*A!)o#F=_-Mkt7dImd5C;pYY zL+W+h3oJmm^Rzcb*uO6w9R_FV4ZOb-6Bhs576yHb;~q|UJP4>k`(KIhW7?r0nBIQn zGqw}nf32_AxT8ARG#i}YbN_%l zAs2k)^$`v{!huIP@CXMU;lLvtc!UFwaNrRRJi>uTIPeGu{{O@Q&8zvRxoH^m2FX}Y z@V2!*LD^zEKWC3KweAET^zEPi^zAe2%B53QZ2IZWWe2_R38U;42ZUw+lD>reU4x^sSh&o9n=?_GC&=F&^|KI03Q9Ju_>p#3@ z{npq0`+FAdzwAq|9{<%Dn}7bH!c9{@{-^Q>E_!w4)9-)h+4tP_-!J(2A*cWHm|KSb z?2sczk6n9L@Y4^Kt3UYow%RklcKy)iLhuBr>j{Ed7^Q22ppvfRCrZcoO~&~Nf+*e3 zqLjL~rxH&c5GLy_M)3yO1i=kH(*{MdU{MLeXbyH2f{9>gb5BsE9D=o=*$Z%`5yUQD zb8yyFYC$+FXiE@$jd+$AvUnrTXLRJ#g_n|)znJ0OB$^bO5RNcd4vgyV zVTSki)TyD7W@QLR?9w6M(PlUlG8|EG6fmF!N3xMxH&;`;luVVWzGONK;`C&G8Y}Xt zn@GL$3X1N~8wRV|v?K>8cQs5XC9dxc8$Bb7Xkx8IG(%pFCWSmrcY_O=tOfJbuFz~i zl54Xx0d;a9Kj~RLR4ww+scHsG=f@T zLhW)BP!+3V>k!^NDSf4rX;5lq4X?(xzoU85WMOhBpy^@C+1L^${g6n5_LrxYk)}|3 zxTW=Hphs9xsh0Cd3sSE}P=p_==^LYzK_k?H ztt0)#9amHD;k^;P-WVAt#{w3FCUt#bu~bj#&T&xcU!cDYJJu#=ipb!5L3!eMq)q>t z{GCWw`!Ii6A6*YxiKpW4Ag(|_Vyl1Bxp(lSyVinXMB6I+TU8dUm8oc?tt>23t!K)j z+Ca)u(+#CC9fB?ZTh~HNavkkHe;k0xl>{rXb;s4yBkpC*^niO=Yx=FxQ>RlzL8Ct? zZXCI&iiRQlwz#hml)T)(1)AwG$h}lT#qpzROJ?`SsB68qN_W>{dnBiTX*fNVU&aBWX>wCBeGK8Lb;)CS7~5ulhZLlk z4{>rDaXGAmL2*^{M(_@&s8WzfwEmcCEe;h?mQqteCW9J35Y_-C7a$~U8B{#f1efz? z9OpT-ISS|&!GPMhbvngX!dV)xfSTwlO~H8=?60Gg4=C3PyQ)EP{_j%JELv5oVKEx*^u%^u&pSWZq`Hc(UC@Ol6hROuu zS$gdGW}q1tdxmK`A~drI{*yjZLNWiM-r-15EQ{&hj965>Y%Z;gQlrm7tVf$^%?`7Dh@t5J&7M zha7Wln;^bNHB4T@U`KG+y8=c5=@VzKgF}2*jZ(UO#mv^rhj*f93c>t6{3e$Z?ZPld zwjQ+%7y;mUyWzve$rz^l!yx*qX^jb|HKdK5Y*dPcbX)^bqr}^OHY6=pLtn&}ECkO5 zKSV;;WdFPfamAojY{)OyZ$pWN{f$dQORZ~Puu?IlSPkN#-uh77SgEmKS6{Kz8lxnq z^=dInkCCF*s~&B*zFQpL8`Bk4qBSMtM= zQbUPRkBO00x0}u@oxYC4^eG_LOe{|6OtLpO@J`?AqB$;^3F$zVq8Z(}UmHi

- /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class MassFlow : IQuantity -#else - public partial struct MassFlow : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly MassFlowUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public MassFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static MassFlow() - { - BaseDimensions = new BaseDimensions(0, 1, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given value in the base unit GramPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public MassFlow(double gramspersecond) - { - _value = Convert.ToDouble(gramspersecond); - _unit = BaseUnit; - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// Numeric value. - /// Unit representation. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. -#if WINDOWS_UWP - private -#else - public -#endif - MassFlow(double numericValue, MassFlowUnit unit) - { - _value = numericValue; - _unit = unit; - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit GramPerSecond. - /// - /// Value assuming base unit GramPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassFlow(long gramspersecond) : this(Convert.ToDouble(gramspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit GramPerSecond. - /// - /// Value assuming base unit GramPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - MassFlow(decimal gramspersecond) : this(Convert.ToDouble(gramspersecond), BaseUnit) { } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.MassFlow; - - /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. - /// - public static MassFlowUnit BaseUnit => MassFlowUnit.GramPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the MassFlow quantity. - /// - public static MassFlowUnit[] Units { get; } = Enum.GetValues(typeof(MassFlowUnit)).Cast().Except(new MassFlowUnit[]{ MassFlowUnit.Undefined }).ToArray(); - - /// - /// Get MassFlow in CentigramsPerSecond. - /// - public double CentigramsPerSecond => As(MassFlowUnit.CentigramPerSecond); - - /// - /// Get MassFlow in DecagramsPerSecond. - /// - public double DecagramsPerSecond => As(MassFlowUnit.DecagramPerSecond); - - /// - /// Get MassFlow in DecigramsPerSecond. - /// - public double DecigramsPerSecond => As(MassFlowUnit.DecigramPerSecond); - - /// - /// Get MassFlow in GramsPerSecond. - /// - public double GramsPerSecond => As(MassFlowUnit.GramPerSecond); - - /// - /// Get MassFlow in HectogramsPerSecond. - /// - public double HectogramsPerSecond => As(MassFlowUnit.HectogramPerSecond); - - /// - /// Get MassFlow in KilogramsPerHour. - /// - public double KilogramsPerHour => As(MassFlowUnit.KilogramPerHour); - - /// - /// Get MassFlow in KilogramsPerMinute. - /// - public double KilogramsPerMinute => As(MassFlowUnit.KilogramPerMinute); - - /// - /// Get MassFlow in KilogramsPerSecond. - /// - public double KilogramsPerSecond => As(MassFlowUnit.KilogramPerSecond); - - /// - /// Get MassFlow in MegapoundsPerHour. - /// - public double MegapoundsPerHour => As(MassFlowUnit.MegapoundPerHour); - - /// - /// Get MassFlow in MegapoundsPerMinute. - /// - public double MegapoundsPerMinute => As(MassFlowUnit.MegapoundPerMinute); - - /// - /// Get MassFlow in MicrogramsPerSecond. - /// - public double MicrogramsPerSecond => As(MassFlowUnit.MicrogramPerSecond); - - /// - /// Get MassFlow in MilligramsPerSecond. - /// - public double MilligramsPerSecond => As(MassFlowUnit.MilligramPerSecond); - - /// - /// Get MassFlow in NanogramsPerSecond. - /// - public double NanogramsPerSecond => As(MassFlowUnit.NanogramPerSecond); - - /// - /// Get MassFlow in PoundsPerHour. - /// - public double PoundsPerHour => As(MassFlowUnit.PoundPerHour); - - /// - /// Get MassFlow in PoundsPerMinute. - /// - public double PoundsPerMinute => As(MassFlowUnit.PoundPerMinute); - - /// - /// Get MassFlow in ShortTonsPerHour. - /// - public double ShortTonsPerHour => As(MassFlowUnit.ShortTonPerHour); - - /// - /// Get MassFlow in TonnesPerDay. - /// - public double TonnesPerDay => As(MassFlowUnit.TonnePerDay); - - /// - /// Get MassFlow in TonnesPerHour. - /// - public double TonnesPerHour => As(MassFlowUnit.TonnePerHour); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit GramPerSecond. - /// - public static MassFlow Zero => new MassFlow(0, BaseUnit); - - /// - /// Get MassFlow from CentigramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromCentigramsPerSecond(double centigramspersecond) -#else - public static MassFlow FromCentigramsPerSecond(QuantityValue centigramspersecond) -#endif - { - double value = (double) centigramspersecond; - return new MassFlow(value, MassFlowUnit.CentigramPerSecond); - } - - /// - /// Get MassFlow from DecagramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromDecagramsPerSecond(double decagramspersecond) -#else - public static MassFlow FromDecagramsPerSecond(QuantityValue decagramspersecond) -#endif - { - double value = (double) decagramspersecond; - return new MassFlow(value, MassFlowUnit.DecagramPerSecond); - } - - /// - /// Get MassFlow from DecigramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromDecigramsPerSecond(double decigramspersecond) -#else - public static MassFlow FromDecigramsPerSecond(QuantityValue decigramspersecond) -#endif - { - double value = (double) decigramspersecond; - return new MassFlow(value, MassFlowUnit.DecigramPerSecond); - } - - /// - /// Get MassFlow from GramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromGramsPerSecond(double gramspersecond) -#else - public static MassFlow FromGramsPerSecond(QuantityValue gramspersecond) -#endif - { - double value = (double) gramspersecond; - return new MassFlow(value, MassFlowUnit.GramPerSecond); - } - - /// - /// Get MassFlow from HectogramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromHectogramsPerSecond(double hectogramspersecond) -#else - public static MassFlow FromHectogramsPerSecond(QuantityValue hectogramspersecond) -#endif - { - double value = (double) hectogramspersecond; - return new MassFlow(value, MassFlowUnit.HectogramPerSecond); - } - - /// - /// Get MassFlow from KilogramsPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromKilogramsPerHour(double kilogramsperhour) -#else - public static MassFlow FromKilogramsPerHour(QuantityValue kilogramsperhour) -#endif - { - double value = (double) kilogramsperhour; - return new MassFlow(value, MassFlowUnit.KilogramPerHour); - } - - /// - /// Get MassFlow from KilogramsPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromKilogramsPerMinute(double kilogramsperminute) -#else - public static MassFlow FromKilogramsPerMinute(QuantityValue kilogramsperminute) -#endif - { - double value = (double) kilogramsperminute; - return new MassFlow(value, MassFlowUnit.KilogramPerMinute); - } - - /// - /// Get MassFlow from KilogramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromKilogramsPerSecond(double kilogramspersecond) -#else - public static MassFlow FromKilogramsPerSecond(QuantityValue kilogramspersecond) -#endif - { - double value = (double) kilogramspersecond; - return new MassFlow(value, MassFlowUnit.KilogramPerSecond); - } - - /// - /// Get MassFlow from MegapoundsPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromMegapoundsPerHour(double megapoundsperhour) -#else - public static MassFlow FromMegapoundsPerHour(QuantityValue megapoundsperhour) -#endif - { - double value = (double) megapoundsperhour; - return new MassFlow(value, MassFlowUnit.MegapoundPerHour); - } - - /// - /// Get MassFlow from MegapoundsPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromMegapoundsPerMinute(double megapoundsperminute) -#else - public static MassFlow FromMegapoundsPerMinute(QuantityValue megapoundsperminute) -#endif - { - double value = (double) megapoundsperminute; - return new MassFlow(value, MassFlowUnit.MegapoundPerMinute); - } - - /// - /// Get MassFlow from MicrogramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromMicrogramsPerSecond(double microgramspersecond) -#else - public static MassFlow FromMicrogramsPerSecond(QuantityValue microgramspersecond) -#endif - { - double value = (double) microgramspersecond; - return new MassFlow(value, MassFlowUnit.MicrogramPerSecond); - } - - /// - /// Get MassFlow from MilligramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromMilligramsPerSecond(double milligramspersecond) -#else - public static MassFlow FromMilligramsPerSecond(QuantityValue milligramspersecond) -#endif - { - double value = (double) milligramspersecond; - return new MassFlow(value, MassFlowUnit.MilligramPerSecond); - } - - /// - /// Get MassFlow from NanogramsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromNanogramsPerSecond(double nanogramspersecond) -#else - public static MassFlow FromNanogramsPerSecond(QuantityValue nanogramspersecond) -#endif - { - double value = (double) nanogramspersecond; - return new MassFlow(value, MassFlowUnit.NanogramPerSecond); - } - - /// - /// Get MassFlow from PoundsPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromPoundsPerHour(double poundsperhour) -#else - public static MassFlow FromPoundsPerHour(QuantityValue poundsperhour) -#endif - { - double value = (double) poundsperhour; - return new MassFlow(value, MassFlowUnit.PoundPerHour); - } - - /// - /// Get MassFlow from PoundsPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromPoundsPerMinute(double poundsperminute) -#else - public static MassFlow FromPoundsPerMinute(QuantityValue poundsperminute) -#endif - { - double value = (double) poundsperminute; - return new MassFlow(value, MassFlowUnit.PoundPerMinute); - } - - /// - /// Get MassFlow from ShortTonsPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromShortTonsPerHour(double shorttonsperhour) -#else - public static MassFlow FromShortTonsPerHour(QuantityValue shorttonsperhour) -#endif - { - double value = (double) shorttonsperhour; - return new MassFlow(value, MassFlowUnit.ShortTonPerHour); - } - - /// - /// Get MassFlow from TonnesPerDay. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromTonnesPerDay(double tonnesperday) -#else - public static MassFlow FromTonnesPerDay(QuantityValue tonnesperday) -#endif - { - double value = (double) tonnesperday; - return new MassFlow(value, MassFlowUnit.TonnePerDay); - } - - /// - /// Get MassFlow from TonnesPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static MassFlow FromTonnesPerHour(double tonnesperhour) -#else - public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) -#endif - { - double value = (double) tonnesperhour; - return new MassFlow(value, MassFlowUnit.TonnePerHour); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MassFlow unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static MassFlow From(double value, MassFlowUnit fromUnit) -#else - public static MassFlow From(QuantityValue value, MassFlowUnit fromUnit) -#endif - { - return new MassFlow((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(MassFlowUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is MassFlow)) throw new ArgumentException("Expected type MassFlow.", nameof(obj)); - - return CompareTo((MassFlow)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(MassFlow other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(MassFlow, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public override bool Equals(object obj) - { - if(obj is null || !(obj is MassFlow)) - return false; - - var objQuantity = (MassFlow)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another MassFlow within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Compare equality to another MassFlow by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(MassFlow, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(MassFlow other, MassFlow maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current MassFlow. - public override int GetHashCode() - { - return new { type = typeof(MassFlow), Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(MassFlowUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this MassFlow to another MassFlow with the unit representation . - /// - /// A MassFlow with the specified unit. - public MassFlow ToUnit(MassFlowUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new MassFlow(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case MassFlowUnit.CentigramPerSecond: return (_value) * 1e-2d; - case MassFlowUnit.DecagramPerSecond: return (_value) * 1e1d; - case MassFlowUnit.DecigramPerSecond: return (_value) * 1e-1d; - case MassFlowUnit.GramPerSecond: return _value; - case MassFlowUnit.HectogramPerSecond: return (_value) * 1e2d; - case MassFlowUnit.KilogramPerHour: return _value/3.6; - case MassFlowUnit.KilogramPerMinute: return _value/0.06; - case MassFlowUnit.KilogramPerSecond: return (_value) * 1e3d; - case MassFlowUnit.MegapoundPerHour: return (_value/7.93664) * 1e6d; - case MassFlowUnit.MegapoundPerMinute: return (_value/0.132277) * 1e6d; - case MassFlowUnit.MicrogramPerSecond: return (_value) * 1e-6d; - case MassFlowUnit.MilligramPerSecond: return (_value) * 1e-3d; - case MassFlowUnit.NanogramPerSecond: return (_value) * 1e-9d; - case MassFlowUnit.PoundPerHour: return _value/7.93664; - case MassFlowUnit.PoundPerMinute: return _value/0.132277; - case MassFlowUnit.ShortTonPerHour: return _value*251.9957611; - case MassFlowUnit.TonnePerDay: return _value/0.0864000; - case MassFlowUnit.TonnePerHour: return 1000*_value/3.6; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(MassFlowUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case MassFlowUnit.CentigramPerSecond: return (baseUnitValue) / 1e-2d; - case MassFlowUnit.DecagramPerSecond: return (baseUnitValue) / 1e1d; - case MassFlowUnit.DecigramPerSecond: return (baseUnitValue) / 1e-1d; - case MassFlowUnit.GramPerSecond: return baseUnitValue; - case MassFlowUnit.HectogramPerSecond: return (baseUnitValue) / 1e2d; - case MassFlowUnit.KilogramPerHour: return baseUnitValue*3.6; - case MassFlowUnit.KilogramPerMinute: return baseUnitValue*0.06; - case MassFlowUnit.KilogramPerSecond: return (baseUnitValue) / 1e3d; - case MassFlowUnit.MegapoundPerHour: return (baseUnitValue*7.93664) / 1e6d; - case MassFlowUnit.MegapoundPerMinute: return (baseUnitValue*0.132277) / 1e6d; - case MassFlowUnit.MicrogramPerSecond: return (baseUnitValue) / 1e-6d; - case MassFlowUnit.MilligramPerSecond: return (baseUnitValue) / 1e-3d; - case MassFlowUnit.NanogramPerSecond: return (baseUnitValue) / 1e-9d; - case MassFlowUnit.PoundPerHour: return baseUnitValue*7.93664; - case MassFlowUnit.PoundPerMinute: return baseUnitValue*0.132277; - case MassFlowUnit.ShortTonPerHour: return baseUnitValue/251.9957611; - case MassFlowUnit.TonnePerDay: return baseUnitValue*0.0864000; - case MassFlowUnit.TonnePerHour: return baseUnitValue*3.6/1000; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static MassFlow Parse(string str) - { - return Parse(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out MassFlow result) - { - return TryParse(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static MassFlowUnit ParseUnit(string str) - { - return ParseUnit(str, (IFormatProvider)null); - } - - #endregion - - /// - /// Set the default unit used by ToString(). Default is GramPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static MassFlowUnit ToStringDefaultUnit { get; set; } = MassFlowUnit.GramPerSecond; - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(MassFlowUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of MassFlow - /// - public static MassFlow MaxValue => new MassFlow(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of MassFlow - /// - public static MassFlow MinValue => new MassFlow(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => MassFlow.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => MassFlow.BaseDimensions; - } -} diff --git a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs b/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs deleted file mode 100644 index ab750c394f..0000000000 --- a/Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs +++ /dev/null @@ -1,1036 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - /// - /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. - /// - // ReSharper disable once PartialTypeWithSinglePart - - // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components - // Public structures can't have any members other than public fields, and those fields must be value types or strings. - // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. -#if WINDOWS_UWP - public sealed partial class VolumeFlow : IQuantity -#else - public partial struct VolumeFlow : IQuantity, IComparable, IComparable -#endif - { - /// - /// The numeric value this quantity was constructed with. - /// - private readonly double _value; - - /// - /// The unit this quantity was constructed with. - /// - private readonly VolumeFlowUnit? _unit; - - /// - /// The unit this quantity was constructed with -or- if default ctor was used. - /// - public VolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit); - - static VolumeFlow() - { - BaseDimensions = new BaseDimensions(3, 0, -1, 0, 0, 0, 0); - } - - /// - /// Creates the quantity with the given value in the base unit CubicMeterPerSecond. - /// - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public VolumeFlow(double cubicmeterspersecond) - { - _value = Convert.ToDouble(cubicmeterspersecond); - _unit = BaseUnit; - } - - /// - /// Creates the quantity with the given numeric value and unit. - /// - /// Numeric value. - /// Unit representation. - /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. -#if WINDOWS_UWP - private -#else - public -#endif - VolumeFlow(double numericValue, VolumeFlowUnit unit) - { - _value = numericValue; - _unit = unit; - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerSecond. - /// - /// Value assuming base unit CubicMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - VolumeFlow(long cubicmeterspersecond) : this(Convert.ToDouble(cubicmeterspersecond), BaseUnit) { } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods - // Windows Runtime Component does not support decimal type - /// - /// Creates the quantity with the given value assuming the base unit CubicMeterPerSecond. - /// - /// Value assuming base unit CubicMeterPerSecond. -#if WINDOWS_UWP - private -#else - [Obsolete("Use the constructor that takes a unit parameter. This constructor will be removed in a future version.")] - public -#endif - VolumeFlow(decimal cubicmeterspersecond) : this(Convert.ToDouble(cubicmeterspersecond), BaseUnit) { } - - #region Properties - - /// - /// The of this quantity. - /// - public static QuantityType QuantityType => QuantityType.VolumeFlow; - - /// - /// The base unit representation of this quantity for the numeric value stored internally. All conversions go via this value. - /// - public static VolumeFlowUnit BaseUnit => VolumeFlowUnit.CubicMeterPerSecond; - - /// - /// The of this quantity. - /// - public static BaseDimensions BaseDimensions - { - get; - } - - /// - /// All units of measurement for the VolumeFlow quantity. - /// - public static VolumeFlowUnit[] Units { get; } = Enum.GetValues(typeof(VolumeFlowUnit)).Cast().Except(new VolumeFlowUnit[]{ VolumeFlowUnit.Undefined }).ToArray(); - - /// - /// Get VolumeFlow in CentilitersPerMinute. - /// - public double CentilitersPerMinute => As(VolumeFlowUnit.CentilitersPerMinute); - - /// - /// Get VolumeFlow in CubicDecimetersPerMinute. - /// - public double CubicDecimetersPerMinute => As(VolumeFlowUnit.CubicDecimeterPerMinute); - - /// - /// Get VolumeFlow in CubicFeetPerHour. - /// - public double CubicFeetPerHour => As(VolumeFlowUnit.CubicFootPerHour); - - /// - /// Get VolumeFlow in CubicFeetPerMinute. - /// - public double CubicFeetPerMinute => As(VolumeFlowUnit.CubicFootPerMinute); - - /// - /// Get VolumeFlow in CubicFeetPerSecond. - /// - public double CubicFeetPerSecond => As(VolumeFlowUnit.CubicFootPerSecond); - - /// - /// Get VolumeFlow in CubicMetersPerHour. - /// - public double CubicMetersPerHour => As(VolumeFlowUnit.CubicMeterPerHour); - - /// - /// Get VolumeFlow in CubicMetersPerMinute. - /// - public double CubicMetersPerMinute => As(VolumeFlowUnit.CubicMeterPerMinute); - - /// - /// Get VolumeFlow in CubicMetersPerSecond. - /// - public double CubicMetersPerSecond => As(VolumeFlowUnit.CubicMeterPerSecond); - - /// - /// Get VolumeFlow in CubicYardsPerHour. - /// - public double CubicYardsPerHour => As(VolumeFlowUnit.CubicYardPerHour); - - /// - /// Get VolumeFlow in CubicYardsPerMinute. - /// - public double CubicYardsPerMinute => As(VolumeFlowUnit.CubicYardPerMinute); - - /// - /// Get VolumeFlow in CubicYardsPerSecond. - /// - public double CubicYardsPerSecond => As(VolumeFlowUnit.CubicYardPerSecond); - - /// - /// Get VolumeFlow in DecilitersPerMinute. - /// - public double DecilitersPerMinute => As(VolumeFlowUnit.DecilitersPerMinute); - - /// - /// Get VolumeFlow in KilolitersPerMinute. - /// - public double KilolitersPerMinute => As(VolumeFlowUnit.KilolitersPerMinute); - - /// - /// Get VolumeFlow in KilousGallonsPerMinute. - /// - public double KilousGallonsPerMinute => As(VolumeFlowUnit.KilousGallonsPerMinute); - - /// - /// Get VolumeFlow in LitersPerHour. - /// - public double LitersPerHour => As(VolumeFlowUnit.LitersPerHour); - - /// - /// Get VolumeFlow in LitersPerMinute. - /// - public double LitersPerMinute => As(VolumeFlowUnit.LitersPerMinute); - - /// - /// Get VolumeFlow in LitersPerSecond. - /// - public double LitersPerSecond => As(VolumeFlowUnit.LitersPerSecond); - - /// - /// Get VolumeFlow in MicrolitersPerMinute. - /// - public double MicrolitersPerMinute => As(VolumeFlowUnit.MicrolitersPerMinute); - - /// - /// Get VolumeFlow in MillilitersPerMinute. - /// - public double MillilitersPerMinute => As(VolumeFlowUnit.MillilitersPerMinute); - - /// - /// Get VolumeFlow in MillionUsGallonsPerDay. - /// - public double MillionUsGallonsPerDay => As(VolumeFlowUnit.MillionUsGallonsPerDay); - - /// - /// Get VolumeFlow in NanolitersPerMinute. - /// - public double NanolitersPerMinute => As(VolumeFlowUnit.NanolitersPerMinute); - - /// - /// Get VolumeFlow in OilBarrelsPerDay. - /// - public double OilBarrelsPerDay => As(VolumeFlowUnit.OilBarrelsPerDay); - - /// - /// Get VolumeFlow in OilBarrelsPerHour. - /// - public double OilBarrelsPerHour => As(VolumeFlowUnit.OilBarrelsPerHour); - - /// - /// Get VolumeFlow in OilBarrelsPerMinute. - /// - public double OilBarrelsPerMinute => As(VolumeFlowUnit.OilBarrelsPerMinute); - - /// - /// Get VolumeFlow in UsGallonsPerHour. - /// - public double UsGallonsPerHour => As(VolumeFlowUnit.UsGallonsPerHour); - - /// - /// Get VolumeFlow in UsGallonsPerMinute. - /// - public double UsGallonsPerMinute => As(VolumeFlowUnit.UsGallonsPerMinute); - - /// - /// Get VolumeFlow in UsGallonsPerSecond. - /// - public double UsGallonsPerSecond => As(VolumeFlowUnit.UsGallonsPerSecond); - - #endregion - - #region Static - - /// - /// Gets an instance of this quantity with a value of 0 in the base unit CubicMeterPerSecond. - /// - public static VolumeFlow Zero => new VolumeFlow(0, BaseUnit); - - /// - /// Get VolumeFlow from CentilitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCentilitersPerMinute(double centilitersperminute) -#else - public static VolumeFlow FromCentilitersPerMinute(QuantityValue centilitersperminute) -#endif - { - double value = (double) centilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CentilitersPerMinute); - } - - /// - /// Get VolumeFlow from CubicDecimetersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicDecimetersPerMinute(double cubicdecimetersperminute) -#else - public static VolumeFlow FromCubicDecimetersPerMinute(QuantityValue cubicdecimetersperminute) -#endif - { - double value = (double) cubicdecimetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicDecimeterPerMinute); - } - - /// - /// Get VolumeFlow from CubicFeetPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicFeetPerHour(double cubicfeetperhour) -#else - public static VolumeFlow FromCubicFeetPerHour(QuantityValue cubicfeetperhour) -#endif - { - double value = (double) cubicfeetperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerHour); - } - - /// - /// Get VolumeFlow from CubicFeetPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicFeetPerMinute(double cubicfeetperminute) -#else - public static VolumeFlow FromCubicFeetPerMinute(QuantityValue cubicfeetperminute) -#endif - { - double value = (double) cubicfeetperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerMinute); - } - - /// - /// Get VolumeFlow from CubicFeetPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicFeetPerSecond(double cubicfeetpersecond) -#else - public static VolumeFlow FromCubicFeetPerSecond(QuantityValue cubicfeetpersecond) -#endif - { - double value = (double) cubicfeetpersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicFootPerSecond); - } - - /// - /// Get VolumeFlow from CubicMetersPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicMetersPerHour(double cubicmetersperhour) -#else - public static VolumeFlow FromCubicMetersPerHour(QuantityValue cubicmetersperhour) -#endif - { - double value = (double) cubicmetersperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerHour); - } - - /// - /// Get VolumeFlow from CubicMetersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicMetersPerMinute(double cubicmetersperminute) -#else - public static VolumeFlow FromCubicMetersPerMinute(QuantityValue cubicmetersperminute) -#endif - { - double value = (double) cubicmetersperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerMinute); - } - - /// - /// Get VolumeFlow from CubicMetersPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicMetersPerSecond(double cubicmeterspersecond) -#else - public static VolumeFlow FromCubicMetersPerSecond(QuantityValue cubicmeterspersecond) -#endif - { - double value = (double) cubicmeterspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicMeterPerSecond); - } - - /// - /// Get VolumeFlow from CubicYardsPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicYardsPerHour(double cubicyardsperhour) -#else - public static VolumeFlow FromCubicYardsPerHour(QuantityValue cubicyardsperhour) -#endif - { - double value = (double) cubicyardsperhour; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerHour); - } - - /// - /// Get VolumeFlow from CubicYardsPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicYardsPerMinute(double cubicyardsperminute) -#else - public static VolumeFlow FromCubicYardsPerMinute(QuantityValue cubicyardsperminute) -#endif - { - double value = (double) cubicyardsperminute; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerMinute); - } - - /// - /// Get VolumeFlow from CubicYardsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromCubicYardsPerSecond(double cubicyardspersecond) -#else - public static VolumeFlow FromCubicYardsPerSecond(QuantityValue cubicyardspersecond) -#endif - { - double value = (double) cubicyardspersecond; - return new VolumeFlow(value, VolumeFlowUnit.CubicYardPerSecond); - } - - /// - /// Get VolumeFlow from DecilitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromDecilitersPerMinute(double decilitersperminute) -#else - public static VolumeFlow FromDecilitersPerMinute(QuantityValue decilitersperminute) -#endif - { - double value = (double) decilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.DecilitersPerMinute); - } - - /// - /// Get VolumeFlow from KilolitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromKilolitersPerMinute(double kilolitersperminute) -#else - public static VolumeFlow FromKilolitersPerMinute(QuantityValue kilolitersperminute) -#endif - { - double value = (double) kilolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.KilolitersPerMinute); - } - - /// - /// Get VolumeFlow from KilousGallonsPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromKilousGallonsPerMinute(double kilousgallonsperminute) -#else - public static VolumeFlow FromKilousGallonsPerMinute(QuantityValue kilousgallonsperminute) -#endif - { - double value = (double) kilousgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.KilousGallonsPerMinute); - } - - /// - /// Get VolumeFlow from LitersPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromLitersPerHour(double litersperhour) -#else - public static VolumeFlow FromLitersPerHour(QuantityValue litersperhour) -#endif - { - double value = (double) litersperhour; - return new VolumeFlow(value, VolumeFlowUnit.LitersPerHour); - } - - /// - /// Get VolumeFlow from LitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromLitersPerMinute(double litersperminute) -#else - public static VolumeFlow FromLitersPerMinute(QuantityValue litersperminute) -#endif - { - double value = (double) litersperminute; - return new VolumeFlow(value, VolumeFlowUnit.LitersPerMinute); - } - - /// - /// Get VolumeFlow from LitersPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromLitersPerSecond(double literspersecond) -#else - public static VolumeFlow FromLitersPerSecond(QuantityValue literspersecond) -#endif - { - double value = (double) literspersecond; - return new VolumeFlow(value, VolumeFlowUnit.LitersPerSecond); - } - - /// - /// Get VolumeFlow from MicrolitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromMicrolitersPerMinute(double microlitersperminute) -#else - public static VolumeFlow FromMicrolitersPerMinute(QuantityValue microlitersperminute) -#endif - { - double value = (double) microlitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MicrolitersPerMinute); - } - - /// - /// Get VolumeFlow from MillilitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromMillilitersPerMinute(double millilitersperminute) -#else - public static VolumeFlow FromMillilitersPerMinute(QuantityValue millilitersperminute) -#endif - { - double value = (double) millilitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.MillilitersPerMinute); - } - - /// - /// Get VolumeFlow from MillionUsGallonsPerDay. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromMillionUsGallonsPerDay(double millionusgallonsperday) -#else - public static VolumeFlow FromMillionUsGallonsPerDay(QuantityValue millionusgallonsperday) -#endif - { - double value = (double) millionusgallonsperday; - return new VolumeFlow(value, VolumeFlowUnit.MillionUsGallonsPerDay); - } - - /// - /// Get VolumeFlow from NanolitersPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromNanolitersPerMinute(double nanolitersperminute) -#else - public static VolumeFlow FromNanolitersPerMinute(QuantityValue nanolitersperminute) -#endif - { - double value = (double) nanolitersperminute; - return new VolumeFlow(value, VolumeFlowUnit.NanolitersPerMinute); - } - - /// - /// Get VolumeFlow from OilBarrelsPerDay. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromOilBarrelsPerDay(double oilbarrelsperday) -#else - public static VolumeFlow FromOilBarrelsPerDay(QuantityValue oilbarrelsperday) -#endif - { - double value = (double) oilbarrelsperday; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelsPerDay); - } - - /// - /// Get VolumeFlow from OilBarrelsPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromOilBarrelsPerHour(double oilbarrelsperhour) -#else - public static VolumeFlow FromOilBarrelsPerHour(QuantityValue oilbarrelsperhour) -#endif - { - double value = (double) oilbarrelsperhour; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelsPerHour); - } - - /// - /// Get VolumeFlow from OilBarrelsPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromOilBarrelsPerMinute(double oilbarrelsperminute) -#else - public static VolumeFlow FromOilBarrelsPerMinute(QuantityValue oilbarrelsperminute) -#endif - { - double value = (double) oilbarrelsperminute; - return new VolumeFlow(value, VolumeFlowUnit.OilBarrelsPerMinute); - } - - /// - /// Get VolumeFlow from UsGallonsPerHour. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromUsGallonsPerHour(double usgallonsperhour) -#else - public static VolumeFlow FromUsGallonsPerHour(QuantityValue usgallonsperhour) -#endif - { - double value = (double) usgallonsperhour; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonsPerHour); - } - - /// - /// Get VolumeFlow from UsGallonsPerMinute. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromUsGallonsPerMinute(double usgallonsperminute) -#else - public static VolumeFlow FromUsGallonsPerMinute(QuantityValue usgallonsperminute) -#endif - { - double value = (double) usgallonsperminute; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonsPerMinute); - } - - /// - /// Get VolumeFlow from UsGallonsPerSecond. - /// -#if WINDOWS_UWP - [Windows.Foundation.Metadata.DefaultOverload] - public static VolumeFlow FromUsGallonsPerSecond(double usgallonspersecond) -#else - public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) -#endif - { - double value = (double) usgallonspersecond; - return new VolumeFlow(value, VolumeFlowUnit.UsGallonsPerSecond); - } - - - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// VolumeFlow unit value. -#if WINDOWS_UWP - // Fix name conflict with parameter "value" - [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] - public static VolumeFlow From(double value, VolumeFlowUnit fromUnit) -#else - public static VolumeFlow From(QuantityValue value, VolumeFlowUnit fromUnit) -#endif - { - return new VolumeFlow((double)value, fromUnit); - } - - /// - /// Get unit abbreviation string. - /// - /// Unit to get abbreviation for. - /// Unit abbreviation string. - [UsedImplicitly] - public static string GetAbbreviation(VolumeFlowUnit unit) - { - return GetAbbreviation(unit, null); - } - - #endregion - - #region Equality / IComparable - - public int CompareTo(object obj) - { - if(obj is null) throw new ArgumentNullException(nameof(obj)); - if(!(obj is VolumeFlow)) throw new ArgumentException("Expected type VolumeFlow.", nameof(obj)); - - return CompareTo((VolumeFlow)obj); - } - - // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods -#if WINDOWS_UWP - internal -#else - public -#endif - int CompareTo(VolumeFlow other) - { - return _value.CompareTo(other.AsBaseNumericType(this.Unit)); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(VolumeFlow, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public override bool Equals(object obj) - { - if(obj is null || !(obj is VolumeFlow)) - return false; - - var objQuantity = (VolumeFlow)obj; - return _value.Equals(objQuantity.AsBaseNumericType(this.Unit)); - } - - /// - /// - /// Compare equality to another VolumeFlow within the given absolute or relative tolerance. - /// - /// - /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a percentage of this quantity's value. will be converted into - /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of - /// this quantity's value to be considered equal. - /// - /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Relative); - /// - /// - /// - /// - /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and - /// as a fixed number in this quantity's unit. will be converted into - /// this quantity's unit for comparison. - /// - /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). - /// - /// var a = Length.FromMeters(2.0); - /// var b = Length.FromInches(50.0); - /// a.Equals(b, 0.01, ComparisonType.Absolute); - /// - /// - /// - /// - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// - /// The other quantity to compare to. - /// The absolute or relative tolerance value. Must be greater than or equal to 0. - /// The comparison type: either relative or absolute. - /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. - public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparisonType) - { - if(tolerance < 0) - throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); - - double thisValue = (double)this.Value; - double otherValueInThisUnits = other.As(this.Unit); - - return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); - } - - /// - /// Compare equality to another VolumeFlow by specifying a max allowed difference. - /// Note that it is advised against specifying zero difference, due to the nature - /// of floating point operations and using System.Double internally. - /// - /// Other quantity to compare to. - /// Max error allowed. - /// True if the difference between the two values is not greater than the specified max. - [Obsolete("Please use the Equals(VolumeFlow, double, ComparisonType) overload. This method will be removed in a future version.")] - public bool Equals(VolumeFlow other, VolumeFlow maxError) - { - return Math.Abs(_value - other.AsBaseNumericType(this.Unit)) <= maxError.AsBaseNumericType(this.Unit); - } - - /// - /// Returns the hash code for this instance. - /// - /// A hash code for the current VolumeFlow. - public override int GetHashCode() - { - return new { type = typeof(VolumeFlow), Value, Unit }.GetHashCode(); - } - - #endregion - - #region Conversion - - /// - /// Convert to the unit representation . - /// - /// Value converted to the specified unit. - public double As(VolumeFlowUnit unit) - { - if(Unit == unit) - return Convert.ToDouble(Value); - - var converted = AsBaseNumericType(unit); - return Convert.ToDouble(converted); - } - - /// - /// Converts this VolumeFlow to another VolumeFlow with the unit representation . - /// - /// A VolumeFlow with the specified unit. - public VolumeFlow ToUnit(VolumeFlowUnit unit) - { - var convertedValue = AsBaseNumericType(unit); - return new VolumeFlow(convertedValue, unit); - } - - /// - /// Converts the current value + unit to the base unit. - /// This is typically the first step in converting from one unit to another. - /// - /// The value in the base unit representation. - private double AsBaseUnit() - { - switch(Unit) - { - case VolumeFlowUnit.CentilitersPerMinute: return (_value/60000.00000) * 1e-2d; - case VolumeFlowUnit.CubicDecimeterPerMinute: return _value/60000.00000; - case VolumeFlowUnit.CubicFootPerHour: return _value*7.8657907199999087346816086183876e-6; - case VolumeFlowUnit.CubicFootPerMinute: return _value/2118.88000326; - case VolumeFlowUnit.CubicFootPerSecond: return _value/35.314666721; - case VolumeFlowUnit.CubicMeterPerHour: return _value/3600; - case VolumeFlowUnit.CubicMeterPerMinute: return _value/60; - case VolumeFlowUnit.CubicMeterPerSecond: return _value; - case VolumeFlowUnit.CubicYardPerHour: return _value*2.1237634944E-4; - case VolumeFlowUnit.CubicYardPerMinute: return _value*0.0127425809664; - case VolumeFlowUnit.CubicYardPerSecond: return _value*0.764554857984; - case VolumeFlowUnit.DecilitersPerMinute: return (_value/60000.00000) * 1e-1d; - case VolumeFlowUnit.KilolitersPerMinute: return (_value/60000.00000) * 1e3d; - case VolumeFlowUnit.KilousGallonsPerMinute: return _value/15.850323141489; - case VolumeFlowUnit.LitersPerHour: return _value/3600000.000; - case VolumeFlowUnit.LitersPerMinute: return _value/60000.00000; - case VolumeFlowUnit.LitersPerSecond: return _value/1000; - case VolumeFlowUnit.MicrolitersPerMinute: return (_value/60000.00000) * 1e-6d; - case VolumeFlowUnit.MillilitersPerMinute: return (_value/60000.00000) * 1e-3d; - case VolumeFlowUnit.MillionUsGallonsPerDay: return _value/22.824465227; - case VolumeFlowUnit.NanolitersPerMinute: return (_value/60000.00000) * 1e-9d; - case VolumeFlowUnit.OilBarrelsPerDay: return _value*1.8401307283333333333333333333333e-6; - case VolumeFlowUnit.OilBarrelsPerHour: return _value*4.41631375e-5; - case VolumeFlowUnit.OilBarrelsPerMinute: return _value*2.64978825e-3; - case VolumeFlowUnit.UsGallonsPerHour: return _value/951019.38848933424; - case VolumeFlowUnit.UsGallonsPerMinute: return _value/15850.323141489; - case VolumeFlowUnit.UsGallonsPerSecond: return _value/264.1720523581484; - default: - throw new NotImplementedException($"Can not convert {Unit} to base units."); - } - } - - private double AsBaseNumericType(VolumeFlowUnit unit) - { - if(Unit == unit) - return _value; - - var baseUnitValue = AsBaseUnit(); - - switch(unit) - { - case VolumeFlowUnit.CentilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-2d; - case VolumeFlowUnit.CubicDecimeterPerMinute: return baseUnitValue*60000.00000; - case VolumeFlowUnit.CubicFootPerHour: return baseUnitValue/7.8657907199999087346816086183876e-6; - case VolumeFlowUnit.CubicFootPerMinute: return baseUnitValue*2118.88000326; - case VolumeFlowUnit.CubicFootPerSecond: return baseUnitValue*35.314666721; - case VolumeFlowUnit.CubicMeterPerHour: return baseUnitValue*3600; - case VolumeFlowUnit.CubicMeterPerMinute: return baseUnitValue*60; - case VolumeFlowUnit.CubicMeterPerSecond: return baseUnitValue; - case VolumeFlowUnit.CubicYardPerHour: return baseUnitValue/2.1237634944E-4; - case VolumeFlowUnit.CubicYardPerMinute: return baseUnitValue/0.0127425809664; - case VolumeFlowUnit.CubicYardPerSecond: return baseUnitValue/0.764554857984; - case VolumeFlowUnit.DecilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-1d; - case VolumeFlowUnit.KilolitersPerMinute: return (baseUnitValue*60000.00000) / 1e3d; - case VolumeFlowUnit.KilousGallonsPerMinute: return baseUnitValue*15.850323141489; - case VolumeFlowUnit.LitersPerHour: return baseUnitValue*3600000.000; - case VolumeFlowUnit.LitersPerMinute: return baseUnitValue*60000.00000; - case VolumeFlowUnit.LitersPerSecond: return baseUnitValue*1000; - case VolumeFlowUnit.MicrolitersPerMinute: return (baseUnitValue*60000.00000) / 1e-6d; - case VolumeFlowUnit.MillilitersPerMinute: return (baseUnitValue*60000.00000) / 1e-3d; - case VolumeFlowUnit.MillionUsGallonsPerDay: return baseUnitValue*22.824465227; - case VolumeFlowUnit.NanolitersPerMinute: return (baseUnitValue*60000.00000) / 1e-9d; - case VolumeFlowUnit.OilBarrelsPerDay: return baseUnitValue/1.8401307283333333333333333333333e-6; - case VolumeFlowUnit.OilBarrelsPerHour: return baseUnitValue/4.41631375e-5; - case VolumeFlowUnit.OilBarrelsPerMinute: return baseUnitValue/2.64978825e-3; - case VolumeFlowUnit.UsGallonsPerHour: return baseUnitValue*951019.38848933424; - case VolumeFlowUnit.UsGallonsPerMinute: return baseUnitValue*15850.323141489; - case VolumeFlowUnit.UsGallonsPerSecond: return baseUnitValue*264.1720523581484; - default: - throw new NotImplementedException($"Can not convert {Unit} to {unit}."); - } - } - - #endregion - - #region Parsing - - /// - /// Parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// - /// Expected string to have one or two pairs of quantity and unit in the format - /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" - /// - /// - /// More than one unit is represented by the specified unit abbreviation. - /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of - /// , and . - /// - /// - /// If anything else goes wrong, typically due to a bug or unhandled case. - /// We wrap exceptions in to allow you to distinguish - /// Units.NET exceptions from other exceptions. - /// - public static VolumeFlow Parse(string str) - { - return Parse(str, null); - } - - /// - /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". - /// - /// String to parse. Typically in the form: {number} {unit} - /// Resulting unit quantity if successful. - /// - /// Length.Parse("5.5 m", new CultureInfo("en-US")); - /// - public static bool TryParse([CanBeNull] string str, out VolumeFlow result) - { - return TryParse(str, null, out result); - } - - /// - /// Parse a unit string. - /// - /// String to parse. Typically in the form: {number} {unit} - /// - /// Length.ParseUnit("m", new CultureInfo("en-US")); - /// - /// The value of 'str' cannot be null. - /// Error parsing string. - public static VolumeFlowUnit ParseUnit(string str) - { - return ParseUnit(str, (IFormatProvider)null); - } - - #endregion - - /// - /// Set the default unit used by ToString(). Default is CubicMeterPerSecond - /// - [Obsolete("This is no longer used since we will instead use the quantity's Unit value as default.")] - public static VolumeFlowUnit ToStringDefaultUnit { get; set; } = VolumeFlowUnit.CubicMeterPerSecond; - - /// - /// Get default string representation of value and unit. - /// - /// String representation. - public override string ToString() - { - return ToString(Unit); - } - - /// - /// Get string representation of value and unit. Using current UI culture and two significant digits after radix. - /// - /// Unit representation to use. - /// String representation. - public string ToString(VolumeFlowUnit unit) - { - return ToString(unit, null, 2); - } - - /// - /// Represents the largest possible value of VolumeFlow - /// - public static VolumeFlow MaxValue => new VolumeFlow(double.MaxValue, BaseUnit); - - /// - /// Represents the smallest possible value of VolumeFlow - /// - public static VolumeFlow MinValue => new VolumeFlow(double.MinValue, BaseUnit); - - /// - /// The of this quantity. - /// - public QuantityType Type => VolumeFlow.QuantityType; - - /// - /// The of this quantity. - /// - public BaseDimensions Dimensions => VolumeFlow.BaseDimensions; - } -} diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs deleted file mode 100644 index f5b063b291..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs +++ /dev/null @@ -1,247 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToMassFlow -{ - public static class NumberToMassFlowExtensions - { - #region CentigramPerSecond - - /// - public static MassFlow CentigramsPerSecond(this T value) => MassFlow.FromCentigramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? CentigramsPerSecond(this T? value) where T : struct => MassFlow.FromCentigramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecagramPerSecond - - /// - public static MassFlow DecagramsPerSecond(this T value) => MassFlow.FromDecagramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? DecagramsPerSecond(this T? value) where T : struct => MassFlow.FromDecagramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecigramPerSecond - - /// - public static MassFlow DecigramsPerSecond(this T value) => MassFlow.FromDecigramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? DecigramsPerSecond(this T? value) where T : struct => MassFlow.FromDecigramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region GramPerSecond - - /// - public static MassFlow GramsPerSecond(this T value) => MassFlow.FromGramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? GramsPerSecond(this T? value) where T : struct => MassFlow.FromGramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region HectogramPerSecond - - /// - public static MassFlow HectogramsPerSecond(this T value) => MassFlow.FromHectogramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? HectogramsPerSecond(this T? value) where T : struct => MassFlow.FromHectogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerHour - - /// - public static MassFlow KilogramsPerHour(this T value) => MassFlow.FromKilogramsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? KilogramsPerHour(this T? value) where T : struct => MassFlow.FromKilogramsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerMinute - - /// - public static MassFlow KilogramsPerMinute(this T value) => MassFlow.FromKilogramsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? KilogramsPerMinute(this T? value) where T : struct => MassFlow.FromKilogramsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilogramPerSecond - - /// - public static MassFlow KilogramsPerSecond(this T value) => MassFlow.FromKilogramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? KilogramsPerSecond(this T? value) where T : struct => MassFlow.FromKilogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegapoundPerHour - - /// - public static MassFlow MegapoundsPerHour(this T value) => MassFlow.FromMegapoundsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? MegapoundsPerHour(this T? value) where T : struct => MassFlow.FromMegapoundsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MegapoundPerMinute - - /// - public static MassFlow MegapoundsPerMinute(this T value) => MassFlow.FromMegapoundsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? MegapoundsPerMinute(this T? value) where T : struct => MassFlow.FromMegapoundsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrogramPerSecond - - /// - public static MassFlow MicrogramsPerSecond(this T value) => MassFlow.FromMicrogramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? MicrogramsPerSecond(this T? value) where T : struct => MassFlow.FromMicrogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MilligramPerSecond - - /// - public static MassFlow MilligramsPerSecond(this T value) => MassFlow.FromMilligramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? MilligramsPerSecond(this T? value) where T : struct => MassFlow.FromMilligramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanogramPerSecond - - /// - public static MassFlow NanogramsPerSecond(this T value) => MassFlow.FromNanogramsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? NanogramsPerSecond(this T? value) where T : struct => MassFlow.FromNanogramsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerHour - - /// - public static MassFlow PoundsPerHour(this T value) => MassFlow.FromPoundsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? PoundsPerHour(this T? value) where T : struct => MassFlow.FromPoundsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region PoundPerMinute - - /// - public static MassFlow PoundsPerMinute(this T value) => MassFlow.FromPoundsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? PoundsPerMinute(this T? value) where T : struct => MassFlow.FromPoundsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region ShortTonPerHour - - /// - public static MassFlow ShortTonsPerHour(this T value) => MassFlow.FromShortTonsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? ShortTonsPerHour(this T? value) where T : struct => MassFlow.FromShortTonsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonnePerDay - - /// - public static MassFlow TonnesPerDay(this T value) => MassFlow.FromTonnesPerDay(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? TonnesPerDay(this T? value) where T : struct => MassFlow.FromTonnesPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region TonnePerHour - - /// - public static MassFlow TonnesPerHour(this T value) => MassFlow.FromTonnesPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static MassFlow? TonnesPerHour(this T? value) where T : struct => MassFlow.FromTonnesPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs b/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs deleted file mode 100644 index b483ab8c79..0000000000 --- a/UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs +++ /dev/null @@ -1,346 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -// Windows Runtime Component does not support extension methods and method overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -namespace UnitsNet.Extensions.NumberToVolumeFlow -{ - public static class NumberToVolumeFlowExtensions - { - #region CentilitersPerMinute - - /// - public static VolumeFlow CentilitersPerMinute(this T value) => VolumeFlow.FromCentilitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CentilitersPerMinute(this T? value) where T : struct => VolumeFlow.FromCentilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicDecimeterPerMinute - - /// - public static VolumeFlow CubicDecimetersPerMinute(this T value) => VolumeFlow.FromCubicDecimetersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicDecimetersPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicDecimetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerHour - - /// - public static VolumeFlow CubicFeetPerHour(this T value) => VolumeFlow.FromCubicFeetPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicFeetPerHour(this T? value) where T : struct => VolumeFlow.FromCubicFeetPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerMinute - - /// - public static VolumeFlow CubicFeetPerMinute(this T value) => VolumeFlow.FromCubicFeetPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicFeetPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicFeetPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicFootPerSecond - - /// - public static VolumeFlow CubicFeetPerSecond(this T value) => VolumeFlow.FromCubicFeetPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicFeetPerSecond(this T? value) where T : struct => VolumeFlow.FromCubicFeetPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerHour - - /// - public static VolumeFlow CubicMetersPerHour(this T value) => VolumeFlow.FromCubicMetersPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicMetersPerHour(this T? value) where T : struct => VolumeFlow.FromCubicMetersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerMinute - - /// - public static VolumeFlow CubicMetersPerMinute(this T value) => VolumeFlow.FromCubicMetersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicMetersPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicMetersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicMeterPerSecond - - /// - public static VolumeFlow CubicMetersPerSecond(this T value) => VolumeFlow.FromCubicMetersPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicMetersPerSecond(this T? value) where T : struct => VolumeFlow.FromCubicMetersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerHour - - /// - public static VolumeFlow CubicYardsPerHour(this T value) => VolumeFlow.FromCubicYardsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicYardsPerHour(this T? value) where T : struct => VolumeFlow.FromCubicYardsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerMinute - - /// - public static VolumeFlow CubicYardsPerMinute(this T value) => VolumeFlow.FromCubicYardsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicYardsPerMinute(this T? value) where T : struct => VolumeFlow.FromCubicYardsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region CubicYardPerSecond - - /// - public static VolumeFlow CubicYardsPerSecond(this T value) => VolumeFlow.FromCubicYardsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? CubicYardsPerSecond(this T? value) where T : struct => VolumeFlow.FromCubicYardsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region DecilitersPerMinute - - /// - public static VolumeFlow DecilitersPerMinute(this T value) => VolumeFlow.FromDecilitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? DecilitersPerMinute(this T? value) where T : struct => VolumeFlow.FromDecilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilolitersPerMinute - - /// - public static VolumeFlow KilolitersPerMinute(this T value) => VolumeFlow.FromKilolitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? KilolitersPerMinute(this T? value) where T : struct => VolumeFlow.FromKilolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region KilousGallonsPerMinute - - /// - public static VolumeFlow KilousGallonsPerMinute(this T value) => VolumeFlow.FromKilousGallonsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? KilousGallonsPerMinute(this T? value) where T : struct => VolumeFlow.FromKilousGallonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerHour - - /// - public static VolumeFlow LitersPerHour(this T value) => VolumeFlow.FromLitersPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? LitersPerHour(this T? value) where T : struct => VolumeFlow.FromLitersPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerMinute - - /// - public static VolumeFlow LitersPerMinute(this T value) => VolumeFlow.FromLitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? LitersPerMinute(this T? value) where T : struct => VolumeFlow.FromLitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region LitersPerSecond - - /// - public static VolumeFlow LitersPerSecond(this T value) => VolumeFlow.FromLitersPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? LitersPerSecond(this T? value) where T : struct => VolumeFlow.FromLitersPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MicrolitersPerMinute - - /// - public static VolumeFlow MicrolitersPerMinute(this T value) => VolumeFlow.FromMicrolitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? MicrolitersPerMinute(this T? value) where T : struct => VolumeFlow.FromMicrolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillilitersPerMinute - - /// - public static VolumeFlow MillilitersPerMinute(this T value) => VolumeFlow.FromMillilitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? MillilitersPerMinute(this T? value) where T : struct => VolumeFlow.FromMillilitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region MillionUsGallonsPerDay - - /// - public static VolumeFlow MillionUsGallonsPerDay(this T value) => VolumeFlow.FromMillionUsGallonsPerDay(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? MillionUsGallonsPerDay(this T? value) where T : struct => VolumeFlow.FromMillionUsGallonsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region NanolitersPerMinute - - /// - public static VolumeFlow NanolitersPerMinute(this T value) => VolumeFlow.FromNanolitersPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? NanolitersPerMinute(this T? value) where T : struct => VolumeFlow.FromNanolitersPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerDay - - /// - public static VolumeFlow OilBarrelsPerDay(this T value) => VolumeFlow.FromOilBarrelsPerDay(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? OilBarrelsPerDay(this T? value) where T : struct => VolumeFlow.FromOilBarrelsPerDay(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerHour - - /// - public static VolumeFlow OilBarrelsPerHour(this T value) => VolumeFlow.FromOilBarrelsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? OilBarrelsPerHour(this T? value) where T : struct => VolumeFlow.FromOilBarrelsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region OilBarrelsPerMinute - - /// - public static VolumeFlow OilBarrelsPerMinute(this T value) => VolumeFlow.FromOilBarrelsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? OilBarrelsPerMinute(this T? value) where T : struct => VolumeFlow.FromOilBarrelsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerHour - - /// - public static VolumeFlow UsGallonsPerHour(this T value) => VolumeFlow.FromUsGallonsPerHour(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? UsGallonsPerHour(this T? value) where T : struct => VolumeFlow.FromUsGallonsPerHour(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerMinute - - /// - public static VolumeFlow UsGallonsPerMinute(this T value) => VolumeFlow.FromUsGallonsPerMinute(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? UsGallonsPerMinute(this T? value) where T : struct => VolumeFlow.FromUsGallonsPerMinute(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - #region UsGallonsPerSecond - - /// - public static VolumeFlow UsGallonsPerSecond(this T value) => VolumeFlow.FromUsGallonsPerSecond(Convert.ToDouble(value)); - - /// - [Obsolete("Nullable type support has been deprecated and will be removed in a future release.")] - public static VolumeFlow? UsGallonsPerSecond(this T? value) where T : struct => VolumeFlow.FromUsGallonsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value)); - - #endregion - - } -} -#endif diff --git a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs b/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs deleted file mode 100644 index 06b693e0a9..0000000000 --- a/UnitsNet/GeneratedCode/UnitSystem.Default.g.cs +++ /dev/null @@ -1,4852 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using UnitsNet.I18n; -using UnitsNet.Units; - -// ReSharper disable RedundantCommaInArrayInitializer -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - public sealed partial class UnitSystem - { - private static readonly ReadOnlyCollection DefaultLocalizations - = new ReadOnlyCollection(new List - { - new UnitLocalization(typeof (AccelerationUnit), - new[] - { - new CulturesForEnumValue((int) AccelerationUnit.CentimeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "cm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.DecimeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "dm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.FootPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "ft/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.InchPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "in/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KilometerPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "km/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KnotPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "kn/h"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KnotPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kn/min"), - }), - new CulturesForEnumValue((int) AccelerationUnit.KnotPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kn/s"), - }), - new CulturesForEnumValue((int) AccelerationUnit.MeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "m/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.MicrometerPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "µm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.MillimeterPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "mm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.NanometerPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "nm/s²"), - }), - new CulturesForEnumValue((int) AccelerationUnit.StandardGravity, - new[] - { - new AbbreviationsForCulture("en-US", "g"), - }), - }), - new UnitLocalization(typeof (AmountOfSubstanceUnit), - new[] - { - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Centimole, - new[] - { - new AbbreviationsForCulture("en-US", "cmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.CentipoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "clbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Decimole, - new[] - { - new AbbreviationsForCulture("en-US", "dmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.DecipoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "dlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Kilomole, - new[] - { - new AbbreviationsForCulture("en-US", "kmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.KilopoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "klbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Micromole, - new[] - { - new AbbreviationsForCulture("en-US", "µmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.MicropoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "µlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Millimole, - new[] - { - new AbbreviationsForCulture("en-US", "mmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.MillipoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "mlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Mole, - new[] - { - new AbbreviationsForCulture("en-US", "mol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.Nanomole, - new[] - { - new AbbreviationsForCulture("en-US", "nmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.NanopoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "nlbmol"), - }), - new CulturesForEnumValue((int) AmountOfSubstanceUnit.PoundMole, - new[] - { - new AbbreviationsForCulture("en-US", "lbmol"), - }), - }), - new UnitLocalization(typeof (AmplitudeRatioUnit), - new[] - { - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelMicrovolt, - new[] - { - new AbbreviationsForCulture("en-US", "dBµV"), - }), - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelMillivolt, - new[] - { - new AbbreviationsForCulture("en-US", "dBmV"), - }), - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelUnloaded, - new[] - { - new AbbreviationsForCulture("en-US", "dBu"), - }), - new CulturesForEnumValue((int) AmplitudeRatioUnit.DecibelVolt, - new[] - { - new AbbreviationsForCulture("en-US", "dBV"), - }), - }), - new UnitLocalization(typeof (AngleUnit), - new[] - { - new CulturesForEnumValue((int) AngleUnit.Arcminute, - new[] - { - new AbbreviationsForCulture("en-US", "'", "arcmin", "amin", "min"), - }), - new CulturesForEnumValue((int) AngleUnit.Arcsecond, - new[] - { - new AbbreviationsForCulture("en-US", "″", "arcsec", "asec", "sec"), - }), - new CulturesForEnumValue((int) AngleUnit.Centiradian, - new[] - { - new AbbreviationsForCulture("en-US", "crad"), - new AbbreviationsForCulture("ru-RU", "cрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Deciradian, - new[] - { - new AbbreviationsForCulture("en-US", "drad"), - new AbbreviationsForCulture("ru-RU", "dрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Degree, - new[] - { - new AbbreviationsForCulture("en-US", "°", "deg"), - new AbbreviationsForCulture("ru-RU", "°"), - }), - new CulturesForEnumValue((int) AngleUnit.Gradian, - new[] - { - new AbbreviationsForCulture("en-US", "g"), - new AbbreviationsForCulture("ru-RU", "g"), - }), - new CulturesForEnumValue((int) AngleUnit.Microdegree, - new[] - { - new AbbreviationsForCulture("en-US", "µ°"), - new AbbreviationsForCulture("ru-RU", "µ°"), - }), - new CulturesForEnumValue((int) AngleUnit.Microradian, - new[] - { - new AbbreviationsForCulture("en-US", "µrad"), - new AbbreviationsForCulture("ru-RU", "µрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Millidegree, - new[] - { - new AbbreviationsForCulture("en-US", "m°"), - new AbbreviationsForCulture("ru-RU", "m°"), - }), - new CulturesForEnumValue((int) AngleUnit.Milliradian, - new[] - { - new AbbreviationsForCulture("en-US", "mrad"), - new AbbreviationsForCulture("ru-RU", "mрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Nanodegree, - new[] - { - new AbbreviationsForCulture("en-US", "n°"), - new AbbreviationsForCulture("ru-RU", "n°"), - }), - new CulturesForEnumValue((int) AngleUnit.Nanoradian, - new[] - { - new AbbreviationsForCulture("en-US", "nrad"), - new AbbreviationsForCulture("ru-RU", "nрад"), - }), - new CulturesForEnumValue((int) AngleUnit.Radian, - new[] - { - new AbbreviationsForCulture("en-US", "rad"), - new AbbreviationsForCulture("ru-RU", "рад"), - }), - new CulturesForEnumValue((int) AngleUnit.Revolution, - new[] - { - new AbbreviationsForCulture("en-US", "r"), - new AbbreviationsForCulture("ru-RU", "r"), - }), - }), - new UnitLocalization(typeof (ApparentEnergyUnit), - new[] - { - new CulturesForEnumValue((int) ApparentEnergyUnit.KilovoltampereHour, - new[] - { - new AbbreviationsForCulture("en-US", "kVAh"), - }), - new CulturesForEnumValue((int) ApparentEnergyUnit.MegavoltampereHour, - new[] - { - new AbbreviationsForCulture("en-US", "MVAh"), - }), - new CulturesForEnumValue((int) ApparentEnergyUnit.VoltampereHour, - new[] - { - new AbbreviationsForCulture("en-US", "VAh"), - }), - }), - new UnitLocalization(typeof (ApparentPowerUnit), - new[] - { - new CulturesForEnumValue((int) ApparentPowerUnit.Gigavoltampere, - new[] - { - new AbbreviationsForCulture("en-US", "GVA"), - }), - new CulturesForEnumValue((int) ApparentPowerUnit.Kilovoltampere, - new[] - { - new AbbreviationsForCulture("en-US", "kVA"), - }), - new CulturesForEnumValue((int) ApparentPowerUnit.Megavoltampere, - new[] - { - new AbbreviationsForCulture("en-US", "MVA"), - }), - new CulturesForEnumValue((int) ApparentPowerUnit.Voltampere, - new[] - { - new AbbreviationsForCulture("en-US", "VA"), - }), - }), - new UnitLocalization(typeof (AreaUnit), - new[] - { - new CulturesForEnumValue((int) AreaUnit.Acre, - new[] - { - new AbbreviationsForCulture("en-US", "ac"), - }), - new CulturesForEnumValue((int) AreaUnit.Hectare, - new[] - { - new AbbreviationsForCulture("en-US", "ha"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cm²"), - new AbbreviationsForCulture("ru-RU", "см²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "dm²"), - new AbbreviationsForCulture("ru-RU", "дм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ft²"), - new AbbreviationsForCulture("ru-RU", "фут²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "in²"), - new AbbreviationsForCulture("ru-RU", "дюйм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareKilometer, - new[] - { - new AbbreviationsForCulture("en-US", "km²"), - new AbbreviationsForCulture("ru-RU", "км²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "m²"), - new AbbreviationsForCulture("ru-RU", "м²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMicrometer, - new[] - { - new AbbreviationsForCulture("en-US", "µm²"), - new AbbreviationsForCulture("ru-RU", "мкм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMile, - new[] - { - new AbbreviationsForCulture("en-US", "mi²"), - new AbbreviationsForCulture("ru-RU", "миля²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mm²"), - new AbbreviationsForCulture("ru-RU", "мм²"), - }), - new CulturesForEnumValue((int) AreaUnit.SquareYard, - new[] - { - new AbbreviationsForCulture("en-US", "yd²"), - new AbbreviationsForCulture("ru-RU", "ярд²"), - }), - new CulturesForEnumValue((int) AreaUnit.UsSurveySquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ft² (US)"), - }), - }), - new UnitLocalization(typeof (AreaDensityUnit), - new[] - { - new CulturesForEnumValue((int) AreaDensityUnit.KilogramPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/m²"), - }), - }), - new UnitLocalization(typeof (AreaMomentOfInertiaUnit), - new[] - { - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.CentimeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "cm⁴", "cm^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.DecimeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "dm⁴", "dm^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.FootToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "ft⁴", "ft^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.InchToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "in⁴", "in^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.MeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "m⁴", "m^4"), - }), - new CulturesForEnumValue((int) AreaMomentOfInertiaUnit.MillimeterToTheFourth, - new[] - { - new AbbreviationsForCulture("en-US", "mm⁴", "mm^4"), - }), - }), - new UnitLocalization(typeof (BitRateUnit), - new[] - { - new CulturesForEnumValue((int) BitRateUnit.BitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "bit/s", "bps"), - }), - new CulturesForEnumValue((int) BitRateUnit.BytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "B/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Ebit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "EB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExbibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Eibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.ExbibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "EiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GibibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Gibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GibibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "GiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GigabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Gbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.GigabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "GB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KibibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Kibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KibibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "KiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KilobitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.KilobytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MebibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Mibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MebibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "MiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MegabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Mbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.MegabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "MB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PebibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Pibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PebibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "PiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PetabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Pbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.PetabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "PB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TebibitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Tibit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TebibytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "TiB/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TerabitPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Tbit/s"), - }), - new CulturesForEnumValue((int) BitRateUnit.TerabytePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "TB/s"), - }), - }), - new UnitLocalization(typeof (BrakeSpecificFuelConsumptionUnit), - new[] - { - new CulturesForEnumValue((int) BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, - new[] - { - new AbbreviationsForCulture("en-US", "g/kWh"), - }), - new CulturesForEnumValue((int) BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, - new[] - { - new AbbreviationsForCulture("en-US", "kg/J"), - }), - new CulturesForEnumValue((int) BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour, - new[] - { - new AbbreviationsForCulture("en-US", "lb/hph"), - }), - }), - new UnitLocalization(typeof (CapacitanceUnit), - new[] - { - new CulturesForEnumValue((int) CapacitanceUnit.Farad, - new[] - { - new AbbreviationsForCulture("en-US", "F"), - }), - }), - new UnitLocalization(typeof (CoefficientOfThermalExpansionUnit), - new[] - { - new CulturesForEnumValue((int) CoefficientOfThermalExpansionUnit.InverseDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "°C⁻¹", "1/°C"), - }), - new CulturesForEnumValue((int) CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit, - new[] - { - new AbbreviationsForCulture("en-US", "°F⁻¹", "1/°F"), - }), - new CulturesForEnumValue((int) CoefficientOfThermalExpansionUnit.InverseKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "K⁻¹", "1/K"), - }), - }), - new UnitLocalization(typeof (DensityUnit), - new[] - { - new CulturesForEnumValue((int) DensityUnit.CentigramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "cg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.CentigramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "cg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.CentigramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "cg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.DecigramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "dg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.DecigramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "dg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.DecigramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "dg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/cm³"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/m³"), - new AbbreviationsForCulture("ru-RU", "г/м³"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/mm³"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "g/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "g/L"), - }), - new CulturesForEnumValue((int) DensityUnit.GramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "g/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.KilogramPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/cm³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilogramPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/m³"), - new AbbreviationsForCulture("ru-RU", "kг/м³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilogramPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/mm³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilopoundPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kip/ft³"), - }), - new CulturesForEnumValue((int) DensityUnit.KilopoundPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "kip/in³"), - }), - new CulturesForEnumValue((int) DensityUnit.MicrogramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "µg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.MicrogramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "µg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.MicrogramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "µg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/m³"), - new AbbreviationsForCulture("ru-RU", "mг/м³"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.MilligramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "mg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.NanogramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "ng/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.NanogramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "ng/L"), - }), - new CulturesForEnumValue((int) DensityUnit.NanogramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "ng/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.PicogramPerDeciliter, - new[] - { - new AbbreviationsForCulture("en-US", "pg/dl"), - }), - new CulturesForEnumValue((int) DensityUnit.PicogramPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "pg/L"), - }), - new CulturesForEnumValue((int) DensityUnit.PicogramPerMilliliter, - new[] - { - new AbbreviationsForCulture("en-US", "pg/ml"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb/ft³"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "lb/in³"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerImperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "ppg (imp.)"), - }), - new CulturesForEnumValue((int) DensityUnit.PoundPerUSGallon, - new[] - { - new AbbreviationsForCulture("en-US", "ppg (U.S.)"), - }), - new CulturesForEnumValue((int) DensityUnit.SlugPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "slug/ft³"), - }), - new CulturesForEnumValue((int) DensityUnit.TonnePerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t/cm³"), - }), - new CulturesForEnumValue((int) DensityUnit.TonnePerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "t/m³"), - }), - new CulturesForEnumValue((int) DensityUnit.TonnePerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t/mm³"), - }), - }), - new UnitLocalization(typeof (DurationUnit), - new[] - { - new CulturesForEnumValue((int) DurationUnit.Day, - new[] - { - new AbbreviationsForCulture("en-US", "d", "day", "days"), - new AbbreviationsForCulture("ru-RU", "д"), - }), - new CulturesForEnumValue((int) DurationUnit.Hour, - new[] - { - new AbbreviationsForCulture("en-US", "h", "hr", "hrs", "hour", "hours"), - new AbbreviationsForCulture("ru-RU", "ч"), - }), - new CulturesForEnumValue((int) DurationUnit.Microsecond, - new[] - { - new AbbreviationsForCulture("en-US", "µs"), - new AbbreviationsForCulture("ru-RU", "мкс"), - }), - new CulturesForEnumValue((int) DurationUnit.Millisecond, - new[] - { - new AbbreviationsForCulture("en-US", "ms"), - new AbbreviationsForCulture("ru-RU", "мс"), - }), - new CulturesForEnumValue((int) DurationUnit.Minute, - new[] - { - new AbbreviationsForCulture("en-US", "m", "min", "minute", "minutes"), - new AbbreviationsForCulture("ru-RU", "мин"), - }), - new CulturesForEnumValue((int) DurationUnit.Month, - new[] - { - new AbbreviationsForCulture("en-US", "mo", "month", "months"), - new AbbreviationsForCulture("ru-RU", "месяц"), - }), - new CulturesForEnumValue((int) DurationUnit.Month30, - new[] - { - new AbbreviationsForCulture("en-US", "mo", "month", "months"), - new AbbreviationsForCulture("ru-RU", "месяц"), - }), - new CulturesForEnumValue((int) DurationUnit.Nanosecond, - new[] - { - new AbbreviationsForCulture("en-US", "ns"), - new AbbreviationsForCulture("ru-RU", "нс"), - }), - new CulturesForEnumValue((int) DurationUnit.Second, - new[] - { - new AbbreviationsForCulture("en-US", "s", "sec", "secs", "second", "seconds"), - new AbbreviationsForCulture("ru-RU", "с"), - }), - new CulturesForEnumValue((int) DurationUnit.Week, - new[] - { - new AbbreviationsForCulture("en-US", "wk", "week", "weeks"), - new AbbreviationsForCulture("ru-RU", "мин"), - }), - new CulturesForEnumValue((int) DurationUnit.Year, - new[] - { - new AbbreviationsForCulture("en-US", "yr", "year", "years"), - new AbbreviationsForCulture("ru-RU", "год"), - }), - new CulturesForEnumValue((int) DurationUnit.Year365, - new[] - { - new AbbreviationsForCulture("en-US", "yr", "year", "years"), - new AbbreviationsForCulture("ru-RU", "год"), - }), - }), - new UnitLocalization(typeof (DynamicViscosityUnit), - new[] - { - new CulturesForEnumValue((int) DynamicViscosityUnit.Centipoise, - new[] - { - new AbbreviationsForCulture("en-US", "cP"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.MicropascalSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µPaS"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.MillipascalSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mPaS"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.NewtonSecondPerMeterSquared, - new[] - { - new AbbreviationsForCulture("en-US", "Ns/m²"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.PascalSecond, - new[] - { - new AbbreviationsForCulture("en-US", "PaS"), - }), - new CulturesForEnumValue((int) DynamicViscosityUnit.Poise, - new[] - { - new AbbreviationsForCulture("en-US", "P"), - }), - }), - new UnitLocalization(typeof (ElectricAdmittanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Microsiemens, - new[] - { - new AbbreviationsForCulture("en-US", "µS"), - }), - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Millisiemens, - new[] - { - new AbbreviationsForCulture("en-US", "mS"), - }), - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Nanosiemens, - new[] - { - new AbbreviationsForCulture("en-US", "nS"), - }), - new CulturesForEnumValue((int) ElectricAdmittanceUnit.Siemens, - new[] - { - new AbbreviationsForCulture("en-US", "S"), - }), - }), - new UnitLocalization(typeof (ElectricChargeUnit), - new[] - { - new CulturesForEnumValue((int) ElectricChargeUnit.Coulomb, - new[] - { - new AbbreviationsForCulture("en-US", "C"), - }), - }), - new UnitLocalization(typeof (ElectricChargeDensityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricChargeDensityUnit.CoulombPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "C/m³"), - }), - }), - new UnitLocalization(typeof (ElectricConductanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricConductanceUnit.Microsiemens, - new[] - { - new AbbreviationsForCulture("en-US", "µS"), - }), - new CulturesForEnumValue((int) ElectricConductanceUnit.Millisiemens, - new[] - { - new AbbreviationsForCulture("en-US", "mS"), - }), - new CulturesForEnumValue((int) ElectricConductanceUnit.Siemens, - new[] - { - new AbbreviationsForCulture("en-US", "S"), - }), - }), - new UnitLocalization(typeof (ElectricConductivityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricConductivityUnit.SiemensPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "S/m"), - }), - }), - new UnitLocalization(typeof (ElectricCurrentUnit), - new[] - { - new CulturesForEnumValue((int) ElectricCurrentUnit.Ampere, - new[] - { - new AbbreviationsForCulture("en-US", "A"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Centiampere, - new[] - { - new AbbreviationsForCulture("en-US", "cA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Kiloampere, - new[] - { - new AbbreviationsForCulture("en-US", "kA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Megaampere, - new[] - { - new AbbreviationsForCulture("en-US", "MA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Microampere, - new[] - { - new AbbreviationsForCulture("en-US", "µA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Milliampere, - new[] - { - new AbbreviationsForCulture("en-US", "mA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Nanoampere, - new[] - { - new AbbreviationsForCulture("en-US", "nA"), - }), - new CulturesForEnumValue((int) ElectricCurrentUnit.Picoampere, - new[] - { - new AbbreviationsForCulture("en-US", "pA"), - }), - }), - new UnitLocalization(typeof (ElectricCurrentDensityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricCurrentDensityUnit.AmperePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "A/m²"), - }), - }), - new UnitLocalization(typeof (ElectricCurrentGradientUnit), - new[] - { - new CulturesForEnumValue((int) ElectricCurrentGradientUnit.AmperePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "A/s"), - }), - }), - new UnitLocalization(typeof (ElectricFieldUnit), - new[] - { - new CulturesForEnumValue((int) ElectricFieldUnit.VoltPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "V/m"), - }), - }), - new UnitLocalization(typeof (ElectricInductanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricInductanceUnit.Henry, - new[] - { - new AbbreviationsForCulture("en-US", "H"), - }), - }), - new UnitLocalization(typeof (ElectricPotentialUnit), - new[] - { - new CulturesForEnumValue((int) ElectricPotentialUnit.Kilovolt, - new[] - { - new AbbreviationsForCulture("en-US", "kV"), - new AbbreviationsForCulture("ru-RU", "kВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Megavolt, - new[] - { - new AbbreviationsForCulture("en-US", "MV"), - new AbbreviationsForCulture("ru-RU", "MВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Microvolt, - new[] - { - new AbbreviationsForCulture("en-US", "µV"), - new AbbreviationsForCulture("ru-RU", "µВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Millivolt, - new[] - { - new AbbreviationsForCulture("en-US", "mV"), - new AbbreviationsForCulture("ru-RU", "mВ"), - }), - new CulturesForEnumValue((int) ElectricPotentialUnit.Volt, - new[] - { - new AbbreviationsForCulture("en-US", "V"), - new AbbreviationsForCulture("ru-RU", "В"), - }), - }), - new UnitLocalization(typeof (ElectricPotentialAcUnit), - new[] - { - new CulturesForEnumValue((int) ElectricPotentialAcUnit.KilovoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "kVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.MegavoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "MVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.MicrovoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "µVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.MillivoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "mVac"), - }), - new CulturesForEnumValue((int) ElectricPotentialAcUnit.VoltAc, - new[] - { - new AbbreviationsForCulture("en-US", "Vac"), - }), - }), - new UnitLocalization(typeof (ElectricPotentialDcUnit), - new[] - { - new CulturesForEnumValue((int) ElectricPotentialDcUnit.KilovoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "kVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.MegavoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "MVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.MicrovoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "µVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.MillivoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "mVdc"), - }), - new CulturesForEnumValue((int) ElectricPotentialDcUnit.VoltDc, - new[] - { - new AbbreviationsForCulture("en-US", "Vdc"), - }), - }), - new UnitLocalization(typeof (ElectricResistanceUnit), - new[] - { - new CulturesForEnumValue((int) ElectricResistanceUnit.Kiloohm, - new[] - { - new AbbreviationsForCulture("en-US", "kΩ"), - }), - new CulturesForEnumValue((int) ElectricResistanceUnit.Megaohm, - new[] - { - new AbbreviationsForCulture("en-US", "MΩ"), - }), - new CulturesForEnumValue((int) ElectricResistanceUnit.Milliohm, - new[] - { - new AbbreviationsForCulture("en-US", "mΩ"), - }), - new CulturesForEnumValue((int) ElectricResistanceUnit.Ohm, - new[] - { - new AbbreviationsForCulture("en-US", "Ω"), - }), - }), - new UnitLocalization(typeof (ElectricResistivityUnit), - new[] - { - new CulturesForEnumValue((int) ElectricResistivityUnit.MicroohmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µΩ·m"), - }), - new CulturesForEnumValue((int) ElectricResistivityUnit.MilliohmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mΩ·m"), - }), - new CulturesForEnumValue((int) ElectricResistivityUnit.NanoohmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nΩ·m"), - }), - new CulturesForEnumValue((int) ElectricResistivityUnit.OhmMeter, - new[] - { - new AbbreviationsForCulture("en-US", "Ω·m"), - }), - }), - new UnitLocalization(typeof (EnergyUnit), - new[] - { - new CulturesForEnumValue((int) EnergyUnit.BritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "BTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.Calorie, - new[] - { - new AbbreviationsForCulture("en-US", "cal"), - }), - new CulturesForEnumValue((int) EnergyUnit.DecathermEc, - new[] - { - new AbbreviationsForCulture("en-US", "Dth (E.C.)"), - new AbbreviationsForCulture("ru-RU", "Европейский декатерм"), - }), - new CulturesForEnumValue((int) EnergyUnit.DecathermImperial, - new[] - { - new AbbreviationsForCulture("en-US", "Dth (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский декатерм"), - }), - new CulturesForEnumValue((int) EnergyUnit.DecathermUs, - new[] - { - new AbbreviationsForCulture("en-US", "Dth (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американский декатерм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ElectronVolt, - new[] - { - new AbbreviationsForCulture("en-US", "eV"), - }), - new CulturesForEnumValue((int) EnergyUnit.Erg, - new[] - { - new AbbreviationsForCulture("en-US", "erg"), - }), - new CulturesForEnumValue((int) EnergyUnit.FootPound, - new[] - { - new AbbreviationsForCulture("en-US", "ft·lb"), - }), - new CulturesForEnumValue((int) EnergyUnit.GigabritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "GBTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.GigawattHour, - new[] - { - new AbbreviationsForCulture("en-US", "GWh"), - new AbbreviationsForCulture("en-US", "GВт/ч"), - }), - new CulturesForEnumValue((int) EnergyUnit.Joule, - new[] - { - new AbbreviationsForCulture("en-US", "J"), - }), - new CulturesForEnumValue((int) EnergyUnit.KilobritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "kBTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.Kilocalorie, - new[] - { - new AbbreviationsForCulture("en-US", "kcal"), - }), - new CulturesForEnumValue((int) EnergyUnit.Kilojoule, - new[] - { - new AbbreviationsForCulture("en-US", "kJ"), - }), - new CulturesForEnumValue((int) EnergyUnit.KilowattHour, - new[] - { - new AbbreviationsForCulture("en-US", "kWh"), - new AbbreviationsForCulture("en-US", "kВт/ч"), - }), - new CulturesForEnumValue((int) EnergyUnit.MegabritishThermalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "MBTU"), - }), - new CulturesForEnumValue((int) EnergyUnit.Megajoule, - new[] - { - new AbbreviationsForCulture("en-US", "MJ"), - }), - new CulturesForEnumValue((int) EnergyUnit.MegawattHour, - new[] - { - new AbbreviationsForCulture("en-US", "MWh"), - new AbbreviationsForCulture("en-US", "MВт/ч"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermEc, - new[] - { - new AbbreviationsForCulture("en-US", "th (E.C.)"), - new AbbreviationsForCulture("ru-RU", "Европейский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermImperial, - new[] - { - new AbbreviationsForCulture("en-US", "th (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.ThermUs, - new[] - { - new AbbreviationsForCulture("en-US", "th (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американский терм"), - }), - new CulturesForEnumValue((int) EnergyUnit.WattHour, - new[] - { - new AbbreviationsForCulture("en-US", "Wh"), - new AbbreviationsForCulture("en-US", "Вт/ч"), - }), - }), - new UnitLocalization(typeof (EntropyUnit), - new[] - { - new CulturesForEnumValue((int) EntropyUnit.CaloriePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "cal/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.JoulePerDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "J/C"), - }), - new CulturesForEnumValue((int) EntropyUnit.JoulePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "J/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.KilocaloriePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.KilojoulePerDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/C"), - }), - new CulturesForEnumValue((int) EntropyUnit.KilojoulePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/K"), - }), - new CulturesForEnumValue((int) EntropyUnit.MegajoulePerKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/K"), - }), - }), - new UnitLocalization(typeof (FlowUnit), - new[] - { - new CulturesForEnumValue((int) FlowUnit.CentilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicDecimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dm³/min"), - new AbbreviationsForCulture("ru-RU", "дм³/мин"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicFootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/h", "cf/hr"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicFootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/min"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicFootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/s"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicMeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "m³/h"), - new AbbreviationsForCulture("ru-RU", "м³/ч"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicMeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "m³/min"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicMeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m³/s"), - new AbbreviationsForCulture("ru-RU", "м³/с"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicYardPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/h"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicYardPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/min"), - }), - new CulturesForEnumValue((int) FlowUnit.CubicYardPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/s"), - }), - new CulturesForEnumValue((int) FlowUnit.DecilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.KilolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.LitersPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "LPH"), - new AbbreviationsForCulture("ru-RU", "л/ч"), - }), - new CulturesForEnumValue((int) FlowUnit.LitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "LPM"), - }), - new CulturesForEnumValue((int) FlowUnit.LitersPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "LPS"), - }), - new CulturesForEnumValue((int) FlowUnit.MicrolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "µLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.MillilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "mLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.MillionUsGallonsPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "MGD"), - }), - new CulturesForEnumValue((int) FlowUnit.NanolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "nLPM"), - }), - new CulturesForEnumValue((int) FlowUnit.OilBarrelsPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/d", "BOPD"), - }), - new CulturesForEnumValue((int) FlowUnit.UsGallonsPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/h"), - }), - new CulturesForEnumValue((int) FlowUnit.UsGallonsPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/min", "GPM"), - }), - new CulturesForEnumValue((int) FlowUnit.UsGallonsPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/s"), - }), - }), - new UnitLocalization(typeof (ForceUnit), - new[] - { - new CulturesForEnumValue((int) ForceUnit.Decanewton, - new[] - { - new AbbreviationsForCulture("en-US", "daN"), - new AbbreviationsForCulture("ru-RU", "даН"), - }), - new CulturesForEnumValue((int) ForceUnit.Dyn, - new[] - { - new AbbreviationsForCulture("en-US", "dyn"), - new AbbreviationsForCulture("ru-RU", "дин"), - }), - new CulturesForEnumValue((int) ForceUnit.KilogramForce, - new[] - { - new AbbreviationsForCulture("en-US", "kgf"), - new AbbreviationsForCulture("ru-RU", "кгс"), - }), - new CulturesForEnumValue((int) ForceUnit.Kilonewton, - new[] - { - new AbbreviationsForCulture("en-US", "kN"), - new AbbreviationsForCulture("ru-RU", "кН"), - }), - new CulturesForEnumValue((int) ForceUnit.KiloPond, - new[] - { - new AbbreviationsForCulture("en-US", "kp"), - new AbbreviationsForCulture("ru-RU", "кгс"), - }), - new CulturesForEnumValue((int) ForceUnit.Meganewton, - new[] - { - new AbbreviationsForCulture("en-US", "MN"), - new AbbreviationsForCulture("ru-RU", "МН"), - }), - new CulturesForEnumValue((int) ForceUnit.Micronewton, - new[] - { - new AbbreviationsForCulture("en-US", "µN"), - new AbbreviationsForCulture("ru-RU", "мкН"), - }), - new CulturesForEnumValue((int) ForceUnit.Millinewton, - new[] - { - new AbbreviationsForCulture("en-US", "mN"), - new AbbreviationsForCulture("ru-RU", "мН"), - }), - new CulturesForEnumValue((int) ForceUnit.Newton, - new[] - { - new AbbreviationsForCulture("en-US", "N"), - new AbbreviationsForCulture("ru-RU", "Н"), - }), - new CulturesForEnumValue((int) ForceUnit.OunceForce, - new[] - { - new AbbreviationsForCulture("en-US", "ozf"), - }), - new CulturesForEnumValue((int) ForceUnit.Poundal, - new[] - { - new AbbreviationsForCulture("en-US", "pdl"), - new AbbreviationsForCulture("ru-RU", "паундаль"), - }), - new CulturesForEnumValue((int) ForceUnit.PoundForce, - new[] - { - new AbbreviationsForCulture("en-US", "lbf"), - new AbbreviationsForCulture("ru-RU", "фунт-сила"), - }), - new CulturesForEnumValue((int) ForceUnit.TonneForce, - new[] - { - new AbbreviationsForCulture("en-US", "Ton"), - new AbbreviationsForCulture("ru-RU", "тс"), - }), - }), - new UnitLocalization(typeof (ForceChangeRateUnit), - new[] - { - new CulturesForEnumValue((int) ForceChangeRateUnit.CentinewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "cN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.DecanewtonPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "daN/min"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.DecanewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "daN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.DecinewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.KilonewtonPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kN/min"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.KilonewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.MicronewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.MillinewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.NanonewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "nN/s"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.NewtonPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "N/min"), - }), - new CulturesForEnumValue((int) ForceChangeRateUnit.NewtonPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "N/s"), - }), - }), - new UnitLocalization(typeof (ForcePerLengthUnit), - new[] - { - new CulturesForEnumValue((int) ForcePerLengthUnit.CentinewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "cN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.DecinewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "dN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.KilogramForcePerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/m"), - new AbbreviationsForCulture("ru-RU", "кгс/м"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.KilonewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.MeganewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.MicronewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.MillinewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.NanonewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nN/m"), - }), - new CulturesForEnumValue((int) ForcePerLengthUnit.NewtonPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/m"), - }), - }), - new UnitLocalization(typeof (FrequencyUnit), - new[] - { - new CulturesForEnumValue((int) FrequencyUnit.CyclePerHour, - new[] - { - new AbbreviationsForCulture("en-US", "cph"), - }), - new CulturesForEnumValue((int) FrequencyUnit.CyclePerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cpm"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Gigahertz, - new[] - { - new AbbreviationsForCulture("en-US", "GHz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Hertz, - new[] - { - new AbbreviationsForCulture("en-US", "Hz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Kilohertz, - new[] - { - new AbbreviationsForCulture("en-US", "kHz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Megahertz, - new[] - { - new AbbreviationsForCulture("en-US", "MHz"), - }), - new CulturesForEnumValue((int) FrequencyUnit.RadianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "rad/s"), - }), - new CulturesForEnumValue((int) FrequencyUnit.Terahertz, - new[] - { - new AbbreviationsForCulture("en-US", "THz"), - }), - }), - new UnitLocalization(typeof (HeatFluxUnit), - new[] - { - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerHourSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/h·ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerMinuteSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/min·ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerSecondSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/s·ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.BtuPerSecondSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/s·in²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.CaloriePerSecondSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cal/s·cm²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.CentiwattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "cW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.DeciwattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "dW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.KilocaloriePerHourSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/h·m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.KilocaloriePerSecondSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/s·cm²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.KilowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.MicrowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.MilliwattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.NanowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nW/m²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.PoundForcePerFootSecond, - new[] - { - new AbbreviationsForCulture("en-US", "lbf/(ft·s)"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.PoundPerSecondCubed, - new[] - { - new AbbreviationsForCulture("en-US", "lb/s³", "lbm/s³"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.WattPerSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "W/ft²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.WattPerSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "W/in²"), - }), - new CulturesForEnumValue((int) HeatFluxUnit.WattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²"), - }), - }), - new UnitLocalization(typeof (HeatTransferCoefficientUnit), - new[] - { - new CulturesForEnumValue((int) HeatTransferCoefficientUnit.WattPerSquareMeterCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²·°C"), - }), - new CulturesForEnumValue((int) HeatTransferCoefficientUnit.WattPerSquareMeterKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²·K"), - }), - }), - new UnitLocalization(typeof (IlluminanceUnit), - new[] - { - new CulturesForEnumValue((int) IlluminanceUnit.Kilolux, - new[] - { - new AbbreviationsForCulture("en-US", "klx"), - }), - new CulturesForEnumValue((int) IlluminanceUnit.Lux, - new[] - { - new AbbreviationsForCulture("en-US", "lx"), - }), - new CulturesForEnumValue((int) IlluminanceUnit.Megalux, - new[] - { - new AbbreviationsForCulture("en-US", "Mlx"), - }), - new CulturesForEnumValue((int) IlluminanceUnit.Millilux, - new[] - { - new AbbreviationsForCulture("en-US", "mlx"), - }), - }), - new UnitLocalization(typeof (InformationUnit), - new[] - { - new CulturesForEnumValue((int) InformationUnit.Bit, - new[] - { - new AbbreviationsForCulture("en-US", "b"), - }), - new CulturesForEnumValue((int) InformationUnit.Byte, - new[] - { - new AbbreviationsForCulture("en-US", "B"), - }), - new CulturesForEnumValue((int) InformationUnit.Exabit, - new[] - { - new AbbreviationsForCulture("en-US", "Eb"), - }), - new CulturesForEnumValue((int) InformationUnit.Exabyte, - new[] - { - new AbbreviationsForCulture("en-US", "EB"), - }), - new CulturesForEnumValue((int) InformationUnit.Exbibit, - new[] - { - new AbbreviationsForCulture("en-US", "Eib"), - }), - new CulturesForEnumValue((int) InformationUnit.Exbibyte, - new[] - { - new AbbreviationsForCulture("en-US", "EiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Gibibit, - new[] - { - new AbbreviationsForCulture("en-US", "Gib"), - }), - new CulturesForEnumValue((int) InformationUnit.Gibibyte, - new[] - { - new AbbreviationsForCulture("en-US", "GiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Gigabit, - new[] - { - new AbbreviationsForCulture("en-US", "Gb"), - }), - new CulturesForEnumValue((int) InformationUnit.Gigabyte, - new[] - { - new AbbreviationsForCulture("en-US", "GB"), - }), - new CulturesForEnumValue((int) InformationUnit.Kibibit, - new[] - { - new AbbreviationsForCulture("en-US", "Kib"), - }), - new CulturesForEnumValue((int) InformationUnit.Kibibyte, - new[] - { - new AbbreviationsForCulture("en-US", "KiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Kilobit, - new[] - { - new AbbreviationsForCulture("en-US", "kb"), - }), - new CulturesForEnumValue((int) InformationUnit.Kilobyte, - new[] - { - new AbbreviationsForCulture("en-US", "kB"), - }), - new CulturesForEnumValue((int) InformationUnit.Mebibit, - new[] - { - new AbbreviationsForCulture("en-US", "Mib"), - }), - new CulturesForEnumValue((int) InformationUnit.Mebibyte, - new[] - { - new AbbreviationsForCulture("en-US", "MiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Megabit, - new[] - { - new AbbreviationsForCulture("en-US", "Mb"), - }), - new CulturesForEnumValue((int) InformationUnit.Megabyte, - new[] - { - new AbbreviationsForCulture("en-US", "MB"), - }), - new CulturesForEnumValue((int) InformationUnit.Pebibit, - new[] - { - new AbbreviationsForCulture("en-US", "Pib"), - }), - new CulturesForEnumValue((int) InformationUnit.Pebibyte, - new[] - { - new AbbreviationsForCulture("en-US", "PiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Petabit, - new[] - { - new AbbreviationsForCulture("en-US", "Pb"), - }), - new CulturesForEnumValue((int) InformationUnit.Petabyte, - new[] - { - new AbbreviationsForCulture("en-US", "PB"), - }), - new CulturesForEnumValue((int) InformationUnit.Tebibit, - new[] - { - new AbbreviationsForCulture("en-US", "Tib"), - }), - new CulturesForEnumValue((int) InformationUnit.Tebibyte, - new[] - { - new AbbreviationsForCulture("en-US", "TiB"), - }), - new CulturesForEnumValue((int) InformationUnit.Terabit, - new[] - { - new AbbreviationsForCulture("en-US", "Tb"), - }), - new CulturesForEnumValue((int) InformationUnit.Terabyte, - new[] - { - new AbbreviationsForCulture("en-US", "TB"), - }), - }), - new UnitLocalization(typeof (IrradianceUnit), - new[] - { - new CulturesForEnumValue((int) IrradianceUnit.KilowattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/m²"), - }), - new CulturesForEnumValue((int) IrradianceUnit.WattPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "W/m²"), - }), - }), - new UnitLocalization(typeof (IrradiationUnit), - new[] - { - new CulturesForEnumValue((int) IrradiationUnit.JoulePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "J/m²"), - }), - new CulturesForEnumValue((int) IrradiationUnit.KilowattHourPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kWh/m²"), - }), - new CulturesForEnumValue((int) IrradiationUnit.WattHourPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "Wh/m²"), - }), - }), - new UnitLocalization(typeof (KinematicViscosityUnit), - new[] - { - new CulturesForEnumValue((int) KinematicViscosityUnit.Centistokes, - new[] - { - new AbbreviationsForCulture("en-US", "cSt"), - new AbbreviationsForCulture("ru-RU", "сСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Decistokes, - new[] - { - new AbbreviationsForCulture("en-US", "dSt"), - new AbbreviationsForCulture("ru-RU", "дСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Kilostokes, - new[] - { - new AbbreviationsForCulture("en-US", "kSt"), - new AbbreviationsForCulture("ru-RU", "кСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Microstokes, - new[] - { - new AbbreviationsForCulture("en-US", "µSt"), - new AbbreviationsForCulture("ru-RU", "мкСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Millistokes, - new[] - { - new AbbreviationsForCulture("en-US", "mSt"), - new AbbreviationsForCulture("ru-RU", "мСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Nanostokes, - new[] - { - new AbbreviationsForCulture("en-US", "nSt"), - new AbbreviationsForCulture("ru-RU", "нСт"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.SquareMeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m²/s"), - new AbbreviationsForCulture("ru-RU", "м²/с"), - }), - new CulturesForEnumValue((int) KinematicViscosityUnit.Stokes, - new[] - { - new AbbreviationsForCulture("en-US", "St"), - new AbbreviationsForCulture("ru-RU", "Ст"), - }), - }), - new UnitLocalization(typeof (LapseRateUnit), - new[] - { - new CulturesForEnumValue((int) LapseRateUnit.DegreeCelsiusPerKilometer, - new[] - { - new AbbreviationsForCulture("en-US", "∆°C/km"), - }), - }), - new UnitLocalization(typeof (LengthUnit), - new[] - { - new CulturesForEnumValue((int) LengthUnit.Centimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cm"), - new AbbreviationsForCulture("ru-RU", "см"), - }), - new CulturesForEnumValue((int) LengthUnit.Decimeter, - new[] - { - new AbbreviationsForCulture("en-US", "dm"), - new AbbreviationsForCulture("ru-RU", "дм"), - }), - new CulturesForEnumValue((int) LengthUnit.DtpPica, - new[] - { - new AbbreviationsForCulture("en-US", "pica"), - }), - new CulturesForEnumValue((int) LengthUnit.DtpPoint, - new[] - { - new AbbreviationsForCulture("en-US", "pt"), - }), - new CulturesForEnumValue((int) LengthUnit.Fathom, - new[] - { - new AbbreviationsForCulture("en-US", "fathom"), - }), - new CulturesForEnumValue((int) LengthUnit.Foot, - new[] - { - new AbbreviationsForCulture("en-US", "ft", "'"), - new AbbreviationsForCulture("ru-RU", "фут"), - }), - new CulturesForEnumValue((int) LengthUnit.Inch, - new[] - { - new AbbreviationsForCulture("en-US", "in", "\""), - new AbbreviationsForCulture("ru-RU", "дюйм"), - }), - new CulturesForEnumValue((int) LengthUnit.Kilometer, - new[] - { - new AbbreviationsForCulture("en-US", "km"), - new AbbreviationsForCulture("ru-RU", "км"), - }), - new CulturesForEnumValue((int) LengthUnit.Meter, - new[] - { - new AbbreviationsForCulture("en-US", "m"), - new AbbreviationsForCulture("ru-RU", "м"), - }), - new CulturesForEnumValue((int) LengthUnit.Microinch, - new[] - { - new AbbreviationsForCulture("en-US", "µin"), - new AbbreviationsForCulture("ru-RU", "микродюйм"), - }), - new CulturesForEnumValue((int) LengthUnit.Micrometer, - new[] - { - new AbbreviationsForCulture("en-US", "µm"), - new AbbreviationsForCulture("ru-RU", "мкм"), - }), - new CulturesForEnumValue((int) LengthUnit.Mil, - new[] - { - new AbbreviationsForCulture("en-US", "mil"), - new AbbreviationsForCulture("ru-RU", "мил"), - }), - new CulturesForEnumValue((int) LengthUnit.Mile, - new[] - { - new AbbreviationsForCulture("en-US", "mi"), - new AbbreviationsForCulture("ru-RU", "миля"), - }), - new CulturesForEnumValue((int) LengthUnit.Millimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mm"), - new AbbreviationsForCulture("ru-RU", "мм"), - }), - new CulturesForEnumValue((int) LengthUnit.Nanometer, - new[] - { - new AbbreviationsForCulture("en-US", "nm"), - new AbbreviationsForCulture("ru-RU", "нм"), - }), - new CulturesForEnumValue((int) LengthUnit.NauticalMile, - new[] - { - new AbbreviationsForCulture("en-US", "NM"), - new AbbreviationsForCulture("ru-RU", "мил"), - }), - new CulturesForEnumValue((int) LengthUnit.PrinterPica, - new[] - { - new AbbreviationsForCulture("en-US", "pica"), - }), - new CulturesForEnumValue((int) LengthUnit.PrinterPoint, - new[] - { - new AbbreviationsForCulture("en-US", "pt"), - }), - new CulturesForEnumValue((int) LengthUnit.Shackle, - new[] - { - new AbbreviationsForCulture("en-US", "shackle"), - }), - new CulturesForEnumValue((int) LengthUnit.Twip, - new[] - { - new AbbreviationsForCulture("en-US", "twip"), - }), - new CulturesForEnumValue((int) LengthUnit.UsSurveyFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS"), - }), - new CulturesForEnumValue((int) LengthUnit.Yard, - new[] - { - new AbbreviationsForCulture("en-US", "yd"), - new AbbreviationsForCulture("ru-RU", "ярд"), - }), - }), - new UnitLocalization(typeof (LevelUnit), - new[] - { - new CulturesForEnumValue((int) LevelUnit.Decibel, - new[] - { - new AbbreviationsForCulture("en-US", "dB"), - }), - new CulturesForEnumValue((int) LevelUnit.Neper, - new[] - { - new AbbreviationsForCulture("en-US", "Np"), - }), - }), - new UnitLocalization(typeof (LinearDensityUnit), - new[] - { - new CulturesForEnumValue((int) LinearDensityUnit.GramPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g/m"), - }), - new CulturesForEnumValue((int) LinearDensityUnit.KilogramPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg/m"), - }), - new CulturesForEnumValue((int) LinearDensityUnit.PoundPerFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb/ft"), - }), - }), - new UnitLocalization(typeof (LuminousFluxUnit), - new[] - { - new CulturesForEnumValue((int) LuminousFluxUnit.Lumen, - new[] - { - new AbbreviationsForCulture("en-US", "lm"), - }), - }), - new UnitLocalization(typeof (LuminousIntensityUnit), - new[] - { - new CulturesForEnumValue((int) LuminousIntensityUnit.Candela, - new[] - { - new AbbreviationsForCulture("en-US", "cd"), - }), - }), - new UnitLocalization(typeof (MagneticFieldUnit), - new[] - { - new CulturesForEnumValue((int) MagneticFieldUnit.Tesla, - new[] - { - new AbbreviationsForCulture("en-US", "T"), - }), - }), - new UnitLocalization(typeof (MagneticFluxUnit), - new[] - { - new CulturesForEnumValue((int) MagneticFluxUnit.Weber, - new[] - { - new AbbreviationsForCulture("en-US", "Wb"), - }), - }), - new UnitLocalization(typeof (MagnetizationUnit), - new[] - { - new CulturesForEnumValue((int) MagnetizationUnit.AmperePerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "A/m"), - }), - }), - new UnitLocalization(typeof (MassUnit), - new[] - { - new CulturesForEnumValue((int) MassUnit.Centigram, - new[] - { - new AbbreviationsForCulture("en-US", "cg"), - new AbbreviationsForCulture("ru-RU", "сг"), - }), - new CulturesForEnumValue((int) MassUnit.Decagram, - new[] - { - new AbbreviationsForCulture("en-US", "dag"), - new AbbreviationsForCulture("ru-RU", "даг"), - }), - new CulturesForEnumValue((int) MassUnit.Decigram, - new[] - { - new AbbreviationsForCulture("en-US", "dg"), - new AbbreviationsForCulture("ru-RU", "дг"), - }), - new CulturesForEnumValue((int) MassUnit.Gram, - new[] - { - new AbbreviationsForCulture("en-US", "g"), - new AbbreviationsForCulture("ru-RU", "г"), - }), - new CulturesForEnumValue((int) MassUnit.Hectogram, - new[] - { - new AbbreviationsForCulture("en-US", "hg"), - new AbbreviationsForCulture("ru-RU", "гг"), - }), - new CulturesForEnumValue((int) MassUnit.Kilogram, - new[] - { - new AbbreviationsForCulture("en-US", "kg"), - new AbbreviationsForCulture("ru-RU", "кг"), - }), - new CulturesForEnumValue((int) MassUnit.Kilopound, - new[] - { - new AbbreviationsForCulture("en-US", "klb"), - new AbbreviationsForCulture("ru-RU", "kфунт"), - }), - new CulturesForEnumValue((int) MassUnit.Kilotonne, - new[] - { - new AbbreviationsForCulture("en-US", "kt"), - new AbbreviationsForCulture("ru-RU", "кт"), - }), - new CulturesForEnumValue((int) MassUnit.LongHundredweight, - new[] - { - new AbbreviationsForCulture("en-US", "cwt"), - }), - new CulturesForEnumValue((int) MassUnit.LongTon, - new[] - { - new AbbreviationsForCulture("en-US", "long tn"), - new AbbreviationsForCulture("ru-RU", "тонна большая"), - }), - new CulturesForEnumValue((int) MassUnit.Megapound, - new[] - { - new AbbreviationsForCulture("en-US", "Mlb"), - new AbbreviationsForCulture("ru-RU", "Mфунт"), - }), - new CulturesForEnumValue((int) MassUnit.Megatonne, - new[] - { - new AbbreviationsForCulture("en-US", "Mt"), - new AbbreviationsForCulture("ru-RU", "Мт"), - }), - new CulturesForEnumValue((int) MassUnit.Microgram, - new[] - { - new AbbreviationsForCulture("en-US", "µg"), - new AbbreviationsForCulture("ru-RU", "мкг"), - }), - new CulturesForEnumValue((int) MassUnit.Milligram, - new[] - { - new AbbreviationsForCulture("en-US", "mg"), - new AbbreviationsForCulture("ru-RU", "мг"), - }), - new CulturesForEnumValue((int) MassUnit.Nanogram, - new[] - { - new AbbreviationsForCulture("en-US", "ng"), - new AbbreviationsForCulture("ru-RU", "нг"), - }), - new CulturesForEnumValue((int) MassUnit.Ounce, - new[] - { - new AbbreviationsForCulture("en-US", "oz"), - }), - new CulturesForEnumValue((int) MassUnit.Pound, - new[] - { - new AbbreviationsForCulture("en-US", "lb", "lbs", "lbm"), - new AbbreviationsForCulture("ru-RU", "фунт"), - }), - new CulturesForEnumValue((int) MassUnit.ShortHundredweight, - new[] - { - new AbbreviationsForCulture("en-US", "cwt"), - }), - new CulturesForEnumValue((int) MassUnit.ShortTon, - new[] - { - new AbbreviationsForCulture("en-US", "short tn"), - new AbbreviationsForCulture("ru-RU", "тонна малая"), - }), - new CulturesForEnumValue((int) MassUnit.Slug, - new[] - { - new AbbreviationsForCulture("en-US", "slug"), - }), - new CulturesForEnumValue((int) MassUnit.Stone, - new[] - { - new AbbreviationsForCulture("en-US", "st"), - }), - new CulturesForEnumValue((int) MassUnit.Tonne, - new[] - { - new AbbreviationsForCulture("en-US", "t"), - new AbbreviationsForCulture("ru-RU", "т"), - }), - }), - new UnitLocalization(typeof (MassFlowUnit), - new[] - { - new CulturesForEnumValue((int) MassFlowUnit.CentigramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "cg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.DecagramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dag/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.DecigramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.GramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "g/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.HectogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "hg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.KilogramPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "kg/h"), - new AbbreviationsForCulture("ru-RU", "кг/ч"), - }), - new CulturesForEnumValue((int) MassFlowUnit.KilogramPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kg/min"), - new AbbreviationsForCulture("ru-RU", "кг/мин"), - }), - new CulturesForEnumValue((int) MassFlowUnit.KilogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.MegapoundPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "Mlb/h"), - }), - new CulturesForEnumValue((int) MassFlowUnit.MegapoundPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "Mlb/min"), - }), - new CulturesForEnumValue((int) MassFlowUnit.MicrogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.MilligramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mg/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.NanogramPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ng/S"), - }), - new CulturesForEnumValue((int) MassFlowUnit.PoundPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "lb/h"), - }), - new CulturesForEnumValue((int) MassFlowUnit.PoundPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "lb/min"), - }), - new CulturesForEnumValue((int) MassFlowUnit.ShortTonPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "short tn/h"), - }), - new CulturesForEnumValue((int) MassFlowUnit.TonnePerDay, - new[] - { - new AbbreviationsForCulture("en-US", "t/d"), - }), - new CulturesForEnumValue((int) MassFlowUnit.TonnePerHour, - new[] - { - new AbbreviationsForCulture("en-US", "t/h"), - }), - }), - new UnitLocalization(typeof (MassFluxUnit), - new[] - { - new CulturesForEnumValue((int) MassFluxUnit.GramPerSecondPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·s⁻¹·m⁻²"), - }), - new CulturesForEnumValue((int) MassFluxUnit.KilogramPerSecondPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·s⁻¹·m⁻²"), - }), - }), - new UnitLocalization(typeof (MassMomentOfInertiaUnit), - new[] - { - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.GramSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "g·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilogramSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kg·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.KilotonneSquareMilimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kt·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MegatonneSquareMilimeter, - new[] - { - new AbbreviationsForCulture("en-US", "Mt·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.MilligramSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mg·mm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.PoundSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb·ft²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.PoundSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "lb·in²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.SlugSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "slug·ft²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.SlugSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "slug·in²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·cm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·dm²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·m²"), - }), - new CulturesForEnumValue((int) MassMomentOfInertiaUnit.TonneSquareMilimeter, - new[] - { - new AbbreviationsForCulture("en-US", "t·mm²"), - }), - }), - new UnitLocalization(typeof (MolarEnergyUnit), - new[] - { - new CulturesForEnumValue((int) MolarEnergyUnit.JoulePerMole, - new[] - { - new AbbreviationsForCulture("en-US", "J/mol"), - }), - new CulturesForEnumValue((int) MolarEnergyUnit.KilojoulePerMole, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/mol"), - }), - new CulturesForEnumValue((int) MolarEnergyUnit.MegajoulePerMole, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/mol"), - }), - }), - new UnitLocalization(typeof (MolarEntropyUnit), - new[] - { - new CulturesForEnumValue((int) MolarEntropyUnit.JoulePerMoleKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "J/(mol*K)"), - }), - new CulturesForEnumValue((int) MolarEntropyUnit.KilojoulePerMoleKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/(mol*K)"), - }), - new CulturesForEnumValue((int) MolarEntropyUnit.MegajoulePerMoleKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/(mol*K)"), - }), - }), - new UnitLocalization(typeof (MolarityUnit), - new[] - { - new CulturesForEnumValue((int) MolarityUnit.CentimolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "cmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.DecimolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "dmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.MicromolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "µmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.MillimolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.MolesPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mol/m³"), - }), - new CulturesForEnumValue((int) MolarityUnit.MolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.NanomolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "nmol/L"), - }), - new CulturesForEnumValue((int) MolarityUnit.PicomolesPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "pmol/L"), - }), - }), - new UnitLocalization(typeof (MolarMassUnit), - new[] - { - new CulturesForEnumValue((int) MolarMassUnit.CentigramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "cg/mol"), - new AbbreviationsForCulture("ru-RU", "сг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.DecagramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "dag/mol"), - new AbbreviationsForCulture("ru-RU", "даг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.DecigramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "dg/mol"), - new AbbreviationsForCulture("ru-RU", "дг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.GramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "g/mol"), - new AbbreviationsForCulture("ru-RU", "г/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.HectogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "hg/mol"), - new AbbreviationsForCulture("ru-RU", "гг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.KilogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "kg/mol"), - new AbbreviationsForCulture("ru-RU", "кг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.KilopoundPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "klb/mol"), - new AbbreviationsForCulture("ru-RU", "kфунт/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.MegapoundPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "Mlb/mol"), - new AbbreviationsForCulture("ru-RU", "Mфунт/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.MicrogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "µg/mol"), - new AbbreviationsForCulture("ru-RU", "мкг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.MilligramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "mg/mol"), - new AbbreviationsForCulture("ru-RU", "мг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.NanogramPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "ng/mol"), - new AbbreviationsForCulture("ru-RU", "нг/моль"), - }), - new CulturesForEnumValue((int) MolarMassUnit.PoundPerMole, - new[] - { - new AbbreviationsForCulture("en-US", "lb/mol"), - new AbbreviationsForCulture("ru-RU", "фунт/моль"), - }), - }), - new UnitLocalization(typeof (PermeabilityUnit), - new[] - { - new CulturesForEnumValue((int) PermeabilityUnit.HenryPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "H/m"), - }), - }), - new UnitLocalization(typeof (PermittivityUnit), - new[] - { - new CulturesForEnumValue((int) PermittivityUnit.FaradPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "F/m"), - }), - }), - new UnitLocalization(typeof (PowerUnit), - new[] - { - new CulturesForEnumValue((int) PowerUnit.BoilerHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(S)"), - }), - new CulturesForEnumValue((int) PowerUnit.BritishThermalUnitPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "Btu/hr"), - }), - new CulturesForEnumValue((int) PowerUnit.Decawatt, - new[] - { - new AbbreviationsForCulture("en-US", "daW"), - }), - new CulturesForEnumValue((int) PowerUnit.Deciwatt, - new[] - { - new AbbreviationsForCulture("en-US", "dW"), - }), - new CulturesForEnumValue((int) PowerUnit.ElectricalHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(E)"), - }), - new CulturesForEnumValue((int) PowerUnit.Femtowatt, - new[] - { - new AbbreviationsForCulture("en-US", "fW"), - }), - new CulturesForEnumValue((int) PowerUnit.Gigawatt, - new[] - { - new AbbreviationsForCulture("en-US", "GW"), - }), - new CulturesForEnumValue((int) PowerUnit.HydraulicHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(H)"), - }), - new CulturesForEnumValue((int) PowerUnit.KilobritishThermalUnitPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "kBtu/hr"), - }), - new CulturesForEnumValue((int) PowerUnit.Kilowatt, - new[] - { - new AbbreviationsForCulture("en-US", "kW"), - }), - new CulturesForEnumValue((int) PowerUnit.MechanicalHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(I)"), - }), - new CulturesForEnumValue((int) PowerUnit.Megawatt, - new[] - { - new AbbreviationsForCulture("en-US", "MW"), - }), - new CulturesForEnumValue((int) PowerUnit.MetricHorsepower, - new[] - { - new AbbreviationsForCulture("en-US", "hp(M)"), - }), - new CulturesForEnumValue((int) PowerUnit.Microwatt, - new[] - { - new AbbreviationsForCulture("en-US", "µW"), - }), - new CulturesForEnumValue((int) PowerUnit.Milliwatt, - new[] - { - new AbbreviationsForCulture("en-US", "mW"), - }), - new CulturesForEnumValue((int) PowerUnit.Nanowatt, - new[] - { - new AbbreviationsForCulture("en-US", "nW"), - }), - new CulturesForEnumValue((int) PowerUnit.Petawatt, - new[] - { - new AbbreviationsForCulture("en-US", "PW"), - }), - new CulturesForEnumValue((int) PowerUnit.Picowatt, - new[] - { - new AbbreviationsForCulture("en-US", "pW"), - }), - new CulturesForEnumValue((int) PowerUnit.Terawatt, - new[] - { - new AbbreviationsForCulture("en-US", "TW"), - }), - new CulturesForEnumValue((int) PowerUnit.Watt, - new[] - { - new AbbreviationsForCulture("en-US", "W"), - }), - }), - new UnitLocalization(typeof (PowerDensityUnit), - new[] - { - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "daW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "daW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "daW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DecawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "daW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "dW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "dW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "dW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.DeciwattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "dW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "GW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "GW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "GW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.GigawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "GW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "kW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.KilowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "kW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "MW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "MW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MegawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "MW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "µW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "µW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "µW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MicrowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "µW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "mW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "mW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "mW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.MilliwattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "mW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "nW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "nW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "nW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.NanowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "nW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "pW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "pW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "pW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.PicowattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "pW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "TW/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "TW/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "TW/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.TerawattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "TW/l"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "W/ft³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "W/in³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "W/m³"), - }), - new CulturesForEnumValue((int) PowerDensityUnit.WattPerLiter, - new[] - { - new AbbreviationsForCulture("en-US", "W/l"), - }), - }), - new UnitLocalization(typeof (PowerRatioUnit), - new[] - { - new CulturesForEnumValue((int) PowerRatioUnit.DecibelMilliwatt, - new[] - { - new AbbreviationsForCulture("en-US", "dBmW", "dBm"), - }), - new CulturesForEnumValue((int) PowerRatioUnit.DecibelWatt, - new[] - { - new AbbreviationsForCulture("en-US", "dBW"), - }), - }), - new UnitLocalization(typeof (PressureUnit), - new[] - { - new CulturesForEnumValue((int) PressureUnit.Atmosphere, - new[] - { - new AbbreviationsForCulture("en-US", "atm"), - new AbbreviationsForCulture("ru-RU", "атм"), - }), - new CulturesForEnumValue((int) PressureUnit.Bar, - new[] - { - new AbbreviationsForCulture("en-US", "bar"), - new AbbreviationsForCulture("ru-RU", "бар"), - }), - new CulturesForEnumValue((int) PressureUnit.Centibar, - new[] - { - new AbbreviationsForCulture("en-US", "cbar"), - new AbbreviationsForCulture("ru-RU", "cбар"), - }), - new CulturesForEnumValue((int) PressureUnit.Decapascal, - new[] - { - new AbbreviationsForCulture("en-US", "daPa"), - new AbbreviationsForCulture("ru-RU", "даПа"), - }), - new CulturesForEnumValue((int) PressureUnit.Decibar, - new[] - { - new AbbreviationsForCulture("en-US", "dbar"), - new AbbreviationsForCulture("ru-RU", "dбар"), - }), - new CulturesForEnumValue((int) PressureUnit.DynePerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "dyn/cm²"), - }), - new CulturesForEnumValue((int) PressureUnit.FootOfHead, - new[] - { - new AbbreviationsForCulture("en-US", "ft of head"), - }), - new CulturesForEnumValue((int) PressureUnit.Gigapascal, - new[] - { - new AbbreviationsForCulture("en-US", "GPa"), - new AbbreviationsForCulture("ru-RU", "ГПа"), - }), - new CulturesForEnumValue((int) PressureUnit.Hectopascal, - new[] - { - new AbbreviationsForCulture("en-US", "hPa"), - new AbbreviationsForCulture("ru-RU", "гПа"), - }), - new CulturesForEnumValue((int) PressureUnit.InchOfMercury, - new[] - { - new AbbreviationsForCulture("en-US", "inHg"), - }), - new CulturesForEnumValue((int) PressureUnit.Kilobar, - new[] - { - new AbbreviationsForCulture("en-US", "kbar"), - new AbbreviationsForCulture("ru-RU", "kбар"), - }), - new CulturesForEnumValue((int) PressureUnit.KilogramForcePerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/cm²"), - new AbbreviationsForCulture("ru-RU", "кгс/см²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilogramForcePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/m²"), - new AbbreviationsForCulture("ru-RU", "кгс/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilogramForcePerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/mm²"), - new AbbreviationsForCulture("ru-RU", "кгс/мм²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilonewtonPerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/cm²"), - new AbbreviationsForCulture("ru-RU", "кН/см²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilonewtonPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/m²"), - new AbbreviationsForCulture("ru-RU", "кН/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilonewtonPerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/mm²"), - new AbbreviationsForCulture("ru-RU", "кН/мм²"), - }), - new CulturesForEnumValue((int) PressureUnit.Kilopascal, - new[] - { - new AbbreviationsForCulture("en-US", "kPa"), - new AbbreviationsForCulture("ru-RU", "кПа"), - }), - new CulturesForEnumValue((int) PressureUnit.KilopoundForcePerSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/ft²"), - }), - new CulturesForEnumValue((int) PressureUnit.KilopoundForcePerSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/in²"), - }), - new CulturesForEnumValue((int) PressureUnit.Megabar, - new[] - { - new AbbreviationsForCulture("en-US", "Mbar"), - new AbbreviationsForCulture("ru-RU", "Mбар"), - }), - new CulturesForEnumValue((int) PressureUnit.MeganewtonPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN/m²"), - new AbbreviationsForCulture("ru-RU", "Мн/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.Megapascal, - new[] - { - new AbbreviationsForCulture("en-US", "MPa"), - new AbbreviationsForCulture("ru-RU", "МПа"), - }), - new CulturesForEnumValue((int) PressureUnit.MeterOfHead, - new[] - { - new AbbreviationsForCulture("en-US", "m of head"), - }), - new CulturesForEnumValue((int) PressureUnit.Microbar, - new[] - { - new AbbreviationsForCulture("en-US", "µbar"), - new AbbreviationsForCulture("ru-RU", "µбар"), - }), - new CulturesForEnumValue((int) PressureUnit.Micropascal, - new[] - { - new AbbreviationsForCulture("en-US", "µPa"), - new AbbreviationsForCulture("ru-RU", "мкПа"), - }), - new CulturesForEnumValue((int) PressureUnit.Millibar, - new[] - { - new AbbreviationsForCulture("en-US", "mbar"), - new AbbreviationsForCulture("ru-RU", "mбар"), - }), - new CulturesForEnumValue((int) PressureUnit.MillimeterOfMercury, - new[] - { - new AbbreviationsForCulture("en-US", "mmHg"), - }), - new CulturesForEnumValue((int) PressureUnit.NewtonPerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/cm²"), - new AbbreviationsForCulture("ru-RU", "Н/см²"), - }), - new CulturesForEnumValue((int) PressureUnit.NewtonPerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/m²"), - new AbbreviationsForCulture("ru-RU", "Н/м²"), - }), - new CulturesForEnumValue((int) PressureUnit.NewtonPerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/mm²"), - new AbbreviationsForCulture("ru-RU", "Н/мм²"), - }), - new CulturesForEnumValue((int) PressureUnit.Pascal, - new[] - { - new AbbreviationsForCulture("en-US", "Pa"), - new AbbreviationsForCulture("ru-RU", "Па"), - }), - new CulturesForEnumValue((int) PressureUnit.PoundForcePerSquareFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lb/ft²"), - }), - new CulturesForEnumValue((int) PressureUnit.PoundForcePerSquareInch, - new[] - { - new AbbreviationsForCulture("en-US", "psi", "lb/in²"), - }), - new CulturesForEnumValue((int) PressureUnit.PoundPerInchSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "lbm/(in·s²)", "lb/(in·s²)"), - }), - new CulturesForEnumValue((int) PressureUnit.Psi, - new[] - { - new AbbreviationsForCulture("en-US", "psi"), - new AbbreviationsForCulture("ru-RU", "psi"), - }), - new CulturesForEnumValue((int) PressureUnit.TechnicalAtmosphere, - new[] - { - new AbbreviationsForCulture("en-US", "at"), - new AbbreviationsForCulture("ru-RU", "ат"), - }), - new CulturesForEnumValue((int) PressureUnit.TonneForcePerSquareCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/cm²"), - }), - new CulturesForEnumValue((int) PressureUnit.TonneForcePerSquareMeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/m²"), - }), - new CulturesForEnumValue((int) PressureUnit.TonneForcePerSquareMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/mm²"), - }), - new CulturesForEnumValue((int) PressureUnit.Torr, - new[] - { - new AbbreviationsForCulture("en-US", "torr"), - new AbbreviationsForCulture("ru-RU", "торр"), - }), - }), - new UnitLocalization(typeof (PressureChangeRateUnit), - new[] - { - new CulturesForEnumValue((int) PressureChangeRateUnit.AtmospherePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "atm/s"), - new AbbreviationsForCulture("ru-RU", "атм/с"), - }), - new CulturesForEnumValue((int) PressureChangeRateUnit.KilopascalPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "kPa/s"), - new AbbreviationsForCulture("ru-RU", "кПа/с"), - }), - new CulturesForEnumValue((int) PressureChangeRateUnit.MegapascalPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "MPa/s"), - new AbbreviationsForCulture("ru-RU", "МПа/с"), - }), - new CulturesForEnumValue((int) PressureChangeRateUnit.PascalPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "Pa/s"), - new AbbreviationsForCulture("ru-RU", "Па/с"), - }), - }), - new UnitLocalization(typeof (RatioUnit), - new[] - { - new CulturesForEnumValue((int) RatioUnit.DecimalFraction, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerBillion, - new[] - { - new AbbreviationsForCulture("en-US", "ppb"), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerMillion, - new[] - { - new AbbreviationsForCulture("en-US", "ppm"), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerThousand, - new[] - { - new AbbreviationsForCulture("en-US", "‰"), - }), - new CulturesForEnumValue((int) RatioUnit.PartPerTrillion, - new[] - { - new AbbreviationsForCulture("en-US", "ppt"), - }), - new CulturesForEnumValue((int) RatioUnit.Percent, - new[] - { - new AbbreviationsForCulture("en-US", "%"), - }), - }), - new UnitLocalization(typeof (ReactiveEnergyUnit), - new[] - { - new CulturesForEnumValue((int) ReactiveEnergyUnit.KilovoltampereReactiveHour, - new[] - { - new AbbreviationsForCulture("en-US", "kvarh"), - }), - new CulturesForEnumValue((int) ReactiveEnergyUnit.MegavoltampereReactiveHour, - new[] - { - new AbbreviationsForCulture("en-US", "Mvarh"), - }), - new CulturesForEnumValue((int) ReactiveEnergyUnit.VoltampereReactiveHour, - new[] - { - new AbbreviationsForCulture("en-US", "varh"), - }), - }), - new UnitLocalization(typeof (ReactivePowerUnit), - new[] - { - new CulturesForEnumValue((int) ReactivePowerUnit.GigavoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "Gvar"), - }), - new CulturesForEnumValue((int) ReactivePowerUnit.KilovoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "kvar"), - }), - new CulturesForEnumValue((int) ReactivePowerUnit.MegavoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "Mvar"), - }), - new CulturesForEnumValue((int) ReactivePowerUnit.VoltampereReactive, - new[] - { - new AbbreviationsForCulture("en-US", "var"), - }), - }), - new UnitLocalization(typeof (RotationalAccelerationUnit), - new[] - { - new CulturesForEnumValue((int) RotationalAccelerationUnit.DegreePerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "°/s²", "deg/s²"), - }), - new CulturesForEnumValue((int) RotationalAccelerationUnit.RadianPerSecondSquared, - new[] - { - new AbbreviationsForCulture("en-US", "rad/s²"), - }), - new CulturesForEnumValue((int) RotationalAccelerationUnit.RevolutionPerMinutePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "rpm/s"), - }), - }), - new UnitLocalization(typeof (RotationalSpeedUnit), - new[] - { - new CulturesForEnumValue((int) RotationalSpeedUnit.CentiradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "crad/s"), - new AbbreviationsForCulture("ru-RU", "cрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.DeciradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "drad/s"), - new AbbreviationsForCulture("ru-RU", "dрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.DegreePerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "°/min", "deg/min"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.DegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "°/s", "deg/s"), - new AbbreviationsForCulture("ru-RU", "°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MicrodegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µ°/s"), - new AbbreviationsForCulture("ru-RU", "µ°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MicroradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µrad/s"), - new AbbreviationsForCulture("ru-RU", "µрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MillidegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m°/s"), - new AbbreviationsForCulture("ru-RU", "m°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.MilliradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mrad/s"), - new AbbreviationsForCulture("ru-RU", "mрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.NanodegreePerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "n°/s"), - new AbbreviationsForCulture("ru-RU", "n°/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.NanoradianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "nrad/s"), - new AbbreviationsForCulture("ru-RU", "nрад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.RadianPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "rad/s"), - new AbbreviationsForCulture("ru-RU", "рад/с"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.RevolutionPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "rpm", "r/min"), - new AbbreviationsForCulture("ru-RU", "об/мин"), - }), - new CulturesForEnumValue((int) RotationalSpeedUnit.RevolutionPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "r/s"), - new AbbreviationsForCulture("ru-RU", "об/с"), - }), - }), - new UnitLocalization(typeof (RotationalStiffnessUnit), - new[] - { - new CulturesForEnumValue((int) RotationalStiffnessUnit.KilonewtonMeterPerRadian, - new[] - { - new AbbreviationsForCulture("en-US", "kN·m/rad"), - }), - new CulturesForEnumValue((int) RotationalStiffnessUnit.MeganewtonMeterPerRadian, - new[] - { - new AbbreviationsForCulture("en-US", "MN·m/rad"), - }), - new CulturesForEnumValue((int) RotationalStiffnessUnit.NewtonMeterPerRadian, - new[] - { - new AbbreviationsForCulture("en-US", "N·m/rad", "Nm/rad"), - }), - }), - new UnitLocalization(typeof (RotationalStiffnessPerLengthUnit), - new[] - { - new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·m/rad/m"), - }), - new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·m/rad/m"), - }), - new CulturesForEnumValue((int) RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·m/rad/m", "Nm/rad/m"), - }), - }), - new UnitLocalization(typeof (SolidAngleUnit), - new[] - { - new CulturesForEnumValue((int) SolidAngleUnit.Steradian, - new[] - { - new AbbreviationsForCulture("en-US", "sr"), - }), - }), - new UnitLocalization(typeof (SpecificEnergyUnit), - new[] - { - new CulturesForEnumValue((int) SpecificEnergyUnit.CaloriePerGram, - new[] - { - new AbbreviationsForCulture("en-US", "cal/g"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.JoulePerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "J/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.KilocaloriePerGram, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/g"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.KilojoulePerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.KilowattHourPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "kWh/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.MegajoulePerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.MegawattHourPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "MWh/kg"), - }), - new CulturesForEnumValue((int) SpecificEnergyUnit.WattHourPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "Wh/kg"), - }), - }), - new UnitLocalization(typeof (SpecificEntropyUnit), - new[] - { - new CulturesForEnumValue((int) SpecificEntropyUnit.CaloriePerGramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "cal/g.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.JoulePerKilogramDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "J/kg.C"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.JoulePerKilogramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "J/kg.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.KilocaloriePerGramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kcal/g.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.KilojoulePerKilogramDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/kg.C"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.KilojoulePerKilogramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "kJ/kg.K"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.MegajoulePerKilogramDegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/kg.C"), - }), - new CulturesForEnumValue((int) SpecificEntropyUnit.MegajoulePerKilogramKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "MJ/kg.K"), - }), - }), - new UnitLocalization(typeof (SpecificVolumeUnit), - new[] - { - new CulturesForEnumValue((int) SpecificVolumeUnit.CubicFootPerPound, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/lb"), - }), - new CulturesForEnumValue((int) SpecificVolumeUnit.CubicMeterPerKilogram, - new[] - { - new AbbreviationsForCulture("en-US", "m³/kg"), - }), - }), - new UnitLocalization(typeof (SpecificWeightUnit), - new[] - { - new CulturesForEnumValue((int) SpecificWeightUnit.KilogramForcePerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilogramForcePerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilogramForcePerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf/mm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilonewtonPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilonewtonPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilonewtonPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN/mm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilopoundForcePerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/ft³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.KilopoundForcePerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "kipf/in³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.MeganewtonPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.NewtonPerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.NewtonPerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.NewtonPerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N/mm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.PoundForcePerCubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lbf/ft³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.PoundForcePerCubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "lbf/in³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.TonneForcePerCubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/cm³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.TonneForcePerCubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/m³"), - }), - new CulturesForEnumValue((int) SpecificWeightUnit.TonneForcePerCubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf/mm³"), - }), - }), - new UnitLocalization(typeof (SpeedUnit), - new[] - { - new CulturesForEnumValue((int) SpeedUnit.CentimeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "cm/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.CentimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.CentimeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "cm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.DecimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.DecimeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "dm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.FootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ft/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.FootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ft/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.FootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ft/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.InchPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "in/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.InchPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "in/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.InchPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "in/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.KilometerPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "km/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.KilometerPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "km/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.KilometerPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "km/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.Knot, - new[] - { - new AbbreviationsForCulture("en-US", "kn", "kt", "knot", "knots"), - }), - new CulturesForEnumValue((int) SpeedUnit.MeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "m/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.MeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "m/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.MeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.MicrometerPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "µm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.MicrometerPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.MilePerHour, - new[] - { - new AbbreviationsForCulture("en-US", "mph"), - }), - new CulturesForEnumValue((int) SpeedUnit.MillimeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "mm/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.MillimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "mm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.MillimeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "mm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.NanometerPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "nm/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.NanometerPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "nm/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.UsSurveyFootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.UsSurveyFootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.UsSurveyFootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ftUS/s"), - }), - new CulturesForEnumValue((int) SpeedUnit.YardPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "yd/h"), - }), - new CulturesForEnumValue((int) SpeedUnit.YardPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "yd/min"), - }), - new CulturesForEnumValue((int) SpeedUnit.YardPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "yd/s"), - }), - }), - new UnitLocalization(typeof (TemperatureUnit), - new[] - { - new CulturesForEnumValue((int) TemperatureUnit.DegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "°C"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeDelisle, - new[] - { - new AbbreviationsForCulture("en-US", "°De"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeFahrenheit, - new[] - { - new AbbreviationsForCulture("en-US", "°F"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeNewton, - new[] - { - new AbbreviationsForCulture("en-US", "°N"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeRankine, - new[] - { - new AbbreviationsForCulture("en-US", "°R"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeReaumur, - new[] - { - new AbbreviationsForCulture("en-US", "°Ré"), - }), - new CulturesForEnumValue((int) TemperatureUnit.DegreeRoemer, - new[] - { - new AbbreviationsForCulture("en-US", "°Rø"), - }), - new CulturesForEnumValue((int) TemperatureUnit.Kelvin, - new[] - { - new AbbreviationsForCulture("en-US", "K"), - }), - }), - new UnitLocalization(typeof (TemperatureChangeRateUnit), - new[] - { - new CulturesForEnumValue((int) TemperatureChangeRateUnit.CentidegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "c°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DecadegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "da°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DecidegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "d°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DegreeCelsiusPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "°C/min"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.DegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "h°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "k°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "µ°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.MillidegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m°C/s"), - }), - new CulturesForEnumValue((int) TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "n°C/s"), - }), - }), - new UnitLocalization(typeof (TemperatureDeltaUnit), - new[] - { - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeCelsius, - new[] - { - new AbbreviationsForCulture("en-US", "∆°C"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeCelsiusDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°C"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeDelisle, - new[] - { - new AbbreviationsForCulture("en-US", "∆°De"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeDelisleDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°De"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeFahrenheit, - new[] - { - new AbbreviationsForCulture("en-US", "∆°F"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeFahrenheitDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°F"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeNewton, - new[] - { - new AbbreviationsForCulture("en-US", "∆°N"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeNewtonDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°N"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRankine, - new[] - { - new AbbreviationsForCulture("en-US", "∆°R"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRankineDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°R"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeReaumur, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Ré"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeReaumurDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Ré"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRoemer, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Rø"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.DegreeRoemerDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆°Rø"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.Kelvin, - new[] - { - new AbbreviationsForCulture("en-US", "∆K"), - }), - new CulturesForEnumValue((int) TemperatureDeltaUnit.KelvinDelta, - new[] - { - new AbbreviationsForCulture("en-US", "∆K"), - }), - }), - new UnitLocalization(typeof (ThermalConductivityUnit), - new[] - { - new CulturesForEnumValue((int) ThermalConductivityUnit.BtuPerHourFootFahrenheit, - new[] - { - new AbbreviationsForCulture("en-US", "BTU/h·ft·°F"), - }), - new CulturesForEnumValue((int) ThermalConductivityUnit.WattPerMeterKelvin, - new[] - { - new AbbreviationsForCulture("en-US", "W/m·K"), - }), - }), - new UnitLocalization(typeof (ThermalResistanceUnit), - new[] - { - new CulturesForEnumValue((int) ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, - new[] - { - new AbbreviationsForCulture("en-US", "Hrft²°F/Btu"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareCentimeterHourDegreeCelsiusPerKilocalorie, - new[] - { - new AbbreviationsForCulture("en-US", "cm²Hr°C/kcal"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareCentimeterKelvinPerWatt, - new[] - { - new AbbreviationsForCulture("en-US", "cm²K/W"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareMeterDegreeCelsiusPerWatt, - new[] - { - new AbbreviationsForCulture("en-US", "m²°C/W"), - }), - new CulturesForEnumValue((int) ThermalResistanceUnit.SquareMeterKelvinPerKilowatt, - new[] - { - new AbbreviationsForCulture("en-US", "m²K/kW"), - }), - }), - new UnitLocalization(typeof (TorqueUnit), - new[] - { - new CulturesForEnumValue((int) TorqueUnit.KilogramForceCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilogramForceMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf·m"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilogramForceMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kgf·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilonewtonCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilonewtonMeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·m"), - new AbbreviationsForCulture("ru-RU", "кН·м"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilonewtonMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "kN·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilopoundForceFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kipf·ft"), - }), - new CulturesForEnumValue((int) TorqueUnit.KilopoundForceInch, - new[] - { - new AbbreviationsForCulture("en-US", "kipf·in"), - }), - new CulturesForEnumValue((int) TorqueUnit.MeganewtonCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.MeganewtonMeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·m"), - new AbbreviationsForCulture("ru-RU", "МН·м"), - }), - new CulturesForEnumValue((int) TorqueUnit.MeganewtonMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "MN·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.MegapoundForceFoot, - new[] - { - new AbbreviationsForCulture("en-US", "Mlbf·ft"), - }), - new CulturesForEnumValue((int) TorqueUnit.MegapoundForceInch, - new[] - { - new AbbreviationsForCulture("en-US", "Mlbf·in"), - }), - new CulturesForEnumValue((int) TorqueUnit.NewtonCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.NewtonMeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·m"), - new AbbreviationsForCulture("ru-RU", "Н·м"), - }), - new CulturesForEnumValue((int) TorqueUnit.NewtonMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "N·mm"), - }), - new CulturesForEnumValue((int) TorqueUnit.PoundForceFoot, - new[] - { - new AbbreviationsForCulture("en-US", "lbf·ft"), - }), - new CulturesForEnumValue((int) TorqueUnit.PoundForceInch, - new[] - { - new AbbreviationsForCulture("en-US", "lbf·in"), - }), - new CulturesForEnumValue((int) TorqueUnit.TonneForceCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf·cm"), - }), - new CulturesForEnumValue((int) TorqueUnit.TonneForceMeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf·m"), - }), - new CulturesForEnumValue((int) TorqueUnit.TonneForceMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "tf·mm"), - }), - }), - new UnitLocalization(typeof (VitaminAUnit), - new[] - { - new CulturesForEnumValue((int) VitaminAUnit.InternationalUnit, - new[] - { - new AbbreviationsForCulture("en-US", "IU"), - }), - }), - new UnitLocalization(typeof (VolumeUnit), - new[] - { - new CulturesForEnumValue((int) VolumeUnit.AuTablespoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.Centiliter, - new[] - { - new AbbreviationsForCulture("en-US", "cl"), - new AbbreviationsForCulture("ru-RU", "сл"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicCentimeter, - new[] - { - new AbbreviationsForCulture("en-US", "cm³"), - new AbbreviationsForCulture("ru-RU", "см³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicDecimeter, - new[] - { - new AbbreviationsForCulture("en-US", "dm³"), - new AbbreviationsForCulture("ru-RU", "дм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "ft³"), - new AbbreviationsForCulture("ru-RU", "фут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicInch, - new[] - { - new AbbreviationsForCulture("en-US", "in³"), - new AbbreviationsForCulture("ru-RU", "дюйм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicKilometer, - new[] - { - new AbbreviationsForCulture("en-US", "km³"), - new AbbreviationsForCulture("ru-RU", "км³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "m³"), - new AbbreviationsForCulture("ru-RU", "м³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMicrometer, - new[] - { - new AbbreviationsForCulture("en-US", "µm³"), - new AbbreviationsForCulture("ru-RU", "мкм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMile, - new[] - { - new AbbreviationsForCulture("en-US", "mi³"), - new AbbreviationsForCulture("ru-RU", "миля³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicMillimeter, - new[] - { - new AbbreviationsForCulture("en-US", "mm³"), - new AbbreviationsForCulture("ru-RU", "мм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.CubicYard, - new[] - { - new AbbreviationsForCulture("en-US", "yd³"), - new AbbreviationsForCulture("ru-RU", "ярд³"), - }), - new CulturesForEnumValue((int) VolumeUnit.Deciliter, - new[] - { - new AbbreviationsForCulture("en-US", "dl"), - new AbbreviationsForCulture("ru-RU", "дл"), - }), - new CulturesForEnumValue((int) VolumeUnit.HectocubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "hft³"), - new AbbreviationsForCulture("ru-RU", "hфут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.HectocubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "hm³"), - new AbbreviationsForCulture("ru-RU", "hм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.Hectoliter, - new[] - { - new AbbreviationsForCulture("en-US", "hl"), - new AbbreviationsForCulture("ru-RU", "гл"), - }), - new CulturesForEnumValue((int) VolumeUnit.ImperialBeerBarrel, - new[] - { - new AbbreviationsForCulture("en-US", "bl (imp.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.ImperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "gal (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.ImperialOunce, - new[] - { - new AbbreviationsForCulture("en-US", "oz (imp.)"), - new AbbreviationsForCulture("ru-RU", "Английская унция"), - }), - new CulturesForEnumValue((int) VolumeUnit.KilocubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "kft³"), - new AbbreviationsForCulture("ru-RU", "kфут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.KilocubicMeter, - new[] - { - new AbbreviationsForCulture("en-US", "km³"), - new AbbreviationsForCulture("ru-RU", "kм³"), - }), - new CulturesForEnumValue((int) VolumeUnit.KiloimperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "kgal (imp.)"), - new AbbreviationsForCulture("ru-RU", "kАнглийский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.Kiloliter, - new[] - { - new AbbreviationsForCulture("en-US", "kl"), - new AbbreviationsForCulture("ru-RU", "кл"), - }), - new CulturesForEnumValue((int) VolumeUnit.KilousGallon, - new[] - { - new AbbreviationsForCulture("en-US", "kgal (U.S.)"), - new AbbreviationsForCulture("ru-RU", "kАмериканский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.Liter, - new[] - { - new AbbreviationsForCulture("en-US", "l"), - new AbbreviationsForCulture("ru-RU", "л"), - }), - new CulturesForEnumValue((int) VolumeUnit.MegacubicFoot, - new[] - { - new AbbreviationsForCulture("en-US", "Mft³"), - new AbbreviationsForCulture("ru-RU", "Mфут³"), - }), - new CulturesForEnumValue((int) VolumeUnit.MegaimperialGallon, - new[] - { - new AbbreviationsForCulture("en-US", "Mgal (imp.)"), - new AbbreviationsForCulture("ru-RU", "MАнглийский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.MegausGallon, - new[] - { - new AbbreviationsForCulture("en-US", "Mgal (U.S.)"), - new AbbreviationsForCulture("ru-RU", "MАмериканский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.MetricCup, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.MetricTeaspoon, - new[] - { - new AbbreviationsForCulture("en-US", "tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.Microliter, - new[] - { - new AbbreviationsForCulture("en-US", "µl"), - new AbbreviationsForCulture("ru-RU", "мкл"), - }), - new CulturesForEnumValue((int) VolumeUnit.Milliliter, - new[] - { - new AbbreviationsForCulture("en-US", "ml"), - new AbbreviationsForCulture("ru-RU", "мл"), - }), - new CulturesForEnumValue((int) VolumeUnit.OilBarrel, - new[] - { - new AbbreviationsForCulture("en-US", "bbl"), - }), - new CulturesForEnumValue((int) VolumeUnit.Tablespoon, - new[] - { - new AbbreviationsForCulture("en-US", "Tbsp", "Tbs", "T", "tb", "tbs", "tbsp", "tblsp", "tblspn", "Tbsp.", "Tbs.", "T.", "tb.", "tbs.", "tbsp.", "tblsp.", "tblspn.", "tablespoon", "Tablespoon"), - new AbbreviationsForCulture("ru-RU", "столовая ложка"), - new AbbreviationsForCulture("nb-NO", "ss", "ss.", "SS", "SS."), - }), - new CulturesForEnumValue((int) VolumeUnit.Teaspoon, - new[] - { - new AbbreviationsForCulture("en-US", "tsp", "t", "ts", "tspn", "t.", "ts.", "tsp.", "tspn.", "teaspoon"), - new AbbreviationsForCulture("ru-RU", "чайная ложка"), - new AbbreviationsForCulture("nb-NO", "ts", "ts."), - }), - new CulturesForEnumValue((int) VolumeUnit.UkTablespoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsBeerBarrel, - new[] - { - new AbbreviationsForCulture("en-US", "bl (U.S.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsCustomaryCup, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsGallon, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американский галлон"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsLegalCup, - new[] - { - new AbbreviationsForCulture("en-US", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsOunce, - new[] - { - new AbbreviationsForCulture("en-US", "oz (U.S.)"), - new AbbreviationsForCulture("ru-RU", "Американская унция"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsPint, - new[] - { - new AbbreviationsForCulture("en-US", "pt (U.S.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsQuart, - new[] - { - new AbbreviationsForCulture("en-US", "qt (U.S.)"), - }), - new CulturesForEnumValue((int) VolumeUnit.UsTablespoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - new CulturesForEnumValue((int) VolumeUnit.UsTeaspoon, - new[] - { - new AbbreviationsForCulture("en-US", ""), - new AbbreviationsForCulture("ru-RU", ""), - new AbbreviationsForCulture("nb-NO", ""), - }), - }), - new UnitLocalization(typeof (VolumeFlowUnit), - new[] - { - new CulturesForEnumValue((int) VolumeFlowUnit.CentilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "cLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicDecimeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dm³/min"), - new AbbreviationsForCulture("ru-RU", "дм³/мин"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicFootPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/h", "cf/hr"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicFootPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/min"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicFootPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "ft³/s"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicMeterPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "m³/h"), - new AbbreviationsForCulture("ru-RU", "м³/ч"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicMeterPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "m³/min"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicMeterPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "m³/s"), - new AbbreviationsForCulture("ru-RU", "м³/с"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicYardPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/h"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicYardPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/min"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.CubicYardPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "yd³/s"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.DecilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "dLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.KilolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.KilousGallonsPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "kgal (U.S.)/min", "KGPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.LitersPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "LPH"), - new AbbreviationsForCulture("ru-RU", "л/ч"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.LitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "LPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.LitersPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "LPS"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.MicrolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "µLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.MillilitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "mLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.MillionUsGallonsPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "MGD"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.NanolitersPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "nLPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelsPerDay, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/d", "BOPD"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelsPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/hr", "bph"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.OilBarrelsPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "bbl/min", "bpm"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonsPerHour, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/h"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonsPerMinute, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/min", "GPM"), - }), - new CulturesForEnumValue((int) VolumeFlowUnit.UsGallonsPerSecond, - new[] - { - new AbbreviationsForCulture("en-US", "gal (U.S.)/s"), - }), - }), - }); - } -} From 9b23a8ea133a3766503f3c58476fcee5d32c997d Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 16 Nov 2018 16:44:17 +0100 Subject: [PATCH 129/131] appveyor: Do not publish symbols packages We no longer create them. --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c23a8354d7..00cc0a7c0b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,13 +52,11 @@ deploy: - provider: NuGet api_key: secure: NlJ+D6kXfgU6RgRuf9okylLDENp8DA3tTRSC6UHBNbRS9ZAvRrC3Z0++Mr5VtGvz - skip_symbols: false on: branch: master - provider: NuGet api_key: secure: NlJ+D6kXfgU6RgRuf9okylLDENp8DA3tTRSC6UHBNbRS9ZAvRrC3Z0++Mr5VtGvz - skip_symbols: false on: branch: v4 From db3caa9798efbba2be7b6bdad9e36252a9ffb2e5 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 16 Nov 2018 23:32:16 +0100 Subject: [PATCH 130/131] Revert "Publish nugets on v4 branch instead of release/v4" This reverts commit f28d0094f317934f815e0799e8be20218d7942c3. It turns out I forgot I did it this way, because skip_branch_with_pr:true setting prevented branch build - and PR builds do not deploy nugets. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 00cc0a7c0b..06eaf58c3f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -59,4 +59,4 @@ deploy: api_key: secure: NlJ+D6kXfgU6RgRuf9okylLDENp8DA3tTRSC6UHBNbRS9ZAvRrC3Z0++Mr5VtGvz on: - branch: v4 + branch: release/v4 From ab6bd32010929865b8ad0230704b762193dae5c3 Mon Sep 17 00:00:00 2001 From: Tristan Milnthorp Date: Fri, 14 Dec 2018 12:24:38 -0500 Subject: [PATCH 131/131] Fix negative FeetInches and StonePounds with negative values #574 Fix negative FeetInches and StonePounds with negative values --- UnitsNet.Tests/CustomCode/LengthTests.cs | 16 ++++++++++++++++ UnitsNet.Tests/CustomCode/MassTests.cs | 17 +++++++++++++++++ UnitsNet/CustomCode/Quantities/Length.extra.cs | 12 ++++++------ UnitsNet/CustomCode/Quantities/Mass.extra.cs | 13 +++++++------ 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/UnitsNet.Tests/CustomCode/LengthTests.cs b/UnitsNet.Tests/CustomCode/LengthTests.cs index 83faafb8c1..df789dbdca 100644 --- a/UnitsNet.Tests/CustomCode/LengthTests.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.cs @@ -153,5 +153,21 @@ public void MinValueIsCorrectForUnitWithBaseTypeDouble() { Assert.Equal(double.MinValue, Length.MinValue.Meters); } + + [Fact] + public void NegativeLengthToStonePoundsReturnsCorrectValues() + { + var negativeLength = Length.FromInches(-1.0); + var feetInches = negativeLength.FeetInches; + + Assert.Equal(0, feetInches.Feet); + Assert.Equal(-1.0, feetInches.Inches); + + negativeLength = Length.FromInches(-25.0); + feetInches = negativeLength.FeetInches; + + Assert.Equal(-2.0, feetInches.Feet); + Assert.Equal(-1.0, feetInches.Inches); + } } } diff --git a/UnitsNet.Tests/CustomCode/MassTests.cs b/UnitsNet.Tests/CustomCode/MassTests.cs index 9cbc92c2de..6b0a9b70ed 100644 --- a/UnitsNet.Tests/CustomCode/MassTests.cs +++ b/UnitsNet.Tests/CustomCode/MassTests.cs @@ -20,6 +20,7 @@ // THE SOFTWARE. using System; +using UnitsNet.Units; using Xunit; namespace UnitsNet.Tests.CustomCode @@ -106,5 +107,21 @@ public void MassTimesAccelerationEqualsForce() Force force = Mass.FromKilograms(18)*Acceleration.FromMetersPerSecondSquared(3); Assert.Equal(force, Force.FromNewtons(54)); } + + [Fact] + public void NegativeMassToStonePoundsReturnsCorrectValues() + { + var negativeMass = Mass.FromPounds(-1.0); + var stonePounds = negativeMass.StonePounds; + + Assert.Equal(0, stonePounds.Stone); + Assert.Equal(-1.0, stonePounds.Pounds); + + negativeMass = Mass.FromPounds(-25.0); + stonePounds = negativeMass.StonePounds; + + Assert.Equal(-1.0, stonePounds.Stone); + Assert.Equal(-11.0, stonePounds.Pounds); + } } } diff --git a/UnitsNet/CustomCode/Quantities/Length.extra.cs b/UnitsNet/CustomCode/Quantities/Length.extra.cs index 8978af0364..7d9ba655d8 100644 --- a/UnitsNet/CustomCode/Quantities/Length.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Length.extra.cs @@ -42,7 +42,7 @@ public sealed partial class Length public partial struct Length #endif { - private const double FeetToInches = 12; + private const double InchesInOneFoot = 12; /// /// Converts the length to a customary feet/inches combination. @@ -51,11 +51,11 @@ public FeetInches FeetInches { get { - double totalInches = Inches; - double wholeFeet = Math.Floor(totalInches/FeetToInches); - double inches = totalInches%FeetToInches; + var inInches = Inches; + var feet = Math.Truncate(inInches / InchesInOneFoot); + var inches = inInches % InchesInOneFoot; - return new FeetInches(wholeFeet, inches); + return new FeetInches(feet, inches); } } @@ -64,7 +64,7 @@ public FeetInches FeetInches /// public static Length FromFeetInches(double feet, double inches) { - return FromInches(FeetToInches*feet + inches); + return FromInches(InchesInOneFoot*feet + inches); } // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx diff --git a/UnitsNet/CustomCode/Quantities/Mass.extra.cs b/UnitsNet/CustomCode/Quantities/Mass.extra.cs index 3811be83dc..11fb195c63 100644 --- a/UnitsNet/CustomCode/Quantities/Mass.extra.cs +++ b/UnitsNet/CustomCode/Quantities/Mass.extra.cs @@ -50,7 +50,7 @@ public static Mass FromGravitationalForce(Force f) /// StonePounds related code makes it easier to work with Stone/Pound combination, which are customarily used in the UK /// to express body weight. For example, someone weighs 11 stone 4 pounds (about 72 kilograms). ///

{QG z^CqZaSclg18j5IL%TL7>yqLz`TJIEw$DaVfm~pKG>g1}nt|O%nTAwP2xG}aoPOj$_ zBcz6TaF5$QLj`&9-okn5g*Z~S^rABrJ zlyp)E8Pmtu^wMM;Iy5#T_OUQuu{tRN1ga*pb z6%Pd88khb|VTffl`C+*nYkr4PD~IV#B>L%$(Sb6DHsNi}3NK@iE1vkQ54&_LGMVd2 z57kfod^w#bY5v*#q&qX9P8}lnPp`6n;kZsp%%S=U;fgsh6vFx(%+P~6=)uZ@9_!p= zOb_D*#71+BK?Kq2XiL}=2saw`e*?Ewa&ZAen|p&MOn@l(6wa#rl_Ra^P|LYt(Gt$; z(R!{T7-$rsNBTTPST$$$JAMYb*sH58SWQ&MGL9X6ZAvevzxsSHP(EWwIIG91t&T6@ ztk^R)yw&l?GKaI`)%D#7tYEsSDA8lQN@>%K!h#*!wiQWmuQzOUJoc!>?^PEqLT1z; zuLVb~BWWoZYspT{H)Yi^YEZZy!N&Av>NnPR?baoTMh}W;YyVjVw$54WhqFR(8zXc$ zH{M1S&MMKTr%Lubfv6o7c#3{@k@mu&*k-oYw0wUAS7E$iU+W7X*iTDaGkVS zA#IOK%kxRaIai?M#q(h>BQaq3s9=StqB5Gd9P$AD#QJ|BQ2(ZNkiT40T_3HxILnY}b>1%}Hwfw~C@nEzuLGpA2@Z=Hv zpOQ*bVa6U1M1^D*K~2sEH8~68WQ($OO~!uWd4j@qveL!@Pnf=_I#K#M@NAlpE&qic zn_t(^`mZOl5|2%$Z{Vd`T;Vvc<$|$bet+^cKg--cPTokeTNWK2D$cwZ1X+cSg&YZ% z@=W+VzwP8XLldkF_Bde4ej3?{6Itn-Ks;2Q`DbEkWi#?^MT~A&Y90^fIW@W_qX-x@fFG;;xJ#Eu+4yIM|7Lje-PImK}(RrAs^H2%^$|~mw zC1m{Vruh4y;NQZ?Q0#L)K{?};n#93gI`YDBtyjjDxKM(UZIq_TMy-mOU9DAX6*IF* z-g1;QC3U@26;MQhh=sMavQ1cq`f7b0M12_|*A}m#)J1K9*QWx0B5AL3_DWQX&8Iv#1*{<}gLRgriN!bNE7t9tht8n^Z zGQw})Oi124Oowi_{zen+R4u9A1cQb!8pX4W;73Jxvnmey2U-}pPRA%77zDWolNxK#$ zQBh)_--&&!aKXolEy7kB*X7GNns_&Hf>}(Q&hm+mQ>MQpv8kH5<@Tbj(KfIqjK)PE zn^bNCt3>S+rRsO>?q*S0cUu>MNk0KG+e^$k zjaV3w&_v`&A_dcq3Ml`{1(mN8a_oChrw9MiW{~go9S)q5?`j#07QF)F+}MkM%{kvTC<49e_o6oPnpIMH4XBD0fd1I07icbK>;G()ZV8+8qO zZDj}5=$R9YgES22*2v;85X>J+baPpOsyMU6@;8qpqIsfXSJHeQYxBv9)lU|yy0q?= zviJvyjjLSi=eY>gs`ZXsgve<9*Ww5cHnedV#BDhUwOk8>qzz#aaW0ERyrK;;K_Bf6 z&ZJRkXZnEE@#&)5)iJpiYGwMclD1_6FbTfm(!ZiP(+WRB@yrj1#_)O~q3thJhX&|M zfMPArS1y%>r~LOQd%ZfWCA&|PkX+7>Ee3mtsgYn+wfQ=V_W&{i`+~;Wu$=4wpRMQh z3Fa%nkWdI#Ri@^U_68EYnVw;h~DqKCFtUGlZqUIYZv+R_|XpyEw^)kpV(W9`*yk z7Hy7_!R{X{tmy;GuShASUx5={$-Th{oMy$|?Jpe=T(mP-^Ag%YYlA$+2k1}tka4gl z@{>Qd-WZD#6y(Tl$Tp2uADetbDgCO@&pH+XP~b4n=|ST#)QY&DevM=|noiYy)Yscl zR+GBVrFyT9IcQ}EcwAjf^|kdq-9tK2t!)X@;c&8(k|Ej7)gWtT!*@jCu@p6T9PrWP zU}UnA+n>gOE=I{W03pAuc>%hxs{w1hp zL_7Ts4}@AUwp`9ZlkXCh{0%=Kn{aZbuE;=ujys+bn-@}Pr{kj5uMrkM4!Ai9G^oxe z00^H}`YbPLXTfw=TF^N|70SlR=3q*L%TzVX`i4%{y31-~U6nlOaLz>Bp{i(I>Vi&P z-F}~_r3%KIlX#-Qp>5A_nGvsOHv<6U2zt|CezO>6!NZ*0ff*|cf_q9D(Of31TCZ^?kgosR$?7d;wVk>jP`r-G+z75%~Qdhycu|P@8s`! zkv2iiPnBgl(!#9QG;eG}q1G2e^*X4DH~K2QLcnS$tFJrpW}{^CD`A_!s(d-A6U^3r z%o9dObF`RdYbWyvCZ3B-DPmbqf)T*#lcHNc5ypR1hKXxE086BclV06UO8*I1D}7%m zlM{C?5=DSq{S;V}tKH!^Bm}LW5iv&(MRm7{WEc{WkKv&{y<~o~osC^lA- zpNnoEjQmn!@>;PYSSZEGKP&lr>VkehZCNmSfV-Bd{j@)Z?_bEyg2BVahvYpZeGZ?| z9wuUA`rsvGdu|g)W%NeDmEb?FQ~#8?fadc^7HZczu3{B@p4SOTtvgTns%=iCyHT87e*y&^vcN0jEcMY@G_7glzpv1%-QuW`)g!>=Z=a zV|S@Ed}h;!j^@W_u$$C96w;!MdMYK&TB+Nt0$Pu_8rof5wc;pyz^PSopcmdkRO{CO zw|>LV9K!?D>$mym^wcnUJ?XBO{+m&1X{*xTT3{r3ohwoq(tlT6_jm?TD$`kAaCUtV zj%InpqV&F8{{L|KWs7_Vni&A#&r<-V3idnX1{hsaeUbaOywPxFMlAMzA! z9qV6T@b(X8@qNK3zGz3ZgA4YIQhsjjQg!jNQ6!hOaeH5;*VfeN%kc1b)TDVV1dW;j zi~W=QCsDggBjN5+@?X4G;@0nZ*xpb!uSWyFT?~|nT|iOD_JusGPe~rzWx4_U0?sVY z8r-bF(*FiuFmXx_$yUpqkGUwrCq4E!>afhox8iA0^ua+`wBfA6=^unJSXhb7TSRgv z)NwW}OCWorA7B-e?zPhWIizJlZ9G`{T3D1X{9<4D5_NgB3RQXve;3u_36{+u^yGl_FPo*B@VB6HAQ7h;*|(heA**$&mBdyx#JVeglnJ6 zsx9A_AD0?>tC(K>XzJFV4y3%3T-#hm+Qw>IJ8u){2dGVDp;XNDu9mIZW7V>CPVept zZIO0PIofJ7oHYa?)XxcXFkvd~$-D}O>WT)?`96)8R(5B+RMz$awbByS`^AOMpc&2z z)nwI{2-U&qxro&u$dr)256U+MjdD;=3YIrJv$8B$JDH7Hp{<%S4zy{=>fc}=YqAv1 zUJfoWb7D@Ijg(%{fw`BX#0%3zT0O-mhyd=hKIZ+zY+p$ydr^?H5cTa_5NS-79jM%bZ!yyhYed6g5Vg39Ha=I}p3ebO=TXV~xD>*DAU!mj8U8O<_ z$sWDaM0)?K-WhK6{x!W{(Iu}5IC{uf$qBpWcTj15(+Cw!4G{7Z=n=_h$?1>&YChB(#65P_78^Zx zevt8~eSR>ElD{SsR1tdxDlhp=JNPJCPo$xdNZjB8;jDON=SZCu&n9%VyJ+VYHx=Bm z%b+m=FQVl0pyKgG9{xOXz$oQTDsp!M6>FQSYFzz|@TU$Q^4HjcghM?ye~SFN?2V&| zEJ<7&hZO4Y;~dq#vB`s`WlI`S(VtsfbfZ0&I{@^sMKZ1Sn;dn|$eqYv2g9;eh#O0bqs_3Q z@JfevcX5?ZSlt}8gf%(N?k=uvPFw6cM=+ApPX(-C$8IYZ^%R`$X#S&&-9OLRu{>i} zH8?m$X_dxk^9XwmHkMz%uKO$y#*;lJP8t*PsB{j?LvaeFvSE)>u zB%8a-9pW9=#BU@`XU!yEu&*O4g@|TyamJxY$0J=cq3?Ti22-M6(|Vp{zOsNGZ5~#I z{so$)eI~k64JzwtitJ26WM$1`4;GT|Fn^tjh8xwec@-H=m3X$AK3Gc`m`~8gno!oB zHv>sK{E)mIShqi8^n}fK3fGTGx1GIqJB4 zupNBOFJ-WuI!}iqT2_+YnsDnvQd`m`*;v6@Ouu;3J2KeQs7LeH(JVH}qsXF#27AKj zHaca`+*3(&bLIi?6phANMe2|}E&gblY5q^FT~(@;S+H}YroRgHL;4x-T!y`j!*$9? znm>l{!mViOp5`xk%>XRMF2l9BG*Y?A#TRzDb|NRoN`$Il2WEC>$@M552AsmxUI}!f zbdgb)t~KXDtvSb0xtjE>^uQ^_{BRSY@Y}q?M2MfO|a= zVe)4nI0qG2wS^DIlhr`H|E#k};R)-sx zG4_VDR^+VkQyZ9q8==`on+))&aWH9Xx}U zY%a@?Et*=u7`aD;QK6pv$SM;|+>ztLjes!wXzJ11lH|=Pm$gOLIW_?ruB;5E#wtTO zeSBnVqi)=bvYrN|ZBF$0QJ{G_Z!PWtN=Q^-lzv;(8Q-G-$@1gp!^eZD z4kD^TrZw3(lh(oJ(23rv@T1D^Z-x6cP%`TamRQNY5yZ&?!~#M=3jxMo_teE z%s1ai5UuhiQ=HsPLh7ug$aQ$}s!IL~m0u@^9jmOJ6mPn3em;w53cpi<_8Qk#%Qu&$ zlP|}cdBuljII-TaQz0v2sz3P!H5tk7anT5e2UbYyKZ)NdG7PX8_R}1Ky_HTEnxb;+ z5u@s7XduzQA1~IX^Uo3;v9=goQl!x@a3o5`~~9(8+3tAR3ww>w^0*d4Em zcE{-&5w0U$8k4M?UgN56xuV~un|FX=rwY+xtW=TeS1{U`@uK5@OdRJCxL;3~;iuAB z(5*(z_mZ8vE8M`Zq~rWFKS)H;Ui*?cIMZLYgMhXVSu7{}0kf%GO5P0Cp+d-Ik=A;m z=5|6sIIG{0bOR9@Y}D4`=cA3!mYD8Onssh<5`lA;U*HoHGUGSdYbVK7Qth%CJWdZ- zE++*0c^pm*9KO_=8r>`8ZhdR@Qh8Z85`>o^y66E$H7tb=t`$*(VB!$kJUK8QU_;na z{>K?E_GdbuOQDp|@OUoiiY_GM)>>BbaDx5phiz+9vYOq|mBqx=ql4IIvCmy`*U@9| zKfv4!#Ob6;sVTs9V!ZV}yuxfdH(-CTb= z^gPkE?Td&8!PPW~Dws}N^}_TZo;DcuH}?0(D#6{O%Y#!W2wMsy9~bJF5l~lm9Fdr> zEv)hf5#9M0qH^b7vb$3ogF`NK=U%k-a4qya$o-rdF)aNH<;DsYiQ^#MW|sz|ZkiXY^07O|W%J%(HtW$8NTNi*}Q2YsGWec7VUX zu*UP4tsrQz$lR&X>@Ksb<6v;Wk#5a18?OtFMoC7SM$zu=o0nwqwn(H9{L1oP=JI0h zbm#T)H+SOQ9i+?>@yCHzbbkQnCv zR`Jf#LF^POHxEbc9ev1qpS`1FdGE~Wb&vK0vazhgSbGLtr^|-~3_pNcO*gG+R$;K<@u*j}VJXeocmVu}6nSR`Q232uF8U$?deox!p0*{_@E5 z{^ivd;f$rzs*MJYGop?X<0D;QF2+%A?;Ef|F^dr&v4Lx}#NL3mr=IIM*HnnHvuVbRBkqL2MCXq)^K2 z^IW$lPV0mU*~Qomx)}SQH_jK|i2a%gM|!qoBl!N^6rJ4=pJLzXjR;t#k96feyDVPZ zF$s+>h3I8?Y|(N|dW1S`#9tCYP=?aL0FtWe+8^URj$Vf{hbT1*B;R;sMIGfD4{%GNYxg+6eQYsYk8KfH8%OC8kTJJ#N$5$qck)$6D!e?PIOH_Vfk4 zrOdi90on_1Fpp(M^t;E%p~IPvE1Yeaec=ucV#-Xd32=9%IJcxhfW?oBU(zTQdefsQ ze5f%09Jtn`FK`XY-A6cu!gEfrBI36I8aT+GP_t-Bz_KICGi^CHw0z0KzEEF)bK+y1 z4I9T0`6#eY4e@fcUMe1J^@ztLLpk$<~nxEW6l11E<(tWB7RDK0ADL`*txq622S$%CzYa4;KHJlM!$ zFv^w9b2(4!SafaF5rS%Cs@O4DE5QKk&EC94{||<7p?9D#&^r((%p@8Aie|);^!bI6 zqNxBo-b_U2vcK-q`KQ2aTByHt1jwT@qVY&VvOPa7VFM^V_9( zbU>a*%G+TPHmq2bKpf{;GVXlkA-Lo0oPpr*6EoiQ2H&OJr!M9VOnqwbpsaD4esZK4 z53qo4YTvo)dLz|gt?6i@t8sC7rPHyVf3avat1aVQhjkaX3)_ct?ZU2Dy0G2dh2?O2 z=3cM|wU9p`BNZ_5ah68d$3(8!M8L8tj3nPDI44Vum=AYiG=kXy#HUj`x7O4L&#o8G z!r5C%^>fm&v)&la-bOtASqq5GuR)@_#K-c6GEm9({1h8Vcm&_ZqctcD56!hK!DjFK zvBeF-FhNGKFrztTVJ94;GeM_N6WdQXgS`BKGeM4Jr2)c1mu$KC)>F}TwydX%wI>im zVqe&tS;h*Dg17~cgvH5;{D9&lJ>Yr*x*uzl&fZSMBqy?8rYG))Ug~g}PR%Zu ztDnI&M+YUGt`f*!nN#l2a5%y)q*4}aJ`tFDJv~lP!kNXtEf=pc!!Q9Ro>Lvd*-lOR z!ueMal^k!J3>JDfnN7Ta3LcqLEwVG5=x$N=jAsVD=y1+{^#nVgBlY0w&Q?lrgOe4J z@t_wF>;SUmDFkokd85mt3O0Yzp*h<@w56D^@vL~{whff3v8KM~$-LQ#vfZo=d;zgH zJI6rJ3yQhp$&pSbe-Qv@jp?-i!3eVmY>p2GH;fOD2SG~J-BlFBu#6obv8ObgB5|r8 za$At@lm9*S1gy<;p!_-*S;NyiOX5$fJ-R=r#Xh+g)CXK=W+!IzDm`z|~`SF+Bwm zvQ3wj@vvhbTj~zu?s9r60Gn80zk=*LB`gz<<|?hacbH(uW$SeXowdS?Q)fRl45N+J zxmN;MoO_kPXZ1Tat&24j$%zOQ`7jczXna2C@=e9yS$*crWt5y_=-F}@WwLy3zN|6I zvc7J+ETeV;wib+{kyKv6?N1n*l{qvk+i1YQDwnV-pRhWYu)3WfIgf1NuTyShP=3glD=ZV2XZM)t@6K^W$KHY_qOxIB}48Ia7Uec@R(_}*zUngZ10Vm zA8$jO`z#aHt(5#%?Rc)~Ob6u$Eh8%LO3tU5d?|KuCu*1QnYj6xHYR}3t=PPotQUh{ zMnS+RMjxB(5AFPCawe5z$o>M^D&dZ|!c%7*4OMEDEgy$(L3pQPtHtCj&n{9J)V`q{ zcDkpSoSjQ4HGig*#h;o_Z+Mt}Yz%8WO)*lm*m$l!y=&~0z8t!;oca=Wks-#%%IUw?=%XYUJ~!y8A{D>S@gEj`Uf6(c2{)@%T?D?EupI_>n-8oROL7zUA3qR zejBLDon2L#+D6kTs=vHq#ftHrkX>&*9{Q3Cx`;fg`qavX8r(qp`B0Z$n?~8fjMZA1D0k5VBeEMTZbH~)`$8UX@mNu-rVw7ik({LPD_yu464mio277k6gST9dni>n50~8wGsd&R{ zVRzOkXq*}DxS~4)XD@8(Eyo#n=6aw@%$9?S(_5r;H$>c=R0@|m%XI!S<7*UfU?E@) zpT1u$jvcW1jN-`yWICHay7!WQTZ!Ms-%kFpJj`1WD?P#z6vx(2&wyt-nL#fTeB$(B z#qk&LI=#I(o{Y1%ZA-V?h|yo;#^xy^X$FfYXr6AbEcOM>bFB)`Zf>>b)0>yrGi_dB z&!;r6wdbYH8|-;u^J(@xtNAQ@p4xn_J&$d^h-c^y@n{xOX-tO6MYIs-tE_8mE-wr0 zW>8~rUsw(kWqaD%l;sR1Mz7zL<yS+V5HTtB>;(J4E9fo=X8g6<4LADEtL ze4kaM+4$N|JBj$46wg*EMi9rWhW%7;3aOQO{v?&$p4a{8kIw7L!TN@q*J<5~S%UWF znM3%Mf-TIwRM>h7Gr!{K%e$zC9iEi0q=F4cWnDVE7|!7(#~Bi&Z7$kf!$zr{2z{48 zUthF?b$7qmto&O(K_Mtmn=<>wp2mvo0<)^7b+`dljmT_yV`>3^Fb}!5QA%f^+qT-I zeW+752y@oj>J%D(UG@G#b=;pH&6BJx8Y{I8rg?nH9mT4#ZEIv;aH{b*qJ=W0B^o7` z&0NX^HF0z1=LMVI<=n-nFa4bOXBls~h3U4pcas;2Sne{{PMj7~u|vHx_W|olaQ-N) z3T6%(V2O*@Gp`3GYSKJ6q)&jtwp$`Oi8?-rTBstqa}`Ekaiwt2*6PMClqJQEYF}8K zRp%Jyjjl!e!jd&wKdbZ3791+DI@&^$#g+2X*)u0p|Kno_oV0kb|JY=1zZ2V=z1F9y zcpd1=_d%Fp-40miYky9#VKPKKhrnM;p7e?E%5UDO+g?u`jHJ=Bx#G!|$N80|H&yn$ zQ(E_2n##lnyPmblD1q}3z^-1>%1F_=RitylT1#Uu5Lw5`D5B1UIk{BjD&s1`ScN)% zP00%b{Xz4C^r&*{x!}1eC=C^u=EWZVd*=Gm-&A0Ff&&fh}>RgBnsEpqOC8~GvVI{bax zdidm+dv*?XH@_!!z^aIoWVaHz#e*AIb8r}l%Ybls9oFq-Nbh%5ucw!j>KK5ZD0%yI zeTd&+>qWtJ%-_ST{izqHXkFjZx$9o8K|9X0&*qNup|_6Cg9vz+s*CzfT~lUx+|-BcDoQI z2lM(hQZ+YXdrqS^biSpX*OYUCgdmwkFs9ax+6iYVp?dQYurZY%X;aTvUpvY%u9XB@CfM*{Hy(%1yA+G5B&=TDJFjh7lW z!o~`7yHH^-IX9ZzZ~JKiI0sL3CuBu)D(~-enGXwE*HSSJ!Og9}q<=z)Uf#T1f$LnL zoTAe0*a=oHcCeg_m?y(b!T*m36Y45{?d17flk3mI3i^|GNtmMgE4ER5n%iGb87eDj zO02n$u}(g<$~z;pX!(!H`aXj;xXK9fXF%JiE#8KI&&W=dH?LIdp|Sy>BY2)@K~KB2 zW4YMaW)9`k8z_0|kT|_j&r+N+!c->L$0_3r-bU)1Ij+z>9;Mq!k@27~A-nQe`quMZy@!_7hX!ZHiKs2B4a&2MotLf_?Wka%^O26&@xQ+`RIAmF`fX1j zmuD>36{eoL&bvHYpsJb6v!u=nns;Y*1@D>5v%7fDT%P@!_sr$lVI!H#vyIK?^1jCB z{Rr=CGgoLT&X-!NEnn_@p&`aWZTZP1*w*X+4&?bL{xnDV0)L!}3=ZILhJ|#DOhy=a zZdX4Vstrx`^UaGF!l(2C;)9vx5ingb0Wq!j05Mc3PqNP!r*{$14xh3g8AL0WIDYMX z$>)k0(2nH$RnGY;CzyE`t=wWpL8lU0Hc>D|+h|8SXj!{um}}>|k$my|)3bJW^IiIT z@=}o~lGf%f(ftetlE#RcZKBQ~WN=|4G0n+Qn(WrI(T>g!{mgK8+DJa_cW|%RJe@4b zcPT34-)T_ujBaW;vUVZp@e=e*5;igOetAY)JxANiK;^j+%wP$E{dbG7Z>bSY0Sr&B zD`@__gU0R|D%Z?QxGH>=+)`q^RECBdNp0A6BhBUh5EtuI(d8BAbH9@Fxewf>$|3|` zWZE+9&eN@^t)SH`wp3e@ZUcms{h6B~BcNznu19_`GngCjl$>JLQ;6Pp`~&2xn=-wGSG*yzaSLcr(} z5=q7*i*|pYE8~W)j7#1m;Dl9B8)U&`ur^p*W~-DiZOd1F|G)#>r^S#8gRg`~m7=xc zQ5c*SJ?0MgZZ-^YFCahq>?7#i+}#C6*nudDTYn|tF7o5|r=nmzd1!a#xzF-^12(eM zIsZvQcKZtz+a70?(`8=K?#zgQFt1*_uu zzg!f%s@f>5@kTCmOa}WQBU6lDg2>&2d$Zh zli=;42jt--etXX8hLgbUS>6pNv1`wo;fL&i!+E|)?K}TDQZdM%Pai<*AVhSWVGGWS z^mHDs?i7$g`fdS^qJ3lV#fIba4#z9=IJP7THt(S3W23{PHXFrx#GWuC4i6Ifz;OC( zl_XT!we$wCY^WolwPocn+=|w&a_X*}w^=zho82j}dHpzQwV!(uIBpS+js)yB=$DBEcZ7FNhqITI1C+N8DU=j;9sX@4+26|7+7vongDz>ksv|Es}2Ickq# z@AGXN6|?2pOs`}XuGS-%NXKM$cRR2pEC7G=XT9&Ha#>xRug90DEPtp1{o!W3t(|BN ztyL6~)gY=Y49aw;rktJI1`s1n=e+Sq(6>RKJqiMDl?*3u%1UPRrk`D_1pW!v>n!Qv z9Drbp|7gmYS6}ldB~Z?6db?`Lr#I3@znD<3P3H_4wjXZ7s70xO?eGVDWO2~Ps`6c5l zyHRZpE04PuD2tUvIps0t|ANBkf?Xfe^d*kW(V3`Fb9kLBQw{)tO;+6SoVDw)HEGe#7`W9vcpB*rNx*JG``$!$=>Y*f9_l*hc-!A5`!Q5K%x{x* zz7}?u_j|a9%a?^*oO-~oeN@ILF zIe+8)P4mZ5)!;P#w)#I-?1Jt5&0v|)zt#KF7tsFI8P*lDh?_0q%1#8cWgyP)M7+o% zPV7Xy*dh+;M6eJ+mi;;rFR_ThPQun5M6EDNR!dw5(4H)ddq5W>s3g|Hk5UE)KpvC!E*#Qc@C z6MX1TEp(UyO^>aG&E*J+_c*Gq?{qa}W@8^# zn#Mk**~p}E3Hvp;UGc*e?+g{2X>95ZW$W%$yx_9znQ23o4ePrGdx|40_(bhqKe@fu z+nk|nx7N0W&~fe1k%UffhYlmOwH?|-=!$k|1N*ikaq>Ya7;c)3X0PkRmD%e^xGH@n+X^vz=hizp9#BxSJOOX6$=f_SqC{lW&j>OX4lyo%=fP=I89?bWL(a zKBnCcW>bcePT&I%VZS9_+r!I)W?vU}D*2V<_c=uN85NQ{Qccs6W&wBUkT~#X3i- zoaY)r?={$Vkb%$9=k^O?)ibwW@Q`)eCP7f$93PPj@#tHSZrs5Sf(7`#$2+u4z!Z&z z4Sj?{AW;itv~T2lmWuqdr6S+IR3z5?zBoU;R3tOzeIY;EiR5D;Op)U`(dtbzFAvAS z<2zK>0QX;7Om2IkX0`Nh31@ocA+0PYJHqvfhlPtz9PH!Oy7Mgq$(L-_R|=Oobm5?Y zqpovHuNoEG^l7_FmwI1E8*b{_9GDo0Z!Y+g~hk(6Fzp9l88BE9GJLyZP^~9}nJFJAT-w8^zlF+z!M# zC~bfA;X$p~uV?+e;_;%Q;^zuKzkc zV4DJwEgt6dz(#0i_{8S4be6wFvRnR|D#!SlMmDr)!N`UvnNCoDeXY@#JN|6DaY~PL zk0D@;?zCyL01|7`P5uTUvtG^NBy?Sk${rTH#?G~mB3s)1aqC|Jb(j0&J^N+#buG+T z;9Ji+O^OVl&kEl{xjj65d`fx^*<^t*nD{>#avex@% z)>4w)6TyWjcH!FKaM_koyU|?3(;4=`_tmU7h_(-b@AWx+CXq8QB-TEps@0OQE_sq9 zUO}w(vt%B~osSs^N;oYTQRNOOmUn66!p*7+99%sO9AdnHdIR}Jvh%Cv3&?ZDQO|uk3zUdhvd;{Ra zG)6y11v|aomfOfaSZaDdjJz*=m#BOR`QBvtoXq1Ko0iVbeph2|8g3KE_zIK>hT8IQ z^1RvdB;U(`A(Z}953NfypMtGnCqY}i0Nlh;jxWNUS;(1dihnrmonF@HU_Pa|Z!_WT?+ zH;JCtI)8Hr<-OI)b4w-Ap%yt+t*Z(wv53d!cMxC-`uoO}ps()M^4N2JI$Qvwvo9XU z+uMX&_kTa+Pt&pJWJn?Jyt>_p6iYSAzFzPWzvSvw_ub`R$Y@ZV`|vO}7qQm{vr z&m;Ir*`@(t{2`7RT5!~TtNru%`P%ztB&&VPbUlB zZamBR_&-%z=UfV~TH)ireF-6Qet^pR`utZO8^Wg91^zXHA=YVK^UwXe^j;zO8=^5- zSa1FgRd2TT*M-RsL#lJfbcTT4?#DG42u6I>g=r3!1efYU)21eMV~_;wP?LDc$Qo2b!xe^n0{QvL-QwiX1uF=QXe3< z`%HoOn8hBsF^knL6RDW1Jp85YlrXtZcfx5# zUF@esnBBi&{^#s+yZ#&1TdWUo+pvA%HyUv^31gJ@Oc2e2NQfBKw{PLB-MNe6?LLzT$V3%YH&jHV~YO` zft|{rK3*`tr0<4D2!LCRcW#H=%5vUmk$vF|9Rpb`9^=ajO;c%pUp(DkO2b7MRPJ_- zcTPX%QgblbRh#SxYJS-q8$cHf8FI4~^XFSke#KmKgevV3s(qW>82f*?N1)!V4o7kL z7_86HpRwRyu3BsIq@dqlb@P^@XbNW)Z<;!rM_uaTzejv}361B~xY=!*uljlD-;%C* zt)8uW=*x@{Z9ILz`S}>jH68rQ-{bHv`22dNAGQ2$M^|G>6SyscoBuA!%`q64*F`2U zVe2xen-iTZo9hv!mnudSIl9_{PyjWKeO-!bJd)l^kzUf%(W6{9rBgR4K$l^7sWvpM17r{xOPlJ60D}#y#8pzW-_Ew-28tEiBiaFYuym- zP;I^eO8v!Im;4NI+?}h3pL);c-z-BU+?zxdT(F0g&is8}HH|c?_Z#6QBgeYIo>?CxyBvS8EU9Y5w*fcw3jy63(Df;h-~h}9tTvhEn`BJIYFT&|5FqMJAXhGwfp{;lsd7uzVkmwZibuf3V-5@EgqE!>@gm&0^<2+74Q>#;Zu*3$pSvQ`MXE))#6A&=)Xg z@H!gJ{Uf>AlN=+?jtbcx^xQwGAaje`JV+_)tv_)0J8B-&2~&pbhZ&xKrn=6H%0lz8 zf;bRiNPfU*z}mqEax-O_RawqlWRt(hmmz*e`X;j(o(qnIV-h3S2~-TEf* z5llWwz}sl5Q>49MZD%kKa?Ze+L=862qhig=_-SEdRc_KHdj6Bd<#TaNV}66Hu$V%! zKoxaueEp^I^@=wYX#HMe6FNs@pFm8fUBaS~TOy_#??+|*j(7L?{SL}DaCDGl#m3d2 zf}?9(EjZkYH{eXLvZuZ|^K59)zf3;R)V~9sQTyk5B%cQR+&|mvU+a~=SODf1dbCca z+2+tf0{>ToK~GlZu%F2J8G--WUO%f>3@Ktir`LbeYuGwR)%#E0p<1-COlbewv_y`U zXjZg1f}&Xw<0y(|MU5jVniWZou4q;?Il`h@5$33iW`C=9{e;o%zw2E;y#I&Z^%L5+ zVE?ab;B>ictoMuW^FITfvAx~aUJs};mLUCb0r0u_$c)%ikqA|1l8psHBTp<_(P!nC zK|PTEs`v+oI@)wO3OpM-uXnN_=C#W{s8hD$UD@M8uAnu2HvCuwQw=1ov)=4+su7mL zsrVdD1ry0ohSMUxuryB9zKt`-BgH>_9trwk@(4pI^S>eCF^?5SfE>Ci#w;vs0pPMR zJ9RuY_`{^(v~JjeKb)vw;wImg&bMpwMe1v3_|q?`<{VkEC`Y9wwC)#=zRb_2T>GI2 zr6<(2tQbs#$cd@NWuN40xAzAey!xNPUn_Wp%pMA7^_qUgNLZXl9kr83A)iOD>7MR9 zA9UrYM|bG5{ynSTXZhLkri3*%+>Wn4yXEQ2S%YBjJN64e>*S=RFxLLdHp#<$LonWd_;QzkUWv*5O-u0urucdxWmx{u76Oy=pdib7w8~?mrWL#?9#cae zNGqVO1yG?3(aTvbaYvF_^*mo0D9sAVFXx%ON+)>T{Cl;P=7uIn#AkZ-BTmMEb26qi zf~$SL+&K1Mfz z{kF2W^J3#m(8{m@G&YH#Qv@G4-b(9>n5 zUy+r$L`nX|gFjcDx!G~s{_w}#l34X-4bQBhnKdl4!eLvdyNh#TQLwO%2Fgwe%V27r zLsjF}fz;$CdCsHz`gPWxVCJY`-FkwW!)zn|9+jKztXo&c!^5? z87{kxHRqGrmRbMyVR;O8HvDjK;4!u(Zu6)AQQ80Uzgc!~Fo@#+sOlXxZ-Y~QRWoXS zm_Xf@IIC{KtNBff`3{V9KJ}vXySyU<=1*V%b8;J`4V7oG_=91t()TuQq&lc;(I9G37%mYX2t||V`0|=eFhESbBB6KO? ziO7$;9MT(lY%B`GK02tK6?6+a|mv;5AHC#FO5i9TPDD zvge}-0EBM2L)nW)GyWR6>@lFRH^2u`R{zy3yApqphPSIh*)Tf&^sq|Uhmm_ z4qa|KG^YzAfuIYoqOLhz$N@1#Nxx=p*w?9@g_4i`ff~?kkSP5j@0mt)q2vnjPf8@S z(LScSIt1yDfH(au8%+iAnGK@6O&0|$uLOVL;6KJ6TebMLo=3&{kY! z`v44|W6D;T5BX{ShHmJW>#Pj-u}W87m_7yi(jSwJ6Ii0a#uQo@RruJzAvpZNZUjzK zdvH_Yar5cGIAk6F6#g@0LF2q|Rum(WV4d<yZ4^~auHYwkqya1ls=92rOv51;D4Gng=A*U@^d(Y;&&PSfND;1wI2h$au*><4O zv%=b4i;FIH2#`5dts5;z>Om{n0iTd^&ct>8)92!=a8EWLR*S{qwa$ua@vU;1etMrH)eap19k^L=D&+Fp!pe6jV) zj2|UwcxQ#SwUu(``c=-XejU~)h#0fYq#vw2hpRk+fH_<#lXMj=jOm@Ujg>E3Yc+Z3 z4(dBXi7+`+LV@%mLrq=&2;9X6cflTvhJ16XM*3#PaPmw8kW8JDm6vTeQ(QSre!3cm@uUO3T@k{AKWWZPU&y+;}cYDn}!T5eb-zNy>jXT+B_ffgO zwECq#CySIU*ZKG)lWlAd6=&WIK$so>SK5|Ki6LqoJ;$uhEDxosH*rmWM4UxRIKbfD zZ3*Wg+-zB^6vi7|$`zfnFQtrRzE9%PsPmp-U6StB@solN6@gab%)tguRJNJVs%qm{ z02`P)hF9KJ79lm~Yz}23?}WwY=hUTrJj=4(9h(m`zQvvMSvFLl!v6yLp)%ui#;}ciM>h6-+}hGgtwel`}xulyD&&zWbMP!4b8%SXfdqJyntxj{A4jvWu`@p zU!e9dY^<;ImPjJkTP>HkzfZ0gS+0GP$n{jq_4cK5ool)FO(NHkmg~Nya;>pk z`zDbKbB%gku~e>~z}{$yByxSxIRD9|a=qVj?VCidS6QyVTAZs8RvL5Bo_*u_dgGPh zo=+_We@3)KJn)Bydp^As{Mu-Vc;I_+i{%dcNluw>_%W{|I*)q3QQel8>8Iz!VEWo{ zPrEUupOjt9+x8LC4@m{r zpVD8ToP8C{w)hokjCYLNrnj-e(tnlyF4l)iGbl-PX05bKM@3pTYTSN}I@D3P5M~$~O` z9L%XbopYs99Zyepg|>*)+@KNn3aYbx6_uGA#OBD&L23lO-S766?=zmwD&E^b1$~bx zpmk&eEhpZQj!n(BVVFFRTEeM8Ay+E<`h2}qZyYpLV!X>{!F)PxYsE*2a`J!2BQ%>@ z$Df`HIAvkB(1wM8g`a@#K)Lx+Dl4k3U#iV!K1X`cNcbL)11M%C@p35|+73RJN<;C? zdjyH$uo3U}j$l})vyz|6!ndIgT~ou-g0=1wL9sh)l?=}3``gy9Bu$(bE2qEaO@fjB zMlTtlD#b?@s(dOl_Vk#_#_1{L{x~x^6bShm_6VldX4(;I8P8+0S6P({==NHDkdS6W zIh-qSEN+XBHu+p9nX1e))5RAC`WyR7Knp7}`px7Z^4s3CiR=Z8|9~>!FLzmQh4(2# zkw0A`J)r*8=fGOZF*Dj?d#vF?*hE|YgeE5Loo{i|IPz{EG#x~wlH^x)plY_ zoN%*CPVt^MQHBkB)7<3aw3=I3at9Pk5IgfcPzR;4qtoA!=)B@?Gq1QT;mo5+IL!17 z<|UKM!gBI*suFvH&Ut~-NyUW|%kv}MfOjknh}*Dzz31Lx$MH}=bUd96{T+SbGpegw zV~p&mF&}hSja_{^ZVw#ku{;ID+5n?@z8;C`k!D~)vkilkHx%u z3tUperT^tPWEtT?!TFhXYhaCGB1*}3shfG9cCp-*W6B7xIxO%dZ+S2ADqP$sTA9MT z<&}zdlnf2j23AcE)dto*inWfQHZV3gJvY-7zHXYPO0HlIRhi*We?J*gw@awqGT*Ys z^4c=zZ6wAX^vib3oGMa1f5=kVGPmr7+YZ#IRkBnY%$CY#SU;v*wjb;y_elDCN|3Vm zUvcT8pvd>$?9B83DhZ97$~*Q``3x*emCBUHT@X0+f4lMwU+}-}1lE*+8tbipc;JCJ z{ck50nMj=<6gwTO-LO;Z*wnBy437D6Jr@WX>xxi1lnZuZP~P_Yd`K_*V8l6>c~?w0P;rQ%V1<`buPiT`jJft`^r#Zzv*1gN=!3 z`&%R*4^Tj*F&=GK)0%VjN@IDnU5qwwRTYk{ckG(Wz#&4}`K0tzdekho*>Pa-XAS1av? zpp^HS;r+Ox&2xTYD=g)+-p^3A9dz)C%>=)cUvc_LBxotW;`Ebur=-{ti}%~esik}~ zx%NoqS$lZ8?v_+JGkD9(krzg@E{ZxTveG!o(=j9`wL4^A%O0BS!y(nV@DDT^!By^{ z+(T2_#M)V#418gNcL9Ar)(xcfft z90NAyTWC$+j~3gPZ|o!)4F^Jl<#Su%H=>=R^neKOntV}dIC(4JjUqSBcIWcRhaM~A zaxjPPY_X23O9BZ?4BQaVa4UJa9!+f<SMVBqR3Fh*kxLr}w)@cFi zM%)0dv=eP2)k~z+-J#LkcC?hn#A+85HNcr@omyljj8XuLGPud`)VG-u)|V!kkvuAy z=nNH6E`D<~r%bk7=k_MO62uvO#>Wy{p4*%fY^#mnc=m1(x8N=Oy^dDkuvvSLQL=ao zVU~zAe`RT!wb!t9J(B(h4ZDir~;U>r!lGk>I;jV`U-j%fYcr z;C<^+i~bx9{c&6{Pj+)ftrHc}0U@DHvM=Q|HX%wjC_Wi+?B{ckq?H|9Io%{cR!Q-; zn)9Z9Kf}#KdQ&f?gIzSZu=8Z;w2(ObAX-RC|Cd_GXU$mFt%W$9z)+|8ojcd@+MXl7 z;>I`m`AVW7_>#$~NrSmqRV!$Ff35EDp>tT+X#PRkg$08Oi(%!NU&G1JWw;UDvk&x! zgYwXy?m%lTL+b%})2;WL-0SGVi;zb8r}gr=5)H-i)o zU*zb#F_=p;3tT;Dax9u$>FCE+&ZH9hQL1c>NVSTHgl7qgg%h`*lLLA~4roF^OpfQGq zeN|V$RSH#xE&piEW@1oE-mZGcuyY^#n6Whh*>`?)Q=RhywesLx3EzJUs20utl;K`> zdJ#}re|0rF4OH-im?W{F+qi&XqvV!dW4*kehMH!Lw6tpn3mNS_DaZBo*r&CU65FuJ z2$*-bzaR!3ewEd&Nr{X%utdivKlIHHx2O73KEf3Bf{gpSVdwjx?d}qJ-evQ;-r%`Z z@P07B$1{8%uodR28Ip7Mc-kzexFU zchlW16f5KIqF-I?7<{t#u7a*DqHFQDP36{5X6b2BQ=Wv~I@HvRGYdx&S)7?!=tJHt z^dWB+x)9>mw*7kb&8XnZR%Y@6nQ&3I#mt#lZI|Gh3{_+c$Zp(CmF%>z-qJWO^{9n)iW3~s6#V5mKtxIr<7c9eUe zcy2Y5b=kwdBacHdO%arOlOv!$pwVRggn9`Q+)Y@-OJvZ3!5WRkoc7a0k zKeK#xHqe_n8Vld6IyxwS+|7^QSM?n7+HCxe^xZnS7^DBPi2Ocj7C+1AZyfGVgzhIn z;?}l9mi!rr-B^f#OfBXf@BBQJ!Vn zm7_T6N`yE&rOZbp*AmNIiDe*S-Ki?&n^9wh7lVlM`;H?n7(x)Bi~p)ZiB1{?lRr^qQuWj^Y%4@O7iZ ztKe@*Q_P z@)IJg;~JWNRkTS~EtN-Jj}V|H%AoY~s`nN3Zt6ymy_yDX^X7-;T`^*QccdNa=-u5l zR<0Y5X6{yW@kOXwTPnXy3QHLJ^#wm2pNXLlC$e3oeY;l7R%hIrT%8(HOWLEk>rk&A zZKl~CQ=FgvZ#tN}+Avsus|{wi+Yn8kiY+lGne^f76_zw+$2GflBBis%-ESG*1zS~NZJqJxz?pn%IY;Gy9 z?Ah!3ZX z7NLH&^U>?ban_(aiv;Q0$i&KGTrBN2*)u7#^E6Yh$Yw2$#))9V8IDHvi-Vx?JED<& z_1oCqHu7rVi6Baw1#fidY}=jT`5*i!tbY4q^1hqA;kdf^ZTFFTZi56M7v8@k5NP7L zF$JT!arfBIJ=XJ}r%HV)dmO!y?FVggTTnd*eefe7`r+5dkP;+K>0_)_kn%Hb3vMKz z-|vpJ=C5x?!}nRm(^2>j;OZauZGm0)9hsCQ0p4A|V0Q2lIMd8@Bl@%pSz*FNbRui~_{>f04req(8D=axDLyp_^KH+y$)q$9Xv4p~+H4{vV*A7zoP51*>;PC82`>FgWX z*aBGyAwYs42?xTC^|B8mu# zBPz_GF#0{`RCT8T_0Ip^`(1wYlX~jZzMQJJ-l}@hu(^fQ>tIvJZd1r1b2t&WHo;yk zgTikK3+yAsdY9ds%IleUwCD1|xe2FKyHy9Wj?X&$lSa8i`qnhecFkrN-u=w}9Hzmx z_HEr}JD)C)u^=EGJS_cwJo`;NEVuDo9T<n z3mctsS8l^p*YY2zjz|m-b1>d>M=nQR*oY3y(x9bxj79byK+(ndBrAibzKSrduJXB) z!h{ktou7l?&W}09V~r7EgG|aCye{I1(4lMD*ccIOum^krn50PnADKE=lKDYWAK7ms z0niA0C>&*jQ(Et^{rv>jfXzAMgnvVg8`3QN-a#qZ?dbu?SFTkIo(wmm3$kYaYM z#1^V;2*_?X<>_V+6?cLwQ#^36G~jkr$gt78QMQN+t@*W#2}9=cpGI$?L3UA@1MNvu zw;~#R&)PZl1sG~x1|S?Ry5O2OBn9R=YDB>=drULn^aa(qpaE0G$*432N?g=UYZtRJDki~sA$;VSz4m}O#Q%GkXW%91m5li7M|Y-NT9+fHM! zeaJtS{DkCw!DXF@ahn&~ieHx;V86*<*jvV=de+&>m`@n=-pG^#nEU zw}`LVj)DoNoI!zJg4*E@UB4TtT(ixaACowO=C*AAJW!o*?SPYJS=fKen4+HB>l;m{UHRQ#d~3cPMQ#oxjKLC zIxtZoNDV&=Bn(}O_rLgqy);Yj19)Bcp-hK*Limw__o?hcYr&E(W-B2}V}fK85FVW! z-XMnzHJGJlf5b)SHjN1LSHEDXY>+R;NjELOlRVy4|a$^qB?|I%XcZJ+XIe7t+z$&m| zpdtdDW3gaJc;Mp}M_I?4$t52__}FE*>=5)6XTa7QZuF^xzs*5kN&VZVEl+u#k;6U(d1H=RJ4hZfJ91Cy#A% z>!6vRR3cr6IbHEqg*aDY0S%oniyXMRgcXNxULdgs$)I8TT(D>j8`V4JGDC#N^PZdV z7wgS37ER=_sK3=FK`ZeIdAE2(JH{va9C!*jFB)vp45`6;2&i+@-tDOm)~Ij!a>~jp zXr)i5=J{vzZ11VU(?0G0~5Rj(Iwzv8+Vw9b6+i4=}O*=g? zf`p+~)Dt3^SGuSO2|p_BY3ip)N9YahxG>~J7*I6r*rPv?gw1~)%F%6dHS+UZzn z=7{-IF~o(|aZLWLJ-8rd20P{%U=ajnUZrKc{Fc+~n2v=39WYDcJ+@w5%Z`Ht@hoO8 zt?|u|?Xw5FsKI-qfc@uMzVibWiu>+NwEUh6iVlaf!lqnUy@pHX)(Loot0M5oY&5X-_>3 zxL)%r{8vb&Y*Y-(i7}4l5>?rwWs6n%_-jbVcbpDhA2)mI_ytmOeytbV>dL*mug+E6 z09Ov#CmFD%>Hd{2lKnLn%);EkX0IfUQaGk(VyehJQua6gkq`7xoFql> z3(YBXOkcxZ(7$AR>K}S>1!!X<*c>c_7 z?ZWH`@;{$A`0fJVnkm{P=M4)Sf3TP8POjyEMO(Q1gS}K&pS946#nh()7gOPnpSrM- zYBQ|O+b9z;Z=}j^@83wpOR(pPS6Z>%NacHT=IcutoL60ohZfV9_|D+lknZEgzBBCc zK1<~GZ2=EA*byyOQ}Z!s@M?Vr9z5hcpL|!rUgHXdig_i6U6X>HL*e*LQ6a2?vu{Gt zxu>R~FV5i@=(A|vr6_}GaFB0J4RNs049sQ?Et@JP%Ju&=1(#Q`)Tf{H)CN@VoC`QK z3+=2OsdY#p7Cdo%VfIfP zBq!fr04R2N#HP*9t}%AzTWO+pxozQjncX{rT-iTxz@PQ7HqPu5;Mi{u#fDbH>(+tp zgI(F!j{x`a2s&CmVh=IC!0syyzUxx14&k>D~**{+;Ec5PR7mf{oVzLr)8h6Xu@sIZe zUV}0IRAamF?WyIrdYJA^MZ*r~ok_UF#Ty?JUEB)J@pb2D>9U&%TO)#a z6Ofmm=FNjIe*_k49nVs*TFG@PdtrFSBIg9~Ozp0L5(>>t@CLs-7^bM-yURiG|1GeSMra9ADwJ&OCUD=)v0pJP(Jo!HqIrtWs znyCuAC-z+r#zQG5+bqpzrmIju2?fmn?NV)$;UONS5$FLW>PvGv3c&XASZ{2+_45F} zdi*0iom=1$R_@OJ8Hxg{?U6B&_!{`smR!CrUVP`BueN7LqbQ=i(O$1SqjC-Ip&+z&!!g8JZhs&b&|Y6k8kHq}U&J5C+9QPztojQ0`0hLXG)&m0Z*#h9@$66@sdZ1nZe z>}*uo1NQmbw}{YbCDwBMkEiGAj>f(90dwaF6awZ8m@8oW)2}?3H=fx>6E*X0%v?@4 ziZG9J(ru_~oGkN=MTD{EH#jlMGqkuEV!IK2+9Xtb7}xG0zk{%1Tt4Evy~+&#oJDMo z#*0aLw7|-t>B8u!wkhWXyJe@k+)Znpcf!mLb#GJ$O099XdY%_70d271+v@g}rg9LA;J+q*6a3`kkL8`{JqPxh|61NW}8oae*D+%W+`G=Qa@@ETBwNv?G)z=D?wgYsViYI#J3t?sz3cu{n7+O19Ky%E zcm4O1%ysf5>V!vXcG}nS1o@&fpJJ4+NJhwK044xVEbXqX<;B{qpc^|55t%Md%m~pOW0#o!Pk}@)4NEE)%G+BkE7;{|3h#n zXZ+D*r(DkZ=n!PG8P4OLa;@KD6e>8z>7H`S*)}ddd(RD*x2klL^BH1H!?k*y(WirD zrx7onPd&(8Mf7k^JT6~EF7OHg_MiLhDJKR`^XFRnH<<<;mVD!RQ6EbBq@kdigfI z1m{GdX|qerIZa`J%S4OaeTjAvZ1#WH*(Tct%r<#y;CFo+T-yhO-*+82$4uq+Qc9WC zrupzLpjnHIncK^5G=qOP=C856m{OGXf*p&&#dmUhLH}I&AGH^`nE{E*i{^Tb4XEp! zGTDd7vL@%WmDs?hl8mPEPmHa$y#xkv?ip=_)u}pQmB!aFx@o!H!I6ECpG(ZW30$YB z2Ktrrj5olaLnMkG$0Y5$`DCBPh3% zS#$NZrQaIMIxu$3qbJ~DT$&Qck9V=Y_+=)35y7H0)Rb>VA7y9s;dpkGz7;rc=jQaM zhcFP8f0Dldj-6-iJvwKS?|;W&&Hrt*4WX~>FPtG8_(@V+~ zDkcq%0%kB7SomZse*IjNgDkRE;YoutA^fwRgfs1pMd7n92;73X`oGwMiFXYcRx!yl z&sz~RdW!GPPKSJ67MI)j^yOJ~;wt_I8S?dTsTNGY0+P?2bOKImu~oP`Ao(olPi%9N zn{X)lJ;u5Jp$fy>gxX_9@O{$Nj#|C|C4yy{vXAI?(=_=AG}un z@5ggapXNU4>(i68yo;RE4NF9N$~%t0?tK~7eA(WCZArO2^kK>>cQ&3A9yady!;`*> zmmA~=(CIkP4DWJUrI>XSPc(70l?}coKVVobvcu{$4m2DJ1JC`T?%FnRB2VxyQ>xM5k4!w46cFwvXuWiY<^v@Ee{~Ks67jpvkGGkfJDnddr-B#g17}e0|LF|M_jypiek?3C zbEtFbo#XPgBNS7Uvx>=AMnUJN)i=+>5G7@V5$AumjIg3Y!RN=@!j_T5%X>c?Bj!SC zi)5U&0rcJfq?CMPRZ%zJJk!j>+~>yMI1jV&Psfu1m!EIC#q%(>l6hF6DU);OVK&8n z>;JuZ7}l65qj}sjfE{q_Z4^eXJ=*L?*C#U>HEN^ zugtH#(RZHbtT_v(HK1K~{oQsMdTw4D`)-nLm+k&{+ogl|4Nw@zYu>q>HP;O)##01q zGI<2yB;e8o9Fn%}fR&g`H?a<3=d*6iXHAQ4dNvPK8B)6rG0oO-VDkB)oS$bn`SLvDOFj$C^GpYS z{fD6bP48@6(y%9N*g4m~Jz;~RHC+E}%kM)*@G!ogNSTVI z5QQ*VBGWeci^xRS8cIFzgOZVd=ZuM5sXpD)TTdCqx+gs}`wRa92)FAY@EO5v#KG4w ze(qZV!P_OPZSj&0%{RztP9FxGc0BN3Xh`#d*XYM6YTo{L^&^MwOCxo=xHsl_l5N?O zbzNb8L4Ny!j)lDNNiLcQ+%bWu=?z2$AlVngeDSm?<0f4_m0b*Z8PA&~up4|a?LS4b zaiD3>!Ic$|9RuIe46<$$YeuqT{6jsdOVc07!DSp+^jGb8A(dmtd{6c*bJ^xQaK;ky z0@$IwOFiL1l*^1d;O}ktt!IuO9u>tuhXHT$?8@z%IT!j1?q*=`x!-Vy(q6$&1&<2; zB$yBq6cS2hA^E_5fma~P-pC14QU z5zgT+7cB8`EIAQT5kXWE!RD?J?A{s4I3$wOIZiO$E4lM>IJ3pP4R0thosVYw0xT1T zQr}oMzY)u^?2YHtj!NJ(%uE`U6iV+WvEQ6zmJUqjxc-uSU2-TrD0n)VL&!_BT|uzg3tMS{_} z?B?5Cb~Clj&^Dp8uaILrA{f@5eSO}Z)7-p-UA}$+r#9+B#ugW{uQI{Q1g8q#F8Gk( zR>4mMPY5P=WnU#-Jt?6yRB&ro4((IHFM&byYgdlzic)qtr!)vTYA9u!$4c4d$AbSB z%q)wF2&M9}H{22QMcFH5Sd!|-rQM<18}4URO*d|{*LRDGh@j_T6H0G&;}ZKx@Qh$^ zIos5gSC@xUz2H;j?DBLu#~xL|(vcNxGrNLIW|iP3!FR>}a0R>U)}3>7MR!imJ>5AM z+q-kQeJvQ#gUxxsQ0mcxLz^JDPVkK$Pxe5*dT=-=dwd47t0%h|EO@)%BRx4Kul3|K z{3_VC7rQCzH77lS?&>wQ7y48$E~SV{E{!3T-77CLIC?9Faw_GX*? zunDC@f(d=toF>>pFjsJxU~M1H*ZqAK^$DeQg1g238{kt)_hqe-)|W##*q6)UxR}%W zaV%e4#PRm&&+(4v&u(T4E)-k`jG(RkyH`fgPQlLv{|Q8o8!!gxUps(v{f6K_2XF}g z7IapzIaDxGa8MP;c-KG<^ZkJw!fBYX@#bPTHVqq{#;9m6bX*cOgD&>5Hehb-(=uaF z7qAfIDqYs{`ha<$1zW;(6u!j8vS`b$vMdj?&?q^TABXkAVsSYaGLEGfS~N<&N*n@T zT}8GU_D%5hnsSl7fYgOxnXXdUyTbDDJz$j)g%fTZN*jE=hEx3mSO~sqJ5oaV4XiWX z?_Vt}Lb2>Z?Ca%prU@&>S1y^g0V|<0`irm&z>*O6LSg;Dy5I}wcL*CJtOwG|>zFr# zd9Wh6LS#$9LXfT%l9u~~T|y6vY%SPmeADq^VVi{w!I@i*{Z(O?;p=eBJ`#30z7@&r zh_GSwq_AIvU4eI0Ec0j%b2z@b#jLroEAdSzW^KVjXasKRW7b*NXxb+1QehKtid#cA z5#wD5zHqo-Qax8>*V53vXwv>7b>ng0CE*91o zY%|_QTq^8xE4xhMn+(>EmeZBO7Km&)jS`p3z}%2c67~?-ez3{Ho)ec1G)?@y1=f$& zQk}^5i)<~;!xIGZhiO0v?ZVe4I7dH1wi&matrYev*a@)vghe`y>;Yk|gzct>gmnW8 z!3{8v3ab*?2eetrWh7V=zm+Y^7zF2zykRQdekh zAukBiYNW_s0~?}3)p%ihg@vhWgdG73SK(^1u+!o%O3f4&62!4bsagp$HmF4qv%iR} z6WC-Gqvi`6AhH;>K-eT<@oJH%~0jEVy0M3YHtuZ%p zD)3G*-!J&2;Im@?p5WgFzY;tlsH50dWYl#kh<=1Qh?JMn12j2Ol;~XoH?6$Ofb+eN z03Y&pQknF$_Z66%N4F<7zXO}D(R+Y*L>~Yyi{{)t7<~xl4bhJ%C%qNF40t#`OZ!5e zlF%QuR+qpfaC^cam{%qY1wNcG9Qe0{QNXPUV}WlbaL@WQVG8^nPnZGoyrcubyOX#y zUIzNY{5GjQN{{P8QAKh(>a04ssiUfHd2%PXY_w7IL~>7uuY`9d_jO!S_qO0iKodeH z9Z25e_jMw9FhbKQmjR1Yt^{^V;gt7D;WQZBo5Hbtk+KZZqbWSwIFqsxW@F<@Z8RHc za_V0lnUtBzrPnf*+dx4ohsp6eXk6;2D8p%~iNKpvzXsl$Itunr2yPR66WEp_(>ej0 z02O7Yxt%^NO^b!O684#r!c3H2hBFg&(ah<~`_{BeoR`$?65K8LzTn>l4*=WJ*J)hB zTvI52*m&umV)JX-c!d9J+Ai3bGJi3hYx$LQZvP((p5GV#k=`D8;a&i(p7Ax%wEthz z?!a=tCu<2XA*&wPGK-}}g1xi2d@jyvk6BiAR%4mBY0BowO}S;(HQny2s>^IPN>$Yr z2$l;D6P(-ZvLG*g3bU77%^C9q2Mf*+d{l5B@RGVEEg07bJ|(zA@FT$^g1-nxwq%zr z1TPS*61-CITET_D4zxmWo#1nV?+P9jbYk0k2Z|AFDOfDnOK^zbB*7a6Zx#H_$-W*G z^Rt2<3H~G)(Ta20s#U$qOBb}_8XVO6Yv82TiNJ=|w_|y@I+@EkBZu1_YcP~~&Qq}O zm9quNy{rTE$zi+{=%jmdxTUSlc_$RNndGFSg>&y{OLydQ33E&EwFl$!V^1&^H&5h+ z0ng-d?+DJn%z>MD^6zl9CDS*#KX#z>{7#4^U$7Ift!Tow)HDBU%A_mu3xQ)`uV_1L zy!1`}A((%}!68MzAT+$gYr_~NnA(P2=C)~vcssV?c4G8KuQsebZfH{s`$cUyZTGg} zRIP8*B|M0pZo^?d-=-Ve7ruiMc%YDby~*kN!ga7WF>Wg4w)$-0M%d)GTZVEry@2!U z6kkpn*KQed%6^^1ew`AsldfyW`hoknqAl&Vqjrqnm)adgXz#T92k^6YKf!&QqK;T* zEi1YJSXor+@xo@br!C!8#C?CQ;32_(365;f_Ok>R1G#^Bu%NUuAsYB_LVQG3U06ph znZ%B)|C0q%1=9pGI`YkWS%S@Ab4gv>j-yly>Ih#gs0^4%l^vG>2LfBr$c_giGUtbxwJ0)R@}aG%(5qhRkSd&?ZOTT+o|3cwkw-uJJjF9 z7sKD0R>tMg@OnIxY_RMXun;<9S*WK0D+L3vr-9>(@zjGIu`C@dj8S<;~n2Mug!j@2dM4XDJb!}L-gf>K^s{|_I#Z|Cf5d|uVE)&MFH{gqs zqlMMeiHJTbh35I$Kx{yJ!7@+eP+ai0-?DnN8O^bXq9CbMBT2MQbBu`&39KsRZuhPW!d1U zYOtA>T`g>rWiy4nYuQ5aw~H5%>9AUZ_?l6?taO{aH=~P$`D9~_jM{i>RWn*{Sx4_m z)tvTQRti~5au#!#b7{DDH9pUg-HDm0vDQ>7Y(6daKCW8R2+LM@H>(_4Y1ta@^D37f zHB9OupI#QWllFLDQ~9*pvVC9$^o3=gc^jyZPFeQ7u>1=+_W7ivS=Plc3A2!@tZY#9 zK2=E9ST+nU+tEDBCJ1{$*j$<}?39s7DD9|OXNdvqH7wzGF^pEhWqTUvmoXdbXGc|g zS|IFj$kWlsF`|WB$e|n#c`5p&>PX4L4yxCp$6@s+%dn6W(Wg}>!ktw3cQB-R46{PZ zE{mzgS=~;S-6O16X%LVfF5l3AK=I5N6tEDXlAIfAihHCR9@?ZM7^Su}+tgE`tcN zjKuk1;lgfm7vg+e88x%4BJnP;&Xx^Mya#NMWn&XpflajRy2LeL^DJAK_%PTiVe{$! z#0Dy(x^5C5Jud82xnVCR)~Pb;i>E;D4|@_f>TYziu*2#gT$a-U%f1)3TA1l8<@AIw zliPCo*w1QJIh`?#Rwf1@SYq>J?&3Au6xlyVJ0n=G+NkBI+1irSJLg4spM*`IPS14IJp7rl=0^d zPySW+rbwJY_347%lr4;72zB(PnZo8%a&okz4?R%HF6UDF$(g4HUwm*q!yHVf z{H#`8LcRK!7&y#Jv94~|X5@AVYXt%JrbVCZWL)gsVE9)!R zh<`g>d%SgyE9i{Kc807g{JBCwVVW$6GNrQxO9u_&Sq{+f|y4hbf z-DDVaa-E}^R`^}kW0m_+Kbwhn(OUytj;8DZ93O{yzhew_7G}b{iuxNSVO~X7`d!vz zt^C>m*;tzEm)-9eM@x-NQZ}9*4sbc1p7Fb^rwR0WfNUb|^UG$^HFPXMHi?R>eCd4D zQA53j@d#Asm`uZr%-tex5?xDc{Vp58-ZYGgQ=fEPOM5LF6#cAY3Jn`5VbbNPFFU5v zA-z3P}wp@WRSk5lVu2Bli|P3msPOez@6vbl6R^&`jiG}^M5 zCLcL!DdQ3&Yu%&*@05pG)}_g(j@h)wvWvjx(Beyt%PX54a@;_>EV~Y}8|jR&B{Z+e zQAZu+4q=x|=>8@@I_A<4%bsd-#&HwPw(O-Q$~li-u$+ zZ4frkJu9u1a}n(j#;MK+d*9F6JD1QY<1d7J_)>}*CZU9!Oz7fVO4){~1!-u0&Xv?zx_rIcm0sgqMT3MbaYv<3 z2b*A7YWgg&Y1U#2`0Q!DFfgkM&x*3%JTJ4Jgx zLaq_)&uINeD9+Dn)uWVQ8EfbbRA5=p^ai}gnrIp8>y31`FcbSmy3fyQ)kb>6&)#xA zM$ZUit@xpH6YcQJ8u0$>9Y3p8PtqrT_LlQ0IuhXTX*%hb)v9L*4|Dj(v9DBHsF|M~ za6U&xesZXojmpk1F8K<3F zsmQX-jB46Sy)5JBs;#uuGJc}nN_#EiC)2HT+%kSL-AZSK&8NH!<=RHEqfJ`62+I}r zieo^A8?tr6%oFrB+G-eGnGp$DuQ8G`c~0FKVSpTcVlD+l|K+F3RLY%g7A*_B|Q z&^*g-%*=9qM$XB`-=fU+u0yoWvimZ7y1t=|YmMx&%u8JVAlDRTra$~hDZ;qD9B}@~ z0{q+Qaix!U{bUH(o0&BM?CZ?wt`mOQ$;?`?J`xJI=!x;JlQhvX4&@}R zvW!FdCvCQjL-{8i7dDqBWHsQ9h`v)f64aQm1(wYhw%aiGU0Ky|88ywgTraX+mOYy_ z2C_4jy_r?3{zdDi8<(GFJ+4ks#&w3B$f|MuOv5Y-ZQ6j-($5N;FFE>!HVQLk_6zOy z%WBmxlsbb$nNPdZYSn4t>%I)T*L8-9{p>C0uQbZC_u&#Be)O|@T}sWi?C+2{)B-=d z*X2~pEGuqWtAf-TKfBiztTtJOJzuU6wO80&x-|U}SD13noukjx=?nWm}upQ-=DBpUtF9b+cu=o8IrpQVT5G3ztpRZI*onSu=H~Wj{jJ zTrIJTn$4sZYN=(BsgF8Zs^!A!-7(FMxU$vb!b~2r)iZw91#gyj2-``#4%SM26Ci7) zP6^vVyn@wQb^ePfm(|VIP>$MU*;8P-YWYnpt9S2gHr<)0Hd*$)up^cwG-p}gdF*nD zyQ{D*!s^|lg`KeMCSlq0#UTKDX=Hr9%)i7c8?yYc{uU1)hSlC|6{v~Yj zEgXu;d%jwJ7JJaoYE`~^+|S-}woxw#Gqu@P?H0DgJ)~7ZXgf7z0f$*nlUj8EJ7U>_ zR;8gGRQN(8TMpJy)PhS$Fl-VwRbb=%MzA%xH}s z>bS_3xUXzo7urJ=En$~S+;dvb2U}&?#@0)~J{ML`+gjfPR(cn^#K_dTA+(p8BFx0l zOI`102b{gsd_OzvtW-;dnV#B5Z7@v6#y)tx!eMeK2b}#>l%E}TUZmy=+d(`U4p0r2 z@fcU7p7*;v;2fy-3o|iXtfH1mnC?@pFTy^RY{L*k7qHR7jLSjlcEcnsgVYtv*q@2- z5;ejyj_*=6+A@ozqj%{inmSEK#x8$C=lyT>PcTwS5U z?-eF%7sFLEVRLDA&f{vhI__t$gWJ4UIc#%0KsoJllVZLsX+oNBN=mc5yC+BsUCv21_NzR=OCSp&zuGvuqBTj8>= zupJ>Mat=T?+A>G(2Vj$pOO=*;D0GZkY+2LX2D(aZv5aR(SE;?0tquP+^lGKSI5fNmJA@%UDC>{m}iKvcrls^fVQ38Efe2D#tR`(ATL_%UDCtP=hUF z4Lwth7iQYaELA70o|fk}3!9~OTlP?HUf67vxSHdurzdkehTW*<`B}HHzo`9|ZO!c) zHc#cQF)rT%o3Cd2*`TlmYPn^9&%G?{R<+x*)4A1Qx2t28h31V9yF-nAfJ0eAS$Wrm zEmjMJ)l*(xUDy(}$FhpNA060Z_n?WdB5z?>y*gys#d*uZR;Z%2Mm90;{;+%10L$j& zZ3w$hP4u%T!&a-+mfe~6eAt8Pke_W2TdVp$WI|b<_h#5%)oRNg%G(q6uzJDI_J^%k z;eTb9bJ4CFXoE@=hBC`L9JWE#2s3?Uqnat~u-cmUUD!r-M3||E$JKG`Z-3HHVOUFi zn8P%(C)7Yci*`JrMhM$U+^(NgJ=U?yoy6_>DK)|}Zplxny_RuHenw@lXP0wnSKhzF zo>$u~+n1N%cu9RD%%pRxIwOo@Kj7S|wmc#+$lJMX>RrP`OKnrl9%Y$H=PRnf&!Qc# zsJ_B>N)O+mMhiO}!hL#&nr9jJ=^bi=W!$HCs2$cH>w+EXn2|{@-l4{C;P?(J&h4ve zo@LyNUsY>`?Npriood8JRVxl z<(ZCAJN^h&M$2bPgdyVUD)kK(iN`6P>`B|-cS9P(BpOW8G0}PX=>-W_)R>sfF z@2i_E<7ejg)m_3&4DYK=R>mu(AK(=@$8J_%_oxAuaSR`-4VG~zAF13;?9!~1exxoH zX7ccn8YRrs-$!b~S+Wg&**Ju9(lDBo9~J(way`Le&ZpU6dsU*axwJ4pA$*@2CTs~U z$xjdeL>;p(AIxtNzF+lvQvA6e%b!G_su6~v1arbaRWpT|vEzVR0enf4tY*)dhV0$e41hS**m}SQyJF48zn6$Xs4iEoEWmuNnb~ISAWo_C{qHomz z%gWnEJHA!JEW5Prgz#f(nq^nFJ?T8A>MWbl_E!2%Ew^l8+j_9ImfhQSa`->g3zj|F z_Bybg!s_Yyw#Vpu^_^u~g=K7!bkeT24Up}#>|XIW-i`S&VTSUt@v93T3p6JbV||EP`#oA2IMSWQ1F_j9IP-YR@5{702x7+ThIU`q`n z)+i^{R?GfX$m|`<4CrH0&7@q1dsnYNH zUB2cbeJH@C(*Fu@sdU12j-A8&AXMq*e)e3r)}_LDr^UCSE?r`wGWjnj2+80IQU^~CE{mc_bhreN5P4 zmDGNjr@7wyj)|{X`&FJ6+WCPArA_;_o|bxuW!=HD^(Vqin631y!c3U0^dVs;%vL&f zPh*&^^;^P>zZ|_$nDLjR_ga_p3ODK;eaf;Wg&RG&`p8EnE%&v5+LNa@eax($o@oD) zr;UC~mSeD;GMRe6K2{UOa)4POmS~lu3 z-T4dlcUWu+1NH204Ev=+HP{wm9Lm&)i}iqS zSvH?qbetJ6NN*4}mvTBb&>(&FF_FRL6Oh#zChrC>(W@_gKUgdcQF9Mr^n~6X0^Vp7{@7jvDAneY>B9L|&;UelIfV(wYq_ z#NzD8F}m)gVXcY_Bd^wp|1|8v;!crc^<>McijPH1(0pAn$9Hvc15OXUE3BTbFMd93 zqK-PnvU=(fdki=Gt`lZj$TfPEFw<|Z(VP6T1I}yo4q-cKSuyEJ`iy0(iYHNxPW_p~ z*65r3Y(V4`y~;2*zwx_HZ?^2sVrIJyqrJtgoY(0=zi=pX=}__Ik=N;#r+r~| z_sq~m!c1$OsrL#qJ#MCsJ;N?dZ=9uzgqgl_y*?$(0(vw4T}ebHgyc&wy;lui_8v#>g9W#c#~!g5451SFg2fK*`d`oAnM-B1_BNtQP82 zW!T7)2O@9PMc7Nr{w9IluF1j7l=YoDR+t$P?$kw=@rbZU@5atf?%}tTY>8Z~d*T`s zQ`QZ1mmVO@_`6F_wv7GVt#9|sW_XtBb$(f$r(RFPZe0%ZwUT3z%k`+R#xPgviNcJY zU#V}mjK_|9^*X<-G-{RJ;g?lL-KW=v`@+09YPFt?UAVqx+eP-HwiWM2{9`)@>fuyDj5& zn~l0C+Jv&T=}dY|udc$9fj4@zi^?6wWp4?I$C*SSfCEh&7*vqK*f zW=eOb4(5v~Y+7E^iNZ`f+ocy<#_jBNy*0&zvZZK-=M6nA)v#Sfb)MaNEPwva*4W$n zCSfL>@95>i4l90B|E><_s}-zEKIzXp>>1-bor{m>@SOqc3)wzZq-XNj{6}~+h268% zL0RJdV~@`-zNUj%95_wHHu)m0PG++~mTDVIDWsaZ1-J<*VV4zRW6XoZ+$WOljm;3T zxlC}l;3%M`Yy4(K)5T`C*z`ea`J9XowGAh=Bm0^wZUW7>h)unOV5ALV^N=5Lzo_4g zQ%Qca&wf2@G(9f%CSK#-q~Dao(;|IQaHpWL`B=)4Z`U3Xr3P2-0fe;)xO~lf`R>AE7r7i9`{hIcQ8)N^4n7Iw`$ppqT0cImL z_O8@MH-Ywnev<>-gkQk!P3~HXd7MZYHFXdh(oI&Dnj7_$fP5B&8VEab1gD&y=GVV3bR5bcEA&e0>+*35o5_4cJ{1f5( zVl=JD)HSC;%Z_6QPAqVk=h`@J-EjzK*Q^QOlnkS$I*E6_m`ywXbE!$mZQ|aT1Iu-*(>a_? z2+cvfPa9_-fG!C+$cAj{?$6zraM-Uy{PJlWE+ymle0x)#fh{4>T%E;!J%YdbTcDEm zU{I6Md!~L($pqGEqx5|DXWKNkD_9SR4-;zvunk@8JkSYd{m_8_HGBxs&TK` zB(1$MC1>0J_iEXU8m1PWLhR_Fl7|1>#<(}NyhHqQxoLV|%%1>#X139EKg$i}GgCPnu5pL0@xZx?No}Lwv*Y^jwH%M+ z_xzd9AKBL)AE<}_x6F<8=+lk&qQ7XI!{m}Q zbB4xpJG<|gnlfn8Z&KChp3ix5`nSm3!}MIn|1A8*aL$hR0qN05T;e>o*pwAlbr%aT91CSdYdW*p^O<`@mMpW?y?d-)!8Q zXN~iHnSNn>8MArH2z)l#i<0rpoy>eGa0V4<4xCK|hNCa!6ml8*o`bkdFzb^ipul3%EYfZey#A!!;M{SaqhQ0?&|Uq-$Bp}_RVp| zt_5|+JzSNz_pk~l=LX~Fr3#pP&`{V8#?On>Onjng3|&d%Xas)MIMp)}XL3f;beu!F zhQ=eT$@n`3Zl*#y6@RDU=B;UPI~{+gJJ`pqve%bbVxV;{3Yq5@5i*(c? zwlXW{)zLHmBi_h0Ou5sQZ$7@|vygw^GbB4Q~x|Vv&h)<@55T7~! zS^Tn_{@yjjYlN*F$GQ&owsM^4dbu}*f=jRTW~$iIF%r%Mn46Ve3zxipn5kBWMTLh@ zUTFo)7natlOjTaWJAKQ=+y@v!14}2s4WBm%AwFkN;uu?64KtrdcorelDzBPedJ!E} zcaaf)@LxGP1Bg&tQ+2%+p z{~OFL%4bGwbF?kL9JR2nbd)*>Hx1a&a$)(akajQM9dl4!RQ@hvA5vaH+Z?>lXsBX* z9q}HF;qq*N7GT__)|4NK*$4X#(c9E(<^PD;ral2ysUOQv0^Jp7Vh%dEZ69?cR}5E2 z9hnvG*l}u&HzD>~#jQQb(YhivmfJ%n?78=?cNA9i_a1a~s%Q!O-W6|pXQ@kY&BH9k zZGM*GQ`oa44L?XZ{Onjz(J!`y_=Ne-j=RLn=gUhZg$vanoX%3t4Hamy&gX#()#a&U zfZV$mN;nJED-}aym%!XNe6Csr_g*LGE(wSpA?D5qE!xo;bvGxrGu_br=2+~vK>Ek& zTf3Kf+lrfUs=V9M*oDOQ+tlOTcf>xSp6PztS>oK)y;zqx|K7cVN}McxLjBbJcx;vW zcXx^j(cHR{R927FxFmHtH!JR1ybZ{Wt8y+#D~vm;ih7g-c~8zz=a3#;Vpj=H?lCOx zSxLjQ>N?m|J60FWa#pFkdlZCLiB1^j+@CZ)?po)sJ&<2#XwOA)*CH3o;;K}1Po&(L z-gA81HdP4oHdQV-y64kzOPsS{UV$8Oov!HleB2r**WD~B&uS;P3I%QULEIYLo%*O_ z7CjF4`_%J2KZ)bE6zy2=e5dEvaqFEQ0=ZrN2>g4`NoZqV^^Asl-eq=F9q)OJo{(6M z!k0V#sOYz&DzsN5%zTFSs7mP701cDcD>J^@@pw{M`))2onSws9rWT9g1z1}&b*Vib+;k~-XuXk4DRw4w}IbJoo7wf$~qVX<(#z=B3 zD}EfV;$?h*V(@K@kIC<}6E*T(LKXI0a<89W8j+Z!2KG)*tklDMw*p?>o5#4n^zNP*;<~N( zainT#?=gubj#bf<6O$bG^=1w5Nbh+te^I(9ky}x%DsgN^_$7{Ay(z})8dAP4G0F99 z?@hoT1f6|0C1%3rY2Xin&OT2kwnBQI1NN?X1);GXOLB1At9G{Qa}YL<^gbgoUKO9I zy7Y;5gs6UfE`qKYmX@DXLe+iRB~|L%dLvaxfA^%m7-t73t#{niXQ--jZSGT(G}N`N z&otm|y?4Y`JNEZkm{jdL*=JEwwIizUvZPsvy@6)ATJ=SZyNU$60Jo_geb*%&ba3A< zad6p|I0p4)tQMTq_obvHwX7KD*qmFExTVeR%eYGL5nwCLI`ci}GccDpxA)b_b6t*p z>B&isn0~F2xy;)nbE$So&Qt~cc;qVWS4~xVV80uahw7{P-3*tt{V;;)d&K@B!6yY@ z75qT(fZ(@+{}Oau#Nl`Z69h8_^8`x-`w3nuI7)Da;2nZ%1UCu3Eck}thrksmv061$ ze{<0qq;qxHUx7bgv?+N#@jn0c#Cv+z6YpVGYdEHvKp1aWV%R zr%U@gQW-;1*GLOLs(4Rd2+rIWr#0XwQ3F0n-G_aO8}&ZyPu%EPLj30Ps7fEu7cL71 z><{N$gf|(dyA439^ivp%$7$X@*h=#pc$~g;K&=|5d5j*XcqV)lsj9+!k9PweRig(0 zUDplh)`Ycj3z%;nFbm<|Gk{&*GhiIBLCl*5RKd+wn3L22#Kl_l(k4lY`)`tR72N=H zT-Aamqou@Fpsu02bn~ihu;Cfed&K*~a2Id;%BUr}UDav0zp#q6P$d*gh#paunHJ*W znP;W0scM-vPDbz~nq8F-^N?_b%DzyoQh_kl;#lGG!xIf&YM$1@IdnDt04?+x-2?^8kf4173a z4NBug2J6pWnI%D7G9^Jg0+s~rA2>X-N*x(UF-!Ch1MkXQqxL7Q1P<>V;p8%$iSGp6 zKk(zs6`JR|@1gWop$vJSLM6gksj5`e#cQ%=DSiT~3_4vtN*zUO8S6QU^t|Rd2=ffj z>%@EhUMGHYz76IXKz>v1rc$(KH&x(E0&YrF-5hS5pJST>#WqE10BrV%&0ewDFE*d6 z%bjjIq(%Ubs4>n6>^=I?h41O<)4;LX9Tb5bKo-4WOku^6~n?*nep%|asR1$`xOt9}5uL;n!srkT$15eUsW zJHkzyodX;Zbi%nkGJ;MyKL(z0{tHMhwsE>Xj?BmRP**g|$8oMnP4nqq8Vme{7Q^Ny z8VU1lV)GO=!2E%jAEmosevobgK2Jm7@=dz2*(>UK*T~qLLca72PW@8Q5z6MKf?tNS z)Zq~~k*~OVsI}>}DBFq*#1-iN(^ z_p0dh=oZn1(Ve2ZMGuOe5q)d)E76Cd^JAvREQ?tg^L)&(KBWABVz z6Z>%NhS)8!FU7td`)=%qv44*}5PK;0o7kUYqvDF=D&q#mjf$Hew<>N;++X81#BGl| z78{?mie<}X8_}%gE z#qWzh5dT&DxAC5Y_=Khj1qmGzIw$l>=$|k?;ktysBrHg{FJWWCiwW;0e3@_};dFu{ z(Vdu(*fz0$;_$>7i3=0!6W>ZaocL|x4~aS{E~$A^Nz&y>wMnaz9#48T>HVZLN$%v> zGv~FJ(x|)hY8+mZjXA z@?grdDce%sPx&O@Z#I!kSkEOkx_Cs1&db9L` z^sec{(kG@*OTQ!ip7i_Dx21oSejxo&`ajZ7r2mpm8L=738O<{CGdgGV%@~m}G2^<7 zx{TX0mS)_a@pQ(^86ReRlc6)cndzB1nMIjZnWHo3WUkHpBJ)^gTvlFIx2&OAqqDBd zx+&|PtaVx2vUX?f&H6Iy`>Zorp-tnO<~8lqbWl@`RU-%PZwtm#D84U-)tMx$&ZNTB zoMNa2#ZgO&r);d$w1Omuk|`I`JW8W{++fD{vlqZ+TevKQi}tuJy%^FGNV-B&M(xn| zi?E{70qZy=xS{9*+?d`OD==N~{p_w-)hVS*;c5tV!zxcXT?W@9s24#)V@;AF&^H8ey!Nd_V9Mc-Ydr4&*LywyJ|Q+cJs-pTjo7S@;t>88#V&UUz9;yZ z*gqDRsEMA6YXbaO@ZWLlvSmEuz<3UGMm&dqzt~hHTnLvX?h4?bgi4@F+6)XzV)xNW z&%&IM^fE9%X$SCvq}PGHlimgnO8Nje+r1CCC5cn@eiA+{jPFu(_TwEXwJ_h4!qPWV zILz~LR4S*cB#rUfG)~)^v~EtHFO}32=F8K!07s_31RS5f9cW^CF>|zw=#@+k*_4kd zRa1thv@cKp3*0!eZUF|GQ=76c^pYZf@6sn%ogk<*jMm!!K(#l3oaDw z*82KTq8qc<0Qa?i7iYFsHWTFq^g83G?uFoPLwGeT84b z#yrF0acDBqf8V)qI|5)6s7`S}qzr$?W43%(7oRJ%_%WG2ZlaU%L%nteC7zH_@ zA+VDG^H+RJ8~OrwxB@k9jPw9Qpf~vYkdZKlL3e0q6I@FNSsd&mfEpSj0ayqvg7;OF z0xY5?!1nl_1NIeR)eQIhQd5`*3J!)|(dg$bftNzJX!P|Q;FZuX8d{iBv>(t%A8EP4Drn(0>3#$g$-JR{PpI6TVUr;Xs zUsNw6%`X8pzCExFcv`&z{7tfst>DPf;zX^2cw}3JF9bj|)9#0A`dULJu~&0k&Fgq|IN`;a`q&FJY7^f&Z$%%9QI zBj`Ewam=F8$0O(^^l{9k(Z?fbJNo#K-Up+DW0GTr#!QTv9@`MxH|bDvPRf=hYtrsY z56|#stX@RaT{-LcomLQj?g9l(G&O2Q*G3yyAisZg^Iz1t|6eF=`yIPC#LkV>ha&Ca zNVx~U=9sN?hEC{#K0k&=(^dFgjo(=O#^E;}zX|wV13iI%o%_{{o<4ERg*0jUq;b>o zN7YOjlRtXmL>e?^>a>1irj4x`O&1MjNjW59TQLTXs;AXVp|Vla#??%k+H1_j$zyzM zz}V`kW2kKE)G^nLoH)xTvUK2>>d|mnQ9Z5t;xXdc?{eUnsWlU?<6x}Y^6F7zIiOjS zMqP~G*eNxW#$8{{5ti3Xnl@(UG$Z@}+I#!hy00_O@9;__FC~jMudGeHCdbq!+E^Q# zW6AQ1l6W>0MahiyW|6WJ#H!|syrgb)$xGi$>SfZPyc(#8fe5I(n|3qs7D+on$HfNd zVr}eZ+u3%CnH|g@!AyYeOMo#jLEkb!r$vC7Vi(wH`}sc4IltfUUS64+>3hvbvXXX~*=%fV zwrVG98$ibbPu5$OxIKTfx~?^zY_3-8Ytt*WwT+mb12^?*qy8(@&fcK>OufwvwblY4 zzS*j8P<~=_dAZiAE#0r)$}eoLuFr2&H)=kNvYrYTH`l0WZNveTKUH6=x38rF?NwI` z6?8Y5-vpAbHdfNz=+fG?>e^C+VQ($g)`e<=ES%rmSl`_6v^^cyv$xj4PNDUMR&%k| zZiBcSr!&n)BW`tGIJ>sFs%Y zMSRb#-C#$SY=zlUXlbR6n_JrFyv{Hv6ooUjmFnVc>k75s+L)=Xt7$mXTsd~GR?M!j zv(6!r%Fk6-YwdO5^xj!^p;fD$*sM21`sbR3`P(@F=QbOSL^;lIYFA`HZ%?&=>SnWb-59I2VJv*AZtKq{N(C3HY7WYw=cQQatLdt7xMD@4y0P4B ztwtn317BmmFE*PSvA)&3bz5*lwy;GI?eJ@ZMn~C-FV>btCE*0ZW8wCCt$nKAYH!Rm zSJ$g8`dqB7HaBX8LFQ{4m(~-|^YzvBMpv!Bfsc6AdP&_piV zJQ*dDW%@Rr0qnjN86kHMK6|USxLFisnlUaXQA)nrg=;P3rp;c2*9r=CzA1$QYn<{n zMr|n{HF(XXje4WLaXSd>aSK8FRpiUs3h1hC)K+dgotOrgir^tDt(ABf@t3viD%E5{ z4K#71o&^88_&h6_TWi$UYElTs|5t4n4|oSYGbq3Q??D=?cxqcF@4qP zqKi)ph{)v1#o7uQk98Jlv(PYMDz2bUONGj@=M|8}-%Nlu0vYnL3NItgdLjIn+yi5jAIQI=#GHU&E-m z!Ht?sX_~zMr>LtAD-w0uJ?VT`3m)2G^6!MIu5 z;8s?&k1%bqD+7jcvY2AYa#X{)%D(DmLS8UscIZlNxq$tgR!|UAd(On4r?J*-p{yL=8KoSTMcJ z@M$Y)U_#gj@V!riN#dq-ME$91y@48;m(6%l9#L*I8^5@yak?t*j(4}6$*_^{N>-Gi zKK2a>&3#e44U-!}l@Kpn%`_1_29&3+_>#?zmLxS$rxuOUwoAAvQ*rghqD1@UBhId2 zZf3K+(Ok`BL6QLBbS+v??NhCt>jgnO8>Fq?2&e|O-%^bA+S-!jDi;4{?aGzlTOVx04Yp{~U8rtcGs9TUYHx)gpKUKz*K12N&83=b zQ-dryg|>-vn5vE1r54vTi({TZfVa>v=I^$aT0yNaMrzg7u-pzy&Gwa5ME_z~uU%=^ zSCIB{GEiDqYpwIk(K&91rg>r2#;Z2aJXSd!Y`WcMgx zso2kQ*?etx)v)fWjYaQ$et8*|Z=2Je&35rdHSo94JhNOiI!ktnAykAn*GA*kmoC(_ zaBDKxKH1#Bg(?)hc}8u z=0+3vYcU#-L)M`%&uYH5{tpmx<1{`M#2AXUaw6PTk_Pl8N-#T$Aqr5Ee_(% z*oqkMp_sr^q7@l?(nWJh^buPH!^|u$j42sjeC*Iz)cacPcH4;75)aV9%uDYQlMm2o zt}Ov^ehty%ER$s)s57dewq%6sz4QDI-4zuxBHN*zXm5umGq_c);Lifa3jv-T1~?5V z<UcAXZh_60Y$%5h=WZ!a|AGW+N^exb3j>I|2s9-xbS2ZcXuPqWMe zbewDFZU>C1NqdSOgw`K~Vjqk|3*^}k`rPrEk`hd`*so~;sgBSc8a*i1deDRa)Z4a02aSD91foV(qX5Q(Kh-FwomWJNw)mW@MYd9R*>jq2E_(M_&) z<%qMy@GvFZjHK_%y!Q4qB zu>u6jcS9=)+g+kIMaRuiCp$BPR!vk;fLKK-+L!mp5S|xVa3jWx@UGWT1&xMA-jG&| zd4s5syVhLHkX|ST?cvf|qgh=_ZgU>3PbKbF7jV$M+U}Kht+Ho@`RY_rSXrd?(~ag; zofDX+olY9e`&@J@As#*iY{WK(&s;ke%qQZteM3d4Hh#3L7!8>LVg@PxyxSXLhLJW1 zbb&%eo$75F%jiEZ$1GAf)+_^_&2<|-@13J64wsuX=hwW*aT{vIV-NE){J_9iZ$lv$ zi_81-4B@^cr4_IsQnT1JTU{iQWzJ52`O1k)r%ugY1hy8Yd?c>Wz8X$7Hrv<2%(dF$ zbw61#@UhZ^4ozhCYdMx^$2d-Nvu)sGEp0fwgpWL|x=x>%j5`$#MwA7kHEOL$DiBut zjV94<8MNvJ>Tv$5SVR~m>tQW<+k(RD#65XV3$!g#u_aXJbIS!Z@V%qes(miuSOOTV zu3uVf6P`CpBDRz{i~yIkhgxnxgDz?@EfsyJrAUQskd3c44vz$nr9`^Ec>$lEL!aQL zobYHmO)C|q=W81>9ACBbBFx7$x6Ta=(>M%@a$*KL7@91)&KW4)o7dQS50Z>>wv`%$ zsnlava$XlFGACpTHMG|QWuNv^0* zcL7wL3Lqgu>9sfO8`mxsz&l;jdEMf5JJm9uvbJ1hm$DfWW@y;2tY5XkUTkmZvI0M* zOE6JnD@q-TfSsH@HGS#K!j&_#Z_J(vVnR#Jo5pb=ZHI7e&dE57b4?_ZEJPvZM|9>P zm^_IdP&kX>eNOD23RWQQ?J`>|Cbu!G$rX8?1hZS zVF93RL(H}1nzwRRgADy3I%7VGSHyjNai&3>N3lR0S;vqTm1VqJmNgeRHjL-b^6X)C zm-DK(QO-4WK58zr@;%wMqK!!1)I4T={y#Gh&9zy90gwe1@-YPi+PihzcOHwyK$A*JX?mwgoh7@FQD|5=GD!=nr9s&8ZBQ(8 zOur^Qf3kLUbHyY#@u^1jwy`+GuW%Jvw^@Qm55=ynW@F|Wp0YaUcLds@m7SAo-TA4x znL7$VYT)^GqO>8e6!Z9n5D{X!!(oa&m5Vg83geelW0|aK`;`yl{d1SjoZ(E6$3nGz zU79|fIFNM$MxPRu;^f$+*!0Rui>nhGMTT@rtQ?k>=2|D{%g+euta=|-F#wRfS&O1h9?C0)zzSz~cceL?JkC_xhiXm%Il0tWXo z0wg;fNUl>}z*!0FuW#ffGtl8mvvoT!NyL|z=#-#UxA=NqcoCbG@cxo5B`GRz4q#T5 z&u!pE_b)FMl)`MR$W~*5xTiAfl~rbuiS7Nes_tG{pe56Z+e&g3ZF#he2+1O|qL=>UVdhilUvK5ne!q2oW zV7PEbd*JIv>pZcSp>z8xt7c5urkZ%lvsLcgz0KiEl;l?1U6lCL10%8?Ypqn~4n%NasvF@nYsDkddu2-xU^pA$lYN)4rC9>DM^ka?!QToZC|VC}gjb(&xTbqd|?Q_alyNpkP;TlfUh8;PB@f7(wzijwK z#kDtDn>yw;^e|ANNRvcnl((KuQ79Ks-eg+~al%q0H3mu)+rM3^)zB$z5qX{dIf$wf z(0-`l2Vrq|IV-s_q!<-k<;JzF*i^$BPEk+PS=<@^&X9p2nve8oGs%s$y_bGemuZ^Hyv7 z08Y7atTbj^jZL@$DMx8%`C>W-C;}G(7e$N2x1zUHQ`{h?Ra;AGfRKujFG_2;^lPAHx`WW@0coo|y_GiZW@%#^^Dvasqu;rcdQPexg>MN_`VPQvZ}!JvLm#mTL1{ ztn;8ptV$7(=6Zt2e3Fz=mk521S9RT1SZJBhU1*nz3a#>ODYVNA3oY}lD74HA)l!>N zBnvg{Eh~&@ds!IF@`d`izl9b(Vmj@5nkVJwiTwxKBG2^6yA#}0y;faY!8^XR&e;#4 z*KT4+nAV0Xoi;MxHd4Mz+i;$SisT)$ISyk%j;dai#0Iwfn2rlYlNh7Q-F0uoQphB! zJOw4tLfp-em}n#bTPCHL7-4BbQ-!~8Y$`c!7aYK$BLbDz&}?$TY%P%6lDy+y;5Q>P#;4NT=G!@=n;n?&a?-q{s% zRxw}W?FuP=Cs83UPGU|;o}aI$+h`WNY6&SVnimQy6#tir>EW@rf+o;`_f zx7Wei94q=80(PV3D(|u`@fN2-pz?5`ET=z6E1jX>62 zqv?&*KrVp2ZZJbJ5e7e@6S=~Ex2)z&ZEc0?h%L_45QIxWtewtUik*Bl z36=5w!;-boVii-ejBa%?logzAHnY7b*j?fw!Bk&`n5=abSAeZQyJ@%8vbDEkc;6PB zmgVbqKx5enVuZEEvVaR5;@fGod%Q7oemShiBY%@W<|A4QxbT|pUS{>?a;C;6lDN8V zu^zX6QU-97`7hAn7JCE5@B8QMiz0}B^4@ui zE26qk2_eUqD8oAad7BTTQ)daGsw9Tu+AGtU@Vu|L}uNib~liu#IGEm?QcNI#) zR`W9mS`r&2!d~!vz0-wOZMl9cI01zw&T-2r);M2N9SM3Kwdb@5T3IDzWV59pPn;%v zdgQdQ&8lBzS{B4bWP4EyS>3Lo9Wv>k6pQPX?1p$j2;0!&)FhRBrCdufTJpOfT6I92 zWDr>rddqK+S+|)p^9m_6>eZsTl!V#In$EVMyXiy?$;7?QwL{&E?pvXew^vx`VyzIP zPqQFgFg^>`TB^{s%~pNoTAwQ1nWfsQE*x)z>1= zu35D-l2u0`29W4M>lt-|d=4UG&mWcfYatA)J=eTxp9}TH>uts5+&$7P-I;=%kt?DY zh;^JZSr&zkj=q@%(ycGWSGOGo6J^0|Lwj#R6Qm<_sU2I1J1x^!xp$EJLI^q{d@3`& z3sH%GTfnqa5l>A*)?we zH`ip!@}|X=xiwCISc=XxQ`|e~Is~t~*gTTeIiT}#(zw%FQPdW3eKIp*iBOo~SD7v} zYVg8wlm%sqdDTZlMcb1Y`LW1WkLpk|@zQA%}9?{CY@=WScJ8?yi{W@+XnX0HO%4EFyiTdb_zQWOuFahEfY z;X;NLRLXfF@QM);b}?luEEr+)D91upNzTcMw5E4;83)8>cO!Fg8{^mRvggHLARcrB z={To%VKliBR*XCU(${BB&OZ0@3(w6wdwlxE>1U6Rry<-7^d~XHM1zA5f{X(n0ihIxfmw8N!cp!DNd4}b3p>O{D z8AQbcL_$C(x_zoEP zg1QoYY3(LAYQyPG)YrM%P5Tt&+3SApRwqx=*hclIc-4+CO7UAiDv;dESqHJ;yb7u} z{a&@D3I>PE5hp)@HOaM&qkWKg%i6@4<^oW=M6Gl>nBlHPUC2R*OIhBEIF1p8HZ5Zk z7T}t}3B0K~4SoAeHoCw|@xm_=E;A6ty>QeTI>3FdIoGF|1DG+K1ZBSe7d9JMr1Onh zEv`Sm?ix2mwl=%BvWaN}72?>q!%Gpq*jyVGj%yZGm0?;@jh;&k@#|W$d5!Y7wKB5u zZ zwWqxVm`b#5^x>W5hHiCbRAU~6(_2<%n=*|h?^oWnk6nhL7U3?Os^B*X&A6uTj$3^y!aFCDp{nqgwy$< zrbJCH+|pLs9-XS!8ob+!+e>@PD3MtlZaIcCRSoKT2a^vN#pw=23|PmObdCjS4`rn& zjG`}U+SIo&5bv&@B$AT;aK6o+1 zFZB8D*zE?tb0EMj!t$*(Tca+nnY7Iml<61shW7oYEv65ki?@v+&(;@P&31EnV~Sf} zSQ{Rx;mb8rLK;;TP~$A`r%DZ@SGh@hRpn8|^1UtoRTu*2{Csq5!iDIA$6Es_i$u1V z(J2PNw^i&GBQ0OQxXn2KmTRD0^l!_`bJ2K zSYiqn!o)pLBKDN0s&6C89YGxEbd#g2MR$8RtD%sy2_+7I^*uCzpwvs!c` zO$JYEbDdy;ofAtE6fPV(a8Wa4yKIsiqzbpVdj33do8ji|30%T=ye#AnciJB(m`Dyj zyqsEzKrc-1sfd({jT32EL;JcJQl{{{m5HQGfA+iWTh)B0$5KN26Cj z4K~Yl!%;W5=ZTu}g%pkMQjbBni-{#bg4qsQ zvaZ%(uHB`rv09~hncq+A;4+rLL&Kc%V>rMOhxA0_YtzVAo>G6d3@S3h(pGgoD*CE(u zfOZo&uNgdH-$mwJ=dVgWJbISTTR`Ni4VPzuq)I)JfABC#8?TuJ6U*ek&Ud4K1I)BZ z*XX&(Q!SNWwXxKGlfS&jk=P?#dXpBsFHyi;f_jpXu2CzDrkSsi68yr8u(}2`{8ERd z7fCls-45Z|bEJgpDu3F^7I}>`$y2|xSF=5G$ioq>pD$ryoi|8njmy?U5DQm=qpQc> zzr{Dk^U@3dh0jcrT8jMy!F~FC{*ujol|EX7w`|b9YBTDoZ*EZVETTwmvr)g_98S-fN9gfov@TRaT4CWZMY4e z?;cnDm`k)t)~}p+X^oWAy;dsP3x`fIu2z|NPn4b0Yvi4Y8N(~zW@}U<3gjS^GJS?e zHUA>LHW{5UA62VDe)>H1qVRt7HEDQMzZUh2F2yfW_>RXe0 z=aICGEB*Xm9@g;ujNw}QRA)ZXkZ5hyV8`+yEh@WcE7o4LLKy4SDqbS4S&yTH{fB`3 z3f~32jy%%dtc383T9GJGzbM+^`75#YB8R9@q8RNzx}M)vizW;i3W#KBKnI zyH~SOFVI&~rqJ#%ugTk51V=wE$fW1NV#{Y4NwQv2Xo}BU{0)3cbf4%hVXu27;i*}Z z-0F9Mc~`;5g2_4QG$hpvPIuCBxx8~Ma0(q~oTP`ejpVxRz>)j+T930x%1WNbdA9!3 zr(yZ+Y$Mci{7;Q!+zLr4ryOw*$u7Q&PHyz1{OkjP`!^WIA^^w#C(ND-s@30;klkLg<| zysZJ7R#BWmWE~DnqKakqrCwG#Jn5$1=X?9Opp_DLg3gtz+STYX zW+YyvNUCPepa!1OkK!ao)B3yN2nXlcBaJ5!In{?R!lT6z5SIJTGNR)sQ+}Vg#2Df` znZNm}!d|hrm>%Qp_#5<-dJ?2EQZ=jgT6sM;pbD9@qRi*`bGV_1mwF8(=QpQ0L7pqZ zN$9C*dk1IicZ?S6!*PjJDNQ{^pOc2O1XtpNOYN zw#RJRt9qnv_U5%YY6ZWH0^w$Xl<%eJPPH04mt{_q!i+GN<5oCIIFS^3hMzil0a-N3 z&x(AVpH6v(zi;s4B9bl7lhWv4=Vw%qR{U&W%^*UZJ@G0(q4YWSW|gOQQR+nhg+Zx3 zJ*)aPh0GY8XBPz_Yx%@HpHi4o-LtGiMkmzrRNlsoAYr!PoV_5GCj1B!a_>Y3ml#Km zK~cJE?MXI<&pcSK@X7+?iOx;|r?|_Vya$}+7yn|tL+wpg;`opmC0Qc+N;Kt^-s@=H zG+Cp)l;o20m!M2kFWe-4cG;g{clf;T&!cXT9HXW17fyHQr=UKWG8)N^yeTt;gpnf5 zy{*D@?>Me&q|a8M4mV}$z+EgCjzyui|HperIAd6G$6n5fS|%PS)`fjtIcUz6KVP`T z$PMYEeMQ*A{$3cM%GVFk?(3}n1eA3i=l>Gxo;A)mWIQ4|`zl7=F<=mX9AYi5$G!X( zrLqeSv73j$-T*(u9Ckg!-!Jj^G=GOf7?A;H4(b6JOPlbM_S0RpbC`+Ur59);!(E&$ z*(g32MxEPnlX}{pqs@xp=|1hB>KH9t-bk+6tJwxzGdw<{FJ+(dk2NjUwchC6y3_t6p6$eCgq)u-G%M3M4p-hKFKdm+qc;%a&R@f_{!a(F{c4xc1%7)z-s`pV5ImRw~tpf9vpgqGlh!}IiArcTzF^wV4LLNnSj z4RUAG_y?pxrK?=8&9I{vp^AA%xo*5I{UhpZP~PM}=6k|jy0@6iq0C?#ae2uK4k~2G zg;)0F7x}N~q0ruO z*_{>D!E|z1`;0WR6BHM~vT*3Q(@({1TgmiJV|0h2`;2gQrxC;>Z?lgcrdusAm}eSJ{GR8 z{N=`c0BA4mG_vDdR*L9vsgG{!gM$ayh2(kl>AmA>=indri>3`O4N}2{#+6+4h?GLy4>0oVPI#PVoHnC+j77XB%=Xw2e<6>&Pyg3;fr_NoaLGb)FI<$S*sCH^!ijwG{yQIDl3loSe?^aEKg#N|XzFLrGvfUZWJKXfH-^KS zL$Jxh?milnb}6)cq1V2Xysy$X*(JGFD_Cp8Z(^z9>+SW==ZP1|yH=Uf^H{8T&QmAx zr{7e~qj`<=avEa>I!fu|M5FTb%UN2wJPfPX^YQao{LI@Q$)vS5Dhkto1%}%5*rAYD5kxEpo`yFK1~5 zkDmctk%NC8i=S$*@)!B^@kJIXEwV`IoGiq+63s2@-e5iMhIO~omKWQlu|-mupd^`61 z=%#PL{j+DlkX#Q@w@!wWQqW1OFn^t=PDKf*a~3KkP;`eRw!6-aCloN1J1o~*3Xp4r z88o_;l)F;emEy5Ocqzf6QFUz5J-;xS8wbneq^1ZCTIjn7shoVRsXJgEo)xX7y0qS0 z$#u^chJ9UO>;&uZgVI>C-_Q2bNT#|D%Ar%}LgOVIc46i-Uj?FWs#1tSSjvM+mr*O) zSr7R4m;whAeiH265VJ%3x34gK%JH8c#1$2D3oH@>`&5Eh2NEiADiyscY@#)VwrHss zyq9w*13)1tUujajI(XE&G*iCco|EEDVSJxUL0+dlwf0`Z389&NqJR{F&>c8YmZ*^z zn5osyxDp4xz0;%xX$v8r))V%L^HQHMTO6V2!ummkIA4cl#Za`HIT}~zqnurfaPR#ZzbbbPRXnMF;#qIU&a<4+bvK zQ?%j79bx+8s8e(y15cL{w2PvhUaAVy2@ArRk1fvk@h9!5Lb6v_Q+-Zp!lI}4 zC*@?xiPo-b5B(_UmpPOTJG!`Owc<+cUEcuBj*xC2g{$z}SG;2=QCLg7ElO0-S2S7e zH`phvL_{LoRg$qx~;ilaDS1ueydX2N7_YDg-f~C6+X2tzj>XH=?50F z;axJglPR4c9jRlSMcajThQ07rVL>!=l3BJN4*Y)_d#1RbAFp$Suf9Bf{x3R)j(~I| zA{p6-gLb6(Jj^ERK~QBhen@&G$9kfI?)?vk`?X3oyza$Gy2vID|3RX_-u)D9BwATR zKiptVe(=*x&*`d`LUrl-m1gR_wBeA7&r%>s^f9ox)BJytc|~P{PPFA$Mf%SgzA{a_ z6v7ml#PyxLxeL*q_oR(XN}kl}8{>#LC9^(%MDMz2oO0q28IotS%&oQ#6um z0ZAvx0oR`W#@jZ^Wm#8AbGU8fKH7$jwQ8`sWst7d^&2-G;w{rYzxom`OWNk4I(ZGn zdY2}NVl?~5&9M#k1Ko!x(JI)o@7dngZ^?XT@dsGOIh+r z{?2r_BT-y}52Fp2y3itJ<`$8WOfM%DZJnIW$?z2b+vGF9x7Muyx)G6I3-3=tPL9R< zp;Bn~TV%h@mFSSV)c7)^BycA&UXx*7B%385mk3jtyBrH2v#FT;`=_^&eHcr9ybgu* zjb5`##%(fNSE6!|yR?kh5$Q^`bvvnkr&F7ruS5*&=9>0LYZv6gjR$iiZVqx+q8sD9 zcpujkUg-`k%+OO9@^DDHF0Z?JeHHVzag#$3j`U+oVSdqeLQuMjo{Be!!j7j2xf<@K z**?nVdJ?eRE%On21;2!Mj@5pOJn!2*W_Y{*Tq@Om{N>gAeP`VIJNK*7)=MU*<+!yc zo6PMJU7r&R=kH78UXPQUlaW6~ejW~2dubJ+$Yt|#mmGw^N3P&^%(2{X;0pTx0{wKrkh^wzo@?y2vC&nG7t)PXVP%xI|_}>(K2% zS$BRZHqA+-V5VQs-nAw_IbD6zI$Rv--LjCq-8S8`#`JcMEN|?}Zfde1GlOfYnnW^B#%c?r_|YQWA{S8}+E^YmfbiTqs& z#d}3*JKzSoD6EJ=RJFV%PYS{Wr@G>-LxGi zQMTIH^_@MFrOMX3mDej<-?s912Wd9;xc7aR<^v?hY4XVAE~a{i)Y#T{xQ018__R%^ z=RHe*i_#K*u6!gEv)Vy;4u^iM(N@o@9!oz%A+(|8XDE~ zKhWbJmWGB)LnFI~CdMX(kx^gi`=m$8dW-<`(`xzQ;ADvrMuedE!N3ny_?t8-sSjnN z!)ic+9?vOV+4`+E$NCT1wi$79++6Ve^ zdH2(50d^1V9va*F7qpnD%&NsV7`QU4{Z{eQR!p;RkfcCU|3vfsksklE9{;-@|5}ef z)Z=G*{Exu=MKD+SqD}o1$HGrE{;D2t>oKRt>uS*XLwo*=W?+=YJvySM_*X zk2yVFR}DS%)MQ&90dZ*pi0OQJI1E(IRJMMqRa|mf{HYD~Q`KCc28;}pg$9uRzX0d! zLckxFh2YmosCt({{U_G%Pj-jh5CHT19CCPTcS+f(#w=NRz0BMq?ssg{%j){B9)IqL`E$}8aRM~!A8~(|w2YCQ``l6P%xZILex1r4!M#ZH&!>A8;7h#2LtfM)`z5z2$KIun{ikZ zjaH5fvm8Dk*g!3aKCH(P(dr=obq0m9@9u`*!fucgb`M6R{0522)^AXu$p=Qs(hv{^ z_!tfh?pXwo1N_^-Ru;={eRp(pFMMVRA*yTxl@SDGjUfz;M2>jJ5YgE;)){mB-Lu`> zx;Fu(gTt@bbI@q&z>p|=>#lutj?uo1EZVF6igKwkIRx4djCGy>moBQtR5VyD8J*m% zMybI*Wd~EvNb!J>^@`2RGmLd61REbh-77R939?@Sb(Dee_YK(-<64wfEgI72#CSQB z0Ojt)I5-^LrM4gVIzP~oVy45&Si=V{C_i8upk$EtdO6+TeMFvE^0@g@l;T@K4|0F^ z7v{`LlN}(dr#lYch6%+oiHI2;z4f8p4n+2(bpYw^ByRs}Fhz!I>oZ`!?P^d)}1{Kcu9d zvQQ8iWfS!G?0Hwu4hBi3b6AgOUCtjSg^(l=LKYR zlE}23ctkQj!Tr?Mi3C70LIc zbU+`A&>Wy~pky|Y>`vNk{r75&t^%!eec3imw&g&{@cxkxgXP7By=i4y&#=LN&q^7i3i8!*WlylP{|0E^ z=5J2$XflX9j(V?hITqecR>sz!8r5B<-4NtAE>U1qSh?)m^dZ1cl$qf}j1^vb8k!gp znT+7tjT}?BS3eP=19W|1PCa~$z!O6eJ2W(bV~5!|F(Gri^Ba;H6Xp;wghu~$ zda!U%^&S~dsSH$4sIWY_i;rI~%UnK420FSoI=V+vMNBvG)XIu4; zM*fF?{_p+n8(;XJ{?0%6FQ3@|&%XD{zx>blt*rg4kAC-W{+m<(?ti@&{+nHMyQ;tT zum7{vi$D7hpZ~Mc>DSJmnz*}n@!)$S z|HVt6`_#WW^2YzM>tFuvKl;{-KR)=>KhPfGdxc%2{M$7=P~vZNaF~s~YtMW3{1&C= zL?0wkwxV|s(R4u^j&;5biSJ>gvCenw`Go4^bq@^e8yz0ngS^_aj|VLu88*$N^mj^+ z4nqj+zG5BxuSiSh`+KYfuF1P4@Hp0a-^bqvQ|;Slfa29l;f#tB<(Z6rVt9l`Hpn|9 z=u`Io2P&Npq3>hbmi=M>@L(!XP(#rU^ny8(L|TYe07+@DroSseako4?4Bb=4C#vC{ z((YljlEO2t*1Z$y5|RLF9_##2d}mmISq~X89Av<;&TldHk1Asb4zUjF*5nxwP!{q8 zb|?ei?>N911)to*XjZZxSr8`nhXcdI6XR(OVhL6;UiM~$dG?1Vhlf+Oi#lYQEfq=X zQtF=O04aFKlL1%n_vlr&Pm0i6nrfi5Km4sU($>AyA$`(NgO^e-M)VkyMyzyxWFzX6 zssDNx&IOFM5KxduxeQ9n5ESHB+5=)y_CFcxxK8c-6tWr?5$&Ntc|@c+0)iEOpk@~} zyUKfqhet<7R7CK}kpIV!BpP3tO6N}u)&!%od7F-Y*S?f%0PjUaB1P-Txh;Q6mFk_uNK}cW%o= z2P$_Clt#;Jhkrt6P~d=s$o}xy{sESRfg?$=^<$8U!88kaiaf!5-`ERh%<|uKsWL{f z;!jNVMd1u{OCbCNY8*h^@_1X1IXzz23JD15`7^P{=-8cuqknC9q;h9MDJBvfvy}15 zm{GdzWVvMK1{6WRy{Wx@hfS3b?o5TBLpMjXYr{7v=ip|`a)#_faED0^Px{pSXg_S#(6?}j!DaTlVNELw?5V?+*NR`G}YGnxs ztj%3a#$B)?vOtuC00j@DG)6%3m@r}kVk@E#u-wJ=WeBsrOt7Ft*{^X(6|Fz6&FLIq zD?TjSMuRsMluCerU8Tnn=EfQybd>!DO9nZ%@ZSa+0rPEJ(w(;%5`2jj?rhrlqrf{P z>P8(yX_CSaMP)2yBHdvX+2EZ6dufh?W9364)2+Mvhj+U`=o}MUo16isEbV)-wGFvf zi-#mVVXf}mRVx&m`zw_@cgNuXHkDSg8n^C_iiZelX%t)TT@^qeP{*jmT^VU5 z{mCw|imjjXcaJi)Dr2aR!YP+UX3~14N6M3fh)TE=Q>Zj{=iB_hAMv#B5fXd$O8C(i zNk-dUBD!6M=nqVje&Blv1)vj$%ZM;(T>WntdsJ)upbVXVpg-sW__bZTVf6{5+(2bQ z!f2xMj0EAhSgLbq6p?@D`)nprTuJ-=!$ZOm8>8&Nj;Yi4}U`LD7#qc z?5>;~1#Jh>wUxu;ARhaCw9H~qyOn84&&zVykb+vyoe5TtY!&-TftQB%fLj*ykwSKoe-++x>sI(QR_q+s z+B?tgVY$e#gv^x?z#Bw9N$gh-HMNcq#~og zG6uS_K3Lc@td3TkI5)O=Tm((JGlxUb)v>M&_Dt5yy z7&N~hT*E=ez3+^d9)pSmEX$DFQ7(zV4e8_1?clgjPa{@;*Z!AdEA-GvENlu5v232m zzR}9QeZxbg$|c-noaBpWKZW$l$Dw9*p%Pz?gv83O_IE(8HpNw*A)-TBEAsC=yY zfv`~8$M2ChZ>Ar$3`PZanH1p<>kt;gx0eVAoPQw#MoK6W#luAr5=xw08NXS{oj*o= z3{+l`YgMk?ant1^YxN2|L*rMZ0|u?+1uPd-hwy|jM-*w7-ZkocM=3|jhn3E6OKghn zSrgnbAu1HxSGN9ORJFM(Kp9AKQ)aS)X}}YpkGs}#iWWQlTMf0V{P^%*37Bq4CazWy z9->G`yT+gKcjx$DAKs&!862HCC6RCt#c?AFA_^=AZ+hB{Vp;KLA!I1|6A*G`I$E)v zv+OxlmBU8P(42;tD?^j|WE5)G#rU|VM!g;M#lZujQH2@&X`Ke;5s&@q0poiVdXO}r z{{qQcAC^uxwq6XWB0w8**-TvWGrbH);=0CJg!<|GPYl!1~ z*Tx>y5Z{%w8nX5bXU5zIXeq=vdua<1$~qsEkbMa8&fq9i1f>F+a?sI%;gKTYL58#_ zJ)YdO&RN?FV+EN(oyk$QN2haW)gPfg*dIx1EDLg=_;r@(^nXA^^{QK(+VNL`4@tr{ z4Vnog@u2c(G8kvPk2_`RO$jM!F;D0HPvUB@F^vDK+FKIPj0BFf0syGeij8D3-w~zv zh!OK4UMnBPUjl(56Sx@KBZ`;E-xzS~$B+a_ey0NGq5LMsiBB7~V=-y>MEIrB)58^m z`G8e5Nq7W<3j!k#)SG9ymF)pjZ<6c z;=0q7S#uv&>Up0>;Ea0ZwpZ`>0m$bKv{|nkj$APQJmK)?m0v|q0!|0>P&m{)t3Hru zc{TEyiZ}D(%~-67H!E*@1*%S&LXVnP#P!!83t2DOQq{Xwsd}R)hA}cfRKB;F#vQB> z{xSdu710Vj`S&u5kaDeBYfR2eO)lJQJ~KJpsNJg7C#R<--)Qn%ejDxPjeg@j$Gp!SoxE_Z-l(rn z&a|ra6`G;oCok#;CEJsHoxOg52e{&!lv{g*j+mqEvei+ApT5__vJXu)mV*_FD z(Ww`wj!qppdh|H&ahC@|S(pmHAha!%{@R=TxYW7AuOjgi1^jBoz@L6WaYO$%`U>gE zlxBD2GH+U2J3eQ>I&Rc%x^?eFH)!?m)7EQ&THP6L zQ(xu4$S-|cgYaMP{&$=s4*-+D0jPI1wvY6$t&P3~!2dhO(G)n~>+$x`S69mQwy?h| zlFm~!e(`W#XXXfS-pw!3C(Y6S8io2!^7nFhq|o*aR;MGc9R8!+dwr2Ved-$sj)vpp zL-=BNlzzg*hV@wkwg%Ano5_K4-5vHfcKsfx-iC|6szCp54SYcVGxXJ)T@72|ItOfe zXMKgEINsjvQ#Ki%rt~n7`?oF}<)Xh*f^3o+y`s=!G`$6)H|+I}uXb!I>;sR&V)q>P z8}B*rJ{i6gSEHNUZ!*Rt>#K1PsCRc-JoV<1zW&j_U{x<32nMxVpjFfAr)_?{BUq<= z+G^jR&fnV6`$M`x`=IbW7uWlot@nZ*S!%WVQc-;iy+m~Q z+GV}muteKHtH05;7f#JO7S)@NTB+aN&1p@yx6}Q0e+8r1I^A#2+fUhwMVqf0-JEAs zL8=?-+WkbU%IQUzo$2QpU3X=Ng-3tgWTQZRMZO5(3r6GJZF?#G{&X(>=)HwLiA3n; zl>7B(DG&cW#K1!gJjB353_QfZLkv8`z(Wi?#K2!o4B&G=!pbLK`K!77hpT>wfrl7) kh=GR~c!+_A7frl7)h=GR~c!+_&3K;l*0m(a=X8-^I diff --git a/Tools/NUnit/lib/nunit.core.interfaces.dll b/Tools/NUnit/lib/nunit.core.interfaces.dll deleted file mode 100644 index a966ad52179e4ac5e150d864da493cbfe4700462..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 61440 zcmeFad3>Bz^*?@|XJ(#RvNV&V*_yVKra(%X(4-4(X`yYBwkheFQd$<?MOj1zER~&t2q={gsDSuE0Ywo-_`T1$_j%^Y0_yMkef|FV zHIOs+oO|xM=bn4+x$C4$Pq~nW#mtXd-Gcd^E1? zycJGuuaH@hWrT;g2rY1bLckZh7*TCHz9S9%uI~aMPuePaBCUU7L>p?8 zspKZ$qT4G-Fwa5!dVc1?AhpSOrwvA>tFi&N$@?>pXn_|$oIY%U!xlJffx{L!Y=OfT zIBbE#7C3By!xlJffx{N~|BnSO=6yAOcyDSFHozOPC+;B%3pE2)#E1qm=qIL{T5ha9 zW`9BL<-hsX&1e3zA#3KSBkC&t`q!c_Jo;L6Am^uFTb!DF^S;e<+fH3`_S;Jy{_3Gs zM-~36(|GKOe;xeZSr-JK*z)X~%L-0hyr(tmI}cTLmEQlYz(22g@P{?c`L)(J8&pq@08*eDdyYHMo#m}|pKN@@NmrEX9dCDJ(3#Rz#DrkotaFljo zH|#I`$SC^A$O+f%rm9gyk%(nu4;?9)nrGQjBjbbo0P`>fe=qwl`-w0mF zpH&6O?=OU;e4}bIk#(dJpi1W(ePfZ8szt^CS4Y)F-uzUJn<3g{S5xTdjb_zo2!(K8 zKMd_R{ry1vbo4UQ=da=t$O`nMcF>3lrl>OrliOtWafwJZSw}l`oZm2=MGT_jOoZty zM$=6~1GtwRIVH8_N?>tqfl5ryQlF(C8L)_3u5xg>T{#e1J4&(c$_0{PhrTAk(%yQ| z10rgqyy8#EEBTZ>X!waT$9zg&xi=5}=GC)!>NsUc@rtskc^WH1ccBf{Mv zUne^%3^f$<&Kkm->oH6*J0N?m%_U2wW|>uWkO!YYZH@z?Jj(W zk%s@r^?1rGEF0jE5gUNL1~^_IuK5tx9tF-nNd)Yk0eF=^c?73ooSM(63Ql!#Y67SB zathJNpZo@=CUWXWoI){w@^MZb$*H$F1*`j$K?5oHjz3w-sY#rw;S^NxC+Bjinp4X; zh4|=CCOCyK>`(6I6k>!wc{!&rYW>NtacT;uZs!!-74>qe9x2F#uLfujJ~_^MBK<04 z`)xQ3B8i^^qE!}~z;>b5kieg6{AWDrv!T!}EgJ&#^U5BHr zC}wZ-a_}s2I)wF~1a`ta5uh8O4`vm_ebaYDmdFYA&w^}+ zU9h%Z8x(}2;n~+BgOYEcAB(Cmqhpz%77kg#8eeg>QI=gb4ph-4M2*gmILgA=idLXqF&NRRV6f253luJ34uOusZHzdT4 z#!Ae_AdM6Rqd`aOdMS29AG>Gr7hpqH(HCJd!^S9%q`8$<7{!q)4B&|JV%1>Aj)UGI>B|*vUuK7DDkv3)ei5r`6Z^bX)g~V{LO^7IIcXQetZE7#?aB$W9IC=t zuy`z#^H?ygs#Ae;o7m_5#aS;G4)OLEiy%hHQERk_j4>GkI#w#WPtn=wN22q%c4I3X z%UP2!eHS8xzY1Y1A{^XyB{NIOWGm{jetI5du?&q;QAEmRnZ;k6!A=98DjHvNZ8TuR zdXa1lSnY-IrkXi)5TnqnLR%uCqN|H}og2BCNs&3o+t-b z?)Nm>m?LeEm^NB(d4ejI@N0BG7Wj(_0@cSw{n5bHSwYk0zMMQZm?>dpk{_AqWwitF zQ!s)-SG<-@7WH#rgV1~77rb;YnBt@Ds6SWguR>kyAMm(Oj`DnM5C zGGuVK3oW9UP(+o=O}+`sTH@zf)s-WPNd8e+rinDiXD@>eqm&L1jsobe5qd@HJlRgk*N2=$V!{;c72qoWzxg*u%Jff05ANA{CTSP`xr|f6d zZdMwKSubo>Z9u`inSwZ2=4khcjoI63~nBid6M%Dte6UGq+dorT19&N|AP#T)>*ECNa`m3dc35(cw^R`NCG<;hXzMKfs6MH-9gC;$1(w zLMr^9AY>9}4A;cF#B_z6KC%#A!XZuv=;!zx{YgGITV9%|l}{XkGH%D+I-AdMIR0e3 zZin`|pbTaEcx5Q@0l25`R|?tKj$*M)IQv zVsA&@V3l~gGft3(+^fKBQv4F$oi^jxkj`VUy&&Y_0{!om^~sC=H<8 z3_tbkX?=u{OU2v=n)3yxY)#0lLh!PxM|*Qb2I96pSy5{Z;7UeSBdV~Q0Nk}oZAQ1v zkXAF^tlEOl5*#NH=(qn(jox!S z(b`po#$cUr1~e%V+v^5A#`^kk!e;MA3c&&Pz?8EXlLr%Q7$lNiJvwABMk0-nXhtkw zvE9YRLN>NU5pciya&f3Ph%U+rLjnlFu)PFXbchF@fzC3imMT|rm#O~C#%F0p58Zca z4TjTVF{=%&4v6hVmpPsmamc0T9juH^bumI*ItE+p~5V`P6s$`na zw6VqE#WbwJi&9>+;*cBp+&{r^;`1-N_MKrhIscAAx>sV*O^WzaKH% z&r9EFacsxZ7Gyc>%2w`XuT zS;R(DBK-)V4wDekj!6HOAw(z_=|{xpxa+iA`qu1Yy$9LDr|iKE8AL~avz@qQE*eOj z+)KKw_b#Nj82(iFkx#P3uQ8_d-0rilhmX|c5Kyz|2`XLz&v}D zkIzi3$>YJ!2_+@h!B`X|INJxzOD63_olqHLiBD#%$vCNl%jy+BIC)TEzqJ|pOqXdX zr+RW&O-mMYRD2 zhGuUeOi6ejo4OTJ2NG;ujBYF=)mjL97(LIZ_N&Q81q!y$C+9=TO%QqXHg|~a+6w7M z6t5lN&;Bz2hywxFC4oRuRQy5Ep=#;dstw4GSgCJ9Smq3AD)J|bO?yk&KvrSZ9m*_d zF>ZobmL(7Yt~z4+cz33QBl|V`z4Gg`nU%Ls&Nfs0p7XP$ew7cm^W>Wxi}ZOwVHE}d zhhoIhh)-b=uF>WimFH#JB)$Y~z5`|DpmWH)B5}&BiaSMXW54$iiN%iQHBOa5R0F+C znST3wp}U^RwsF!mrVY=x?B@Z}=wGwHlXGSNYxUbI&Hmiqqtcint^PArx`NYbm1ckK zPpLHQZ1rPp#Bwl=SpA6mm~CT7!qL$Be6x@BQ6w9~JOYodbh9_(kZBo+{j90Zu`%ee z1UphK!ESEkb%WW*4Ee;%|(2TRmhEBa(k zGr{{39bIq2VeW#q&?pnvVO);K++{kZ4LX11E*Oc<-7ylKyL%)$cd^hVt}=FXCg#Iw zSO<2G3=d--9yLDt*ljXAjCpwU+`)!$bqJ!h<5<3D4djXC>_dZiV_KY90z*4%JtivWk|MHa_$taA!}5K6Ud>?@hmYB2)dN7XXR@c5QVFPeddVc` z^TpZK9YvAMA`1Dd!E65%>z!~*zi8sF^GpT50CE4or8E7 z8_sjqARfkq$4_fvEyPXs8`hvuf}9GB_k*W;<_G7GJbv+>?G(5vHacB|@ zt#fj|1#Yz^M94aDg3~~f-E+WabYLsPSit@3lr%|b7@%rKa zbROk~{U`INv!>zo*dFMO^+OcX@b^$03t(B7Df@I{mRgF2^q-A(Am>PM=oQ(dK`SyV z^&+xxw!lL^Xd@CujtrXpeO%04jy?IQ%P|CfH9s9g$8J{ZuuJ$Z`7Y7QqlekY+W6I+ z%4^n-|v&MtgtSw6y~@2uyUej)nSOd1xCS!SVnIW^i};0)yfj};{Gpl$v!D$BYs5Cb+Tr<7Ijbme^WOcc@gAf zRZkD9K#s^`L~z5&N?06I29_t}_j;471T*pcb$XNiwk9@5Ma z_(GN(KDo>spO|;nh`jpf*K@DUyt7B<%O=E@|%v%GwQQ_qSK6TF-v645! z?bM-aj+MOKLHLN1kAR*svGP_w{a3?EaI~-Shr2`QzlKqt{bLNTehd-Bf(528#SyXU zeF;E{@O>}AjXQIc?pLDRpuU@{=vQUvChu4Dp1Y6v%WB7(k{DB4s1oJ1cm&B=80MMn zx71aHvf3Y5U;78p#(o??YE^M?M4l%H^YHp|oYIZuxIQy#h;H7uibL`~>5U^R?s?;= z_Lg3q@5`v-+V6O!3-^rZB0kQT$H%n{?wdh2*7UD9bScZ2r|cLdpSwIGpE2R_z9;Pa zDyaOPkU#CS;9x}`neO?8a|RSs@|Z{D)stCPSXhN`{oQi~l}VO3Nz*6?nu z4vWsy_tBBwA?H5TP`X;pyx+()-K{g&%jFP<2J-!ZqADz3`;z0?d?%*z8diC+vFPy%tM-3v#_Xb3Zkru-_!MP zy~de#B7X5$z&217jBT6ziHDqASe`Hzqmo=Rc|?$U3d@xG)zvB=W>A*EeR~e8iaU<6 zKHEYPtkUdio=o{&I%a8_$NHys!6=BBTOm-cej@TP!4#9(1IRqmw9mmu7B9Y~Uu|st zB1c-u-6#^|+agsY=qVCZMTnnSK__h7erkzay=8+AChc%^FssHx$JFN_36C&TWi3N0 zyAhS?igle>szx-$t5#5isf^)je8Z#07@T#LKnIB#*q^d{L|(?yDESRk7I_&amo+Hn z95kQ*Cxgcq`j#+hdCte}b5XSaI`p~k;B<7ZT-F!a=dnQRqJ$cSSlb+f)!Nl*=D_)Q z-(BGEzn&c>*oT?K-+zNjBaZv~Zv?<*k+YQzQ9K(FgIlc%^)ZX;b6z%Kk;epl+{8sa z@lM*OM2!?Hxz<7S1!{;B%7U&Vb3TUxC6zC2krzMGk`JcA0HmTES@>X z#Tn}bU`Lh3{cLxy-O5zE?gcs1F2+3VYEnG+IXupsuu#!|n4x>$zx(<*!|b~s&F^^uluYNp;hq2*2KN-Zs*l?Z)2JtZF;W)$pHY<0) z$sF#J-5i-yocm;#I^;fCVk-K=Ip_NsM7q+Pb3P`TeGJ9?m$+-*qJH*lbR4^~UYYc> z!rps`VqxMjG6r+Vr6%#a3Ctne(QOgS+%*aORXc(7B5RC&I#M{W;fFPv96<=RHwf8Y zj}PcqkR8pgDa2JN<8n=FZ)Aq*Vw8ld>ymX`QZhhBi13ozncv(s(V=F^>t2?dgVP60 zuMvB*VmZ=b$u@T#;iPjylS3idvea1ojsXiiQ7UAG?G7%78jo_A<=L~nRg-Zp>Q$sm z)dKq{s=jCvX}MO^FO}G~E;sy4@)rr2_9epLFO+k}HR^Vs zW0<CY zxxGaZS@mXl+l@PkSS-6hn{T`15+&|Q02a_+ki_l<5#g)&p@tr#hVY?4b zs&6gu*pxkq3x}eXGd@&A(udN@KE<@8O^%FdjpGE`10EMIQGGib`t$rW0*h~Qo_82=RE(u4 zU)Z0nONdY9R9EWbVUFT>s~tnvTK45iRW5;x`fB%J_~)N`Fg*00egf6CD&OL9eG+t9 z$~vii4VY^PUyI>RgfE4y@ssT=+A){vPEdBl&1+HBmw28**YCpN*i)WHVTJG{qkf@^FF7`0 zpMtu~EjE$$6=P_W!?RrRun6H{f1HMTaGvCpU*FH?1ejEY={D1eXM2+)#H2W;aS3T?AEaird zAA3TF(~$>Ja(G92sb(KzZhUZ-0wb|_qO+%rywk?QlvYUp`Lc@ejyD*>cgRGtzJbAg zX?93nm?Lhyin}0_Adc5X(&sEs_j#4>^Ewr~Ip(Oxjm|o8Sm1f;Kk5C<+F(Yb>i-3; zOBNV7YvG@4{BEnSol-k}%CYswG9^HrfOjBWxeIS`XA-@K1%G90I+^I+l46d$(}_OB zs-^OzR?3d6KTlY>=%nUGqdqVSE?~`iC)&Jg~yhV2id{yB40?ioHM+>ZsG5@Kt6Jr*&3*0A^ z8)8?2@*RN>#8{IT1b!^JkqRzlS1|p?3g-N|P+qEF3s@7l?PpI&Oo-4efEFE`!2JIb zSW(I8V=LJjEdnmrRKz`&c~G!98apJ|0*$>U z*kZ;i^5|V)VXRJ;!prldPK(yy+YaXdD>6854Q&=|46st1bMGZ1mPbcO-g>%(&H*+< zumpXLe8A>IgSGgU!q-Ef*q-`69k*BvH5~EYphAIbsB3H>|Zo0j>|eiAils@Q;Yz z+d-c}7Xvyn?Z}&uxn1Dr1YQPc(KV5Jyz%&sz#j{IQs7Gr^L`(hj@-XSW&#GY7?ujW znvO$yV%BlS40_H#9k3>g;p>u~FX@v6#s%5}AClY;1)gp&|DBQ!1vs52uvFkdizyEa z+$Ci%5O|5e>j9m1eJAU9W6i+*0v{0=3NYoMq+b+R5oF3MNIRv9j76aQA&cQV0)K09 z`U9jLp8K;-1m$Cac>zv8BIyv)4o@h1Iq2B}^8^+NEC-xH71^($N2X-A8c~{`eKO!l z*{8v)HX+xbt;jX#Y=NK8o^I69S8^HND)9S&20f7bFyN!PCjvg3`zYWqbDspP%_~L_ zoSioY@X9>qyg84h-J8e$eK7BCq<O$tMD`d$t3V&oemRyDOnt_TS!!?pV&6B&K@LAA11lj_306Jwi6h4pKa|Ct>+yQ8i zxAyZ2S+_4qy~+a08dnx_D{d049uS*J{}rAJbDq}GovkE1wB7H>@(=4(X9FF z0{=96G0OgJG+X1tVy3Gal}!RA`@mmNas?psJKEZjD|~APwt~K9ASLi@ffd0kd=Ag& zPd9d03aUN`iztV%9F$mi}2>bjX zDVGkyuJdvRjttDr$PCm48e~l?dIDRbSG3SNuqeRutkycv3Qj&b;GYA54af^B1XvgH zLN3+^DPb40jWvAMBtHiN7X?n^ds&TrIj~XxHF1{t4KJ2+hJSM=FX!$+r3ZU>5cb?4 z?A5?l59gl(JsylL!7G0LIgs%sOwrpp<)$hs(l<-CJ(d5)C8ht{1Q%n06zXmv2g*;j;a3cgGE!Z|?u zV)q392CTP&3FnnO9Q+r)<$jTi1&q;jlfpue2S*ttbic-43>E@=PGi3dmI8ZAWA6mZ zaDP5=g2)VgB-m<=g+rXzqp>2vF4Wj0!EV*qv4ZW_Sc71%Xl$8aA8PDW!Diy}2W<## z5iG5-lwfygY`0*CG`3f;5O#}P?oz>~Y3y3THfZb{g59dI?+bQFV~+|JIzmbLxnOfN z_CJEPYwRzAU8%8fm@V;y#>NXqM=B{(1)HX^1%h=5wy)$@IHde5UH8wei%iX21c{!E9o)GK`T9LCGC)^EG1v-J!92 za&9pu((g3(B(NiBV2a{=4cL*i0w)zLlX7o2j-s`=|6{B$_ZH)5nmJW4v2Hb8DHxB3 zjWEh}3Jd)%w+z@JjTMi2#;B$kA5!9V^wEON5o~|>_)*NcL*+rrHegS<*z?9@nmb*} zA#Vk~SF={I^XTMJhm2$B6~SH)a|9EW!FnKvqf{OJUFUI>s-wIaEamkuN2xk0*BD2s zdTP`dN2z++BiMm3N2#fFrOx9hHI?2L?7YyXQNO`qhhI)rUJrB3nnsf~#xZLeb!v=b z)^z%sVCRLBqkeBpr`rTO5atLrgB}p<)$lo^_5yoRbMCbMgjL=<8oPGXUx0n6%W-r& zmhy0ZgVu&`9W@TvM8RGUbM!uzI&>aKZz;r_Iroez@?iT%ePA3*XDd#FW27XRGjMR! zN5(9=Ny#*x8x=B-qc;RoqiPNXXL0S^@8iumRO(_!m~&~G!a@u3YRnU;MPp0z>Vc`B z1A*0fW&HX}ehvgq$=m3`*5@4y&UPvHy3vWedDJ7=0ZQi;0o$WwqV^VZ9yRi{4n|{H zv=T31PSaRrw9sgzw8oB$o@_SKg&JEUdADiIj`pG4evS2ultUW3P_XwjcAa3^$Eo_h zC)h-dJu287jlCG%2APXB_C|C!HPHsaUJvsO)I?_scEI2nsEGyQ=RkmGpoMgs>xY58A#FXVF&*rh28BZWHVPv6Ne;$P8 z@nN0xX52iHCJM%p=nS)k8U;H*kLUN8OKFeBp3U#W`Nd5dL zjN`;w`n|?DPOKxEPxv_y=5@$ADirMXFh`AbG+F2IxLrr{bRLiXb+lGv94FQhe?19O zWHhd$#S0iaFLYbMHRdU_L1T9pTnDUEV-FSd(W$gYV^0^v%~R=Ojq!Lmjc(Q0p@MC| z?$X$61(i5edO~A=M&9Z4qQ*W(-e+h|1J}-8@OASuw4sqP)#==L;1ij~$+lIWJMNWOcGS8sNiv^R2 z(n*aPW1Dr-X&QR~GCL`)u_p_+0UOX5M}{uCQe(eDUKib@F^(bKbic;lL0&gKqA}m- zGP3CvjTMZ3)wJm?ja81`O+Dnt^%MI7i*FTQqtbuz4C=J$etFNoy5G zZKGc|&!hntd&^AGZ7%j_vzK0UvA>(!$-hMEL%EO4ois(TebhPn5~Gh2Di32b$9Fbe z>tg4d{q$`YTY58b3G^V!)u$A?*@ecd$@SO z_jMP03NpXxV!wct4E8^Q-6U<`xO5FTSFB`awet8Db!d$J>{~S8N)0ayzi+G{!!78@;8mg>R>6tGM<9#8LR$oW#$8z@;S* z_*^XKnv&i09hJqF2>i^K!MdkEzocd=(n*ZZHOPU#~x$30Ce1yk#ur(MpEOFR5e zQ`*D%44tpA5U)y}q3blptCDBvHjRC^Y{364?HBCzFrR!qONVscBW33zFVxDFoELh& zEQ-J178C6CFrR$=oM!60x5}>Z{hS(g9-o6fN2lpLbIdki9U3biQ%S#|0gX*T-Y@7v zjWr_gdAdnstC06R-67cPVLpX>fgaI$8^(NKyg-L^9-qm*NbhNkN6w2>zFKL`>$4YW ztzf+7tE692kIv&c?w547&f_z=U(sbcZ|j&>&0o=VI*(82UZQ(+-ge}@MEi9fuj>xc zA)UwTxf?Yv-#$4cknL5^TxqWo$ zm`nWsLk}xV_RO!+OM8@447U`YlDUlthmq?^^$FsYYS++?bpEzoU5y3%xkz zoBr3RQ?LWXtNYjJcN*iB|Lb(xDJ(^u7ra6KQyrNb=?yA(v2DQGUF-+`-_z9!qqoq1 zZ_;gosolgMXx?cVng2^S33gtHt@OWizrvvPMqtmn*a~2ORT$c^g5ILg=}HRg`A0fm zFmCNl{y)*>F7|-`ZMsKcp`!9K+?O8ISY`RE=DT!AV^hk1=KnLjCz#Un&ou2bT*H3i z-O^v^Ey0u}-lKx`oToYU=|?i;=H3gsDRiIk_;KsToI~jj zg=P9Q57*^L&ZM1OHNF^{n%_GrGr0y8i=IQh&PU@x_tRv_&3NNry6OwB&6WR5mr}C@ zdV8v%g!NZenkTs#Xwnjw;-ppCHA2rolQsw?0che5m@TF>QE5dVhp!P^@!K&lr>siA9j3Fd82}g-xMB(@GeO! zoxRdNy_T)ISFth)fs1u zPX%Tfe2+ED;QOncv}1f9UKo92{LVnL@JAtSBkiPvpsxhwxqG9t z!S4nb-Wym+4Y9`qb&&RKV5iX&dm(U+(H}bmcz*1+fqlj;vEK)-GVYCCVyvVmV}A;K z!}v|?{lH%1&DckP?;tmu-j9`7JL%>8uNiv{f5mauN-D2dV1;o)wZz(M{2_l8a=CST zjoON})}6-8iqk=#SFzEG%6ZUUP%4r8PHYcKEvdKyxi3qp)(Y(6jSUswg3KKiKd~M( z&IRW_&#&RN!#5~@LOA%U5t~p%uNspll;Lka@Tqo!crTNn=@TXf_lcaV1g@mx!LyQ9 zOc)2qXCHfU27gMhPIBKg_Do0z-!zuy_0faI6%)=v`uh_Gg6|r90=>`JKjC5P1LIc{ z&I^8EyfvYcJ}|N?FAN$cpJW>*pG+AhpFxGq6*;#BqjIhrHhB*jHhB%hlplkBRAmv? zuML&^g9+&Wc(B4uf>L3g1$Y&#F)_%!^MODLO)_~kyVtn7@)S^RsO+OUP`EGVRfIy= znLvIUN`*|ee@$qg@uSL1j9F4@pU|%o>+LfRRX%J*%{L)o9q}Hx&iG4ZPiP(SDa?HE zZv?#|HV*01iD!X+s&xJU58{JF1mt0BnCRQSS%EZe;dyU8QpYk30*?gwI6!18W~Vuq(Vzdb3S>oa_BM zD34X#9_I9Sk!H<9`0vN~&8D9M=Fua7h4ds~3HE3qjO`ZyW7utkXr6F33g=?sY!S|b zLVr%^FADvT&|eV=zY__+7YT3C0{r{x?+O3kh5tk0CxdJB8(d?y!TRJGtWTlA`jkj+ zx#Uii+$zbPEV)x8cbepq$z}Z}mkpU*Hrr&$g+eb8db!YJLa!3~WT8(H`ZS?`Md;TF z{U)K`D)ie-*6=Q&-y`(VxeiF zS)qo|;?UC2s?f=y(?T0@58oL|hrST{O6ca$w?cP@#)T`xb>R)+o#EZ#3&Pig?+rf` zek%O)@Jo1R&EF}>!h4Vsy!$A{Se*fD91q`GiFuu~FLC*sj}VZ-my9C?L(r~fF}6%k%IL5#fy&>+o@ubt}j}4V0tvIekJt_fc~`=dKpmE-)qV zT!9zo-+)}zM@naJT}pq|zr%Z9^|JB-rLF3H~w-ZKn!- zuE0eCRqK`)Z$zop#a!cQ0=E>i<|*OXRm?U1PAG2(T77bvHe zu(bA)`&`Knm9U&sN^|}2|I*QbXO}XkDtk?71t`kS*NnLmX*G&(AH!qWJAO~fV##rV z-Z8FfS2h_wu2oN|-uc~_J0M?CPAF$vEiQio6sB{8@?llX|N5wjR1gqB93mx(`2Rt#8z7-r&k3}6}7y$0ggc%;V&9E)gX;1vx1@iE|) zfHC}?KNI*-piclaL7fCR5iySc24D@~k@!2D{BI7{0ajx+;eWGnI^Yz%h%iB&1z3+5 zXd-Ve;558PFu^e&a0X@;{+s1ZfHQF)&;JHuGvI8@HT>^ZEd`u|@4T2Oxf1YrL}Gkf z8u!&E&BHCS2`TFU7hqO0Aq(H^q(($(6B6417h;~`e?K7(xEME@CZs0-mtej#@lAm) zz?HZcG;wo&CSWU~x`}_Uq8IQa{QE^FZn1X)o=km!o2egg3nIP=Ddzxo)8_zfIv4gi z6Zb{2kn+`ZDOd z08P|)72p7778A8z3;0=lGr>gN*Mnydpouze1iX-L2E3GR0lW;~P%t6uTYy*4?SNm# zeFb)%n3YUO{2t)dn3YV(<+rfcVohh_o{8aCabsYjjvoR3fPMmaH}*p&-Gh1E1jobR z{~^BRVA6g3T?gBWFM9HTCAEIXfe~R;Q6EWczfDdD(Wnew^ zOQe4WXy8@;OGrN|@Nt|2;~lENr|5q`e^TJn*nycilm0E>OE{l3aYFnC;Q!!U)ui9x zT+~F~9|3f%90OW-M$;bjUj2uAI7zOAvqJ{y!0;K%{En_s&L8BP- zkidvh3QAaDmN5qDY-227%oqm<8Bq90%BB%mrL%oB+7am=FF_08Kj8XaGFT zXaePQK$AX$_xC2PH=04&AaJ8`A}DPFHyKMoZwE9fZtz?A%>p}&m7r`9m@rzAKEpT( zxmyKx87G6%DX`nX_ch1{#5gieMfyxY6aVJr=}4ylF`A6^fW1Z=;BI3R;9esRc(Jhs zJo^Amy2MBTUS(`G3UD^Ognl|cLRI13Fd6IU9{ekp{sBH+z+dH{5dK0B(KG&;bY&?1PdS@_LIj4j5x5I=L4+U>oa@#Cqxw>y!p-DD@@wTbR@Jh{1TQ#@7M z-q}gbtK+G3Lt84|*p_aiWhXJ;!em=le7l|8N=@71-RYJ@Djn~RCv|QEq)_wxE%EM6 zJE^%fp4^t$1Om%ZaABeoRZxq)WedJ#xVj@5Pj%Rx?XYbetBpB|3YP@zw;=t9rW? z5s7r7D=wmRI-|dvYOp&y76>w zCGf3C`Eb}+MWHOS+f`zDZ@Q;f2~|na3r&K(Q|OI2-j>*1ZHexaQf*sQkri#5wmNCm zS`mr1u+8VUw76Q@4bht-onv=Poz1GG`dAg;f=*1Lzqp%M z*l+^qv@Ow&8iteVso9ma*ye6^Q7JkU2fu6ROiiu5=%)p}iB746?Z$5QNd(AnSTdRo zrQqRa98TPpwv#K82|LLakYX-bSxTBdKaFp>ZtR7xtY~A0hEKM}RoA%M(){jr-M`B9 z*|}>KB}ENw>G&2q>39J5w!>_vb!vH1Ct4F-J)Ln6Pge@6b|yAb>rRZHE^6xT?V{xy z&wv}!nzqhf<+3WXHshbE+C@Cr5}Sy}-G(}9Zm_$0(1MMfaa!7zOm(z%F4(y$zFCWE zZcLypw+r5$BF40radL56s%b|LREoDdzQ<#dvmAQU zj!p3%895_TWeji*cb1DZ##5V;iA=HPE#0teyCb+Wu_=)jL}jdsx1}&NGiqvOhO0MR zt6>yT!mEH&IXG3tgDO>#Bnb;}P+6GhPNX`J&NQ1Fh9M>#oOW5n!<`&K+^mzjJKDP2 zJLBycF=}M+fJ2N;v~?!ViaWvcr0!0;t=+-cm<^q6sg!HYrSWu!-R`2Sgp6_KRO-Xa zQ$vwKt#o>*!A88)F6s3;YG!wnF41nEK=fsqgDlyYkRaNIP{I;*tY%h5n^R&1mDQHy z@aoiy(Zn^g>Kq1ux-Imy&TX0SiK-rLJheGBVQ4!++)+V-HpYA^h2fIk)IrTDMcT%L zZvA>%zIijIl5|@qH6@ey%i<@uCA-ln2>p%mjlElFKBh%yrb5K;aVD)b@nni8kZt<2 zM@?e1sW-_=I7J9^=ne;IZd|`Ku_uTCTwVM#_ltmpy z*rtv$oQ7R^HWjAk)X9nNc6+;H4OS+TF}1$ciwtH3Hno1)>I_3elTNSQh(CSIH8rP} zwryJ8x;DczYq}>rGm~EGlwG!Zs-`YmJW7wR6CRskVRR-9?I@?0o%IY{%`s_nN-Qq~ zwz^JavK?zn1}xp25-YnF7CNk}K4+>=ShYFD7G*e1pyq%Tg%cK(PmlGOcLu1+YEG_W zu^~9DHI#y>nVVHV#kG>)%0g~(Cfs{#x4pfaPR7cSmn1w^)MBT>?oKCp1(qaj=l1Pb z_Nj5iBd-;~klME|Z9BtGI-U(Qfk`8S%FBw3LHS zV|;TPR@aW{bRf&Dj@q_i#my?Xq!dXX>k=tSs?|4bcD4+ztjf)rx#!rbE|SC(`sA&VHI>#Pmi6%YO6V=bzlb(M?h(9b+2SyBcdx$So6`_ z-R;~%uI!X1Ld6m3TIQgqGvqn(B`c%%=r^YG?zYg{Tjm)O>o;TX-+fkW--ZE<5$ zYs0GM6|1rDqvl1+mal4B)il2qNW=WqO^cSVYHn(!G|VhUgO_nYi4)erJl$jF8vrNaz)90XIXurnSTF?QBO|mv=AU-tEYb z%g~G`u{hubl4pg&sArY3Ot#aqr;u$*Emy6VEW)aq!_C#Qf*J4V7xgCEiPLFBRxy>La}pGoFp2eJ+U}tSSUVku zQoK)9yAYfMxQpAC#O64=h>piJU&((3y@edNZ zY@ax! z$QVn=hEz|>OyymP+8ibHE~eeHhn=5Hw(XQ168eu11vvJMuy=38URv$#u%f^!)w5sX zO3;#|_%;&Ve0a3Ex3kmr54MkvDLTnrtNKRM2O)03g^m>V3>V?T2ta4{s+q?v>N0pT zS-BKO$&NIoodbZ?jEQqGMKGLc(dr})5BYS@Sw2uJf-J^ZYaEdY)}f_XQzUR0f<;WX z>`T+~*Ty!&!ZI$~degS!@H!T-IbnAZG+&1YshbCi6yl~0LWaAVgw(nNrrDV$r%rCe85$%z zQU^)oQ7jINLCojH`cycjj*7Xyra>8^fm4PNG>{LKb+@$@?D4q||ws(=c`mIWgnbLAgQr!bB3|bs4TyaGKT9hV)Xb ztgtdwr&&0F=6H;ClN|NCn_Fsg&x0|O!N1x%Ge@s+eID#`OE4Qo)y}2Pjvcq?;{D4Y ze(lkTlp3||i1OGct7F)XwxNg5Y$hx_hG;9X!PS^~mJidKd7KTntGRgZFsd8Jog7Dd zuMCIAwaKzXTE!fLG2K4Sa9XIvs5WxnvJuxT!0N}b9mCyC0x3P){Rle z>je0uoX#d?rlPoeN5EP75)A8ljCwhBrOoP2&`xbj;Q0ae5U7i`)#1;TW{wV0Sk`yj zE0XceII`@)0$v)P#O#D~SB#lXtf%B2(%yK6vy6g2wb$XdUY1jJ0_&+=oolqJd0J!< zHYrm>){fZSAjR89J~e^_9Z)f@^c~b@ z=k!A~R?AIF33r!_M@p&gm#`&k$;|zXm~^$x9ox{-%KN*{1Qx#;2FDK?<2Z7K2!8#4kkbPwL&fysteteibJfp$x*@>EWD}duBbX7~+PP^ArM&T#o8o;?PobPG+ zN!?v--58qf640QEY*%>F&eSS_fNySP!oiG3?j=U8oLl4YL0>3433wpp{7r40OWQVe zB(UsNf6YH-5HMIWQ5@qv<>IY7)@#Cw2GU& zSnlPVhH-e-6mB#ZNkKr1y`9ghdpF|JoHa(}JdB)m=(dDh1c9nrsPdd~D*ZnQVZ+FA zI7+y!2lJH1dGNOQGK4mnGNmfcZB8vxm(k)ZDD6RUYzXmoh+R1@ zUDZjm%Zyo|w?|4y$`g0sKIy6T@F!j}ZBJnT&)4UC;qE>bK~!GV){SF+T(dhjpB@W( ziTu2RZN?tYpUUN(b=5L#(KG9k=I-|R4vcu_Yl(MnLC-56_OPUQaICUz-kLd5GTE?; zyTlYRnGN5v`1TeaPr6rR5zh}rae)`&6Bq;E=F!@wJZyix5J9!MDi3!mb0i6o+3Dg zO}w++p$Y;M;e-Zno+_L0Z{+phW#uNkaKxn&UR>@#8mnO73A~By#y=J@oVFS-9=Q}% z|NHXG@P@OCc}I}r=8YdJXDLcxKZUYexNN~vq|(r=1MfO@-8rj-rx$Pe(`djqi-C0tdGzq55QgE8gWUgiTMz8{Ac}-f4KP%k5!p zS@+H0Jq_iSA#XJ}liEVtMdPhR#m$h1MJni>_-_^HHZTfr!%N{>ybyL$cn7_x6@ACN zan#Pb;7AW;l=mrb8=2YwnXGjjt%mHe{1!M(jnFg&n|7jZ+}UZ(C>p~%<`~}LPQm-z z7+yN#38-%yzW7-~2L3P%OR_<)g9gya7bBX~3JSM$J7jS0o(5?)-uYq~jsMstsuYcF zg-y5O{qcxx9?kx>88VblHsG(IDR0;e{kip&mEoYVF}%nABu-;0d)r35 z&F<0~9i!X9loa}ny;JejLQ~eB@Vz)`=?G=(CFj%1Dh?WtI=~!=*!i3P2LJPAHPi)59{GO zO`tS@ry0Df0hfc1#;iwb5mL*M(%p%iERy_YkwK+S^oT(ckDD`~2gg&2 zo~pg@bbQvq8>!Tx)MyIl)Fa36A;L`Oc+f5WnT8Mah&QGnErwJKboQ%Gq<9Q*4C_YZ zARqn=h3|BH{er!68#uZD@fX6-DvqIaNE-8GYWSj zCG!LR{DW5uCmOnbjPJ4W_{VsOwgTdX5TwLZJBqojJa!vV%XX<#S~j`{qiJZKQR7%9 z2Ax?$p7GeSN^}0+E`KYGEs`W^S`H4@nQg~yS2F;Y?LccgrM28Dwl%l812WkHT$=qM z2`b_5(5ZODdTDQ{j3Lb$@_)w*eJGC+;5?&_dNfFZ`!@@bm9c=jjA2k9y1ojAAf#L?s=>Uk% zVOn&KA21ggA$UszFvbr7ho_j z8So=-KNI}{1{MI=X8ElAx%jNY=S1Y@PqgrD-@NGLAoP#U%AXsK;i*49qgBu%I*V1A z%c&}V2+XX>EUtSlr>aaVY+AYaQ|P7@fY53FpsHmikU99Bhgur_)>sARN*(j^=ZZ1r za_x=KjdM}Kya2)E_(w$mLFcA5`k`BHkj&gDO5xMYpNrB2<1P-84=^{E)oKicL<&^m z8awdYf?u{{biQUN@C{P!P`Hfs?+o-y{I9WAjTu+Q7AK5c&o#+rdUL^E<>f@;873T+y_}J{V1Nv(v0e z8pIv=JzFwZ6MX3d_9)LS2h7c7tC+b=3FU^+u>3%7e!#SHAg^62YiCi@7|eu+=5YC( zFj^L!mYW-$8Dv*MN?c}IevP829Ow=ly5{EBuqx9S%!Ci;1kjX$Jun)~J&+yqYonXd z7~72Pk7NMm8rb8vq63#PxLCBAgrXn_yqHHCXFx1S44DL(w{lMYz=crO%nd=sTx6l8 z$Xki5{FCxmqNzagTVP^F^II$o^!$O_M76t^Y2db83&WggtjS%HbE~9pg}IFKkO-W_ zye;`q4AR#rWSvM~r=+*!BcWKXO-UAyi0FZ%y=`M!H=l8Il3A3E@v zpRJkm+e>e|rL^G3*Ux?ahMXxWDTMWwzF+UWBkl^ecNNvb1vse#48{R;!r^}81@$6GC?>M z;=55^&ZeF({qaYU^e%Tu3kKA?`D3{+I+y`-7M#BvO-4~Ozs_Vho$Zic!k~pg9fL`z zQ@S8%LT5zOTqd-L%@8;ts|iwIbtwH;fv-xnA4vLNoIb}0LHfX7xmA$Z$Q@jQkt-U( zWnd*Ul)r)HZZO5x3|z_n4)=yX=Zc%`JJjDmjN#~Bn{cH_PeGs)O7R^XCTZn;0{B$ z0LTw8Hzr8~kuYfFz^AzhW^@|DRQ@>?kjHL{1S@+^MSe}LiC{7ou4Kad@Hy}t4305y znZS#KX!*c}ra8l)x|34zSh^z~8+NrAb1xubJ^V$U7!C;2{O*m|R?&0nj>I>~5E<}& zQ8P!L;JNQHR-57G?hYLJ@|hBMK@Gsza%d#>4VMK+ag^d8ctLJ{9jx%8G7rzD=S=6} zC8=4QV*5=3HUFGh=+>4D^Rl}qh9!}TS@LT5?9|q&*I<|t(Tx)Y8Bl1m|7F)t6 z!?BZVV>o!*nn-S)9K&gOM_arz)=(Q;z1^N1o8KAV5l_VC*T&Y^xI##$>}?~-n}T|$ z)W=rf^=_gk){tyVYylg(Ft&>CT~aYzHp*jVY!}hV71D}WA{A?krJWm?n7ujXX>1<; zZJzqt8MXDbb@lbLX5g<5;LDwCDZ(FEFyJ9YCnwu_@J`1){KGji-nttD&kC1-uW~w; z!M&-AJ$#Ce_iIVqWGuzOHOY6N;&HjX;M|Xopx8Xcb{HPEz+npBv=H}&{PQFK+aK}KBM#{BS8JTVUc-M2OZ~7&KBx5lGy*Xo zm2bBe${i2h*WgBq@ACL(qMTo>mfIk{mF7Dj_w9yo+~J=H!3K27+!~G`NqDB9-Ri$- zxJiNy@Rz>$-<0PY_%6A%>-OHYBYzq0;kuz$8u!6`*M&m^{1smO{Ulf0Pk40!z8HRI z;x9{Pc==!X=KC`J_5}HS13d%3{8_+Kk!OYq%W5}$nY>AnI0&MzI5 zUg};v4hei`s`&Yyo^Q`mpz51)y3n`_GFw31BGS0kJ!miAwQj+^9`1C-5`$?myfW82l^#*S00Z45blAE<8S`L1pSWb#cYYm)=p4zJ^r?Lr(N*ZR4S{gU+zDwb#l&~9UVqv zK2KUJ$LD@M#$MX!sborz&`aGO=?%5+|KC%kcKbq9VB2UuCj)Yq4)YKCN*;S*9Q(N= ze(i^KocnF^r_PTseK7$OFaZ-V0TVC*6EJ}}5qR=H1|d9Fb1KTUn1BhGfC-p@37CKh Qn1BhGfC-p@2@DCm09u*j=>Px# diff --git a/Tools/NUnit/lib/nunit.uiexception.dll b/Tools/NUnit/lib/nunit.uiexception.dll deleted file mode 100644 index 39b60bf3bc866312a6727cc4d21892a5d3551128..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90112 zcmeFa2bfgF(m&jDCeLh|4YPqw&6`4O!jt}*aQOE@F_NP)wnT{y&ON0!ncD9u-F?{bK;~FY9jf&oojI`om@#TW z=77PO+W0YTZe*mZoX)y)OCj2u%)*~Cy|Yo;X`z&Mn;b$^F$s|= zvFlps@qT!cbcBzQawEp_(^D)*I`F=WCe*9R!wdipJvl}Q{_73CohSyrF;;87|FSysr*be(UbYZjL6pXfgt_(uc(Xy6|W{G)+?H1LlG{?Wic8u&*8|7hSJ z4gCK|1M_KJjXzqOD#9wdzkzk@0wJ7?6{7P~LYPzW%oL(n$Nk;oMyZB#ZhZZH(`L%T zUB|@I+I2fk5t(b-j&DA8>cxMhM-FUzn6X@Rb8x{sX{Wy4 z{Kn30bR>DWv02p>>34ciK1nNm$)o(0gUNpce`+b#6>|A+K1{)hA*{fG3||3muHrvI$I z&Hs|Vr_qQ?APK4~f>JGh0Uev5Txu9RltRL)$)s9p3E)ei4JP1;Z5)pokDQE-Rc?4uS}8RH zC~;h94}rB=dzlKz1S)`*bWI{N5hhrlA~Hm72N4ZX(9VjegeQc6Oz}5ND8p^fv3Onn zL^BobiZMy)%xYOcp}HtyDDv6E^1)~=UbnydZPkfHb!>9Us*xt&9@SAY!I$0B{c8r0{lf@3q!5ZqkFBIY6w|CzPz!913*_OQr`D;Bjp za(Ztl+ELI+f)A;|EE%~fN_HjOFlkPuM3PjNg_Wf>MVdvs2O+nEnyUpTU)?IerR^$h)+1gw?(PSD zlC9-rsJCGE&sK!)VNnVx40M4iw6~xh6%Gzc2|ydRB9u(siG3RF7jpY5g@k5?Ja zDo%hm@{(>Y1$CpCedrsu7*pUm7>x@8uA+WqQ&-?Iw+TF3L|8o18)xyxS-o*KVUBZp z<6Qn`9;e5pRv{y|3y(d+#jY;S?Q!R%2#3ewu`YEYv@G@567%A$9t%Q?V8A9kE?6vjlA;A9Bbl*U!F!|n`Jhpcf9zwkI@e>V#_7^%lF-y84p z$Ci&~qMrH?;x z@O>D>1^QaJueWQFCQ=`a#1NzzL8p;1Y~7ETSXIz+8&(R5Migj+Gism9i#1YRYI~r9B^vXM@H`!E&x7iQ^3eD<2j$S8;%h(^5K5-V6e5u<3Drq5B8h4vMwpAJ zCW@~HOi3DqrHCyeL01RYL18PBjp4(r)`hu)Xc}mOn2HWSdTK^-m=48(f>4QS3j$#l zt)L4ZY>CoZ;ZcEg;t`(f|TbtV7oY@nc6Qs>W4^Uh-ua61{3Byb8uN2lgMja(J{AuwcdrW64+&zMlYJG#KGC3Sh0zccMx*-{m}eLbK}@4iI~x6& zB$$l;ZCO-^+Dr09;2*-PBc$Sj7_+R`U+{|k3to&b!HY0|&kMfrj&d=+1TVt;J+G+0 z;Kle7ya@C6yfDAGqg;$H!HY0|&kJ+EJMv7f1)|$P6b}3jd^g+bx3&5SZ3GB-t z{Jt&18|m*Q9NrriEVeMkwqj}9++kMhU}AwOwM4YAIm`~VK2XSeFY*pn99G|WWY>A+ z2l@dU_zD=cKVq0KCgw#t67wRQcAd+!Hgy0};!p(-oN-(gn|Q+{uBAm42d|qO>G5;mL|43(+Oqs*i`H@*&<}&4z&#cDT2kJ-UUEK+t|SC zJRWfou@SyO5XfWC3r7tGN*#hgV9Np%ES-Y~EZTyFp%vZ z+6;7ZSyON5&6_vb-%u1e(y0!kk|jNez7CdeQDGCe%N|yjkl%4(I(1-o;_SQF=Bn#w)KJC9;f zmMCjLMbcD)JXTj=EC9DXleS7!n668})X>x}VYXVBF9(w`@>nKgXt4y)JzaJcy%KwF z-bH2=9n2MHi?#VCAi}k!{;lwS3eR)QmR`dX^MdO%bUV4vNqELedcwoYpr4Jj^kjUG zGNQ@imc>*wgxJ-rn99#Gma=B_%?rpwe?huWtw)SQ?Gipgp1;#W8!&GEU)i8{Y zFo_xUGh#BLWv)t06AM(7fy!c3*^CAm&Qg-dPnf`5)SxIEQEAU5=9qAwa`2}4e;4SX zEa^{C%;jB0lx8b}>F#j2eWQUZm*NlKj*UB;EtGc~U$6X_5P z?dcE}lMv7d`9XiMzgWX;St%qj&6X&Ox&T5)I_rIitnmGWR_Ad`P^vZXs8J`M9WhBz zm;)-MkTe`+@y#S^t5zEY=`xLiOc*3A(sk$?2Khy(F@_#>3;HXv%|9s~# zqiixu7VXimL48pJv_YudWJzJ&H8R$EBLTA?biYV{A$KpgFsoZ3Pn^wP0e-y*buFj| z)kVN9JABhos>`ld**6)9Zunny3L@P9_nb`g*v2=Yj&AqZv2bLp!(%sg_3gu@5K3Vt z)YX%BSGcFjec5`V_Bfgr%6`}oPgu1_z)iP95i(ORmpMB@$9Su`v57|dyJ7L0ytES^ z@AkXQHr8^;Us-q^<79p4wqa${fHGvqr?aJ5C=Y#x>?-6JEn2&vjhQX#>nJPC4%|Sk zFNtyiwYDTG0`8c-vfNz4xd%b4KMp3N%9fFNvVJ2&&YJb$5UUm3wPiineZ|N)I6_id zdPduQQ-R2jv?TS(b|{7918Bd1dcG^lngbMdEJ9KLbHhZ)&b>}#92(RpcXC^j`XDfZ z+&Q;ewg^%u=G{)O6p}O1Gr?#!pvrpIdTHpOMs66eGbzumQcuncIvJ&qyo{b(FNd{| zobSkUmdZ<#8G7a!K1eAfClt(}-Hk>utC$hl<}`u1`5pp$yFxaMu1j4Jg^rZ-i71!| zH5-!2-8#6OypbWP!suQDoi>yje41n!mZKEs2}%~0i<(<6JdAsCm=Eh|2qWse0NvbK zIfheK3dt*n>N*32!vU&8Tt@*ogmL`2P-1gXUy9uE9HU5)JxM-R?vt=KE*095u!ND1#gB^$}XUt zf!P19d<+jLAFg?O$gYTQav0zSwOC{Cleh!Q;2lJIDoJ_ zjY)!R6^V_NfD(9`M1LkIteh`oi8AeZXh+|c_ZDDMkdc+B9zlUTx;N4>X7wn^Ani&K z?NKKu+m$vxIL6DoX7w0R!XT+$QuHvc!HyJZkTYYb@g<}1&nds+TZ%`#`cXLWF#)7; z?%%D;Rin2N)Ls zsW1f@do7TM_X2|1re#9Nra7UJ62R2Y=G#aWfjc$IMn|MF>V%gaVdz*XY;53pubLn< zgpoH!=B;PYkgvv=PJRSD&AzQD%VqXGi%RFj$uguf;Kirkln4t-lK6P-VYFsK;3c>? z^&JFQhZNQaW0|ZJVt#6&<%dl_*GnjBNU4hN72tB<15GyH>r}U}6F);vxG$fF-eY5%=%FV{yo~A|cH&Q^w-$Z6Lv($7LM~rOQZrKEAVM&NaCQXN1 zedvfTs5AH~lBIS?7Db@_4Zllxy&$@Pk%H0)r7Q1!R*XE-L_3)Edp*dGYC}UV;KI8_ z@JOx1L0jm2jTIc&46a3_0VTeO+7b_{A#~drEQ?6&eRow`SwsexoO2GH^o%1AL2;w3NUDrNT6chH-`AiQNs8!SH@!h5)A7uzqs^Kya_D(W{sBe`)&hvB`s6q9) zf+FBo^*K>+j)P4EYD-+M(OZ@>=mMBam;)!=T9!rFOvn(XbCzo_REGI%$wu(XNvkcN zmqf!bWSGNVqWL~7( zA;ef3oRbeYQ)C822lptNa^n|f&z4Z#so&Sb{8W1v z+S05RY<%(6UM!c1p;40JZ>HF!vSfnqOZIp=@C5_hhVUAY4D(lNr||hJG)nqBgSx=F zX^%Cu<}$0Nz(Ffd#q)hwiJ(Q}yQmDWhfjb)u7@$k(-cRl>U{>nn|3QOZmAU` zvw9l2jWMyg4o3(F->&qR^;kW&MUlekRWS&GH?wm}BMF`_daQh?N5@=y_2RiD!$x}t zrXxp57pUwOgJye(C9S*+_Th#Ia#~|Af^INHg1N}r(T)Jlv4&x$wi7Wo=0x0f<>}70 zu}!P^+t`ijg>W^5M9K;#as?wCHY^8Z6^%pFuu6R?P|imvhbIoRd)jDXr+xE zJEZJFe)L>9U%<#GnlS(I8SIO(mBhScaq`eX@t2jz@zm|ybnt@HMZ(tNZ*hlDHh*lep-G1(hV!LX4ZX5C-gMVZLCpaB>&F0;xXV* zxm`kdMdU*sj6k$@b(_a0L;Uy~W?3tG52CTe;SG*+C|>bVSiORc56BhY*MRt?j_f!a zAMPu@^Mv{Ysss;Rjqq`Dz9HrH?MA9DuUSk%`54VTBEvb?B!@Gt9sB@|Wn9`EXy3HL zo}`UuY_cqMg*`>X<#>>ll4a5&Zx9&I>CNP++C!Y07D^o)N=?^hajNfALzG;sB#KCp zFmk$@KM(1_tNElznn;?9NOe3a@Q_n>rnm)F;&!8dn{XRJkr%1k3C@&4!5V1eV$}!7ZzLK}3*X1Ccs?S5lAU$Es zQsv?F)g*tWUwu3M8meYEeM?DC8dIH6NRU5a%&LoY6iy!(M(@6zK7#4{Vu9=X1x00> zY3IrJE0xOb8}Dyf#BfC>`W5$L$yOX460i;=SnJ= zd*wJ%f7pDK;IM>HcMT?Jx8xw0bI62H4o;wbo5pZ>)SilOFPSOsus?Iqie@e(v7V%w=y4zrR|<);=w6~x3W>C+AI0^>B;iYL z98jvUaZm<48{-biK;Ude11Mjjk2?k48G^B}RU0;;_oe=z;&yFDE}I~oR`w%>{fpj@ zC^az`D_kmoj>)MAX)V&fG=Tu@14t6O@l@Q{?AwQm@xeX4SI8{5@4!nrQ6jOxZk3sZ zHi|Z6)NPMy&Bf3h21ac7JHm(U*)}VoCAfdgWo17_S&*7E3mME(yR1>Oq0FFqZngV< ze^EB!!^FXS4T&lWX2!XeR< zdjgry6^l^3K$5JCl%1S3sXRa--O9m=$7Y|5xsN4`goIa=2k1f9m|VDqaVrVQ3le(# z6$w>UDI~-6>dg{Xthyh3;fKivygGgsP~oZ#L+49+3`OMs!t_J!RYE`1iS*_!sUNpJ zOchc;n2>n6+ER13>1PI*M<@;()36343G2t9D~O~{%Da_>^#c-C(49$2=tnjP6)0s1 z*N?6TYKfAHBusudJ?p2$8G4ESfj2sn+4n&eNfaq@PNj(SP`{#PlXD`_ayP)r;(3%O z=!LAX0~VkUFdBJjUWEenz8QXW;48<)aV<;W4^pLgo>mS{H|*rXR~9*BisFw|5{rgG zB9QnFQE75cLglsjyYdPtlVp;53w!R&di{wlMsQ|JJWqh9jr(5-iDVs^rwhkV#9M#k zHA3;>1$&#QvluyrG>j5i^=e{=1CtM5oYXyM@lQ}5AWQfga+o_cl_YO1ZR#(`(`ne` zHqSLDVkKn^d6~q*kBtDc?{G=|l@98!kY*&Z&9MzbK=@g)90TQd6r9p0(|jaIPr&W; zcCpJOL_4CF$5~3@a3U-u|3l~O@Bu!WzRJxIm#rQ&g-tqst4%578A_;Y!1_I)rBgfZ zDKh0@aG~>g+OB~$V5crD+e{!5^TRSqgx;lY&FXWZ;gv$}--R?A((h79#(FAu?LwLv z-6>V}YMLeKsiMw%w^qq;c+*K*IhM$(5aRZ#806$eaIq&mgG7aADNzNQn%zlASp}M< z-6>U8fo5z*6<{{4Q8;xw>K_7-u8G;(G{7Sq6&g*{%Y=u6!K5M!x3gV0to zlpD4jm}A&dcRW!9zCgi60g4tDm)Eqm5v=bhdg#{$~4BYBmAn| z%hmfG5%L?qe5*maH>dEOWL~)A5K2F#vq!y*c_iAA)<0C2pxzUaj-FFu{X-;=P(gfV<|9v&HNn_=fQJR5XacC6jt5RdprZQ$3k$st?@z<~?N7ip5Md$VZFEh> zg;!+gRduBBbjOX_llg_}&sC(YH>1iVE^WRU zFcr<|{93-t#tcIHZVH{p(0zQANosc48uE0cda7(5X4lIjC~(hm+q= zeyvoh{B{Jz& z>G(}JCvPX~7kle{8TJm<5-6-YwF~c8r^C_9{c7x6*}V~Uijiy{PiVa_6oz#siqf{a zD`%MOD6)HnwPdiJs<+Z9f^Dm}WDu@iPNxW3dYCt0>!8bAUR^F&hroV#^{{g7tm-fW zkqF*`qpEB~7JDLYIfvzueCfLJo8VR@Oh&tU85Ii?QX-g}1-E)egtH1(f^RNw4r4`? zDIr)05oDDS&MH`Y$tsaQvIEJDaZ37x@I8Nvn1)8Wo7#|_k(-=y6L@gE(FV(;SNU=x z?7V-^m+-OR3w1k>g|)_3L?AE+pbkg*ZZmVAU-PA=RJ|Qs$hd z=x$s{#I1#dDKM-M9-(fni8EA4BreVe2aMZl5_xMOVXD;&c@ABsl=KXEy$0w0!Qo5mGnl71^VM&m>NuTB`QNLrX$Ex*o;FZp+fXMEN zYqZB2Ht5A!Q6bJp_9i>DuO(_0XTuB!H@iAfEsgnwna+wt9@Ww8wzovb!$;CExZod_ zL-e60;g7*cTNV@bj3k%8R5Ct~=GFQ_2Kgl_9Zh7`5lk^TXZHh%=N_-DySW) zF!-OpG7z@la5b=rM)-3KJ(4jQ*_nN07<)ND;=taPufKUsUc#+C0pSDRqk@yd6l?>P z)I1HJp*aK%X1dj98P*;=TZw>r^!d#cNTTaN?)mkUIw-ysug`a;hVTmSWAx%Sp!3wy z!SRWgRBnH+#9_JE25o2KSEc0%Y7DNjGKxYTI(Rno*M3y4;aO&_x)X0FGE2#2PDK>V zXDnP1RJS#m3hrw2o;cMIuYOR4vWDP0Hk^i?Txw3>sSROOp)Ul=$^U~AP5nuMkqP=u z2kL)>59EP|K7C@}kM)++r#1z$$rQ?0!^mgW9!7$G#u_RBOVqo;ine=wJxDIa*VSN6 zYu56}AIi%Zj9jEEg~TFKaRx?^MKKv$lvl-?#io*HVAgOrXTcX4s5B>k?GNKBWx$6X zKqY6*5%^$;B+&&jrVuo%3rle3C(1(-nw>Dm#5_zrX<|Z$^U|`3IZNPBA3_Oyfr-V( zAsLr!m-3CF;w47bM^!@@y9z&RQ%5tVJXcqehU%8b{mY+9A3G7442S8HimPXbM}nh4 z6>M1#276_E5!R@*?er);5{l;Gfu;))m?eQl5?Bp_VB6~BI&oneF~-z>vdxKY3A{e8 zQ#m?bp3(LvdR}){Li?1sC)L1QKsel!qK3p(B!qHYPq(S;>3tMdkFl|q6d&m-G|H15 z{nZ^Q3%z%zkEK7O4@l+;^PAHIOBBg$jvwXwuAyC7=EoG@02Be7t~cq_Sd(T$Lqmj8 zzK~GnIjEal>##1f9;5>ZCgzZB%$%=Y2YX3SfqXM*PF{>6QW+zyWyyZ=h*^jM&{?o0 z1BDQ&XelU^zz@V~IYkR8#5%qE=Q$d|GW8siZZRku2>l8S!hqWF%V~E+aYGcp1snX2?io zZJvx&(U!&-wAPe0SHTI8*7$s3LDR^-o z&WgC2*}3{AkZejx+<5XlM5Ava(6}83e!8zGpM>jz4^U42((Ikni;VQ}!Dl7%V%4-t zKAy(|%IiocT@yhL4{R+Wq`d$Bl3oYHC*qUcLA6>Q9iEOY6D){)QI&qCzT|zP(3JBdM%cJBa*7vK$p2f)>L#%56oI#@C%!^JcmMJqfq|0{Edq ztMSlnMiGr5_aL$ZcxXzX@1UhSoQtr{O2x~2L$t!?PrJv{2=8BGaDKgO3lp$-=Z~CZXtzUZ~ELEpz!KTk~ctV#LF*6AdAgyhbcJ*@&g27_som7`U`FBNkpta&o8?quPmyMl8u|#FCSZSW1c!D^<#f zrKW;V>Ma3TPiA z^yzprPwd#aY6;QCUfxb9gKmjDh^N*KXfuByN9L1>z9~qPd+uK zp2**8P`GG-`p-{<7j0OK@y}<_?4RY{v1|+ZK6M1r|{3M!0(hCR1DPbKf9-)Yntw`5o zQ(XUPI6H)4S#Eg4TUS?9T1ZhjZnL3Eza<{8O5+UKU2qjBm(3X5c~Pe?m8FX!ne=hqB2rPu zk+M#$L-o)?-x$Tmdtf*k?HAG82`-n8pe-dvxNQl!k$At~iTMg0=#fzbw?f{7xb{eU zVm>zF%Rv>y3mb`5&=47!`XPwoPr~=;u#G`fI1mXPx_p*^Z4b&?@%F4_E>sNX#(~}K zxp(86nf%%uk0^eyxG$H8nw5p?SKV_mvVf1clM)bJ%qyXb55&3*P~O0g{an zce!z{^@qsXwWDIVMBB_SqWl|K|Kv~ z!kgXI`0zH#jV&!Y8cmeBkt3i(vou9V;ny|=CKabH+kVkphbzfUoi^1&b| zBh9PQcwPnF&Ok}jmv}0VpEbI5E_Kux8ReV>g6i*Iy6}Y=n^YN;4i>aH!)hx*f5}p+ z8_3T??^jyHeB>WTvY53y`y1V6yuQT{%rGb^9mMXTTU276ZxN-t!`_UwAib8JZr6_l zBOEGTk-~I?TR&0%hAvS?V1$_m79x?qlR@i0+%u8yv-=wvMpv0@hC?TKpzLJWU2MqI z;J?^9=)x`?OQEwT(rI~^u>rj?fxA?A`~UkoSOx)&w`gzEL9*0=+x{QvAo=fgP++t# zYSWV@FIC7@_pjzQqLZq6jcC(qSw^&Hl?*f5T{nm7v1VJ64)iv(q?<<)ecO)S^d|dA z%I78NQ_?~V9X%547=cJMUeW8YS$Rm~TSYBKJ%W5H4BA-F6A8U-7&gC_`>Qdszr2QY z-4`qLty;OyA3CcF{$7i@h)6M$UQH#*?n~JNuE}9eJ%dLDeXirgN zfhr$?ug1a)y%h9NFiyaAQ3~Hc2s;`7w~7euABD|1xE8p?=9&|0%sCbst!36w)!>d% z(FW83y9#eoRZH&P>nXVKL?0Z~3Br!(jkeWwPUOCLlo=YEO0+Gd>uqbMb6*jVZBBSO z_L1pfN1~-tNI1TUmZByQM_WSG1Wb?#EjE;-&gm4Y-usOWcZh-(0^+~Bj% zHZ=v$A|kP=r4Xe-lpwYQ(y6@vK9S0kw>Y5?tr<$<&$AFKdYip3Bk;L6vKD%qUB0hg zN-3nO&1r(Oj1~4&Z3vTv-c#p&f^Mh}?igXr9AA&;2|=r(SN7}aR?1TIN-DdoEXKx# zNfbWALIv443_FM_sprtWz0hTl0G0@@qD{zr2fs^b6?ekJ`lj61fSuC(lhVytR@O!Je3-152|EcshJNj4CA8 zpJm0c+4R#aR6qGGE7?AJx5LL}&4KdJ;3QoKW>nH>Lwai!8%7m^$>3q8-x|}~ST<`o z34Z)FP?5-u$pC0?mJ;H#PriE(OI5J||3-DYKTt4ubZ*zd0d>4KaBv_P>pHmqput*p z=IFpcRU0*YKz3%2!CGLrI;LT@+$!{6c4qVOqYB1rgBy++Jib8dKPo%3^Y{Uyh7W8v z`2Ozd$iZV84yawbf6ak4YgMgVy~f}wb?TPAy|D3P3Wkp!Y?R(@Z~<)^*zu199H!H^ z(E3jtK4xfcv*87!`;X1eEQ$W#2v()~keWkk52;#pP|Yg+tM~8Rv<3bj{@kC-heaOP znRq_(*v{k;&h?Yd-Hgd5{82>aVE)C_|z#d#S&Z#kar+9M7o27Vz+V~kw~A1p?1dZ(@lEP zUj!LIm;dW6jLkXx7*|QQx;;^frA7aO{&t1RcA61j&qj!iNKs~W?$|ogm4dNKMBde= z1eOHU7-RpFk`&iDS+pEMpTsUoC!&d7$CvB>-p|v9-C!$7;$cP$0 zBq))Q%_H5buYW$i_UOZ-m(@tA^wT@b#zj>abM}GQxFy+>6W;&rc=V~_ZA0r^SXIB% zGUuG@mACJl zOvW1Vbfx<14s_VEY5ltq6W7hJ_2kx1U+dkhjr;JGRy&3sn!b5Q^3M6QrcADQX;Pny z)hcV7SG`?k#>#P8#S@pB&nf%aqp##1OnH3X=VRKIp7_$vrU@VPTvNZ)^TRK!IKH9c z;Cc-U4*k4!LXl_Y8`tVDcZ`_x?zId3Pxy9y_e$f~9?73P|I8a#CJy^-O0U6h9~)HM z_p)oi+Wkwf9xr_t)FO5h)I`yw%quSL1PuDdB70 z?Yp;pa^a30yT9DI=lHI@CwK2ZwddfOy@$^pIC}2T=U*TB^8Du~E`E9H(up&dPkr^T zGhcsu?!tHHFMWUU^0muXu3!1?$M3HFbnS;}+TtYsZ7wS3mCC1>hEE^S@TGeFrJ{zP?u$j~w;*-ANz0%Ur!{<$m99AGfKI zGB+cu)yn-BEAAUsBc<{1axta;7?j!f>cZ>+F*92@%fvgg=3L&nv(~YG5lIhKwGAFP z=Ak}G+aLKd>22TJ<7=ni+*`M(-Qia*6kHzOsiOMJ^F!5T?-iXo^?T!|_CI*}gI`nH z4(WaDi;r8@8#{Vn^PHA1MD0E5Ir`0{Gd=J5=F!-;dtY3B_;R39*ZMgx_s)--y!gJu z*K1nVOe;A3#mE+`%tznsJElU~v|Ve9h7P~7Q~6@)nU#Y^U9b7W{vijpt=W}PJE7~4 zF*UzVZ_w#@$GtbkANpyj`NtJIUzjwq#gMO;tTeZr{M-Fsj?=zqJUXYxo1=SQv{G^$tGYh%Z`pX^c4rDw;QcKv(MDdN2X;|?E7QabKaTV2Xuw{;~M^U1>2d?p(8LPN4lM z>y27?@sD+B%NsJdWL?@`>x2y#%EoO@q&h(C(d%AoHE4so-%x{;QW}E17oT!_&u}h+%5}V%I|eyKx}^5mfy~RVp@Ll>0?xZUu7|i+E*_6rNZ2y zuZ)=6=ESg@gz|s; zsYQ*Ey((RcVYRIO{aEj^Ez_q{5iboH{cQPboAb+dop|KUyVu0$&jiV$Hhr3Ym4Ert zs>y3VdaBI4CeUx04t)nT81qI6=*kxZ`&4l?w!PU`b}9V)n*=c}IC>eAG*?YOdA-WZWxxzWPfogQgmVx|c-j#%Hg z^i{92T`Q)&*|uQv(e&kA4{RG&X8hZ4?s02NZYE6|nRjmA)haEAIQB-*`eJuZ2XvDy z1#d6ysKs?DoBP4^(PgrCjlP=n+lt}UZboiSD5DmP_K(><_wkv-wqE|RbDjMcKgoUR zxdprGbZ=Szr>DA&=ve7%@74MgcDlgdE{JqR~ zmfidH&Xo`CzMTGjv%CSTrqo?u`jz?V%NovGSU9m#%d3SG-dz0LGl7K%T3eSq_uKLv z-(CITt$yWyv8@%mw;kG;^MtqSNE&> zOVR_5Mq>8XW>+WoZuxqPdpnnzeSK4((_7jsX!c->(+~EWI)B!x8|{Yl8alDfxq|Ns zO7Hve-PxP=l(|R!WMzKf{0v7Y^X{(Oer#IzyXQ8G`?kK_uhG-?^AAqk`sL|YHqCzG z(&MuV9=q7UwP10pg_XKiDu3<9*ag*V?cKUJ_u9l?tl48f`J&Q*Qy=f_cBpZc_DfDY z)a-?_-4DM~rrfm-@B9>bwcdS^@3{J!DnInp*4h0gJlLYlGi{zOyYHcMACHT3T1wB_ z_F7j+bj_Ck$G#J#mVfyC?BR${vCQVe%a5e? zpYwp})uQwU_NCUn#jCeEO?-5_T2K5nzVgn_VM(Nsm=z?7DxYHC4a#C zF}qf+>YeC`|NL;AWBllawTJI1SNhrqPtHCxZv6b*jX!l8*se*hb8S{Uq@`~U%zLo) z*6pWDU(LKvd}{gmq2JHuKGx~jmG2+>=)$gtw)Xqd^Ucnv#1YfBo^Jnb?==^X9NRMK zw_yYKv|7-{`*fFul?MIx<+CqdYFnK0?C)!ioGRsB@blR#-q^!C;zr=!N!-xPV= zHRi6FZPu#O8cd6>)Z(|R)&EsyR-3XFt3A=ykv9CR?zWG1Z9CJnYNLg}@9jMCRF#bd z5uLYZbRF>Z!%OpKE`GGz)2=bL+EYLF9H@WxQp)EaKbE)Rp*HE|wp1w$^lBSX;jxU? zpa0Qebd4(a&3)-|HIm4?_8`s7U*J@4X9ZS50EzOQR?+d+dCfn)Lr_`Nab(>Nj6iw(_P{e!F`53*zuE-``xDX^UcE#R3?yLWFo1tsF&pLP4hxrAqCmqUfo#O1!J1S*y z-j2eDorj9lq0jAktYBZmZ|82gIcw_srV5*zUs$qoJg*P_J0?1Kh3t;2Dq5{a^F*iq zktf>%_E;i_^^#xNScVs$RF8QEk-qzvAW{s{V{B>r3bkBED2Ok;T?9j0bQwFsC zw(ODfN1y%m&kWD#;+FI5$NSfMI9puKKgc>#?w${hAAR*?exHYgtIMjN-kDLO*40WIpE%HY z$ia{5-rQZ<^YOO1^&9M-`oiRW9qL|)`fS|ReU^*k$E)iXnNlZi9I|Knl^_1>)42JT zC0Azr{`PPv>%U}{TNOJucUn^azuNew*?Qx5{<5voCBESg&G+{zYTmHbp~9GkKg1>M zf7my3lB0cG8CRKa_P4n{d3cTF@dX8o*RS$j8j!ST(aWC?t<$~l*2vi#_x68v<4<)z z9dggCnY@`Q}&- z7Txpx2WNk6{92Vd>XLC~>%|RQH}J~j$A_>zV%2qSkHq z&u=sA>BWm$)mYTL&SMWZUjD)5ZfCZ9a{9nCrj_H{9P3nbQBL=lJ9N*AOigRoZ^NT8 zi7u;Se)5l7CeQAjJ8#mvAGZ8ji>&@x6RnOCwf$;Z=alSZ+7$di(1yY=Y#VLcgHVV z{K9=H?{?_&`uwjW&W^Jl?Hc>s`iNzXqu#3TTHWoz?VhI9ew^87_DAuRbL#Kw)U)27 zmb%~1Jl4VEe>w5}0oB%j+wS;+ejBa7-WxHm{nhI~Jv#gP7r$ADF1l&T9ysyfD|Oz- zS;~KlO}F_Ao5syMQJNiEdH?dy0sLQcXvUiQ1FWe(FeUif7K8i0v8Fc7B}30^y=P&= zj+Uws4`0|Y*41;zUB0@CH6ecA)q}-NKJD7f`gZ5y4{@?$Lht3j zxbM5xKIe3;COKnkE$F&6)mQKJrY_2&61Y={^#n&p2r5R zdZNpq*)PA>f6eCDc?;S0^r<9<2K8;zkcXI{1qxP7Y}}ubRKb zqHk(Ey8QW#L%!S7_0;)t8%%jydbRxKi}6>U+0ta>8%M1@d#%ph*Rz#2^@#SWd&5r) z$4y;$^7+Qm!-xJpyWXF+tgff+pC}vYsPn(XeGmPMu^YEDg_}+N#kCW$f&PEb)c*~u z7Td_GeccB3Tkft?@Y~s&2PZE5^WL$i|G0Vfy@Z?NdQLih?#Y|W-oN?F&F^r25k2L` z&BoXFUAbAk$LNpN_22tzseTW?KlSR38Ta0N>%^ZwHh%v8MiV|9Iq%eso9Fi4y!qDq zfBZ4!{I5^lY`3@Qk7ZwMN_zY3dxPuWs9fjzFE`(8ee*`;&DXx3a%9Jqn~!%JIPUGY z#~oO7bNuz_o0XSsxjdz7k8L*x?rwfFBQJSwFSF+8KD6$i@4uUKddkSDRmY`F$||~9 zJHZ~eI_dKY;?u78FWWbu<4+|lK{V^uwwZ|!UU1xkqzQDOSF=j(YPE^ZinARd);7lP zP)|nhZ-Vpk%7}L>&~OBY9XBE7t2j5rkx<#YyNN%F`96;*+xqUiS|BZAst|u*)Gga= zlsbTj@drO1jKP>$?q4Dqr*8b?hf%8 zCx5?y&MXh(ADw#=585-QXC(g7X)DDk$4tvqi%qPs%(J+}cFQ`1dlA~i=fJzfNsj+) z!4JR-pEb@JB_6g;u-e2G+W}jwxZmE>ZWGVg=UJk}DktHiT$HQ4YaK8@xh8<#>89{1 zhc`L&MiHhmhqE}mz~R3*JRePb3Sx-QmN=59PCSKu5!ysy!U4PmFeia9&m)Wy#oh^4 zm#CFQn5wBnV=aHZoK0kMSeL`D9FF908i&g`+`{2O4u9paPKBfjHj#%gRxGbD6Y)d$76PF1ti2Vp{;^j1=|C8xsd{c2? z-@zxu?|SMWU{F(pF0s%@@}EW+C0v!LMw2R0d>`UAQ9dg<%O=`nO$DY)7HO{^hod=M z%c03n_)LU0(cVARQcCpkQ#-Hl6X(4g9_6r1Hep6__%w%~b7;vSd^W;Dme3_u<;={n ziT83y&JPi~ge8|~{2aDKXcL`sDRnM~qcfN0+Qf!j3b%52gu|~mypcv{N_&&j zZ20wdO4}ojB82sF+BHCtfGRWe8z3v-W+){_M4PBjC*i!7@}-$5Unv~R5>G!ME1)r) z)|k`MaF$DHT{$gHOlB@4nM;nC%W3107AdMhUgG&6=c^@_bJ}B^R!h9d&|-#~h;7W} z6>y2f_wzsHwD*wa!AbW%=CYf)v=^rYUTzVe14_UbHos!ZZvk0xf-NDT5Y$y%;j~yl z$)YEI*`B0M2Na1z@d_rAtcubQ&S!$i<+M%;X?}vJW>P@e2Psz6wF##U;j{-tQ-+Ee znj%`8NQ3i1IZZq$Ix@5rP%)s+Ou30E9~50U?Ng-Phu_}JW9TgBdr0J)Kq{_+G68&g zaX!UNvdq#U2SankfM9v6aJzQ|=kp*f0nk{^m%^0K03ykN50#xSyfM z46PA`oUc9Sdr?g0wBATtg?lv9SxckMlK`(3GnjI@`Bk$O&`gF7BaNU(7&^&m>&4>? zeWydX!~+6-+FFEZ4Wp-o~lLw7T@S!`oy2t)6R z9VU;k!+Ur{4R`~S_|4WF;d%QUgxBozF$!clcO$Ig+zU)&=Rt&RoktONcYcYmuk$2A z)p-VY{vLNxxRk@S9B$$8BMy&ocmbhF+;k;CiYRw7Ldt6r@$NK}jm89oSKX5k-gHkk zRTaIXmLt?S{56UwWiER( zIQ%I350qFbhNP++QwQ(qwBWE~4Dq=qrXes>V>%%`#9@{vAMt7)(!ilu!k3F%g|Kqm z8icjth(pu3FQK=#&Q}zR=n$7+!j~rFNZL_xuOT%McM`gC#goPo5Y`f<5t>Am_%ldt z6#q5Cj`5ceS`#d0lZZ@kBJ?FtSq~;uKzva`F2Y*iX|r|ko)JBY@Aj@zdK3>p2(1ER z5|g|n;S8^4wur0VrxA+8#Ry%A%aJ!eaTUU}#5D+g99B&v{?icF61$Q}sv{g;L}(H} zB#}JkWC~+BOy#gb@*Z%go=lpr#bMoK(p!5D`*B#n;ml;RmZy`cy_O|UM!1Ucn>hTG z!_yr8#9>4V@hOvHNQKr(y%?0aRq7hl<(brLz^qJ#9)uM(X%i<>D`CXAm|6wl_lR4> z@2RyBDrwh1Pnxl?X7CM*w4T6MO{3aTs?;0l^La~;;)O`-}_p-H^X^isFK zr>+O)owSYMLm1+D0P)E5P`g;22f(LMI)!aG?8;$34pj~(aX6jB$B?&2@iGqAbGV(u zeF#nBRJzw{5?^ur+w@Y1|BzlD;f?f@sQWz`2Tq zgiAA~W8^=I&?K&8ke&R@;h&&KD`yhsk<8sll{Nh#^DD$j&jw{&X`+$zlBROp&!CaL zphcMkThN>ke7j=t7XfEw%22x}&wHaaxN zS{d`*`*i4ehSuoNHinMr&>@B#WhBpU8LFd0P8)FV3LRNRdvO@F&prch*KL>iSn3GzhtB19`xBV| z#M6pSOn1aMo&l7tL**UIFoL&`kf`D43}}uHbpRA44(ZTPM=|bV)xexoi1Q{Y-6NjR zAu2tN67aV(@+rqUUNJBPIbR2KOj0^2EkRrja(Nxlam;6_?yopzV6hTei6O27?yT|O z&d5#37lO7q282PxGbu><3DQE)QAd0JIua%CjJ)7@Ck*=8u}!3igs}2bL^eY^9aLV5 zXs<(5UWz!x(0Q&yDe*5IqVh_KI=Dp(y*R17RMA<7sJv9MR)?s(G_ixB>5d1S=Kvko zq4~~>fG+CLOU^6!Z3KMx5`WVj+nv_{rRvaeq-BV@I`kvbGDK&Fra@=Fh)i*jp&cR# z3$!xg4;`xEvYEk!pFOVH1X5hc|d(+Q9nu(bRFicmW++>S=11I( z5<2V93Wf@FXfs1k>(D-i-qE2`44u}YZyB;wmnHnhP(_9oBz;`zHx%7XroqmxVLdWg zLLw?EmVWJ=|8`n4qaMVjg8|iynq#UJgjz;DWvVL{>-nCDT4`z^TGXKA^CrsISXh|& zyovHP6LWNk^0gHE7@8_pM6ENm5f9X+d{f27sLiGh;t3u42v8@nR)<IFwjxi+d zx|{fbAz7nt!~%aL^@pYqbTaCo=^mMcw3<<8OnrjTwW!OcdkrX(dcc4nL_J`DI2~5r zKyj!JC7*W^=GF%$bt1pNW%Az^7k&{TZG zvZ^veWb058pjqNxhNPBei(w2&4bBz?L8z%RTU?b8Tfsb0v8lk{bTK%lqG_IJphKha zOKtPT(||J3|DK8IraUfQ)1i%ko)Dkt&=o*Wim!CY<>{s@6n_8$PaYAT5^I_<=zgQI*Bw0Ui3>QvitmGBJ{*#C8jVssUQUX*9}oh+QX^2BF@u1Hzz@u``ur z!L$cr&+&UrgxDGRMC`>dXl?AH%JLxP*4W1ZErl$Zuq7(}Iq{YbQRyqhK9*BzX{9(V zA;-+Pjmk>#3q$9fRNhJv(~{VpcT#yPMXC;w)T=}d9U`e$i5)sbQa>+_Gc?`tSlruy zI=7NsNX{3;FdZT}Ul6MpqVebhWwof#nkaXeR>r*})`*%q^eUhiMGFZD8l7GeQEix# zN3NGerVf1^w@X~UK} zIfkTUTf|}sIXw0#^A@p5hY}Ow&2Niy5)zpSrOfY&%uce8HA(2EyeI1FP;Wr*i|&Ao z+HMt_7+NScCR8(T6@SPyp5g8gshyb;};oss|hX4AB#;o^h?4p(DZ9 zv3Z|(nxUOybj)->^!ay`F4iL7evza@o4o4)tz>AL*yeo)(5pK1F-kumKGdQ8-r44Z zVlN=_e0L>wQx1uXIy4y2VPWba(-s3dB2si{6QHA_1|Xxwj)`m@lBSBIiNlm*B2S0D z2lR!Q#?W*}R8o%VxOh&7$|O|-v_Xfc_n#2^b%=WZ32{z`s25`$p2y`ms286U@jBEj z=@s*-|I^<0$H!Gw`|f=vlR1-2rk!aEg(h@bz^1<t6%p?97m8x9a)m2kQS^c$f@vZ| z(EkRlXVf9V4q#7Y(E6!r-^vo653@C&Qz-{yYd)v0aWJ;#bLu98X}0Eb>P}$P;EI!b ztmoBZ4%QCrXX-y3j2b+q{@`HL;0tQz+oVP^cKlpj`gT*l9VdS_@N>1t!FHW|7qCMP z#v1)X-Q!@a(JxfRHk0q_lV7o3RJ9Iv{mHKb<4^jajqIC{_Dl6)2m372eyRTGVE3K; z-N3KZOqoPnt-f>elfVu-*i$FR)l2Gw4)!a-ZWru;{TJkWNj>afC(I%CV+UI**eimK zsg^n9GE*idV``&d%P*y5V=5(BRP1RW9k5S{#L!u!9FV3LxMdlzWlf911WMDQ(v6(RNz(hqJw>X&Xa-H z)J18g8DIB%H7Jn*2Zz>(Jq*=o6D~&1zo;LUu~!3s zQ5A#ad4qjNt;W_|tzcKHdul6z?J;TU%eB?O9un;NFiQyNryY#41aw7)T%He8mVh1> z>}q)7>B#p!lcp(4g}zg;8`L*zPpk;)bvv2Q_^e9(O4eZXSs@)6G8lbUNFUA-Gj#~* zBZ6_9jw9^>lO|(8NO$Fh5~ZJ45z?cAjVZgXxx&_|VWy3#6YJV5s`cH1T`g`27* zJ_jq+ZC5k&OC?f{smtrGteB}AM~G3DYb#FB&1LNRiW7C#VCvesk5$akA1J5AaW2%m zTk_eD*4JydauzS~JVR`;wrMgQ2rUJ`7@URRbl z(l(W`Cy{TD!K97m>GwI<`E^fM%+t3x7~5fFW4)gSBmy@Syhxz(E2V*vcYy~J6=vNFT7Fn+k zz0+vPp8Kq-*GCMdX3fPLYV-pCF4P}zurueLA6%sGcCfbq zTcW=w7^Q9vHt1K%SV!;-ZI4QMNZS@XQ$J)d^ni45h2~ki+jGv+%l}R=#S+faha8M0 zoTHyHnABmFt~el+(yLbK(;O@odT(%*ZZVkp^xPYQ=jv@&8J@Sz-K5Uf-*B+I=l)~x zE&7RfGwp!-(%er4FVI`AA!cSstM%oAu|_upS8JxA#e&byy+7EZZ*eGzt+f<3P(S-W2T9+ohsb|=0TT(4&ylJZ2(E?qkg>ou5t zUE=XzmmYSoPYZTPFvGJ;|4^_S)P0F3gWY=ewd85idiC9cjj3;=yiI!MKX~PB(Y1mZ z$}RdH!7z4!@@@K@_j;7u^abOvlwi+?>C3n20}e(%zfB)Dls0z~x9M+~H1XvZ>lYnL zdi_gu#rs&onEC_sd5QjpV5X(}^sfYC`~5uFr)OU0%JNb$saKS-xJu~@42HKt+yU%T z2V;w+^d1LWC23DPSi4}aIao%pE$^2S>^*{g*umZ-Sj+V$?Z$cS;JMAgZkhKiuzdzo z4+-Uqf<2<>HB!3$1I%aqOG@AFU>vK``eDJ0eWvw~4JJJ&t^ep?v5=}v>ytkyrK9KE zZ|%_MI2hL*13K$qx6KVz4(Pvku=D1})u28sn9=8;e$b?eoek>O3?^&lK|TEjQv$v4 zp#Gs?H>i>MCs$_lA06yn^AnXjb?t{pd4oCxET_+Nun)~&P1Ii9iC74 zae=o9{AXYID+pW4#2d)d25TI>;o#5pxG$Fp`}s3Qs~-p?H&+J3=WmBbwr7OH&nLmZ zozG;-7loT2z9ccGF0UdSQ0u2taudTx0t4z#LSvmu{rF=H4e4?31F3GV|6M-hX-O#o zIrG825pWBt`NDIdlxz5(;|s6yg)fls8o+=^SmD&7Q{qX9cXt6+DAELlrqZD?c`1Wd zUKsBQ0_FG?{C`)9;oKscH2OC>q5N9;YeD%d)OM-G0AQumCFIm)2r+IOT_%)<+lVjz za*2N@AWpL--q85NMjnNleN+v80iVf$)j z;N<=?ImWcCiNAT0RDWGUuPn>)Feb(?^X*bcdVqlXXM`)%{XPl(+W4x(8))j{FWtyy z`M5nU^#3N1@ml%|`kjRRGWf%Op8l|(W^&k1=?@#JCe#1*n16?amSX?aYI2KAj`7p` z!;@Q$-Uc@ag!9u<$}a!|>Q%rBg^Ok7R6`Syn12)cRRWEMV~7vPNwRCthKB8EDdRIw z1&!sDRWE#)iu)H5UL~nKi^jc}a;nK25TAy75WW%(&kH6|UL-Mo2{%a0yCkp4Wy&@3 zvs~D}z#c$Ly?s)cF?cVs#Czd@+95GTNgXYxYN0$HA5$XR+SQ3^cgka_L&D)h!p-Qx zPx((0Z`#Wr{*>gJY(IXQ+a>Q8g!2DZyeZMNh|%Ylq?E5nDJJ|)gagXN_*=yD%vyOp z!csq$yw3}tUr63JiuuK90o*GH;*MDe=jdUTz>R=2aPof+PWad1d_Ihm@NGEN-i9;j z63louQo}g^dsMB!2X}~3Es%JD$HjnCX{ij1O zNZzA*e*GQDwW$8V5Z>Gy`XT7gs&5BPQ~k4u`Sjcu06RiV^DQ`Xz-e;YatrBvBV zP|93;D=1Gxn57)m@2KBuAJu#7i}tN*tp2{ht?E61_ag6;ftYnm{a(9KJy;*dtuU@7 z8WqOnqeGzXDQk8Fd6@Wz_8g|3%%~l zWZgfnezcJAr+{H-J{VpOja37_xG)y}yn1Eff^b;pB((&HrTLzxG!#HsQw=rz)aZppkA@GbUoZMjc%D_g_y-8L1fK$AizLy$uYiB; z;@84SY2TYghc}B3$JElrr&S%rE>k05xc=;_nXCi-FC ztyN(;m)L7?th$9ctliwCXC)RVOzf+SyFd|TCZ*1s>lAAEkc_{#|YTEc%`{N2Dwio3!`r4~mW zOW@9MBlh=c1Kdx3MtC-=_!68;LZ6i9tR=q#Tnjh`IbXNt2@THsQTjafwk5Nx=c#LE z%&)!`GS^o(ssl?J0FNwLUaisM=K?;sA&Zp z4{isCSZEOO=hwXweqC)|T0*#QX^(ZD*vzfgOS9@hlUceK@xx1xsq>_7-fFRjo`+uf zzUmg~l`Yaad*tu)SWWe!=?o(mT*+9}5K|jZzod(re*H^`oVC zp=WVF{bqIB+@}JKqPIrHeRJC6GHf6{w{%tHI_pi|#E zXEkh&=s<7i_qGl^cEWe4IWUJ18LU+5KxeO^d=RQEOX8mH3jttdyITva+JpeWKN)dO!G=MCN^>;jDy9(h4P^FG=2#gwIKVTN=8NtEql7;7hYMN9P6Z zZMdy!VL-+pfhz;Q0?(C!*BavLuy8&soDU1y`>U4`6);u-3XAFk#(MVXGF4H0!J(z;^33#B^DI z0_?S{ppAFXg#fo%5x`5W7+^~12ZcT>^ut150{udDm+A>MsEgE>r!}az<5oxm#@vqp z_NdQ98&tpg5yI6Ho}unU%p3`ys=kKsV)X>znd&FeX58c-3N))L1nyK%RJIA{es#av z7HZanpRfqOY9LOZw}k=~5)+hgC1HPvaP*v0!$X0a1U@A2X@Se|>v?NJxzHVmG)KkLHi%<`|Zc=f3u&qpR<2%zhwW`J~7-J9t!Ub zeZYnsR^3_kFIA6LeYfh#s{g3^b5)=^ zQoXf0S3O$&@#=r6ez^KytG`?QAJzX^{aW>3sw0uvky9cIB1b^ z8+j$%yxWDFa(i*>?Q+cWuE1~N?g!^F%0_Y1r$bQvh`4UGUk7`g)R3i}A)Ax#GK*PbVVXB{Iw#1w+aGAjK1l}7;fpT3<7I2He zA%X7__+EjB1%6847i#!)-9rMuC-8ZJFAMymz=|koj64QD7h@e?jqSCte-eKuU_AbJ zfXCvD|4sZxgw+hzYvzo9Lbzh)kIFHA8j~82<9Axst1}7zB=Fu)BA}G3^9vC+Wu0{b zpHOK!VLPCqeCh;h*y#3WC%hl=H_WEq{H1?t_E!=A#o3PmPUdiyFZGEzl;J6X&(HZO z=wB09UCZz(0w;60s+KamSD=yP$=bRKS1Nz%y`lMtck9(trZKsC>(YqXQb%rA*Ik3K zv8&(KJ%X@0Vts9`P^Ftpsj9#Z<|lSrA1`7=Fc86?!^if`Ars#t>7f z3*Lse_~+oC1&>n)I3M?xEqEHdwi>?XRHQBxxEME)E!^uRT!K5p8uxJ*Al!g-jaltt zgwFuP?gmmU+(RW?E>GjF0JPwt8j*Sq(k=Kv!jD2z*eMa zJS|7K4o}Kj@R#Q!d?EZNf8mSpBGrT#%*z4SBcG)@0JZ8;tq6At+<<&qbqnl8KK|-c z8)7ygw}tCOgqxAi!c%mefNzH%wy>J+0lXOL7JlJ(GhiQlv!yOYx&;q?G2nK@Ss2Ze zfGK=iDvf^@etB#FZ~!YV4gb6o;eGPN;V9liYpE*%@q7oox`i8(gg2_o5c3g03pW#s zfd7P7(&9M|ybl*A4FZqA>s#uR@cCMO3edvyk^2$81rX0efU8z_U?i~AX92ak6C;A9 zJ_m?rVboO!e;!b)yVbi9zDwZ4cmhwWuL=CRdJp0s0o3X-Jm+X(zkp9WehVXth372^ zpTNjs;rZk15&tA?+)_Uf_!HE_Qct5EmU>2g6!2N~F~H|g4@*4{tGCoEsEx)A6~f=4 z9+r9)P-8vuX@p+`)VNP_E5g4Q_(wdShv!xR;i~j!0k!@dprt<#7}j?owF(dxuKyX~ zh`^}+B4TO)@ie5q7vX6FW0)(!^7WShPtgAZ@I?J(z=is&fQ$6k02k}812*W#0N5D z*sY%f?9o31+@@au?9;yhOzB?&ruBaU?$9p-UZ#Hoc)9*9;FbD!fTQ|#!1w4s03OnR zLcOj9wA4T7zaacxf!Aq`XFA^}@IyL)@P~B}@Z&lJ_z4}>c!mqmQlHY*fVb-!z|ZPw zfOqH^;OF!Vz&rIUz|ZRw0l%P60=!Gl0lZt+0p6$Q0^YCZ0e(fFs&|Cm8M;2C?Gx-j z+p+48R9_NFMON2bRCBQAx|$nneps_2dQtRX^tx!pD0lqm_iVf|9dAjl-1R2Lcz;^$ zq353vcgLi-H>q9l=@aS3gpTp#zUIyRRjVraziIGvGvU)tQS(&-p6nEOu+!9=@L2@^ zwiLds0iQSHgC_%+{k)ERY9yO}i^`4UGNp!*OnOg$dboslemA7DS>?W^yQtQ0WctQT zYdO8EkRMJLN||&~HRn_5HTl9&vQ$bJn)BIgx}PkLlW81fQMGxw@HXaben72F=hAqw z_&7S%HXiND;x);=={=?K(L%K;liq#Ya&x6ZK5Il>o!=uOcc*iB-#OlK(45bezz&hw ze4!(WN@S8*Q>vj!7gS4nM-neTXOZQ&w$?%+Uue%1OXVnsY;uCU+L`a1R+6^5kl$Sd z+qRxkvVUi9A=#f6(aRYPSywWb&bBA_=0{4Z4MG-j$!yPXHbX@lir#!ayFCd;lCvdK z9L^^9nj{L=SwI!L@_0x4Uh{V8_Dn9_p6^de1NF!o;8`a(qsyE+@? z;wPDea$7S+j-ukW+zz}FJ)0~RGdnWrl)NO~XCM<&%2gD)GS=KPDPPZEvM@ZM`5pC4 z6e8DONSD%vqg$S-es6L>wWs%>Du9MSP{x}QUBL?qEtD%}s5EIqsHT*rf=cO*Wd9&^ zYI3w>#PXAcy=CdkyiE&rB@1l#Ny=;RwB3Y8-g`M-y|31cbfnhBhXsyn$`Y(cT9 z*N+TshXI&EyOO2B=KRob9yLijap>2381JB)Gr1Hj(--4dw7=zreH(s6z}Oi>zDD&b z;uhg~jdkfPoQ86LVL+MJv#ZYS?|{p2um+D8JVa}5WC$K%dlu?8KV0C5*uaJ^s*R{K z`!9MonjoL$TT6x&bHM;jw3E+sW^Tx}Xwo!$j=NV9ds3wSA$yFEpf!u|c3>XiB2aVX5=)T&lM1kLPlTZN;zJ_z8&t^TvUB2Gmc43ov!UEf>t^y zlA@JKilP9QAIoveoRm2r*DE#)}$HX%4k9Lp)icJFoV9VYbt%k!TfGN z&5L&`xgE8BSFcc|&V`8>th?!P)ElyMW@zsTq;vhS!33R1%MEJ#= zp0p;JalSTU@^KT`cwT~29WTO>-XD?j(Hr@^R8I<5t_d<6Cz=wt(N6g;>Xh!GsWPQ0 znJHeGMvvo~WSsUn=QK3q^jdCvQ;!J}Pm1(3HcngPG{urkM!$wUNh$Y)awbH%TJdSb zrw#IF22Tqd-1EgW2D1JVdNpQT{28X+eA)1OFm|n>#kA!6F)PcJ7$MWlHaI^_p|>{Y zVcMA-C&wMFO+6dCTbtK4b@#1qTids}t)+L}q}X+>ZEM%{dPS~LTm}v23*xzP7L-mF z@q<%F$jzBlY0!*-n=-`==7e$N2Hg5QpD`auBm; z+qS-Mi|P0q>A$ncoKk%mP_0X61_t2{wzJQy&W@y=AhfYp_2qZ$K<}5)1+Kpzp<)S( z63m@B6d2rVD-*}EO>R;U+dPPpOkz*kSv7ZLQYoljxU}_Sy@7Rj8EKYM(j^A!e#%+_+C9@#4K16tyN(D3(NJj#e>`m=LkqjDuxM=-VNA z$i3(au68*sR~|NHj%Et(&8ybSMv_>8%Sf^=nL{NpO)5{|oGG6(oFr2zI5PAqSs9N{ zE66)_kT{9ygmjGRvIy@hQYw~_7N6;rW`vY6VNxVLscGPJ%3*8> zMR#7DJC}56WG>kR18`RPWhU-^gIhNiV73Wl$G}XGoSlJ5(oB@ZpV8e;5M?>i(TLoF zTs<8pNh(=xvk8hY%JSush^CQJ-biC?(AZO{?|AW2#R)qa9Dpb8a=5kgOYNyZ`IFW0 z%9+ToFY6X+`~v3CMX3i@2F4u3NXu65b&^5OpVBGgjrxW-rBZ##t?hm7t!sLnV7K_?-pLQ z+tTWDR_INsR65mJFbk;Eq@AxmzwB&s*GQ?hPT8##y*WX~k})KcXg8e78$(wPof{AD ziA^>%YrmPKnnn=i%YcL7!Zn(S-Ok@jCZF1rmvS6IscxzlnYf88D;pTlq&QzzozHt{$bY7VsP6WtgaR(+d6^Jzec>y}hm7eLZb&YgJ`zT~qrSiCMj|x3_b> zN$pDy4VU&ho(CP!k78e_AD#nyiAZolh|7BouKHjYnEydTVlLiX8T8p~a=4goJWkv) zUtB7~=^sW9UmSLhu+8AA$C+tjUWfU4UttrES^9Y>;uPSE!)(tm^ToMzki4)CvR{rW zjnD1H`ty6S9tU4r`)&O=(T+_XCxtEVi#ER6r&42gj@pgEIfyT1S=pDPb(VQ{2Q%>W zDEUuYiWc$4tVyjl-|UF4LimdKtYa$E{4Q{*(>Hz5yg_SOf;i>C`P1_VWDa6p{Q66 zVN)JU&McOdrZ^{|IhpH77qG=FWX_@;i0u71%XCU=j-fbnD4#V^1aEuWlx8L~rUVR} z>p9*E@DVyQHK*1Xe^9NaVR)TX5q5~Jzx*)2Wjawl8bghwei(e+DN1WD)wzSZb;WJQ zyo~!3&c+qy8r)cL(P0dvFyCx?!$=*YlrHushare4tkp$ujFX1zRZ~At z#LK66YttpC6ft2Mk&Bl(c!!0qM3}Mo2%Q-c>;<*=h`F+06u!CUC@&}!=Eu+-oOmXO zd17HNj;Q+w**G$bH>}xqsLJLH`j!}?i-6uWIp;Ky`vstq*%&RFx-mxVhTL;U@wsJ$ zG&~rTSP3vjnw?%-0=;?faIj4{m$OR_A_PhtDyO8DLS|RGJuRo^Qf;W%?edg}&d(i2cZ_7S zdpBUKLQbqZ(xt(CYJGCZEce%7zhoTJ>Yl-f2G{(xyc1ZhP8QP>qQvIP>?xQzz7^i+ z!)A-2se~E%Ah+MJZI(sTnu1yh_+?{pE1qoJAvHByK28=( zc55M42wx%#lJ)u0dML{vy#@GJiC%*pBGd+rs$@B#%7-a%U(RWq8zqX`;T}aPSy1%T z!xqc88dSkOl}Y0rLIbK_cIJ~j;uuh}+YjS$b_qLkQ`y8*a8FAt?rrepMWT;^5Y>$Z{@B7}_2uK4Vsg z6N!py7&{zhL}RTBnAa%`FT5*ZJXD%@ZA_98kY*+|a5@P)uFtMHHVui5z@wJ1kz6cN zZ{^DXJKP@MR4k^4wrBUYq_ODf$qeMs!3vq}BdCO%gu$2{>$nLlVsZk8I&3TKot%Ip z%+yGKX>tN5PX%r{PfmiDOQnaBg`Ja=Fxli0_2dLjiFhLmiOK96Qejltkr^1lM#DHJ zu99#ho*7ExLdMWAs$b|y7j|WE0Ly_K5t6AJTH7O`q9;VR$tX%FWwygbmwc+2bl1#n z6dG7deyCg?Mp)hkL)T)8$KDaIC6gS;<%?Jw6>&Xl`^W$WlJ)tVxe?;0cjYg$^H_DK zcVKG`%Wh|Px_9p|4nU0f44aK=8R~&?M(D)2rXjw$jI71B%Y?fuxNeh!uf|2YbXK*d zGT73QI~=^y;>j@~!E_I2W32<`nJ##=(s_MD7KcZtL;EfYFxK6P%MbTS{m=~9Ioy?& zd0-pY`T3$;t$`ijPL#soubk_YZ~0-~(w^UqKIl$A&=aJ_&Me*x;WFytg=$z;m&Z{S zj~HBK$d%4?mRd5EY-f4gGQpsRtMRQs&T*NxgZq@@P-*z>!zpEPP-KZ9`ZQ_G5|6^F3!L z4gM|bEoz+}CL@O-SUr--;(*Lq9=PXAPG(F<2NjwHgE+h{#==53uLU@Z7EJZvh{hq@ zjWqkLCeh$%AaiadZ9k4x5hgPLALSN2z96}kvYKb_&bdAPMy9_9LlAscW{09WVcgqA zW4^X#(AY#7X<~9^0}*@Icx00BsT8X1iGm ziSbV86OKum%1gu0px9FUHhqC1r!O?+`Ump`$AB4cB53;ayWjD$4U34$dt%EcIvYmwIIyH-a`U6dcJo3<}BQ z*l{eKEmEI5G4nPrg4+P17dd}v!%jS=M=abuV`W&RhXS4MHtuF)gHucPT3)ef&8D48 zAnwG)tf7_Xtl6L)?mP#VJWPjRC+A#VY=52E8zbc=6J$-XrNd=_$j3EBXAXXl0(Ria zGZ$Fs%Hn!gb2ESmKGeIZD0>FIg$xd?Qi^^im*$x-N1dLL?U;eG0gzVoR;eb)JdS^m zIYS{+L_0WIY3tfKUcc?O?W!CuxQelfe@*ImCD23CKKR()ea9+6S@S@}0-iG6l&2b_?6^d`%Kd z8aN-xfgLY=H{(gl4DxSBI0@>MQg8MsTM6!7(IPyDA#oB<{iu0q7R6tp5%e{g#KT~sv$s(lyUJ0?MA(X<_o0y)!b6pwGv9%kN4q|zS zM@@DK?-9_eFy&+Wsaaj3K_ew~MUAOhMWjz`YZVA1X9A`1A0A=BTPkn~m%IZ5NTFtP z%pJgMW2@Qn)EH7{(DHJ?5_nq9{8M2!UB$fAEAVv7emtgGkLUGNXg!{IX~Iu}V}TAX zWg9zl4eF7B)CrW32OI{@x{^O@Y;20Du2rePQl-~6BgJb|(o>uLpi7{xIZ(sbN?FEY z)6h@?AAji$O3m%@ zLFafK8ZSrtq`gs_ruUh4T!3detKcDBf90k%LUxm;S4@?7@e2OIsSi)0ga%>^F!zksN8u6KKPj zPC@ddQhi=ZlhmD_u|YgMt&G-Y`f>v0lm8o04WUfdFX4Ere#i~`J9jm5(K21T@$x6& z4P04S3iDE0QzzKX99oZ`W;dvc(rT)aX{m2RUhHlk1E!f*14GX#KoqTB8i2;aPRW6&3*0!ExSiB+S%w@Jm-862F)3$` zOL2|Ir16yq%!T)`2db1>LBnLX%}VpSgO3>u*!V^fbVpv7R-+%|e1WYS^P6?YDPh-!nJ*dIi{F71u^;{<}ejzFC4)LNK3??o+u%Kv6m{KNbC!kGK)gY zSY#B54O676i~hQF^l+{u=ff+wo`cFay~Aw~JV6|6#LDjq&HfYBxZ&Vg0G{8TWEbGwtI8|+CUNT~as71VxyT)jFMEai!vQ<^g^hvfyzi3^B zb7CY}p*Jl-^HAaKVh0%2YmAArU30+lDEl3b1#r|D1Rrn)eO|0XRqv2C=a{Hs?%b7a zO5d-lnS=HL39Gjw#Mud68$XTKmXn-W&i+C)UX1@Jp@0zQ8QT%h4#yHQ;#V=7MG0ok zNqdr6NQgPW0rL{p+0bWEB4toDW`s|g*+fkVl=M+~Si7n=Bc{|pWaf5i+Az3f#Lr3D z;SrIOl97(xnX@ zPoRa2ZVy#K_E8lxC1bS(YSCQ{^A#b@4)ABKm_ln%u?*^M=F(34hnO2&kjJXm+gt-T9%Vf`r?<5Y}17&3l?F&-CVPn3bqP-+$?2U>~>Qe)I1 ztQVzZ@NOB`4t9gy;a@{4(=X4rT*#;Y)85t|cA(Twy%Be9`ikHf5X z2BjN9nVgS$we>tBZO$p9&Dj<9D1AUyVZ&0%#qJO zqGnF%p>0%f|7ntx(vD;7x7hT=}Z3<>1x{bq*O0m2t*7Wv0m6la$BbP;502Nz7#<3M43O7A|h7_|>;Q8Qbfm3V+ zayQ}AT2WaSU%~>KgrJGRRtdI-5?~S=J&f;ooAcd)Z<4eTbWo-yg4R&Ip(WBr&=IJV zLfTMBM>r8ch2r(G4ONLiY$JkA@m4z#h}aBRl@UbO#Z&P;v8@OOBaDsOP_$)7B7hM) zQj@6A@zEFKqsQV+u?;l|y#8nOm~C0a!U-#OF%z32i2x}Wj3pt#29$n5bs}JytcG+W z*pD8ICh+bcVIe%K@rt2%n%rU=&|tP5+fY%7bTCMJWydy%)-s}?4AQ!&hi!sxqcPOR zS29MTw@?q;2)YQi1d%X$49T%enE?>7h(L2(3Ry2@c`t(JIY5#^{9+~OKqCCl5jZ4S zlSn{(R5&nCFFu#ybCMBaghHGo8BSu^C$X6?BVc6wB%5S5q7xcwhN+%phhXA+b$lC` z?1wVqqhql5bevUsAjLT# zvJ!_^?Qbu3~9a`7qTR-zOb+kInGt0Thmg*duMSFHGS; zXWPhO*$7#cK@EYlr2{PZ7J`Ss+J#3@0KDu^<`1Qk94`Op_eZ)eR|7)zD!AdG4BZdT4V z0aWsCrcjp*2*Ew{oG`1=hur`fgD)#C;^P}=G+HBSI%24gh=PyU=-EhpDL(og`hut} zJRcRcJQ`FILxntQS`K~_JYm~V4BUrP@-Zp!7@{?J9TU#S&~(TK7P=NMI>Xz9;Gd!X z=;%%AG$?3P;T>mqA09Obyt}8V5wAGI#-&!@zOed#thi|C+Q`bEJ#fKO)z7?R*?k|| z^_FWZ{`A4??p<2QJQe=RBbR)A(|JF={`OCwG~>aW&;P;4YX)*pKK1oCy|(6$&kw5m z18sriN9KH{ds^Sf!8PAreBrD2?Q5*DzVrT1etW}%L*2)&KJ&NM+KW2Z)Lm8GKksn( z6KAhF^~uIfzY6@|>vtVG>+yMWZxA*bm8W@wI$)mZ3~@v#`?##aOu7Fz+0#F8QS2Xd=K zff&i~3Pqstrb;wdQ#@^>dGLiHJES>!gKZN*D~htg0l_wc4)lF(dO?b2!?9FDLul-} z8ETs2@lz-VgRceVv8^1TgE|^-jkiT2VFdXdiJTm&frI1_J$fJ##c&)?0kJK3arUmU zx+v-p+lYMC(BW8JY@>}jOU)zfr>F^aF}4(Q30)T(JDn9I<7lFyE-fQHz36LOcXf z&_u`ZJEE8+G{#3?hIzxa9kZ%PZ2mU>Oc!K7rzG zDFh*l&4SjDRsy?fWyQzNH~*>bT1@aDX_KjXD@u!RvqS(k4hPzm40I7}K~rM%hYzx% z5cG4tVnQ;5m6f!r~=TNwW_ z`onf@%b3JA%*x{XoiQH8Y=m*x7|~f++Q__B#u&~541Tfs;_L&B2|I*C9g{&DR)u!a z@%=X2VVlfFG1_yIv40w*+Yb}lAKwot_QR>e5sYP!B_!YRZ8Jh4%r4^l9aN}lLKTQ} zV}fWhDjpJpJ2V8#3&U;Ti#CY(6y8a!FyhyucK}MP6>pDch4`R&m)hEDGy-%qJw7%< zE|6VRv!Bx!Fx?>K$k>D_FD91g03B>|)XKudFcbh3yWU_KCF~D!#Igkjt5J_2{eV>$ zq~7Wi|kz z;F?D7jxhEf&JgYasWTODzK__Zbw?kLu~i<%fB1G71_B%fMvs(HR08Am!%=kGBQA;M zWXxjSMXzS!5BL* zyNSjd(Y`NZ3W&d%T1{(ccr*T+dy~Z+cA%m-G&R=_@&#-vR%sO!RH@N>wHm#ve3>*+ z-@Guf?2I#(EnRj-)LKkzZb;w(o1K}$&LxSC zO#fgqolP`1Bzkw}mn539cyn4N(bSOGl*bICRLt)>9=|hC?itGxU4ytqGMs3}b^QU5 z;gR-4H!n~X6PS|VR%tqgEs!^9HBV}h$P^RF1a1(UTd#@yj)bqWcwut&vWBx7mNhgk zTek8nr7-=lsVV&6BxYp2)(M;OS{GadE#J`K<&ND&X!Ages8opmk>P{{CxQ3*=x`9% zoG;)l3>|p2le!*aqYQ??R9^Ad_ z#BV6zl{J8C5a!>PD*p4&+}p(x5pQpI-{NlJw-?MGS#l%T|JMS9zplU&d-s^K4abd;e{7-i5%D5l5u_6(6^Z7CCz5F){BsmXB^hm%!&7{2GTxy9u#^H9YX0cnh9) zm2qDLzXWhMc<~MbZ+qa$Vd$23H!1M|PT+AT;y7^$+_P%Ny{QCbqSp9J9Sl**1X9c` z9^Sd(0X8q?@s0@|sFFLUlgoG`erKQ!68N1C_f|&&zn{TF>-FHZ8}~$b_hqLXOLrj5 zdp${{WJLzj^@1ud=}l5TZ;oaV-y~c%A&s{Us7Kz&-Ss!i$NQCT%~?Nlw}oxY+VcpV z+B3Cf$&{#D;;2y`#&<&!bHjjlt$0^LfolG^wlJ2>I~BYE#G2x63I060(KkLfyEnVHcPHs|((Xw@+LeS(!|mw+kz|oG222hTm}oMXmS;t#sff>OE`@X#RqdiA{dGQGs zT-a)?OU(JnSubq7;H*n8HR~H^pW8?-yR>oPrHzA*KEClnbI!RFgM*drE$L$p4uT_l z3c>jNS03ZIJrRV9`+Lekuo03q6uRhj_Wce@yPv{msocb%{POn%;sHOeQAED>dxZoL zPM`9oxcL3d&4u7(hCui4o`{bQf`<#iKqmN%UmHPy9QeO7!iV`#5KOE;_saDMZ=cwF zZB)54D9rkq6G{^%pFXr21Q-~IZtU;ppoZhxrn7X2#t`c?f$@AljN-M>*=)mXCELx1c4&gcs_ z{rvd%efE&Id~N5mPu_9gGyb{iq_Hrb5d;;8IChA84GW!+GX!IR4)0V5_Qta(2!?{N zjYo0LWKVUnr@ypfaTvCVI9}FgGYZX25Nq8W1W|{mnxN7QqOlF(oDK%t#V|%h1m(r} zi30F~LLIL#*b%%yb0{c)M9HBJ`hCE8+88hFOmFS&MR%2utqFP$Ho5cV=l;juPSXvy_ti zGdZAL)MwTA&Cw<>`F4gj0gd02_E3&C;R_sXN%ixTcGzY?#Y;sUVVlZ}G2;gVY>Xho zjW>XvP>YudG#Hps!D%?8N{Nvhc0-pgD==A3{VL05P~nc zSpj0n8RR&Dx6!aoXw|@VKp|n9{>1ErfY}*81I?q$W+h(M!cP;0MTU54=>iwUO8~V60rPSMiW8Yb-qp8=!|YHEs*DY*^1N$sl*mw&ypZ|525+OQDxi_crY1Dc z@$&jK_oitc2Y*Futp;KR-k3VJ+SpUlhLYXY*HTu9CwkfoG3zf!9xb|8ZrEmegSMg4 zU((DUAC$~K2#el_i_Q5^hG?GY2O^0pn|*;1AjT^3`&$+a6;+G9L%mLmy-thSj7DZZ zrVVTH{_>0u;KS+pr@;;bJ@5-bz@`QbK&Gh~gx=WH;EASY809csJHs?-JHycQ?aUr% zpybcCGiX3v+c8sKrO83zyCw&1RNA5tJ9UH-npJP)oC<+SDMW$W7KMPuDinKHi$b_> zQ6yEiMWHa=zL2n-FC@S>7ZSUejBTUDOw`xZ56g*1V6Gh^V8r=0i9Iy+ZEXVJ6hJ%Q zqM*ZfoewTOo^O# zf)qRtp?>lZD&0bo{h>JPAiZOJL8?se1?lU+EkIqO4-^uhToFeIIPLRzJf$Bbow6wB z7SIuzpoV6E^2{Cx}^m7e$z z05xn-jKCWcnbdEisi4fnwthPdmLtBD!VBgwB&$TIN^mFxELcVt*TQ#E>JZMC0Yi z9EpU$QVyy^I$emL!Rw0(=6N|pR~B$~#6!0*x(tpj6mFZsxt+Px&YVt_58ri#1maJC zz72oEG^syfXsSOMM!)qWFhn1BD0mFo4MqR0qabA^Y#oh92ThFgBp2z}C{hCIv&?a6Xi>f!B`N;E6xJ)HglgvaG+E;v z(0k*X_{nvEnB4m+2H+DK-Y1-(>6IjNnG655OT<9^OgPwV zmr*fnS5>IIkW{SGBLKo7LEd4haMXK(L5o)$0U}&|r<|J<#BWTIj$khx15>0U(7RKi z^4pAb1VB0nlb4Q0;N7W;N>K98jHm>NsEzNic#u&)iV@tU#co{^?4@O3inIj!PP0(i zlT@rO34pX1YUHI=0cowtp+vVvNPy~cO-?#Nyl#qg1bgWim?9m4zS}KSZqG($j zPL>u%5g6EOgDLG{WX>Sv$ef9X7qDbi5Nw&nHX7}0DRSNIF&(oE1}j#}j)>q=E3TE} zEYh>-#}1j=6-V1%4Cw#0?_#yQCsJuc+7^SBTvu1F*hW5W)UHSwpN$`M2)JE?4V5^+ zHZ4|#s!kSBbjvClA2~D{r$tyfcbek%6vq}|j_VT0jQ*a}Wuf)CXQs^2Y;hK3I24&L zBCR<`q}4(VwxR18!I7t^t|`ZpkOO@~${}@04D?)*sxt51E@X@~*gUo`9ozO}_(c;L zz;vA8iSq0)mP6DP1LXu=jCJvO#L6%zoAUt~jcRKuL7xoF1pTfp+x2BfW&$h^`LS7~ zl}5l55RSGSO%^5G7e=+Uw#=omS4&5?4?VJG$#$&V*ljd8>s0|Ndl0b8g~oziu2DXG zmungA9z!^|Le3U$Z4AdmX`hRsseLZa6+VH^xBS@&!Umb?Tp?7k@Fd$2BVY<~0v9^kk|f*fA^;i0#8N(k zRD9YmWoWxD?t~>jgJHXFAOTzHg-UuS0|Q{W+_OA^<{7qGz*>;`UI^hySV|cYFeRG; z>~}mQ&2~%!%XP%TblfvV$r4Ue5~huf-DSt9WIV%{fGK{;}U3|kf zOWAiNBmh)M)Y!fUhE&AQHo6j|n(qQI!+8iY*aab%JPu1g4`Jb0NOC&z(LJ($d73w5 z3pIV(*1xOmZvqXv7TV%kyW4&-3AX)oLYcOoJ|jW7$R8SLp&;#=c&oNpZ=3Jh9JyAA z+6XN?bU-Nz1+LsqW4mRlt(`2UEtJk3vc1Qw6x#-R!4}4>&#=9hY;U6tO56LFS>ig2 zATpW@#2nbILeJyIX%H?1g05xkjR^;tFJN2te#nafI^|6jelCe+X_$)u8EDpLhw;UD z!_hnZ%HabxJ7qB9T%+XoZJv5Up|grfBQ(6BoFXH`TEKyns~f|m*5W&M_0$tp2} zAqbIqAyT48rON&Pz-NuMSS_rl;qzfMuV_h%Xl&tci($0`cf>XqT?Vvgmr^DOwUQ;i z_4!gFr)@1mnYPxD2HRPhI2>Qpx`y~K z&%rUuvhtjuaF&hND+5){7&_;E=7He)Ip!5fNoLS~@acn!6j6^7shrR)0=1Zau8sk=lNHOGJiON0SG4MO9qapcDs z4P2KET%QJ(Y`XQ zhN|Y~G?4t7Iec9TfV%eaWp|6f?HVKb1i>I25R#Ct=0&GwcR4n1ijB>CpY>P~9 zX56j#sYDjC34xV0%!a=OFT=&z#rUmwk?~@)r-t?bOM6TjncD#8z*}gZ37R$YHh^Np zvctd}hHY^qit>J-Xi41;v}MD+>K-sSx>6`9)>laAdYE62xdY(4`PN^mP1G!-iN0W+ z8o-^1Zeo}!{IAb}F;b%ml}yHJ%FbdKgTmY07v5%NZ{fRn_+1&XegXPb$)BwFt(c?c zYYpw~#B9!XFflcOS;%ArS8uEN-NfZKjC=SpcAqO1a!_>hZ-`OKlRekNhmU@_yc2P?iBdw%GRM%sVSUb>3Bk9MeVazf2GDn(U?FWfdKy4HoN3#;t#KyO3Uusz?_oU0d z`pvt^qO`1E?W;r+mumMOz-5)CYQ>AJ1^VU_GK9e%kO6*bn_XhA6Tzl~}PC<&Ic`wtwFC`Zv7txAEMe}~ZBJ%_Kod>B9d#o0aaNAPl?`6zw^20tdj2N;B+Dc?6B-+anfG#>{T9dS-Y ztbPb!fc~ABmVru6q>SW6^9cZIXVfMNRd@%^i^UHD((H{vqB2l4591Mk5_Yr0gfnsv_s;GW!7r8>MG%ttkcG3+$q~&nb172%X#^qNXYiP!ta6|EETipwM-}-9 zMgPKG=PNOrw>K0{9dJ$%6*5@RRYsW!&Vll3G?E~rvOGfS8J%#}i~U#;lu9yU=IDce z9)ZE;Je_Xp&tR0ad#=+)SnT`ZmiczlNH;}r{V&}VVH19Vd?~W+XP+1>ze@K=&{hf8 ze5SUl{Y^_)GY)3e)7~%YbARWWlTvR8|6mGuDcQIVrDa^*%DO0J5&bKto_cH0eFX?3LEUi;l zr{(%LrOnyzf&!F(2-*Jtsmu?Vl%PXBXo~|K=0QIq2tq*Dp`6cLL|qrn6M)07{1^}P zJJudt0t#Gsur%`zRgKw@f6c{_`3aEc*@gRv3-?jbtc30jT*w1HC#dImFxh-rPFSuC z2g(c99t_QT;$)Jiq_%-<1P#(kUXN;7G(QC;^E3YZ96vVv3%tfp;s=0V;t^T+ukhab zHGcZTQhYdtmHjt&~qtnT!`A?u>j>nFNb)39d>PUNc#0z|s z!(oO{xLsrEJ#shW6vk&2a(iB&CqyjA>ee5DjjDza zdOQ*`QoTak4TFvCfjYh(XxcB6!44|WX{;@<*-GnA_^H^m5Cj$E&-fkHcD5Lxg|_*N zk3^bEwEB8L;Bi}L!$Wphc3OfUda5I8te2G7_;~<3Ppgol39;^0A;%JOiTYfH98bul zS;&cmSiejh>wmQl!k=d4)B>0RO$z1#$P#h{1DYcuGfg2l0cp0^@^};o+J4!6+oAC- zQhyl#1<|gXwGy4NziRj+cw8v$(Lfm-F@{19WG%!D##W;|W|HU^@e_A`R z!LjuTZZE@&p{Y1%Ix;v6O~u(Shr>_?$JV+19Zq+hV?@~I@6*<~e?qg<*11Wl+!Oi# zt6Y6+-wi6iRjoW#aw0_^IXLe3$?);Wb-K!~k#3b}|7TjvyV z2_d%55wf*9M>*3vCz!U*p^q`Aqr@%;l2pQ2-&hA<;Ok(UmZ-Jp1bE2*#TvPee5I`} z1}_4?Wm@M&h%kN%rGMjvVI1@Xl~XDO>3&6%A#Kqe!&S33pp z9knFFZT|=^y$6JSe`E*n4~4(bOZ!QZ#`crs{rjXf#gP=y=D^zJ4?cr6+L3|b85R(k_2kQ!Puf($-QQ-Q8 z%3e^h`@%vozM9JA9*lyt6=*nyf{`20x023zHQYSZTPxxR9XAt!*l<)GE;TP0iiS#? zxJq9FY@mEuKN1WEedGOorVI$|fW7?kPzu>j_FOfwtY+G69YKz`Y*l zrlTdTTYP1p-Z1k-f_OezERgqXN_&>0Ya23?y4lr?ZmV`T)s*d08)*siMe%NfRMno! za5JqOf4vmSLXTAXTib0-6j8fbi0H~}xFZ&V!FjeyKl%Y50*f%thSrXp+J*Dh91cUk ziR;2HiZKz4`nONG;ZS5TzM1v~^T4Syt&iyEVj!S zN%|~KO>nARI9)PsN(tn6cp3NWk};QlJ}0%E0Mn;$bfqr_7b1`F%dm$^YYB_ElzbGH z6zRC@11P%4`~tsbDI!Okqi7OQz=WpdHdb4v{y5jE*4x1f{*$+9gK|F^kSgH$fNj})4?Ezk7E>gEFbYMAc{Q2A7`$^`m9>Kt3Y%Ng8@RW zUDzHi0U4(40z4 zS<+Sug;@)d?@)CzDU?Jyu9{^3uiyD}g*E`6oXn7GU!%Nhb<<%JUymrFt zR(Mg(o)>yOxqR)^UkGDmiVg($_CrHbGLoAMQVvOm19exBeX%R3yQ=C)39Xg!_585S zLcdsJ@F0(i*PdEwmZ1XJ6wmeI*;NKi<7GW5l~ssIeSnBz^8g6VQkfz>nx2AMo7EGG zy!1#_yAy{GY}t$XKgK}1wO`{gl(!89Ar`)y+LF^(hNtlBbm9rc*&># z67PG;g#$?Y6_`qSP5D%;n%sxfeHWi{Nqi9KUC5P@uub0~)3h?Py&hYfmc<7nT4Tzm ztcednC}q+hLXC9%ySuX1j;sLxJ-D|)`**e@Z>mDLuJTsSFjp2pRsKFBNF{hC@Z=5HwdHxy`v&qEo^)tNy7zT}EE$?tbV+ z>(|7v3(*Q)^C6PLGR3II{>oMK!{CiP2_P}(!9Z|=Q z3b|TKH(Ea@{)D`Zy@Zs+++oM}5*BVa4)Q9+v3&xxUC#q?#h((^wjJXy-D5v}+ch&s zqge}Wcv-)4EZO=tkqV}5#5&O3QSI`B6iu5^nbfXem$6K0qy7iG;omI#WZ3;{?hlrE3|#{>>o6;tQ2Yfx;jm96wAg{a=i_8N=vLsHrax;-B551X zP-gGgkjNtX8D$~z&z`l#c-8H_UX#9J{xKc>5e4V;XXW9^Yu`74xpT6DbwtU+cR)#90uY`%JWD{mTL2}sFr}NEp9-K^^V@@o>rT{SWDwMk)~!8g zR_TOB@d!mWH-uFPbCHKokrv`F82EeYw%kzGpQ9b0;dKIae95U}nzKH+`vqu@X@7tr z7-h~T!#1I6iVc*cl(4|uhHVk`c$TxYwV}+R!z?j|QFJ}SFP7hCHIPF=O4psrM@tO9 zUVzxiz5Y;s6BP1i*@Lmitua~3CxC5r=aCGbu+6%aKNBN)Dh6*wfne-8g#P&Hz(G~L zm=C|5^J`#_dUP2IsdFY{^!2Rt_3ZQ&&5A=fhp%m>sG1Yi-WjNwlhS}}K%1X#KqJx3 z5%xKeSiys%Aj>E1L_N={Ul1ffdm)%dZ9%{lhOCPXol?zf!X>w zz@0Pjrfmw^GTVRGJ{s@1VM(R_kfDq}G|ZN^7n=%5%)hXO6YZ4_>4&Ygd_7lQC&=r( z6pFeGgu4m7KwhQzFXF2RXR4|*rgra4W8d99IOJ0^r)a4#V61%=syusyQ{~)%ayk5Xem^xhXd$^gBQqfM@uDFM;Q4dJ#}%rBfZF^9dFGmyCql7g_^&?yR)V1hyZ0zZ!7NPjRm8^$;FAvDV}D4S4OG z2D}#TF~LGx*k-`&BFoP4w}oqb4s>qL#ZQdhV-!dt)UNL!klBKpqG7`mg)W(cCA~;p zGIub*k?}p$9mcxF;1`f7R9VG)3-ja-l!0!zHRow*i<8#KC%PgxJRh8r#w^s9^98x4 z&7Hcl3n=-8N`xHDMR->~i`GaAo+w&L&BcmHZd*lUAv;7Vt6ymz#p9@mhd`LBY(2Ja zOIu(R5c?XCSMyvnmw;b#6-CE=K9v=FS;)Hpkqd`bj9JKc9M1S$3;8`Emm(E1gJ~Xa z9EmttAteUg_R9Fj>Xt<+S`FK(=Bz4kR93Vc<+tNP)~Ph8d~L+_*J){58fU}2408yZ zTh}@o7R9wGF;vb`U=qu&L$=vJ!SHE+7`PP4I;6tJ^_9agM*+MD0JrlFh$uSA5)~a~ zwo6GJ;5Z6Hdi~?5=0`MBv;-C7=YgN_pcs^8I`_vOY?EtrmX!QO@ytf_vl3 z@Q|sT0rBthI;h)6k@jKcS>{0Wom<|Q#g`+^yfyI^cmxc86rvvD0kV;PVC*Yl>ly?) zFGL`-lynJ#&TB#ES+6BF!@aWTNVCqs6^CsmH!laFf#yB%$k^k)Q1cXsr{04-Ipiu7&kVpfup=CnUk zRPk?6C<9O|Z!3}`fWy%$7-oR^L-c+tSQj_@A&S|?g7)eUAS#%HrSFoI(r~%ioLv@? zsRi>Y$k}IBBZ0fOjj2|Yf}vihb`Yq{iNHROyp;2Kk=xrWCoB;3wO||(Cnu#K(pJvA z8bpw}V%h8n44W;Wy@v3xO`|hxT>z4nMY02^a9+Lmsi&R-^C*9I5q7d2eaKnCUbm?p zL)4UC%9%B+rW{5RcqF=`kJ$5_lc$k`>fmu zi#nL*r;w;GuMQL-I7TIDqo@|(t^O^g0qj~xV6MXt^;4fP*Yg!cVDADTD!c=gR7JVm zz}RT02>-H1Qn`EWEHZlt>i3(4)UP|&51s# z>yfz;{N%bi9lST^_N8@cC^9>+)KEDy3Rr!WmP)q{;3c$N_6QcQapm&O;MLF9a$#G! z8rj6ZA?+UF8mjGVnLt;WouKA+1e-Iv_J_)9=GhpdV{iw@H3K;GZoh+)-8{pNpf7Dp z<}OrXr{hG1GUG(lYBx@dkWl{Yr3ROhOY0`6r-SKKyuz1OIxpg@8{!egUjeFt#UvQE z8E9+=n`nFtKe>4|M&;(X2&kV@UyvIe5$NZ*BuVyG0SZ)~>8?JNP^G?qjtzmy2`F(l zKq8=KUW@!dJ_Z^ak>dtBd--u0qx=|AsAQ+}nE&)HJ_!xunBfSr?QVA^FgYi~nSjO> zU{;^V<&kiIYm=nPaBAE}>7H=X<*)IiSavjG$0tmlhfry5#Il~2uLDI{4Yw0j==l5* z)+5{PxTOi2$&X1mPCz@1@qlQ|juUjgY%hhAvA_>uw;e?eBJrPSlhPN`H@4@ufY#n= z8nYKru|MQdu$4Wf{iU!ixtIxveSHsJ?V^aB>fsTen~}~R%tPc?fwLByKACoz`71(w zYs~A?VqRu$K>)DVXJLZ3R`JGeM5Ve6$k)&xotp#9)GsDX>lZ`Q z*RL<4DCN)AuY?Ts{*V@5U8N$tUU9a~P}Ll+qBG#9a2aSoz@YIC8cEgy8I_yGC7^y- z*EF&KXS;a;NrQolpGT%psT>UH1sPMgF)CM~C1p1^0S-BClIGAZZZOCHa^`3nC`jBW zfhC2YLDfmk$=3pkoVR(BwUF-1q^4|xx+kp@Q|6Ap#M-+^B!E!=a6-k83215^*+=b~ zmLhe5eZ><|*!vQW%EJh`f2Y6MDCzw>sEycMz|DT_v7pC<{d*M-eM)kj4gimDsg>k1 zoxwiX7cu(W?FHyc`M%=BUOXzO<3jiiZmE2VgR)a^%zr!QL=@~xE61fXgjxxRl-INasbZX5z{>@P5G#U^YGli zTL%Np*xs+3(ZM)2nv_%*U~fCkO@DFjSGIX^uIoN~o$P*)o(;n)Wc+4iu3&D(?@$IlK#9yk)W0Ro z!Z)^=1ztnR5kOk5JMXJ`z%HA&LZUIY{8vEb>Fj(z%|*s0^sk2@?J~#+Cnj*Lu)Ub* zh0aUxD4^qY8^~bDJjrqN%&>sVo1}v!@nLfNY>dEfMqzf^ELhoRup?-q8Oq(QP8m{v z$56)Kp?g6ib9*dcKWsZFN3QL#a0+JOAr`;A?Ov%YXui5(g!D=-UXQVRMEwZ*&njogeS5af*jXo?`$EOxm8ow4Vu$jC++9m`(;kjN z8q8Z^%rXN&_$hM)@Nze(*+D6i@;bG@L9Ye#KddTxw;HzPZuKs;Qn1H9dcPOTd;^)s ze`Zq1Gb>Z()31{fKP?}I)N3Ghfk!krxx)F6uRs~{7q;F8!|0&>M|*TTUpvCGO3}kM zy=(*3C1|{w>KkE3=cQ4(c8319fej$j;EKmb-SGV}@|&{gN?`JBl$-0d5zxpNp1T}h z2+VaY3T3X(YFyAQBjL%icF-h;Igc+)uJD?1-LBD2(-bKO-knemOL?QBR z5RN*J9t{XK|HFpXx3!=`uKq^rVi@Y6HwoMATC&&3TT3*#m z;uoDNk#-c!BP(HKdLfiHb<#HE?p}e@*E%%{+vzX_9PR->7s}vY*xF2cxf(I{bz}Pa z()9IZ>FYJ=>&y9C?Yu%Cuhhq@^nsb^Vz^Y8;HUE%g;IntzKg1Y`sPCPuubOX?EqnS zqCzM`9zs#_5K5GXP_R6N@>z&*88LTDAxWTS?nwj5(qWkFzbSz1=Q&hz_5m{W0rK+! zvT}i1{0--&qdPtn0}_aTTXV5l02#!e(Hs9<9kp%4qzol0`w z0B%ay88XN7$V2w^?+-fir>TlIJB4RnJ}NNfrH$NT$w7*Z$X$JMmG9`OM1>sdR!1&z|PPV;TZQW=^Ox6kx zt#eu&k*p;+G~H=&M7&oC4()nc9Fg&M!J)Co@9C09`fbmLPSI;dd)&H@#T?=i20S}b zcOvs%zDos)%=`E*wJ0+0=ety)Se4Il8p{)$htEI??WdAn$o%TjU2WEe)j*RcL0b!}*|4Ub z{Kdl{!4ve>4Q7Ish;#4X2ff2cFX@{@!9D=Rm=EGdq^o41A97Iii~SfC^QxI6j~H}H zjr%ZA-9dbNndK5IP-JV7AgT#|1lZU#d{R&@O{Fyr#T_wOFLF|%W=|q7+Id?!E$)=g8=0gNa1xrR&(;prOR3+mEx=0t z`gOvRI;x)Q-Vxw8ZZM#IJuEckC*>IBrpg-Mql{?grt6Op(e=Le03+M~hfS=Y0o3Ud znlzJtt@lN;Q@dIi;}(OB(Ebs$A&_KeOUC&F&BL-|LqOTjYW+J@(_fN}Ft!I4RlBww zN(Ru2#gPkL5b$H*`?fiNwD&O22u?aj$Bq1^2}Uolxf#qaq(jFXPQTE(0Z@+b^qUgm zU&HpBsJKsnuXHTfcOax-9%N~re zds`~oBcLgl2C-w~;zhd8F$N2+*auCYJ{SM^Y~os*%}AfTh9arr9Ox}62(7PR-Iaon z?b}nvpHKPmBoDiKn8qz8@AL`6_PqprAp^LdfL${4f$!}G(2U>?aUIbX2OqtYZu)~_1De+7XosiIuQ!Zzha zjqvHJf*^}m@qXTrnz$gS8#5CPF3hGS^Cd4eswyVOp}3J7`XMRTAaRY+-9X)p;V|Znf%$&z`B}4N@7Em&@>#bzw-5!Y+u@$8IJQ58fMY4iY+-H!j zF#Z}dlV)Agxy&qpHgpaH>y@)u_viKOx3*_KYZcow3>>)chVyn*d*<#sK*WK39n{S? z$fCFk8+!R^u9YBq_ZMKS)GCWanvxYGSfBYOu|I(LWM@=ESs}(wBrX82#sGu&6UW~I z%4KM)dge@WVMXFTPkC(Idd8vMd>nX)weim1yQ7Y?nk!W{>1nt2s3x^`T#vWAp^}?^&uAu>!RLT@S*XU} zX0Fc%#nAwVNm5Nt!M9nQl8Rb&60P1eiG2VI-B-`17m982{=2F#{|Md>!9R3Vd54z# z(Z?^tzZXL3ufsnF=iD(`C$<47^T*)$b;nGyH*(YZ4)W2t1qGUoIm^eqo-xu>2-|!& z-vvGh;2l%V+-$b9HUaEA7LpkuW zN%l{&TrC~u`zW>F*AYW1gWD=3=k>;5qm&0FizQA6BW%5p_29Jrpnn`3=#0<1NYUsbWD6SWhum4fZGUBmb=sn@sAMT zvHK_RtS_*~z-nl&20-folt)mj;4ZB~{9_k?PmuPua&5y;~Q?5 zYvi4+^!Nqyb4a&#(OO+OE@0{SV*uNOgb1OMxR4H9q)~t@1@5;Cj??m%c4Ph;kuxat zR|lH2OXW?l@hIMxrX7@PYX-_C-kt#^{EXx8qO1=bFL~jo!C=E`YGowan~4eq!}f;D z+1lJt3)yByo2!CYR{RT~ioPIQDCgHt5ZWM$3c`h^!a(!vY6Z(+`v!%Qc@p@t*QRgn z!C=p?rlIupq#GQ*ykjR$Va=ct5{ris_ZL!TK4sx z^p(9P3uQ0ME|t71g|hLt2yE=_E6mfq-Y2i8V~p65USUgK-wt{%8@3p53wKgx$;@hM%=9BQ^J_I<1{&AFwi*xP zC&!*q$qr12ZZS<=aM5ISf1{ajT;7kql*3Ann8NQjDL?dnR(l)&4~5g5>gU!^%1J7 zp4^)uCy2*%c^LuD$kIw4&1j0%0ZOegs80lG8ka$;UI4325xW{N=x-PPli}^gYmSo)m$}mouaUtGnC?^sSjB`Bg?n zdM^;p*EIr@r!s^EtD7)^{$?ok0H`2uZRw zLzu1-gqu0S1SWuZ!h+RJm_XmcN|Kv0gxQHmeT8%>M&ZVE62m#?448eIX~68?Oao?L zXBsg3J=1{M2g-u$1C0_)B$sE3lH8riGXdHpyc!mra|w*{DrLYo2}0##88xui*7!B6 zggweRPklMz$>%cc1o8bu%o{G@-f$&Vc4CuStIw|Qn9B-*$&WI$1*^OG2=v7#N&bxg;<- zHj_&Nl*!7Ri4pEU6U&aGXTpGI!T_9N-Y*cCoS$JrfI7vY923Gl6Lt+f6Af5(F#sm{ zHjlvM>I@SCe4EF>bZ%Hk4Z7Be-8avY0dUECA_9|JGh7JJeoDS&BHR_qk|20^Kl~hn zi?7iH$Nwqqa4r75JR1+ANM*;F=pw)0iuKoe3cFW|J-$4Ief~UzV~sq7;~Wb~?uGbn zcl@`Q6}49M)zBx(tr-Hey9fP2qy-4AnZ^2}fTZ8)PyC8}f6@qbMdMN#+>WhBu$A@! zNQ0eFALpZB{tRSY!p`m-w7{ZlMq4Tjk zJ-5H;M49twlbf3%Qr=^nd(ypOsIQzGCI!L4)wMZ#K$ZEt*_18C)yWD;p|pk&Ur70x zzd}44E$I(L{EY7On6JYU1LZSZ#=8Cy%&y4PX{8A`Wimg8cCUvCI5=+{bFy1`sBU3} zU7`h5e%K}urzZafvN$#QcRb>M;D=Ly-RW6QlAiM+C`~&b61Ev3QsKOU{XA90Y=Z2W z+|bK(VROJu86))AmIZFM7!%)0IrAM>9Hf&Q7IprA`(W2K`~(Q|S(MBEQ8zi)8OA3< zu4R?@zp02Q{vW3gt`l4c{566%N6pEh_bYly(UBV%PR0BaKLgESyDDBsF0l#mII6=h zaQ}4M3*6wR@{R|KpQmfw)c;z*@elIyp07ykDESMk^lqvmOo0}|{^sssJP8>tQ`Y12 zBU!4RijJu)roiQqMQ+NLJ=rWT^d))s?N<13`}}jk9)+RX=dW@Z$4(E{;jS_rXzp%R z!4gHUi>9*zE5x>3_4azq4^nwi>mcR~Q|Xma)fVc(!&_?Q^mqU#viG=TeTkeNvJyr4`bw%qW%!POB`bx#A!|KG0q2hc@5YCu4ub)m&$m8>yzBR2;a3|9QCCSQl{+dKmVfTfzY>vw#EhFJdMaQ=@JT z?2h1|pJ^SSo-lXIGx(Te56#K6(X4p=&8j`aA*RHQ-B<+!jz78a#I{auXt`8_?N@8L zV1GZR@Oihgo{<7;Op(H+R63u4O~AcBq>qRBsCGWf#|9iRu5>=95R?cbzMzjU@*x*< zQtERlS@zoo`Vj-PTCYHi&b5W01=JT1)t!Joo3Usl?WfaVQLJk_P&Vqt-Y`&@pH?$C zIDCmwsf6|(M)jS=;0mNWjp>AZ!enyr^0Lcm{MPfq2i?H1*k7_ga5fJWYssC1eXrvwfskulUOmvCc!Z^gSY*Io>;Iuo2hnZwpWD2vW#K;f~aEZ0L2 zY*moHf^7%{xB3z2kcB@<#z2(32hy^WU0MHaDAx>-r^*r!;@!+h0U}&A`94$3>;l)4 zKTQW7N%|K|gFP=>og7J^VIy80um;L@MKid;de`&68Vb2to5!HMTW144)G)k~4_ zGsSiUjvHmsMkGODMHvPH#1(}(%?Jm4alo0Yf;G`z`^zAVW&x;JVPzm}jUdL%W3*ky zf`Z|d=yh-d<;BQv=fEDmo7eNObg%_wT9xPkYR_9 zSf7ZG{jGwJoZt`W&oiFf$HUJXc!s2Dh z7>C8e_M=Euh!;?Yi&0`7hBFb{O^x_cngTt*u*0yV&Tq5Q1p0Ob&ZdPlFz(5Py^z(_>(gp5qElUyvb97J+GDo$Q-Z$Nz?; zaJh@f;5dkvU5CAuaWG>xr|`9UkIh9)H%)?i2$%2{q-Z^epPGEQ0n6dh=5pMJia&~~ zh`lofIq!I}^2X^9+nOe)!RP5+MO-nZAA(hBFA)`9YM_Em9g@b^p%%rj)2h^q>H?=B zM*t!2oX&$tZ94&A%Dx0^SmW@Zw~XNFF4J<%5ec-rAZ$6@=EJ{>l;F`&Pb5qhRk>r+g(80khKCy6@k zV)LlojK7&mf!wT{hd`beQl0{@N~tt3<`1O)ffuea*22SR`0MbQ1^M1cycBqlP>e-1 z0e2bWz7y+H@!gUz2riX8>SvyAqMKhvgs@G`;YRhe;=%g~P^^OOG_Q~7T?G>Y_wymC zg{{65l7avW&fs=YY14^Yvg%FVgaU?vTu&{aPpF@Z>M!9yJFRPchsYd>sBwHLO-3l6 zgUQq;W@SRS9TxV0KL4`eKC_(i4)vK>>zCxwf4dRLl>@teX@!&B~hG|Jg zjtY`HRjliBV)06kqX04IvBk;|>)R&z(pnYjV%&KW3=$x}EC_@*wh6t;qe>*9M*XD_$V->d9Ii8x(e#R?9 zD=Xu2C3kb498PWgk!D5P!j>@M%snl>fr&3c0zE&w0)}I>&TZTLVDmWtEtQVGgnsN_ zOgm0%;YSwZ6?_Zh34P$&88?Sf;CXcIzk4h&BC=rFF9qN#A(%L?4?>rI82L(zAjaK1 zq{jM-HYiy4w0Vrotx9@3?`7f5o(i--AM|Ts<*jR<-sZ(OTn(Hd-6Cn0;$Pp4&MlLerHz!>mX0%m;mi( zYFpfRbT{R)zV{nQi}nD%cf)QV%qx{-$IyyWb#T>35NYAK@2|ogObgHf%XN@g@df!> zAfxA`Lvw*10LQthzZ9=R+5sK!?Td=!zeyoTGs^LE5MSa2OqDY+-%>8cd*T&daIpCt zT%{xft3@)f!Z=IfBw?{SxMg1VfQiC<6A1%eVny4$4pOzmPKstPkd3k7k?tJT>~i=4 zf;8jI;CjuV%LH(S)Y&5+W^W(_O`P!m~%`#@`<&AkMa@@>4U#`!nJ*BYy5L=dpZDB_AD;>PK zsKQAkHaA`noJF&CtW^RX7u$y|*R(d!EX20=^77f9Mw`8SNVfwr{iwHK3=J4iD!k$q z^|TNlNa?jcVdl-%rwjr1BDD&D00VOOUt~_V1P)RHNXt2x!|+7^9n-|tFL4I3zd4+p zd$BW!e&Xe)+n9LKd6yZ%;vL<5nBJv+8F{qcg#H#C;af!(bxic>^nC?fbPq7j7k`AY z!Ilx{mRyG{#z_j~{Reh_V;dbl_#F%tNo1Pi|Mvc_?nF z{xFHB9UX!6)7a7f!W`a=VEdJ7OZbju3%$B1mSG=1YuWlj8q~UlI&A%QA?_g3bvxm2 zirD6RD(4XoqfT^KGj(EG`v|gv5XKh*lXs>(7y0xx9UF)vb2uRJ5zKxV&!HkwC#i>% zogQqn>y)k4YEHIVp>#e(NqoKf$=2(YwJbM}IyYFdhw23DLMSH=CVbNaAJZHB9CBPC zwj@IcI0SLbt1+HnRW}eB^AY^`P}E7s7?GLDyy$=DIZmX;oamOZD!)$hAJ!>6Kwpy>LQar*k6%v~fB#c!Dk%8sChnlmNQD2If^7#l;M zA$}K`LJ^|p=i;e-C8@L0Hu!Gc%C0tn-J~g1n}e0jrGjfC(6_YhNEoj}lL%Pg4BRP6R{@(u%uyf= zNkO&E&CQmrvTXe?dNTELGyvHbqXhYv?2D z8nd2TRsEj?(O`XSl_GPp$_d{)vf`KfsJUBWEm3x}`9ukR|J*>jN#>Nqsc!H3r=J zCXP`sPYk<(rzyG4O(7Qk1#_y9q1^0Wcf`h}5*d!xkqTP60?n69a&S36`6_hcmSGXu zS1>Y6Z5{)xhUg)a?}6r=?CP*s;OnyrU`DKsmJ=@+8M0 z*Kd#fnmgdI@8+AVpW6lB1!4SrNCi)N8Xl8Hf@@d@p6AwqX)|1JzM3?#V#zFo@rP;R zJWg9c6jUkG(*1bil#&j^n^+ybi-m}T7Oq#RlNvgr)>$cYI_a^TST6hFsq5OdP{ldW zI5RV*oS%l`A?R#Ol?et%k@3ewBoUkb;!U8nkuqB|G-r^^r-6yPZlCA;!R0UzOoi7^ zlPg-$B>Ig0^)PH_#2&6Pja>9tDo`z%Q5>&V=-e zK1?NQe_=Q%)RcZf%?snpsT|q&fN^lmi2ZC#4;0PW;Fq0uNAvf;AP??T6Y@4wFAz20 z17odo@YW$?)q;HHmFfV~Lg$-+bF6@`w(->_J{L*M^N2&8(at}N=gXJ}xhwly%*J^@ zLL0kqc5i$>Ui(9IXdXiv)Ec>Uyoj~e3L^2*Z#fl@YZqtE?wzcbLD89MB&$D|BZu%= zqRY2NbVj*v8RpJs_q4wc88&Che`zZDGAbeJ4KktQu%TdLUw41-dBLi;={xHLZQ>f{ zZ)Q*X2cSG&F4oRKPP98!!~ws3Y|M&saU>tJJz^-0Y@8a|rCgk!k1y)IdN+ox3!#b* z^O@d`F5i==#ov$u(Rqp0sXbhT1dsxa20u*0lv+Z?);E#BT#V?TIx9p;N-I}XI>;~A zOz5Ls8~9Inr2gjIeDha~zfQKk{rmCO2P3ott%H5R(s4fyDRh`|d}NF|BaT~t+*$4Y z_W;}VwIc6>30|)7Ujwe^pP_i1XO+zW+-avHJ}fZmU)W}Rfj4(!UZsuk5(4<%Jo^y8%Le{48~B3+WKv(t zr-jyNF8GBl!}9zg;?bi24Mf$bCDC`SM?uVjwv&Lz4hV z^0RK5RD%EF6a&e*nN(6}lhIGRQ&D5{-REx@$VoyqE^x67Brnd;lp>#up6sScop0w- zF_7GpNhQ`X8U4IF6$@ygOT|F)&P*yXq{-+P-Kkibi(D!Oa`Ll;aenb;)jC57*L7S8 ziyclzzw9Q;DhL(-neesvF_+;77GdH4ApA7KuTc1Z1HWosKrU#F+!%bCU*^K87>X>wf+MeeM|L zzaA)9)o0}@*#*Wn>nBdd_h>k1E&@}jeG*e$HmDJHsTbc@MLZ45ke?2bx?l}zh;~(w z^?+h-ZGHj>?vPj(H=Wew*EhfkGnkrEMlEBTTrkT_7Z@|l zC|~A$xTRos(LndOASJ_-aNe%T-W&HmUd#~_|Li?xKcaa0ow_IF^=-&R=O^jw&*T+* z$fAyr)oX0oT-s~Z**@A=wwspNkL6W}{WN|3O^W;5^z}dF^>#A;mAoDe7PMU~RDxm1cN*7qjAP z=hl7~lC{-kUDQ5`q}t=nf=A5dN|HELIV+Sqrbck`+>D3>h=}z#ceaXfe{PS=YwnT* z2I`mPZ!RP(IV(d}kj|{vax|5U&9fwV1(R5FBLGVHlUG7Rb3*6jnKMuy%rhq}xjn;N zkh+-@=+E>?l22rq69DFa>}D?YUR5oQ#u_`p-4&0pEL1*{$pHmQ?>Cju zEOVSzSB4hh5O7uu!jd0l#2{dvxl%nT1C5WfuusSdM7Y-?1G&N((!^9kdS;fPMfEFl z%n3{Wkzr0i;{)WEKdMZ)H!evvuaQ~@0TAGCzSRDM{r|AdI+yA~YM_>y^x$o&5xl6H z6N{kS9UcT|(ad5oE@1uGPIbyCuL%v@k#bLt$cRa@R(eE!jLXcpHUpjZee9T^V078p4;k*2XdisH1a%%B^BlpebbLjHnis>w%}em3qbgkP z`3+zMGGj&4OOe_@8f?zV-KJVHSFwupncbmE499-5&HGX@+UNisbHNjskKKUResEx| zlTm0%Z|lp9OG`Q~4S;<$u)*MSI(J*iObt&vFa>IUV9E(<_ieZ(YxV46h!wQGAJDm7 zu2J-$PFUTDP*ZgS>&WOPMf$&>8#_Xm@;C+Bw%Ym^bz_&Rwu9d3Y^plecYznMLU8tE z+q&|G1qT5$^uar=opFr3CuqD{?TluuYe(al}|o0@<;I7nnWUWGKr*v(}$6+ z=Aw*ALlUpyNbOOLTV|6V-?Ckw-b$%QdIgv{)N9AvEyypM7Z|_#ThIig{{`h`On>Pz z_!W22CO1wl2ukY-GB0J7aPuh-GNU-sxE_wD$Gi+tR^Agb@?rrhr7EUBJ%g zqU`2&ygtgVp3wsAyp65GlKhUR%caf)IVRUYvS3W>)+xcns{=GBod2oxoO3Cm^gG4i z`6$P0r5vXgotMm}SlNy__;(AI#ci z@N4`C7cf3-F+|=BwlD>XVqvzLYOyr}^F&f7`dmHnYTdR`VL55H?3ym5rF13p3JB&U zg3O+ttbi?YavcD0H>@u#TUers)KvliaUym3$nU zPQ-mq&W2}bQ z5&d^BVgKe2&->w`)qnv!E?y1WB{1N5Mywn+YzRvO2+hXY{|pORA`rdzB$U0|GqjFMYMfxR zMU{VikEoj{;fnggNUCy^Tel@k@|it|<^02qDG%`jFtS zG@B3yQo&CCzgLC}=%|X|?W+P3gd0}Mrmio>pUvlR%jerU( ziuIkEVSVS@MAqE53yDyhnx^)2X-1}|8JUu1Nb)27QSzC0OMR!cA{qx{0x8sYTJtrE zC2KLnzbVbj{3-bJ^Z4-D0j5oG9s+y1u%|85?_awk%%EA2eOWgXN9vh=TD%~|haIfR zjxZ<*B>Usd+y)&Fgyk5Umm)0JmGRodtF|j4?~e&yM_PLAFmA0zKck3yj1LS7gH`ln z7WSb}@+68B+q~XJS`xiwdu+g6!|r0Ay{;JWZ((=I?XF0%YmcAPK3VBSptwtC4H8dT!APSL_hHqJ1-Si`bWhT)|eUUbHa0=8Fe7vp3p@$35u zU@&TI1TVbfBGe%%-`v`Risr z?F=V26U&HqA)dB1GtnP-li(FPbHKWV(;iW!uwgFVljk{;Nx#J|M+JFr z#_A6v7r2>P>MhT;R_o)p4VBGi+Coqs?yC-0R&4~zP~T8x(_kPJ`@{f;i-nv$9l zHBl<0N+qYzq8hhA@`?eLNsZ^O(}0*BfFdb<0mneMq6}^&AOEcy@-P>n?Hi6(p>%@T zQG78%{UG`o7+ps6fhhCg1ng6%ndpZTMBxe$tz$^Y0xqYDFR2|#>+2%DN=s%xkh&gi zM~_;3N%CVkV6!kR4PsqFA!!b4p;=7AM3YsxXum&C$#z-OhE;6U>3}d7Lz%kb?U!>z zu0BDI*$;4Lu@0x-r?a}@BDU&@-8J_SqZ{tk(!wd^gCK9lvT!4r=R4FZ>M?iIW~Q3V ziVw2d+P!OYgZn=1_WWrddz09Q7=_faiDU$(v60n>O&z*#m9Yn0GlmuwM=9Z$it*m^ zti@soq1aF?mMyl|6ZC^8`}JYF3Q|IP30iFiq<*LIwQM{CKA!D<*dEEoGvMRdmWJ(l z*?0yJUy#B2TO@BhJs1_F7IO2gR4sRpM<{*1w-OI~6vu<4gBls7U-7}7&Nx*)nwes0 zpxK97v8IAUp^xE?C(h*@g}mNI8t_jv`hjL0+p}r#IQ&C{_Pd)&0iSMOjA$Ajg4`1t z=55Y@u-WZ5oY=#aStwUtX&<7HkxcZ9;<^VmFm?!TIG`=Cmoy*x(3vd0nF32~4Ckk2 z_QdZ1j(H~$Wx|#51ydA+eBa3;X@896_BQ4ye6bi8r`Fl|y_l4dhaUo*#N(q7PYc`Oswhul)IkU5xSGBRPj zfuk^XY11x}(Ga?1B`7(UX|1dTG`IvZRb0V+bc(o2)r!kN{rE0%1vuM@D`b9?5tjgn z`}}TkX{_m@B10qQJ*>xJTNOo6(z`SjUQ%3$uPcl|d2U%-u-;Fs`Kr=1vDY$j8lOh4 z>vMA^CItQZ8bc5iN2;t|?^9`5l~O?&YFtBFd2=H?cQ>>k9*iDO{v+Q)%`X8n+>B#&|hQE5M(>e z%XS<`En%CEF4ZbSU0Nk58KwwUPy!mKQ>*zqlLhhWDY7a_t5pW-`*+n40oGj&5i-A@ zm1>m$NPfDP+*WA%WiKlOi@F3NEV(@+5CQc?T`o?54aZ&5yoYIQnbOaDE(|pOll}qz zIls+;QOUC@DR{aEsQBRdYaE~4ZZmzN` zRa*iK)SuT?(*?M_6N@1z{7kQKThrONc~vk_U)K11w;l*jUX+nR5TDZ25Mzv(KJV%mu$kV)6^~nT{_p*Cfhmd;;Hb+7Lr~lq-HK!T?-i%jpP=L`j{5Efw`LMzHcXzqCk zYg-<|%ASYNapfU&vv~;Hi9Cd@RUX2IHV%u zu}k4dmjN?uUx`H)-VlTicziq`7&LN@3nj%n^SI`Oliuu}i-giWe;@2qhw_-D-pNLV z)n)zCu`e0)m*J_E11|!Ks^&s~;*&`T3^;be9Aa>X(9aOoet#yR%q8?=Skx3myR{s7~Pv%?ssU;9XJp7ANgXL}_7sDYxakAGT$VfRN@$ z{6yvq{POhe2LSg=2g~zTnUPg;Q(LQIO@A|un-dufjz2TK2j|6*2fob9v-BCrgX?>? zQ8$o%Tofj%sxBK4t(L7^(_NSY{yOd-3{E*;<>JDU7#qvU8Z66C%0p(g)ShI0S10de zG3x2kh-di(9D&a9jXkg}K4DuN+D!75$)Be~7mp~^b+Yi8$Q2B;L%jU%34$a`rm!$N0AMK&nq7<1+D z$8bk@DwS${AhQrw<2Ck)84`qJ%m!5q+7OA0Z5-4j>EDB=E|BW^nlnAWY`O*-$)GWS z9~qq4k8PwJ9o0PNyoy?i zKZKBd{V-l*SUhsjX6foh1G9swjsGfG+4v|%ZKW0-CG1Q1!9EwVh(7`%1G5Wd^HIDE zN0>kU3S#T=+KV$FQX(k+opPfQ*<0+eKCq%XyI@%|?ZxrOKq}xT(uoIm$!TKZ&GC37 zcyasy@o@1c?Mj!o`^?7yi~pUn6hmAr4hIjhhl(R3s`5`T`az}(Yc>1vQamud_K}ZCWc)DFXEJ>t(B%Fdk^MPA*cBJXe?hvn z^*L)Z5iFki9KAUyK9X`m>5qX@2IpHyhE$&R>g#B2T82(ldt|vWK^XsaDmPky=k|Ij zo2O%j%O0nS62`Y6@mk*eM}gb)4t7O@<#r&Z_#OxM&aR?d{UwgUSeMo(kjdzBuhH+M zaPwWh!y&mfFrDiai zr9&f3aTvJfhyps-CFk3R{un$J?VW6)rHfV^>j8XhLFvg{5-oywh$Qewz_ zk9hX|`+S#v3;V?f8rN?+B3mzbozSa%%rf9jo|0X z`~R?aB>+(t?SJOoWmyinL_`He1VlkZK}Azj!2?eWG%He9Sd`-WVDU&zNF%$|)Fe%< zv`jm!G_CAQjVz7Q%+yZ1EG<(@zp|76@0po}U04*&zK{Cv!aMK#n|WsDd7io6cTTNl z-kwe0Khf9p{S&h3`$u(W?fV~uLgOj&vOH^nC}~hbowYC$Ok$ry6j=A!eTW5ZCQ-;^ z7y6NfTz}eEJgy?L{`6?=n8z!$J|qRH6f&P0+du?o?L{T0!Vxx|h*hq%bCPlzE6#F8=qQBSBR|eAbnJ+ZXIFq4O#52@g}=As9(;m z6PIY)G_`gEh#3DcV2+-}_9~ZJOBzXzhItSx*^by_Ey|BhSd2eYXK|W^Y59w{|21b*S!0 zfYM7zxox1Z$S4@d%@Md+bIL$?9R-`fNxfEhl zv<>?W?(cyKesTwz0F;^LNf-F*4u68=CG7L%B4>-MeZFX6LB0EY zbz{jlTle|Wu{7`xjxYyI?uaI0QktaKZ1h@TlVwUuD}mUeAS$%lLx@OWt1B@o6+~m( zE}~stXQv<14gy9q=*M*Q8on0+$kVl=;;dTos8*a0_AzyhybWpNNev0Sc`1G9Wlp6& zGQHSK@NtSqDYr>fxLPVfszv8WUDaY^$xr&(tnk=-fwd2`!j*XS(78%>G0(x~3@bO* zt*>1FKzYmpy{;E>=YI^9PO4=%MR| zA|q-Wsx|W85sI#{z=jvFW;jJUx76FV_`Qt3F?M>%lh00l6%o1A{`=0(RZVcQxE}0E}&{jCzb|@MMJ2!dMWH~ zuvsbu`)15gvrq_|B+ed;AZf?p=b)L{g9wm7R41VWS?&*s7sZ8$0ZAb$#F@l}u4pN& z@(+V6Dl1f8)#-q>_kR@3HDn9Enly=Fp()n7oQnrpw}^dOIvI8OHy~PiB^M{k(7P*g zHhYTFO;_|j+>nh8k@t~S9KMm(q`jxVHSKjGo~K3riTnUz6v=eQ;c*|5kg|Tj+alX2 z;?ZW}J6tTnKqQ*bN&ZJ5Y!WrhPZ#;IU_xh@nM_18kqzW*NUBmhqE)oO-7s?~9MJ_q zmaeY(pHMWehMB|2i-`dGYw_xiCqc3f9qqb50`PikGiQ!62a1p&XiHn`kwvWtji_lv zbqhWzv)R#;g#-FeMf}=K$`Mxj{_sy&O{v2dxR}W4A|`T*)h}qSDL)~nNTG~HpCKGi z^x{}(ehxB5Kds`2`?y_oLNxI!UL?_kpt@)CtObKVVS~s7~mNbP)MZn@Pb! z8)(h2Z>ET2CIv6)u?|Qe84u-V#(Fhp?Cm|L{*7$I7UIfDol#^l=f+%RF3K-1%rF;K zKV4-uWtt14Lvo8U@(XjaCq;*hH5V3T=jZk58WT%@(IJV&IhNu=bDunOv8B+I6CILL zJSitTW0-kHTKw4N70uwB{7I&q?3+v$C^SatF*z?Q|FY^krGFCr-}n8= zlDOgD-fF14{kG3C7TkaGkL3?MnrU1UaqQP;eNuBaC2n5#{OG7&Th~1@fNx#H>oyZyjfu>Zvs;fCSWWD1&yA{N7v zumy4!GvQE!9N3P)23(nN$--sEpc4g;JZA5q5aiR?U^r)k7&AKU39JsOaJ~tltg1~g z9RBlgdQCCzlR=OOzCvxI7!EEn;Fu#qFtJH^GPCEvdSG3$8{w46Hp9{1)^Q~K=fY_V z971dzQW3Wa=jNm#5-Y2FYZIkGI1@HHAA%6F!Q>R^<{c14*oI^!B6$jhB*|bqAK@Pa zX)lr>4;E%{KLEm7@JEgp*7;$IsebQLJyPysBhs^e(z@w64IYL|E-8^I6-ZPIo{70c zn7L4RK3LAj8_|WC^>k9N7g1D;wAguWy4e2l)Vm4H)6tp4d z;jF%3ZH4;|K_p!~XLUt9g@9smkV=z8X6n*_RJqFoC;i%cv1P3TUPMCdo$E%6^Q>*7 z?b?87-+&jJXvvFhwB{yu(UNoBXeWcHYd*X2A`6WkA9=0odb5rGA&`XCC8^88BOvU@ zP%Sa6cBrB|{X9{JvgFIwjJi;`ZB!#yU$ad#u2W4p#pVeUn2{Kuu3is~_jk>_%@8kLtb!y_XuzcAM%SZ?o-DoOEQL+3cIL?xP$&w;AA8zqGsT6yM%=AJ%yU2tQ2 z$e_WA`ZQi6lJJX{xwx*w6O)r%mF|`15QEW35z*yFLF6*e;DdpA=T6AUF0!PW zkzyuGexY4T`eqatS@Lt$``k#RkOvY98mK3Un&eK944U#LC*#A1auPRkqk&@L(cE2# zODyV12@OkzwxIMu?m^lNF3c}3pjX)z@v=Ik&d8mVpW|oB zE6Pq(+)69AJX4;03b1mB(vY2(ZJD90t-RV>H&+tYjfoC|en%7to08oE)=+ zo_RtSN!gRLEk!oPuBn}3q;oT?Kq_8o+uUlKqLiFsvRKT8dDZqKmA;jIGZ}I%+W^I6 ztw5~SwW$3SwH+hAnIuGN@uVV4wxyUpK-_EUqPo>cGt|`CnJB#}rotj~|Dus1XEm>7 zYfUg$S66QTqpWQ6Gur-$(hV<$%#G?+@q}?cWc?@u+Iq%28PN7J9%DfBiSl4T6Gk_0 zX-S=A+RioZ2K0_H-AL0&gC8D@);wTn3gp(w3f(9uHwwrQ0E34c@F~o6pONOguc@m`I5DKL`3(1NUE4H%AKyo&*YPKQ3CkXn9_#11x-niLw>JC}x5?|Szx^wF8Qac0x%%_4g-#PQ$|03Tp_8VR?8h!sc zz2DHAiL?Lw&y828{`2U=<`PGJ=+u91?K^LO)Nd#Cojd9`Pu})pQ|dRTK67h-IrWqO zig!w^n-l%owteMDx#~W0Gt!az$f>WJ`p4sOxAu?sf*bXZQ{VV>*kkRE=nwCOS8iv2 zcom7^b=&rbzX_rS_J{8S>7VEi-%l~s-^p#;#g~r{jEm|I{}()5WZ$Y6 zdYo-KIjK9=mW2&)zF^<#lOVc;PR^nDTDm|d=hq-`(K^?uh#xoAN0Sb znI@%}CYzl-uXaQ1q zRa>^G2+5Z&UKK^DKXXR5br}t^erTH|_XgDb0f&aKrKkXfAA=@B0tf_T^>v zNqp&*pDVVNKJ@C#LC4KImcKK3=g$Kx_w5h=_0VR|+>c++Oh0?|r#`>Y{8*YBJGOj- zKlSe&UlQE$)Z(mY>gT(;Gf%k3_sx`dKHO}2_~@Rjaq|b<;EsN}_t9rZ^Ig;MO#OJ& z?}vpJ;&%Wh&5L~m_!wwD#eD|oX|i?#?vLU+j^}a6+b!Y#Bxvu#Mg4x%4>%Y0G-C#f zZP^@L!$9*gt`@MT{=owD&-@Si1?{G=T4$3cf>LFVIIkOeT}HkJDJI_LV4iN# zMQdmt=7ogS=h>E_wwO86u|C4OOtk}fZ`(Pq!;yeR7cuX4I|7J2UjVkuU60u;G3O($ z%isif={-fvqbj-&qG}%yJ0#` zuR^etE7-f(?7tu0BkK2VtHFGKNK-#)UDo~u4}vwCMNbp#FRo;IHB+oP_HN7C29OHY z9Fx{%?MZlW_8QB@Gva&ca?RQm6QBP}GmGgh4ec+crs08RgNg^5m+7k4>Jx}Oi21KB zzhPomeN+x7E5oPwdE;e(b;lb3!s0MOLQoOmcMLcJcOM^#BheUpfi@C$A-MYC!YVSD z_z@rKN7T{>S(J!>R#HMwxbTOE?c2BGPBvBIAG6Kr2^apzij2SbM-$=B_gjx2++mdC zM-K}BOn8;TzpP(Rj)LH6kP}{2RrND@APi6E!yvbFuZ`EQ|HalF&b9E7X;OIfBu&yoT`Vjw!T5`_MRo9$ z&nX{=;IiiP58Zh*ulE2!ETK~^`eGa>lCW( zYb{i84z@W5+pL3aP3=}X49v_%F>|hTP+KTC$Bdj~Mt`?4qsHBTfv?@#FS(6qQFNnb zF3GXx{-RzLe@DYa)H}ha^BL$|5$m+kkx84SF^@*AxJJ!fBVSJF)E%<-C9c=QSebMG zCx=^8)gD;?C++_6f*~ zx_b>-9AzEre)QR&ucmQs8smO-LVoVMdO5DW3th_A{hw%`rZupqpLPGIQ?SF9jw~9L zI5vJ}*r=2(fgcm>Xsrv4kFNp^jcxx3w=uYAtxFVWTtHKS=Ns_+5tdT?55~36JA6&! z+o84_D_KX-{%iX`(NdNR4qv}Tt59s&w2pDpaJ>EgPqbj=lE#P+5F?I;e{BcGXvsp`< zhcn=zuLUJy5=PhM{%#jL1%P2ZI@M-o`a6scaajwM>h3u&y7#tdnkkj5NojF8sBUUWTgH@cT3&J+1(oev|1yT?daT8`W8NeeW0A*!L|2=r+KXxoF_{k z%MJVvejlWNVqbXrjBen*@YC_3dr|ws(?|4QaI9!^n)_m+5hktY}w=7d&0T*gmdqSg6h*ZoqJC> z_nxphYZDu0+Wu_M*)%#2+Qe&c0}k43ag~|QRkquK!Z{n$IUCbC8?!KbQnAHcgwIHa zXSX-*H(ti_a13vw?}rJ4a%qm#e{p`)KY88rm3JH~rGA*!-`>4&#QR?_w9W%de7fnH zd3{ele*Nq2&(OSs8Q0zOJe}iLwz^`==%`*>N4bCh`mayzJkWd2$b-xN_~_t+J^LT` zcx3LW#rJLfJ$~o-D%<%9UpyBPN%Ip%_r5pY;QoHMlVb<&(U$*CX(p$BJ1pY-m^H3(u6OL{M1y z+>oH^PK(G!=T9%1n?c({7lISo!@2-`n84SC<2E3(MAYxywln7u%2)N1)@5xib=uT; zNCQig8o<&3bhLyz@<#JdY9{L(aZENCN}xTmQ(@kO1o#YOt?PznE7+}A{v1}9q^>}> z(K_k6gpPKZ55v0U_&g+u1%0>0$Pf*cJ^~)Y9DB5v|JC{kYir;&5QaDk(N+i9m;@K$ zh^Vd>ZUkwhBT`3tFk6ompkavPuElRJ= zsiP!{#8{TIW7FBOImwiheUliO$K2oC0#l(m856pK)%IM2bMkEn(#+E>1Y{ zgOcbXzW2T zWuTin4@c6P(X(y86|8Ni@;Z=S)I{U;@NfyUa0jE){Q|RazXVBxX5oGXLT5Akr<>UU zjz7cyq9Yz^pK|FuIMaD>CXS)BKS;CAL7C2jGtn^rSALO*#d&b%g;ni5IJ0Jm&^gA3 z^XoiwCuA308z-p!qX(FZ%zuxu zK4)(&UMc>Wd#X;yOvpw*?;bNho%8N5-~I>n?R{W7Z=U)hzlYkbbKvQn+RJT@6KbmjR!iQwyhd%hPL5G=h*}8Lf zr}N9t`Q_*Q@^gOq;c)6eyy?&j=jEK;>1qA)OEFEZ`R1c{s%xA54c@tFIcouNTc781zcos8>#(zBX;? zxbZZP;DdEtXZ1tc)%Pw>dz58hzQ8lMGC)UbRqw)`&i3sEJKD1>8FNoQhaJr?2*WeI z^M3?4H`viRzqEhZD|n{0t9Ri!32&;-?}6IuR_Q3;3w{smZTR;9ZF%-5rWc5v!y7ie zfDZJ%sObg8@DM*)EXXSsXV~Vm>6o>0;YF-|SZEsN*rWZzJUY(TAz|%hdC!0_#8HU0 z^C!ljzK?K3RCh_<)gX;@MCxck-dPY|!ZeE?;q3y`EbgO~uKDc7T9ZQR^1B3tF$Ln| znC6f)BoVq|nQ80VUhLJsw=PL-#lHiRmiD38s=OF8P(tjT>oPwLM4|RXj@0b$oJx|_ zrHk{+*k)OybKN7R0HV2e!xTWKN88NKzx|dR%IzE#MP17(XDJCU9JI@jwVsCpXU7oRVS>3W~ za#!v1H{Y4C@JPFr6;-{8ADTWCBGXzX`W53^k83a8p^J;|KeStQWZlyKBF=qXhlpb> z*g}dnkxIj!V+9T9uOf~^YI~C195pBG4Mw*pc80PKxo&627a(i26=n)vD7agy#bhZi z8el4H-7D$aa5pTU^XNYB3NYTU17jNRn-H>fWIpiJu1 zaPGrel%1c~r)x|s{Y8hUajQOg=3+~sDJME4rFc?KcE&LCjQS5p#`)Xl8;>gdCUSeo zghwi9&1%fMKfPrgld?S1BkfumcRIT9?VA#i@#`CR+5tB@JBP-f zl5oEc*t$=u^_(0UXF3Uc8ef`+i^i9VKsyBODhj)<=gWS*B*8G4#Z*gv1L2{vJm4!4!4#h z7V5s7(0EgHec?J9lZnOfPosXD`FrdnRCjr=bGD*$wxV;kqH|2fIVR&AlliO0WUve6 zBy*;7OeX(Eb6%fGJ$n2<8Ix(eFKo{K`kEe9vF%>%jaX8%Z!+TxnYm2M&a_N1OfhFq zo?@}~Jz+K;qsyZaciT}4Yxut31U?&me?52c3#nsLZlVfAo;9o?l23e>7XmEI;Lems}-m$KsyN}n47XhJQ(s+mwIk6k1Iwb+MK}t)uHHz^`XrOZ7bq-oO3 zn~VgU5uuGp9c1Cje7MFr0_ASF@J+{kDI7x1?bcM89O$MR6{U&Kf9$z0k?8p)HC=HODM+roG8S&-ond_BpJ@EiF{{40JN z^za>jh`)yrbNQ{1tUZt6qj+!V{wQD0-&Qn|{tZw(r`v+imh*RcHuNW@JHqq%Hc;LR zu1@iFuziu=hgjlxCryTUEx!`F{s@w9N8Chx5dHoy>XzGtB{}<$FGSc!pqnEIaU=hX zpW$0!K8n~vv~r)2H`aWr`bFbT#EdrJBSpu<_QxI=EEU{KVmFJ4!RLqNk=NYj=c03q#XyY z`tVlJUlekDJEU$h&(f_}#rSNb;cTABJ0gWTa8IEJFOdU?PEt#=BlqHMLDv#Fdpe)S zr>|wYrTkjtr7=7nE-~=$51-PEg!G|E{SLgdZVpPxLER?Zy}G+~Yjy8bu_|U@hPh!( zw@3GgVUF$*-5x)t+otPb5M|4-9OdgEo_pxF!5*be+O($UIfgd6Il6t2`J-t!}Tt{K)0e9 z(`A6CbeK2ja&Tqo=ISy$nQkWPkE{7aTqCMI)tI;YK+v7t$2yZqY5$J*ayK*CIR@!e$TUI@GCYJOjM=@#c_f zBvSM+N?kVp66GitCGl$13ZI}1w%|QMl?sW?B99(axu+>gaZ?d%7}^Src5dOW+ymD% zr13PKhk7zkNhi}t<}1qQ2UWfb<%OsZW%@`dB9JZ*K{}Gr9ajgGskC9>Bi2d07_Hh4ltA)19GZ zBWlA3P&ZCPyB3b;m8eZNpstNZ8~6fu*P@`W7}T5oS}M$!P*$b8q|HTseOQDvM`zJx zBX=&*ZP4w|9m2H%&vTGR=YY@Us3EhEf4ZU_ego+h!c)LsBtpCfp~nfSTO7NP$m>(^p0Ep-s3(-)(MY=` zDu+g(MqiEc{R~p63(|iNYC|*HbWg$0Qa%iPJ%sixT+pY%|3f0QIjGefrD3U( z5P206%37o^a@E^N&mi6(HAO3Mkc1j#Jo4|A$kp#azFfXX@fZM^1N0c#!`sXN)Z&9s z@;^b`ccawZ!wo3a2Bc{laNfo)6;n{Fq}a(RQ!x`IZ3lAg%P6}OpzTAvoAw@fF(Fn; zPnmN)!6~(gH$g+Gd=XzMLV5(X_w`ySpRXy5}QFCZUW33+8r z*&F$Fg@$}*V44oOuNS0P#RsB<9#j;fo>zJ9I@IddA(wW=H4v#g0%`gVe*)#|AY7L4 zkC6+LprItBcL(H~4oII@aMAl$rd__3rSn0^`U%3=!9PXW*eSI98no9LZ7t=t$*42j zP!EJdmmw%yK4@15ApE6#l?aXMp{ukqzF1qqpMvBoY--mGxXIdRHcDMN{Kp}8_#xC` zqE6B2n5J=^j*HwFfU-LhEp%_>AK9kKxE9l_bVvdISAoRXy-}XqoBX%RS9j1ygU+V z5rkBBLp>ZWYc$=^9t>Dem^9n7BNG24Qxx`x=+_lM|EXWw4^Oj5~m{M zVJN|mi`*E1QprKF50uunLrPW-oo@zryU_-upe&A2C9*rxwmT$84F$hfinb#O?Y{}! zwFGx<5q1XnyA3HK>lIn{!bBU`1R763%z==k1!&vpmZBx3);vWwLN`h`8dnMswdV7X z|6GvD-aJsFFkeM&k_jD0iM$$)aGrx!Tk&y31zzS=x8t%6lyZ2Z{__TBTX4x%Q9k?d z`;m8yXgkSo2grX!*BVj>D7%ExIdo(Yi=oN8OygRCA5seO(#vi@K`zHyY(79>8=s9!IOf^EuuI=4tK?^HZub zP?PCkmWUSm{HCOozGMg@Gz!;H#s7egfT6_};!e+?qL9U%p5a$uy3>Ua?JlDID=&(V z!nej-!w=cH3O>p0G-y5rza)daTG8ED6~Hh8jbFzr{s#Rl?>pxwU6%PtSMGXr zF6~)0=DDid`UVcW!*9oHcZI!PzVPA6pWJs%OSWWv*u16Iv!h=s*z>@&O`(sx=Vn~H zVA;lXUoO4-@h{K4`UI`9pR-}zrljjAcLnF6yvl#E8Q|zdrTR&7Y6?!n!X1p|HWnx}^D?{>-z@>GdB^ z`H9x(`%K8urRLR`Sf z1X|-?^lE9JZ@izs^7t>)2TTac80fvS)1YZyKFMFid^}ti*gS>rO-h?rdB@eG1|A$o z`v4rjy6W07t?s)1`3|p5`0<4p(-W<4$Xqn>*Sw#i4(AWb4KB#ci7DvX?5%=F_h%Lk zd!?$-G-~M#+B4wGgHvb!ijFLrzeV$|Dsdghit{^>ucu)CReKaiZ!FKX?hm#Q^F7XC z^2y_Hn~6Es+ps1##|NJA+lD;?;?VVF-9L=ZoqZoP``{-JbccbbVm{4n=tE6|T@Tm| zq`5livizejL=4!3mh zkPiP3fbXNAbA!Jta9;u1FW~1%#Fv0L)`O=dz<8BqkHOz>HpZxfpehUf@#I-@uTj131W0*e>kL4l3|k33%h zw#+>O;+XRh*JY570#BHP>G~G@(YebhU@}jfPjO-9=s@tu`aRpvd!u8)>m{x|?~M)z z534U^TaoFA@Q(En))kiy3XiUj+|j%@Ixc)jMy>ob;1cykM~LG*dHc*+e_;0dd-Y;G z*VZQ;H6Gv4m~Hh-$B&C$No>ngeJt12H#H5t8yc@8{nIh!b>gQyIvIKN!a0Tv|x4YB8nW74{s8wC$B^>gk>S0~`5jGx(;HBdhx#L{T__M+R=4uo~k6G|XFFrF{#}y&C4(QGGcd2V~dr-tbr2JK#N{cI-9YZKZ7A3WdIY z(z=p$fCse}cA{CM zt*eE1L5jsfHR`gGI?_WyTND5*aYJ%+Av^@yda&ivJJcpIDYUxW`GN$Bmvgr+=H2lr zc!c5|d9+vjuy*wj)>ixo5JK^FL$np?dk{hKb&2YVb_S$Sd|gsUieC^`@07G;Icw~4 zO+vfWb0~O!hQ6-<+N$VFo1r?O4v)_DPR{jC&h<{t^-j+9PR{jCf6;m;W16|hl2&N0 z*_pjxoo2`rV>_&owB)Q&v)8DZYs4#HQZQKAxOMlpc!O-@Dcsoi>~p4ZT)a6pp{H2y zbIG4t&T{PBdvmP0@XyVD`g2+E@9?$ntgHW28av+u|EZ_4HtzPrneQ$=-#Oo}{`v1$ z&hp_bAOG8zKWF=a-nvWtdTZRebG9G<{Px3{#?CZOlKb*s%A|o>JMfE7%u5@McYdEc zzt1myckw@^J7*nuIqJZ_?|y2o6HI43lA}h~;w^p3x0|>>qzlz|MxO zqpWE7I?CN3b$&Db>G3Y-%*UMUn@kp*XA(2AICqk{kT#_>S(5Xz^4qIz7YFC$+Z^$W z4HnI5*}3K#I>$%cCYo~0d6}j{Bc}s#xtj)4Y{^K=wwb%T0jsnb+e3z)+^lC{*~eyc zpfG9`=7vMF;<^q`OipsmD9*7I7n%*Z6Y{WWCSoueDI&U@r|%Zf#z9&Nz7T)JU7 zD_LUADbseYaW`OjCew{HjWl50Br~Ea%FfHS%rIbiB6I6xg>Dp-8wF&*dO60!4Oqs; zbf1@Oq_t+^N7V{l)*sEoxBkeUFg8Nt-o!EiY#@nkFNpVQRZ)z0 zFtSe1w**5d-Fjj#XbqKNT6Tfl z+*jj9OhBvQ^2hMM!TUEBXfUe1o%`(kxtS*a>;0hrn}<=>I`8bI`MD3A{A2k8w%;3c z*4dJ>&W8rv{CoADKh|^4+MW8zVBOc}nRmB%>rQeX-;aAYrEim$j*JNz65S$v&ADA- z|DM=GH}s@Ed+1!WL9e8ZqWyT%mW~@w=c9d+k&#dP?C9|lV*Q@UMP5FP>`cFxaCN~& z=c6rxeKBf;4Ad3R;A#&)^sSSEJALo;g56rsH38kDu%qvv)u2CyXF6MrzJ=(G=OfU) zh5K&U)0t{>ai_g~;^FTuU^>&v`Mp$o-uv+jMxiq_ynLkaHX^QLnw0{n`2mYcJ;81i}lh zWgmz3uz_pYuLWs?*RuZv;_lhi8_`?W8aL!B!jX?nKU zYG)&@$9GIxH!X+bE#wl;$U6>i7dRuY3~wS~4LKukJ_ut9L{_DI-VpVL z*fZCC5ALF;h+YF(xWj%f`CVMo%heW?KDPZM)WhOu?F5irCS>KSzR_!JoZT?g!;v~8 zcT#?i7ql}XJ1561p=X}xl9K%_?zs~(Rhl-Hininp;OB2Pbzb( zIjKyXz0#dy1g&}}d>`zJPp6gP+yJf*#7_5cE5XSTC9uOC`@xG#gS~D$p11RlaM2$5 zdvKB!db3?{(Oq6z9O%%Mr3=CpimL;zF}OzH8i1=O=t^*&0PVP+LMG0aU^rca;rRqk zX<#^=;ULbHft~g>%mp~x;YsjR#j*J^PN8DF99Jc5fGIY_oF&Y1VG0*sg=eD8;-JvT zJ&TijmhhP++$o%La)${DjofiggfPi}CB-A$D@6>I6oN+XmBN3Ou&ol|Rte7Ilzp`} z5TAT5S9g++G(~blBIpW8g9O3^6`nx@lPIi`K?*{e3=NV)mRZYd9*etGq(`q&!n|5uM0aLOKzPaFtRKrVvDaBU8jh5)ki%Wmr-| zvIjLJ0!J`Gqk}u11P3Z4nO|!plOah7%Y}qQFJmPMDF={*WGiWVPV-+y3~RL2u%Xt2v|ojKTEs*cR3aYKe7Jjm%nw>GALds0asP2|pC(P{|+8gc^zyS%iBnH`2-?gm+fIS?IHdzZo8@t^PsbijbNaSK~ys z(KrRl>gxxW&2~JDvxaWHgCoU*2;&4!eL98ngo1Edp>uHHyJFQlJubtwPQ{h*!IzQ@@>*3=?xQ>xVH^Hrpn3PtDYdJ4Wz z;M`1^Pe>!%bb6cybxQL>=+;m|wPrYf3nx-q?;<@sgdFlpwOR zUWmidxk%QxL5{b&lIAF*_cM_Diz-d z7$LzcXyHgP;g=N`R~{Ev85dV2A_mUNiYw2GtIUe45`4fpt30l}Jg%}lu1c^4>a5DR z^2)f%%D5`QB|K+U#g$jZRaV7S38oj2b?Rb%BzH;kt|3DC?1-I zYN1Og588rypbsbj5<^5Vjj+Hq*aTl-1TiCMgpI)98{}|@1%6c`&7ew1h=_r!L=qzX zk>E&SBq`-NN+P5Q5&>F=nkj*yOQ-`}!ZY*%1wdkm2&NGhxCWcx3ydIU1dXr}7<_{q z?y$g575qzySJt8 zcF(khV?xG8T$5e##=bDNuvxdhVY?TF4SXQlJaom@`yL*7Tfe#P%>sQy*&C2L6n)q9 z8N?V(B%j(fCN`#9Y>%!z$i@ZJrWl);$ymFa(G23QAB*QyOJR22WSaWP_PvO!1MJ46 zvejQ=W&rHk4IY!6g!@L|6PSb5ZU7d}5HWuE#^G15dj3kW0_GPU$1taiVn2r~5!WaH zbRMzWanV%yFK|Z?I3z{VZNwc`OpmJ#t_)nOa8Vd!Pcon?5t!^SjgQexb($Yf?*U|o z!Bh5&{;1xa1-Te-I&y@|QN0%%;?f7tWAJQX*TM8-IWAQ&i(q=O*}`?9aD70yZgzPX z^g$ZYR|uQ81pN_Veksh8Fb(XS@TE6UnC%Uon9ZMHh=G}CppfSnDBf*w#jFfh;>yQ( z#?_rg!SrK8ja9I@)@X2XXH#Gr*keYbJP9*^jdM@NiD7x}6vAEZNA)e)G55FJTQW}% zG9zFbSfU5fj}zuiFuhm@PogjIB>NS@?AnB$O)$OK-A($qc(F%dwnh)dk4?N-TQ9O1 z??b+B@gd6lh4~iD05;G!8L`Cp(Q}4hvU>n~3}z@xZ~7z7)c&>UQGII`;ZM)21IX`_ z!u$Yc54MtK`?1>te{2%Ko(-gMidzuP1I@_n+>-qM*y_h7e(dI8N{c&%`E>BZ;OF;X z;>V{o(ImAdn%EH1_K~*a_g9z*Ih5>Iw|f|}RD}@_!@^0%1>q#!mJUBQY0a8Ok&LUO z`ndS9S)B?x1+XohlimGTRToO5kGoR5G4Vn1ek@s-lY}`_n2Uw^q%hwQ<`=^JO_-tG z$d{>G|89P)6sCc_(2cb8PB+rhmoN>iL-(Wl&Mdn-<;nSYHn4xgypf#~HcfjFw_SP= zZ)19p)HB8N${v(+J{Hf$1j-=;5)7cpz_TB_HNlb)z&=YzcAqQ4ac7}D4K7!+>w8ix z`8_F?5@FsaOy6E)(^HsJg!wScmh8t~lz-Y>LC<5ZpywhyM`_d1XhVla$`!9(LA*WR zo8mnSGk{&)hvZt+ha_E(XGjXuj|KI87?cq(4Xk%xDhvDiRw0c%uB23G4>N#Su1t1! zXB)4i-2SRC-xKDyFi|@Ck*}nF;r;wrW^U$X{~&3)qeO*|XeVVD7oCldeBi6mVXo(=3k zBDuOI9o7HD?nPA>z=8%+EFEBmvebc;>)sd`6c3s~L>UDWIbjf`+LS?*_hupQxwE5# zNK&uCly)(LDZh;$OnLQRgDHe{c=ltj3iExK0qpo-iv9Fp3e#^0g_$~p^e`2sf$fKl zfwf8|a}-QJ_I7emycau>OlkB-a*Uw|cOOc%V2`1s&y=A=`Jyme4Ws8JFumA;VN|jv z4yO{db@Gl0FALi&6~m>%}#9@M=R8lMWXexqIe)9+6BFE8zxW_v@b-N4&=s~;)zhU zaPw!)1)42TYt~Mn1wc($dz?cBaG;ynL*Tj@kA#`TN`+fEkPFaV0`&(9W`o%Rfl`1vuw=GcpzDA-0X-^E z4$u&+yVxesEFdEr!(JC?DNqwgxfk;Lu!o?gV6^H-h1(XmxnL&$34!(re}(KUT2dc| zArMR?p2mI?Zoi07ril@CALgn>vWaXKYr;wPAfRrTM(8I{gmAl)br9$ZAQyHwixDUV zs3&`tCGt}En*?? z;Ps+EJID@j5AMV61scdc1R@z$fwB+#n7t=L*$&hM=zW2910}OR*dP2Mr1;lB_;Cu- zhn)dJA>u}XG(E-V#)CDIs2N^$`ZIUlNw~Fz+h}N7qIf~sly}uA#fE`07^`i13X}?D zU@iFo;m-`pYk&p|G!1A9YsE(ibdUZCq)`l?qye&JBEFt{ws3n4loMGWLLolv6%k(| zzf+($1xn^i1my<^C76xi_e1AMkx|6UDE@%f6k(PE4P+@moQ=YgLC(fwaUf@R8M?t- zES?_~=BtLDu&EU0`-VPv{=v{6=Fh@(a~+81Hm=Dq_qa}mdC;|n#@4T-X=^M3jf|z- zxTf0g)5gc}{IZea+9S+E!u(8_zZ#!_y_=hG6|qRal1AD~zc0E`IJ*VqVPR6dU2t0X zi?E;W{tC=ecZzqBdj-q~-FL%$%>8Yc8{Hp6`uyVl4$KxF2Vs-o@gbgvdwh!LOb;rd zb3ML+DP@s!XzXyy#8gyy`<5KH#$vAxr*0 z^=ZS}sx*?ZxAUdY+6yyEn4N_gFU(=SRBpxybAs>N(7=;^M|l_aqA*{FX-x&0)^1HH z^=;EjrZvUo%QBjN4|=J+$xVsFf~G&h=9Z?UjXQ<;pfH~n=F7s|*Yp?Ayx;T>m|uzK z(@iNu8~hD0Z8a%vf||91z2rg4*tc0v*bHjcAMFI?K)rH(xY=mfOPUSMh#z{^D-N#< zAXz2|bCh8oC?5@&5A*qeyM?bsFpmeUg!vy~>YLNEpDBom32IVASW(hMNrh)kezoy|WJDfO~75*!HxwU4P`?oxt(tUL}?WSWg&8Q!4lp^p zB6=0fnbEJpq?)8Vn;T7`y)VpD!ZdWESlVok*g!!ra`6TA$ZD zk@jSsdA}32KA(4@94_0Vbrj7g3>t1bsW$*h0+Bo5U7+*bxns`?+BtSW%mIY*qZj%7;>1ARR|U z@scsPv!sqPhA$ANJIfSEhJr6p=_VxdWakuRALBIiGWkT2zX~?WI14CAprvf0@fN)C zl_*qXydB@k>l7MgT!7)IeF~Krm!YQmP9W0R2XAaPOfuugeScO26&v3R8eGC-CQG^-J&MEXeP7XtyMjAZDYy7l*XkV zr&v52qR=BAsX!KqL_WheTz~0rqsJM1$+S)s{@50ebkrNe75W$`fh|^ud8V^o>{o%x zSUb;9)|kw?+BnzB_->FQ)o?W{z&1EB?j0-pEoEA`RZi(iI{N<}iywq`@4v zS|F*xT((sq(qJx28!h4!8q8zADMT8~W8t((1hhmN%wydJs$d>IXIKI2r`#x)|BG!@ zZh=0Nc@c|EmHsFv z`zwUo34tnDzRz@ydOuCZZt=N=&tMe-$@pf9Fd5tBa<9)F+!ih5v#Q-5hZ_b`#BZ0& z<30<;o?rwCE$5}uNuV`+ZZ&!uZe`WzMT9cn1})^bSEE{jVk@)XF!OKf^u{NNVX>_N5&fejSA=b^R<`AW)ex+c%9r$JQxS>^lzVH-$>! zwu$+tlfN?K-EiB)rYKYnx6Q0Xp@-qNnN}v46~Bh0+8%tWb{M2mB>=>qH7g=DKa{Re_`ix3NP4m9hhVA2Kkez`8LZDNXoF6tu~WenRrv(%eE>M&@=-5t`!2wH`RS& zP7%pKZ>sy*#4Pex%A%X5vjc3IKvEM2S-&adCgVHEW(g$YJH*0r$gRxi>wk(JVo3`1 z@b}OTF_T2%t>h3}pxlP}`@(IVKoyKi_#xIimqICJPeSXePDmO~MFW5PSDE*Eytw4rCDfTt2H#h^nLUr`)DSiGUN7UW3(UHS&7(wgz_VsGD}i^iWq)m3lySUcaEKt$oNaM zQ|uQuYqki5^$VDw{le~2C@H|K{mNEIWE>HYqy5IVSEEAhch>J_;SZV*MZfkCJCs?C zBH*@FASpu?J1gCc=74eN^Y)x0LNU@87~^3IjfES3@ z6xpT*a=my>ku^h0zDyuWhpk#GuD^pqk$FCthX^FoA(*ENB-5ca|46*vl(HKF(^+di z{VuD&16l}QCXsP};3?LYZ&v8zz*L~uBx1)Pdni9#jSgs`{E0;j;~%Ukw=Sk zps*zpg#(529EG|8wddOv8Vl5cdoGofx3%~{i{irts$dVc_+0D6A5d;jgEEG%QD|?A zP!`L5@0b3L2o$E!H!Z%=V);ge&b2tLb>XKK(pvtcb>+jCNq=4~f5#H8N`a)#;<>(D zx=}sRjfbowMA{A0b>nH(D3*8UYa}vOwTja9;M){326X{?Lm}Uw1YH9ERH2}tSf0So zD%3vc6zj?T9~Utgy9JE{idSfWK=TwDEhtwgG(IR5lobly2)ADRBZY2-TQBavUWT~} zZddRpBw{ZHg#sN==uLsrHwa30IH<4g3SObmSHf-n6XaIPeho_FSMZHb5}M20gA+kX z&-Cv7uiyh(Zyxd#p?RX*_7QG6p|i0%E84}U1$WV1soZw)^5Aq`ziPBLI9r!!=P#++ zZCY@FZcsHU51y_YT#d-zP#!5_mnC2re?uVI9t}e`8*zqrhSs4NVVkGWW3AU<@o~aN z=|(A?!lyq&s0?+;23-pGe^wyli>*(wt9Z0R`&*|1B`8ESSSn9Zh-$D@p03b0@R!Cd z3jGX!Y25!g8K$w#DK>^jD-_ly3X7q~Db%gaW}xW`4HD>6g~kbF+$2Mp(k20v@e0jp zvkhptLW|n$1S$p!LH+qco40ji`8^7~19UZiOrfeaALz#M?Ft2ie4x9Azpv1!kgs&t z@*fm316{{GH_O;Z1bnAU=dl8nqK!MFyPglPM!)LD^BjpptvG?NQRwE7NN(cC6rx%& zgXcU?VU{wg70rB}LR2eG=GqqNb{G6*bAN#)wmK~8D|lH_x`n#yZ{x;)OB4olJMXPfztD7c zCtoK}1sfmgr@xz@RwxJP9v=S+`72{HLPOcTe3?RvLR;wXEiE#r|2g$k6eP(r(OxMc}c#zw>K z0dA>AsX)6Gx*l%J`DY5{3G|ylrEGS)5dCsK1-fK>N0IoX78xZk}OhbdU2Ag_?zZr(4hC-;{1)VWDgTFHxvRSS;Vbe-lW)&p*NaDv6Tn z!3g#Qr)O&|{G>uu3%AfeU5(0vXXrOpBdSfGv-7v9+HG2JD0{vdl?RvUYY_R{%3F)r zcQI-aUf><7c?o4N@^~A!7x{7m0sS{|bLvAkxcD{SJOWx%CR)t>4Lm_DafL;rsLz zyhI?P{8+!sP7^fOh4e`pJgVPQjmm?+(_*Ve7F5j-u{PqDZ2YAkV zl9EP04)S#Zm9p~o>Ff}1caYpl8P$C6^BxLOt@t4yt`OCHAM?!$t%JWKyh0(WBR}IO z6rvjJ3m$ezhDq(_QNH|h*~+}vKGfwX-=xqF*ApGyL2!iB`hjf4Kg*L@&ebCq6}?cOnaPKl6uJ7 ztduT~b%?M*PXdVp5GWM5^>=Zprre464BF{xUP6K9oS^th*_e(P@zZWsXbO-~TdYtC zkh``^q5FY6wciwa7RXEM`kf5rEg&ClxI$ldOm*?o?p26d=B8SOLWZbF-b@QSDgA{; zUF*_Zo23wa^#p1k2qb$eT56vP^pzXwrImJ0A<|1L4V@DBeZ@%=L0Xe))ZZmo3s#8q z(prmGh&0hg8?F$I*|gD$1=^vDjS6KU+8qK>iV=E3BIC%YQ$TwZ8XJ`g^r=GQ;nr6B zL!l{fYpeO6CeF%?g>Vbix+*jaZlT%`h03Blw04?Vq5GoDF734G3OyZ_;}WJVQRu~} zLZEd5EoHAo&2S0VDy17M35Z}3THyB-Un$!kRpQcKo2Agvs0bFRu^$94>>N-Bt&c=P zzK)tjB4c9o8kdgRLWNSJQ-L0;rd;n5r5#po8PU(UL~ExdLhPX|T0<8Meq}&!z%A&k zM0Z4ovQFAOg{Wttlh*r3;by!)dap|-ZK6bimrh!mK(Za{q)n-I`w*1Nl)tsn<5*|y zX@#DOjsV)K5cPn>YI_yh0=HQ0utJo3x@e~qqTJI(JEzc&=u@n#=KYi8?5*fjpg@V( zz)qjJ#A*EmDrKWOjbriJJViMo;4_za?X;r2u2YFiH_iK;2t`QLU29&A&boBhI!Gk? z&w6MH0_|dtb@Q1Vpap?!NqVJplw&^C4`csrMODB-2xp`=pZPQv>>B& zI|npKOHrtKXN=Kma}*1U+UE-005nnyaFe0T2TIX~3q+duNxMp0Q;nJ# zQZ;{fNm!mG8j3eia6)f&Sd5#&arkK?pJ zg=q9~oED}KjTBy^^;U>R3a`!V#l%Tw0R0OkBtCYpisNm zU_-jLPNA-`?SM8Z)IatVyI!kQC}0c>nQI) z=bV+ayR!AzwIy4`#_Pm!B8Y`$C$W{-j%7)<6-$<6$qxakSxakcv9v4iN`8=pN_GO6 zk_(}vC6t#TX=@-*^GtY@x`cvhDfpI@xDc8Yn%1Q>(DL#nl>7UA-<-2&^)R9I{&DYh z9L<^MH{X2oy=Kmw*}d*YNj+{3uKX{PbdTB;-y-gFFW8z#QFFlko=yE8QYo=3eE;|E zl`knf;C56K=HuoAD_4~rbf1=#?n@239WkMj$V0{*l9X~}#(hXq%8^<3=kpb_vc^}M ztoxxFOA)V-GkJfZlX@h-htHJZil4)!2Dxly6kt|_uAA?8#84S?)UuE zc-f>Ie-YcMwK(o3{M28T9Cv>xsYz45>KpC}_vlsH!&R$Zi&Kv8l+^1?{i@~WUiWD~ zbx+yr+!EZ7Ms3=#>Mu)P@4jkrp@%oP2mRDH+&8!n`Khb%#n<2Xsh_zg-JeV9S?49- z>o;P?a2~IW;hQAvUd8y!5xOQhE&i1-OQ+WvkeVNP8A}VHYl8VN1paLOzL5Nbg2QYW zz7Pm6q>hd~FMUm?&*dQ;n?}#e*Z)o7U%vip1HA_^nI3=JLeAs8QeQ`U`7k(&={Q`z z?ex;iLz@o&je_S}5PBT@_CS1d4adUJH4jP6nR8t8A-`1Pp+Nm$>92$KN$LHw0!_I^ zaaJjtx%cTXgFXIs_)H(yS;6f$<%b~WPoFi-(UAtjbJEw%3pfjZEtJvH;4J?(aUBJ9 zi;M3a*h>)47XmprM=zxQY;|5ZJrzPw?t&C6o6k`M>&%9s=Ff)D|0$IJri4F|@D;U$ ztYHwQa;(;$4l_8{I*$xpqa3cfVm2Ipn|!6G;-;gRj@vz=sT4zv|294TOsEuua7l80 zC8652$m#-*y;*u!3IwSXjF(G&#VwAwYw9FN+cI?JylBXk)F?&$zn%_YfG6$rl<{S#-D9q`h_E>pUf#1|B1-VY^Fr10& zf;D;C*)8JU={?T5mVIgdU4rd#X{GVkOAbq2^A?HgSTwFUXgt{O%rg=aX(}ngN4Z_; zPl@37IP41-`yf7DtIQ19)5$NKV}nw5O8WXuA?qw?tDwCI#)J51zG{ri_oX#A2_0Th zPdX^Js?{}oA|4V_d)@-ULISJ28SZ`~7@Fv#(tDDw^`vIXP+;6^lQ#(TLktS`<#hbd3^Pe|iAIk8| z)G^?>E7Wg(b+F1KDH)`H~ z^Ffq;=;mHv_4S)`i2u{g&jQZ(k#pWe*W4XGiJB+E_lK6O+2fow?Q7l;PMYMJ|08@V zlwI?-@aYiuanG8QYxbBkp@-MJ9rTxv}<9;6VJNazZ_7F0JVW-AKa=5?(YfTKl!|1#`pN zZzAMZM==Te&6>3r!{OD~|`>WJgWT-fk|wYA6*`Z(`jyBP70 ztbH~VHD6xai~8SOyDSnl&#tXU_#ASg=2r;uJGN_Xj$8~?HT5}3qhVds9$W?9S-UxM z31foV7~)%>Gof8g`vHekoofhTuIa3uh|C35 zUl*BgvTGhhNE*&HLrou!)XAuw67o#5;NK`=lZ5pWwoBL}VZV7}(`PZFcQ$T z^_Du$N70Mpe5r|}_(z2O=4VZuW%rh6Lv_1Q?1^U_;?fN6Jeus zXx$}Xaxda_a^knqdEdHMpyr>iOQPmi)*V3jkL$h$_`g^;g7}>Ey`}wT$@+&tJ>ga7 z`t^Ho>%yA#ea=P9_&w32)4cv9zI5M?{PWHo>)#Bl4x*It2cwfEivTStJT_T!a6RMW z>+$W0Ku9|$)?aPX&U@GYS@iyrN7sK6;g=AmoeS$1mpxeW-1^T(ACy)Pmi%J%3FC;fqnnsorq4IRz?xFM6tklIS?AkaMPF^M;>C`%T}5Uq;V6dpF=#W@l(ar2K+Q ztS-2uSkxTbz|{QZWPmQOnWBH<;3Cmo)TyWd%G+p6;Woz=IkMNZ3YJIb3)&uzQQ zFPi?__CUkFyoS1B|81{CDYZwlA#HIrdf7lZ!-!CW6KUm&hva$9Q>Tsm}h9kWI`t+J-5JK({{%twKUh^YAXOGh; z&>98WrINWD%Q54%8wr75*fgo!m5Sy^cs20cU-rjyW2GlHK7#OpjcDTXDW*TeFTmT2XJ_(7dqXg7XK>ODg)!A2(lH5fvVenvXZ% zfcV+w>!baluQaznXNsjLy=OynMOtu9mtJb_s%SQ4n|72RD!q2oz6#Ml6_ZZmCeGbP z340{mhp@-wHod0ev`bBOzs$}d;19j+aMljl(v7tf6+JSpejC1V(|y2=I%*RAK7csC zlIS-d*~HQD8;O2-Z*fjIx!-(h)8ev|rO$3URdH7KwfoI~ZTfJql<@1P>V=uT(Eqjo2Tg&6f`2}R^ywlS16}0MUfu=3Zw~$JcE!S3@ zbof60g7fg2{{;2kjQk7E+a-Lj)cIh`v!P2RpJ}<;Tq^k@dg*b#(-NxeasD0fdz@bY z+C^{|xLwA0(V5>`UU|`>9lR*^;&kcNtxGCS3C&N5Ek1?sAbW8u$*NXBFwGKnAWW7F zv@WhZ9RWawk>;* z)3xRKs`@f&_;e|0n=XCz7Pq?2C0EzEuh|ks{Pn1Lze7x@QLFGB-P^bHIrodT>No1| zQA_lPC_A7t!l>BLI``vSURK=%_%~Izm!)do7H%*5Yz!V<34I%CiCe3CfbE{@{<2?e z*;{?cly2Q$okY&AP>;E8>%r=Jcg@yg)s61Pt$j|TyLIa?qv^7jBi?WJZT%;AY1y4y z@2Or|_Ev;vLLb`t`s#l38I+zXeSGWV&_Z9{`pN1hnWHB6sjXi?>5DNJ{bm2Y6<&lJ zX{VjKuKg?3lhD}btDTZH?cYRrNBehBGmFxw`CX}VUpq9jQ15<+C%5Zdp1i)`{82k4 z;?ea>Dh`P@xZgS5{(RLTLwP(T5_;MtZ4be3JciMIq8*qEK8M^TH@qj*?mQ0o_m_RM zeM{`YvY)nh#+D-7A30SPx_wtH?Y`*tSHzaO*WR9toi1y*eJFMYl&OxS0pYbM-FN#v zu?tS__9Yc*_paNotvFqF|Lq@gd(1m;|Gikh`M~YZhRzBl`^{h9{#N8XiLl4;lyQ%F z_V#1dJ%(qD?-%Yp<{nx6O6311@?)hxZNC_cm4>!mjP<*nwLgiSlu;+$@@>@5{6?4d zs3v~MxqjRA@gB2!TSL6x@PuuD3AK9CUB3;zIP^<Q-oKW^JS;DEises2ewU=PP&h6 zTLw?~?6zI8WXX58-5bA9_EY3PSXSDxD|XUd*zt#GyR?ICmv+1h@fA4AlXROq-XA|} zdJsS9j&^()`15>hkKwsktXw)UIRdi{q=+bpkddN^4tdshe1WzZtzw90J;gQ0obV!{Z;mHTx zSFC85cM+>9hKg0X6JvCac49Wo>k#&sw;^<#k9VG(51+sD%k%5PoVB_zdA>t>=@3l% z1d~3&@B2&s)Pm4v&NLx0A*URr)hxVHyAg4*GK=sH$I%ktKm zLuLQgb*kn}=s&yuxMtG)ch|=d-(PkXVM+Ht)XbHU&Xx6Aom1Yu9IGlqIHNQ#qlQ0& zlRL}JdAGKEW9>;4;9r>+u+a)KB_|7?L8)xq)C4N$B zo5Tiy;#eDENAfF4% z*d>fc7_XPGCGxHL)uDEYrzLEUvUG6C98(=Sdo@d+kpa}7(EEoYd#{`YIE zLr(o4)!w{dX+7i3HY5(odJUOBDRnk(A)Hr9I3eMCCHxBspO(;UWu1hC4|TE^2RG;N z_U2XLwc%socZWY8{!aM2;r|N%cepe%C$ciKF47!%dE`}*;mB(u?~Z&TQW@=tjzwP^ zeJJ{O(eFpA%9oXIDBoKC>hhE2Z!Z7S@{g3?Hur0DS5@3vv8N(ak*|1N#XBp$QSp35 zta3qRedU45J1gH&`GLy6to&wWtm-9ItE<*lt*`2=+EH~!)nL^`)xA}3t@^{N$EvPM?2r^{=Yu#OB48#8$=D$3|lh z#@-YAWe*kM?N zTTNe#-PtAB8@>j6!Y{$SqbqU8OrzO`oKEP8?Xc}#xDTh#tTDT=r@Y%VL5JL8UJ2`c z2k>ZiRw8^~n4iUeT*4nn_?F0fkh8LK1F*cKisAmMI}naa{Akqx;;)zR4<+Z}Dnba> zTvp9iTK{F$tUp_;@i$9TV#Y8|CR%R<)Qz3`)`sUw=WiaD{x zw})_F@ZxTSix)HJy2XUEQo>s$r&Yq2OSpL%>nOCBOFSjv-OC8)jmvt#4u2@&!xElZ zM#zsZ!%v$4&)<=7P{Lt^m!!_hdXBfLzP{Ap1~9_EtDZRATTkkJrG6{&H7vb>rKg4d zQHfXGK#DEA;a=3q-tZ}eZ?66v!uQ_r1j4l|2uEq65Z13Cgk81&iqgAQ;5sookIDnV zdHkqcukh)Wx1i1!S8i}3X58VeriT&YH}&u@VvaZ^$T^D81z(fHk2$yl9ACASAt!>o z2)?a|Am{rCal{q;?_#H%H~lu^W-b>z&9DPEak=1X{30IsnqfDrp9}t;hxiUii3_V< zgLoe##f8OWxD(RifcNVV-wmsXH#-RNCJu7tnpZ(~9Fs)onthNk2i9{b;)9SU2ft^- z@Bk#v#V@Wf9D?LIScNk@2nlq}t0f%fZCJQHhhY|XVY#>;X9eP?arc#L{#3#bU^I^T zpoEV=HgWPw!Vly2D%>mz33c(wD8n<5QU^EgHX;5M*ngaELg?b=iS-Eo&fJFZ3GDH? z=2>WP*Zd3aX?1Y}!WM)-H0=m~1`XhvUw~RJzU1#h_$$x`TE^)`Sc-e0TzvDs8(|o0 zV9WyUal(6c+{)ybc?ezHal98{t&>E~0tr_-1IT%qgl$d=`I`~CW{YzG@vR75(~cX9 zTys0_A9Bq$X9Qt~lSOH#gk8=dHR`nmci`j*G7(e-Gi^&V2~K;=CE* z1?PT*|KR*S!f!bbp#HZJf-<<_2IAp9h|qEW2>C8TP{4f`;%}zN>gY;@2Q_%`*34#IHr@;@gNnLHs%iU*?`hPJ@Jv?gtUS*?k11x4Iue{1$|` zm(o3h_&NzUxF18#Z3tbn(ftJC%?MqbS^pHm4)-yH2i(sfe+VHc=6(+GS4%kTejYgo zB^+_jB0nSHsQU%vXAwFk=YA3KLlWlQFCk|P;c9rKWhJ{eez$ubZizoxd4J{cc-Q=c z^YimRIR9_wziPo=>%viID? zoWg&O`DbXesd>M$dD@cY~J@Yh=q5cQW z&{K%xcQkew-0aG?x5lhu{3ROiN8H@5@e_zAk{bUI;!oQ6*AQPjsQH%==N&PGb8Rnz zF^%s={81Y}iumZb=D!E=pTADyUt|6$jsKAGPinlb&zK*c)%ZHZyT7UN1Bg$2TjQ@s z97;j@{V3v(+W1q5CmcueOLwB}I*l(wJOa0bc=jOvhOHVu%y>rQ4b}y+yE_iBRr5b&}wU-$JRk}Z9-3GU1xT1d^oki zWX3b;v4-*VL4l%^VXrnjZXO!MGiOE$AVePBG797|_2t?A@& z_5ic{lKZ-o2U1?f=qT!qCDWNy&J?w18%&R7bA}JwByZca<#O3vYdSwVoIGaQj*ccX zgZSB$j^w`7uxaUT*qzP{W{>0>h*!Q)-j_N$wkdnmY#C2CkBub9T0rmjt-ca{$9N_KOu9x>-k`N? zO4aSzG1TnKrBWF2a5mSS%O1!9+NNYqPzk1Yq%z5oR1sk;6?UZZ|&SaNJ! zF;DK>ml~W>Ov+(6Ajnuc<;@>6d&kpbDUx7&c2FmvC}&qXFSFm9A}XmtHfb43W)7qV zw_>_Eyq2NVz`+?yis0``r;Zp)oZhixoNe@qU)mWT7#q)}EYQMqcVv@(7eUNrCjGvL zQ^}k~fCI>T_)6a9WO_I?Sd_0>L@d8KJv^4mc@3CVoD&$=W^ghmQiuRv+&r8-kPi;L zJ+nV+i3$O1)VFuPp(Q&qn$2M3(23MHzVh0cPvxxi zd3tgzZB=B$PDVKoUHee&Fh-~9iescw8p#i2bHnL^^JA^xssp4+TV{O3>`D%gr(`mvGhv7w>46~+L2q8C z_tdZ@1>KzkL7G(I*4C7wNKBLm6IKx)`aOs(#Xc9^!L(a2*J zNI9}E%ULSwG>~gKA}@L-3rpAzjA8K7uYoePg)*|~_;I`~Gh#liu4>%9R8anS_O=YC z2M&@8r;K}Mm}AL(o-CQM^w@C98!*x6V+O>Fp+C(*W^ZUs<ZxgYq$53 zr;(F4?bFH#*=9n;P+M$CL7=5RszcHxgU|K?MARutGzZ-TA6(vAhjysRqr!iMSt2(w zl}n9e52x&e=fs-YL~?M@i^1CYb+)F4N5O4}(^S1ffkdMj7{=t?Uqz=T*rA=C zV7E5Q@7zlVP_S78GO2bPprKkq8LQRuW(M!Tz?uwugU5VRXL?CeqBVOYV~4=x&QY6~ z?q}(6ib2ebMi7uizPKx!X}QY&{)TW zr|P)nr{#$6xhV(#5@@98hB^;H|HMu9 zsg25nUsn(H79!?pF&Wt-@bpneq2KO`V;S92}M73jL$fMvssjvvd zkQ^a3gk+i~oA-{7j%IW4`Nd-D@-CPVc;t5}k`zUu%l5z$FV6ht;vQK%C5yERbEk-~ z+SEMOqggE=$XdlYtV5eh-K7y7fZ3T5VhqAmj~?p-4br3gvdP?_U7uorh2ePUPr-94 zKE*vtuR>4ZR2>G%Z4vNjVUr#m0;K{!(AcLzAkPYea=A?iHxpM2YbqR>Z__+HoE?B} zlLhx?IIvz^crmzK*_;N;aV35*<*i`U^|37IDQD{@!pN%$!&;yE*lbRYC5JUCYmMgo zLBkcOC@f>$eON)b>+1Tqwry_S+0nPRrMbJWy=%MKG@c$Fw9u`X+J$N!vZTyD3@;3m zhW!j#z#dKxn~`+Jj3kd5tQJP$I%18RIxqr7*^(WHo!gWf&kvdX5GRf8gRRk6UaMIi z?}XHjz#$jv+qiIO@@OI7#+l#C-dI^8%;`?S4rRu~qZb*{80!@BEN$f(3Nq0JK+L6I^z4kx%?g`+*E_ z#ioxWd=DK{irpC4M{H4K4%i8%0R?Szws&UiY-e-n1L;h1SXLIK8>lqJ?;e<%V?At9 z1|EqD3fFXG4;+A9;ojKz=pa}WC=9CiVW)t59WV!ZaTCO*=lhcTd^aGYn@NEj@Z5NB zYBULk$EfLH=qlQ8B0vB`{TEN1d_cy=!1G+Mdz=6qyePS>Jx@;w=(c6JsvDG%AlWyR zOXY{M!>YdR>|vB0sl!+BV?$N3D~O)ec$JE|ww7bW)^8w3aXC4U=I?9u~lrH~IV%dn1@ zu;ty!3|I@U2G{Ica@p}w())moU`JwxjZ0nJK_0#lQycrZQMpsqYJo26r7w2CGKe+kOMrYOEiNbFNBurw7M|O#27~!i=Ufnbe@h z$1}l{kVZ*8A_)ZHEpWeD*3ve4OjZeYMr?U-M+V^44Y5jS#+npbPshwy0klMw zw#=aHQge^5uqJ>TZ}$M`a(G~X9_<~(qC1y5%+2nh^x$ABQy2x-U9wZ|wSe@BeRC4PO`&3NO&0`&xTWRF;{zdgfvUoJfY|BtU+HVr2;2RrcUCNGm>89}?p_728j+;XB|-U{MiF%urdg zV2j3w2Pu7itWa0>qu2u@nq9z3(*cY%WB>TDIsjfovpsdQ$|Un#A}PLB>1!1%c}B5j z6xo5Qv3m_#R!C2qKV#XGLadu0y$92yqu^}W_OhaBOVs<(gmrjqA_LcCV0b)_oi5Eu zGf6K8ggHVesln!aetbk`hpz+j=nn4}C@f5fs7Qo4cCx9JY?Qe$0)Z4O3yE2zdP*3J z$#%c@U_vU+hz>jIow3CB3xNIr6^Fc0qbwRg$1IC(uXGCpVJMZ&9TOLRM`|=XIzCK~ zq>$N?93BWXZ-#G)U$hV+*l`v{?2k4uQh$^)qmITip)D_m>=MYdH|LLK25fH<2U5da zKB(mCN(sC8;0Lam41f+nsbUv*3@%(JHpEg#vE?*?ja}G$-9?lU=f*SGo*u#bw8E0M zAbzUcROgDJrI!k?7>+cxtEfYEAgR150P`F|9NP5gU6GBpE zi7V{kgR(E?tYcGnotc*$l{=-;R2X*71rmk{UFp+|h!tmfGfPmOrpG3;?*Rw%b&Gn& zB5NyxwFza0Yzt(D5}8SF>0Y2;5Uc6AL2xi0DewKHU4wazz4fYGtLij>52spTlexWmpx}X!EBx2= zbWXT_Iv^EiE^6a;qNvL$&9dXrPx|hvE7QCmwUmD`+me!b)4dmvMFl~Xh-fZ~I(HQK z@LJfp^U`fH!3sj4**Eg~`drCMSlC5{8Nk4-v~9(EA109x{^|A|6RQqoMKwK_9@ezn zu7DG!&80OkAJ1S^+6&@A(ap0ks1%UYik-=WDXTIWr8{Ml?V^jZ!t!47VtWONELHyw zdHuCHmmMjjgoOS$ck+yZWNk@#r%3dLItW9b11~a#n6lN%BMDO3i)=b3jvc6n-3Gjs zF1%~ES>EJfAk*}4K|F=pGbz>}ae_x5IB!8^8l+jU#7^rJZF!ilyZ7!j+_r@3P_Y*` zRn@YRTtnG$x1`=Lhd0bX;p|D?fNYk*w0=78^^f&KX0V9)ycr5C)A}H0*vRMpuNZ0W zlp18}hDq`;R0)l_9RR&$c0&oU8$*IN*WkWomBbiosaNkATusqtYiysq8`rqskML67 zk~Yw(mnG#ML|yS%2srU&O_F`->L*1jVOUySsi*U0bBGhQk`{^j_mq@6F~Kb@ZX7hy zrwJ%~lDgnQihoQf*Ml4nb7A}5GylSLdEz`b_`w+0z zoOV_yasmRxWgV&;X(YqfZQ0^1Wvf6l4=HQ#reSTDq8>X6dwPa+s&C-i+Zmh#zYLAM zNwu)G_LR)x`L;C&C^NxXxB2AL{EWUxif;w-vi1;mA2fj+)&5w$Orf{us(9lJH1YRw zwM#3Qq>5Kra4cd!i=-|jykS~p5C9`>JShHbdxQ^6*_2rxkaq*ZB0xhlsh7|NB(alh zLDR1--VWX>h=)qg2XQ%SqaoMiq9%0bmnuqE^tS2%UPAc{tCAgLfA3AYUu8eq`H6I9 z0Ivx0DQ=khnS-erGIKy4Mxm%87HNWQ5Cu!*X^7bTsp#13neebhGht(kX28joB)KU{ zT+L`oPLvACF;HEhtLJG6$|8-*`WCZ_O$L}RN`CMhYy-(|_mvuC@hK_*O=ar%YM^*khNZE?{hwE&vR=YyxAiJ~_BEkHy*c)DfO> zOO6$?x`uHML$Z4DD%)>DR231wUkkYnI|j$N{jX=*x-!GZx-v=}Z*xef*xSOwP>{3-My#EdaSnMv%Q}?>V`g`T@4g0bh*41t;1K9=D>j{9L%|z1ySULm zfXJpSUK`M#;gK{)6Jv`$q5h9t0tY7Ga>j)kj#RXqnri?JaCXpjx^_T$z%8`1ZSznaS#=&HmIu+Rd77@ zOWubyHHYnI30Xa*J(3z5$_`@LW%pwg-kafZ?bY?9tTapvSU1Mo5T5# z0W*vpEZ9a}02NF4*s}16)2*?ueevCoalidMX~r z>AcsDc!!W0**A>iig?Y~i+3~yx_U);S;Y=!Ea3D{FMyH3axXAN9w>0+Aim_7sm16q z9M>3{p$JB5Fg23Q9h}|@`heRU(+lW@&?!P;a(LESP?Lr8AO#@y+$(lK#_--02Tn&u zF??)!*;CV+A;7V$NgkD0zR=z_6e5hJ_oZ=`G(d{LM_JfN$kTc4NFDqJRLp(^CQQvXY^XKBEZ2=J%bm=ij@_CPzHL{(0#p!V z!BTx=qWJ>9g(pkBodDK=m4SMdZf(QB<_Il^&BfbT%)lm`cm?I;LmsxCDX$lfNPDI) znLoG>2Z>k%c0M=O4V@!jHL+cB4u?pen96H>1P;HDPxnNpV8h|&<*a#dn4Y3lih(Kl zu>vZ98>Y0^Ojy-6e0IS@X;6sJz=4#E*&3Z9NMe1P<)FAi5mkv#nW##$qkG#9;X4^=ur)BQhqnXApp`pv1we9W)Ca4coOc*&8ceUin~I>0>V-A*kJnFY>7A_B zv(qwC|HZo=*cX^|K$T_0OQVeIVNyy(7d1|I7S8Z7sXR5Wt8g4%Y02~bGiJh5!umzd z)UHtwqmXhz<&l;Fu4;x6*y2A{9a@l zfjrq@3n7-TCAaW19ceD$AOS*lRt%_YCav}t>T>Kp2+pqn4N$}D&@T%R#VZp?cJ=5j z_@ur+cQ)5+AlOf7uqlgAdz1KDsj!Qo+GpzYNMmLOFo8Xkl@l?c7($uKlxW)j#6yIQ z?fnSsiapmMofT%sKjGS!^>h{_YqKXyHjl9M2orlEA8Lvcz)cFCGJyl<2?Tnxs#IgD zHN8W%3XC5^%X*E;t)7qR=hzjSzgXNXY6@Ta^1y)ba{&X3q#PL19Z@5mv)B&kK>z4j zTV~LfgH`N7_g=hRD!gbEWW-z6HdSYa z@UVs(!+J$1$5jay5dxx*pU8ngxiN&$7Fe>Z#xWf*CtYU$$eM5%KT9skVHK>L?8o5h z_Y}w;OmlA=nomAyBRW&l1t=J(Y#T}~?>G_t6xf4?0r?J+47E8qk{;F*k@g$Q&TJ-& zFVL}2VpC61Gah78`67w$j0zs4w{u;{v0FiS-8&wr2OZ*_&ni?UufPz>cckn~PkagT zz|u;;XRxi0E6c*{sPE#o4iC4(MCJnS_%@v0z&6q#j!3D0K3_{c=bpWa^6uKdA3#6{*)E}TQ;3T1qY^G3K!7ATCXB^| zWlW_qC{^I&w#?ylF006~7+Y=f=D`y!`_{%w`tM)74F4StGvHl{jMAAEV6r;4K9F6* z^ui{I>yJ+h;5}!!2j8_{4i*=%!df(kBj`GzvbZQ{6bnwiGQge>E&J+L1t}`l=15zN z+kQFF3*(P18-Bn+%nDQngYm$aK%CMt=jNlLsPDfH9~7KFvTSV$2AOIk53gd(T1)c#2l`r7ia@0@d!tzaRk zX@z4{7R6PuYY=_iZdz0O#t-n2F!w0}=7!zdTqT{i;lzSobz?G(Ll`Sa@T)qQg zUv`H0ai1>jghXBYrCV;q@eK=32>9+8cKf7^PZcSWQigyJ89b`OYtT<^JFz{J$`#Z* z`)udNn&{OIe7NLw2-39-;ae!3BU(MV>OE z$Z;Sp@v!C9JB}lX*r2s4nfS}ObfPIfvre(KuA1QHwIxAz*xUS-21io^*wGvGt-Y^e ztjh6iy?W2GDWisnTLr@UQ?^@vO+{=dg1ffx3lO`JN<0E~RpuqI3+QbGaLJ_#mkVtY z(n@$Rp+|bb1U&ytz+A0+hmCQ`f?V5@%&F6W#k6;jJx~-_a2D#fVWoM@Y)X%f;LMP& zkHt)K)IRpY&(MgyT@=cEUUg4Ftvx+ zMe60lG5Gd5ybH`>BLxQ^{c{(RjiaBllmytfIiqCgNbQHo!-sk7pUrVR3Wg1MU?)o1 zw>XKF6DA(ZbTJGCZBLf5n#Egqh|=%NN*AQn)U*f&_J{FJILsBd7STBuo6Pgq?8Q0k zhO+JTA)M-e7l2RT_Cs6QEh-L4oPbSm<79v;L@E{m6-*#{EYjQXA&<6+c)(QondDwx zR>BKJM)vU-0r?p34zN7MrWG~z6vZof*qnnaE>(qPxPbQeM1WG!){V5FvVp!#C9w%6 zlOVa8qnt7XS6qb}GX<}gJ4s?5v5P;3Eo9N?K7)$#;wW1KXA5D|_4s0tN0}*S7Ns_8 zaIqkLLWBAo>scwu(48Kw1BK+vwrq;1yeP>FdrNGGts%}3gT^W)66Sn^e7YK99|J3G?1d*Td|f>vm>9W=y6R}IKxchbGGe)J5*$r z?8c(?&jphyS=gwBNk0tj!l?xek4M)0(YXu9`b3{lKkvPI_&+GXE86mdT@ew-^#Dqf7VA%D%9$Cdk*#;-%gJKeV zQ-uW$_TKn8jdW_eRG$FkCn7WpHc8J3V*+Ql9Zh1E_(8giVano_%B(#j>vRb&8L^U4fzE7lgcdrAf*?5@UHs!($Ts;ukIr4PeiV}(1M;<7|A)XOFE8}4jgySnM7 z#!ahNG~U>@a>b1|-_*2X)6J_ltysBfWlPhI%{MmQxa#J+MP2f(kSq@YY_Py0d*$Pq z^nkDyUosOPQgwafO0#U4zJ^?R^yZZ-SFUPYyQ0zCspn?52m)VkdYN*_#qQSI7uJBJ zT-%N-+74jpi3R^+Aoq`Sgw?;Km7_-)V+9;r3PYAP#y^ zCc0sB83?lYTFvg97gl24RvFe}IlB` z8K|nvQ!rnW-i#d|aS|)i%T_A_sP`$&0&x0GMYB~5?63!_OuZtqLFW?uBL~`EP)%w9uz8?vaLAXr z3v!kg(6Mk5=wHuLK^!00Pw%40S*q>85w01pi=4GSmt2^i{45oE?HdH0J1YNQQ;|#a z*{aO&9rkQhy|v~n<-mB_hr+W}RmY>~likZyE&5R9GW9MqS7Z(~9v=0k5M>$%V#%uN zZnh4=7^FSkt?CP%%ZieEyma zwaT^{HOEW>HiCygc%jQ4x>k$g~y+HMf0y|djxgIa8G(dLe66X zJu6KTf;W$3B>{_+;GCvG0qj3x=17q-jBMI$FX=;zeW>4!=K+)_zz<$s&}^yFOlx^{ zis)45(P=6qvsCF(=$lw&fCo-D;SXc(;d~LR0l`y8MjS3jL-J$-fA~Pw@-thI<_*SN z6>QmIDPTFfZ3kM6pypvb$s435+v5D0j|K6%T>qwyxO-5FqyWDq7wp08Yz9~(bl+Q9(6zv=7{8}d?G=GfE)Q$;=3 zEyoT1+E)TN1lrUr6TTp&8gS#kj_7ilsZD4>uFM%z--73C8my@1Tefsy2m} zL;mbj+khXDr~nbk-~~8&Kr7BUA~1=KiZDw(K`IEt?ETz^-zG_z>j9-OUG@0gkTK-! z^A*?>p|A6L*a?ME!~#{F7#~$Z0zYLj3OHU({45)2n<=h6uTa}7H`jU-TC5&%-3n;x z8o@$FYp>h2~8T6ovC9;gO&q!d{VVYNtBF7BWUW{ z{5r$~*K`0zk|jM`FehoSH93#-GYq(j6Pdlx4jUqZ>D2za(MMkJQ5WJjhuDCh3L*A` zc+wdeMXyw5%8@V$S9v&YMn6Y^=O9ctMQY5LyDYz7(|}E=1&7Go z@jr#XRmPMyud$eN?x)eJ|9=X7m&`Ebln&SokYDjXh1?5#DW!Dj$Uo%8-NYy5 zLG7sqj?$v~^A>^H2&g!^g*F`NsI(zZC8X_PV0+MqLU)*L+e9~zLlWq>fG4D|W;!Ie zO7ns)iItBv9e_wYPtr69$K)eWdQj?9B2D+PLN~7;_ z{FybyY2wI{aqhUdNZ>~?)+40Jr(3M8fHmL*a|kDxo(^Y&g%j)@aH73J30RS2r{D8_ zz@h`FIN;+PU_#0fk6?SXwdDV)y|WhGGmb@F8d7?fz#RuHv!EN)<8md36t>`D6-ZAb zzJ=!`QnF`uNs8=LJ*n)qx$LqB&J*i;7R0k_ux8gSFR~&DxTDK4uFb%TlB*s8>Miy- zg8Z}`OFMcR2`eQggdcdq!h|x;+~wd1%K4~-)>W)g3#ntnw-sSk|essD6-2u!VY65dSII*A&<1%wVQ!f)rCIpu=sK*WAUJ1V>`=_>I~t zo<-xhmYxqi!k`va9|b3}WkComZ@N5|y%--QnO+(7xW#S7MqYP}AR8b#N_LN?x zu@{t3ex&b4?eAexJZ9C_&|diMqT+1}*7N*FN;Gw}iA}9#CO%IC&hF`+tC8Xwo7B4Rv0Fh2{!TF!b)i1!K zfE>YZt(nCIqcMH&#?(z6u($tUD#)B%bIPvKJgPrBGIa2{hlQP_dj6vO2y)1nQ{e>3 zYbvO^DF9TmW)8)aMhEV)FXU8)Itiq#7@#^%DQUqR6)9UXFDRxqZ^2Y`WAm%XW;%ZY zRSca+CyJ7Z(Wn;X%qw;!2+34<@TJW>GORat&Kcl9{RABl4=;{0_tc80SEUBXTWFeCGboZr3-0of>r5%#3=^Ycp-%V!#tbnE_oEglUP`rOmax3w z(2-|#CyLa;2(R+s;%Z!!aD*Js7|WpIFW1&{E6p{t!|>~b_TpzSZ@}Mr>;Sf76rK`n z0QMASa@`=Dmjg)Qr^l`!9pzXp%Y|OM{8;ZMrB=js%D`^klTa8|E7BdQ;m_pQ&W4 z6B&S870d^`YiEZSXeEY4bzz}Dw4Rp-UC5impry*3Sv);22&p&F!qX+tjsEQQfgd>P z!brWG0F;_O)KGl9Qed-WCi(|jEg;RN&JWrxB_HI)jByD^J|)iuTGnw%{nycUp)xZyxJ zbW&9FnkA$fx0DVdk4rKx5d)B{ePB7D)XY@dESQ;IrfxR=GqI^uqR!PBoJsnMbgsC@ zI@dGRH5Gkg&&l=BBYLVhvEe*V(gbgf^bX?Du?0!MBw?gE!_nM7xf*ejJylnW@@3iC3R ze!ge&C`<0-o;2yn#ce_UK*1%2`Ykfc$UUa61CmPrh48q6M!$wMGglRs+tbPx zET38DcfPQN{M1q6cX7}+e&P;&lXJ+4u=v-sN}5iwraNA&<^bH!Bpd$`Rw_fhrc(9X9VzQ>FO zjSqDmC7qgprRqf+I8f&rt~=*rS%CemW$z859vB;-(W3WffUAV>(xz#<}Z+!q#*mc zbwsWz%mClL<1K$9Ik-^nt?>wtYsnz?wy*kTXf)l%@wV${!RjjNzT%obUa>y(5VS&+ zJxYbVx`0kEjGG%jo^&ktUmGO+7Y8QlzZi(Au2$Q?F_>5@LN3E~;}ALG=dow?2F<*e z81J9&{l~Z|Nl%BAmc{;@mDrNje+H{Hj@%zh1vfVRZ347yLmQ7aw0&A%J%8G(;MlYb z9>tyQSV!pkUFC?nk8394sv3q{dekC{8$DR^2H$xXw#B#^%e5#qZ{d}X>QP-yaf?^$ zXy4dM1UJ%KJz{MWx8k+0t^j1(oT-=;m8WJK0X+-djQd}}6@HrHT3BBfVG(%kHD$AB z;)BXY`nJqtb#L#R`{inA$T*(R=}uwr7)2VB%h%mXJWi0uUSt;5FT4iVIvg~ia}vlV zg`Q~wIlZjG$=CYaDL2=U)ca)7?cu^{FFG_caqkWQE$}ku-P^#Q4Rm4aQ){LLwE=)G zaJxqc4;D4YexRc-3KJsL+{9(yL{(oNP|^yuxCLFX6lQ5Lrn>G7);4$aiFIJ#o-BEI z=+^z^Ihv#oPMmVQ5)?R!B`j>#VQ=H$Y~1RN+M7I;73zV4OmnA8+jCVpCUUA%tF?n` zV)PCz9Bf_C!uCW;;2hIUqAxrOKraN!ZifA(Uq|)}@;qvd1hq;rAFw`mDU@wFI%-3e zBCbyPnn)S6n8IXA?!K_a6n(LjJ5jhW5OC<-;-d$oi&!&&^=fd4r|s2JaGnx@wN;)g zs)?UW9fEF0>U5}dDzmF$QXq7-^w<~&O{GQ9#RDNLaKeI4R02Po-i6^^H?20|6hkE$ zbmO$JLF!?}-jq1OGZNW=+9Y|Y{63+32A!qK`6Hp8r;TO7n-8gXY; zv~=Ed;rhR+Xz45~)F9Jw6UoajW=FGv(@kLu*5~X7w-4!9iNh9Khb;mg8`3vAI6yaV z9Zaa|%0eDZ>?n*r85zHzi~0p;l?x9-fLMnhZY$EDwnF!ebR(e8vVeRU$HC>Mx5NHx zwmKWV<=)g0O$xgG&ZlK4yEuMU4T_)Ft2T8e7%BrCgURausBokj8X(DkOWq%1!1?J^cm zd>b`K27&H}*vN zElizca36#F8T`;KbNPIL!GjFm#o!c!hZ&p(TCQN(9v0*#9e9S&Sr%0c* z$uDa1oIbvap`pXr#E(l81|f6tKqnCrAyRrhb5SXx^&blv+x^lgx{ptsk57D&kmKv) z?Whu)c%l*oe8eU$L^Kv(IwuigR(vTkIf|!9*m!AWsd11QHla#9WZ=)B>$%$3KkMTn zdY?-ae;|#LG7~?-6zsuY5B?JPYbDg5$QUjm1f2x)O9&B>IvJ1`2AMy|)S%FMhz%FVhmeR5MI@{&ylG595dNe8LB!37v#e25vP zZdnD9ngn~fP6RC(k4OywMfJN_t%4BFF&2|f@6s8YtO+L^w>maiC%H9>$_h!Wz$8_Y zAd`y$WmySMJDU=Rfy)4sWlESSn_Qem=L@wgk7s>m6QTIz zwLmRCS-(izT?=eLiph!!DPxR<#9;++ILb&PgPTgrSjcEoSt5jSlQSHY#wX5}B@7D% zA(TR@CYw-m;vPli9>(9G@i!2{dabjbq`#{YD8%nVbA3*bm)-bev!z#?))hje< zg0CAztH~yI3wC7tPL#TSeBvDB3f%sdvg;K$&QcR+867fYhw|hkp`J&ac8(uI6H3)D zvdpF&w`y7S8`q}!NCxKuWPT*p;myQ*%`zSP+c5kx3L?@wdYc;o0iPB)=4-dl`TR}WM(&&2^e>;? z_|%+dUcKtm?>fBUzLH-)aQ|Z~a_Og{fB9Fx^QB$uzWe(h`jfhOe|~EH-@mWoK<1lI zeQEj6H$VUEkoiogJ(PUMRUg<u-JdYdwEHvg2Q0xB4gU zmTg^|7vDQ)VCg%f?_YDvHQ#L9^&g?X|I)|abo2S8OFmQ@c3~GoVaHX%oEEht8a_7p zh~}M<$HWtS#3w%iI>sj-(;_h_vB|Rl0CqzD7cmc!MH2n0gy*5e7nK^S3EW0JnRjM4brk|UMp%Uq00^A%#i<10|rS!Cz+N2P!``2)f8CnaImjUcEbC5WdY zC44^d1cA@Ie^R3B04{J84p<1tOC7CT<2RTk@GDH&g_pFu`7cw*wKK#>XJq667UW;))pNExNXIL;z4+CmY@iwjW)fFc+|eBvTv zmFUjJ?6{Fg1ms4Jusd898A?*Zl#JwD?0C}E7?6kiXW}5Sp$`YoWDzW12%=vJD8Lac zjwxIO+v;!-$J3%Hj;H5>6!ewC@S4ze;$h~4Q`Q5qh|CNIblNQ^LtIqcXsJzwV~c)c zZ`MU3$)8)2-beWJ>xtpi;UtF1;Q>4Orq;a7F)wM~pTGy}sT(}(@`5sTc$GmcOT(q;1@%&g~Un-H;Z=`WmiBK?+%p`E#!w8CSy9MZMX;=;zi`>%K72wVwQ0Yv2^hwsjUuwsj$^kA~~u( zC!QjgTJ`a+%0#IHcAOhKekykSVVipz)x~wD{ifD~hL2Dh9-%0bW1pxnC3Mc|u*Z&{ ziNH5H{s}OB6pXr*Q5URU3EK$?fUgM|pdi3grMm=s3H=v|H!-Uz-b9{{9se984HC16 zwdcBXO$a)IA{jdlzmn*bn-G%_*9Zn(Q334=DTV4l#b=OR5e`dXBtp5Za!h&P-V+mr zWdRTl3nPK(Qa!|uU(m->GOA0Wm^gYkLqfQ-BH-VK^C^fQe+Gy<@gD8;B#5TXFCshM z6R8F<3koTI{GaEAIcO>LgvA3I73rna2vnjZ#AJoQmZiXn6lOKv6p64_6KlaFW0(%|UIdo83rP*|^!|qv zf!cTJP@9x^tjIA5Xped$bHZUz#zn3!u_iH>aLZ)h3FJVws;U!*sEh8B#)5x|^*%@` zc7`1Tgp)m3_sL?r2XczVC@I*)Ry|7M(iohb6URtQ&98{iokp#8K$p4J^u#$Y4Z^vw zI#}EIaDF;Jf@=K}CE2$$WI(UKyy=vlYpSZ6~K)?%- zEh{jS%%WzBC_S!bw+C7P&Sj5Xif{re=fHah_el$JO2I(FM@?$+(wI@$Ir!zCpAd#< zpLkb%T!fzm5dMebCr&|%SU?WI#sHm$BmhBgiBL~qmmoGd7iJih&csf90=2RF7xVIU zYzfc|Rl?dp3EhVgP?dzBKdBu{Ls))9u;GVoQ_zF{$2UYqLNd7fDn-;!O88~a4@xF9 zKRgH91EO=FQ=fJhhbUfD2~S^zqT`=HgzBi$TF_vP?+H?{oKKg9OK1#Z#ENOZGRKbn z1HhY1L)9&=gxfC@_n06?Ewgx$nCL>Ai0pL6PkgQna=Zw>3)dd-s2&l5o{g`--Vl^G ztuP*3<-qnFZ-xdFBLq8y-P#fdK2M~EuFfN{74Z{iQ3WNaGXiuN0<{z8#6vl84rv(- z9VrYZ8jZ^2PW;>jM?pg2ed*MT?-hY@!GMv+1rf^dPb3%^SHhOlip%|A1{Mr-p+Y)w zf%*r7UxbYf_I2VZWLSZaCF_Z2P>fmcR|a{?x;m4l2Axb|ClPu`2|H;pPar2|>8bgS zscL9=8UEKFe8^`G!lQIdRIhf(=5X+>+`%bmxjfcPJm#2*kI_4qU%^OR-%_7gh5Lb4 ztXkQ)D#7c0a5ZY8o0nuaRFuzHZ{>}N+j*-`Vs}FVSGyie=MLVG=u8g`B~!zRmWD*% zk?akL=Hb-QR65bzkl2;QU9e;M?BSW%&$*Kp#wPcjH8$`>f*cvE*@(!^}u|Ud=Ih;SMe}L%y_z)w=d)X zjR#VBo1$KU#IGzXKu1#Xg~22J6XteHXC6x44HyYfn+IKaO;HXZKR@6lG6T{tPht}X z*6Ty9td#ReF^}Wow{4N%ETy|p#zVahR@(8dl<{`U*>H|_RC*>4l6pE? zJ88DAX_T=2qdGF0>(5lm^beCl5@?H}b!he{O*EV*eg+cwrX5ejS@dE)1?6B99l> zoyzI6^EumkcNTc}DI}l~NW+4p%+_8AcO|$&fh!caLV+t3xI%#|6u3fxD-^gwf&V{J z;4L9|;>IL!wa}ISu2A3#1+Gxw3I(oE;0gtAANU*BFz+-wQ7ob3dN^w?=;V{Iea&oqb>EH1}m6TXcWh zNslc$^RkV#{w-l}X}JE%{tfFlZw|)$FBPw*Pj}d_Ox*p<=ZmGJl$qYzs64fA$oTZu}0&&lx{+he)+cs>4+cvcL()a z^Lhy&+<3~H!s2%bcu$d#WBwW=iIY)|V+x7jUcdGmgBryDG6)|Rhm08+AG>B8;nzKG z>&3bXoedylxo{+`g&Pp1v}xVUbAV0!TLXrSgkzfm01B<3S#jZ+_y@Qn6Tuf>U*y1x z9C(ofFLK~T4!p>L7dh}E2VUgBiyU~7121ym|3@6Skn?K%iQ3T@A}L4IsJ(*Ja^y12Nv8icX0gA zXZ&$~@m(DYFMZ;iBXCvy934m}lqeOj3Yc z)p&y=PT7Ye#6#Xe{FRoc%*A+O23>UgA~N9Jtpg(E)Vi4;972BnP68-ZDze;AVD9IW~F47HvE&R z`B^Qyz1WVjB{EZNk4pCnRg)RivU|+Z)dp0t?3C#Mm(UjE1susxFN>xoUMY(JPIgVLoR$OS% zD13jX8U3EVM>3RFzTpwcP|CauQi5&_e){BW2(jDZ28&USzYl(beer|B8ba*`OAxiB zluiugk%c-1p`0t{dkSta0Jx#D8|;Uth5{e2kVQ6CwwN6*8jUZwJ;72W8H7=p zT!_Gy00Ky0ft+icN*ywnN&*Z?7UW?G0eW|?lv{Nss!_~oTd$WU$_y1US${;aRolu$ zI64F{1HQ6D^<8{!dR=8*fbzXkDqCAdOb`q=SWd(%@M9QS$-XZ`IdQ+XA(9@EWoddiAPa|?h-~0RvFMy)lo+z^N zbTnI1gh)vo&SsR#NCvu5cWJ-XAPyBvS2JGuc?VBZg#K9zHbX?s6=*N;*xZGu2soP$ zf8Vlc`y&v=&s*-Adk_zyjr0V{grcunq97MrRDT4AqtxIC{P=75lazVNvgSL+vcxJ_ z$bM46u0=+pY87Sta;lI)OD^o2T!oR z*rLrks^w-K>jp;xa9u8;V5jy+&{DvOJ$E z<%{{@@2R?xRw+2C0IqAV!!qrgAf>lKN(KZ}vNw)_v<4{?q$HCKjwNCKariA2x(ojC ze6b_5S33cr+KG&6cP84Af&GG|Z-ZPl#Bfh z^&3ZQr5o}Cd+cl!Y0@Ggg$&h2TEs)t1tJ>i!rDKbX3?@pC+uw*FZ(|( z<8a%=Zm^Cx2K9f{NB;!=Tb*iqOg=q|9*KVmb{DD(oAo2?Ms^hF#`d4S2e7fK{P7-C zrK)FXOcAj?l;BKI2E734(#ro{l^~Mr1W*>9O0yXFD!+YZ=tSi?rEchB`rhEpxx$-9 z_`H_z`7Pm>w}dZ{FzqssZlC~)rboXL6uNiJk=wyJpE)Z;&ZH=gov-h}?jWkXnNwYRq!Z`!nI5AeSMcLkn!IIy8G+L{-F z0d9bCI5&=;Hm!RJW8M8`0zLfgV*On5#Jk z2BE=>k7IUqv2i>f2s}5kKG6pj}J00aL~@dgi&xToQ4Cf zj)`2g+?*e=KjfS(Jve}BEdzEl;~ROrD5{fk50V5ncWc0z+(brPNeTxSI{s$7M07zW z4W_NMsi1~a?hb7>(A;jyNK>A=m7B=WoL5fm^!!nwg!S^wk>D)gie?hlMJn9TP~WK_ zKsh&|@!RS|jZt4Bz`V9P#1C_dRrjL=oAXV`sRl_tT}IE}g3LS9!7E9$(&pLNTF4}4 zf;hZdEfLsZ0e1xBhz+)CUV&>QUBx7f%S5Y5eZ9do$*}XhcOE=*OQU8Z*I(3E<3DW-?38G(72?N6bJX(_TUoVKYroT_r^d(x;L~EF-jOSlZ z@TZI&n_*wB)a@Me&RltYIGD}e}xk~@q7q6s?b3~nHCATtw@X{uRh1E~tEDD|ftZ4P_2(#(E)Drm+4 zO?e^bKn8TdTHDW#k86N_rU1d4QO3<1)#Q%59J4wTtWEG<^34pMy$d6oBU)A5YTMc6 zsZef2ezcD~0pZr6HBwHw4yBm_jnq$vfF>BwqzNrYn$&z)fC;;Q67UaY9NP6>wSDp? zpsN$g0$Y_NcrFK?`GSYWzn60+pjA`hO{kTBGx7l|y<%`S9bLI;Ayf_BP-SmtF;#mD zlBr|0yn(bM7=l|6O@VLV89@w?{3tCRE9$wF`7FwX@eBI>6B6aVH7a*#w#D$yC-IQ8l#TsYfnH9l#Q{K{GT+#aI(_Mrn`&^VLxc{2tbeg()yPv^3j*wpz}H zynHq5_$PuxGHz+P2pV_`qjGES0G3>}1LGtcK6oeVr0?PFQ7Ig|gvh(17*q*FK4KA5 z&L0Hcer=PN0ugYWjEB-!fIeaVRp1yBPKgtiz`hXiTrxrNT+&flCvuvt1h;|^$y8kr z77=I?W(zt20Rw0Pm@eh#IjaOA1%(LS&FBcHKzf?t9Klz<>1qgJ@SX^@<7uzZ+9{LR zKQQ2cLHNJg=_qBEE=86oY+0|ZfReQXnEl)E11}i5`NOuY(MJ^DwER*5=~65gU5>T` zik7-^G+CO-z8yx4a;Z^>`k_Re;dAb3D0>m{??ldJ;2ScBVorFSsT$ubH5V)p7A)EI zXK>NK9h7b-R|k&-k6}5aTsOD_k>*}g`R0c;%qBa7umVUdT=)9 z`F8>iZDQ@P(SjbDmjtg4)h3{{oc156g$Wd^%CN!Cf)_V-ebkkfo!? z(g9w#U0A48$~gJCAPb%sPP6b3q-WxyOrz%Z16v3M}_C14n$zW)Gd8N9%m{2-ov z%S13-{}rq~Mu~@^_@U{sbOL>utK%n?7#W~{QjU}I(av5SjMMQ!>4K?9x|qYtry~m# z;0xmY09m*;z+7l=$~zZxsADw0!cDLUo4?)M2a*PupC0U0P&FK%(mOcW@Cq3?C4or< zcm?9S+cLowNQmM*n)B5jWN>fZSUJc45Gu4IxC9W!RF4Iz7-j8HCOGo8&WzSX7Ii3c z4M?GwnZOy10U;+rMMRI8VF7TJA#L=0*pe78ptadQpq`wDqE9#owNCCk<&sQg- zNY(>dX{B+?bAk^84yx+yeZ%|D_9}dII$rPF1I(ycH`S!6-hA~4Q_UksujW7^U`J;0 zv26dc!`YEHgshd;teC5$bY{YF1yTtD@xSYT1SJor-M%BF6lsNXZIil|5fzaRG@G;= zEDFtA(Z*z**#~{Ww<|~GeHoBef{(IN@EVq}K(Z`bOzjwFB3Ku^3}mJ%{yzW!wPWMS z3Q(mm)r*ys$~v+&EBs~r*UA{yu@c4dT?3(ljsgj~T$uCvdV-Gu5%88$1(b~b}w2)0Mu}x2JrQB(*durJeE8#TpGeG9)OQjC9iUng@k5wei zct;$VZXVmN8%Lv!q>nMLunN1&khQ*Wpwj z)?NCRb(l;kTgC$2VaQd?7IQmFDfGBjX=WdY$vZ7>Z4nBvd0R*UoYz2nrdEqY`*)$Cc%>wHA_ajH}d1fOQ za?lZ2fhnqjV)Z|bl{hc>0su-Gc;GXG$2k5M5#q>IhaHU}6Rm~Dn_wXL5|ak$w`9-_ zzT6Uipe6jEggIvBQT}qawf_*}BKxOe&v!#6FN^m6j3i92LR95?0H5fkkSU|YNtNDgSF&sF-|J<~_y zBc_i5(kI3Stjd?6f_2u_@h4Fv$0p-K$3d0Kzl0eFp2EPZp_cWwg^)k=spU z)-VRWhfW{HG<q|M~Q)EyP2X6v0Os$|oS&ntr*t8p15Hc_y^l&m?S^YZB z#JE>4|cad>G048`1dBY`r21Y4G>Mj)?*Cqgvc z@D=#=zkw`n?VI@BCUzv`*}}U%tYFvylixyOG^0;se{CcCw{>zw1m8h^QA5;b8ucim$Y0LQo&fxT zgx5VvZay8pfU<+f00TRzph3~jd5a+UF4A<5Myk3GH255Z#X=}#(!uu-K*vSijF*Y_ zRLCkGqP{;hub9$RUW{MhGQk?#nc%oU9kKdco!f*~3C{#VI8xBDN!(BNjBQZYs17zO zH;OKUlDOF{{hYpYrYzh@1$O|O$Y-R#4-$UdOBQo7ghc&6nj|t`G)bJo%xo#c~+jGFhi@QsSK)kZ|qldw5pA-H?^RH3{XbVNo9;D`@no3)MnPouIhjNoU2VnVgEnpLsWCVM4d4;EV8 zI+1GnP+w~iG>Vwcc@D~}KuG7%9Z9q{<#BR^Fx*!pus=njVs$D@^8P~znza8gAE^3_ zb^kt)H0s_oSH+N+m|rs_{BzA1aII2)!z4@%m7EDShBLuX(22$Y!Qes~elA97!mtJ7 zEEbZ@Nuh#ugM8*M2Qc@&M2-es4*lGmlb}EPpGSRi@X30?AMsXg>(LQf+peK|1P-oG zc?NAj9hDq4AKR_~yjGu5;G{_LOE6^XI|>*pUyL2DI4U>fUFfEu(V&5HRd`uNoYpi& z+e);QMNyX&>dTkJG`QLaCRogn=PHZP^!u@ii9Cc6yT$(jO3=PwyGcbG8Liw>4r-97 z6GKubtvBjL{RSf;q9rArTKVDDnczT@a{faUAup1osEk83Kg_h5^D|*j`47|lYH%*XPnN-z+2DBrTmw<_HM)VKiq{M20C zg~1sm)Hk9MdtuQ;)(6*VPCTcv5B5pKA0afkLES;=q^Xoz^$yn04jOB2WOjHxnmj);a7fosDV3KjO6`BV8xU-G!b(GnDYqwq(+pzri2e9$#!4SAsb zp$4Ahay{7p3DW-w?*m@&6Fe$#E(K5FC0xV~b2HwgGnGr&6$NYLP{eux^d&aPOyRdS z8$8&y3Ue>u5d>;81A6pMi6pYptm3Rg-a=I{E4-a}(NA;3`yur4C^QPrGWpAKL?7T+ zojVg^l!M~J?*TOU88GF&@Ym71csrC>CmTGC)bND}C1+`DJ!vwyU^QpGFoi+e*s+gNW|AP)BbTL%oiZAQKpq~CQma- z1PnY6mA(|Ln8wZj&`O^eBZMr}o&#VZdJo|Fl43>4Gp$aIxb(@sWIf~i6#DO-KBV&NKg;4M2cl39<$Vo;Q9 zJ}Uc}xa_?4!%XmJRJfQI4X1t5R2^7X!LNXr`9=@>FRb^MRrOeF%1m80V4j~_Dwyy= zV8k}we+IPw41VzbFZy^E5A6n}4io-`a2*1t{X|w^wX?{p|7*Zc??PsZYVkKnGhDVd zYcFPdv%_MY4Sg5G9Sjy@-U7i%#vg!q*f6jxo8!+%{9%aiM?CtF;JE>Dx8V;($Uo|Z zRS2(TvK=V>Z-Y-dM(U{iTUPI1@dKY%@NdlQiEapf$9JpbufThGIlRmFA-5V^N!>w3 z_B4z1r29|LsxEtK$8PP{j{gNf2fvpxX22?%6tEP0Ej5CTIyaFORWXPLh|<3byijR^ zV7~Th$7iHY|50o%0>zk^1Z7{Afzne)Ndwdi&=JX19T{|d@m9eLLd`!1Y2zID@~A%* zp4Q(B*_YEY6l#fS5mKxglZzQ2s!d0qSz6DGLRA-~gTEk&UCMHdT+qk}5wryyze7bB z)DPgb(HL^}f?TG8NC$+A^1OieO2g&RqdFrU{8tQ91;eN@(g9&_l-}OpLOO8JjU%!u zssS`oJYQN426M3~WeiSN4}%X)7_=UO3M0*v5g_6a`>}EbdibfBj)>pLI}gkiHhd1F zq_qv8-y$lg>Ody9g2b5`2S`RQ&<*l-INoDEFZcuTBs2sDvD9F+@BM0YvX?>vzJ@2- zTK=)$odFs6F#i6Yh(CsNtWTmgkeBcBF*qXj>2?@gslma>B@@p*^1uTr!nV1j?gTcLWM#;ib0CHNDfa%?MwKGZZ41w5x= zj7ljAC3dy|7HEqm?fFlV<}`;I%DkQd;y!pxb!d}=PL}Q1QX)rheyWQF!eom!Lq28F z@!r||9KG@61WO4C_hCqJ21eW%RLxPu?YK$2oGp1iY%7eLieF-)HjmbWbEdRF@zY1K z4!DjcE(})aNx3{$kGj&C9a!%T{>n;aaQ-Kg<^m6@{0yMbO$2H#p}5meCXKJsuL_f_bzYC=&EG6)B|dp-7}>ci5$kxJW@F_*o=}fD-1JMeIPO zuci#{9w+Uo%V)Hx%RUFkfn z1BUedroHCBVC7+R$Gp2eHpfRynJ z(dTef5ba?V8+kJemv^m!pQDK0%@Nd~i)bCYGPjKS3MJ>Z9tiucPIQV?wK{m3 z7wbDGNpc$aP{72gE1<%m$lzG5)H4bk`7Z5{MJ3V=b5V>mu3|Hqwc6Y`4T|Iu?)Bv*H~_> z=UGLG4=OC=2vpi%!=HWdW4HebZNXYZV3|jLwNQg*qyLl|r~Fy*lhYw1fOU??DlIwYjYQ0MbCh00cpBz)n@) zsU!TGAO?{u_7lpr@>Sy9Xtsi?cM*XUN7YJ{fQ|Hy%|jZwE5jRJ;7q_ql!XUARd3&n z+QBeD57yqN`8NO$Y!=Em^V1hEcwhinvlw~MzpxNNRJrQG`l5n`gw8~UTy;(&q=2ga zWHVcH9eo&b(Dx(@T{x;E3vpWN2(CBL2uHb858g;V?Gi^5l{3%*QAp_0?gp=q1`e%` zWen+ryAn2_@P+9(1|xjolVKNq#ok(1)=+y?)HxTtBtxwJhNYcZ)MG%93Xl z7dMbs8fxKZq8`UguSb)tG2P0VOZ^$i8sn4gfH{?0XCzbxA46^hGGJvtlDurS`>N&x z;35mi{T+!!b@f2w0j+Z6>(jDucS|BsT|SZ}wqJCNSZ0>4(=}aaJMF~#qce1}7Y??VIg4=EEuy|Pr?Z-18^P&TE z1h>XJk{+BbMkvc~=mN`w`QW2gU+4pEwjH$oy5B$I4`;mbx-6@Tc7lFiV^Uj%jaq-( zT)J{)S@H$8*$AjYn;{3A0k)vY@xc|klKm|4xt4y z&a0`m(7vzaHljWoxCAzwCOE13382DhufwE>!6i2{=eVGjH zWA|V$f#XlNb;2yyt)8_d0I9(OqXmgBHibS{gYCu%2rWn$TrjM7g01ghwZ9hk4Q(ea z>_z?na@+0GJT{@>RIneS*|{m#bCEmhS3^LY^Jd3KBB}^WceIFP4r=oqj(qD_7qD*; zy5KNi19BqnS~8c(SLfQJt)#{FETlX(J28i$emO^ZsT5;m%#HU)`UN`{g@C{py0Nuy zDPE|qZUmgDEA+0!ev@+r*90Sl`{ey*lyM&8-M*1v5c#7cIq2rI9D#MkVOFRfYlF5i z)G21HbFw>)iK{k_f@81vRF_R`_`$f(TK0;o{$6Dko~^z?(sDUyIe#Wvz?iP6@BrM0 z+X0geCC*Z#j!7(6LxT`JK@J8%a6^efQiB+_wbF5@ng24SgFB_jAU8m(LmEie^`PtJ zq$`#4w!Rv9u*(o?2OR45?qPV?rHLy`Ou2}U*taac9zaF3d+Kzo9u}2RPRnj(>sHLT z@RP_q)&hcN`WJzr;azOde1Vx=Yxq?uD+e{&*A<*KCRE=SDc2ynx%z2{qp}+zH!v7d&#-HW-tw0rHb9K_X5ua&4e5}l+S;ga+C{*_ za|oEfo(ha1?kk9=Q~nAdaDtUAK~ryI>i!IysY(?2I3m5^0LEgn*>32@O!oDnS+vqr z`q3QQESf_yQ6bI*>k%A;%mahm=_|p5C3yC(ebHAEvoR7lcy2r~cWRRuDC#iksL?s5 zqYTSGXM)i#4>fzuQ(I0xxX11az`jCw?XN;{IsXv+iqphj1G&VqRJ5CJcC;O02dco` zbfbVw?njW_3wAStUD4(mR0du^XmVL*Q74zm^dd8GtS*PRpaVKd{$WB1lZEq2SS5VG zDBuI*10PVsd;ppcC?7tcH~4^>NICmhJf@DGiqT0`jTvMa7uqzy{y!)K4RS0bN@UP6 z*P<+xSNwldmT?p75?XA_x&%~*tc|>;&6xGlz7tRpc1{O_WG;-g;83(+ozZy5mj0aZ z3}@a}QwHv0^QTAujZDK4MRE*B6!~z2!vRpp9GyYZMflr}zdP}F3;x>ihY^npGV-_T zHoPD|TMqf90hdg$aS`HU)eQ>3hDMaMcN0K$6SA}Ykt$-)oO&`+DGx{$v1m?Rj#LT; zQu(O%BTRWgn2%}~!W1Kf`9PO-gCkHoHQP==2sPFnr8r$;@1U839>4>D(%yRW3|RV$ zsk!z-Jl%kVsOAkwD)&dVExx2}F6!KB6R{y;n`Rc$i`s7F2rYl>FKDvY*c>)bQ#=_v zQ#{!}Q#|=PQ#{L_DW063DV{u@DW1HYDV}Z66c2Ht-e>2v@oMXcK6j+49BIIHjp_!I*4s@8!)^ofbIm>n3kvbMu-VO+pM;iAg(pJw+Uu~eIKl(kdA)jq<1?6D!WC^; zCly%Siei{d zppeD2UD53nB;iCXA5~;L7jw0g*2*29jj!h-Ylq#s4CnSgl``I!eJSrob5SLuU z#^^nOL{B7H*me1Op$i@fLWfxB)(yH^VBf|5#gNfDq>m0VDflE5Jb()y(V)$Rlsfa!5EBFj7SPCDH;D$_1&fcmE(LAd~4sa`$M z9J(dC$HOs~f%q}4r_><2B*d8@K`0yA84hIsR3WphWGX2TV`88LG!pG1;JUQRJRj3QQ$r#hY#aNBWgJ4l*{je<77wJ7Oj$Lw9_{s4Q&ga`d~|L>miZE zph>xwJbaSr!+IZ1&|^}t9*o0$(Z7HsO)W2&Nr-+b+yas_YN_{Q7G?ZbFrAZhSrx{_ zUNC(LMza{KY!hSpP0s;lQ9sI~-8>I5IzH?4ganDC#49ekPQ=^R@;#>ggUEOGE;M4& zk|#B>9?-eZD&XBn)RU0jhPk%Te*qhbcO4t$5AazfZ=AvHgcIO+yd;jx1qY;J8V+#Z zwzJ@1a6929`O}00a|6(UmYRkG9ucjF(!t<%!U=GU1CtoG7jU4(rr{WB#=+or!Zicu zYH8H8kzmCHa^x7+^Gd-Fj!nbAs2M+l+X*+xpO{ACfR6z*f@9NgAT?P}2DcMVfSYgx zf&(0zh67wk;$Uz);U@Xhgky`~0LP}`II$TAgWCzmi@p>`bZ|21T>)<}N+kA-@#q;U z8y!7^iSE=HmZN8y03pbYHxgnS^&rybOb}&EGyAdCZ;Y24Jfejkwhv}~Jez}juK!x; zifUXz?K^N)h$o4C3F5=`_?h5RseENR7E=e=D z#k`ZEwn)i&r>kcu6V9Yms!%<_+j?kRCgQT*IKzeN3bTtZ>JGVxd`kED8}L*j0@xur z1r-_!kOyA<5X(dLe5HZo<}$<=g$9vpH@FiTA41NapjsU(zYJhqrP09VCc`1FC^x}e)w25w8I!^_CsGJgkAL>*= zPl>pXtXAJ1Q(sL)NaZsnzaxFxNJBj-X{@1wmkP$f3k-`e=U^+tq;a^iqE$`tUYkT+ zkvd~tMbGXF>JxlY*3dp87u2@{`-lPhBOQ+I<{IIJ_IDXgQ@9D^^x7pLDd*HK#UpR9 ze3S8SfnpGV4jjq64DrE(5GM5EU?T!ccu{sVv_EdxrcQ@!ho{J4bmpch9iRKmfoB@8 zA1t8_@hZ@8EooSI6WQL8Er<7E*x#A0gipz{HykK1JSV(Bo^!(+$@|_mHJ=jfdXqf{Pqw2`W;{|LvZdZ7Mq$0#v_p zKHJu2%!I`2?vu#?sWWe_L1QqhG7F7~^*d0BD*}H2k*zbynSd&80H7+Gg%izOooNaY zY(kh;XA#dBAGgW~OmHQl6I*4Jrc=Qpz0w(*l@xD)tvR`!nM%V4D+cM#jJ-Wi@Wbtd zX3R~^8!(FKLqHS+$O!_v_;`MR9wsJ8E-|qx z!CHBbcGkq~K$a!8@E+57_~WIs$$MX_DXdV+j)fjHt7kf4fGJg zsU6?W^Zd9m3-YP;9t0wtyuw~hVB8s9HYisq^M)#T%DE)eo8S>H>Vqmv8kQ6kU4Px* z^2qUD$s8Dp>o>5iQ}s9V(O$n156;|CtAf)Wgn+8Q6>+kfH&Y%nIJsM7nsN8(Z`mE< zn|7CQ^X?LMi|Q815v@1YwO_H$)^2H9ha?l4;wKfJTxp7jKA~VU$Pp*Jvn2<^l0y?3IpTy{TXHZgIW(b>BTjf%OAdx5hbA;~#0l?i$-%JX(1b>g zI00_6ChjsUIW(b>BTm@Sl7nH%p$Ux~al&maIT)54n$XA*C%m^M2g8y>6B;?NODwd7z}a%e&$ zN1Ol?rl|!PmK>VU$Pp*NQ__@!VacHhjT~{p-7Ps7mK>VU$Pp*p(~^T>$)O329C5-2 zT5>QfIW(b>BTo2WOAdx5hbA;~#0ej2$-%JX(1b<~NuV#n<^BRFCH&8G78oD0F79-` z4Q7QIJeTGJ)lk{3y$>-#PE2Eorf#V;MPEQ@Dv(|`RlBPNoN8iD6S!cZE|}XCEm+v$ z=gokH-Fp6XaQ58=0KcPAsGwmFUD%99;wkZch3R-G*L@vL@fWdDl-|D184$5U_hqMN zV7KkVt!+t)1QUB_U%nZWBv9P@aHCr7&Xzh*s{6X!+WU7Ce|Jkf<*l#e)^@hUQ>yxU zrsH8B=qpZ#r=<6FH^B>`l(oLu%{36FQl$DIDEBl9j_l&Aq7_=$B_9TuUxWSO2IFF@ z3_|`mpExj*LuZ08DvWcDz-m;ml^I}SF`bTC$G?g(JS_`ju?wRoo>hF13J;mnVBA#M z-b7uaX#YPuJPov zjd#o<#4pkKCOQ|APOp3ul!aY=ZPectc>f469QBu{*v_r>I$80u6`Sa=eEC8Yj~SO+ zX9xlt)!}uT_lr$13=O`9V~1K_qBxkC5%gg1m2k-E;m>tu`-^V1wOx?bxH-> zD5JB$-(Ui7`Sj4jbofS8Mjauu(%}XlJC7i)>S|KT!} zxt(Py!{*M4W`&l_@HocgnFTk_Qb9e7cmL&#FjLF0xkng%A)xH$9$ZG!;Gkspf(`|@ zYf&t2;9#?i)N;+@X3%hbgN9px%S}ubV+IQqZVk1-szvZkJi_~gI*wBu& z9(HxXDH6@)t$+yq!bCT~eTZI;ss_%xZd}*OyS`8fOY=-b_XFd9Pqg}a+RVnwmF5wM zZjXNs`48WdEBl#**Ova{fHk^bpW=~dZ%gT~NNIzK%OWQ3jvm3##K?%ILq;2Ij=pQ& zNIv4~eioo&bO)&MrZ>G8bg}}De>fiSc5xRVHd;%Z9VmpwUNDPsW-4y!ukD6uIP}=1 zps`FYG>5!QdB!ne8R%0TYj^xF|fX= zA=}S^9<8yz2E98`RsD!px;xEV_;VPnlgNu&s(%HZI7LD&4AJ4bKkr><(7G9&2@ZE@ z+0do~sidaGkA%w;>&f9%$5Gu$Q7$HTQV=mJyOG6mSB8}IavuAI`n6j|;9JDi#xe+3 zXD1U5L4qDxld)OGtg>$GPFBhe3f(NjRF@kkJQp;$azjXMA(d@IjVQ~U3C08^$zgtq zrCWR|O9f{qvSw|M&Pql|%US^P^ew)9M8)+((1mY!ZNTn@Id~Pvvg`$s8=bPjbtqHx z>kv)?$-pUj{|p4ULE&e3z*8)ofO9Z>NJ^AE&j4Gt#_i-%a9G5r z>}4*D#a%AZuD>RxB&ygf5nj{h%G$Nshj&MAF&-!`7u#<{AI4|m^6Er1QwNkh%b{%m z#U2;gf9VvHI$D{FG-d1*dIat@IZ188H-X9H=nMaa=K?&Vf3y$xL)^>ow+Mf4LAgwe z;;(_+AAoSb)$zOVZu@)OiANtmWYmBlZ|07nu~CP>Hcd7^+_&;j*6k zF7L{2FPKdP%EqhX&lDz9$D^QVCVdOlQD#=IhwI)7-V(QQXEa7Q1`|AU1N*$}#&Kmg z4pbIz2*1wpk3r^OH7G{EQeDP`4XBc&3?l{K9I!Gfrj<8@#;HTR+-PGFtSCh|RaHqt z=&_dVb%;uAuZwous;xh24t`~H$5+a{8Z8G$Ut|OPZMRL)tduI!0?q_kESf3Dc`%CY zP8>0E?dhVK+KZ}6Tg~GIq&!I4-`tF<&b)>?v&mlcnNMUn0EdTnqm_~gEn3N~e}<*+ zRs{laqySYJ>|TTQHUw$kQZ$-kJ4G~59)-x61W5%OSGYvdgj$%joD|^SBK%>`w!uao z=~MmaM=&*=36kw!#4Om~)XsT^xv|l97ox1#PwvLvaeoamK-jSIk;R@P=(SY!1W4Ql z;&CRvgz(U89SCj&hH|u}4hj!ha8V??778bzGx25lMd!8Of~3BPXep8wN6O;?HroFX z3gE%;c`=G&(ZjZ=?=~03&vk(3N|RfcvYZLp{Bh=f^bN2N0mKsP-T54mO`pAII`0gZkF=XB%N-h-Ms z6P!Z$caV$1gOsTOpYmXWb5PXXR-7T8#v{Mw{lLb%e4}pKc;y3t2l}EMxDWVZlvKNo z@dq{H`ORLaBVA`*J5%{9qcV3>eiP<{EjDdaYz?A)&Ngifrzs4l{Jz#w@=?SFCmy8_ z7J4A-;ShdRhHiW{1tK$h28eWcGNSEm)0mKXa$y`Uy1iMV z!H71_(>%F@yCX9cX(GA(ng$C;aBjMv0~QLwOvxn9G@9(t!fa(^Zf4H@sqCDQ2!Y(! zJtG39WD_SGBgBt_BKf?tl!sF;QXFIbS3#02PoitAWloDZx$YNH7lEGnID6MBjKqoK z4V-VWtz9|$Ls@J1h;(Oqh4^K<`Ve3-b={7L`d9QF%05?r81IQ~>_eSyfQ|4uJw~UU zwTzA5%pN{VlJ^1c>I};278FhnM7a_JZ;POA7p&S3JaaPYg1$wc1yf~jZNK@OF|sZU zrLr{aDsyp=NaYH61uP4Y9IKJr-gup@kMHS54h-%kSOnZKFR(vuMie%mu8T%~T7k!1 zwnVkizbZz^^u@rpn)qawXU#)@i9n+C3-RoZkNaOC{F69j)#qY7R(TIBO@Hdd+)NTQxbxdsG?b?o4 zG0j9)(C*3uXM&Jo!U`h9NB$8@Bhw`*iifSnb|G3D?--asJf6UQ{(96_zSMvNP~2{U zmHL-E!P98-a1iXU%llE%k$Pz=906YgKK(|>Lit7r?=cxcE{r=wgU^q^KuvxD1hGHj zHUREGAz#a&f$|I*ophiy;bR#dQXBYrLJNZPJUWWypDXb@4%1~ zcETwl;J-yg?RqxnJlXe9Di(`nx$9tOu~?B?mhjRmcQ4^(PIwS%jF-6)Ou^LNfb1RF zbnr$zqk>3pDb<6%o+@=0yAQ!<>rAmbT!Y-|vRQ@DsZnUu)#MA~h(ERo{FXT4=ZIMK zFZeOp@HL1HV2I~}8}L&q>E(DOoyDw$&V!K;lRkWgx!*vBq#1lJ3i@wmwoEb2E06lF zlVgJNm22$9AnOXnY#Gy$TUiI(+UbQol?V}L72yF0wenLgNRe}){*5GzJ%m$`@N@uU z_M_qG(n#z>_rmLt65K?%j$#MKMJf6S5Z)1fisfBT!l9d^q&)5fT|<)Et61@mg&dQo z9ion~c^~_AfcRT8A?_jGzY{MRVi94tf0*k9fq5kmrG*O-cKitdMRDocn@CD$gOoBp zW&LKv6$_y0anKapjCu@c7ed<2NJIOTbkYZwMwjE2^uF|-Voy}7OtB}L_fKg3@O@6r4$ihmOEvk~79@xiN{$Kssr5BNhN@{hW41>R1P{sw*a8j!>Dr8M&S zebzZta<6TPv>!r3KKh#u1#NF*{#1AvI4uGYU7jbGVBzYo+^RC594~w$Af&zW2<(gk zg-m!q->C_PyE5TJQ2>NsA|zNk(|SW1$Ekc327z3jCLw!oB>RtEa0@XVy^|HpYJVzJ zFT;(bbC7d*ddmyy%j&$ z+5Rh#8U6`B!P_V-sqp+c9Kha=fLucemQgl|i|EWYnxvyz$Tpg!qX!Br9Vs)oP}p^Z|0JN4#(i(W zt)L;i6%<65y$IRut4;=V4|Q4aE<$_?5W&0gX7Au7)F|wEpv(sEVLW^;;Wr4SyV68G z4_}G<*1~6_Sn-`e7n17Jky6a#0;~Jb2=)p#bl-Ac|Lw(|O5c9?4R#PO^icRaVt5RI z5nD^eOc`f!-i@dQ`l+c>hP0$Z?9*yuW}ydakem0U)GP#$Tt^&F3`gj|i4GhLc)94y zC^A*_tOku@oa&)&u|pISZ{yAC+pJ|H)0-pX_fBs+Et~KupxaK9WH5AU z?*+p8w-IQVZS`*@9|mCBJ{N*d`rYuYuuAP+BwXiR z514lm20)hrNItkxsP1DwyC}e3z+2ek%L-_C;f{r>egG1oA56{7sM66xn21VviTGIq z6YmdquzhdE5$Y#`@4*sw7D^tFeXOJhqW(Xn2VcwFTYBIa+YLQfAm0o^25~yL z1VftdgDv^c4xAT(DDxh+hg&-uGY{CjL~C!J)<8M<5b}aFri9NxqytzFam2d$i1-~y ziy(N-vKJf&YlM}VOzc~X*bVr}MRTz-t)(Bv~G-yz9o?k@RW zNrqo+=G@9XbmzIDNFW>b;0fhl^X% z{M#uLj{jZ}4Hr5Hy-5FAoChFB6X#DRihm$_xVW0xyO~KJn<+`}(xwh#8GmUh<87^F ze1wSZC8Ce>=Myub48K93{uz^|nDogRll~MZeG2I}VkM|;dPTg2$S>ZI-zQ|Qld+#B z)?}>D*!x;zS2Ff9EwPphm!M1fw+Z82|9#p3cS-|*FC1%NZI~URb6x)~3%Aog-_NHW zkRKj5vA8+n@sHs`;;(ulio2WHs%!V)Tj4>23?N~!1G1vd84R;FS`nb+BTy*} z@HYAbLY9bMqm4NxU@S3k2vP?pQtkU^fg_6loW4_u3_*~oQ&6fpcwYh_CX_D^?r(tA zK96_iCoGPSAQZs)n!{{FZleZijoYZBV*a22ZZuEPJCe^a_y_`A9^_n`dCM)leuQn% zZZ3q*davlL#;ppdHk_u%S(M=kXyc}?aUmishrdXol43%Ir5877w5bk8crI_nqp)9! zQGn}TMgVL<@%Z45boNOpjPXt7+$zxzAUfaO=0Dh){2@s`9MLzTb&{g*2F#>Y+!&Ge zSpk1&ci5;@^acv3+wdCz_P+vH|6%+zQT3GI`6{A2y7BSZI9b>JzY3l&PVoADXse-K z%Si_8vQ+$;q)}L6kzj@Y3f$TZ;L~cNmMp`_SE#N|eu6rxmD3mHu)NgKB+*J@%d6yZ45fbMdd?jQn%$pmVDN647lz`%bsY3NL@L<`i>2SLPB@K6UbGom&;Fi-!4G!Y2z>5D7${D5( z7digDvOWg0{JY4B#Sf?fnC|q+tc51IQ)Pu|wGcS5QSCb*cxaXvJc?)ea!~|yTd~8n zuj-=q5tnj4?MyIR@EG8DzVEwu>Nj7$hqquCe{R4}seKiy6ze2dG1N)wG5H8s6njiq zLOJ{bqBJ!z7tY8BRD#Eej$rxF^qVcUg$QrUgj6%hv}58l`!z?+{e3`NV7}_d7)e*G zfY$AW0y0yb`1a4uC_?wpY?C>3^lcDmT=Q}Kkx!9t0YS4Ie{G0cfxk|?_ajJu<6#Kj zrES25k;S)s_zhOz5j4j(<*|N#(er=6`g1)HAHsM7?{Mj|33QhAuYk{|?er-f9QI@a~fkrRrhd*tS@Mt0FN_6Mg@7k;f%^gs7%#f9j zeX=c}s)VEiftJk~6~WOUtD}8dS_tmA#?&Bfl{OsW%6``BR`kd{elE@CiXURV*}k~L zY|g0O#~d51&()!OVt)r4iTd$;@O~%xje0QM`Xm-wd*DdKvk!g@{Rd+p-4RXG{~zzs z9bu>csvA1Z&}g)0#W5G5-1ko}ci-KXODeD#ugMwm{XLc*J42%KSFX|Wbzv62pn+>@ zX*};HExK+iaU6;r#)ab$6LIt4>Va2^BtUmO4pznaIg1cjXM*vuuZTV&Fc$N9pUYhM zG>88xJh?t=@49m3{?&ULFyJxFa(qs}e-Mzl>VcX?qxZG9Cfxvvbn%@ize1Go7(FBz z?5EUG2Uot0^#S5`WDU)3yme~uJwuyO4MzJ_qq_=H=5wgX2V3*#Cld3HxJ?T7+Wu0h zSSsVI@WoQ4ZwS8~*4rx4@U|j)F@8&_@Hx<1YOjICxF#hd=blUHRSQrOJ*(bg^bz!R zal*n?OBZfBD__W!wZo3L| za3F+MyBv*&B~gNp!uiZtIgrhDfWEq}s^yF6GOmNtQ3$?gAeD~2^)NIsuVZ5GCW5mR zLF{Ul&zoo&SR(BpnhtzOf`b`-y3wi~J_cw>z^Ywmxi~9=NEbUmB8NJ4U1N2vARlam z^Y$dGShmcBjZuzl4C>j9 zXee1lXwW_SeSD!Vmex|Y{qhe{HtyyucH`S|2S{HuX-F3=I&&_b(YQl_!_a2nYBul} z$hi>&Wu5C6cz$T_wWS1lM zfk4{(Nz=g;KuYc9lD7)9f*nO~2h6Emm@K!+uA6f3QGnmP(SF_y%pAVXWNJS{Hdu;3 z0BU?I6M^98_+cL-#DJE00Lrv?u0a)*6>ujk;$HyPRQJcAsR(|_u;#gHcX?h3GC(13 zrCZ1Q>hyC&EN=7|*jZ+3A?$L+u~X{GYC`!PK-}D|il&SA7gGHc@Y8|6g?R5rbx(() zN8j=4q{;EWM)nWV#)gFVAJ924X9jS}L~ScrH1 z$6|dHjbn~{za4yz(`6|KLz$e7_!Vp5wFmz!HHp_A{y|V`K`m<`C!jizHMYzD{k0Gs z{~KffEYhK4KRz=qrV{IJFRRmid9OwNKSsF8A0bJ*9ICg`4#^Lp!DNd`a19z@J7EM+ zKf^HsrbDs-ztn#QRqB<6D_kWJruN}6lSPF2_4{18duvvBhE!2CjC&Ogi{CfeN|vu@d|afe3a9 zR3yK_8~k3;2hYjV@v*N1UsYtlR102sBw9~l!jtjp28&rQDu9wFhaZDK0=D+=_@TlG z{)88l5fyWcDcAnYG%Tz`JN+-b8d(_NvbuaYs`eKq=a8J!xLDAnravZHTBBut&a1!CQ`SCU%dLSg~na^?nZE6oI`m3afJb*@64o`?mv4&@SYq15e3p$1s2ar-4L#N|^n9+eyMZ zt?57!igzfZH;rMZMzpy(vKMc-C-UtjzR4rKLL4y=cka=bh>D+~B+>d11LSy! zYGMyG^-O#*Wb#VCA0xr`$#(hn->1o27$Zy&iNQseDcmZ0ja61~9yOgfbg&ox=aBze z7UkD)YeTM%=?jh+@R#Rc>BZ)|eoqaj{@^3R_wQ8oZAQ;jdk=%Nhx4Ce=V=DNgPCcC zkslQ8F6@efp&)*%*CFOU(ptus<-;l9DMVCvA|KZBr3N_PnB&RC9G39nD#2~fcORz& zsUzm&P@E{@--(`}9=1p0*e9p@a3b4d`%%Hs_g6@Z($Q|u?S=a7v%ERvC^Nqw^f@MP z)@_ijIbzrMf>tn0I-w-7Plvmv;6BJ# zbIAK!Jc2uXv#}R>B!1wQAB2o;X#1T>aHZ5Kg8A`nU7}e$IXjygVS|Tl+V~omQU;S zG_4a}(yKxEFw6PrgJf1D_85P(r9=^!b}eMGFrv1^u5>{wzXol!j2c>W}^X zPeN)c>z3r}d`YX}_YCS~bt&5s?QCAdJdXbi7_H5xSBgtLRw3Q`h@>HuPkVDNTbq0U zY7V|qdwxdmZ2UaSgY^Fss4A2@s`E419SJ9*@QQB49(={MBb$lul>4#u7n1H1Ko`8D zO?dVt9!?IeH&PHa{DSjL3%*^DO^TatLQ+*kKEfV0Uj%NP9wXzN%1uXtTpb3A4 zhVuV|RM~j8I~r5R#kn|hj3v4VA{>d|X9O=e;ps8NAlpOl6g`RM!hejpz820xEZw?B zcC_-WZUtn*~@mv|4~$WryzkC$+C*#|%BrlQX)CAQ*& z#N$l-T=ISg0OK$wU^l6Kih6NR2{G$xQ>wZ=vU>@K!7ET1ES1 zK(!Tz%n?_Jt5tlf++Xn!>z%Axp?a!a>k$SREoJ$BTq17Z7Z&b|;vk|t@r~yc_IfDr zNdUG7b7i&?Z<77M9@mAeeYD!-kJC98_sL$cDO#IydFL?qM6;cwC5}e9}6#n2~5XYc53Na`s741dEiN9Jq?--}>?s_R2Az_FU@8F07a~%*U z8uG4ZU}68^T;i)lIbeAEXTbRt@IU-3iRi^!B(pG|yZkwbnEVxi9w)OL&#iIET`tY_ z#BxLZ0EsWhUJ0n+Zki0$S^SI_VsUCXFXeNxK)vIb#URG&Se6Yq&Mj>2dzjntZ`Q6a zGWJTqKg=wXe*^)OD_F>%Ns5(n=)EpYf_E#Cg!sc?7GczeS`Sz#_tr0X83Gb zk_efrsLUT`%BSldxskBj$6j-?WAFqgqAw=&bu&lbJuUiCLjMLo>dxfE zx*YZn^1NMpCEQnEqS^@X2;%kz_HTkz9NwM4&TTJ-&der{UyKo!yF~Fz+M!(i`5dFLT02^d(~F6oO%4 zWbX(&3UDER_NEr&1ioW0fqzF}UOlrnnCCA8Fs~=r8{p#z%nJtg26zjBd1!rafbS$Q z&#&(d@Q(@HwS4b@F92LfbG=F8CfMu4Tad;LmoQ0(@_Ms5bQ-7doEl?SC{Mu8k#p$& zP1F~TV4BC%yj~u=o=!I5{lKC7y=3YOqgGIV3(;9MHdp{>MUi)>#|eKEr{WSE!K}N) z(qiUH>Gz1vb@?4i`<((ooVep1TJk7Zkz*K}hCEslARKW6IH}J#Z0A~;Pq%X-rhTEw0b!7c5L_h^(r?8pWPcZy40v4}jPd5Y1slYj zaTu|&fomR00hU{)Drs4=mK~vppl1$AaJ5*ve9_qaV2jLybv)=a25BtF!O}h~@^EPSca0?=9-$sesJh#r;+4efD6=w^&d5Ugk zOsP5sO4_%H`x9M%0SE%`INYj}fOd5^%K3)SF1JO^_IpY8Zqwc7^mducWA6aQ=6^$x z;dWFWOFeyccgvQ_rNC0UDpx(yH?{Xp3r2185aF29)2=0f$}H=cbLcd_h(GCp)oP zb`-m|0-k#S6~6}w;5r%r*&@LZegIgp!C?*BYyU+OGwGg6Z84-F7{Ct}cl6^>-1qPn z@Z=H7Or$%g(+bto>|986nm56&scUVR6C7x%xdGHzvZ3P3-o)<#C7pXG=7_H(+1?xx z_r#N-nI?hJCb>vwz2Zup2bGq427Ww)DJuGx>(8ZZD_8Dq&_R>0+k}5aj6WiL zXjejHH6)*c_oYx>kHwl-P_DrTjCJj)^f_IaiL=Xkq5(xm>vnqrEVuRjUwcsww%Jt6 z1}-fOJWe#4z9n9{P#*?d1m;oJ!(Rp(6Q9oRmGR1v&uHtru5Y5F3}S{ZQIv6dYrCp-wil$r2wed!I4(U&>l$@)@o z0;uBL&_ZjLNVc=1Y!~QDb$&9{Mpi-#hI82|Fgb@K_0=Uj2E9W*P!?}|BXu~E+zy`g zaFZL)O&75<27BU|^qATWd_5M2>lM$4;(;3+tBdv~mFD`kqrOw~%?t=JcK2ZGIXIt| zapofM?J^p2#%OTY)*&Url^ShN@R z+m!)sXK151zyUHifL7Ddm~ZFHxP11m)6kfSxi1H!!8@X9GNxzjPuLJndjcPh_yZrE zI!tn2toO!zSLmPkcO<&f_kxumO>Gg5h#W7mje;EZ5!OUBq_Q_L9i-A8`^0Q>b@@we%WYir|USB{)MRtvU<8^&t! z+v#KLFCGhr`md~Q2*OPpFB!$Io;n?cUV_V0=^_zzJ zPu+Uari~j;9J}_+;EJ)$t1mkE;PnS?IPjnqhwOjA*z#3}>@&Tvt((U;UO5((e#Y21 z>xFfyY`zOWf%(>ruPiEtggg=>tViMYew*Kq8dI-H!kpPpXog8h-p7TXD!Chb&un#!1W04A*b2T@r*>E{+fe zTgSI-9q+$#Z2Yp|;??_&k6kmq-!dfH^1$gWo7Rty^o z4o3hrW;$#cX^f(Fk7azUHa;AV)zBKXm=YF!_?bwl^@m$GkM>8%5NnCKYW=3IW5dBE z{k5@8V;ja-FJ3bqjIZCcSc=w?0X)=ybQlIitw$!|KwnN@AwP?1nHe zYq0%1+lDV+e7Hz=ERFrgY`lg#qaR)UtS$YqU^F#_%Id~TB1vuO8?nI7Tw*N0t(0w8 zUmM#!VJ|`I{~dao%h@wIYsRh_+pu+f49en|^_yyA`%U9mtsmkgviSdnM?%vKg~imd zh59evSX+P5CMX3_W5Z*$4ePg1aqf5RSZ%+<2llz` zG;OpcsBIj_aN{q9AU1?(X|pC% z%dQ-&)z)9yqCx)87^UUKQfa%0uwXZ&SdeA4@%0<77{(a8p@opdC?S0^o9sF>w2MSF zMm-r*`uj0>9(l$Im;mU&%eCpNILIHk{NR-bb7XDD5R2~sZZu|}Nn?J6=M%@_{fzMt z(m@l>-2W-;+dB|(XPsd#dlqNl5Vy~vJ*PnbdS&J~p(wSTWYhxNS|+C4Mde9rt(;(vyiocT50b0(kuBjV@D?_ipxtV|R0;rQ(|CrHdyc+Z(z z@t!julix=r{x1^WnPL2p{GKMioAB$I&t+Ijf0pkzWl87Jxxrkwd2fz%ei6Uj=Eu25 z5L3$YcPM`mO1UCWY!Bo=n)h(7l$4w(zYlc$Lx*R+(0OlX&itX1IOokGP9MMjo4q%W zkE+VTMb|!+s#Im3NdS>BkAX-CVG=?nqD&zHK~V@v0i_`oQVD~!N)S;LTTz;!olwyR zwQ)j)76)1y#Sv`>G`2#EDD8j)wgW2nTWjxgsseiNeeeG9-XAyoShc^k*Php2dpzgF z(7j2_`Ah10yaa1c+5_=1bVfRJUTDWMUuPc7^iX`(Ywir{*5PD(4{h#nWrz0k_l}Qt z^w5_bxyDX*Wci=Evi!szuem!>daoF~AEO>Lg`VlP3GNSj?FUu8V|t-2de8QBqTJq{ zdv~Hj;miUjh92s}^*OOG(?(Dawf5!mj_b#HSl$0McM2WJ`DacFoyggQcrY5l_oV@x z?)0;`j7>tX7kaPIXM`RQ`mNA}K`hx*=y;*42h|Po&;y_e^shl&hu?u>>obq*XJa0_ zdu4J?w&iiyo#1=u8PEj!Mtm~|Grwdo^Uo7nFZ3p%w-4?U^QpK`px!)`IFxC-q1zHX)Lq;|K@+HUD93PvaP9$3q0C|2UcHBL3l0HIpwO_B zXw$85d+70D+;(q??=j&F9KJp^g?0?*_&*W)lhBbPxW*nEaq|cd{bK~T;JctP^vejY z;WI`u9SfR3D?mN;@yJi0UH=uDe)g64YGfg32GxoCma`v-&!Fw%ep~3*Li>;Uqp$VXPh5D$#s1&+G+>ejqJUl0~a5U#|A!rP(AI&Kq7|mt*cr=$ZqmXH?(8)qC z5xNG{Lt6`3^6^5}*gb{&!FfwKKZ|ei7_RNtdrLKBMuqhJk+nDf^n*6ohPtk3nu z%<+^QEA~)Fp}8g5B_1jj_c=l*3TH{lh2XCe&bE@ZB?RI^O1ioe}|B?tF$$*88!Riz@MDYxoM%jYq1Es^S8$aVrmjV&)X6B0DbwF7_ z1%hr7luV_9wh79h3PDfPtGI~Uj?R7$5WYiO=0O$&N4tq3EcZ9rB!c_wCJIt>Z$r%zZ8{W(+pa2e`FvOC^e zg$s>zIZ$`}yG8u|Wc==sSnf69?iI94P!HU>=e+C_luNG*dPmS;+?Qd$LqNSzt4Ae; zV?h1!w%@PB?}SJe8sxLMcFQRmSxKU7pj@0iqzEbi%A#?UsW{hTfe6puW{Y1H&|sim zf-V-xi8N5qa-g9!iH6~0@=0_PM%>;s8E*>U6mA#EN-9>H5Zi-5{NB7N;;a??zjE`DE#UoBM&`bCf*^~yQ(xHy*iv_SllfU}O z(5olJ?|z_>Ku-#KD(at*e1o16^p&LW20bU}7a%viN&5uFx;Zaz(HjbSgF! zFO2Sp&9wPKmqnk6K6FiVS8(o#?g96X=ss{i7o7w8R`glm{Mq*+LUC9{+hV-P=$@Da z6@}N?rhy)g$pU9}OfQv7=f#eI`+`{J%!=&@dB3<9#*PLjJMIF=FN$jfT^5%GdX3QI zac3f}lW|=k?~CV9>G7Pa9`Ve%Heo-)ewy$T=$u53IhfcTHOZ-S-uhTk)GO%%l~1`z z>^od&nb1i|9K$rBbCW6%Dk$ztlcvCZwYWDXO^5rDq>HS4nvt4?cxHhn(J+6YKdV3J*;yRw9HEs$X9>MT=whMQ3SBF7lh6mUauJsEspCW|x92?n zyFJG?pu@TF9nyhowYWp0kx8a!JJcf&A9Pp(`fG>fpq)Bi4?3db2GD68?*^^!xD9kg z$DL78^nAxbZf?7gZae2cbQ}jxyYvdTU3*z)EOt*_)=Ox<(6K_N3k?XpOz0}1YlYq| z^kJb-3w=%Kzl8or=n0{_y&QjZC#K(sJ6+u5V@?-wcZOThK)7|CpzNLAhg`v4Wu0+}M^P`K`9jAEoh~#W^fIBVgsv5Ox6p@$J}vY$q5l&4AE76N z?)Gy0(VdunBkpu@laD!F#NAokS>0MZc768gcD-lnvK*ngpmxp2b-x>-w9ce<-vW21 z?yR4Ey0eZA68BmS9RYGdZTb|70y-(`&Kl^ zHnS(wxk4Z7xy6%9FZDblI+t37qkHb$r0i(Bwl7T|1NZS>3qdFLUJE+CH(P`Gy*I+G zt-<0xoQK=`u*G<#kFB?`570(MWAQnAUD9N_qc5jk*)Q9xNb6gmAGghiq%(lJ7 zJ0-dua^lNov@-L9=zO3|2Mq(dM$lg0;b^>=oi-WtSu|b{NSR$Y++N==(Pcnu4NCLk zK?8cZtM)s?TLE-f&=FPO#hq97z~3JCNbd~nBJAqHXs7*lo3JZ!qe0gqg?Ji>LqYaigIMBetwFa4`a#eUwaI%0{Ji~G@`!rC zdlhc!#u~KSdmYBUBteJNE8d&X(rNv*p=g4Sdv4}QvOM_&oj?a+>XcF-_LdUH50dx+~S zlR691l3CQxLBlXs7eq+5r%Bq+yVUm#u217C9{yH(SNQheFzz0p&OmqhUc=hrX@j-_ zok<6@Bt7MO8#0)>a5(yhuN5fIpnX8uwAi5izJs`9`!_**=w08()Rp!a^dF$^^r}H8 ze4k;r2^Zn;*FwISeB6F<50n%{2c=;F_qxv%KlWkNtqmF<^F6}pzrF79F?&cFPb4cL zDFr}o_r_PpSSpN~fd&w6;Nfot{Sebp4Wxd8jwp^LmnJ#rdm2Qy=d$Dx#i-YvGDDj?j}5i~kBPYt8P z2Ava|Pa|k*9{cH*9zml8X?+<%7dd{dkX)>h_p;a$HIkkc)I!$?D!`s0*Y!F7ajpW+63P>I| z==Qi)NMbR^aeBAJ-9d%eKhfxsxMo#I-3;1=aARnMK`$fR7%J6BQYfMc4qC2?XpV!f zQN^^uge!iQlFs(3=K*7yp==NRvis z$&>LMU0OOe;hW8pP=}(F-EEj+Q0nSk3ftWX-+^=TtrpE%^ep9@;Y z^?8MZxIUK);y7PU9Bp0cpm)#?D;)GO&{YolI7ZW{&$X^`P(o5Ze|1&<_PRR= zS}kQbqBwr+EK;Mt4XbR+rd18K7ijEy2hYyl8R^z?J&rj z%zlRrN>6TuUv0Uh;Ozpxn`nhWeUpo@J9Dc+!;-tgZ;L_Y$u-u^)bSi0?tFy1nTibx zBHYc?WYFb;RvWYyvD{1>47v~D*3v(W+RTWI?Q8r_|C(%MP~4SE3Re)_`K{{yAD{1Mj zhbi+yE%`6R`3P+gw1$32+h#pV+YPePJGvgFPYsGoKWS~J0T*#N-8&wqEJ3;qkJFGg zenk!%hPMJt(#Sh1y|3#DnkNXeZLBnaW^$Z+iPsi8XpceM8+TB_EcVkW?4U`4bZ^{2 zw`=6xoIcsLleQSd{pfG>tU(W@x8iy7yylTSVN-y`uCuy@m+#8>y0|xC( zuTZu7A0VUN+iRkW( zpzB%UE6qITdo-g7XoEp}GxG7I+$Vy#1}D4zPCsjena8!R=cw}>i3R9J*B+Xz5&GCV z*FPxepjNchGJ|++@jPu2)I!tR{Ykw*G*{N%j<|w(Zr%??izG1%x_`N4`EO}|>zg!M-ugv_Y4QiDqi6s^{*ZlkR zn54%u_>WxwqJJ24f96-N59okFEP0TAHRutfeu$DT=2%uri~XBsXoPnE!SxYcVf=V@ zf0+KLk+jNTTIZnHsKd0ygxi~$67?}XD@c#iAJe!?IE5pM$LS;Vra?STe?o^1;&J*@ zx~5J`@;Ln;y5Arkr$3`@2Jtxk8ErR+EyHKjDu^|?Yt(0STqAEv)+pXTpU-jbm38u)JEJk|;>Gu1Q-q(IeVHo_5n{aHij#1}&Nx{pzDqqnS zLE0*QMR7s)V{{Yz7CR^}>T99~@uP>cZlZ5!(*i*<_J2z|401u5>rkP- zr=*3Ff~@AhrymUB7WqQCZP8X8ru;spjMq_YQD}pv*Q+^T7#N9J_@wOpqo2B4fMGn zJ1-o6XIYbc3qKoe^L-nI4NCdb^Ku*?IOwM+Z0kCR+}PN4kjITJRtLqo`C$hB<5*JM zu@NZK9Up;uyAvJ6{XN-1+}~3i#Qi;09e2tw#GS4@ve?i%k)e`-csJ%Qlp#a)F^Egl zP8EyfO7CkO$G9`q3_;r3WU4<1(gc@1S9LXX<8+ys>9Yb?2yEg7oYuN4>wCW6`sx0cyjQ z8u9My0Cm71&dVTmRFKwPJaC3Td&OrXUh&O#4>o?h;=9;A#6i5`8?N-ij&uDV_Xssg zmU)bhyGN;M4*J<$s1`fO?I~6p9F*iKQx7{R%TumibWj)1x#}Ya_4ABZKWpT@pi{nQ zqDs4p^Sx3m=0w%cAl}WMsEQ4m(`f`GXBZUfGzxxA2DNmm09tL(>Q04_+-%UFJCy-( z{M@T{cdCs*Zvstn{Qd(};h>*^COatk%vw*SgL(qtSqBs6XrL($ngTS{LGyvmb5IM= zGzV<}n(m;7fX;W&OF$Pms1*p$y_odA1j6$$2K@qbk%JOD*Lv`HmhtNXG|NE+K-CU9 z2WYl~W&+hXr~#WA4jKkj@1XHOK?hw3)Zm~7pal+E4%FzN^*|v9Z3Sv_(9=M88>zKKTF(*(wFkP?K?8u6I_PYmKd4>MNVbElgO{nd3}PL;TzzQ}>);hCdZm_R z9bBe58^k);qJ|p8I=Ea-Hi&ibN_B}rtb;4m3WHb&uTr-e#5%ZAJ#G-|;MM9igIEWz zQJ)&bI=D)yt94#j2d`D_4PqU);>N9I(V}>VG!%!T9tN<&Kc|ApHzQ?SO?dsQiE6r*Q=QZu?}uf ziw*h(Xro$V5bNNd)qMuB4&I`kGl+HYR`tF?tb@0y?+jucyj>-%(s^MWyhHUgh;?w2 z8f_5k;GJr^L9By!sYZiX2k%zb8N@ocS#36mb?_ebltHY6_o}xIVjcX8I%W{-;1=b* zR_BFvaI4BTh;{HjH3Eot!6$WT@Z7I15VVq}bZMo(sz!t60c}&O47#+-HrIpdPJ?cQ z-@|H$LH7VXqFys-CnO(LpBVHy{2o)k8g!`3rJl!C#&w+fO8N?tJ5-KAuC7?kt5So~ zfu2+s8PuceHrFn-$e`iyds^LK(D<&GdY(~R47v!CyVY)kLS3(-=hS-!UD@>}`iJ_) zLDym5GiJ5U%gtS{pyyQ=gEm9*1vSi|$Kbb5O*ZIx_`RquHt1cX_maBOpwGH)pjXr_ z8p&MvRdu(6R(f7ldj##F>~8t=n##PMQ`a-x*Tha>w2vQ*t@1D`Z-e;UH|%$Qx0^g+ zbaA%|6-IpS>mc`1Nsm+GIp5N5Sb5v&xmN=1k3j1^uScNe>Yom}39-ECpiQTs)(F3? z@O#UV+};K~)9p4-*zX1Sy{)RGCiHyiZB^@_9iF#UvxA=TyrZsh&_6r}RMa22L`QsF zXYZ+Q263Ier>X?4^!}~;IG{fmKd!;|)MkUY2H#V=jO4!VuL8Yk{J1{fQ^yVB`g~8t zVcVGJC~tNzgk(2^c%_K+4B}Y{(lh8t_r9+8)LMg1bm!C`Fes@V!eNaUTAGO1V+WuK48qL)F_LK4U+qN(|z&@I>t?r|O?5Y-r=}h+pe%+ zVF$I+XX+~lEmxnb#W!n7)}=30=2}KAw5-Qu*B7c%5bg=U?@KkyL9IaZ*6VPrS;th> z21YCCk3Bx|98*ynHQL^7p6e_1(4Vy=Yu(rCSwSo5{vNGB<8IM@tb^aE0|v1UeyjMS zhaBh59%Vp74SF8ozEzV1wb0u=^69wRZ_vkrI^V|OTChX+rRTU>eLEw)PW?{ZA?S$u z7Lwnoy9`o28Qmkute~B~GNtE9&v$B<_;G)@iT#mi(Z8zIj$bSNs&*JZ z-hDl(4j9DeBq!BZ22D-r5q(m5?`DzSh9sy zcIy|dtXT$S_v#nzvUc37{RRQKtr=T2D(%&Zmw7cAbV09ec){R}1}*HB7ae2mGH4Z0 zoON7~uH6Ky;69FpYp|6PtZ5p_N+Z!~FzAYmvgkzX8iSVlDuEtw(D~6xR=@it7VODY zM<-h&4B~qiDb_BHkU~DCT6@}{_Z-v;zaJd5G&;@7ctFQl;BBRJtA~S@MrT<02F3PX z?`da^bI|hWEbBrCT^HTK3Tht#VLbZPIK=uB(zHcqdFR`<@Q&er<| z-6rV62X$VyL9(;;v!E7w3Mkup_8}c^KP02 zk^`(A2C?Kot6&#P9#Q*z%_`R#ZqSxK&FU=cY(Xn&OP~9q2U*41&-YB9hoT2t(+uLC zg9rZc=aTfIEgSKwd{;CctQS9CmG6n>XTbESEU(H(T0xzHwC&l}3XQz)_Nh>#tXp*o zlIu~{vj%alM_V1A;&|53cYWT7F0>{YJm&AiBhwq>*n*U)<%e z<{7_PeGdX%W6TgwJHVa5}j+! z6SU5|t?#kubFCk=AMNh@El~ao9Op`$P@RY#XN?uqLa+9%P~)w`g4WQ{zLs~q_0T?+ zY@r|e`n(gYHwCRDH@=`T(OUK*`>mslei`0L*5a2m>ecTlYqE8>AUy_5w(d2E>uj?1 zj3AxQ$<|gu+Gb6*o_G9CL{GNf*GNv%Dy?f?<`i1!{C@dVY304bXeBlGI|ww*pq1S= zM^{;E4O-E!pLdG2_*E@=bHB~eQ?1Vp+SIQ?oo97^P5W){ca!HlYqUX2F+)1fT4B)c zev@72SvLyOePx<;z#!JT=~m8ujz#Ol`Btt$+(zeHd4hCl&$s+-P_u&yyyshMbvPfN zpxJ(FBe%& zf?DXieg)o{*5?Mr_iv?H)~tWBWD8~YFYs1dac^ogqwSv}poB9`fYvq$T+(s?^&jETs{8rMM{*%0ZYx7&2!b-Zee?HBzs@~SZ;~g{}iNKWv+F=Aa0epmiK_fNgp7Exz+|j zI?lP)WsCf9Y^1`p@wOtVadu)a$H04!Vl!toH@&CEn$)x3+x1 z;f|XGzf@nvceUI&RdBk4lnMAAsf z)7@7>-bJe=)So~tJhQ=ZYWE$&kBncZ{*Xv&U+vbR9zRX~DUsy+wu&O%7f5|_&G7RE zVH%m1cJGz2J>ofU+O6q_!v9F9j^|@>e+Fvd=?;!lQ|2fMYZ2$)MPCbtW3cEuaqDtj zo4}Gf&L4%Zsn&$Yda}HB|L=27NGjGqj(JX^O)c_)<0AIOjenu1m!0J;;u=Xy_rzwK7NH~`X=XCd#!oOZ*!frf$ z(LS8F$WU#phv?z|eyJl{xlzJKmU^A!BvQAvJCe`xwq?+6-QqK$z5H|v``#w;Xm+f2l)WOU-I4u~Tg1Y1ToM+wr`;}kRphy@e&2UM2M!h4QsLZM^rpn1HUIy_eaMLi z&;B`XyEi>ArT+gm4_`>Gz7-m&$-g)DMOqTAz1lv9-7c|pQEhD9K-he3om|HLhdKN- zTG&^Qn~@wnR%(tOVYPdQjJDbxDWgZ#$Xfls?*Cf@zgGiU-B|bZj3v_6u^V6gk-5tM znr|7c{yz_;t(NWu+T!UvXwBE0NVk^PGFtPwM0grddUTjtq;i?BXKp$MJ7R3tC{9k&j})Yg_OL~@0M(r&IL zdlst4LCuLAudf&R4MHQ`cSvmfT$dvDweVahyZPBJ+pWv4`MT8qPwC$zem%-Zw#8zZ z^+nc6r27R46{Z%wA)NnrV}TxLBjf))cdMilu2qW;f#Z@^w(D8X2Y!%|^iz@7Zmm&e z(q7uF`H^X9zFs})*;k}*FNC#c2)gDq)iWRM`?aJPcIy=fdY|y=ERI3f?eYHHj&Z_C z1I3pHL0!~WIFb6 z7tB|reRWUQu}u~}r>>|9uYmO-bUgkiQ#79VOu#!}6Y(E!mBBNm@pvM18ve)Q8Ov$- zA5Xn-eAFAi{qbGT{`eh$@B{FhhxZf@#%}@QDZstn0z4mAL|#1KR)Qzjys8X%ES^3a zi{EnmKNq}n@jDKevBu$d0{&Ofc>FKKn`bJh3Qvb+6Q2OCv3TctBWPE3Cul3)ox${B zp*w}{7P?R9>q6fZdPwL|&|&m7DBia~Zw=bz`_cMr(BFMNV$SPAm5XIwr=JJy_q|Th zdF0a;(c+SD>v^)>tQNDY)5HiUWGbJb2>4_c?@n-@Aq|zIZEec@>W~PvI~oMZ{Qi}Y!{b; z^IwawEWeYM`YwsdCVsv-*Y!ePLrkt~f8N5FWYpwI-#+B?(wML5y}TBr!gu+SiJz|C zM<3?h1bQ^@>X@OB+!9kEzWc~MxC}DKX1NLmUu~5O|6N*voB9>5U1=Z1RJiu}K8op0 zvj*=~3#?^>kD**o`F;S0ZOJe#U|tQqRG`;S~*Sl9T9WC*oWzX!L>2H z6{naDnoqseBZDhcw%Rkel@>^iWvln$&Q{+IJ}b5bd5E^M)m^@!vDxa3{H`h&p{|a} zRfEM{1iDIOa#c)k1vMbi-N*MBY(5xY&!0A0?AKbY^-j3br8a|{ob~nPJ2f5q@U&c;XtXGHVytpzt zLDqrNJ*8txMXIWY^YsG&tP9ZxRY0Lg?Q z_kczXd4{s0HYeZJx;rj6s$}S~=6 z6>ffRbb*>S^jO?cdO0!EJyhb^s*ZF|j^C=9hqjB)a$P=jwZ%QUFuoAJ>pec#hQV2i zb!@$-9Gq5^m;2guIZN}oo*8-&9PWcY*9&lGx&Db5vY>}Qf_^CO6GPb@J8U&Ram3ap z*@_u(U3^7U-hc{K5yjSKy2PAq6%D&PKHI7g%B?>=ik}>r9>q_LWLp;v+Zyk4T{5gf z1)^3CI~L9Lvkf`#lKD77-8QTUZ=>QTCVj5EhCLO(K*BDNu*`W5GOS|@)XT$;#SMkc z{5XE7b#T}h@vEYK90p4g6+3*rXH`_^;dst5iY3=XsWea2Mm2P}Ct;&19Ud=~-J+|i zV))y%QOz9Q3VMmSFBSLI!$(^i(T*h+*I_H_LOEKrR3L_77+?5FtqS6M02T69p#}1!MFpjdV2i|7u|jP4Az0}Vo(i$^3uI?M89E$o z-Fz_tiuB3(aXn`OC@;xQ~X8#OS7~My^cUs%DLR(FL6!`IPHnRhzdu@u;-a(Wsk8Vk}Vik6aCz zzlqET(d*#ehp-Q;cfn^}dOq>%s9#3Dnz&E7&%T3{yT{pYQ*T$7%y+=gKl|fEpS$Ah zxltQkHD|LmyT$ueVvCH?E!IC^Ns`@MiUrmm&;Bm)PW9HH6Nw9~EoWOvS?&`BzNBpN z-G`b2$!0I{boTT1ST{1T%`9QC>3f(hC;TDJc+ELFZmAlvUc_k^A zVn?9WB!&Pe+q(UuDpYUlEl{riKdGbYgHb1w7T~F8u04J$$szRxe7S~UA4DIPNP8W^ zS5MgY*HHtL52>WlD?Nu)Pf%zG?%OPI7mq$a_G{6Z*Ja%QQB4_r2g=2BfF)6Z(G}`- z)aQ$?opjk~Soo;rqmM=JBkrO5i0`oMqq|2xp6qiyI(irAuF)y(EZ3gVFC?!*&OeS< zQe(<0@V=Amv%VhvLGl{6SdXY*M!$nr$j$p0e0Skz$;qhIKcS4=E0xu?aB#|6AN+84{VZksDvQqMA!?{;J% zCrhI_Z>_Xj=swVQlC!MX-n&wm^Fj(+l{ZzPgksL?DXXI1FT~gvb*vC$xAf~n?ySt# zlnQtBnCH=U?LqHU1IA2*CRB|1BIT$%cf^b6Wq~o@rhM&QKIX@i+^8GI9E;A4x-qydyRH#Gr3Ftm)k$uGPY}iM~#}tt-iml2%Qbn+n zp3X&CsY{TPGgJ4`m?E??O)kRREQ)VyEKt=&rKt#eeeER5mS!5aas%ZeIOeVBtS1YJ{fS?X5zrlNzi)y)<=*~7LX+4Drv`qWiX&lj!t z1fu?3bS%0WwFIkTeOHu~w!kIxMwB9-j=Fhvder@EQ7hev_uULkyHmv$4^69p{Af^a zyEVjj4OnAqW7fb*9Eh&41{PPtcX%<|+p=P=vC87rRUxWCgtpIA^;`D&Uv!H-=@9+ib8$C-)7p5Ol zx0GTwq8=<=k)G|@QwklxyMV4uUm`XwAoIEf)*GdrV(_k!p7}Ue<#Xe$p6s$SG9LCU z^=*w0MCFzpi(X=#Q&vPvtZ8Kn(qV^@hXu5B#F&gFqR&gL=CU~%J3UvHbyd67`m(x= z-JUIF+pIv;69~K0^L!cKDbC7#hIV@16!*W&M#0{GUe<_E?Zz(6*ymZ{Tklzd{1-un z?ZZybz_AsGEi04raQ4_^(GRPtv7^xXO=I_Ew8*T!MOF$eGPiHR%;8|hArHT$q{ZTq zWtDKY5}%g(@NU3QEFYc<{oL|mrS>)G4>a86rJrduC|>vg`m$oqe#M+Og>yh%=7zjl z4th{s4T^h|pr5KWpr5OCpkJw5K#!|Upg*X4Kz~;Efs*wgXq2@b)NAbojk7*Mx=Gg4 zaHm<%fo57SfOfQA0qtzP0ou)a2lN4pbMlbIIoWP;-Zr_Iv)RR*EiUFf;NrYJX>aY+hhJ7^K#7om=9y3Vtug*v6-=Du@hov z#@5D$Vwc2T9lJhuOY9@Duf-mW{UKJx#l~gF^@|%GH#u%z+~si_;_i=oB<_j0H{!mF zI}zuJ?-ZXKKQ_K9etP^x@wM?6$2Y_;j9(hREPhS=OYz6!(-XQR^hwA~7@9C4VO~O0 z!qSAR60S?QCE7JzflO9fbBI!WVM@h$$ zeoXQvCnl#Qw@*GZxm$9dWo!B+p8om)w$kee$~GTa)ie{(JH($=@Wm zPpL_{A!S|4ttoeGyanCc*biP?`0gx_#xw$41OCfK4FNx5Es^)QP>A@<9$ya z>~%y#cf8o=I1?@TXWuH&)iG5L{j+bh@HI_REWNFa4>4h!w z;hn;GzdCk~;_$XJ?3>_UI`*M5u(#3!J+~L$7u*|f4a-Np7f@%sfGL~K#{0htu^Tmp zx}gtur(#H!Kx#62eI;7z0_;f5z}DP_Gz9O`DS#CihL!wqyi0flEyX*eE=LT@5OO&} zt-y}dRoIbQiCw6xvHx@}Vz>^wPuHXN&iCC7dXaAnXtj^8mj-+ffiCnt2Kv|Nzk#-o z`35v8ZVKAEE{>n;dOwbzjQV%n<)EL6yEK7AotMBdTqIP7YDjnqGD{OU{=X%B4EL-= zcJE2#7;aBtdY{n0rEu7n#r>Ah_k{Ct$_Ct`{6;vgRF+8)+BucOo+a*KLcdP94U+dJ z-3?lmx)t?~ zj&FArsE)0D%w2G|kJ$oxXFD#}144Uca@hWv?|@&B$uW!)x;B$#ZWDTU=6@vYNzk`4 zGoy(5WwEcWf1ShW?Ky09d*;s_!j6`s}*#+>k#Pm?oU8_xxWBy?O5g}ycK^2=+;i-J$Aim-FP{= z5}b!Rao+yciS^_O?=)~a`z``~yBp{Hh)}Ip-*)4gKiQ3QqV+0LCbcK)Tcl*Cp2rbS zq63C&wS-$;7#;u0yS3RjDH!&iHoY;cg!@PiPSI zg+7lvzDN6T3>*5gK9B5ohSzQ{-FCXwezB&3-#+G7q0v5~@&T7CFZw9I^|vP|TL2e& zKfi|&?;QrU@ZSy2C|KGg8Z8!B+lcGHO`_GH{H1#zes6}oNWz0Pz(D6XMnRybpq!pP@H4I!g=w;S7&gZ0mW%LY+VxVR$ah<78JKAVD-H8chwF2 z=RhsIgR46@dsGi_{sC&?6IwmteqQwge=jKBtqI#`!MgPZ=LOXVzWYEeypyOeI4`Px z;JgH?uvX{~KJV=F3@``$S3oU#1Qs<3&r%Hp|5Z?n9>q>N&kxT6|8-DBk70bY@LuRa z;QUkN!S@YNiyp_hKoXvk$_M97P`r~BZEoSMIYYpI2k#~H;>oB2aCYK-kS+(F>pcegt@mA5Vph@Jm=71js z3X`Gc!uKT21wY!F2fhasc0dK-_F5N%?*oNxP?td71&Y3`=7aiF5Hth(Ulz4fA<*`! z8MK311lmz80X;)4MW`<7GPtvac2!rv-A%QC_E%Se=BleehvN}ni;C1L(6Q<|&~kM> z=sD^J&~ve7wrCvQF=o+tydwHBd)1Smf5F?AEZU-; z0o|&0gWji}1HE7U1M~s)Jm_DsLt)`rl9xbxS+9Whwq676W4#XA*ZL=DKkF^fk=8q) zXIt-rjX+XerK_U?Hu~K*w5NfRM9F#QF|&sr5bRAFLliFSAa7UTggVdYyF=6z|4Y7F}<-Kp(T*ppRR4 zD2jGjKF}AfSkN~tY-nLcnh5%hm8_uipwMuAATy-wwIc7IgLJpSX{ZXe5ENa}_+be6+bOu*c>0``E< zMJut6oWf!w#s_Pg>-=X^eRF-FDW|z9P?u9%S4V|&=QjH1RyW~ePF47n+vMi@dVeEL zn8HF+AVlNwX~954ou7S+gY&Bc^+qPrV^U)f-;WF#pTbbcKYw=Jl5v4h6P4TOJpS$> z;yx7@;iHIigN;i{7B}ECf&7(8vRUJ+>+$`qMw-~bUjr*_!Z)X8}R{nnyVXYsl3u(H)kq;|4%B`De|c?;6r#^@u5oO3k9X| z{`tt@sa$CcWcgxzsZqDgWdB@LEs8R!x@jJ_Qi$5Nz?eWidsQuI@UstxM77Kb%x#N` zf_41)N3L=sRf;cKRyUO_uJKEi(`0{*zrKk}SW?dkhH)s;9TAb8w^K_o8D(n{Eh?Og zD4}?uMqwt)2P`X_(Uy&YOSx|0!5?odZN#_S76ltGL4_it!AAOBk4k?dKK(fc-`36w4m0g@A3z1j5-Px~DR~kFT zuds10Vs~ID9I7}FYA}i~-geDK#x|~cw!dzif1$rl$1yI*pI?ZmJd~c2G%u^L&3}H7mdUJzmlu)1~p%jiGtfbz_!H_RpC(TkL~2?}*Qz z6R1bK%z;veOyd-RtF=d4`EpjypnUd`qzTwy``P}RkM)L|ip{ERDxFBD#W*N12r(4!TLxmR9!oQQc5rrgv!zKKb;o7-Sqa4ru? zb-}qb*WWY~&>2I;y5X~jjZ(dE6gDrqg%LhOa%ry5^Ou0wC<0!+YIM%88%mKbys ziAkg;t{&~Ivl~Z3!7hsD1a{=LEHt5kZd2ahQad zHwgx@8Y2?hA1Z3}qv<$K6kK-|9fh%$ML}3=4pju}8BPK7d|x?OSIah=#$d?e znFE#7*YZzMb$yM$j$P+f2b!eF=pC>mB5pe)RG_)OG*BPF2b*gnv^l4Z+U6iSN2roN z0qh{oodc%SV&jAVl(M=ZU{jKcx)HbF|l697S2zkpIxX){GIdA zJY9Lgh7fw;;wGwR(!^gr7ga_SJSHN?{KNgvaFCyfc`i_uzi~e2a#CYpK2!}&8)3L~ zAlP1XKb|6oBRQQTpIs;Z*zn<>LM8BVJj>pi|{I{^H(?8x#hsYh9*pdoBiw%OI3^S3O5Gy+>)!M za$XQR$2~*4n5RQ9PrH~`91)IvBC!ssWh40wFthj?JF7_`WWLAE8NtvZ7K_Yhx6$|* zVe6Zq#C3JSMVJCF!X&;D>x+51^Xjj2hs8KU6VN9y=VK?T=af)vHHd3lrq;HDD*#%A z*{zPy@kZ7IwLB?Qawb)*~IMt_%lK zB?eXFRajpeu2v^eT@nZC`Wfr5Yv4HfSCq(PJX{l|7EZ4LCnl^+?1Je?YxMGrit2)x zs+ZO^qn2g1pee89>>7|XOX_Qa7@zfM>wxjqm&jPjW*0pSqse4{Gvd?Vv&S%v$px=S zvFgP*i!xMIH_qi=7Qsbn&|!Ijx}?6wjD6xRf*#Dq0H_BoBZjVIT!;tyS6976^j5nx zodXLcW@nL^@=vVSW&<+;tz-DM{Dfv+cDKb78%yRlV6JR?i$%{7ju;|Z>$j$F3ExqHTCp?nE33L@=T~POtUTYuv8w->*L% zCPe3!Os8=rWrao4XR@;ilRh>(R8>-0B^<6Mo(c+=>(Bw?12v7oP;gFD&Uu0QL1&>q z>y4dr{Yyk4i<%o7F)~fTgpR-~S&TIRrUN|8avWe8RM|Y6!-$VKf(=Xf*GVZdrqc3p zB{K`FswS6@nNn3Uv$%Y6Nm13r$cYMP2%xy2bQP50i^+Mf8VYY+ySncur8g^*D=Gu;ljZ^A*9|UvP**q%P zri0D7?G}|e1>3qdr7-}lM8(zy7s1T&5GdkILM02ZrGRx8YWK7~C0?cRl+xLKlD5E5 z)0VlAXErlu5^Erq;`JQigdj3nkCNDCldAP*D9?s!#3D*JK!GGL=2xo5bU#_fv)i#G zcAYtjAMSS%HX__XIPmET{hNU#6YPWe=RyoPX5%m%*Xe#@RoaScvl_AI$T=`kNzphK z(_~x`?0s5w+C%yzv-AvCoU;(Z@EDl0#F&+dbIjOkFglM`EvK4JtAlW{PV>^5@jI1p zN@*iXQVtDWJaLY*45K<|>V#&Vl8JLtFoan>Mp3Q-p4%8d8#?|Ge(ZGkPFJG_Ue8R$ zY?h;|scW>I(n9RVj-qjsBl*T)uupl2*MR7InC(YMRRt@ttB$DzrfHZzNi{@xn+Sd< zFvmN-dNFIXZd3YlvFA`Nvqjw>F{{IZi&uCYO+#g1Zaq3_S#vDaFLve z0~6Or2rD$>H@6Z$k1URLV#r~GiKJZes3YXnu?R?tIu!CLrA2dvtH{Zb$&Ja0 zlZ!Svh)kVVubi@-s-)N^H8}=2&2%)w(l_uz(rgYGfgCw=VCDWDehyoZdVgIgr>drb z@ZVtBN&p}0Mzh6=%_3@==N}iusz9_*w&JHW)Q4dKPDMuySfd-_$dI z_T~wP!@!`A4x~Fddq$oC@$4U_j@jH!JmUrAVHKO(Hn&j220er43gf+X_BE#4X0=Jy z)K_t1^&)PMy$Nh0VA$AK_dc~1B6oqOdz{vSl)IcF54L)g;qBiVNZ>Wqy`bP;XJUclYuZW zvgi!5o5`t%_crakI9?nsydTP|HViXOV3OZHvl3`_N!cfCgLtxS204z$nYl0sOKBS+ zjTcVIRuU7hi76b=1cHj&+G4kr*(E)t1y2z~?VTI$LDD5X;P-j z!@*8ZwvC3{F@|e3BFZqctytT#wy9)JxJ@;l7F|S%BfE@|i)3-4z|MI>Sj1tmNZZb4 zgxWG4F(+W8n8UP7>2y{j#f5TswvZDlLdfCSLgD@wAr)rYVy06@$QTYEBf#P|`cLV7 zr?AiJHvgy-PMOPh?bkR3g{oecSTJ;3KS5(#e~v(px>lc+d= zmM88)f*O- zN2#!@%_owl`+^zKQhK|dD_S;qOkLXRRvg2jpn7dzOJz8_#J+?%n&RC;F0z>vV5!)I zy?XoDaI&0)+DI#yJ+%xUxrs3%rdY&!*TaxGVE zaF#;2?1tNXd|kq@!rg*Z9;nht2sG1b-09(aKE=TrIs1}>{;8E`4IDVg?g(5z<15EB z5a)w#ilaXfc!{n>AvSYEdb? zM-le57j#G{XIcm)3DxoL22at$*O(TE>cRk$ld&~``U~^;e917wwURSU_CU(zXF~PD zz+73BBRq?ndo7FS*BRF$ea+C^+-t)2!+dCiT;tOqtayk*T0lY;VMC$0(JzO3!YHX< z7-$UE^FgE>$w-Uqn;+t@RlcOoFA{ug42#|5wJo?zA%E`&K@YoMjfy)szKCc{B&6Zq;m&JG;4CNS9;N|=(xTIsPlYwr&Q zs*0UlE2;vp_WIx;YBerA)C=)PAM9-i4O5?GieJH)4!MpY211-M;N+O<0hOQ0_**Yw4;_U5tP@D$9cIv zB;pG`Iu`LFzuuG$1)CeOVTSm4ekJ!Q&gz{ zWCeGn>|STrr5yj8T|zXD9KT3(^?V#xBWG{ol=*+ey==Sk?TMonm4q=Y$#KgZ`yRS1 z6`WSW9sG%n0Zffi(e-lUDrBGgh1It6PO9pcobCZ*Qrle9bh-x*ooI=9zu|@XUacPw7F=?A zC}Yh|_u!$FAA~?fSJ(Zn6f7%lxR@i@a3sbsnHtM66I1M`%ZPy~lgv~lav06(#o`Ku z!<&Fo2{^8kTl8Vy@bf!j82Jg0a=z$|jH0A46EJYRUV~P#)x_0Q^krE;7$>4fcQc?A zU0+%qYqB?o6BMf=)18$t)>Xr?JC;qt(elj8K@;nM+&Y1wT)hXtC2V^$HaEd`5xAaO_b8*)U)|_jQl}ryrPL5=T!58nKjp&V1y->9B zdR#ff;t;Af5tkpO@VMC+t_GXu+-1ci2g`MR)-AKPiE|3;wW5ym*U!cIIWJ|fIt>D=DLcaxv7XTzI0Xl~1Nx;fq*2SZkaKjd*C^(C9a^T|I8kKj0c@E=FxkB776z-PmWlK_B@_$U z0}C%*_3bn|2M;7kCGi8UvO?!OZ1`V^*7WKaBxw?~shqdT@vs8*$s*kE@0?e&fxRY$iT3Y)HD}t1sp!psF#gF!!Ex!FB1X z@IZ*}!E$NQUifiLn7i{&A?EQ|k;;7#dyFu4%DJnNqxVR8F*>mxPisWX0%cg@$AyeN zL(i6rI|i~3f^Zfvt~4&O=btjiuz@pT>gS%IS$Z6n*CHwg z2o>kdH1Uug+7${Wj|u9i5GO8_$P%B8q;d0Q3SD@^gwjE+1EHEAMDX0PVLMSzsc)3K zs(!u$%CXR-<~l6@acl%bjfFN#;<*Ir)hG*W>m|^Lg#k7zq6=op%U3FRGZG77Jqxt4 ziKnP80DJS>@sw*%J8zLm;89;r|F^uLA9kMY{W=?0*7^Mn+K{6j!-j|rp#5kGdH_S1 zFvQQDj^lHHnf#a41!wc#weF^oo4wNPcmSj^P+gC~PIiIuG+mnn5M2{idZzChOQt)r zQ68SA$OeuKM%qZp-YI&pQASi-ZC!X2HyambE08B^zi~`s4tjsX2X8Ut;j9t5<{TAr zQJgw54}>yL%r-B&i-UMr3ZpDv&0-Hb4>;G<7wgRSawUwH&b8id7CZ^h74V7<#gxMm zu4gksvgt&VVU~kR!H&DB6f;`M98o_o&LdO^Ba&W4Xr3PB*++&qb~r zY90cA(j<|J^Aui8=zHH zSW+Gg&rSh(ym#)%a`RUO;Vtp-pe7R*j#QTdYc~cs2{X49^(|a&RK)Ixx7{m+Q?7ka zvswIPB@DJiXiODfZ7uURjaky99a=TP(Op(V?VLyIj2xtB6~zz}RtIOUXs#57vD5=n z-Y$ z+W3P38w>AlKDey_yRd?|YmW6&fnNluPmQ&N z8|%qMAZ0=3^Gm}>!=zKvyi3%T=1B{9*k$=^2KV#*477>wXDOXV244gIjBQD<(v=C$ zoFR7H82jprGX8( zIq`B145oh^4qt+M!pZ#_*BfUy4RT(67A$QvBPZ`8*_(l68{(=g*z|vu6we&3M9!mO zjrWr7CBdy1MbaN~TUMcQL)_EIjnjvPb zAJ_{GPA7%Wd1YZww)Ls)V4IEoG(%&^@rtF>N$4rkjhgHIPhATiRP3RiOYhG>lWgS- zIqhnS!ppSaWMs!9%b~`+_H~`ttG9aMFzrc#(p4T}F7nYwG2(TlKK6S_%M;0pB(CGJ+g0r(yaoqPjNFb;n}*$Dm)qhujUrBu>xKVfvio(6c)LU)3(G-0cR_DaVSe_M*Ru;V+U$&^mWAw)kVf)*|?Xh8BJkaW1ZZ$Rv zFX2T@yV_$CoD23H?Je~-FI`VMdzAXpu?wWlrrX0F15WyfE50uY**ZK{2ohabpm5J= zw;B9Z>S*AK!)@u0Y_rk)D>n3#r5vPGwx&SPe91cz@BBrv`YQ8RUK#3SQ_1jBgQz6t zhE-YllXWYo&? z?VWkE4Vb~PIt9`pH;^a8@Wx=*tUd&_SLvxd`SfB4ZniewYf9z%-O+R8Oz%!4Cb{`=4FiQcB78Z2x{DQX?Z%vI{BA_d|F-5+?kISM{ zeZ=29*RB;$Q;b_n6KAYcgosFuNU__ZHbS-G4bg_i$Ip6iLl^T8gyys@? z5{@vauQ3g3*-eaib;_8H?MA|wa?hXk9?F+WcNV2K*bbw5(TbJ!H#y5m`psA>4S3fj zAzOQ@rLkBKn(SipXoJ>k0`Et2x2O^?K$y|xYn_`Sw&>i*@-cXx2#52|W}QYdEn%>I zr-5o`t7gyguzw1cjiYFmrVg6WX}YZNU(-ll6ppa$HQ>evMdMl=txx1r{H9Frd7x&2dVpA5amgfOkQR@gp&jp& z-C~j?>PA6V{?+)tAo#CYnb#rCY~^@;d7?Sw!%-lXE=4laO=Ia+D>pw(F&W?!A0q=buF~RU{*QXl85jyG{5_MTbskycu+8cCVZWd?IL^~LlXR? z$A)J9C#hM~pOO94NiMQ`@8&$LMtrxNruf0F6C_9V<=1wRj9Yt1VAypK{ED5W>3%^` z%U=G`jiPAzX02&R&lMdJ7vrUQ&4)VXvgS@M+KXw`2%(;61a=FOih5)*s_pV!46l4y zf^rp4X#v+!GHz@5NLD_)K1W~UBecOLOhNA~xZHY`>5~P?(zGaM3XL;ca{67wD;#P! zSfh5&0I#bau!$$KN7L^f{|S?wNA=I(?=<(24iP6)o|K`%-xHD~nbt;LMKnI~R2^rkoTrPe! z!K{`nctZ$0>Zg35T`XQ3FJBMZKF14*!D?~i3bZ$_83qILVJ*1@&B)YyuWu%EhNuWG zt@8>&YW)V#>OCM?}Q7tIzOX{ORx^vX>5tJFYo1bZOe{Mxl9$1fb;&mY8#$y>L^K;Ox z7S*;XH0Ba3rJe-V*|_&W9=0(T*k0!s>?0&gquP|*H0lWd;)BEfM(sAMwJIcTKMkK{ zyDkO}`jb6{zRVMh`dDb`6!~*Jj<;EczyA+FY!5k`0VC2&RfaDm_3bH zlaC@5FH4`wL?m7hHgebMYl26Xhb89K5_op)fe+3f=mBx#+-&Kdn5j|QN54Mf=CATI zTBDYvrA6{>%8}0!*Dk{MxHO)rH}*vwbE|2Rkmg1~<{Dbhs_)uHYa20l5i@H|`!34j zHK=BMX26YLuC^$%-fv=gbBCp3;PhKV(3#OuN;Li^XZL!@2tGXU< zV)SGEqxEr>*Nx?_)U=zoEspPuG8$c^C5qil+qvQxRJb_N^c{zKS?>(%w5C^ft#^bO zg%YD)(l@f5VPosMUh6tAynSqWTHtg_Qj-+)=uC5HHoaNtYfQm6Eptx$DOlFV(oRav z&MLR=r}boHBwy;d6mOA9$Z}dfE4DOekK(UJh;YOmfqJ8S>a%l<77IXx15T zENH^Ac?^o=d7W1fO~;yeCW_^`%o^2A#syv;=I*6Ot_pf+N4|A?@iTf#s+>V!?U%H*+z%px2Ks2{fhZu<4)z%8m zWWlSLMVo2ufmR$^p_;KLpjO8%Xl|vMidG=Z#-*v>w**{sD-CdrlwK-|%CFIq)-rwv zTtv`=OSk4cOapYUw68v@<&Gn38{sB!G*i+B$Eui~r=ZNvViHns)(k;6!!)<&mOK~w^Dy<{hWWkp)JYUuB#m}P*YG`uN@`g zfPA@GwGV1EpY|=mgTZE+-8NV~0g)%t-1A}ZXeAZs#dySHh-tlTy%udb08Yj7(kYEL zjWLbc)J#=8ZY3>6GHizQl=&7E5oiyLANLyTABI=T@eyMyKa!<_7GL~^XS2DvbwRt8 zs213b?O=Vojt<4SriE7rEzTvMx$SDk>-FIfbh;G=>4YMpV>X(cB_&xl*IR1ds9K6C zG;%N|E%T|{GO-PbV?MGSY|?{vv2D=8$AfjhIoYs-#q|4lr5;PK|Fo6@`xMvH(x{Q5 z#0+@d^1EZ~9O|&Y)AMrIR`YXnjZyKssaqq^oJ_M{x5_BbCQHydr7!1L7}+uYAsL5h z4lG^JI2cE(ZpE$fiG01^d$h8fjD}lx-Zj&!RUJ2@_8!-)YOQ5{yWL#r3T?%^O&Y27 z+|er=J{EVpY34#;rRDJmMzLzL=jM0gC^UZJJ`JSfja$c(&Mv)A(ydtg^=v&+J8D}| z9~vo?k5aTFijc`#-MQ!B+M_1B^>a(JS*t9b;&|O)uz`BbAs=1@I z;yicq(r*8bWPOEoP{BCQ;#(R)NVG1onar5#|d ze2n#plePuXEbf^}`D9Oto8OEkH0}~q#4k6*8ZVhje;wykUn5tt*V?hBoojkBtQ~8? zR*g_vHFqPHd*MU!)4W*J3))eyC(UkdDNXm>P3nV#He-7A#f_OxXP%-B=|C&2U+t5$ zlj~0=^)Oyo-omZlt0xYZ--FbOOV1$$KWNwYhFAgAHg#5tGWR9EcXGd@ey?>v=E51b z9%$CJ*OUraHTDJ@+m{bg`dj9HaMj_AdHj=S3cslQVDF1lThE@&{48s-fBHLLIk{%X zyDwz_^-urcH~;j*N3W*3qc5k+Ci-&NohAK5*d6jU&S!#8fzKqG8KlcWkR_o{DEKK| zF6%PURSv>vj%$?5a?M81_LkGpL{x~L4GYipl+!^yNnsF8c9p{*pY2w^l9d_qI7FDljg-0AXo}p4Ps(!cr{YRN0@kb27TCwX{J@T=MEE4gak=GYj2<*7Z$gTuT`=fOf+!1BY*L z8)P7cWWHPERBz2)QMKwc z&}DtoHC?rYe^by|AjssJ?FKDhLUhBy-LQCWSm+zde-_4J!0Lv{?zgk96#~1Bu*yNTjq+Bbex$d{gdvpbnuHUfNcWwS|d);FDSzC$H7NxXd z)_RZ?`4yzYe8?5WfKSn2J{ruv^5B#Iyl}JU0k{xVKY;lkK=~<2HaaC5R;Cf@sr0?N zKas$YK3(#<^y^a4CDLV;E_diMpvz~tKzSr#ad8b%E5EVZV4!+=mtN>z^ z`-y}2L`?aau%1Q;axvoavx4|3eaZ2;6T^Fs?`K_&pIV4JMJq7TotBIrgQ4)8N(#@_ zng2_`5g!H-M03tKehis~=Ny_JTYFM_h#r4$qMSNGgZN@v|JdUF7-TqzTEI77T@KI3 z0Mv2<;7X-h4xCZ-Lk(wq)&1Fr*3ih5y?rR8HETvutze0-4Mgi*VokJOr6pbPj*7!i8E=cWPX$*&dyC9H~1MnQ3iDmw~1oRurQ`J{r}AyRym? zh0&?#R7ParVG(dmqe<<6g&uYq^`0{6*RVP|oP`h3Fdl^jTKQhx^Var3DCYOJl;l0( z7|9bySjRLH4cGCGQYWhIBe#y48?9-Pp(BO$I;;_&en}~){trHGzPxTMY zJs48en16*Wb<4$bfArYs5Mu~~NML^QXzzdB`PkIARt*2||MJi~z3+W(`=5RHnJ<1T z{mbhwzCL(m@}1m&`|tnkM<>7VKmX+)|NAwo{``+d{_@}UoxAu~@BHYqAMgFe|2l8} zb83HT{14Xthok*Z&b_erCz~JryFdH-P+$1dfAP{!9{=;HqyOjk?)xZwKU2!pNyx_0_%%AsunRl+Cm{H(814eF2$=iW-BU zZ*8WZ_HoBOgo?SIzG$LU41pGAt1r1Oh^l>8T>yZO`eoa+DLPyf*|}U`(mKiq7nljc zUK2*Om)-v?%&MU*-?Mu1Dro{K>gW&v!8!FZtQA^e9-2+kWwII(|JyKj{WCcN? zWI{Azw;$XVTexsE{=! z0>V@_(?zUEuVi|sat3>>y;`V!kjjnVpOP96eGJ$3Wb0N-Q3?xW;V=~2^6ZY73PD1Oa>U;xc^E~Hphtiab=X_Vw2xj^7|IzCb$sK%?PTwR&P=eT?j+ItfcB$+^W}v z3we4SJwfli>70Vh5Pc$mbJskL3capxiu`NpNL~gyi}s?(va|V3g$&`@hk1fM>Gb?2 zn_rk8LZn0`uu1H}6+)Dv*L=R1As|ry*JM^k^TaH(qR0M==JBJo(1(q$TiMQ!7BV>o z7zCW*!6=hba;Szty0A0ze zgxgdvoO}ZHD5c0kNink=7zAt04%W%|@~8|JSxOb=AJ0m^l!mM@Uzk5(#dZ@gI12}f zn_=S}E8zTGKAN+vS3Hk{B7YX%XQNrj*@$f}`0Ky;C@B8y6w)p=z%; z&`nBipqm!thLp9a9BI5AcMb|^Z6uA{4qEQiTr+R=)7dFFFj@Dqa#0gR%rrn~GC#Ef zp-+S)q%F88iM}v@8S8}qZ}Z;{Uh|hpeKyly*FbvgJz| zy7HI?ew1eCYk534o*?Q%--@A}g7xUtw<_CqMQ+T&f99OsN$C52O9=<{qa;ueh&o zxUY9z*>3l>MY1TWRtgUS))kmes<^^t$fQ#E1bjg;8Vu#m=W&z6lEnPW#Icb0JyOLU zgr%bD2RNjzX#Uk`{xx(gm+6wim85M@eM<Dq89$5j;{v zge$C`6$^ai7GKAW;+e4J+EM9Nwe-Kejn)CR0<-?V+0RikS zrGO-50p7N)zmwmb`3zY?GtY3w$6liOck)?#=kb}0$Qu3}tjLw?16nI5XBaS)@6TirLWz;ZwW!|Lvaa`X zBDE}frXa{NY=aE#w6&ts(dm0LtC2|nJ&_k#!;mtM9la$-QQJf}h;)WAG`o<*1jGt< z6Qc&$HtD~p#^~~>8bGcXs%voe6uE^ZXq>AAcO;U4DVx5LN{IC_M>WH7S{>a zcDnvscf3%rdDUBZD9ydl0}Z^$F+_#<)~L=6woS-Dim2hVjfJvK5fD#}QPnaSt#EhU zxHGb?A$=1a#?YJ*q#eZbC6in^r2Qb=KZF8~C!^5Ci?GuqTr#GNc#rp7LU3Uk2{n8oQmFX+zjOhtXm%TNn`g&lh zf3o-0&^%q<_$QRtPvp0;q?c9b90@uuZ3RmvPf_w?kI zr?-?3PM$eGK5?NuRw*C9I=!VldST+)#AJE2Qa(A&sfDvM)6cZSw~cnUZ7&}=&o5P6 zDvwc$4o}u$yk~h*`Psm%x4kG&&XmW?v;Ma^%F|Dk6P;ZdnBMJ` z`zzZkL)*6x-;a?7M(a|>{HA8V$HUL)*P{;UNAK!Kq;uxr^wpW*_$|v&3wlxMvQ4&J zPAA}ud2(#}%I*sn4vusD_7q1RbC7lAETU>mylnU+--mcP;jjh#e)@0zUQgtBGHv)7xkEoOXc5@Se zTboh+cIW+UR@A0P{kumGvf1vh*C2GLr#6{t`>5UMX(3)o|ANK20GeijavL36G5yTK z=#_c*w}Z{8@PKo8d#LNSak>`|634Po9&gdD*ln0BuyFo%NFCpXUYl(5dOvVwKEGvF zBw$Yh8y{&vF)tiej5a^&TZepZH^bZ;^N{JMo;ab+?pOHM=3T!b-f-_Xs8&dcBNxC> zf0>#3zaRW3>K~vkztv2cdZ^=|#G!L+&}AEZo4m3;Vq_DPy8~XfvmI0^QC6P}8=2)V8k;rjwM8+R~Ghxq~J2`tr1SX4&*@tM_-C?e7uV6<_rNkXn`w zihHiNYFQK=wRz&GHf(Fttu_(sB~EQUW+@A(yBcKSv{@UTwQ*QI<$GW-C>dj%Wic(pFr0;cAcjEY`>(3UfH>khNa25^IFjoaSS<{!+bJ<7htH#T%ZyDFQbU4uAK!*bz4sIXJXG= rd7Xb94sxafoPn2Az;2K4dGi=-O#i$f+*%qcPdX5c>qLY{UqD9G#q3Zr#qQhF8QmY>5 zk9vEDV%h?&foLfx$$i z9%H{$)20Cu^mfaFC`wQ>&q;9)^fu8s?qKOB+LF4a zy4|nw=movq2e!c7b37vFSc``NPcEbeXCum%K&GQD6nKFJHnG|U=O!)!Jy$AZYFiwT z7R11b!DIs}X59{AtyyYB?`KXG^T5v5)>%@QW=e&9u8v1yYN(veRdWua={n{}>&-0E zvZ#&b-;A(wSh}>-sMZ3{VA)T!qaQ`Mh~2OyrsyMYB2qCm2CZ$7pJpF!UKeX^M+FM^ z4<6dDu{a)HdlMNwt#41?lDUN`bz}iPhEd&cj_BVgu{>zQpzoS?!DEj0`9$|{`|uz= z0|l7+wBg`zUk}QcQD2JgH|)2ZQD(-2s&;%?j37qzFKsLD1>8GK;WqSGS-aE@d;wl= z=Qmi)$ce)Bq%pb!EvJDu()Z~+HPhedm!PDy#acb>QgB2;N5Kab{Go!cEBFTm zKUQ#0Y)!15?o{yM80&m0b{@Sv7rO)aW#IMn8_<*VHYhEWjDHCJw)lR~cPO|Ya1~i` z=D!#}5Bzn7{|3 zFI4UE6>I9AQ)8jg0Ys!5 zU`SJi0vbI(2W@{ytM;0t5v*7B>^b7(%a**A?6Ph89Y#Uge#hj_9lD&9baWWBA?f*9 zCI?kLz>8kaaV>L{2B$n<7U|gNH)YNbwCHFGh4pSm4?Bf|bjflGbg*pZNvY@y%G}hj zYlU)U-?YMBh8c~z&P^#16hUwLK-u=qqSOau(ebelU5l=Fk0XPVmZuNpN`yD8Q&b)? zOq=wa@3>^R*v=yTa?FA|rejmq^JH<(cl%eiKWS+8#Fc8Vp# zp1QiB-$m4O{?!fLPHD9t8v?G$1WwQej?IJ{%+!1m7GrEz_?F#jN>8gG1S& zaaS7os)9l3^Wb`6kJM-T(uE_4L{1)-6VjrH<)G`7OVn$Zi*!)>A$6tzYNl@*mU&i2 z!`x#U1>5m_Gv^V81WtJ@-d%QG%=d^=kp2lwR`k9#132cOp9#}->>@9UFsj5{5w3hw zt3Wr|<}ujoQ5cT{_^^;?9QTwG3HzE!>@mHPWlS9fBRo{$K4RDguOaTHG6H>3WU~2u zgu-fGiBYx3DH^67NrTU{2V}wYd>3nqYf)1*Iu-SdNS9Y40tW{WnwljvG*yz3PmJGY z*m+ATCe#kNPBElpv5+PVUSd!X?i0O}IjI&6^|~%v)IyfgdiN_U-={&}aDD2LqvZk} zH%$M4;|}^xDH_7rJ3(c|M@zioO<%O;hiz9yK)Mly6=p4~!rE;)p2W7G_5~On?q9rN zZnCLNHkst(v^A(e5;dPr&?YKj_qWIaP1}A9H6L6KT0PMF6qh6yr2(!XUL+zboSc3`?{6CHgx1F_6cAP`Wph3ZI67+ z(G;i#D3Mi2AXRim5eo@wAeWn=lR5`Muk~Nh0Jw|b@=?z21>dI~$H5$AsKr@3^^l;M#WSN)xVZLC{B_iWp# zEs9*JVhhi73*4Tvux3_mjb;Il{8 zj;!4F&O;4PzIkEYOCKCM6R&TcAFpp(6svCp+Jtu*GUA4{jd4L*LTFkegNB5LmCRUd zo`^LMH#QF=H_{rLjv%XUz6-n!^#b*^Yq)MQD1z9?$mu$WHS-s2^Rfognx`Lantps9 z#nu38gf^|QdHTCtHZ4N`g79Sk{^@6tZ)uJ5>YMw}+&ukM!`d~mc@UouvBgNTRi@RE zRcRKIP2Oo5HJY!;y5nM*CpD^5RooA~qS5pVl~h5rc5fD$bUM?KNq1%hHZ>$>QuI5H zg?p;xoP6nR;t)<3PaN09QF-Q+>7HsAN6g%~AuZ9Zi=i`4yU1Ed0!@+C#fXFB&i9;& zx%8#cZ#pCT$8k=SM7L|01+Za16$6~fcw#_$e3ImKqMI~Yue=brWix~y6E)6q zNHY2kJ)?JKGP`yVHE7{g)H?pY8H%+Wca73f$F7_s$Q_(Bp0+K#3*rDCWn3_J^%LD0 z1uZ9#rS?url?0@=_V3g3i|?l9wHD^_YVTA1lM7-6Xi^+dH&!o@*4E< zIp{1u&0xl()+jv&+S6S`m$4y4&&gh*zXZ*SbUCpNRV zZg1(e#CxCcH$CuyLe=*t@D&{U~)GBI^qK&9C=Kyv~K8^Uq<};3;jl@zxw!xW* z1laPh0vK^JIf$y7l&X6BbXG@gfuv`Xx?ZC@r zCtwC&)Yw9BKfDzEa&&?dGswiM*3O;Tb>I}*sr2!A#9lq3y$C&=w-w;2rMxd8n_&+M zI4Rjij>t@!pjJ>flYl)O#SHRC#@IrE7CyD{i3}Z_`}9NJQKPBTBEpH0xSs&xcyoR@M8J(Lrm zUY~vG&|mhP{Tqi?_LeiPZs_D3tq^MCp4p-SMdOIFADk6MnFQxtI8MNonlTo^Oy}&k zsN#7F68u!>66aW~&A`hu-hiemw}4M$XsPm7=WV~5KgS@$mU6zuqaV#DKa+R%%)i#W57t{2UUT${Sh<$Uy{}jPy`TMj&%Vi` zCGauG*9?18oq9SYq@8o{{aDzW8Xh{(u`?w+A76lm<=Ap>YD#*keYY-3?lHpa69EOb zw>MRG?cH8(92Xg0N72l=j^~W|9XY4C+wh9|L}yAA4ci>Uom2QR9rOlOLR6IX z+k_bw;nEsb*~n`4rjATyOC`(9sVfQHD3wxM0u8=f_I&<^zfOBHDJ6%#J((-J=rgQ? z;>y!y*eUb+^DJq*dUl>Ol&U!xflgtGf+h@eRk`l;QQ+6V55=rbOAy z=J=9gZ)(i2JQ+Hrlx&&9n#lAmGi=|pr4j@%?Aa2H5Grb^eEt9qqJ^;fWKHh(`E%k6 Ji~rvU{0AiYe - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Tools/NUnit/nunit-agent.exe b/Tools/NUnit/nunit-agent.exe deleted file mode 100644 index 637b2562be5daec46d82e0263a74c8fd78f85ff7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeHLYiu0V6+W}Ob{r>OVkdFl;bxOihuD+#=0Ot0i8rNFbrM5&=|RqVxx<`Vdkoq)MnN1+`KiLPbdMBNc*v=kCrv z9H+QHk+{2a=G=47Irp4%UuSOL*Dq3-h$47C|D5P$yt#BL_`ks%nxi+q8l@MPzP06L z?c`fqh9^x=VY1jlUkT!>mM8l zdV7yT+A^(3L=Hsx#4Zq!r}L}zr@b5p1( z+d6@;(q=prr4!A%D=i0%%GNVzWL=x_RFqDlqZL(!c5+-%*tQVWQ0G>nH={%v>Ue6o z?f)qo;x+U`^bOfY3N>Hy8Zd-&AVflIF3n-4MVdXRudjE(k*jsT2H5<_N(eYNfc!LL zEf}(Tx&VfVdpFwGJPK4>8EK3(w=|;3LCoqOSqs`zjS&YD0rU63ytaZF^QRsxYg$&b z6r#qpN`XH>z*)lzTA;4J)>&7=z4bsV>l^0PH_oeXD%A^?e^jm8!C;`98v*BP;8}rb zlUC*41rAWjM!JGkskI1*sD_p;!17F+1BlSO&C7x)LCq2;#y!xxL>IV&Ri9}qYZ_|~ zzRtr}=}BE@Rxzt(yu|Ur$2(yOrh|H;NKcP47#r1LBREt z4m1Cy@MFM#q43`UkJ38|{$0UO6kHu)ox3BfVZVZRDVPI{(i~dX)5Qq;_;%#^NG<&p z5Wy%$fyYim)YsDv#E$VsGHE5COKSkn(+0q&v6VK`#}uOh!Lm=#r*so|_hIo6J-AlW zS`mGrYLBm7Rr7N-78)(l+DX&mbU?wRg1rjfuHc;t8VZ^Uo>g!ba4+2l*h&v6xK7a@ z2RuSQq2GtP=`#H-bdp}7`tT6o#_%1ma7Xwq`Yjy|r|2EZhbI9a4rdiTPVdvR;j@5m zgs15vrSqzS8cHiIRq%ZZMOvv*+a9@>)@dgq_t6e*BJwaaoR55$4uIzpCACYDr$Bi! z0>89pm>;ci>eW7oJOllofpVFmh{0vrQ1dIyRMsyjMF&Zzopcp&B`nhs*}nj8rGEo1 zqu&7TrWZAxy68`Uw<(?>`T+Ph=o9TSMdo;p*W#&*BkU;CnDRX9gQC%1g;sLa)5!&B z_ZMk_B+rMREkHZGfNVe3t15^3oOIrjhsn;{rr%~{r0wf+MpFL>>ci6WlT0d9^#Y#t zQjTkx<1{qu`7%qV#=j*~enEqdrlPRk#pp>VlaVf2PKJ)>%`_<$y@hvbcEq)ca(Umh zioJ|58g!kSRU&v5deaB@t{Nl*EX zONNWBEYL3}EVyGjHYGhzX2-4BVbix{(#MuJp7&*m+%3J7Yv!2s+Qu#?n=|a$Ya0e! zL_FnR+tB6YW?eHgxj@sfYouk?aHp=78kMfMpaH%1gyUunw$8Aw%hl!B6J{pwD!#Jz zAQr_~vooe8-682tn6mA&4=x9-9_YP_OX4K9A%$HHn1OQy`y!rcJQmU3 zWJ#ZZybEdO@bD9K55?)*cze)mppCWL;HQp3Wf9xNb)jl$$hp8-vkRGmC4m+`!|tJW z=%X8xl*TWR9a8+$s26&sooqRKYbv`;XNiYcg)oCGJ)iOL1ld8XSu#I&K=$>yo?F=H9 zE7`&`-2%6#EUcJSyMtN4qkp}b&V7`}jp&zmUeI2<{ngIrv;Vk%)x%f*Om#1vziV{e zp7$QAd*aHa%`bg?;#|14X=%8&u_06&1=@&bH8SD4P0_F*Eh026%AhWyVI?ybS|UPC zBhjW2WMW#hu@BjF)7{{$s}-nk+Q@a2K^DX)BWG(M*2G_~O{?ojYnpqsaqjUY6xs+Z z3T;}nY3>L7ZfrpRg78HE{<&w7XKB$TwN1TfZkqd1-KLG9B@kZvihH3~G@5&%lqQIlt{ox~k0;s^@%DtkriP?UiUG&5a6eVQ zAYXisIDyl}6JxsQm*=KTcdAwNnW;%bTB1uA!{?kW;8>5HS^ zctQ+J;+)8dF4r(KV8ebY204rI#Gv%}BuVQ;H)*s*c_DDSW(YsXXM{5$DxBqzB=miH zLT^tb4(ubU(~4J6oB6wDIMh7m8o7SQE}bLD9h`HX)>^y+;sEwDE*QJE1b0Q%EvJ#G z_RL6?5US)>NoD4nceT|#kBA1YL!VrL&hm2% zs)|~xbP=>CJ8{o}jUgy}AN;REvm!kg*@O2e&YRPKJ=o=kkQbbye$;ybj{)cMdgQ~; z_!|y;621BLg+5)c31%hIexv zJV;|f?WE<93Hs;;r-$>9PqOlf$iijWwo>-M_s#pOtIi6xasl8wQu7+LNk(_SpnIsai+T#(62n&ck~e)Wz8sFZ#=#vwxG& z%HDFO)diiLqh*TPxM#L#P|-M|><4E>K_W zq@8l`-I(c!jSL@a+aD92k1s#Na%|ZVo0VSd$l-?iLq_q+L_mS - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Tools/NUnit/nunit-console-x86.exe b/Tools/NUnit/nunit-console-x86.exe deleted file mode 100644 index 672a80ee512397daae272230b601af6d5f0d057b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5120 zcmeHKO>A6O6+Un5xD%(gObb<0M7SA;HfcT2Y7c31REBV@0>T28Dj^fD}?B^ z@3}wc+;hKk?z!)tS^C}`8X%%U)XzR6dKWF1lFA?rxt@#yVqV ziSSRu>FiriqgALSR3-{dCdG}O;OCYOQ8CYDfJ#3h8k7HC+Zm=JGy}a=?w5#eKhl}( zZ*CJk+CP5SzDnVD#j_Z{(jB0+6TP3H{lyT7LSNK z6XS)Am?a7bRCdAmdX;9-$LZ4e%j=8tXkWqjkk?-Kqb-cNV7c}3S2A>(2mi1x(-UGB z0gSi^d_lwGGo3!8<9QCg6zLGXO7n0=LR+9e6Z&hRe-Qd7p??=TX0gmAp({e)vO;T! zek1hH);zQhWu6iJsrJ+#W2ERAcz{Q%irH_|njmP(=*=fLVQq@{2XO8teVNV*Jumc< z&?%u;g_eab3jMaw?}DBs2Xu@)p|8sxr=_pRrE_G{b7*aPoGPGSrA5$j`VQzBDu7<5 zbCwO>0_dwEQ>6{`U!z;r1Pvat?}kvb1(I?PMyB3O#}<7{I{i}P^w-oCM6*j#z3uB4 zDQt&cl6Rvpj(nZppSfb|eN7eLiQ_3+UI){zq|CK;7-~a7>_*1-wy1g#Cpw^&tsiPP zp(V!)$##>-kYf-;Dc4@p+dkM{6jC{kb+F|h)V##k3JQy#%rNtti?6-+0cGF$(f2pbPJi-K z+?edwMj>VmD$5#Wk{#q|%D(;aFVDU6w;Ou{k678qEE)i;c1TypD0(DRyUkL$7<77 z%X)9eGdmM%$#a{I_Ep7JwY_LUm3;)Zr^>e4h)fhFakP7qz5@0w6xC`IUT&$1al8h^ z%D%7GIGSR$remC&uG>UUTXbHmP)6Ecv(+ zt~kCzwagQn#%V1_;ljSFruu-SFBKBC!@fy$)A{BJ^DKABwtN^mxcUG<1fvO_A^~5Cf}$>tHqp-$4f8fg1{+=(mFt z5V3$Mfs}{&#tE9TB2&QYnf^^9PvFOKT3+`G^aa$CJq}=zgOL{f%d`%S9(3D~G0;uO zLPoJ)7wtSGW4zY9ck2kY-r79gXhs}^vW0xEkM`-?M3`isH*6<)z0c6*x`kGQi|PucB4xOl`Jl1in7L$Ak10a5jo=bj~71e-qdh zY}K?!JJ4@HCor>wzAO7`?8_Kft_G<{_+{}q+w5V!EZhz73~C4~`BZi>`*8RQ9eWF6 z?<)4?sO7WgojFcD_%qeUJ2Rp+nPZQ#9cw@mqZ;h0sSa6!RPM-Gq!C{SKM;TJUkPzW`mk0dD{R diff --git a/Tools/NUnit/nunit-console-x86.exe.config b/Tools/NUnit/nunit-console-x86.exe.config deleted file mode 100644 index 81e5346c83..0000000000 --- a/Tools/NUnit/nunit-console-x86.exe.config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Tools/NUnit/nunit-console.exe b/Tools/NUnit/nunit-console.exe deleted file mode 100644 index 28734cb44c2470c41e884321bd808ce92d913996..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5120 zcmeHKO>A4o5uPW>4lP@P>$E}KrtXSL0y&YMC|Y&mK#ECIiYr@^S&@?Cwy5>=xFTQl z_#U(GQ9nHdI<)Q&atKf$hn{*Ua>%Jb4J2tDw8vfow1?)}T-!@fpogM|q~FXVMKY2L z_12}yYBROmT$1`0!8VmC0cpGVq9$2_-w%Kd=oto(Pz7MX}p26}HYo+Bzg z(wgiZ)``w^)5pbCVt!jZ1^OFp0;3)4-5BHdPXZ`(_O)dpQV$}T<9Ac2L8;o(v54DXise2&e|FK>zU`W&+#@V$OpWS#iOqwEbt+P zK3a;67gQsb7(=3R2u4>+lmU*@rP1rF3v(EAp!a$0H9y<{%?-<~>tE`lQ%wBRx&*PnG&r5|2EyV#%W-mV|Nlgm4T^fzlW1aG!xn)IqDv%QTj^~3Zj{%u+sGP zixe~iFP?D2APRkL>s?I+--)6rT3!XiE+mYVW)NsY^~ep4?`=?NFN$@YZf(4x-I$gf zFCg2ELqm>10wr8~MQ{3GdtpHNDAM%}f3NJtzRt%;w2fx052ojI#b8u6?*JYSoVHrt-7BT6P@(Tet+UBRNxdPJTVN)Tdi!}GnkD-=DaN2PMU zTr=9Kbe8uBOyGs!V{Dx!CrZDPbotYrpH_Z!?~lvxT^V`n&kuG|lzQiT-&s39{n3wc zQ&L|YhL|;=ENhrSYJjsS_2wUbcHy1B-`MGY#7dpBXh;%fqLncC$VjRUTXZVPq|j7x z(=9q7Bt9YUS+xJFgQHSog^Mbi$z&(8nW?NQ)Ep$5R>hFha%k{Kxy-b>;na1cZrf^E z?`(NyYg{dPZq3oYD%h&L6OOCAkEHfg-d1a&34=Haw~x}7!M>TSD%KF;hAJ4xt3oXA z`)Y+VDN-vs!kOucP4u)yBjSa^JM5^qol`2@R9()Vwdi!#zHDdhsciPjWrWO!=6+ny_W+!N4@eHM~!E0q1E2*aF?ct92LSGQ9+x+xr6_f5Li`m#6&#_0d(~ zCiP*LTA7^#w4l`?13eyU4-K6GZBi)wCy5O!gX>^60^gw+av`Xs{c_+5h*+>GhLnf- z>Jgg$(a$oOgTHCo08TV5uX_Rd>ZmMuk3D$gfYPFVnN~69LAMPV1KmV(s8po`KOtO;PN z-(_(?&6d3ru&H}b8}hrd_v_Yu=vV|^mDOxp1AemyRjNTViM_pZipDT|5g(hZL@`Sf zg0Xc9oEmf)*y2I2q9SxAzS=Z|7$4r_Vfr#S6Gb;#XAl9ujTk8SsA-3`px*$FV`d4s zEBk8f%QmoF8B(F}^AcbSK&GF9P=(R*Vaww`16@o#=Rb9J}wtL>zSn@vyInY7Y@8&>d} zW;VTAere+Qw2ERUs5pKY=-Kq1j?!0O92%TKxhut~f`TBLO*c*OLgdy^CPou=&oyBb zZgPoSf5D0B_V!d-)t$iG)KT0j29w>ON~r^73l)vRE#B*~2tUGLRe+jhHodf$Z!~<* zm4eT98jbX1q9HcTDCU~;nD%7TvJQJk+HD%_*`hIH^s7zSsVha}ZKLk2qF6efmzUaF z6(+oJ~8?La-ffX_Hn>FYltRMHn|7KhiCyM9Jh4*0fEZ?6G}j f@*oHhn3-&!5C}f)|G}n`-{JfGf&aYy-$meG%J=@} diff --git a/Tools/NUnit/nunit-console.exe.config b/Tools/NUnit/nunit-console.exe.config deleted file mode 100644 index 81e5346c83..0000000000 --- a/Tools/NUnit/nunit-console.exe.config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Tools/NUnit/nunit-x86.exe b/Tools/NUnit/nunit-x86.exe deleted file mode 100644 index 9c8147f7a82804fde79f2b7d4900383731e1a9d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6656 zcmeHLU2GKB6+W{VYD}?QB~73|a9L7h5_`N}D1pQdyDWy9V6(N2QQN3tJbS%6_3X^% z&aAPks`X2eDz#FcP^gf2_lqMHi8NJJr1l{%k^0s?BJ~CJB`Ru%UakP{8LXN{oyh63N44mNTEw5af6chxu+#G$Qe?U`?)v}A3zOXjZSPj;dhd$98vF= zMYIuJC)!TD(P$e^CE+(Uo#4OIWYF8OUWn0`_5dj~UTY(6Py&kRx@{ukf|J;CAiB}I z(Apq}=xw9@5QY-#btu`_0kk&A5uIyeh0JkY0UTS3c2i9ey|?R-h9@IyFinL%2 zpE5le8!sqFZ1Fq_l~Z-}>Lh&wH1Flni&sa_qwfRnv;8?goB_`O7uLnErf4rStJVp6 z0RoVmM(Ct9`F-G-=EgcsG}D}hGn56Mp(602;9G)M1b-y>Z-PG){G!E{!-9Wey=Cp8 zJA(gYW#RRaby)l+-Z>u@R&sz2BLhqq6{~MiP9mrXck{pqY&b59-b8Xo=y^IQ_=w=+ zf(Hek5u6u1D)_sCzXyDf9N-@E1ivG5>=jy(ONYp&SFi$`o}<@+zfO7Jqm%*OC-?;I zvur9*7WhrEnWO^fAK*FeqmCuc-5#{g3_=Bbh(#vZOn8fq3(;U;Wf@o+gEY*Ge z1_kxNi~AQ&pR)CWrh@N8(IAaqh0wlO_oy1Vq4B*Lnp})xU8O5CKhkbYV~!V)?Z%-Y z$Dm{qtv#VWsfQ<;A|v$0)6tdaT#Q=XK;7ug0cZm4&ccbArXKilRZ( zZoE}d2y2VRD_6ErO&O=8tB#r5I%-;*XxjirgW1qj9gfcNceE;m!K_!V8?kG7Z|0&N z#9md~yco~dW>TAZ&(#qn0vR-+eP=^ud!4e}Si> z^PAl;vpSSzbu;Sh;EL(I_2*w7y8r2=8@s+_b#_^_TM7g(5-F!{i}ofJ6PhwU4ZpQ$ z={M^;qIwI*RW_5!_GdGLSyiYws3)z8Vd&!%)wQi%=A^phRCT1T*=k(hnDfkBpBnSr zilcp1u+`L!uutWERII1+wwex27{pOHzn#Af=FMbPv4TX_RKYl28D@FkR})+?k($sE zwnmq1qGJ{vk(DTXU>y}VOGkyXs%?cm7VXR0r|hgfn9ZI!h5T6Zwj?^lua&9P3)hTO z8xMn#1y@UrW23?wkwuxtcYrryoN2|>R%m`NTAH^Dp&41w^5DrsskL45`8|#k#kWZ1 zgnEYl8#2%#-+jEem-zcwM9<&X3VJ?DEXhBJbx6sZ{XNL}4Eg>RJ)Xj!5q-3coS)B! zJIMdBjhv@Mb#H=1pmvbsD6$C>L2d_mk>wYN9<_b09^qir+h*T$i74IX^?IJ@4$d7- zI1T;Z+wAXjoP=r`XUw;OM`!}nC|#j(@T0&NKr{TlkA|ol<2WO+j0q5%-xgs&^+tUC zw18RIhX%#b|I)gLv6n%YWfZTnhLayhTE-K>XZNi#MZJ(7CxsX|S6S*8ilb7{RN%`X z1`mD}p05ypylXb?M=qbhrwR%oU8`NcoB2nrYT6b4hhSsdoCL#*6R~V%|FPAGcLqdz@UOT-zIMH&^&h^_`Qk zd90K(R>f24qe6NAHa;Ocjpv;8qA9c-nkDZG5N+>2e*bezU@3VsFD(%$H2i^h@ZbS@ zmf!~j{PPb9(gE{t3TuqMV89$tgk=B>fNlerXz-7jzuVwfmzP;71}iXU{_fh^V;;af z20e*~`3C)FetCJdT@Uppeq{r{yu6uTTjgLmWWU?$+Y)%QXh!VWJwuZ|$Wsydt=v@>a?12-(;x0>Pf)u{{pr_(BmouK6SVW5Z8i#kf5ePe&u z5U%oa1y^toM8oO230{lb3NFJ@f7NqM7=^QOzZ+IxbE2v}KbTfkC-7!<6gRHC$!u_? z)Vj0LlE%F@Ufd87eq2IS0j_Mr>9IvzI(^TTYpw0nYUzQ*Lu~3%%s1<&j3=9xahN;O zZrxzc1`mnR@6-{eE)|V8kK1(_cg3e$<%y - - - - - - - - - - - - - - - - diff --git a/Tools/NUnit/nunit.exe b/Tools/NUnit/nunit.exe deleted file mode 100644 index 6d24caf6e94a6c5c6b754f754aea5519bf1ebcfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6656 zcmeHLO>7(25uT-GN0uW&fz!aQQTK^<0y(kP6s0d(OiP|*js%piU8@MhgyfK-^`LCB~gYO zG>0M{>CKyYGjHC^yxHCNIQgx&X%`W7p{=hIeTbeRBly8+8REXL{;H4e?EQG)L+jGV z1BHqks+tMP#;K~Jc4EDm=p66)KvxgId@Vw{Qb2Ag?EU_N@x{$V0_VcM1(l78byU7E-gULs}kF+3$ zPne#GjO&*})_5F+%BebXWrm&v&3k#|;+669=#PT;SpS?C%z|ft3G3pQ6110@HR~ij z701SDgiIQyNLu%yXPO(!IMGaV8lEQ`_`7roxGwm|f`2CX_k#Z_cunwri#1ORUbMbx z?V)!C|HiUm^`3P|?8eqP9~L5ck`5sQOy?Dg-=R_Qpd#Fx2eQy%zbv|l+O%6U#04%5^X9=KR{sTvjok=__Sufw8oYpl9mmBPqgF2P=iGALh+fNjGZ%F~a;w_r zU|dg|8EqEaq7Eq@kV(_pa~6dPTl1&miIRlKopn7oYD2~t;*Gt3{OMac>i*!3?_51Na_=oX4c%Yq zgPPT)EUS-EcNbSm_d9?7$>9(FIdNmxV^(*MMZ2Xq@B)!C>a%EXTrGhq!Dg*m9^E?zyy921`D0+rLb-)t@0Hlv8Hmyam!H4dY+o*VhPo>4zVq| zWD`AO(SSsv@L_dS)GQkn%&E2r`z_j+woln z3yVc9^^J`RZiE&MHs1fd5oefIOl^necY^4(TwpFNYI)e?LDbqVdHmkS3F2u|8KEAb z|Hlk;$ypFD?q&Wy=F#)_wSu0H63g-rVgnNLW`7sse1?2)n;cK$4~RbMFwW2Ey&cB? z)nS~MM3rxWctGtij-$vHhzBw|jOQ`_51dE;*7mvj3l2tu?fMf$$u_IkvqU#>?r6dw z;fnNsA@Y}9W|IJ_a_{-V+HYVt-NaOQun^_s< zGmizU4jI^Sady(M>C+qqB0oy(SOHQ8qaoxDMbHbt#qeI&C)hX(K1I-SF<$Oq=_Aoe z;p-p&jnFJ8q7gZr_mRFXBYmnsXI%3}&_BNW=aqH13Ci({vhq(?8BgBy)WD=Cyg~<0RMgPt&4!ebc&w zwJw1!i#A7Bqb2dMj3bBj@-ku*%Waz~x}m0bOobXcdI`SU1Rav`#INnMvZ`R#f(L2?1M&@P_A!n+Jr_e)X^1f|; zB6gb3xf(=MXc;t1-VY$!-go@I=N7|q{3c#rCQxYj19A86UGzMH9}Mu%KO9I0%)cS5 zGy0qXYdjEE08jwB1z@7V-)H`IgI`-&VWB9jLY?{B>+AP<0`r*kARg+Q+n;T z^2S}jjk=6G;=@IGvT0QTT6S=?D%Saqe@QRkZs{=|OFH4WzYxr8lT>v#Tf~hWX`FMs xP&a}SBPTj|({%mBCf`R-Y$O2+qbHg>1Sa0^NB9ep0Turao96@bBlyB);6IN;`LqB4 diff --git a/Tools/NUnit/nunit.exe.config b/Tools/NUnit/nunit.exe.config deleted file mode 100644 index 9301f94653..0000000000 --- a/Tools/NUnit/nunit.exe.config +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - From 721f16527840cdb1bf3afa4958c79d913e6ee2ba Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 21:28:22 +0100 Subject: [PATCH 107/131] Use wildcards in WRC project To make sure we got all the quantities and not having to manually update it. --- .../UnitsNet.WindowsRuntimeComponent.csproj | 90 +------------------ 1 file changed, 1 insertion(+), 89 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj index e254fd55f5..e34d1d23a3 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.csproj @@ -104,95 +104,7 @@ PackageReference - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + From 6a81983a63e18155e4da0de5cccc36845d54812f Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 21:25:02 +0100 Subject: [PATCH 108/131] Move/rename testapps to Samples dir Include in Samples solution --- Samples/Samples.sln | 88 ++++++++++++++++++ .../.gitignore | 0 .../SimpleConversionDemo.UWP.CSharp}/App.xaml | 0 .../App.xaml.cs | 0 .../Assets/LockScreenLogo.scale-200.png | Bin .../Assets/SplashScreen.scale-200.png | Bin .../Assets/Square150x150Logo.scale-200.png | Bin .../Assets/Square44x44Logo.scale-200.png | Bin ...x44Logo.targetsize-24_altform-unplated.png | Bin .../Assets/StoreLogo.png | Bin .../Assets/Wide310x150Logo.scale-200.png | Bin .../MainPage.xaml | 0 .../MainPage.xaml.cs | 0 .../Package.appxmanifest | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/Default.rd.xml | 0 .../README.md | 0 .../SimpleConversionDemo.UWP.CSharp.csproj | 0 .../build.bat | 0 .../project.json | 0 .../SimpleConversionDemo.UWP.WinJS}/README.md | 0 .../SimpleConversionDemo.UWP.WinJS.jsproj | 0 .../SimpleConversionDemo.UWP.WinJS}/build.bat | 0 .../css/default.css | 0 .../images/LockScreenLogo.scale-200.png | Bin .../images/SplashScreen.scale-200.png | Bin .../images/Square150x150Logo.scale-200.png | Bin .../images/Square44x44Logo.scale-200.png | Bin ...x44Logo.targetsize-24_altform-unplated.png | Bin .../images/StoreLogo.png | Bin .../images/Wide310x150Logo.scale-200.png | Bin .../index.html | 0 .../js/main.js | 0 .../lib/winjs-4.0.1/css/ui-dark.css | 0 .../lib/winjs-4.0.1/css/ui-light.css | 0 .../lib/winjs-4.0.1/fonts/Symbols.ttf | Bin .../lib/winjs-4.0.1/js/base.js | 0 .../lib/winjs-4.0.1/js/ui.js | 0 .../package.appxmanifest | 0 .../project.json | 0 ...tsNet.TestApps.Uwp.Csharp_TemporaryKey.pfx | Bin 2504 -> 0 bytes ...itsNet.TestApps.Uwp.WinJS_TemporaryKey.pfx | Bin 2512 -> 0 bytes 42 files changed, 88 insertions(+) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/.gitignore (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/App.xaml (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/App.xaml.cs (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Assets/LockScreenLogo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Assets/SplashScreen.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Assets/Square150x150Logo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Assets/Square44x44Logo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Assets/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Assets/StoreLogo.png (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Assets/Wide310x150Logo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/MainPage.xaml (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/MainPage.xaml.cs (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Package.appxmanifest (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Properties/AssemblyInfo.cs (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/Properties/Default.rd.xml (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/README.md (100%) rename UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp.csproj => Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp.csproj (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/build.bat (100%) rename {UnitsNet.TestApps.Uwp.Csharp => Samples/SimpleConversionDemo.UWP.CSharp}/project.json (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/README.md (100%) rename UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS.jsproj => Samples/SimpleConversionDemo.UWP.WinJS/SimpleConversionDemo.UWP.WinJS.jsproj (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/build.bat (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/css/default.css (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/images/LockScreenLogo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/images/SplashScreen.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/images/Square150x150Logo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/images/Square44x44Logo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/images/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/images/StoreLogo.png (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/images/Wide310x150Logo.scale-200.png (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/index.html (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/js/main.js (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/lib/winjs-4.0.1/css/ui-dark.css (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/lib/winjs-4.0.1/css/ui-light.css (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/lib/winjs-4.0.1/fonts/Symbols.ttf (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/lib/winjs-4.0.1/js/base.js (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/lib/winjs-4.0.1/js/ui.js (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/package.appxmanifest (100%) rename {UnitsNet.TestApps.Uwp.WinJS => Samples/SimpleConversionDemo.UWP.WinJS}/project.json (100%) delete mode 100644 UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp_TemporaryKey.pfx delete mode 100644 UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS_TemporaryKey.pfx diff --git a/Samples/Samples.sln b/Samples/Samples.sln index 0d8fc0f162..02e4fd5c9f 100644 --- a/Samples/Samples.sln +++ b/Samples/Samples.sln @@ -9,24 +9,112 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitConverter.Wpf", "UnitCo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfMVVMSample", "WpfMVVMSample\WpfMVVMSample\WpfMVVMSample.csproj", "{B72F9215-70FF-4155-89BC-9A02CC550447}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleConversionDemo.UWP.CSharp", "SimpleConversionDemo.UWP.CSharp\SimpleConversionDemo.UWP.CSharp.csproj", "{76255CC9-A854-441F-AF5C-2606509D3C5E}" +EndProject +Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "SimpleConversionDemo.UWP.WinJS", "SimpleConversionDemo.UWP.WinJS\SimpleConversionDemo.UWP.WinJS.jsproj", "{F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Debug|ARM.ActiveCfg = Debug|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Debug|x64.ActiveCfg = Debug|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Debug|x64.Build.0 = Debug|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Debug|x86.ActiveCfg = Debug|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Debug|x86.Build.0 = Debug|Any CPU {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Release|Any CPU.ActiveCfg = Release|Any CPU {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Release|Any CPU.Build.0 = Release|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Release|ARM.ActiveCfg = Release|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Release|x64.ActiveCfg = Release|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Release|x64.Build.0 = Release|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Release|x86.ActiveCfg = Release|Any CPU + {955A6CBF-C4E3-4C55-85C8-613E2CA4CCD7}.Release|x86.Build.0 = Release|Any CPU {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Debug|x64.ActiveCfg = Debug|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Debug|x64.Build.0 = Debug|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Debug|x86.ActiveCfg = Debug|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Debug|x86.Build.0 = Debug|Any CPU {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Release|Any CPU.Build.0 = Release|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Release|ARM.ActiveCfg = Release|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Release|x64.ActiveCfg = Release|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Release|x64.Build.0 = Release|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Release|x86.ActiveCfg = Release|Any CPU + {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}.Release|x86.Build.0 = Release|Any CPU {B72F9215-70FF-4155-89BC-9A02CC550447}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B72F9215-70FF-4155-89BC-9A02CC550447}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Debug|x64.ActiveCfg = Debug|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Debug|x64.Build.0 = Debug|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Debug|x86.ActiveCfg = Debug|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Debug|x86.Build.0 = Debug|Any CPU {B72F9215-70FF-4155-89BC-9A02CC550447}.Release|Any CPU.ActiveCfg = Release|Any CPU {B72F9215-70FF-4155-89BC-9A02CC550447}.Release|Any CPU.Build.0 = Release|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Release|ARM.ActiveCfg = Release|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Release|x64.ActiveCfg = Release|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Release|x64.Build.0 = Release|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Release|x86.ActiveCfg = Release|Any CPU + {B72F9215-70FF-4155-89BC-9A02CC550447}.Release|x86.Build.0 = Release|Any CPU + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|Any CPU.ActiveCfg = Debug|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|Any CPU.Build.0 = Debug|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|Any CPU.Deploy.0 = Debug|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|ARM.ActiveCfg = Debug|ARM + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|ARM.Build.0 = Debug|ARM + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|ARM.Deploy.0 = Debug|ARM + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x64.ActiveCfg = Debug|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x64.Build.0 = Debug|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x64.Deploy.0 = Debug|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x86.ActiveCfg = Debug|x86 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x86.Build.0 = Debug|x86 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x86.Deploy.0 = Debug|x86 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|Any CPU.ActiveCfg = Release|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|Any CPU.Build.0 = Release|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|Any CPU.Deploy.0 = Release|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|ARM.ActiveCfg = Release|ARM + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|ARM.Build.0 = Release|ARM + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|ARM.Deploy.0 = Release|ARM + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x64.ActiveCfg = Release|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x64.Build.0 = Release|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x64.Deploy.0 = Release|x64 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x86.ActiveCfg = Release|x86 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x86.Build.0 = Release|x86 + {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x86.Deploy.0 = Release|x86 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|Any CPU.ActiveCfg = Debug|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|Any CPU.Build.0 = Debug|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|Any CPU.Deploy.0 = Debug|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|ARM.ActiveCfg = Debug|ARM + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|ARM.Build.0 = Debug|ARM + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|ARM.Deploy.0 = Debug|ARM + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x64.ActiveCfg = Debug|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x64.Build.0 = Debug|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x64.Deploy.0 = Debug|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x86.ActiveCfg = Debug|x86 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x86.Build.0 = Debug|x86 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x86.Deploy.0 = Debug|x86 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|Any CPU.ActiveCfg = Release|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|Any CPU.Build.0 = Release|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|Any CPU.Deploy.0 = Release|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|ARM.ActiveCfg = Release|ARM + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|ARM.Build.0 = Release|ARM + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|ARM.Deploy.0 = Release|ARM + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x64.ActiveCfg = Release|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x64.Build.0 = Release|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x64.Deploy.0 = Release|x64 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x86.ActiveCfg = Release|x86 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x86.Build.0 = Release|x86 + {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UnitsNet.TestApps.Uwp.Csharp/.gitignore b/Samples/SimpleConversionDemo.UWP.CSharp/.gitignore similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/.gitignore rename to Samples/SimpleConversionDemo.UWP.CSharp/.gitignore diff --git a/UnitsNet.TestApps.Uwp.Csharp/App.xaml b/Samples/SimpleConversionDemo.UWP.CSharp/App.xaml similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/App.xaml rename to Samples/SimpleConversionDemo.UWP.CSharp/App.xaml diff --git a/UnitsNet.TestApps.Uwp.Csharp/App.xaml.cs b/Samples/SimpleConversionDemo.UWP.CSharp/App.xaml.cs similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/App.xaml.cs rename to Samples/SimpleConversionDemo.UWP.CSharp/App.xaml.cs diff --git a/UnitsNet.TestApps.Uwp.Csharp/Assets/LockScreenLogo.scale-200.png b/Samples/SimpleConversionDemo.UWP.CSharp/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Assets/LockScreenLogo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.CSharp/Assets/LockScreenLogo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.Csharp/Assets/SplashScreen.scale-200.png b/Samples/SimpleConversionDemo.UWP.CSharp/Assets/SplashScreen.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Assets/SplashScreen.scale-200.png rename to Samples/SimpleConversionDemo.UWP.CSharp/Assets/SplashScreen.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.Csharp/Assets/Square150x150Logo.scale-200.png b/Samples/SimpleConversionDemo.UWP.CSharp/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Assets/Square150x150Logo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.CSharp/Assets/Square150x150Logo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.Csharp/Assets/Square44x44Logo.scale-200.png b/Samples/SimpleConversionDemo.UWP.CSharp/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Assets/Square44x44Logo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.CSharp/Assets/Square44x44Logo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.Csharp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/Samples/SimpleConversionDemo.UWP.CSharp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to Samples/SimpleConversionDemo.UWP.CSharp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/UnitsNet.TestApps.Uwp.Csharp/Assets/StoreLogo.png b/Samples/SimpleConversionDemo.UWP.CSharp/Assets/StoreLogo.png similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Assets/StoreLogo.png rename to Samples/SimpleConversionDemo.UWP.CSharp/Assets/StoreLogo.png diff --git a/UnitsNet.TestApps.Uwp.Csharp/Assets/Wide310x150Logo.scale-200.png b/Samples/SimpleConversionDemo.UWP.CSharp/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Assets/Wide310x150Logo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.CSharp/Assets/Wide310x150Logo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml b/Samples/SimpleConversionDemo.UWP.CSharp/MainPage.xaml similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml rename to Samples/SimpleConversionDemo.UWP.CSharp/MainPage.xaml diff --git a/UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml.cs b/Samples/SimpleConversionDemo.UWP.CSharp/MainPage.xaml.cs similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/MainPage.xaml.cs rename to Samples/SimpleConversionDemo.UWP.CSharp/MainPage.xaml.cs diff --git a/UnitsNet.TestApps.Uwp.Csharp/Package.appxmanifest b/Samples/SimpleConversionDemo.UWP.CSharp/Package.appxmanifest similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Package.appxmanifest rename to Samples/SimpleConversionDemo.UWP.CSharp/Package.appxmanifest diff --git a/UnitsNet.TestApps.Uwp.Csharp/Properties/AssemblyInfo.cs b/Samples/SimpleConversionDemo.UWP.CSharp/Properties/AssemblyInfo.cs similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Properties/AssemblyInfo.cs rename to Samples/SimpleConversionDemo.UWP.CSharp/Properties/AssemblyInfo.cs diff --git a/UnitsNet.TestApps.Uwp.Csharp/Properties/Default.rd.xml b/Samples/SimpleConversionDemo.UWP.CSharp/Properties/Default.rd.xml similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/Properties/Default.rd.xml rename to Samples/SimpleConversionDemo.UWP.CSharp/Properties/Default.rd.xml diff --git a/UnitsNet.TestApps.Uwp.Csharp/README.md b/Samples/SimpleConversionDemo.UWP.CSharp/README.md similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/README.md rename to Samples/SimpleConversionDemo.UWP.CSharp/README.md diff --git a/UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp.csproj b/Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp.csproj similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp.csproj rename to Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp.csproj diff --git a/UnitsNet.TestApps.Uwp.Csharp/build.bat b/Samples/SimpleConversionDemo.UWP.CSharp/build.bat similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/build.bat rename to Samples/SimpleConversionDemo.UWP.CSharp/build.bat diff --git a/UnitsNet.TestApps.Uwp.Csharp/project.json b/Samples/SimpleConversionDemo.UWP.CSharp/project.json similarity index 100% rename from UnitsNet.TestApps.Uwp.Csharp/project.json rename to Samples/SimpleConversionDemo.UWP.CSharp/project.json diff --git a/UnitsNet.TestApps.Uwp.WinJS/README.md b/Samples/SimpleConversionDemo.UWP.WinJS/README.md similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/README.md rename to Samples/SimpleConversionDemo.UWP.WinJS/README.md diff --git a/UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS.jsproj b/Samples/SimpleConversionDemo.UWP.WinJS/SimpleConversionDemo.UWP.WinJS.jsproj similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/UnitsNet.TestApps.Uwp.WinJS.jsproj rename to Samples/SimpleConversionDemo.UWP.WinJS/SimpleConversionDemo.UWP.WinJS.jsproj diff --git a/UnitsNet.TestApps.Uwp.WinJS/build.bat b/Samples/SimpleConversionDemo.UWP.WinJS/build.bat similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/build.bat rename to Samples/SimpleConversionDemo.UWP.WinJS/build.bat diff --git a/UnitsNet.TestApps.Uwp.WinJS/css/default.css b/Samples/SimpleConversionDemo.UWP.WinJS/css/default.css similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/css/default.css rename to Samples/SimpleConversionDemo.UWP.WinJS/css/default.css diff --git a/UnitsNet.TestApps.Uwp.WinJS/images/LockScreenLogo.scale-200.png b/Samples/SimpleConversionDemo.UWP.WinJS/images/LockScreenLogo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/images/LockScreenLogo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.WinJS/images/LockScreenLogo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.WinJS/images/SplashScreen.scale-200.png b/Samples/SimpleConversionDemo.UWP.WinJS/images/SplashScreen.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/images/SplashScreen.scale-200.png rename to Samples/SimpleConversionDemo.UWP.WinJS/images/SplashScreen.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.WinJS/images/Square150x150Logo.scale-200.png b/Samples/SimpleConversionDemo.UWP.WinJS/images/Square150x150Logo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/images/Square150x150Logo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.WinJS/images/Square150x150Logo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.WinJS/images/Square44x44Logo.scale-200.png b/Samples/SimpleConversionDemo.UWP.WinJS/images/Square44x44Logo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/images/Square44x44Logo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.WinJS/images/Square44x44Logo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.WinJS/images/Square44x44Logo.targetsize-24_altform-unplated.png b/Samples/SimpleConversionDemo.UWP.WinJS/images/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/images/Square44x44Logo.targetsize-24_altform-unplated.png rename to Samples/SimpleConversionDemo.UWP.WinJS/images/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/UnitsNet.TestApps.Uwp.WinJS/images/StoreLogo.png b/Samples/SimpleConversionDemo.UWP.WinJS/images/StoreLogo.png similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/images/StoreLogo.png rename to Samples/SimpleConversionDemo.UWP.WinJS/images/StoreLogo.png diff --git a/UnitsNet.TestApps.Uwp.WinJS/images/Wide310x150Logo.scale-200.png b/Samples/SimpleConversionDemo.UWP.WinJS/images/Wide310x150Logo.scale-200.png similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/images/Wide310x150Logo.scale-200.png rename to Samples/SimpleConversionDemo.UWP.WinJS/images/Wide310x150Logo.scale-200.png diff --git a/UnitsNet.TestApps.Uwp.WinJS/index.html b/Samples/SimpleConversionDemo.UWP.WinJS/index.html similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/index.html rename to Samples/SimpleConversionDemo.UWP.WinJS/index.html diff --git a/UnitsNet.TestApps.Uwp.WinJS/js/main.js b/Samples/SimpleConversionDemo.UWP.WinJS/js/main.js similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/js/main.js rename to Samples/SimpleConversionDemo.UWP.WinJS/js/main.js diff --git a/UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/css/ui-dark.css b/Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/css/ui-dark.css similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/css/ui-dark.css rename to Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/css/ui-dark.css diff --git a/UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/css/ui-light.css b/Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/css/ui-light.css similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/css/ui-light.css rename to Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/css/ui-light.css diff --git a/UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/fonts/Symbols.ttf b/Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/fonts/Symbols.ttf similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/fonts/Symbols.ttf rename to Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/fonts/Symbols.ttf diff --git a/UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/js/base.js b/Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/js/base.js similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/js/base.js rename to Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/js/base.js diff --git a/UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/js/ui.js b/Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/js/ui.js similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/lib/winjs-4.0.1/js/ui.js rename to Samples/SimpleConversionDemo.UWP.WinJS/lib/winjs-4.0.1/js/ui.js diff --git a/UnitsNet.TestApps.Uwp.WinJS/package.appxmanifest b/Samples/SimpleConversionDemo.UWP.WinJS/package.appxmanifest similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/package.appxmanifest rename to Samples/SimpleConversionDemo.UWP.WinJS/package.appxmanifest diff --git a/UnitsNet.TestApps.Uwp.WinJS/project.json b/Samples/SimpleConversionDemo.UWP.WinJS/project.json similarity index 100% rename from UnitsNet.TestApps.Uwp.WinJS/project.json rename to Samples/SimpleConversionDemo.UWP.WinJS/project.json diff --git a/UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp_TemporaryKey.pfx b/UnitsNet.TestApps.Uwp.Csharp/UnitsNet.TestApps.Uwp.Csharp_TemporaryKey.pfx deleted file mode 100644 index f9430b979edc4dc04940fc18fa0fe2b01ecc01fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2504 zcmb7Gc{G&a8vnl8$Jn=I(3EVEz8S+vmLy7r8G9rdGbAx$O0;QgsbnqTCL&9rD3QpP zEEyFFDOp0w5~h&K{dDf_cF(#0-1DC2InVF+yubH*&ilUSc|VAUe}Vv!5Dy=Q!EcD# z88t5gV!=!v{s@YP_k(F4h=>0EUn%rw6c0TH)5Ea6#}NLd5*7jxnLN}lh==+PDPV;D zO~Z?eqHx91(IjGt@O}gW`vS#7^_U*fwdqWJnG4FDdU8Lr(pOQ-FAFlMNxNZD-AZ;Z z%OP$3S!DF<7;WZqQ@^$ryhh{}MSD=Qhnp5WC&-!}c`RdzZ&1oPIL*X@5UI&ad>?otn0jlLL}t zw3@>$hLvS%w2KobBNq74KD>|{I(Dv}=Q28zq%j58V$Jz)yu%6&4Eogb>Xn^BhV8wu zBp@XBePPAf5ZehUr5ES*=7xGopw~{4F6#=TF2~CDp%T)jVjcqmC9d>TVJ-a+B?TwQak1 zTXJ={<%3??bgS|n7YRa1`mC+t^b#nJ*Y;YQT zUx{G-{XvrpcBZ}2G}!UpAYE2R+m{)c9>FhuIxh zZ#QzcVdfL{qxC&Ge}c$G=H-K`;&zOs5S?psqF!B-5B)sH@9emx#xZtt1}V}O8VmbM zv`SBuJi8Y&Pq7^fz4}8tg`y$fyffR_@SNhIrOy(zv-24T)i&>-71%mNFT3W~#bA7g zrv*k@G;&iT^Yx8tNe?S3CFaCpYp3E2Q@UHNHMB#ea(hL>30msJ0W5w{N8iBY#YWqN z*WZK145aF?G9_#3R;SC)mi5xC5_J#71jNzb7Lo*kVc`z}2SUVBr{OE51iL_$8DPrZlHCa;HpywCDkQlF*dwRT1+`DC9S|Z278?sgyjatYPsh&xVddLxALOciu9_!Jc542 zo*jYyN%tWul9_#~@KC1q7GnnPFnj0}`79rj`qM7)GGq)21p)v7IsJ!}Cht<(39x|8 z@E`-8fF5itU?V_y;}3Yl$PA7{fB=}|z&H@_fa8O|RV0A^d)_e^ zu>dv@2=S2Ke=1*j7?92=9?~AB>9FnjyZa;I)g8YTBPu)Qun* z4a-BFLe`_zJBm}x4x6#I7|S1U{Mfu9KyWX65qdM5KHH}ODz6DhJGBOvHzSxH$uDJ7 zWEls(BD1*!KD}w2^*Y+s6JeuVJVSD6X|{I0QsaA0ru-FWUF0a`Nur8KHxF#f`l0VG z#?^I`dVf9AX;%EJX$p~mm$|5NxiDP!Yp1wl;y=ptO+D$Gt9Z|ivXW4Uc#AIYp@=qO z&HP1#Mz~H?Y7+I8@q*OABiZe*BFhg2b9_`Ca{Q8mhxylmnnN|UnaJJuS<|rd6_dMiOx=Ehzv|FZPHny_=U!G zz2E52t3jqemNrv>G&7&C%5TXdG=CHmJ5F+_X$$BLJ2=pV zdzi|z=30Qj)>DV6x2r zZV_9cH4qkq))Yk|d1i-`=YVC5;o23su%~#Pao%P2O#= N54U|xV3mMmcmNf$A)rXma#)lkTi zE!zyTm0`lYjHQTciy_PX*6a7X_w{@I&ht9wJkR@cp68r@&VwN#+c_Xm3<*g@Ae9nL z61R9EoRC5iG6+UO27uTfLxQjUj|6AINbui5{0W>4#G(IW@o+;p3Q4d{3<^*Ej{tt<`>&H)$+HbBU-E-Y#Z*~ZzF4K^Ukp*gR&9~EWeE4_F}RS)PTXNF?>YqN993#1zgwu7`=PEIT=!0r5icHgg#YzP1MWT_z6yzQX)ZM&iyUi=uL z&h3o~?ct9+GTaBw4XfQPv`NZ6dB?@EFb9^0g#{0sy!-GwMrP6=h9I7jke!`kx9#HT z$hs2HifwMz{?L^ExP3`A&*lUTZg}V2PC??d!>dlG76Hie_t+uxr|L>r`XhCiG@e8JbIqX+ zHP1#Szbt)t`HRBay-NaPvborYo^Xk`HOa?faCbkFI7@DA$Y-Xh_@KJ58$ESmm=mKH z?s`Jnue$Aq2Y)g;V8$GF!LD&RdV764wa2WV30qvya)(E5ww35WgrQG0qKwNIZt+^& z>f{w+I;Fx)gSq+LIG9^7#qI-@#pf-F6H+?lE6I|&xalyw$-*y-#2DI#;`qK1Ko9?J z{FdnZuy64md)X^4{ZSpVO@^=D7&t?5A~AcM9*c1j1~SzQsz6Tbu1IRR+?s@g(wKbF z*R!1ckxN&o+uc=bqDFDbS{LdCzvxOl&aFPCZHbC&LsF7hh+8ysVfc_>8XcPLi2c3lUL~znp(AL&Rb$ zaS=;66BlimaUi}`-n2I++_2v6^U@+ps-d-a&8VB4kQy|X{sSdKS4zt_-8cPqC!r|J$BpkFC}Z3+BcRRtcddY zRc;A82-OTAZs9 z=biO>-t18K(_io>BdrS9R+DvJp{gC1IpW(HNE-r6?|H7Lh((~bswe~%a{n${OWXAG z=t*m1%g3Q5vzX5A6H_ z0eFLo7wBn&sy5*9Q`H2C8kmOxV|9@0fSwn|8G%$rKwuCORsf=AdDI**1N^}v1ON{N zgVP5H0b~GcaQ#891HNEn2>KB~Ajt4wOaQM61pIzx$pDr=&xL`J7x)MQh6Kg`{c=u3 zAqnaRA}0W4vPdy(5$z+|9h9fGak6qEcEP5tR5~s0z(*RiBgn3p(MMd&ZkC z$D!W+F?8(mGV^9w3jA#nyr!Z8}I6rOZvvw566!Ou4QfD zE=lW-V^K;fX3#k70`^I-$4Z28LNS6lFAL+C)*?0764{`FAymZV; z?+anZ`Wwz@l^iI>Y3;absWfZD@--pDgyD@(VU;7n^DW6I-cRNaWN9dD4OtvlsF-pW zvt`()FO2t1Y@W_JBlPIlKGYqO5Z-V*7#T4pAhvr@9f~%{4IE|%w7YZoNtYRLF9jO5 z#{b#h06RUUX?xxv6_Z`zYeTypOsv!mP#%DsBb=6aD75Iumb;pPys4z8r+0xXz||>% zMP660>v;_IU)}YqO1`-u(|dc)qHB1mv8yNW_H~caHKOmdrW><#`*Z8LX!bjS95cVh zl~PpbHTaR}IM2%Pai0m)ZBvSf?i-zty3xCQ*4t^sC|8IS#HaMZkknRLMDp5MGiL56 z!Dur7>?Ys4paXQ9KGZ7xJ3NXcV$j;|Z<>7*7)Al;dwo{@H1&5y07)Q?Y@;OvV|L^3ZbJ&tQqFQ4v4WZD$Q zYX2eFuBeRJnvWo3(r>PtR@U925SM6|@MDIQns^Fk2t5u> zz?oX9k&Q{<{THR(5Hsz@f%dpae_kDNN1pr6|;^se@)sr)>@IdkXPdC zxl&+x>}0|GhhcNs)?QMuqP~DjMbit^Yy`ccG`;MOzQsBUF@*YrT4K{{0UOtitTe$o zMBAT-5C)nUJ&ZJl69HG|gK`{!32)nDWFEXsGE+Yw%8`yNi*?)(5Qhn8RxEV9yE>LT XZqC Date: Fri, 9 Nov 2018 22:03:49 +0100 Subject: [PATCH 109/131] Remove unused solutions AllTargets and TestApps --- UnitsNet.AllTargets.sln | 151 ---------------------------------------- UnitsNet.TestApps.sln | 63 ----------------- 2 files changed, 214 deletions(-) delete mode 100644 UnitsNet.AllTargets.sln delete mode 100644 UnitsNet.TestApps.sln diff --git a/UnitsNet.AllTargets.sln b/UnitsNet.AllTargets.sln deleted file mode 100644 index 17dd988da7..0000000000 --- a/UnitsNet.AllTargets.sln +++ /dev/null @@ -1,151 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2027 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.NetStandard10", "UnitsNet\UnitsNet.NetStandard10.csproj", "{CBEAD842-07BC-4B08-9D9D-D6659813776F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet", "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj", "{FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet.Signed", "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Signed.csproj", "{7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.NetStandard10.Signed", "UnitsNet\UnitsNet.NetStandard10.Signed.csproj", "{21C1AFDC-354E-4D97-947B-2DB63C529E6E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet.Tests", "UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj", "{FFEEDF44-F32D-4D92-A75E-487CB0582EB1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Tests", "UnitsNet.Tests\UnitsNet.Tests.csproj", "{0E3B7567-5DF2-44BD-88DB-CCF050D3F943}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitsNet.WindowsRuntimeComponent", "UnitsNet.WindowsRuntimeComponent\UnitsNet.WindowsRuntimeComponent.csproj", "{2DA428CA-BFE1-43FA-86D2-7CB42289D596}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|ARM.ActiveCfg = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|ARM.Build.0 = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|x64.ActiveCfg = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|x64.Build.0 = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|x86.ActiveCfg = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Debug|x86.Build.0 = Debug|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|Any CPU.Build.0 = Release|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|ARM.ActiveCfg = Release|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|ARM.Build.0 = Release|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|x64.ActiveCfg = Release|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|x64.Build.0 = Release|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|x86.ActiveCfg = Release|Any CPU - {CBEAD842-07BC-4B08-9D9D-D6659813776F}.Release|x86.Build.0 = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|ARM.ActiveCfg = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|ARM.Build.0 = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|x64.ActiveCfg = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|x64.Build.0 = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|x86.ActiveCfg = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|x86.Build.0 = Debug|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|Any CPU.Build.0 = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|ARM.ActiveCfg = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|ARM.Build.0 = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|x64.ActiveCfg = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|x64.Build.0 = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|x86.ActiveCfg = Release|Any CPU - {FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|x86.Build.0 = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|ARM.ActiveCfg = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|ARM.Build.0 = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|x64.ActiveCfg = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|x64.Build.0 = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|x86.ActiveCfg = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|x86.Build.0 = Debug|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|Any CPU.Build.0 = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|ARM.ActiveCfg = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|ARM.Build.0 = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|x64.ActiveCfg = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|x64.Build.0 = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|x86.ActiveCfg = Release|Any CPU - {7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|x86.Build.0 = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|ARM.ActiveCfg = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|ARM.Build.0 = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|x64.ActiveCfg = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|x64.Build.0 = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|x86.ActiveCfg = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|x86.Build.0 = Debug|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|Any CPU.Build.0 = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|ARM.ActiveCfg = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|ARM.Build.0 = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|x64.ActiveCfg = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|x64.Build.0 = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|x86.ActiveCfg = Release|Any CPU - {21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|x86.Build.0 = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|ARM.ActiveCfg = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|ARM.Build.0 = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|x64.ActiveCfg = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|x64.Build.0 = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|x86.ActiveCfg = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|x86.Build.0 = Debug|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|Any CPU.Build.0 = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|ARM.ActiveCfg = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|ARM.Build.0 = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|x64.ActiveCfg = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|x64.Build.0 = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|x86.ActiveCfg = Release|Any CPU - {FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|x86.Build.0 = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|ARM.ActiveCfg = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|ARM.Build.0 = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|x64.ActiveCfg = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|x64.Build.0 = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|x86.ActiveCfg = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Debug|x86.Build.0 = Debug|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|Any CPU.Build.0 = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|ARM.ActiveCfg = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|ARM.Build.0 = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|x64.ActiveCfg = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|x64.Build.0 = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|x86.ActiveCfg = Release|Any CPU - {0E3B7567-5DF2-44BD-88DB-CCF050D3F943}.Release|x86.Build.0 = Release|Any CPU - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|ARM.ActiveCfg = Debug|ARM - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|ARM.Build.0 = Debug|ARM - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|x64.ActiveCfg = Debug|x64 - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|x64.Build.0 = Debug|x64 - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|x86.ActiveCfg = Debug|x86 - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Debug|x86.Build.0 = Debug|x86 - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|Any CPU.Build.0 = Release|Any CPU - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|ARM.ActiveCfg = Release|ARM - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|ARM.Build.0 = Release|ARM - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|x64.ActiveCfg = Release|x64 - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|x64.Build.0 = Release|x64 - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|x86.ActiveCfg = Release|x86 - {2DA428CA-BFE1-43FA-86D2-7CB42289D596}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {554906B2-5972-4EBF-9DD5-EEFA77D735D8} - EndGlobalSection -EndGlobal diff --git a/UnitsNet.TestApps.sln b/UnitsNet.TestApps.sln deleted file mode 100644 index 1cd5c2919c..0000000000 --- a/UnitsNet.TestApps.sln +++ /dev/null @@ -1,63 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2027 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitsNet.TestApps.Uwp.Csharp", "UnitsNet.TestApps.Uwp.Csharp\UnitsNet.TestApps.Uwp.Csharp.csproj", "{76255CC9-A854-441F-AF5C-2606509D3C5E}" -EndProject -Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "UnitsNet.TestApps.Uwp.WinJS", "UnitsNet.TestApps.Uwp.WinJS\UnitsNet.TestApps.Uwp.WinJS.jsproj", "{F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|ARM.ActiveCfg = Debug|ARM - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|ARM.Build.0 = Debug|ARM - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|ARM.Deploy.0 = Debug|ARM - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x64.ActiveCfg = Debug|x64 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x64.Build.0 = Debug|x64 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x64.Deploy.0 = Debug|x64 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x86.ActiveCfg = Debug|x86 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x86.Build.0 = Debug|x86 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Debug|x86.Deploy.0 = Debug|x86 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|ARM.ActiveCfg = Release|ARM - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|ARM.Build.0 = Release|ARM - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|ARM.Deploy.0 = Release|ARM - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x64.ActiveCfg = Release|x64 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x64.Build.0 = Release|x64 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x64.Deploy.0 = Release|x64 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x86.ActiveCfg = Release|x86 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x86.Build.0 = Release|x86 - {76255CC9-A854-441F-AF5C-2606509D3C5E}.Release|x86.Deploy.0 = Release|x86 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|ARM.ActiveCfg = Debug|ARM - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|ARM.Build.0 = Debug|ARM - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|ARM.Deploy.0 = Debug|ARM - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x64.ActiveCfg = Debug|x64 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x64.Build.0 = Debug|x64 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x64.Deploy.0 = Debug|x64 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x86.ActiveCfg = Debug|x86 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x86.Build.0 = Debug|x86 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Debug|x86.Deploy.0 = Debug|x86 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|ARM.ActiveCfg = Release|ARM - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|ARM.Build.0 = Release|ARM - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|ARM.Deploy.0 = Release|ARM - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x64.ActiveCfg = Release|x64 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x64.Build.0 = Release|x64 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x64.Deploy.0 = Release|x64 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x86.ActiveCfg = Release|x86 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x86.Build.0 = Release|x86 - {F5B26152-A64B-42A8-8F19-D2EAFB94CBD1}.Release|x86.Deploy.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C28E940D-1A2A-43AC-BF2D-5BF50546156F} - EndGlobalSection -EndGlobal From 37cad3453bc43f36d369538848d3c329ecc3011e Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 22:05:22 +0100 Subject: [PATCH 110/131] Fix nuget hint paths in sample apps --- .../UnitConverter.Wpf/UnitConverter.Wpf.csproj | 6 +++--- .../WpfMVVMSample/WpfMVVMSample.csproj | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj index 1cebd5d03b..9c7d742abe 100644 --- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj +++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj @@ -38,12 +38,12 @@ - ..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + ..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll - ..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll + ..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll @@ -55,7 +55,7 @@ 4.0 - ..\packages\UnitsNet.3.87.0\lib\net40\UnitsNet.dll + ..\..\packages\UnitsNet.3.87.0\lib\net40\UnitsNet.dll diff --git a/Samples/WpfMVVMSample/WpfMVVMSample/WpfMVVMSample.csproj b/Samples/WpfMVVMSample/WpfMVVMSample/WpfMVVMSample.csproj index a240bf2c02..3eef840624 100644 --- a/Samples/WpfMVVMSample/WpfMVVMSample/WpfMVVMSample.csproj +++ b/Samples/WpfMVVMSample/WpfMVVMSample/WpfMVVMSample.csproj @@ -35,30 +35,30 @@ - ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll + ..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll - ..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.dll + ..\..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.dll - ..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.Configuration.dll + ..\..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.Configuration.dll - ..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll + ..\..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll - ..\packages\Prism.Core.6.3.0\lib\net45\Prism.dll + ..\..\packages\Prism.Core.6.3.0\lib\net45\Prism.dll - ..\packages\Prism.Unity.6.3.0\lib\net45\Prism.Unity.Wpf.dll + ..\..\packages\Prism.Unity.6.3.0\lib\net45\Prism.Unity.Wpf.dll - ..\packages\Prism.Wpf.6.3.0\lib\net45\Prism.Wpf.dll + ..\..\packages\Prism.Wpf.6.3.0\lib\net45\Prism.Wpf.dll - ..\packages\Prism.Wpf.6.3.0\lib\net45\System.Windows.Interactivity.dll + ..\..\packages\Prism.Wpf.6.3.0\lib\net45\System.Windows.Interactivity.dll @@ -70,7 +70,7 @@ 4.0 - ..\packages\UnitsNet.3.85.0\lib\net40\UnitsNet.dll + ..\..\packages\UnitsNet.3.85.0\lib\net40\UnitsNet.dll From ed1420fc9f1a9155cac53110d4f2cbc876dc22be Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 22:05:30 +0100 Subject: [PATCH 111/131] Remove old unused R# file --- .../UnitConverter.Wpf/Wpf-GenericUnitConverter.sln.DotSettings | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Samples/UnitConverter.Wpf/Wpf-GenericUnitConverter.sln.DotSettings diff --git a/Samples/UnitConverter.Wpf/Wpf-GenericUnitConverter.sln.DotSettings b/Samples/UnitConverter.Wpf/Wpf-GenericUnitConverter.sln.DotSettings deleted file mode 100644 index 8939b3c194..0000000000 --- a/Samples/UnitConverter.Wpf/Wpf-GenericUnitConverter.sln.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file From e6e3400b56f146ad639dad00f29bc46684f38c4c Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 22:11:20 +0100 Subject: [PATCH 112/131] Set verbosity minimal for Samples build script --- Samples/build.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/build.bat b/Samples/build.bat index ef5054245f..e18b95c1fd 100644 --- a/Samples/build.bat +++ b/Samples/build.bat @@ -9,5 +9,5 @@ for /f "usebackq tokens=*" %%i in (`%vswhere% -latest -products * -requires Micr echo %vswhere% if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" ( - "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" %* + "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" -verbosity:minimal %* ) \ No newline at end of file From a1473d20198ec51b9d985077e8a4e7efc0a2bcec Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 9 Nov 2018 22:15:03 +0100 Subject: [PATCH 113/131] Regenerate certs for UWP apps Check certs in to repo so it's easier for others to build this. --- .../Package.appxmanifest | 2 +- .../SimpleConversionDemo.UWP.CSharp.csproj | 6 +-- ...ConversionDemo.UWP.CSharp_TemporaryKey.pfx | Bin 0 -> 2528 bytes .../SimpleConversionDemo.UWP.WinJS.jsproj | 5 ++- ...eConversionDemo.UWP.WinJS_TemporaryKey.pfx | Bin 0 -> 2528 bytes .../package.appxmanifest | 40 ++++-------------- 6 files changed, 15 insertions(+), 38 deletions(-) create mode 100644 Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp_TemporaryKey.pfx create mode 100644 Samples/SimpleConversionDemo.UWP.WinJS/SimpleConversionDemo.UWP.WinJS_TemporaryKey.pfx diff --git a/Samples/SimpleConversionDemo.UWP.CSharp/Package.appxmanifest b/Samples/SimpleConversionDemo.UWP.CSharp/Package.appxmanifest index 23c4bac2b3..4aa128459b 100644 --- a/Samples/SimpleConversionDemo.UWP.CSharp/Package.appxmanifest +++ b/Samples/SimpleConversionDemo.UWP.CSharp/Package.appxmanifest @@ -1,6 +1,6 @@  - + UWP diff --git a/Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp.csproj b/Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp.csproj index 3c7046dac5..19f9c3b450 100644 --- a/Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp.csproj +++ b/Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp.csproj @@ -16,8 +16,8 @@ 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - UnitsNet.TestApps.Uwp.Csharp_TemporaryKey.pfx - A1E3AD6087EF223EE6E43EE09818599CAE918FEE + SimpleConversionDemo.UWP.CSharp_TemporaryKey.pfx + E98156EA0B8126C89A2653E1CBF645701A704E52 true @@ -91,7 +91,7 @@ - + diff --git a/Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp_TemporaryKey.pfx b/Samples/SimpleConversionDemo.UWP.CSharp/SimpleConversionDemo.UWP.CSharp_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..61cfb8eca28916b939aaf5fbd9591d72c51956d4 GIT binary patch literal 2528 zcmZXVcU05a632gmKnR8^plE=gpcI7!5(x4r3qhosMUjZo1f)u@flz`XD^jE@WkFi# ztW+t|K@m2rKnyj&(tA^y!i#&}+dc2RbI;tF?`P)TGymMVNHTPs1;mOZL(|xyGLbhT z_qae1P&OI*3z!Uj!o=Z7GTY(*q}W!#WVQt+{*!48_EY~k1>*#8sBGlT(2)KT*{p&<4T2?zin{Q{=_e}CfqpqN-^Hth0zsT+*58prEkfaE6JzM z_`?z*Q=@O`fl%yBOzto0z2LF_uMZD3Qe9h)AQ(;VVzlzQh{xHbdLDlB9W}ba*YcCufZn zLz0c3vQ;9(Q`2A?3}O5T1*Ei(burd6BD8g9 zE*4Vhjd8Epxue>{&>^`~{kPNGeY7W^E{W?%wRw9D?*(O>E-^T73UitGi#%9F_m;MF zb@xpU&|%d5x0npv0qVM{bH`p??}+=l^x{xJT~krGp_H%(>!YII`s_28e_y#RJ>I{67#3CDia%@iV!Fk46yK`DNzo(aG>e4(($~iVp<4*lXkoL5Ow#MD!Eqze> z-Q(_Zod`85WwhF(mVHMi^wD!(sei%Bh0Z>8aaVq)4E!M+5D}9EwELb@dMNyD+nX0? z{Z~%u!K#;fNe7>q=lpX52kupM1!qfhOz!|~O3X5ldp0a+X7jnht_LOK#gNix)i8Vk zvDkSkwZ?XaBr;lPZF@K>jZ$CAi;hwG%97_8?7Ws2)Bg~8D!EWo17y$D>z7Tu5n5wW zLu*T{6AC;RG3#0MRJIT^(j9tD%-bh_i_xyl>NiB&m6-Y<%ryPfUM(I`M3rP>>7S-PS*5;d!lo8F{iSCuO+!EkQ^=wdDTJ zqm?r*UiYs*i+-dD-}z}#W<+zyFB_9D{k<#0LSl-eeibIU7S#BZtfs1+gfzoL6&|*0a<2s4109Hp&EFd zx*Jq3gLhLC7{e^SZ^pF>qy`?n9#J7JeN=BTtZx1z?C&HjM`D1FfzfDNDkJOI#uJ=0LYL*Oc) z2q2jZ#f;E^3ZTqXSD7Bo%%PbPidp?b{qQIN3)nK35`aQlutR0pL0}MBnGb}*iy8w) zfD<$21-Jv=OnV6U00`g~bN@ly00*YhX2yYl2a~xowHLD$55V!SQwRY6SDhbI*)d!5 zLXufS|Lz>Zo=s-;U?Nu*5WsZy|71Y_Kl1Ns2MN>Fij#kg{4g>rHY14?lsIeaFdoXo zTOnb5(fDBS(aZjppkapo2c)G03FY>pUNsLVqfcFtfl6{HDC}ifID{lv&R}G)kPk(D zi+3b0xOqITA-#W=5q9Umuy0<0f$q;6+}`A1zh^*6b>cXjmqEd2KsQ>7Ob$G?)=Uo??M z+nf(;sKZNa~^}C4?U211MI#te8Dd5n8bL*RVr1=ey!bAY}{Bf*u zRjzDsRy|>#cKhR;xvLm#uLPnXl=LxLB(Nht?z#ki>1(vxC)cDgmBohY(sI$Mq_2MP zZV|7iRY%7lnF7aU`AMBs&PLP?STH9D0bN_ZmSlEvI1&UMaOxWK=`H| zE@`#OF8&!Jm#WY89pro^@m6uv$Qwa5_*`pAW?l*pXfeYE0+p;=@R4K5$ri;ZoE$jp z#&-ExY|fD?cD(FzM1X^`O&H9YS||7fi@vhZ;ybs98`ncui%h?Ldu!oON~vE_yPLRL zyv&)8Ss;$I0(r+vPkSf&bvB1M`ydFVb(pUNjwN1O+L1HLz>U5*cU7eKLBt_kP$MOI zG8(%@I2NNcn9ms5GfFSfVokWAavaB@LHLU3SG-2FTN9p=s`Nc_){`%KbVL>{o!%y) zc}uOOXGn1LP4&()FLd+C$m57)%;Yi_!;fyYE}$b-kzz;)JDV&wE6X{sK$Xgz)d1CX qgtr<4?Z%nD{WYa88!Rv-nI+P&ZgaWhlT9LIt?6pvF~10.0.16299.0 $(VersionNumberMajor).$(VersionNumberMinor) en-US - UnitsNet.TestApps.Uwp.WinJS_TemporaryKey.pfx + SimpleConversionDemo.UWP.WinJS_TemporaryKey.pfx + 233FD264CDB1D145E2BAA90728A41382699F2046 @@ -74,7 +75,7 @@ - + UnitsNet.Serialization.JsonNet - 4.0.0-beta1 + 4.0.0-beta2 Andreas Gullberg Larsen Units.NET Serialization with Json.NET A helper library for serializing and deserializing types in Units.NET using Json.NET. From 23af7a90dff42d11f18493ab7e746679d7d5afa4 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 16 Nov 2018 15:56:39 +0100 Subject: [PATCH 126/131] UnitsNet: 4.0.0-beta2 --- .../UnitsNet.WindowsRuntimeComponent.nuspec | 2 +- UnitsNet/UnitsNet.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec index f32b61b129..d39cbb50b2 100644 --- a/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec +++ b/UnitsNet.WindowsRuntimeComponent/UnitsNet.WindowsRuntimeComponent.nuspec @@ -2,7 +2,7 @@ UnitsNet.WindowsRuntimeComponent - 4.0.0-beta1 + 4.0.0-beta2 Units.NET - Windows Runtime Component Andreas Gullberg Larsen Andreas Gullberg Larsen diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index c98a4e25df..d1fe305e5f 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -2,7 +2,7 @@ UnitsNet - 4.0.0-beta1 + 4.0.0-beta2 Andreas Gullberg Larsen Units.NET Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested. From 831efcce9db17c35efa05d1ca8f32a77653e166d Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 16 Nov 2018 16:28:07 +0100 Subject: [PATCH 127/131] Improve clean script, add test script --- Build/Test.ps1 | 17 +++++++++++++++++ Build/clean.bat | 4 ---- Build/clean.ps1 | 31 +++++++++++++++++++++++++------ clean.bat | 4 ++++ test.bat | 5 +++++ 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 Build/Test.ps1 delete mode 100644 Build/clean.bat create mode 100644 clean.bat create mode 100644 test.bat diff --git a/Build/Test.ps1 b/Build/Test.ps1 new file mode 100644 index 0000000000..9458d0934b --- /dev/null +++ b/Build/Test.ps1 @@ -0,0 +1,17 @@ +$root = Resolve-Path $PSScriptRoot/.. + +[int]$exitCode = 0 + +# When this change is made available, we can possibly simplify below with: `dotnet test MySolution.sln` +# Run tests only for test projects by smadala · Pull Request #1745 · Microsoft/vstest +# https://github.com/Microsoft/vstest/pull/1745 +Get-ChildItem -Path $root -Recurse -Filter "*Tests*.csproj" | % { + $projectFilePath = $_.FullName + $projectName = [IO.Path]::GetFileNameWithoutExtension($projectFilePath) + $reportFilePath = [IO.Path]::GetFullPath("$root/TestResults/$projectName.xml") + dotnet test $projectFilePath --logger "trx;LogFileName=$reportFilePath" + if ($LASTEXITCODE) { $exitCode = $LASTEXITCODE } +} + +Write-Host -ForegroundColor Green "All tests run." +exit $exitCode \ No newline at end of file diff --git a/Build/clean.bat b/Build/clean.bat deleted file mode 100644 index 30744fa48f..0000000000 --- a/Build/clean.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -SET scriptdir=%~dp0 -call powershell -NoProfile %scriptdir%\clean.ps1 -if %errorlevel% neq 0 exit /b %errorlevel% \ No newline at end of file diff --git a/Build/clean.ps1 b/Build/clean.ps1 index dd6b04a8ef..e1d6b46077 100644 --- a/Build/clean.ps1 +++ b/Build/clean.ps1 @@ -1,8 +1,27 @@ +# Don't allow using undeclared variables +Set-Strictmode -version latest + $root = "$PSScriptRoot\.." -$artifactsDir = "$root\Artifacts" -if (test-path $artifactsDir) { - write-host -foreground blue "Delete Artifacts dir" - rm -r -fo $artifactsDir -ErrorAction Continue +Write-Host -Foreground Blue "Delete dirs: bin, obj" + +[int]$deleteCount = 0 +[array]$failedToDeleteDirs = @() +Get-ChildItem $root -Include bin,obj -Recurse -Force | %{ + Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $_.FullName + if ($?) { $deleteCount++ } + else { + $failedToDeleteDirs += $_ + } } -write-host -foreground blue "Delete dirs: bin, obj" -ls $root -inc bin,obj -r -fo | ri -r -fo -ErrorAction SilentlyContinue \ No newline at end of file + +Write-Host -Foreground Green "Deleted $deleteCount folders." + +if ($failedToDeleteDirs) { + $failCount = $failedToDeleteDirs.Count + Write-Host "" + Write-Host -Foreground Red "Failed to delete $failCount dirs:" + $failedToDeleteDirs | %{ + Write-Host -Foreground Red $_.FullName + } + exit /B 1 +} \ No newline at end of file diff --git a/clean.bat b/clean.bat new file mode 100644 index 0000000000..b8b7e8be43 --- /dev/null +++ b/clean.bat @@ -0,0 +1,4 @@ +@echo off +SET root=%~dp0 +powershell -NoProfile "%root%/Build/Clean.ps1" +if %errorlevel% neq 0 exit /b %errorlevel% \ No newline at end of file diff --git a/test.bat b/test.bat new file mode 100644 index 0000000000..cddb2d7d07 --- /dev/null +++ b/test.bat @@ -0,0 +1,5 @@ +@echo off +SET root=%~dp0 + +powershell -NoProfile %root%/Build/Test.ps1 +if %errorlevel% neq 0 exit /b %errorlevel% \ No newline at end of file From 85dea04eb73b3b38c51e9ec1756bf0672762c5a8 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Fri, 16 Nov 2018 16:31:27 +0100 Subject: [PATCH 128/131] fixup! Merge remote-tracking branch 'origin/master' into v4 --- .../Quantities/MassFlow.Common.g.cs | 847 --- .../Quantities/VolumeFlow.Common.g.cs | 1036 ---- .../Number/NumberToMassFlowExtensions.g.cs | 247 - .../Number/NumberToVolumeFlowExtensions.g.cs | 346 -- .../GeneratedCode/UnitSystem.Default.g.cs | 4852 ----------------- 5 files changed, 7328 deletions(-) delete mode 100644 Common/GeneratedCode/Quantities/MassFlow.Common.g.cs delete mode 100644 Common/GeneratedCode/Quantities/VolumeFlow.Common.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToMassFlowExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/Extensions/Number/NumberToVolumeFlowExtensions.g.cs delete mode 100644 UnitsNet/GeneratedCode/UnitSystem.Default.g.cs diff --git a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs b/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs deleted file mode 100644 index d60a2c5d4a..0000000000 --- a/Common/GeneratedCode/Quantities/MassFlow.Common.g.cs +++ /dev/null @@ -1,847 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by \generate-code.bat. -// -// Changes to this file will be lost when the code is regenerated. -// The build server regenerates the code before each build and a pre-build -// step will regenerate the code on each local build. -// -// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. -// -// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. -// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior. -// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities. -// -// -//------------------------------------------------------------------------------ - -// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). -// https://github.com/angularsen/UnitsNet -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Linq; -using JetBrains.Annotations; -using UnitsNet.Units; - -// ReSharper disable once CheckNamespace - -namespace UnitsNet -{ - ///

- private const double StoneToPounds = 14; + private const double StonesInOnePound = 14.0; /// /// Converts the mass to a customary stone/pounds combination. @@ -59,11 +59,12 @@ public StonePounds StonePounds { get { - double totalPounds = Pounds; - double wholeStone = Math.Floor(totalPounds/StoneToPounds); - double pounds = totalPounds%StoneToPounds; + var inPounds = Pounds; - return new StonePounds(wholeStone, pounds); + var stones = Math.Truncate(inPounds / StonesInOnePound); + var pounds = inPounds % StonesInOnePound; + + return new StonePounds(stones, pounds); } } @@ -72,7 +73,7 @@ public StonePounds StonePounds /// public static Mass FromStonePounds(double stone, double pounds) { - return FromPounds(StoneToPounds*stone + pounds); + return FromPounds(StonesInOnePound*stone + pounds); } // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx